From 421efbcbd12439af697346825d09c2f100817c0a Mon Sep 17 00:00:00 2001 From: Xavier Brown Date: Thu, 19 Sep 2024 17:19:15 -0500 Subject: [PATCH] v24.8.1 --- .github/workflows/merge-announce.yml | 20 + .github/workflows/pr-announce.yml | 25 + config/boards/armsom-aim7-io.csc | 21 + config/boards/ayn-odin2.eos | 155 + config/boards/bananapi.conf | 15 + config/boards/gateway-gz80x.conf | 19 + config/boards/nanopct6.conf | 107 + config/boards/nanopim4v2.conf | 35 + config/boards/odroidc4.conf | 11 + config/boards/odroidhc4.conf | 112 + config/boards/pinebook-pro.csc | 42 + config/boards/retro-lite-cm5.csc | 26 + config/boards/rk3328-heltec.csc | 13 + config/boards/rock-3a.conf | 15 + config/boards/rockpro64.csc | 78 + config/boards/x96q.tvb | 11 + config/boards/youyeetoo-r1-v3.wip | 53 + config/bootenv/rk356x.txt | 4 + .../kernel/linux-rockchip-rk3588-6.11.config | 11042 ++++ config/sources/families/meson-axg.conf | 23 + config/sources/git_sources.json | 202 + ...-cpuinfo-consistent-on-arm64-and-arm.patch | 29 + ...atform-selection-brcm-soc-support.disabled | 22 + .../bcm2711-6.10/1003-remote-wakeup.patch | 193 + .../bcm2711-6.10/2001-rename-msd.patch | 50 + patch/kernel/archive/imx6-6.10/.placeholder | 0 ...meson8b-usb2-Add-support-for-reading.patch | 46 + ...n8b-usb2-Add-support-for-reading-the.patch | 102 + ...onn-gpio-Fall-back-to-polling-the-GP.patch | 146 + ...register-child-USB-connector-devices.patch | 49 + ...d-GPIO-controller-capabilities-to-th.patch | 30 + ...odroidc1-Enable-the-Micro-USB-OTG-co.patch | 74 + ...Add-bindings-for-the-Amlogic-Meson-C.patch | 104 + ...a-new-driver-for-the-CVBS-DAC-CVBS-P.patch | 445 + ...lay-meson-vpu-Add-the-CVBS-DAC-prope.patch | 48 + ...pport-for-using-a-PHY-for-the-CVBS-D.patch | 317 + ...k-meson8b-Add-the-RMII-reference-clo.patch | 30 + ...k-meson8b-Add-the-Meson8-Ethernet-RM.patch | 30 + ...b-Add-the-Ethernet-RMII-clock-tree-o.patch | 162 + ...dwmac-meson-Add-the-Ethernet-clock-i.patch | 52 + ...mac-meson-Rename-the-SPEED_100-macro.patch | 44 + ...wmac-meson-Manage-the-ethernet-clock.patch | 117 + ...-meson-Initialize-all-known-PREG_ETH.patch | 76 + ...son8-Add-the-clock-input-to-the-Ethe.patch | 34 + ...k-meson8b-add-the-rtc_32k-oscillator.patch | 29 + ...son8b-Add-the-mpeg_rtc_osc_sel-clock.patch | 108 + ...d-address-cells-size-cells-and-range.patch | 84 + ...ware-Document-the-Amlogic-Meson6-8-8.patch | 75 + ...cpus-Document-Meson8-TrustZone-firmw.patch | 31 + ...d-support-for-the-TrustZone-firmware.patch | 436 + ...p-Add-support-for-SoCs-running-on-Tr.patch | 75 + ...n-mx-socinfo-Add-support-for-the-Tru.patch | 68 + ...fuse-Add-support-for-the-TrustZone-f.patch | 73 + ...on8-Add-the-PWM_C-DV9-and-PWM_D-pins.patch | 45 + ...lay-meson-vpu-add-support-for-Meson8.patch | 32 + ...son8-Meson8b-Meson8m2-specific-vpu_c.patch | 39 + ...-bits-per-pixel-for-the-framebuffer-.patch | 66 + ...separate-list-of-supported-formats-f.patch | 83 + ...IU_OSD1_CTRL_STAT2-alpha-replace-val.patch | 52 + ...-the-RGB-to-YUV-converter-on-Meson8-.patch | 34 + ...-meson_vpu_init-to-work-with-Meson8-.patch | 84 + ...be-the-HDMI-PHY-frequency-limits-of-.patch | 56 + ...e-the-HDMI-encoder-for-Meson8-8b-8m2.patch | 144 + ...set-ycbcr_420_allowed-on-64-bit-SoCs.patch | 34 + ...-Make-the-HHI-registers-optional-WIP.patch | 100 + ...pport-for-the-Meson8-8b-8m2-TranSwit.patch | 2131 + ...on-Meson8-Meson8b-Meson8m2-VCLK-HACK.patch | 458 + ...-support-for-Meson8-Meson8b-Meson8m2.patch | 52 + .../0059-ARM-dts-meson-add-the-VPU-WiP.patch | 272 + ...s-meson8-add-the-HDMI-controller-WiP.patch | 125 + ...8-Add-the-shared-CMA-dma-memory-pool.patch | 36 + ...meson8-add-the-AO-CEC-controller-WiP.patch | 50 + ...-meson8b-add-the-HDMI-controller-WiP.patch | 120 + ...eson8b-add-the-AO-CEC-controller-WiP.patch | 50 + ...odroid-c1-enable-HDMI-for-the-Odroid.patch | 106 + ...-clock-speed-before-sending-HS-CMD13.patch | 76 + ...-modify-and-simplify-calculation-in-.patch | 39 + .../meson-6.10/onecloud-0001-add-dts.patch | 440 + .../onecloud-0002-dts-Support-HDMI.patch | 96 + .../meson64-6.10/0000.patching_config.yaml | 38 + .../board-bananapi-cm4-cm4io.patch | 77 + .../meson64-6.10/board-bananapi-m2s.patch | 62 + ...01-sd-use-270-mmc-clock-phase-via-dt.patch | 45 + ...d-bananapim5-002-add-wifi-bt-support.patch | 112 + ...oard-bananapism1-add-uart_A-and-AO_B.patch | 85 + ...ard-khadas-vim3-fix-missing-i2c3-nod.patch | 37 + ...ard-khadas-vims-add-rtc-vrtc-aliases.patch | 58 + .../board-nanopi-k2-add-uartC-alias.patch | 26 + .../board-nanopi-k2-enable-emmc.patch | 35 + .../board-odroidc2-add-uartA-uartC.patch | 50 + .../board-odroidc2-enable-SPI.patch | 52 + .../board-odroidc2-enable-scpi-dvfs.patch | 27 + ...sable-autosuspend-for-Genesys-Logic-.patch | 33 + .../meson64-6.10/board-odroidc4-reset.patch | 35 + .../board-odroidhc4-enable-fan1_input.patch | 29 + ...ard-odroidn2plus-Add-missing-CPU-opp.patch | 46 + ...s-add-aliases-for-serial-i2c-and-spi.patch | 36 + ...add-support-for-the-usb-c-controller.patch | 104 + ...-dts-slow-down-sdio-for-working-wifi.patch | 29 + .../board-t95z-add-rc-remote-keymap.patch | 153 + .../driver-power-meson64-reset.patch | 236 + .../drv-spi-spidev-remove-warnings.patch | 41 + .../dt/meson-axg-amper-gateway-am-gz80x.dts | 87 + .../dt/meson-g12-enable-spinor.dtsi | 13 + .../dt/meson-g12a-radxa-zero-spidev.dts | 29 + .../meson-g12b-a311d-khadas-vim3-spidev.dts | 29 + .../meson-g12b-a311d-khadas-vim3-spinor.dts | 11 + .../dt/meson-g12b-odroid-n2-plus-spidev.dts | 21 + .../dt/meson-g12b-odroid-n2-plus-spinor.dts | 11 + .../dt/meson-g12b-odroid-n2-spinor.dts | 11 + .../dt/meson-g12b-radxa-zero2-spidev.dts | 29 + .../dt/meson-g12b-waveshare-cm4-io-base-b.dts | 64 + .../dt/meson-gxm-mini-m8s-pro.dts | 91 + .../meson64-6.10/dt/meson-gxm-t95z-plus.dts | 166 + .../meson-sm1-jethome-jethub-j200-spinor.dts | 11 + .../dt/meson-sm1-jethome-jethub-j200.dts | 705 + .../dt/meson-sm1-khadas-vim3l-spidev.dts | 29 + .../dt/meson-sm1-khadas-vim3l-spinor.dts | 11 + .../dt/meson-sm1-odroid-c4-spidev.dts | 24 + .../meson64-6.10/dt/meson-sm1-ugoos-x3.dts | 293 + ...eral-add-Amlogic-Meson-GX-PM-Suspend.patch | 134 + ...eral-add-overlay-compilation-support.patch | 64 + ...isplay-add-support-for-Titanmec-TM16.patch | 585 + ...hdmi-call-hdmi_set_cts_n-after-clock.patch | 30 + ...eral-drm-panfrost-fix-reference-leak.patch | 38 + ...ral-fix-Kodi-sysinfo-CPU-information.patch | 31 + ...add-new-display-resolution-2560x1440.patch | 72 + ...odec-reorder-channel-allocation-list.patch | 202 + ...put-touchscreen-Add-D-WAV-Multitouch.patch | 636 + ...cec-silence-CEC-timeout-message-HACK.patch | 40 + .../general-memory-marked-nomap.patch | 38 + ...aiu-Fix-HDMI-codec-control-selection.patch | 232 + ...c-meson-gx-Add-core-tx-rx-eMMC-SD-SD.patch | 108 + ...s-meson-update-meson-axg-device-tree.patch | 44 + ...pdate-mmc-meson-gx-documentation-for.patch | 51 + ...ral-meson-vdec-add-HEVC-decode-codec.patch | 1608 + ...n-vdec-add-handling-to-HEVC-decoder-.patch | 157 + ...ec-check-if-parser-has-really-parser.patch | 51 + ...n-vdec-improve-mmu-and-fbc-handling-.patch | 587 + .../general-meson64-overlays.patch | 27 + .../general-si2168-fix-cmd-timeout.patch | 28 + ...mlogic-meson-gx-socinfo-Add-S905L-ID.patch | 30 + ...eson-gx-socinfo-add-new-A113X-SoC-id.patch | 29 + ...n-gx-socinfo-move-common-code-to-hea.patch | 339 + ...n-gx-socinfo-sm-Add-Amlogic-secure-m.patch | 275 + ...add-dts-links-to-secure-monitor-for-.patch | 68 + ...amlogic-amlogic-meson-gx-ao-secure-a.patch | 31 + ...soc-remove-mono-channel-as-it-curren.patch | 37 + ...al-spi-nor-add-support-for-XT25F128B.patch | 96 + ...prove-handling-of-hubs-with-no-ports.patch | 53 + .../hwmon-emc2305-fixups-for-driver.patch | 212 + ...gpio-irq-patch-from-https-lkml.org-l.patch | 100 + ...rm64-dts-jethub-j1xx-add-eeprom-node.patch | 54 + ...o-secure-monitor-for-jethub.patch.disabled | 39 + ...amlogic-add-binding-for-JetHome-JetH.patch | 28 + .../kernel-6.8-tools-cgroup-makefile.patch | 41 + ...-g12a-pinctrl-add-missing-ir-options.patch | 91 + ...b-pinctrl-Add-missing-pinmux-for-pwm.patch | 125 + ...x-dts-add-support-for-GX-PM-and-VRTC.patch | 40 + .../meson-gxbb-dts-i2cX-missing-pins.patch | 35 + ...n-gxbb-vdec-add-HEVC-support-to-GXBB.patch | 39 + ...son-set-p212-p23x-q20x-SDIO-to-100MH.patch | 125 + ...eson-gxm-vdec-add-VP9-support-to-GXM.patch | 43 + .../meson-sm1-dts-add-higher-clocks.patch | 34 + .../archive/meson64-6.10/overlay/Makefile | 42 + .../overlay/README.meson-overlays | 20 + .../meson64-6.10/overlay/meson-fixup.scr-cmd | 4 + .../overlay/meson-g12-gxl-cma-pool-896MB.dtso | 19 + .../overlay/meson-g12-pwm-gpiox-5-fan.dtso | 43 + .../meson-g12a-radxa-zero-gpio-10-led.dtso | 26 + .../meson-g12a-radxa-zero-gpio-8-led.dtso | 26 + ...adxa-zero-i2c-ao-m0-gpioao-2-gpioao-3.dtso | 15 + ...-radxa-zero-i2c-ee-m1-gpioh-6-gpioh-7.dtso | 15 + ...adxa-zero-i2c-ee-m1-gpiox-10-gpiox-11.dtso | 15 + ...adxa-zero-i2c-ee-m3-gpioa-14-gpioa-15.dtso | 15 + ...eson-g12a-radxa-zero-pwm-c-on-gpiox-8.dtso | 17 + ...-g12a-radxa-zero-pwmao-a-on-gpioao-11.dtso | 17 + .../meson-g12a-radxa-zero-spi-spidev.dtso | 38 + ...a-zero-uart-ao-a-on-gpioao-0-gpioao-1.dtso | 15 + ...a-zero-uart-ao-b-on-gpioao-2-gpioao-3.dtso | 15 + ...a-zero-uart-ao-b-on-gpioao-8-gpioao-9.dtso | 15 + .../meson-g12a-radxa-zero-uart-ee-c.dtso | 15 + ...son-g12b-bananapi-cm4-pwm-gpioh-5-fan.dtso | 63 + .../meson-g12b-bananapi-m2s-rtl8822cs.dtso | 22 + .../overlay/meson-g12b-odroid-n2-spi.dtso | 23 + .../meson-g12b-waveshare-cm4-io-base-usb.dtso | 20 + .../meson64-6.10/overlay/meson-i2cA.dtso | 17 + .../meson64-6.10/overlay/meson-i2cB.dtso | 17 + .../meson-sm1-bananapi-m5-rtl8822cs.dtso | 22 + .../overlay/meson-sm1-bananapi-uartA.dtso | 15 + .../overlay/meson-sm1-bananapi-uartAO_B.dtso | 14 + .../meson-sm1-bananapi-uartA_cts_rts.dtso | 17 + .../meson-sm1-jethome-jethub-j200-spi.dtso | 19 + .../meson64-6.10/overlay/meson-uartA.dtso | 11 + .../meson64-6.10/overlay/meson-uartC.dtso | 11 + .../meson64-6.10/overlay/meson-w1-gpio.dtso | 20 + .../meson64-6.10/overlay/meson-w1AB-gpio.dtso | 32 + .../dt/meson-axg-amper-gateway-am-gz80x.dts | 87 + .../09-pci-link-retraining.patch.disabled | 219 + ...-libata-add-ledtrig-support.patch.disabled | 136 + ...Enable-ATA-port-LED-trigger.patch.disabled | 30 + ...-mvebu-gpio-add_wake_on_gpio_support.patch | 88 + ...-hardcoded-timer-assignment.patch.disabled | 411 + ...-helios4-dts-add-wake-on-lan-support.patch | 21 + .../compile-dtb-with-symbol-support.patch | 12 + ...s-disable-spi-flash-on-a388-microsom.patch | 10 + ..._DMA_block_memory_allocation_to_2048.patch | 11 + ...lock_atheros_regulatory_restrictions.patch | 70 + .../odroidxu4-6.6/patch-6.6.44-45.patch | 5821 ++ .../odroidxu4-6.6/patch-6.6.45-46.patch | 6300 ++ .../odroidxu4-6.6/patch-6.6.46-47.patch | 4211 ++ .../rockchip-6.10/0000.patching_config.yaml | 35 + .../archive/rockchip-6.10/armbian.series | 53 + .../archive/rockchip-6.10/dt/rk322x-box.dts | 782 + .../rockchip-6.10/dt/rk3288-xt-q8l-v10.dts | 1128 + .../kernel-6.8-tools-cgroup-makefile.patch | 17 + .../archive/rockchip-6.10/libreelec.series | 9 + .../archive/rockchip-6.10/overlay/Makefile | 54 + .../overlay/README.rk322x-overlays | 98 + .../overlay/README.rockchip-overlays | 78 + .../overlay/rk322x-bt-8723cs.dtso | 19 + .../overlay/rk322x-cpu-hs-lv.dtso | 68 + .../rockchip-6.10/overlay/rk322x-cpu-hs.dtso | 28 + .../overlay/rk322x-cpu-stability.dtso | 52 + .../overlay/rk322x-ddr3-330.dtso | 28 + .../overlay/rk322x-ddr3-528.dtso | 28 + .../overlay/rk322x-ddr3-660.dtso | 28 + .../overlay/rk322x-ddr3-800.dtso | 28 + .../overlay/rk322x-emmc-ddr-ph180.dtso | 14 + .../overlay/rk322x-emmc-ddr-ph45.dtso | 14 + .../overlay/rk322x-emmc-hs200.dtso | 13 + .../overlay/rk322x-emmc-pins.dtso | 34 + .../rockchip-6.10/overlay/rk322x-emmc.dtso | 20 + .../overlay/rk322x-fixup.scr-cmd | 4 + .../overlay/rk322x-ir-wakeup.dtso | 16 + .../overlay/rk322x-led-conf-default.dtso | 22 + .../overlay/rk322x-led-conf1.dtso | 64 + .../overlay/rk322x-led-conf2.dtso | 64 + .../overlay/rk322x-led-conf3.dtso | 64 + .../overlay/rk322x-led-conf4.dtso | 96 + .../overlay/rk322x-led-conf5.dtso | 97 + .../overlay/rk322x-led-conf6.dtso | 96 + .../overlay/rk322x-led-conf7.dtso | 180 + .../overlay/rk322x-led-conf8.dtso | 109 + .../rockchip-6.10/overlay/rk322x-nand.dtso | 22 + .../overlay/rk322x-usb-otg-peripheral.dtso | 11 + .../overlay/rk322x-wlan-alt-wiring.dtso | 67 + .../overlay/rockchip-ds1307.dtbo | Bin 0 -> 485 bytes .../overlay/rockchip-ds1307.dtso | 23 + .../overlay/rockchip-fixup.scr-cmd | 4 + .../rockchip-6.10/overlay/rockchip-i2c1.dtbo | Bin 0 -> 262 bytes .../rockchip-6.10/overlay/rockchip-i2c1.dtso | 16 + .../rockchip-6.10/overlay/rockchip-i2c4.dtbo | Bin 0 -> 262 bytes .../rockchip-6.10/overlay/rockchip-i2c4.dtso | 16 + .../rockchip-6.10/overlay/rockchip-spi0.dtbo | Bin 0 -> 262 bytes .../rockchip-6.10/overlay/rockchip-spi0.dtso | 16 + .../rockchip-6.10/overlay/rockchip-spi2.dtbo | Bin 0 -> 262 bytes .../rockchip-6.10/overlay/rockchip-spi2.dtso | 16 + .../overlay/rockchip-spidev0.dtbo | Bin 0 -> 572 bytes .../overlay/rockchip-spidev0.dtso | 35 + .../overlay/rockchip-spidev2.dtbo | Bin 0 -> 572 bytes .../overlay/rockchip-spidev2.dtso | 35 + .../rockchip-6.10/overlay/rockchip-uart1.dtbo | Bin 0 -> 263 bytes .../rockchip-6.10/overlay/rockchip-uart1.dtso | 16 + .../rockchip-6.10/overlay/rockchip-uart2.dtbo | Bin 0 -> 263 bytes .../rockchip-6.10/overlay/rockchip-uart2.dtso | 16 + .../rockchip-6.10/overlay/rockchip-uart3.dtbo | Bin 0 -> 263 bytes .../rockchip-6.10/overlay/rockchip-uart3.dtso | 16 + .../rockchip-6.10/overlay/rockchip-uart4.dtbo | Bin 0 -> 263 bytes .../rockchip-6.10/overlay/rockchip-uart4.dtso | 16 + .../overlay/rockchip-w1-gpio.dtbo | Bin 0 -> 487 bytes .../overlay/rockchip-w1-gpio.dtso | 23 + .../bt-broadcom-serdev-workaround.patch | 27 + .../clk-rk322x-composite-mmc-clk.patch | 38 + .../clk-rockchip-max-frac-divider.patch | 1536 + .../driver-rk322x-audio-codec.patch | 914 + .../driver-rk3288-gpiomem.patch | 395 + .../driver-tinkerboard-alc4040-codec.patch | 19 + .../drm-rk322x-plane-overlay.patch | 66 + .../drm-rk322x-yuv-10bit-modes.patch | 44 + .../drm-rockchip-hardware-cursor.patch | 358 + .../patches.armbian/dts-miqi-fan.patch | 45 + .../patches.armbian/dts-miqi-hevc-rga.patch | 42 + .../patches.armbian/dts-miqi-mali-gpu.patch | 35 + .../dts-miqi-regulator-fix.patch | 45 + .../patches.armbian/dts-rk322x-iep-node.patch | 34 + .../dts-rk322x-pinctrl-nand.patch | 93 + .../dts-rk3288-disable-serial-dma.patch | 40 + .../dts-rk3288-fix-mmc-aliases.patch | 20 + .../dts-rk3288-gpu-500mhz-opp.patch | 42 + .../dts-rk3288-pinctrl-spi2.patch | 31 + .../dts-rk3288-thermal-rearrange-zones.patch | 32 + .../dts-tinkerboard-bt-rtl8723bs.patch | 34 + .../dts-tinkerboard-bt-uart-pins.patch | 62 + .../dts-tinkerboard-hevc-rga.patch | 43 + .../dts-tinkerboard-sdio-wifi.patch | 98 + .../dts-tinkerboard-sdmmc-properties.patch | 33 + .../dts-tinkerboard-spi-interface.patch | 50 + .../dts-veyron-flag-cache-flush.patch | 32 + ...eral-add-overlay-compilation-support.patch | 64 + .../general-add-overlay-configfs.patch | 358 + ...eral-add-restart-handler-for-act8846.patch | 71 + .../general-dwc2-fix-wait-peripheral.patch | 26 + .../general-dwc2-fix-wait-time.patch | 56 + .../general-dwc2-nak-gadget.patch | 88 + .../general-fix-reboot-from-kwiboo.patch | 19 + ...eral-linux-export-mm-trace-rss-stats.patch | 24 + .../general-rk322x-gpio-ir-driver.patch | 786 + .../general-rockchip-various-fixes.patch | 770 + .../ir-keymap-rk322x-box.patch | 119 + .../ir-keymap-xt-q8l-v10.patch | 118 + .../misc-tinkerboard-spi-interface.patch | 20 + .../mmc-tinkerboard-sdmmc-reboot-fix.patch | 116 + .../rk322x-dmc-driver-01-sipv2-calls.patch | 234 + .../rk322x-dmc-driver-02-sip-constants.patch | 67 + .../rk322x-dmc-driver-03-dfi-driver.patch | 199 + .../rk322x-dmc-driver-04-driver.patch | 1155 + .../rk322x-dwc2-no-clock-gating.patch | 27 + .../rk322x-usb-reset-props.patch | 75 + .../wifi-ath9k-no-bulk-EP3-EP4.patch | 102 + .../wifi-brcmfmac-add-bcm43342.patch | 45 + .../wifi-brcmfmac-ap6330-firmware.patch | 23 + .../patches.armbian/wifi-driver-esp8089.patch | 10931 ++++ .../patches.armbian/wifi-driver-ssv6051.patch | 49482 ++++++++++++++++ .../linux-0002-rockchip-from-list.patch | 131 + .../linux-0011-v4l2-from-list.patch | 659 + .../linux-1000-drm-rockchip.patch | 2956 + .../linux-1001-v4l2-rockchip.patch | 506 + .../linux-1002-for-libreelec.patch | 688 + .../linux-1003-temp-dw_hdmi-rockchip.patch | 63 + .../linux-2000-v4l2-wip-rkvdec-hevc.patch | 3226 + .../linux-2001-v4l2-wip-iep-driver.patch | 1805 + .../kernel/archive/rockchip-6.10/series.conf | 62 + ...nopsys-designware-hdmi-rx-controller.patch | 3770 ++ .../overlay/rockchip-rk3588-hdmirx.dtso | 20 + .../rk3588-rock-5b_dts_add_rfkill-bt.patch | 31 + .../0000.patching_config.yaml | 47 + .../0001-general-add-overlay-support.patch | 69 + .../0010-fix-clk-divisions.patch | 142 + .../0011-irqchip-fix-its-timeout-issue.patch | 214 + .../0024-RK3588-Add-Crypto-Support.patch | 2322 + .../0025-RK3588-Add-HW-RNG-Support.patch | 663 + ...588-Add-VPU121-H.264-Decoder-Support.patch | 395 + .../0027-RK3588-Add-rkvdec2-Support-v3.patch | 3887 ++ ...Initialize-h264-frame_mbs_only_flag-.patch | 43 + ...64-dts-rockchip-rk3588-add-RGA2-node.patch | 34 + ...nopsys-designware-hdmi-rx-controller.patch | 3967 ++ ...chip-samsung-hdptx-Enable-runtime-PM.patch | 123 + ...hip-samsung-hdptx-Add-clock-provider.patch | 323 + ...p-samsung-hdptx-Add-FRL-EARC-support.patch | 547 + ...-vop2-Improve-display-modes-handling.patch | 715 + ...itial-support-for-DW-HDMI-Controller.patch | 2603 + ...kchip-Add-HDMI0-bridge-CLK-to-rk3588.patch | 94 + ...ckchip-vop2-add-clocks-reset-support.patch | 187 + .../0801-wireless-add-bcm43752.patch | 74 + .../0802-wireless-add-clk-property.patch | 51 + ...b-Slow-down-emmc-to-hs200-and-add-ts.patch | 37 + ...dts-rockchip-Enable-HDMI0-on-rock-5b.patch | 67 + ...-Make-use-of-HDMI0-PHY-PLL-on-rock5b.patch | 41 + .../1020-Add-HDMI-and-VOP2-to-Rock-5A.patch | 57 + ...rm64-dts-enable-gpu-node-for-rock-5a.patch | 36 + ...dd-missing-nodes-to-Orange-Pi-5-Plus.patch | 322 + ...ip-add-PCIe-for-M.2-E-Key-to-rock-5a.patch | 39 + ...hip-Add-HDMI-support-to-ArmSoM-Sige7.patch | 64 + ...ip-Add-ap6275p-wireless-support-to-A.patch | 39 + .../1040-board-khadas-edge2-add-nodes.patch | 359 + .../1041-board-khadas-edge2-mcu.patch | 441 + ...dts-rockchip-Add-NanoPC-T6-SPI-Flash.patch | 38 + .../dt/rk3588-bananapi-m7.dts | 10 + .../dt/rk3588-hinlink-h88k.dts | 858 + .../dt/rk3588-mixtile-blade3.dts | 712 + .../dt/rk3588-nanopc-cm3588-nas.dts | 1436 + .../dt/rk3588s-nanopi-r6c.dts | 19 + .../dt/rk3588s-nanopi-r6s.dts | 865 + .../dt/rk3588s-orangepi-5.dts | 814 + .../dt/rk3588s-orangepi-5b.dts | 48 + .../dt/rk3588s-rock-5c.dts | 825 + .../rockchip-rk3588-6.11/overlay/Makefile | 46 + .../overlay/rockchip-rk3588-hdmirx.dtso | 20 + .../overlay/rockchip-rk3588-i2c8-m2.dtso | 14 + .../overlay/rockchip-rk3588-pwm0-m0.dtso | 14 + .../overlay/rockchip-rk3588-pwm0-m1.dtso | 13 + .../overlay/rockchip-rk3588-pwm0-m2.dtso | 13 + .../overlay/rockchip-rk3588-pwm1-m0.dtso | 14 + .../overlay/rockchip-rk3588-pwm1-m1.dtso | 13 + .../overlay/rockchip-rk3588-pwm1-m2.dtso | 13 + .../overlay/rockchip-rk3588-pwm10-m0.dtso | 13 + .../overlay/rockchip-rk3588-pwm11-m0.dtso | 13 + .../overlay/rockchip-rk3588-pwm11-m1.dtso | 21 + .../overlay/rockchip-rk3588-pwm12-m0.dtso | 13 + .../overlay/rockchip-rk3588-pwm13-m0.dtso | 13 + .../overlay/rockchip-rk3588-pwm13-m2.dtso | 13 + .../overlay/rockchip-rk3588-pwm14-m0.dtso | 14 + .../overlay/rockchip-rk3588-pwm14-m1.dtso | 14 + .../overlay/rockchip-rk3588-pwm14-m2.dtso | 13 + .../overlay/rockchip-rk3588-pwm15-m0.dtso | 21 + .../overlay/rockchip-rk3588-pwm15-m1.dtso | 13 + .../overlay/rockchip-rk3588-pwm15-m2.dtso | 13 + .../overlay/rockchip-rk3588-pwm15-m3.dtso | 21 + .../overlay/rockchip-rk3588-pwm2-m1.dtso | 21 + .../overlay/rockchip-rk3588-pwm3-m0.dtso | 13 + .../overlay/rockchip-rk3588-pwm3-m1.dtso | 21 + .../overlay/rockchip-rk3588-pwm3-m2.dtso | 13 + .../overlay/rockchip-rk3588-pwm3-m3.dtso | 13 + .../overlay/rockchip-rk3588-pwm5-m2.dtso | 21 + .../overlay/rockchip-rk3588-pwm6-m0.dtso | 21 + .../overlay/rockchip-rk3588-pwm6-m2.dtso | 21 + .../overlay/rockchip-rk3588-pwm7-m0.dtso | 21 + .../overlay/rockchip-rk3588-pwm7-m3.dtso | 21 + .../overlay/rockchip-rk3588-pwm8-m0.dtso | 21 + .../overlay/rockchip-rk3588-sata1.dtso | 20 + .../overlay/rockchip-rk3588-sata2.dtso | 20 + .../overlay/rockchip-rk3588-uart1-m1.dtso | 13 + .../overlay/rockchip-rk3588-uart3-m1.dtso | 13 + .../overlay/rockchip-rk3588-uart4-m2.dtso | 13 + .../overlay/rockchip-rk3588-uart6-m1.dtso | 13 + .../overlay/rockchip-rk3588-uart7-m2.dtso | 13 + .../overlay/rockchip-rk3588-uart8-m1.dtso | 13 + .../rockchip64-6.10/0000.patching_config.yaml | 37 + .../add-board-fine3399-dts.patch | 876 + .../rockchip64-6.10/add-board-helios64.patch | 1038 + .../add-board-xiaobao-nas-dts.patch | 779 + .../board-firefly-rk3399-dts.patch | 282 + ...rd-helios64-dts-fix-stability-issues.patch | 72 + .../board-helios64-remove-pcie-ep-gpios.patch | 25 + .../board-nanopc-t4-add-typec-dp.patch | 147 + ...board-nanopi-m4v2-dts-add-sound-card.patch | 190 + .../board-nanopi-r2c-plus.patch | 30 + .../rockchip64-6.10/board-nanopi-r2s.patch | 735 + .../board-nanopi-r4s-pwmfan.patch | 58 + .../board-orangepi-r1-plus.patch | 216 + .../board-orangepi-rk3399-pcie.patch | 68 + .../board-pbp-add-dp-alt-mode.patch | 421 + .../board-radxa-e25-sdmmc0-fix.patch | 35 + .../board-radxa-e25-usb3-and-emmc-fix.patch | 64 + .../board-rk3328-roc-cc-dts-enable-dmc.patch | 75 + .../board-rk3328-roc-cc-dts-ram-profile.patch | 330 + .../board-rk3328-roc-pc-dts-ram-profile.patch | 301 + .../rockchip64-6.10/board-rk3328-roc-pc.patch | 593 + .../board-rock3a-emmc-sfc.patch | 54 + .../rockchip64-6.10/board-rock3a-usb3.patch | 44 + .../board-rock64-mail-supply.patch | 29 + .../board-rockpi3-enable-dmc.patch | 44 + .../board-rockpi4-0003-arm64-dts-pcie.patch | 130 + ...oard-rockpis-0001-arm64-dts.patch.disabled | 408 + ...s-rk3308-Add-gmac-node-at-dtsi-level.patch | 24 + ...ip-add-cpu-s-thermal-config-for-rk33.patch | 87 + ...ockchip-add-tsadc-support-for-rk3308.patch | 71 + ...chip-add-i2s_8ch-for-rk3308.patch.disabled | 126 + ...12-arm64-dts-rk3308-Add-rk-timer-rtc.patch | 32 + ...K3308-internal-codec-driver.patch.disabled | 2638 + ...nc-rk3308_codec-to-BSP-tree.patch.disabled | 6738 +++ ...-Add-acodec-node-for-rk3308.patch.disabled | 50 + ...-replace-codec-to-component.patch.disabled | 459 + ...027-arm64-dts-rk3308-add-otp-cpuinfo.patch | 115 + ...s-rk3308-add-reserved-memory-ramoops.patch | 99 + ...ckpro64-0001-Add-pcie-bus-scan-delay.patch | 64 + ...d-rockpro64-change-rx_delay-for-gmac.patch | 26 + .../board-rockpro64-fix-emmc.patch | 123 + ...board-rockpro64-fix-spi1-flash-speed.patch | 105 + .../board-rockpro64-work-led-heartbeat.patch | 95 + .../board-rocks0-0001-deviceTree.patch | 366 + .../rockchip64-6.10/board-station-p2.patch | 580 + .../drv-spi-spidev-remove-warnings.patch | 41 + .../dt/rk3308-sakurapi-rk3308b.dts | 226 + .../archive/rockchip64-6.10/dt/rk3318-box.dts | 1007 + .../rockchip64-6.10/dt/rk3328-heltec.dts | 288 + .../dt/rk3328-nanopi-neo3-rev02.dts | 195 + .../dt/rk3328-nanopi-r2-rev00.dts | 126 + .../dt/rk3328-nanopi-r2-rev06.dts | 92 + .../dt/rk3328-nanopi-r2-rev20.dts | 39 + .../dt/rk3328-orangepi-r1-plus-lts.dts | 449 + .../rockchip64-6.10/dt/rk3328-z28pro.dts | 1 + .../rockchip64-6.10/dt/rk3399-fine3399.dts | 797 + .../rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts | 87 + .../rockchip64-6.10/dt/rk3399-nanopi-r4se.dts | 17 + .../dt/rk3399-orangepi-4-lts.dts | 1334 + .../rockchip64-6.10/dt/rk3399-orangepi-4.dts | 1194 + .../rockchip64-6.10/dt/rk3399-rock-pi-4.dts | 1 + .../rockchip64-6.10/dt/rk3399-rock-pi-4c.dts | 69 + .../rockchip64-6.10/dt/rk3399-tinker-2.dts | 751 + .../rockchip64-6.10/dt/rk3399-xiaobao-nas.dts | 774 + .../dt/rk3399pro-tinker-edge-r.dts | 1080 + .../dt/rk3566-firefly-roc-pc.dts | 760 + .../rockchip64-6.10/dt/rk3566-jp-tvbox.dts | 579 + .../dt/rk3566-orangepi-3b-sata.dts | 17 + .../rockchip64-6.10/dt/rk3566-orangepi-3b.dts | 869 + .../rockchip64-6.10/dt/rk3566-panther-x2.dts | 579 + .../dt/rk3566-radxa-zero-3.dtsi | 531 + .../dt/rk3566-radxa-zero-3e.dts | 52 + .../dt/rk3566-radxa-zero-3w.dts | 92 + .../rockchip64-6.10/dt/rk3566-rock-3c.dts | 786 + .../dt/rk3568-hinlink-h66k.dts | 21 + .../dt/rk3568-hinlink-h68k.dts | 889 + .../rockchip64-6.10/dt/rk3568-odroid-m1.dts | 775 + .../general-add-miniDP-dt-doc.patch | 133 + .../general-add-miniDP-virtual-extcon.patch | 382 + ...eral-add-overlay-compilation-support.patch | 64 + .../general-add-overlay-configfs.patch | 419 + .../general-add-panel-simple-dsi.patch | 856 + .../general-add-pll-hdmi-timings.patch | 155 + .../general-add-xtx-spi-nor-chips.patch | 82 + .../general-cryptov1-trng.patch | 304 + .../general-disable-mtu-validation.patch | 51 + .../general-fix-es8316-kernel-panic.patch | 105 + .../general-fix-inno-usb2-phy-init.patch | 28 + ...fix-mmc-signal-voltage-before-reboot.patch | 46 + .../general-hdmi-clock-fixes.patch | 523 + ..._DMA_block_memory_allocation_to_2048.patch | 21 + .../general-legacy-rockchip-hwrng.patch | 436 + .../general-legacy-rockchip-hwrng_5.10.patch | 523 + ...l-possibility-of-disabling-rk808-rtc.patch | 51 + .../general-rk3328-dtsi-trb-ent-quirk.patch | 61 + ...08-configurable-switch-voltage-steps.patch | 104 + .../general-rockchip-overlays.patch | 28 + .../general-rt5651-add-mclk.patch | 133 + .../general-v4l2-iep-driver.patch | 1808 + .../general-v4l2-rkvdec-00-fixes.patch | 659 + .../general-v4l2-rkvdec-01-vp9.patch | 493 + .../general-v4l2-rkvdec-02-hevc.patch | 3226 + ...eneral-workaround-broadcom-bt-serdev.patch | 26 + .../kernel-6.8-tools-cgroup-makefile.patch | 17 + .../media-0001-Add-rkvdec2-Support-v3.patch | 1 + ...Initialize-h264-frame_mbs_only_flag-.patch | 1 + ...edia-0003-rk3568-disable-hantro-h264.patch | 63 + ...-r8152-add-LED-configuration-from-OF.patch | 79 + .../archive/rockchip64-6.10/overlay/Makefile | 57 + .../overlay/README.rockchip-overlays | 259 + .../overlay/rk3308-b@1.3ghz.dtso | 27 + .../rockchip64-6.10/overlay/rk3308-bs.dtso | 39 + .../overlay/rk3308-bs@1.3ghz.dtso | 26 + .../rockchip64-6.10/overlay/rk3308-emmc.dtso | 13 + .../overlay/rk3308-s0-ext-antenna.dtso | 48 + .../overlay/rk3308-sdio@10mhz.dtso | 14 + .../overlay/rk3308-sdio@4mhz.dtso | 14 + .../overlay/rockchip-fixup.scr-cmd | 65 + .../overlay/rockchip-rk3318-box-cpu-hs.dtso | 24 + .../overlay/rockchip-rk3318-box-emmc-ddr.dtso | 14 + .../rockchip-rk3318-box-emmc-hs200.dtso | 14 + .../rockchip-rk3318-box-led-conf1.dtso | 49 + .../rockchip-rk3318-box-led-conf2.dtso | 63 + .../rockchip-rk3318-box-led-conf3.dtso | 305 + .../rockchip-rk3318-box-led-conf4.dtso | 38 + .../rockchip-rk3318-box-wlan-ap6330.dtso | 106 + .../rockchip-rk3318-box-wlan-ap6334.dtso | 117 + .../overlay/rockchip-rk3318-box-wlan-ext.dtso | 33 + .../overlay/rockchip-rk3328-i2c0.dtso | 13 + .../overlay/rockchip-rk3328-i2s1-pcm5102.dtso | 104 + .../overlay/rockchip-rk3328-opp-1.4ghz.dtso | 15 + .../overlay/rockchip-rk3328-opp-1.5ghz.dtso | 15 + .../overlay/rockchip-rk3328-spi-spidev.dtso | 33 + .../overlay/rockchip-rk3328-uart1.dtso | 17 + .../overlay/rockchip-rk3399-dwc3-0-host.dtso | 13 + .../overlay/rockchip-rk3399-i2c7.dtso | 11 + .../overlay/rockchip-rk3399-i2c8.dtso | 11 + .../overlay/rockchip-rk3399-opp-2ghz.dtso | 24 + .../overlay/rockchip-rk3399-pcie-gen2.dtso | 12 + .../rockchip-rk3399-spi-jedec-nor.dtso | 72 + .../overlay/rockchip-rk3399-spi-spidev.dtso | 72 + .../overlay/rockchip-rk3399-uart4.dtso | 20 + .../overlay/rockchip-rk3399-w1-gpio.dtso | 20 + .../overlay/rockchip-rk3566-sata2.dtso | 20 + .../overlay/rockchip-rk3568-hk-i2c0.dtso | 14 + .../overlay/rockchip-rk3568-hk-i2c1.dtso | 12 + .../overlay/rockchip-rk3568-hk-pwm1.dtso | 13 + .../overlay/rockchip-rk3568-hk-pwm2.dtso | 13 + .../overlay/rockchip-rk3568-hk-pwm9.dtso | 13 + .../rockchip-rk3568-hk-spi-spidev.dtso | 22 + .../rockchip-rk3568-hk-uart0-rts_cts.dtso | 14 + .../overlay/rockchip-rk3568-hk-uart0.dtso | 13 + .../overlay/rockchip-rk3568-hk-uart1.dtso | 15 + .../rockchip-rk3568-nanopi-r5c-leds.dtso | 11 + .../rockchip-rk3568-nanopi-r5s-leds.dtso | 15 + .../rockchip-rockpi4cplus-usb-host.dtso | 16 + .../overlay/rockchip-rockpro64-lcd.dtso | 58 + ...28-iomux-width-flag-for-GPIO2-B-pins.patch | 13 + .../regulator-add-fan53200-driver.patch | 597 + .../rk3308-0001-pinctrl-slew-mux.patch | 257 + .../rk3308-0002-iodomains.patch | 159 + ...3308-0003-pinctrl-io-voltage-domains.patch | 202 + .../rk3308-add-missing-i2s-controllers.patch | 82 + .../rk3328-add-dmc-driver.patch | 1901 + .../rockchip64-6.10/rk3328-add-rga-node.patch | 37 + .../rk3328-dtsi-mali-opp-table.patch | 48 + .../rk3328-dtsi-mmc-reset-properties.patch | 43 + .../rk3328-dtsi-sdmmc-ext-node.patch | 37 + .../rockchip64-6.10/rk3328-dtsi-spdif.patch | 128 + .../rk3328-dtsi-usb3-reset-properties.patch | 25 + .../rk3328-gpu-cooling-target.patch | 37 + .../rk3328-roc-cc-add-missing-nodes.patch | 79 + .../rk3399-add-sclk-i2sout-src-clock.patch | 98 + .../rk3399-dmc-polling-rate.patch | 35 + ...k3399-enable-dwc3-xhci-usb-trb-quirk.patch | 119 + .../rockchip64-6.10/rk3399-fix-pci-phy.patch | 47 + .../rockchip64-6.10/rk3399-fix-usb-phy.patch | 26 + ...plement-rockchip-PCIe-bus-scan-delay.patch | 181 + .../rk3399-sd-drive-level-8ma.patch | 159 + .../rk3399-sd-pwr-pinctrl.patch | 28 + .../rk3399-unlock-temperature.patch | 127 + .../rk356x-add-rkvdec2-support.patch | 59 + .../rk35xx-montjoie-crypto-v2-rk35xx.patch | 2327 + .../wifi-4003-add-bcm43342-chip.patch | 45 + .../wifi-4003-ssv-6051-driver.patch | 49482 ++++++++++++++++ ...oard-rockpis-0001-arm64-dts.patch.disabled | 406 + .../rockchip64-6.6/board-station-p2.patch | 580 + ...drivers-regulator-fan53555-bug-fixed.patch | 44 + .../rockchip64-6.6/dt/rk3328-heltec.dts | 288 + ...28-iomux-width-flag-for-GPIO2-B-pins.patch | 13 + ...drivers-regulator-fan53555-bug-fixed.patch | 44 + .../rockchip64-6.9/dt/rk3328-heltec.dts | 288 + ...28-iomux-width-flag-for-GPIO2-B-pins.patch | 13 + ...e-ASAP-after-writing-new-instruction.patch | 63 + .../ARM-dts-axp813-Add-charger-LED.patch | 30 + ...Book-Touch-Lux-3-display-ctp-support.patch | 185 + .../ARM-dts-sun5i-Add-soc-handle.patch | 26 + ...book-touch-lux-3-Add-RTC-clock-cells.patch | 27 + .../ARM-dts-sun8i-a83t-Add-MBUS-node.patch | 39 + ...us-video-codec-support-to-A83T-untes.patch | 37 + ...M-dts-sun8i-a83t-Add-hdmi-sound-card.patch | 48 + ...un8i-a83t-Add-missing-GPU-trip-point.patch | 35 + ...-hdmi-sound-card-on-boards-with-hdmi.patch | 69 + ...prove-CPU-OPP-tables-go-up-to-1.8GHz.patch | 134 + ...s-sun8i-a83t-Set-fifo-size-for-uarts.patch | 59 + ...-a83t-tbs-a711-Add-PN544-NFC-support.patch | 66 + ...711-Add-camera-sensors-HM5065-GC2145.patch | 180 + ...-a83t-tbs-a711-Add-flash-led-support.patch | 32 + ...-Add-powerup-down-support-for-the-3G.patch | 61 + ...-Add-regulators-to-the-accelerometer.patch | 30 + ...11-Add-sound-support-via-AC100-codec.patch | 131 + ...1-Add-support-for-the-vibrator-motor.patch | 39 + ...8i-a83t-tbs-a711-Enable-charging-LED.patch | 31 + ...-Give-Linux-more-privileges-over-SCP.patch | 47 + ...711-Increase-voltage-on-the-vibrator.patch | 30 + ...s-bananapi-m2-zero-Enable-HDMI-audio.patch | 42 + ...-hdmi-sound-card-on-boards-with-hdmi.patch | 272 + ...se-my-own-more-aggressive-OPPs-on-H3.patch | 72 + ...-pi-one-Enable-all-gpio-header-UARTs.patch | 49 + ...pc-Increase-max-CPUX-voltage-to-1.4V.patch | 31 + ...RM-dts-sun8i-r40-Add-hdmi-sound-card.patch | 48 + ...-bananapi-m2-ultra-Enable-HDMI-audio.patch | 42 + ...-bananapi-m2-berry-Enable-HDMI-audio.patch | 42 + .../ARM-dts-suni-a83t-Add-i2s0-pins.patch | 29 + .../ARM-dts-sunxi-Add-aliases-for-MMC.patch | 66 + ...ARM-dts-sunxi-a83t-Add-SCPI-protocol.patch | 52 + ...RM-dts-sunxi-a83t-Protect-SCP-clocks.patch | 33 + ...RM-dts-sunxi-h3-h5-Add-SCPI-protocol.patch | 81 + ...-dts-sunxi-h3-h5-Add-hdmi-sound-card.patch | 48 + ...M-dts-sunxi-h3-h5-Protect-SCP-clocks.patch | 33 + ...suspend-to-memory-implementation-for.patch | 88 + ...-send-suspend-message-to-SCP-on-A83T.patch | 54 + ...g_support_set-is-not-supported-on-A8.patch | 27 + ...9i-hdmi-audio-Initial-implementation.patch | 235 + ...ft-Ramp-Rate-is-just-a-2-bit-control.patch | 29 + ...-New-codec-driver-for-the-EC25-modem.patch | 154 + ...of-playback-speed-after-system-sleep.patch | 45 + ...-to-define-pins-for-aux-jack-devices.patch | 67 + ...-Add-debug-output-for-jack-detection.patch | 129 + ...-jack-type-to-be-set-via-device-tree.patch | 47 + ...codec-Set-jack_type-from-DT-in-probe.patch | 48 + ...C-sun8i-codec-define-button-keycodes.patch | 31 + ...-with-information-and-u-boot-patches.patch | 215 + ...upport-for-my-private-Sapomat-device.patch | 66 + .../Defconfigs-for-all-my-devices.patch | 3989 ++ .../Fix-for-usb-gadget-on-PP.patch | 192 + .../patches.megous/Fix-intptr_t-typedef.patch | 32 + ...INTAINERS-Add-entry-for-Himax-HM5065.patch | 30 + ...-Pi-PC-and-PC-2-work-as-power-off-bu.patch | 39 + ...async-probe-with-PROBE_PREFER_ASYNCH.patch | 40 + ...om-Support-protected-clocks-property.patch | 54 + ...-sun4i-lvds-Invert-the-LVDS-polarity.patch | 28 + ...ister-existing-source-caps-before-re.patch | 39 + .../patches.megous/Update-defconfigs.patch | 301 + ...able-K101-IM2BYL02-panel-for-PineTab.patch | 35 + ...ner-Enforce-consistent-MMC-numbering.patch | 66 + ...-dts-allwinner-a64-Add-SCPI-protocol.patch | 51 + ...ts-allwinner-a64-Add-hdmi-sound-card.patch | 48 + ...ble-hdmi-sound-card-on-boards-with-h.patch | 204 + ...s-allwinner-a64-Fix-LRADC-compatible.patch | 32 + ...dts-allwinner-a64-Protect-SCP-clocks.patch | 33 + ...lwinner-a64-pinetab-add-front-camera.patch | 99 + ...le-hdmi-sound-card-on-boards-with-hd.patch | 113 + ...4-dts-allwinner-h6-Add-SCPI-protocol.patch | 51 + ...dts-allwinner-h6-Add-hdmi-sound-card.patch | 56 + ...le-hdmi-sound-card-on-boards-with-hd.patch | 123 + ...-dts-allwinner-h6-Protect-SCP-clocks.patch | 33 + ...llwinner-orange-pi-3-Enable-ethernet.patch | 105 + ...56x-Fix-PCIe-register-map-and-ranges.patch | 47 + ...a64-pinephone-Define-jack-pins-in-DT.patch | 30 + ...-a64-Add-missing-trip-points-for-GPU.patch | 51 + ...s-sun50i-a64-Set-fifo-size-for-uarts.patch | 59 + ...4-pinephone-Add-AF8133J-to-PinePhone.patch | 40 + ...one-Add-Type-C-support-for-all-PP-va.patch | 416 + ...one-Add-detailed-OCV-to-capactiy-con.patch | 187 + ...a64-pinephone-Add-front-back-cameras.patch | 130 + ...pinephone-Add-interrupt-pin-for-WiFi.patch | 26 + ...64-pinephone-Add-modem-power-manager.patch | 119 + ...one-Add-mount-matrix-for-PinePhone-m.patch | 41 + ...one-Add-mount-matrix-for-acceleromet.patch | 29 + ...inephone-Add-power-supply-to-stk3311.patch | 27 + ...a64-pinephone-Add-reboot-mode-driver.patch | 80 + ...one-Add-supply-for-i2c-bus-to-anx768.patch | 54 + ...hone-Add-support-for-Bluetooth-audio.patch | 33 + ...one-Add-support-for-Pinephone-1.2-be.patch | 88 + ...one-Add-support-for-Pinephone-keyboa.patch | 170 + ...inephone-Add-support-for-modem-audio.patch | 71 + ...nephone-Bump-I2C-frequency-to-400kHz.patch | 35 + ...one-Don-t-make-lradc-keys-a-wakeup-s.patch | 29 + ...one-Enable-Pinephone-Keyboard-power-.patch | 34 + ...-pinephone-Enable-internal-HMIC-bias.patch | 29 + ...ephone-Fix-BH-modem-manager-behavior.patch | 29 + ...one-Power-off-the-touch-controller-i.patch | 28 + ...one-Set-minimum-backlight-duty-cycle.patch | 73 + ...one-Shorten-post-power-on-delay-on-m.patch | 43 + ...one-Use-newer-jack-detection-impleme.patch | 35 + ...one-Workaround-broken-HDMI-HPD-signa.patch | 84 + ...sun50i-a64-pinetab-Add-accelerometer.patch | 38 + ...-a64-pinetab-Name-sound-card-PineTab.patch | 28 + ...4-pinetab-enable-RTL8723CS-bluetooth.patch | 44 + ...sun50i-h5-Add-missing-GPU-trip-point.patch | 35 + ...se-my-own-more-aggressive-OPPs-on-H5.patch | 97 + ...s-without-benchmark-to-speed-up-boot.patch | 45 + ..._rts_on_open-true-behavior-on-bcm207.patch | 35 + ...-t-re-initialize-rtl8723cs-on-resume.patch | 28 + ...ways-check-register-address-validity.patch | 32 + ...ed-clocks-for-all-OF-clock-providers.patch | 206 + ...PLL-gating-and-CPUX-reparenting-to-H.patch | 55 + ...sunxi-ng-Export-CLK_DRAM-for-devfreq.patch | 59 + ...and-M-factors-to-1-for-H3-pll-cpux-c.patch | 59 + ...64-Increase-PLL_AUDIO-base-frequency.patch | 87 + ...tch-parent-of-MIPI-DSI-to-periph0-1x.patch | 47 + ...etected-CPU-bin-for-easier-debugging.patch | 29 + ...-accept-HPD-status-from-other-driver.patch | 152 + ...e-dw-hdmi-Report-HDMI-hotplug-events.patch | 41 + ...-timings-to-make-refresh-rate-exactl.patch | 37 + ...reboot-when-DRM-device-fails-to-bind.patch | 36 + ...rockchip-Fix-ISP1-PHY-initialization.patch | 35 + ...ckchip-Restore-DPHY-config-on-resume.patch | 94 + ...ters-to-sunxi_engine-commit-callback.patch | 112 + ...layer-zpos-change-atomic-modesetting.patch | 386 + ...drm-sun4i-Implement-gamma-correction.patch | 131 + ...one-of-the-UI-planes-as-a-cursor-one.patch | 73 + ...er-display-pipeline-state-from-p-boo.patch | 547 + ...rm-sun4i-Unify-sun8i_-_layer-structs.patch | 236 + ...un4i-drm-Change-update_bits-to-write.patch | 42 + ...ing-dclk-rate-upon-ancestor-clock-ch.patch | 179 + ...20x-adc-allow-to-use-TS-pin-as-GPADC.patch | 34 + ...-vibrator-Don-t-require-enable-gpios.patch | 35 + ...Add-a-binding-for-AXP813-charger-led.patch | 46 + ...dings-for-Himax-HM5065-camera-sensor.patch | 71 + ...dec-related-properties-to-AC100-PMIC.patch | 84 + ...ack-type-property-to-sun8i-a33-codec.patch | 36 + ...port-unidirectional-mailbox-channels.patch | 127 + ...or-sending-a-SCPI_CMD_SET_SYS_PWR_ST.patch | 87 + ...nd-soft-powerdown-message-on-suspend.patch | 64 + .../hm5065-yaml-bindings-wip.patch | 109 + ...ss-when-pinctrl-recovery-state-is-no.patch | 35 + ...dc-allow-to-set-TS-pin-to-GPADC-mode.patch | 42 + ...ow-to-use-sun5i-a13-gpadc-iio-from-D.patch | 61 + ...-error-when-the-device-is-not-presen.patch | 39 + ...-Clear-the-ids-buffer-in-a-saner-way.patch | 32 + ...scate-MT-signals-setup-platform-data.patch | 263 + ...-De-obfuscate-platform-data-for-keys.patch | 85 + ...-ENOSYS-error-is-ok-when-powering-up.patch | 29 + ...ter-recovery-from-failed-wakeup-HACK.patch | 31 + .../input-cyttsp4-Fix-probe-oops.patch | 29 + .../input-cyttsp4-Fix-warnings.patch | 47 + ...river-not-hog-the-system-s-workqueue.patch | 105 + ...-the-driver-to-use-device-properties.patch | 590 + ...t-cyttsp4-Remove-unused-enable_vkeys.patch | 27 + ...s-indirection-with-driver-platform-d.patch | 718 + ...keup-wakeup-by-I2C-read-doesn-t-work.patch | 125 + ...i2c-spi-names-directly-in-the-driver.patch | 64 + ...se-vcc-supply-alone-to-control-the-v.patch | 76 + ...ort-charger-LED-on-AXP20x-like-PMICs.patch | 347 + ...ilbox-while-timekeeping-is-suspended.patch | 64 + ...o-clean-up-hardware-on-probe-failure.patch | 35 + ...IXEL_RATE-HBLANK-and-VBLANK-controls.patch | 549 + .../media-gc2145-Added-BGGR-bayer-mode.patch | 30 + .../media-gc2145-Disable-debug-output.patch | 37 + ...2145-Galaxycore-camera-module-driver.patch | 2306 + ...edia-gc2145-fix-white-balance-colors.patch | 183 + ...edia-gc2145-implement-system-suspend.patch | 72 + ...river-for-Himax-HM5065-camera-sensor.patch | 2268 + ...-Move-upstream-driver-out-of-the-way.patch | 52 + ...gc2145-Parse-and-register-properties.patch | 43 + ...40-Add-read-only-property-for-vblank.patch | 24 + ...werup-the-sensor-during-driver-probe.patch | 119 + ...-Try-to-disable-denoising-sharpening.patch | 50 + ...cus-commands-blocking-until-complete.patch | 113 + .../media-ov5640-Implement-autofocus.patch | 395 + ...media-ov5640-Improve-error-reporting.patch | 43 + ...ia-ov5640-Improve-firmware-load-time.patch | 177 + ...weroff-to-ensure-next-poweron-is-not.patch | 29 + ...a-ov5640-set-default-ae-target-lower.patch | 27 + ..._force_suspend-resume-for-system-sus.patch | 31 + ...Fix-call-to-pm_runtime_set_suspended.patch | 29 + ...rent-SoCs-having-different-size-limi.patch | 167 + ...multicamera-support-for-parallel-bus.patch | 166 + ...6i-csi-add-V4L2_CAP_IO_MC-capability.patch | 82 + ...-subdev-operation-to-access-bridge-f.patch | 128 + ...csi-implement-vidioc_enum_framesizes.patch | 65 + ..._csi_formats-and-sun6i_csi_formats_m.patch | 431 + ...subdev-active-state-to-store-active-.patch | 346 + ...mfd-axp20x-Add-battery-IRQ-resources.patch | 102 + ...modem-power-Power-manager-for-modems.patch | 2050 + ...dd-delay-after-power-class-selection.patch | 38 + ...rockchip-fix-sdmmc-after-soft-reboot.patch | 52 + .../mmc-sunxi-mmc-Remove-runtime-PM.patch | 143 + ...-spi-nor-Add-Alliance-memory-support.patch | 85 + ...td-spi-nor-Add-vdd-regulator-support.patch | 41 + ...t-for-enabling-a-regulator-for-PHY-I.patch | 89 + ...-regulator-variable-to-regulator_phy.patch | 81 + ...devm_regulator_get-for-PHY-regulator.patch | 84 + ...Add-support-for-VBAT-PVDD-regulators.patch | 106 + ...devlink-Support-allwinner-sram-links.patch | 58 + ...ror-when-no-regulator-is-defined-in-.patch | 31 + ...-on-poweroff-reboot-on-Orange-Pi-5-P.patch | 32 + ...-usb-Add-support-for-usb_role_switch.patch | 146 + ...Allow-to-set-target-voltage-to-4.35V.patch | 31 + ...upts-for-low-battery-power-condition.patch | 43 + ...r-USB_BC_ENABLED-and-USB_DCP_INPUT_C.patch | 45 + ...-Add-support-for-POWER_SUPPLY_PROP_E.patch | 75 + ...-battery-Enable-poweron-by-RTC-alarm.patch | 35 + ...-Support-POWER_SUPPLY_PROP_CHARGE_BE.patch | 86 + ...20x-usb-power-Add-missing-interrupts.patch | 59 + ...wer-Change-Vbus-hold-voltage-to-4.5V.patch | 38 + ...attery-Add-support-for-reporting-OCV.patch | 63 + ..._battery-Fix-charging-done-detection.patch | 40 + ...xp20x_battery-Monitor-battery-health.patch | 117 + ...tery-Send-uevents-for-status-changes.patch | 138 + ...-Setup-thermal-regulation-experiment.patch | 90 + ...-for-enabling-a-regulator-from-users.patch | 194 + ...support-for-vin-supply-for-drivevbus.patch | 61 + ...r-temperature-protection-and-16s-res.patch | 41 + ...SEN-to-input-on-x-powers-sense-vbus-.patch | 53 + ...hwmon-device-for-reading-temperature.patch | 235 + ...tp65185x-eInk-panel-regulator-driver.patch | 487 + ...-which-error-caused-RTC-read-failure.patch | 31 + ...un6i-Allow-RTC-wakeup-after-shutdown.patch | 69 + ...rt-analog-part-of-X-Powers-AC100-cod.patch | 1075 + ...upport-for-digital-part-of-the-AC100.patch | 371 + .../sunxi-6.10/patches.megous/spi-fixes.patch | 66 + ...chip-Fix-runtime-PM-and-other-issues.patch | 274 + ..._probe-to-handle-EPROBE_DEFER-errors.patch | 150 + ...ermal-sun8i-Be-loud-when-probe-fails.patch | 88 + ...gling-pointer-in-netdev-private-data.patch | 206 + ...ng-host-side-code-on-SoCs-where-it-s.patch | 107 + ...set_resume-callback-for-WWAN-devices.patch | 33 + ...ayport-Respect-DP_CAP_RECEPTACLE-bit.patch | 98 + ...driver-for-ANX7688-USB-C-HDMI-bridge.patch | 2333 + ...usb-typec-anx7688-Port-to-Linux-6.10.patch | 28 + .../usb-typec-anx7688-Port-to-Linux-6.9.patch | 110 + ...-typec-fusb302-Add-OF-extcon-support.patch | 38 + ...-interrupts-before-we-start-toggling.patch | 40 + ...bugging-interface-with-driver-state-.patch | 112 + ...pec-fusb302-Fix-register-definitions.patch | 49 + ...seful-of-logging-status-on-interrupt.patch | 189 + ...ding-of-CC-pins-status-if-activity-i.patch | 76 + ...-the-current-before-enabling-pullups.patch | 50 + ...-increase-wait-time-for-BC1.2-result.patch | 33 + ...US-state-even-if-VBUS-interrupt-is-n.patch | 43 + ...PD-devices-capabilities-registration.patch | 95 + .../usb-typec-tcpm-Improve-logs.patch | 64 + ...altmodes-before-registering-new-ones.patch | 52 + ...xtcon-Add-typec-extcon-bridge-driver.patch | 386 + ...ow-to-force-reset-on-each-mux-change.patch | 48 + ...ypec-extcon-Enable-debugging-for-now.patch | 25 + ...lay-driver-for-A13-based-PocketBooks.patch | 1276 + ...w-to-change-lth_brightness-via-sysfs.patch | 126 + patch/kernel/archive/sunxi-6.10/series.conf | 263 + patch/kernel/archive/sunxi-6.10/series.megous | 262 + ...nanopiduo2-Use-key-0-as-power-button.patch | 31 + ...dts-sun8i-nanopiduo2-enable-ethernet.patch | 31 + .../Add-FB_TFT-ST7796S-driver.patch | 154 + .../Add-wifi-nodes-for-Inovato-Quadra.patch | 88 + ...ws2812-RGB-driver-for-allwinner-H616.patch | 275 + ...p20x-pek-allow-wakeup-after-shutdown.patch | 48 + ...us_heartbeat-arch-arm64-boot-dts-all.patch | 39 + ...C2007-touchscreen-add-polling-method.patch | 195 + ...er-SOCs-arch-arm64-boot-dts-allwinne.patch | 5452 ++ ...-boot-dts-allwinner-sun50i-a64-pinep.patch | 53 + .../add-bigtreetech-cb1-dts.patch | 455 + .../add-dtb-overlay-for-zero2w.patch | 215 + ...i-info-sunxi-addr-and-sunxi-dump-reg.patch | 73 + ...pinctr-arch-arm-boot-dts-allwinner-s.patch | 29 + ...ts-allwinner-sun50i-h616-PG-12c-pins.patch | 39 + ...s-allwinner-sun50i-h616-spi1-cs1-pin.patch | 30 + ...lwinner-sun50i-h618-bananapi-m4-zero.patch | 309 + ...-microvolt-to-prevent-not-supported-.patch | 48 + ...-that-are-also-compatible-with-orang.patch | 166 + ...r-sun50i-h616.dtsi-add-usb-ehci-ohci.patch | 64 + ...d-efuse_xlate-cpu-frequency-scaling-.patch | 474 + ...-Fix-thermal-zones-add-missing-trips.patch | 73 + ...angepi-zero2-Enable-expansion-board-.patch | 48 + ...pport-for-orange-pi-zero-2-and-zero3.patch | 68 + .../arm64-dts-sun50i-h313-x96q-lpddr3.patch | 511 + ...h5-nanopi-r1s-h5-add-rtl8153-support.patch | 40 + ...0i-h616-bigtreetech-cb1-enable-emac1.patch | 46 + ...50i-h616-bigtreetech-cb1-enable-hdmi.patch | 65 + ...6-bigtreetech-cb1-enable-ir-receiver.patch | 32 + .../patches.armbian/cb1-overlay.patch | 498 + .../driver-allwinner-h618-emac.patch | 4519 ++ ...dd-pwm-sunxi-enhance-driver-for-h616.patch | 1317 + ...nable-TV-Output-on-OrangePi-Zero-LTE.patch | 659 + .../orangepi-zero2w-add-dtb.patch | 572 + .../arm64-dts-sun50i-h313-x96q-lpddr3.patch | 511 + ...0i-h616-bigtreetech-cb1-enable-emac1.patch | 1 + ...50i-h616-bigtreetech-cb1-enable-hdmi.patch | 1 + ...e-ASAP-after-writing-new-instruction.patch | 63 + ...nanopiduo2-Use-key-0-as-power-button.patch | 31 + ...dts-sun8i-nanopiduo2-enable-ethernet.patch | 31 + .../ASoC-AC200-Initial-driver.patch | 844 + .../Add-FB_TFT-ST7796S-driver.patch | 154 + ...d-dump_reg-and-sunxi-sysinfo-drivers.patch | 1551 + ...to-fix-uwe5622-bluetooth-MAC-address.patch | 610 + .../Add-wifi-nodes-for-Inovato-Quadra.patch | 88 + ...ws2812-RGB-driver-for-allwinner-H616.patch | 275 + .../Bananapro-add-AXP209-regulators.patch | 72 + ...ding-for-DWC3-controller-on-Allwinne.patch | 63 + .../Fix-include-uapi-spi-spidev-module.patch | 26 + ...p20x-pek-allow-wakeup-after-shutdown.patch | 48 + ...us_heartbeat-arch-arm64-boot-dts-all.patch | 39 + ...FIG_SHELL-fix-for-builddeb-packaging.patch | 27 + ...C2007-touchscreen-add-polling-method.patch | 195 + ...-boot-dts-allwinner-sun50i-a64-pinep.patch | 53 + ...dd-initial-support-for-orangepi3-lts.patch | 431 + ...i-info-sunxi-addr-and-sunxi-dump-reg.patch | 73 + ...pinctr-arch-arm-boot-dts-allwinner-s.patch | 29 + ...ts-allwinner-sun50i-h616-PG-12c-pins.patch | 39 + ...s-allwinner-sun50i-h616-spi1-cs1-pin.patch | 30 + ...lwinner-sun50i-h618-bananapi-m4-zero.patch | 309 + ...rm-arm64-dts-Add-leds-axp20x-charger.patch | 79 + ...-Add-sun8i-h2-plus-nanopi-duo-device.patch | 196 + ...Add-sun8i-h2-plus-sunvell-r69-device.patch | 257 + ...ubietruck-green-LED-mmc0-default-tri.patch | 38 + ...-orangepi-and-mini-fix-phy-mode-hdmi.patch | 86 + ...3-nanopi-neo-Add-regulator-leds-mmc2.patch | 80 + ...dd-regulator-camera-wifi-bluetooth-o.patch | 196 + ...-h3-orangepi-2-Add-regulator-vdd-cpu.patch | 59 + ...m-dts-overlay-Add-Overlays-for-sunxi.patch | 4964 ++ ...lay-sun8i-h3-cpu-clock-add-overclock.patch | 209 + ...-Add-panel-lcd-olinuxino-4.3-needed-.patch | 133 + ...no-micro-add-panel-lcd-olinuxino-4.3.patch | 106 + ...OB-IRQ-for-brcm-wifi-on-Cubietruck-a.patch | 99 + ...-a20-bananapro-add-hdmi-connector-de.patch | 78 + ...sun7i-a20-cubietruck-add-alias-uart2.patch | 24 + ...m-204-evb-olinuxino-micro-decrease-d.patch | 55 + ...0-olinuxino-lime2-enable-audio-codec.patch | 27 + ...linuxino-lime2-enable-ldo3-always-on.patch | 28 + ...-olinuxino-micro-emmc-Add-vqmmc-node.patch | 24 + ...s-orangepi-zero-fix-xradio-interrupt.patch | 35 + .../arm-dts-sun8i-h3-add-thermal-zones.patch | 104 + ...-h3-bananapi-m2-plus-add-wifi_pwrseq.patch | 25 + ...ts-sun8i-h3-nanopi-add-leds-pio-pins.patch | 60 + ...-h3-orangepi-pc-plus-add-wifi_pwrseq.patch | 33 + ...-microvolt-to-prevent-not-supported-.patch | 48 + ...-r40-add-clk_out_a-fix-bananam2ultra.patch | 40 + ...0-bananapi-m2-ultra-add-codec-analog.patch | 63 + ...i-v3s-s3-pinecube-enable-sound-codec.patch | 63 + ...arm-dts-sun9i-a80-add-thermal-sensor.patch | 41 + .../arm-dts-sun9i-a80-add-thermal-zone.patch | 54 + ...-sunxi-h3-h5.dtsi-add-i2s0-i2s1-pins.patch | 33 + ...unxi-h3-h5.dtsi-force-mmc0-bus-width.patch | 24 + ...-Add-sun50i-h5-nanopi-k1-plus-device.patch | 429 + ...Add-sun50i-h5-nanopi-m1-plus2-device.patch | 272 + ...dd-sun50i-h5-nanopi-neo-core2-device.patch | 242 + ...dd-sun50i-h5-nanopi-neo2-v1.1-device.patch | 212 + ...64-olinuxino-add-regulator-audio-mmc.patch | 99 + ...-that-are-also-compatible-with-orang.patch | 166 + ...r-sun50i-h616.dtsi-add-usb-ehci-ohci.patch | 64 + ...s-allwinner-Add-Overlays-for-sunxi64.patch | 2491 + ...ts-allwinner-h6-Add-AC200-EPHY-nodes.patch | 144 + ...s-allwinner-h6-add-AC200-codec-nodes.patch | 87 + ...-dts-allwinner-h6-enable-AC200-codec.patch | 142 + ...s-allwinner-h6-tanix-enable-Ethernet.patch | 97 + ...lwinner-h616-Add-device-node-for-SID.patch | 30 + ...d-efuse_xlate-cpu-frequency-scaling-.patch | 474 + ...Add-thermal-sensor-and-thermal-zones.patch | 82 + ...angepi-zero2-Enable-expansion-board-.patch | 48 + ...-dts-allwinner-sun50i-h6-Fix-H6-emmc.patch | 26 + ...s-allwinner-sun50i-h616-Add-GPU-node.patch | 38 + ...s-allwinner-sun50i-h616-Add-VPU-node.patch | 55 + ...add-hdmi-support-for-zero2-and-zero3.patch | 339 + ...pport-for-orange-pi-zero-2-and-zero3.patch | 68 + ...i-a64-set-right-phy-mode-to-rgmii-id.patch | 29 + ...-overlay-sun50i-a64-pine64-7inch-lcd.patch | 144 + ...n50i-h5-add-gpio-regulator-overclock.patch | 220 + ...-dts-sun50i-a64-force-mmc0-bus-width.patch | 24 + ...ino-1Ge16GW-Disable-clock-phase-and-.patch | 28 + ...4-olinuxino-1Ge16GW-enable-bluetooth.patch | 41 + ...-dts-sun50i-a64-olinuxino-add-boards.patch | 603 + ...-a64-olinuxino-emmc-enable-bluetooth.patch | 38 + ...64-orangepi-win-add-aliase-ethernet1.patch | 24 + ...arm64-dts-sun50i-a64-pine64-add-spi0.patch | 49 + ...s-sun50i-a64-pine64-enable-Bluetooth.patch | 40 + ...s-sun50i-a64-pine64-enable-wifi-mmc1.patch | 52 + ...i-a64-sopine-baseboard-Add-i2s2-mmc1.patch | 44 + ...64-sopine-baseboard-enable-Bluetooth.patch | 44 + ...-a64.dtsi-adjust-thermal-trip-points.patch | 42 + ...arm64-dts-sun50i-h5-add-cpu-opp-refs.patch | 122 + ...arm64-dts-sun50i-h5-add-termal-zones.patch | 102 + ...able-power-button-for-orangepi-prime.patch | 27 + ...nanopi-neo2-add-regulator-led-triger.patch | 65 + ...h5-nanopi-r1s-h5-add-rtl8153-support.patch | 40 + ...sun50i-h5-orangepi-pc2-add-spi-flash.patch | 51 + ...n50i-h5-orangepi-prime-add-regulator.patch | 92 + ...n50i-h5-orangepi-prime-add-rtl8723cs.patch | 35 + ...-h5-orangepi-zero-plus-add-regulator.patch | 67 + ...angepi-zero-plus2-regulator-gpio-fix.patch | 106 + ...ts-sun50i-h6-Add-r_uart-uart2-3-pins.patch | 119 + ...n50i-h6-orangepi-3-add-r_uart-aliase.patch | 24 + ...un50i-h6-orangepi-3-delete-node-spi0.patch | 25 + ...-sun50i-h6-orangepi-add-cpu-opp-refs.patch | 35 + ...i-enable-higher-clock-regulator-max-.patch | 26 + ...ngepi-lite2-spi0-usb3phy-dwc3-enable.patch | 60 + ...rangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch | 40 + ...-sun50i-h6-pine-h64-add-dwc3-usb3phy.patch | 36 + ...un50i-h6-pine-h64-add-wifi-rtl8723cs.patch | 81 + ...50i-h6.dtsi-add-pinctrl-pins-for-spi.patch | 34 + ...-dts-sun50i-h6.dtsi-improve-thermals.patch | 111 + ...-h616-orangepi-zero2-Enable-GPU-mali.patch | 29 + ...angepi-zero2-reg_usb1_vbus-status-ok.patch | 24 + ...i-h616-x96-mate-T95-eth-sd-card-hack.patch | 103 + ...64-dts-sun50i-h616-x96-mate-add-hdmi.patch | 64 + ...-h618-orangepi-zero3-Enable-GPU-mali.patch | 28 + .../patches.armbian/cb1-overlay.patch | 498 + ...e-add-support-for-regmap-based-gates.patch | 251 + .../driver-allwinner-h618-emac.patch | 4519 ++ ...q-sun8i-a33-mbus-disable-autorefresh.patch | 27 + ...dd-pwm-sunxi-enhance-driver-for-h616.patch | 1317 + ...i-ng-ccu-add-min-max-rate-sun50i-a64.patch | 57 + ...urce-arm_arch_timer-fix-a64-timejump.patch | 48 + ...gem-dma-Export-with-handle-allocator.patch | 51 + ...simple-Add-compability-olinuxino-lcd.patch | 170 + .../drv-gpu-drm-sun4i-Add-GEM-allocator.patch | 103 + ...4i-Add-HDMI-audio-sun4i-hdmi-encoder.patch | 633 + ...rm-sun4i-sun8i_mixer.c-add-h3-mixer1.patch | 42 + ...rm64-dts-axp803-hwmon-enable-thermal.patch | 168 + ...-touchscreen-sun4i-ts-Enable-parsing.patch | 63 + ...dvb-frontends-si2168-fix-cmd-timeout.patch | 28 + .../drv-mfd-axp20x-add-sysfs-interface.patch | 658 + ...ble-DDR52-mode-on-all-A20-based-boar.patch | 27 + ...ost-sunxi-mmc-add-h5-emmc-compatible.patch | 38 + ...-nand_ids.c-add-H27UBG8T2BTR-BC-nand.patch | 27 + ...mac-sun8i-second-EMAC-clock-register.patch | 64 + ...-nvmem-sunxi_sid-Support-SID-on-H616.patch | 41 + ...vice-Tree-Overlay-ConfigFS-interface.patch | 343 + ...4i-usb-Allow-reset-line-to-be-shared.patch | 36 + ...nctrl-sun50i-a64-disable_strict_mode.patch | 30 + ...sun50i-h6.c-GPIO-disable_strict_mode.patch | 24 + ...rtc-sun6i-Add-Allwinner-H616-support.patch | 45 + ...-support-RTCs-without-external-LOSCs.patch | 68 + ...sunxi-sram-Add-SRAM-C1-H616-handling.patch | 41 + ...v-spi-spi-sun4i.c-spi-bug-low-on-sck.patch | 36 + ...pidev-Add-armbian-spi-dev-compatible.patch | 37 + ...-media-sunxi-cedrus-add-H616-variant.patch | 44 + .../drv-staging-rtl8723bs-AP-bugfix.patch | 25 + ...name-gadget-serial-console-manufactu.patch | 27 + ...nable-TV-Output-on-OrangePi-Zero-LTE.patch | 659 + .../fix-cpu-opp-table-sun8i-a83t.patch | 115 + ...fourcc-add-ARM-tiled-format-modifier.patch | 35 + ...pport-for-X-Powers-AC200-EPHY-syscon.patch | 375 + .../mfd-Add-support-for-X-Powers-AC200.patch | 266 + .../mmc-host-sunxi-mmc-Fix-H6-emmc.patch | 43 + .../net-phy-Add-support-for-AC200-EPHY.patch | 143 + ...-r8152-add-LED-configuration-from-OF.patch | 79 + ...unxi_get_soc_chipid-sunxi_get_serial.patch | 58 + ...ipts-add-overlay-compilation-support.patch | 92 + ...the-early-load-of-sun8i-codec-analog.patch | 27 + ...4i-codec-adcis-select-capture-source.patch | 120 + ...unxi-sun4i-spdif-add-mclk_multiplier.patch | 69 + ...unxi-sun8i-codec-analog-enable-sound.patch | 31 + ...entation-and-rotation-for-PinePhone-.patch | 31 + .../ARM-dts-axp813-Add-charger-LED.patch | 30 + .../ARM-dts-sun8i-a83t-Add-MBUS-node.patch | 39 + ...us-video-codec-support-to-A83T-untes.patch | 37 + ...M-dts-sun8i-a83t-Add-hdmi-sound-card.patch | 48 + ...un8i-a83t-Add-missing-GPU-trip-point.patch | 35 + ...-hdmi-sound-card-on-boards-with-hdmi.patch | 69 + ...prove-CPU-OPP-tables-go-up-to-1.8GHz.patch | 134 + ...s-sun8i-a83t-Set-fifo-size-for-uarts.patch | 59 + ...-a83t-tbs-a711-Add-PN544-NFC-support.patch | 66 + ...711-Add-camera-sensors-HM5065-GC2145.patch | 180 + ...-a83t-tbs-a711-Add-flash-led-support.patch | 32 + ...-Add-powerup-down-support-for-the-3G.patch | 61 + ...-Add-regulators-to-the-accelerometer.patch | 30 + ...11-Add-sound-support-via-AC100-codec.patch | 131 + ...1-Add-support-for-the-vibrator-motor.patch | 39 + ...8i-a83t-tbs-a711-Enable-charging-LED.patch | 31 + ...-Give-Linux-more-privileges-over-SCP.patch | 47 + ...711-Increase-voltage-on-the-vibrator.patch | 30 + ...s-bananapi-m2-zero-Enable-HDMI-audio.patch | 42 + ...-hdmi-sound-card-on-boards-with-hdmi.patch | 272 + ...se-my-own-more-aggressive-OPPs-on-H3.patch | 72 + ...-pi-one-Enable-all-gpio-header-UARTs.patch | 49 + ...pc-Increase-max-CPUX-voltage-to-1.4V.patch | 31 + ...RM-dts-sun8i-r40-Add-hdmi-sound-card.patch | 48 + ...-bananapi-m2-ultra-Enable-HDMI-audio.patch | 42 + ...-bananapi-m2-berry-Enable-HDMI-audio.patch | 42 + .../ARM-dts-suni-a83t-Add-i2s0-pins.patch | 29 + .../ARM-dts-sunxi-Add-aliases-for-MMC.patch | 66 + ...ARM-dts-sunxi-a83t-Add-SCPI-protocol.patch | 52 + ...RM-dts-sunxi-a83t-Protect-SCP-clocks.patch | 33 + ...RM-dts-sunxi-h3-h5-Add-SCPI-protocol.patch | 81 + ...-dts-sunxi-h3-h5-Add-hdmi-sound-card.patch | 48 + ...M-dts-sunxi-h3-h5-Protect-SCP-clocks.patch | 33 + ...suspend-to-memory-implementation-for.patch | 88 + ...-send-suspend-message-to-SCP-on-A83T.patch | 54 + ...g_support_set-is-not-supported-on-A8.patch | 27 + ...9i-hdmi-audio-Initial-implementation.patch | 235 + ...ft-Ramp-Rate-is-just-a-2-bit-control.patch | 29 + ...-New-codec-driver-for-the-EC25-modem.patch | 154 + ...of-playback-speed-after-system-sleep.patch | 45 + ...log-Enable-jack-detection-on-startup.patch | 97 + ...ove-suspend-resume-to-set_bias_level.patch | 74 + ...-Add-debug-output-for-jack-detection.patch | 129 + ...-jack-type-to-be-set-via-device-tree.patch | 47 + ...bus-clock-at-STANDBY-and-higher-bias.patch | 136 + ...ation-without-CONFIG_SND_JACK_INPUT_.patch | 85 + ...plement-jack-and-accessory-detection.patch | 470 + ...codec-Set-jack_type-from-DT-in-probe.patch | 48 + ...C-sun8i-codec-define-button-keycodes.patch | 31 + ...-with-information-and-u-boot-patches.patch | 215 + ...upport-for-my-private-Sapomat-device.patch | 66 + .../Defconfigs-for-all-my-devices.patch | 3989 ++ .../patches.megous/Fix-intptr_t-typedef.patch | 32 + ...INTAINERS-Add-entry-for-Himax-HM5065.patch | 30 + ...-Pi-PC-and-PC-2-work-as-power-off-bu.patch | 39 + ...async-probe-with-PROBE_PREFER_ASYNCH.patch | 40 + .../Move-a-node-to-avoid-merge-conflict.patch | 115 + ...om-Support-protected-clocks-property.patch | 54 + ...-sun4i-lvds-Invert-the-LVDS-polarity.patch | 28 + ...ister-existing-source-caps-before-re.patch | 43 + ...able-K101-IM2BYL02-panel-for-PineTab.patch | 35 + ...ner-Enforce-consistent-MMC-numbering.patch | 66 + ...-dts-allwinner-a64-Add-SCPI-protocol.patch | 51 + ...ts-allwinner-a64-Add-hdmi-sound-card.patch | 48 + ...ble-hdmi-sound-card-on-boards-with-h.patch | 204 + ...s-allwinner-a64-Fix-LRADC-compatible.patch | 32 + ...dts-allwinner-a64-Protect-SCP-clocks.patch | 33 + ...lwinner-a64-pinetab-add-front-camera.patch | 99 + ...le-hdmi-sound-card-on-boards-with-hd.patch | 113 + ...4-dts-allwinner-h6-Add-SCPI-protocol.patch | 51 + ...dts-allwinner-h6-Add-hdmi-sound-card.patch | 56 + ...le-hdmi-sound-card-on-boards-with-hd.patch | 123 + ...-dts-allwinner-h6-Protect-SCP-clocks.patch | 33 + ...llwinner-orange-pi-3-Enable-ethernet.patch | 105 + ...56x-Fix-PCIe-register-map-and-ranges.patch | 47 + ...entation-and-rotation-for-PinePhone-.patch | 31 + ...-a64-Add-missing-trip-points-for-GPU.patch | 51 + ...s-sun50i-a64-Set-fifo-size-for-uarts.patch | 59 + ...4-pinephone-Add-AF8133J-to-PinePhone.patch | 40 + ...one-Add-Type-C-support-for-all-PP-va.patch | 416 + ...one-Add-detailed-OCV-to-capactiy-con.patch | 187 + ...a64-pinephone-Add-front-back-cameras.patch | 130 + ...pinephone-Add-interrupt-pin-for-WiFi.patch | 26 + ...64-pinephone-Add-modem-power-manager.patch | 119 + ...one-Add-mount-matrix-for-PinePhone-m.patch | 41 + ...one-Add-mount-matrix-for-acceleromet.patch | 29 + ...inephone-Add-power-supply-to-stk3311.patch | 27 + ...a64-pinephone-Add-reboot-mode-driver.patch | 80 + ...one-Add-supply-for-i2c-bus-to-anx768.patch | 54 + ...hone-Add-support-for-Bluetooth-audio.patch | 33 + ...one-Add-support-for-Pinephone-1.2-be.patch | 88 + ...one-Add-support-for-Pinephone-keyboa.patch | 170 + ...inephone-Add-support-for-modem-audio.patch | 71 + ...nephone-Bump-I2C-frequency-to-400kHz.patch | 35 + ...one-Don-t-make-lradc-keys-a-wakeup-s.patch | 29 + ...one-Enable-Pinephone-Keyboard-power-.patch | 34 + ...-pinephone-Enable-internal-HMIC-bias.patch | 29 + ...ephone-Fix-BH-modem-manager-behavior.patch | 29 + ...one-Power-off-the-touch-controller-i.patch | 28 + ...nephone-Retain-leds-state-in-suspend.patch | 43 + ...one-Set-minimum-backlight-duty-cycle.patch | 73 + ...one-Shorten-post-power-on-delay-on-m.patch | 43 + ...one-Use-newer-jack-detection-impleme.patch | 35 + ...one-Workaround-broken-HDMI-HPD-signa.patch | 84 + ...sun50i-a64-pinetab-Add-accelerometer.patch | 38 + ...-a64-pinetab-Name-sound-card-PineTab.patch | 28 + ...4-pinetab-enable-RTL8723CS-bluetooth.patch | 44 + ...sun50i-h5-Add-missing-GPU-trip-point.patch | 35 + ...se-my-own-more-aggressive-OPPs-on-H5.patch | 97 + ...s-without-benchmark-to-speed-up-boot.patch | 45 + ..._rts_on_open-true-behavior-on-bcm207.patch | 35 + ...-t-re-initialize-rtl8723cs-on-resume.patch | 28 + ...ways-check-register-address-validity.patch | 32 + ...ed-clocks-for-all-OF-clock-providers.patch | 206 + ...PLL-gating-and-CPUX-reparenting-to-H.patch | 55 + ...sunxi-ng-Export-CLK_DRAM-for-devfreq.patch | 59 + ...and-M-factors-to-1-for-H3-pll-cpux-c.patch | 59 + ...64-Increase-PLL_AUDIO-base-frequency.patch | 87 + ...tch-parent-of-MIPI-DSI-to-periph0-1x.patch | 47 + ...etected-CPU-bin-for-easier-debugging.patch | 28 + ...-accept-HPD-status-from-other-driver.patch | 152 + ...e-dw-hdmi-Report-HDMI-hotplug-events.patch | 41 + ...-timings-to-make-refresh-rate-exactl.patch | 37 + ...reboot-when-DRM-device-fails-to-bind.patch | 36 + ...ters-to-sunxi_engine-commit-callback.patch | 112 + ...layer-zpos-change-atomic-modesetting.patch | 386 + ...drm-sun4i-Implement-gamma-correction.patch | 131 + ...one-of-the-UI-planes-as-a-cursor-one.patch | 73 + ...er-display-pipeline-state-from-p-boo.patch | 547 + ...rm-sun4i-Unify-sun8i_-_layer-structs.patch | 236 + ...un4i-drm-Change-update_bits-to-write.patch | 42 + ...ing-dclk-rate-upon-ancestor-clock-ch.patch | 179 + ...20x-adc-allow-to-use-TS-pin-as-GPADC.patch | 34 + ...-vibrator-Don-t-require-enable-gpios.patch | 35 + ...Add-a-binding-for-AXP813-charger-led.patch | 46 + ...dings-for-Himax-HM5065-camera-sensor.patch | 71 + ...dec-related-properties-to-AC100-PMIC.patch | 84 + ...ack-type-property-to-sun8i-a33-codec.patch | 36 + ...port-unidirectional-mailbox-channels.patch | 127 + ...or-sending-a-SCPI_CMD_SET_SYS_PWR_ST.patch | 87 + ...nd-soft-powerdown-message-on-suspend.patch | 64 + .../hm5065-yaml-bindings-wip.patch | 109 + ...ss-when-pinctrl-recovery-state-is-no.patch | 35 + ...dc-allow-to-set-TS-pin-to-GPADC-mode.patch | 42 + ...-error-when-the-device-is-not-presen.patch | 39 + ...se-vcc-supply-alone-to-control-the-v.patch | 76 + ...ort-charger-LED-on-AXP20x-like-PMICs.patch | 347 + ...ilbox-while-timekeeping-is-suspended.patch | 64 + ...o-clean-up-hardware-on-probe-failure.patch | 35 + ...IXEL_RATE-HBLANK-and-VBLANK-controls.patch | 549 + .../media-gc2145-Added-BGGR-bayer-mode.patch | 30 + .../media-gc2145-Disable-debug-output.patch | 37 + ...2145-Galaxycore-camera-module-driver.patch | 2306 + ...edia-gc2145-fix-white-balance-colors.patch | 183 + ...edia-gc2145-implement-system-suspend.patch | 72 + ...river-for-Himax-HM5065-camera-sensor.patch | 2268 + ...-Move-upstream-driver-out-of-the-way.patch | 52 + ...gc2145-Parse-and-register-properties.patch | 43 + ...40-Add-read-only-property-for-vblank.patch | 24 + ...werup-the-sensor-during-driver-probe.patch | 119 + ...-Try-to-disable-denoising-sharpening.patch | 50 + ...cus-commands-blocking-until-complete.patch | 113 + .../media-ov5640-Implement-autofocus.patch | 395 + ...media-ov5640-Improve-error-reporting.patch | 43 + ...ia-ov5640-Improve-firmware-load-time.patch | 177 + ...weroff-to-ensure-next-poweron-is-not.patch | 29 + ...a-ov5640-set-default-ae-target-lower.patch | 27 + ..._force_suspend-resume-for-system-sus.patch | 31 + ...Fix-call-to-pm_runtime_set_suspended.patch | 29 + ...rent-SoCs-having-different-size-limi.patch | 167 + ...multicamera-support-for-parallel-bus.patch | 166 + ...6i-csi-add-V4L2_CAP_IO_MC-capability.patch | 82 + ...-subdev-operation-to-access-bridge-f.patch | 128 + ...csi-implement-vidioc_enum_framesizes.patch | 65 + ..._csi_formats-and-sun6i_csi_formats_m.patch | 431 + ...subdev-active-state-to-store-active-.patch | 346 + ...mfd-axp20x-Add-battery-IRQ-resources.patch | 102 + ...modem-power-Power-manager-for-modems.patch | 2050 + ...dd-delay-after-power-class-selection.patch | 38 + ...rockchip-fix-sdmmc-after-soft-reboot.patch | 52 + .../mmc-sunxi-mmc-Remove-runtime-PM.patch | 143 + ...-spi-nor-Add-Alliance-memory-support.patch | 85 + ...t-for-enabling-a-regulator-for-PHY-I.patch | 89 + ...-regulator-variable-to-regulator_phy.patch | 81 + ...devm_regulator_get-for-PHY-regulator.patch | 84 + ...dd-optional-32k-clock-enable-support.patch | 51 + ...ac-Add-support-for-detecting-AP6275P.patch | 80 + ...Add-support-for-VBAT-PVDD-regulators.patch | 106 + ...devlink-Support-allwinner-sram-links.patch | 58 + ...ror-when-no-regulator-is-defined-in-.patch | 31 + ...-on-poweroff-reboot-on-Orange-Pi-5-P.patch | 32 + ...-usb-Add-support-for-usb_role_switch.patch | 146 + ...Allow-to-set-target-voltage-to-4.35V.patch | 31 + ...upts-for-low-battery-power-condition.patch | 43 + ...r-USB_BC_ENABLED-and-USB_DCP_INPUT_C.patch | 45 + ...-Add-support-for-POWER_SUPPLY_PROP_E.patch | 75 + ...-battery-Enable-poweron-by-RTC-alarm.patch | 35 + ...-Support-POWER_SUPPLY_PROP_CHARGE_BE.patch | 86 + ...20x-usb-power-Add-missing-interrupts.patch | 59 + ...wer-Change-Vbus-hold-voltage-to-4.5V.patch | 38 + ...attery-Add-support-for-reporting-OCV.patch | 63 + ..._battery-Fix-charging-done-detection.patch | 40 + ...xp20x_battery-Monitor-battery-health.patch | 117 + ...tery-Send-uevents-for-status-changes.patch | 138 + ...-Setup-thermal-regulation-experiment.patch | 90 + ...support-for-vin-supply-for-drivevbus.patch | 61 + ...r-temperature-protection-and-16s-res.patch | 41 + ...SEN-to-input-on-x-powers-sense-vbus-.patch | 53 + ...-which-error-caused-RTC-read-failure.patch | 31 + ...un6i-Allow-RTC-wakeup-after-shutdown.patch | 69 + ...rt-analog-part-of-X-Powers-AC100-cod.patch | 1075 + ...upport-for-digital-part-of-the-AC100.patch | 371 + .../sunxi-6.9/patches.megous/spi-fixes.patch | 66 + ...chip-Fix-runtime-PM-and-other-issues.patch | 274 + ..._probe-to-handle-EPROBE_DEFER-errors.patch | 150 + ...ermal-sun8i-Be-loud-when-probe-fails.patch | 88 + ...gling-pointer-in-netdev-private-data.patch | 206 + ...ng-host-side-code-on-SoCs-where-it-s.patch | 107 + ...set_resume-callback-for-WWAN-devices.patch | 33 + ...ayport-Respect-DP_CAP_RECEPTACLE-bit.patch | 98 + ...driver-for-ANX7688-USB-C-HDMI-bridge.patch | 2333 + .../usb-typec-anx7688-Port-to-Linux-6.9.patch | 110 + ...-typec-fusb302-Add-OF-extcon-support.patch | 38 + ...-interrupts-before-we-start-toggling.patch | 40 + ...bugging-interface-with-driver-state-.patch | 112 + ...pec-fusb302-Fix-register-definitions.patch | 49 + ...seful-of-logging-status-on-interrupt.patch | 189 + ...ding-of-CC-pins-status-if-activity-i.patch | 76 + ...-the-current-before-enabling-pullups.patch | 50 + ...-increase-wait-time-for-BC1.2-result.patch | 33 + ...US-state-even-if-VBUS-interrupt-is-n.patch | 43 + ...PD-devices-capabilities-registration.patch | 95 + .../usb-typec-tcpm-Improve-logs.patch | 64 + ...altmodes-before-registering-new-ones.patch | 52 + ...xtcon-Add-typec-extcon-bridge-driver.patch | 386 + ...ow-to-force-reset-on-each-mux-change.patch | 48 + ...ypec-extcon-Enable-debugging-for-now.patch | 25 + ...w-to-change-lth_brightness-via-sysfs.patch | 126 + ...er-SOCs-arch-arm64-boot-dts-allwinne.patch | 5452 ++ .../add-bigtreetech-cb1-dts.patch | 455 + .../add-dtb-overlay-for-zero2w.patch | 215 + ...vers-hack-for-h616-hdmi-video-output.patch | 978 + ...v-thermal-sun8i_thermal-Add-for-H616.patch | 157 + .../orangepi-zero2w-add-dtb.patch | 572 + patch/kernel/archive/sunxi-6.9/series.armbian | 168 + patch/kernel/archive/sunxi-6.9/series.conf | 465 + patch/kernel/archive/sunxi-6.9/series.megous | 268 + patch/kernel/rk35xx-legacy/001-hid-sony.patch | 111 + .../rk35xx-vendor-6.1/001-hid-sony.patch | 111 + ...-add-default-power-enable-config-val.patch | 46 + ...ckchip-rk3576-the-power_en-for-SD-co.patch | 38 + ...fly-itx-3588j-disable-optee-security.patch | 22 + .../defconfig/armsom-aim7-io-rk3588_defconfig | 214 + .../retro-lite-cm5-rk3588s_defconfig | 222 + .../dt/rk3588-armsom-aim7-io.dts | 62 + .../dt/rk3588s-retro-lite-cm5.dts | 134 + ...un50i-h313-add-x96q-lpddr3-defconfig.patch | 241 + .../allwinner-h616-driver-i2c3.patch | 92 + ...r-h616-dts-enable-internal-phy-emac1.patch | 117 + ...winner-h616-setup-internal-phy-emac1.patch | 93 + ..._atf_imx8mp.sh-add-script-for-imx8mp.patch | 190 + ...001-Add-board-Amper-Gateway-AM-GZ80x.patch | 215 + ...002-HACK-mmc-meson-gx-limit-to-24MHz.patch | 26 + ...change-clock-phase-value-on-axg-SoCs.patch | 54 + .../004-HACK-meson64-boot-target-usb.patch | 29 + ...osen-kaslr-seed-and-deduplicate-code.patch | 543 + .../nanopi-r5c_kaslrseed.patch | 26 + .../orangepi5-plus_kaslrseed.patch | 26 + 1341 files changed, 398682 insertions(+) create mode 100644 .github/workflows/merge-announce.yml create mode 100644 .github/workflows/pr-announce.yml create mode 100644 config/boards/armsom-aim7-io.csc create mode 100644 config/boards/ayn-odin2.eos create mode 100644 config/boards/bananapi.conf create mode 100644 config/boards/gateway-gz80x.conf create mode 100644 config/boards/nanopct6.conf create mode 100644 config/boards/nanopim4v2.conf create mode 100644 config/boards/odroidc4.conf create mode 100644 config/boards/odroidhc4.conf create mode 100644 config/boards/pinebook-pro.csc create mode 100644 config/boards/retro-lite-cm5.csc create mode 100644 config/boards/rk3328-heltec.csc create mode 100644 config/boards/rock-3a.conf create mode 100644 config/boards/rockpro64.csc create mode 100644 config/boards/x96q.tvb create mode 100644 config/boards/youyeetoo-r1-v3.wip create mode 100644 config/bootenv/rk356x.txt create mode 100644 config/kernel/linux-rockchip-rk3588-6.11.config create mode 100644 config/sources/families/meson-axg.conf create mode 100644 config/sources/git_sources.json create mode 100644 patch/kernel/archive/bcm2711-6.10/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch create mode 100644 patch/kernel/archive/bcm2711-6.10/001-force-platform-selection-brcm-soc-support.disabled create mode 100644 patch/kernel/archive/bcm2711-6.10/1003-remote-wakeup.patch create mode 100644 patch/kernel/archive/bcm2711-6.10/2001-rename-msd.patch create mode 100644 patch/kernel/archive/imx6-6.10/.placeholder create mode 100644 patch/kernel/archive/meson-6.10/0007-dt-bindings-phy-meson8b-usb2-Add-support-for-reading.patch create mode 100644 patch/kernel/archive/meson-6.10/0008-phy-amlogic-meson8b-usb2-Add-support-for-reading-the.patch create mode 100644 patch/kernel/archive/meson-6.10/0009-usb-common-usb-conn-gpio-Fall-back-to-polling-the-GP.patch create mode 100644 patch/kernel/archive/meson-6.10/0010-usb-dwc2-register-child-USB-connector-devices.patch create mode 100644 patch/kernel/archive/meson-6.10/0011-ARM-dts-meson-Add-GPIO-controller-capabilities-to-th.patch create mode 100644 patch/kernel/archive/meson-6.10/0012-ARM-dts-meson8b-odroidc1-Enable-the-Micro-USB-OTG-co.patch create mode 100644 patch/kernel/archive/meson-6.10/0013-dt-bindings-phy-Add-bindings-for-the-Amlogic-Meson-C.patch create mode 100644 patch/kernel/archive/meson-6.10/0014-phy-amlogic-Add-a-new-driver-for-the-CVBS-DAC-CVBS-P.patch create mode 100644 patch/kernel/archive/meson-6.10/0015-dt-bindings-display-meson-vpu-Add-the-CVBS-DAC-prope.patch create mode 100644 patch/kernel/archive/meson-6.10/0016-drm-meson-Add-support-for-using-a-PHY-for-the-CVBS-D.patch create mode 100644 patch/kernel/archive/meson-6.10/0018-dt-bindings-clock-meson8b-Add-the-RMII-reference-clo.patch create mode 100644 patch/kernel/archive/meson-6.10/0019-dt-bindings-clock-meson8b-Add-the-Meson8-Ethernet-RM.patch create mode 100644 patch/kernel/archive/meson-6.10/0020-clk-meson-meson8b-Add-the-Ethernet-RMII-clock-tree-o.patch create mode 100644 patch/kernel/archive/meson-6.10/0021-dt-bindings-net-dwmac-meson-Add-the-Ethernet-clock-i.patch create mode 100644 patch/kernel/archive/meson-6.10/0022-net-stmmac-dwmac-meson-Rename-the-SPEED_100-macro.patch create mode 100644 patch/kernel/archive/meson-6.10/0023-net-stmmac-dwmac-meson-Manage-the-ethernet-clock.patch create mode 100644 patch/kernel/archive/meson-6.10/0024-net-stmmac-dwmac-meson-Initialize-all-known-PREG_ETH.patch create mode 100644 patch/kernel/archive/meson-6.10/0025-ARM-dts-meson-meson8-Add-the-clock-input-to-the-Ethe.patch create mode 100644 patch/kernel/archive/meson-6.10/0026-dt-bindings-clock-meson8b-add-the-rtc_32k-oscillator.patch create mode 100644 patch/kernel/archive/meson-6.10/0027-clk-meson-meson8b-Add-the-mpeg_rtc_osc_sel-clock.patch create mode 100644 patch/kernel/archive/meson-6.10/0028-ARM-dts-meson-Add-address-cells-size-cells-and-range.patch create mode 100644 patch/kernel/archive/meson-6.10/0029-dt-bindings-firmware-Document-the-Amlogic-Meson6-8-8.patch create mode 100644 patch/kernel/archive/meson-6.10/0030-dt-bindings-arm-cpus-Document-Meson8-TrustZone-firmw.patch create mode 100644 patch/kernel/archive/meson-6.10/0031-ARM-meson-Add-support-for-the-TrustZone-firmware.patch create mode 100644 patch/kernel/archive/meson-6.10/0032-ARM-meson-platsmp-Add-support-for-SoCs-running-on-Tr.patch create mode 100644 patch/kernel/archive/meson-6.10/0033-soc-amlogic-meson-mx-socinfo-Add-support-for-the-Tru.patch create mode 100644 patch/kernel/archive/meson-6.10/0034-nvmem-meson-mx-efuse-Add-support-for-the-TrustZone-f.patch create mode 100644 patch/kernel/archive/meson-6.10/0036-ARM-dts-meson8-Add-the-PWM_C-DV9-and-PWM_D-pins.patch create mode 100644 patch/kernel/archive/meson-6.10/0045-dt-bindings-display-meson-vpu-add-support-for-Meson8.patch create mode 100644 patch/kernel/archive/meson-6.10/0046-drm-meson-add-Meson8-Meson8b-Meson8m2-specific-vpu_c.patch create mode 100644 patch/kernel/archive/meson-6.10/0047-drm-meson-Use-24-bits-per-pixel-for-the-framebuffer-.patch create mode 100644 patch/kernel/archive/meson-6.10/0048-drm-meson-Use-a-separate-list-of-supported-formats-f.patch create mode 100644 patch/kernel/archive/meson-6.10/0049-drm-meson-Skip-VIU_OSD1_CTRL_STAT2-alpha-replace-val.patch create mode 100644 patch/kernel/archive/meson-6.10/0050-drm-meson-Enable-the-RGB-to-YUV-converter-on-Meson8-.patch create mode 100644 patch/kernel/archive/meson-6.10/0051-drm-meson-Update-meson_vpu_init-to-work-with-Meson8-.patch create mode 100644 patch/kernel/archive/meson-6.10/0052-drm-meson-Describe-the-HDMI-PHY-frequency-limits-of-.patch create mode 100644 patch/kernel/archive/meson-6.10/0053-drm-meson-Update-the-HDMI-encoder-for-Meson8-8b-8m2.patch create mode 100644 patch/kernel/archive/meson-6.10/0054-drm-meson-Only-set-ycbcr_420_allowed-on-64-bit-SoCs.patch create mode 100644 patch/kernel/archive/meson-6.10/0055-drm-meson-Make-the-HHI-registers-optional-WIP.patch create mode 100644 patch/kernel/archive/meson-6.10/0056-drm-meson-Add-support-for-the-Meson8-8b-8m2-TranSwit.patch create mode 100644 patch/kernel/archive/meson-6.10/0057-drm-meson-Meson8-Meson8b-Meson8m2-VCLK-HACK.patch create mode 100644 patch/kernel/archive/meson-6.10/0058-drm-meson-Enable-support-for-Meson8-Meson8b-Meson8m2.patch create mode 100644 patch/kernel/archive/meson-6.10/0059-ARM-dts-meson-add-the-VPU-WiP.patch create mode 100644 patch/kernel/archive/meson-6.10/0060-ARM-dts-meson8-add-the-HDMI-controller-WiP.patch create mode 100644 patch/kernel/archive/meson-6.10/0061-ARM-dts-meson8-Add-the-shared-CMA-dma-memory-pool.patch create mode 100644 patch/kernel/archive/meson-6.10/0062-ARM-dts-meson8-add-the-AO-CEC-controller-WiP.patch create mode 100644 patch/kernel/archive/meson-6.10/0063-ARM-dts-meson8b-add-the-HDMI-controller-WiP.patch create mode 100644 patch/kernel/archive/meson-6.10/0064-ARM-dts-meson8b-add-the-AO-CEC-controller-WiP.patch create mode 100644 patch/kernel/archive/meson-6.10/0066-ARM-dts-meson8b-odroid-c1-enable-HDMI-for-the-Odroid.patch create mode 100644 patch/kernel/archive/meson-6.10/generic-Revert-mmc-core-Set-HS-clock-speed-before-sending-HS-CMD13.patch create mode 100644 patch/kernel/archive/meson-6.10/generic-Revert-pwm-meson-modify-and-simplify-calculation-in-.patch create mode 100644 patch/kernel/archive/meson-6.10/onecloud-0001-add-dts.patch create mode 100644 patch/kernel/archive/meson-6.10/onecloud-0002-dts-Support-HDMI.patch create mode 100644 patch/kernel/archive/meson64-6.10/0000.patching_config.yaml create mode 100644 patch/kernel/archive/meson64-6.10/board-bananapi-cm4-cm4io.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-bananapi-m2s.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-bananapim5-001-sd-use-270-mmc-clock-phase-via-dt.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-bananapim5-002-add-wifi-bt-support.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-bananapism1-add-uart_A-and-AO_B.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-khadas-vim3-fix-missing-i2c3-nod.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-khadas-vims-add-rtc-vrtc-aliases.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-nanopi-k2-add-uartC-alias.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-nanopi-k2-enable-emmc.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidc2-add-uartA-uartC.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidc2-enable-SPI.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidc2-enable-scpi-dvfs.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidc2-usb-hub-disable-autosuspend-for-Genesys-Logic-.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidc4-reset.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidhc4-enable-fan1_input.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-odroidn2plus-Add-missing-CPU-opp.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-aliases-for-serial-i2c-and-spi.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-support-for-the-usb-c-controller.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-slow-down-sdio-for-working-wifi.patch create mode 100644 patch/kernel/archive/meson64-6.10/board-t95z-add-rc-remote-keymap.patch create mode 100644 patch/kernel/archive/meson64-6.10/driver-power-meson64-reset.patch create mode 100644 patch/kernel/archive/meson64-6.10/drv-spi-spidev-remove-warnings.patch create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-axg-amper-gateway-am-gz80x.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12-enable-spinor.dtsi create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12a-radxa-zero-spidev.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spidev.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spinor.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spidev.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spinor.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-spinor.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-radxa-zero2-spidev.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-g12b-waveshare-cm4-io-base-b.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-gxm-mini-m8s-pro.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-gxm-t95z-plus.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200-spinor.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spidev.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spinor.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-sm1-odroid-c4-spidev.dts create mode 100644 patch/kernel/archive/meson64-6.10/dt/meson-sm1-ugoos-x3.dts create mode 100644 patch/kernel/archive/meson64-6.10/general-add-Amlogic-Meson-GX-PM-Suspend.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-add-overlay-compilation-support.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-driver-tm1628-auxdisplay-add-support-for-Titanmec-TM16.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-drm-panfrost-fix-reference-leak.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-fix-Kodi-sysinfo-CPU-information.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-gpu-drm-add-new-display-resolution-2560x1440.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-hdmi-codec-reorder-channel-allocation-list.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-input-touchscreen-Add-D-WAV-Multitouch.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-media-cec-silence-CEC-timeout-message-HACK.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-memory-marked-nomap.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-aiu-Fix-HDMI-codec-control-selection.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-mmc-1-arm64-amlogic-mmc-meson-gx-Add-core-tx-rx-eMMC-SD-SD.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-mmc-2-arm64-amlogic-dts-meson-update-meson-axg-device-tree.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-mmc-3-arm64-dts-docs-Update-mmc-meson-gx-documentation-for.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-vdec-add-HEVC-decode-codec.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-vdec-add-handling-to-HEVC-decoder-.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-vdec-check-if-parser-has-really-parser.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson-vdec-improve-mmu-and-fbc-handling-.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-meson64-overlays.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-si2168-fix-cmd-timeout.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-socinfo-sm-1-soc-amlogic-meson-gx-socinfo-Add-S905L-ID.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-socinfo-sm-2-soc-amlogic-meson-gx-socinfo-add-new-A113X-SoC-id.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-socinfo-sm-3-soc-amlogic-meson-gx-socinfo-move-common-code-to-hea.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-socinfo-sm-4-soc-amlogic-meson-gx-socinfo-sm-Add-Amlogic-secure-m.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-socinfo-sm-5-arm64-dts-meson-add-dts-links-to-secure-monitor-for-.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-socinfo-sm-6-dt-bindings-arm-amlogic-amlogic-meson-gx-ao-secure-a.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-sound-soc-remove-mono-channel-as-it-curren.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-spi-nor-add-support-for-XT25F128B.patch create mode 100644 patch/kernel/archive/meson64-6.10/general-usb-core-improve-handling-of-hubs-with-no-ports.patch create mode 100644 patch/kernel/archive/meson64-6.10/hwmon-emc2305-fixups-for-driver.patch create mode 100644 patch/kernel/archive/meson64-6.10/jethome-0001-Fix-meson64-add-gpio-irq-patch-from-https-lkml.org-l.patch create mode 100644 patch/kernel/archive/meson64-6.10/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch create mode 100644 patch/kernel/archive/meson64-6.10/jethome-0003-arm64-dts-meson-add-dts-links-to-secure-monitor-for-jethub.patch.disabled create mode 100644 patch/kernel/archive/meson64-6.10/jethome-0003-dt-bindings-arm-amlogic-add-binding-for-JetHome-JetH.patch create mode 100644 patch/kernel/archive/meson64-6.10/kernel-6.8-tools-cgroup-makefile.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-g12a-pinctrl-add-missing-ir-options.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-g12b-pinctrl-Add-missing-pinmux-for-pwm.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-gx-dts-add-support-for-GX-PM-and-VRTC.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-gxbb-dts-i2cX-missing-pins.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-gxbb-vdec-add-HEVC-support-to-GXBB.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-gxl-gxm-arm64-dts-meson-set-p212-p23x-q20x-SDIO-to-100MH.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-gxm-vdec-add-VP9-support-to-GXM.patch create mode 100644 patch/kernel/archive/meson64-6.10/meson-sm1-dts-add-higher-clocks.patch create mode 100644 patch/kernel/archive/meson64-6.10/overlay/Makefile create mode 100644 patch/kernel/archive/meson64-6.10/overlay/README.meson-overlays create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-fixup.scr-cmd create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12-gxl-cma-pool-896MB.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12-pwm-gpiox-5-fan.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-10-led.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-8-led.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ao-m0-gpioao-2-gpioao-3.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpioh-6-gpioh-7.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpiox-10-gpiox-11.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m3-gpioa-14-gpioa-15.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwm-c-on-gpiox-8.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwmao-a-on-gpioao-11.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-spi-spidev.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-a-on-gpioao-0-gpioao-1.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-2-gpioao-3.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-8-gpioao-9.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ee-c.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-cm4-pwm-gpioh-5-fan.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-m2s-rtl8822cs.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12b-odroid-n2-spi.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-g12b-waveshare-cm4-io-base-usb.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-i2cA.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-i2cB.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-m5-rtl8822cs.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartAO_B.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA_cts_rts.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-sm1-jethome-jethub-j200-spi.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-uartA.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-uartC.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-w1-gpio.dtso create mode 100644 patch/kernel/archive/meson64-6.10/overlay/meson-w1AB-gpio.dtso create mode 100644 patch/kernel/archive/meson64-6.6/dt/meson-axg-amper-gateway-am-gz80x.dts create mode 100644 patch/kernel/archive/mvebu-6.10/09-pci-link-retraining.patch.disabled create mode 100644 patch/kernel/archive/mvebu-6.10/91-01-libata-add-ledtrig-support.patch.disabled create mode 100644 patch/kernel/archive/mvebu-6.10/91-02-Enable-ATA-port-LED-trigger.patch.disabled create mode 100644 patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-add_wake_on_gpio_support.patch create mode 100644 patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-remove-hardcoded-timer-assignment.patch.disabled create mode 100644 patch/kernel/archive/mvebu-6.10/94-helios4-dts-add-wake-on-lan-support.patch create mode 100644 patch/kernel/archive/mvebu-6.10/compile-dtb-with-symbol-support.patch create mode 100644 patch/kernel/archive/mvebu-6.10/dts-disable-spi-flash-on-a388-microsom.patch create mode 100644 patch/kernel/archive/mvebu-6.10/general-increasing_DMA_block_memory_allocation_to_2048.patch create mode 100644 patch/kernel/archive/mvebu-6.10/unlock_atheros_regulatory_restrictions.patch create mode 100644 patch/kernel/archive/odroidxu4-6.6/patch-6.6.44-45.patch create mode 100644 patch/kernel/archive/odroidxu4-6.6/patch-6.6.45-46.patch create mode 100644 patch/kernel/archive/odroidxu4-6.6/patch-6.6.46-47.patch create mode 100644 patch/kernel/archive/rockchip-6.10/0000.patching_config.yaml create mode 100644 patch/kernel/archive/rockchip-6.10/armbian.series create mode 100644 patch/kernel/archive/rockchip-6.10/dt/rk322x-box.dts create mode 100644 patch/kernel/archive/rockchip-6.10/dt/rk3288-xt-q8l-v10.dts create mode 100644 patch/kernel/archive/rockchip-6.10/kernel-6.8-tools-cgroup-makefile.patch create mode 100644 patch/kernel/archive/rockchip-6.10/libreelec.series create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/Makefile create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/README.rk322x-overlays create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/README.rockchip-overlays create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-bt-8723cs.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs-lv.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-stability.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-330.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-528.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-660.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-800.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph180.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph45.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-hs200.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-pins.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-fixup.scr-cmd create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-ir-wakeup.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf-default.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf1.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf2.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf3.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf4.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf5.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf6.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf7.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf8.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-nand.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-usb-otg-peripheral.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rk322x-wlan-alt-wiring.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-fixup.scr-cmd create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart1.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart1.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart2.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart2.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart4.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart4.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtbo create mode 100644 patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtso create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/bt-broadcom-serdev-workaround.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rk322x-composite-mmc-clk.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rockchip-max-frac-divider.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk322x-audio-codec.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk3288-gpiomem.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/driver-tinkerboard-alc4040-codec.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-plane-overlay.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-yuv-10bit-modes.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rockchip-hardware-cursor.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-fan.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-hevc-rga.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-mali-gpu.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-regulator-fix.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-iep-node.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-pinctrl-nand.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-disable-serial-dma.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-fix-mmc-aliases.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-gpu-500mhz-opp.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-pinctrl-spi2.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-thermal-rearrange-zones.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-rtl8723bs.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-uart-pins.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-hevc-rga.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdio-wifi.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdmmc-properties.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-spi-interface.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/dts-veyron-flag-cache-flush.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-compilation-support.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-configfs.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-restart-handler-for-act8846.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-peripheral.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-time.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-nak-gadget.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-fix-reboot-from-kwiboo.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-linux-export-mm-trace-rss-stats.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-rk322x-gpio-ir-driver.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/general-rockchip-various-fixes.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-rk322x-box.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-xt-q8l-v10.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/misc-tinkerboard-spi-interface.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/mmc-tinkerboard-sdmmc-reboot-fix.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-01-sipv2-calls.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-02-sip-constants.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-03-dfi-driver.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-04-driver.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dwc2-no-clock-gating.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-usb-reset-props.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-ath9k-no-bulk-EP3-EP4.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-add-bcm43342.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-ap6330-firmware.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-esp8089.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-ssv6051.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0002-rockchip-from-list.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0011-v4l2-from-list.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1000-drm-rockchip.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1001-v4l2-rockchip.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1002-for-libreelec.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1003-temp-dw_hdmi-rockchip.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2000-v4l2-wip-rkvdec-hevc.patch create mode 100644 patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2001-v4l2-wip-iep-driver.patch create mode 100644 patch/kernel/archive/rockchip-6.10/series.conf create mode 100644 patch/kernel/archive/rockchip-rk3588-6.10/0113-add-synopsys-designware-hdmi-rx-controller.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.10/overlay/rockchip-rk3588-hdmirx.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.10/rk3588-rock-5b_dts_add_rfkill-bt.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0000.patching_config.yaml create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0001-general-add-overlay-support.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0010-fix-clk-divisions.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0011-irqchip-fix-its-timeout-issue.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0024-RK3588-Add-Crypto-Support.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0025-RK3588-Add-HW-RNG-Support.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0026-RK3588-Add-VPU121-H.264-Decoder-Support.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0027-RK3588-Add-rkvdec2-Support-v3.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0028-media-v4l2-core-Initialize-h264-frame_mbs_only_flag-.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0029-arm64-dts-rockchip-rk3588-add-RGA2-node.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0113-add-synopsys-designware-hdmi-rx-controller.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0130-phy-phy-rockchip-samsung-hdptx-Enable-runtime-PM.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0131-phy-phy-rockchip-samsung-hdptx-Add-clock-provider.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0132-phy-phy-rockchip-samsung-hdptx-Add-FRL-EARC-support.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0133-drm-rockchip-vop2-Improve-display-modes-handling.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0134-drm-bridge-synopsys-Add-initial-support-for-DW-HDMI-Controller.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0135-arm64-dts-rockchip-Add-HDMI0-bridge-CLK-to-rk3588.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0170-drm-rockchip-vop2-add-clocks-reset-support.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0801-wireless-add-bcm43752.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/0802-wireless-add-clk-property.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1010-arm64-dts-rock-5b-Slow-down-emmc-to-hs200-and-add-ts.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1012-arm64-dts-rockchip-Enable-HDMI0-on-rock-5b.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1014-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-rock5b.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1020-Add-HDMI-and-VOP2-to-Rock-5A.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1021-arch-arm64-dts-enable-gpu-node-for-rock-5a.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1021-arm64-dts-Add-missing-nodes-to-Orange-Pi-5-Plus.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1023-arm64-dts-rockchip-add-PCIe-for-M.2-E-Key-to-rock-5a.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1031-arm64-dts-rockchip-Add-HDMI-support-to-ArmSoM-Sige7.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1032-arm64-dts-rockchip-Add-ap6275p-wireless-support-to-A.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1040-board-khadas-edge2-add-nodes.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1041-board-khadas-edge2-mcu.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/1051-arm64-dts-rockchip-Add-NanoPC-T6-SPI-Flash.patch create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-bananapi-m7.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-hinlink-h88k.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-mixtile-blade3.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-nanopc-cm3588-nas.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6c.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6s.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5b.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-rock-5c.dts create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/Makefile create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-hdmirx.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-i2c8-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm10-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm12-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m3.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm2-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m3.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm5-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m3.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm8-m0.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart1-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart3-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart4-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart6-m1.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart7-m2.dtso create mode 100644 patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart8-m1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml create mode 100644 patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/board-station-p2.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts create mode 100755 patch/kernel/archive/rockchip64-6.10/dt/rk3328-heltec.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-pll-hdmi-timings.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-add-xtx-spi-nor-chips.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-cryptov1-trng.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-disable-mtu-validation.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-fix-es8316-kernel-panic.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-fix-inno-usb2-phy-init.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-fix-mmc-signal-voltage-before-reboot.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-hdmi-clock-fixes.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-increasing_DMA_block_memory_allocation_to_2048.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-legacy-rockchip-hwrng.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-legacy-rockchip-hwrng_5.10.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-possibility-of-disabling-rk808-rtc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rk3328-dtsi-trb-ent-quirk.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rk808-configurable-switch-voltage-steps.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rockchip-overlays.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-rt5651-add-mclk.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-iep-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-rkvdec-00-fixes.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-rkvdec-01-vp9.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-v4l2-rkvdec-02-hevc.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/general-workaround-broadcom-bt-serdev.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/kernel-6.8-tools-cgroup-makefile.patch create mode 120000 patch/kernel/archive/rockchip64-6.10/media-0001-Add-rkvdec2-Support-v3.patch create mode 120000 patch/kernel/archive/rockchip64-6.10/media-0002-v4l2-core-Initialize-h264-frame_mbs_only_flag-.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/media-0003-rk3568-disable-hantro-h264.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/net-usb-r8152-add-LED-configuration-from-OF.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/Makefile create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/README.rockchip-overlays create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-b@1.3ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-bs.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-bs@1.3ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-emmc.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-s0-ext-antenna.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-sdio@10mhz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rk3308-sdio@4mhz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-fixup.scr-cmd create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-cpu-hs.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-emmc-ddr.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-emmc-hs200.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf3.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-led-conf4.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-wlan-ap6330.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-wlan-ap6334.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3318-box-wlan-ext.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-i2c0.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-i2s1-pcm5102.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-opp-1.4ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-opp-1.5ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-spi-spidev.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3328-uart1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-dwc3-0-host.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-i2c7.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-i2c8.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-opp-2ghz.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-pcie-gen2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-spi-jedec-nor.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-spi-spidev.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-uart4.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3399-w1-gpio.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3566-sata2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-i2c0.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-i2c1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-pwm1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-pwm2.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-pwm9.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-spi-spidev.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-uart0-rts_cts.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-uart0.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-hk-uart1.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-nanopi-r5c-leds.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rk3568-nanopi-r5s-leds.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rockpi4cplus-usb-host.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/overlay/rockchip-rockpro64-lcd.dtso create mode 100644 patch/kernel/archive/rockchip64-6.10/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/regulator-add-fan53200-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-0001-pinctrl-slew-mux.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-0002-iodomains.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-0003-pinctrl-io-voltage-domains.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3308-add-missing-i2s-controllers.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-add-dmc-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-add-rga-node.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-mali-opp-table.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-mmc-reset-properties.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-sdmmc-ext-node.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-spdif.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-dtsi-usb3-reset-properties.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-gpu-cooling-target.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3328-roc-cc-add-missing-nodes.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-add-sclk-i2sout-src-clock.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-dmc-polling-rate.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-enable-dwc3-xhci-usb-trb-quirk.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-fix-pci-phy.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-fix-usb-phy.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-sd-drive-level-8ma.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-sd-pwr-pinctrl.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk3399-unlock-temperature.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk356x-add-rkvdec2-support.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/rk35xx-montjoie-crypto-v2-rk35xx.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/wifi-4003-add-bcm43342-chip.patch create mode 100644 patch/kernel/archive/rockchip64-6.10/wifi-4003-ssv-6051-driver.patch create mode 100644 patch/kernel/archive/rockchip64-6.6/board-rockpis-0001-arm64-dts.patch.disabled create mode 100644 patch/kernel/archive/rockchip64-6.6/board-station-p2.patch create mode 100644 patch/kernel/archive/rockchip64-6.6/drivers-regulator-fan53555-bug-fixed.patch create mode 100755 patch/kernel/archive/rockchip64-6.6/dt/rk3328-heltec.dts create mode 100644 patch/kernel/archive/rockchip64-6.6/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch create mode 100644 patch/kernel/archive/rockchip64-6.9/drivers-regulator-fan53555-bug-fixed.patch create mode 100755 patch/kernel/archive/rockchip64-6.9/dt/rk3328-heltec.dts create mode 100644 patch/kernel/archive/rockchip64-6.9/pinctrl-rockchip-correct-RK3328-iomux-width-flag-for-GPIO2-B-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.10/arm-patch-call-flush_icache-ASAP-after-writing-new-instruction.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-axp813-Add-charger-LED.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun5i-Add-PocketBook-Touch-Lux-3-display-ctp-support.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun5i-Add-soc-handle.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun5i-a13-pocketbook-touch-lux-3-Add-RTC-clock-cells.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Add-MBUS-node.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Add-cedrus-video-codec-support-to-A83T-untes.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Add-missing-GPU-trip-point.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Enable-hdmi-sound-card-on-boards-with-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Improve-CPU-OPP-tables-go-up-to-1.8GHz.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-Set-fifo-size-for-uarts.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-PN544-NFC-support.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-camera-sensors-HM5065-GC2145.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-flash-led-support.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-powerup-down-support-for-the-3G.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-regulators-to-the-accelerometer.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-sound-support-via-AC100-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-support-for-the-vibrator-motor.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Enable-charging-LED.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Give-Linux-more-privileges-over-SCP.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Increase-voltage-on-the-vibrator.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-h2-plus-bananapi-m2-zero-Enable-HDMI-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-h3-Enable-hdmi-sound-card-on-boards-with-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-h3-Use-my-own-more-aggressive-OPPs-on-H3.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-h3-orange-pi-one-Enable-all-gpio-header-UARTs.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-h3-orange-pi-pc-Increase-max-CPUX-voltage-to-1.4V.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-r40-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-r40-bananapi-m2-ultra-Enable-HDMI-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sun8i-v40-bananapi-m2-berry-Enable-HDMI-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-suni-a83t-Add-i2s0-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sunxi-Add-aliases-for-MMC.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sunxi-a83t-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sunxi-a83t-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sunxi-h3-h5-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sunxi-h3-h5-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-dts-sunxi-h3-h5-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-sunxi-Add-experimental-suspend-to-memory-implementation-for.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-sunxi-Use-SCPI-to-send-suspend-message-to-SCP-on-A83T.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ARM-sunxi-sunxi_cpu0_hotplug_support_set-is-not-supported-on-A8.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASOC-sun9i-hdmi-audio-Initial-implementation.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-codec-es8316-DAC-Soft-Ramp-Rate-is-just-a-2-bit-control.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-ec25-New-codec-driver-for-the-EC25-modem.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-rockchip-Fix-doubling-of-playback-speed-after-system-sleep.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-simple-card-Allow-to-define-pins-for-aux-jack-devices.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-sun8i-codec-Add-debug-output-for-jack-detection.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-sun8i-codec-Allow-the-jack-type-to-be-set-via-device-tree.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-sun8i-codec-Set-jack_type-from-DT-in-probe.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/ASoC-sun8i-codec-define-button-keycodes.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Add-README.md-with-information-and-u-boot-patches.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Add-support-for-my-private-Sapomat-device.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Defconfigs-for-all-my-devices.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Fix-for-usb-gadget-on-PP.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Fix-intptr_t-typedef.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/MAINTAINERS-Add-entry-for-Himax-HM5065.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Make-microbuttons-on-Orange-Pi-PC-and-PC-2-work-as-power-off-bu.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Mark-some-slow-drivers-for-async-probe-with-PROBE_PREFER_ASYNCH.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Revert-clk-qcom-Support-protected-clocks-property.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Revert-drm-sun4i-lvds-Invert-the-LVDS-polarity.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Revert-usb-typec-tcpm-unregister-existing-source-caps-before-re.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/Update-defconfigs.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-allwinner-dts-a64-enable-K101-IM2BYL02-panel-for-PineTab.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-Enforce-consistent-MMC-numbering.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-a64-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-a64-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-a64-Enable-hdmi-sound-card-on-boards-with-h.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-a64-Fix-LRADC-compatible.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-a64-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-a64-pinetab-add-front-camera.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-h5-Enable-hdmi-sound-card-on-boards-with-hd.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-h6-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-h6-Enable-hdmi-sound-card-on-boards-with-hd.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-h6-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-allwinner-orange-pi-3-Enable-ethernet.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-rockchip-rk356x-Fix-PCIe-register-map-and-ranges.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50-a64-pinephone-Define-jack-pins-in-DT.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-Add-missing-trip-points-for-GPU.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-Set-fifo-size-for-uarts.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-AF8133J-to-PinePhone.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-Type-C-support-for-all-PP-va.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-detailed-OCV-to-capactiy-con.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-front-back-cameras.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-interrupt-pin-for-WiFi.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-modem-power-manager.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-mount-matrix-for-PinePhone-m.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-mount-matrix-for-acceleromet.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-power-supply-to-stk3311.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-reboot-mode-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-supply-for-i2c-bus-to-anx768.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-Bluetooth-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-Pinephone-1.2-be.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-Pinephone-keyboa.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-modem-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Bump-I2C-frequency-to-400kHz.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Don-t-make-lradc-keys-a-wakeup-s.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Enable-Pinephone-Keyboard-power-.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Enable-internal-HMIC-bias.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Fix-BH-modem-manager-behavior.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Power-off-the-touch-controller-i.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Set-minimum-backlight-duty-cycle.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Shorten-post-power-on-delay-on-m.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Use-newer-jack-detection-impleme.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinephone-Workaround-broken-HDMI-HPD-signa.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinetab-Add-accelerometer.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinetab-Name-sound-card-PineTab.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-a64-pinetab-enable-RTL8723CS-bluetooth.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-h5-Add-missing-GPU-trip-point.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-dts-sun50i-h5-Use-my-own-more-aggressive-OPPs-on-H5.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/arm64-xor-Select-32regs-without-benchmark-to-speed-up-boot.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/bluetooth-bcm-Restore-drive_rts_on_open-true-behavior-on-bcm207.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/bus-sunxi-rsb-Always-check-register-address-validity.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/clk-Implement-protected-clocks-for-all-OF-clock-providers.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/clk-sunxi-ng-Don-t-use-CPU-PLL-gating-and-CPUX-reparenting-to-H.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/clk-sunxi-ng-Export-CLK_DRAM-for-devfreq.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/clk-sunxi-ng-Set-maximum-P-and-M-factors-to-1-for-H3-pll-cpux-c.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/clk-sunxi-ng-a64-Increase-PLL_AUDIO-base-frequency.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/clk-sunxi-ng-sun50i-a64-Switch-parent-of-MIPI-DSI-to-periph0-1x.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/cpufreq-sun50i-Show-detected-CPU-bin-for-easier-debugging.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-bridge-dw-hdmi-Allow-to-accept-HPD-status-from-other-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-bridge-dw-hdmi-Report-HDMI-hotplug-events.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-panel-st7703-Fix-xbd599-timings-to-make-refresh-rate-exactl.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-rockchip-dw-mipi-dsi-rockchip-Fix-ISP1-PHY-initialization.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-rockchip-dw-mipi-dsi-rockchip-Restore-DPHY-config-on-resume.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-Add-more-parameters-to-sunxi_engine-commit-callback.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-Fix-layer-zpos-change-atomic-modesetting.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-Implement-gamma-correction.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-Unify-sun8i_-_layer-structs.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-drm-Change-update_bits-to-write.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/drm-sun4i-tcon-Support-keeping-dclk-rate-upon-ancestor-clock-ch.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/dt-bindings-axp20x-adc-allow-to-use-TS-pin-as-GPADC.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/dt-bindings-input-gpio-vibrator-Don-t-require-enable-gpios.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/dt-bindings-leds-Add-a-binding-for-AXP813-charger-led.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/dt-bindings-media-Add-bindings-for-Himax-HM5065-camera-sensor.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/dt-bindings-mfd-Add-codec-related-properties-to-AC100-PMIC.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/dt-bindings-sound-Add-jack-type-property-to-sun8i-a33-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/firmware-arm_scpi-Support-unidirectional-mailbox-channels.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/firmware-scpi-Add-support-for-sending-a-SCPI_CMD_SET_SYS_PWR_ST.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/gnss-ubx-Send-soft-powerdown-message-on-suspend.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/hm5065-yaml-bindings-wip.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/i2c-mv64xxx-Don-t-make-a-fuss-when-pinctrl-recovery-state-is-no.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/iio-adc-axp20x_adc-allow-to-set-TS-pin-to-GPADC-mode.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/iio-adc-sun4i-gpadc-iio-Allow-to-use-sun5i-a13-gpadc-iio-from-D.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/iio-st_sensors-Don-t-report-error-when-the-device-is-not-presen.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Clear-the-ids-buffer-in-a-saner-way.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-De-obfuscate-MT-signals-setup-platform-data.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-De-obfuscate-platform-data-for-keys.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-ENOSYS-error-is-ok-when-powering-up.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Faster-recovery-from-failed-wakeup-HACK.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Fix-probe-oops.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Fix-warnings.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Make-the-driver-not-hog-the-system-s-workqueue.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Port-the-driver-to-use-device-properties.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Remove-unused-enable_vkeys.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Remove-useless-indirection-with-driver-platform-d.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Restart-on-wakeup-wakeup-by-I2C-read-doesn-t-work.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-cyttsp4-Use-i2c-spi-names-directly-in-the-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/input-gpio-vibra-Allow-to-use-vcc-supply-alone-to-control-the-v.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/leds-axp20x-Support-charger-LED-on-AXP20x-like-PMICs.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mailbox-Allow-to-run-mailbox-while-timekeeping-is-suspended.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-cedrus-Fix-failure-to-clean-up-hardware-on-probe-failure.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-gc2145-Add-PIXEL_RATE-HBLANK-and-VBLANK-controls.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-gc2145-Added-BGGR-bayer-mode.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-gc2145-Disable-debug-output.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-gc2145-Galaxycore-camera-module-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-gc2145-fix-white-balance-colors.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-gc2145-implement-system-suspend.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-hm5065-Add-subdev-driver-for-Himax-HM5065-camera-sensor.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-i2c-gc2145-Move-upstream-driver-out-of-the-way.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-i2c-gc2145-Parse-and-register-properties.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Add-read-only-property-for-vblank.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Don-t-powerup-the-sensor-during-driver-probe.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Experiment-Try-to-disable-denoising-sharpening.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Fix-focus-commands-blocking-until-complete.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Implement-autofocus.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Improve-error-reporting.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Improve-firmware-load-time.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-Sleep-after-poweroff-to-ensure-next-poweron-is-not.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-set-default-ae-target-lower.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5640-use-pm_runtime_force_suspend-resume-for-system-sus.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-ov5648-Fix-call-to-pm_runtime_set_suspended.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-rkisp1-Adapt-to-different-SoCs-having-different-size-limi.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-sun6i-csi-Add-multicamera-support-for-parallel-bus.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-sun6i-csi-add-V4L2_CAP_IO_MC-capability.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-sun6i-csi-capture-Use-subdev-operation-to-access-bridge-f.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-sun6i-csi-implement-vidioc_enum_framesizes.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-sun6i-csi-merge-sun6i_csi_formats-and-sun6i_csi_formats_m.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/media-sun6i-csi-subdev-Use-subdev-active-state-to-store-active-.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mfd-axp20x-Add-battery-IRQ-resources.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/misc-modem-power-Power-manager-for-modems.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mmc-add-delay-after-power-class-selection.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mmc-dw-mmc-rockchip-fix-sdmmc-after-soft-reboot.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mmc-sunxi-mmc-Remove-runtime-PM.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mtd-spi-nor-Add-Alliance-memory-support.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/mtd-spi-nor-Add-vdd-regulator-support.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/net-stmmac-sun8i-Add-support-for-enabling-a-regulator-for-PHY-I.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/net-stmmac-sun8i-Rename-PHY-regulator-variable-to-regulator_phy.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/net-stmmac-sun8i-Use-devm_regulator_get-for-PHY-regulator.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/nfc-pn544-Add-support-for-VBAT-PVDD-regulators.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/opp-core-Avoid-confusing-error-when-no-regulator-is-defined-in-.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/pci-Workaround-ITS-timeouts-on-poweroff-reboot-on-Orange-Pi-5-P.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/phy-allwinner-sun4i-usb-Add-support-for-usb_role_switch.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-axp20x_battery-Allow-to-set-target-voltage-to-4.35V.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-axp803-Add-interrupts-for-low-battery-power-condition.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-Add-support-for-USB_BC_ENABLED-and-USB_DCP_INPUT_C.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x-battery-Add-support-for-POWER_SUPPLY_PROP_E.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x-battery-Enable-poweron-by-RTC-alarm.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x-battery-Support-POWER_SUPPLY_PROP_CHARGE_BE.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x-usb-power-Add-missing-interrupts.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x-usb-power-Change-Vbus-hold-voltage-to-4.5V.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x_battery-Add-support-for-reporting-OCV.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x_battery-Fix-charging-done-detection.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x_battery-Monitor-battery-health.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x_battery-Send-uevents-for-status-changes.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/power-supply-axp20x_battery-Setup-thermal-regulation-experiment.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/regulator-Add-simple-driver-for-enabling-a-regulator-from-users.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/regulator-axp20x-Add-support-for-vin-supply-for-drivevbus.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/regulator-axp20x-Enable-over-temperature-protection-and-16s-res.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/regulator-axp20x-Turn-N_VBUSEN-to-input-on-x-powers-sense-vbus-.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/regulator-tp65185-Add-hwmon-device-for-reading-temperature.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/regulator-tp65185x-Add-tp65185x-eInk-panel-regulator-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/rtc-Print-which-error-caused-RTC-read-failure.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/rtc-sun6i-Allow-RTC-wakeup-after-shutdown.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/sound-soc-ac100-codec-Support-analog-part-of-X-Powers-AC100-cod.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/sound-soc-sun8i-codec-Add-support-for-digital-part-of-the-AC100.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/spi-fixes.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/spi-rockchip-Fix-runtime-PM-and-other-issues.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/sunxi-Use-dev_err_probe-to-handle-EPROBE_DEFER-errors.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/thermal-sun8i-Be-loud-when-probe-fails.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs-where-it-s.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-serial-option-add-reset_resume-callback-for-WWAN-devices.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-altmodes-displayport-Respect-DP_CAP_RECEPTACLE-bit.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-anx7688-Add-driver-for-ANX7688-USB-C-HDMI-bridge.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-anx7688-Port-to-Linux-6.10.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-anx7688-Port-to-Linux-6.9.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Add-OF-extcon-support.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Clear-interrupts-before-we-start-toggling.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Extend-debugging-interface-with-driver-state-.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Fix-register-definitions.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-More-useful-of-logging-status-on-interrupt.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Retry-reading-of-CC-pins-status-if-activity-i.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Set-the-current-before-enabling-pullups.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Slightly-increase-wait-time-for-BC1.2-result.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-interrupt-is-n.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-tcpm-Fix-PD-devices-capabilities-registration.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-tcpm-Improve-logs.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-tcpm-Unregister-altmodes-before-registering-new-ones.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-typec-extcon-Add-typec-extcon-bridge-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-typec-extcon-Allow-to-force-reset-on-each-mux-change.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/usb-typec-typec-extcon-Enable-debugging-for-now.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/video-fbdev-eInk-display-driver-for-A13-based-PocketBooks.patch create mode 100644 patch/kernel/archive/sunxi-6.10/patches.megous/video-pwm_bl-Allow-to-change-lth_brightness-via-sysfs.patch create mode 100644 patch/kernel/archive/sunxi-6.10/series.conf create mode 100644 patch/kernel/archive/sunxi-6.10/series.megous create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/ARM-dts-sun8i-nanopiduo2-Use-key-0-as-power-button.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/ARM-dts-sun8i-nanopiduo2-enable-ethernet.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Add-FB_TFT-ST7796S-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Add-wifi-nodes-for-Inovato-Quadra.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Add-ws2812-RGB-driver-for-allwinner-H616.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Input-axp20x-pek-allow-wakeup-after-shutdown.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/LED-green_power_on-red_status_heartbeat-arch-arm64-boot-dts-all.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Optimize-TSC2007-touchscreen-add-polling-method.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Sound-for-H616-H618-Allwinner-SOCs-arch-arm64-boot-dts-allwinne.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/Temp_fix-mailbox-arch-arm64-boot-dts-allwinner-sun50i-a64-pinep.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/add-bigtreetech-cb1-dts.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/add-dtb-overlay-for-zero2w.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/add-nodes-for-sunxi-info-sunxi-addr-and-sunxi-dump-reg.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/adding-dummy-regulators-in-pinctr-arch-arm-boot-dts-allwinner-s.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arch-arm64-dts-allwinner-sun50i-h616-PG-12c-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arch-arm64-dts-allwinner-sun50i-h616-spi1-cs1-pin.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arch-arm64-dts-allwinner-sun50i-h618-bananapi-m4-zero.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm-dts-sun8i-h3-reduce-opp-microvolt-to-prevent-not-supported-.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-H616-Add-overlays-that-are-also-compatible-with-orang.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-allwiner-sun50i-h616.dtsi-add-usb-ehci-ohci.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-allwinner-h616-Add-efuse_xlate-cpu-frequency-scaling-.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-allwinner-h616-Fix-thermal-zones-add-missing-trips.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-allwinner-h616-orangepi-zero2-Enable-expansion-board-.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-h616-add-wifi-support-for-orange-pi-zero-2-and-zero3.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-sun50i-h313-x96q-lpddr3.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-sun50i-h5-nanopi-r1s-h5-add-rtl8153-support.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1-enable-emac1.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1-enable-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1-enable-ir-receiver.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/cb1-overlay.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/driver-allwinner-h618-emac.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/drivers-pwm-Add-pwm-sunxi-enhance-driver-for-h616.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/enable-TV-Output-on-OrangePi-Zero-LTE.patch create mode 100644 patch/kernel/archive/sunxi-6.6/patches.armbian/orangepi-zero2w-add-dtb.patch create mode 100644 patch/kernel/archive/sunxi-6.7/patches.armbian/arm64-dts-sun50i-h313-x96q-lpddr3.patch create mode 120000 patch/kernel/archive/sunxi-6.7/patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1-enable-emac1.patch create mode 120000 patch/kernel/archive/sunxi-6.7/patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1-enable-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/arm-patch-call-flush_icache-ASAP-after-writing-new-instruction.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/ARM-dts-sun8i-nanopiduo2-Use-key-0-as-power-button.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/ARM-dts-sun8i-nanopiduo2-enable-ethernet.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/ASoC-AC200-Initial-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Add-FB_TFT-ST7796S-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Add-dump_reg-and-sunxi-sysinfo-drivers.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Add-sunxi-addr-driver-Used-to-fix-uwe5622-bluetooth-MAC-address.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Add-wifi-nodes-for-Inovato-Quadra.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Add-ws2812-RGB-driver-for-allwinner-H616.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Bananapro-add-AXP209-regulators.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Doc-dt-bindings-usb-add-binding-for-DWC3-controller-on-Allwinne.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Fix-include-uapi-spi-spidev-module.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Input-axp20x-pek-allow-wakeup-after-shutdown.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/LED-green_power_on-red_status_heartbeat-arch-arm64-boot-dts-all.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Makefile-CONFIG_SHELL-fix-for-builddeb-packaging.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Optimize-TSC2007-touchscreen-add-polling-method.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/Temp_fix-mailbox-arch-arm64-boot-dts-allwinner-sun50i-a64-pinep.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/add-initial-support-for-orangepi3-lts.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/add-nodes-for-sunxi-info-sunxi-addr-and-sunxi-dump-reg.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/adding-dummy-regulators-in-pinctr-arch-arm-boot-dts-allwinner-s.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arch-arm64-dts-allwinner-sun50i-h616-PG-12c-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arch-arm64-dts-allwinner-sun50i-h616-spi1-cs1-pin.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arch-arm64-dts-allwinner-sun50i-h618-bananapi-m4-zero.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-arm64-dts-Add-leds-axp20x-charger.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-Add-sun8i-h2-plus-nanopi-duo-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-Add-sun8i-h2-plus-sunvell-r69-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-a10-cubiebord-a20-cubietruck-green-LED-mmc0-default-tri.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-a20-orangepi-and-mini-fix-phy-mode-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-h3-nanopi-neo-Add-regulator-leds-mmc2.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-h3-nanopi-neo-air-Add-regulator-camera-wifi-bluetooth-o.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-h3-orangepi-2-Add-regulator-vdd-cpu.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-overlay-Add-Overlays-for-sunxi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-overlay-sun8i-h3-cpu-clock-add-overclock.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun5i-a13-olinuxino-Add-panel-lcd-olinuxino-4.3-needed-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun5i-a13-olinuxino-micro-add-panel-lcd-olinuxino-4.3.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-Disable-OOB-IRQ-for-brcm-wifi-on-Cubietruck-a.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-bananapro-add-hdmi-connector-de.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-cubietruck-add-alias-uart2.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-olimex-som-204-evb-olinuxino-micro-decrease-d.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-olinuxino-lime2-enable-audio-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-olinuxino-lime2-enable-ldo3-always-on.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun7i-a20-olinuxino-micro-emmc-Add-vqmmc-node.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-h2-plus-orangepi-zero-fix-xradio-interrupt.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-h3-add-thermal-zones.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-h3-bananapi-m2-plus-add-wifi_pwrseq.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-h3-nanopi-add-leds-pio-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-h3-orangepi-pc-plus-add-wifi_pwrseq.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-h3-reduce-opp-microvolt-to-prevent-not-supported-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-r40-add-clk_out_a-fix-bananam2ultra.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-r40-bananapi-m2-ultra-add-codec-analog.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun8i-v3s-s3-pinecube-enable-sound-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun9i-a80-add-thermal-sensor.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sun9i-a80-add-thermal-zone.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sunxi-h3-h5.dtsi-add-i2s0-i2s1-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm-dts-sunxi-h3-h5.dtsi-force-mmc0-bus-width.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-Add-sun50i-h5-nanopi-k1-plus-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-Add-sun50i-h5-nanopi-m1-plus2-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-Add-sun50i-h5-nanopi-neo-core2-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-Add-sun50i-h5-nanopi-neo2-v1.1-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-FIXME-a64-olinuxino-add-regulator-audio-mmc.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-H616-Add-overlays-that-are-also-compatible-with-orang.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwiner-sun50i-h616.dtsi-add-usb-ehci-ohci.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-Add-Overlays-for-sunxi64.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h6-Add-AC200-EPHY-nodes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h6-add-AC200-codec-nodes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h6-enable-AC200-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h6-tanix-enable-Ethernet.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h616-Add-device-node-for-SID.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h616-Add-efuse_xlate-cpu-frequency-scaling-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h616-Add-thermal-sensor-and-thermal-zones.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-h616-orangepi-zero2-Enable-expansion-board-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-sun50i-h6-Fix-H6-emmc.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-sun50i-h616-Add-GPU-node.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-allwinner-sun50i-h616-Add-VPU-node.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-h616-add-hdmi-support-for-zero2-and-zero3.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-h616-add-wifi-support-for-orange-pi-zero-2-and-zero3.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-nanopi-a64-set-right-phy-mode-to-rgmii-id.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-overlay-sun50i-a64-pine64-7inch-lcd.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-overlay-sun50i-h5-add-gpio-regulator-overclock.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-force-mmc0-bus-width.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-Disable-clock-phase-and-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-enable-bluetooth.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-olinuxino-add-boards.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-olinuxino-emmc-enable-bluetooth.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-orangepi-win-add-aliase-ethernet1.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-pine64-add-spi0.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-pine64-enable-Bluetooth.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-pine64-enable-wifi-mmc1.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-sopine-baseboard-Add-i2s2-mmc1.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64-sopine-baseboard-enable-Bluetooth.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-a64.dtsi-adjust-thermal-trip-points.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-add-cpu-opp-refs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-add-termal-zones.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-enable-power-button-for-orangepi-prime.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-nanopi-neo2-add-regulator-led-triger.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-nanopi-r1s-h5-add-rtl8153-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-orangepi-pc2-add-spi-flash.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-orangepi-prime-add-regulator.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-orangepi-prime-add-rtl8723cs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-orangepi-zero-plus-add-regulator.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h5-orangepi-zero-plus2-regulator-gpio-fix.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-Add-r_uart-uart2-3-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-orangepi-3-add-r_uart-aliase.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-orangepi-3-delete-node-spi0.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-orangepi-add-cpu-opp-refs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-orangepi-enable-higher-clock-regulator-max-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-orangepi-lite2-spi0-usb3phy-dwc3-enable.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-pine-h64-add-dwc3-usb3phy.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6-pine-h64-add-wifi-rtl8723cs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6.dtsi-add-pinctrl-pins-for-spi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h6.dtsi-improve-thermals.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-Enable-GPU-mali.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-reg_usb1_vbus-status-ok.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h616-x96-mate-T95-eth-sd-card-hack.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h616-x96-mate-add-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/arm64-dts-sun50i-h618-orangepi-zero3-Enable-GPU-mali.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/cb1-overlay.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/clk-gate-add-support-for-regmap-based-gates.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/driver-allwinner-h618-emac.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drivers-devfreq-sun8i-a33-mbus-disable-autorefresh.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drivers-pwm-Add-pwm-sunxi-enhance-driver-for-h616.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-clk-sunxi-ng-ccu-add-min-max-rate-sun50i-a64.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-clocksource-arm_arch_timer-fix-a64-timejump.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-gpu-drm-gem-dma-Export-with-handle-allocator.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-gpu-drm-panel-simple-Add-compability-olinuxino-lcd.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-gpu-drm-sun4i-Add-GEM-allocator.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-gpu-drm-sun4i-Add-HDMI-audio-sun4i-hdmi-encoder.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-gpu-drm-sun4i-sun8i_mixer.c-add-h3-mixer1.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-iio-adc-axp20x_adc-arm64-dts-axp803-hwmon-enable-thermal.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-input-touchscreen-sun4i-ts-Enable-parsing.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-media-dvb-frontends-si2168-fix-cmd-timeout.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-mfd-axp20x-add-sysfs-interface.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-mmc-host-sunxi-mmc-Disable-DDR52-mode-on-all-A20-based-boar.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-mmc-host-sunxi-mmc-add-h5-emmc-compatible.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-mtd-nand-raw-nand_ids.c-add-H27UBG8T2BTR-BC-nand.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-net-stmmac-dwmac-sun8i-second-EMAC-clock-register.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-nvmem-sunxi_sid-Support-SID-on-H616.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-of-Device-Tree-Overlay-ConfigFS-interface.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-phy-sun4i-usb-Allow-reset-line-to-be-shared.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-pinctrl-pinctrl-sun50i-a64-disable_strict_mode.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-pinctrl-sunxi-pinctrl-sun50i-h6.c-GPIO-disable_strict_mode.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-rtc-sun6i-Add-Allwinner-H616-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-rtc-sun6i-support-RTCs-without-external-LOSCs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-soc-sunxi-sram-Add-SRAM-C1-H616-handling.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-spi-spi-sun4i.c-spi-bug-low-on-sck.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-spi-spidev-Add-armbian-spi-dev-compatible.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-staging-media-sunxi-cedrus-add-H616-variant.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-staging-rtl8723bs-AP-bugfix.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/drv-usb-gadget-composite-rename-gadget-serial-console-manufactu.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/enable-TV-Output-on-OrangePi-Zero-LTE.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/fix-cpu-opp-table-sun8i-a83t.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/include-uapi-drm_fourcc-add-ARM-tiled-format-modifier.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/mfd-Add-support-for-X-Powers-AC200-EPHY-syscon.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/mfd-Add-support-for-X-Powers-AC200.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/mmc-host-sunxi-mmc-Fix-H6-emmc.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/net-phy-Add-support-for-AC200-EPHY.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/net-usb-r8152-add-LED-configuration-from-OF.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/nvmem-sunxi_sid-add-sunxi_get_soc_chipid-sunxi_get_serial.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/scripts-add-overlay-compilation-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/sound-soc-sunxi-Provoke-the-early-load-of-sun8i-codec-analog.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/sound-soc-sunxi-sun4i-codec-adcis-select-capture-source.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/sound-soc-sunxi-sun4i-spdif-add-mclk_multiplier.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.armbian/sound-soc-sunxi-sun8i-codec-analog-enable-sound.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/2-arm64-dts-sun50i-Define-orientation-and-rotation-for-PinePhone-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-axp813-Add-charger-LED.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Add-MBUS-node.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Add-cedrus-video-codec-support-to-A83T-untes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Add-missing-GPU-trip-point.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Enable-hdmi-sound-card-on-boards-with-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Improve-CPU-OPP-tables-go-up-to-1.8GHz.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-Set-fifo-size-for-uarts.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-PN544-NFC-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-camera-sensors-HM5065-GC2145.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-flash-led-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-powerup-down-support-for-the-3G.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-regulators-to-the-accelerometer.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-sound-support-via-AC100-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Add-support-for-the-vibrator-motor.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Enable-charging-LED.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Give-Linux-more-privileges-over-SCP.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-a83t-tbs-a711-Increase-voltage-on-the-vibrator.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-h2-plus-bananapi-m2-zero-Enable-HDMI-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-h3-Enable-hdmi-sound-card-on-boards-with-hdmi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-h3-Use-my-own-more-aggressive-OPPs-on-H3.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-h3-orange-pi-one-Enable-all-gpio-header-UARTs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-h3-orange-pi-pc-Increase-max-CPUX-voltage-to-1.4V.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-r40-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-r40-bananapi-m2-ultra-Enable-HDMI-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sun8i-v40-bananapi-m2-berry-Enable-HDMI-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-suni-a83t-Add-i2s0-pins.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sunxi-Add-aliases-for-MMC.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sunxi-a83t-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sunxi-a83t-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sunxi-h3-h5-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sunxi-h3-h5-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-dts-sunxi-h3-h5-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-sunxi-Add-experimental-suspend-to-memory-implementation-for.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-sunxi-Use-SCPI-to-send-suspend-message-to-SCP-on-A83T.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ARM-sunxi-sunxi_cpu0_hotplug_support_set-is-not-supported-on-A8.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASOC-sun9i-hdmi-audio-Initial-implementation.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-codec-es8316-DAC-Soft-Ramp-Rate-is-just-a-2-bit-control.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-ec25-New-codec-driver-for-the-EC25-modem.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-rockchip-Fix-doubling-of-playback-speed-after-system-sleep.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun50i-codec-analog-Enable-jack-detection-on-startup.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun50i-codec-analog-Move-suspend-resume-to-set_bias_level.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-Add-debug-output-for-jack-detection.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-Allow-the-jack-type-to-be-set-via-device-tree.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-Enable-bus-clock-at-STANDBY-and-higher-bias.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-Fix-compilation-without-CONFIG_SND_JACK_INPUT_.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-Implement-jack-and-accessory-detection.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-Set-jack_type-from-DT-in-probe.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/ASoC-sun8i-codec-define-button-keycodes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Add-README.md-with-information-and-u-boot-patches.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Add-support-for-my-private-Sapomat-device.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Defconfigs-for-all-my-devices.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Fix-intptr_t-typedef.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/MAINTAINERS-Add-entry-for-Himax-HM5065.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Make-microbuttons-on-Orange-Pi-PC-and-PC-2-work-as-power-off-bu.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Mark-some-slow-drivers-for-async-probe-with-PROBE_PREFER_ASYNCH.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Move-a-node-to-avoid-merge-conflict.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Revert-clk-qcom-Support-protected-clocks-property.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Revert-drm-sun4i-lvds-Invert-the-LVDS-polarity.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/Revert-usb-typec-tcpm-unregister-existing-source-caps-before-re.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-allwinner-dts-a64-enable-K101-IM2BYL02-panel-for-PineTab.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-Enforce-consistent-MMC-numbering.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-a64-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-a64-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-a64-Enable-hdmi-sound-card-on-boards-with-h.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-a64-Fix-LRADC-compatible.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-a64-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-a64-pinetab-add-front-camera.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-h5-Enable-hdmi-sound-card-on-boards-with-hd.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-h6-Add-SCPI-protocol.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-h6-Add-hdmi-sound-card.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-h6-Enable-hdmi-sound-card-on-boards-with-hd.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-h6-Protect-SCP-clocks.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-allwinner-orange-pi-3-Enable-ethernet.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-rockchip-rk356x-Fix-PCIe-register-map-and-ranges.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-Define-orientation-and-rotation-for-PinePhone-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-Add-missing-trip-points-for-GPU.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-Set-fifo-size-for-uarts.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-AF8133J-to-PinePhone.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-Type-C-support-for-all-PP-va.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-detailed-OCV-to-capactiy-con.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-front-back-cameras.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-interrupt-pin-for-WiFi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-modem-power-manager.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-mount-matrix-for-PinePhone-m.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-mount-matrix-for-acceleromet.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-power-supply-to-stk3311.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-reboot-mode-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-supply-for-i2c-bus-to-anx768.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-Bluetooth-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-Pinephone-1.2-be.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-Pinephone-keyboa.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Add-support-for-modem-audio.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Bump-I2C-frequency-to-400kHz.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Don-t-make-lradc-keys-a-wakeup-s.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Enable-Pinephone-Keyboard-power-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Enable-internal-HMIC-bias.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Fix-BH-modem-manager-behavior.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Power-off-the-touch-controller-i.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Retain-leds-state-in-suspend.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Set-minimum-backlight-duty-cycle.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Shorten-post-power-on-delay-on-m.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Use-newer-jack-detection-impleme.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinephone-Workaround-broken-HDMI-HPD-signa.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinetab-Add-accelerometer.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinetab-Name-sound-card-PineTab.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-a64-pinetab-enable-RTL8723CS-bluetooth.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-h5-Add-missing-GPU-trip-point.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-dts-sun50i-h5-Use-my-own-more-aggressive-OPPs-on-H5.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/arm64-xor-Select-32regs-without-benchmark-to-speed-up-boot.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/bluetooth-bcm-Restore-drive_rts_on_open-true-behavior-on-bcm207.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/bus-sunxi-rsb-Always-check-register-address-validity.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/clk-Implement-protected-clocks-for-all-OF-clock-providers.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/clk-sunxi-ng-Don-t-use-CPU-PLL-gating-and-CPUX-reparenting-to-H.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/clk-sunxi-ng-Export-CLK_DRAM-for-devfreq.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/clk-sunxi-ng-Set-maximum-P-and-M-factors-to-1-for-H3-pll-cpux-c.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/clk-sunxi-ng-a64-Increase-PLL_AUDIO-base-frequency.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/clk-sunxi-ng-sun50i-a64-Switch-parent-of-MIPI-DSI-to-periph0-1x.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/cpufreq-sun50i-Show-detected-CPU-bin-for-easier-debugging.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-bridge-dw-hdmi-Allow-to-accept-HPD-status-from-other-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-bridge-dw-hdmi-Report-HDMI-hotplug-events.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-panel-st7703-Fix-xbd599-timings-to-make-refresh-rate-exactl.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-Add-more-parameters-to-sunxi_engine-commit-callback.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-Fix-layer-zpos-change-atomic-modesetting.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-Implement-gamma-correction.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-Mark-one-of-the-UI-planes-as-a-cursor-one.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-Support-taking-over-display-pipeline-state-from-p-boo.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-Unify-sun8i_-_layer-structs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-drm-Change-update_bits-to-write.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/drm-sun4i-tcon-Support-keeping-dclk-rate-upon-ancestor-clock-ch.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/dt-bindings-axp20x-adc-allow-to-use-TS-pin-as-GPADC.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/dt-bindings-input-gpio-vibrator-Don-t-require-enable-gpios.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/dt-bindings-leds-Add-a-binding-for-AXP813-charger-led.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/dt-bindings-media-Add-bindings-for-Himax-HM5065-camera-sensor.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/dt-bindings-mfd-Add-codec-related-properties-to-AC100-PMIC.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/dt-bindings-sound-Add-jack-type-property-to-sun8i-a33-codec.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/firmware-arm_scpi-Support-unidirectional-mailbox-channels.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/firmware-scpi-Add-support-for-sending-a-SCPI_CMD_SET_SYS_PWR_ST.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/gnss-ubx-Send-soft-powerdown-message-on-suspend.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/hm5065-yaml-bindings-wip.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/i2c-mv64xxx-Don-t-make-a-fuss-when-pinctrl-recovery-state-is-no.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/iio-adc-axp20x_adc-allow-to-set-TS-pin-to-GPADC-mode.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/iio-st_sensors-Don-t-report-error-when-the-device-is-not-presen.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/input-gpio-vibra-Allow-to-use-vcc-supply-alone-to-control-the-v.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/leds-axp20x-Support-charger-LED-on-AXP20x-like-PMICs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/mailbox-Allow-to-run-mailbox-while-timekeeping-is-suspended.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-cedrus-Fix-failure-to-clean-up-hardware-on-probe-failure.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-gc2145-Add-PIXEL_RATE-HBLANK-and-VBLANK-controls.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-gc2145-Added-BGGR-bayer-mode.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-gc2145-Disable-debug-output.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-gc2145-Galaxycore-camera-module-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-gc2145-fix-white-balance-colors.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-gc2145-implement-system-suspend.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-hm5065-Add-subdev-driver-for-Himax-HM5065-camera-sensor.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-i2c-gc2145-Move-upstream-driver-out-of-the-way.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-i2c-gc2145-Parse-and-register-properties.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Add-read-only-property-for-vblank.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Don-t-powerup-the-sensor-during-driver-probe.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Experiment-Try-to-disable-denoising-sharpening.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Fix-focus-commands-blocking-until-complete.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Implement-autofocus.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Improve-error-reporting.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Improve-firmware-load-time.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-Sleep-after-poweroff-to-ensure-next-poweron-is-not.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-set-default-ae-target-lower.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5640-use-pm_runtime_force_suspend-resume-for-system-sus.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-ov5648-Fix-call-to-pm_runtime_set_suspended.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-rkisp1-Adapt-to-different-SoCs-having-different-size-limi.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-sun6i-csi-Add-multicamera-support-for-parallel-bus.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-sun6i-csi-add-V4L2_CAP_IO_MC-capability.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-sun6i-csi-capture-Use-subdev-operation-to-access-bridge-f.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-sun6i-csi-implement-vidioc_enum_framesizes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-sun6i-csi-merge-sun6i_csi_formats-and-sun6i_csi_formats_m.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/media-sun6i-csi-subdev-Use-subdev-active-state-to-store-active-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/mfd-axp20x-Add-battery-IRQ-resources.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/misc-modem-power-Power-manager-for-modems.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/mmc-add-delay-after-power-class-selection.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/mmc-dw-mmc-rockchip-fix-sdmmc-after-soft-reboot.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/mmc-sunxi-mmc-Remove-runtime-PM.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/mtd-spi-nor-Add-Alliance-memory-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/net-stmmac-sun8i-Add-support-for-enabling-a-regulator-for-PHY-I.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/net-stmmac-sun8i-Rename-PHY-regulator-variable-to-regulator_phy.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/net-stmmac-sun8i-Use-devm_regulator_get-for-PHY-regulator.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/net-wireless-brcmfmac-Add-optional-32k-clock-enable-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/net-wireless-brcmfmac-Add-support-for-detecting-AP6275P.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/nfc-pn544-Add-support-for-VBAT-PVDD-regulators.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/opp-core-Avoid-confusing-error-when-no-regulator-is-defined-in-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/pci-Workaround-ITS-timeouts-on-poweroff-reboot-on-Orange-Pi-5-P.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/phy-allwinner-sun4i-usb-Add-support-for-usb_role_switch.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-axp20x_battery-Allow-to-set-target-voltage-to-4.35V.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-axp803-Add-interrupts-for-low-battery-power-condition.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-Add-support-for-USB_BC_ENABLED-and-USB_DCP_INPUT_C.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x-battery-Add-support-for-POWER_SUPPLY_PROP_E.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x-battery-Enable-poweron-by-RTC-alarm.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x-battery-Support-POWER_SUPPLY_PROP_CHARGE_BE.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x-usb-power-Add-missing-interrupts.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x-usb-power-Change-Vbus-hold-voltage-to-4.5V.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x_battery-Add-support-for-reporting-OCV.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x_battery-Fix-charging-done-detection.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x_battery-Monitor-battery-health.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x_battery-Send-uevents-for-status-changes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/power-supply-axp20x_battery-Setup-thermal-regulation-experiment.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/regulator-axp20x-Add-support-for-vin-supply-for-drivevbus.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/regulator-axp20x-Enable-over-temperature-protection-and-16s-res.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/regulator-axp20x-Turn-N_VBUSEN-to-input-on-x-powers-sense-vbus-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/rtc-Print-which-error-caused-RTC-read-failure.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/rtc-sun6i-Allow-RTC-wakeup-after-shutdown.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/sound-soc-ac100-codec-Support-analog-part-of-X-Powers-AC100-cod.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/sound-soc-sun8i-codec-Add-support-for-digital-part-of-the-AC100.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/spi-fixes.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/spi-rockchip-Fix-runtime-PM-and-other-issues.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/sunxi-Use-dev_err_probe-to-handle-EPROBE_DEFER-errors.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/thermal-sun8i-Be-loud-when-probe-fails.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-gadget-Fix-dangling-pointer-in-netdev-private-data.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs-where-it-s.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-serial-option-add-reset_resume-callback-for-WWAN-devices.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-altmodes-displayport-Respect-DP_CAP_RECEPTACLE-bit.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-anx7688-Add-driver-for-ANX7688-USB-C-HDMI-bridge.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-anx7688-Port-to-Linux-6.9.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Add-OF-extcon-support.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Clear-interrupts-before-we-start-toggling.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Extend-debugging-interface-with-driver-state-.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Fix-register-definitions.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-More-useful-of-logging-status-on-interrupt.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Retry-reading-of-CC-pins-status-if-activity-i.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Set-the-current-before-enabling-pullups.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Slightly-increase-wait-time-for-BC1.2-result.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-interrupt-is-n.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-tcpm-Fix-PD-devices-capabilities-registration.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-tcpm-Improve-logs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-tcpm-Unregister-altmodes-before-registering-new-ones.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-typec-extcon-Add-typec-extcon-bridge-driver.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-typec-extcon-Allow-to-force-reset-on-each-mux-change.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/usb-typec-typec-extcon-Enable-debugging-for-now.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.megous/video-pwm_bl-Allow-to-change-lth_brightness-via-sysfs.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.needs-to-be-redone/Sound-for-H616-H618-Allwinner-SOCs-arch-arm64-boot-dts-allwinne.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.needs-to-be-redone/add-bigtreetech-cb1-dts.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.needs-to-be-redone/add-dtb-overlay-for-zero2w.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.needs-to-be-redone/drivers-hack-for-h616-hdmi-video-output.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.needs-to-be-redone/drv-thermal-sun8i_thermal-Add-for-H616.patch create mode 100644 patch/kernel/archive/sunxi-6.9/patches.needs-to-be-redone/orangepi-zero2w-add-dtb.patch create mode 100644 patch/kernel/archive/sunxi-6.9/series.armbian create mode 100644 patch/kernel/archive/sunxi-6.9/series.conf create mode 100644 patch/kernel/archive/sunxi-6.9/series.megous create mode 100644 patch/kernel/rk35xx-legacy/001-hid-sony.patch create mode 100644 patch/kernel/rk35xx-vendor-6.1/001-hid-sony.patch create mode 100644 patch/u-boot/legacy/u-boot-armsom-rk3576/0001-dw_mmc-add-default-power-enable-config-val.patch create mode 100644 patch/u-boot/legacy/u-boot-armsom-rk3576/0002-dts-rockchip-rk3576-the-power_en-for-SD-co.patch create mode 100644 patch/u-boot/legacy/u-boot-radxa-rk35xx/board_firefly-itx-3588j/board-firefly-itx-3588j-disable-optee-security.patch create mode 100644 patch/u-boot/legacy/u-boot-radxa-rk35xx/defconfig/armsom-aim7-io-rk3588_defconfig create mode 100644 patch/u-boot/legacy/u-boot-radxa-rk35xx/defconfig/retro-lite-cm5-rk3588s_defconfig create mode 100644 patch/u-boot/legacy/u-boot-radxa-rk35xx/dt/rk3588-armsom-aim7-io.dts create mode 100644 patch/u-boot/legacy/u-boot-radxa-rk35xx/dt/rk3588s-retro-lite-cm5.dts create mode 100644 patch/u-boot/u-boot-sunxi/arm64-sun50i-h313-add-x96q-lpddr3-defconfig.patch create mode 100644 patch/u-boot/u-boot-sunxi/board_bigtreetech-cb1/allwinner-h616-driver-i2c3.patch create mode 100644 patch/u-boot/u-boot-sunxi/board_bigtreetech-cb1/allwinner-h616-dts-enable-internal-phy-emac1.patch create mode 100644 patch/u-boot/u-boot-sunxi/board_bigtreetech-cb1/allwinner-h616-setup-internal-phy-emac1.patch create mode 100644 patch/u-boot/u-boot-tqma/0003-imx-mkimage_fit_atf_imx8mp.sh-add-script-for-imx8mp.patch create mode 100644 patch/u-boot/v2024.04/board_gateway-gz80x/001-Add-board-Amper-Gateway-AM-GZ80x.patch create mode 100644 patch/u-boot/v2024.04/board_gateway-gz80x/002-HACK-mmc-meson-gx-limit-to-24MHz.patch create mode 100644 patch/u-boot/v2024.04/board_gateway-gz80x/003-mmc-meson-gx-change-clock-phase-value-on-axg-SoCs.patch create mode 100644 patch/u-boot/v2024.04/board_gateway-gz80x/004-HACK-meson64-boot-target-usb.patch create mode 100644 patch/u-boot/v2024.07/0050-automatically-add-chosen-kaslr-seed-and-deduplicate-code.patch create mode 100644 patch/u-boot/v2024.07/board_nanopi-r5c/nanopi-r5c_kaslrseed.patch create mode 100644 patch/u-boot/v2024.07/board_orangepi5-plus/orangepi5-plus_kaslrseed.patch diff --git a/.github/workflows/merge-announce.yml b/.github/workflows/merge-announce.yml new file mode 100644 index 000000000000..7b53e680b795 --- /dev/null +++ b/.github/workflows/merge-announce.yml @@ -0,0 +1,20 @@ +name: push + +on: + push: + branches: [ main ] + +jobs: + announcepush: + runs-on: ubuntu-latest + steps: + - name: Get repo + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Send push to Discord + run: | + curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data \ + "{\"username\": \"Github\", \"avatar_url\": \"${{ secrets.AVATARURL }}\", \"content\": \"\ + :white_check_mark: **Merged** into [$GITHUB_REPOSITORY](<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY>) by [$GITHUB_ACTOR](<$GITHUB_SERVER_URL/$GITHUB_ACTOR>) - \ + [Link](<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA>): *$(git show -s --format=%s)*\"}" ${{ secrets.WEBHOOKURL }} diff --git a/.github/workflows/pr-announce.yml b/.github/workflows/pr-announce.yml new file mode 100644 index 000000000000..6953ba98d567 --- /dev/null +++ b/.github/workflows/pr-announce.yml @@ -0,0 +1,25 @@ +name: "Announce PR on Discord for review" +run-name: 'Announce PR #${{ github.event.pull_request.number }} on Discord for review' + +on: + pull_request: + types: [ labeled ] + +jobs: + Announce: + permissions: + pull-requests: read + + runs-on: ubuntu-latest + if: ${{ github.repository == 'armbian/build' && github.event.label.id == '6210849975' }} + steps: + - name: Get repo + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Discord webhook + run: | + curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data \ + "{\"username\": \"Github\", \"avatar_url\": \"${{ secrets.AVATARURL }}\", \"content\": \"\ + :arrow_heading_up: **Pull request** to [$GITHUB_REPOSITORY](<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY>) by [$GITHUB_ACTOR](<$GITHUB_SERVER_URL/$GITHUB_ACTOR>) - **Please review!** \ + :point_right: [Link](<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/${{github.event.pull_request.number}}>): *$(git show -s --format=%s)*\"}" ${{ secrets.WEBHOOKURL }} diff --git a/config/boards/armsom-aim7-io.csc b/config/boards/armsom-aim7-io.csc new file mode 100644 index 000000000000..bfb4099e2010 --- /dev/null +++ b/config/boards/armsom-aim7-io.csc @@ -0,0 +1,21 @@ +# Rockchip RK3588 SoC octa core 8-32GB SoC 2.5GBe eMMC USB3 NvME +BOARD_NAME="ArmSoM AIM7 IO" +BOARDFAMILY="rockchip-rk3588" +BOARD_MAINTAINER="" +BOOTCONFIG="armsom-aim7-io-rk3588_defconfig" +KERNEL_TARGET="vendor" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3588-armsom-aim7-io.dtb" +BOOT_SCENARIO="spl-blobs" +IMAGE_PARTITION_TABLE="gpt" + +function post_family_tweaks__armsom-aim7-io_naming_audios() { + display_alert "$BOARD" "Renaming audios" "info" + + mkdir -p $SDCARD/etc/udev/rules.d/ + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"' > $SDCARD/etc/udev/rules.d/90-naming-audios.rules + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-dp0-sound", ENV{SOUND_DESCRIPTION}="DP0 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules + + return 0 +} diff --git a/config/boards/ayn-odin2.eos b/config/boards/ayn-odin2.eos new file mode 100644 index 000000000000..9cbef2db7a2c --- /dev/null +++ b/config/boards/ayn-odin2.eos @@ -0,0 +1,155 @@ +# Generate kernel and rootfs image for Qcom ABL Custom booting +declare -g BOARD_NAME="Ayn Odin2" +declare -g BOARD_MAINTAINER="FantasyGmm" +declare -g BOARDFAMILY="qcom-abl" +declare -g KERNEL_TARGET="sm8550" +declare -g KERNELPATCHDIR="sm8550-6.7" +declare -g EXTRAWIFI="no" +declare -g BOOTCONFIG="none" +declare -g BOOTFS_TYPE="fat" +declare -g BOOTSIZE="256" +declare -g BOOTIMG_CMDLINE_EXTRA="clk_ignore_unused pd_ignore_unused panic=30 audit=0 allow_mismatched_32bit_el0 rw mem_sleep_default=s2idle" +declare -g IMAGE_PARTITION_TABLE="gpt" + +# Use the full firmware, complete linux-firmware plus Armbian's +declare -g BOARD_FIRMWARE_INSTALL="-full" + +declare -g DESKTOP_AUTOLOGIN="yes" + +function post_family_config_branch_sm8550__edk2_kernel() { + declare -g KERNELSOURCE='https://github.com/edk2-porting/linux-next' + declare -g KERNEL_MAJOR_MINOR="6.7" # Major and minor versions of this kernel. + declare -g KERNELBRANCH="branch:integration/ayn-odin2" + declare -g LINUXCONFIG="linux-${ARCH}-${BRANCH}" # for this board: linux-arm64-sm8550 + display_alert "Setting up kernel ${KERNEL_MAJOR_MINOR} for" "${BOARD}" "info" +} + +function ayn-odin2_is_userspace_supported() { + [[ "${RELEASE}" == "trixie" || "${RELEASE}" == "sid" || "${RELEASE}" == "mantic" || "${RELEASE}" == "noble" ]] && return 0 + return 1 +} + +function post_family_tweaks__enable_services() { + if ! ayn-odin2_is_userspace_supported; then + if [[ "${RELEASE}" != "" ]]; then + display_alert "Missing userspace for ${BOARD}" "${RELEASE} does not have the userspace necessary to support the ${BOARD}" "warn" + fi + return 0 + fi + + if [[ "${RELEASE}" == "noble" ]]; then + display_alert "Adding Mesa PPA For Ubuntu " "${BOARD}" "info" + do_with_retries 3 chroot_sdcard add-apt-repository ppa:oibaf/graphics-drivers --yes --no-update + fi + + # We need unudhcpd from armbian repo, so enable it + mv "${SDCARD}"/etc/apt/sources.list.d/armbian.list.disabled "${SDCARD}"/etc/apt/sources.list.d/armbian.list + + # Add zink env + echo '__GLX_VENDOR_LIBRARY_NAME=mesa' | tee -a "${SDCARD}"/etc/environment + echo 'MESA_LOADER_DRIVER_OVERRIDE=zink' | tee -a "${SDCARD}"/etc/environment + echo 'GALLIUM_DRIVER=zink' | tee -a "${SDCARD}"/etc/environment + # Add Gamepad udev rule + echo 'SUBSYSTEM=="input", ATTRS{name}=="Ayn Odin2 Gamepad", MODE="0666", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="1"' > "${SDCARD}"/etc/udev/rules.d/99-ignore-gamepad.rules + # No driver support for suspend + chroot_sdcard systemctl mask suspend.target + # Add Bt Mac Fixed service + install -Dm655 $SRC/packages/bsp/ayn-odin2/bt-fixed-mac.sh "${SDCARD}"/usr/local/bin/ + install -Dm644 $SRC/packages/bsp/ayn-odin2/bt-fixed-mac.service "${SDCARD}"/usr/lib/systemd/system/ + chroot_sdcard systemctl enable bt-fixed-mac + + do_with_retries 3 chroot_sdcard_apt_get_update + display_alert "$BOARD" "Installing board tweaks" "info" + do_with_retries 3 chroot_sdcard_apt_get_install alsa-ucm-conf unudhcpd mkbootimg git + + # Disable armbian repo back + mv "${SDCARD}"/etc/apt/sources.list.d/armbian.list "${SDCARD}"/etc/apt/sources.list.d/armbian.list.disabled + do_with_retries 3 chroot_sdcard_apt_get_update + + do_with_retries 3 chroot_sdcard_apt_get_install mesa-vulkan-drivers qbootctl qrtr-tools protection-domain-mapper tqftpserv + + # Kernel postinst script to update abl boot partition + install -Dm655 $SRC/packages/bsp/ayn-odin2/zz-update-abl-kernel "${SDCARD}"/etc/kernel/postinst.d/ + + cp $SRC/packages/bsp/ayn-odin2/LinuxLoader.cfg "${SDCARD}"/boot/ + + return 0 +} + +function post_family_tweaks__preset_configs() { + display_alert "$BOARD" "preset configs for rootfs" "info" + # Set PRESET_NET_CHANGE_DEFAULTS to 1 to apply any network related settings below + echo "PRESET_NET_CHANGE_DEFAULTS=1" > "${SDCARD}"/root/.not_logged_in_yet + + # Enable WiFi or Ethernet. + # NB: If both are enabled, WiFi will take priority and Ethernet will be disabled. + echo "PRESET_NET_ETHERNET_ENABLED=0" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_WIFI_ENABLED=1" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset user default shell, you can choose bash or zsh + echo "PRESET_USER_SHELL=zsh" >> "${SDCARD}"/root/.not_logged_in_yet + + # Set PRESET_CONNECT_WIRELESS=y if you want to connect wifi manually at first login + echo "PRESET_CONNECT_WIRELESS=n" >> "${SDCARD}"/root/.not_logged_in_yet + + # Set SET_LANG_BASED_ON_LOCATION=n if you want to choose "Set user language based on your location?" with "n" at first login + echo "SET_LANG_BASED_ON_LOCATION=y" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset default locale + echo "PRESET_LOCALE=en_US.UTF-8" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset timezone + echo "PRESET_TIMEZONE=Etc/UTC" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset root password + echo "PRESET_ROOT_PASSWORD=admin" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset username + echo "PRESET_USER_NAME=odin" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset user password + echo "PRESET_USER_PASSWORD=admin" >> "${SDCARD}"/root/.not_logged_in_yet + + # Preset user default realname + echo "PRESET_DEFAULT_REALNAME=Odin" >> "${SDCARD}"/root/.not_logged_in_yet +} + +function post_family_tweaks_bsp__firmware_in_initrd() { + random_mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') + declare -g BOOTIMG_CMDLINE_EXTRA="${BOOTIMG_CMDLINE_EXTRA} bt_mac=${random_mac}" + display_alert "Generate a random Bluetooth MAC address, Mac:${random_mac}" "info" + display_alert "Adding to bsp-cli" "${BOARD}: firmware in initrd" "info" + declare file_added_to_bsp_destination # Will be filled in by add_file_from_stdin_to_bsp_destination + # Using odin2's firmware for now + add_file_from_stdin_to_bsp_destination "/etc/initramfs-tools/hooks/ayn-odin2-firmware" <<- 'FIRMWARE_HOOK' + #!/bin/bash + [[ "$1" == "prereqs" ]] && exit 0 + . /usr/share/initramfs-tools/hook-functions + for f in /lib/firmware/qcom/sm8550/ayn/odin2/* ; do + add_firmware "${f#/lib/firmware/}" + done + add_firmware "qcom/a740_sqe.fw" # Extra one for dpu + add_firmware "qcom/gmu_gen70200.bin" # Extra one for gpu + # Extra one for wifi + for f in /lib/firmware/ath12k/WCN7850/hw2.0/* ; do + add_firmware "${f#/lib/firmware/}" + done + # Extra one for bt + for f in /lib/firmware/qca/* ; do + add_firmware "${f#/lib/firmware/}" + done + FIRMWARE_HOOK + run_host_command_logged chmod -v +x "${file_added_to_bsp_destination}" +} + +function pre_umount_final_image__update_ABL_settings() { + if [ -z "$BOOTFS_TYPE" ]; then + return 0 + fi + display_alert "Update ABL settings for " "${BOARD}" "info" + uuid_line=$(head -n 1 "${SDCARD}"/etc/fstab) + rootfs_image_uuid=$(echo "${uuid_line}" | awk '{print $1}' | awk -F '=' '{print $2}') + initrd_name=$(find "${SDCARD}/boot/" -type f -name "config-*" | sed 's/.*config-//') + sed -i "s/UUID_PLACEHOLDER/${rootfs_image_uuid}/g" "${MOUNT}"/boot/LinuxLoader.cfg + sed -i "s/INITRD_PLACEHOLDER/${initrd_name}/g" "${MOUNT}"/boot/LinuxLoader.cfg +} diff --git a/config/boards/bananapi.conf b/config/boards/bananapi.conf new file mode 100644 index 000000000000..15079e1aeff7 --- /dev/null +++ b/config/boards/bananapi.conf @@ -0,0 +1,15 @@ +# Allwinner A20 dual core 1Gb RAM SoC 1xSATA GBE +BOARD_NAME="Banana Pi" +BOARDFAMILY="sun7i" +BOARD_MAINTAINER="janprunk" +BOOTCONFIG="Bananapi_defconfig" +KERNEL_TARGET="legacy,current,edge" +KERNEL_TEST_TARGET="current" + +function post_config_uboot_target__extra_configs_for_bananapi() { + display_alert "$BOARD" "set dram clock" "info" + run_host_command_logged scripts/config --set-val CONFIG_DRAM_CLK "384" + + display_alert "$BOARD" "disable de2 to improve edid detection" "info" + run_host_command_logged scripts/config --disable CONFIG_VIDEO_DE2 +} diff --git a/config/boards/gateway-gz80x.conf b/config/boards/gateway-gz80x.conf new file mode 100644 index 000000000000..6640b7803714 --- /dev/null +++ b/config/boards/gateway-gz80x.conf @@ -0,0 +1,19 @@ +# Amlogic A113X quad core 1Gb RAM SoC, eMMC 8Gb +BOARD_NAME="Gateway GZ80x" +BOARDFAMILY="meson-axg" +BOARD_MAINTAINER="pyavitz" +BOOTCONFIG="amper_gateway_am-gz80x_defconfig" +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +BOOTBRANCH_BOARD="tag:v2024.04" +BOOTPATCHDIR="v2024.04" +BOOT_FDT_FILE="amlogic/meson-axg-amper-gateway-am-gz80x.dtb" +SRC_EXTLINUX="yes" +SRC_CMDLINE="console=ttyAML0,115200n8 clk_ignore_unused loglevel=7" +HAS_VIDEO_OUTPUT="no" + +function post_family_tweaks_bsp__gateway_gz80x_udev() { + mkdir -p "${destination}"/etc/udev/rules.d + display_alert "$BOARD" "Install zwave udev rule" "info" + echo 'KERNEL=="ttyAML2", NAME="tts/%n", SYMLINK+="zwave", GROUP="dialout", MODE="0660"' > "${destination}"/etc/udev/rules.d/10-zwave.rules +} diff --git a/config/boards/nanopct6.conf b/config/boards/nanopct6.conf new file mode 100644 index 000000000000..a73349ef347d --- /dev/null +++ b/config/boards/nanopct6.conf @@ -0,0 +1,107 @@ +# Rockchip RK3588S octa core 8GB RAM SoC eMMC USB3 USB2 1x GbE 2x 2.5GbE +BOARD_NAME="NanoPC T6" +BOARDFAMILY="rockchip-rk3588" +BOARD_MAINTAINER="Tonymac32" +BOOTCONFIG="nanopc_t6_defconfig" # vendor name, not standard, see hook below, set BOOT_SOC below to compensate +BOOT_SOC="rk3588" +KERNEL_TARGET="edge,current,vendor" +KERNEL_TEST_TARGET="vendor,current" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3588-nanopc-t6.dtb" +BOOT_SCENARIO="spl-blobs" +BOOT_SUPPORT_SPI="yes" +BOOT_SPI_RKSPI_LOADER="yes" +IMAGE_PARTITION_TABLE="gpt" +declare -g UEFI_EDK2_BOARD_ID="nanopc-t6" # This _only_ used for uefi-edk2-rk3588 extension + +function post_family_tweaks__nanopct6_naming_audios() { + display_alert "$BOARD" "Renaming nanopct6 audio" "info" + + mkdir -p $SDCARD/etc/udev/rules.d/ + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"' > $SDCARD/etc/udev/rules.d/90-naming-audios.rules + + return 0 +} + +# Mainline u-boot or Kwiboo's tree +function post_family_config_branch_edge__nanopct6_use_mainline_uboot() { + display_alert "$BOARD" "mainline (next branch) u-boot overrides for $BOARD / $BRANCH" "info" + + declare -g BOOTCONFIG="nanopc-t6-rk3588_defconfig" # override the default for the board/family + declare -g BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc + declare -g BOOTSOURCE="https://github.com/Kwiboo/u-boot-rockchip.git" # We ❤️ Kwiboo's tree + declare -g BOOTBRANCH="branch:rk3xxx-2024.07" # commit:xx as of 2024-06-04 + declare -g BOOTPATCHDIR="v2024.04/board_${BOARD}" # empty; defconfig changes are done in hook below + declare -g BOOTDIR="u-boot-${BOARD}" # do not share u-boot directory + declare -g UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin u-boot-rockchip-spi.bin" + unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd # disable stuff from rockchip64_common; we're using binman here which does all the work already + + # Just use the binman-provided u-boot-rockchip.bin, which is ready-to-go + function write_uboot_platform() { + dd "if=$1/u-boot-rockchip.bin" "of=$2" bs=32k seek=1 conv=notrunc status=none + } + + function write_uboot_platform_mtd() { + flashcp -v -p "$1/u-boot-rockchip-spi.bin" /dev/mtd0 + } +} + +function post_config_uboot_target__extra_configs_for_nanopct6_mainline_environment_in_spi() { + [[ "${BRANCH}" != "edge" ]] && return 0 + + display_alert "$BOARD" "u-boot configs for ${BOOTBRANCH} u-boot config BRANCH=${BRANCH}" "info" + run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_NOWHERE "n" + run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_IN_SPI_FLASH "y" + run_host_command_logged scripts/config --set-val CONFIG_ENV_SECT_SIZE_AUTO "y" + run_host_command_logged scripts/config --set-val CONFIG_ENV_OVERWRITE "y" + run_host_command_logged scripts/config --set-val CONFIG_ENV_SIZE "0x20000" + run_host_command_logged scripts/config --set-val CONFIG_ENV_OFFSET "0xc00000" + + display_alert "u-boot for ${BOARD}" "u-boot: enable preboot & flash user LED in preboot" "info" + run_host_command_logged scripts/config --enable CONFIG_USE_PREBOOT + run_host_command_logged scripts/config --set-str CONFIG_PREBOOT "'led user-led on; sleep 0.1; led user-led off'" # double quotes required due to run_host_command_logged's quirks + + display_alert "u-boot for ${BOARD}" "u-boot: enable EFI debugging command" "info" + run_host_command_logged scripts/config --enable CMD_EFIDEBUG + run_host_command_logged scripts/config --enable CMD_NVEDIT_EFI + + display_alert "u-boot for ${BOARD}" "u-boot: enable more compression support" "info" + run_host_command_logged scripts/config --enable CONFIG_LZO + run_host_command_logged scripts/config --enable CONFIG_BZIP2 + run_host_command_logged scripts/config --enable CONFIG_ZSTD + + display_alert "u-boot for ${BOARD}" "u-boot: enable gpio LED support" "info" + run_host_command_logged scripts/config --enable CONFIG_LED + run_host_command_logged scripts/config --enable CONFIG_LED_GPIO + + display_alert "u-boot for ${BOARD}" "u-boot: enable networking cmds" "info" + run_host_command_logged scripts/config --enable CONFIG_CMD_NFS + run_host_command_logged scripts/config --enable CONFIG_CMD_WGET + run_host_command_logged scripts/config --enable CONFIG_CMD_DNS + run_host_command_logged scripts/config --enable CONFIG_PROT_TCP + run_host_command_logged scripts/config --enable CONFIG_PROT_TCP_SACK + + # UMS, RockUSB, gadget stuff + declare -a enable_configs=("CONFIG_CMD_USB_MASS_STORAGE" "CONFIG_USB_GADGET" "USB_GADGET_DOWNLOAD" "CONFIG_USB_FUNCTION_ROCKUSB" "CONFIG_USB_FUNCTION_ACM" "CONFIG_CMD_ROCKUSB" "CONFIG_CMD_USB_MASS_STORAGE") + for config in "${enable_configs[@]}"; do + display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable ${config}" "info" + run_host_command_logged scripts/config --enable "${config}" + done + # Auto-enabled by the above, force off... + run_host_command_logged scripts/config --disable USB_FUNCTION_FASTBOOT + +} + +# Include fw_setenv, configured to point to the correct spot on the SPI Flash +PACKAGE_LIST_BOARD="libubootenv-tool" # libubootenv-tool provides fw_printenv and fw_setenv, for talking to U-Boot environment +function post_family_tweaks__config_nanopct6_fwenv() { + [[ "${BRANCH}" != "edge" ]] && return 0 + display_alert "Configuring fw_printenv and fw_setenv" "for ${BOARD} and u-boot ${BOOTBRANCH}" "info" + # Addresses below come from CONFIG_ENV_OFFSET and CONFIG_ENV_SIZE in defconfig + cat <<- 'FW_ENV_CONFIG' > "${SDCARD}"/etc/fw_env.config + # MTD/SPI u-boot env for the ${BOARD_NAME} + # MTD device name Device offset Env. size Flash sector size Number of sectors + /dev/mtd0 0xc00000 0x20000 + FW_ENV_CONFIG +} diff --git a/config/boards/nanopim4v2.conf b/config/boards/nanopim4v2.conf new file mode 100644 index 000000000000..949288283ee3 --- /dev/null +++ b/config/boards/nanopim4v2.conf @@ -0,0 +1,35 @@ +# Rockchip RK3399 hexa core 4GB RAM SoC GBE eMMC USB3 USB-C WiFi/BT +BOARD_NAME="NanoPi M4V2" +BOARDFAMILY="rockchip64" # Used to be rk3399 +BOARD_MAINTAINER="igorpecovnik" +BOOTCONFIG="nanopi-m4v2-rk3399_defconfig" +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +FULL_DESKTOP="yes" +ASOUND_STATE="asound.state.rt5651" +BOOT_LOGO="desktop" + +function post_family_tweaks__m4v2() { + display_alert "$BOARD" "Installing board tweaks" "info" + + # enable fan support + chroot $SDCARD /bin/bash -c "systemctl --no-reload enable nanopim4-pwm-fan.service >/dev/null 2>&1" + + return 0 +} +function post_family_tweaks_bsp__M4V2() { + display_alert "Installing BSP firmware and fixups" + + # Bluetooth for most of others (custom patchram is needed only in legacy) + install -m 755 $SRC/packages/bsp/rk3399/brcm_patchram_plus_rk3399 $destination/usr/bin + cp $SRC/packages/bsp/rk3399/rk3399-bluetooth.service $destination/lib/systemd/system/ + + # Swap out the chip for some boards + sed -i s%BCM4345C5%BCM4356A2%g $destination/lib/systemd/system/rk3399-bluetooth.service + + # Fan support + cp $SRC/packages/bsp/nanopim4/nanopim4-pwm-fan.service $destination/lib/systemd/system/ + install -m 755 $SRC/packages/bsp/nanopim4/nanopim4-pwm-fan.sh $destination/usr/bin/nanopim4-pwm-fan.sh + + return 0 +} diff --git a/config/boards/odroidc4.conf b/config/boards/odroidc4.conf new file mode 100644 index 000000000000..f244972e9037 --- /dev/null +++ b/config/boards/odroidc4.conf @@ -0,0 +1,11 @@ +# Amlogic S905X3 quad core 4GB RAM SoC eMMC GBE USB3 SPI +BOARD_NAME="Odroid C4" +BOARDFAMILY="meson-sm1" +BOARD_MAINTAINER="" +BOOTCONFIG="odroid-c4_defconfig" +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +MODULES_BLACKLIST="simpledrm" # SimpleDRM conflicts with Panfrost +FULL_DESKTOP="yes" +SERIALCON="ttyAML0" +BOOT_LOGO="desktop" diff --git a/config/boards/odroidhc4.conf b/config/boards/odroidhc4.conf new file mode 100644 index 000000000000..3f492b964839 --- /dev/null +++ b/config/boards/odroidhc4.conf @@ -0,0 +1,112 @@ +# Amlogic S905X3 quad core 4GB RAM SoC GBE USB3 SPI 2 x SATA +BOARD_NAME="Odroid HC4" +BOARDFAMILY="meson-sm1" +BOARD_MAINTAINER="" +BOOTCONFIG="odroid-c4_defconfig" # for the SD card; but also 'odroid-hc4_defconfig', see below at pre_config_uboot_target +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +MODULES_BLACKLIST="simpledrm" # SimpleDRM conflicts with Panfrost +FULL_DESKTOP="no" +SERIALCON="ttyAML0" +BOOT_FDT_FILE="amlogic/meson-sm1-odroid-hc4.dtb" +PACKAGE_LIST_BOARD="lm-sensors fancontrol" # SPI, sensors, manual fan control via 'pwmconfig' + +# Newer u-boot for the HC4. There's patches in `board_odroidhc4` for the defconfigs used in the UBOOT_TARGET_MAP below. +BOOTBRANCH_BOARD="tag:v2024.04" +BOOTPATCHDIR="v2024.04" + +# We build u-boot twice: C4 config for SD cards, and HC4 (with SATA/PCI/SPI) config for SPI. +UBOOT_TARGET_MAP=" +armbian_target=sd u-boot-dtb.img;;u-boot.bin.sd.bin:u-boot.bin u-boot-dtb.img +armbian_target=spi u-boot-dtb.img;;u-boot.bin:u-boot-spi.bin +" + +# The SPI version (u-boot-spi.bin, built from odroid-hc4_defconfig above) is then used by nand-sata-install / armbian-install +function write_uboot_platform_mtd() { + declare -a extra_opts_flashcp=("--verbose") + if flashcp -h | grep -q -e '--partition'; then + echo "Confirmed flashcp supports --partition -- read and write only changed blocks." >&2 + extra_opts_flashcp+=("--partition") + else + echo "flashcp does not support --partition, will write full SPI flash blocks." >&2 + fi + flashcp "${extra_opts_flashcp[@]}" "${1}/u-boot-spi.bin" /dev/mtd0 +} + +# FIP blobs; the C4 & HC4 fip blobs are actually the same, still LE carries both. +function post_uboot_custom_postprocess__odroid_hc4_uboot() { + display_alert "Signing u-boot FIP" "${BOARD}" "info" + uboot_g12_postprocess "${SRC}"/cache/sources/amlogic-boot-fip/odroid-hc4 g12a +} + +# switch defconfig according to target, so we can still use the same post_config_uboot_target for both. +function pre_config_uboot_target__odroidhc4_defconfig_per_target() { + case "${target_make}" in + "armbian_target=spi "*) + BOOTCONFIG="odroid-hc4_defconfig" + ;; + "armbian_target=sd "*) + BOOTCONFIG="odroid-c4_defconfig" + ;; + *) + exit_with_error "Unknown target_make: '${target_make}', unknown BOOTCONFIG." + ;; + esac + display_alert "setting BOOTCONFIG for target" "${target_make}: '${BOOTCONFIG}'" "info" +} + +# Enable extra u-boot .config options, this way we avoid patching defconfig +function post_config_uboot_target__extra_configs_for_odroid_hc4() { + display_alert "u-boot for ${BOARD}" "u-boot: enable preboot & pci+usb start in preboot" "info" + run_host_command_logged scripts/config --enable CONFIG_USE_PREBOOT + run_host_command_logged scripts/config --set-str CONFIG_PREBOOT "'run boot_pci_enum; usb start'" # double quotes required due to run_host_command_logged's quirks + + display_alert "u-boot for ${BOARD}" "u-boot: enable EFI debugging command" "info" + run_host_command_logged scripts/config --enable CMD_EFIDEBUG + run_host_command_logged scripts/config --enable CMD_NVEDIT_EFI + + ## WAIT ## display_alert "u-boot for ${BOARD}" "u-boot: disable EFI Video Framebuffer" "info" + ## WAIT ## run_host_command_logged scripts/config --disable CONFIG_VIDEO_DT_SIMPLEFB # "Enables the code to pass the framebuffer to the kernel as a simple framebuffer in the device tree." + ## WAIT ## # CONFIG_VIDEO_EFI is unrelated: its about _using_ an EFI framebuffer when booted by an EFI-capable bootloader earlier in the chain. Not about _providing_ an EFI framebuffer. That's simplefb. + ## WAIT ## # CONFIG_FDT_SIMPLEFB seems to be rpi-specific and 100% unrelated here + + display_alert "u-boot for ${BOARD}" "u-boot: enable I2C support" "info" + run_host_command_logged scripts/config --enable CONFIG_DM_I2C + run_host_command_logged scripts/config --enable CONFIG_SYS_I2C_MESON + run_host_command_logged scripts/config --enable CONFIG_CMD_I2C + + display_alert "u-boot for ${BOARD}" "u-boot: enable more compression support" "info" + run_host_command_logged scripts/config --enable CONFIG_LZO + run_host_command_logged scripts/config --enable CONFIG_BZIP2 + run_host_command_logged scripts/config --enable CONFIG_ZSTD + + display_alert "u-boot for ${BOARD}" "u-boot: enable gpio LED support" "info" + run_host_command_logged scripts/config --enable CONFIG_LED + run_host_command_logged scripts/config --enable CONFIG_LED_GPIO + + display_alert "u-boot for ${BOARD}" "u-boot: enable networking cmds" "info" + run_host_command_logged scripts/config --enable CONFIG_CMD_NFS + run_host_command_logged scripts/config --enable CONFIG_CMD_WGET + run_host_command_logged scripts/config --enable CONFIG_CMD_DNS + run_host_command_logged scripts/config --enable CONFIG_PROT_TCP + run_host_command_logged scripts/config --enable CONFIG_PROT_TCP_SACK +} + +# @TODO: this is no longer needed in `edge` branch -- Neil has sent a patch with a trip for the cooling map in the DT - also doesn't hurt. +function post_family_tweaks__config_odroidhc4_fancontrol() { + display_alert "Configuring fancontrol" "for Odroid HC4" "info" + cat <<- FANCONTROL > "${SDCARD}"/etc/fancontrol + # Default config for the Odroid HC4 -- adjust to your needs (MINTEMP=40) + INTERVAL=10 + DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan + DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan + FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input + FCFANS= hwmon2/pwm1=hwmon2/fan1_input + MINTEMP=hwmon2/pwm1=40 + MAXTEMP=hwmon2/pwm1=60 + MINSTART=hwmon2/pwm1=150 + MINSTOP=hwmon2/pwm1=30 + MAXPWM=hwmon2/pwm1=180 + FANCONTROL + chroot_sdcard systemctl enable fancontrol.service +} diff --git a/config/boards/pinebook-pro.csc b/config/boards/pinebook-pro.csc new file mode 100644 index 000000000000..3a251f2bb839 --- /dev/null +++ b/config/boards/pinebook-pro.csc @@ -0,0 +1,42 @@ +# Rockchip RK3399 hexa core 2G/4GB SoC Laptop eMMC USB3 WiFi +BOARD_NAME="Pinebook Pro" +BOARDFAMILY="rockchip64" +BOARD_MAINTAINER="TRSx80 ahoneybun" +BOOTCONFIG="pinebook-pro-rk3399_defconfig" +BOOT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb" +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_SCENARIO="blobless" +ASOUND_STATE="asound.state.pinebook-pro" +BOOTBRANCH_BOARD="tag:v2022.04" +BOOTPATCHDIR="u-boot-rockchip64-v2022.04" + +function post_family_tweaks__PBP() { + display_alert "$BOARD" "Installing board tweaks" "info" + + chroot $SDCARD /bin/bash -c "echo SuspendState=freeze >> /etc/systemd/sleep.conf" + chroot $SDCARD /bin/bash -c "echo HandlePowerKey=ignore >> /etc/systemd/login.d" + + return 0 +} + +function post_family_tweaks_bsp__PBP_BSP() { + display_alert "Installing BSP firmware and fixups" + + # special keys + mkdir -p "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/ + cp $SRC/packages/bsp/pinebook-pro/pointers.xml "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/ + + # touchpad and keyboard tweaks + mkdir -p "${destination}"/etc/X11/xorg.conf.d/ + # from https://github.com/ayufan-rock64/linux-package/tree/master/root-pinebookpro + cp "${SRC}"/packages/bsp/pinebook-pro/40-pinebookpro-touchpad.conf "${destination}"/etc/X11/xorg.conf.d/ + + # keyboard hwdb + mkdir -p "${destination}"/etc/udev/hwdb.d/ + cp "${SRC}"/packages/bsp/pinebook-pro/10-usb-kbd.hwdb "${destination}"/etc/udev/hwdb.d/ + + return 0 +} diff --git a/config/boards/retro-lite-cm5.csc b/config/boards/retro-lite-cm5.csc new file mode 100644 index 000000000000..6f2a1c66ba09 --- /dev/null +++ b/config/boards/retro-lite-cm5.csc @@ -0,0 +1,26 @@ +# Rockchip RK3588S octa core 4/8/16GB RAM SoC NVMe USB3 USB-C GbE +BOARD_NAME="Retro Lite CM5" +BOARDFAMILY="rockchip-rk3588" +BOARD_MAINTAINER="ginkage" +BOOT_SOC="rk3588" +BOOTCONFIG="retro-lite-cm5-rk3588s_defconfig" +KERNEL_TARGET="vendor" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3588s-retro-lite-cm5.dtb" +BOOT_SCENARIO="spl-blobs" +IMAGE_PARTITION_TABLE="gpt" +DDR_BLOB="rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.16.bin" +BL31_BLOB="rk35/rk3588_bl31_v1.45.elf" + +function post_family_tweaks__retrolitecm5_naming_audios() { + display_alert "$BOARD" "Renaming Retro Lite CM5 audios" "info" + + mkdir -p $SDCARD/etc/udev/rules.d/ + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"' > $SDCARD/etc/udev/rules.d/90-naming-audios.rules + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-dp0-sound", ENV{SOUND_DESCRIPTION}="DP0 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-wm8960-sound", ENV{SOUND_DESCRIPTION}="WM8960 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules + + return 0 +} + diff --git a/config/boards/rk3328-heltec.csc b/config/boards/rk3328-heltec.csc new file mode 100644 index 000000000000..b317a864a373 --- /dev/null +++ b/config/boards/rk3328-heltec.csc @@ -0,0 +1,13 @@ +# Rockchip RK3328 quad core 2GB RAM SoC WIFI/BT eMMC +BOARD_NAME="RK3328-Heltec" +BOARDFAMILY="rockchip64" +BOARD_MAINTAINER="sicXnull" +BOOTCONFIG="evb-rk3328_defconfig" +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3328-heltec.dtb" +IMAGE_PARTITION_TABLE="gpt" +BOOT_SCENARIO="spl-blobs" +BOOTFS_TYPE="fat" diff --git a/config/boards/rock-3a.conf b/config/boards/rock-3a.conf new file mode 100644 index 000000000000..eff0a0747012 --- /dev/null +++ b/config/boards/rock-3a.conf @@ -0,0 +1,15 @@ +# Rockchip RK3568 quad core 1-8GB SoC GBe eMMC USB3 +BOARD_NAME="Rock 3A" +BOARDFAMILY="rk35xx" +BOARD_MAINTAINER="amazingfate ZazaBR vamzii catalinii" +BOOTCONFIG="rock-3a-rk3568_defconfig" +KERNEL_TARGET="edge,current,vendor" +KERNEL_TEST_TARGET="current" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3568-rock-3a.dtb" +BOOT_SCENARIO="spl-blobs" +BOOT_SUPPORT_SPI="yes" +BOOT_SPI_RKSPI_LOADER="yes" +IMAGE_PARTITION_TABLE="gpt" +BOOTFS_TYPE="fat" diff --git a/config/boards/rockpro64.csc b/config/boards/rockpro64.csc new file mode 100644 index 000000000000..0069befa4cdf --- /dev/null +++ b/config/boards/rockpro64.csc @@ -0,0 +1,78 @@ +# Rockchip RK3399 hexa core 2G/4GB SoC GBe eMMC USB3 WiFi +BOARD_NAME="RockPro 64" +BOARDFAMILY="rockchip64" +BOARD_MAINTAINER="joekhoobyar" +BOOTCONFIG="rockpro64-rk3399_defconfig" +KERNEL_TARGET="current,edge" +KERNEL_TEST_TARGET="current" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_SCENARIO="blobless" +BOOT_SUPPORT_SPI=yes + +# u-boot v2024.04-rc4 for rockpro64 +BOOTBRANCH_BOARD="tag:v2024.04-rc4" +BOOTPATCHDIR="v2024.04" + +# Include fw_setenv, configured to point to the correct spot on the SPI Flash +PACKAGE_LIST_BOARD="libubootenv-tool" # libubootenv-tool provides fw_printenv and fw_setenv, for talking to U-Boot environment + +function post_family_config__use_mainline_uboot_rockpro64() { + # Use latest lts 2.8 ATF + ATFBRANCH='tag:lts-v2.8.16' + ATFPATCHDIR="atf-rockchip64" # patches for logging etc + display_alert "$BOARD" "using ATF (blobless) ${ATFBRANCH} for ${BOOTBRANCH_BOARD} u-boot" "info" + # bl31.elf is copied directly from ATF build dir to uboot dir (by armbian u-boot build system) + UBOOT_TARGET_MAP="BL31=bl31.elf;;u-boot-rockchip.bin u-boot-rockchip-spi.bin" + + # Ignore most of the rockchip64_common stuff, we're using binman here which does all the work already + unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd + + function write_uboot_platform() { + dd "if=$1/u-boot-rockchip.bin" "of=$2" bs=32k seek=1 conv=notrunc status=none + } + + function write_uboot_platform_mtd() { + flashcp -v -p "$1/u-boot-rockchip-spi.bin" /dev/mtd0 + } +} + +# From Kwiboo: +# ... "note that u-boot mainline for rk3328/rk3399 suffers from a limitation in that the u-boot.bin may not exceed 1000 KiB or the stack may overwrite part of it during runtime, resulting in strange unexplained issues. +# This has been fixed in current U-Boot next branch with https://github.com/u-boot/u-boot/commit/5e7cd8a119953dc2f466fea81e230d683ee03493 and should be included with v2024.07-rc1 +# If your u-boot.bin build output is less than 950 KiB in size you should not suffer from this limitation/issue." +# ... "The real limit will be at most 1 MiB - 16 KiB (malloc heap on stack) = 1008 KiB and any additional runtime usage of the stack will take up until U-Boot has been relocated to top of RAM, +# lets say an additional 16 KiB (same as malloc heap) to be on the safer side, so I would suggest you check for e.g. < 992 KiB or similar instead of < 1 MiB. +# As long as the generated u-boot.bin is < 992 KiB I think it should be safe, and I do not think the stack usage will be that much before relocation so < 1000 KiB may also be fine 😎" +# rpardini: close call; the u-boot.bin is 994920 bytes. Let's check for >992KiB and break the build if it's too large. +function post_uboot_custom_postprocess__check_bin_size_less_than_992KiB() { + declare one_bin + declare -i uboot_bin_size + declare -a bins_to_check=("u-boot.bin") + for one_bin in "${bins_to_check[@]}"; do + uboot_bin_size=$(stat -c %s "${one_bin}") + display_alert "Checking u-boot ${BOARD} bin size" "'${one_bin}' is less than 992KiB (1015808 bytes): ${uboot_bin_size} bytes" "info" + if [[ ${uboot_bin_size} -ge 1015808 ]]; then + display_alert "u-boot for ${BOARD}" "'${one_bin}' is larger than 992KiB (1015808 bytes): ${uboot_bin_size} bytes" "err" + exit_with_error "u-boot ${BOARD} bin size check failed" + fi + done +} + +function post_config_uboot_target__extra_configs_for_rockpro64() { + # Taken from https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-rockpro64/-/blob/master/PKGBUILD + display_alert "$BOARD" "u-boot configs for ${BOOTBRANCH_BOARD} u-boot config" "info" + run_host_command_logged scripts/config --set-val CONFIG_OF_LIBFDT_OVERLAY "y" + run_host_command_logged scripts/config --set-val CONFIG_MMC_HS400_SUPPORT "y" + run_host_command_logged scripts/config --set-val CONFIG_USE_PREBOOT "n" +} + +function post_family_tweaks__config_rockpro64_fwenv() { + display_alert "Configuring fw_printenv and fw_setenv" "for ${BOARD} and u-boot ${BOOTBRANCH_BOARD}" "info" + # Addresses below come from CONFIG_ENV_OFFSET and CONFIG_ENV_SIZE in https://github.com/u-boot/u-boot/blob/v2024.04-rc4/configs/rockpro64-rk3399_defconfig + cat <<- 'FW_ENV_CONFIG' > "${SDCARD}"/etc/fw_env.config + # MTD on the SPI for the Rockpro64 + # MTD device name Device offset Env. size Flash sector size Number of sectors + /dev/mtd0 0x3F8000 0x8000 + FW_ENV_CONFIG +} diff --git a/config/boards/x96q.tvb b/config/boards/x96q.tvb new file mode 100644 index 000000000000..5a4667cd2adb --- /dev/null +++ b/config/boards/x96q.tvb @@ -0,0 +1,11 @@ +# Allwinner H313 TVBox with 2GB of RAM and EMMC +BOARD_NAME="X96Q TV Box" +BOARDFAMILY="sun50iw9" +BOARD_MAINTAINER="sicXnull" +BOOTCONFIG="x96q_lpddr3_defconfig" +BOOT_LOGO="desktop" +KERNEL_TARGET="current" +KERNEL_TEST_TARGET="current" +FORCE_BOOTSCRIPT_UPDATE="yes" +OVERLAY_PREFIX="sun50i-h616" +enable_extension "uwe5622-allwinner" diff --git a/config/boards/youyeetoo-r1-v3.wip b/config/boards/youyeetoo-r1-v3.wip new file mode 100644 index 000000000000..8420072da81d --- /dev/null +++ b/config/boards/youyeetoo-r1-v3.wip @@ -0,0 +1,53 @@ +# Rockchip RK3588S octa core 32GB RAM SoC eMMC NvME 1x USB3 3x USB2 1x GbE +BOARD_NAME="Youyeetoo R1 v3" +BOARDFAMILY="rockchip-rk3588" +BOARD_MAINTAINER="superkali" +BOOTCONFIG="generic-rk3588_defconfig" # vendor name, not standard, see hook below, set BOOT_SOC below to compensate +BOOT_SOC="rk3588" +KERNEL_TARGET="vendor" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +IMAGE_PARTITION_TABLE="gpt" +BOOT_FDT_FILE="rockchip/rk3588s-youyeetoo-r1.dtb" +BOOT_SCENARIO="spl-blobs" + +function post_family_tweaks__youyeetoo_r1_naming_audios() { + display_alert "$BOARD" "Renaming Youyeetoo R1 audios" "info" + + mkdir -p $SDCARD/etc/udev/rules.d/ + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-hdmi0-sound", ENV{SOUND_DESCRIPTION}="HDMI0 Audio"' > $SDCARD/etc/udev/rules.d/90-naming-audios.rules + echo 'SUBSYSTEM=="sound", ENV{ID_PATH}=="platform-es8388-sound", ENV{SOUND_DESCRIPTION}="ES8388 Audio"' >> $SDCARD/etc/udev/rules.d/90-naming-audios.rules + + return 0 +} + +function post_family_tweaks__youyeetoo_r1_naming_udev_network_interfaces() { + display_alert "$BOARD" "Renaming Youyeetoo R1 network interfaces to eth0" "info" + + mkdir -p $SDCARD/etc/udev/rules.d/ + cat <<- EOF > "${SDCARD}/etc/udev/rules.d/70-persistent-net.rules" + SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="fe1c0000.ethernet", NAME:="eth0" + EOF +} + +# Mainline U-Boot +function post_family_config__youyeetoo_r1_use_mainline_uboot() { + display_alert "$BOARD" "Using mainline U-Boot for $BOARD / $BRANCH" "info" + + declare -g BOOTCONFIG="generic-rk3588_defconfig" # Use generic defconfig which should boot all RK3588 boards + declare -g BOOTDELAY=1 # Wait for UART interrupt to enter UMS/RockUSB mode etc + declare -g BOOTSOURCE="https://github.com/u-boot/u-boot.git" # We ❤️ Mainline U-Boot + declare -g BOOTBRANCH="tag:v2024.07" + declare -g BOOTPATCHDIR="v2024.07" + # Don't set BOOTDIR, allow shared U-Boot source directory for disk space efficiency + + declare -g UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB};;u-boot-rockchip.bin" + + # Disable stuff from rockchip64_common; we're using binman here which does all the work already + unset uboot_custom_postprocess write_uboot_platform write_uboot_platform_mtd + + # Just use the binman-provided u-boot-rockchip.bin, which is ready-to-go + function write_uboot_platform() { + dd "if=$1/u-boot-rockchip.bin" "of=$2" bs=32k seek=1 conv=notrunc status=none + } +} diff --git a/config/bootenv/rk356x.txt b/config/bootenv/rk356x.txt new file mode 100644 index 000000000000..472418799e60 --- /dev/null +++ b/config/bootenv/rk356x.txt @@ -0,0 +1,4 @@ +verbosity=1 +bootlogo=false +console=both +extraargs=cma=256M diff --git a/config/kernel/linux-rockchip-rk3588-6.11.config b/config/kernel/linux-rockchip-rk3588-6.11.config new file mode 100644 index 000000000000..94c6c5a44077 --- /dev/null +++ b/config/kernel/linux-rockchip-rk3588-6.11.config @@ -0,0 +1,11042 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm64 6.11.0-rc4 Kernel Configuration +# +CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0" +CONFIG_CC_IS_GCC=y +CONFIG_GCC_VERSION=130200 +CONFIG_CLANG_VERSION=0 +CONFIG_AS_IS_GNU=y +CONFIG_AS_VERSION=24200 +CONFIG_LD_IS_BFD=y +CONFIG_LD_VERSION=24200 +CONFIG_LLD_VERSION=0 +CONFIG_CC_CAN_LINK=y +CONFIG_CC_CAN_LINK_STATIC=y +CONFIG_GCC_ASM_GOTO_OUTPUT_BROKEN=y +CONFIG_CC_HAS_ASM_INLINE=y +CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y +CONFIG_PAHOLE_VERSION=125 +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_TABLE_SORT=y +CONFIG_THREAD_INFO_IN_TASK=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +# CONFIG_COMPILE_TEST is not set +# CONFIG_WERROR is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_BUILD_SALT="" +CONFIG_DEFAULT_INIT="" +CONFIG_DEFAULT_HOSTNAME="(none)" +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +CONFIG_SYSVIPC_COMPAT=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +# CONFIG_WATCH_QUEUE is not set +CONFIG_CROSS_MEMORY_ATTACH=y +CONFIG_USELIB=y +CONFIG_AUDIT=y +CONFIG_HAVE_ARCH_AUDITSYSCALL=y +CONFIG_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_GENERIC_IRQ_INJECTION=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_SIM=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_GENERIC_IRQ_IPI=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_IRQ_MSI_IOMMU=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +# CONFIG_GENERIC_IRQ_DEBUGFS is not set +# end of IRQ subsystem + +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y +CONFIG_TIME_KUNIT_TEST=m +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y + +# +# Timers subsystem +# +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ_COMMON=y +# CONFIG_HZ_PERIODIC is not set +CONFIG_NO_HZ_IDLE=y +# CONFIG_NO_HZ_FULL is not set +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +# end of Timers subsystem + +CONFIG_BPF=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y + +# +# BPF subsystem +# +CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT=y +# CONFIG_BPF_JIT_ALWAYS_ON is not set +CONFIG_BPF_JIT_DEFAULT_ON=y +# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set +# CONFIG_BPF_PRELOAD is not set +CONFIG_BPF_LSM=y +# end of BPF subsystem + +CONFIG_PREEMPT_BUILD=y +# CONFIG_PREEMPT_NONE is not set +# CONFIG_PREEMPT_VOLUNTARY is not set +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y +CONFIG_PREEMPTION=y +# CONFIG_PREEMPT_DYNAMIC is not set +CONFIG_SCHED_CORE=y + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +CONFIG_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_SCHED_AVG_IRQ=y +CONFIG_SCHED_HW_PRESSURE=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_TASKSTATS=y +CONFIG_TASK_DELAY_ACCT=y +CONFIG_TASK_XACCT=y +CONFIG_TASK_IO_ACCOUNTING=y +# CONFIG_PSI is not set +# end of CPU/Task time and stats accounting + +CONFIG_CPU_ISOLATION=y + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +CONFIG_PREEMPT_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_TREE_SRCU=y +CONFIG_TASKS_RCU_GENERIC=y +CONFIG_NEED_TASKS_RCU=y +CONFIG_TASKS_RCU=y +CONFIG_TASKS_TRACE_RCU=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RCU_NEED_SEGCBLIST=y +# end of RCU Subsystem + +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=m +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +# CONFIG_PRINTK_INDEX is not set +CONFIG_GENERIC_SCHED_CLOCK=y + +# +# Scheduler features +# +# CONFIG_UCLAMP_TASK is not set +# end of Scheduler features + +CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y +CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y +CONFIG_CC_HAS_INT128=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_GCC10_NO_ARRAY_BOUNDS=y +CONFIG_CC_NO_ARRAY_BOUNDS=y +CONFIG_GCC_NO_STRINGOP_OVERFLOW=y +CONFIG_CC_NO_STRINGOP_OVERFLOW=y +CONFIG_ARCH_SUPPORTS_INT128=y +CONFIG_NUMA_BALANCING=y +CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y +CONFIG_SLAB_OBJ_EXT=y +CONFIG_CGROUPS=y +CONFIG_PAGE_COUNTER=y +# CONFIG_CGROUP_FAVOR_DYNMODS is not set +CONFIG_MEMCG=y +# CONFIG_MEMCG_V1 is not set +CONFIG_BLK_CGROUP=y +CONFIG_CGROUP_WRITEBACK=y +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_SCHED_MM_CID=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_RDMA=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_HUGETLB=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_BPF=y +CONFIG_CGROUP_MISC=y +# CONFIG_CGROUP_DEBUG is not set +CONFIG_SOCK_CGROUP_DATA=y +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_TIME_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y +CONFIG_CHECKPOINT_RESTORE=y +CONFIG_SCHED_AUTOGROUP=y +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_XZ=y +CONFIG_RD_LZO=y +CONFIG_RD_LZ4=y +CONFIG_RD_ZSTD=y +CONFIG_BOOT_CONFIG=y +# CONFIG_BOOT_CONFIG_FORCE is not set +# CONFIG_BOOT_CONFIG_EMBED is not set +CONFIG_INITRAMFS_PRESERVE_MTIME=y +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_LD_ORPHAN_WARN=y +CONFIG_LD_ORPHAN_WARN_LEVEL="warn" +CONFIG_SYSCTL=y +CONFIG_HAVE_UID16=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_EXPERT=y +CONFIG_UID16=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +CONFIG_FHANDLE=y +CONFIG_POSIX_TIMERS=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +# CONFIG_BASE_SMALL is not set +CONFIG_FUTEX=y +CONFIG_FUTEX_PI=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_IO_URING=y +CONFIG_ADVISE_SYSCALLS=y +CONFIG_MEMBARRIER=y +CONFIG_KCMP=y +CONFIG_RSEQ=y +# CONFIG_DEBUG_RSEQ is not set +CONFIG_CACHESTAT_SYSCALL=y +# CONFIG_PC104 is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_SELFTEST is not set +# CONFIG_KALLSYMS_ALL is not set +CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_GUEST_PERF_EVENTS=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +# end of Kernel Performance Events And Counters + +CONFIG_SYSTEM_DATA_VERIFICATION=y +CONFIG_PROFILING=y +CONFIG_TRACEPOINTS=y + +# +# Kexec and crash features +# +CONFIG_KEXEC_CORE=y +CONFIG_HAVE_IMA_KEXEC=y +CONFIG_KEXEC=y +CONFIG_KEXEC_FILE=y +# CONFIG_KEXEC_SIG is not set +# CONFIG_CRASH_DUMP is not set +# end of Kexec and crash features +# end of General setup + +CONFIG_ARM64=y +CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=y +CONFIG_64BIT=y +CONFIG_MMU=y +CONFIG_ARM64_CONT_PTE_SHIFT=4 +CONFIG_ARM64_CONT_PMD_SHIFT=4 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=33 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_SMP=y +CONFIG_KERNEL_MODE_NEON=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_PGTABLE_LEVELS=4 +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y + +# +# Platform selection +# +# CONFIG_ARCH_ACTIONS is not set +# CONFIG_ARCH_AIROHA is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_APPLE is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_BITMAIN is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SPARX5 is not set +# CONFIG_ARCH_K3 is not set +# CONFIG_ARCH_LG1K is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEEMBAY is not set +# CONFIG_ARCH_MEDIATEK is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_NXP is not set +# CONFIG_ARCH_MA35 is not set +# CONFIG_ARCH_NPCM is not set +# CONFIG_ARCH_PENSANDO is not set +# CONFIG_ARCH_QCOM is not set +# CONFIG_ARCH_REALTEK is not set +# CONFIG_ARCH_RENESAS is not set +CONFIG_ARCH_ROCKCHIP=y +# CONFIG_ARCH_SEATTLE is not set +# CONFIG_ARCH_INTEL_SOCFPGA is not set +# CONFIG_ARCH_STM32 is not set +# CONFIG_ARCH_SYNQUACER is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_SPRD is not set +# CONFIG_ARCH_THUNDER is not set +# CONFIG_ARCH_THUNDER2 is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_VEXPRESS is not set +# CONFIG_ARCH_VISCONTI is not set +# CONFIG_ARCH_XGENE is not set +# CONFIG_ARCH_ZYNQMP is not set +# end of Platform selection + +# +# Kernel Features +# + +# +# ARM errata workarounds via the alternatives framework +# +CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y +CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y +CONFIG_ARM64_ERRATUM_826319=y +CONFIG_ARM64_ERRATUM_827319=y +CONFIG_ARM64_ERRATUM_824069=y +CONFIG_ARM64_ERRATUM_819472=y +CONFIG_ARM64_ERRATUM_832075=y +CONFIG_ARM64_ERRATUM_834220=y +CONFIG_ARM64_ERRATUM_1742098=y +CONFIG_ARM64_ERRATUM_845719=y +CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y +CONFIG_ARM64_ERRATUM_1024718=y +CONFIG_ARM64_ERRATUM_1418040=y +CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y +CONFIG_ARM64_ERRATUM_1165522=y +CONFIG_ARM64_ERRATUM_1319367=y +CONFIG_ARM64_ERRATUM_1530923=y +CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y +CONFIG_ARM64_ERRATUM_2441007=y +CONFIG_ARM64_ERRATUM_1286807=y +CONFIG_ARM64_ERRATUM_1463225=y +CONFIG_ARM64_ERRATUM_1542419=y +CONFIG_ARM64_ERRATUM_1508412=y +CONFIG_ARM64_ERRATUM_2051678=y +CONFIG_ARM64_ERRATUM_2077057=y +CONFIG_ARM64_ERRATUM_2658417=y +CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE=y +CONFIG_ARM64_ERRATUM_2054223=y +CONFIG_ARM64_ERRATUM_2067961=y +CONFIG_ARM64_ERRATUM_2441009=y +CONFIG_ARM64_ERRATUM_2457168=y +CONFIG_ARM64_ERRATUM_2645198=y +CONFIG_ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD=y +CONFIG_ARM64_ERRATUM_2966298=y +CONFIG_ARM64_ERRATUM_3117295=y +CONFIG_ARM64_ERRATUM_3194386=y +CONFIG_CAVIUM_ERRATUM_22375=y +CONFIG_CAVIUM_ERRATUM_23144=y +CONFIG_CAVIUM_ERRATUM_23154=y +CONFIG_CAVIUM_ERRATUM_27456=y +CONFIG_CAVIUM_ERRATUM_30115=y +CONFIG_CAVIUM_TX2_ERRATUM_219=y +CONFIG_FUJITSU_ERRATUM_010001=y +CONFIG_HISILICON_ERRATUM_161600802=y +CONFIG_QCOM_FALKOR_ERRATUM_1003=y +CONFIG_QCOM_FALKOR_ERRATUM_1009=y +CONFIG_QCOM_QDF2400_ERRATUM_0065=y +CONFIG_QCOM_FALKOR_ERRATUM_E1041=y +CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y +CONFIG_ROCKCHIP_ERRATUM_3588001=y +CONFIG_SOCIONEXT_SYNQUACER_PREITS=y +# end of ARM errata workarounds via the alternatives framework + +CONFIG_ARM64_4K_PAGES=y +# CONFIG_ARM64_16K_PAGES is not set +# CONFIG_ARM64_64K_PAGES is not set +# CONFIG_ARM64_VA_BITS_39 is not set +CONFIG_ARM64_VA_BITS_48=y +# CONFIG_ARM64_VA_BITS_52 is not set +CONFIG_ARM64_VA_BITS=48 +CONFIG_ARM64_PA_BITS_48=y +CONFIG_ARM64_PA_BITS=48 +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_SCHED_MC=y +CONFIG_SCHED_CLUSTER=y +CONFIG_SCHED_SMT=y +CONFIG_NR_CPUS=256 +CONFIG_HOTPLUG_CPU=y +CONFIG_NUMA=y +CONFIG_NODES_SHIFT=4 +# CONFIG_HZ_100 is not set +# CONFIG_HZ_250 is not set +CONFIG_HZ_300=y +# CONFIG_HZ_1000 is not set +CONFIG_HZ=300 +CONFIG_SCHED_HRTICK=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_CC_HAVE_SHADOW_CALL_STACK=y +CONFIG_PARAVIRT=y +CONFIG_PARAVIRT_TIME_ACCOUNTING=y +CONFIG_ARCH_SUPPORTS_KEXEC=y +CONFIG_ARCH_SUPPORTS_KEXEC_FILE=y +CONFIG_ARCH_SELECTS_KEXEC_FILE=y +CONFIG_ARCH_SUPPORTS_KEXEC_SIG=y +CONFIG_ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG=y +CONFIG_ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG=y +CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y +CONFIG_TRANS_TABLE=y +CONFIG_XEN_DOM0=y +CONFIG_XEN=y +CONFIG_ARCH_FORCE_MAX_ORDER=10 +CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY=y +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +# CONFIG_ARM64_SW_TTBR0_PAN is not set +CONFIG_ARM64_TAGGED_ADDR_ABI=y +CONFIG_COMPAT=y +CONFIG_KUSER_HELPERS=y +CONFIG_COMPAT_ALIGNMENT_FIXUPS=y +CONFIG_ARMV8_DEPRECATED=y +CONFIG_SWP_EMULATION=y +CONFIG_CP15_BARRIER_EMULATION=y +CONFIG_SETEND_EMULATION=y + +# +# ARMv8.1 architectural features +# +CONFIG_ARM64_HW_AFDBM=y +CONFIG_ARM64_PAN=y +CONFIG_AS_HAS_LSE_ATOMICS=y +CONFIG_ARM64_LSE_ATOMICS=y +CONFIG_ARM64_USE_LSE_ATOMICS=y +# end of ARMv8.1 architectural features + +# +# ARMv8.2 architectural features +# +CONFIG_AS_HAS_ARMV8_2=y +CONFIG_AS_HAS_SHA3=y +# CONFIG_ARM64_PMEM is not set +CONFIG_ARM64_RAS_EXTN=y +CONFIG_ARM64_CNP=y +# end of ARMv8.2 architectural features + +# +# ARMv8.3 architectural features +# +CONFIG_ARM64_PTR_AUTH=y +CONFIG_ARM64_PTR_AUTH_KERNEL=y +CONFIG_CC_HAS_BRANCH_PROT_PAC_RET=y +CONFIG_CC_HAS_SIGN_RETURN_ADDRESS=y +CONFIG_AS_HAS_ARMV8_3=y +CONFIG_AS_HAS_CFI_NEGATE_RA_STATE=y +CONFIG_AS_HAS_LDAPR=y +# end of ARMv8.3 architectural features + +# +# ARMv8.4 architectural features +# +CONFIG_ARM64_AMU_EXTN=y +CONFIG_AS_HAS_ARMV8_4=y +CONFIG_ARM64_TLB_RANGE=y +# end of ARMv8.4 architectural features + +# +# ARMv8.5 architectural features +# +CONFIG_AS_HAS_ARMV8_5=y +CONFIG_ARM64_BTI=y +CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI=y +CONFIG_ARM64_E0PD=y +CONFIG_ARM64_AS_HAS_MTE=y +CONFIG_ARM64_MTE=y +# end of ARMv8.5 architectural features + +# +# ARMv8.7 architectural features +# +CONFIG_ARM64_EPAN=y +# end of ARMv8.7 architectural features + +CONFIG_ARM64_SVE=y +CONFIG_ARM64_SME=y +CONFIG_ARM64_PSEUDO_NMI=y +# CONFIG_ARM64_DEBUG_PRIORITY_MASKING is not set +CONFIG_RELOCATABLE=y +CONFIG_RANDOMIZE_BASE=y +CONFIG_RANDOMIZE_MODULE_REGION_FULL=y +CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_STACKPROTECTOR_PER_TASK=y +CONFIG_ARM64_CONTPTE=y +# end of Kernel Features + +# +# Boot options +# +# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set +CONFIG_CMDLINE="" +CONFIG_EFI_STUB=y +CONFIG_EFI=y +# CONFIG_COMPRESSED_INSTALL is not set +CONFIG_DMI=y +# end of Boot options + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_SUSPEND_SKIP_SYNC is not set +CONFIG_HIBERNATE_CALLBACKS=y +CONFIG_HIBERNATION=y +CONFIG_HIBERNATION_SNAPSHOT_DEV=y +CONFIG_HIBERNATION_COMP_LZO=y +# CONFIG_HIBERNATION_COMP_LZ4 is not set +CONFIG_HIBERNATION_DEF_COMP="lzo" +CONFIG_PM_STD_PARTITION="" +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_USERSPACE_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y +CONFIG_PM_GENERIC_DOMAINS_SLEEP=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_CPU_PM=y +CONFIG_ENERGY_MODEL=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_HIBERNATION_HEADER=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +# end of Power management options + +# +# CPU Power Management +# + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE_GOV_TEO=y +CONFIG_DT_IDLE_STATES=y +CONFIG_DT_IDLE_GENPD=y + +# +# ARM CPU Idle Drivers +# +CONFIG_ARM_PSCI_CPUIDLE=y +CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y +# end of ARM CPU Idle Drivers +# end of CPU Idle + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_STAT=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y + +# +# CPU frequency scaling drivers +# +CONFIG_CPUFREQ_DT=y +CONFIG_CPUFREQ_DT_PLATDEV=y +# CONFIG_ARM_SCMI_CPUFREQ is not set +# CONFIG_ACPI_CPPC_CPUFREQ is not set +# end of CPU Frequency scaling +# end of CPU Power Management + +CONFIG_ARCH_SUPPORTS_ACPI=y +CONFIG_ACPI=y +CONFIG_ACPI_GENERIC_GSI=y +CONFIG_ACPI_CCA_REQUIRED=y +CONFIG_ACPI_TABLE_LIB=y +CONFIG_ACPI_THERMAL_LIB=y +# CONFIG_ACPI_DEBUGGER is not set +CONFIG_ACPI_SPCR_TABLE=y +# CONFIG_ACPI_FPDT is not set +# CONFIG_ACPI_EC_DEBUGFS is not set +CONFIG_ACPI_AC=m +CONFIG_ACPI_BATTERY=m +CONFIG_ACPI_BUTTON=m +# CONFIG_ACPI_TINY_POWER_BUTTON is not set +CONFIG_ACPI_VIDEO=m +CONFIG_ACPI_FAN=m +# CONFIG_ACPI_TAD is not set +CONFIG_ACPI_DOCK=y +CONFIG_ACPI_PROCESSOR_IDLE=y +CONFIG_ACPI_MCFG=y +CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_IPMI=m +CONFIG_ACPI_HOTPLUG_CPU=y +CONFIG_ACPI_THERMAL=m +CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y +CONFIG_ACPI_TABLE_UPGRADE=y +# CONFIG_ACPI_DEBUG is not set +CONFIG_ACPI_PCI_SLOT=y +CONFIG_ACPI_CONTAINER=y +CONFIG_ACPI_HED=y +# CONFIG_ACPI_BGRT is not set +CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y +CONFIG_ACPI_NHLT=y +CONFIG_ACPI_NUMA=y +CONFIG_ACPI_HMAT=y +CONFIG_HAVE_ACPI_APEI=y +CONFIG_ACPI_APEI=y +CONFIG_ACPI_APEI_GHES=y +# CONFIG_ACPI_APEI_PCIEAER is not set +CONFIG_ACPI_APEI_SEA=y +CONFIG_ACPI_APEI_MEMORY_FAILURE=y +CONFIG_ACPI_APEI_EINJ=y +CONFIG_ACPI_APEI_EINJ_CXL=y +# CONFIG_ACPI_APEI_ERST_DEBUG is not set +CONFIG_ACPI_WATCHDOG=y +CONFIG_ACPI_CONFIGFS=m +# CONFIG_ACPI_PFRUT is not set +CONFIG_ACPI_IORT=y +CONFIG_ACPI_GTDT=y +# CONFIG_ACPI_AGDI is not set +CONFIG_ACPI_APMT=y +CONFIG_ACPI_PPTT=y +CONFIG_ACPI_PCC=y +# CONFIG_ACPI_FFH is not set +CONFIG_PMIC_OPREGION=y +CONFIG_ACPI_VIOT=y +CONFIG_ACPI_PRMT=y +CONFIG_KVM_COMMON=y +CONFIG_HAVE_KVM_IRQCHIP=y +CONFIG_HAVE_KVM_IRQ_ROUTING=y +CONFIG_HAVE_KVM_DIRTY_RING=y +CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL=y +CONFIG_NEED_KVM_DIRTY_RING_WITH_BITMAP=y +CONFIG_KVM_MMIO=y +CONFIG_HAVE_KVM_MSI=y +CONFIG_HAVE_KVM_READONLY_MEM=y +CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y +CONFIG_KVM_VFIO=y +CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y +CONFIG_HAVE_KVM_IRQ_BYPASS=y +CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE=y +CONFIG_KVM_XFER_TO_GUEST_WORK=y +CONFIG_KVM_GENERIC_HARDWARE_ENABLING=y +CONFIG_KVM_GENERIC_MMU_NOTIFIER=y +CONFIG_VIRTUALIZATION=y +CONFIG_KVM=y +# CONFIG_NVHE_EL2_DEBUG is not set +CONFIG_CPU_MITIGATIONS=y + +# +# General architecture-dependent options +# +CONFIG_ARCH_HAS_SUBPAGE_FAULTS=y +CONFIG_HOTPLUG_CORE_SYNC=y +CONFIG_HOTPLUG_CORE_SYNC_DEAD=y +CONFIG_KPROBES=y +CONFIG_JUMP_LABEL=y +# CONFIG_STATIC_KEYS_SELFTEST is not set +CONFIG_UPROBES=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_KRETPROBES=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y +CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y +CONFIG_HAVE_NMI=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_ARCH_HAS_FORTIFY_SOURCE=y +CONFIG_ARCH_HAS_KEEPINITRD=y +CONFIG_ARCH_HAS_SET_MEMORY=y +CONFIG_ARCH_HAS_SET_DIRECT_MAP=y +CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y +CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_HAVE_ASM_MODVERSIONS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_RSEQ=y +CONFIG_HAVE_RUST=y +CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_EVENTS_NMI=y +CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y +CONFIG_MMU_GATHER_TABLE_FREE=y +CONFIG_MMU_GATHER_RCU_TABLE_FREE=y +CONFIG_MMU_LAZY_TLB_REFCOUNT=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_SECCOMP=y +CONFIG_SECCOMP_FILTER=y +# CONFIG_SECCOMP_CACHE_DEBUG is not set +CONFIG_HAVE_ARCH_STACKLEAK=y +CONFIG_HAVE_STACKPROTECTOR=y +CONFIG_STACKPROTECTOR=y +CONFIG_STACKPROTECTOR_STRONG=y +CONFIG_ARCH_SUPPORTS_SHADOW_CALL_STACK=y +# CONFIG_SHADOW_CALL_STACK is not set +CONFIG_ARCH_SUPPORTS_LTO_CLANG=y +CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y +CONFIG_LTO_NONE=y +CONFIG_ARCH_SUPPORTS_CFI_CLANG=y +CONFIG_HAVE_CONTEXT_TRACKING_USER=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOVE_PUD=y +CONFIG_HAVE_MOVE_PMD=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +CONFIG_HAVE_ARCH_HUGE_VMAP=y +CONFIG_HAVE_ARCH_HUGE_VMALLOC=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_WANT_PMD_MKWRITE=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_ARCH_WANTS_EXECMEM_LATE=y +CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y +CONFIG_SOFTIRQ_ON_OWN_STACK=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_HAVE_ARCH_MMAP_RND_BITS=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 +CONFIG_HAVE_PAGE_SIZE_4KB=y +CONFIG_PAGE_SIZE_4KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SHIFT=12 +CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_COMPAT_OLD_SIGACTION=y +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_HAVE_ARCH_VMAP_STACK=y +CONFIG_VMAP_STACK=y +CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y +CONFIG_RANDOMIZE_KSTACK_OFFSET=y +# CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set +CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y +CONFIG_STRICT_KERNEL_RWX=y +CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y +CONFIG_STRICT_MODULE_RWX=y +CONFIG_HAVE_ARCH_COMPILER_H=y +CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y +CONFIG_ARCH_USE_MEMREMAP_PROT=y +# CONFIG_LOCK_EVENT_COUNTS is not set +CONFIG_ARCH_HAS_RELR=y +CONFIG_HAVE_PREEMPT_DYNAMIC=y +CONFIG_HAVE_PREEMPT_DYNAMIC_KEY=y +CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y +CONFIG_ARCH_HAVE_TRACE_MMIO_ACCESS=y +CONFIG_ARCH_HAS_HW_PTE_YOUNG=y +CONFIG_ARCH_HAS_KERNEL_FPU_SUPPORT=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +# end of GCOV-based kernel profiling + +CONFIG_HAVE_GCC_PLUGINS=y +CONFIG_FUNCTION_ALIGNMENT_4B=y +CONFIG_FUNCTION_ALIGNMENT=4 +# end of General architecture-dependent options + +CONFIG_RT_MUTEXES=y +CONFIG_MODULES=y +# CONFIG_MODULE_DEBUG is not set +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set +CONFIG_MODVERSIONS=y +CONFIG_ASM_MODVERSIONS=y +CONFIG_MODULE_SRCVERSION_ALL=y +# CONFIG_MODULE_SIG is not set +CONFIG_MODULE_COMPRESS_NONE=y +# CONFIG_MODULE_COMPRESS_GZIP is not set +# CONFIG_MODULE_COMPRESS_XZ is not set +# CONFIG_MODULE_COMPRESS_ZSTD is not set +# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set +CONFIG_MODPROBE_PATH="/sbin/modprobe" +# CONFIG_TRIM_UNUSED_KSYMS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +CONFIG_BLOCK_LEGACY_AUTOLOAD=y +CONFIG_BLK_CGROUP_RWSTAT=y +CONFIG_BLK_CGROUP_PUNT_BIO=y +CONFIG_BLK_DEV_BSG_COMMON=y +CONFIG_BLK_ICQ=y +CONFIG_BLK_DEV_BSGLIB=y +CONFIG_BLK_DEV_INTEGRITY=y +CONFIG_BLK_DEV_WRITE_MOUNTED=y +CONFIG_BLK_DEV_ZONED=y +CONFIG_BLK_DEV_THROTTLING=y +CONFIG_BLK_WBT=y +CONFIG_BLK_WBT_MQ=y +CONFIG_BLK_CGROUP_IOLATENCY=y +# CONFIG_BLK_CGROUP_FC_APPID is not set +# CONFIG_BLK_CGROUP_IOCOST is not set +# CONFIG_BLK_CGROUP_IOPRIO is not set +CONFIG_BLK_DEBUG_FS=y +CONFIG_BLK_SED_OPAL=y +# CONFIG_BLK_INLINE_ENCRYPTION is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_AIX_PARTITION is not set +CONFIG_OSF_PARTITION=y +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +CONFIG_MAC_PARTITION=y +CONFIG_MSDOS_PARTITION=y +CONFIG_BSD_DISKLABEL=y +# CONFIG_MINIX_SUBPARTITION is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +CONFIG_LDM_PARTITION=y +# CONFIG_LDM_DEBUG is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_KARMA_PARTITION is not set +CONFIG_EFI_PARTITION=y +# CONFIG_SYSV68_PARTITION is not set +CONFIG_CMDLINE_PARTITION=y +# end of Partition Types + +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_MQ_VIRTIO=y +CONFIG_BLK_PM=y +CONFIG_BLOCK_HOLDER_DEPRECATED=y +CONFIG_BLK_MQ_STACKING=y + +# +# IO Schedulers +# +CONFIG_MQ_IOSCHED_DEADLINE=y +CONFIG_MQ_IOSCHED_KYBER=y +CONFIG_IOSCHED_BFQ=y +CONFIG_BFQ_GROUP_IOSCHED=y +# CONFIG_BFQ_CGROUP_DEBUG is not set +# end of IO Schedulers + +CONFIG_PREEMPT_NOTIFIERS=y +CONFIG_PADATA=y +CONFIG_ASN1=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y +CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y +CONFIG_FREEZER=y + +# +# Executable file formats +# +CONFIG_BINFMT_ELF=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_ARCH_BINFMT_ELF_STATE=y +CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y +CONFIG_ARCH_HAVE_ELF_PROT=y +CONFIG_ARCH_USE_GNU_PROPERTY=y +CONFIG_ELFCORE=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_BINFMT_SCRIPT=y +CONFIG_BINFMT_MISC=m +CONFIG_COREDUMP=y +# end of Executable file formats + +# +# Memory Management options +# +CONFIG_ZPOOL=y +CONFIG_SWAP=y +CONFIG_ZSWAP=y +CONFIG_ZSWAP_DEFAULT_ON=y +# CONFIG_ZSWAP_SHRINKER_DEFAULT_ON is not set +# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE is not set +# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO is not set +# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842 is not set +# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4 is not set +# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC is not set +CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y +CONFIG_ZSWAP_COMPRESSOR_DEFAULT="zstd" +# CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD is not set +CONFIG_ZSWAP_ZPOOL_DEFAULT_Z3FOLD=y +# CONFIG_ZSWAP_ZPOOL_DEFAULT_ZSMALLOC is not set +CONFIG_ZSWAP_ZPOOL_DEFAULT="z3fold" +CONFIG_ZBUD=y +CONFIG_Z3FOLD=y +CONFIG_HAVE_ZSMALLOC=y +CONFIG_ZSMALLOC=y +# CONFIG_ZSMALLOC_STAT is not set +CONFIG_ZSMALLOC_CHAIN_SIZE=8 + +# +# Slab allocator options +# +CONFIG_SLUB=y +# CONFIG_SLUB_TINY is not set +CONFIG_SLAB_MERGE_DEFAULT=y +CONFIG_SLAB_FREELIST_RANDOM=y +# CONFIG_SLAB_FREELIST_HARDENED is not set +# CONFIG_SLAB_BUCKETS is not set +# CONFIG_SLUB_STATS is not set +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_RANDOM_KMALLOC_CACHES is not set +# end of Slab allocator options + +# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_SPARSEMEM=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_GUP_FAST=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_MEMORY_ISOLATION=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +# CONFIG_MEMORY_HOTPLUG is not set +CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y +CONFIG_MEMORY_BALLOON=y +CONFIG_BALLOON_COMPACTION=y +CONFIG_COMPACTION=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 +CONFIG_PAGE_REPORTING=y +CONFIG_MIGRATION=y +CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=y +CONFIG_ARCH_ENABLE_THP_MIGRATION=y +CONFIG_CONTIG_ALLOC=y +CONFIG_PCP_BATCH_SCALE_MAX=5 +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_MMU_NOTIFIER=y +CONFIG_KSM=y +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y +CONFIG_MEMORY_FAILURE=y +# CONFIG_HWPOISON_INJECT is not set +CONFIG_ARCH_WANTS_THP_SWAP=y +CONFIG_TRANSPARENT_HUGEPAGE=y +# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set +CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y +# CONFIG_TRANSPARENT_HUGEPAGE_NEVER is not set +CONFIG_THP_SWAP=y +# CONFIG_READ_ONLY_THP_FOR_FS is not set +CONFIG_PGTABLE_HAS_HUGE_LEAVES=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +CONFIG_USE_PERCPU_NUMA_NODE_ID=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_CMA=y +# CONFIG_CMA_DEBUGFS is not set +# CONFIG_CMA_SYSFS is not set +CONFIG_CMA_AREAS=7 +CONFIG_GENERIC_EARLY_IOREMAP=y +# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y +CONFIG_IDLE_PAGE_TRACKING=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y +CONFIG_ARCH_HAS_PTE_DEVMAP=y +CONFIG_ARCH_HAS_ZONE_DMA_SET=y +CONFIG_ZONE_DMA=y +CONFIG_ZONE_DMA32=y +CONFIG_GET_FREE_REGION=y +CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y +CONFIG_ARCH_USES_PG_ARCH_X=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_PERCPU_STATS=y +# CONFIG_GUP_TEST is not set +# CONFIG_DMAPOOL_TEST is not set +CONFIG_ARCH_HAS_PTE_SPECIAL=y +CONFIG_MAPPING_DIRTY_HELPERS=y +CONFIG_MEMFD_CREATE=y +CONFIG_SECRETMEM=y +# CONFIG_ANON_VMA_NAME is not set +# CONFIG_USERFAULTFD is not set +CONFIG_LRU_GEN=y +# CONFIG_LRU_GEN_ENABLED is not set +# CONFIG_LRU_GEN_STATS is not set +CONFIG_LRU_GEN_WALKS_MMU=y +CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y +CONFIG_PER_VMA_LOCK=y +CONFIG_LOCK_MM_AND_FIND_VMA=y +CONFIG_IOMMU_MM_DATA=y +CONFIG_EXECMEM=y + +# +# Data Access Monitoring +# +# CONFIG_DAMON is not set +# end of Data Access Monitoring +# end of Memory Management options + +CONFIG_NET=y +CONFIG_COMPAT_NETLINK_MESSAGES=y +CONFIG_NET_INGRESS=y +CONFIG_NET_EGRESS=y +CONFIG_NET_XGRESS=y +CONFIG_NET_REDIRECT=y +CONFIG_SKB_DECRYPTED=y +CONFIG_SKB_EXTENSIONS=y + +# +# Networking options +# +CONFIG_PACKET=y +CONFIG_PACKET_DIAG=m +CONFIG_UNIX=y +CONFIG_AF_UNIX_OOB=y +CONFIG_UNIX_DIAG=m +CONFIG_TLS=m +CONFIG_TLS_DEVICE=y +# CONFIG_TLS_TOE is not set +CONFIG_XFRM=y +CONFIG_XFRM_OFFLOAD=y +CONFIG_XFRM_ALGO=m +CONFIG_XFRM_USER=m +CONFIG_XFRM_INTERFACE=m +CONFIG_XFRM_SUB_POLICY=y +CONFIG_XFRM_MIGRATE=y +CONFIG_XFRM_STATISTICS=y +CONFIG_XFRM_AH=m +CONFIG_XFRM_ESP=m +CONFIG_XFRM_IPCOMP=m +CONFIG_NET_KEY=m +CONFIG_NET_KEY_MIGRATE=y +CONFIG_XDP_SOCKETS=y +# CONFIG_XDP_SOCKETS_DIAG is not set +CONFIG_NET_HANDSHAKE=y +# CONFIG_NET_HANDSHAKE_KUNIT_TEST is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_FIB_TRIE_STATS=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +CONFIG_IP_ROUTE_CLASSID=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=m +CONFIG_NET_IPGRE_DEMUX=m +CONFIG_NET_IP_TUNNEL=m +CONFIG_NET_IPGRE=m +CONFIG_NET_IPGRE_BROADCAST=y +CONFIG_IP_MROUTE_COMMON=y +CONFIG_IP_MROUTE=y +CONFIG_IP_MROUTE_MULTIPLE_TABLES=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_SYN_COOKIES=y +CONFIG_NET_IPVTI=m +CONFIG_NET_UDP_TUNNEL=m +CONFIG_NET_FOU=m +CONFIG_NET_FOU_IP_TUNNELS=y +CONFIG_INET_AH=m +CONFIG_INET_ESP=m +CONFIG_INET_ESP_OFFLOAD=m +# CONFIG_INET_ESPINTCP is not set +CONFIG_INET_IPCOMP=m +CONFIG_INET_TABLE_PERTURB_ORDER=16 +CONFIG_INET_XFRM_TUNNEL=m +CONFIG_INET_TUNNEL=m +CONFIG_INET_DIAG=m +CONFIG_INET_TCP_DIAG=m +CONFIG_INET_UDP_DIAG=m +CONFIG_INET_RAW_DIAG=m +CONFIG_INET_DIAG_DESTROY=y +CONFIG_TCP_CONG_ADVANCED=y +CONFIG_TCP_CONG_BIC=m +CONFIG_TCP_CONG_CUBIC=y +CONFIG_TCP_CONG_WESTWOOD=m +CONFIG_TCP_CONG_HTCP=m +CONFIG_TCP_CONG_HSTCP=m +CONFIG_TCP_CONG_HYBLA=m +CONFIG_TCP_CONG_VEGAS=m +CONFIG_TCP_CONG_NV=m +CONFIG_TCP_CONG_SCALABLE=m +CONFIG_TCP_CONG_LP=m +CONFIG_TCP_CONG_VENO=m +CONFIG_TCP_CONG_YEAH=m +CONFIG_TCP_CONG_ILLINOIS=m +CONFIG_TCP_CONG_DCTCP=m +CONFIG_TCP_CONG_CDG=m +CONFIG_TCP_CONG_BBR=m +# CONFIG_DEFAULT_CUBIC is not set +CONFIG_DEFAULT_RENO=y +CONFIG_DEFAULT_TCP_CONG="reno" +CONFIG_TCP_SIGPOOL=y +# CONFIG_TCP_AO is not set +CONFIG_TCP_MD5SIG=y +CONFIG_IPV6=y +CONFIG_IPV6_ROUTER_PREF=y +CONFIG_IPV6_ROUTE_INFO=y +CONFIG_IPV6_OPTIMISTIC_DAD=y +CONFIG_INET6_AH=m +CONFIG_INET6_ESP=m +CONFIG_INET6_ESP_OFFLOAD=m +# CONFIG_INET6_ESPINTCP is not set +CONFIG_INET6_IPCOMP=m +CONFIG_IPV6_MIP6=m +CONFIG_IPV6_ILA=m +CONFIG_INET6_XFRM_TUNNEL=m +CONFIG_INET6_TUNNEL=m +CONFIG_IPV6_VTI=m +CONFIG_IPV6_SIT=m +CONFIG_IPV6_SIT_6RD=y +CONFIG_IPV6_NDISC_NODETYPE=y +CONFIG_IPV6_TUNNEL=m +CONFIG_IPV6_GRE=m +CONFIG_IPV6_FOU=m +CONFIG_IPV6_FOU_TUNNEL=m +CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_IPV6_SUBTREES=y +CONFIG_IPV6_MROUTE=y +CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y +CONFIG_IPV6_PIMSM_V2=y +CONFIG_IPV6_SEG6_LWTUNNEL=y +CONFIG_IPV6_SEG6_HMAC=y +CONFIG_IPV6_SEG6_BPF=y +# CONFIG_IPV6_RPL_LWTUNNEL is not set +# CONFIG_IPV6_IOAM6_LWTUNNEL is not set +CONFIG_NETLABEL=y +# CONFIG_MPTCP is not set +CONFIG_NETWORK_SECMARK=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NETWORK_PHY_TIMESTAMPING=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +CONFIG_BRIDGE_NETFILTER=m + +# +# Core Netfilter Configuration +# +CONFIG_NETFILTER_INGRESS=y +CONFIG_NETFILTER_EGRESS=y +CONFIG_NETFILTER_SKIP_EGRESS=y +CONFIG_NETFILTER_NETLINK=m +CONFIG_NETFILTER_FAMILY_BRIDGE=y +CONFIG_NETFILTER_FAMILY_ARP=y +CONFIG_NETFILTER_BPF_LINK=y +CONFIG_NETFILTER_NETLINK_HOOK=m +CONFIG_NETFILTER_NETLINK_ACCT=m +CONFIG_NETFILTER_NETLINK_QUEUE=m +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NETFILTER_NETLINK_OSF=m +CONFIG_NF_CONNTRACK=m +CONFIG_NF_LOG_SYSLOG=m +CONFIG_NETFILTER_CONNCOUNT=m +CONFIG_NF_CONNTRACK_MARK=y +CONFIG_NF_CONNTRACK_SECMARK=y +CONFIG_NF_CONNTRACK_ZONES=y +CONFIG_NF_CONNTRACK_PROCFS=y +CONFIG_NF_CONNTRACK_EVENTS=y +CONFIG_NF_CONNTRACK_TIMEOUT=y +CONFIG_NF_CONNTRACK_TIMESTAMP=y +CONFIG_NF_CONNTRACK_LABELS=y +CONFIG_NF_CONNTRACK_OVS=y +CONFIG_NF_CT_PROTO_DCCP=y +CONFIG_NF_CT_PROTO_GRE=y +CONFIG_NF_CT_PROTO_SCTP=y +CONFIG_NF_CT_PROTO_UDPLITE=y +CONFIG_NF_CONNTRACK_AMANDA=m +CONFIG_NF_CONNTRACK_FTP=m +CONFIG_NF_CONNTRACK_H323=m +CONFIG_NF_CONNTRACK_IRC=m +CONFIG_NF_CONNTRACK_BROADCAST=m +CONFIG_NF_CONNTRACK_NETBIOS_NS=m +CONFIG_NF_CONNTRACK_SNMP=m +CONFIG_NF_CONNTRACK_PPTP=m +CONFIG_NF_CONNTRACK_SANE=m +CONFIG_NF_CONNTRACK_SIP=m +CONFIG_NF_CONNTRACK_TFTP=m +CONFIG_NF_CT_NETLINK=m +CONFIG_NF_CT_NETLINK_TIMEOUT=m +CONFIG_NF_CT_NETLINK_HELPER=m +CONFIG_NETFILTER_NETLINK_GLUE_CT=y +CONFIG_NF_NAT=m +CONFIG_NF_NAT_AMANDA=m +CONFIG_NF_NAT_FTP=m +CONFIG_NF_NAT_IRC=m +CONFIG_NF_NAT_SIP=m +CONFIG_NF_NAT_TFTP=m +CONFIG_NF_NAT_REDIRECT=y +CONFIG_NF_NAT_MASQUERADE=y +CONFIG_NF_NAT_OVS=y +CONFIG_NETFILTER_SYNPROXY=m +CONFIG_NF_TABLES=m +CONFIG_NF_TABLES_INET=y +CONFIG_NF_TABLES_NETDEV=y +CONFIG_NFT_NUMGEN=m +CONFIG_NFT_CT=m +CONFIG_NFT_FLOW_OFFLOAD=m +CONFIG_NFT_CONNLIMIT=m +CONFIG_NFT_LOG=m +CONFIG_NFT_LIMIT=m +CONFIG_NFT_MASQ=m +CONFIG_NFT_REDIR=m +CONFIG_NFT_NAT=m +CONFIG_NFT_TUNNEL=m +CONFIG_NFT_QUEUE=m +CONFIG_NFT_QUOTA=m +CONFIG_NFT_REJECT=m +CONFIG_NFT_REJECT_INET=m +CONFIG_NFT_COMPAT=m +CONFIG_NFT_HASH=m +CONFIG_NFT_FIB=m +CONFIG_NFT_FIB_INET=m +CONFIG_NFT_XFRM=m +CONFIG_NFT_SOCKET=m +CONFIG_NFT_OSF=m +CONFIG_NFT_TPROXY=m +CONFIG_NFT_SYNPROXY=m +CONFIG_NF_DUP_NETDEV=m +CONFIG_NFT_DUP_NETDEV=m +CONFIG_NFT_FWD_NETDEV=m +CONFIG_NFT_FIB_NETDEV=m +CONFIG_NFT_REJECT_NETDEV=m +CONFIG_NF_FLOW_TABLE_INET=m +CONFIG_NF_FLOW_TABLE=m +CONFIG_NF_FLOW_TABLE_PROCFS=y +CONFIG_NETFILTER_XTABLES=m +CONFIG_NETFILTER_XTABLES_COMPAT=y + +# +# Xtables combined modules +# +CONFIG_NETFILTER_XT_MARK=m +CONFIG_NETFILTER_XT_CONNMARK=m +CONFIG_NETFILTER_XT_SET=m + +# +# Xtables targets +# +CONFIG_NETFILTER_XT_TARGET_AUDIT=m +CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m +CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m +CONFIG_NETFILTER_XT_TARGET_CONNMARK=m +CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m +CONFIG_NETFILTER_XT_TARGET_CT=m +CONFIG_NETFILTER_XT_TARGET_DSCP=m +CONFIG_NETFILTER_XT_TARGET_HL=m +CONFIG_NETFILTER_XT_TARGET_HMARK=m +CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m +CONFIG_NETFILTER_XT_TARGET_LED=m +CONFIG_NETFILTER_XT_TARGET_LOG=m +CONFIG_NETFILTER_XT_TARGET_MARK=m +CONFIG_NETFILTER_XT_NAT=m +CONFIG_NETFILTER_XT_TARGET_NETMAP=m +CONFIG_NETFILTER_XT_TARGET_NFLOG=m +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m +CONFIG_NETFILTER_XT_TARGET_NOTRACK=m +CONFIG_NETFILTER_XT_TARGET_RATEEST=m +CONFIG_NETFILTER_XT_TARGET_REDIRECT=m +CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m +CONFIG_NETFILTER_XT_TARGET_TEE=m +CONFIG_NETFILTER_XT_TARGET_TPROXY=m +CONFIG_NETFILTER_XT_TARGET_TRACE=m +CONFIG_NETFILTER_XT_TARGET_SECMARK=m +CONFIG_NETFILTER_XT_TARGET_TCPMSS=m +CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m + +# +# Xtables matches +# +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m +CONFIG_NETFILTER_XT_MATCH_BPF=m +CONFIG_NETFILTER_XT_MATCH_CGROUP=m +CONFIG_NETFILTER_XT_MATCH_CLUSTER=m +CONFIG_NETFILTER_XT_MATCH_COMMENT=m +CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m +CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m +CONFIG_NETFILTER_XT_MATCH_CONNMARK=m +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m +CONFIG_NETFILTER_XT_MATCH_CPU=m +CONFIG_NETFILTER_XT_MATCH_DCCP=m +CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m +CONFIG_NETFILTER_XT_MATCH_DSCP=m +CONFIG_NETFILTER_XT_MATCH_ECN=m +CONFIG_NETFILTER_XT_MATCH_ESP=m +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m +CONFIG_NETFILTER_XT_MATCH_HELPER=m +CONFIG_NETFILTER_XT_MATCH_HL=m +CONFIG_NETFILTER_XT_MATCH_IPCOMP=m +CONFIG_NETFILTER_XT_MATCH_IPRANGE=m +CONFIG_NETFILTER_XT_MATCH_IPVS=m +CONFIG_NETFILTER_XT_MATCH_L2TP=m +CONFIG_NETFILTER_XT_MATCH_LENGTH=m +CONFIG_NETFILTER_XT_MATCH_LIMIT=m +CONFIG_NETFILTER_XT_MATCH_MAC=m +CONFIG_NETFILTER_XT_MATCH_MARK=m +CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m +CONFIG_NETFILTER_XT_MATCH_NFACCT=m +CONFIG_NETFILTER_XT_MATCH_OSF=m +CONFIG_NETFILTER_XT_MATCH_OWNER=m +CONFIG_NETFILTER_XT_MATCH_POLICY=m +CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m +CONFIG_NETFILTER_XT_MATCH_QUOTA=m +CONFIG_NETFILTER_XT_MATCH_RATEEST=m +CONFIG_NETFILTER_XT_MATCH_REALM=m +CONFIG_NETFILTER_XT_MATCH_RECENT=m +CONFIG_NETFILTER_XT_MATCH_SCTP=m +CONFIG_NETFILTER_XT_MATCH_SOCKET=m +CONFIG_NETFILTER_XT_MATCH_STATE=m +CONFIG_NETFILTER_XT_MATCH_STATISTIC=m +CONFIG_NETFILTER_XT_MATCH_STRING=m +CONFIG_NETFILTER_XT_MATCH_TCPMSS=m +CONFIG_NETFILTER_XT_MATCH_TIME=m +CONFIG_NETFILTER_XT_MATCH_U32=m +# end of Core Netfilter Configuration + +CONFIG_IP_SET=m +CONFIG_IP_SET_MAX=256 +CONFIG_IP_SET_BITMAP_IP=m +CONFIG_IP_SET_BITMAP_IPMAC=m +CONFIG_IP_SET_BITMAP_PORT=m +CONFIG_IP_SET_HASH_IP=m +CONFIG_IP_SET_HASH_IPMARK=m +CONFIG_IP_SET_HASH_IPPORT=m +CONFIG_IP_SET_HASH_IPPORTIP=m +CONFIG_IP_SET_HASH_IPPORTNET=m +CONFIG_IP_SET_HASH_IPMAC=m +CONFIG_IP_SET_HASH_MAC=m +CONFIG_IP_SET_HASH_NETPORTNET=m +CONFIG_IP_SET_HASH_NET=m +CONFIG_IP_SET_HASH_NETNET=m +CONFIG_IP_SET_HASH_NETPORT=m +CONFIG_IP_SET_HASH_NETIFACE=m +CONFIG_IP_SET_LIST_SET=m +CONFIG_IP_VS=m +CONFIG_IP_VS_IPV6=y +# CONFIG_IP_VS_DEBUG is not set +CONFIG_IP_VS_TAB_BITS=12 + +# +# IPVS transport protocol load balancing support +# +CONFIG_IP_VS_PROTO_TCP=y +CONFIG_IP_VS_PROTO_UDP=y +CONFIG_IP_VS_PROTO_AH_ESP=y +CONFIG_IP_VS_PROTO_ESP=y +CONFIG_IP_VS_PROTO_AH=y +CONFIG_IP_VS_PROTO_SCTP=y + +# +# IPVS scheduler +# +CONFIG_IP_VS_RR=m +CONFIG_IP_VS_WRR=m +CONFIG_IP_VS_LC=m +CONFIG_IP_VS_WLC=m +CONFIG_IP_VS_FO=m +CONFIG_IP_VS_OVF=m +CONFIG_IP_VS_LBLC=m +CONFIG_IP_VS_LBLCR=m +CONFIG_IP_VS_DH=m +CONFIG_IP_VS_SH=m +CONFIG_IP_VS_MH=m +CONFIG_IP_VS_SED=m +CONFIG_IP_VS_NQ=m +CONFIG_IP_VS_TWOS=m + +# +# IPVS SH scheduler +# +CONFIG_IP_VS_SH_TAB_BITS=8 + +# +# IPVS MH scheduler +# +CONFIG_IP_VS_MH_TAB_INDEX=12 + +# +# IPVS application helper +# +CONFIG_IP_VS_FTP=m +CONFIG_IP_VS_NFCT=y +CONFIG_IP_VS_PE_SIP=m + +# +# IP: Netfilter Configuration +# +CONFIG_NF_DEFRAG_IPV4=m +CONFIG_IP_NF_IPTABLES_LEGACY=m +CONFIG_NF_SOCKET_IPV4=m +CONFIG_NF_TPROXY_IPV4=m +CONFIG_NF_TABLES_IPV4=y +CONFIG_NFT_REJECT_IPV4=m +CONFIG_NFT_DUP_IPV4=m +CONFIG_NFT_FIB_IPV4=m +CONFIG_NF_TABLES_ARP=y +CONFIG_NF_DUP_IPV4=m +CONFIG_NF_LOG_ARP=m +CONFIG_NF_LOG_IPV4=m +CONFIG_NF_REJECT_IPV4=m +CONFIG_NF_NAT_SNMP_BASIC=m +CONFIG_NF_NAT_PPTP=m +CONFIG_NF_NAT_H323=m +CONFIG_IP_NF_IPTABLES=m +CONFIG_IP_NF_MATCH_AH=m +CONFIG_IP_NF_MATCH_ECN=m +CONFIG_IP_NF_MATCH_RPFILTER=m +CONFIG_IP_NF_MATCH_TTL=m +CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IP_NF_TARGET_SYNPROXY=m +CONFIG_IP_NF_NAT=m +CONFIG_IP_NF_TARGET_MASQUERADE=m +CONFIG_IP_NF_TARGET_NETMAP=m +CONFIG_IP_NF_TARGET_REDIRECT=m +CONFIG_IP_NF_MANGLE=m +CONFIG_IP_NF_TARGET_ECN=m +CONFIG_IP_NF_TARGET_TTL=m +CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_SECURITY=m +CONFIG_IP_NF_ARPTABLES=m +CONFIG_NFT_COMPAT_ARP=m +CONFIG_IP_NF_ARPFILTER=m +CONFIG_IP_NF_ARP_MANGLE=m +# end of IP: Netfilter Configuration + +# +# IPv6: Netfilter Configuration +# +CONFIG_IP6_NF_IPTABLES_LEGACY=m +CONFIG_NF_SOCKET_IPV6=m +CONFIG_NF_TPROXY_IPV6=m +CONFIG_NF_TABLES_IPV6=y +CONFIG_NFT_REJECT_IPV6=m +CONFIG_NFT_DUP_IPV6=m +CONFIG_NFT_FIB_IPV6=m +CONFIG_NF_DUP_IPV6=m +CONFIG_NF_REJECT_IPV6=m +CONFIG_NF_LOG_IPV6=m +CONFIG_IP6_NF_IPTABLES=m +CONFIG_IP6_NF_MATCH_AH=m +CONFIG_IP6_NF_MATCH_EUI64=m +CONFIG_IP6_NF_MATCH_FRAG=m +CONFIG_IP6_NF_MATCH_OPTS=m +CONFIG_IP6_NF_MATCH_HL=m +CONFIG_IP6_NF_MATCH_IPV6HEADER=m +CONFIG_IP6_NF_MATCH_MH=m +CONFIG_IP6_NF_MATCH_RPFILTER=m +CONFIG_IP6_NF_MATCH_RT=m +CONFIG_IP6_NF_MATCH_SRH=m +CONFIG_IP6_NF_TARGET_HL=m +CONFIG_IP6_NF_FILTER=m +CONFIG_IP6_NF_TARGET_REJECT=m +CONFIG_IP6_NF_TARGET_SYNPROXY=m +CONFIG_IP6_NF_MANGLE=m +CONFIG_IP6_NF_RAW=m +CONFIG_IP6_NF_SECURITY=m +CONFIG_IP6_NF_NAT=m +CONFIG_IP6_NF_TARGET_MASQUERADE=m +CONFIG_IP6_NF_TARGET_NPT=m +# end of IPv6: Netfilter Configuration + +CONFIG_NF_DEFRAG_IPV6=m +CONFIG_NF_TABLES_BRIDGE=m +CONFIG_NFT_BRIDGE_META=m +CONFIG_NFT_BRIDGE_REJECT=m +CONFIG_NF_CONNTRACK_BRIDGE=m +CONFIG_BRIDGE_NF_EBTABLES_LEGACY=m +CONFIG_BRIDGE_NF_EBTABLES=m +CONFIG_BRIDGE_EBT_BROUTE=m +CONFIG_BRIDGE_EBT_T_FILTER=m +CONFIG_BRIDGE_EBT_T_NAT=m +CONFIG_BRIDGE_EBT_802_3=m +CONFIG_BRIDGE_EBT_AMONG=m +CONFIG_BRIDGE_EBT_ARP=m +CONFIG_BRIDGE_EBT_IP=m +CONFIG_BRIDGE_EBT_IP6=m +CONFIG_BRIDGE_EBT_LIMIT=m +CONFIG_BRIDGE_EBT_MARK=m +CONFIG_BRIDGE_EBT_PKTTYPE=m +CONFIG_BRIDGE_EBT_STP=m +CONFIG_BRIDGE_EBT_VLAN=m +CONFIG_BRIDGE_EBT_ARPREPLY=m +CONFIG_BRIDGE_EBT_DNAT=m +CONFIG_BRIDGE_EBT_MARK_T=m +CONFIG_BRIDGE_EBT_REDIRECT=m +CONFIG_BRIDGE_EBT_SNAT=m +CONFIG_BRIDGE_EBT_LOG=m +CONFIG_BRIDGE_EBT_NFLOG=m +CONFIG_IP_DCCP=m +CONFIG_INET_DCCP_DIAG=m + +# +# DCCP CCIDs Configuration +# +# CONFIG_IP_DCCP_CCID2_DEBUG is not set +CONFIG_IP_DCCP_CCID3=y +# CONFIG_IP_DCCP_CCID3_DEBUG is not set +CONFIG_IP_DCCP_TFRC_LIB=y +# end of DCCP CCIDs Configuration + +# +# DCCP Kernel Hacking +# +# CONFIG_IP_DCCP_DEBUG is not set +# end of DCCP Kernel Hacking + +CONFIG_IP_SCTP=m +CONFIG_SCTP_DBG_OBJCNT=y +CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=y +# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1 is not set +# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set +CONFIG_SCTP_COOKIE_HMAC_MD5=y +CONFIG_SCTP_COOKIE_HMAC_SHA1=y +CONFIG_INET_SCTP_DIAG=m +CONFIG_RDS=m +CONFIG_RDS_TCP=m +# CONFIG_RDS_DEBUG is not set +CONFIG_TIPC=m +CONFIG_TIPC_MEDIA_UDP=y +CONFIG_TIPC_CRYPTO=y +CONFIG_TIPC_DIAG=m +CONFIG_ATM=m +CONFIG_ATM_CLIP=m +CONFIG_ATM_CLIP_NO_ICMP=y +CONFIG_ATM_LANE=m +CONFIG_ATM_MPOA=m +CONFIG_ATM_BR2684=m +CONFIG_ATM_BR2684_IPFILTER=y +CONFIG_L2TP=m +CONFIG_L2TP_DEBUGFS=m +CONFIG_L2TP_V3=y +CONFIG_L2TP_IP=m +CONFIG_L2TP_ETH=m +CONFIG_STP=y +CONFIG_GARP=y +CONFIG_MRP=y +CONFIG_BRIDGE=m +CONFIG_BRIDGE_IGMP_SNOOPING=y +CONFIG_BRIDGE_VLAN_FILTERING=y +CONFIG_BRIDGE_MRP=y +# CONFIG_BRIDGE_CFM is not set +CONFIG_NET_DSA=m +CONFIG_NET_DSA_TAG_NONE=m +CONFIG_NET_DSA_TAG_AR9331=m +CONFIG_NET_DSA_TAG_BRCM_COMMON=m +CONFIG_NET_DSA_TAG_BRCM=m +CONFIG_NET_DSA_TAG_BRCM_LEGACY=m +CONFIG_NET_DSA_TAG_BRCM_PREPEND=m +CONFIG_NET_DSA_TAG_HELLCREEK=m +CONFIG_NET_DSA_TAG_GSWIP=m +CONFIG_NET_DSA_TAG_DSA_COMMON=m +CONFIG_NET_DSA_TAG_DSA=m +CONFIG_NET_DSA_TAG_EDSA=m +CONFIG_NET_DSA_TAG_MTK=m +CONFIG_NET_DSA_TAG_KSZ=m +CONFIG_NET_DSA_TAG_OCELOT=m +CONFIG_NET_DSA_TAG_OCELOT_8021Q=m +CONFIG_NET_DSA_TAG_QCA=m +CONFIG_NET_DSA_TAG_RTL4_A=m +CONFIG_NET_DSA_TAG_RTL8_4=m +CONFIG_NET_DSA_TAG_RZN1_A5PSW=m +CONFIG_NET_DSA_TAG_LAN9303=m +CONFIG_NET_DSA_TAG_SJA1105=m +CONFIG_NET_DSA_TAG_TRAILER=m +CONFIG_NET_DSA_TAG_VSC73XX_8021Q=m +CONFIG_NET_DSA_TAG_XRS700X=m +CONFIG_VLAN_8021Q=y +CONFIG_VLAN_8021Q_GVRP=y +CONFIG_VLAN_8021Q_MVRP=y +CONFIG_LLC=y +CONFIG_LLC2=m +CONFIG_ATALK=m +CONFIG_X25=m +CONFIG_LAPB=m +CONFIG_PHONET=m +CONFIG_6LOWPAN=m +# CONFIG_6LOWPAN_DEBUGFS is not set +CONFIG_6LOWPAN_NHC=m +CONFIG_6LOWPAN_NHC_DEST=m +CONFIG_6LOWPAN_NHC_FRAGMENT=m +CONFIG_6LOWPAN_NHC_HOP=m +CONFIG_6LOWPAN_NHC_IPV6=m +CONFIG_6LOWPAN_NHC_MOBILITY=m +CONFIG_6LOWPAN_NHC_ROUTING=m +CONFIG_6LOWPAN_NHC_UDP=m +CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m +CONFIG_6LOWPAN_GHC_UDP=m +CONFIG_6LOWPAN_GHC_ICMPV6=m +CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m +CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m +CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m +CONFIG_IEEE802154=m +CONFIG_IEEE802154_NL802154_EXPERIMENTAL=y +CONFIG_IEEE802154_SOCKET=m +CONFIG_IEEE802154_6LOWPAN=m +CONFIG_MAC802154=m +CONFIG_NET_SCHED=y + +# +# Queueing/Scheduling +# +CONFIG_NET_SCH_HTB=m +CONFIG_NET_SCH_HFSC=m +CONFIG_NET_SCH_PRIO=m +CONFIG_NET_SCH_MULTIQ=m +CONFIG_NET_SCH_RED=m +CONFIG_NET_SCH_SFB=m +CONFIG_NET_SCH_SFQ=m +CONFIG_NET_SCH_TEQL=m +CONFIG_NET_SCH_TBF=m +CONFIG_NET_SCH_CBS=m +CONFIG_NET_SCH_ETF=m +CONFIG_NET_SCH_MQPRIO_LIB=m +CONFIG_NET_SCH_TAPRIO=m +CONFIG_NET_SCH_GRED=m +CONFIG_NET_SCH_NETEM=m +CONFIG_NET_SCH_DRR=m +CONFIG_NET_SCH_MQPRIO=m +CONFIG_NET_SCH_SKBPRIO=m +CONFIG_NET_SCH_CHOKE=m +CONFIG_NET_SCH_QFQ=m +CONFIG_NET_SCH_CODEL=m +CONFIG_NET_SCH_FQ_CODEL=m +CONFIG_NET_SCH_CAKE=m +CONFIG_NET_SCH_FQ=m +CONFIG_NET_SCH_HHF=m +CONFIG_NET_SCH_PIE=m +CONFIG_NET_SCH_FQ_PIE=m +CONFIG_NET_SCH_INGRESS=m +CONFIG_NET_SCH_PLUG=m +CONFIG_NET_SCH_ETS=m +CONFIG_NET_SCH_DEFAULT=y +# CONFIG_DEFAULT_FQ is not set +# CONFIG_DEFAULT_CODEL is not set +# CONFIG_DEFAULT_FQ_CODEL is not set +# CONFIG_DEFAULT_FQ_PIE is not set +# CONFIG_DEFAULT_SFQ is not set +CONFIG_DEFAULT_PFIFO_FAST=y +CONFIG_DEFAULT_NET_SCH="pfifo_fast" + +# +# Classification +# +CONFIG_NET_CLS=y +CONFIG_NET_CLS_BASIC=m +CONFIG_NET_CLS_ROUTE4=m +CONFIG_NET_CLS_FW=m +CONFIG_NET_CLS_U32=m +CONFIG_CLS_U32_PERF=y +CONFIG_CLS_U32_MARK=y +CONFIG_NET_CLS_FLOW=m +CONFIG_NET_CLS_CGROUP=m +CONFIG_NET_CLS_BPF=m +CONFIG_NET_CLS_FLOWER=m +CONFIG_NET_CLS_MATCHALL=m +CONFIG_NET_EMATCH=y +CONFIG_NET_EMATCH_STACK=32 +CONFIG_NET_EMATCH_CMP=m +CONFIG_NET_EMATCH_NBYTE=m +CONFIG_NET_EMATCH_U32=m +CONFIG_NET_EMATCH_META=m +CONFIG_NET_EMATCH_TEXT=m +CONFIG_NET_EMATCH_CANID=m +CONFIG_NET_EMATCH_IPSET=m +CONFIG_NET_EMATCH_IPT=m +CONFIG_NET_CLS_ACT=y +CONFIG_NET_ACT_POLICE=m +CONFIG_NET_ACT_GACT=m +CONFIG_GACT_PROB=y +CONFIG_NET_ACT_MIRRED=m +CONFIG_NET_ACT_SAMPLE=m +CONFIG_NET_ACT_NAT=m +CONFIG_NET_ACT_PEDIT=m +CONFIG_NET_ACT_SIMP=m +CONFIG_NET_ACT_SKBEDIT=m +CONFIG_NET_ACT_CSUM=m +CONFIG_NET_ACT_MPLS=m +CONFIG_NET_ACT_VLAN=m +CONFIG_NET_ACT_BPF=m +CONFIG_NET_ACT_CONNMARK=m +CONFIG_NET_ACT_CTINFO=m +CONFIG_NET_ACT_SKBMOD=m +CONFIG_NET_ACT_IFE=m +CONFIG_NET_ACT_TUNNEL_KEY=m +CONFIG_NET_ACT_CT=m +CONFIG_NET_ACT_GATE=m +CONFIG_NET_IFE_SKBMARK=m +CONFIG_NET_IFE_SKBPRIO=m +CONFIG_NET_IFE_SKBTCINDEX=m +# CONFIG_NET_TC_SKB_EXT is not set +CONFIG_NET_SCH_FIFO=y +CONFIG_DCB=y +CONFIG_DNS_RESOLVER=y +CONFIG_BATMAN_ADV=m +CONFIG_BATMAN_ADV_BATMAN_V=y +CONFIG_BATMAN_ADV_BLA=y +CONFIG_BATMAN_ADV_DAT=y +CONFIG_BATMAN_ADV_NC=y +CONFIG_BATMAN_ADV_MCAST=y +CONFIG_BATMAN_ADV_DEBUG=y +CONFIG_BATMAN_ADV_TRACING=y +CONFIG_OPENVSWITCH=m +CONFIG_OPENVSWITCH_GRE=m +CONFIG_OPENVSWITCH_VXLAN=m +CONFIG_OPENVSWITCH_GENEVE=m +CONFIG_VSOCKETS=m +CONFIG_VSOCKETS_DIAG=m +CONFIG_VSOCKETS_LOOPBACK=m +CONFIG_VIRTIO_VSOCKETS=m +CONFIG_VIRTIO_VSOCKETS_COMMON=m +CONFIG_NETLINK_DIAG=m +CONFIG_MPLS=y +CONFIG_NET_MPLS_GSO=m +CONFIG_MPLS_ROUTING=m +CONFIG_MPLS_IPTUNNEL=m +CONFIG_NET_NSH=m +CONFIG_HSR=m +CONFIG_NET_SWITCHDEV=y +CONFIG_NET_L3_MASTER_DEV=y +# CONFIG_QRTR is not set +# CONFIG_NET_NCSI is not set +CONFIG_PCPU_DEV_REFCNT=y +CONFIG_MAX_SKB_FRAGS=17 +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_XPS=y +CONFIG_CGROUP_NET_PRIO=y +CONFIG_CGROUP_NET_CLASSID=y +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +CONFIG_BPF_STREAM_PARSER=y +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +CONFIG_NET_PKTGEN=m +CONFIG_NET_DROP_MONITOR=m +# end of Network testing +# end of Networking options + +CONFIG_HAMRADIO=y + +# +# Packet Radio protocols +# +CONFIG_AX25=m +CONFIG_AX25_DAMA_SLAVE=y +CONFIG_NETROM=m +CONFIG_ROSE=m + +# +# AX.25 network device drivers +# +CONFIG_MKISS=m +CONFIG_6PACK=m +CONFIG_BPQETHER=m +CONFIG_BAYCOM_SER_FDX=m +CONFIG_BAYCOM_SER_HDX=m +CONFIG_YAM=m +# end of AX.25 network device drivers + +CONFIG_CAN=m +CONFIG_CAN_RAW=m +CONFIG_CAN_BCM=m +CONFIG_CAN_GW=m +CONFIG_CAN_J1939=m +# CONFIG_CAN_ISOTP is not set +CONFIG_BT=m +CONFIG_BT_BREDR=y +CONFIG_BT_RFCOMM=m +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=m +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=m +CONFIG_BT_LE=y +CONFIG_BT_LE_L2CAP_ECRED=y +CONFIG_BT_6LOWPAN=m +CONFIG_BT_LEDS=y +# CONFIG_BT_MSFTEXT is not set +CONFIG_BT_AOSPEXT=y +# CONFIG_BT_DEBUGFS is not set +# CONFIG_BT_SELFTEST is not set + +# +# Bluetooth device drivers +# +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_QCA=m +CONFIG_BT_MTK=m +CONFIG_BT_HCIBTUSB=m +# CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set +CONFIG_BT_HCIBTUSB_POLL_SYNC=y +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_MTK=y +CONFIG_BT_HCIBTUSB_RTL=y +CONFIG_BT_HCIBTSDIO=m +CONFIG_BT_HCIUART=m +CONFIG_BT_HCIUART_SERDEV=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_NOKIA=m +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_ATH3K=y +CONFIG_BT_HCIUART_LL=y +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIUART_INTEL=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HCIUART_RTL=y +CONFIG_BT_HCIUART_QCA=y +CONFIG_BT_HCIUART_AG6XX=y +CONFIG_BT_HCIUART_MRVL=y +CONFIG_BT_HCIBCM203X=m +# CONFIG_BT_HCIBCM4377 is not set +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m +CONFIG_BT_HCIVHCI=m +CONFIG_BT_MRVL=m +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +CONFIG_BT_MTKSDIO=m +CONFIG_BT_MTKUART=m +CONFIG_BT_HCIRSI=m +CONFIG_BT_VIRTIO=m +# CONFIG_BT_NXPUART is not set +# CONFIG_BT_INTEL_PCIE is not set +# end of Bluetooth device drivers + +CONFIG_AF_RXRPC=m +# CONFIG_AF_RXRPC_IPV6 is not set +# CONFIG_AF_RXRPC_INJECT_LOSS is not set +# CONFIG_AF_RXRPC_INJECT_RX_DELAY is not set +# CONFIG_AF_RXRPC_DEBUG is not set +# CONFIG_RXKAD is not set +# CONFIG_RXPERF is not set +# CONFIG_AF_KCM is not set +CONFIG_STREAM_PARSER=y +# CONFIG_MCTP is not set +CONFIG_FIB_RULES=y +CONFIG_WIRELESS=y +CONFIG_WIRELESS_EXT=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_WEXT_SPY=y +CONFIG_WEXT_PRIV=y +CONFIG_CFG80211=m +# CONFIG_NL80211_TESTMODE is not set +# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set +# CONFIG_CFG80211_CERTIFICATION_ONUS is not set +CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y +CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y +CONFIG_CFG80211_DEFAULT_PS=y +# CONFIG_CFG80211_DEBUGFS is not set +CONFIG_CFG80211_CRDA_SUPPORT=y +CONFIG_CFG80211_WEXT=y +CONFIG_CFG80211_WEXT_EXPORT=y +# CONFIG_CFG80211_KUNIT_TEST is not set +CONFIG_LIB80211=m +CONFIG_LIB80211_CRYPT_WEP=m +CONFIG_LIB80211_CRYPT_CCMP=m +CONFIG_LIB80211_CRYPT_TKIP=m +# CONFIG_LIB80211_DEBUG is not set +CONFIG_MAC80211=m +CONFIG_MAC80211_HAS_RC=y +CONFIG_MAC80211_RC_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y +CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" +# CONFIG_MAC80211_KUNIT_TEST is not set +CONFIG_MAC80211_MESH=y +CONFIG_MAC80211_LEDS=y +# CONFIG_MAC80211_MESSAGE_TRACING is not set +# CONFIG_MAC80211_DEBUG_MENU is not set +CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 +CONFIG_RFKILL=m +CONFIG_RFKILL_LEDS=y +CONFIG_RFKILL_INPUT=y +CONFIG_RFKILL_GPIO=m +CONFIG_NET_9P=m +CONFIG_NET_9P_FD=m +CONFIG_NET_9P_VIRTIO=m +CONFIG_NET_9P_XEN=m +# CONFIG_NET_9P_DEBUG is not set +CONFIG_CAIF=m +# CONFIG_CAIF_DEBUG is not set +CONFIG_CAIF_NETDEV=m +CONFIG_CAIF_USB=m +CONFIG_CEPH_LIB=m +# CONFIG_CEPH_LIB_PRETTYDEBUG is not set +CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y +CONFIG_NFC=m +CONFIG_NFC_DIGITAL=m +CONFIG_NFC_NCI=m +CONFIG_NFC_NCI_SPI=m +CONFIG_NFC_NCI_UART=m +CONFIG_NFC_HCI=m +CONFIG_NFC_SHDLC=y + +# +# Near Field Communication (NFC) devices +# +CONFIG_NFC_TRF7970A=m +CONFIG_NFC_SIM=m +CONFIG_NFC_PORT100=m +CONFIG_NFC_VIRTUAL_NCI=m +CONFIG_NFC_FDP=m +CONFIG_NFC_FDP_I2C=m +CONFIG_NFC_PN544=m +CONFIG_NFC_PN544_I2C=m +CONFIG_NFC_PN533=m +CONFIG_NFC_PN533_USB=m +CONFIG_NFC_PN533_I2C=m +CONFIG_NFC_PN532_UART=m +CONFIG_NFC_MICROREAD=m +CONFIG_NFC_MICROREAD_I2C=m +CONFIG_NFC_MRVL=m +CONFIG_NFC_MRVL_USB=m +CONFIG_NFC_MRVL_UART=m +CONFIG_NFC_MRVL_I2C=m +CONFIG_NFC_MRVL_SPI=m +CONFIG_NFC_ST21NFCA=m +CONFIG_NFC_ST21NFCA_I2C=m +CONFIG_NFC_ST_NCI=m +CONFIG_NFC_ST_NCI_I2C=m +CONFIG_NFC_ST_NCI_SPI=m +CONFIG_NFC_NXP_NCI=m +CONFIG_NFC_NXP_NCI_I2C=m +CONFIG_NFC_S3FWRN5=m +CONFIG_NFC_S3FWRN5_I2C=m +CONFIG_NFC_S3FWRN82_UART=m +CONFIG_NFC_ST95HF=m +# end of Near Field Communication (NFC) devices + +CONFIG_PSAMPLE=m +CONFIG_NET_IFE=m +CONFIG_LWTUNNEL=y +CONFIG_LWTUNNEL_BPF=y +CONFIG_DST_CACHE=y +CONFIG_GRO_CELLS=y +CONFIG_SOCK_VALIDATE_XMIT=y +CONFIG_NET_IEEE8021Q_HELPERS=y +CONFIG_NET_SELFTESTS=y +CONFIG_NET_SOCK_MSG=y +CONFIG_NET_DEVLINK=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_POOL_STATS=y +CONFIG_FAILOVER=y +CONFIG_ETHTOOL_NETLINK=y +# CONFIG_NETDEV_ADDR_LIST_TEST is not set +# CONFIG_NET_TEST is not set + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y +CONFIG_HAVE_PCI=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_SYSCALL=y +CONFIG_PCIEPORTBUS=y +CONFIG_HOTPLUG_PCI_PCIE=y +CONFIG_PCIEAER=y +CONFIG_PCIEAER_INJECT=m +CONFIG_PCIEAER_CXL=y +CONFIG_PCIE_ECRC=y +CONFIG_PCIEASPM=y +CONFIG_PCIEASPM_DEFAULT=y +# CONFIG_PCIEASPM_POWERSAVE is not set +# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set +# CONFIG_PCIEASPM_PERFORMANCE is not set +CONFIG_PCIE_PME=y +# CONFIG_PCIE_DPC is not set +# CONFIG_PCIE_PTM is not set +CONFIG_PCI_MSI=y +CONFIG_PCI_QUIRKS=y +# CONFIG_PCI_DEBUG is not set +# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set +CONFIG_PCI_STUB=y +# CONFIG_PCI_PF_STUB is not set +CONFIG_PCI_ATS=y +CONFIG_PCI_DOE=y +CONFIG_PCI_ECAM=y +CONFIG_PCI_IOV=y +CONFIG_PCI_PRI=y +CONFIG_PCI_PASID=y +CONFIG_PCI_LABEL=y +# CONFIG_PCI_DYNAMIC_OF_NODES is not set +# CONFIG_PCIE_BUS_TUNE_OFF is not set +CONFIG_PCIE_BUS_DEFAULT=y +# CONFIG_PCIE_BUS_SAFE is not set +# CONFIG_PCIE_BUS_PERFORMANCE is not set +# CONFIG_PCIE_BUS_PEER2PEER is not set +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +CONFIG_HOTPLUG_PCI=y +CONFIG_HOTPLUG_PCI_ACPI=y +# CONFIG_HOTPLUG_PCI_ACPI_AMPERE_ALTRA is not set +# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set +# CONFIG_HOTPLUG_PCI_CPCI is not set +# CONFIG_HOTPLUG_PCI_SHPC is not set + +# +# PCI controller drivers +# +CONFIG_PCIE_ALTERA=y +CONFIG_PCIE_ALTERA_MSI=y +CONFIG_PCI_HOST_THUNDER_PEM=y +CONFIG_PCI_HOST_THUNDER_ECAM=y +# CONFIG_PCI_FTPCI100 is not set +CONFIG_PCI_HOST_COMMON=y +CONFIG_PCI_HOST_GENERIC=y +# CONFIG_PCIE_HISI_ERR is not set +CONFIG_PCIE_ROCKCHIP=y +CONFIG_PCIE_ROCKCHIP_HOST=y +CONFIG_PCIE_ROCKCHIP_EP=y +CONFIG_PCI_XGENE=y +CONFIG_PCI_XGENE_MSI=y +# CONFIG_PCIE_XILINX is not set + +# +# Cadence-based PCIe controllers +# +# CONFIG_PCIE_CADENCE_PLAT_HOST is not set +# CONFIG_PCIE_CADENCE_PLAT_EP is not set +# end of Cadence-based PCIe controllers + +# +# DesignWare-based PCIe controllers +# +CONFIG_PCIE_DW=y +CONFIG_PCIE_DW_HOST=y +CONFIG_PCIE_DW_EP=y +# CONFIG_PCIE_AL is not set +# CONFIG_PCI_MESON is not set +CONFIG_PCI_HISI=y +# CONFIG_PCIE_KIRIN is not set +CONFIG_PCIE_DW_PLAT=y +CONFIG_PCIE_DW_PLAT_HOST=y +CONFIG_PCIE_DW_PLAT_EP=y +CONFIG_PCIE_ROCKCHIP_DW=y +CONFIG_PCIE_ROCKCHIP_DW_HOST=y +# CONFIG_PCIE_ROCKCHIP_DW_EP is not set +# end of DesignWare-based PCIe controllers + +# +# Mobiveil-based PCIe controllers +# +# end of Mobiveil-based PCIe controllers + +# +# PLDA-based PCIe controllers +# +# CONFIG_PCIE_MICROCHIP_HOST is not set +# end of PLDA-based PCIe controllers +# end of PCI controller drivers + +# +# PCI Endpoint +# +CONFIG_PCI_ENDPOINT=y +CONFIG_PCI_ENDPOINT_CONFIGFS=y +CONFIG_PCI_EPF_TEST=m +CONFIG_PCI_EPF_NTB=m +# end of PCI Endpoint + +# +# PCI switch controller drivers +# +# CONFIG_PCI_SW_SWITCHTEC is not set +# end of PCI switch controller drivers + +CONFIG_CXL_BUS=m +CONFIG_CXL_PCI=m +# CONFIG_CXL_MEM_RAW_COMMANDS is not set +CONFIG_CXL_ACPI=m +CONFIG_CXL_MEM=m +CONFIG_CXL_PORT=m +CONFIG_CXL_SUSPEND=y +CONFIG_CXL_REGION=y +# CONFIG_CXL_REGION_INVALIDATION_TEST is not set +# CONFIG_PCCARD is not set +# CONFIG_RAPIDIO is not set + +# +# Generic Driver Options +# +CONFIG_AUXILIARY_BUS=y +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_DEVTMPFS_SAFE is not set +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y + +# +# Firmware loader +# +CONFIG_FW_LOADER=y +CONFIG_FW_LOADER_DEBUG=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER is not set +# CONFIG_FW_LOADER_COMPRESS is not set +CONFIG_FW_CACHE=y +CONFIG_FW_UPLOAD=y +# end of Firmware loader + +CONFIG_WANT_DEV_COREDUMP=y +CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set +CONFIG_HMEM_REPORTING=y +# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set +# CONFIG_DM_KUNIT_TEST is not set +# CONFIG_DRIVER_PE_KUNIT_TEST is not set +CONFIG_SYS_HYPERVISOR=y +CONFIG_GENERIC_CPU_DEVICES=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_SOC_BUS=y +CONFIG_REGMAP=y +# CONFIG_REGMAP_KUNIT is not set +# CONFIG_REGMAP_BUILD is not set +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_SLIMBUS=m +CONFIG_REGMAP_SPI=m +CONFIG_REGMAP_SPMI=m +CONFIG_REGMAP_W1=m +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y +CONFIG_REGMAP_SOUNDWIRE=m +CONFIG_REGMAP_SOUNDWIRE_MBQ=m +CONFIG_REGMAP_SCCB=m +CONFIG_DMA_SHARED_BUFFER=y +# CONFIG_DMA_FENCE_TRACE is not set +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_ARCH_NUMA=y +# CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT is not set +# end of Generic Driver Options + +# +# Bus devices +# +CONFIG_ARM_CCI=y +CONFIG_ARM_CCI400_COMMON=y +# CONFIG_MOXTET is not set +CONFIG_VEXPRESS_CONFIG=y +CONFIG_MHI_BUS=m +# CONFIG_MHI_BUS_DEBUG is not set +CONFIG_MHI_BUS_PCI_GENERIC=m +# CONFIG_MHI_BUS_EP is not set +# end of Bus devices + +# +# Cache Drivers +# +# end of Cache Drivers + +CONFIG_CONNECTOR=m + +# +# Firmware Drivers +# + +# +# ARM System Control and Management Interface Protocol +# +CONFIG_ARM_SCMI_PROTOCOL=y +# CONFIG_ARM_SCMI_RAW_MODE_SUPPORT is not set +CONFIG_ARM_SCMI_HAVE_TRANSPORT=y +CONFIG_ARM_SCMI_HAVE_SHMEM=y +CONFIG_ARM_SCMI_HAVE_MSG=y +CONFIG_ARM_SCMI_TRANSPORT_MAILBOX=y +CONFIG_ARM_SCMI_TRANSPORT_OPTEE=y +CONFIG_ARM_SCMI_TRANSPORT_SMC=y +# CONFIG_ARM_SCMI_TRANSPORT_SMC_ATOMIC_ENABLE is not set +CONFIG_ARM_SCMI_TRANSPORT_VIRTIO=y +CONFIG_ARM_SCMI_TRANSPORT_VIRTIO_VERSION1_COMPLIANCE=y +# CONFIG_ARM_SCMI_TRANSPORT_VIRTIO_ATOMIC_ENABLE is not set +CONFIG_ARM_SCMI_POWER_CONTROL=m +# end of ARM System Control and Management Interface Protocol + +CONFIG_ARM_SCPI_PROTOCOL=y +CONFIG_ARM_SDE_INTERFACE=y +# CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_DMIID=y +CONFIG_DMI_SYSFS=y +CONFIG_ISCSI_IBFT=y +# CONFIG_FW_CFG_SYSFS is not set +CONFIG_SYSFB=y +CONFIG_SYSFB_SIMPLEFB=y +CONFIG_ARM_FFA_TRANSPORT=m +CONFIG_ARM_FFA_SMCCC=y +CONFIG_FW_CS_DSP=m +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# EFI (Extensible Firmware Interface) Support +# +CONFIG_EFI_ESRT=y +CONFIG_EFI_VARS_PSTORE=y +CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=y +CONFIG_EFI_SOFT_RESERVE=y +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_GENERIC_STUB=y +# CONFIG_EFI_ZBOOT is not set +CONFIG_EFI_ARMSTUB_DTB_LOADER=y +CONFIG_EFI_BOOTLOADER_CONTROL=m +CONFIG_EFI_CAPSULE_LOADER=m +CONFIG_EFI_TEST=m +CONFIG_RESET_ATTACK_MITIGATION=y +CONFIG_EFI_DISABLE_PCI_DMA=y +CONFIG_EFI_EARLYCON=y +CONFIG_EFI_CUSTOM_SSDT_OVERLAYS=y +# CONFIG_EFI_DISABLE_RUNTIME is not set +# CONFIG_EFI_COCO_SECRET is not set +# end of EFI (Extensible Firmware Interface) Support + +CONFIG_UEFI_CPER=y +CONFIG_UEFI_CPER_ARM=y +# CONFIG_TEE_STMM_EFI is not set +CONFIG_ARM_PSCI_FW=y +CONFIG_ARM_PSCI_CHECKER=y + +# +# Qualcomm firmware drivers +# +# end of Qualcomm firmware drivers + +CONFIG_HAVE_ARM_SMCCC=y +CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y +CONFIG_ARM_SMCCC_SOC_ID=y + +# +# Tegra firmware driver +# +# end of Tegra firmware driver +# end of Firmware Drivers + +CONFIG_GNSS=m +CONFIG_GNSS_SERIAL=m +CONFIG_GNSS_MTK_SERIAL=m +CONFIG_GNSS_SIRF_SERIAL=m +CONFIG_GNSS_UBX_SERIAL=m +# CONFIG_GNSS_USB is not set +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set + +# +# Partition parsers +# +CONFIG_MTD_CMDLINE_PARTS=m +CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_AFS_PARTS=m +# CONFIG_MTD_REDBOOT_PARTS is not set +# end of Partition parsers + +# +# User Modules And Translation Layers +# +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y + +# +# Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK. +# +CONFIG_FTL=m +CONFIG_NFTL=m +CONFIG_NFTL_RW=y +CONFIG_INFTL=m +CONFIG_RFD_FTL=m +CONFIG_SSFDC=m +CONFIG_SM_FTL=m +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_PSTORE is not set +CONFIG_MTD_SWAP=m +# CONFIG_MTD_PARTITIONED_MASTER is not set + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_GEN_PROBE=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +CONFIG_MTD_CFI_NOSWAP=y +# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set +# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set +# CONFIG_MTD_CFI_GEOMETRY is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_OTP is not set +CONFIG_MTD_CFI_INTELEXT=m +CONFIG_MTD_CFI_AMDSTD=m +CONFIG_MTD_CFI_STAA=m +CONFIG_MTD_CFI_UTIL=y +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set +# end of RAM/ROM/Flash chip drivers + +# +# Mapping drivers for chip access +# +CONFIG_MTD_COMPLEX_MAPPINGS=y +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_PHYSMAP_COMPAT is not set +CONFIG_MTD_PHYSMAP_OF=y +# CONFIG_MTD_PHYSMAP_VERSATILE is not set +# CONFIG_MTD_PHYSMAP_GEMINI is not set +CONFIG_MTD_PHYSMAP_GPIO_ADDR=y +CONFIG_MTD_PCI=m +# CONFIG_MTD_PLATRAM is not set +# end of Mapping drivers for chip access + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_PMC551 is not set +CONFIG_MTD_DATAFLASH=y +# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set +# CONFIG_MTD_DATAFLASH_OTP is not set +# CONFIG_MTD_MCHP23K256 is not set +CONFIG_MTD_MCHP48L640=m +CONFIG_MTD_SST25L=y +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +# end of Self-contained MTD device drivers + +# +# NAND +# +CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_ONENAND=m +# CONFIG_MTD_ONENAND_VERIFY_WRITE is not set +# CONFIG_MTD_ONENAND_GENERIC is not set +# CONFIG_MTD_ONENAND_OTP is not set +# CONFIG_MTD_ONENAND_2X_PROGRAM is not set +CONFIG_MTD_RAW_NAND=y + +# +# Raw/parallel NAND flash controllers +# +CONFIG_MTD_NAND_DENALI=y +# CONFIG_MTD_NAND_DENALI_PCI is not set +CONFIG_MTD_NAND_DENALI_DT=y +# CONFIG_MTD_NAND_CAFE is not set +# CONFIG_MTD_NAND_BRCMNAND is not set +# CONFIG_MTD_NAND_MXIC is not set +# CONFIG_MTD_NAND_GPIO is not set +# CONFIG_MTD_NAND_PLATFORM is not set +# CONFIG_MTD_NAND_CADENCE is not set +# CONFIG_MTD_NAND_ARASAN is not set +# CONFIG_MTD_NAND_INTEL_LGM is not set +CONFIG_MTD_NAND_ROCKCHIP=m + +# +# Misc +# +# CONFIG_MTD_NAND_NANDSIM is not set +# CONFIG_MTD_NAND_RICOH is not set +# CONFIG_MTD_NAND_DISKONCHIP is not set +CONFIG_MTD_SPI_NAND=m + +# +# ECC engine support +# +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_ECC_SW_HAMMING=y +# CONFIG_MTD_NAND_ECC_SW_HAMMING_SMC is not set +# CONFIG_MTD_NAND_ECC_SW_BCH is not set +CONFIG_MTD_NAND_ECC_MXIC=y +# end of ECC engine support +# end of NAND + +# +# LPDDR & LPDDR2 PCM memory drivers +# +# CONFIG_MTD_LPDDR is not set +# end of LPDDR & LPDDR2 PCM memory drivers + +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +# CONFIG_MTD_SPI_NOR_SWP_DISABLE is not set +CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE=y +# CONFIG_MTD_SPI_NOR_SWP_KEEP is not set +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +# CONFIG_MTD_UBI_BLOCK is not set +# CONFIG_MTD_UBI_NVMEM is not set +CONFIG_MTD_HYPERBUS=m +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +# CONFIG_OF_KUNIT_TEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_KOBJ=y +CONFIG_OF_DYNAMIC=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_RESERVED_MEM=y +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y +CONFIG_OF_NUMA=y +# CONFIG_PARPORT is not set +CONFIG_PNP=y +CONFIG_PNP_DEBUG_MESSAGES=y + +# +# Protocols +# +CONFIG_PNPACPI=y +CONFIG_BLK_DEV=y +CONFIG_BLK_DEV_NULL_BLK=m +CONFIG_CDROM=y +# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set +CONFIG_ZRAM=m +CONFIG_ZRAM_DEF_COMP_LZORLE=y +# CONFIG_ZRAM_DEF_COMP_ZSTD is not set +# CONFIG_ZRAM_DEF_COMP_LZ4 is not set +# CONFIG_ZRAM_DEF_COMP_LZO is not set +# CONFIG_ZRAM_DEF_COMP_LZ4HC is not set +# CONFIG_ZRAM_DEF_COMP_842 is not set +CONFIG_ZRAM_DEF_COMP="lzo-rle" +CONFIG_ZRAM_WRITEBACK=y +# CONFIG_ZRAM_TRACK_ENTRY_ACTIME is not set +# CONFIG_ZRAM_MEMORY_TRACKING is not set +# CONFIG_ZRAM_MULTI_COMP is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +CONFIG_BLK_DEV_DRBD=m +# CONFIG_DRBD_FAULT_INJECTION is not set +CONFIG_BLK_DEV_NBD=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_CDROM_PKTCDVD is not set +CONFIG_ATA_OVER_ETH=m +CONFIG_XEN_BLKDEV_FRONTEND=m +CONFIG_XEN_BLKDEV_BACKEND=m +CONFIG_VIRTIO_BLK=y +CONFIG_BLK_DEV_RBD=m +CONFIG_BLK_DEV_UBLK=m +CONFIG_BLKDEV_UBLK_LEGACY_OPCODES=y + +# +# NVME Support +# +CONFIG_NVME_KEYRING=m +CONFIG_NVME_AUTH=y +CONFIG_NVME_CORE=y +CONFIG_BLK_DEV_NVME=y +CONFIG_NVME_MULTIPATH=y +# CONFIG_NVME_VERBOSE_ERRORS is not set +CONFIG_NVME_HWMON=y +CONFIG_NVME_FABRICS=m +CONFIG_NVME_FC=m +CONFIG_NVME_TCP=m +CONFIG_NVME_TCP_TLS=y +CONFIG_NVME_HOST_AUTH=y +CONFIG_NVME_TARGET=m +# CONFIG_NVME_TARGET_DEBUGFS is not set +CONFIG_NVME_TARGET_PASSTHRU=y +CONFIG_NVME_TARGET_LOOP=m +CONFIG_NVME_TARGET_FC=m +CONFIG_NVME_TARGET_FCLOOP=m +CONFIG_NVME_TARGET_TCP=m +CONFIG_NVME_TARGET_TCP_TLS=y +CONFIG_NVME_TARGET_AUTH=y +# end of NVME Support + +# +# Misc devices +# +CONFIG_AD525X_DPOT=m +CONFIG_AD525X_DPOT_I2C=m +CONFIG_AD525X_DPOT_SPI=m +# CONFIG_DUMMY_IRQ is not set +CONFIG_PHANTOM=m +CONFIG_TIFM_CORE=m +CONFIG_TIFM_7XX1=m +# CONFIG_ICS932S401 is not set +CONFIG_ENCLOSURE_SERVICES=m +CONFIG_HI6421V600_IRQ=m +# CONFIG_HP_ILO is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_LATTICE_ECP3_CONFIG is not set +CONFIG_SRAM=y +CONFIG_DW_XDATA_PCIE=m +# CONFIG_PCI_ENDPOINT_TEST is not set +CONFIG_XILINX_SDFEC=m +CONFIG_MISC_RTSX=m +# CONFIG_HISI_HIKEY_USB is not set +# CONFIG_OPEN_DICE is not set +CONFIG_VCPU_STALL_DETECTOR=m +# CONFIG_NSM is not set +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +CONFIG_EEPROM_AT24=m +CONFIG_EEPROM_AT25=m +CONFIG_EEPROM_MAX6875=m +CONFIG_EEPROM_93CX6=m +# CONFIG_EEPROM_93XX46 is not set +# CONFIG_EEPROM_IDT_89HPESX is not set +CONFIG_EEPROM_EE1004=m +# end of EEPROM support + +CONFIG_CB710_CORE=m +# CONFIG_CB710_DEBUG is not set +CONFIG_CB710_DEBUG_ASSUMPTIONS=y + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# end of Texas Instruments shared transport line discipline + +# CONFIG_SENSORS_LIS3_I2C is not set +CONFIG_ALTERA_STAPL=m +# CONFIG_VMWARE_VMCI is not set +CONFIG_GENWQE=m +CONFIG_GENWQE_PLATFORM_ERROR_RECOVERY=0 +CONFIG_ECHO=m +CONFIG_BCM_VK=m +# CONFIG_BCM_VK_TTY is not set +CONFIG_MISC_ALCOR_PCI=m +CONFIG_MISC_RTSX_PCI=m +CONFIG_MISC_RTSX_USB=m +CONFIG_UACCE=m +# CONFIG_PVPANIC is not set +CONFIG_GP_PCI1XXXX=m +# CONFIG_KEBA_CP500 is not set +# end of Misc devices + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +CONFIG_RAID_ATTRS=m +CONFIG_SCSI_COMMON=y +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +CONFIG_SCSI_NETLINK=y +CONFIG_SCSI_PROC_FS=y +# CONFIG_SCSI_LIB_KUNIT_TEST is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_ST=m +CONFIG_BLK_DEV_SR=y +CONFIG_CHR_DEV_SG=y +CONFIG_BLK_DEV_BSG=y +CONFIG_CHR_DEV_SCH=m +CONFIG_SCSI_ENCLOSURE=m +CONFIG_SCSI_CONSTANTS=y +CONFIG_SCSI_LOGGING=y +CONFIG_SCSI_SCAN_ASYNC=y +# CONFIG_SCSI_PROTO_TEST is not set + +# +# SCSI Transports +# +CONFIG_SCSI_SPI_ATTRS=m +CONFIG_SCSI_FC_ATTRS=m +CONFIG_SCSI_ISCSI_ATTRS=m +CONFIG_SCSI_SAS_ATTRS=y +CONFIG_SCSI_SAS_LIBSAS=m +CONFIG_SCSI_SAS_ATA=y +CONFIG_SCSI_SAS_HOST_SMP=y +CONFIG_SCSI_SRP_ATTRS=m +# end of SCSI Transports + +CONFIG_SCSI_LOWLEVEL=y +CONFIG_ISCSI_TCP=m +CONFIG_ISCSI_BOOT_SYSFS=y +# CONFIG_SCSI_CXGB3_ISCSI is not set +# CONFIG_SCSI_CXGB4_ISCSI is not set +CONFIG_SCSI_BNX2_ISCSI=m +CONFIG_SCSI_BNX2X_FCOE=m +CONFIG_BE2ISCSI=m +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +CONFIG_SCSI_HPSA=m +# CONFIG_SCSI_3W_9XXX is not set +# CONFIG_SCSI_3W_SAS is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_AACRAID is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_AIC79XX is not set +# CONFIG_SCSI_AIC94XX is not set +# CONFIG_SCSI_HISI_SAS is not set +CONFIG_SCSI_MVSAS=m +# CONFIG_SCSI_MVSAS_DEBUG is not set +CONFIG_SCSI_MVSAS_TASKLET=y +CONFIG_SCSI_MVUMI=m +# CONFIG_SCSI_ADVANSYS is not set +CONFIG_SCSI_ARCMSR=m +CONFIG_SCSI_ESAS2R=m +CONFIG_MEGARAID_NEWGEN=y +CONFIG_MEGARAID_MM=m +CONFIG_MEGARAID_MAILBOX=m +CONFIG_MEGARAID_LEGACY=m +CONFIG_MEGARAID_SAS=m +CONFIG_SCSI_MPT3SAS=m +CONFIG_SCSI_MPT2SAS_MAX_SGE=128 +CONFIG_SCSI_MPT3SAS_MAX_SGE=128 +# CONFIG_SCSI_MPT2SAS is not set +CONFIG_SCSI_MPI3MR=m +# CONFIG_SCSI_SMARTPQI is not set +# CONFIG_SCSI_HPTIOP is not set +CONFIG_SCSI_BUSLOGIC=m +CONFIG_SCSI_FLASHPOINT=y +# CONFIG_SCSI_MYRB is not set +# CONFIG_SCSI_MYRS is not set +# CONFIG_XEN_SCSI_FRONTEND is not set +CONFIG_LIBFC=m +CONFIG_LIBFCOE=m +CONFIG_FCOE=m +CONFIG_SCSI_SNIC=m +# CONFIG_SCSI_SNIC_DEBUG_FS is not set +CONFIG_SCSI_DMX3191D=m +# CONFIG_SCSI_FDOMAIN_PCI is not set +# CONFIG_SCSI_IPS is not set +CONFIG_SCSI_INITIO=m +CONFIG_SCSI_INIA100=m +CONFIG_SCSI_STEX=m +CONFIG_SCSI_SYM53C8XX_2=m +CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 +CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 +CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 +CONFIG_SCSI_SYM53C8XX_MMIO=y +CONFIG_SCSI_IPR=m +CONFIG_SCSI_IPR_TRACE=y +CONFIG_SCSI_IPR_DUMP=y +CONFIG_SCSI_QLOGIC_1280=m +CONFIG_SCSI_QLA_FC=m +CONFIG_TCM_QLA2XXX=m +# CONFIG_TCM_QLA2XXX_DEBUG is not set +CONFIG_SCSI_QLA_ISCSI=m +# CONFIG_SCSI_LPFC is not set +# CONFIG_SCSI_EFCT is not set +CONFIG_SCSI_DC395x=m +CONFIG_SCSI_AM53C974=m +CONFIG_SCSI_WD719X=m +CONFIG_SCSI_DEBUG=m +CONFIG_SCSI_PMCRAID=m +# CONFIG_SCSI_PM8001 is not set +# CONFIG_SCSI_BFA_FC is not set +CONFIG_SCSI_VIRTIO=y +CONFIG_SCSI_CHELSIO_FCOE=m +CONFIG_SCSI_DH=y +CONFIG_SCSI_DH_RDAC=m +CONFIG_SCSI_DH_HP_SW=m +CONFIG_SCSI_DH_EMC=m +CONFIG_SCSI_DH_ALUA=m +# end of SCSI device support + +CONFIG_ATA=y +CONFIG_SATA_HOST=y +CONFIG_PATA_TIMINGS=y +CONFIG_ATA_VERBOSE_ERROR=y +CONFIG_ATA_FORCE=y +CONFIG_ATA_ACPI=y +# CONFIG_SATA_ZPODD is not set +CONFIG_SATA_PMP=y + +# +# Controllers with non-SFF native interface +# +CONFIG_SATA_AHCI=y +CONFIG_SATA_MOBILE_LPM_POLICY=0 +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_AHCI_DWC=y +CONFIG_AHCI_CEVA=y +CONFIG_SATA_INIC162X=m +CONFIG_SATA_ACARD_AHCI=m +CONFIG_SATA_SIL24=y +CONFIG_ATA_SFF=y + +# +# SFF controllers with custom DMA interface +# +CONFIG_PDC_ADMA=m +CONFIG_SATA_QSTOR=m +CONFIG_SATA_SX4=m +CONFIG_ATA_BMDMA=y + +# +# SATA SFF controllers with BMDMA +# +CONFIG_ATA_PIIX=y +# CONFIG_SATA_DWC is not set +CONFIG_SATA_MV=m +CONFIG_SATA_NV=m +CONFIG_SATA_PROMISE=m +CONFIG_SATA_SIL=m +CONFIG_SATA_SIS=m +CONFIG_SATA_SVW=m +CONFIG_SATA_ULI=m +CONFIG_SATA_VIA=m +CONFIG_SATA_VITESSE=m + +# +# PATA SFF controllers with BMDMA +# +CONFIG_PATA_ALI=m +CONFIG_PATA_AMD=m +CONFIG_PATA_ARTOP=m +CONFIG_PATA_ATIIXP=m +CONFIG_PATA_ATP867X=m +CONFIG_PATA_CMD64X=m +CONFIG_PATA_CYPRESS=m +CONFIG_PATA_EFAR=m +CONFIG_PATA_HPT366=m +CONFIG_PATA_HPT37X=m +CONFIG_PATA_HPT3X2N=m +CONFIG_PATA_HPT3X3=m +# CONFIG_PATA_HPT3X3_DMA is not set +CONFIG_PATA_IT8213=m +CONFIG_PATA_IT821X=m +CONFIG_PATA_JMICRON=m +CONFIG_PATA_MARVELL=m +CONFIG_PATA_NETCELL=m +CONFIG_PATA_NINJA32=m +CONFIG_PATA_NS87415=m +CONFIG_PATA_OLDPIIX=m +CONFIG_PATA_OPTIDMA=m +CONFIG_PATA_PDC2027X=m +CONFIG_PATA_PDC_OLD=m +# CONFIG_PATA_RADISYS is not set +CONFIG_PATA_RDC=m +CONFIG_PATA_SCH=m +CONFIG_PATA_SERVERWORKS=m +CONFIG_PATA_SIL680=m +CONFIG_PATA_SIS=m +CONFIG_PATA_TOSHIBA=m +CONFIG_PATA_TRIFLEX=m +CONFIG_PATA_VIA=m +CONFIG_PATA_WINBOND=m + +# +# PIO-only SFF controllers +# +CONFIG_PATA_CMD640_PCI=m +CONFIG_PATA_MPIIX=m +CONFIG_PATA_NS87410=m +CONFIG_PATA_OPTI=m +CONFIG_PATA_PLATFORM=y +CONFIG_PATA_OF_PLATFORM=y +# CONFIG_PATA_RZ1000 is not set + +# +# Generic fallback / legacy drivers +# +CONFIG_PATA_ACPI=m +CONFIG_ATA_GENERIC=y +# CONFIG_PATA_LEGACY is not set +CONFIG_MD=y +CONFIG_BLK_DEV_MD=y +CONFIG_MD_AUTODETECT=y +CONFIG_MD_BITMAP_FILE=y +CONFIG_MD_RAID0=m +CONFIG_MD_RAID1=m +CONFIG_MD_RAID10=m +CONFIG_MD_RAID456=m +CONFIG_MD_CLUSTER=m +CONFIG_BCACHE=m +# CONFIG_BCACHE_DEBUG is not set +# CONFIG_BCACHE_ASYNC_REGISTRATION is not set +CONFIG_BLK_DEV_DM_BUILTIN=y +CONFIG_BLK_DEV_DM=m +# CONFIG_DM_DEBUG is not set +CONFIG_DM_BUFIO=m +# CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING is not set +CONFIG_DM_BIO_PRISON=m +CONFIG_DM_PERSISTENT_DATA=m +CONFIG_DM_UNSTRIPED=m +CONFIG_DM_CRYPT=m +CONFIG_DM_SNAPSHOT=m +CONFIG_DM_THIN_PROVISIONING=m +CONFIG_DM_CACHE=m +CONFIG_DM_CACHE_SMQ=m +CONFIG_DM_WRITECACHE=m +# CONFIG_DM_EBS is not set +CONFIG_DM_ERA=m +CONFIG_DM_CLONE=m +CONFIG_DM_MIRROR=m +CONFIG_DM_LOG_USERSPACE=m +CONFIG_DM_RAID=m +CONFIG_DM_ZERO=m +CONFIG_DM_MULTIPATH=m +CONFIG_DM_MULTIPATH_QL=m +CONFIG_DM_MULTIPATH_ST=m +# CONFIG_DM_MULTIPATH_HST is not set +CONFIG_DM_MULTIPATH_IOA=m +CONFIG_DM_DELAY=m +CONFIG_DM_DUST=m +CONFIG_DM_UEVENT=y +CONFIG_DM_FLAKEY=m +CONFIG_DM_VERITY=m +# CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG is not set +CONFIG_DM_VERITY_FEC=y +CONFIG_DM_SWITCH=m +CONFIG_DM_LOG_WRITES=m +CONFIG_DM_INTEGRITY=m +CONFIG_DM_ZONED=m +CONFIG_DM_AUDIT=y +# CONFIG_DM_VDO is not set +CONFIG_TARGET_CORE=m +CONFIG_TCM_IBLOCK=m +CONFIG_TCM_FILEIO=m +CONFIG_TCM_PSCSI=m +CONFIG_TCM_USER2=m +CONFIG_LOOPBACK_TARGET=m +CONFIG_TCM_FC=m +CONFIG_ISCSI_TARGET=m +# CONFIG_REMOTE_TARGET is not set +CONFIG_FUSION=y +CONFIG_FUSION_SPI=m +CONFIG_FUSION_FC=m +CONFIG_FUSION_SAS=m +CONFIG_FUSION_MAX_SGE=128 +CONFIG_FUSION_CTL=m +CONFIG_FUSION_LAN=m +# CONFIG_FUSION_LOGGING is not set + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_FIREWIRE is not set +CONFIG_FIREWIRE_NOSY=m +# end of IEEE 1394 (FireWire) support + +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +CONFIG_BONDING=m +CONFIG_DUMMY=m +CONFIG_WIREGUARD=m +# CONFIG_WIREGUARD_DEBUG is not set +CONFIG_EQUALIZER=m +CONFIG_NET_FC=y +CONFIG_IFB=m +CONFIG_NET_TEAM=m +CONFIG_NET_TEAM_MODE_BROADCAST=m +CONFIG_NET_TEAM_MODE_ROUNDROBIN=m +CONFIG_NET_TEAM_MODE_RANDOM=m +CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=m +CONFIG_NET_TEAM_MODE_LOADBALANCE=m +CONFIG_MACVLAN=m +CONFIG_MACVTAP=m +CONFIG_IPVLAN_L3S=y +CONFIG_IPVLAN=m +CONFIG_IPVTAP=m +CONFIG_VXLAN=m +CONFIG_GENEVE=m +CONFIG_BAREUDP=m +CONFIG_GTP=m +# CONFIG_PFCP is not set +CONFIG_AMT=m +CONFIG_MACSEC=m +CONFIG_NETCONSOLE=y +CONFIG_NETCONSOLE_DYNAMIC=y +# CONFIG_NETCONSOLE_EXTENDED_LOG is not set +CONFIG_NETPOLL=y +CONFIG_NET_POLL_CONTROLLER=y +CONFIG_TUN=m +CONFIG_TAP=m +CONFIG_TUN_VNET_CROSS_LE=y +CONFIG_VETH=m +CONFIG_VIRTIO_NET=m +CONFIG_NLMON=m +# CONFIG_NETKIT is not set +CONFIG_NET_VRF=m +CONFIG_MHI_NET=m +# CONFIG_ARCNET is not set +CONFIG_ATM_DRIVERS=y +CONFIG_ATM_DUMMY=m +CONFIG_ATM_TCP=m +CONFIG_ATM_LANAI=m +CONFIG_ATM_ENI=m +# CONFIG_ATM_ENI_DEBUG is not set +# CONFIG_ATM_ENI_TUNE_BURST is not set +CONFIG_ATM_NICSTAR=m +# CONFIG_ATM_NICSTAR_USE_SUNI is not set +# CONFIG_ATM_NICSTAR_USE_IDT77105 is not set +CONFIG_ATM_IDT77252=m +# CONFIG_ATM_IDT77252_DEBUG is not set +# CONFIG_ATM_IDT77252_RCV_ALL is not set +CONFIG_ATM_IDT77252_USE_SUNI=y +CONFIG_ATM_IA=m +# CONFIG_ATM_IA_DEBUG is not set +CONFIG_ATM_FORE200E=m +# CONFIG_ATM_FORE200E_USE_TASKLET is not set +CONFIG_ATM_FORE200E_TX_RETRY=16 +CONFIG_ATM_FORE200E_DEBUG=0 +CONFIG_ATM_HE=m +# CONFIG_ATM_HE_USE_SUNI is not set +CONFIG_ATM_SOLOS=m +CONFIG_CAIF_DRIVERS=y +CONFIG_CAIF_TTY=m +CONFIG_CAIF_VIRTIO=m + +# +# Distributed Switch Architecture drivers +# +CONFIG_B53=m +CONFIG_B53_SPI_DRIVER=m +CONFIG_B53_MDIO_DRIVER=m +CONFIG_B53_MMAP_DRIVER=m +CONFIG_B53_SRAB_DRIVER=m +CONFIG_B53_SERDES=m +CONFIG_NET_DSA_BCM_SF2=m +CONFIG_NET_DSA_LOOP=m +CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK=m +CONFIG_NET_DSA_LANTIQ_GSWIP=m +CONFIG_NET_DSA_MT7530=m +CONFIG_NET_DSA_MT7530_MDIO=m +CONFIG_NET_DSA_MT7530_MMIO=m +CONFIG_NET_DSA_MV88E6060=m +CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON=m +CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C=m +CONFIG_NET_DSA_MICROCHIP_KSZ_SPI=m +# CONFIG_NET_DSA_MICROCHIP_KSZ_PTP is not set +CONFIG_NET_DSA_MICROCHIP_KSZ8863_SMI=m +CONFIG_NET_DSA_MV88E6XXX=m +# CONFIG_NET_DSA_MV88E6XXX_PTP is not set +# CONFIG_NET_DSA_MSCC_OCELOT_EXT is not set +# CONFIG_NET_DSA_MSCC_SEVILLE is not set +CONFIG_NET_DSA_AR9331=m +CONFIG_NET_DSA_QCA8K=m +# CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT is not set +CONFIG_NET_DSA_SJA1105=m +# CONFIG_NET_DSA_SJA1105_PTP is not set +CONFIG_NET_DSA_XRS700X=m +CONFIG_NET_DSA_XRS700X_I2C=m +CONFIG_NET_DSA_XRS700X_MDIO=m +CONFIG_NET_DSA_REALTEK=m +# CONFIG_NET_DSA_REALTEK_MDIO is not set +# CONFIG_NET_DSA_REALTEK_SMI is not set +CONFIG_NET_DSA_SMSC_LAN9303=m +CONFIG_NET_DSA_SMSC_LAN9303_I2C=m +CONFIG_NET_DSA_SMSC_LAN9303_MDIO=m +CONFIG_NET_DSA_VITESSE_VSC73XX=m +CONFIG_NET_DSA_VITESSE_VSC73XX_SPI=m +CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM=m +# end of Distributed Switch Architecture drivers + +CONFIG_ETHERNET=y +CONFIG_MDIO=m +CONFIG_NET_VENDOR_3COM=y +# CONFIG_VORTEX is not set +# CONFIG_TYPHOON is not set +CONFIG_NET_VENDOR_ADAPTEC=y +# CONFIG_ADAPTEC_STARFIRE is not set +CONFIG_NET_VENDOR_AGERE=y +CONFIG_ET131X=m +CONFIG_NET_VENDOR_ALACRITECH=y +# CONFIG_SLICOSS is not set +CONFIG_NET_VENDOR_ALTEON=y +CONFIG_ACENIC=m +# CONFIG_ACENIC_OMIT_TIGON_I is not set +CONFIG_ALTERA_TSE=m +CONFIG_NET_VENDOR_AMAZON=y +# CONFIG_ENA_ETHERNET is not set +CONFIG_NET_VENDOR_AMD=y +CONFIG_AMD8111_ETH=m +CONFIG_PCNET32=m +CONFIG_AMD_XGBE=m +# CONFIG_AMD_XGBE_DCB is not set +# CONFIG_PDS_CORE is not set +CONFIG_NET_VENDOR_AQUANTIA=y +CONFIG_AQTION=m +CONFIG_NET_VENDOR_ARC=y +# CONFIG_EMAC_ROCKCHIP is not set +CONFIG_NET_VENDOR_ASIX=y +# CONFIG_SPI_AX88796C is not set +CONFIG_NET_VENDOR_ATHEROS=y +CONFIG_ATL2=m +CONFIG_ATL1=m +CONFIG_ATL1E=m +CONFIG_ATL1C=m +CONFIG_ALX=m +CONFIG_NET_VENDOR_BROADCOM=y +CONFIG_B44=m +CONFIG_B44_PCI_AUTOSELECT=y +CONFIG_B44_PCICORE_AUTOSELECT=y +CONFIG_B44_PCI=y +CONFIG_BCMGENET=m +CONFIG_BNX2=m +CONFIG_CNIC=m +CONFIG_TIGON3=m +CONFIG_TIGON3_HWMON=y +CONFIG_BNX2X=m +CONFIG_BNX2X_SRIOV=y +CONFIG_SYSTEMPORT=m +CONFIG_BNXT=m +CONFIG_BNXT_SRIOV=y +CONFIG_BNXT_FLOWER_OFFLOAD=y +# CONFIG_BNXT_DCB is not set +CONFIG_BNXT_HWMON=y +CONFIG_NET_VENDOR_CADENCE=y +CONFIG_MACB=y +CONFIG_MACB_USE_HWSTAMP=y +# CONFIG_MACB_PCI is not set +CONFIG_NET_VENDOR_CAVIUM=y +CONFIG_THUNDER_NIC_PF=y +# CONFIG_THUNDER_NIC_VF is not set +CONFIG_THUNDER_NIC_BGX=y +CONFIG_THUNDER_NIC_RGX=y +CONFIG_CAVIUM_PTP=y +# CONFIG_LIQUIDIO is not set +# CONFIG_LIQUIDIO_VF is not set +CONFIG_NET_VENDOR_CHELSIO=y +# CONFIG_CHELSIO_T1 is not set +# CONFIG_CHELSIO_T3 is not set +# CONFIG_CHELSIO_T4 is not set +# CONFIG_CHELSIO_T4VF is not set +CONFIG_NET_VENDOR_CISCO=y +# CONFIG_ENIC is not set +CONFIG_NET_VENDOR_CORTINA=y +# CONFIG_GEMINI_ETHERNET is not set +CONFIG_NET_VENDOR_DAVICOM=y +# CONFIG_DM9051 is not set +CONFIG_DNET=m +CONFIG_NET_VENDOR_DEC=y +# CONFIG_NET_TULIP is not set +CONFIG_NET_VENDOR_DLINK=y +CONFIG_DL2K=m +CONFIG_SUNDANCE=m +# CONFIG_SUNDANCE_MMIO is not set +CONFIG_NET_VENDOR_EMULEX=y +# CONFIG_BE2NET is not set +CONFIG_NET_VENDOR_ENGLEDER=y +# CONFIG_TSNEP is not set +CONFIG_NET_VENDOR_EZCHIP=y +# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set +CONFIG_NET_VENDOR_FUNGIBLE=y +# CONFIG_FUN_ETH is not set +CONFIG_NET_VENDOR_GOOGLE=y +# CONFIG_GVE is not set +CONFIG_NET_VENDOR_HISILICON=y +CONFIG_HIX5HD2_GMAC=y +# CONFIG_HISI_FEMAC is not set +# CONFIG_HIP04_ETH is not set +CONFIG_HNS_MDIO=y +CONFIG_HNS=y +CONFIG_HNS_DSAF=y +CONFIG_HNS_ENET=y +CONFIG_HNS3=y +CONFIG_HNS3_HCLGE=y +# CONFIG_HNS3_DCB is not set +# CONFIG_HNS3_HCLGEVF is not set +CONFIG_HNS3_ENET=y +CONFIG_NET_VENDOR_HUAWEI=y +# CONFIG_HINIC is not set +CONFIG_NET_VENDOR_I825XX=y +CONFIG_NET_VENDOR_INTEL=y +CONFIG_LIBETH=m +CONFIG_LIBIE=m +CONFIG_E100=m +CONFIG_E1000=m +CONFIG_E1000E=m +CONFIG_IGB=m +CONFIG_IGB_HWMON=y +CONFIG_IGBVF=m +CONFIG_IXGBE=m +CONFIG_IXGBE_HWMON=y +CONFIG_IXGBE_DCB=y +CONFIG_IXGBE_IPSEC=y +CONFIG_IXGBEVF=m +CONFIG_IXGBEVF_IPSEC=y +CONFIG_I40E=m +# CONFIG_I40E_DCB is not set +CONFIG_IAVF=m +CONFIG_I40EVF=m +# CONFIG_ICE is not set +CONFIG_FM10K=m +# CONFIG_IGC is not set +# CONFIG_IDPF is not set +CONFIG_JME=m +CONFIG_NET_VENDOR_ADI=y +CONFIG_ADIN1110=m +CONFIG_NET_VENDOR_LITEX=y +CONFIG_LITEX_LITEETH=m +CONFIG_NET_VENDOR_MARVELL=y +CONFIG_MVMDIO=m +CONFIG_SKGE=m +# CONFIG_SKGE_DEBUG is not set +CONFIG_SKGE_GENESIS=y +CONFIG_SKY2=m +# CONFIG_SKY2_DEBUG is not set +CONFIG_OCTEONTX2_MBOX=m +# CONFIG_OCTEONTX2_AF is not set +CONFIG_OCTEONTX2_PF=m +CONFIG_OCTEONTX2_VF=m +# CONFIG_OCTEON_EP is not set +# CONFIG_OCTEON_EP_VF is not set +# CONFIG_PRESTERA is not set +CONFIG_NET_VENDOR_MELLANOX=y +CONFIG_MLX4_EN=m +CONFIG_MLX4_EN_DCB=y +CONFIG_MLX4_CORE=m +CONFIG_MLX4_DEBUG=y +CONFIG_MLX4_CORE_GEN2=y +CONFIG_MLX5_CORE=m +# CONFIG_MLX5_FPGA is not set +CONFIG_MLX5_CORE_EN=y +CONFIG_MLX5_EN_ARFS=y +CONFIG_MLX5_EN_RXNFC=y +CONFIG_MLX5_MPFS=y +CONFIG_MLX5_ESWITCH=y +CONFIG_MLX5_BRIDGE=y +CONFIG_MLX5_CORE_EN_DCB=y +# CONFIG_MLX5_CORE_IPOIB is not set +# CONFIG_MLX5_MACSEC is not set +# CONFIG_MLX5_EN_IPSEC is not set +# CONFIG_MLX5_EN_TLS is not set +CONFIG_MLX5_SW_STEERING=y +# CONFIG_MLX5_SF is not set +# CONFIG_MLX5_DPLL is not set +# CONFIG_MLXSW_CORE is not set +# CONFIG_MLXFW is not set +CONFIG_MLXBF_GIGE=m +CONFIG_NET_VENDOR_META=y +CONFIG_NET_VENDOR_MICREL=y +# CONFIG_KS8842 is not set +# CONFIG_KS8851 is not set +# CONFIG_KS8851_MLL is not set +CONFIG_KSZ884X_PCI=m +CONFIG_NET_VENDOR_MICROCHIP=y +CONFIG_ENC28J60=m +CONFIG_ENC28J60_WRITEVERIFY=y +# CONFIG_ENCX24J600 is not set +# CONFIG_LAN743X is not set +# CONFIG_LAN966X_SWITCH is not set +# CONFIG_VCAP is not set +CONFIG_NET_VENDOR_MICROSEMI=y +CONFIG_MSCC_OCELOT_SWITCH_LIB=m +CONFIG_MSCC_OCELOT_SWITCH=m +CONFIG_NET_VENDOR_MICROSOFT=y +CONFIG_NET_VENDOR_MYRI=y +CONFIG_MYRI10GE=m +# CONFIG_FEALNX is not set +CONFIG_NET_VENDOR_NI=y +# CONFIG_NI_XGE_MANAGEMENT_ENET is not set +CONFIG_NET_VENDOR_NATSEMI=y +CONFIG_NATSEMI=m +CONFIG_NS83820=m +CONFIG_NET_VENDOR_NETERION=y +# CONFIG_S2IO is not set +CONFIG_NET_VENDOR_NETRONOME=y +# CONFIG_NFP is not set +CONFIG_NET_VENDOR_8390=y +CONFIG_NE2K_PCI=m +CONFIG_NET_VENDOR_NVIDIA=y +CONFIG_FORCEDETH=m +CONFIG_NET_VENDOR_OKI=y +CONFIG_ETHOC=m +CONFIG_NET_VENDOR_PACKET_ENGINES=y +CONFIG_HAMACHI=m +CONFIG_YELLOWFIN=m +CONFIG_NET_VENDOR_PENSANDO=y +CONFIG_IONIC=m +CONFIG_NET_VENDOR_QLOGIC=y +# CONFIG_QLA3XXX is not set +# CONFIG_QLCNIC is not set +# CONFIG_NETXEN_NIC is not set +# CONFIG_QED is not set +CONFIG_NET_VENDOR_BROCADE=y +CONFIG_BNA=m +CONFIG_NET_VENDOR_QUALCOMM=y +CONFIG_QCA7000=m +# CONFIG_QCA7000_SPI is not set +CONFIG_QCA7000_UART=m +CONFIG_QCOM_EMAC=m +CONFIG_RMNET=m +CONFIG_NET_VENDOR_RDC=y +# CONFIG_R6040 is not set +CONFIG_NET_VENDOR_REALTEK=y +CONFIG_8139CP=m +CONFIG_8139TOO=m +CONFIG_8139TOO_PIO=y +CONFIG_8139TOO_TUNE_TWISTER=y +CONFIG_8139TOO_8129=y +CONFIG_8139_OLD_RX_RESET=y +CONFIG_R8169=m +CONFIG_R8169_LEDS=y +CONFIG_NET_VENDOR_RENESAS=y +CONFIG_NET_VENDOR_ROCKER=y +CONFIG_ROCKER=m +CONFIG_NET_VENDOR_SAMSUNG=y +# CONFIG_SXGBE_ETH is not set +CONFIG_NET_VENDOR_SEEQ=y +CONFIG_NET_VENDOR_SILAN=y +# CONFIG_SC92031 is not set +CONFIG_NET_VENDOR_SIS=y +# CONFIG_SIS900 is not set +# CONFIG_SIS190 is not set +CONFIG_NET_VENDOR_SOLARFLARE=y +# CONFIG_SFC is not set +# CONFIG_SFC_FALCON is not set +# CONFIG_SFC_SIENA is not set +CONFIG_NET_VENDOR_SMSC=y +CONFIG_SMC91X=y +# CONFIG_EPIC100 is not set +CONFIG_SMSC911X=y +# CONFIG_SMSC9420 is not set +CONFIG_NET_VENDOR_SOCIONEXT=y +CONFIG_NET_VENDOR_STMICRO=y +CONFIG_STMMAC_ETH=y +# CONFIG_STMMAC_SELFTESTS is not set +CONFIG_STMMAC_PLATFORM=y +# CONFIG_DWMAC_DWC_QOS_ETH is not set +CONFIG_DWMAC_GENERIC=y +CONFIG_DWMAC_ROCKCHIP=y +# CONFIG_DWMAC_INTEL_PLAT is not set +# CONFIG_STMMAC_PCI is not set +CONFIG_NET_VENDOR_SUN=y +# CONFIG_HAPPYMEAL is not set +# CONFIG_SUNGEM is not set +# CONFIG_CASSINI is not set +# CONFIG_NIU is not set +CONFIG_NET_VENDOR_SYNOPSYS=y +# CONFIG_DWC_XLGMAC is not set +CONFIG_NET_VENDOR_TEHUTI=y +CONFIG_TEHUTI=m +# CONFIG_TEHUTI_TN40 is not set +CONFIG_NET_VENDOR_TI=y +# CONFIG_TI_CPSW_PHY_SEL is not set +# CONFIG_TLAN is not set +CONFIG_NET_VENDOR_VERTEXCOM=y +# CONFIG_MSE102X is not set +CONFIG_NET_VENDOR_VIA=y +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set +CONFIG_NET_VENDOR_WANGXUN=y +CONFIG_LIBWX=m +CONFIG_NGBE=m +# CONFIG_TXGBE is not set +CONFIG_NET_VENDOR_WIZNET=y +# CONFIG_WIZNET_W5100 is not set +# CONFIG_WIZNET_W5300 is not set +CONFIG_NET_VENDOR_XILINX=y +CONFIG_XILINX_EMACLITE=m +CONFIG_XILINX_LL_TEMAC=m +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +CONFIG_PHYLINK=y +CONFIG_PHYLIB=y +CONFIG_SWPHY=y +CONFIG_LED_TRIGGER_PHY=y +CONFIG_PHYLIB_LEDS=y +CONFIG_FIXED_PHY=y +CONFIG_SFP=m + +# +# MII PHY device drivers +# +# CONFIG_AIR_EN8811H_PHY is not set +CONFIG_AMD_PHY=m +CONFIG_ADIN_PHY=m +CONFIG_ADIN1100_PHY=m +CONFIG_AQUANTIA_PHY=m +CONFIG_AX88796B_PHY=m +CONFIG_BROADCOM_PHY=m +# CONFIG_BCM54140_PHY is not set +CONFIG_BCM7XXX_PHY=m +CONFIG_BCM84881_PHY=m +CONFIG_BCM87XX_PHY=m +CONFIG_BCM_NET_PHYLIB=m +CONFIG_BCM_NET_PHYPTP=m +CONFIG_CICADA_PHY=m +# CONFIG_CORTINA_PHY is not set +CONFIG_DAVICOM_PHY=m +CONFIG_ICPLUS_PHY=m +CONFIG_LXT_PHY=m +# CONFIG_INTEL_XWAY_PHY is not set +CONFIG_LSI_ET1011C_PHY=m +CONFIG_MARVELL_PHY=m +CONFIG_MARVELL_10G_PHY=m +# CONFIG_MARVELL_88Q2XXX_PHY is not set +CONFIG_MARVELL_88X2222_PHY=m +CONFIG_MAXLINEAR_GPHY=m +CONFIG_MEDIATEK_GE_PHY=m +# CONFIG_MEDIATEK_GE_SOC_PHY is not set +CONFIG_MICREL_PHY=y +# CONFIG_MICROCHIP_T1S_PHY is not set +CONFIG_MICROCHIP_PHY=m +CONFIG_MICROCHIP_T1_PHY=m +CONFIG_MICROSEMI_PHY=m +CONFIG_MOTORCOMM_PHY=y +CONFIG_NATIONAL_PHY=m +# CONFIG_NXP_CBTX_PHY is not set +CONFIG_NXP_C45_TJA11XX_PHY=m +# CONFIG_NXP_TJA11XX_PHY is not set +# CONFIG_NCN26000_PHY is not set +CONFIG_QCOM_NET_PHYLIB=m +CONFIG_AT803X_PHY=m +# CONFIG_QCA83XX_PHY is not set +# CONFIG_QCA808X_PHY is not set +# CONFIG_QCA807X_PHY is not set +CONFIG_QSEMI_PHY=m +CONFIG_REALTEK_PHY=y +# CONFIG_RENESAS_PHY is not set +CONFIG_ROCKCHIP_PHY=y +CONFIG_SMSC_PHY=m +# CONFIG_STE10XP is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_DP83822_PHY is not set +CONFIG_DP83TC811_PHY=m +CONFIG_DP83848_PHY=m +# CONFIG_DP83867_PHY is not set +CONFIG_DP83869_PHY=m +CONFIG_DP83TD510_PHY=m +# CONFIG_DP83TG720_PHY is not set +CONFIG_VITESSE_PHY=m +# CONFIG_XILINX_GMII2RGMII is not set +# CONFIG_MICREL_KS8995MA is not set +CONFIG_PSE_CONTROLLER=y +CONFIG_PSE_REGULATOR=m +# CONFIG_PSE_PD692X0 is not set +# CONFIG_PSE_TPS23881 is not set +CONFIG_CAN_DEV=m +CONFIG_CAN_VCAN=m +CONFIG_CAN_VXCAN=m +CONFIG_CAN_NETLINK=y +CONFIG_CAN_CALC_BITTIMING=y +CONFIG_CAN_RX_OFFLOAD=y +# CONFIG_CAN_CAN327 is not set +# CONFIG_CAN_FLEXCAN is not set +CONFIG_CAN_GRCAN=m +CONFIG_CAN_KVASER_PCIEFD=m +CONFIG_CAN_SLCAN=m +CONFIG_CAN_XILINXCAN=m +CONFIG_CAN_C_CAN=m +CONFIG_CAN_C_CAN_PLATFORM=m +CONFIG_CAN_C_CAN_PCI=m +CONFIG_CAN_CC770=m +CONFIG_CAN_CC770_PLATFORM=m +# CONFIG_CAN_CTUCANFD_PCI is not set +# CONFIG_CAN_CTUCANFD_PLATFORM is not set +# CONFIG_CAN_ESD_402_PCI is not set +# CONFIG_CAN_IFI_CANFD is not set +CONFIG_CAN_M_CAN=m +CONFIG_CAN_M_CAN_PCI=m +CONFIG_CAN_M_CAN_PLATFORM=m +CONFIG_CAN_M_CAN_TCAN4X5X=m +CONFIG_CAN_PEAK_PCIEFD=m +CONFIG_CAN_SJA1000=m +CONFIG_CAN_EMS_PCI=m +CONFIG_CAN_F81601=m +CONFIG_CAN_KVASER_PCI=m +CONFIG_CAN_PEAK_PCI=m +CONFIG_CAN_PEAK_PCIEC=y +CONFIG_CAN_PLX_PCI=m +CONFIG_CAN_SJA1000_PLATFORM=m +CONFIG_CAN_SOFTING=m + +# +# CAN SPI interfaces +# +CONFIG_CAN_HI311X=m +CONFIG_CAN_MCP251X=m +CONFIG_CAN_MCP251XFD=m +# CONFIG_CAN_MCP251XFD_SANITY is not set +# end of CAN SPI interfaces + +# +# CAN USB interfaces +# +CONFIG_CAN_8DEV_USB=m +CONFIG_CAN_EMS_USB=m +CONFIG_CAN_ESD_USB=m +CONFIG_CAN_ETAS_ES58X=m +# CONFIG_CAN_F81604 is not set +CONFIG_CAN_GS_USB=m +CONFIG_CAN_KVASER_USB=m +CONFIG_CAN_MCBA_USB=m +CONFIG_CAN_PEAK_USB=m +CONFIG_CAN_UCAN=m +# end of CAN USB interfaces + +# CONFIG_CAN_DEBUG_DEVICES is not set +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_BUS=y +CONFIG_FWNODE_MDIO=y +CONFIG_OF_MDIO=y +CONFIG_ACPI_MDIO=y +CONFIG_MDIO_DEVRES=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BCM_UNIMAC=m +CONFIG_MDIO_CAVIUM=y +CONFIG_MDIO_GPIO=m +# CONFIG_MDIO_HISI_FEMAC is not set +CONFIG_MDIO_I2C=m +CONFIG_MDIO_MVUSB=m +CONFIG_MDIO_MSCC_MIIM=m +# CONFIG_MDIO_OCTEON is not set +# CONFIG_MDIO_IPQ4019 is not set +CONFIG_MDIO_IPQ8064=m +CONFIG_MDIO_REGMAP=m +CONFIG_MDIO_THUNDER=y + +# +# MDIO Multiplexers +# +CONFIG_MDIO_BUS_MUX=y +CONFIG_MDIO_BUS_MUX_GPIO=m +CONFIG_MDIO_BUS_MUX_MULTIPLEXER=y +CONFIG_MDIO_BUS_MUX_MMIOREG=y + +# +# PCS device drivers +# +CONFIG_PCS_XPCS=y +CONFIG_PCS_LYNX=m +CONFIG_PCS_MTK_LYNXI=m +# end of PCS device drivers + +CONFIG_PPP=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_FILTER=y +CONFIG_PPP_MPPE=m +CONFIG_PPP_MULTILINK=y +CONFIG_PPPOATM=m +CONFIG_PPPOE=m +# CONFIG_PPPOE_HASH_BITS_1 is not set +# CONFIG_PPPOE_HASH_BITS_2 is not set +CONFIG_PPPOE_HASH_BITS_4=y +# CONFIG_PPPOE_HASH_BITS_8 is not set +CONFIG_PPPOE_HASH_BITS=4 +CONFIG_PPTP=m +CONFIG_PPPOL2TP=m +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +CONFIG_SLIP=m +CONFIG_SLHC=m +CONFIG_SLIP_COMPRESSED=y +CONFIG_SLIP_SMART=y +CONFIG_SLIP_MODE_SLIP6=y +CONFIG_USB_NET_DRIVERS=y +CONFIG_USB_CATC=m +CONFIG_USB_KAWETH=m +CONFIG_USB_PEGASUS=m +CONFIG_USB_RTL8150=m +CONFIG_USB_RTL8152=m +CONFIG_USB_LAN78XX=m +CONFIG_USB_USBNET=m +CONFIG_USB_NET_AX8817X=m +CONFIG_USB_NET_AX88179_178A=m +CONFIG_USB_NET_CDCETHER=m +CONFIG_USB_NET_CDC_EEM=m +CONFIG_USB_NET_CDC_NCM=m +CONFIG_USB_NET_HUAWEI_CDC_NCM=m +CONFIG_USB_NET_CDC_MBIM=m +CONFIG_USB_NET_DM9601=m +CONFIG_USB_NET_SR9700=m +CONFIG_USB_NET_SR9800=m +CONFIG_USB_NET_SMSC75XX=m +CONFIG_USB_NET_SMSC95XX=m +CONFIG_USB_NET_GL620A=m +CONFIG_USB_NET_NET1080=m +CONFIG_USB_NET_PLUSB=m +CONFIG_USB_NET_MCS7830=m +CONFIG_USB_NET_RNDIS_HOST=m +CONFIG_USB_NET_CDC_SUBSET_ENABLE=m +CONFIG_USB_NET_CDC_SUBSET=m +CONFIG_USB_ALI_M5632=y +CONFIG_USB_AN2720=y +CONFIG_USB_BELKIN=y +CONFIG_USB_ARMLINUX=y +CONFIG_USB_EPSON2888=y +CONFIG_USB_KC2190=y +CONFIG_USB_NET_ZAURUS=m +CONFIG_USB_NET_CX82310_ETH=m +CONFIG_USB_NET_KALMIA=m +CONFIG_USB_NET_QMI_WWAN=m +CONFIG_USB_HSO=m +CONFIG_USB_NET_INT51X1=m +CONFIG_USB_CDC_PHONET=m +CONFIG_USB_IPHETH=m +CONFIG_USB_SIERRA_NET=m +CONFIG_USB_VL600=m +CONFIG_USB_NET_CH9200=m +CONFIG_USB_NET_AQC111=m +CONFIG_USB_RTL8153_ECM=m +CONFIG_WLAN=y +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_ADM8211=m +CONFIG_ATH_COMMON=m +CONFIG_WLAN_VENDOR_ATH=y +# CONFIG_ATH_DEBUG is not set +CONFIG_ATH5K=m +# CONFIG_ATH5K_DEBUG is not set +# CONFIG_ATH5K_TRACER is not set +CONFIG_ATH5K_PCI=y +CONFIG_ATH9K_HW=m +CONFIG_ATH9K_COMMON=m +CONFIG_ATH9K_BTCOEX_SUPPORT=y +CONFIG_ATH9K=m +CONFIG_ATH9K_PCI=y +CONFIG_ATH9K_AHB=y +CONFIG_ATH9K_DYNACK=y +CONFIG_ATH9K_WOW=y +CONFIG_ATH9K_RFKILL=y +CONFIG_ATH9K_CHANNEL_CONTEXT=y +CONFIG_ATH9K_PCOEM=y +CONFIG_ATH9K_PCI_NO_EEPROM=m +CONFIG_ATH9K_HTC=m +# CONFIG_ATH9K_HTC_DEBUGFS is not set +CONFIG_ATH9K_HWRNG=y +CONFIG_CARL9170=m +CONFIG_CARL9170_LEDS=y +CONFIG_CARL9170_WPC=y +CONFIG_CARL9170_HWRNG=y +CONFIG_ATH6KL=m +CONFIG_ATH6KL_SDIO=m +CONFIG_ATH6KL_USB=m +# CONFIG_ATH6KL_DEBUG is not set +# CONFIG_ATH6KL_TRACING is not set +CONFIG_AR5523=m +CONFIG_WIL6210=m +CONFIG_WIL6210_ISR_COR=y +# CONFIG_WIL6210_TRACING is not set +# CONFIG_WIL6210_DEBUGFS is not set +CONFIG_ATH10K=m +CONFIG_ATH10K_CE=y +CONFIG_ATH10K_PCI=m +CONFIG_ATH10K_AHB=y +CONFIG_ATH10K_SDIO=m +CONFIG_ATH10K_USB=m +# CONFIG_ATH10K_DEBUG is not set +# CONFIG_ATH10K_DEBUGFS is not set +CONFIG_ATH10K_LEDS=y +# CONFIG_ATH10K_TRACING is not set +CONFIG_WCN36XX=m +# CONFIG_WCN36XX_DEBUGFS is not set +CONFIG_ATH11K=m +CONFIG_ATH11K_AHB=m +# CONFIG_ATH11K_PCI is not set +# CONFIG_ATH11K_DEBUG is not set +# CONFIG_ATH11K_TRACING is not set +# CONFIG_ATH12K is not set +CONFIG_WLAN_VENDOR_ATMEL=y +CONFIG_AT76C50X_USB=m +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_B43=m +CONFIG_B43_BCMA=y +CONFIG_B43_SSB=y +CONFIG_B43_BUSES_BCMA_AND_SSB=y +# CONFIG_B43_BUSES_BCMA is not set +# CONFIG_B43_BUSES_SSB is not set +CONFIG_B43_PCI_AUTOSELECT=y +CONFIG_B43_PCICORE_AUTOSELECT=y +CONFIG_B43_SDIO=y +CONFIG_B43_BCMA_PIO=y +CONFIG_B43_PIO=y +CONFIG_B43_PHY_G=y +CONFIG_B43_PHY_N=y +CONFIG_B43_PHY_LP=y +CONFIG_B43_PHY_HT=y +CONFIG_B43_LEDS=y +CONFIG_B43_HWRNG=y +# CONFIG_B43_DEBUG is not set +CONFIG_B43LEGACY=m +CONFIG_B43LEGACY_PCI_AUTOSELECT=y +CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y +CONFIG_B43LEGACY_LEDS=y +CONFIG_B43LEGACY_HWRNG=y +# CONFIG_B43LEGACY_DEBUG is not set +CONFIG_B43LEGACY_DMA=y +CONFIG_B43LEGACY_PIO=y +CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y +# CONFIG_B43LEGACY_DMA_MODE is not set +# CONFIG_B43LEGACY_PIO_MODE is not set +CONFIG_BRCMUTIL=m +CONFIG_BRCMSMAC=m +CONFIG_BRCMSMAC_LEDS=y +CONFIG_BRCMFMAC=m +CONFIG_BRCMFMAC_PROTO_BCDC=y +CONFIG_BRCMFMAC_PROTO_MSGBUF=y +CONFIG_BRCMFMAC_SDIO=y +CONFIG_BRCMFMAC_USB=y +CONFIG_BRCMFMAC_PCIE=y +CONFIG_BRCM_TRACING=y +# CONFIG_BRCMDBG is not set +CONFIG_WLAN_VENDOR_INTEL=y +CONFIG_IPW2100=m +CONFIG_IPW2100_MONITOR=y +# CONFIG_IPW2100_DEBUG is not set +CONFIG_IPW2200=m +CONFIG_IPW2200_MONITOR=y +CONFIG_IPW2200_RADIOTAP=y +CONFIG_IPW2200_PROMISCUOUS=y +CONFIG_IPW2200_QOS=y +# CONFIG_IPW2200_DEBUG is not set +CONFIG_LIBIPW=m +# CONFIG_LIBIPW_DEBUG is not set +CONFIG_IWLEGACY=m +CONFIG_IWL4965=m +CONFIG_IWL3945=m + +# +# iwl3945 / iwl4965 Debugging Options +# +# CONFIG_IWLEGACY_DEBUG is not set +# end of iwl3945 / iwl4965 Debugging Options + +CONFIG_IWLWIFI=m +CONFIG_IWLWIFI_LEDS=y +CONFIG_IWLDVM=m +CONFIG_IWLMVM=m +CONFIG_IWLWIFI_OPMODE_MODULAR=y + +# +# Debugging Options +# +# CONFIG_IWLWIFI_DEBUG is not set +CONFIG_IWLWIFI_DEVICE_TRACING=y +# end of Debugging Options + +CONFIG_WLAN_VENDOR_INTERSIL=y +CONFIG_P54_COMMON=m +CONFIG_P54_USB=m +# CONFIG_P54_PCI is not set +CONFIG_P54_SPI=m +CONFIG_P54_SPI_DEFAULT_EEPROM=y +CONFIG_P54_LEDS=y +CONFIG_WLAN_VENDOR_MARVELL=y +CONFIG_LIBERTAS=m +CONFIG_LIBERTAS_USB=m +CONFIG_LIBERTAS_SDIO=m +CONFIG_LIBERTAS_SPI=m +# CONFIG_LIBERTAS_DEBUG is not set +CONFIG_LIBERTAS_MESH=y +CONFIG_LIBERTAS_THINFIRM=m +# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set +CONFIG_LIBERTAS_THINFIRM_USB=m +CONFIG_MWIFIEX=m +CONFIG_MWIFIEX_SDIO=m +CONFIG_MWIFIEX_PCIE=m +CONFIG_MWIFIEX_USB=m +CONFIG_MWL8K=m +CONFIG_WLAN_VENDOR_MEDIATEK=y +CONFIG_MT7601U=m +CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y +CONFIG_MT76_USB=m +CONFIG_MT76_SDIO=m +CONFIG_MT76x02_LIB=m +CONFIG_MT76x02_USB=m +CONFIG_MT76_CONNAC_LIB=m +CONFIG_MT792x_LIB=m +CONFIG_MT792x_USB=m +CONFIG_MT76x0_COMMON=m +CONFIG_MT76x0U=m +CONFIG_MT76x0E=m +CONFIG_MT76x2_COMMON=m +CONFIG_MT76x2E=m +CONFIG_MT76x2U=m +CONFIG_MT7603E=m +CONFIG_MT7615_COMMON=m +CONFIG_MT7615E=m +CONFIG_MT7663_USB_SDIO_COMMON=m +CONFIG_MT7663U=m +CONFIG_MT7663S=m +CONFIG_MT7915E=m +CONFIG_MT7921_COMMON=m +CONFIG_MT7921E=m +CONFIG_MT7921S=m +CONFIG_MT7921U=m +CONFIG_MT7996E=m +CONFIG_MT7925_COMMON=m +CONFIG_MT7925E=m +CONFIG_MT7925U=m +CONFIG_WLAN_VENDOR_MICROCHIP=y +CONFIG_WILC1000=m +CONFIG_WILC1000_SDIO=m +CONFIG_WILC1000_SPI=m +# CONFIG_WILC1000_HW_OOB_INTR is not set +CONFIG_WLAN_VENDOR_PURELIFI=y +# CONFIG_PLFXLC is not set +CONFIG_WLAN_VENDOR_RALINK=y +CONFIG_RT2X00=m +CONFIG_RT2400PCI=m +CONFIG_RT2500PCI=m +CONFIG_RT61PCI=m +CONFIG_RT2800PCI=m +CONFIG_RT2800PCI_RT33XX=y +CONFIG_RT2800PCI_RT35XX=y +CONFIG_RT2800PCI_RT53XX=y +CONFIG_RT2800PCI_RT3290=y +CONFIG_RT2500USB=m +CONFIG_RT73USB=m +CONFIG_RT2800USB=m +CONFIG_RT2800USB_RT33XX=y +CONFIG_RT2800USB_RT35XX=y +CONFIG_RT2800USB_RT3573=y +CONFIG_RT2800USB_RT53XX=y +CONFIG_RT2800USB_RT55XX=y +CONFIG_RT2800USB_UNKNOWN=y +CONFIG_RT2800_LIB=m +CONFIG_RT2800_LIB_MMIO=m +CONFIG_RT2X00_LIB_MMIO=m +CONFIG_RT2X00_LIB_PCI=m +CONFIG_RT2X00_LIB_USB=m +CONFIG_RT2X00_LIB=m +CONFIG_RT2X00_LIB_FIRMWARE=y +CONFIG_RT2X00_LIB_CRYPTO=y +CONFIG_RT2X00_LIB_LEDS=y +# CONFIG_RT2X00_DEBUG is not set +CONFIG_WLAN_VENDOR_REALTEK=y +CONFIG_RTL8180=m +CONFIG_RTL8187=m +CONFIG_RTL8187_LEDS=y +CONFIG_RTL_CARDS=m +CONFIG_RTL8192CE=m +CONFIG_RTL8192SE=m +CONFIG_RTL8192DE=m +CONFIG_RTL8723AE=m +CONFIG_RTL8723BE=m +CONFIG_RTL8188EE=m +CONFIG_RTL8192EE=m +CONFIG_RTL8821AE=m +CONFIG_RTL8192CU=m +# CONFIG_RTL8192DU is not set +CONFIG_RTLWIFI=m +CONFIG_RTLWIFI_PCI=m +CONFIG_RTLWIFI_USB=m +# CONFIG_RTLWIFI_DEBUG is not set +CONFIG_RTL8192C_COMMON=m +CONFIG_RTL8192D_COMMON=m +CONFIG_RTL8723_COMMON=m +CONFIG_RTLBTCOEXIST=m +CONFIG_RTL8XXXU=m +# CONFIG_RTL8XXXU_UNTESTED is not set +CONFIG_RTW88=m +CONFIG_RTW88_CORE=m +CONFIG_RTW88_PCI=m +CONFIG_RTW88_USB=m +CONFIG_RTW88_8822B=m +CONFIG_RTW88_8822C=m +CONFIG_RTW88_8723X=m +CONFIG_RTW88_8723D=m +CONFIG_RTW88_8821C=m +CONFIG_RTW88_8822BE=m +# CONFIG_RTW88_8822BS is not set +CONFIG_RTW88_8822BU=m +CONFIG_RTW88_8822CE=m +# CONFIG_RTW88_8822CS is not set +CONFIG_RTW88_8822CU=m +CONFIG_RTW88_8723DE=m +# CONFIG_RTW88_8723DS is not set +# CONFIG_RTW88_8723CS is not set +CONFIG_RTW88_8723DU=m +CONFIG_RTW88_8821CE=m +# CONFIG_RTW88_8821CS is not set +CONFIG_RTW88_8821CU=m +# CONFIG_RTW88_DEBUG is not set +# CONFIG_RTW88_DEBUGFS is not set +CONFIG_RTW89=m +CONFIG_RTW89_CORE=m +CONFIG_RTW89_PCI=m +CONFIG_RTW89_8851B=m +CONFIG_RTW89_8852A=m +CONFIG_RTW89_8852B_COMMON=m +CONFIG_RTW89_8852B=m +CONFIG_RTW89_8852C=m +CONFIG_RTW89_8851BE=m +CONFIG_RTW89_8852AE=m +CONFIG_RTW89_8852BE=m +CONFIG_RTW89_8852CE=m +# CONFIG_RTW89_8922AE is not set +# CONFIG_RTW89_DEBUGMSG is not set +# CONFIG_RTW89_DEBUGFS is not set +CONFIG_WLAN_VENDOR_RSI=y +CONFIG_RSI_91X=m +# CONFIG_RSI_DEBUGFS is not set +CONFIG_RSI_SDIO=m +CONFIG_RSI_USB=m +CONFIG_RSI_COEX=y +CONFIG_WLAN_VENDOR_SILABS=y +CONFIG_WFX=m +CONFIG_WLAN_VENDOR_ST=y +CONFIG_CW1200=m +CONFIG_CW1200_WLAN_SDIO=m +CONFIG_CW1200_WLAN_SPI=m +CONFIG_WLAN_VENDOR_TI=y +CONFIG_WL1251=m +CONFIG_WL1251_SPI=m +CONFIG_WL1251_SDIO=m +CONFIG_WL12XX=m +CONFIG_WL18XX=m +CONFIG_WLCORE=m +CONFIG_WLCORE_SPI=m +CONFIG_WLCORE_SDIO=m +# CONFIG_RTL8723DS is not set +# CONFIG_RTL8822BU is not set +# CONFIG_RTL8821CU is not set +# CONFIG_88XXAU is not set +# CONFIG_RTL8192EU is not set +# CONFIG_RTL8189FS is not set +# CONFIG_RTL8189ES is not set +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_ZD1211RW=m +# CONFIG_ZD1211RW_DEBUG is not set +CONFIG_WLAN_VENDOR_QUANTENNA=y +CONFIG_QTNFMAC=m +CONFIG_QTNFMAC_PCIE=m +CONFIG_MAC80211_HWSIM=m +CONFIG_VIRT_WIFI=m +CONFIG_WAN=y +CONFIG_HDLC=m +CONFIG_HDLC_RAW=m +CONFIG_HDLC_RAW_ETH=m +# CONFIG_HDLC_CISCO is not set +# CONFIG_HDLC_FR is not set +# CONFIG_HDLC_PPP is not set +# CONFIG_HDLC_X25 is not set +# CONFIG_FRAMER is not set +# CONFIG_PCI200SYN is not set +# CONFIG_WANXL is not set +# CONFIG_PC300TOO is not set +# CONFIG_FARSYNC is not set +# CONFIG_LAPBETHER is not set +CONFIG_IEEE802154_DRIVERS=m +CONFIG_IEEE802154_FAKELB=m +CONFIG_IEEE802154_AT86RF230=m +CONFIG_IEEE802154_MRF24J40=m +CONFIG_IEEE802154_CC2520=m +CONFIG_IEEE802154_ATUSB=m +CONFIG_IEEE802154_ADF7242=m +CONFIG_IEEE802154_CA8210=m +# CONFIG_IEEE802154_CA8210_DEBUGFS is not set +CONFIG_IEEE802154_MCR20A=m +CONFIG_IEEE802154_HWSIM=m + +# +# Wireless WAN +# +CONFIG_WWAN=m +CONFIG_WWAN_DEBUGFS=y +CONFIG_WWAN_HWSIM=m +CONFIG_MHI_WWAN_CTRL=m +CONFIG_MHI_WWAN_MBIM=m +CONFIG_RPMSG_WWAN_CTRL=m +CONFIG_IOSM=m +CONFIG_MTK_T7XX=m +# end of Wireless WAN + +CONFIG_XEN_NETDEV_FRONTEND=m +CONFIG_XEN_NETDEV_BACKEND=m +CONFIG_VMXNET3=m +CONFIG_FUJITSU_ES=m +CONFIG_NETDEVSIM=m +CONFIG_NET_FAILOVER=y +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +CONFIG_INPUT_FF_MEMLESS=m +CONFIG_INPUT_SPARSEKMAP=m +CONFIG_INPUT_MATRIXKMAP=y +CONFIG_INPUT_VIVALDIFMAP=y + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_JOYDEV=m +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set +# CONFIG_INPUT_KUNIT_TEST is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +CONFIG_KEYBOARD_ADC=m +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +CONFIG_KEYBOARD_ATKBD=y +CONFIG_KEYBOARD_QT1050=m +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_DLINK_DIR685 is not set +# CONFIG_KEYBOARD_LKKBD is not set +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_GPIO_POLLED=m +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_PINEPHONE is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_KEYBOARD_CROS_EC=y +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +# CONFIG_KEYBOARD_CYPRESS_SF is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_BYD=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y +CONFIG_MOUSE_PS2_CYPRESS=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +# CONFIG_MOUSE_PS2_SENTELIC is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_FOCALTECH=y +CONFIG_MOUSE_PS2_SMBUS=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +# CONFIG_MOUSE_ELAN_I2C is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +CONFIG_MOUSE_SYNAPTICS_I2C=m +CONFIG_MOUSE_SYNAPTICS_USB=m +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_ANALOG=m +CONFIG_JOYSTICK_A3D=m +CONFIG_JOYSTICK_ADC=m +CONFIG_JOYSTICK_ADI=m +CONFIG_JOYSTICK_COBRA=m +CONFIG_JOYSTICK_GF2K=m +CONFIG_JOYSTICK_GRIP=m +CONFIG_JOYSTICK_GRIP_MP=m +CONFIG_JOYSTICK_GUILLEMOT=m +CONFIG_JOYSTICK_INTERACT=m +CONFIG_JOYSTICK_SIDEWINDER=m +CONFIG_JOYSTICK_TMDC=m +CONFIG_JOYSTICK_IFORCE=m +CONFIG_JOYSTICK_IFORCE_USB=m +CONFIG_JOYSTICK_IFORCE_232=m +CONFIG_JOYSTICK_WARRIOR=m +CONFIG_JOYSTICK_MAGELLAN=m +CONFIG_JOYSTICK_SPACEORB=m +CONFIG_JOYSTICK_SPACEBALL=m +CONFIG_JOYSTICK_STINGER=m +CONFIG_JOYSTICK_TWIDJOY=m +CONFIG_JOYSTICK_ZHENHUA=m +CONFIG_JOYSTICK_AS5011=m +CONFIG_JOYSTICK_JOYDUMP=m +CONFIG_JOYSTICK_XPAD=m +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_JOYSTICK_PSXPAD_SPI=m +CONFIG_JOYSTICK_PSXPAD_SPI_FF=y +CONFIG_JOYSTICK_PXRC=m +CONFIG_JOYSTICK_QWIIC=m +CONFIG_JOYSTICK_FSIA6B=m +CONFIG_JOYSTICK_SENSEHAT=m +# CONFIG_JOYSTICK_SEESAW is not set +CONFIG_INPUT_TABLET=y +# CONFIG_TABLET_USB_ACECAD is not set +# CONFIG_TABLET_USB_AIPTEK is not set +# CONFIG_TABLET_USB_HANWANG is not set +# CONFIG_TABLET_USB_KBTAB is not set +# CONFIG_TABLET_USB_PEGASUS is not set +# CONFIG_TABLET_SERIAL_WACOM4 is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_AD7877=m +CONFIG_TOUCHSCREEN_AD7879=m +CONFIG_TOUCHSCREEN_AD7879_I2C=m +CONFIG_TOUCHSCREEN_AD7879_SPI=m +CONFIG_TOUCHSCREEN_ADC=m +CONFIG_TOUCHSCREEN_AR1021_I2C=m +CONFIG_TOUCHSCREEN_ATMEL_MXT=m +CONFIG_TOUCHSCREEN_ATMEL_MXT_T37=y +CONFIG_TOUCHSCREEN_AUO_PIXCIR=m +CONFIG_TOUCHSCREEN_BU21013=m +CONFIG_TOUCHSCREEN_BU21029=m +CONFIG_TOUCHSCREEN_CHIPONE_ICN8318=m +CONFIG_TOUCHSCREEN_CHIPONE_ICN8505=m +CONFIG_TOUCHSCREEN_CY8CTMA140=m +CONFIG_TOUCHSCREEN_CY8CTMG110=m +CONFIG_TOUCHSCREEN_CYTTSP_CORE=m +CONFIG_TOUCHSCREEN_CYTTSP_I2C=m +CONFIG_TOUCHSCREEN_CYTTSP_SPI=m +CONFIG_TOUCHSCREEN_CYTTSP4_CORE=m +CONFIG_TOUCHSCREEN_CYTTSP4_I2C=m +CONFIG_TOUCHSCREEN_CYTTSP4_SPI=m +# CONFIG_TOUCHSCREEN_CYTTSP5 is not set +CONFIG_TOUCHSCREEN_DYNAPRO=m +CONFIG_TOUCHSCREEN_HAMPSHIRE=m +CONFIG_TOUCHSCREEN_EETI=m +CONFIG_TOUCHSCREEN_EGALAX=m +CONFIG_TOUCHSCREEN_EGALAX_SERIAL=m +CONFIG_TOUCHSCREEN_EXC3000=m +CONFIG_TOUCHSCREEN_FUJITSU=m +CONFIG_TOUCHSCREEN_GOODIX=m +# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_I2C is not set +# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_SPI is not set +CONFIG_TOUCHSCREEN_HIDEEP=m +CONFIG_TOUCHSCREEN_HYCON_HY46XX=m +# CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX is not set +CONFIG_TOUCHSCREEN_ILI210X=m +CONFIG_TOUCHSCREEN_ILITEK=m +CONFIG_TOUCHSCREEN_S6SY761=m +CONFIG_TOUCHSCREEN_GUNZE=m +CONFIG_TOUCHSCREEN_EKTF2127=m +CONFIG_TOUCHSCREEN_ELAN=m +CONFIG_TOUCHSCREEN_ELO=m +CONFIG_TOUCHSCREEN_WACOM_W8001=m +CONFIG_TOUCHSCREEN_WACOM_I2C=m +CONFIG_TOUCHSCREEN_MAX11801=m +CONFIG_TOUCHSCREEN_MCS5000=m +CONFIG_TOUCHSCREEN_MMS114=m +CONFIG_TOUCHSCREEN_MELFAS_MIP4=m +CONFIG_TOUCHSCREEN_MSG2638=m +CONFIG_TOUCHSCREEN_MTOUCH=m +# CONFIG_TOUCHSCREEN_NOVATEK_NVT_TS is not set +CONFIG_TOUCHSCREEN_IMAGIS=m +CONFIG_TOUCHSCREEN_IMX6UL_TSC=m +CONFIG_TOUCHSCREEN_INEXIO=m +CONFIG_TOUCHSCREEN_PENMOUNT=m +CONFIG_TOUCHSCREEN_EDT_FT5X06=m +CONFIG_TOUCHSCREEN_TOUCHRIGHT=m +CONFIG_TOUCHSCREEN_TOUCHWIN=m +CONFIG_TOUCHSCREEN_PIXCIR=m +CONFIG_TOUCHSCREEN_WDT87XX_I2C=m +CONFIG_TOUCHSCREEN_WM97XX=m +CONFIG_TOUCHSCREEN_WM9705=y +CONFIG_TOUCHSCREEN_WM9712=y +CONFIG_TOUCHSCREEN_WM9713=y +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +CONFIG_TOUCHSCREEN_TOUCHIT213=m +CONFIG_TOUCHSCREEN_TSC_SERIO=m +CONFIG_TOUCHSCREEN_TSC200X_CORE=m +CONFIG_TOUCHSCREEN_TSC2004=m +CONFIG_TOUCHSCREEN_TSC2005=m +CONFIG_TOUCHSCREEN_TSC2007=m +CONFIG_TOUCHSCREEN_TSC2007_IIO=y +CONFIG_TOUCHSCREEN_RM_TS=m +CONFIG_TOUCHSCREEN_SILEAD=m +CONFIG_TOUCHSCREEN_SIS_I2C=m +CONFIG_TOUCHSCREEN_ST1232=m +CONFIG_TOUCHSCREEN_STMFTS=m +CONFIG_TOUCHSCREEN_SUR40=m +CONFIG_TOUCHSCREEN_SURFACE3_SPI=m +CONFIG_TOUCHSCREEN_SX8654=m +CONFIG_TOUCHSCREEN_TPS6507X=m +CONFIG_TOUCHSCREEN_ZET6223=m +CONFIG_TOUCHSCREEN_ZFORCE=m +CONFIG_TOUCHSCREEN_COLIBRI_VF50=m +CONFIG_TOUCHSCREEN_ROHM_BU21023=m +CONFIG_TOUCHSCREEN_IQS5XX=m +# CONFIG_TOUCHSCREEN_IQS7211 is not set +CONFIG_TOUCHSCREEN_ZINITIX=m +# CONFIG_TOUCHSCREEN_HIMAX_HX83112B is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_ATMEL_CAPTOUCH is not set +# CONFIG_INPUT_BMA150 is not set +# CONFIG_INPUT_E3X0_BUTTON is not set +# CONFIG_INPUT_MMA8450 is not set +CONFIG_INPUT_GPIO_BEEPER=m +CONFIG_INPUT_GPIO_DECODER=m +CONFIG_INPUT_GPIO_VIBRA=m +CONFIG_INPUT_ATI_REMOTE2=m +# CONFIG_INPUT_KEYSPAN_REMOTE is not set +# CONFIG_INPUT_KXTJ9 is not set +# CONFIG_INPUT_POWERMATE is not set +# CONFIG_INPUT_YEALINK is not set +# CONFIG_INPUT_CM109 is not set +# CONFIG_INPUT_REGULATOR_HAPTIC is not set +CONFIG_INPUT_UINPUT=m +# CONFIG_INPUT_PCF8574 is not set +# CONFIG_INPUT_PWM_BEEPER is not set +# CONFIG_INPUT_PWM_VIBRA is not set +CONFIG_INPUT_RK805_PWRKEY=m +# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +CONFIG_INPUT_DA7280_HAPTICS=m +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_IBM_PANEL is not set +# CONFIG_INPUT_IMS_PCU is not set +# CONFIG_INPUT_IQS269A is not set +CONFIG_INPUT_IQS626A=m +CONFIG_INPUT_IQS7222=m +# CONFIG_INPUT_CMA3000 is not set +CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y +CONFIG_INPUT_SOC_BUTTON_ARRAY=m +# CONFIG_INPUT_DRV260X_HAPTICS is not set +# CONFIG_INPUT_DRV2665_HAPTICS is not set +# CONFIG_INPUT_DRV2667_HAPTICS is not set +CONFIG_RMI4_CORE=m +CONFIG_RMI4_I2C=m +CONFIG_RMI4_SPI=m +CONFIG_RMI4_SMB=m +CONFIG_RMI4_F03=y +CONFIG_RMI4_F03_SERIO=m +CONFIG_RMI4_2D_SENSOR=y +CONFIG_RMI4_F11=y +CONFIG_RMI4_F12=y +CONFIG_RMI4_F30=y +CONFIG_RMI4_F34=y +CONFIG_RMI4_F3A=y +CONFIG_RMI4_F54=y +CONFIG_RMI4_F55=y + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +CONFIG_SERIO_AMBAKMI=y +# CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=y +CONFIG_SERIO_RAW=m +CONFIG_SERIO_ALTERA_PS2=m +# CONFIG_SERIO_PS2MULT is not set +CONFIG_SERIO_ARC_PS2=m +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_SERIO_GPIO_PS2 is not set +# CONFIG_USERIO is not set +CONFIG_GAMEPORT=m +# CONFIG_GAMEPORT_EMU10K1 is not set +# CONFIG_GAMEPORT_FM801 is not set +# end of Hardware I/O ports +# end of Input device support + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=16 +CONFIG_LEGACY_TIOCSTI=y +CONFIG_LDISC_AUTOLOAD=y + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIAL_8250_16550A_VARIANTS=y +CONFIG_SERIAL_8250_FINTEK=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_PCILIB=y +CONFIG_SERIAL_8250_PCI=m +CONFIG_SERIAL_8250_EXAR=m +CONFIG_SERIAL_8250_NR_UARTS=8 +CONFIG_SERIAL_8250_RUNTIME_UARTS=8 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +# CONFIG_SERIAL_8250_PCI1XXXX is not set +CONFIG_SERIAL_8250_SHARE_IRQ=y +# CONFIG_SERIAL_8250_DETECT_IRQ is not set +CONFIG_SERIAL_8250_RSA=y +CONFIG_SERIAL_8250_DWLIB=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_RT288X is not set +CONFIG_SERIAL_8250_PERICOM=y +CONFIG_SERIAL_OF_PLATFORM=y + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_AMBA_PL010=y +CONFIG_SERIAL_AMBA_PL010_CONSOLE=y +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_SERIAL_EARLYCON_SEMIHOST is not set +# CONFIG_SERIAL_MAX3100 is not set +# CONFIG_SERIAL_MAX310X is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_SERIAL_JSM=m +CONFIG_SERIAL_SIFIVE=m +CONFIG_SERIAL_SCCNXP=y +CONFIG_SERIAL_SCCNXP_CONSOLE=y +# CONFIG_SERIAL_SC16IS7XX is not set +CONFIG_SERIAL_ALTERA_JTAGUART=m +CONFIG_SERIAL_ALTERA_UART=m +CONFIG_SERIAL_ALTERA_UART_MAXPORTS=4 +CONFIG_SERIAL_ALTERA_UART_BAUDRATE=115200 +CONFIG_SERIAL_XILINX_PS_UART=y +CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y +CONFIG_SERIAL_ARC=m +CONFIG_SERIAL_ARC_NR_PORTS=1 +CONFIG_SERIAL_RP2=m +CONFIG_SERIAL_RP2_NR_UARTS=32 +CONFIG_SERIAL_FSL_LPUART=m +CONFIG_SERIAL_FSL_LINFLEXUART=m +CONFIG_SERIAL_CONEXANT_DIGICOLOR=m +CONFIG_SERIAL_SPRD=m +CONFIG_SERIAL_LITEUART=m +CONFIG_SERIAL_LITEUART_MAX_PORTS=1 +# end of Serial drivers + +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_NONSTANDARD=y +CONFIG_MOXA_INTELLIO=m +CONFIG_MOXA_SMARTIO=m +CONFIG_N_HDLC=m +CONFIG_N_GSM=m +CONFIG_NOZOMI=m +CONFIG_NULL_TTY=m +CONFIG_HVC_DRIVER=y +CONFIG_HVC_IRQ=y +CONFIG_HVC_XEN=y +CONFIG_HVC_XEN_FRONTEND=y +# CONFIG_HVC_DCC is not set +CONFIG_RPMSG_TTY=m +CONFIG_SERIAL_DEV_BUS=y +CONFIG_SERIAL_DEV_CTRL_TTYPORT=y +# CONFIG_TTY_PRINTK is not set +CONFIG_VIRTIO_CONSOLE=y +CONFIG_IPMI_HANDLER=m +CONFIG_IPMI_DMI_DECODE=y +CONFIG_IPMI_PLAT_DATA=y +# CONFIG_IPMI_PANIC_EVENT is not set +CONFIG_IPMI_DEVICE_INTERFACE=m +CONFIG_IPMI_SI=m +# CONFIG_IPMI_SSIF is not set +CONFIG_IPMI_IPMB=m +# CONFIG_IPMI_WATCHDOG is not set +# CONFIG_IPMI_POWEROFF is not set +# CONFIG_SSIF_IPMI_BMC is not set +# CONFIG_IPMB_DEVICE_INTERFACE is not set +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_TIMERIOMEM=m +# CONFIG_HW_RANDOM_BA431 is not set +CONFIG_HW_RANDOM_VIRTIO=m +CONFIG_HW_RANDOM_OPTEE=m +# CONFIG_HW_RANDOM_CCTRNG is not set +# CONFIG_HW_RANDOM_XIPHERA is not set +CONFIG_HW_RANDOM_ROCKCHIP=m +CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=m +CONFIG_HW_RANDOM_CN10K=y +# CONFIG_APPLICOM is not set +CONFIG_DEVMEM=y +CONFIG_DEVPORT=y +CONFIG_TCG_TPM=y +# CONFIG_TCG_TPM2_HMAC is not set +CONFIG_HW_RANDOM_TPM=y +# CONFIG_TCG_TIS is not set +# CONFIG_TCG_TIS_SPI is not set +# CONFIG_TCG_TIS_I2C is not set +CONFIG_TCG_TIS_I2C_CR50=m +# CONFIG_TCG_TIS_I2C_ATMEL is not set +CONFIG_TCG_TIS_I2C_INFINEON=y +# CONFIG_TCG_TIS_I2C_NUVOTON is not set +# CONFIG_TCG_ATMEL is not set +# CONFIG_TCG_INFINEON is not set +# CONFIG_TCG_XEN is not set +CONFIG_TCG_CRB=y +# CONFIG_TCG_VTPM_PROXY is not set +# CONFIG_TCG_FTPM_TEE is not set +# CONFIG_TCG_TIS_ST33ZP24_I2C is not set +# CONFIG_TCG_TIS_ST33ZP24_SPI is not set +CONFIG_XILLYBUS_CLASS=m +# CONFIG_XILLYBUS is not set +CONFIG_XILLYUSB=m +# end of Character devices + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_ACPI_I2C_OPREGION=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y + +# +# Multiplexer I2C Chip support +# +CONFIG_I2C_ARB_GPIO_CHALLENGE=m +CONFIG_I2C_MUX_GPIO=m +CONFIG_I2C_MUX_GPMUX=m +CONFIG_I2C_MUX_LTC4306=m +CONFIG_I2C_MUX_PCA9541=m +CONFIG_I2C_MUX_PCA954x=m +CONFIG_I2C_MUX_PINCTRL=m +CONFIG_I2C_MUX_REG=m +CONFIG_I2C_DEMUX_PINCTRL=m +CONFIG_I2C_MUX_MLXCPLD=m +# end of Multiplexer I2C Chip support + +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_SMBUS=m +CONFIG_I2C_ALGOBIT=m +CONFIG_I2C_ALGOPCA=m + +# +# I2C Hardware Bus support +# + +# +# PC SMBus host controller drivers +# +CONFIG_I2C_CCGX_UCSI=m +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_AMD_MP2 is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_ISCH is not set +# CONFIG_I2C_PIIX4 is not set +# CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_NVIDIA_GPU is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set +# CONFIG_I2C_ZHAOXIN is not set + +# +# ACPI drivers +# +CONFIG_I2C_SCMI=m + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +CONFIG_I2C_CADENCE=m +CONFIG_I2C_CBUS_GPIO=m +CONFIG_I2C_DESIGNWARE_CORE=y +# CONFIG_I2C_DESIGNWARE_SLAVE is not set +CONFIG_I2C_DESIGNWARE_PLATFORM=y +CONFIG_I2C_DESIGNWARE_PCI=m +CONFIG_I2C_EMEV2=m +CONFIG_I2C_GPIO=m +CONFIG_I2C_GPIO_FAULT_INJECTOR=y +CONFIG_I2C_HISI=m +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +CONFIG_I2C_PCA_PLATFORM=m +CONFIG_I2C_RK3X=y +# CONFIG_I2C_SIMTEC is not set +# CONFIG_I2C_THUNDERX is not set +CONFIG_I2C_XILINX=m + +# +# External I2C/SMBus adapter drivers +# +CONFIG_I2C_DIOLAN_U2C=m +CONFIG_I2C_CP2615=m +CONFIG_I2C_PCI1XXXX=m +CONFIG_I2C_ROBOTFUZZ_OSIF=m +CONFIG_I2C_TAOS_EVM=m +CONFIG_I2C_TINY_USB=m + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_MLXCPLD is not set +CONFIG_I2C_CROS_EC_TUNNEL=y +CONFIG_I2C_VIRTIO=m +# end of I2C Hardware Bus support + +CONFIG_I2C_STUB=m +CONFIG_I2C_SLAVE=y +CONFIG_I2C_SLAVE_EEPROM=m +CONFIG_I2C_SLAVE_TESTUNIT=m +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# end of I2C support + +CONFIG_I3C=m +CONFIG_CDNS_I3C_MASTER=m +CONFIG_DW_I3C_MASTER=m +CONFIG_SVC_I3C_MASTER=m +CONFIG_MIPI_I3C_HCI=m +CONFIG_SPI=y +# CONFIG_SPI_DEBUG is not set +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y + +# +# SPI Master Controller Drivers +# +CONFIG_SPI_ALTERA=m +CONFIG_SPI_ALTERA_CORE=m +CONFIG_SPI_AXI_SPI_ENGINE=m +CONFIG_SPI_BITBANG=m +CONFIG_SPI_CADENCE=m +CONFIG_SPI_CADENCE_QUADSPI=y +CONFIG_SPI_CADENCE_XSPI=m +# CONFIG_SPI_CH341 is not set +CONFIG_SPI_DESIGNWARE=m +# CONFIG_SPI_DW_DMA is not set +CONFIG_SPI_DW_PCI=m +CONFIG_SPI_DW_MMIO=m +CONFIG_SPI_HISI_KUNPENG=m +CONFIG_SPI_HISI_SFC_V3XX=m +CONFIG_SPI_GPIO=m +CONFIG_SPI_FSL_LIB=m +CONFIG_SPI_FSL_SPI=m +CONFIG_SPI_MICROCHIP_CORE=m +CONFIG_SPI_MICROCHIP_CORE_QSPI=m +CONFIG_SPI_OC_TINY=m +# CONFIG_SPI_PCI1XXXX is not set +CONFIG_SPI_PL022=y +CONFIG_SPI_ROCKCHIP=y +CONFIG_SPI_ROCKCHIP_SFC=y +# CONFIG_SPI_SC18IS602 is not set +# CONFIG_SPI_SIFIVE is not set +# CONFIG_SPI_SN_F_OSPI is not set +CONFIG_SPI_MXIC=m +# CONFIG_SPI_THUNDERX is not set +# CONFIG_SPI_XCOMM is not set +# CONFIG_SPI_XILINX is not set +# CONFIG_SPI_ZYNQMP_GQSPI is not set +# CONFIG_SPI_AMD is not set + +# +# SPI Multiplexer support +# +CONFIG_SPI_MUX=m + +# +# SPI Protocol Masters +# +CONFIG_SPI_SPIDEV=m +CONFIG_SPI_LOOPBACK_TEST=m +CONFIG_SPI_TLE62X0=m +CONFIG_SPI_SLAVE=y +CONFIG_SPI_SLAVE_TIME=m +CONFIG_SPI_SLAVE_SYSTEM_CONTROL=m +CONFIG_SPI_DYNAMIC=y +CONFIG_SPMI=y +# CONFIG_SPMI_HISI3670 is not set +# CONFIG_HSI is not set +CONFIG_PPS=y +# CONFIG_PPS_DEBUG is not set + +# +# PPS clients support +# +# CONFIG_PPS_CLIENT_KTIMER is not set +CONFIG_PPS_CLIENT_LDISC=m +CONFIG_PPS_CLIENT_GPIO=m + +# +# PPS generators support +# + +# +# PTP clock support +# +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_DP83640_PHY=m +CONFIG_PTP_1588_CLOCK_INES=m +CONFIG_PTP_1588_CLOCK_KVM=m +CONFIG_PTP_1588_CLOCK_IDT82P33=m +CONFIG_PTP_1588_CLOCK_IDTCM=m +# CONFIG_PTP_1588_CLOCK_FC3W is not set +# CONFIG_PTP_1588_CLOCK_MOCK is not set +CONFIG_PTP_1588_CLOCK_OCP=m +# end of PTP clock support + +CONFIG_PINCTRL=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_PINMUX=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y +CONFIG_PINCONF=y +CONFIG_GENERIC_PINCONF=y +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_PINCTRL_AMD is not set +# CONFIG_PINCTRL_AW9523 is not set +CONFIG_PINCTRL_CY8C95X0=m +# CONFIG_PINCTRL_MCP23S08 is not set +# CONFIG_PINCTRL_MICROCHIP_SGPIO is not set +# CONFIG_PINCTRL_OCELOT is not set +CONFIG_PINCTRL_RK805=m +CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SCMI is not set +CONFIG_PINCTRL_SINGLE=y +CONFIG_PINCTRL_STMFX=m +CONFIG_PINCTRL_SX150X=y +# CONFIG_PINCTRL_IMX_SCMI is not set + +# +# Renesas pinctrl drivers +# +# end of Renesas pinctrl drivers + +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_FASTPATH_LIMIT=512 +CONFIG_OF_GPIO=y +CONFIG_GPIO_ACPI=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_OF_GPIO_MM_GPIOCHIP=y +# CONFIG_DEBUG_GPIO is not set +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_CDEV_V1=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_REGMAP=m +CONFIG_GPIO_MAX730X=m +CONFIG_GPIO_IDIO_16=m + +# +# Memory mapped GPIO drivers +# +CONFIG_GPIO_74XX_MMIO=m +CONFIG_GPIO_ALTERA=m +# CONFIG_GPIO_AMDPT is not set +CONFIG_GPIO_CADENCE=m +CONFIG_GPIO_DWAPB=m +CONFIG_GPIO_EXAR=m +# CONFIG_GPIO_FTGPIO010 is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_GRGPIO=m +CONFIG_GPIO_HISI=m +CONFIG_GPIO_HLWD=m +CONFIG_GPIO_LOGICVC=m +CONFIG_GPIO_MB86S7X=m +CONFIG_GPIO_PL061=y +CONFIG_GPIO_ROCKCHIP=y +# CONFIG_GPIO_SIFIVE is not set +CONFIG_GPIO_SYSCON=y +CONFIG_GPIO_XGENE=y +CONFIG_GPIO_XILINX=y +CONFIG_GPIO_AMD_FCH=m +# end of Memory mapped GPIO drivers + +# +# I2C GPIO expanders +# +CONFIG_GPIO_ADNP=m +# CONFIG_GPIO_FXL6408 is not set +# CONFIG_GPIO_DS4520 is not set +CONFIG_GPIO_GW_PLD=m +CONFIG_GPIO_MAX7300=m +CONFIG_GPIO_MAX732X=m +CONFIG_GPIO_PCA953X=y +CONFIG_GPIO_PCA953X_IRQ=y +CONFIG_GPIO_PCA9570=m +CONFIG_GPIO_PCF857X=m +CONFIG_GPIO_TPIC2810=m +# end of I2C GPIO expanders + +# +# MFD GPIO expanders +# +# CONFIG_GPIO_CROS_EC is not set +# end of MFD GPIO expanders + +# +# PCI GPIO expanders +# +CONFIG_GPIO_PCI_IDIO_16=m +CONFIG_GPIO_PCIE_IDIO_24=m +CONFIG_GPIO_RDC321X=m +# end of PCI GPIO expanders + +# +# SPI GPIO expanders +# +CONFIG_GPIO_74X164=m +CONFIG_GPIO_MAX3191X=m +CONFIG_GPIO_MAX7301=m +CONFIG_GPIO_MC33880=m +CONFIG_GPIO_PISOSR=m +CONFIG_GPIO_XRA1403=m +# end of SPI GPIO expanders + +# +# USB GPIO expanders +# +# end of USB GPIO expanders + +# +# Virtual GPIO drivers +# +CONFIG_GPIO_AGGREGATOR=m +# CONFIG_GPIO_LATCH is not set +CONFIG_GPIO_MOCKUP=m +CONFIG_GPIO_VIRTIO=m +# CONFIG_GPIO_SIM is not set +# end of Virtual GPIO drivers + +# +# GPIO Debugging utilities +# +# CONFIG_GPIO_SLOPPY_LOGIC_ANALYZER is not set +# CONFIG_GPIO_VIRTUSER is not set +# end of GPIO Debugging utilities + +CONFIG_W1=m +CONFIG_W1_CON=y + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_AMD_AXI is not set +CONFIG_W1_MASTER_MATROX=m +CONFIG_W1_MASTER_DS2490=m +CONFIG_W1_MASTER_DS2482=m +CONFIG_W1_MASTER_GPIO=m +CONFIG_W1_MASTER_SGI=m +# CONFIG_W1_MASTER_UART is not set +# end of 1-wire Bus Masters + +# +# 1-wire Slaves +# +CONFIG_W1_SLAVE_THERM=m +CONFIG_W1_SLAVE_SMEM=m +CONFIG_W1_SLAVE_DS2405=m +CONFIG_W1_SLAVE_DS2408=m +CONFIG_W1_SLAVE_DS2408_READBACK=y +CONFIG_W1_SLAVE_DS2413=m +CONFIG_W1_SLAVE_DS2406=m +CONFIG_W1_SLAVE_DS2423=m +CONFIG_W1_SLAVE_DS2805=m +CONFIG_W1_SLAVE_DS2430=m +CONFIG_W1_SLAVE_DS2431=m +CONFIG_W1_SLAVE_DS2433=m +# CONFIG_W1_SLAVE_DS2433_CRC is not set +CONFIG_W1_SLAVE_DS2438=m +CONFIG_W1_SLAVE_DS250X=m +CONFIG_W1_SLAVE_DS2780=m +CONFIG_W1_SLAVE_DS2781=m +CONFIG_W1_SLAVE_DS28E04=m +CONFIG_W1_SLAVE_DS28E17=m +# end of 1-wire Slaves + +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_RESET_GPIO_RESTART=y +# CONFIG_POWER_RESET_LTC2952 is not set +CONFIG_POWER_RESET_REGULATOR=y +CONFIG_POWER_RESET_RESTART=y +CONFIG_POWER_RESET_VEXPRESS=y +CONFIG_POWER_RESET_XGENE=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_REBOOT_MODE=y +CONFIG_SYSCON_REBOOT_MODE=y +# CONFIG_NVMEM_REBOOT_MODE is not set +# CONFIG_POWER_SEQUENCING is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +CONFIG_POWER_SUPPLY_HWMON=y +CONFIG_GENERIC_ADC_BATTERY=m +# CONFIG_IP5XXX_POWER is not set +# CONFIG_TEST_POWER is not set +CONFIG_CHARGER_ADP5061=m +CONFIG_BATTERY_CW2015=m +CONFIG_BATTERY_DS2760=m +CONFIG_BATTERY_DS2780=m +CONFIG_BATTERY_DS2781=m +CONFIG_BATTERY_DS2782=m +# CONFIG_BATTERY_SAMSUNG_SDI is not set +CONFIG_BATTERY_SBS=m +CONFIG_CHARGER_SBS=m +CONFIG_MANAGER_SBS=m +CONFIG_BATTERY_BQ27XXX=m +CONFIG_BATTERY_BQ27XXX_I2C=m +CONFIG_BATTERY_BQ27XXX_HDQ=m +# CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM is not set +CONFIG_BATTERY_MAX17040=m +CONFIG_BATTERY_MAX17042=m +# CONFIG_BATTERY_MAX1720X is not set +CONFIG_BATTERY_MAX1721X=m +CONFIG_CHARGER_ISP1704=m +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +CONFIG_CHARGER_GPIO=m +# CONFIG_CHARGER_MANAGER is not set +CONFIG_CHARGER_LT3651=m +CONFIG_CHARGER_LTC4162L=m +CONFIG_CHARGER_DETECTOR_MAX14656=m +# CONFIG_CHARGER_MAX77976 is not set +# CONFIG_CHARGER_MT6370 is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24257 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ2515X is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_BQ25980 is not set +CONFIG_CHARGER_BQ256XX=m +# CONFIG_CHARGER_RK817 is not set +CONFIG_CHARGER_SMB347=m +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +CONFIG_BATTERY_GOLDFISH=m +CONFIG_BATTERY_RT5033=m +# CONFIG_CHARGER_RT9455 is not set +# CONFIG_CHARGER_RT9467 is not set +# CONFIG_CHARGER_RT9471 is not set +# CONFIG_CHARGER_CROS_USBPD is not set +CONFIG_CHARGER_CROS_PCHG=m +CONFIG_CHARGER_CROS_CONTROL=m +CONFIG_CHARGER_UCS1002=m +# CONFIG_CHARGER_BD99954 is not set +# CONFIG_BATTERY_UG3105 is not set +# CONFIG_FUEL_GAUGE_MM8013 is not set +CONFIG_HWMON=y +CONFIG_HWMON_VID=m +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +CONFIG_SENSORS_AD7314=m +CONFIG_SENSORS_AD7414=m +CONFIG_SENSORS_AD7418=m +CONFIG_SENSORS_ADM1025=m +CONFIG_SENSORS_ADM1026=m +CONFIG_SENSORS_ADM1029=m +CONFIG_SENSORS_ADM1031=m +CONFIG_SENSORS_ADM1177=m +CONFIG_SENSORS_ADM9240=m +CONFIG_SENSORS_ADT7X10=m +CONFIG_SENSORS_ADT7310=m +CONFIG_SENSORS_ADT7410=m +CONFIG_SENSORS_ADT7411=m +CONFIG_SENSORS_ADT7462=m +CONFIG_SENSORS_ADT7470=m +CONFIG_SENSORS_ADT7475=m +CONFIG_SENSORS_AHT10=m +CONFIG_SENSORS_AQUACOMPUTER_D5NEXT=m +CONFIG_SENSORS_AS370=m +CONFIG_SENSORS_ASC7621=m +# CONFIG_SENSORS_ASUS_ROG_RYUJIN is not set +CONFIG_SENSORS_AXI_FAN_CONTROL=m +CONFIG_SENSORS_ARM_SCMI=m +CONFIG_SENSORS_ARM_SCPI=m +CONFIG_SENSORS_ATXP1=m +# CONFIG_SENSORS_CHIPCAP2 is not set +# CONFIG_SENSORS_CORSAIR_CPRO is not set +CONFIG_SENSORS_CORSAIR_PSU=m +CONFIG_SENSORS_CROS_EC=y +CONFIG_SENSORS_DRIVETEMP=m +CONFIG_SENSORS_DS620=m +CONFIG_SENSORS_DS1621=m +CONFIG_SENSORS_I5K_AMB=m +CONFIG_SENSORS_F71805F=m +CONFIG_SENSORS_F71882FG=m +CONFIG_SENSORS_F75375S=m +CONFIG_SENSORS_FTSTEUTATES=m +# CONFIG_SENSORS_GIGABYTE_WATERFORCE is not set +CONFIG_SENSORS_GL518SM=m +CONFIG_SENSORS_GL520SM=m +CONFIG_SENSORS_G760A=m +CONFIG_SENSORS_G762=m +CONFIG_SENSORS_GPIO_FAN=m +CONFIG_SENSORS_HIH6130=m +# CONFIG_SENSORS_HS3001 is not set +CONFIG_SENSORS_IBMAEM=m +CONFIG_SENSORS_IBMPEX=m +CONFIG_SENSORS_IIO_HWMON=m +CONFIG_SENSORS_IT87=m +CONFIG_SENSORS_JC42=m +# CONFIG_SENSORS_POWERZ is not set +CONFIG_SENSORS_POWR1220=m +CONFIG_SENSORS_LINEAGE=m +CONFIG_SENSORS_LTC2945=m +CONFIG_SENSORS_LTC2947=m +CONFIG_SENSORS_LTC2947_I2C=m +CONFIG_SENSORS_LTC2947_SPI=m +CONFIG_SENSORS_LTC2990=m +# CONFIG_SENSORS_LTC2991 is not set +CONFIG_SENSORS_LTC2992=m +CONFIG_SENSORS_LTC4151=m +CONFIG_SENSORS_LTC4215=m +CONFIG_SENSORS_LTC4222=m +CONFIG_SENSORS_LTC4245=m +CONFIG_SENSORS_LTC4260=m +CONFIG_SENSORS_LTC4261=m +# CONFIG_SENSORS_LTC4282 is not set +CONFIG_SENSORS_MAX1111=m +CONFIG_SENSORS_MAX127=m +CONFIG_SENSORS_MAX16065=m +CONFIG_SENSORS_MAX1619=m +CONFIG_SENSORS_MAX1668=m +CONFIG_SENSORS_MAX197=m +CONFIG_SENSORS_MAX31722=m +CONFIG_SENSORS_MAX31730=m +CONFIG_SENSORS_MAX31760=m +# CONFIG_MAX31827 is not set +CONFIG_SENSORS_MAX6620=m +CONFIG_SENSORS_MAX6621=m +CONFIG_SENSORS_MAX6639=m +CONFIG_SENSORS_MAX6650=m +CONFIG_SENSORS_MAX6697=m +CONFIG_SENSORS_MAX31790=m +# CONFIG_SENSORS_MC34VR500 is not set +CONFIG_SENSORS_MCP3021=m +CONFIG_SENSORS_TC654=m +CONFIG_SENSORS_TPS23861=m +# CONFIG_SENSORS_MR75203 is not set +CONFIG_SENSORS_ADCXX=m +CONFIG_SENSORS_LM63=m +CONFIG_SENSORS_LM70=m +CONFIG_SENSORS_LM73=m +CONFIG_SENSORS_LM75=m +CONFIG_SENSORS_LM77=m +CONFIG_SENSORS_LM78=m +CONFIG_SENSORS_LM80=m +CONFIG_SENSORS_LM83=m +CONFIG_SENSORS_LM85=m +CONFIG_SENSORS_LM87=m +CONFIG_SENSORS_LM90=m +CONFIG_SENSORS_LM92=m +CONFIG_SENSORS_LM93=m +CONFIG_SENSORS_LM95234=m +CONFIG_SENSORS_LM95241=m +CONFIG_SENSORS_LM95245=m +CONFIG_SENSORS_PC87360=m +CONFIG_SENSORS_PC87427=m +CONFIG_SENSORS_NTC_THERMISTOR=m +CONFIG_SENSORS_NCT6683=m +CONFIG_SENSORS_NCT6775_CORE=m +CONFIG_SENSORS_NCT6775=m +CONFIG_SENSORS_NCT6775_I2C=m +CONFIG_SENSORS_NCT7802=m +CONFIG_SENSORS_NCT7904=m +CONFIG_SENSORS_NPCM7XX=m +CONFIG_SENSORS_NZXT_KRAKEN2=m +# CONFIG_SENSORS_NZXT_KRAKEN3 is not set +# CONFIG_SENSORS_NZXT_SMART2 is not set +CONFIG_SENSORS_OCC_P8_I2C=m +CONFIG_SENSORS_OCC=m +CONFIG_SENSORS_PCF8591=m +CONFIG_PMBUS=m +CONFIG_SENSORS_PMBUS=m +# CONFIG_SENSORS_ACBEL_FSG032 is not set +# CONFIG_SENSORS_ADM1266 is not set +CONFIG_SENSORS_ADM1275=m +# CONFIG_SENSORS_ADP1050 is not set +CONFIG_SENSORS_BEL_PFE=m +CONFIG_SENSORS_BPA_RS600=m +# CONFIG_SENSORS_DELTA_AHE50DC_FAN is not set +CONFIG_SENSORS_FSP_3Y=m +CONFIG_SENSORS_IBM_CFFPS=m +CONFIG_SENSORS_DPS920AB=m +CONFIG_SENSORS_INSPUR_IPSPS=m +CONFIG_SENSORS_IR35221=m +CONFIG_SENSORS_IR36021=m +CONFIG_SENSORS_IR38064=m +# CONFIG_SENSORS_IR38064_REGULATOR is not set +CONFIG_SENSORS_IRPS5401=m +CONFIG_SENSORS_ISL68137=m +CONFIG_SENSORS_LM25066=m +# CONFIG_SENSORS_LM25066_REGULATOR is not set +CONFIG_SENSORS_LT7182S=m +CONFIG_SENSORS_LTC2978=m +CONFIG_SENSORS_LTC2978_REGULATOR=y +CONFIG_SENSORS_LTC3815=m +# CONFIG_SENSORS_LTC4286 is not set +CONFIG_SENSORS_MAX15301=m +CONFIG_SENSORS_MAX16064=m +CONFIG_SENSORS_MAX16601=m +CONFIG_SENSORS_MAX20730=m +CONFIG_SENSORS_MAX20751=m +CONFIG_SENSORS_MAX31785=m +CONFIG_SENSORS_MAX34440=m +CONFIG_SENSORS_MAX8688=m +# CONFIG_SENSORS_MP2856 is not set +CONFIG_SENSORS_MP2888=m +# CONFIG_SENSORS_MP2891 is not set +# CONFIG_SENSORS_MP2975 is not set +# CONFIG_SENSORS_MP2993 is not set +# CONFIG_SENSORS_MP5023 is not set +# CONFIG_SENSORS_MP5920 is not set +# CONFIG_SENSORS_MP5990 is not set +# CONFIG_SENSORS_MP9941 is not set +# CONFIG_SENSORS_MPQ7932 is not set +# CONFIG_SENSORS_MPQ8785 is not set +CONFIG_SENSORS_PIM4328=m +# CONFIG_SENSORS_PLI1209BC is not set +CONFIG_SENSORS_PM6764TR=m +CONFIG_SENSORS_PXE1610=m +CONFIG_SENSORS_Q54SJ108A2=m +CONFIG_SENSORS_STPDDC60=m +# CONFIG_SENSORS_TDA38640 is not set +CONFIG_SENSORS_TPS40422=m +CONFIG_SENSORS_TPS53679=m +CONFIG_SENSORS_TPS546D24=m +CONFIG_SENSORS_UCD9000=m +CONFIG_SENSORS_UCD9200=m +# CONFIG_SENSORS_XDP710 is not set +CONFIG_SENSORS_XDPE152=m +CONFIG_SENSORS_XDPE122=m +# CONFIG_SENSORS_XDPE122_REGULATOR is not set +CONFIG_SENSORS_ZL6100=m +# CONFIG_SENSORS_PT5161L is not set +CONFIG_SENSORS_PWM_FAN=m +CONFIG_SENSORS_SBTSI=m +CONFIG_SENSORS_SBRMI=m +CONFIG_SENSORS_SHT15=m +CONFIG_SENSORS_SHT21=m +CONFIG_SENSORS_SHT3x=m +CONFIG_SENSORS_SHT4x=m +CONFIG_SENSORS_SHTC1=m +CONFIG_SENSORS_SIS5595=m +CONFIG_SENSORS_DME1737=m +CONFIG_SENSORS_EMC1403=m +CONFIG_SENSORS_EMC2103=m +CONFIG_SENSORS_EMC2305=m +CONFIG_SENSORS_EMC6W201=m +CONFIG_SENSORS_SMSC47M1=m +CONFIG_SENSORS_SMSC47M192=m +CONFIG_SENSORS_SMSC47B397=m +CONFIG_SENSORS_SCH56XX_COMMON=m +CONFIG_SENSORS_SCH5627=m +CONFIG_SENSORS_SCH5636=m +CONFIG_SENSORS_STTS751=m +CONFIG_SENSORS_ADC128D818=m +CONFIG_SENSORS_ADS7828=m +CONFIG_SENSORS_ADS7871=m +CONFIG_SENSORS_AMC6821=m +CONFIG_SENSORS_INA209=m +CONFIG_SENSORS_INA2XX=m +# CONFIG_SENSORS_INA238 is not set +CONFIG_SENSORS_INA3221=m +# CONFIG_SENSORS_SPD5118 is not set +CONFIG_SENSORS_TC74=m +CONFIG_SENSORS_THMC50=m +CONFIG_SENSORS_TMP102=m +CONFIG_SENSORS_TMP103=m +CONFIG_SENSORS_TMP108=m +CONFIG_SENSORS_TMP401=m +CONFIG_SENSORS_TMP421=m +# CONFIG_SENSORS_TMP464 is not set +CONFIG_SENSORS_TMP513=m +CONFIG_SENSORS_VEXPRESS=m +CONFIG_SENSORS_VIA686A=m +CONFIG_SENSORS_VT1211=m +CONFIG_SENSORS_VT8231=m +CONFIG_SENSORS_W83773G=m +CONFIG_SENSORS_W83781D=m +CONFIG_SENSORS_W83791D=m +CONFIG_SENSORS_W83792D=m +CONFIG_SENSORS_W83793=m +CONFIG_SENSORS_W83795=m +# CONFIG_SENSORS_W83795_FANCTRL is not set +CONFIG_SENSORS_W83L785TS=m +CONFIG_SENSORS_W83L786NG=m +CONFIG_SENSORS_W83627HF=m +CONFIG_SENSORS_W83627EHF=m +CONFIG_SENSORS_XGENE=m + +# +# ACPI drivers +# +CONFIG_SENSORS_ACPI_POWER=m +CONFIG_THERMAL=y +# CONFIG_THERMAL_NETLINK is not set +CONFIG_THERMAL_STATISTICS=y +# CONFIG_THERMAL_DEBUGFS is not set +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_HWMON=y +CONFIG_THERMAL_OF=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set +# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set +# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set +# CONFIG_THERMAL_DEFAULT_GOV_BANG_BANG is not set +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_GOV_BANG_BANG=y +CONFIG_THERMAL_GOV_USER_SPACE=y +CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y +CONFIG_CPU_THERMAL=y +CONFIG_CPU_FREQ_THERMAL=y +CONFIG_DEVFREQ_THERMAL=y +CONFIG_THERMAL_EMULATION=y +CONFIG_THERMAL_MMIO=m +CONFIG_ROCKCHIP_THERMAL=y +# CONFIG_GENERIC_ADC_THERMAL is not set +CONFIG_KHADAS_MCU_FAN_THERMAL=m +CONFIG_WATCHDOG=y +CONFIG_WATCHDOG_CORE=y +# CONFIG_WATCHDOG_NOWAYOUT is not set +CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y +CONFIG_WATCHDOG_OPEN_TIMEOUT=0 +CONFIG_WATCHDOG_SYSFS=y +# CONFIG_WATCHDOG_HRTIMER_PRETIMEOUT is not set + +# +# Watchdog Pretimeout Governors +# +# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set + +# +# Watchdog Device Drivers +# +CONFIG_SOFT_WATCHDOG=m +# CONFIG_CROS_EC_WATCHDOG is not set +CONFIG_GPIO_WATCHDOG=m +CONFIG_WDAT_WDT=m +# CONFIG_XILINX_WATCHDOG is not set +# CONFIG_XILINX_WINDOW_WATCHDOG is not set +# CONFIG_ZIIRAVE_WATCHDOG is not set +CONFIG_ARM_SP805_WATCHDOG=y +CONFIG_ARM_SBSA_WATCHDOG=y +# CONFIG_CADENCE_WATCHDOG is not set +CONFIG_DW_WATCHDOG=y +# CONFIG_MAX63XX_WATCHDOG is not set +CONFIG_ARM_SMC_WATCHDOG=y +# CONFIG_ALIM7101_WDT is not set +# CONFIG_I6300ESB_WDT is not set +# CONFIG_HP_WATCHDOG is not set +# CONFIG_MEN_A21_WDT is not set +# CONFIG_XEN_WDT is not set + +# +# PCI-based Watchdog Cards +# +CONFIG_PCIPCWATCHDOG=m +CONFIG_WDTPCI=m + +# +# USB-based Watchdog Cards +# +CONFIG_USBPCWATCHDOG=m +CONFIG_SSB_POSSIBLE=y +CONFIG_SSB=m +CONFIG_SSB_SPROM=y +CONFIG_SSB_BLOCKIO=y +CONFIG_SSB_PCIHOST_POSSIBLE=y +CONFIG_SSB_PCIHOST=y +CONFIG_SSB_B43_PCI_BRIDGE=y +CONFIG_SSB_SDIOHOST_POSSIBLE=y +CONFIG_SSB_SDIOHOST=y +CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y +CONFIG_SSB_DRIVER_PCICORE=y +CONFIG_SSB_DRIVER_GPIO=y +CONFIG_BCMA_POSSIBLE=y +CONFIG_BCMA=m +CONFIG_BCMA_BLOCKIO=y +CONFIG_BCMA_HOST_PCI_POSSIBLE=y +CONFIG_BCMA_HOST_PCI=y +CONFIG_BCMA_HOST_SOC=y +CONFIG_BCMA_DRIVER_PCI=y +CONFIG_BCMA_SFLASH=y +CONFIG_BCMA_DRIVER_GMAC_CMN=y +CONFIG_BCMA_DRIVER_GPIO=y +CONFIG_BCMA_DEBUG=y + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_ACT8945A is not set +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_SMPRO is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_BD9571MWV is not set +# CONFIG_MFD_AXP20X_I2C is not set +CONFIG_MFD_CROS_EC_DEV=y +# CONFIG_MFD_CS42L43_I2C is not set +# CONFIG_MFD_CS42L43_SDW is not set +# CONFIG_MFD_MADERA is not set +# CONFIG_MFD_MAX5970 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_SPI is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_GATEWORKS_GSC is not set +# CONFIG_MFD_MC13XXX_SPI is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_MP2629 is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_MFD_HI6421_SPMI is not set +# CONFIG_LPC_ICH is not set +# CONFIG_LPC_SCH is not set +# CONFIG_MFD_IQS62X is not set +# CONFIG_MFD_JANZ_CMODIO is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_88PM886_PMIC is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77541 is not set +# CONFIG_MFD_MAX77620 is not set +# CONFIG_MFD_MAX77650 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77714 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6360 is not set +CONFIG_MFD_MT6370=m +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +CONFIG_MFD_OCELOT=m +# CONFIG_EZX_PCAP is not set +# CONFIG_MFD_CPCAP is not set +# CONFIG_MFD_VIPERBOARD is not set +CONFIG_MFD_NTXEC=m +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_MFD_SY7636A is not set +CONFIG_MFD_RDC321X=m +# CONFIG_MFD_RT4831 is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RT5120 is not set +# CONFIG_MFD_RC5T583 is not set +CONFIG_MFD_RK8XX=m +CONFIG_MFD_RK8XX_I2C=m +CONFIG_MFD_RK8XX_SPI=m +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +CONFIG_MFD_SIMPLE_MFD_I2C=m +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_TI_LMU is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65086 is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TI_LP873X is not set +# CONFIG_MFD_TI_LP87565 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS65219 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS65912_SPI is not set +# CONFIG_MFD_TPS6594_I2C is not set +# CONFIG_MFD_TPS6594_SPI is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +CONFIG_MFD_WL1273_CORE=m +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TQMX86 is not set +# CONFIG_MFD_VX855 is not set +# CONFIG_MFD_LOCHNAGAR is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_ARIZONA_SPI is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM831X_SPI is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +# CONFIG_MFD_ROHM_BD718XX is not set +# CONFIG_MFD_ROHM_BD71828 is not set +# CONFIG_MFD_ROHM_BD957XMUF is not set +# CONFIG_MFD_ROHM_BD96801 is not set +# CONFIG_MFD_STPMIC1 is not set +CONFIG_MFD_STMFX=m +# CONFIG_MFD_WCD934X is not set +# CONFIG_MFD_ATC260X_I2C is not set +CONFIG_MFD_KHADAS_MCU=m +# CONFIG_MFD_QCOM_PM8008 is not set +# CONFIG_MFD_CS40L50_I2C is not set +# CONFIG_MFD_CS40L50_SPI is not set +CONFIG_MFD_VEXPRESS_SYSREG=y +# CONFIG_RAVE_SP_CORE is not set +# CONFIG_MFD_INTEL_M10_BMC_SPI is not set +CONFIG_MFD_RSMU_I2C=m +CONFIG_MFD_RSMU_SPI=m +# end of Multifunction device drivers + +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_NETLINK_EVENTS is not set +# CONFIG_REGULATOR_88PG86X is not set +CONFIG_REGULATOR_ACT8865=y +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ARM_SCMI is not set +# CONFIG_REGULATOR_AW37503 is not set +# CONFIG_REGULATOR_CROS_EC is not set +# CONFIG_REGULATOR_DA9121 is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +CONFIG_REGULATOR_FAN53555=y +CONFIG_REGULATOR_FAN53880=m +CONFIG_REGULATOR_GPIO=y +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX77503 is not set +# CONFIG_REGULATOR_MAX77857 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +CONFIG_REGULATOR_MAX8893=m +# CONFIG_REGULATOR_MAX8952 is not set +CONFIG_REGULATOR_MAX8973=y +# CONFIG_REGULATOR_MAX20086 is not set +# CONFIG_REGULATOR_MAX20411 is not set +# CONFIG_REGULATOR_MAX77826 is not set +CONFIG_REGULATOR_MCP16502=m +CONFIG_REGULATOR_MP5416=m +CONFIG_REGULATOR_MP8859=m +CONFIG_REGULATOR_MP886X=m +CONFIG_REGULATOR_MPQ7920=m +# CONFIG_REGULATOR_MT6311 is not set +CONFIG_REGULATOR_MT6315=m +CONFIG_REGULATOR_MT6370=m +CONFIG_REGULATOR_PCA9450=y +CONFIG_REGULATOR_PF8X00=m +CONFIG_REGULATOR_PFUZE100=m +# CONFIG_REGULATOR_PV88060 is not set +# CONFIG_REGULATOR_PV88080 is not set +# CONFIG_REGULATOR_PV88090 is not set +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_QCOM_SPMI=y +# CONFIG_REGULATOR_QCOM_USB_VBUS is not set +# CONFIG_REGULATOR_RAA215300 is not set +# CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY is not set +CONFIG_REGULATOR_RK808=m +# CONFIG_REGULATOR_RT4801 is not set +# CONFIG_REGULATOR_RT4803 is not set +# CONFIG_REGULATOR_RT5190A is not set +# CONFIG_REGULATOR_RT5739 is not set +CONFIG_REGULATOR_RT5759=m +CONFIG_REGULATOR_RT6160=m +# CONFIG_REGULATOR_RT6190 is not set +CONFIG_REGULATOR_RT6245=m +CONFIG_REGULATOR_RTQ2134=m +# CONFIG_REGULATOR_RTMV20 is not set +CONFIG_REGULATOR_RTQ6752=m +# CONFIG_REGULATOR_RTQ2208 is not set +CONFIG_REGULATOR_SLG51000=m +# CONFIG_REGULATOR_SY8106A is not set +CONFIG_REGULATOR_SY8824X=m +# CONFIG_REGULATOR_SY8827N is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS6286X is not set +# CONFIG_REGULATOR_TPS6287X is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS65132 is not set +# CONFIG_REGULATOR_TPS6524X is not set +CONFIG_REGULATOR_VCTRL=m +CONFIG_REGULATOR_VEXPRESS=m +# CONFIG_REGULATOR_QCOM_LABIBB is not set +CONFIG_RC_CORE=m +CONFIG_LIRC=y +CONFIG_RC_MAP=m +CONFIG_RC_DECODERS=y +CONFIG_IR_IMON_DECODER=m +CONFIG_IR_JVC_DECODER=m +CONFIG_IR_MCE_KBD_DECODER=m +CONFIG_IR_NEC_DECODER=m +CONFIG_IR_RC5_DECODER=m +CONFIG_IR_RC6_DECODER=m +CONFIG_IR_RCMM_DECODER=m +CONFIG_IR_SANYO_DECODER=m +CONFIG_IR_SHARP_DECODER=m +CONFIG_IR_SONY_DECODER=m +CONFIG_IR_XMP_DECODER=m +CONFIG_RC_DEVICES=y +CONFIG_IR_ENE=m +CONFIG_IR_FINTEK=m +CONFIG_IR_GPIO_CIR=m +CONFIG_IR_GPIO_TX=m +CONFIG_IR_HIX5HD2=m +CONFIG_IR_IGORPLUGUSB=m +CONFIG_IR_IGUANA=m +CONFIG_IR_IMON=m +CONFIG_IR_IMON_RAW=m +CONFIG_IR_ITE_CIR=m +CONFIG_IR_MCEUSB=m +CONFIG_IR_NUVOTON=m +CONFIG_IR_PWM_TX=m +CONFIG_IR_REDRAT3=m +CONFIG_IR_SERIAL=m +CONFIG_IR_SERIAL_TRANSMITTER=y +CONFIG_IR_SPI=m +CONFIG_IR_STREAMZAP=m +CONFIG_IR_TOY=m +CONFIG_IR_TTUSBIR=m +CONFIG_RC_ATI_REMOTE=m +CONFIG_RC_LOOPBACK=m +CONFIG_RC_XBOX_DVD=m +CONFIG_CEC_CORE=m +CONFIG_CEC_NOTIFIER=y +CONFIG_CEC_PIN=y + +# +# CEC support +# +# CONFIG_MEDIA_CEC_RC is not set +CONFIG_CEC_PIN_ERROR_INJ=y +CONFIG_MEDIA_CEC_SUPPORT=y +CONFIG_CEC_CH7322=m +CONFIG_CEC_CROS_EC=m +CONFIG_CEC_GPIO=m +CONFIG_USB_PULSE8_CEC=m +CONFIG_USB_RAINSHADOW_CEC=m +# end of CEC support + +CONFIG_MEDIA_SUPPORT=m +CONFIG_MEDIA_SUPPORT_FILTER=y +CONFIG_MEDIA_SUBDRV_AUTOSELECT=y + +# +# Media device types +# +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +CONFIG_MEDIA_SDR_SUPPORT=y +CONFIG_MEDIA_PLATFORM_SUPPORT=y +CONFIG_MEDIA_TEST_SUPPORT=y +# end of Media device types + +CONFIG_VIDEO_DEV=m +CONFIG_MEDIA_CONTROLLER=y +CONFIG_DVB_CORE=m + +# +# Video4Linux options +# +CONFIG_VIDEO_V4L2_I2C=y +CONFIG_VIDEO_V4L2_SUBDEV_API=y +# CONFIG_VIDEO_ADV_DEBUG is not set +CONFIG_VIDEO_FIXED_MINOR_RANGES=y +CONFIG_VIDEO_TUNER=m +CONFIG_V4L2_JPEG_HELPER=m +CONFIG_V4L2_H264=m +CONFIG_V4L2_VP9=m +CONFIG_V4L2_MEM2MEM_DEV=m +CONFIG_V4L2_FLASH_LED_CLASS=m +CONFIG_V4L2_FWNODE=m +CONFIG_V4L2_ASYNC=m +CONFIG_V4L2_CCI=m +CONFIG_V4L2_CCI_I2C=m +# end of Video4Linux options + +# +# Media controller options +# +CONFIG_MEDIA_CONTROLLER_DVB=y +# end of Media controller options + +# +# Digital TV options +# +CONFIG_DVB_MMAP=y +CONFIG_DVB_NET=y +CONFIG_DVB_MAX_ADAPTERS=16 +CONFIG_DVB_DYNAMIC_MINORS=y +CONFIG_DVB_DEMUX_SECTION_LOSS_LOG=y +# CONFIG_DVB_ULE_DEBUG is not set +# end of Digital TV options + +# +# Media drivers +# + +# +# Drivers filtered as selected at 'Filter media drivers' +# + +# +# Media drivers +# +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +CONFIG_USB_GSPCA=m +CONFIG_USB_GSPCA_BENQ=m +CONFIG_USB_GSPCA_CONEX=m +CONFIG_USB_GSPCA_CPIA1=m +CONFIG_USB_GSPCA_DTCS033=m +CONFIG_USB_GSPCA_ETOMS=m +CONFIG_USB_GSPCA_FINEPIX=m +CONFIG_USB_GSPCA_JEILINJ=m +CONFIG_USB_GSPCA_JL2005BCD=m +CONFIG_USB_GSPCA_KINECT=m +CONFIG_USB_GSPCA_KONICA=m +CONFIG_USB_GSPCA_MARS=m +CONFIG_USB_GSPCA_MR97310A=m +CONFIG_USB_GSPCA_NW80X=m +CONFIG_USB_GSPCA_OV519=m +CONFIG_USB_GSPCA_OV534=m +CONFIG_USB_GSPCA_OV534_9=m +CONFIG_USB_GSPCA_PAC207=m +CONFIG_USB_GSPCA_PAC7302=m +CONFIG_USB_GSPCA_PAC7311=m +CONFIG_USB_GSPCA_SE401=m +CONFIG_USB_GSPCA_SN9C2028=m +CONFIG_USB_GSPCA_SN9C20X=m +CONFIG_USB_GSPCA_SONIXB=m +CONFIG_USB_GSPCA_SONIXJ=m +CONFIG_USB_GSPCA_SPCA1528=m +CONFIG_USB_GSPCA_SPCA500=m +CONFIG_USB_GSPCA_SPCA501=m +CONFIG_USB_GSPCA_SPCA505=m +CONFIG_USB_GSPCA_SPCA506=m +CONFIG_USB_GSPCA_SPCA508=m +CONFIG_USB_GSPCA_SPCA561=m +CONFIG_USB_GSPCA_SQ905=m +CONFIG_USB_GSPCA_SQ905C=m +CONFIG_USB_GSPCA_SQ930X=m +CONFIG_USB_GSPCA_STK014=m +CONFIG_USB_GSPCA_STK1135=m +CONFIG_USB_GSPCA_STV0680=m +CONFIG_USB_GSPCA_SUNPLUS=m +CONFIG_USB_GSPCA_T613=m +CONFIG_USB_GSPCA_TOPRO=m +CONFIG_USB_GSPCA_TOUPTEK=m +CONFIG_USB_GSPCA_TV8532=m +CONFIG_USB_GSPCA_VC032X=m +CONFIG_USB_GSPCA_VICAM=m +CONFIG_USB_GSPCA_XIRLINK_CIT=m +CONFIG_USB_GSPCA_ZC3XX=m +CONFIG_USB_GL860=m +CONFIG_USB_M5602=m +CONFIG_USB_STV06XX=m +CONFIG_USB_PWC=m +# CONFIG_USB_PWC_DEBUG is not set +CONFIG_USB_PWC_INPUT_EVDEV=y +CONFIG_USB_S2255=m +CONFIG_VIDEO_USBTV=m +CONFIG_USB_VIDEO_CLASS=m +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y + +# +# Analog TV USB devices +# +CONFIG_VIDEO_GO7007=m +CONFIG_VIDEO_GO7007_USB=m +CONFIG_VIDEO_GO7007_LOADER=m +CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set +CONFIG_VIDEO_STK1160=m + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +CONFIG_VIDEO_CX231XX_ALSA=m +CONFIG_VIDEO_CX231XX_DVB=m + +# +# Digital TV USB devices +# +CONFIG_DVB_AS102=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_ZD1301=m +CONFIG_DVB_USB=m +# CONFIG_DVB_USB_DEBUG is not set +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_CXUSB=m +# CONFIG_DVB_USB_CXUSB_ANALOG is not set +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_DIB3000MC=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_VP7045=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_TTUSB_BUDGET=m +CONFIG_DVB_TTUSB_DEC=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +CONFIG_VIDEO_EM28XX_V4L2=m +CONFIG_VIDEO_EM28XX_ALSA=m +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# Software defined radio USB devices +# +CONFIG_USB_AIRSPY=m +CONFIG_USB_HACKRF=m +CONFIG_USB_MSI2500=m +CONFIG_MEDIA_PCI_SUPPORT=y + +# +# Media capture support +# +# CONFIG_VIDEO_MGB4 is not set +CONFIG_VIDEO_SOLO6X10=m +# CONFIG_VIDEO_TW5864 is not set +CONFIG_VIDEO_TW68=m +# CONFIG_VIDEO_TW686X is not set +CONFIG_VIDEO_ZORAN=m +# CONFIG_VIDEO_ZORAN_DC30 is not set +# CONFIG_VIDEO_ZORAN_ZR36060 is not set + +# +# Media capture/analog TV support +# +CONFIG_VIDEO_DT3155=m +CONFIG_VIDEO_IVTV=m +CONFIG_VIDEO_IVTV_ALSA=m +CONFIG_VIDEO_FB_IVTV=m +CONFIG_VIDEO_HEXIUM_GEMINI=m +CONFIG_VIDEO_HEXIUM_ORION=m +CONFIG_VIDEO_MXB=m + +# +# Media capture/analog/hybrid TV support +# +CONFIG_VIDEO_BT848=m +CONFIG_DVB_BT8XX=m +CONFIG_VIDEO_CX18=m +CONFIG_VIDEO_CX18_ALSA=m +CONFIG_VIDEO_CX23885=m +CONFIG_MEDIA_ALTERA_CI=m +CONFIG_VIDEO_CX25821=m +CONFIG_VIDEO_CX25821_ALSA=m +CONFIG_VIDEO_CX88=m +CONFIG_VIDEO_CX88_ALSA=m +CONFIG_VIDEO_CX88_BLACKBIRD=m +CONFIG_VIDEO_CX88_DVB=m +CONFIG_VIDEO_CX88_ENABLE_VP3054=y +CONFIG_VIDEO_CX88_VP3054=m +CONFIG_VIDEO_CX88_MPEG=m +CONFIG_VIDEO_SAA7134=m +CONFIG_VIDEO_SAA7134_ALSA=m +CONFIG_VIDEO_SAA7134_RC=y +CONFIG_VIDEO_SAA7134_DVB=m +CONFIG_VIDEO_SAA7134_GO7007=m +CONFIG_VIDEO_SAA7164=m + +# +# Media digital TV PCI Adapters +# +CONFIG_DVB_B2C2_FLEXCOP_PCI=m +# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set +CONFIG_DVB_DDBRIDGE=m +# CONFIG_DVB_DDBRIDGE_MSIENABLE is not set +CONFIG_DVB_DM1105=m +CONFIG_MANTIS_CORE=m +CONFIG_DVB_MANTIS=m +CONFIG_DVB_HOPPER=m +# CONFIG_DVB_NETUP_UNIDVB is not set +CONFIG_DVB_NGENE=m +CONFIG_DVB_PLUTO2=m +CONFIG_DVB_PT1=m +CONFIG_DVB_PT3=m +CONFIG_DVB_SMIPCIE=m +CONFIG_DVB_BUDGET_CORE=m +CONFIG_DVB_BUDGET=m +CONFIG_DVB_BUDGET_CI=m +CONFIG_DVB_BUDGET_AV=m +# CONFIG_IPU_BRIDGE is not set +CONFIG_RADIO_ADAPTERS=m +CONFIG_RADIO_MAXIRADIO=m +CONFIG_RADIO_SAA7706H=m +CONFIG_RADIO_SHARK=m +CONFIG_RADIO_SHARK2=m +CONFIG_RADIO_SI4713=m +CONFIG_RADIO_TEA575X=m +CONFIG_RADIO_TEA5764=m +CONFIG_RADIO_TEF6862=m +CONFIG_RADIO_WL1273=m +CONFIG_USB_DSBR=m +CONFIG_USB_KEENE=m +CONFIG_USB_MA901=m +CONFIG_USB_MR800=m +CONFIG_USB_RAREMONO=m +CONFIG_RADIO_SI470X=m +CONFIG_USB_SI470X=m +CONFIG_I2C_SI470X=m +CONFIG_USB_SI4713=m +CONFIG_PLATFORM_SI4713=m +CONFIG_I2C_SI4713=m +CONFIG_MEDIA_PLATFORM_DRIVERS=y +CONFIG_V4L_PLATFORM_DRIVERS=y +CONFIG_SDR_PLATFORM_DRIVERS=y +CONFIG_DVB_PLATFORM_DRIVERS=y +CONFIG_V4L_MEM2MEM_DRIVERS=y +CONFIG_VIDEO_MEM2MEM_DEINTERLACE=m +CONFIG_VIDEO_MUX=m + +# +# Allegro DVT media platform drivers +# + +# +# Amlogic media platform drivers +# + +# +# Amphion drivers +# + +# +# Aspeed media platform drivers +# + +# +# Atmel media platform drivers +# + +# +# Cadence media platform drivers +# +CONFIG_VIDEO_CADENCE_CSI2RX=m +CONFIG_VIDEO_CADENCE_CSI2TX=m + +# +# Chips&Media media platform drivers +# +# CONFIG_VIDEO_E5010_JPEG_ENC is not set + +# +# Intel media platform drivers +# + +# +# Marvell media platform drivers +# +CONFIG_VIDEO_CAFE_CCIC=m + +# +# Mediatek media platform drivers +# + +# +# Microchip Technology, Inc. media platform drivers +# + +# +# Nuvoton media platform drivers +# + +# +# NVidia media platform drivers +# + +# +# NXP media platform drivers +# + +# +# Qualcomm media platform drivers +# + +# +# Raspberry Pi media platform drivers +# +# CONFIG_VIDEO_RASPBERRYPI_PISP_BE is not set + +# +# Renesas media platform drivers +# + +# +# Rockchip media platform drivers +# +CONFIG_VIDEO_ROCKCHIP_RGA=m +CONFIG_VIDEO_ROCKCHIP_ISP1=m +CONFIG_VIDEO_ROCKCHIP_VDEC2=m + +# +# Samsung media platform drivers +# + +# +# STMicroelectronics media platform drivers +# + +# +# Sunxi media platform drivers +# +CONFIG_VIDEO_SYNOPSYS_HDMIRX=m +CONFIG_HDMIRX_LOAD_DEFAULT_EDID=y + +# +# Texas Instruments drivers +# + +# +# Verisilicon media platform drivers +# +CONFIG_VIDEO_HANTRO=m +CONFIG_VIDEO_HANTRO_ROCKCHIP=y + +# +# VIA media platform drivers +# + +# +# Xilinx media platform drivers +# +CONFIG_VIDEO_XILINX=m +CONFIG_VIDEO_XILINX_CSI2RXSS=m +CONFIG_VIDEO_XILINX_TPG=m +CONFIG_VIDEO_XILINX_VTC=m + +# +# MMC/SDIO DVB adapters +# +CONFIG_SMS_SDIO_DRV=m +CONFIG_V4L_TEST_DRIVERS=y +CONFIG_VIDEO_VIM2M=m +CONFIG_VIDEO_VICODEC=m +CONFIG_VIDEO_VIMC=m +CONFIG_VIDEO_VIVID=m +CONFIG_VIDEO_VIVID_CEC=y +CONFIG_VIDEO_VIVID_MAX_DEVS=64 +# CONFIG_VIDEO_VISL is not set +CONFIG_DVB_TEST_DRIVERS=y +CONFIG_DVB_VIDTV=m +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_CYPRESS_FIRMWARE=m +CONFIG_TTPCI_EEPROM=m +CONFIG_UVC_COMMON=m +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_VIDEO_SAA7146=m +CONFIG_VIDEO_SAA7146_VV=m +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y +# CONFIG_SMS_SIANO_DEBUGFS is not set +CONFIG_VIDEO_V4L2_TPG=m +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_V4L2=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_DMA_CONTIG=m +CONFIG_VIDEOBUF2_VMALLOC=m +CONFIG_VIDEOBUF2_DMA_SG=m +CONFIG_VIDEOBUF2_DVB=m +# end of Media drivers + +# +# Media ancillary drivers +# +CONFIG_MEDIA_ATTACH=y + +# +# IR I2C driver auto-selected by 'Autoselect ancillary drivers' +# +CONFIG_VIDEO_IR_I2C=m +CONFIG_VIDEO_CAMERA_SENSOR=y +CONFIG_VIDEO_APTINA_PLL=m +CONFIG_VIDEO_CCS_PLL=m +# CONFIG_VIDEO_ALVIUM_CSI2 is not set +# CONFIG_VIDEO_AR0521 is not set +# CONFIG_VIDEO_GC0308 is not set +# CONFIG_VIDEO_GC05A2 is not set +# CONFIG_VIDEO_GC08A3 is not set +# CONFIG_VIDEO_GC2145 is not set +CONFIG_VIDEO_HI556=m +CONFIG_VIDEO_HI846=m +# CONFIG_VIDEO_HI847 is not set +CONFIG_VIDEO_IMX208=m +CONFIG_VIDEO_IMX214=m +CONFIG_VIDEO_IMX219=m +CONFIG_VIDEO_IMX258=m +CONFIG_VIDEO_IMX274=m +# CONFIG_VIDEO_IMX283 is not set +CONFIG_VIDEO_IMX290=m +# CONFIG_VIDEO_IMX296 is not set +CONFIG_VIDEO_IMX319=m +CONFIG_VIDEO_IMX334=m +CONFIG_VIDEO_IMX335=m +CONFIG_VIDEO_IMX355=m +CONFIG_VIDEO_IMX412=m +# CONFIG_VIDEO_IMX415 is not set +CONFIG_VIDEO_MAX9271_LIB=m +CONFIG_VIDEO_MT9M001=m +CONFIG_VIDEO_MT9M111=m +# CONFIG_VIDEO_MT9M114 is not set +CONFIG_VIDEO_MT9P031=m +CONFIG_VIDEO_MT9T112=m +CONFIG_VIDEO_MT9V011=m +CONFIG_VIDEO_MT9V032=m +CONFIG_VIDEO_MT9V111=m +# CONFIG_VIDEO_OG01A1B is not set +# CONFIG_VIDEO_OV01A10 is not set +CONFIG_VIDEO_OV02A10=m +# CONFIG_VIDEO_OV08D10 is not set +# CONFIG_VIDEO_OV08X40 is not set +CONFIG_VIDEO_OV13858=m +CONFIG_VIDEO_OV13B10=m +CONFIG_VIDEO_OV2640=m +CONFIG_VIDEO_OV2659=m +CONFIG_VIDEO_OV2680=m +CONFIG_VIDEO_OV2685=m +CONFIG_VIDEO_OV2740=m +# CONFIG_VIDEO_OV4689 is not set +CONFIG_VIDEO_OV5640=m +CONFIG_VIDEO_OV5645=m +CONFIG_VIDEO_OV5647=m +CONFIG_VIDEO_OV5648=m +CONFIG_VIDEO_OV5670=m +CONFIG_VIDEO_OV5675=m +# CONFIG_VIDEO_OV5693 is not set +CONFIG_VIDEO_OV5695=m +# CONFIG_VIDEO_OV64A40 is not set +CONFIG_VIDEO_OV6650=m +CONFIG_VIDEO_OV7251=m +CONFIG_VIDEO_OV7640=m +CONFIG_VIDEO_OV7670=m +CONFIG_VIDEO_OV772X=m +CONFIG_VIDEO_OV7740=m +CONFIG_VIDEO_OV8856=m +# CONFIG_VIDEO_OV8858 is not set +CONFIG_VIDEO_OV8865=m +CONFIG_VIDEO_OV9282=m +CONFIG_VIDEO_OV9640=m +CONFIG_VIDEO_OV9650=m +CONFIG_VIDEO_OV9734=m +CONFIG_VIDEO_RDACM20=m +CONFIG_VIDEO_RDACM21=m +CONFIG_VIDEO_RJ54N1=m +CONFIG_VIDEO_S5C73M3=m +CONFIG_VIDEO_S5K5BAF=m +CONFIG_VIDEO_S5K6A3=m +# CONFIG_VIDEO_VGXY61 is not set +CONFIG_VIDEO_CCS=m +CONFIG_VIDEO_ET8EK8=m + +# +# Camera ISPs +# +# CONFIG_VIDEO_THP7312 is not set +# end of Camera ISPs + +# +# Lens drivers +# +CONFIG_VIDEO_AD5820=m +CONFIG_VIDEO_AK7375=m +CONFIG_VIDEO_DW9714=m +# CONFIG_VIDEO_DW9719 is not set +CONFIG_VIDEO_DW9768=m +CONFIG_VIDEO_DW9807_VCM=m +# end of Lens drivers + +# +# Flash devices +# +CONFIG_VIDEO_ADP1653=m +CONFIG_VIDEO_LM3560=m +CONFIG_VIDEO_LM3646=m +# end of Flash devices + +# +# Audio decoders, processors and mixers +# +CONFIG_VIDEO_CS3308=m +CONFIG_VIDEO_CS5345=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_SONY_BTF_MPX=m +# CONFIG_VIDEO_TDA1997X is not set +CONFIG_VIDEO_TDA7432=m +CONFIG_VIDEO_TDA9840=m +CONFIG_VIDEO_TEA6415C=m +CONFIG_VIDEO_TEA6420=m +# CONFIG_VIDEO_TLV320AIC23B is not set +CONFIG_VIDEO_TVAUDIO=m +CONFIG_VIDEO_UDA1342=m +CONFIG_VIDEO_VP27SMPX=m +CONFIG_VIDEO_WM8739=m +CONFIG_VIDEO_WM8775=m +# end of Audio decoders, processors and mixers + +# +# RDS decoders +# +CONFIG_VIDEO_SAA6588=m +# end of RDS decoders + +# +# Video decoders +# +# CONFIG_VIDEO_ADV7180 is not set +# CONFIG_VIDEO_ADV7183 is not set +# CONFIG_VIDEO_ADV748X is not set +# CONFIG_VIDEO_ADV7604 is not set +# CONFIG_VIDEO_ADV7842 is not set +# CONFIG_VIDEO_BT819 is not set +# CONFIG_VIDEO_BT856 is not set +# CONFIG_VIDEO_BT866 is not set +# CONFIG_VIDEO_ISL7998X is not set +# CONFIG_VIDEO_KS0127 is not set +# CONFIG_VIDEO_MAX9286 is not set +# CONFIG_VIDEO_ML86V7667 is not set +# CONFIG_VIDEO_SAA7110 is not set +CONFIG_VIDEO_SAA711X=m +# CONFIG_VIDEO_TC358743 is not set +# CONFIG_VIDEO_TC358746 is not set +# CONFIG_VIDEO_TVP514X is not set +CONFIG_VIDEO_TVP5150=m +# CONFIG_VIDEO_TVP7002 is not set +CONFIG_VIDEO_TW2804=m +# CONFIG_VIDEO_TW9900 is not set +CONFIG_VIDEO_TW9903=m +CONFIG_VIDEO_TW9906=m +# CONFIG_VIDEO_TW9910 is not set +# CONFIG_VIDEO_VPX3220 is not set + +# +# Video and audio decoders +# +CONFIG_VIDEO_SAA717X=m +CONFIG_VIDEO_CX25840=m +# end of Video decoders + +# +# Video encoders +# +# CONFIG_VIDEO_ADV7170 is not set +# CONFIG_VIDEO_ADV7175 is not set +# CONFIG_VIDEO_ADV7343 is not set +# CONFIG_VIDEO_ADV7393 is not set +# CONFIG_VIDEO_AK881X is not set +CONFIG_VIDEO_SAA7127=m +# CONFIG_VIDEO_SAA7185 is not set +# CONFIG_VIDEO_THS8200 is not set +# end of Video encoders + +# +# Video improvement chips +# +CONFIG_VIDEO_UPD64031A=m +CONFIG_VIDEO_UPD64083=m +# end of Video improvement chips + +# +# Audio/Video compression chips +# +CONFIG_VIDEO_SAA6752HS=m +# end of Audio/Video compression chips + +# +# SDR tuner chips +# +# CONFIG_SDR_MAX2175 is not set +# end of SDR tuner chips + +# +# Miscellaneous helper chips +# +# CONFIG_VIDEO_I2C is not set +CONFIG_VIDEO_M52790=m +# CONFIG_VIDEO_ST_MIPID02 is not set +# CONFIG_VIDEO_THS7303 is not set +# end of Miscellaneous helper chips + +# +# Video serializers and deserializers +# +# CONFIG_VIDEO_DS90UB913 is not set +# CONFIG_VIDEO_DS90UB953 is not set +# CONFIG_VIDEO_DS90UB960 is not set +# CONFIG_VIDEO_MAX96714 is not set +# CONFIG_VIDEO_MAX96717 is not set +# end of Video serializers and deserializers + +# +# Media SPI Adapters +# +CONFIG_CXD2880_SPI_DRV=m +CONFIG_VIDEO_GS1662=m +# end of Media SPI Adapters + +CONFIG_MEDIA_TUNER=m + +# +# Customize TV tuners +# +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_M88RS6000T=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MSI001=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2131=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_MXL301RF=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m +CONFIG_MEDIA_TUNER_QM1D1B0004=m +CONFIG_MEDIA_TUNER_QM1D1C0042=m +CONFIG_MEDIA_TUNER_QT1010=m +CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_TDA18250=m +CONFIG_MEDIA_TUNER_TDA18271=m +CONFIG_MEDIA_TUNER_TDA827X=m +CONFIG_MEDIA_TUNER_TDA8290=m +CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_TEA5761=m +CONFIG_MEDIA_TUNER_TEA5767=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_XC2028=m +CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_XC5000=m +# end of Customize TV tuners + +# +# Customise DVB Frontends +# + +# +# Multistandard (satellite) frontends +# +CONFIG_DVB_M88DS3103=m +CONFIG_DVB_MXL5XX=m +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV0910=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_STV6111=m + +# +# Multistandard (cable + terrestrial) frontends +# +CONFIG_DVB_DRXK=m +CONFIG_DVB_MN88472=m +CONFIG_DVB_MN88473=m +CONFIG_DVB_SI2165=m +CONFIG_DVB_TDA18271C2DD=m + +# +# DVB-S (satellite) frontends +# +CONFIG_DVB_CX24110=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24117=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_CX24123=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_MB86A16=m +CONFIG_DVB_MT312=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_TDA10071=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TDA8083=m +CONFIG_DVB_TDA8261=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_TUA6100=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_VES1X93=m +CONFIG_DVB_ZL10036=m +CONFIG_DVB_ZL10039=m + +# +# DVB-T (terrestrial) frontends +# +CONFIG_DVB_AF9013=m +CONFIG_DVB_AS102_FE=m +CONFIG_DVB_CX22700=m +CONFIG_DVB_CX22702=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_CXD2841ER=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +# CONFIG_DVB_DIB9000 is not set +CONFIG_DVB_DRXD=m +CONFIG_DVB_EC100=m +CONFIG_DVB_GP8PSK_FE=m +CONFIG_DVB_L64781=m +CONFIG_DVB_MT352=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_RTL2832_SDR=m +# CONFIG_DVB_S5H1432 is not set +CONFIG_DVB_SI2168=m +CONFIG_DVB_SP887X=m +CONFIG_DVB_STV0367=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_ZD1301_DEMOD=m +CONFIG_DVB_ZL10353=m +# CONFIG_DVB_CXD2880 is not set + +# +# DVB-C (cable) frontends +# +CONFIG_DVB_STV0297=m +CONFIG_DVB_TDA10021=m +CONFIG_DVB_TDA10023=m +CONFIG_DVB_VES1820=m + +# +# ATSC (North American/Korean Terrestrial/Cable DTV) frontends +# +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_MXL692=m +CONFIG_DVB_NXT200X=m +CONFIG_DVB_OR51132=m +CONFIG_DVB_OR51211=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_S5H1411=m + +# +# ISDB-T (terrestrial) frontends +# +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m +CONFIG_DVB_S921=m + +# +# ISDB-S (satellite) & ISDB-T (terrestrial) frontends +# +# CONFIG_DVB_MN88443X is not set +CONFIG_DVB_TC90522=m + +# +# Digital terrestrial only tuners/PLL +# +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m + +# +# SEC control devices for DVB-S +# +CONFIG_DVB_A8293=m +CONFIG_DVB_AF9033=m +# CONFIG_DVB_ASCOT2E is not set +CONFIG_DVB_ATBM8830=m +# CONFIG_DVB_HELENE is not set +# CONFIG_DVB_HORUS3A is not set +CONFIG_DVB_ISL6405=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_IX2505V=m +# CONFIG_DVB_LGS8GL5 is not set +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_LNBH25=m +# CONFIG_DVB_LNBH29 is not set +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_TDA665x=m +CONFIG_DVB_DRX39XYJ=m + +# +# Common Interface (EN50221) controller drivers +# +CONFIG_DVB_CXD2099=m +CONFIG_DVB_SP2=m +# end of Customise DVB Frontends + +# +# Tools to develop new frontends +# +CONFIG_DVB_DUMMY_FE=m +# end of Media ancillary drivers + +# +# Graphics support +# +CONFIG_APERTURE_HELPERS=y +CONFIG_SCREEN_INFO=y +CONFIG_VIDEO=y +# CONFIG_AUXDISPLAY is not set +CONFIG_DRM=m +CONFIG_DRM_MIPI_DBI=m +CONFIG_DRM_MIPI_DSI=y +# CONFIG_DRM_DEBUG_MM is not set +CONFIG_DRM_KUNIT_TEST_HELPERS=m +CONFIG_DRM_KUNIT_TEST=m +CONFIG_DRM_KMS_HELPER=m +# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set +# CONFIG_DRM_DEBUG_MODESET_LOCK is not set +CONFIG_DRM_FBDEV_EMULATION=y +CONFIG_DRM_FBDEV_OVERALLOC=100 +# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set +CONFIG_DRM_LOAD_EDID_FIRMWARE=y +CONFIG_DRM_DISPLAY_HELPER=m +CONFIG_DRM_DISPLAY_DP_AUX_BUS=m +# CONFIG_DRM_DISPLAY_DP_AUX_CEC is not set +# CONFIG_DRM_DISPLAY_DP_AUX_CHARDEV is not set +CONFIG_DRM_DISPLAY_DP_HELPER=y +CONFIG_DRM_DISPLAY_HDCP_HELPER=y +CONFIG_DRM_DISPLAY_HDMI_HELPER=y +CONFIG_DRM_DISPLAY_HDMI_STATE_HELPER=y +CONFIG_DRM_TTM=m +CONFIG_DRM_EXEC=m +CONFIG_DRM_GPUVM=m +CONFIG_DRM_BUDDY=m +CONFIG_DRM_VRAM_HELPER=m +CONFIG_DRM_TTM_HELPER=m +CONFIG_DRM_GEM_DMA_HELPER=m +CONFIG_DRM_GEM_SHMEM_HELPER=m +CONFIG_DRM_SCHED=m + +# +# I2C encoder or helper chips +# +CONFIG_DRM_I2C_CH7006=m +CONFIG_DRM_I2C_SIL164=m +CONFIG_DRM_I2C_NXP_TDA998X=m +CONFIG_DRM_I2C_NXP_TDA9950=m +# end of I2C encoder or helper chips + +# +# ARM devices +# +CONFIG_DRM_HDLCD=m +CONFIG_DRM_HDLCD_SHOW_UNDERRUN=y +# CONFIG_DRM_MALI_DISPLAY is not set +CONFIG_DRM_KOMEDA=m +# end of ARM devices + +# CONFIG_DRM_RADEON is not set +# CONFIG_DRM_AMDGPU is not set +# CONFIG_DRM_NOUVEAU is not set +# CONFIG_DRM_XE is not set +CONFIG_DRM_VGEM=m +# CONFIG_DRM_VKMS is not set +CONFIG_DRM_ROCKCHIP=m +CONFIG_ROCKCHIP_VOP=y +CONFIG_ROCKCHIP_VOP2=y +CONFIG_ROCKCHIP_ANALOGIX_DP=y +CONFIG_ROCKCHIP_CDN_DP=y +CONFIG_ROCKCHIP_DW_HDMI=y +CONFIG_ROCKCHIP_DW_HDMI_QP=y +CONFIG_ROCKCHIP_DW_MIPI_DSI=y +CONFIG_ROCKCHIP_INNO_HDMI=y +CONFIG_ROCKCHIP_LVDS=y +CONFIG_ROCKCHIP_RGB=y +CONFIG_ROCKCHIP_RK3066_HDMI=y +CONFIG_DRM_VMWGFX=m +CONFIG_DRM_UDL=m +CONFIG_DRM_AST=m +CONFIG_DRM_MGAG200=m +CONFIG_DRM_QXL=m +CONFIG_DRM_VIRTIO_GPU=m +CONFIG_DRM_VIRTIO_GPU_KMS=y +CONFIG_DRM_PANEL=y + +# +# Display Panels +# +CONFIG_DRM_PANEL_ABT_Y030XX067A=m +CONFIG_DRM_PANEL_ARM_VERSATILE=m +# CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 is not set +# CONFIG_DRM_PANEL_AUO_A030JTN01 is not set +# CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0 is not set +CONFIG_DRM_PANEL_BOE_HIMAX8279D=m +# CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A is not set +CONFIG_DRM_PANEL_BOE_TV101WUM_NL6=m +# CONFIG_DRM_PANEL_EBBG_FT8719 is not set +CONFIG_DRM_PANEL_ELIDA_KD35T133=m +CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02=m +CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D=m +CONFIG_DRM_PANEL_DSI_CM=m +CONFIG_DRM_PANEL_LVDS=m +# CONFIG_DRM_PANEL_HIMAX_HX83102 is not set +# CONFIG_DRM_PANEL_HIMAX_HX83112A is not set +# CONFIG_DRM_PANEL_HIMAX_HX8394 is not set +CONFIG_DRM_PANEL_ILITEK_IL9322=m +CONFIG_DRM_PANEL_ILITEK_ILI9341=m +# CONFIG_DRM_PANEL_ILITEK_ILI9805 is not set +# CONFIG_DRM_PANEL_ILITEK_ILI9806E is not set +CONFIG_DRM_PANEL_ILITEK_ILI9881C=m +# CONFIG_DRM_PANEL_ILITEK_ILI9882T is not set +CONFIG_DRM_PANEL_INNOLUX_EJ030NA=m +CONFIG_DRM_PANEL_INNOLUX_P079ZCA=m +# CONFIG_DRM_PANEL_JADARD_JD9365DA_H3 is not set +# CONFIG_DRM_PANEL_JDI_LPM102A188A is not set +CONFIG_DRM_PANEL_JDI_LT070ME05000=m +# CONFIG_DRM_PANEL_JDI_R63452 is not set +CONFIG_DRM_PANEL_KHADAS_TS050=m +CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04=m +# CONFIG_DRM_PANEL_LEADTEK_LTK050H3146W is not set +CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829=m +# CONFIG_DRM_PANEL_LINCOLNTECH_LCD197 is not set +CONFIG_DRM_PANEL_LG_LB035Q02=m +# CONFIG_DRM_PANEL_LG_LG4573 is not set +# CONFIG_DRM_PANEL_LG_SW43408 is not set +# CONFIG_DRM_PANEL_MAGNACHIP_D53E6EA8966 is not set +# CONFIG_DRM_PANEL_MANTIX_MLAF057WE51 is not set +CONFIG_DRM_PANEL_NEC_NL8048HL11=m +# CONFIG_DRM_PANEL_NEWVISION_NV3051D is not set +CONFIG_DRM_PANEL_NEWVISION_NV3052C=m +CONFIG_DRM_PANEL_NOVATEK_NT35510=m +CONFIG_DRM_PANEL_NOVATEK_NT35560=m +# CONFIG_DRM_PANEL_NOVATEK_NT35950 is not set +# CONFIG_DRM_PANEL_NOVATEK_NT36523 is not set +CONFIG_DRM_PANEL_NOVATEK_NT36672A=m +# CONFIG_DRM_PANEL_NOVATEK_NT36672E is not set +CONFIG_DRM_PANEL_NOVATEK_NT39016=m +CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO=m +# CONFIG_DRM_PANEL_ORISETECH_OTA5601A is not set +CONFIG_DRM_PANEL_ORISETECH_OTM8009A=m +# CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS is not set +CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00=m +CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m +CONFIG_DRM_PANEL_RAYDIUM_RM67191=m +CONFIG_DRM_PANEL_RAYDIUM_RM68200=m +# CONFIG_DRM_PANEL_RAYDIUM_RM692E5 is not set +# CONFIG_DRM_PANEL_RAYDIUM_RM69380 is not set +CONFIG_DRM_PANEL_RONBO_RB070D30=m +CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01=m +CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20=m +CONFIG_DRM_PANEL_SAMSUNG_DB7430=m +# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E3FA7 is not set +CONFIG_DRM_PANEL_SAMSUNG_S6D16D0=m +CONFIG_DRM_PANEL_SAMSUNG_S6D27A1=m +# CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0 is not set +CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2=m +CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=m +# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set +# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set +CONFIG_DRM_PANEL_SAMSUNG_SOFEF00=m +CONFIG_DRM_PANEL_SEIKO_43WVF1G=m +CONFIG_DRM_PANEL_SHARP_LQ101R1SX01=m +CONFIG_DRM_PANEL_SHARP_LS037V7DW01=m +CONFIG_DRM_PANEL_SHARP_LS043T1LE01=m +CONFIG_DRM_PANEL_SHARP_LS060T1SX01=m +CONFIG_DRM_PANEL_SITRONIX_ST7701=m +# CONFIG_DRM_PANEL_SITRONIX_ST7703 is not set +# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +CONFIG_DRM_PANEL_SONY_ACX565AKM=m +# CONFIG_DRM_PANEL_SONY_TD4353_JDI is not set +# CONFIG_DRM_PANEL_SONY_TULIP_TRULY_NT35521 is not set +# CONFIG_DRM_PANEL_STARTEK_KD070FHFID015 is not set +CONFIG_DRM_PANEL_EDP=m +CONFIG_DRM_PANEL_SIMPLE=m +# CONFIG_DRM_PANEL_SYNAPTICS_R63353 is not set +CONFIG_DRM_PANEL_TDO_TL070WSH30=m +CONFIG_DRM_PANEL_TPO_TD028TTEC1=m +CONFIG_DRM_PANEL_TPO_TD043MTEA1=m +CONFIG_DRM_PANEL_TPO_TPG110=m +CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA=m +# CONFIG_DRM_PANEL_VISIONOX_R66451 is not set +# CONFIG_DRM_PANEL_VISIONOX_RM69299 is not set +# CONFIG_DRM_PANEL_VISIONOX_VTDR6130 is not set +CONFIG_DRM_PANEL_WIDECHIPS_WS2401=m +CONFIG_DRM_PANEL_XINPENG_XPP055C272=m +# end of Display Panels + +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_PANEL_BRIDGE=y + +# +# Display Interface Bridges +# +CONFIG_DRM_CHIPONE_ICN6211=m +CONFIG_DRM_CHRONTEL_CH7033=m +CONFIG_DRM_CROS_EC_ANX7688=m +CONFIG_DRM_DISPLAY_CONNECTOR=m +CONFIG_DRM_ITE_IT6505=m +CONFIG_DRM_LONTIUM_LT8912B=m +CONFIG_DRM_LONTIUM_LT9211=m +CONFIG_DRM_LONTIUM_LT9611=m +CONFIG_DRM_LONTIUM_LT9611UXC=m +CONFIG_DRM_ITE_IT66121=m +CONFIG_DRM_LVDS_CODEC=m +# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set +CONFIG_DRM_NWL_MIPI_DSI=m +# CONFIG_DRM_NXP_PTN3460 is not set +# CONFIG_DRM_PARADE_PS8622 is not set +CONFIG_DRM_PARADE_PS8640=m +# CONFIG_DRM_SAMSUNG_DSIM is not set +# CONFIG_DRM_SIL_SII8620 is not set +CONFIG_DRM_SII902X=m +CONFIG_DRM_SII9234=m +CONFIG_DRM_SIMPLE_BRIDGE=m +CONFIG_DRM_THINE_THC63LVD1024=m +# CONFIG_DRM_TOSHIBA_TC358762 is not set +CONFIG_DRM_TOSHIBA_TC358764=m +# CONFIG_DRM_TOSHIBA_TC358767 is not set +CONFIG_DRM_TOSHIBA_TC358768=m +# CONFIG_DRM_TOSHIBA_TC358775 is not set +# CONFIG_DRM_TI_DLPC3433 is not set +# CONFIG_DRM_TI_TFP410 is not set +CONFIG_DRM_TI_SN65DSI83=m +# CONFIG_DRM_TI_SN65DSI86 is not set +CONFIG_DRM_TI_TPD12S015=m +CONFIG_DRM_ANALOGIX_ANX6345=m +CONFIG_DRM_ANALOGIX_ANX78XX=m +CONFIG_DRM_ANALOGIX_DP=m +# CONFIG_DRM_ANALOGIX_ANX7625 is not set +CONFIG_DRM_I2C_ADV7511=m +CONFIG_DRM_I2C_ADV7511_AUDIO=y +CONFIG_DRM_I2C_ADV7511_CEC=y +CONFIG_DRM_CDNS_DSI=m +CONFIG_DRM_CDNS_DSI_J721E=y +# CONFIG_DRM_CDNS_MHDP8546 is not set +CONFIG_DRM_DW_HDMI=m +CONFIG_DRM_DW_HDMI_AHB_AUDIO=m +CONFIG_DRM_DW_HDMI_I2S_AUDIO=m +# CONFIG_DRM_DW_HDMI_GP_AUDIO is not set +CONFIG_DRM_DW_HDMI_CEC=m +CONFIG_DRM_DW_HDMI_QP=m +CONFIG_DRM_DW_MIPI_DSI=m +# end of Display Interface Bridges + +CONFIG_DRM_ETNAVIV=m +CONFIG_DRM_ETNAVIV_THERMAL=y +CONFIG_DRM_HISI_HIBMC=m +CONFIG_DRM_HISI_KIRIN=m +CONFIG_DRM_LOGICVC=m +# CONFIG_DRM_ARCPGU is not set +CONFIG_DRM_BOCHS=m +# CONFIG_DRM_CIRRUS_QEMU is not set +CONFIG_DRM_GM12U320=m +CONFIG_DRM_PANEL_MIPI_DBI=m +CONFIG_DRM_SIMPLEDRM=m +CONFIG_TINYDRM_HX8357D=m +# CONFIG_TINYDRM_ILI9163 is not set +CONFIG_TINYDRM_ILI9225=m +CONFIG_TINYDRM_ILI9341=m +CONFIG_TINYDRM_ILI9486=m +CONFIG_TINYDRM_MI0283QT=m +CONFIG_TINYDRM_REPAPER=m +CONFIG_TINYDRM_ST7586=m +CONFIG_TINYDRM_ST7735R=m +CONFIG_DRM_PL111=m +CONFIG_DRM_XEN=y +CONFIG_DRM_XEN_FRONTEND=m +CONFIG_DRM_LIMA=m +CONFIG_DRM_PANFROST=m +CONFIG_DRM_PANTHOR=m +CONFIG_DRM_TIDSS=m +CONFIG_DRM_GUD=m +CONFIG_DRM_SSD130X=m +CONFIG_DRM_SSD130X_I2C=m +CONFIG_DRM_SSD130X_SPI=m +# CONFIG_DRM_POWERVR is not set +CONFIG_DRM_EXPORT_FOR_TESTS=y +CONFIG_DRM_LIB_RANDOM=y +# CONFIG_DRM_WERROR is not set +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FB_CIRRUS is not set +# CONFIG_FB_PM2 is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_ASILIANT is not set +# CONFIG_FB_IMSTT is not set +CONFIG_FB_UVESA=m +CONFIG_FB_EFI=y +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_NVIDIA is not set +# CONFIG_FB_RIVA is not set +# CONFIG_FB_I740 is not set +# CONFIG_FB_MATROX is not set +# CONFIG_FB_RADEON is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_S3 is not set +# CONFIG_FB_SAVAGE is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_NEOMAGIC is not set +# CONFIG_FB_KYRO is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_VOODOO1 is not set +# CONFIG_FB_VT8623 is not set +# CONFIG_FB_TRIDENT is not set +# CONFIG_FB_ARK is not set +# CONFIG_FB_PM3 is not set +# CONFIG_FB_CARMINE is not set +# CONFIG_FB_SMSCUFX is not set +CONFIG_FB_UDL=m +# CONFIG_FB_IBM_GXT4500 is not set +CONFIG_FB_VIRTUAL=m +CONFIG_XEN_FBDEV_FRONTEND=y +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_MB862XX is not set +CONFIG_FB_SIMPLE=m +CONFIG_FB_SSD1307=m +# CONFIG_FB_SM712 is not set +CONFIG_FB_CORE=y +CONFIG_FB_NOTIFY=y +CONFIG_FIRMWARE_EDID=y +CONFIG_FB_DEVICE=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYSMEM_FOPS=y +CONFIG_FB_DEFERRED_IO=y +CONFIG_FB_DMAMEM_HELPERS=y +CONFIG_FB_IOMEM_FOPS=y +CONFIG_FB_IOMEM_HELPERS=y +CONFIG_FB_SYSMEM_HELPERS=y +CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y +CONFIG_FB_BACKLIGHT=m +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y +# end of Frame buffer Devices + +# +# Backlight & LCD device support +# +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_L4F00242T03 is not set +# CONFIG_LCD_LMS283GF05 is not set +# CONFIG_LCD_LTV350QV is not set +# CONFIG_LCD_ILI922X is not set +# CONFIG_LCD_ILI9320 is not set +# CONFIG_LCD_TDO24M is not set +# CONFIG_LCD_VGG2432A4 is not set +CONFIG_LCD_PLATFORM=m +# CONFIG_LCD_AMS369FG06 is not set +# CONFIG_LCD_LMS501KF03 is not set +# CONFIG_LCD_HX8357 is not set +CONFIG_LCD_OTM3225A=m +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_KTD253 is not set +# CONFIG_BACKLIGHT_KTD2801 is not set +# CONFIG_BACKLIGHT_KTZ8866 is not set +CONFIG_BACKLIGHT_PWM=m +CONFIG_BACKLIGHT_MT6370=m +CONFIG_BACKLIGHT_QCOM_WLED=m +# CONFIG_BACKLIGHT_ADP8860 is not set +# CONFIG_BACKLIGHT_ADP8870 is not set +# CONFIG_BACKLIGHT_LM3509 is not set +# CONFIG_BACKLIGHT_LM3630A is not set +# CONFIG_BACKLIGHT_LM3639 is not set +CONFIG_BACKLIGHT_LP855X=y +# CONFIG_BACKLIGHT_MP3309C is not set +CONFIG_BACKLIGHT_GPIO=m +# CONFIG_BACKLIGHT_LV5207LP is not set +# CONFIG_BACKLIGHT_BD6107 is not set +# CONFIG_BACKLIGHT_ARCXCNN is not set +CONFIG_BACKLIGHT_LED=m +# end of Backlight & LCD device support + +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_HDMI=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set +# end of Console display driver support + +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=y +CONFIG_LOGO_LINUX_VGA16=y +CONFIG_LOGO_LINUX_CLUT224=y +# end of Graphics support + +# CONFIG_DRM_ACCEL is not set +CONFIG_SOUND=m +CONFIG_SND=m +CONFIG_SND_TIMER=m +CONFIG_SND_PCM=m +CONFIG_SND_PCM_ELD=y +CONFIG_SND_PCM_IEC958=y +CONFIG_SND_DMAENGINE_PCM=m +CONFIG_SND_HWDEP=m +CONFIG_SND_SEQ_DEVICE=m +CONFIG_SND_RAWMIDI=m +# CONFIG_SND_CORE_TEST is not set +CONFIG_SND_COMPRESS_OFFLOAD=m +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_OSSEMUL is not set +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_HRTIMER is not set +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +CONFIG_SND_CTL_FAST_LOOKUP=y +# CONFIG_SND_DEBUG is not set +CONFIG_SND_CTL_INPUT_VALIDATION=y +CONFIG_SND_VMASTER=y +CONFIG_SND_CTL_LED=m +CONFIG_SND_SEQUENCER=m +CONFIG_SND_SEQ_DUMMY=m +CONFIG_SND_SEQ_MIDI_EVENT=m +CONFIG_SND_SEQ_MIDI=m +CONFIG_SND_SEQ_MIDI_EMUL=m +CONFIG_SND_SEQ_VIRMIDI=m +# CONFIG_SND_SEQ_UMP is not set +CONFIG_SND_MPU401_UART=m +CONFIG_SND_OPL3_LIB=m +CONFIG_SND_OPL3_LIB_SEQ=m +CONFIG_SND_VX_LIB=m +CONFIG_SND_AC97_CODEC=m +CONFIG_SND_DRIVERS=y +CONFIG_SND_DUMMY=m +CONFIG_SND_ALOOP=m +# CONFIG_SND_PCMTEST is not set +CONFIG_SND_VIRMIDI=m +CONFIG_SND_MTPAV=m +CONFIG_SND_SERIAL_U16550=m +CONFIG_SND_SERIAL_GENERIC=m +CONFIG_SND_MPU401=m +CONFIG_SND_AC97_POWER_SAVE=y +CONFIG_SND_AC97_POWER_SAVE_DEFAULT=0 +CONFIG_SND_PCI=y +CONFIG_SND_AD1889=m +CONFIG_SND_ALS300=m +CONFIG_SND_ALI5451=m +CONFIG_SND_ATIIXP=m +CONFIG_SND_ATIIXP_MODEM=m +CONFIG_SND_AU8810=m +CONFIG_SND_AU8820=m +CONFIG_SND_AU8830=m +CONFIG_SND_AW2=m +CONFIG_SND_AZT3328=m +CONFIG_SND_BT87X=m +CONFIG_SND_BT87X_OVERCLOCK=y +CONFIG_SND_CA0106=m +CONFIG_SND_CMIPCI=m +CONFIG_SND_OXYGEN_LIB=m +CONFIG_SND_OXYGEN=m +CONFIG_SND_CS4281=m +CONFIG_SND_CS46XX=m +CONFIG_SND_CS46XX_NEW_DSP=y +CONFIG_SND_CTXFI=m +CONFIG_SND_DARLA20=m +CONFIG_SND_GINA20=m +CONFIG_SND_LAYLA20=m +CONFIG_SND_DARLA24=m +CONFIG_SND_GINA24=m +CONFIG_SND_LAYLA24=m +CONFIG_SND_MONA=m +CONFIG_SND_MIA=m +CONFIG_SND_ECHO3G=m +CONFIG_SND_INDIGO=m +CONFIG_SND_INDIGOIO=m +CONFIG_SND_INDIGODJ=m +CONFIG_SND_INDIGOIOX=m +CONFIG_SND_INDIGODJX=m +CONFIG_SND_EMU10K1=m +CONFIG_SND_EMU10K1_SEQ=m +CONFIG_SND_EMU10K1X=m +CONFIG_SND_ENS1370=m +CONFIG_SND_ENS1371=m +CONFIG_SND_ES1938=m +CONFIG_SND_ES1968=m +CONFIG_SND_ES1968_INPUT=y +CONFIG_SND_ES1968_RADIO=y +CONFIG_SND_FM801=m +CONFIG_SND_FM801_TEA575X_BOOL=y +CONFIG_SND_HDSP=m +CONFIG_SND_HDSPM=m +CONFIG_SND_ICE1712=m +CONFIG_SND_ICE1724=m +CONFIG_SND_INTEL8X0=m +CONFIG_SND_INTEL8X0M=m +CONFIG_SND_KORG1212=m +CONFIG_SND_LOLA=m +CONFIG_SND_LX6464ES=m +CONFIG_SND_MAESTRO3=m +CONFIG_SND_MAESTRO3_INPUT=y +CONFIG_SND_MIXART=m +CONFIG_SND_NM256=m +CONFIG_SND_PCXHR=m +CONFIG_SND_RIPTIDE=m +CONFIG_SND_RME32=m +CONFIG_SND_RME96=m +CONFIG_SND_RME9652=m +CONFIG_SND_SONICVIBES=m +CONFIG_SND_TRIDENT=m +CONFIG_SND_VIA82XX=m +CONFIG_SND_VIA82XX_MODEM=m +CONFIG_SND_VIRTUOSO=m +CONFIG_SND_VX222=m +CONFIG_SND_YMFPCI=m + +# +# HD-Audio +# +CONFIG_SND_HDA=m +CONFIG_SND_HDA_GENERIC_LEDS=y +CONFIG_SND_HDA_INTEL=m +CONFIG_SND_HDA_HWDEP=y +CONFIG_SND_HDA_RECONFIG=y +CONFIG_SND_HDA_INPUT_BEEP=y +CONFIG_SND_HDA_INPUT_BEEP_MODE=1 +CONFIG_SND_HDA_PATCH_LOADER=y +# CONFIG_SND_HDA_CIRRUS_SCODEC_KUNIT_TEST is not set +CONFIG_SND_HDA_SCODEC_CS35L41=m +CONFIG_SND_HDA_CS_DSP_CONTROLS=m +CONFIG_SND_HDA_SCODEC_COMPONENT=m +CONFIG_SND_HDA_SCODEC_CS35L41_I2C=m +CONFIG_SND_HDA_SCODEC_CS35L41_SPI=m +# CONFIG_SND_HDA_SCODEC_CS35L56_I2C is not set +# CONFIG_SND_HDA_SCODEC_CS35L56_SPI is not set +# CONFIG_SND_HDA_SCODEC_TAS2781_I2C is not set +CONFIG_SND_HDA_CODEC_REALTEK=m +CONFIG_SND_HDA_CODEC_ANALOG=m +CONFIG_SND_HDA_CODEC_SIGMATEL=m +CONFIG_SND_HDA_CODEC_VIA=m +CONFIG_SND_HDA_CODEC_HDMI=m +CONFIG_SND_HDA_CODEC_CIRRUS=m +CONFIG_SND_HDA_CODEC_CS8409=m +CONFIG_SND_HDA_CODEC_CONEXANT=m +# CONFIG_SND_HDA_CODEC_SENARYTECH is not set +CONFIG_SND_HDA_CODEC_CA0110=m +CONFIG_SND_HDA_CODEC_CA0132=m +CONFIG_SND_HDA_CODEC_CA0132_DSP=y +CONFIG_SND_HDA_CODEC_CMEDIA=m +CONFIG_SND_HDA_CODEC_SI3054=m +CONFIG_SND_HDA_GENERIC=m +CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 +CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM=y +# CONFIG_SND_HDA_CTL_DEV_ID is not set +# end of HD-Audio + +CONFIG_SND_HDA_CORE=m +CONFIG_SND_HDA_DSP_LOADER=y +CONFIG_SND_HDA_EXT_CORE=m +CONFIG_SND_HDA_PREALLOC_SIZE=64 +CONFIG_SND_INTEL_NHLT=y +CONFIG_SND_INTEL_DSP_CONFIG=m +CONFIG_SND_INTEL_SOUNDWIRE_ACPI=m +CONFIG_SND_SPI=y +CONFIG_SND_USB=y +CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_USB_AUDIO_MIDI_V2 is not set +CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y +CONFIG_SND_USB_UA101=m +CONFIG_SND_USB_CAIAQ=m +CONFIG_SND_USB_CAIAQ_INPUT=y +CONFIG_SND_USB_6FIRE=m +CONFIG_SND_USB_HIFACE=m +CONFIG_SND_BCD2000=m +CONFIG_SND_USB_LINE6=m +CONFIG_SND_USB_POD=m +CONFIG_SND_USB_PODHD=m +CONFIG_SND_USB_TONEPORT=m +CONFIG_SND_USB_VARIAX=m +CONFIG_SND_SOC=m +CONFIG_SND_SOC_AC97_BUS=y +CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y +CONFIG_SND_SOC_COMPRESS=y +# CONFIG_SND_SOC_TOPOLOGY_BUILD is not set +# CONFIG_SND_SOC_CARD_KUNIT_TEST is not set +CONFIG_SND_SOC_UTILS_KUNIT_TEST=m +CONFIG_SND_SOC_ACPI=m +CONFIG_SND_SOC_ADI=m +CONFIG_SND_SOC_ADI_AXI_I2S=m +CONFIG_SND_SOC_ADI_AXI_SPDIF=m +CONFIG_SND_SOC_AMD_ACP=m +CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH=m +CONFIG_SND_SOC_AMD_CZ_RT5645_MACH=m +CONFIG_SND_SOC_AMD_ST_ES8336_MACH=m +# CONFIG_SND_AMD_ACP_CONFIG is not set +CONFIG_SND_ATMEL_SOC=m +CONFIG_SND_SOC_MIKROE_PROTO=m +CONFIG_SND_BCM63XX_I2S_WHISTLER=m +CONFIG_SND_DESIGNWARE_I2S=m +CONFIG_SND_DESIGNWARE_PCM=y + +# +# SoC Audio for Freescale CPUs +# + +# +# Common SoC Audio options for Freescale CPUs: +# +CONFIG_SND_SOC_FSL_ASRC=m +CONFIG_SND_SOC_FSL_SAI=m +CONFIG_SND_SOC_FSL_MQS=m +CONFIG_SND_SOC_FSL_AUDMIX=m +CONFIG_SND_SOC_FSL_SSI=m +CONFIG_SND_SOC_FSL_SPDIF=m +CONFIG_SND_SOC_FSL_ESAI=m +CONFIG_SND_SOC_FSL_MICFIL=m +CONFIG_SND_SOC_FSL_EASRC=m +CONFIG_SND_SOC_FSL_XCVR=m +CONFIG_SND_SOC_FSL_UTILS=m +CONFIG_SND_SOC_FSL_RPMSG=m +CONFIG_SND_SOC_IMX_AUDMUX=m +# end of SoC Audio for Freescale CPUs + +# CONFIG_SND_SOC_CHV3_I2S is not set +CONFIG_SND_I2S_HI6210_I2S=m +CONFIG_SND_SOC_IMG=y +CONFIG_SND_SOC_IMG_I2S_IN=m +CONFIG_SND_SOC_IMG_I2S_OUT=m +CONFIG_SND_SOC_IMG_PARALLEL_OUT=m +CONFIG_SND_SOC_IMG_SPDIF_IN=m +CONFIG_SND_SOC_IMG_SPDIF_OUT=m +CONFIG_SND_SOC_IMG_PISTACHIO_INTERNAL_DAC=m +CONFIG_SND_SOC_MTK_BTCVSD=m +CONFIG_SND_SOC_ROCKCHIP=m +CONFIG_SND_SOC_ROCKCHIP_I2S=m +CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=m +CONFIG_SND_SOC_ROCKCHIP_PDM=m +CONFIG_SND_SOC_ROCKCHIP_SPDIF=m +CONFIG_SND_SOC_ROCKCHIP_MAX98090=m +CONFIG_SND_SOC_ROCKCHIP_RT5645=m +CONFIG_SND_SOC_RK3288_HDMI_ANALOG=m +CONFIG_SND_SOC_RK3399_GRU_SOUND=m +CONFIG_SND_SOC_SOF_TOPLEVEL=y +CONFIG_SND_SOC_SOF_PCI=m +CONFIG_SND_SOC_SOF_ACPI=m +CONFIG_SND_SOC_SOF_OF=m +CONFIG_SND_SOC_SOF_IMX_TOPLEVEL=y +# CONFIG_SND_SOC_SOF_MTK_TOPLEVEL is not set + +# +# STMicroelectronics STM32 SOC audio support +# +# end of STMicroelectronics STM32 SOC audio support + +CONFIG_SND_SOC_XILINX_I2S=m +CONFIG_SND_SOC_XILINX_AUDIO_FORMATTER=m +CONFIG_SND_SOC_XILINX_SPDIF=m +CONFIG_SND_SOC_XTFPGA_I2S=m +CONFIG_SND_SOC_I2C_AND_SPI=m + +# +# CODEC drivers +# +CONFIG_SND_SOC_WM_ADSP=m +CONFIG_SND_SOC_AC97_CODEC=m +CONFIG_SND_SOC_ADAU_UTILS=m +CONFIG_SND_SOC_ADAU1372=m +CONFIG_SND_SOC_ADAU1372_I2C=m +CONFIG_SND_SOC_ADAU1372_SPI=m +CONFIG_SND_SOC_ADAU1701=m +CONFIG_SND_SOC_ADAU17X1=m +CONFIG_SND_SOC_ADAU1761=m +CONFIG_SND_SOC_ADAU1761_I2C=m +CONFIG_SND_SOC_ADAU1761_SPI=m +CONFIG_SND_SOC_ADAU7002=m +CONFIG_SND_SOC_ADAU7118=m +CONFIG_SND_SOC_ADAU7118_HW=m +CONFIG_SND_SOC_ADAU7118_I2C=m +CONFIG_SND_SOC_AK4104=m +CONFIG_SND_SOC_AK4118=m +CONFIG_SND_SOC_AK4375=m +CONFIG_SND_SOC_AK4458=m +CONFIG_SND_SOC_AK4554=m +CONFIG_SND_SOC_AK4613=m +# CONFIG_SND_SOC_AK4619 is not set +CONFIG_SND_SOC_AK4642=m +CONFIG_SND_SOC_AK5386=m +CONFIG_SND_SOC_AK5558=m +CONFIG_SND_SOC_ALC5623=m +# CONFIG_SND_SOC_AUDIO_IIO_AUX is not set +CONFIG_SND_SOC_AW8738=m +# CONFIG_SND_SOC_AW88395 is not set +# CONFIG_SND_SOC_AW88261 is not set +# CONFIG_SND_SOC_AW87390 is not set +# CONFIG_SND_SOC_AW88399 is not set +CONFIG_SND_SOC_BD28623=m +CONFIG_SND_SOC_BT_SCO=m +# CONFIG_SND_SOC_CHV3_CODEC is not set +CONFIG_SND_SOC_CROS_EC_CODEC=m +CONFIG_SND_SOC_CS_AMP_LIB=m +# CONFIG_SND_SOC_CS_AMP_LIB_TEST is not set +CONFIG_SND_SOC_CS35L32=m +CONFIG_SND_SOC_CS35L33=m +CONFIG_SND_SOC_CS35L34=m +CONFIG_SND_SOC_CS35L35=m +CONFIG_SND_SOC_CS35L36=m +CONFIG_SND_SOC_CS35L41_LIB=m +CONFIG_SND_SOC_CS35L41=m +CONFIG_SND_SOC_CS35L41_SPI=m +CONFIG_SND_SOC_CS35L41_I2C=m +CONFIG_SND_SOC_CS35L45=m +CONFIG_SND_SOC_CS35L45_SPI=m +CONFIG_SND_SOC_CS35L45_I2C=m +# CONFIG_SND_SOC_CS35L56_I2C is not set +# CONFIG_SND_SOC_CS35L56_SPI is not set +# CONFIG_SND_SOC_CS35L56_SDW is not set +CONFIG_SND_SOC_CS42L42_CORE=m +CONFIG_SND_SOC_CS42L42=m +# CONFIG_SND_SOC_CS42L42_SDW is not set +CONFIG_SND_SOC_CS42L51=m +CONFIG_SND_SOC_CS42L51_I2C=m +CONFIG_SND_SOC_CS42L52=m +CONFIG_SND_SOC_CS42L56=m +CONFIG_SND_SOC_CS42L73=m +CONFIG_SND_SOC_CS42L83=m +CONFIG_SND_SOC_CS4234=m +CONFIG_SND_SOC_CS4265=m +CONFIG_SND_SOC_CS4270=m +CONFIG_SND_SOC_CS4271=m +CONFIG_SND_SOC_CS4271_I2C=m +CONFIG_SND_SOC_CS4271_SPI=m +CONFIG_SND_SOC_CS42XX8=m +CONFIG_SND_SOC_CS42XX8_I2C=m +CONFIG_SND_SOC_CS43130=m +CONFIG_SND_SOC_CS4341=m +CONFIG_SND_SOC_CS4349=m +CONFIG_SND_SOC_CS53L30=m +# CONFIG_SND_SOC_CS530X_I2C is not set +CONFIG_SND_SOC_CX2072X=m +CONFIG_SND_SOC_DA7213=m +CONFIG_SND_SOC_DA7219=m +CONFIG_SND_SOC_DMIC=m +CONFIG_SND_SOC_HDMI_CODEC=m +CONFIG_SND_SOC_ES7134=m +CONFIG_SND_SOC_ES7241=m +# CONFIG_SND_SOC_ES8311 is not set +CONFIG_SND_SOC_ES8316=m +CONFIG_SND_SOC_ES8326=m +CONFIG_SND_SOC_ES8328=m +CONFIG_SND_SOC_ES8328_I2C=m +CONFIG_SND_SOC_ES8328_SPI=m +CONFIG_SND_SOC_GTM601=m +CONFIG_SND_SOC_HDA=m +CONFIG_SND_SOC_ICS43432=m +# CONFIG_SND_SOC_IDT821034 is not set +CONFIG_SND_SOC_INNO_RK3036=m +CONFIG_SND_SOC_MAX98088=m +CONFIG_SND_SOC_MAX98090=m +CONFIG_SND_SOC_MAX98357A=m +CONFIG_SND_SOC_MAX98504=m +CONFIG_SND_SOC_MAX9867=m +CONFIG_SND_SOC_MAX98927=m +CONFIG_SND_SOC_MAX98520=m +# CONFIG_SND_SOC_MAX98363 is not set +CONFIG_SND_SOC_MAX98373=m +CONFIG_SND_SOC_MAX98373_I2C=m +CONFIG_SND_SOC_MAX98373_SDW=m +# CONFIG_SND_SOC_MAX98388 is not set +CONFIG_SND_SOC_MAX98390=m +CONFIG_SND_SOC_MAX98396=m +CONFIG_SND_SOC_MAX9860=m +CONFIG_SND_SOC_MSM8916_WCD_ANALOG=m +CONFIG_SND_SOC_MSM8916_WCD_DIGITAL=m +CONFIG_SND_SOC_PCM1681=m +CONFIG_SND_SOC_PCM1789=m +CONFIG_SND_SOC_PCM1789_I2C=m +CONFIG_SND_SOC_PCM179X=m +CONFIG_SND_SOC_PCM179X_I2C=m +CONFIG_SND_SOC_PCM179X_SPI=m +CONFIG_SND_SOC_PCM186X=m +CONFIG_SND_SOC_PCM186X_I2C=m +CONFIG_SND_SOC_PCM186X_SPI=m +CONFIG_SND_SOC_PCM3060=m +CONFIG_SND_SOC_PCM3060_I2C=m +CONFIG_SND_SOC_PCM3060_SPI=m +CONFIG_SND_SOC_PCM3168A=m +CONFIG_SND_SOC_PCM3168A_I2C=m +CONFIG_SND_SOC_PCM3168A_SPI=m +CONFIG_SND_SOC_PCM5102A=m +CONFIG_SND_SOC_PCM512x=m +CONFIG_SND_SOC_PCM512x_I2C=m +CONFIG_SND_SOC_PCM512x_SPI=m +# CONFIG_SND_SOC_PCM6240 is not set +# CONFIG_SND_SOC_PEB2466 is not set +# CONFIG_SND_SOC_RK3308 is not set +CONFIG_SND_SOC_RK3328=m +# CONFIG_SND_SOC_RK817 is not set +CONFIG_SND_SOC_RL6231=m +# CONFIG_SND_SOC_RT1017_SDCA_SDW is not set +CONFIG_SND_SOC_RT1308_SDW=m +CONFIG_SND_SOC_RT1316_SDW=m +# CONFIG_SND_SOC_RT1318_SDW is not set +# CONFIG_SND_SOC_RT1320_SDW is not set +CONFIG_SND_SOC_RT5514=m +CONFIG_SND_SOC_RT5514_SPI=m +CONFIG_SND_SOC_RT5616=m +CONFIG_SND_SOC_RT5631=m +CONFIG_SND_SOC_RT5640=m +CONFIG_SND_SOC_RT5645=m +CONFIG_SND_SOC_RT5659=m +CONFIG_SND_SOC_RT5682=m +CONFIG_SND_SOC_RT5682_I2C=m +CONFIG_SND_SOC_RT5682_SDW=m +CONFIG_SND_SOC_RT700=m +CONFIG_SND_SOC_RT700_SDW=m +CONFIG_SND_SOC_RT711=m +CONFIG_SND_SOC_RT711_SDW=m +CONFIG_SND_SOC_RT711_SDCA_SDW=m +# CONFIG_SND_SOC_RT712_SDCA_SDW is not set +# CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW is not set +# CONFIG_SND_SOC_RT722_SDCA_SDW is not set +CONFIG_SND_SOC_RT715=m +CONFIG_SND_SOC_RT715_SDW=m +CONFIG_SND_SOC_RT715_SDCA_SDW=m +# CONFIG_SND_SOC_RT9120 is not set +# CONFIG_SND_SOC_RTQ9128 is not set +# CONFIG_SND_SOC_SDW_MOCKUP is not set +CONFIG_SND_SOC_SGTL5000=m +CONFIG_SND_SOC_SIGMADSP=m +CONFIG_SND_SOC_SIGMADSP_I2C=m +CONFIG_SND_SOC_SIGMADSP_REGMAP=m +CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m +CONFIG_SND_SOC_SIMPLE_MUX=m +# CONFIG_SND_SOC_SMA1303 is not set +CONFIG_SND_SOC_SPDIF=m +CONFIG_SND_SOC_SRC4XXX_I2C=m +CONFIG_SND_SOC_SRC4XXX=m +CONFIG_SND_SOC_SSM2305=m +CONFIG_SND_SOC_SSM2518=m +CONFIG_SND_SOC_SSM2602=m +CONFIG_SND_SOC_SSM2602_SPI=m +CONFIG_SND_SOC_SSM2602_I2C=m +# CONFIG_SND_SOC_SSM3515 is not set +CONFIG_SND_SOC_SSM4567=m +CONFIG_SND_SOC_STA32X=m +CONFIG_SND_SOC_STA350=m +CONFIG_SND_SOC_STI_SAS=m +CONFIG_SND_SOC_TAS2552=m +CONFIG_SND_SOC_TAS2562=m +CONFIG_SND_SOC_TAS2764=m +CONFIG_SND_SOC_TAS2770=m +CONFIG_SND_SOC_TAS2780=m +# CONFIG_SND_SOC_TAS2781_I2C is not set +CONFIG_SND_SOC_TAS5086=m +CONFIG_SND_SOC_TAS571X=m +CONFIG_SND_SOC_TAS5720=m +CONFIG_SND_SOC_TAS5805M=m +CONFIG_SND_SOC_TAS6424=m +CONFIG_SND_SOC_TDA7419=m +CONFIG_SND_SOC_TFA9879=m +CONFIG_SND_SOC_TFA989X=m +CONFIG_SND_SOC_TLV320ADC3XXX=m +CONFIG_SND_SOC_TLV320AIC23=m +CONFIG_SND_SOC_TLV320AIC23_I2C=m +CONFIG_SND_SOC_TLV320AIC23_SPI=m +CONFIG_SND_SOC_TLV320AIC31XX=m +CONFIG_SND_SOC_TLV320AIC32X4=m +CONFIG_SND_SOC_TLV320AIC32X4_I2C=m +CONFIG_SND_SOC_TLV320AIC32X4_SPI=m +CONFIG_SND_SOC_TLV320AIC3X=m +CONFIG_SND_SOC_TLV320AIC3X_I2C=m +CONFIG_SND_SOC_TLV320AIC3X_SPI=m +CONFIG_SND_SOC_TLV320ADCX140=m +CONFIG_SND_SOC_TS3A227E=m +CONFIG_SND_SOC_TSCS42XX=m +CONFIG_SND_SOC_TSCS454=m +CONFIG_SND_SOC_UDA1334=m +CONFIG_SND_SOC_WCD_CLASSH=m +CONFIG_SND_SOC_WCD9335=m +CONFIG_SND_SOC_WCD_MBHC=m +# CONFIG_SND_SOC_WCD937X_SDW is not set +CONFIG_SND_SOC_WCD938X=m +CONFIG_SND_SOC_WCD938X_SDW=m +# CONFIG_SND_SOC_WCD939X_SDW is not set +CONFIG_SND_SOC_WM8510=m +CONFIG_SND_SOC_WM8523=m +CONFIG_SND_SOC_WM8524=m +CONFIG_SND_SOC_WM8580=m +CONFIG_SND_SOC_WM8711=m +CONFIG_SND_SOC_WM8728=m +CONFIG_SND_SOC_WM8731=m +CONFIG_SND_SOC_WM8731_I2C=m +CONFIG_SND_SOC_WM8731_SPI=m +CONFIG_SND_SOC_WM8737=m +CONFIG_SND_SOC_WM8741=m +CONFIG_SND_SOC_WM8750=m +CONFIG_SND_SOC_WM8753=m +CONFIG_SND_SOC_WM8770=m +CONFIG_SND_SOC_WM8776=m +CONFIG_SND_SOC_WM8782=m +CONFIG_SND_SOC_WM8804=m +CONFIG_SND_SOC_WM8804_I2C=m +CONFIG_SND_SOC_WM8804_SPI=m +CONFIG_SND_SOC_WM8903=m +CONFIG_SND_SOC_WM8904=m +CONFIG_SND_SOC_WM8940=m +CONFIG_SND_SOC_WM8960=m +# CONFIG_SND_SOC_WM8961 is not set +CONFIG_SND_SOC_WM8962=m +CONFIG_SND_SOC_WM8974=m +CONFIG_SND_SOC_WM8978=m +CONFIG_SND_SOC_WM8985=m +CONFIG_SND_SOC_WSA881X=m +CONFIG_SND_SOC_WSA883X=m +# CONFIG_SND_SOC_WSA884X is not set +CONFIG_SND_SOC_ZL38060=m +CONFIG_SND_SOC_MAX9759=m +CONFIG_SND_SOC_MT6351=m +CONFIG_SND_SOC_MT6358=m +CONFIG_SND_SOC_MT6660=m +CONFIG_SND_SOC_NAU8315=m +CONFIG_SND_SOC_NAU8540=m +CONFIG_SND_SOC_NAU8810=m +CONFIG_SND_SOC_NAU8821=m +CONFIG_SND_SOC_NAU8822=m +CONFIG_SND_SOC_NAU8824=m +CONFIG_SND_SOC_TPA6130A2=m +CONFIG_SND_SOC_LPASS_MACRO_COMMON=m +CONFIG_SND_SOC_LPASS_WSA_MACRO=m +CONFIG_SND_SOC_LPASS_VA_MACRO=m +CONFIG_SND_SOC_LPASS_RX_MACRO=m +CONFIG_SND_SOC_LPASS_TX_MACRO=m +# end of CODEC drivers + +CONFIG_SND_SIMPLE_CARD_UTILS=m +CONFIG_SND_SIMPLE_CARD=m +CONFIG_SND_AUDIO_GRAPH_CARD=m +CONFIG_SND_AUDIO_GRAPH_CARD2=m +CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE=m +CONFIG_SND_TEST_COMPONENT=m +CONFIG_SND_SYNTH_EMUX=m +CONFIG_SND_XEN_FRONTEND=m +CONFIG_SND_VIRTIO=m +CONFIG_AC97_BUS=m +CONFIG_HID_SUPPORT=y +CONFIG_HID=y +CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=m +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=m +CONFIG_HID_ACCUTOUCH=m +CONFIG_HID_ACRUX=m +CONFIG_HID_ACRUX_FF=y +CONFIG_HID_APPLE=m +CONFIG_HID_APPLEIR=m +CONFIG_HID_ASUS=m +CONFIG_HID_AUREAL=m +CONFIG_HID_BELKIN=m +CONFIG_HID_BETOP_FF=m +CONFIG_HID_BIGBEN_FF=m +CONFIG_HID_CHERRY=m +CONFIG_HID_CHICONY=m +CONFIG_HID_CORSAIR=m +CONFIG_HID_COUGAR=m +CONFIG_HID_MACALLY=m +CONFIG_HID_PRODIKEYS=m +CONFIG_HID_CMEDIA=m +CONFIG_HID_CP2112=m +CONFIG_HID_CREATIVE_SB0540=m +CONFIG_HID_CYPRESS=m +CONFIG_HID_DRAGONRISE=m +CONFIG_DRAGONRISE_FF=y +CONFIG_HID_EMS_FF=m +CONFIG_HID_ELAN=m +CONFIG_HID_ELECOM=m +CONFIG_HID_ELO=m +# CONFIG_HID_EVISION is not set +CONFIG_HID_EZKEY=m +CONFIG_HID_FT260=m +CONFIG_HID_GEMBIRD=m +CONFIG_HID_GFRM=m +CONFIG_HID_GLORIOUS=m +CONFIG_HID_HOLTEK=m +CONFIG_HOLTEK_FF=y +CONFIG_HID_VIVALDI_COMMON=m +CONFIG_HID_GOOGLE_HAMMER=m +# CONFIG_HID_GOOGLE_STADIA_FF is not set +CONFIG_HID_VIVALDI=m +CONFIG_HID_GT683R=m +CONFIG_HID_KEYTOUCH=m +CONFIG_HID_KYE=m +CONFIG_HID_UCLOGIC=m +CONFIG_HID_WALTOP=m +CONFIG_HID_VIEWSONIC=m +CONFIG_HID_VRC2=m +CONFIG_HID_XIAOMI=m +CONFIG_HID_GYRATION=m +CONFIG_HID_ICADE=m +CONFIG_HID_ITE=m +CONFIG_HID_JABRA=m +CONFIG_HID_TWINHAN=m +CONFIG_HID_KENSINGTON=m +CONFIG_HID_LCPOWER=m +CONFIG_HID_LED=m +CONFIG_HID_LENOVO=m +# CONFIG_HID_LETSKETCH is not set +CONFIG_HID_LOGITECH=m +CONFIG_HID_LOGITECH_DJ=m +CONFIG_HID_LOGITECH_HIDPP=m +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWHEELS_FF=y +CONFIG_HID_MAGICMOUSE=m +CONFIG_HID_MALTRON=m +CONFIG_HID_MAYFLASH=m +CONFIG_HID_MEGAWORLD_FF=m +CONFIG_HID_REDRAGON=m +CONFIG_HID_MICROSOFT=m +CONFIG_HID_MONTEREY=m +CONFIG_HID_MULTITOUCH=m +CONFIG_HID_NINTENDO=m +# CONFIG_NINTENDO_FF is not set +CONFIG_HID_NTI=m +CONFIG_HID_NTRIG=m +# CONFIG_HID_NVIDIA_SHIELD is not set +CONFIG_HID_ORTEK=m +CONFIG_HID_PANTHERLORD=m +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PENMOUNT=m +CONFIG_HID_PETALYNX=m +CONFIG_HID_PICOLCD=m +CONFIG_HID_PICOLCD_FB=y +CONFIG_HID_PICOLCD_BACKLIGHT=y +CONFIG_HID_PICOLCD_LCD=y +CONFIG_HID_PICOLCD_LEDS=y +CONFIG_HID_PICOLCD_CIR=y +CONFIG_HID_PLANTRONICS=m +CONFIG_HID_PXRC=m +# CONFIG_HID_RAZER is not set +CONFIG_HID_PRIMAX=m +CONFIG_HID_RETRODE=m +CONFIG_HID_ROCCAT=m +CONFIG_HID_SAITEK=m +CONFIG_HID_SAMSUNG=m +CONFIG_HID_SEMITEK=m +# CONFIG_HID_SIGMAMICRO is not set +CONFIG_HID_SONY=m +CONFIG_SONY_FF=y +CONFIG_HID_SPEEDLINK=m +CONFIG_HID_STEAM=m +# CONFIG_STEAM_FF is not set +CONFIG_HID_STEELSERIES=m +CONFIG_HID_SUNPLUS=m +CONFIG_HID_RMI=m +CONFIG_HID_GREENASIA=m +CONFIG_GREENASIA_FF=y +CONFIG_HID_SMARTJOYPLUS=m +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TIVO=m +CONFIG_HID_TOPSEED=m +CONFIG_HID_TOPRE=m +CONFIG_HID_THINGM=m +CONFIG_HID_THRUSTMASTER=m +CONFIG_THRUSTMASTER_FF=y +CONFIG_HID_UDRAW_PS3=m +CONFIG_HID_U2FZERO=m +CONFIG_HID_WACOM=m +CONFIG_HID_WIIMOTE=m +# CONFIG_HID_WINWING is not set +CONFIG_HID_XINMO=m +CONFIG_HID_ZEROPLUS=m +CONFIG_ZEROPLUS_FF=y +CONFIG_HID_ZYDACRON=m +CONFIG_HID_SENSOR_HUB=m +CONFIG_HID_SENSOR_CUSTOM_SENSOR=m +CONFIG_HID_ALPS=m +# CONFIG_HID_MCP2200 is not set +CONFIG_HID_MCP2221=m +# CONFIG_HID_KUNIT_TEST is not set +# end of Special HID drivers + +# +# HID-BPF support +# +# end of HID-BPF support + +# +# USB HID support +# +CONFIG_USB_HID=y +CONFIG_HID_PID=y +CONFIG_USB_HIDDEV=y +# end of USB HID support + +CONFIG_I2C_HID=y +CONFIG_I2C_HID_ACPI=m +CONFIG_I2C_HID_OF=m +CONFIG_I2C_HID_OF_ELAN=m +CONFIG_I2C_HID_OF_GOODIX=m +CONFIG_I2C_HID_CORE=m +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_LED_TRIG=y +CONFIG_USB_ULPI_BUS=y +CONFIG_USB_CONN_GPIO=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_PCI=y +# CONFIG_USB_PCI_AMD is not set +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_FEW_INIT_RETRIES is not set +CONFIG_USB_DYNAMIC_MINORS=y +CONFIG_USB_OTG=y +# CONFIG_USB_OTG_PRODUCTLIST is not set +# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set +CONFIG_USB_OTG_FSM=m +CONFIG_USB_LEDS_TRIGGER_USBPORT=y +CONFIG_USB_AUTOSUSPEND_DELAY=2 +CONFIG_USB_DEFAULT_AUTHORIZATION_MODE=1 +CONFIG_USB_MON=m + +# +# USB Host Controller Drivers +# +CONFIG_USB_C67X00_HCD=m +CONFIG_USB_XHCI_HCD=y +# CONFIG_USB_XHCI_DBGCAP is not set +CONFIG_USB_XHCI_PCI=y +# CONFIG_USB_XHCI_PCI_RENESAS is not set +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_ROOT_HUB_TT=y +CONFIG_USB_EHCI_TT_NEWSCHED=y +CONFIG_USB_EHCI_PCI=y +CONFIG_USB_EHCI_FSL=m +CONFIG_USB_EHCI_HCD_PLATFORM=y +CONFIG_USB_OXU210HP_HCD=m +CONFIG_USB_ISP116X_HCD=m +CONFIG_USB_MAX3421_HCD=m +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PCI=y +CONFIG_USB_OHCI_HCD_PLATFORM=y +CONFIG_USB_UHCI_HCD=m +CONFIG_USB_SL811_HCD=m +CONFIG_USB_SL811_HCD_ISO=y +CONFIG_USB_R8A66597_HCD=m +CONFIG_USB_HCD_BCMA=m +CONFIG_USB_HCD_SSB=m +CONFIG_USB_HCD_TEST_MODE=y +# CONFIG_USB_XEN_HCD is not set + +# +# USB Device Class drivers +# +CONFIG_USB_ACM=m +CONFIG_USB_PRINTER=m +CONFIG_USB_WDM=m +CONFIG_USB_TMC=m + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +CONFIG_USB_STORAGE_REALTEK=m +CONFIG_REALTEK_AUTOPM=y +CONFIG_USB_STORAGE_DATAFAB=m +CONFIG_USB_STORAGE_FREECOM=m +CONFIG_USB_STORAGE_ISD200=m +CONFIG_USB_STORAGE_USBAT=m +CONFIG_USB_STORAGE_SDDR09=m +CONFIG_USB_STORAGE_SDDR55=m +CONFIG_USB_STORAGE_JUMPSHOT=m +CONFIG_USB_STORAGE_ALAUDA=m +CONFIG_USB_STORAGE_ONETOUCH=m +CONFIG_USB_STORAGE_KARMA=m +CONFIG_USB_STORAGE_CYPRESS_ATACB=m +CONFIG_USB_STORAGE_ENE_UB6250=m +CONFIG_USB_UAS=m + +# +# USB Imaging devices +# +CONFIG_USB_MDC800=m +CONFIG_USB_MICROTEK=m +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set + +# +# USB dual-mode controller drivers +# +CONFIG_USB_CDNS_SUPPORT=m +CONFIG_USB_CDNS_HOST=y +CONFIG_USB_CDNS3=m +# CONFIG_USB_CDNS3_GADGET is not set +# CONFIG_USB_CDNS3_HOST is not set +CONFIG_USB_CDNS3_PCI_WRAP=m +CONFIG_USB_CDNSP_PCI=m +CONFIG_USB_CDNSP_GADGET=y +CONFIG_USB_CDNSP_HOST=y +CONFIG_USB_MUSB_HDRC=y +# CONFIG_USB_MUSB_HOST is not set +# CONFIG_USB_MUSB_GADGET is not set +CONFIG_USB_MUSB_DUAL_ROLE=y + +# +# Platform Glue Layer +# + +# +# MUSB DMA mode +# +# CONFIG_MUSB_PIO_ONLY is not set +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_ULPI=y +# CONFIG_USB_DWC3_HOST is not set +# CONFIG_USB_DWC3_GADGET is not set +CONFIG_USB_DWC3_DUAL_ROLE=y + +# +# Platform Glue Driver Support +# +CONFIG_USB_DWC3_PCI=y +CONFIG_USB_DWC3_HAPS=y +CONFIG_USB_DWC3_OF_SIMPLE=y +CONFIG_USB_DWC2=y +# CONFIG_USB_DWC2_HOST is not set + +# +# Gadget/Dual-role mode requires USB Gadget support to be enabled +# +# CONFIG_USB_DWC2_PERIPHERAL is not set +CONFIG_USB_DWC2_DUAL_ROLE=y +CONFIG_USB_DWC2_PCI=m +# CONFIG_USB_DWC2_DEBUG is not set +# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_CHIPIDEA_PCI=y +CONFIG_USB_CHIPIDEA_MSM=y +CONFIG_USB_CHIPIDEA_NPCM=y +CONFIG_USB_CHIPIDEA_IMX=y +CONFIG_USB_CHIPIDEA_GENERIC=y +CONFIG_USB_CHIPIDEA_TEGRA=y +CONFIG_USB_ISP1760=y +CONFIG_USB_ISP1760_HCD=y +CONFIG_USB_ISP1761_UDC=y +# CONFIG_USB_ISP1760_HOST_ROLE is not set +# CONFIG_USB_ISP1760_GADGET_ROLE is not set +CONFIG_USB_ISP1760_DUAL_ROLE=y + +# +# USB port drivers +# +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_SIMPLE=m +CONFIG_USB_SERIAL_AIRCABLE=m +CONFIG_USB_SERIAL_ARK3116=m +CONFIG_USB_SERIAL_BELKIN=m +CONFIG_USB_SERIAL_CH341=m +CONFIG_USB_SERIAL_WHITEHEAT=m +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m +CONFIG_USB_SERIAL_CP210X=m +CONFIG_USB_SERIAL_CYPRESS_M8=m +CONFIG_USB_SERIAL_EMPEG=m +CONFIG_USB_SERIAL_FTDI_SIO=m +CONFIG_USB_SERIAL_VISOR=m +CONFIG_USB_SERIAL_IPAQ=m +CONFIG_USB_SERIAL_IR=m +CONFIG_USB_SERIAL_EDGEPORT=m +CONFIG_USB_SERIAL_EDGEPORT_TI=m +CONFIG_USB_SERIAL_F81232=m +CONFIG_USB_SERIAL_F8153X=m +CONFIG_USB_SERIAL_GARMIN=m +CONFIG_USB_SERIAL_IPW=m +CONFIG_USB_SERIAL_IUU=m +CONFIG_USB_SERIAL_KEYSPAN_PDA=m +CONFIG_USB_SERIAL_KEYSPAN=m +CONFIG_USB_SERIAL_KLSI=m +CONFIG_USB_SERIAL_KOBIL_SCT=m +CONFIG_USB_SERIAL_MCT_U232=m +CONFIG_USB_SERIAL_METRO=m +CONFIG_USB_SERIAL_MOS7720=m +CONFIG_USB_SERIAL_MOS7840=m +CONFIG_USB_SERIAL_MXUPORT=m +CONFIG_USB_SERIAL_NAVMAN=m +CONFIG_USB_SERIAL_PL2303=m +CONFIG_USB_SERIAL_OTI6858=m +CONFIG_USB_SERIAL_QCAUX=m +CONFIG_USB_SERIAL_QUALCOMM=m +CONFIG_USB_SERIAL_SPCP8X5=m +CONFIG_USB_SERIAL_SAFE=m +CONFIG_USB_SERIAL_SAFE_PADDED=y +CONFIG_USB_SERIAL_SIERRAWIRELESS=m +CONFIG_USB_SERIAL_SYMBOL=m +CONFIG_USB_SERIAL_TI=m +CONFIG_USB_SERIAL_CYBERJACK=m +CONFIG_USB_SERIAL_WWAN=m +CONFIG_USB_SERIAL_OPTION=m +CONFIG_USB_SERIAL_OMNINET=m +CONFIG_USB_SERIAL_OPTICON=m +CONFIG_USB_SERIAL_XSENS_MT=m +CONFIG_USB_SERIAL_WISHBONE=m +CONFIG_USB_SERIAL_SSU100=m +CONFIG_USB_SERIAL_QT2=m +CONFIG_USB_SERIAL_UPD78F0730=m +CONFIG_USB_SERIAL_XR=m +CONFIG_USB_SERIAL_DEBUG=m + +# +# USB Miscellaneous drivers +# +CONFIG_USB_EMI62=m +CONFIG_USB_EMI26=m +CONFIG_USB_ADUTUX=m +CONFIG_USB_SEVSEG=m +CONFIG_USB_LEGOTOWER=m +CONFIG_USB_LCD=m +CONFIG_USB_CYPRESS_CY7C63=m +CONFIG_USB_CYTHERM=m +CONFIG_USB_IDMOUSE=m +CONFIG_USB_APPLEDISPLAY=m +CONFIG_APPLE_MFI_FASTCHARGE=m +# CONFIG_USB_LJCA is not set +CONFIG_USB_SISUSBVGA=m +CONFIG_USB_LD=m +CONFIG_USB_TRANCEVIBRATOR=m +CONFIG_USB_IOWARRIOR=m +CONFIG_USB_TEST=m +CONFIG_USB_EHSET_TEST_FIXTURE=m +CONFIG_USB_ISIGHTFW=m +CONFIG_USB_YUREX=m +CONFIG_USB_EZUSB_FX2=m +CONFIG_USB_HUB_USB251XB=m +CONFIG_USB_HSIC_USB3503=y +CONFIG_USB_HSIC_USB4604=m +CONFIG_USB_LINK_LAYER_TEST=m +CONFIG_USB_CHAOSKEY=m +# CONFIG_USB_ONBOARD_DEV is not set +CONFIG_USB_ATM=m +CONFIG_USB_SPEEDTOUCH=m +CONFIG_USB_CXACRU=m +CONFIG_USB_UEAGLEATM=m +CONFIG_USB_XUSBATM=m + +# +# USB Physical Layer drivers +# +CONFIG_USB_PHY=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_USB_ISP1301=m +CONFIG_USB_ULPI=y +CONFIG_USB_ULPI_VIEWPORT=y +# end of USB Physical Layer drivers + +CONFIG_USB_GADGET=y +# CONFIG_USB_GADGET_DEBUG is not set +# CONFIG_USB_GADGET_DEBUG_FILES is not set +# CONFIG_USB_GADGET_DEBUG_FS is not set +CONFIG_USB_GADGET_VBUS_DRAW=2 +CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 +CONFIG_U_SERIAL_CONSOLE=y + +# +# USB Peripheral Controller +# +CONFIG_USB_GR_UDC=m +CONFIG_USB_R8A66597=m +CONFIG_USB_PXA27X=m +CONFIG_USB_MV_UDC=m +CONFIG_USB_MV_U3D=m +CONFIG_USB_SNP_CORE=m +CONFIG_USB_SNP_UDC_PLAT=m +CONFIG_USB_M66592=m +CONFIG_USB_BDC_UDC=m +CONFIG_USB_AMD5536UDC=m +CONFIG_USB_NET2272=m +# CONFIG_USB_NET2272_DMA is not set +CONFIG_USB_NET2280=m +CONFIG_USB_GOKU=m +CONFIG_USB_EG20T=m +CONFIG_USB_GADGET_XILINX=m +CONFIG_USB_MAX3420_UDC=m +# CONFIG_USB_CDNS2_UDC is not set +CONFIG_USB_DUMMY_HCD=m +# end of USB Peripheral Controller + +CONFIG_USB_LIBCOMPOSITE=m +CONFIG_USB_F_ACM=m +CONFIG_USB_F_SS_LB=m +CONFIG_USB_U_SERIAL=m +CONFIG_USB_U_ETHER=m +CONFIG_USB_U_AUDIO=m +CONFIG_USB_F_SERIAL=m +CONFIG_USB_F_OBEX=m +CONFIG_USB_F_NCM=m +CONFIG_USB_F_ECM=m +CONFIG_USB_F_PHONET=m +CONFIG_USB_F_EEM=m +CONFIG_USB_F_SUBSET=m +CONFIG_USB_F_RNDIS=m +CONFIG_USB_F_MASS_STORAGE=m +CONFIG_USB_F_FS=m +CONFIG_USB_F_UAC1=m +CONFIG_USB_F_UAC1_LEGACY=m +CONFIG_USB_F_UAC2=m +CONFIG_USB_F_UVC=m +CONFIG_USB_F_MIDI=m +CONFIG_USB_F_HID=m +CONFIG_USB_F_PRINTER=m +CONFIG_USB_F_TCM=m +CONFIG_USB_CONFIGFS=m +CONFIG_USB_CONFIGFS_SERIAL=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_OBEX=y +CONFIG_USB_CONFIGFS_NCM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS_EEM=y +# CONFIG_USB_CONFIGFS_PHONET is not set +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_LB_SS=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_CONFIGFS_F_UAC1=y +CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y +CONFIG_USB_CONFIGFS_F_UAC2=y +CONFIG_USB_CONFIGFS_F_MIDI=y +# CONFIG_USB_CONFIGFS_F_MIDI2 is not set +CONFIG_USB_CONFIGFS_F_HID=y +CONFIG_USB_CONFIGFS_F_UVC=y +CONFIG_USB_CONFIGFS_F_PRINTER=y +CONFIG_USB_CONFIGFS_F_TCM=y + +# +# USB Gadget precomposed configurations +# +CONFIG_USB_ZERO=m +# CONFIG_USB_ZERO_HNPTEST is not set +CONFIG_USB_AUDIO=m +CONFIG_GADGET_UAC1=y +# CONFIG_GADGET_UAC1_LEGACY is not set +CONFIG_USB_ETH=m +CONFIG_USB_ETH_RNDIS=y +CONFIG_USB_ETH_EEM=y +CONFIG_USB_G_NCM=m +CONFIG_USB_GADGETFS=m +CONFIG_USB_FUNCTIONFS=m +CONFIG_USB_FUNCTIONFS_ETH=y +CONFIG_USB_FUNCTIONFS_RNDIS=y +CONFIG_USB_FUNCTIONFS_GENERIC=y +CONFIG_USB_MASS_STORAGE=m +CONFIG_USB_GADGET_TARGET=m +CONFIG_USB_G_SERIAL=m +CONFIG_USB_MIDI_GADGET=m +CONFIG_USB_G_PRINTER=m +CONFIG_USB_CDC_COMPOSITE=m +CONFIG_USB_G_NOKIA=m +CONFIG_USB_G_ACM_MS=m +CONFIG_USB_G_MULTI=m +CONFIG_USB_G_MULTI_RNDIS=y +CONFIG_USB_G_MULTI_CDC=y +CONFIG_USB_G_HID=m +# CONFIG_USB_G_DBGP is not set +CONFIG_USB_G_WEBCAM=m +CONFIG_USB_RAW_GADGET=m +# end of USB Gadget precomposed configurations + +CONFIG_TYPEC=y +CONFIG_TYPEC_TCPM=m +CONFIG_TYPEC_TCPCI=m +CONFIG_TYPEC_RT1711H=m +CONFIG_TYPEC_TCPCI_MT6370=m +CONFIG_TYPEC_TCPCI_MAXIM=m +CONFIG_TYPEC_FUSB302=m +CONFIG_TYPEC_UCSI=m +CONFIG_UCSI_CCG=m +CONFIG_UCSI_ACPI=m +CONFIG_UCSI_STM32G0=m +CONFIG_TYPEC_TPS6598X=m +CONFIG_TYPEC_ANX7411=m +CONFIG_TYPEC_RT1719=m +CONFIG_TYPEC_HD3SS3220=m +CONFIG_TYPEC_STUSB160X=m +CONFIG_TYPEC_WUSB3801=m + +# +# USB Type-C Multiplexer/DeMultiplexer Switch support +# +CONFIG_TYPEC_MUX_FSA4480=m +# CONFIG_TYPEC_MUX_GPIO_SBU is not set +CONFIG_TYPEC_MUX_PI3USB30532=m +# CONFIG_TYPEC_MUX_IT5205 is not set +# CONFIG_TYPEC_MUX_NB7VPQ904M is not set +# CONFIG_TYPEC_MUX_PTN36502 is not set +# CONFIG_TYPEC_MUX_WCD939X_USBSS is not set +# end of USB Type-C Multiplexer/DeMultiplexer Switch support + +# +# USB Type-C Alternate Mode drivers +# +CONFIG_TYPEC_DP_ALTMODE=m +CONFIG_TYPEC_NVIDIA_ALTMODE=m +# end of USB Type-C Alternate Mode drivers + +CONFIG_USB_ROLE_SWITCH=y +CONFIG_MMC=y +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SD8787=m +CONFIG_PWRSEQ_SIMPLE=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_SDIO_UART=m +CONFIG_MMC_TEST=y + +# +# MMC/SD/SDIO Host Controller Drivers +# +# CONFIG_MMC_DEBUG is not set +CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_STM32_SDMMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_IO_ACCESSORS=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_ARASAN=y +CONFIG_MMC_SDHCI_OF_AT91=m +CONFIG_MMC_SDHCI_OF_DWCMSHC=y +CONFIG_MMC_SDHCI_CADENCE=y +CONFIG_MMC_SDHCI_F_SDH30=y +CONFIG_MMC_SDHCI_MILBEAUT=m +CONFIG_MMC_ALCOR=m +CONFIG_MMC_TIFM_SD=m +CONFIG_MMC_SPI=y +# CONFIG_MMC_CB710 is not set +CONFIG_MMC_VIA_SDMMC=m +CONFIG_MMC_DW=y +CONFIG_MMC_DW_PLTFM=y +CONFIG_MMC_DW_BLUEFIELD=m +CONFIG_MMC_DW_EXYNOS=y +CONFIG_MMC_DW_HI3798CV200=y +# CONFIG_MMC_DW_HI3798MV200 is not set +CONFIG_MMC_DW_K3=y +# CONFIG_MMC_DW_PCI is not set +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_MMC_VUB300=m +CONFIG_MMC_USHC=m +CONFIG_MMC_USDHI6ROL0=m +CONFIG_MMC_REALTEK_PCI=m +CONFIG_MMC_REALTEK_USB=m +CONFIG_MMC_CQHCI=y +CONFIG_MMC_HSQ=m +# CONFIG_MMC_TOSHIBA_PCI is not set +CONFIG_MMC_MTK=m +CONFIG_MMC_SDHCI_XENON=y +# CONFIG_MMC_LITEX is not set +CONFIG_SCSI_UFSHCD=y +# CONFIG_SCSI_UFS_BSG is not set +CONFIG_SCSI_UFS_HWMON=y +CONFIG_SCSI_UFSHCD_PCI=m +# CONFIG_SCSI_UFS_DWC_TC_PCI is not set +CONFIG_SCSI_UFSHCD_PLATFORM=y +# CONFIG_SCSI_UFS_CDNS_PLATFORM is not set +# CONFIG_SCSI_UFS_DWC_TC_PLATFORM is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_CLASS_FLASH=m +# CONFIG_LEDS_CLASS_MULTICOLOR is not set +# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set + +# +# LED drivers +# +CONFIG_LEDS_AN30259A=m +# CONFIG_LEDS_AW200XX is not set +# CONFIG_LEDS_AW2013 is not set +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +CONFIG_LEDS_CR0014114=m +CONFIG_LEDS_EL15203000=m +# CONFIG_LEDS_LM3530 is not set +CONFIG_LEDS_LM3532=m +# CONFIG_LEDS_LM3642 is not set +CONFIG_LEDS_LM3692X=m +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP3952 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_PCA995X is not set +# CONFIG_LEDS_DAC124S085 is not set +CONFIG_LEDS_PWM=m +CONFIG_LEDS_REGULATOR=m +# CONFIG_LEDS_BD2606MVV is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set +# CONFIG_LEDS_IS31FL319X is not set +# CONFIG_LEDS_IS31FL32XX is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +CONFIG_LEDS_SYSCON=y +CONFIG_LEDS_MLXREG=m +CONFIG_LEDS_USER=y +CONFIG_LEDS_SPI_BYTE=m +CONFIG_LEDS_TI_LMU_COMMON=m +CONFIG_LEDS_LM3697=m + +# +# Flash and Torch LED drivers +# +# CONFIG_LEDS_AAT1290 is not set +# CONFIG_LEDS_AS3645A is not set +# CONFIG_LEDS_KTD2692 is not set +# CONFIG_LEDS_LM3601X is not set +# CONFIG_LEDS_MT6370_FLASH is not set +# CONFIG_LEDS_RT4505 is not set +# CONFIG_LEDS_RT8515 is not set +# CONFIG_LEDS_SGM3140 is not set +# CONFIG_LEDS_SY7802 is not set + +# +# RGB LED drivers +# + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=m +CONFIG_LEDS_TRIGGER_ONESHOT=m +CONFIG_LEDS_TRIGGER_DISK=y +CONFIG_LEDS_TRIGGER_MTD=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=m +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_ACTIVITY=y +# CONFIG_LEDS_TRIGGER_GPIO is not set +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y + +# +# iptables trigger is under Netfilter config (LED target) +# +CONFIG_LEDS_TRIGGER_TRANSIENT=m +CONFIG_LEDS_TRIGGER_CAMERA=m +CONFIG_LEDS_TRIGGER_PANIC=y +CONFIG_LEDS_TRIGGER_NETDEV=m +CONFIG_LEDS_TRIGGER_PATTERN=m +CONFIG_LEDS_TRIGGER_TTY=m +# CONFIG_LEDS_TRIGGER_INPUT_EVENTS is not set + +# +# Simple LED drivers +# +# CONFIG_ACCESSIBILITY is not set +# CONFIG_INFINIBAND is not set +CONFIG_EDAC_SUPPORT=y +CONFIG_EDAC=y +CONFIG_EDAC_LEGACY_SYSFS=y +# CONFIG_EDAC_DEBUG is not set +CONFIG_EDAC_GHES=y +# CONFIG_EDAC_THUNDERX is not set +# CONFIG_EDAC_XGENE is not set +CONFIG_EDAC_DMC520=m +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set +CONFIG_RTC_LIB_KUNIT_TEST=m +CONFIG_RTC_NVMEM=y + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABEOZ9 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +CONFIG_RTC_DRV_HYM8563=y +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_MAX31335 is not set +# CONFIG_RTC_DRV_NCT3018Y is not set +CONFIG_RTC_DRV_RK808=m +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12026 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF85363 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8010 is not set +# CONFIG_RTC_DRV_RX8111 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3028 is not set +# CONFIG_RTC_DRV_RV3032 is not set +# CONFIG_RTC_DRV_RV8803 is not set +# CONFIG_RTC_DRV_SD3078 is not set + +# +# SPI RTC drivers +# +# CONFIG_RTC_DRV_M41T93 is not set +# CONFIG_RTC_DRV_M41T94 is not set +# CONFIG_RTC_DRV_DS1302 is not set +# CONFIG_RTC_DRV_DS1305 is not set +# CONFIG_RTC_DRV_DS1343 is not set +# CONFIG_RTC_DRV_DS1347 is not set +# CONFIG_RTC_DRV_DS1390 is not set +# CONFIG_RTC_DRV_MAX6916 is not set +# CONFIG_RTC_DRV_R9701 is not set +# CONFIG_RTC_DRV_RX4581 is not set +# CONFIG_RTC_DRV_RS5C348 is not set +# CONFIG_RTC_DRV_MAX6902 is not set +# CONFIG_RTC_DRV_PCF2123 is not set +# CONFIG_RTC_DRV_MCP795 is not set +CONFIG_RTC_I2C_AND_SPI=y + +# +# SPI and I2C RTC drivers +# +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RX6110 is not set + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_EFI is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +CONFIG_RTC_DRV_OPTEE=m +# CONFIG_RTC_DRV_ZYNQMP is not set +# CONFIG_RTC_DRV_CROS_EC is not set +# CONFIG_RTC_DRV_NTXEC is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +# CONFIG_RTC_DRV_PL031 is not set +# CONFIG_RTC_DRV_CADENCE is not set +# CONFIG_RTC_DRV_FTRTC010 is not set +# CONFIG_RTC_DRV_R7301 is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +# CONFIG_RTC_DRV_GOLDFISH is not set +CONFIG_DMADEVICES=y +# CONFIG_DMADEVICES_DEBUG is not set + +# +# DMA Devices +# +CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DMA_ACPI=y +CONFIG_DMA_OF=y +CONFIG_ALTERA_MSGDMA=m +# CONFIG_AMBA_PL08X is not set +CONFIG_BCM_SBA_RAID=m +CONFIG_DW_AXI_DMAC=m +CONFIG_FSL_EDMA=y +CONFIG_FSL_QDMA=m +# CONFIG_INTEL_IDMA64 is not set +CONFIG_MV_XOR_V2=y +CONFIG_PL330_DMA=y +CONFIG_PLX_DMA=m +# CONFIG_XILINX_DMA is not set +# CONFIG_XILINX_XDMA is not set +# CONFIG_XILINX_ZYNQMP_DMA is not set +# CONFIG_XILINX_ZYNQMP_DPDMA is not set +CONFIG_QCOM_HIDMA_MGMT=y +CONFIG_QCOM_HIDMA=y +CONFIG_DW_DMAC_CORE=m +CONFIG_DW_DMAC=m +CONFIG_DW_DMAC_PCI=m +CONFIG_DW_EDMA=m +CONFIG_DW_EDMA_PCIE=m +CONFIG_SF_PDMA=m + +# +# DMA Clients +# +CONFIG_ASYNC_TX_DMA=y +# CONFIG_DMATEST is not set +CONFIG_DMA_ENGINE_RAID=y + +# +# DMABUF options +# +CONFIG_SYNC_FILE=y +# CONFIG_SW_SYNC is not set +CONFIG_UDMABUF=y +# CONFIG_DMABUF_MOVE_NOTIFY is not set +# CONFIG_DMABUF_DEBUG is not set +CONFIG_DMABUF_SELFTESTS=m +CONFIG_DMABUF_HEAPS=y +CONFIG_DMABUF_SYSFS_STATS=y +CONFIG_DMABUF_HEAPS_SYSTEM=y +CONFIG_DMABUF_HEAPS_CMA=y +# end of DMABUF options + +CONFIG_UIO=m +CONFIG_UIO_CIF=m +# CONFIG_UIO_PDRV_GENIRQ is not set +# CONFIG_UIO_DMEM_GENIRQ is not set +CONFIG_UIO_AEC=m +CONFIG_UIO_SERCOS3=m +CONFIG_UIO_PCI_GENERIC=m +# CONFIG_UIO_NETX is not set +# CONFIG_UIO_MF624 is not set +CONFIG_VFIO=y +CONFIG_VFIO_GROUP=y +CONFIG_VFIO_CONTAINER=y +CONFIG_VFIO_IOMMU_TYPE1=y +# CONFIG_VFIO_NOIOMMU is not set +CONFIG_VFIO_VIRQFD=y +# CONFIG_VFIO_DEBUGFS is not set + +# +# VFIO support for PCI devices +# +CONFIG_VFIO_PCI_CORE=y +CONFIG_VFIO_PCI_MMAP=y +CONFIG_VFIO_PCI_INTX=y +CONFIG_VFIO_PCI=y +CONFIG_MLX5_VFIO_PCI=m +# CONFIG_HISI_ACC_VFIO_PCI is not set +# CONFIG_NVGRACE_GPU_VFIO_PCI is not set +# end of VFIO support for PCI devices + +# +# VFIO support for platform devices +# +# CONFIG_VFIO_PLATFORM is not set +# CONFIG_VFIO_AMBA is not set +# end of VFIO support for platform devices + +CONFIG_IRQ_BYPASS_MANAGER=y +CONFIG_VIRT_DRIVERS=y +CONFIG_VMGENID=y +CONFIG_NITRO_ENCLAVES=m +CONFIG_VIRTIO_ANCHOR=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_PCI_LIB=y +CONFIG_VIRTIO_PCI_LIB_LEGACY=y +CONFIG_VIRTIO_MENU=y +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_PCI_LEGACY=y +CONFIG_VIRTIO_VDPA=m +CONFIG_VIRTIO_BALLOON=y +CONFIG_VIRTIO_INPUT=m +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set +CONFIG_VIRTIO_DMA_SHARED_BUFFER=m +# CONFIG_VIRTIO_DEBUG is not set +CONFIG_VDPA=m +CONFIG_VDPA_SIM=m +CONFIG_VDPA_SIM_NET=m +CONFIG_VDPA_SIM_BLOCK=m +CONFIG_VDPA_USER=m +CONFIG_IFCVF=m +CONFIG_MLX5_VDPA=y +CONFIG_MLX5_VDPA_NET=m +# CONFIG_MLX5_VDPA_STEERING_DEBUG is not set +CONFIG_VP_VDPA=m +# CONFIG_SNET_VDPA is not set +# CONFIG_OCTEONEP_VDPA is not set +CONFIG_VHOST_IOTLB=m +CONFIG_VHOST_RING=m +CONFIG_VHOST_TASK=y +CONFIG_VHOST=m +CONFIG_VHOST_MENU=y +CONFIG_VHOST_NET=m +CONFIG_VHOST_SCSI=m +# CONFIG_VHOST_VSOCK is not set +CONFIG_VHOST_VDPA=m +# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set + +# +# Microsoft Hyper-V guest support +# +# CONFIG_HYPERV is not set +# end of Microsoft Hyper-V guest support + +# +# Xen driver support +# +CONFIG_XEN_BALLOON=y +CONFIG_XEN_SCRUB_PAGES_DEFAULT=y +CONFIG_XEN_DEV_EVTCHN=y +CONFIG_XEN_BACKEND=y +CONFIG_XENFS=y +CONFIG_XEN_COMPAT_XENFS=y +CONFIG_XEN_SYS_HYPERVISOR=y +CONFIG_XEN_XENBUS_FRONTEND=y +CONFIG_XEN_GNTDEV=y +CONFIG_XEN_GRANT_DEV_ALLOC=y +# CONFIG_XEN_GRANT_DMA_ALLOC is not set +CONFIG_SWIOTLB_XEN=y +CONFIG_XEN_PCI_STUB=y +CONFIG_XEN_PCIDEV_STUB=m +# CONFIG_XEN_PVCALLS_FRONTEND is not set +# CONFIG_XEN_PVCALLS_BACKEND is not set +CONFIG_XEN_SCSI_BACKEND=m +CONFIG_XEN_PRIVCMD=y +CONFIG_XEN_EFI=y +CONFIG_XEN_AUTO_XLATE=y +CONFIG_XEN_FRONT_PGDIR_SHBUF=m +# CONFIG_XEN_VIRTIO is not set +# end of Xen driver support + +# CONFIG_GREYBUS is not set +# CONFIG_COMEDI is not set +CONFIG_STAGING=y +CONFIG_RTLLIB=m +CONFIG_RTLLIB_CRYPTO_CCMP=m +CONFIG_RTLLIB_CRYPTO_TKIP=m +CONFIG_RTLLIB_CRYPTO_WEP=m +CONFIG_RTL8192E=m +CONFIG_RTL8723BS=m +CONFIG_R8712U=m +CONFIG_RTS5208=m +CONFIG_VT6655=m +CONFIG_VT6656=m + +# +# IIO staging drivers +# + +# +# Accelerometers +# +# CONFIG_ADIS16203 is not set +# CONFIG_ADIS16240 is not set +# end of Accelerometers + +# +# Analog to digital converters +# +# CONFIG_AD7816 is not set +# end of Analog to digital converters + +# +# Analog digital bi-direction converters +# +# CONFIG_ADT7316 is not set +# end of Analog digital bi-direction converters + +# +# Direct Digital Synthesis +# +CONFIG_AD9832=m +CONFIG_AD9834=m +# end of Direct Digital Synthesis + +# +# Network Analyzer, Impedance Converters +# +# CONFIG_AD5933 is not set +# end of Network Analyzer, Impedance Converters +# end of IIO staging drivers + +CONFIG_FB_SM750=m +CONFIG_STAGING_MEDIA=y +CONFIG_DVB_AV7110_IR=y +CONFIG_DVB_AV7110=m +CONFIG_DVB_AV7110_OSD=y +CONFIG_DVB_SP8870=m +# CONFIG_VIDEO_MAX96712 is not set +CONFIG_VIDEO_ROCKCHIP_VDEC=m + +# +# StarFive media platform drivers +# +CONFIG_STAGING_MEDIA_DEPRECATED=y + +# +# Atmel media platform drivers +# +# CONFIG_LTE_GDM724X is not set +CONFIG_FB_TFT=m +CONFIG_FB_TFT_AGM1264K_FL=m +CONFIG_FB_TFT_BD663474=m +CONFIG_FB_TFT_HX8340BN=m +CONFIG_FB_TFT_HX8347D=m +CONFIG_FB_TFT_HX8353D=m +CONFIG_FB_TFT_HX8357D=m +CONFIG_FB_TFT_ILI9163=m +CONFIG_FB_TFT_ILI9320=m +CONFIG_FB_TFT_ILI9325=m +CONFIG_FB_TFT_ILI9340=m +CONFIG_FB_TFT_ILI9341=m +CONFIG_FB_TFT_ILI9481=m +CONFIG_FB_TFT_ILI9486=m +CONFIG_FB_TFT_PCD8544=m +CONFIG_FB_TFT_RA8875=m +CONFIG_FB_TFT_S6D02A1=m +CONFIG_FB_TFT_S6D1121=m +CONFIG_FB_TFT_SEPS525=m +CONFIG_FB_TFT_SH1106=m +CONFIG_FB_TFT_SSD1289=m +CONFIG_FB_TFT_SSD1305=m +CONFIG_FB_TFT_SSD1306=m +CONFIG_FB_TFT_SSD1331=m +CONFIG_FB_TFT_SSD1351=m +CONFIG_FB_TFT_ST7735R=m +CONFIG_FB_TFT_ST7789V=m +CONFIG_FB_TFT_TINYLCD=m +CONFIG_FB_TFT_TLS8204=m +CONFIG_FB_TFT_UC1611=m +CONFIG_FB_TFT_UC1701=m +CONFIG_FB_TFT_UPD161704=m +# CONFIG_MOST_COMPONENTS is not set +# CONFIG_KS7010 is not set +# CONFIG_XIL_AXIS_FIFO is not set +CONFIG_FIELDBUS_DEV=m +CONFIG_HMS_ANYBUSS_BUS=m +# CONFIG_ARCX_ANYBUS_CONTROLLER is not set +# CONFIG_HMS_PROFINET is not set +# CONFIG_VME_BUS is not set +# CONFIG_RTL8723CS is not set +# CONFIG_GOLDFISH is not set +CONFIG_CHROME_PLATFORMS=y +CONFIG_CHROMEOS_ACPI=m +# CONFIG_CHROMEOS_TBMC is not set +CONFIG_CROS_EC=y +CONFIG_CROS_EC_I2C=y +# CONFIG_CROS_EC_RPMSG is not set +CONFIG_CROS_EC_SPI=y +# CONFIG_CROS_EC_UART is not set +CONFIG_CROS_EC_PROTO=y +# CONFIG_CROS_KBD_LED_BACKLIGHT is not set +CONFIG_CROS_EC_CHARDEV=y +CONFIG_CROS_EC_LIGHTBAR=y +CONFIG_CROS_EC_VBC=y +CONFIG_CROS_EC_DEBUGFS=y +CONFIG_CROS_EC_SENSORHUB=y +CONFIG_CROS_EC_SYSFS=y +CONFIG_CROS_EC_TYPEC=m +# CONFIG_CROS_HPS_I2C is not set +CONFIG_CROS_USBPD_NOTIFY=y +# CONFIG_CHROMEOS_PRIVACY_SCREEN is not set +CONFIG_CROS_TYPEC_SWITCH=m +# CONFIG_CROS_KUNIT_EC_PROTO_TEST is not set +# CONFIG_CZNIC_PLATFORMS is not set +# CONFIG_MELLANOX_PLATFORM is not set +CONFIG_SURFACE_PLATFORMS=y +# CONFIG_SURFACE_3_POWER_OPREGION is not set +# CONFIG_SURFACE_GPE is not set +# CONFIG_SURFACE_HOTPLUG is not set +# CONFIG_SURFACE_PRO3_BUTTON is not set +# CONFIG_SURFACE_AGGREGATOR is not set +CONFIG_ARM64_PLATFORM_DEVICES=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Clock driver for ARM Reference designs +# +# CONFIG_CLK_ICST is not set +# CONFIG_CLK_SP810 is not set +# CONFIG_CLK_VEXPRESS_OSC is not set +# end of Clock driver for ARM Reference designs + +# CONFIG_LMK04832 is not set +# CONFIG_COMMON_CLK_MAX9485 is not set +CONFIG_COMMON_CLK_RK808=m +CONFIG_COMMON_CLK_SCMI=y +# CONFIG_COMMON_CLK_SCPI is not set +# CONFIG_COMMON_CLK_SI5341 is not set +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI544 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE706 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_COMMON_CLK_CS2000_CP is not set +# CONFIG_COMMON_CLK_AXI_CLKGEN is not set +# CONFIG_COMMON_CLK_XGENE is not set +CONFIG_COMMON_CLK_PWM=y +# CONFIG_COMMON_CLK_RS9_PCIE is not set +# CONFIG_COMMON_CLK_SI521XX is not set +# CONFIG_COMMON_CLK_VC3 is not set +# CONFIG_COMMON_CLK_VC5 is not set +# CONFIG_COMMON_CLK_VC7 is not set +# CONFIG_COMMON_CLK_FIXED_MMIO is not set +CONFIG_COMMON_CLK_ROCKCHIP=y +CONFIG_CLK_PX30=y +CONFIG_CLK_RK3308=y +CONFIG_CLK_RK3328=y +CONFIG_CLK_RK3368=y +CONFIG_CLK_RK3399=y +CONFIG_CLK_RK3568=y +CONFIG_CLK_RK3588=y +# CONFIG_XILINX_VCU is not set +# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set +# CONFIG_CLK_KUNIT_TEST is not set +# CONFIG_CLK_GATE_KUNIT_TEST is not set +# CONFIG_CLK_FD_KUNIT_TEST is not set +# CONFIG_HWSPINLOCK is not set + +# +# Clock Source drivers +# +CONFIG_TIMER_OF=y +CONFIG_TIMER_ACPI=y +CONFIG_TIMER_PROBE=y +CONFIG_CLKSRC_MMIO=y +CONFIG_ROCKCHIP_TIMER=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y +CONFIG_FSL_ERRATUM_A008585=y +CONFIG_HISILICON_ERRATUM_161010101=y +CONFIG_ARM64_ERRATUM_858921=y +# end of Clock Source drivers + +CONFIG_MAILBOX=y +CONFIG_ARM_MHU=y +CONFIG_ARM_MHU_V2=m +# CONFIG_ARM_MHU_V3 is not set +CONFIG_PLATFORM_MHU=y +# CONFIG_PL320_MBOX is not set +CONFIG_ROCKCHIP_MBOX=y +CONFIG_PCC=y +# CONFIG_ALTERA_MBOX is not set +# CONFIG_MAILBOX_TEST is not set +CONFIG_IOMMU_IOVA=y +CONFIG_IOMMU_API=y +CONFIG_IOMMUFD_DRIVER=y +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +CONFIG_IOMMU_IO_PGTABLE=y +CONFIG_IOMMU_IO_PGTABLE_LPAE=y +# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set +CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S_SELFTEST is not set +# CONFIG_IOMMU_IO_PGTABLE_DART is not set +# end of Generic IOMMU Pagetable Support + +# CONFIG_IOMMU_DEBUGFS is not set +CONFIG_IOMMU_DEFAULT_DMA_STRICT=y +# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set +CONFIG_OF_IOMMU=y +CONFIG_IOMMU_DMA=y +CONFIG_IOMMU_SVA=y +CONFIG_IOMMU_IOPF=y +# CONFIG_IOMMUFD is not set +CONFIG_ROCKCHIP_IOMMU=y +CONFIG_ARM_SMMU=y +# CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS is not set +CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT=y +CONFIG_ARM_SMMU_V3=y +CONFIG_ARM_SMMU_V3_SVA=y +# CONFIG_ARM_SMMU_V3_KUNIT_TEST is not set +CONFIG_VIRTIO_IOMMU=m + +# +# Remoteproc drivers +# +CONFIG_REMOTEPROC=y +# CONFIG_REMOTEPROC_CDEV is not set +# end of Remoteproc drivers + +# +# Rpmsg drivers +# +CONFIG_RPMSG=y +# CONFIG_RPMSG_CHAR is not set +# CONFIG_RPMSG_CTRL is not set +CONFIG_RPMSG_NS=m +CONFIG_RPMSG_QCOM_GLINK=y +CONFIG_RPMSG_QCOM_GLINK_RPM=y +# CONFIG_RPMSG_VIRTIO is not set +# end of Rpmsg drivers + +CONFIG_SOUNDWIRE=m + +# +# SoundWire Devices +# +# CONFIG_SOUNDWIRE_AMD is not set +# CONFIG_SOUNDWIRE_INTEL is not set +CONFIG_SOUNDWIRE_QCOM=m + +# +# SOC (System On Chip) specific Drivers +# + +# +# Amlogic SoC drivers +# +# end of Amlogic SoC drivers + +# +# Broadcom SoC drivers +# +# end of Broadcom SoC drivers + +# +# NXP/Freescale QorIQ SoC drivers +# +# CONFIG_QUICC_ENGINE is not set +# CONFIG_FSL_RCPM is not set +# end of NXP/Freescale QorIQ SoC drivers + +# +# fujitsu SoC drivers +# +# CONFIG_A64FX_DIAG is not set +# end of fujitsu SoC drivers + +# +# i.MX SoC drivers +# +# end of i.MX SoC drivers + +# +# Enable LiteX SoC Builder specific drivers +# +CONFIG_LITEX=y +CONFIG_LITEX_SOC_CONTROLLER=m +# end of Enable LiteX SoC Builder specific drivers + +# CONFIG_WPCM450_SOC is not set + +# +# Qualcomm SoC drivers +# +# CONFIG_QCOM_PMIC_PDCHARGER_ULOG is not set +# CONFIG_QCOM_PMIC_GLINK is not set +CONFIG_QCOM_QMI_HELPERS=m +# CONFIG_QCOM_PBS is not set +# end of Qualcomm SoC drivers + +CONFIG_ROCKCHIP_GRF=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_SOC_TI=y + +# +# Xilinx SoC drivers +# +# end of Xilinx SoC drivers +# end of SOC (System On Chip) specific Drivers + +# +# PM Domains +# + +# +# Amlogic PM Domains +# +# end of Amlogic PM Domains + +CONFIG_ARM_SCMI_PERF_DOMAIN=y +CONFIG_ARM_SCMI_POWER_DOMAIN=y +CONFIG_ARM_SCPI_POWER_DOMAIN=y + +# +# Broadcom PM Domains +# +# end of Broadcom PM Domains + +# +# i.MX PM Domains +# +# end of i.MX PM Domains + +# +# Qualcomm PM Domains +# +# end of Qualcomm PM Domains + +CONFIG_ROCKCHIP_PM_DOMAINS=y +# end of PM Domains + +CONFIG_PM_DEVFREQ=y + +# +# DEVFREQ Governors +# +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=m +CONFIG_DEVFREQ_GOV_POWERSAVE=m +CONFIG_DEVFREQ_GOV_USERSPACE=m +CONFIG_DEVFREQ_GOV_PASSIVE=m + +# +# DEVFREQ Drivers +# +CONFIG_ARM_RK3399_DMC_DEVFREQ=y +CONFIG_PM_DEVFREQ_EVENT=y +CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y +CONFIG_EXTCON=y + +# +# Extcon Device Drivers +# +CONFIG_EXTCON_ADC_JACK=m +# CONFIG_EXTCON_FSA9480 is not set +CONFIG_EXTCON_GPIO=y +# CONFIG_EXTCON_MAX3355 is not set +CONFIG_EXTCON_PTN5150=m +# CONFIG_EXTCON_RT8973A is not set +# CONFIG_EXTCON_SM5502 is not set +CONFIG_EXTCON_USB_GPIO=y +CONFIG_EXTCON_USBC_CROS_EC=y +CONFIG_EXTCON_USBC_TUSB320=m +CONFIG_MEMORY=y +# CONFIG_ARM_PL172_MPMC is not set +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +CONFIG_IIO_BUFFER_CB=m +# CONFIG_IIO_BUFFER_DMA is not set +# CONFIG_IIO_BUFFER_DMAENGINE is not set +CONFIG_IIO_BUFFER_HW_CONSUMER=m +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGERED_BUFFER=y +CONFIG_IIO_CONFIGFS=m +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 +CONFIG_IIO_SW_DEVICE=m +CONFIG_IIO_SW_TRIGGER=m +CONFIG_IIO_TRIGGERED_EVENT=m + +# +# Accelerometers +# +CONFIG_ADIS16201=m +CONFIG_ADIS16209=m +CONFIG_ADXL313=m +CONFIG_ADXL313_I2C=m +CONFIG_ADXL313_SPI=m +CONFIG_ADXL345=m +CONFIG_ADXL345_I2C=m +CONFIG_ADXL345_SPI=m +CONFIG_ADXL355=m +CONFIG_ADXL355_I2C=m +CONFIG_ADXL355_SPI=m +CONFIG_ADXL367=m +CONFIG_ADXL367_SPI=m +CONFIG_ADXL367_I2C=m +CONFIG_ADXL372=m +CONFIG_ADXL372_SPI=m +CONFIG_ADXL372_I2C=m +CONFIG_BMA180=m +CONFIG_BMA220=m +CONFIG_BMA400=m +CONFIG_BMA400_I2C=m +CONFIG_BMA400_SPI=m +CONFIG_BMC150_ACCEL=m +CONFIG_BMC150_ACCEL_I2C=m +CONFIG_BMC150_ACCEL_SPI=m +CONFIG_BMI088_ACCEL=m +CONFIG_BMI088_ACCEL_I2C=m +CONFIG_BMI088_ACCEL_SPI=m +CONFIG_DA280=m +CONFIG_DA311=m +CONFIG_DMARD06=m +CONFIG_DMARD09=m +CONFIG_DMARD10=m +CONFIG_FXLS8962AF=m +CONFIG_FXLS8962AF_I2C=m +CONFIG_FXLS8962AF_SPI=m +CONFIG_HID_SENSOR_ACCEL_3D=m +CONFIG_IIO_CROS_EC_ACCEL_LEGACY=m +CONFIG_IIO_ST_ACCEL_3AXIS=m +CONFIG_IIO_ST_ACCEL_I2C_3AXIS=m +CONFIG_IIO_ST_ACCEL_SPI_3AXIS=m +# CONFIG_IIO_KX022A_SPI is not set +# CONFIG_IIO_KX022A_I2C is not set +CONFIG_KXSD9=m +CONFIG_KXSD9_SPI=m +CONFIG_KXSD9_I2C=m +CONFIG_KXCJK1013=m +CONFIG_MC3230=m +CONFIG_MMA7455=m +CONFIG_MMA7455_I2C=m +CONFIG_MMA7455_SPI=m +CONFIG_MMA7660=m +CONFIG_MMA8452=m +CONFIG_MMA9551_CORE=m +CONFIG_MMA9551=m +CONFIG_MMA9553=m +# CONFIG_MSA311 is not set +CONFIG_MXC4005=m +CONFIG_MXC6255=m +CONFIG_SCA3000=m +CONFIG_SCA3300=m +CONFIG_STK8312=m +CONFIG_STK8BA50=m +# end of Accelerometers + +# +# Analog to digital converters +# +CONFIG_AD_SIGMA_DELTA=m +# CONFIG_AD4130 is not set +CONFIG_AD7091R=m +CONFIG_AD7091R5=m +# CONFIG_AD7091R8 is not set +CONFIG_AD7124=m +# CONFIG_AD7173 is not set +# CONFIG_AD7192 is not set +CONFIG_AD7266=m +# CONFIG_AD7280 is not set +CONFIG_AD7291=m +CONFIG_AD7292=m +CONFIG_AD7298=m +# CONFIG_AD7380 is not set +CONFIG_AD7476=m +CONFIG_AD7606=m +CONFIG_AD7606_IFACE_PARALLEL=m +CONFIG_AD7606_IFACE_SPI=m +CONFIG_AD7766=m +CONFIG_AD7768_1=m +# CONFIG_AD7780 is not set +CONFIG_AD7791=m +CONFIG_AD7793=m +CONFIG_AD7887=m +CONFIG_AD7923=m +# CONFIG_AD7944 is not set +CONFIG_AD7949=m +CONFIG_AD799X=m +# CONFIG_AD9467 is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_ENVELOPE_DETECTOR is not set +# CONFIG_HI8435 is not set +# CONFIG_HX711 is not set +# CONFIG_INA2XX_ADC is not set +# CONFIG_LTC2309 is not set +# CONFIG_LTC2471 is not set +# CONFIG_LTC2485 is not set +CONFIG_LTC2496=m +# CONFIG_LTC2497 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX11100 is not set +# CONFIG_MAX1118 is not set +CONFIG_MAX11205=m +# CONFIG_MAX11410 is not set +# CONFIG_MAX1241 is not set +CONFIG_MAX1363=m +# CONFIG_MAX34408 is not set +CONFIG_MAX9611=m +CONFIG_MCP320X=m +CONFIG_MCP3422=m +# CONFIG_MCP3564 is not set +CONFIG_MCP3911=m +# CONFIG_MEDIATEK_MT6370_ADC is not set +# CONFIG_NAU7802 is not set +# CONFIG_PAC1934 is not set +# CONFIG_QCOM_SPMI_IADC is not set +# CONFIG_QCOM_SPMI_VADC is not set +# CONFIG_QCOM_SPMI_ADC5 is not set +CONFIG_ROCKCHIP_SARADC=y +CONFIG_RICHTEK_RTQ6056=m +# CONFIG_SD_ADC_MODULATOR is not set +CONFIG_TI_ADC081C=m +CONFIG_TI_ADC0832=m +CONFIG_TI_ADC084S021=m +CONFIG_TI_ADC12138=m +CONFIG_TI_ADC108S102=m +CONFIG_TI_ADC128S052=m +CONFIG_TI_ADC161S626=m +CONFIG_TI_ADS1015=m +# CONFIG_TI_ADS1119 is not set +# CONFIG_TI_ADS7924 is not set +# CONFIG_TI_ADS1100 is not set +# CONFIG_TI_ADS1298 is not set +CONFIG_TI_ADS7950=m +CONFIG_TI_ADS8344=m +CONFIG_TI_ADS8688=m +CONFIG_TI_ADS124S08=m +CONFIG_TI_ADS131E08=m +# CONFIG_TI_LMP92064 is not set +# CONFIG_TI_TLC4541 is not set +CONFIG_TI_TSC2046=m +# CONFIG_VF610_ADC is not set +CONFIG_XILINX_XADC=m +# end of Analog to digital converters + +# +# Analog to digital and digital to analog converters +# +# CONFIG_AD74115 is not set +# CONFIG_AD74413R is not set +# end of Analog to digital and digital to analog converters + +# +# Analog Front Ends +# +# CONFIG_IIO_RESCALE is not set +# end of Analog Front Ends + +# +# Amplifiers +# +# CONFIG_AD8366 is not set +# CONFIG_ADA4250 is not set +CONFIG_HMC425=m +# end of Amplifiers + +# +# Capacitance to digital converters +# +# CONFIG_AD7150 is not set +# CONFIG_AD7746 is not set +# end of Capacitance to digital converters + +# +# Chemical Sensors +# +# CONFIG_AOSONG_AGS02MA is not set +# CONFIG_ATLAS_PH_SENSOR is not set +# CONFIG_ATLAS_EZO_SENSOR is not set +CONFIG_BME680=m +CONFIG_BME680_I2C=m +CONFIG_BME680_SPI=m +# CONFIG_CCS811 is not set +# CONFIG_ENS160 is not set +# CONFIG_IAQCORE is not set +CONFIG_PMS7003=m +# CONFIG_SCD30_CORE is not set +CONFIG_SCD4X=m +CONFIG_SENSIRION_SGP30=m +CONFIG_SENSIRION_SGP40=m +CONFIG_SPS30=m +CONFIG_SPS30_I2C=m +CONFIG_SPS30_SERIAL=m +CONFIG_SENSEAIR_SUNRISE_CO2=m +# CONFIG_VZ89X is not set +# end of Chemical Sensors + +CONFIG_IIO_CROS_EC_SENSORS_CORE=m +CONFIG_IIO_CROS_EC_SENSORS=m +# CONFIG_IIO_CROS_EC_SENSORS_LID_ANGLE is not set + +# +# Hid Sensor IIO Common +# +CONFIG_HID_SENSOR_IIO_COMMON=m +CONFIG_HID_SENSOR_IIO_TRIGGER=m +# end of Hid Sensor IIO Common + +CONFIG_IIO_MS_SENSORS_I2C=m + +# +# IIO SCMI Sensors +# +CONFIG_IIO_SCMI=m +# end of IIO SCMI Sensors + +# +# SSP Sensor Common +# +# CONFIG_IIO_SSP_SENSORHUB is not set +# end of SSP Sensor Common + +CONFIG_IIO_ST_SENSORS_I2C=m +CONFIG_IIO_ST_SENSORS_SPI=m +CONFIG_IIO_ST_SENSORS_CORE=m + +# +# Digital to analog converters +# +# CONFIG_AD3552R is not set +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5592R is not set +# CONFIG_AD5593R is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD9739A is not set +# CONFIG_LTC2688 is not set +CONFIG_AD5686=m +CONFIG_AD5686_SPI=m +CONFIG_AD5696_I2C=m +# CONFIG_AD5755 is not set +CONFIG_AD5758=m +# CONFIG_AD5761 is not set +# CONFIG_AD5764 is not set +CONFIG_AD5766=m +CONFIG_AD5770R=m +# CONFIG_AD5791 is not set +# CONFIG_AD7293 is not set +# CONFIG_AD7303 is not set +# CONFIG_AD8801 is not set +# CONFIG_DPOT_DAC is not set +# CONFIG_DS4424 is not set +CONFIG_LTC1660=m +# CONFIG_LTC2632 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5522 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4728 is not set +# CONFIG_MCP4821 is not set +# CONFIG_MCP4922 is not set +# CONFIG_TI_DAC082S085 is not set +CONFIG_TI_DAC5571=m +CONFIG_TI_DAC7311=m +CONFIG_TI_DAC7612=m +# CONFIG_VF610_DAC is not set +# end of Digital to analog converters + +# +# IIO dummy driver +# +CONFIG_IIO_SIMPLE_DUMMY=m +# CONFIG_IIO_SIMPLE_DUMMY_EVENTS is not set +# CONFIG_IIO_SIMPLE_DUMMY_BUFFER is not set +# end of IIO dummy driver + +# +# Filters +# +# CONFIG_ADMV8818 is not set +# end of Filters + +# +# Frequency Synthesizers DDS/PLL +# + +# +# Clock Generator/Distribution +# +CONFIG_AD9523=m +# end of Clock Generator/Distribution + +# +# Phase-Locked Loop (PLL) frequency synthesizers +# +# CONFIG_ADF4350 is not set +CONFIG_ADF4371=m +# CONFIG_ADF4377 is not set +# CONFIG_ADMFM2000 is not set +# CONFIG_ADMV1013 is not set +# CONFIG_ADMV1014 is not set +# CONFIG_ADMV4420 is not set +CONFIG_ADRF6780=m +# end of Phase-Locked Loop (PLL) frequency synthesizers +# end of Frequency Synthesizers DDS/PLL + +# +# Digital gyroscope sensors +# +CONFIG_ADIS16080=m +CONFIG_ADIS16130=m +CONFIG_ADIS16136=m +CONFIG_ADIS16260=m +# CONFIG_ADXRS290 is not set +CONFIG_ADXRS450=m +CONFIG_BMG160=m +CONFIG_BMG160_I2C=m +CONFIG_BMG160_SPI=m +CONFIG_FXAS21002C=m +CONFIG_FXAS21002C_I2C=m +CONFIG_FXAS21002C_SPI=m +CONFIG_HID_SENSOR_GYRO_3D=m +CONFIG_MPU3050=m +CONFIG_MPU3050_I2C=m +CONFIG_IIO_ST_GYRO_3AXIS=m +CONFIG_IIO_ST_GYRO_I2C_3AXIS=m +CONFIG_IIO_ST_GYRO_SPI_3AXIS=m +CONFIG_ITG3200=m +# end of Digital gyroscope sensors + +# +# Health Sensors +# + +# +# Heart Rate Monitors +# +CONFIG_AFE4403=m +CONFIG_AFE4404=m +CONFIG_MAX30100=m +CONFIG_MAX30102=m +# end of Heart Rate Monitors +# end of Health Sensors + +# +# Humidity sensors +# +CONFIG_AM2315=m +CONFIG_DHT11=m +CONFIG_HDC100X=m +# CONFIG_HDC2010 is not set +# CONFIG_HDC3020 is not set +CONFIG_HID_SENSOR_HUMIDITY=m +CONFIG_HTS221=m +CONFIG_HTS221_I2C=m +CONFIG_HTS221_SPI=m +CONFIG_HTU21=m +CONFIG_SI7005=m +CONFIG_SI7020=m +# end of Humidity sensors + +# +# Inertial measurement units +# +# CONFIG_ADIS16400 is not set +CONFIG_ADIS16460=m +# CONFIG_ADIS16475 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_BMI160_I2C is not set +# CONFIG_BMI160_SPI is not set +# CONFIG_BMI323_I2C is not set +# CONFIG_BMI323_SPI is not set +# CONFIG_BOSCH_BNO055_SERIAL is not set +# CONFIG_BOSCH_BNO055_I2C is not set +CONFIG_FXOS8700=m +CONFIG_FXOS8700_I2C=m +CONFIG_FXOS8700_SPI=m +# CONFIG_KMX61 is not set +# CONFIG_INV_ICM42600_I2C is not set +# CONFIG_INV_ICM42600_SPI is not set +# CONFIG_INV_MPU6050_I2C is not set +# CONFIG_INV_MPU6050_SPI is not set +# CONFIG_IIO_ST_LSM6DSX is not set +CONFIG_IIO_ST_LSM9DS0=m +CONFIG_IIO_ST_LSM9DS0_I2C=m +CONFIG_IIO_ST_LSM9DS0_SPI=m +# end of Inertial measurement units + +CONFIG_IIO_ADIS_LIB=m +CONFIG_IIO_ADIS_LIB_BUFFER=y + +# +# Light sensors +# +CONFIG_ACPI_ALS=m +CONFIG_ADJD_S311=m +CONFIG_ADUX1020=m +CONFIG_AL3010=m +CONFIG_AL3320A=m +CONFIG_APDS9300=m +# CONFIG_APDS9306 is not set +CONFIG_APDS9960=m +# CONFIG_AS73211 is not set +CONFIG_BH1750=m +CONFIG_BH1780=m +CONFIG_CM32181=m +CONFIG_CM3232=m +CONFIG_CM3323=m +CONFIG_CM3605=m +CONFIG_CM36651=m +CONFIG_IIO_CROS_EC_LIGHT_PROX=m +CONFIG_GP2AP002=m +CONFIG_GP2AP020A00F=m +CONFIG_SENSORS_ISL29018=m +CONFIG_SENSORS_ISL29028=m +CONFIG_ISL29125=m +# CONFIG_ISL76682 is not set +CONFIG_HID_SENSOR_ALS=m +CONFIG_HID_SENSOR_PROX=m +CONFIG_JSA1212=m +# CONFIG_ROHM_BU27008 is not set +# CONFIG_ROHM_BU27034 is not set +CONFIG_RPR0521=m +# CONFIG_LTR390 is not set +CONFIG_LTR501=m +# CONFIG_LTRF216A is not set +CONFIG_LV0104CS=m +CONFIG_MAX44000=m +CONFIG_MAX44009=m +CONFIG_NOA1305=m +CONFIG_OPT3001=m +# CONFIG_OPT4001 is not set +CONFIG_PA12203001=m +CONFIG_SI1133=m +CONFIG_SI1145=m +CONFIG_STK3310=m +CONFIG_ST_UVIS25=m +CONFIG_ST_UVIS25_I2C=m +CONFIG_ST_UVIS25_SPI=m +CONFIG_TCS3414=m +CONFIG_TCS3472=m +CONFIG_SENSORS_TSL2563=m +CONFIG_TSL2583=m +CONFIG_TSL2591=m +CONFIG_TSL2772=m +CONFIG_TSL4531=m +CONFIG_US5182D=m +CONFIG_VCNL4000=m +CONFIG_VCNL4035=m +CONFIG_VEML6030=m +# CONFIG_VEML6040 is not set +CONFIG_VEML6070=m +# CONFIG_VEML6075 is not set +CONFIG_VL6180=m +CONFIG_ZOPT2201=m +# end of Light sensors + +# +# Magnetometer sensors +# +# CONFIG_AF8133J is not set +CONFIG_AK8974=m +CONFIG_AK8975=m +CONFIG_AK09911=m +CONFIG_BMC150_MAGN=m +CONFIG_BMC150_MAGN_I2C=m +CONFIG_BMC150_MAGN_SPI=m +CONFIG_MAG3110=m +CONFIG_HID_SENSOR_MAGNETOMETER_3D=m +CONFIG_MMC35240=m +CONFIG_IIO_ST_MAGN_3AXIS=m +CONFIG_IIO_ST_MAGN_I2C_3AXIS=m +CONFIG_IIO_ST_MAGN_SPI_3AXIS=m +CONFIG_SENSORS_HMC5843=m +CONFIG_SENSORS_HMC5843_I2C=m +CONFIG_SENSORS_HMC5843_SPI=m +CONFIG_SENSORS_RM3100=m +CONFIG_SENSORS_RM3100_I2C=m +CONFIG_SENSORS_RM3100_SPI=m +# CONFIG_TI_TMAG5273 is not set +CONFIG_YAMAHA_YAS530=m +# end of Magnetometer sensors + +# +# Multiplexers +# +# CONFIG_IIO_MUX is not set +# end of Multiplexers + +# +# Inclinometer sensors +# +CONFIG_HID_SENSOR_INCLINOMETER_3D=m +CONFIG_HID_SENSOR_DEVICE_ROTATION=m +# end of Inclinometer sensors + +# CONFIG_IIO_GTS_KUNIT_TEST is not set +CONFIG_IIO_FORMAT_KUNIT_TEST=m + +# +# Triggers - standalone +# +CONFIG_IIO_HRTIMER_TRIGGER=m +CONFIG_IIO_INTERRUPT_TRIGGER=m +CONFIG_IIO_TIGHTLOOP_TRIGGER=m +CONFIG_IIO_SYSFS_TRIGGER=m +# end of Triggers - standalone + +# +# Linear and angular position sensors +# +CONFIG_HID_SENSOR_CUSTOM_INTEL_HINGE=m +# end of Linear and angular position sensors + +# +# Digital potentiometers +# +CONFIG_AD5110=m +CONFIG_AD5272=m +CONFIG_DS1803=m +CONFIG_MAX5432=m +# CONFIG_MAX5481 is not set +# CONFIG_MAX5487 is not set +CONFIG_MCP4018=m +# CONFIG_MCP4131 is not set +# CONFIG_MCP4531 is not set +CONFIG_MCP41010=m +# CONFIG_TPL0102 is not set +# CONFIG_X9250 is not set +# end of Digital potentiometers + +# +# Digital potentiostats +# +# CONFIG_LMP91000 is not set +# end of Digital potentiostats + +# +# Pressure sensors +# +# CONFIG_ABP060MG is not set +# CONFIG_ROHM_BM1390 is not set +CONFIG_BMP280=m +CONFIG_BMP280_I2C=m +CONFIG_BMP280_SPI=m +# CONFIG_IIO_CROS_EC_BARO is not set +CONFIG_DLHL60D=m +CONFIG_DPS310=m +CONFIG_HID_SENSOR_PRESS=m +# CONFIG_HP03 is not set +# CONFIG_HSC030PA is not set +CONFIG_ICP10100=m +# CONFIG_MPL115_I2C is not set +# CONFIG_MPL115_SPI is not set +CONFIG_MPL3115=m +# CONFIG_MPRLS0025PA is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set +# CONFIG_HP206C is not set +# CONFIG_ZPA2326 is not set +# end of Pressure sensors + +# +# Lightning sensors +# +# CONFIG_AS3935 is not set +# end of Lightning sensors + +# +# Proximity and distance sensors +# +CONFIG_CROS_EC_MKBP_PROXIMITY=m +# CONFIG_IRSD200 is not set +CONFIG_ISL29501=m +# CONFIG_LIDAR_LITE_V2 is not set +CONFIG_MB1232=m +CONFIG_PING=m +# CONFIG_RFD77402 is not set +# CONFIG_SRF04 is not set +# CONFIG_SX9310 is not set +# CONFIG_SX9324 is not set +# CONFIG_SX9360 is not set +# CONFIG_SX9500 is not set +# CONFIG_SRF08 is not set +# CONFIG_VCNL3020 is not set +CONFIG_VL53L0X_I2C=m +# end of Proximity and distance sensors + +# +# Resolver to digital converters +# +# CONFIG_AD2S90 is not set +# CONFIG_AD2S1200 is not set +# CONFIG_AD2S1210 is not set +# end of Resolver to digital converters + +# +# Temperature sensors +# +CONFIG_LTC2983=m +CONFIG_MAXIM_THERMOCOUPLE=m +CONFIG_HID_SENSOR_TEMP=m +CONFIG_MLX90614=m +CONFIG_MLX90632=m +# CONFIG_MLX90635 is not set +CONFIG_TMP006=m +CONFIG_TMP007=m +CONFIG_TMP117=m +CONFIG_TSYS01=m +CONFIG_TSYS02D=m +# CONFIG_MAX30208 is not set +CONFIG_MAX31856=m +CONFIG_MAX31865=m +# CONFIG_MCP9600 is not set +# end of Temperature sensors + +# CONFIG_NTB is not set +CONFIG_PWM=y +# CONFIG_PWM_DEBUG is not set +CONFIG_PWM_ATMEL_TCB=m +CONFIG_PWM_CLK=m +CONFIG_PWM_CROS_EC=m +CONFIG_PWM_DWC_CORE=m +CONFIG_PWM_DWC=m +# CONFIG_PWM_FSL_FTM is not set +# CONFIG_PWM_GPIO is not set +CONFIG_PWM_NTXEC=m +# CONFIG_PWM_PCA9685 is not set +CONFIG_PWM_ROCKCHIP=y +CONFIG_PWM_XILINX=m + +# +# IRQ chip support +# +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_MAX_NR=1 +CONFIG_ARM_GIC_V2M=y +CONFIG_ARM_GIC_V3=y +CONFIG_ARM_GIC_V3_ITS=y +CONFIG_ARM_GIC_V3_ITS_PCI=y +CONFIG_IRQ_MSI_LIB=y +# CONFIG_AL_FIC is not set +# CONFIG_LAN966X_OIC is not set +# CONFIG_XILINX_INTC is not set +CONFIG_PARTITION_PERCPU=y +# end of IRQ chip support + +# CONFIG_IPACK_BUS is not set +CONFIG_ARCH_HAS_RESET_CONTROLLER=y +CONFIG_RESET_CONTROLLER=y +# CONFIG_RESET_GPIO is not set +CONFIG_RESET_SCMI=y +# CONFIG_RESET_SIMPLE is not set +# CONFIG_RESET_TI_SYSCON is not set +CONFIG_RESET_TI_TPS380X=m + +# +# PHY Subsystem +# +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PHY_MIPI_DPHY=y +CONFIG_PHY_CAN_TRANSCEIVER=m + +# +# PHY drivers for Broadcom platforms +# +CONFIG_BCM_KONA_USB2_PHY=m +# end of PHY drivers for Broadcom platforms + +CONFIG_PHY_CADENCE_TORRENT=m +CONFIG_PHY_CADENCE_DPHY=m +# CONFIG_PHY_CADENCE_DPHY_RX is not set +CONFIG_PHY_CADENCE_SIERRA=m +# CONFIG_PHY_CADENCE_SALVO is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_PHY_LAN966X_SERDES is not set +# CONFIG_PHY_CPCAP_USB is not set +CONFIG_PHY_MAPPHONE_MDM6600=m +# CONFIG_PHY_OCELOT_SERDES is not set +CONFIG_PHY_QCOM_USB_HS=y +CONFIG_PHY_QCOM_USB_HSIC=y +CONFIG_PHY_ROCKCHIP_DP=y +CONFIG_PHY_ROCKCHIP_DPHY_RX0=m +CONFIG_PHY_ROCKCHIP_EMMC=y +CONFIG_PHY_ROCKCHIP_INNO_HDMI=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY=m +CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY=y +CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY=y +CONFIG_PHY_ROCKCHIP_PCIE=y +CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX=m +CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=m +CONFIG_PHY_ROCKCHIP_TYPEC=y +CONFIG_PHY_ROCKCHIP_USB=y +CONFIG_PHY_ROCKCHIP_USBDP=y +CONFIG_PHY_SAMSUNG_USB2=y +# CONFIG_PHY_TUSB1210 is not set +# end of PHY Subsystem + +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_CCI_PMU=y +CONFIG_ARM_CCI400_PMU=y +CONFIG_ARM_CCI5xx_PMU=y +CONFIG_ARM_CCN=y +# CONFIG_ARM_CMN is not set +CONFIG_ARM_PMU=y +CONFIG_ARM_PMU_ACPI=y +CONFIG_ARM_SMMU_V3_PMU=m +CONFIG_ARM_PMUV3=y +# CONFIG_ARM_DSU_PMU is not set +# CONFIG_ARM_SPE_PMU is not set +CONFIG_ARM_DMC620_PMU=m +CONFIG_ALIBABA_UNCORE_DRW_PMU=m +CONFIG_HISI_PMU=y +# CONFIG_HISI_PCIE_PMU is not set +CONFIG_HNS3_PMU=m +# CONFIG_DWC_PCIE_PMU is not set +# CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is not set +CONFIG_CXL_PMU=m +# end of Performance monitor support + +CONFIG_RAS=y +# CONFIG_USB4 is not set + +# +# Android +# +CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y +CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder,anbox-binder,anbox-hwbinder,anbox-vndbinder" +# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set +# end of Android + +# CONFIG_LIBNVDIMM is not set +CONFIG_DAX=y +CONFIG_DEV_DAX=m +CONFIG_DEV_DAX_HMEM=m +CONFIG_DEV_DAX_CXL=m +CONFIG_DEV_DAX_HMEM_DEVICES=y +CONFIG_NVMEM=y +CONFIG_NVMEM_SYSFS=y +CONFIG_NVMEM_LAYOUTS=y + +# +# Layout Types +# +# CONFIG_NVMEM_LAYOUT_SL28_VPD is not set +# CONFIG_NVMEM_LAYOUT_ONIE_TLV is not set +# end of Layout Types + +CONFIG_NVMEM_RMEM=m +CONFIG_NVMEM_ROCKCHIP_EFUSE=m +CONFIG_NVMEM_ROCKCHIP_OTP=m +CONFIG_NVMEM_SPMI_SDAM=m +CONFIG_NVMEM_U_BOOT_ENV=m + +# +# HW tracing support +# +# CONFIG_STM is not set +# CONFIG_INTEL_TH is not set +CONFIG_HISI_PTT=m +# end of HW tracing support + +CONFIG_FPGA=y +# CONFIG_ALTERA_PR_IP_CORE is not set +# CONFIG_FPGA_MGR_ALTERA_PS_SPI is not set +# CONFIG_FPGA_MGR_ALTERA_CVP is not set +# CONFIG_FPGA_MGR_XILINX_SELECTMAP is not set +# CONFIG_FPGA_MGR_XILINX_SPI is not set +# CONFIG_FPGA_MGR_ICE40_SPI is not set +# CONFIG_FPGA_MGR_MACHXO2_SPI is not set +CONFIG_FPGA_BRIDGE=m +CONFIG_ALTERA_FREEZE_BRIDGE=m +# CONFIG_XILINX_PR_DECOUPLER is not set +CONFIG_FPGA_REGION=m +CONFIG_OF_FPGA_REGION=m +# CONFIG_FPGA_DFL is not set +CONFIG_FPGA_MGR_MICROCHIP_SPI=m +# CONFIG_FPGA_MGR_LATTICE_SYSCONFIG_SPI is not set +# CONFIG_FSI is not set +CONFIG_TEE=y +CONFIG_OPTEE=y +# CONFIG_OPTEE_INSECURE_LOAD_IMAGE is not set +# CONFIG_ARM_TSTEE is not set +CONFIG_MULTIPLEXER=y + +# +# Multiplexer drivers +# +CONFIG_MUX_ADG792A=m +CONFIG_MUX_ADGS1408=m +CONFIG_MUX_GPIO=m +CONFIG_MUX_MMIO=m +# end of Multiplexer drivers + +CONFIG_PM_OPP=y +# CONFIG_SIOX is not set +CONFIG_SLIMBUS=m +CONFIG_SLIM_QCOM_CTRL=m +CONFIG_INTERCONNECT=y +CONFIG_COUNTER=m +CONFIG_INTERRUPT_CNT=m +CONFIG_MOST=m +# CONFIG_MOST_USB_HDM is not set +# CONFIG_MOST_CDEV is not set +CONFIG_MOST_SND=m +# CONFIG_PECI is not set +# CONFIG_HTE is not set +# CONFIG_CDX_BUS is not set +CONFIG_DPLL=y +# end of Device Drivers + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_VALIDATE_FS_PARSER=y +CONFIG_FS_IOMAP=y +CONFIG_FS_STACK=y +CONFIG_BUFFER_HEAD=y +CONFIG_LEGACY_DIRECT_IO=y +CONFIG_EXT2_FS=y +CONFIG_EXT2_FS_XATTR=y +CONFIG_EXT2_FS_POSIX_ACL=y +CONFIG_EXT2_FS_SECURITY=y +CONFIG_EXT3_FS=y +CONFIG_EXT3_FS_POSIX_ACL=y +CONFIG_EXT3_FS_SECURITY=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +# CONFIG_EXT4_DEBUG is not set +CONFIG_EXT4_KUNIT_TESTS=m +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +CONFIG_REISERFS_FS=m +# CONFIG_REISERFS_CHECK is not set +CONFIG_REISERFS_PROC_INFO=y +CONFIG_REISERFS_FS_XATTR=y +CONFIG_REISERFS_FS_POSIX_ACL=y +CONFIG_REISERFS_FS_SECURITY=y +CONFIG_JFS_FS=m +CONFIG_JFS_POSIX_ACL=y +CONFIG_JFS_SECURITY=y +# CONFIG_JFS_DEBUG is not set +CONFIG_JFS_STATISTICS=y +CONFIG_XFS_FS=m +CONFIG_XFS_SUPPORT_V4=y +CONFIG_XFS_SUPPORT_ASCII_CI=y +CONFIG_XFS_QUOTA=y +CONFIG_XFS_POSIX_ACL=y +CONFIG_XFS_RT=y +# CONFIG_XFS_ONLINE_SCRUB is not set +# CONFIG_XFS_WARN is not set +# CONFIG_XFS_DEBUG is not set +CONFIG_GFS2_FS=m +CONFIG_GFS2_FS_LOCKING_DLM=y +CONFIG_OCFS2_FS=m +CONFIG_OCFS2_FS_O2CB=m +CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m +CONFIG_OCFS2_FS_STATS=y +CONFIG_OCFS2_DEBUG_MASKLOG=y +# CONFIG_OCFS2_DEBUG_FS is not set +CONFIG_BTRFS_FS=y +CONFIG_BTRFS_FS_POSIX_ACL=y +# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set +# CONFIG_BTRFS_DEBUG is not set +# CONFIG_BTRFS_ASSERT is not set +# CONFIG_BTRFS_FS_REF_VERIFY is not set +CONFIG_NILFS2_FS=m +CONFIG_F2FS_FS=y +CONFIG_F2FS_STAT_FS=y +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_FS_POSIX_ACL=y +CONFIG_F2FS_FS_SECURITY=y +CONFIG_F2FS_CHECK_FS=y +# CONFIG_F2FS_FAULT_INJECTION is not set +CONFIG_F2FS_FS_COMPRESSION=y +CONFIG_F2FS_FS_LZO=y +CONFIG_F2FS_FS_LZORLE=y +CONFIG_F2FS_FS_LZ4=y +CONFIG_F2FS_FS_LZ4HC=y +CONFIG_F2FS_FS_ZSTD=y +CONFIG_F2FS_IOSTAT=y +# CONFIG_F2FS_UNFAIR_RWSEM is not set +CONFIG_BCACHEFS_FS=m +CONFIG_BCACHEFS_QUOTA=y +CONFIG_BCACHEFS_ERASURE_CODING=y +CONFIG_BCACHEFS_POSIX_ACL=y +# CONFIG_BCACHEFS_DEBUG is not set +# CONFIG_BCACHEFS_TESTS is not set +# CONFIG_BCACHEFS_LOCK_TIME_STATS is not set +# CONFIG_BCACHEFS_NO_LATENCY_ACCT is not set +CONFIG_BCACHEFS_SIX_OPTIMISTIC_SPIN=y +# CONFIG_MEAN_AND_VARIANCE_UNIT_TEST is not set +CONFIG_ZONEFS_FS=m +CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y +CONFIG_EXPORTFS_BLOCK_OPS=y +CONFIG_FILE_LOCKING=y +CONFIG_FS_ENCRYPTION=y +CONFIG_FS_ENCRYPTION_ALGS=y +CONFIG_FS_VERITY=y +CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +CONFIG_FANOTIFY=y +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y +CONFIG_QUOTA=y +CONFIG_QUOTA_NETLINK_INTERFACE=y +# CONFIG_QUOTA_DEBUG is not set +CONFIG_QUOTA_TREE=m +CONFIG_QFMT_V1=m +CONFIG_QFMT_V2=m +CONFIG_QUOTACTL=y +CONFIG_AUTOFS_FS=m +CONFIG_FUSE_FS=y +CONFIG_CUSE=m +CONFIG_VIRTIO_FS=m +CONFIG_FUSE_PASSTHROUGH=y +CONFIG_OVERLAY_FS=y +# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set +CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y +# CONFIG_OVERLAY_FS_INDEX is not set +CONFIG_OVERLAY_FS_XINO_AUTO=y +# CONFIG_OVERLAY_FS_METACOPY is not set +# CONFIG_OVERLAY_FS_DEBUG is not set + +# +# Caches +# +CONFIG_NETFS_SUPPORT=m +CONFIG_NETFS_STATS=y +# CONFIG_NETFS_DEBUG is not set +CONFIG_FSCACHE=y +CONFIG_FSCACHE_STATS=y +CONFIG_CACHEFILES=m +# CONFIG_CACHEFILES_DEBUG is not set +# CONFIG_CACHEFILES_ERROR_INJECTION is not set +# CONFIG_CACHEFILES_ONDEMAND is not set +# end of Caches + +# +# CD-ROM/DVD Filesystems +# +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=m +# end of CD-ROM/DVD Filesystems + +# +# DOS/FAT/EXFAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=936 +CONFIG_FAT_DEFAULT_IOCHARSET="utf8" +# CONFIG_FAT_DEFAULT_UTF8 is not set +# CONFIG_FAT_KUNIT_TEST is not set +CONFIG_EXFAT_FS=y +CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8" +CONFIG_NTFS3_FS=y +# CONFIG_NTFS3_64BIT_CLUSTER is not set +CONFIG_NTFS3_LZX_XPRESS=y +CONFIG_NTFS3_FS_POSIX_ACL=y +CONFIG_NTFS_FS=y +# end of DOS/FAT/EXFAT/NT Filesystems + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PROC_CHILDREN=y +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y +# CONFIG_TMPFS_INODE64 is not set +# CONFIG_TMPFS_QUOTA is not set +CONFIG_ARCH_SUPPORTS_HUGETLBFS=y +CONFIG_HUGETLBFS=y +CONFIG_HUGETLB_PAGE=y +CONFIG_ARCH_HAS_GIGANTIC_PAGE=y +CONFIG_CONFIGFS_FS=y +CONFIG_EFIVAR_FS=y +# end of Pseudo filesystems + +CONFIG_MISC_FILESYSTEMS=y +CONFIG_ORANGEFS_FS=m +CONFIG_ADFS_FS=m +# CONFIG_ADFS_FS_RW is not set +CONFIG_AFFS_FS=m +CONFIG_ECRYPT_FS=y +CONFIG_ECRYPT_FS_MESSAGING=y +CONFIG_HFS_FS=m +CONFIG_HFSPLUS_FS=m +CONFIG_BEFS_FS=m +# CONFIG_BEFS_DEBUG is not set +CONFIG_BFS_FS=m +CONFIG_EFS_FS=m +CONFIG_JFFS2_FS=m +CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +# CONFIG_JFFS2_SUMMARY is not set +CONFIG_JFFS2_FS_XATTR=y +CONFIG_JFFS2_FS_POSIX_ACL=y +CONFIG_JFFS2_FS_SECURITY=y +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_JFFS2_ZLIB=y +CONFIG_JFFS2_LZO=y +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +# CONFIG_JFFS2_CMODE_NONE is not set +# CONFIG_JFFS2_CMODE_PRIORITY is not set +# CONFIG_JFFS2_CMODE_SIZE is not set +CONFIG_JFFS2_CMODE_FAVOURLZO=y +CONFIG_UBIFS_FS=m +# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +CONFIG_UBIFS_FS_ZSTD=y +# CONFIG_UBIFS_ATIME_SUPPORT is not set +CONFIG_UBIFS_FS_XATTR=y +CONFIG_UBIFS_FS_SECURITY=y +# CONFIG_UBIFS_FS_AUTHENTICATION is not set +CONFIG_CRAMFS=m +CONFIG_CRAMFS_BLOCKDEV=y +CONFIG_CRAMFS_MTD=y +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_FILE_CACHE=y +# CONFIG_SQUASHFS_FILE_DIRECT is not set +CONFIG_SQUASHFS_DECOMP_SINGLE=y +# CONFIG_SQUASHFS_CHOICE_DECOMP_BY_MOUNT is not set +CONFIG_SQUASHFS_COMPILE_DECOMP_SINGLE=y +# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI is not set +# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU is not set +CONFIG_SQUASHFS_XATTR=y +CONFIG_SQUASHFS_ZLIB=y +CONFIG_SQUASHFS_LZ4=y +CONFIG_SQUASHFS_LZO=y +CONFIG_SQUASHFS_XZ=y +CONFIG_SQUASHFS_ZSTD=y +CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y +CONFIG_SQUASHFS_EMBEDDED=y +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +CONFIG_VXFS_FS=m +CONFIG_MINIX_FS=m +CONFIG_OMFS_FS=m +CONFIG_HPFS_FS=m +CONFIG_QNX4FS_FS=m +CONFIG_QNX6FS_FS=m +# CONFIG_QNX6FS_DEBUG is not set +CONFIG_ROMFS_FS=m +CONFIG_ROMFS_BACKED_BY_BLOCK=y +# CONFIG_ROMFS_BACKED_BY_MTD is not set +# CONFIG_ROMFS_BACKED_BY_BOTH is not set +CONFIG_ROMFS_ON_BLOCK=y +CONFIG_PSTORE=y +CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240 +CONFIG_PSTORE_COMPRESS=y +# CONFIG_PSTORE_CONSOLE is not set +# CONFIG_PSTORE_PMSG is not set +CONFIG_PSTORE_RAM=m +CONFIG_PSTORE_ZONE=m +CONFIG_PSTORE_BLK=m +CONFIG_PSTORE_BLK_BLKDEV="" +CONFIG_PSTORE_BLK_KMSG_SIZE=64 +CONFIG_PSTORE_BLK_MAX_REASON=2 +CONFIG_SYSV_FS=m +CONFIG_UFS_FS=m +CONFIG_UFS_FS_WRITE=y +# CONFIG_UFS_DEBUG is not set +CONFIG_EROFS_FS=m +# CONFIG_EROFS_FS_DEBUG is not set +CONFIG_EROFS_FS_XATTR=y +CONFIG_EROFS_FS_POSIX_ACL=y +CONFIG_EROFS_FS_SECURITY=y +# CONFIG_EROFS_FS_ZIP is not set +# CONFIG_EROFS_FS_ONDEMAND is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=m +CONFIG_NFS_V2=m +CONFIG_NFS_V3=m +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=m +CONFIG_NFS_SWAP=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=m +CONFIG_PNFS_BLOCK=m +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +CONFIG_NFS_V4_1_MIGRATION=y +CONFIG_NFS_V4_SECURITY_LABEL=y +CONFIG_NFS_FSCACHE=y +# CONFIG_NFS_USE_LEGACY_DNS is not set +CONFIG_NFS_USE_KERNEL_DNS=y +CONFIG_NFS_DEBUG=y +CONFIG_NFS_DISABLE_UDP_SUPPORT=y +CONFIG_NFS_V4_2_READ_PLUS=y +CONFIG_NFSD=m +# CONFIG_NFSD_V2 is not set +CONFIG_NFSD_V3_ACL=y +CONFIG_NFSD_V4=y +CONFIG_NFSD_PNFS=y +CONFIG_NFSD_BLOCKLAYOUT=y +CONFIG_NFSD_SCSILAYOUT=y +CONFIG_NFSD_FLEXFILELAYOUT=y +# CONFIG_NFSD_V4_2_INTER_SSC is not set +CONFIG_NFSD_V4_SECURITY_LABEL=y +# CONFIG_NFSD_LEGACY_CLIENT_TRACKING is not set +CONFIG_GRACE_PERIOD=m +CONFIG_LOCKD=m +CONFIG_LOCKD_V4=y +CONFIG_NFS_ACL_SUPPORT=m +CONFIG_NFS_COMMON=y +CONFIG_NFS_V4_2_SSC_HELPER=y +CONFIG_SUNRPC=m +CONFIG_SUNRPC_GSS=m +CONFIG_SUNRPC_BACKCHANNEL=y +CONFIG_SUNRPC_SWAP=y +CONFIG_RPCSEC_GSS_KRB5=m +CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1=y +# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_CAMELLIA is not set +# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2 is not set +# CONFIG_RPCSEC_GSS_KRB5_KUNIT_TEST is not set +CONFIG_SUNRPC_DEBUG=y +CONFIG_CEPH_FS=m +CONFIG_CEPH_FSCACHE=y +CONFIG_CEPH_FS_POSIX_ACL=y +CONFIG_CEPH_FS_SECURITY_LABEL=y +CONFIG_CIFS=m +CONFIG_CIFS_STATS2=y +CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y +CONFIG_CIFS_UPCALL=y +CONFIG_CIFS_XATTR=y +CONFIG_CIFS_POSIX=y +CONFIG_CIFS_DEBUG=y +# CONFIG_CIFS_DEBUG2 is not set +# CONFIG_CIFS_DEBUG_DUMP_KEYS is not set +CONFIG_CIFS_DFS_UPCALL=y +# CONFIG_CIFS_SWN_UPCALL is not set +CONFIG_CIFS_FSCACHE=y +CONFIG_SMB_SERVER=m +CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN=y +CONFIG_SMB_SERVER_KERBEROS5=y +CONFIG_SMBFS=m +CONFIG_CODA_FS=m +CONFIG_AFS_FS=m +# CONFIG_AFS_DEBUG is not set +CONFIG_AFS_FSCACHE=y +# CONFIG_AFS_DEBUG_CURSOR is not set +CONFIG_9P_FS=m +CONFIG_9P_FSCACHE=y +CONFIG_9P_FS_POSIX_ACL=y +CONFIG_9P_FS_SECURITY=y +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_737=m +CONFIG_NLS_CODEPAGE_775=m +CONFIG_NLS_CODEPAGE_850=m +CONFIG_NLS_CODEPAGE_852=m +CONFIG_NLS_CODEPAGE_855=m +CONFIG_NLS_CODEPAGE_857=m +CONFIG_NLS_CODEPAGE_860=m +CONFIG_NLS_CODEPAGE_861=m +CONFIG_NLS_CODEPAGE_862=m +CONFIG_NLS_CODEPAGE_863=m +CONFIG_NLS_CODEPAGE_864=m +CONFIG_NLS_CODEPAGE_865=m +CONFIG_NLS_CODEPAGE_866=m +CONFIG_NLS_CODEPAGE_869=m +CONFIG_NLS_CODEPAGE_936=m +CONFIG_NLS_CODEPAGE_950=m +CONFIG_NLS_CODEPAGE_932=m +CONFIG_NLS_CODEPAGE_949=m +CONFIG_NLS_CODEPAGE_874=m +CONFIG_NLS_ISO8859_8=m +CONFIG_NLS_CODEPAGE_1250=m +CONFIG_NLS_CODEPAGE_1251=m +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=m +CONFIG_NLS_ISO8859_2=m +CONFIG_NLS_ISO8859_3=m +CONFIG_NLS_ISO8859_4=m +CONFIG_NLS_ISO8859_5=m +CONFIG_NLS_ISO8859_6=m +CONFIG_NLS_ISO8859_7=m +CONFIG_NLS_ISO8859_9=m +CONFIG_NLS_ISO8859_13=m +CONFIG_NLS_ISO8859_14=m +CONFIG_NLS_ISO8859_15=m +CONFIG_NLS_KOI8_R=m +CONFIG_NLS_KOI8_U=m +CONFIG_NLS_MAC_ROMAN=m +CONFIG_NLS_MAC_CELTIC=m +CONFIG_NLS_MAC_CENTEURO=m +CONFIG_NLS_MAC_CROATIAN=m +CONFIG_NLS_MAC_CYRILLIC=m +CONFIG_NLS_MAC_GAELIC=m +CONFIG_NLS_MAC_GREEK=m +CONFIG_NLS_MAC_ICELAND=m +CONFIG_NLS_MAC_INUIT=m +CONFIG_NLS_MAC_ROMANIAN=m +CONFIG_NLS_MAC_TURKISH=m +CONFIG_NLS_UTF8=m +CONFIG_NLS_UCS2_UTILS=m +CONFIG_DLM=m +# CONFIG_DLM_DEBUG is not set +CONFIG_UNICODE=y +# CONFIG_UNICODE_NORMALIZATION_SELFTEST is not set +CONFIG_IO_WQ=y +# end of File systems + +# +# Security options +# +CONFIG_KEYS=y +CONFIG_KEYS_REQUEST_CACHE=y +CONFIG_PERSISTENT_KEYRINGS=y +CONFIG_TRUSTED_KEYS=y +CONFIG_HAVE_TRUSTED_KEYS=y +CONFIG_TRUSTED_KEYS_TPM=y +CONFIG_TRUSTED_KEYS_TEE=y +CONFIG_ENCRYPTED_KEYS=y +# CONFIG_USER_DECRYPTED_DATA is not set +CONFIG_KEY_DH_OPERATIONS=y +CONFIG_SECURITY_DMESG_RESTRICT=y +CONFIG_SECURITY=y +CONFIG_SECURITYFS=y +CONFIG_SECURITY_NETWORK=y +CONFIG_SECURITY_NETWORK_XFRM=y +CONFIG_SECURITY_PATH=y +CONFIG_LSM_MMAP_MIN_ADDR=0 +CONFIG_HARDENED_USERCOPY=y +CONFIG_FORTIFY_SOURCE=y +# CONFIG_STATIC_USERMODEHELPER is not set +CONFIG_SECURITY_SELINUX=y +CONFIG_SECURITY_SELINUX_BOOTPARAM=y +CONFIG_SECURITY_SELINUX_DEVELOP=y +CONFIG_SECURITY_SELINUX_AVC_STATS=y +CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9 +CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256 +# CONFIG_SECURITY_SELINUX_DEBUG is not set +CONFIG_SECURITY_SMACK=y +# CONFIG_SECURITY_SMACK_BRINGUP is not set +CONFIG_SECURITY_SMACK_NETFILTER=y +CONFIG_SECURITY_SMACK_APPEND_SIGNALS=y +CONFIG_SECURITY_TOMOYO=y +CONFIG_SECURITY_TOMOYO_MAX_ACCEPT_ENTRY=2048 +CONFIG_SECURITY_TOMOYO_MAX_AUDIT_LOG=1024 +# CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER is not set +CONFIG_SECURITY_TOMOYO_POLICY_LOADER="/sbin/tomoyo-init" +CONFIG_SECURITY_TOMOYO_ACTIVATION_TRIGGER="/sbin/init" +# CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING is not set +CONFIG_SECURITY_APPARMOR=y +# CONFIG_SECURITY_APPARMOR_DEBUG is not set +CONFIG_SECURITY_APPARMOR_INTROSPECT_POLICY=y +CONFIG_SECURITY_APPARMOR_HASH=y +CONFIG_SECURITY_APPARMOR_HASH_DEFAULT=y +CONFIG_SECURITY_APPARMOR_EXPORT_BINARY=y +CONFIG_SECURITY_APPARMOR_PARANOID_LOAD=y +# CONFIG_SECURITY_APPARMOR_KUNIT_TEST is not set +# CONFIG_SECURITY_LOADPIN is not set +CONFIG_SECURITY_YAMA=y +CONFIG_SECURITY_SAFESETID=y +# CONFIG_SECURITY_LOCKDOWN_LSM is not set +# CONFIG_SECURITY_LANDLOCK is not set +CONFIG_INTEGRITY=y +CONFIG_INTEGRITY_SIGNATURE=y +CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y +CONFIG_INTEGRITY_TRUSTED_KEYRING=y +CONFIG_INTEGRITY_PLATFORM_KEYRING=y +# CONFIG_INTEGRITY_MACHINE_KEYRING is not set +CONFIG_LOAD_UEFI_KEYS=y +CONFIG_INTEGRITY_AUDIT=y +CONFIG_IMA=y +# CONFIG_IMA_KEXEC is not set +CONFIG_IMA_MEASURE_PCR_IDX=10 +CONFIG_IMA_LSM_RULES=y +CONFIG_IMA_NG_TEMPLATE=y +# CONFIG_IMA_SIG_TEMPLATE is not set +CONFIG_IMA_DEFAULT_TEMPLATE="ima-ng" +CONFIG_IMA_DEFAULT_HASH_SHA1=y +# CONFIG_IMA_DEFAULT_HASH_SHA256 is not set +# CONFIG_IMA_DEFAULT_HASH_SHA512 is not set +CONFIG_IMA_DEFAULT_HASH="sha1" +# CONFIG_IMA_WRITE_POLICY is not set +# CONFIG_IMA_READ_POLICY is not set +CONFIG_IMA_APPRAISE=y +# CONFIG_IMA_ARCH_POLICY is not set +# CONFIG_IMA_APPRAISE_BUILD_POLICY is not set +CONFIG_IMA_APPRAISE_BOOTPARAM=y +# CONFIG_IMA_APPRAISE_MODSIG is not set +# CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY is not set +# CONFIG_IMA_BLACKLIST_KEYRING is not set +# CONFIG_IMA_LOAD_X509 is not set +CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS=y +CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS=y +# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set +# CONFIG_IMA_DISABLE_HTABLE is not set +CONFIG_EVM=y +CONFIG_EVM_ATTR_FSUUID=y +CONFIG_EVM_EXTRA_SMACK_XATTRS=y +# CONFIG_EVM_ADD_XATTRS is not set +# CONFIG_EVM_LOAD_X509 is not set +# CONFIG_DEFAULT_SECURITY_SELINUX is not set +# CONFIG_DEFAULT_SECURITY_SMACK is not set +# CONFIG_DEFAULT_SECURITY_TOMOYO is not set +CONFIG_DEFAULT_SECURITY_APPARMOR=y +# CONFIG_DEFAULT_SECURITY_DAC is not set +CONFIG_LSM="lockdown,yama,integrity,apparmor" + +# +# Kernel hardening options +# + +# +# Memory initialization +# +CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y +CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y +CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y +CONFIG_INIT_STACK_NONE=y +# CONFIG_INIT_STACK_ALL_PATTERN is not set +# CONFIG_INIT_STACK_ALL_ZERO is not set +CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y +# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set +CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y +# CONFIG_ZERO_CALL_USED_REGS is not set +# end of Memory initialization + +# +# Hardening of kernel data structures +# +# CONFIG_LIST_HARDENED is not set +# CONFIG_BUG_ON_DATA_CORRUPTION is not set +# end of Hardening of kernel data structures + +CONFIG_RANDSTRUCT_NONE=y +# end of Kernel hardening options +# end of Security options + +CONFIG_XOR_BLOCKS=y +CONFIG_ASYNC_CORE=m +CONFIG_ASYNC_MEMCPY=m +CONFIG_ASYNC_XOR=m +CONFIG_ASYNC_PQ=m +CONFIG_ASYNC_RAID6_RECOV=m +CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA=y +CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA=y +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_SIG=y +CONFIG_CRYPTO_SIG2=y +CONFIG_CRYPTO_SKCIPHER=y +CONFIG_CRYPTO_SKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_AKCIPHER2=y +CONFIG_CRYPTO_AKCIPHER=y +CONFIG_CRYPTO_KPP2=y +CONFIG_CRYPTO_KPP=y +CONFIG_CRYPTO_ACOMP2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_USER=m +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_NULL2=y +CONFIG_CRYPTO_PCRYPT=m +CONFIG_CRYPTO_CRYPTD=y +CONFIG_CRYPTO_AUTHENC=m +CONFIG_CRYPTO_TEST=m +CONFIG_CRYPTO_ENGINE=m +# end of Crypto core or helper + +# +# Public-key cryptography +# +CONFIG_CRYPTO_RSA=y +CONFIG_CRYPTO_DH=y +CONFIG_CRYPTO_DH_RFC7919_GROUPS=y +CONFIG_CRYPTO_ECC=m +CONFIG_CRYPTO_ECDH=m +CONFIG_CRYPTO_ECDSA=m +CONFIG_CRYPTO_ECRDSA=m +CONFIG_CRYPTO_CURVE25519=m +# end of Public-key cryptography + +# +# Block ciphers +# +CONFIG_CRYPTO_AES=y +CONFIG_CRYPTO_AES_TI=m +CONFIG_CRYPTO_ANUBIS=m +# CONFIG_CRYPTO_ARIA is not set +CONFIG_CRYPTO_BLOWFISH=m +CONFIG_CRYPTO_BLOWFISH_COMMON=m +CONFIG_CRYPTO_CAMELLIA=m +CONFIG_CRYPTO_CAST_COMMON=m +CONFIG_CRYPTO_CAST5=m +CONFIG_CRYPTO_CAST6=m +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_FCRYPT=m +CONFIG_CRYPTO_KHAZAD=m +CONFIG_CRYPTO_SEED=m +CONFIG_CRYPTO_SERPENT=m +CONFIG_CRYPTO_SM4=m +CONFIG_CRYPTO_SM4_GENERIC=m +CONFIG_CRYPTO_TEA=m +CONFIG_CRYPTO_TWOFISH=m +CONFIG_CRYPTO_TWOFISH_COMMON=m +# end of Block ciphers + +# +# Length-preserving ciphers and modes +# +CONFIG_CRYPTO_ADIANTUM=m +CONFIG_CRYPTO_ARC4=m +CONFIG_CRYPTO_CHACHA20=m +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CTR=y +CONFIG_CRYPTO_CTS=y +CONFIG_CRYPTO_ECB=y +# CONFIG_CRYPTO_HCTR2 is not set +CONFIG_CRYPTO_KEYWRAP=m +CONFIG_CRYPTO_LRW=m +CONFIG_CRYPTO_PCBC=m +CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_NHPOLY1305=y +# end of Length-preserving ciphers and modes + +# +# AEAD (authenticated encryption with associated data) ciphers +# +CONFIG_CRYPTO_AEGIS128=m +CONFIG_CRYPTO_AEGIS128_SIMD=y +CONFIG_CRYPTO_CHACHA20POLY1305=m +CONFIG_CRYPTO_CCM=m +CONFIG_CRYPTO_GCM=y +CONFIG_CRYPTO_GENIV=y +CONFIG_CRYPTO_SEQIV=y +CONFIG_CRYPTO_ECHAINIV=m +CONFIG_CRYPTO_ESSIV=m +# end of AEAD (authenticated encryption with associated data) ciphers + +# +# Hashes, digests, and MACs +# +CONFIG_CRYPTO_BLAKE2B=y +CONFIG_CRYPTO_CMAC=m +CONFIG_CRYPTO_GHASH=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_MD4=m +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_MICHAEL_MIC=m +CONFIG_CRYPTO_POLY1305=m +CONFIG_CRYPTO_RMD160=m +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_SHA3=y +CONFIG_CRYPTO_SM3=m +CONFIG_CRYPTO_SM3_GENERIC=m +CONFIG_CRYPTO_STREEBOG=m +CONFIG_CRYPTO_VMAC=m +CONFIG_CRYPTO_WP512=m +CONFIG_CRYPTO_XCBC=m +CONFIG_CRYPTO_XXHASH=y +# end of Hashes, digests, and MACs + +# +# CRCs (cyclic redundancy checks) +# +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_CRC64_ROCKSOFT=y +# end of CRCs (cyclic redundancy checks) + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_842=m +CONFIG_CRYPTO_LZ4=m +CONFIG_CRYPTO_LZ4HC=m +CONFIG_CRYPTO_ZSTD=y +# end of Compression + +# +# Random number generation +# +CONFIG_CRYPTO_ANSI_CPRNG=m +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKS=64 +CONFIG_CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE=32 +CONFIG_CRYPTO_JITTERENTROPY_OSR=1 +CONFIG_CRYPTO_KDF800108_CTR=y +# end of Random number generation + +# +# Userspace interface +# +CONFIG_CRYPTO_USER_API=m +CONFIG_CRYPTO_USER_API_HASH=m +CONFIG_CRYPTO_USER_API_SKCIPHER=m +CONFIG_CRYPTO_USER_API_RNG=m +# CONFIG_CRYPTO_USER_API_RNG_CAVP is not set +CONFIG_CRYPTO_USER_API_AEAD=m +CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y +# end of Userspace interface + +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_NHPOLY1305_NEON=y +CONFIG_CRYPTO_CHACHA20_NEON=y + +# +# Accelerated Cryptographic Algorithms for CPU (arm64) +# +CONFIG_CRYPTO_GHASH_ARM64_CE=y +CONFIG_CRYPTO_POLY1305_NEON=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_CRYPTO_SHA256_ARM64=y +CONFIG_CRYPTO_SHA2_ARM64_CE=y +CONFIG_CRYPTO_SHA512_ARM64=y +CONFIG_CRYPTO_SHA512_ARM64_CE=m +CONFIG_CRYPTO_SHA3_ARM64=m +# CONFIG_CRYPTO_SM3_NEON is not set +CONFIG_CRYPTO_SM3_ARM64_CE=m +# CONFIG_CRYPTO_POLYVAL_ARM64_CE is not set +CONFIG_CRYPTO_AES_ARM64=y +CONFIG_CRYPTO_AES_ARM64_CE=y +CONFIG_CRYPTO_AES_ARM64_CE_BLK=y +CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y +CONFIG_CRYPTO_AES_ARM64_BS=y +CONFIG_CRYPTO_SM4_ARM64_CE=m +# CONFIG_CRYPTO_SM4_ARM64_CE_BLK is not set +# CONFIG_CRYPTO_SM4_ARM64_NEON_BLK is not set +CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +# CONFIG_CRYPTO_SM4_ARM64_CE_CCM is not set +# CONFIG_CRYPTO_SM4_ARM64_CE_GCM is not set +CONFIG_CRYPTO_CRCT10DIF_ARM64_CE=m +# end of Accelerated Cryptographic Algorithms for CPU (arm64) + +CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_DEV_ATMEL_I2C=m +CONFIG_CRYPTO_DEV_ATMEL_ECC=m +CONFIG_CRYPTO_DEV_ATMEL_SHA204A=m +# CONFIG_CRYPTO_DEV_CCP is not set +CONFIG_CRYPTO_DEV_NITROX=m +CONFIG_CRYPTO_DEV_NITROX_CNN55XX=m +# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set +# CONFIG_CRYPTO_DEV_QAT_C3XXX is not set +# CONFIG_CRYPTO_DEV_QAT_C62X is not set +# CONFIG_CRYPTO_DEV_QAT_4XXX is not set +# CONFIG_CRYPTO_DEV_QAT_420XX is not set +# CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set +# CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set +# CONFIG_CRYPTO_DEV_QAT_C62XVF is not set +CONFIG_CRYPTO_DEV_CAVIUM_ZIP=m +CONFIG_CRYPTO_DEV_ROCKCHIP=m +# CONFIG_CRYPTO_DEV_ROCKCHIP_DEBUG is not set +CONFIG_CRYPTO_DEV_ROCKCHIP2=m +# CONFIG_CRYPTO_DEV_ROCKCHIP2_DEBUG is not set +CONFIG_CRYPTO_DEV_VIRTIO=m +CONFIG_CRYPTO_DEV_SAFEXCEL=m +CONFIG_CRYPTO_DEV_CCREE=m +CONFIG_CRYPTO_DEV_HISI_SEC=m +CONFIG_CRYPTO_DEV_HISI_SEC2=m +CONFIG_CRYPTO_DEV_HISI_QM=m +CONFIG_CRYPTO_DEV_HISI_ZIP=m +CONFIG_CRYPTO_DEV_HISI_HPRE=m +CONFIG_CRYPTO_DEV_HISI_TRNG=m +# CONFIG_CRYPTO_DEV_AMLOGIC_GXL is not set +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_X509_CERTIFICATE_PARSER=y +# CONFIG_PKCS8_PRIVATE_KEY_PARSER is not set +CONFIG_PKCS7_MESSAGE_PARSER=y +CONFIG_PKCS7_TEST_KEY=m +CONFIG_SIGNED_PE_FILE_VERIFICATION=y +# CONFIG_FIPS_SIGNATURE_SELFTEST is not set + +# +# Certificates for signature checking +# +CONFIG_SYSTEM_TRUSTED_KEYRING=y +CONFIG_SYSTEM_TRUSTED_KEYS="" +CONFIG_SYSTEM_EXTRA_CERTIFICATE=y +CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE=4096 +CONFIG_SECONDARY_TRUSTED_KEYRING=y +# CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN is not set +CONFIG_SYSTEM_BLACKLIST_KEYRING=y +CONFIG_SYSTEM_BLACKLIST_HASH_LIST="" +# CONFIG_SYSTEM_REVOCATION_LIST is not set +# CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE is not set +# end of Certificates for signature checking + +CONFIG_BINARY_PRINTF=y + +# +# Library routines +# +CONFIG_RAID6_PQ=y +CONFIG_RAID6_PQ_BENCHMARK=y +CONFIG_LINEAR_RANGES=y +CONFIG_PACKING=y +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_CORDIC=m +CONFIG_PRIME_NUMBERS=m +CONFIG_RATIONAL=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_HAS_FAST_MULTIPLIER=y +CONFIG_ARCH_USE_SYM_ANNOTATIONS=y +CONFIG_INDIRECT_PIO=y +# CONFIG_TRACE_MMIO_ACCESS is not set + +# +# Crypto library routines +# +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_CRYPTO_LIB_AES=y +CONFIG_CRYPTO_LIB_ARC4=m +CONFIG_CRYPTO_LIB_GF128MUL=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y +CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y +CONFIG_CRYPTO_LIB_CHACHA=m +CONFIG_CRYPTO_LIB_CURVE25519_GENERIC=m +CONFIG_CRYPTO_LIB_CURVE25519=m +CONFIG_CRYPTO_LIB_DES=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=9 +CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305=y +CONFIG_CRYPTO_LIB_POLY1305_GENERIC=y +CONFIG_CRYPTO_LIB_POLY1305=m +CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_SHA256=y +# end of Crypto library routines + +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC64_ROCKSOFT=y +CONFIG_CRC_ITU_T=y +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +CONFIG_CRC64=y +CONFIG_CRC4=m +CONFIG_CRC7=y +CONFIG_LIBCRC32C=y +CONFIG_CRC8=m +CONFIG_XXHASH=y +CONFIG_AUDIT_GENERIC=y +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +CONFIG_AUDIT_COMPAT_GENERIC=y +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_842_COMPRESS=m +CONFIG_842_DECOMPRESS=m +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_COMPRESS=y +CONFIG_LZ4HC_COMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_ZSTD_COMMON=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y +CONFIG_XZ_DEC=y +CONFIG_XZ_DEC_X86=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_MICROLZMA=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_XZ_DEC_TEST=m +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_DECOMPRESS_LZ4=y +CONFIG_DECOMPRESS_ZSTD=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_REED_SOLOMON=m +CONFIG_REED_SOLOMON_ENC8=y +CONFIG_REED_SOLOMON_DEC8=y +CONFIG_REED_SOLOMON_ENC16=y +CONFIG_REED_SOLOMON_DEC16=y +CONFIG_TEXTSEARCH=y +CONFIG_TEXTSEARCH_KMP=m +CONFIG_TEXTSEARCH_BM=m +CONFIG_TEXTSEARCH_FSM=m +CONFIG_BTREE=y +CONFIG_INTERVAL_TREE=y +CONFIG_XARRAY_MULTI=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_CLOSURES=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAS_DMA=y +CONFIG_DMA_OPS=y +CONFIG_NEED_SG_DMA_FLAGS=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_DMA_DECLARE_COHERENT=y +CONFIG_ARCH_HAS_SETUP_DMA_OPS=y +CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y +CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y +CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y +CONFIG_SWIOTLB=y +# CONFIG_SWIOTLB_DYNAMIC is not set +CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC=y +CONFIG_DMA_NEED_SYNC=y +CONFIG_DMA_RESTRICTED_POOL=y +CONFIG_DMA_NONCOHERENT_MMAP=y +CONFIG_DMA_COHERENT_POOL=y +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_CMA=y +# CONFIG_DMA_NUMA_CMA is not set + +# +# Default contiguous memory area size: +# +CONFIG_CMA_SIZE_MBYTES=384 +CONFIG_CMA_SIZE_SEL_MBYTES=y +# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +# CONFIG_CMA_SIZE_SEL_MIN is not set +# CONFIG_CMA_SIZE_SEL_MAX is not set +CONFIG_CMA_ALIGNMENT=8 +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_DMA_MAP_BENCHMARK is not set +CONFIG_SGL_ALLOC=y +CONFIG_CHECK_SIGNATURE=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_GLOB=y +CONFIG_GLOB_SELFTEST=m +CONFIG_NLATTR=y +CONFIG_LRU_CACHE=m +CONFIG_CLZ_TAB=y +CONFIG_IRQ_POLL=y +CONFIG_MPILIB=y +CONFIG_SIGNATURE=y +CONFIG_DIMLIB=y +CONFIG_LIBFDT=y +CONFIG_OID_REGISTRY=y +CONFIG_UCS2_STRING=y +CONFIG_HAVE_GENERIC_VDSO=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_VDSO_TIME_NS=y +CONFIG_FONT_SUPPORT=y +CONFIG_FONTS=y +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_FONT_6x11 is not set +# CONFIG_FONT_7x14 is not set +# CONFIG_FONT_PEARL_8x8 is not set +CONFIG_FONT_ACORN_8x8=y +# CONFIG_FONT_MINI_4x6 is not set +CONFIG_FONT_6x10=y +# CONFIG_FONT_10x18 is not set +# CONFIG_FONT_SUN8x16 is not set +# CONFIG_FONT_SUN12x22 is not set +CONFIG_FONT_TER16x32=y +# CONFIG_FONT_6x8 is not set +CONFIG_SG_SPLIT=y +CONFIG_SG_POOL=y +CONFIG_MEMREGION=y +CONFIG_ARCH_STACKWALK=y +CONFIG_STACKDEPOT=y +CONFIG_STACKDEPOT_MAX_FRAMES=64 +CONFIG_SBITMAP=y +# CONFIG_LWQ_TEST is not set +# end of Library routines + +CONFIG_GENERIC_IOREMAP=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_ASN1_ENCODER=y +CONFIG_POLYNOMIAL=m +CONFIG_FIRMWARE_TABLE=y + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +CONFIG_PRINTK_TIME=y +# CONFIG_PRINTK_CALLER is not set +# CONFIG_STACKTRACE_BUILD_ID is not set +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 +CONFIG_CONSOLE_LOGLEVEL_QUIET=4 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +CONFIG_DYNAMIC_DEBUG=y +CONFIG_DYNAMIC_DEBUG_CORE=y +CONFIG_SYMBOLIC_ERRNAME=y +CONFIG_DEBUG_BUGVERBOSE=y +# end of printk and dmesg options + +CONFIG_DEBUG_KERNEL=y +CONFIG_DEBUG_MISC=y + +# +# Compile-time checks and compiler options +# +CONFIG_AS_HAS_NON_CONST_ULEB128=y +CONFIG_DEBUG_INFO_NONE=y +# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +# CONFIG_DEBUG_INFO_DWARF5 is not set +CONFIG_FRAME_WARN=2048 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_HEADERS_INSTALL is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B is not set +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_FRAME_POINTER=y +# CONFIG_VMLINUX_MAP is not set +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# end of Compile-time checks and compiler options + +# +# Generic Kernel Debugging Instruments +# +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ALLOW_ALL=y +# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set +# CONFIG_DEBUG_FS_ALLOW_NONE is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +CONFIG_ARCH_HAS_UBSAN=y +# CONFIG_UBSAN is not set +CONFIG_HAVE_ARCH_KCSAN=y +CONFIG_HAVE_KCSAN_COMPILER=y +# CONFIG_KCSAN is not set +# end of Generic Kernel Debugging Instruments + +# +# Networking Debugging +# +# CONFIG_NET_DEV_REFCNT_TRACKER is not set +# CONFIG_NET_NS_REFCNT_TRACKER is not set +# CONFIG_DEBUG_NET is not set +# end of Networking Debugging + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +CONFIG_SLUB_DEBUG=y +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_PAGE_OWNER is not set +# CONFIG_PAGE_TABLE_CHECK is not set +# CONFIG_PAGE_POISONING is not set +# CONFIG_DEBUG_PAGE_REF is not set +# CONFIG_DEBUG_RODATA_TEST is not set +CONFIG_ARCH_HAS_DEBUG_WX=y +# CONFIG_DEBUG_WX is not set +CONFIG_GENERIC_PTDUMP=y +# CONFIG_PTDUMP_DEBUGFS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_PER_VMA_LOCK_STATS is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SHRINKER_DEBUG is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_VM_PGTABLE is not set +CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y +# CONFIG_DEBUG_VIRTUAL is not set +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_MEM_ALLOC_PROFILING is not set +CONFIG_HAVE_ARCH_KASAN=y +CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y +CONFIG_HAVE_ARCH_KASAN_HW_TAGS=y +CONFIG_HAVE_ARCH_KASAN_VMALLOC=y +CONFIG_CC_HAS_KASAN_GENERIC=y +CONFIG_CC_HAS_KASAN_SW_TAGS=y +CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y +# CONFIG_KASAN is not set +CONFIG_HAVE_ARCH_KFENCE=y +# CONFIG_KFENCE is not set +# end of Memory Debugging + +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Oops, Lockups and Hangs +# +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SOFTLOCKUP_DETECTOR is not set +CONFIG_HAVE_HARDLOCKUP_DETECTOR_BUDDY=y +# CONFIG_HARDLOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_WQ_WATCHDOG is not set +# CONFIG_WQ_CPU_INTENSIVE_REPORT is not set +CONFIG_TEST_LOCKUP=m +# end of Debug Oops, Lockups and Hangs + +# +# Scheduler Debugging +# +CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_INFO=y +# CONFIG_SCHEDSTATS is not set +# end of Scheduler Debugging + +# CONFIG_DEBUG_TIMEKEEPING is not set +# CONFIG_DEBUG_PREEMPT is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +CONFIG_LOCK_DEBUGGING_SUPPORT=y +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_RWSEMS is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_WW_MUTEX_SELFTEST is not set +# CONFIG_SCF_TORTURE_TEST is not set +# CONFIG_CSD_LOCK_WAIT_DEBUG is not set +# end of Lock Debugging (spinlocks, mutexes, etc...) + +# CONFIG_DEBUG_IRQFLAGS is not set +CONFIG_STACKTRACE=y +# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set +# CONFIG_DEBUG_KOBJECT is not set + +# +# Debug kernel data structures +# +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PLIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CLOSURES is not set +# CONFIG_DEBUG_MAPLE_TREE is not set +# end of Debug kernel data structures + +# +# RCU Debugging +# +# CONFIG_RCU_SCALE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_REF_SCALE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +CONFIG_RCU_EXP_CPU_STALL_TIMEOUT=0 +# CONFIG_RCU_CPU_STALL_CPUTIME is not set +CONFIG_RCU_TRACE=y +# CONFIG_RCU_EQS_DEBUG is not set +# end of RCU Debugging + +# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set +# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set +# CONFIG_LATENCYTOP is not set +# CONFIG_DEBUG_CGROUP_REF is not set +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_NOP_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_RETVAL=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_TRACING=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +# CONFIG_BOOTTIME_TRACING is not set +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_STACK_TRACER is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_PREEMPT_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_HWLAT_TRACER is not set +# CONFIG_OSNOISE_TRACER is not set +# CONFIG_TIMERLAT_TRACER is not set +# CONFIG_ENABLE_DEFAULT_TRACERS is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +CONFIG_KPROBE_EVENTS=y +CONFIG_UPROBE_EVENTS=y +CONFIG_BPF_EVENTS=y +CONFIG_DYNAMIC_EVENTS=y +CONFIG_PROBE_EVENTS=y +# CONFIG_BPF_KPROBE_OVERRIDE is not set +# CONFIG_SYNTH_EVENTS is not set +# CONFIG_USER_EVENTS is not set +# CONFIG_HIST_TRIGGERS is not set +# CONFIG_TRACE_EVENT_INJECT is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_TRACE_EVAL_MAP_FILE is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +# CONFIG_RING_BUFFER_VALIDATE_TIME_DELTAS is not set +# CONFIG_PREEMPTIRQ_DELAY_TEST is not set +# CONFIG_KPROBE_EVENT_GEN_TEST is not set +# CONFIG_RV is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_SAMPLE_FTRACE_DIRECT=y +CONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=y +CONFIG_STRICT_DEVMEM=y +# CONFIG_IO_STRICT_DEVMEM is not set + +# +# arm64 Debugging +# +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_ARM64_RELOC_TEST is not set +# CONFIG_CORESIGHT is not set +# end of arm64 Debugging + +# +# Kernel Testing and Coverage +# +CONFIG_KUNIT=m +# CONFIG_KUNIT_DEBUGFS is not set +# CONFIG_KUNIT_TEST is not set +# CONFIG_KUNIT_EXAMPLE_TEST is not set +# CONFIG_KUNIT_ALL_TESTS is not set +# CONFIG_KUNIT_DEFAULT_ENABLED is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +CONFIG_FUNCTION_ERROR_INJECTION=y +# CONFIG_FAULT_INJECTION is not set +CONFIG_ARCH_HAS_KCOV=y +CONFIG_CC_HAS_SANCOV_TRACE_PC=y +# CONFIG_KCOV is not set +CONFIG_RUNTIME_TESTING_MENU=y +# CONFIG_TEST_DHRY is not set +# CONFIG_LKDTM is not set +# CONFIG_CPUMASK_KUNIT_TEST is not set +# CONFIG_TEST_LIST_SORT is not set +CONFIG_TEST_MIN_HEAP=m +# CONFIG_TEST_SORT is not set +CONFIG_TEST_DIV64=m +# CONFIG_TEST_IOV_ITER is not set +# CONFIG_KPROBES_SANITY_TEST is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_TEST_REF_TRACKER is not set +# CONFIG_RBTREE_TEST is not set +CONFIG_REED_SOLOMON_TEST=m +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +CONFIG_ASYNC_RAID6_TEST=m +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_STRING_KUNIT_TEST is not set +# CONFIG_STRING_HELPERS_KUNIT_TEST is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +CONFIG_TEST_SCANF=m +# CONFIG_TEST_BITMAP is not set +# CONFIG_TEST_UUID is not set +CONFIG_TEST_XARRAY=m +# CONFIG_TEST_MAPLE_TREE is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_TEST_IDA is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_BITOPS is not set +CONFIG_TEST_VMALLOC=m +CONFIG_TEST_BPF=m +CONFIG_TEST_BLACKHOLE_DEV=m +# CONFIG_FIND_BIT_BENCHMARK is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_SYSCTL is not set +# CONFIG_BITFIELD_KUNIT is not set +# CONFIG_CHECKSUM_KUNIT is not set +# CONFIG_HASH_KUNIT_TEST is not set +CONFIG_RESOURCE_KUNIT_TEST=m +# CONFIG_SYSCTL_KUNIT_TEST is not set +# CONFIG_LIST_KUNIT_TEST is not set +# CONFIG_HASHTABLE_KUNIT_TEST is not set +# CONFIG_LINEAR_RANGES_TEST is not set +CONFIG_CMDLINE_KUNIT_TEST=m +# CONFIG_BITS_TEST is not set +CONFIG_SLUB_KUNIT_TEST=m +CONFIG_RATIONAL_KUNIT_TEST=m +CONFIG_MEMCPY_KUNIT_TEST=m +# CONFIG_IS_SIGNED_TYPE_KUNIT_TEST is not set +# CONFIG_OVERFLOW_KUNIT_TEST is not set +# CONFIG_STACKINIT_KUNIT_TEST is not set +# CONFIG_FORTIFY_KUNIT_TEST is not set +# CONFIG_SIPHASH_KUNIT_TEST is not set +# CONFIG_USERCOPY_KUNIT_TEST is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_TEST_DYNAMIC_DEBUG is not set +# CONFIG_TEST_KMOD is not set +CONFIG_TEST_MEMCAT_P=m +# CONFIG_TEST_MEMINIT is not set +# CONFIG_TEST_FREE_PAGES is not set +# CONFIG_TEST_FPU is not set +# CONFIG_TEST_OBJPOOL is not set +CONFIG_ARCH_USE_MEMTEST=y +CONFIG_MEMTEST=y +# end of Kernel Testing and Coverage + +# +# Rust hacking +# +# end of Rust hacking +# end of Kernel hacking diff --git a/config/sources/families/meson-axg.conf b/config/sources/families/meson-axg.conf new file mode 100644 index 000000000000..1449aba633ba --- /dev/null +++ b/config/sources/families/meson-axg.conf @@ -0,0 +1,23 @@ +# +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2024 Armbian +# +# This file is a part of the Armbian Build Framework +# https://github.com/armbian/build/ +# + +# shellcheck source=config/sources/families/include/meson64_common.inc +source "${BASH_SOURCE%/*}/include/meson64_common.inc" +if [[ "$BOARD" == "gateway-gz80x" ]]; then + UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin u-boot-dtb.img" +fi + +uboot_custom_postprocess() { + if [[ "$BOARD" == "gateway-gz80x" ]]; then + uboot_axg_postprocess_ng "$SRC/cache/sources/amlogic-boot-fip/jethub-j100" + else + echo "Don't know how to handle FIP trees for board '${BOARD}'" + exit 1 + fi +} diff --git a/config/sources/git_sources.json b/config/sources/git_sources.json new file mode 100644 index 000000000000..80905987897d --- /dev/null +++ b/config/sources/git_sources.json @@ -0,0 +1,202 @@ +[ + { + "source": "https://github.com/armbian/firmware", + "branch": "master", + "sha1": "511deee7289cb9a5dee6ba142d18a09933d5ba00" + }, + { + "source": "https://github.com/armbian/config", + "branch": "master", + "sha1": "59ed13e1598431b6016a7bb8ea5615bb52dbd351" + }, + { + "source": "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git", + "branch": "main", + "sha1": "5649ca751a23ff3b4b2b2caa4d5978af3afb5c1b" + }, + { + "source": "https://github.com/starfive-tech/linux", + "branch": "JH7110_VisionFive2_devel", + "sha1": "a61d1d826ca3060fd76ab31d37c691fc09b52fc0" + }, + { + "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", + "branch": "linux-6.10.y", + "sha1": "7ba498d9d1bb67bcbc2a79f19a9054cdc8b95098" + }, + { + "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", + "branch": "linux-6.6.y", + "sha1": "4c1a2d4cd9a5b6c55739a80c5b9efbca322adad7" + }, + { + "source": "https://github.com/AvaotaSBC/linux.git", + "branch": "linux-5.15", + "sha1": "af5fc555764e1ad015ba43f9b5151ee9180c0be6" + }, + { + "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", + "branch": "linux-6.1.y", + "sha1": "ee5e09825b810498caeaaa3d46a3410768471053" + }, + { + "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", + "branch": "linux-6.9.y", + "sha1": "bb67b270b37e8bd9c96829d58ffe758635651e90" + }, + { + "source": "https://github.com/armbian/linux-rockchip.git", + "branch": "rk-6.1-rkr3", + "sha1": "30da05a12335a6ccc1ca262e2b783f99b69731ec" + }, + { + "source": "https://github.com/radxa/u-boot.git", + "branch": "next-dev-v2024.03", + "sha1": "f73b1eede495c82cd5d7ed20cc484a22d670136f" + }, + { + "source": "https://gitlab.collabora.com/hardware-enablement/rockchip-3588/linux.git", + "branch": "rk3588-v6.9", + "sha1": "23bb9c65a88c114bbe945b7ef5366bb02d3d9b80" + }, + { + "source": "https://github.com/edk2-porting/linux-next", + "branch": "integration/ayn-odin2", + "sha1": "9a94c7a1294c58ffa6d19bc5cc50b2009ffb40c9" + }, + { + "source": "https://github.com/khadas/linux.git", + "branch": "khadas-vims-5.15.y", + "sha1": "dd276a72527a5d00f09cf4105a8acfadb5c49c0b" + }, + { + "source": "https://github.com/khadas/common_drivers", + "branch": "khadas-vims-5.15.y", + "sha1": "5e2f70d55dd211d15b3db71ffba671003bf3e512" + }, + { + "source": "https://source.denx.de/u-boot/u-boot.git", + "branch": "v2024.01", + "sha1": "aa6d5f7192d5860458b5ef0163aad1d94e9bde70" + }, + { + "source": "https://github.com/SolidRun/u-boot.git", + "branch": "v2018.01-solidrun-imx6", + "sha1": "5b6bc28ead0674ed9c9b7afa35f35828aad07cda" + }, + { + "source": "https://github.com/functionland/u-boot.git", + "branch": "next-dev", + "sha1": "46da2bfe5068535caf919a36c6fcc5a7e744a04b" + }, + { + "source": "https://github.com/stvhay/u-boot.git", + "branch": "rockchip-rk3588-unified", + "sha1": "2f6e967dc901ae570f522d1b47309e7c34acf542" + }, + { + "source": "https://github.com/khadas/u-boot.git", + "branch": "khadas-edges-v2017.09", + "sha1": "b70d025cfadadb132f78fe01e75e007f4070bd10" + }, + { + "source": "https://github.com/khadas/u-boot.git", + "branch": "khadas-vims-v2019.01", + "sha1": "aae94d9eb9f1fa2c01e2c5dba9c57ef37ac91aea" + }, + { + "source": "https://github.com/radxa/u-boot.git", + "branch": "rk35xx-2024.01", + "sha1": "31b85240876dc43492b0826a74b99c23fbf6ed9d" + }, + { + "source": "https://github.com/chainsx/thead-kernel", + "branch": "th1520", + "sha1": "a76d97e234b6613fc20a3dcbfc99128fe9b05e7a" + }, + { + "source": "https://github.com/chainsx/thead-u-boot", + "branch": "extlinux", + "sha1": "990e122d26d1ef94f4e0e1bbf5d7df58e8393eee" + }, + { + "source": "https://github.com/tq-systems/u-boot-tqmaxx.git", + "branch": "TQMa8-v2020.04_imx_5.4.70_2.3.0", + "sha1": "1e3fada66dba19bd4e06f1cb33f36ff025f95146" + }, + { + "source": "https://github.com/Kwiboo/u-boot-rockchip.git", + "branch": "rk3xxx-2024.04", + "sha1": "830cfcfdf54a1f08a3ca7fc17e69b4bc18cece50" + }, + { + "source": "https://github.com/Kwiboo/u-boot-rockchip.git", + "branch": "rk3xxx-2024.07", + "sha1": "2e2ae1fb69a25217640bfe2fb9abaf9f4fbacead" + }, + { + "source": "https://github.com/hardkernel/u-boot.git", + "branch": "odroidc-v2011.03", + "sha1": "b7b8dc21b64b9494618325c9b4d2fbae728aeed6" + }, + { + "source": "https://github.com/hardkernel/u-boot.git", + "branch": "odroidxu4-v2017.05", + "sha1": "42ac93dcfbbb8a08c2bdc02e19f96eb35a81891a" + }, + { + "source": "https://github.com/hardkernel/linux", + "branch": "odroid-6.6.y", + "sha1": "e5dcbb1ea6b49685611bcc5553900291855895b4" + }, + { + "source": "https://github.com/orangepi-xunlong/u-boot-orangepi.git", + "branch": "v2017.09-rk3588", + "sha1": "5e34a2115e1dd9128892b828d869f74677361a78" + }, + { + "source": "https://github.com/chainsx/phytium-linux-kernel", + "branch": "linux-5.10", + "sha1": "b17835d38155a8c2bcb3e2d0f3f55989bf2f1b98" + }, + { + "source": "https://github.com/chainsx/phytium-linux-kernel", + "branch": "linux-6.6", + "sha1": "b9b9d633ab5b213fe492a62f35c6cfd5a2614f42" + }, + { + "source": "https://github.com/raspberrypi/linux", + "branch": "rpi-6.1.y", + "sha1": "fbd8b3facb36ce888b1cdcf5f45a78475a8208f2" + }, + { + "source": "https://github.com/raspberrypi/linux", + "branch": "rpi-6.6.y", + "sha1": "15ca476264094b25d0a210109a061192a468117b" + }, + { + "source": "https://github.com/raspberrypi/linux", + "branch": "rpi-6.10.y", + "sha1": "084962e99477691e0abe232731e3a24b14b05147" + }, + { + "source": "https://github.com/jhovold/linux.git", + "branch": "wip/sc8280xp-6.10", + "sha1": "f0239008542ebdcd4a94755124b5700649df5c39" + }, + { + "source": "https://github.com/jglathe/linux_ms_dev_kit.git", + "branch": "jg/wdk2023-gunyah-6.7-rc6", + "sha1": "401bea57d6b96f440142b9039d483c671c4a9587" + }, + { + "source": "https://github.com/SolidRun/u-boot", + "branch": "v2018.01-solidrun-a38x", + "sha1": "a8004c1f1112ca2f867badccce5a76f052034853" + }, + { + "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", + "branch": "linux-5.15.y", + "sha1": "fa93fa65db6e232b5f2226dd86c9f066ec6dfd97" + } +] diff --git a/patch/kernel/archive/bcm2711-6.10/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch b/patch/kernel/archive/bcm2711-6.10/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch new file mode 100644 index 000000000000..fda816869467 --- /dev/null +++ b/patch/kernel/archive/bcm2711-6.10/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: graysky +Date: Mon, 7 Dec 2020 13:03:40 -0500 +Subject: Make /proc/cpuinfo consistent on arm64 and arm + +Signed-off-by: graysky +--- + arch/arm64/kernel/cpuinfo.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c +index ee36fa8be3af..049bdca2655c 100644 +--- a/arch/arm64/kernel/cpuinfo.c ++++ b/arch/arm64/kernel/cpuinfo.c +@@ -193,9 +193,8 @@ static int c_show(struct seq_file *m, void *v) + * "processor". Give glibc what it expects. + */ + seq_printf(m, "processor\t: %d\n", i); +- if (compat) +- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", +- MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); ++ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", ++ MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); + + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", + loops_per_jiffy / (500000UL/HZ), +-- +Armbian + diff --git a/patch/kernel/archive/bcm2711-6.10/001-force-platform-selection-brcm-soc-support.disabled b/patch/kernel/archive/bcm2711-6.10/001-force-platform-selection-brcm-soc-support.disabled new file mode 100644 index 000000000000..01ef6aecd3b6 --- /dev/null +++ b/patch/kernel/archive/bcm2711-6.10/001-force-platform-selection-brcm-soc-support.disabled @@ -0,0 +1,22 @@ +diff -Naur a/arch/arm/Kconfig b/arch/arm/Kconfig +--- a/arch/arm/Kconfig 2022-12-11 17:15:18.000000000 -0500 ++++ b/arch/arm/Kconfig 2022-12-13 10:24:24.085749880 -0500 +@@ -2,6 +2,7 @@ + config ARM + bool + default y ++ select ARCH_BCM + select ARCH_32BIT_OFF_T + select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND + select ARCH_HAS_BINFMT_FLAT +diff -Naur a/arch/arm64/Kconfig b/arch/arm64/Kconfig +--- a/arch/arm64/Kconfig 2022-12-11 17:15:18.000000000 -0500 ++++ b/arch/arm64/Kconfig 2022-12-13 10:28:40.045233987 -0500 +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config ARM64 + def_bool y ++ select ARCH_BCM + select ACPI_APMT if ACPI + select ACPI_CCA_REQUIRED if ACPI + select ACPI_GENERIC_GSI if ACPI diff --git a/patch/kernel/archive/bcm2711-6.10/1003-remote-wakeup.patch b/patch/kernel/archive/bcm2711-6.10/1003-remote-wakeup.patch new file mode 100644 index 000000000000..39ef8d9e3a24 --- /dev/null +++ b/patch/kernel/archive/bcm2711-6.10/1003-remote-wakeup.patch @@ -0,0 +1,193 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Mon, 29 Aug 2022 08:43:24 +0200 +Subject: [ARCHEOLOGY] Add patches needed for Pi-KVM on Rpi4 (#4127) + +> X-Git-Archeology: > recovered message: > * Add patches needed for Pi-KVM on Rpi4 +> X-Git-Archeology: > recovered message: > * Remove patch that does not belong here +> X-Git-Archeology: > recovered message: > * Update config +> X-Git-Archeology: > recovered message: > * Update edge config +> X-Git-Archeology: - Revision 2fb3aaaf86a7463ef1d26f4d623e1d3289ea4f25: https://github.com/armbian/build/commit/2fb3aaaf86a7463ef1d26f4d623e1d3289ea4f25 +> X-Git-Archeology: Date: Mon, 29 Aug 2022 08:43:24 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Add patches needed for Pi-KVM on Rpi4 (#4127) +> X-Git-Archeology: +> X-Git-Archeology: - Revision acf5810cbe38c7578907ecd06e61abb0a446df1e: https://github.com/armbian/build/commit/acf5810cbe38c7578907ecd06e61abb0a446df1e +> X-Git-Archeology: Date: Sat, 11 Mar 2023 19:19:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Move Rpi kernels to 6.2, move current to legacy (#4898) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 5f2a1af2193187f0b994d6f163b94f370a01134f: https://github.com/armbian/build/commit/5f2a1af2193187f0b994d6f163b94f370a01134f +> X-Git-Archeology: Date: Fri, 28 Apr 2023 21:32:52 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `bcm2711`/`edge`: bump to `6.3` (`rpi4b`, RPi Foundation Kernel) +> X-Git-Archeology: +--- + drivers/usb/dwc2/gadget.c | 73 ++++++++++ + drivers/usb/gadget/function/f_hid.c | 14 ++ + drivers/usb/gadget/function/u_hid.h | 1 + + 3 files changed, 88 insertions(+) + +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c +index 8b15742d9e8a..a7d997a205d5 100644 +--- a/drivers/usb/dwc2/gadget.c ++++ b/drivers/usb/dwc2/gadget.c +@@ -4763,6 +4763,78 @@ static void dwc2_gadget_set_speed(struct usb_gadget *g, enum usb_device_speed sp + spin_unlock_irqrestore(&hsotg->lock, flags); + } + ++/** ++ * dwc2_hsotg_wakeup - send wakeup signal to the host ++ * @gadget: The usb gadget state ++ * ++ * If the gadget is in device mode and in the L1 or L2 state, ++ * it sends a wakeup signal to the host. ++ */ ++static int dwc2_hsotg_wakeup(struct usb_gadget *gadget) ++{ ++ struct dwc2_hsotg *hsotg = to_hsotg(gadget); ++ int ret = -1; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&hsotg->lock, flags); ++ ++ if (!hsotg->remote_wakeup_allowed) { ++ dev_dbg(hsotg->dev, ++ "wakeup: signalling skipped: is not allowed by host\n"); ++ goto skip; ++ } ++ if (hsotg->lx_state != DWC2_L1 && hsotg->lx_state != DWC2_L2) { ++ dev_dbg(hsotg->dev, ++ "wakeup: signalling skipped: gadget not in L1/L2 state: %d\n", hsotg->lx_state); ++ goto skip; ++ } ++ if (!dwc2_is_device_mode(hsotg)) { ++ dev_dbg(hsotg->dev, ++ "wakeup: signalling skipped: gadget not in device mode\n"); ++ goto skip; ++ } ++ ++ /*if (hsotg->in_ppd) { ++ if (dwc2_exit_partial_power_down(hsotg, 1, true)) ++ dev_err(hsotg->dev, "wakeup: exit partial_power_down failed\n"); ++ call_gadget(hsotg, resume); ++ }*/ ++ if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) { ++ u32 pcgctl; ++ ++ dev_dbg(hsotg->dev, "wakeup: exiting device clock gating\n"); ++ ++ /* Clear the Gate hclk. */ ++ pcgctl = dwc2_readl(hsotg, PCGCTL); ++ pcgctl &= ~PCGCTL_GATEHCLK; ++ dwc2_writel(hsotg, pcgctl, PCGCTL); ++ udelay(5); ++ ++ /* Phy Clock bit. */ ++ pcgctl = dwc2_readl(hsotg, PCGCTL); ++ pcgctl &= ~PCGCTL_STOPPCLK; ++ dwc2_writel(hsotg, pcgctl, PCGCTL); ++ udelay(5); ++ ++ hsotg->bus_suspended = false; ++ } ++ ++ dev_dbg(hsotg->dev, "wakeup: sending signal to the host"); ++ ++ dwc2_set_bit(hsotg, DCTL, DCTL_RMTWKUPSIG); ++ mdelay(10); ++ dwc2_clear_bit(hsotg, DCTL, DCTL_RMTWKUPSIG); ++ ++ /* After the signalling, the USB core wakes up to L0 */ ++ call_gadget(hsotg, resume); ++ hsotg->lx_state = DWC2_L0; ++ ++ ret = 0; ++skip: ++ spin_unlock_irqrestore(&hsotg->lock, flags); ++ return ret; ++} ++ + static const struct usb_gadget_ops dwc2_hsotg_gadget_ops = { + .get_frame = dwc2_hsotg_gadget_getframe, + .set_selfpowered = dwc2_hsotg_set_selfpowered, +@@ -4772,6 +4844,7 @@ static const struct usb_gadget_ops dwc2_hsotg_gadget_ops = { + .udc_set_speed = dwc2_gadget_set_speed, + .vbus_session = dwc2_hsotg_vbus_session, + .vbus_draw = dwc2_hsotg_vbus_draw, ++ .wakeup = dwc2_hsotg_wakeup, + }; + + /** +diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c +index ea85e2c701a1..846942e4275a 100644 +--- a/drivers/usb/gadget/function/f_hid.c ++++ b/drivers/usb/gadget/function/f_hid.c +@@ -58,6 +58,8 @@ struct f_hidg { + * will be used to receive reports. + */ + bool use_out_ep; ++ /* attempt to wake up the host before write */ ++ bool wakeup_on_write; + + /* recv report */ + spinlock_t read_spinlock; +@@ -434,10 +436,19 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer, + size_t count, loff_t *offp) + { + struct f_hidg *hidg = file->private_data; ++ struct usb_composite_dev *cdev = hidg->func.config->cdev; + struct usb_request *req; + unsigned long flags; + ssize_t status = -ENOMEM; + ++ /* ++ * remote wakeup is allowed only when the corresponding bit ++ * in config descriptor is set and wakeup_on_write is enabled. ++ * FIXME: cdev->config can be NULLed on disconnect. ++ */ ++ if (hidg->wakeup_on_write /*&& cdev->config->bmAttributes & 0x20*/) ++ usb_gadget_wakeup(cdev->gadget); ++ + spin_lock_irqsave(&hidg->write_spinlock, flags); + + if (!hidg->req) { +@@ -1101,6 +1112,7 @@ CONFIGFS_ATTR(f_hid_opts_, name) + F_HID_OPT(subclass, 8, 255); + F_HID_OPT(protocol, 8, 255); + F_HID_OPT(no_out_endpoint, 8, 1); ++F_HID_OPT(wakeup_on_write, 8, 1); + F_HID_OPT(report_length, 16, 65535); + + static ssize_t f_hid_opts_report_desc_show(struct config_item *item, char *page) +@@ -1161,6 +1173,7 @@ static struct configfs_attribute *hid_attrs[] = { + &f_hid_opts_attr_subclass, + &f_hid_opts_attr_protocol, + &f_hid_opts_attr_no_out_endpoint, ++ &f_hid_opts_attr_wakeup_on_write, + &f_hid_opts_attr_report_length, + &f_hid_opts_attr_report_desc, + &f_hid_opts_attr_dev, +@@ -1296,6 +1309,7 @@ static struct usb_function *hidg_alloc(struct usb_function_instance *fi) + } + } + hidg->use_out_ep = !opts->no_out_endpoint; ++ hidg->wakeup_on_write = opts->wakeup_on_write; + + ++opts->refcnt; + mutex_unlock(&opts->lock); +diff --git a/drivers/usb/gadget/function/u_hid.h b/drivers/usb/gadget/function/u_hid.h +index 84bb70292855..f7fcaf1eaf1d 100644 +--- a/drivers/usb/gadget/function/u_hid.h ++++ b/drivers/usb/gadget/function/u_hid.h +@@ -21,6 +21,7 @@ struct f_hid_opts { + unsigned char subclass; + unsigned char protocol; + unsigned char no_out_endpoint; ++ unsigned char wakeup_on_write; + unsigned short report_length; + unsigned short report_desc_length; + unsigned char *report_desc; +-- +Armbian + diff --git a/patch/kernel/archive/bcm2711-6.10/2001-rename-msd.patch b/patch/kernel/archive/bcm2711-6.10/2001-rename-msd.patch new file mode 100644 index 000000000000..1714836d0d74 --- /dev/null +++ b/patch/kernel/archive/bcm2711-6.10/2001-rename-msd.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Mon, 29 Aug 2022 08:43:24 +0200 +Subject: [ARCHEOLOGY] Add patches needed for Pi-KVM on Rpi4 (#4127) + +> X-Git-Archeology: > recovered message: > * Add patches needed for Pi-KVM on Rpi4 +> X-Git-Archeology: > recovered message: > * Remove patch that does not belong here +> X-Git-Archeology: > recovered message: > * Update config +> X-Git-Archeology: > recovered message: > * Update edge config +> X-Git-Archeology: - Revision 2fb3aaaf86a7463ef1d26f4d623e1d3289ea4f25: https://github.com/armbian/build/commit/2fb3aaaf86a7463ef1d26f4d623e1d3289ea4f25 +> X-Git-Archeology: Date: Mon, 29 Aug 2022 08:43:24 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Add patches needed for Pi-KVM on Rpi4 (#4127) +> X-Git-Archeology: +> X-Git-Archeology: - Revision acf5810cbe38c7578907ecd06e61abb0a446df1e: https://github.com/armbian/build/commit/acf5810cbe38c7578907ecd06e61abb0a446df1e +> X-Git-Archeology: Date: Sat, 11 Mar 2023 19:19:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Move Rpi kernels to 6.2, move current to legacy (#4898) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 5f2a1af2193187f0b994d6f163b94f370a01134f: https://github.com/armbian/build/commit/5f2a1af2193187f0b994d6f163b94f370a01134f +> X-Git-Archeology: Date: Fri, 28 Apr 2023 21:32:52 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `bcm2711`/`edge`: bump to `6.3` (`rpi4b`, RPi Foundation Kernel) +> X-Git-Archeology: +--- + drivers/usb/gadget/function/f_mass_storage.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c +index da07e45ae6df..723d70766a49 100644 +--- a/drivers/usb/gadget/function/f_mass_storage.c ++++ b/drivers/usb/gadget/function/f_mass_storage.c +@@ -2967,11 +2967,11 @@ void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn, + /* Prepare inquiryString */ + i = get_default_bcdDevice(); + snprintf(common->inquiry_string, sizeof(common->inquiry_string), +- "%-8s%-16s%04x", vn ?: "Linux", ++ "%-8s%-16s%04x", vn ?: "PiKVM", + /* Assume product name dependent on the first LUN */ + pn ?: ((*common->luns)->cdrom +- ? "File-CD Gadget" +- : "File-Stor Gadget"), ++ ? "CD-ROM Drive" ++ : "Flash Drive"), + i); + } + EXPORT_SYMBOL_GPL(fsg_common_set_inquiry_string); +-- +Armbian + diff --git a/patch/kernel/archive/imx6-6.10/.placeholder b/patch/kernel/archive/imx6-6.10/.placeholder new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/patch/kernel/archive/meson-6.10/0007-dt-bindings-phy-meson8b-usb2-Add-support-for-reading.patch b/patch/kernel/archive/meson-6.10/0007-dt-bindings-phy-meson8b-usb2-Add-support-for-reading.patch new file mode 100644 index 000000000000..b0df035c222e --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0007-dt-bindings-phy-meson8b-usb2-Add-support-for-reading.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 16 Jun 2021 20:34:01 +0200 +Subject: dt-bindings: phy: meson8b-usb2: Add support for reading the ID signal + +The first USB PHY on Amlogic Meson8/8b/8m2/GXBB SoCs is OTG capable. +This means that the USB "ID" signal is routed to the PHY. Add support +for the gpio-controller and #gpio-cells properties so the value of +the "ID" signal can be read as a GPIO (from the PHY) for example by +an "gpio-usb-b-connector". + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml ++++ b/Documentation/devicetree/bindings/phy/amlogic,meson8b-usb2-phy.yaml +@@ -6,6 +6,10 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# + + title: Amlogic Meson8, Meson8b, Meson8m2 and GXBB USB2 PHY + ++description: | ++ OTG capable PHYs have the USB "ID" signal routed to them. ++ This can be read out via the PHY-provided GPIO controller. ++ + maintainers: + - Martin Blumenstingl + +@@ -31,6 +35,11 @@ properties: + - const: usb_general + - const: usb + ++ '#gpio-cells': ++ const: 2 ++ ++ gpio-controller: true ++ + resets: + minItems: 1 + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0008-phy-amlogic-meson8b-usb2-Add-support-for-reading-the.patch b/patch/kernel/archive/meson-6.10/0008-phy-amlogic-meson8b-usb2-Add-support-for-reading-the.patch new file mode 100644 index 000000000000..3bf658ac3c9f --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0008-phy-amlogic-meson8b-usb2-Add-support-for-reading-the.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 3 May 2020 21:40:27 +0200 +Subject: phy: amlogic: meson8b-usb2: Add support for reading the "ID" signal + +The first USB PHY on Amlogic Meson8/8b/8m2/GXBB SoCs is OTG capable. +This means that the USB "ID" signal is routed to the PHY. Add support +for the gpio-controller and #gpio-cells properties so the value of +the "ID" signal can be read as a GPIO (from the PHY) for example by +the usb-conn-gpio driver. + +The registers also have a bit for the VBUS signal. That either is not +wired in hardware inside the SoC silicon or not wired on the boards +(e.g. Odroid-C1), which is why it's value is not exposed for now. + +Signed-off-by: Martin Blumenstingl +--- + drivers/phy/amlogic/phy-meson8b-usb2.c | 42 +++++++++- + 1 file changed, 41 insertions(+), 1 deletion(-) + +diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c +index 111111111111..222222222222 100644 +--- a/drivers/phy/amlogic/phy-meson8b-usb2.c ++++ b/drivers/phy/amlogic/phy-meson8b-usb2.c +@@ -7,6 +7,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -127,6 +128,7 @@ struct phy_meson8b_usb2_priv { + struct clk *clk_usb_general; + struct clk *clk_usb; + struct reset_control *reset; ++ struct gpio_chip gpiochip; + const struct phy_meson8b_usb2_match_data *match; + }; + +@@ -236,12 +238,44 @@ static const struct phy_ops phy_meson8b_usb2_ops = { + .owner = THIS_MODULE, + }; + ++static int phy_meson8b_usb2_id_gpio_get_direction(struct gpio_chip *gc, ++ unsigned int offset) ++{ ++ return GPIO_LINE_DIRECTION_IN; ++} ++ ++static int phy_meson8b_usb2_id_gpio_get_value(struct gpio_chip *gc, ++ unsigned int offset) ++{ ++ struct phy_meson8b_usb2_priv *priv = gpiochip_get_data(gc); ++ unsigned int val; ++ ++ regmap_read(priv->regmap, REG_ADP_BC, &val); ++ ++ return (val & REG_ADP_BC_ID_DIG) ? 1 : 0; ++} ++ ++static int phy_meson8b_usb2_id_gpiochip_add(struct device *dev, ++ struct phy_meson8b_usb2_priv *priv) ++{ ++ priv->gpiochip.label = dev_name(dev); ++ priv->gpiochip.parent = dev; ++ priv->gpiochip.get_direction = phy_meson8b_usb2_id_gpio_get_direction; ++ priv->gpiochip.get = phy_meson8b_usb2_id_gpio_get_value; ++ priv->gpiochip.of_gpio_n_cells = 2; ++ priv->gpiochip.base = -1; ++ priv->gpiochip.ngpio = 1; ++ ++ return devm_gpiochip_add_data(dev, &priv->gpiochip, priv); ++} ++ + static int phy_meson8b_usb2_probe(struct platform_device *pdev) + { + struct phy_meson8b_usb2_priv *priv; +- struct phy *phy; + struct phy_provider *phy_provider; + void __iomem *base; ++ struct phy *phy; ++ int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) +@@ -280,6 +314,12 @@ static int phy_meson8b_usb2_probe(struct platform_device *pdev) + return -EINVAL; + } + ++ if (device_property_read_bool(&pdev->dev, "gpio-controller")) { ++ ret = phy_meson8b_usb2_id_gpiochip_add(&pdev->dev, priv); ++ if (ret) ++ return ret; ++ } ++ + phy = devm_phy_create(&pdev->dev, NULL, &phy_meson8b_usb2_ops); + if (IS_ERR(phy)) { + return dev_err_probe(&pdev->dev, PTR_ERR(phy), +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0009-usb-common-usb-conn-gpio-Fall-back-to-polling-the-GP.patch b/patch/kernel/archive/meson-6.10/0009-usb-common-usb-conn-gpio-Fall-back-to-polling-the-GP.patch new file mode 100644 index 000000000000..d8c082fea941 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0009-usb-common-usb-conn-gpio-Fall-back-to-polling-the-GP.patch @@ -0,0 +1,146 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 16 Jun 2021 21:07:50 +0200 +Subject: usb: common: usb-conn-gpio: Fall back to polling the GPIO + +On some SoCs (for example: Amlogic Meson8/8b/8m2 and GXBB) the ID GPIO +cannot generate an interrupt. Fall back to polling the GPIO(s) in that +case. + +Signed-off-by: Martin Blumenstingl +--- + drivers/usb/common/usb-conn-gpio.c | 76 ++++++---- + 1 file changed, 48 insertions(+), 28 deletions(-) + +diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c +index 111111111111..222222222222 100644 +--- a/drivers/usb/common/usb-conn-gpio.c ++++ b/drivers/usb/common/usb-conn-gpio.c +@@ -23,6 +23,7 @@ + + #define USB_GPIO_DEB_MS 20 /* ms */ + #define USB_GPIO_DEB_US ((USB_GPIO_DEB_MS) * 1000) /* us */ ++#define USB_GPIO_POLL_MS 1000 + + #define USB_CONN_IRQF \ + (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT) +@@ -45,6 +46,23 @@ struct usb_conn_info { + bool initial_detection; + }; + ++static void usb_conn_queue_dwork(struct usb_conn_info *info, ++ unsigned long delay) ++{ ++ queue_delayed_work(system_power_efficient_wq, &info->dw_det, delay); ++} ++ ++static void usb_conn_gpio_start_polling(struct usb_conn_info *info) ++{ ++ usb_conn_queue_dwork(info, msecs_to_jiffies(USB_GPIO_POLL_MS)); ++} ++ ++static bool usb_conn_gpio_needs_polling(struct usb_conn_info *info) ++{ ++ /* We need to poll if one of the GPIOs cannot generate an IRQ. */ ++ return info->id_irq < 0 || info->vbus_irq < 0; ++} ++ + /* + * "DEVICE" = VBUS and "HOST" = !ID, so we have: + * Both "DEVICE" and "HOST" can't be set as active at the same time +@@ -88,7 +106,10 @@ static void usb_conn_detect_cable(struct work_struct *work) + usb_role_string(info->last_role), usb_role_string(role), id, vbus); + + if (!info->initial_detection && info->last_role == role) { +- dev_warn(info->dev, "repeated role: %s\n", usb_role_string(role)); ++ if (usb_conn_gpio_needs_polling(info)) ++ usb_conn_gpio_start_polling(info); ++ else ++ dev_warn(info->dev, "repeated role: %s\n", usb_role_string(role)); + return; + } + +@@ -114,12 +135,9 @@ static void usb_conn_detect_cable(struct work_struct *work) + regulator_is_enabled(info->vbus) ? "enabled" : "disabled"); + + power_supply_changed(info->charger); +-} + +-static void usb_conn_queue_dwork(struct usb_conn_info *info, +- unsigned long delay) +-{ +- queue_delayed_work(system_power_efficient_wq, &info->dw_det, delay); ++ if (usb_conn_gpio_needs_polling(info)) ++ usb_conn_gpio_start_polling(info); + } + + static irqreturn_t usb_conn_isr(int irq, void *dev_id) +@@ -226,34 +244,34 @@ static int usb_conn_probe(struct platform_device *pdev) + if (info->id_gpiod) { + info->id_irq = gpiod_to_irq(info->id_gpiod); + if (info->id_irq < 0) { +- dev_err(dev, "failed to get ID IRQ\n"); +- ret = info->id_irq; +- goto put_role_sw; +- } +- +- ret = devm_request_threaded_irq(dev, info->id_irq, NULL, +- usb_conn_isr, USB_CONN_IRQF, +- pdev->name, info); +- if (ret < 0) { +- dev_err(dev, "failed to request ID IRQ\n"); +- goto put_role_sw; ++ dev_info(dev, ++ "failed to get ID IRQ - falling back to polling\n"); ++ } else { ++ ret = devm_request_threaded_irq(dev, info->id_irq, ++ NULL, usb_conn_isr, ++ USB_CONN_IRQF, ++ pdev->name, info); ++ if (ret < 0) { ++ dev_err(dev, "failed to request ID IRQ\n"); ++ goto put_role_sw; ++ } + } + } + + if (info->vbus_gpiod) { + info->vbus_irq = gpiod_to_irq(info->vbus_gpiod); + if (info->vbus_irq < 0) { +- dev_err(dev, "failed to get VBUS IRQ\n"); +- ret = info->vbus_irq; +- goto put_role_sw; +- } +- +- ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, +- usb_conn_isr, USB_CONN_IRQF, +- pdev->name, info); +- if (ret < 0) { +- dev_err(dev, "failed to request VBUS IRQ\n"); +- goto put_role_sw; ++ dev_info(dev, ++ "failed to get VBUS IRQ - falling back to polling\n"); ++ } else { ++ ret = devm_request_threaded_irq(dev, info->vbus_irq, ++ NULL, usb_conn_isr, ++ USB_CONN_IRQF, ++ pdev->name, info); ++ if (ret < 0) { ++ dev_err(dev, "failed to request VBUS IRQ\n"); ++ goto put_role_sw; ++ } + } + } + +@@ -300,6 +318,8 @@ static int __maybe_unused usb_conn_suspend(struct device *dev) + if (info->vbus_gpiod) + disable_irq(info->vbus_irq); + ++ cancel_delayed_work_sync(&info->dw_det); ++ + pinctrl_pm_select_sleep_state(dev); + + return 0; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0010-usb-dwc2-register-child-USB-connector-devices.patch b/patch/kernel/archive/meson-6.10/0010-usb-dwc2-register-child-USB-connector-devices.patch new file mode 100644 index 000000000000..4153e833ff88 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0010-usb-dwc2-register-child-USB-connector-devices.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 4 Jul 2020 21:04:29 +0200 +Subject: usb: dwc2: register child (USB connector) devices + +Populate the child devices/nodes of the dwc2 controller. Typically these +are USB connectors with a compatible string (and additional properties) +like "gpio-usb-b-connector". + +Signed-off-by: Martin Blumenstingl +--- + drivers/usb/dwc2/platform.c | 14 ++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c +index 111111111111..222222222222 100644 +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -620,6 +621,19 @@ static int dwc2_driver_probe(struct platform_device *dev) + } + } + #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ ++ ++ retval = devm_of_platform_populate(&dev->dev); ++ if (retval) { ++ dev_err(hsotg->dev, ++ "Failed to create child devices/connectors for %p\n", ++ dev->dev.of_node); ++ ++ if (hsotg->gadget_enabled) ++ dwc2_hsotg_remove(hsotg); ++ ++ goto error_debugfs; ++ } ++ + return 0; + + #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0011-ARM-dts-meson-Add-GPIO-controller-capabilities-to-th.patch b/patch/kernel/archive/meson-6.10/0011-ARM-dts-meson-Add-GPIO-controller-capabilities-to-th.patch new file mode 100644 index 000000000000..517c014cce8b --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0011-ARM-dts-meson-Add-GPIO-controller-capabilities-to-th.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 16 Jun 2021 20:38:07 +0200 +Subject: ARM: dts: meson: Add GPIO controller capabilities to the first USB + PHY + +This is needed for boards that implement OTG functionality to read out +the value of the "ID" signal (e.g. on Micro USB connectors). + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson.dtsi b/arch/arm/boot/dts/amlogic/meson.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson.dtsi +@@ -124,6 +124,8 @@ usb0_phy: phy@8800 { + compatible = "amlogic,meson-mx-usb2-phy"; + #phy-cells = <0>; + reg = <0x8800 0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; + status = "disabled"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0012-ARM-dts-meson8b-odroidc1-Enable-the-Micro-USB-OTG-co.patch b/patch/kernel/archive/meson-6.10/0012-ARM-dts-meson8b-odroidc1-Enable-the-Micro-USB-OTG-co.patch new file mode 100644 index 000000000000..a31cf329e8c3 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0012-ARM-dts-meson8b-odroidc1-Enable-the-Micro-USB-OTG-co.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 4 May 2020 00:16:00 +0200 +Subject: ARM: dts: meson8b: odroidc1: Enable the Micro USB OTG connector + +Enable &usb0 which is routed to the Micro USB connector. The port +supports OTG modes and the role switch is implemented by reading out the +"ID" signal from &usb0_phy. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts | 34 +++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts b/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts ++++ b/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts +@@ -93,6 +93,20 @@ rtc32k_xtal: rtc32k-xtal-clk { + #clock-cells = <0>; + }; + ++ usb0_vbus: regulator-usb0-vbus { ++ /* Richtek RT9715EGB */ ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "USB0_VBUS"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ ++ vin-supply = <&p5v0>; ++ ++ gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ }; ++ + vcc_1v8: regulator-vcc-1v8 { + /* + * RICHTEK RT9179 configured for a fixed output voltage of +@@ -363,8 +377,18 @@ &uart_AO { + pinctrl-names = "default"; + }; + +-&usb1_phy { ++&usb0 { + status = "okay"; ++ ++ dr_mode = "otg"; ++ usb-role-switch; ++ ++ connector { ++ compatible = "gpio-usb-b-connector", "usb-b-connector"; ++ type = "micro"; ++ id-gpios = <&usb0_phy 0 GPIO_ACTIVE_HIGH>; ++ vbus-supply = <&usb0_vbus>; ++ }; + }; + + &usb1 { +@@ -381,3 +405,11 @@ hub@1 { + reset-gpio = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; + }; + }; ++ ++&usb0_phy { ++ status = "okay"; ++}; ++ ++&usb1_phy { ++ status = "okay"; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0013-dt-bindings-phy-Add-bindings-for-the-Amlogic-Meson-C.patch b/patch/kernel/archive/meson-6.10/0013-dt-bindings-phy-Add-bindings-for-the-Amlogic-Meson-C.patch new file mode 100644 index 000000000000..4aba87f6ff5b --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0013-dt-bindings-phy-Add-bindings-for-the-Amlogic-Meson-C.patch @@ -0,0 +1,104 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 11 Oct 2021 23:37:19 +0200 +Subject: dt-bindings: phy: Add bindings for the Amlogic Meson CVBS DAC + +Amlogic Meson SoCs embed a Composite Video Baseband Signal DAC. Add the +bindings for this IP. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/phy/amlogic,meson-cvbs-dac-phy.yaml | 82 ++++++++++ + 1 file changed, 82 insertions(+) + +diff --git a/Documentation/devicetree/bindings/phy/amlogic,meson-cvbs-dac-phy.yaml b/Documentation/devicetree/bindings/phy/amlogic,meson-cvbs-dac-phy.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/phy/amlogic,meson-cvbs-dac-phy.yaml +@@ -0,0 +1,82 @@ ++# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/phy/amlogic,meson-cvbs-dac-phy.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Amlogic Meson Composite Video Baseband Signal DAC ++ ++maintainers: ++ - Martin Blumenstingl ++ ++description: |+ ++ The CVBS DAC node should be the child of a syscon node with the ++ required property: ++ ++ compatible = "amlogic,meson-hhi-sysctrl", "simple-mfd", "syscon" ++ ++ Refer to the bindings described in ++ Documentation/devicetree/bindings/mfd/syscon.yaml ++ ++properties: ++ $nodename: ++ pattern: "^video-dac@[0-9a-f]+$" ++ ++ compatible: ++ oneOf: ++ - items: ++ - enum: ++ - amlogic,meson8-cvbs-dac ++ - amlogic,meson8b-cvbs-dac ++ - amlogic,meson-gxbb-cvbs-dac ++ - amlogic,meson-gxl-cvbs-dac ++ - amlogic,meson-g12a-cvbs-dac ++ - const: amlogic,meson-cvbs-dac ++ - const: amlogic,meson-cvbs-dac ++ ++ reg: ++ maxItems: 1 ++ ++ clocks: ++ minItems: 1 ++ ++ nvmem-cells: ++ minItems: 1 ++ ++ nvmem-cell-names: ++ items: ++ - const: cvbs_trimming ++ ++ "#phy-cells": ++ const: 0 ++ ++required: ++ - compatible ++ - reg ++ - clocks ++ - "#phy-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ video-dac@2f4 { ++ compatible = "amlogic,meson8-cvbs-dac", "amlogic,meson-cvbs-dac"; ++ reg = <0x2f4 0x8>; ++ ++ #phy-cells = <0>; ++ ++ clocks = <&vdac_clock>; ++ ++ nvmem-cells = <&cvbs_trimming>; ++ nvmem-cell-names = "cvbs_trimming"; ++ }; ++ - | ++ video-dac@2ec { ++ compatible = "amlogic,meson-g12a-cvbs-dac", "amlogic,meson-cvbs-dac"; ++ reg = <0x2ec 0x8>; ++ ++ #phy-cells = <0>; ++ ++ clocks = <&vdac_clock>; ++ }; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0014-phy-amlogic-Add-a-new-driver-for-the-CVBS-DAC-CVBS-P.patch b/patch/kernel/archive/meson-6.10/0014-phy-amlogic-Add-a-new-driver-for-the-CVBS-DAC-CVBS-P.patch new file mode 100644 index 000000000000..494e8cd7abd2 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0014-phy-amlogic-Add-a-new-driver-for-the-CVBS-DAC-CVBS-P.patch @@ -0,0 +1,445 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 11 Oct 2021 23:05:25 +0200 +Subject: phy: amlogic: Add a new driver for the CVBS DAC (CVBS PHY) + +Amlogic Meson SoCs embed a CVBS DAC which converts the signal from the +VPU to analog. The IP has evolved over time with the SoC generations: +- Meson8/8b/8m2 has per-chip calibrated data for the CDAC_GSW register +- GXBB is overall similar to Meson8/8b/8m2 except that it doesn't have + per-chip calibration data and uses 0x0 in CDAC_GSW always +- GXL/GXM are overall similar to GXBB but require a CDAC_VREF_ADJ value + of 0xf (of which the actual meaning is unknown) +- G12A/G12B/SM1 use different register offsets and different values for + CDAC_CTRL_RESV2, CDAC_VREF_ADJ and CDAC_RL_ADJ. Like other SoCs from + GXBB onwards they don't need any per-chip data. + +For backwards compatibility with old .dtbs the driver gets +platform_device_id's so the VPU driver can register the PHY as platform +device if not provided via .dtb. + +Signed-off-by: Martin Blumenstingl +--- + drivers/phy/amlogic/Kconfig | 10 + + drivers/phy/amlogic/Makefile | 1 + + drivers/phy/amlogic/phy-meson-cvbs-dac.c | 376 ++++++++++ + 3 files changed, 387 insertions(+) + +diff --git a/drivers/phy/amlogic/Kconfig b/drivers/phy/amlogic/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/phy/amlogic/Kconfig ++++ b/drivers/phy/amlogic/Kconfig +@@ -25,6 +25,16 @@ config PHY_MESON8B_USB2 + Meson8b and GXBB SoCs. + If unsure, say N. + ++config PHY_MESON_CVBS_DAC ++ tristate "Amlogic Meson CVBS DAC PHY driver" ++ depends on ARCH_MESON || COMPILE_TEST ++ depends on OF ++ select MFD_SYSCON ++ help ++ Enable this to support the CVBS DAC (PHY) found in Amlogic ++ Meson SoCs. ++ If unsure, say N. ++ + config PHY_MESON_GXL_USB2 + tristate "Meson GXL and GXM USB2 PHY drivers" + default ARCH_MESON +diff --git a/drivers/phy/amlogic/Makefile b/drivers/phy/amlogic/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/phy/amlogic/Makefile ++++ b/drivers/phy/amlogic/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + obj-$(CONFIG_PHY_MESON8_HDMI_TX) += phy-meson8-hdmi-tx.o + obj-$(CONFIG_PHY_MESON8B_USB2) += phy-meson8b-usb2.o ++obj-$(CONFIG_PHY_MESON_CVBS_DAC) += phy-meson-cvbs-dac.o + obj-$(CONFIG_PHY_MESON_GXL_USB2) += phy-meson-gxl-usb2.o + obj-$(CONFIG_PHY_MESON_G12A_USB2) += phy-meson-g12a-usb2.o + obj-$(CONFIG_PHY_MESON_G12A_USB3_PCIE) += phy-meson-g12a-usb3-pcie.o +diff --git a/drivers/phy/amlogic/phy-meson-cvbs-dac.c b/drivers/phy/amlogic/phy-meson-cvbs-dac.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/phy/amlogic/phy-meson-cvbs-dac.c +@@ -0,0 +1,376 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Copyright (C) 2016 BayLibre, SAS ++ * Copyright (C) 2021 Martin Blumenstingl ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define HHI_VDAC_CNTL0_MESON8 0x2F4 /* 0xbd offset in data sheet */ ++#define HHI_VDAC_CNTL1_MESON8 0x2F8 /* 0xbe offset in data sheet */ ++ ++#define HHI_VDAC_CNTL0_G12A 0x2EC /* 0xbd offset in data sheet */ ++#define HHI_VDAC_CNTL1_G12A 0x2F0 /* 0xbe offset in data sheet */ ++ ++enum phy_meson_cvbs_dac_reg { ++ MESON_CDAC_CTRL_RESV1, ++ MESON_CDAC_CTRL_RESV2, ++ MESON_CDAC_VREF_ADJ, ++ MESON_CDAC_RL_ADJ, ++ MESON_CDAC_CLK_PHASE_SEL, ++ MESON_CDAC_DRIVER_ADJ, ++ MESON_CDAC_EXT_VREF_EN, ++ MESON_CDAC_BIAS_C, ++ MESON_VDAC_CNTL0_RESERVED, ++ MESON_CDAC_GSW, ++ MESON_CDAC_PWD, ++ MESON_VDAC_CNTL1_RESERVED, ++ MESON_CVBS_DAC_NUM_REGS ++}; ++ ++struct phy_meson_cvbs_dac_data { ++ const struct reg_field *reg_fields; ++ u8 cdac_ctrl_resv2_enable_val; ++ u8 cdac_vref_adj_enable_val; ++ u8 cdac_rl_adj_enable_val; ++ u8 cdac_pwd_disable_val; ++ bool needs_cvbs_trimming_nvmem_cell; ++}; ++ ++struct phy_meson_cvbs_dac_priv { ++ struct regmap_field *regs[MESON_CVBS_DAC_NUM_REGS]; ++ const struct phy_meson_cvbs_dac_data *data; ++ u8 cdac_gsw_enable_val; ++}; ++ ++static const struct reg_field phy_meson8_cvbs_dac_reg_fields[] = { ++ [MESON_CDAC_CTRL_RESV1] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 0, 7), ++ [MESON_CDAC_CTRL_RESV2] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 8, 15), ++ [MESON_CDAC_VREF_ADJ] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 16, 20), ++ [MESON_CDAC_RL_ADJ] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 21, 23), ++ [MESON_CDAC_CLK_PHASE_SEL] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 24, 24), ++ [MESON_CDAC_DRIVER_ADJ] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 25, 25), ++ [MESON_CDAC_EXT_VREF_EN] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 26, 26), ++ [MESON_CDAC_BIAS_C] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 27, 27), ++ [MESON_VDAC_CNTL0_RESERVED] = REG_FIELD(HHI_VDAC_CNTL0_MESON8, 28, 31), ++ [MESON_CDAC_GSW] = REG_FIELD(HHI_VDAC_CNTL1_MESON8, 0, 2), ++ [MESON_CDAC_PWD] = REG_FIELD(HHI_VDAC_CNTL1_MESON8, 3, 3), ++ [MESON_VDAC_CNTL1_RESERVED] = REG_FIELD(HHI_VDAC_CNTL1_MESON8, 4, 31), ++}; ++ ++static const struct reg_field phy_meson_g12a_cvbs_dac_reg_fields[] = { ++ [MESON_CDAC_CTRL_RESV1] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 0, 7), ++ [MESON_CDAC_CTRL_RESV2] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 8, 15), ++ [MESON_CDAC_VREF_ADJ] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 16, 20), ++ [MESON_CDAC_RL_ADJ] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 21, 23), ++ [MESON_CDAC_CLK_PHASE_SEL] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 24, 24), ++ [MESON_CDAC_DRIVER_ADJ] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 25, 25), ++ [MESON_CDAC_EXT_VREF_EN] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 26, 26), ++ [MESON_CDAC_BIAS_C] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 27, 27), ++ [MESON_VDAC_CNTL0_RESERVED] = REG_FIELD(HHI_VDAC_CNTL0_G12A, 28, 31), ++ [MESON_CDAC_GSW] = REG_FIELD(HHI_VDAC_CNTL1_G12A, 0, 2), ++ [MESON_CDAC_PWD] = REG_FIELD(HHI_VDAC_CNTL1_G12A, 3, 3), ++ [MESON_VDAC_CNTL1_RESERVED] = REG_FIELD(HHI_VDAC_CNTL1_G12A, 4, 31), ++}; ++ ++static const struct phy_meson_cvbs_dac_data phy_meson8_cvbs_dac_data = { ++ .reg_fields = phy_meson8_cvbs_dac_reg_fields, ++ .cdac_ctrl_resv2_enable_val = 0x0, ++ .cdac_vref_adj_enable_val = 0x0, ++ .cdac_rl_adj_enable_val = 0x0, ++ .cdac_pwd_disable_val = 0x1, ++ .needs_cvbs_trimming_nvmem_cell = true, ++}; ++ ++static const struct phy_meson_cvbs_dac_data phy_meson_gxbb_cvbs_dac_data = { ++ .reg_fields = phy_meson8_cvbs_dac_reg_fields, ++ .cdac_ctrl_resv2_enable_val = 0x0, ++ .cdac_vref_adj_enable_val = 0x0, ++ .cdac_rl_adj_enable_val = 0x0, ++ .cdac_pwd_disable_val = 0x1, ++ .needs_cvbs_trimming_nvmem_cell = false, ++}; ++ ++static const struct phy_meson_cvbs_dac_data phy_meson_gxl_cvbs_dac_data = { ++ .reg_fields = phy_meson8_cvbs_dac_reg_fields, ++ .cdac_ctrl_resv2_enable_val = 0x0, ++ .cdac_vref_adj_enable_val = 0xf, ++ .cdac_rl_adj_enable_val = 0x0, ++ .cdac_pwd_disable_val = 0x1, ++ .needs_cvbs_trimming_nvmem_cell = false, ++}; ++ ++static const struct phy_meson_cvbs_dac_data phy_meson_g12a_cvbs_dac_data = { ++ .reg_fields = phy_meson_g12a_cvbs_dac_reg_fields, ++ .cdac_ctrl_resv2_enable_val = 0x60, ++ .cdac_vref_adj_enable_val = 0x10, ++ .cdac_rl_adj_enable_val = 0x4, ++ .cdac_pwd_disable_val = 0x0, ++ .needs_cvbs_trimming_nvmem_cell = false, ++}; ++ ++static int phy_meson_cvbs_dac_power_on(struct phy *phy) ++{ ++ struct phy_meson_cvbs_dac_priv *priv = phy_get_drvdata(phy); ++ ++ regmap_field_write(priv->regs[MESON_CDAC_CTRL_RESV1], 0x1); ++ regmap_field_write(priv->regs[MESON_CDAC_CTRL_RESV2], ++ priv->data->cdac_ctrl_resv2_enable_val); ++ regmap_field_write(priv->regs[MESON_CDAC_VREF_ADJ], ++ priv->data->cdac_vref_adj_enable_val); ++ regmap_field_write(priv->regs[MESON_CDAC_RL_ADJ], ++ priv->data->cdac_rl_adj_enable_val); ++ regmap_field_write(priv->regs[MESON_CDAC_GSW], ++ priv->cdac_gsw_enable_val); ++ regmap_field_write(priv->regs[MESON_CDAC_PWD], 0x0); ++ ++ return 0; ++} ++ ++static int phy_meson_cvbs_dac_power_off(struct phy *phy) ++{ ++ struct phy_meson_cvbs_dac_priv *priv = phy_get_drvdata(phy); ++ ++ regmap_field_write(priv->regs[MESON_CDAC_CTRL_RESV1], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_CTRL_RESV2], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_VREF_ADJ], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_RL_ADJ], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_GSW], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_PWD], ++ priv->data->cdac_pwd_disable_val); ++ ++ return 0; ++} ++ ++static int phy_meson_cvbs_dac_init(struct phy *phy) ++{ ++ struct phy_meson_cvbs_dac_priv *priv = phy_get_drvdata(phy); ++ ++ regmap_field_write(priv->regs[MESON_CDAC_CLK_PHASE_SEL], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_DRIVER_ADJ], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_EXT_VREF_EN], 0x0); ++ regmap_field_write(priv->regs[MESON_CDAC_BIAS_C], 0x0); ++ regmap_field_write(priv->regs[MESON_VDAC_CNTL0_RESERVED], 0x0); ++ regmap_field_write(priv->regs[MESON_VDAC_CNTL1_RESERVED], 0x0); ++ ++ return phy_meson_cvbs_dac_power_off(phy); ++} ++ ++static const struct phy_ops phy_meson_cvbs_dac_ops = { ++ .init = phy_meson_cvbs_dac_init, ++ .power_on = phy_meson_cvbs_dac_power_on, ++ .power_off = phy_meson_cvbs_dac_power_off, ++ .owner = THIS_MODULE, ++}; ++ ++static u8 phy_meson_cvbs_trimming_version(u8 trimming1) ++{ ++ if ((trimming1 & 0xf0) == 0xa0) ++ return 5; ++ else if ((trimming1 & 0xf0) == 0x40) ++ return 2; ++ else if ((trimming1 & 0xc0) == 0x80) ++ return 1; ++ else if ((trimming1 & 0xc0) == 0x00) ++ return 0; ++ else ++ return 0xff; ++} ++ ++static int phy_meson_cvbs_read_trimming(struct device *dev, ++ struct phy_meson_cvbs_dac_priv *priv) ++{ ++ struct nvmem_cell *cell; ++ u8 *trimming; ++ size_t len; ++ ++ cell = devm_nvmem_cell_get(dev, "cvbs_trimming"); ++ if (IS_ERR(cell)) ++ return dev_err_probe(dev, PTR_ERR(cell), ++ "Failed to get the 'cvbs_trimming' nvmem-cell\n"); ++ ++ trimming = nvmem_cell_read(cell, &len); ++ if (IS_ERR(trimming)) { ++ /* ++ * TrustZone firmware may block access to the CVBS trimming ++ * data stored in the eFuse. On those devices the trimming data ++ * is stored in the u-boot environment. However, the known ++ * examples of trimming data in the u-boot environment are all ++ * zero. ++ */ ++ dev_dbg(dev, ++ "Failed to read the 'cvbs_trimming' nvmem-cell - falling back to a default value\n"); ++ priv->cdac_gsw_enable_val = 0x0; ++ return 0; ++ } ++ ++ if (len != 2) { ++ kfree(trimming); ++ return dev_err_probe(dev, -EINVAL, ++ "Read the 'cvbs_trimming' nvmem-cell with invalid length\n"); ++ } ++ ++ switch (phy_meson_cvbs_trimming_version(trimming[1])) { ++ case 1: ++ case 2: ++ case 5: ++ priv->cdac_gsw_enable_val = trimming[0] & 0x7; ++ break; ++ default: ++ priv->cdac_gsw_enable_val = 0x0; ++ break; ++ } ++ ++ kfree(trimming); ++ ++ return 0; ++} ++ ++static int phy_meson_cvbs_dac_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct phy_meson_cvbs_dac_priv *priv; ++ struct phy_provider *phy_provider; ++ struct device *dev = &pdev->dev; ++ struct regmap *hhi; ++ struct phy *phy; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ if (np) { ++ priv->data = device_get_match_data(dev); ++ if (!priv->data) ++ return dev_err_probe(dev, -EINVAL, ++ "Could not find the OF match data\n"); ++ ++ hhi = syscon_node_to_regmap(np->parent); ++ if (IS_ERR(hhi)) ++ return dev_err_probe(dev, PTR_ERR(hhi), ++ "Failed to get the parent syscon\n"); ++ } else { ++ const struct platform_device_id *pdev_id; ++ ++ pdev_id = platform_get_device_id(pdev); ++ if (!pdev_id) ++ return dev_err_probe(dev, -EINVAL, ++ "Failed to find platform device ID\n"); ++ ++ priv->data = (void *)pdev_id->driver_data; ++ if (!priv->data) ++ return dev_err_probe(dev, -EINVAL, ++ "Could not find the platform driver data\n"); ++ ++ hhi = syscon_regmap_lookup_by_compatible("amlogic,meson-gx-hhi-sysctrl"); ++ if (IS_ERR(hhi)) ++ return dev_err_probe(dev, PTR_ERR(hhi), ++ "Failed to get the \"amlogic,meson-gx-hhi-sysctrl\" syscon\n"); ++ } ++ ++ if (priv->data->needs_cvbs_trimming_nvmem_cell) { ++ ret = phy_meson_cvbs_read_trimming(dev, priv); ++ if (ret) ++ return ret; ++ } ++ ++ ret = devm_regmap_field_bulk_alloc(dev, hhi, priv->regs, ++ priv->data->reg_fields, ++ MESON_CVBS_DAC_NUM_REGS); ++ if (ret) ++ return dev_err_probe(dev, ret, ++ "Failed to create regmap fields\n"); ++ ++ phy = devm_phy_create(dev, np, &phy_meson_cvbs_dac_ops); ++ if (IS_ERR(phy)) ++ return PTR_ERR(phy); ++ ++ phy_set_drvdata(phy, priv); ++ ++ if (np) { ++ phy_provider = devm_of_phy_provider_register(dev, ++ of_phy_simple_xlate); ++ ret = PTR_ERR_OR_ZERO(phy_provider); ++ if (ret) ++ return dev_err_probe(dev, ret, ++ "Failed to register PHY provider\n"); ++ } else { ++ platform_set_drvdata(pdev, phy); ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id phy_meson_cvbs_dac_of_match[] = { ++ { ++ .compatible = "amlogic,meson8-cvbs-dac", ++ .data = &phy_meson8_cvbs_dac_data, ++ }, ++ { ++ .compatible = "amlogic,meson8b-cvbs-dac", ++ .data = &phy_meson8_cvbs_dac_data, ++ }, ++ { ++ .compatible = "amlogic,meson-gxbb-cvbs-dac", ++ .data = &phy_meson_gxbb_cvbs_dac_data, ++ }, ++ { ++ .compatible = "amlogic,meson-gxl-cvbs-dac", ++ .data = &phy_meson_gxl_cvbs_dac_data, ++ }, ++ { ++ .compatible = "amlogic,meson-g12a-cvbs-dac", ++ .data = &phy_meson_g12a_cvbs_dac_data, ++ }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, phy_meson_cvbs_dac_of_match); ++ ++/* ++ * The platform_device_id table is used for backwards compatibility with old ++ * .dtbs which don't have a CVBS DAC node (where the VPU DRM driver registers ++ * this as a platform device. Support for additional SoCs should only be added ++ * to the of_device_id table above. ++ */ ++static const struct platform_device_id phy_meson_cvbs_dac_device_ids[] = { ++ { ++ .name = "meson-gxbb-cvbs-dac", ++ .driver_data = (kernel_ulong_t)&phy_meson_gxbb_cvbs_dac_data, ++ }, ++ { ++ .name = "meson-gxl-cvbs-dac", ++ .driver_data = (kernel_ulong_t)&phy_meson_gxl_cvbs_dac_data, ++ }, ++ { ++ .name = "meson-g12a-cvbs-dac", ++ .driver_data = (kernel_ulong_t)&phy_meson_g12a_cvbs_dac_data, ++ }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(platform, phy_meson_cvbs_dac_device_ids); ++ ++static struct platform_driver phy_meson_cvbs_dac_driver = { ++ .driver = { ++ .name = "phy-meson-cvbs-dac", ++ .of_match_table = phy_meson_cvbs_dac_of_match, ++ }, ++ .id_table = phy_meson_cvbs_dac_device_ids, ++ .probe = phy_meson_cvbs_dac_probe, ++}; ++module_platform_driver(phy_meson_cvbs_dac_driver); ++ ++MODULE_AUTHOR("Martin Blumenstingl "); ++MODULE_DESCRIPTION("Amlogic Meson CVBS DAC driver"); ++MODULE_LICENSE("GPL v2"); +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0015-dt-bindings-display-meson-vpu-Add-the-CVBS-DAC-prope.patch b/patch/kernel/archive/meson-6.10/0015-dt-bindings-display-meson-vpu-Add-the-CVBS-DAC-prope.patch new file mode 100644 index 000000000000..0775d10d8271 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0015-dt-bindings-display-meson-vpu-Add-the-CVBS-DAC-prope.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 20 Oct 2021 22:19:25 +0200 +Subject: dt-bindings: display: meson-vpu: Add the CVBS DAC properties + +The CVBS DAC converts the digital video signal to the (analog) composite +video baseband signal (CVBS). This DAC is part of the HHI registers. +Add the phy and phy-names property to describe the relation between the +VPU (which outputs the digital signal) and the CVBS DAC. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | 12 ++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml ++++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +@@ -82,6 +82,15 @@ properties: + description: should point to a canvas provider node + $ref: /schemas/types.yaml#/definitions/phandle + ++ phys: ++ maxItems: 1 ++ description: ++ PHY specifier for the CVBS DAC ++ ++ phy-names: ++ items: ++ - const: cvbs-dac ++ + power-domains: + maxItems: 1 + description: phandle to the associated power domain +@@ -130,6 +139,9 @@ examples: + #size-cells = <0>; + amlogic,canvas = <&canvas>; + ++ phys = <&cvbs_dac_phy>; ++ phy-names = "cvbs-dac"; ++ + /* CVBS VDAC output port */ + port@0 { + reg = <0>; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0016-drm-meson-Add-support-for-using-a-PHY-for-the-CVBS-D.patch b/patch/kernel/archive/meson-6.10/0016-drm-meson-Add-support-for-using-a-PHY-for-the-CVBS-D.patch new file mode 100644 index 000000000000..4ef1ee3d5e9f --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0016-drm-meson-Add-support-for-using-a-PHY-for-the-CVBS-D.patch @@ -0,0 +1,317 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 22:06:53 +0200 +Subject: drm/meson: Add support for using a PHY for the CVBS DAC + +Currently the VPU driver hardcodes the initialization, power-on and +power-off sequences for the CVBS DAC. The registers for the CVBS DAC are +in the HHI register area. Also the CVBS DAC is a PHY so it can be +modelled as such. Add support for using a PHY as CVBS DAC to de-couple +the VPU driver from the HHI registers (at least for this part of the +implementation). +Register a platform device for the PHY (which creates a lookup entry to +compensate for the missing .dtb entry) which takes over all +HHI_VDAC_CNTL register management. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/Kconfig | 1 + + drivers/gpu/drm/meson/meson_drv.h | 6 + + drivers/gpu/drm/meson/meson_encoder_cvbs.c | 132 ++++++++-- + drivers/gpu/drm/meson/meson_venc.c | 13 - + 4 files changed, 110 insertions(+), 42 deletions(-) + +diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/Kconfig ++++ b/drivers/gpu/drm/meson/Kconfig +@@ -10,6 +10,7 @@ config DRM_MESON + select REGMAP_MMIO + select MESON_CANVAS + select CEC_CORE if CEC_NOTIFIER ++ imply PHY_MESON_CVBS_DAC + + config DRM_MESON_DW_HDMI + tristate "HDMI Synopsys Controller support for Amlogic Meson Display" +diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.h ++++ b/drivers/gpu/drm/meson/meson_drv.h +@@ -16,6 +16,8 @@ struct drm_device; + struct drm_plane; + struct meson_drm; + struct meson_afbcd_ops; ++struct phy; ++struct platform_device; + + enum vpu_compatible { + VPU_COMPATIBLE_GXBB = 0, +@@ -61,6 +63,10 @@ struct meson_drm { + + const struct meson_drm_soc_limits *limits; + ++ struct phy *cvbs_dac; ++ bool cvbs_dac_enabled; ++ struct platform_device *cvbs_dac_pdev; ++ + /* Components Data */ + struct { + bool osd1_enabled; +diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c ++++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c +@@ -11,6 +11,8 @@ + + #include + #include ++#include ++#include + + #include + #include +@@ -24,12 +26,6 @@ + #include "meson_vclk.h" + #include "meson_encoder_cvbs.h" + +-/* HHI VDAC Registers */ +-#define HHI_VDAC_CNTL0 0x2F4 /* 0xbd offset in data sheet */ +-#define HHI_VDAC_CNTL0_G12A 0x2EC /* 0xbd offset in data sheet */ +-#define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */ +-#define HHI_VDAC_CNTL1_G12A 0x2F0 /* 0xbe offset in data sheet */ +- + struct meson_encoder_cvbs { + struct drm_encoder encoder; + struct drm_bridge bridge; +@@ -87,11 +83,28 @@ static int meson_encoder_cvbs_attach(struct drm_bridge *bridge, + { + struct meson_encoder_cvbs *meson_encoder_cvbs = + bridge_to_meson_encoder_cvbs(bridge); ++ int ret; ++ ++ ret = phy_init(meson_encoder_cvbs->priv->cvbs_dac); ++ if (ret) ++ return ret; + + return drm_bridge_attach(bridge->encoder, meson_encoder_cvbs->next_bridge, + &meson_encoder_cvbs->bridge, flags); + } + ++static void meson_encoder_cvbs_detach(struct drm_bridge *bridge) ++{ ++ struct meson_encoder_cvbs *meson_encoder_cvbs = ++ bridge_to_meson_encoder_cvbs(bridge); ++ int ret; ++ ++ ret = phy_exit(meson_encoder_cvbs->priv->cvbs_dac); ++ if (ret) ++ dev_err(meson_encoder_cvbs->priv->dev, ++ "Failed to exit the CVBS DAC\n"); ++} ++ + static int meson_encoder_cvbs_get_modes(struct drm_bridge *bridge, + struct drm_connector *connector) + { +@@ -148,6 +161,7 @@ static void meson_encoder_cvbs_atomic_enable(struct drm_bridge *bridge, + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + struct drm_connector *connector; ++ int ret; + + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + if (WARN_ON(!connector)) +@@ -177,16 +191,13 @@ static void meson_encoder_cvbs_atomic_enable(struct drm_bridge *bridge, + writel_bits_relaxed(VENC_VDAC_SEL_ATV_DMD, 0, + priv->io_base + _REG(VENC_VDAC_DACSEL0)); + +- if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB)) { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0, 1); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1, 0); +- } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) || +- meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL)) { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0xf0001); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1, 0); +- } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0_G12A, 0x906001); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1_G12A, 0); ++ if (!priv->cvbs_dac_enabled) { ++ ret = phy_power_on(priv->cvbs_dac); ++ if (ret) ++ dev_err(priv->dev, ++ "Failed to power on the CVBS DAC\n"); ++ else ++ priv->cvbs_dac_enabled = true; + } + } + +@@ -196,19 +207,22 @@ static void meson_encoder_cvbs_atomic_disable(struct drm_bridge *bridge, + struct meson_encoder_cvbs *meson_encoder_cvbs = + bridge_to_meson_encoder_cvbs(bridge); + struct meson_drm *priv = meson_encoder_cvbs->priv; ++ int ret; + +- /* Disable CVBS VDAC */ +- if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0_G12A, 0); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1_G12A, 0); +- } else { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1, 8); +- } ++ if (!priv->cvbs_dac_enabled) ++ return; ++ ++ ret = phy_power_off(priv->cvbs_dac); ++ if (ret) ++ dev_err(priv->dev, ++ "Failed to power off the CVBS DAC\n"); ++ else ++ priv->cvbs_dac_enabled = false; + } + + static const struct drm_bridge_funcs meson_encoder_cvbs_bridge_funcs = { + .attach = meson_encoder_cvbs_attach, ++ .detach = meson_encoder_cvbs_detach, + .mode_valid = meson_encoder_cvbs_mode_valid, + .get_modes = meson_encoder_cvbs_get_modes, + .atomic_enable = meson_encoder_cvbs_atomic_enable, +@@ -219,6 +233,54 @@ static const struct drm_bridge_funcs meson_encoder_cvbs_bridge_funcs = { + .atomic_reset = drm_atomic_helper_bridge_reset, + }; + ++static int meson_cvbs_dac_probe(struct meson_drm *priv) ++{ ++ struct platform_device *pdev; ++ const char *platform_id_name; ++ ++ priv->cvbs_dac = devm_phy_optional_get(priv->dev, "cvbs-dac"); ++ if (IS_ERR(priv->cvbs_dac)) ++ return dev_err_probe(priv->dev, PTR_ERR(priv->cvbs_dac), ++ "Failed to get the 'cvbs-dac' PHY\n"); ++ else if (priv->cvbs_dac) ++ return 0; ++ ++ switch (priv->compat) { ++ case VPU_COMPATIBLE_GXBB: ++ platform_id_name = "meson-gxbb-cvbs-dac"; ++ break; ++ case VPU_COMPATIBLE_GXL: ++ case VPU_COMPATIBLE_GXM: ++ platform_id_name = "meson-gxl-cvbs-dac"; ++ break; ++ case VPU_COMPATIBLE_G12A: ++ platform_id_name = "meson-g12a-cvbs-dac"; ++ break; ++ default: ++ return dev_err_probe(priv->dev, -EINVAL, ++ "No CVBS DAC platform ID found\n"); ++ } ++ ++ pdev = platform_device_register_data(priv->dev, platform_id_name, ++ PLATFORM_DEVID_AUTO, NULL, 0); ++ if (IS_ERR(pdev)) ++ return dev_err_probe(priv->dev, PTR_ERR(pdev), ++ "Failed to register fallback CVBS DAC PHY platform device\n"); ++ ++ priv->cvbs_dac = platform_get_drvdata(pdev); ++ if (IS_ERR(priv->cvbs_dac)) { ++ platform_device_unregister(pdev); ++ return dev_err_probe(priv->dev, PTR_ERR(priv->cvbs_dac), ++ "Failed to get the 'cvbs-dac' PHY from it's platform device\n"); ++ } ++ ++ dev_info(priv->dev, "Using fallback for old .dtbs without CVBS DAC\n"); ++ ++ priv->cvbs_dac_pdev = pdev; ++ ++ return 0; ++} ++ + int meson_encoder_cvbs_probe(struct meson_drm *priv) + { + struct drm_device *drm = priv->drm; +@@ -255,6 +317,10 @@ int meson_encoder_cvbs_probe(struct meson_drm *priv) + + meson_encoder_cvbs->priv = priv; + ++ ret = meson_cvbs_dac_probe(priv); ++ if (ret) ++ return ret; ++ + /* Encoder */ + ret = drm_simple_encoder_init(priv->drm, &meson_encoder_cvbs->encoder, + DRM_MODE_ENCODER_TVDAC); +@@ -268,21 +334,27 @@ int meson_encoder_cvbs_probe(struct meson_drm *priv) + ret = drm_bridge_attach(&meson_encoder_cvbs->encoder, &meson_encoder_cvbs->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (ret) { +- dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); +- return ret; ++ dev_err_probe(priv->dev, ret, "Failed to attach bridge\n"); ++ goto err_unregister_cvbs_dac_pdev; + } + + /* Initialize & attach Bridge Connector */ + connector = drm_bridge_connector_init(priv->drm, &meson_encoder_cvbs->encoder); +- if (IS_ERR(connector)) +- return dev_err_probe(priv->dev, PTR_ERR(connector), +- "Unable to create CVBS bridge connector\n"); ++ if (IS_ERR(connector)) { ++ ret = dev_err_probe(priv->dev, PTR_ERR(connector), ++ "Unable to create CVBS bridge connector\n"); ++ goto err_unregister_cvbs_dac_pdev; ++ } + + drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder); + + priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs; + + return 0; ++ ++err_unregister_cvbs_dac_pdev: ++ platform_device_unregister(priv->cvbs_dac_pdev); ++ return ret; + } + + void meson_encoder_cvbs_remove(struct meson_drm *priv) +@@ -293,4 +365,6 @@ void meson_encoder_cvbs_remove(struct meson_drm *priv) + meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS]; + drm_bridge_remove(&meson_encoder_cvbs->bridge); + } ++ ++ platform_device_unregister(priv->cvbs_dac_pdev); + } +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -62,10 +62,6 @@ + + /* HHI Registers */ + #define HHI_GCLK_MPEG2 0x148 /* 0x52 offset in data sheet */ +-#define HHI_VDAC_CNTL0 0x2F4 /* 0xbd offset in data sheet */ +-#define HHI_VDAC_CNTL0_G12A 0x2EC /* 0xbb offset in data sheet */ +-#define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */ +-#define HHI_VDAC_CNTL1_G12A 0x2F0 /* 0xbc offset in data sheet */ + #define HHI_HDMI_PHY_CNTL0 0x3a0 /* 0xe8 offset in data sheet */ + + struct meson_cvbs_enci_mode meson_cvbs_enci_pal = { +@@ -1968,15 +1964,6 @@ void meson_venc_disable_vsync(struct meson_drm *priv) + + void meson_venc_init(struct meson_drm *priv) + { +- /* Disable CVBS VDAC */ +- if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0_G12A, 0); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1_G12A, 8); +- } else { +- regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0); +- regmap_write(priv->hhi, HHI_VDAC_CNTL1, 8); +- } +- + /* Power Down Dacs */ + writel_relaxed(0xff, priv->io_base + _REG(VENC_VDAC_SETTING)); + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0018-dt-bindings-clock-meson8b-Add-the-RMII-reference-clo.patch b/patch/kernel/archive/meson-6.10/0018-dt-bindings-clock-meson8b-Add-the-RMII-reference-clo.patch new file mode 100644 index 000000000000..41f977d085c3 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0018-dt-bindings-clock-meson8b-Add-the-RMII-reference-clo.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 May 2020 23:16:07 +0200 +Subject: dt-bindings: clock: meson8b: Add the RMII reference clock input + +Amlogic Meson8 SoCs need an external 50MHz RMII reference clock. This is +either provided by the Ethernet PHY or an external oscillator. Add the +documentation for this clock input. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt b/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt ++++ b/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt +@@ -16,6 +16,8 @@ Required Properties: + * "xtal": the 24MHz system oscillator + * "ddr_pll": the DDR PLL clock + * "clk_32k": (if present) the 32kHz clock signal from GPIOAO_6 (CLK_32K_IN) ++ * "rmii_clk": (if present) the 50MHz RMII reference clock (from the PHY or ++ an external oscillator + + Parent node should have the following properties : + - compatible: "amlogic,meson-hhi-sysctrl", "simple-mfd", "syscon" +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0019-dt-bindings-clock-meson8b-Add-the-Meson8-Ethernet-RM.patch b/patch/kernel/archive/meson-6.10/0019-dt-bindings-clock-meson8b-Add-the-Meson8-Ethernet-RM.patch new file mode 100644 index 000000000000..ae1ab785b416 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0019-dt-bindings-clock-meson8b-Add-the-Meson8-Ethernet-RM.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 May 2020 23:23:49 +0200 +Subject: dt-bindings: clock: meson8b: Add the Meson8 Ethernet (RMII) clocks + +Export CLKID_ETH_CLK (and it's parents) because it is used as input for +the Ethernet controller on Meson8 SoCs. + +Signed-off-by: Martin Blumenstingl +--- + include/dt-bindings/clock/meson8b-clkc.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/include/dt-bindings/clock/meson8b-clkc.h b/include/dt-bindings/clock/meson8b-clkc.h +index 111111111111..222222222222 100644 +--- a/include/dt-bindings/clock/meson8b-clkc.h ++++ b/include/dt-bindings/clock/meson8b-clkc.h +@@ -221,5 +221,9 @@ + #define CLKID_VCLK2_EN 215 + #define CLKID_VID_PLL_LVDS_EN 216 + #define CLKID_HDMI_PLL_DCO_IN 217 ++#define CLKID_ETH_CLK_SEL 218 ++#define CLKID_ETH_CLK_DIV 219 ++#define CLKID_ETH_CLK_PHASE 220 ++#define CLKID_ETH_CLK 221 + + #endif /* __MESON8B_CLKC_H */ +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0020-clk-meson-meson8b-Add-the-Ethernet-RMII-clock-tree-o.patch b/patch/kernel/archive/meson-6.10/0020-clk-meson-meson8b-Add-the-Ethernet-RMII-clock-tree-o.patch new file mode 100644 index 000000000000..451f73d4c91f --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0020-clk-meson-meson8b-Add-the-Ethernet-RMII-clock-tree-o.patch @@ -0,0 +1,162 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 May 2020 23:25:13 +0200 +Subject: clk: meson: meson8b: Add the Ethernet (RMII) clock tree on Meson8 + +Add the Ethernet clock tree on Meson8 which consists of: +- an input mux - the only known input is the RMII reference clock signal + which is an input on one of the SoC's pads +- a divider +- 0deg or 180deg phase change +- a gate to enable/disable the clock + +Add these clocks only for Meson8 because they're only known to be used +there. + +Signed-off-by: Martin Blumenstingl +--- + drivers/clk/meson/Kconfig | 1 + + drivers/clk/meson/meson8b.c | 81 ++++++++++ + drivers/clk/meson/meson8b.h | 1 + + 3 files changed, 83 insertions(+) + +diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/clk/meson/Kconfig ++++ b/drivers/clk/meson/Kconfig +@@ -59,6 +59,7 @@ config COMMON_CLK_MESON8B + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_CLKC_UTILS + select COMMON_CLK_MESON_MPLL ++ select COMMON_CLK_MESON_PHASE + select COMMON_CLK_MESON_PLL + select MFD_SYSCON + select RESET_CONTROLLER +diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c +index 111111111111..222222222222 100644 +--- a/drivers/clk/meson/meson8b.c ++++ b/drivers/clk/meson/meson8b.c +@@ -19,6 +19,7 @@ + #include "meson8b.h" + #include "clk-regmap.h" + #include "meson-clkc-utils.h" ++#include "clk-phase.h" + #include "clk-pll.h" + #include "clk-mpll.h" + +@@ -2682,6 +2683,78 @@ static struct clk_regmap meson8b_cts_i958 = { + }, + }; + ++static u32 meson8_eth_clk_mux_table[] = { 7 }; ++ ++static struct clk_regmap meson8_eth_clk_sel = { ++ .data = &(struct clk_regmap_mux_data) { ++ .offset = HHI_ETH_CLK_CNTL, ++ .mask = 0x7, ++ .shift = 9, ++ .table = meson8_eth_clk_mux_table, ++ }, ++ .hw.init = &(struct clk_init_data) { ++ .name = "eth_clk_sel", ++ .ops = &clk_regmap_mux_ops, ++ .parent_data = &(const struct clk_parent_data) { ++ /* TODO: all other parents are unknown */ ++ .fw_name = "rmii_clk", ++ }, ++ .num_parents = 1, ++ }, ++}; ++ ++static struct clk_regmap meson8_eth_clk_div = { ++ .data = &(struct clk_regmap_div_data) { ++ .offset = HHI_ETH_CLK_CNTL, ++ .shift = 0, ++ .width = 8, ++ }, ++ .hw.init = &(struct clk_init_data) { ++ .name = "eth_clk_div", ++ .ops = &clk_regmap_divider_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &meson8_eth_clk_sel.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ ++static struct clk_regmap meson8_eth_clk_phase = { ++ .data = &(struct meson_clk_phase_data) { ++ .ph = { ++ .reg_off = HHI_ETH_CLK_CNTL, ++ .shift = 14, ++ .width = 1, ++ }, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "eth_clk_inverted", ++ .ops = &meson_clk_phase_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &meson8_eth_clk_div.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ ++static struct clk_regmap meson8_eth_clk_gate = { ++ .data = &(struct clk_regmap_gate_data) { ++ .offset = HHI_ETH_CLK_CNTL, ++ .bit_idx = 8, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "eth_clk_en", ++ .ops = &clk_regmap_gate_ops, ++ .parent_hws = (const struct clk_hw *[]) { ++ &meson8_eth_clk_phase.hw ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ + #define MESON_GATE(_name, _reg, _bit) \ + MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw) + +@@ -2978,6 +3051,10 @@ static struct clk_hw *meson8_hw_clks[] = { + [CLKID_CTS_I958] = &meson8b_cts_i958.hw, + [CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw, + [CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw, ++ [CLKID_ETH_CLK_SEL] = &meson8_eth_clk_sel.hw, ++ [CLKID_ETH_CLK_DIV] = &meson8_eth_clk_div.hw, ++ [CLKID_ETH_CLK_PHASE] = &meson8_eth_clk_phase.hw, ++ [CLKID_ETH_CLK] = &meson8_eth_clk_gate.hw, + }; + + static struct clk_hw *meson8b_hw_clks[] = { +@@ -3606,6 +3683,10 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { + &meson8b_cts_mclk_i958, + &meson8b_cts_i958, + &meson8b_vid_pll_lvds_en, ++ &meson8_eth_clk_sel, ++ &meson8_eth_clk_div, ++ &meson8_eth_clk_phase, ++ &meson8_eth_clk_gate, + }; + + static const struct meson8b_clk_reset_line { +diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h +index 111111111111..222222222222 100644 +--- a/drivers/clk/meson/meson8b.h ++++ b/drivers/clk/meson/meson8b.h +@@ -43,6 +43,7 @@ + #define HHI_MALI_CLK_CNTL 0x1b0 /* 0x6c offset in data sheet */ + #define HHI_VPU_CLK_CNTL 0x1bc /* 0x6f offset in data sheet */ + #define HHI_HDMI_CLK_CNTL 0x1cc /* 0x73 offset in data sheet */ ++#define HHI_ETH_CLK_CNTL 0x1d8 /* 0x76 offset in data sheet */ + #define HHI_VDEC_CLK_CNTL 0x1e0 /* 0x78 offset in data sheet */ + #define HHI_VDEC2_CLK_CNTL 0x1e4 /* 0x79 offset in data sheet */ + #define HHI_VDEC3_CLK_CNTL 0x1e8 /* 0x7a offset in data sheet */ +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0021-dt-bindings-net-dwmac-meson-Add-the-Ethernet-clock-i.patch b/patch/kernel/archive/meson-6.10/0021-dt-bindings-net-dwmac-meson-Add-the-Ethernet-clock-i.patch new file mode 100644 index 000000000000..ec3546c577fb --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0021-dt-bindings-net-dwmac-meson-Add-the-Ethernet-clock-i.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 May 2020 23:37:35 +0200 +Subject: dt-bindings: net: dwmac-meson: Add the Ethernet clock input for + Meson6/8 + +The additional DWMAC register on Amlogic Meson6 and Meson8 SoCs take a +clock input (which is provided by the HHI clock controller). For RMII +mode this clock is derived from the RMII reference clock. Document this +clock input so the clock can be enabled when needed. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml | 22 ++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml ++++ b/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml +@@ -127,6 +127,28 @@ allOf: + - 2800 + - 3000 + ++ - if: ++ properties: ++ compatible: ++ contains: ++ enum: ++ - amlogic,meson6-dwmac ++ then: ++ properties: ++ clocks: ++ minItems: 1 ++ maxItems: 2 ++ items: ++ - description: GMAC main clock ++ - description: The RMII reference clock ++ ++ clock-names: ++ minItems: 1 ++ maxItems: 2 ++ items: ++ - const: stmmaceth ++ - const: ethernet ++ + properties: + compatible: + additionalItems: true +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0022-net-stmmac-dwmac-meson-Rename-the-SPEED_100-macro.patch b/patch/kernel/archive/meson-6.10/0022-net-stmmac-dwmac-meson-Rename-the-SPEED_100-macro.patch new file mode 100644 index 000000000000..37d4aecc6bbd --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0022-net-stmmac-dwmac-meson-Rename-the-SPEED_100-macro.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Dec 2021 04:07:05 +0100 +Subject: net: stmmac: dwmac-meson: Rename the SPEED_100 macro + +The SPEED_100 macro is part of the PREG_ETHERNET_ADDR0 register. Rename +it accordingly to make this relationship clear. +While here also add a comment what the SPEED_100 bit actually does. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +index 111111111111..222222222222 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +@@ -15,7 +15,8 @@ + + #include "stmmac_platform.h" + +-#define ETHMAC_SPEED_100 BIT(1) ++/* divides the input clock by 20 (= 0x0) or 2 (= 0x1) */ ++#define PREG_ETHERNET_ADDR0_SPEED_100 BIT(1) + + struct meson_dwmac { + struct device *dev; +@@ -31,10 +32,10 @@ static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned + + switch (speed) { + case SPEED_10: +- val &= ~ETHMAC_SPEED_100; ++ val &= ~PREG_ETHERNET_ADDR0_SPEED_100; + break; + case SPEED_100: +- val |= ETHMAC_SPEED_100; ++ val |= PREG_ETHERNET_ADDR0_SPEED_100; + break; + } + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0023-net-stmmac-dwmac-meson-Manage-the-ethernet-clock.patch b/patch/kernel/archive/meson-6.10/0023-net-stmmac-dwmac-meson-Manage-the-ethernet-clock.patch new file mode 100644 index 000000000000..a2a4b0111beb --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0023-net-stmmac-dwmac-meson-Manage-the-ethernet-clock.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Dec 2021 04:22:53 +0100 +Subject: net: stmmac: dwmac-meson: Manage the "ethernet" clock + +Meson6 and Meson8 (both use the same glue registers on top of the DWMAC +IP) have a dedicated Ethernet clock. For RMII mode the SoC has an input +for an external RMII reference clock signal (which can be provided by +either the PHY or an external oscillator). This clock needs to run at +50MHz because the additional glue registers can divide by 2 - to achieve +25MHz for 100Mbit/s line speed, or 20 - to achieve 2.5MHz for 10Mbit/s +line speed. + +Set the correct frequency for this clock and enable it during init. Also +enable the ETHMAC_DIV_EN bit which enables the divider in the glue +registers, based on the Ethernet clock input. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 51 +++++++++- + 1 file changed, 50 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +index 111111111111..222222222222 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +@@ -5,6 +5,7 @@ + * Copyright (C) 2014 Beniamino Galvani + */ + ++#include + #include + #include + #include +@@ -15,12 +16,15 @@ + + #include "stmmac_platform.h" + ++#define PREG_ETHERNET_ADDR0_DIV_EN BIT(0) ++ + /* divides the input clock by 20 (= 0x0) or 2 (= 0x1) */ + #define PREG_ETHERNET_ADDR0_SPEED_100 BIT(1) + + struct meson_dwmac { + struct device *dev; + void __iomem *reg; ++ struct clk *ethernet_clk; + }; + + static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) +@@ -42,6 +46,33 @@ static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned + writel(val, dwmac->reg); + } + ++static int meson6_dwmac_init(struct platform_device *pdev, void *priv) ++{ ++ struct meson_dwmac *dwmac = priv; ++ int ret; ++ ++ ret = clk_set_rate(dwmac->ethernet_clk, 50 * 1000 * 1000); ++ if (ret) ++ return ret; ++ ++ ret = clk_prepare_enable(dwmac->ethernet_clk); ++ if (ret) ++ return ret; ++ ++ writel(readl(dwmac->reg) | PREG_ETHERNET_ADDR0_DIV_EN, dwmac->reg); ++ ++ return 0; ++} ++ ++static void meson6_dwmac_exit(struct platform_device *pdev, void *priv) ++{ ++ struct meson_dwmac *dwmac = priv; ++ ++ writel(readl(dwmac->reg) & ~PREG_ETHERNET_ADDR0_DIV_EN, dwmac->reg); ++ ++ clk_disable_unprepare(dwmac->ethernet_clk); ++} ++ + static int meson6_dwmac_probe(struct platform_device *pdev) + { + struct plat_stmmacenet_data *plat_dat; +@@ -65,10 +96,28 @@ static int meson6_dwmac_probe(struct platform_device *pdev) + if (IS_ERR(dwmac->reg)) + return PTR_ERR(dwmac->reg); + ++ dwmac->ethernet_clk = devm_clk_get_optional(&pdev->dev, "ethernet"); ++ if (IS_ERR(dwmac->ethernet_clk)) ++ return PTR_ERR(dwmac->ethernet_clk); ++ + plat_dat->bsp_priv = dwmac; ++ plat_dat->init = meson6_dwmac_init; ++ plat_dat->exit = meson6_dwmac_exit; + plat_dat->fix_mac_speed = meson6_dwmac_fix_mac_speed; + +- return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); ++ ret = meson6_dwmac_init(pdev, dwmac); ++ if (ret) ++ return ret; ++ ++ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); ++ if (ret) ++ goto err_exit_dwmac; ++ ++ return 0; ++ ++err_exit_dwmac: ++ meson6_dwmac_exit(pdev, dwmac); ++ return ret; + } + + static const struct of_device_id meson6_dwmac_match[] = { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0024-net-stmmac-dwmac-meson-Initialize-all-known-PREG_ETH.patch b/patch/kernel/archive/meson-6.10/0024-net-stmmac-dwmac-meson-Initialize-all-known-PREG_ETH.patch new file mode 100644 index 000000000000..de3a2f4aba60 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0024-net-stmmac-dwmac-meson-Initialize-all-known-PREG_ETH.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Dec 2021 04:18:30 +0100 +Subject: net: stmmac: dwmac-meson: Initialize all known PREG_ETHERNET_ADDR0 + bits + +Initialize all known PREG_ETHERNET_ADDR0 register bits to be less +dependent on the bootloader to set them up correctly. + +Signed-off-by: Martin Blumenstingl +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 25 ++++++++-- + 1 file changed, 22 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +index 111111111111..222222222222 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +@@ -5,6 +5,7 @@ + * Copyright (C) 2014 Beniamino Galvani + */ + ++#include + #include + #include + #include +@@ -16,10 +17,20 @@ + + #include "stmmac_platform.h" + +-#define PREG_ETHERNET_ADDR0_DIV_EN BIT(0) ++#define PREG_ETHERNET_ADDR0_DIV_EN BIT(0) + + /* divides the input clock by 20 (= 0x0) or 2 (= 0x1) */ +-#define PREG_ETHERNET_ADDR0_SPEED_100 BIT(1) ++#define PREG_ETHERNET_ADDR0_SPEED_100 BIT(1) ++ ++/* 0x0 = little, 0x1 = big */ ++#define PREG_ETHERNET_ADDR0_DATA_ENDIANNESS BIT(2) ++ ++/* 0x0 = same order, 0x1: unknown */ ++#define PREG_ETHERNET_ADDR0_DESC_ENDIANNESS BIT(3) ++ ++#define PREG_ETHERNET_ADDR0_MII_MODE GENMASK(6, 4) ++#define PREG_ETHERNET_ADDR0_MII_MODE_RGMII 0x1 ++#define PREG_ETHERNET_ADDR0_MII_MODE_RMII 0x4 + + struct meson_dwmac { + struct device *dev; +@@ -49,6 +60,7 @@ static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned + static int meson6_dwmac_init(struct platform_device *pdev, void *priv) + { + struct meson_dwmac *dwmac = priv; ++ u32 val; + int ret; + + ret = clk_set_rate(dwmac->ethernet_clk, 50 * 1000 * 1000); +@@ -59,7 +71,14 @@ static int meson6_dwmac_init(struct platform_device *pdev, void *priv) + if (ret) + return ret; + +- writel(readl(dwmac->reg) | PREG_ETHERNET_ADDR0_DIV_EN, dwmac->reg); ++ val = readl(dwmac->reg); ++ val &= ~PREG_ETHERNET_ADDR0_DATA_ENDIANNESS; ++ val &= ~PREG_ETHERNET_ADDR0_DESC_ENDIANNESS; ++ val &= ~PREG_ETHERNET_ADDR0_MII_MODE; ++ val |= FIELD_PREP(PREG_ETHERNET_ADDR0_MII_MODE, ++ PREG_ETHERNET_ADDR0_MII_MODE_RMII); ++ val |= PREG_ETHERNET_ADDR0_DIV_EN; ++ writel(val, dwmac->reg); + + return 0; + } +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0025-ARM-dts-meson-meson8-Add-the-clock-input-to-the-Ethe.patch b/patch/kernel/archive/meson-6.10/0025-ARM-dts-meson-meson8-Add-the-clock-input-to-the-Ethe.patch new file mode 100644 index 000000000000..f8c9c33b075d --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0025-ARM-dts-meson-meson8-Add-the-clock-input-to-the-Ethe.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 May 2020 23:47:47 +0200 +Subject: ARM: dts: meson: meson8: Add the clock input to the Ethernet + controller + +The Ethernet controller on Meson8 has an additional clock input from the +HHI clock controller. The clock signal provides the RMII reference clock +which is used to generate the internal 25MHz or 2.5MHz clocks depending +on the line speed. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -613,8 +613,8 @@ temperature_calib: calib@1f4 { + }; + + ðmac { +- clocks = <&clkc CLKID_ETH>; +- clock-names = "stmmaceth"; ++ clocks = <&clkc CLKID_ETH>, <&clkc CLKID_ETH_CLK>; ++ clock-names = "stmmaceth", "ethernet"; + + power-domains = <&pwrc PWRC_MESON8_ETHERNET_MEM_ID>; + }; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0026-dt-bindings-clock-meson8b-add-the-rtc_32k-oscillator.patch b/patch/kernel/archive/meson-6.10/0026-dt-bindings-clock-meson8b-add-the-rtc_32k-oscillator.patch new file mode 100644 index 000000000000..e87a6e8b80a8 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0026-dt-bindings-clock-meson8b-add-the-rtc_32k-oscillator.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 Jan 2021 19:01:08 +0100 +Subject: dt-bindings: clock: meson8b: add the rtc_32k oscillator input + +The CLK81 tree can be driven off the 32kHz oscillator connected to the +SoCs RTC32K_XI and RTC32K_XO pads. Add this clock as a valid input. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt b/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt ++++ b/Documentation/devicetree/bindings/clock/amlogic,meson8b-clkc.txt +@@ -18,6 +18,8 @@ Required Properties: + * "clk_32k": (if present) the 32kHz clock signal from GPIOAO_6 (CLK_32K_IN) + * "rmii_clk": (if present) the 50MHz RMII reference clock (from the PHY or + an external oscillator ++ * "rtc_32k": the clock signal from the 32kHz oscillator connected to the ++ RTC32K_XI and RTC32K_XO pads + + Parent node should have the following properties : + - compatible: "amlogic,meson-hhi-sysctrl", "simple-mfd", "syscon" +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0027-clk-meson-meson8b-Add-the-mpeg_rtc_osc_sel-clock.patch b/patch/kernel/archive/meson-6.10/0027-clk-meson-meson8b-Add-the-mpeg_rtc_osc_sel-clock.patch new file mode 100644 index 000000000000..2271ffe73580 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0027-clk-meson-meson8b-Add-the-mpeg_rtc_osc_sel-clock.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 1 Jan 2021 18:55:05 +0100 +Subject: clk: meson: meson8b: Add the mpeg_rtc_osc_sel clock + +The first input of the CLK81 clock tree uses the SoC's external +oscillators. By default it's the 24MHz XTAL from which most frequencies +in this SoC are derived. For power-saving purposes there's a mux to +switch the input between the 24MHz XTAL and the 32kHz RTC oscillator. +Add support for that mux add it to the CLK81 clock tree for a better +representation of how the hardware is actually designed. + +Signed-off-by: Martin Blumenstingl +--- + drivers/clk/meson/meson8b.c | 26 +++++++++- + include/dt-bindings/clock/meson8b-clkc.h | 1 + + 2 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c +index 111111111111..222222222222 100644 +--- a/drivers/clk/meson/meson8b.c ++++ b/drivers/clk/meson/meson8b.c +@@ -611,7 +611,24 @@ static struct clk_regmap meson8b_mpll2 = { + }, + }; + +-static u32 mux_table_clk81[] = { 6, 5, 7 }; ++static struct clk_regmap meson8b_mpeg_rtc_osc_sel = { ++ .data = &(struct clk_regmap_mux_data){ ++ .offset = HHI_MPEG_CLK_CNTL, ++ .mask = 0x1, ++ .shift = 9, ++ }, ++ .hw.init = &(struct clk_init_data){ ++ .name = "mpeg_rtc_osc_sel", ++ .ops = &clk_regmap_mux_ro_ops, ++ .parent_data = (const struct clk_parent_data[]) { ++ { .fw_name = "xtal", .index = -1, }, ++ { .fw_name = "rtc_32k", .index = -1, }, ++ }, ++ .num_parents = 2, ++ }, ++}; ++ ++static u32 mux_table_clk81[] = { 0, 6, 5, 7 }; + static struct clk_regmap meson8b_mpeg_clk_sel = { + .data = &(struct clk_regmap_mux_data){ + .offset = HHI_MPEG_CLK_CNTL, +@@ -628,11 +645,12 @@ static struct clk_regmap meson8b_mpeg_clk_sel = { + * fclk_div4, fclk_div3, fclk_div5 + */ + .parent_hws = (const struct clk_hw *[]) { ++ &meson8b_mpeg_rtc_osc_sel.hw, + &meson8b_fclk_div3.hw, + &meson8b_fclk_div4.hw, + &meson8b_fclk_div5.hw, + }, +- .num_parents = 3, ++ .num_parents = 4, + }, + }; + +@@ -3055,6 +3073,7 @@ static struct clk_hw *meson8_hw_clks[] = { + [CLKID_ETH_CLK_DIV] = &meson8_eth_clk_div.hw, + [CLKID_ETH_CLK_PHASE] = &meson8_eth_clk_phase.hw, + [CLKID_ETH_CLK] = &meson8_eth_clk_gate.hw, ++ [CLKID_MPEG_RTC_OSC_SEL] = &meson8b_mpeg_rtc_osc_sel.hw, + }; + + static struct clk_hw *meson8b_hw_clks[] = { +@@ -3270,6 +3289,7 @@ static struct clk_hw *meson8b_hw_clks[] = { + [CLKID_CTS_I958] = &meson8b_cts_i958.hw, + [CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw, + [CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw, ++ [CLKID_MPEG_RTC_OSC_SEL] = &meson8b_mpeg_rtc_osc_sel.hw, + }; + + static struct clk_hw *meson8m2_hw_clks[] = { +@@ -3487,6 +3507,7 @@ static struct clk_hw *meson8m2_hw_clks[] = { + [CLKID_CTS_I958] = &meson8b_cts_i958.hw, + [CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw, + [CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw, ++ [CLKID_MPEG_RTC_OSC_SEL] = &meson8b_mpeg_rtc_osc_sel.hw, + }; + + static struct clk_regmap *const meson8b_clk_regmaps[] = { +@@ -3687,6 +3708,7 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { + &meson8_eth_clk_div, + &meson8_eth_clk_phase, + &meson8_eth_clk_gate, ++ &meson8b_mpeg_rtc_osc_sel, + }; + + static const struct meson8b_clk_reset_line { +diff --git a/include/dt-bindings/clock/meson8b-clkc.h b/include/dt-bindings/clock/meson8b-clkc.h +index 111111111111..222222222222 100644 +--- a/include/dt-bindings/clock/meson8b-clkc.h ++++ b/include/dt-bindings/clock/meson8b-clkc.h +@@ -225,5 +225,6 @@ + #define CLKID_ETH_CLK_DIV 219 + #define CLKID_ETH_CLK_PHASE 220 + #define CLKID_ETH_CLK 221 ++#define CLKID_MPEG_RTC_OSC_SEL 222 + + #endif /* __MESON8B_CLKC_H */ +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0028-ARM-dts-meson-Add-address-cells-size-cells-and-range.patch b/patch/kernel/archive/meson-6.10/0028-ARM-dts-meson-Add-address-cells-size-cells-and-range.patch new file mode 100644 index 000000000000..7e534e33657f --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0028-ARM-dts-meson-Add-address-cells-size-cells-and-range.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 28 Aug 2021 18:50:10 +0200 +Subject: ARM: dts: meson: Add #address-cells, #size-cells and ranges to hhi + +The HHI node has multiple child-nodes. Add #address-cells, #size-cells +and ranges properties to the hhi node itself so the child-nodes can get +their own offset and register sizes. Also add the reg property to the +clock and power domain controllers inside the hhi region. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson.dtsi | 3 +++ + arch/arm/boot/dts/amlogic/meson8.dtsi | 6 ++++-- + arch/arm/boot/dts/amlogic/meson8b.dtsi | 6 ++++-- + 3 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/amlogic/meson.dtsi b/arch/arm/boot/dts/amlogic/meson.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson.dtsi +@@ -35,6 +35,9 @@ hhi: system-controller@4000 { + "simple-mfd", + "syscon"; + reg = <0x4000 0x400>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0x0 0x4000 0x400>; + }; + + aiu: audio-controller@5400 { +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -625,16 +625,18 @@ &gpio_intc { + }; + + &hhi { +- clkc: clock-controller { ++ clkc: clock-controller@0 { + compatible = "amlogic,meson8-clkc"; ++ reg = <0x0 0x39c>; + clocks = <&xtal>, <&ddr_clkc DDR_CLKID_DDR_PLL>; + clock-names = "xtal", "ddr_pll"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + +- pwrc: power-controller { ++ pwrc: power-controller@100 { + compatible = "amlogic,meson8-pwrc"; ++ reg = <0x100 0x10>; + #power-domain-cells = <1>; + amlogic,ao-sysctrl = <&pmu>; + clocks = <&clkc CLKID_VPU>; +diff --git a/arch/arm/boot/dts/amlogic/meson8b.dtsi b/arch/arm/boot/dts/amlogic/meson8b.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8b.dtsi +@@ -586,16 +586,18 @@ &gpio_intc { + }; + + &hhi { +- clkc: clock-controller { ++ clkc: clock-controller@0 { + compatible = "amlogic,meson8b-clkc"; ++ reg = <0x0 0x39c>; + clocks = <&xtal>, <&ddr_clkc DDR_CLKID_DDR_PLL>; + clock-names = "xtal", "ddr_pll"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + +- pwrc: power-controller { ++ pwrc: power-controller@100 { + compatible = "amlogic,meson8b-pwrc"; ++ reg = <0x100 0x10>; + #power-domain-cells = <1>; + amlogic,ao-sysctrl = <&pmu>; + resets = <&reset RESET_DBLK>, +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0029-dt-bindings-firmware-Document-the-Amlogic-Meson6-8-8.patch b/patch/kernel/archive/meson-6.10/0029-dt-bindings-firmware-Document-the-Amlogic-Meson6-8-8.patch new file mode 100644 index 000000000000..c7e40d3c8a67 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0029-dt-bindings-firmware-Document-the-Amlogic-Meson6-8-8.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 17 May 2021 22:50:25 +0200 +Subject: dt-bindings: firmware: Document the Amlogic Meson6/8/8b/8m2 TrustZone + +Amlogic Meson6/8/8b/8m2 SoCs can optionally use a TrustZone secure +firmware. This prevents anything outside of the TEE (Trusted +Execution Environment aka TrustZone secure firmware) from accessing +certain functionality of these SoCs, such as (but not limited to): +Bringing up/down secondary SMP cores, accessing the eFuse and getting +the SoC misc version. +ARM SMCCC is used for communication with the TrustZone secure +firmware. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/firmware/meson/amlogic,meson-mx-trustzone-firmware.yaml | 47 ++++++++++ + 1 file changed, 47 insertions(+) + +diff --git a/Documentation/devicetree/bindings/firmware/meson/amlogic,meson-mx-trustzone-firmware.yaml b/Documentation/devicetree/bindings/firmware/meson/amlogic,meson-mx-trustzone-firmware.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/firmware/meson/amlogic,meson-mx-trustzone-firmware.yaml +@@ -0,0 +1,47 @@ ++# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) ++# Copyright 2021 Martin Blumenstingl ++%YAML 1.2 ++--- ++$id: "http://devicetree.org/schemas/firmware/meson/amlogic,meson-mx-trustzone-firmware.yaml#" ++$schema: "http://devicetree.org/meta-schemas/core.yaml#" ++ ++title: Amlogic Meson6/8/8b/8m2 TrustZone secure firmware ++ ++description: | ++ Amlogic Meson6/8/8b/8m2 SoCs can optionally use a TrustZone secure ++ firmware. This prevents anything outside of the TEE (Trusted ++ Execution Environment aka TrustZone secure firmware) from accessing ++ certain functionality of these SoCs, such as (but not limited to): ++ Bringing up/down secondary SMP cores, accessing the eFuse and getting ++ the SoC misc version. ++ ARM SMCCC is used for communication with the TrustZone secure ++ firmware. ++ ++maintainers: ++ - Martin Blumenstingl ++ ++properties: ++ compatible: ++ oneOf: ++ - items: ++ - enum: ++ - amlogic,meson6-trustzone-firmware ++ - amlogic,meson8-trustzone-firmware ++ - amlogic,meson8b-trustzone-firmware ++ - amlogic,meson8m2-trustzone-firmware ++ - const: amlogic,meson-mx-trustzone-firmware ++ ++required: ++ - compatible ++ ++additionalProperties: false ++ ++examples: ++ - | ++ firmware { ++ trustzone-firmware { ++ compatible = "amlogic,meson8m2-trustzone-firmware", ++ "amlogic,meson-mx-trustzone-firmware"; ++ }; ++ }; ++... +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0030-dt-bindings-arm-cpus-Document-Meson8-TrustZone-firmw.patch b/patch/kernel/archive/meson-6.10/0030-dt-bindings-arm-cpus-Document-Meson8-TrustZone-firmw.patch new file mode 100644 index 000000000000..1c5b8d4bd6f9 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0030-dt-bindings-arm-cpus-Document-Meson8-TrustZone-firmw.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 18 Dec 2021 16:38:16 +0100 +Subject: dt-bindings: arm: cpus: Document Meson8 TrustZone firmware + enable-method + +Amlogic Meson8 SoCs can run a TrustZone firmware. This results in the +CPU registers not being accessible directly and instead require firmware +calls for booting the secondary cores or powering off a CPU. Add a new +compatible string for this enable-method. + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/arm/cpus.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/arm/cpus.yaml b/Documentation/devicetree/bindings/arm/cpus.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/arm/cpus.yaml ++++ b/Documentation/devicetree/bindings/arm/cpus.yaml +@@ -216,6 +216,7 @@ properties: + - allwinner,sun9i-a80-smp + - allwinner,sun8i-a83t-smp + - amlogic,meson8-smp ++ - amlogic,meson8-trustzone-firmware-smp + - amlogic,meson8b-smp + - arm,realview-smp + - aspeed,ast2600-smp +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0031-ARM-meson-Add-support-for-the-TrustZone-firmware.patch b/patch/kernel/archive/meson-6.10/0031-ARM-meson-Add-support-for-the-TrustZone-firmware.patch new file mode 100644 index 000000000000..5d0fca16bab9 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0031-ARM-meson-Add-support-for-the-TrustZone-firmware.patch @@ -0,0 +1,436 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 3 May 2021 00:34:53 +0200 +Subject: ARM: meson: Add support for the TrustZone firmware + +Amlogic Meson6/8/8b/8m2 SoCs can optionally use a TrustZone secure +firmware. This prevents anything outside of the TEE (Trusted +Execution Environment aka TrustZone secure firmware) from accessing +certain functionality of these SoCs, such as (but not limited to): +Bringing up/down secondary SMP cores, accessing the eFuse and getting +the SoC misc version. +ARM SMCCC is used for communication with the TrustZone secure +firmware. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/mach-meson/Makefile | 2 +- + arch/arm/mach-meson/meson.c | 4 + + arch/arm/mach-meson/tz_firmware.c | 250 ++++++++++ + arch/arm/mach-meson/tz_firmware.h | 76 +++ + include/linux/firmware/meson/meson_mx_trustzone.h | 37 ++ + 5 files changed, 368 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mach-meson/Makefile b/arch/arm/mach-meson/Makefile +index 111111111111..222222222222 100644 +--- a/arch/arm/mach-meson/Makefile ++++ b/arch/arm/mach-meson/Makefile +@@ -1,3 +1,3 @@ + # SPDX-License-Identifier: GPL-2.0-only +-obj-$(CONFIG_ARCH_MESON) += meson.o ++obj-$(CONFIG_ARCH_MESON) += meson.o tz_firmware.o + obj-$(CONFIG_SMP) += platsmp.o +diff --git a/arch/arm/mach-meson/meson.c b/arch/arm/mach-meson/meson.c +index 111111111111..222222222222 100644 +--- a/arch/arm/mach-meson/meson.c ++++ b/arch/arm/mach-meson/meson.c +@@ -5,6 +5,8 @@ + + #include + ++#include "tz_firmware.h" ++ + static const char * const meson_common_board_compat[] = { + "amlogic,meson6", + "amlogic,meson8", +@@ -17,4 +19,6 @@ DT_MACHINE_START(MESON, "Amlogic Meson platform") + .dt_compat = meson_common_board_compat, + .l2c_aux_val = 0, + .l2c_aux_mask = ~0, ++ .init_early = meson_mx_trustzone_firmware_init, ++ .reserve = meson_mx_trustzone_firmware_reserve_mem, + MACHINE_END +diff --git a/arch/arm/mach-meson/tz_firmware.c b/arch/arm/mach-meson/tz_firmware.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/arch/arm/mach-meson/tz_firmware.c +@@ -0,0 +1,250 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (C) 2021 Martin Blumenstingl ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include "tz_firmware.h" ++ ++struct meson_mx_trustzone_firmware_memconfig { ++ unsigned char name[64]; ++ unsigned int start_phy_addr; ++ unsigned int end_phy_addr; ++} __packed; ++ ++static struct meson_mx_trustzone_firmware_memconfig meson_firmware_memconfig[2]; ++ ++static int meson_mx_trustzone_firmware_hal_api(unsigned int cmd, u32 *args) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(MESON_CALL_TRUSTZONE_HAL_API, cmd, virt_to_phys(args), 0, ++ 0, 0, 0, 0, &res); ++ ++ return res.a0; ++} ++ ++static u32 meson_mx_trustzone_firmware_mon(unsigned int cmd, unsigned int arg0, ++ unsigned int arg1) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(MESON_CALL_TRUSTZONE_MON, cmd, arg0, arg1, 0, 0, 0, 0, ++ &res); ++ ++ return res.a0; ++} ++ ++static int meson_mx_trustzone_firmware_set_cpu_boot_addr(int cpu, ++ unsigned long boot_addr){ ++ return meson_mx_trustzone_firmware_mon(MESON_TRUSTZONE_MON_CORE_BOOTADDR_INDEX, ++ cpu, boot_addr); ++} ++ ++static int meson_mx_trustzone_firmware_cpu_boot(int cpu) ++{ ++ u32 ret, corectrl; ++ ++ corectrl = meson_mx_trustzone_firmware_mon(MESON_TRUSTZONE_MON_CORE_RD_CTRL_INDEX, ++ 0, 0); ++ ++ corectrl |= BIT(cpu); ++ ++ ret = meson_mx_trustzone_firmware_mon(MESON_TRUSTZONE_MON_CORE_WR_CTRL_INDEX, ++ corectrl, 0); ++ if (ret != corectrl) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static void meson_mx_trustzone_firmware_l2x0_write_sec(unsigned long val, ++ unsigned int reg) ++{ ++ u32 fn; ++ ++ switch (reg) { ++ case L2X0_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_CTRL_INDEX; ++ break; ++ ++ case L2X0_AUX_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_AUXCTRL_INDEX; ++ break; ++ ++ case L310_TAG_LATENCY_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_TAGLATENCY_INDEX; ++ break; ++ ++ case L310_DATA_LATENCY_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_DATALATENCY_INDEX; ++ break; ++ ++ case L310_ADDR_FILTER_START: ++ fn = MESON_TRUSTZONE_MON_L2X0_FILTERSTART_INDEX; ++ break; ++ ++ case L310_ADDR_FILTER_END: ++ fn = MESON_TRUSTZONE_MON_L2X0_FILTEREND_INDEX; ++ break; ++ ++ case L2X0_DEBUG_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_DEBUG_INDEX; ++ break; ++ ++ case L310_PREFETCH_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_PREFETCH_INDEX; ++ break; ++ ++ case L310_POWER_CTRL: ++ fn = MESON_TRUSTZONE_MON_L2X0_POWER_INDEX; ++ break; ++ ++ default: ++ pr_warn("Amlogic Meson TrustZone - unsupported L2X0 register 0x%08x\n", ++ reg); ++ return; ++ } ++ ++ WARN_ON(meson_mx_trustzone_firmware_mon(fn, val, 0)); ++} ++ ++static int __maybe_unused meson_mx_trustzone_firmware_l2x0_init(void) ++{ ++ if (IS_ENABLED(CONFIG_CACHE_L2X0)) ++ outer_cache.write_sec = meson_mx_trustzone_firmware_l2x0_write_sec; ++ ++ return 0; ++} ++ ++static const struct firmware_ops meson_mx_trustzone_firmware_ops = { ++ .set_cpu_boot_addr = meson_mx_trustzone_firmware_set_cpu_boot_addr, ++ .cpu_boot = meson_mx_trustzone_firmware_cpu_boot, ++ .l2x0_init = meson_mx_trustzone_firmware_l2x0_init, ++}; ++ ++void __init meson_mx_trustzone_firmware_init(void) ++{ ++ if (!meson_mx_trustzone_firmware_available()) ++ return; ++ ++ pr_info("Running under Amlogic Meson TrustZone secure firmware.\n"); ++ ++ register_firmware_ops(&meson_mx_trustzone_firmware_ops); ++ ++ call_firmware_op(l2x0_init); ++} ++ ++static void __init meson_mx_trustzone_firmware_memconfig_init(void) ++{ ++ unsigned int i, size; ++ u32 args[2] = { ++ __pa_symbol(meson_firmware_memconfig), ++ ARRAY_SIZE(meson_firmware_memconfig), ++ }; ++ int ret; ++ ++ ret = meson_mx_trustzone_firmware_hal_api(MESON_TRUSTZONE_HAL_API_MEMCONFIG, ++ args); ++ if (ret) { ++ pr_err("Amlogic Meson TrustZone memconfig failed: %d\n", ret); ++ return; ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(meson_firmware_memconfig); i++) { ++ size = meson_firmware_memconfig[i].end_phy_addr - ++ meson_firmware_memconfig[i].start_phy_addr; ++ ++ pr_debug("\tAmlogic Meson TrustZone memblock[%d]: %s (%u bytes)\n", ++ i, meson_firmware_memconfig[i].name, size); ++ ++ ret = memblock_mark_nomap(meson_firmware_memconfig[i].start_phy_addr, ++ size); ++ if (ret) ++ pr_err("Failed to reserve %u bytes for Amlogic Meson TrustZone memblock[%d] (%s): %d\n", ++ size, i, meson_firmware_memconfig[i].name, ret); ++ } ++} ++ ++static void __init meson_mx_trustzone_firmware_monitor_memory_init(void) ++{ ++ u32 base, size; ++ int ret; ++ ++ base = meson_mx_trustzone_firmware_mon(MESON_TRUSTZONE_MON_MEM_BASE, ++ 0, 0); ++ WARN_ON(!base); ++ ++ size = meson_mx_trustzone_firmware_mon(MESON_TRUSTZONE_MON_MEM_TOTAL_SIZE, ++ 0, 0); ++ WARN_ON(!size); ++ ++ ret = memblock_mark_nomap(base, size); ++ if (ret) ++ pr_err("Failed to reserve %u bytes of Amlogic Meson TrustZone monitor memory: %d\n", ++ size, ret); ++} ++ ++void __init meson_mx_trustzone_firmware_reserve_mem(void) ++{ ++ if (!meson_mx_trustzone_firmware_available()) ++ return; ++ ++ meson_mx_trustzone_firmware_monitor_memory_init(); ++ meson_mx_trustzone_firmware_memconfig_init(); ++} ++ ++bool meson_mx_trustzone_firmware_available(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "amlogic,meson-mx-trustzone-firmware"); ++ if (!np) ++ return false; ++ ++ of_node_put(np); ++ ++ return true; ++} ++EXPORT_SYMBOL_GPL(meson_mx_trustzone_firmware_available); ++ ++int meson_mx_trustzone_firmware_efuse_read(unsigned int offset, ++ unsigned int bytes, void *buf) ++{ ++ unsigned int read_bytes; ++ u32 args[5] = { ++ MESON_TRUSTZONE_HAL_API_EFUSE_CMD_READ, ++ offset, ++ bytes, ++ __pa_symbol(buf), ++ virt_to_phys(&read_bytes) ++ }; ++ int ret; ++ ++ ret = meson_mx_trustzone_firmware_hal_api(MESON_TRUSTZONE_HAL_API_EFUSE, ++ args); ++ if (ret) ++ return -EIO; ++ ++ if (read_bytes != bytes) ++ return -EINVAL; ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(meson_mx_trustzone_firmware_efuse_read); ++ ++u32 meson_mx_trustzone_read_soc_rev1(void) ++{ ++ return meson_mx_trustzone_firmware_mon(MESON_TRUSTZONE_MON_CORE_RD_SOC_REV1, ++ 0, 0); ++} ++EXPORT_SYMBOL_GPL(meson_mx_trustzone_read_soc_rev1); +diff --git a/arch/arm/mach-meson/tz_firmware.h b/arch/arm/mach-meson/tz_firmware.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/arch/arm/mach-meson/tz_firmware.h +@@ -0,0 +1,76 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Amlogic Meson6/8/8b/8m2 secure TrustZone firmware definitions. ++ * ++ * Based on meson-secure.c and meson-secure.h from the Amlogic vendor kernel: ++ * Copyright (C) 2002 ARM Ltd. ++ * Copyright (c) 2010, Code Aurora Forum. All rights reserved. ++ * Copyright (C) 2013 Amlogic, Inc. ++ * Author: Platform-SH@amlogic.com ++ * ++ * Copyright (C) 2021 Martin Blumenstingl ++ */ ++ ++/* Meson Secure Monitor/HAL APIs */ ++#define MESON_CALL_TRUSTZONE_API 0x1 ++#define MESON_CALL_TRUSTZONE_MON 0x4 ++#define MESON_CALL_TRUSTZONE_HAL_API 0x5 ++ ++/* Secure Monitor mode APIs */ ++#define MESON_TRUSTZONE_MON_TYPE_MASK 0xF00 ++#define MESON_TRUSTZONE_MON_FUNC_MASK 0x0FF ++ ++#define MESON_TRUSTZONE_MON_L2X0 0x100 ++#define MESON_TRUSTZONE_MON_L2X0_CTRL_INDEX 0x101 ++#define MESON_TRUSTZONE_MON_L2X0_AUXCTRL_INDEX 0x102 ++#define MESON_TRUSTZONE_MON_L2X0_PREFETCH_INDEX 0x103 ++#define MESON_TRUSTZONE_MON_L2X0_TAGLATENCY_INDEX 0x104 ++#define MESON_TRUSTZONE_MON_L2X0_DATALATENCY_INDEX 0x105 ++#define MESON_TRUSTZONE_MON_L2X0_FILTERSTART_INDEX 0x106 ++#define MESON_TRUSTZONE_MON_L2X0_FILTEREND_INDEX 0x107 ++#define MESON_TRUSTZONE_MON_L2X0_DEBUG_INDEX 0x108 ++#define MESON_TRUSTZONE_MON_L2X0_POWER_INDEX 0x109 ++ ++#define MESON_TRUSTZONE_MON_CORE 0x200 ++#define MESON_TRUSTZONE_MON_CORE_RD_CTRL_INDEX 0x201 ++#define MESON_TRUSTZONE_MON_CORE_WR_CTRL_INDEX 0x202 ++#define MESON_TRUSTZONE_MON_CORE_RD_STATUS0_INDEX 0x203 ++#define MESON_TRUSTZONE_MON_CORE_WR_STATUS0_INDEX 0x204 ++#define MESON_TRUSTZONE_MON_CORE_RD_STATUS1_INDEX 0x205 ++#define MESON_TRUSTZONE_MON_CORE_WR_STATUS1_INDEX 0x206 ++#define MESON_TRUSTZONE_MON_CORE_BOOTADDR_INDEX 0x207 ++#define MESON_TRUSTZONE_MON_CORE_DDR_INDEX 0x208 ++#define MESON_TRUSTZONE_MON_CORE_RD_SOC_REV1 0x209 ++#define MESON_TRUSTZONE_MON_CORE_RD_SOC_REV2 0x20A ++ ++#define MESON_TRUSTZONE_MON_SUSPEND_FIRMWARE 0x300 ++#define MESON_TRUSTZONE_MON_SAVE_CPU_GIC 0x400 ++ ++#define MESON_TRUSTZONE_MON_RTC 0x500 ++#define MESON_TRUSTZONE_MON_RTC_RD_REG_INDEX 0x501 ++#define MESON_TRUSTZONE_MON_RTC_WR_REG_INDEX 0x502 ++ ++#define MESON_TRUSTZONE_MON_REG 0x600 ++#define MESON_TRUSTZONE_MON_REG_RD_INDEX 0x601 ++#define MESON_TRUSTZONE_MON_REG_WR_INDEX 0x602 ++ ++#define MESON_TRUSTZONE_MON_MEM 0x700 ++#define MESON_TRUSTZONE_MON_MEM_BASE 0x701 ++#define MESON_TRUSTZONE_MON_MEM_TOTAL_SIZE 0x702 ++#define MESON_TRUSTZONE_MON_MEM_FLASH 0x703 ++#define MESON_TRUSTZONE_MON_MEM_FLASH_SIZE 0x704 ++#define MESON_TRUSTZONE_MON_MEM_GE2D 0x705 ++ ++/* Secure HAL APIs*/ ++#define MESON_TRUSTZONE_HAL_API_EFUSE 0x100 ++#define MESON_TRUSTZONE_HAL_API_EFUSE_CMD_READ 0x0 ++#define MESON_TRUSTZONE_HAL_API_EFUSE_CMD_WRITE 0x1 ++#define MESON_TRUSTZONE_HAL_API_EFUSE_CMD_VERIFY_IMG 0x3 ++ ++#define MESON_TRUSTZONE_HAL_API_STORAGE 0x200 ++ ++#define MESON_TRUSTZONE_HAL_API_MEMCONFIG 0x300 ++#define MESON_TRUSTZONE_HAL_API_MEMCONFIG_GE2D 0x301 ++ ++void __init meson_mx_trustzone_firmware_init(void); ++void __init meson_mx_trustzone_firmware_reserve_mem(void); +diff --git a/include/linux/firmware/meson/meson_mx_trustzone.h b/include/linux/firmware/meson/meson_mx_trustzone.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/include/linux/firmware/meson/meson_mx_trustzone.h +@@ -0,0 +1,37 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Copyright (C) 2021 Martin Blumenstingl ++ */ ++ ++#include ++#include ++ ++#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_MESON) ++ ++bool meson_mx_trustzone_firmware_available(void); ++ ++int meson_mx_trustzone_firmware_efuse_read(unsigned int offset, ++ unsigned int bytes, void *buf); ++ ++u32 meson_mx_trustzone_read_soc_rev1(void); ++ ++#else ++ ++static inline bool meson_mx_trustzone_firmware_available(void) ++{ ++ return false; ++} ++ ++static inline int meson_mx_trustzone_firmware_efuse_read(unsigned int offset, ++ unsigned int bytes, ++ void *buf) ++{ ++ return -EINVAL; ++} ++ ++static inline u32 meson_mx_trustzone_read_soc_rev1(void) ++{ ++ return 0; ++} ++ ++#endif +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0032-ARM-meson-platsmp-Add-support-for-SoCs-running-on-Tr.patch b/patch/kernel/archive/meson-6.10/0032-ARM-meson-platsmp-Add-support-for-SoCs-running-on-Tr.patch new file mode 100644 index 000000000000..df0e646f58d9 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0032-ARM-meson-platsmp-Add-support-for-SoCs-running-on-Tr.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 3 May 2021 08:36:16 +0200 +Subject: ARM: meson: platsmp: Add support for SoCs running on TrustZone + firmware + +When the SoC is running on the TrustZone firmware we cannot modify the +SMP related registers. Add a new set of SMP ops which use firmware calls +to set the startup (function) address and core control (on/off). + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/mach-meson/platsmp.c | 33 ++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/arch/arm/mach-meson/platsmp.c b/arch/arm/mach-meson/platsmp.c +index 111111111111..222222222222 100644 +--- a/arch/arm/mach-meson/platsmp.c ++++ b/arch/arm/mach-meson/platsmp.c +@@ -16,6 +16,7 @@ + + #include + #include ++#include + #include + #include + +@@ -291,6 +292,31 @@ static int meson8b_smp_boot_secondary(unsigned int cpu, + return 0; + } + ++static int meson8_smp_trustzone_firmware_boot_secondary(unsigned int cpu, ++ struct task_struct *idle) ++{ ++ unsigned int addr = __pa_symbol(secondary_startup); ++ int ret; ++ ++ ret = call_firmware_op(set_cpu_boot_addr, cpu, addr); ++ if (ret) { ++ pr_err("Failed to set aux core boot address for CPU%u using TrustZone secure firmware\n", ++ cpu); ++ return ret; ++ } ++ ++ ret = call_firmware_op(cpu_boot, cpu); ++ if (ret) { ++ pr_err("Failed to modify core control for CPU%u using TrustZone secure firmware\n", ++ cpu); ++ return ret; ++ } ++ ++ udelay(10); ++ ++ return 0; ++} ++ + #ifdef CONFIG_HOTPLUG_CPU + static void meson8_smp_cpu_die(unsigned int cpu) + { +@@ -428,5 +454,12 @@ static struct smp_operations meson8b_smp_ops __initdata = { + #endif + }; + ++static struct smp_operations meson8_smp_trustzone_firmware_ops __initdata = { ++ .smp_boot_secondary = meson8_smp_trustzone_firmware_boot_secondary, ++}; ++ + CPU_METHOD_OF_DECLARE(meson8_smp, "amlogic,meson8-smp", &meson8_smp_ops); + CPU_METHOD_OF_DECLARE(meson8b_smp, "amlogic,meson8b-smp", &meson8b_smp_ops); ++CPU_METHOD_OF_DECLARE(meson8_trustzone_firmware_smp, ++ "amlogic,meson8-trustzone-firmware-smp", ++ &meson8_smp_trustzone_firmware_ops); +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0033-soc-amlogic-meson-mx-socinfo-Add-support-for-the-Tru.patch b/patch/kernel/archive/meson-6.10/0033-soc-amlogic-meson-mx-socinfo-Add-support-for-the-Tru.patch new file mode 100644 index 000000000000..ab4633b2e36d --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0033-soc-amlogic-meson-mx-socinfo-Add-support-for-the-Tru.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 16 May 2021 19:48:54 +0200 +Subject: soc: amlogic: meson-mx-socinfo: Add support for the TrustZone + firmware + +When the TrustZone firmware is enabled the SoC is configured so the boot +ROM cannot be read from the (untrusted) Linux kernel. Instead a firmware +call needs to be used to get the SoC's "misc" version. +Add support for the firmware call to retrieve the SoC's misc version if +the TrustZone firmware is loaded. + +Signed-off-by: Martin Blumenstingl +--- + drivers/soc/amlogic/meson-mx-socinfo.c | 23 ++++++---- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/drivers/soc/amlogic/meson-mx-socinfo.c b/drivers/soc/amlogic/meson-mx-socinfo.c +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/meson-mx-socinfo.c ++++ b/drivers/soc/amlogic/meson-mx-socinfo.c +@@ -4,6 +4,7 @@ + * SPDX-License-Identifier: GPL-2.0+ + */ + ++#include + #include + #include + #include +@@ -118,10 +119,12 @@ static int __init meson_mx_socinfo_init(void) + if (IS_ERR(assist_regmap)) + return PTR_ERR(assist_regmap); + +- bootrom_regmap = +- syscon_regmap_lookup_by_compatible("amlogic,meson-mx-bootrom"); +- if (IS_ERR(bootrom_regmap)) +- return PTR_ERR(bootrom_regmap); ++ if (!meson_mx_trustzone_firmware_available()) { ++ bootrom_regmap = ++ syscon_regmap_lookup_by_compatible("amlogic,meson-mx-bootrom"); ++ if (IS_ERR(bootrom_regmap)) ++ return PTR_ERR(bootrom_regmap); ++ } + + np = of_find_matching_node(NULL, meson_mx_socinfo_analog_top_ids); + if (np) { +@@ -141,10 +144,14 @@ static int __init meson_mx_socinfo_init(void) + if (ret < 0) + return ret; + +- ret = regmap_read(bootrom_regmap, MESON_MX_BOOTROM_MISC_VER, +- &misc_ver); +- if (ret < 0) +- return ret; ++ if (meson_mx_trustzone_firmware_available()) { ++ misc_ver = meson_mx_trustzone_read_soc_rev1(); ++ } else { ++ ret = regmap_read(bootrom_regmap, MESON_MX_BOOTROM_MISC_VER, ++ &misc_ver); ++ if (ret < 0) ++ return ret; ++ } + + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + if (!soc_dev_attr) +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0034-nvmem-meson-mx-efuse-Add-support-for-the-TrustZone-f.patch b/patch/kernel/archive/meson-6.10/0034-nvmem-meson-mx-efuse-Add-support-for-the-TrustZone-f.patch new file mode 100644 index 000000000000..a4019c70a137 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0034-nvmem-meson-mx-efuse-Add-support-for-the-TrustZone-f.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 3 May 2021 00:35:22 +0200 +Subject: nvmem: meson-mx-efuse: Add support for the TrustZone firmware + interface + +Some boards have a TrustZone firmware which prevents us from accessing +(most of) the eFuse registers. On these boards we must use read the +eFuse through TrustZone firmware calls (using SMC). +Implement a .reg_read op using the Meson TrustZone firmware interface. + +Signed-off-by: Martin Blumenstingl +--- + drivers/nvmem/meson-mx-efuse.c | 29 +++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/drivers/nvmem/meson-mx-efuse.c b/drivers/nvmem/meson-mx-efuse.c +index 111111111111..222222222222 100644 +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -165,6 +166,28 @@ static int meson_mx_efuse_read(void *context, unsigned int offset, + return err; + } + ++static int meson_mx_efuse_read_trustzone_firmware(void *context, ++ unsigned int offset, ++ void *buf, size_t bytes) ++{ ++ struct meson_mx_efuse *efuse = context; ++ unsigned int tmp; ++ int i, ret; ++ ++ for (i = 0; i < bytes; i += efuse->config.word_size) { ++ ret = meson_mx_trustzone_firmware_efuse_read(offset + i, ++ sizeof(tmp), ++ &tmp); ++ if (ret) ++ return ret; ++ ++ memcpy(buf + i, &tmp, ++ min_t(size_t, bytes - i, efuse->config.word_size)); ++ } ++ ++ return 0; ++} ++ + static const struct meson_mx_efuse_platform_data meson6_efuse_data = { + .name = "meson6-efuse", + .word_size = 1, +@@ -215,7 +238,11 @@ static int meson_mx_efuse_probe(struct platform_device *pdev) + efuse->config.word_size = drvdata->word_size; + efuse->config.size = SZ_512; + efuse->config.read_only = true; +- efuse->config.reg_read = meson_mx_efuse_read; ++ ++ if (meson_mx_trustzone_firmware_available()) ++ efuse->config.reg_read = meson_mx_efuse_read_trustzone_firmware; ++ else ++ efuse->config.reg_read = meson_mx_efuse_read; + + efuse->core_clk = devm_clk_get(&pdev->dev, "core"); + if (IS_ERR(efuse->core_clk)) { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0036-ARM-dts-meson8-Add-the-PWM_C-DV9-and-PWM_D-pins.patch b/patch/kernel/archive/meson-6.10/0036-ARM-dts-meson8-Add-the-PWM_C-DV9-and-PWM_D-pins.patch new file mode 100644 index 000000000000..efea3f1a0dbb --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0036-ARM-dts-meson8-Add-the-PWM_C-DV9-and-PWM_D-pins.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Thu, 22 Jul 2021 08:27:29 +0200 +Subject: ARM: dts: meson8: Add the PWM_C (DV9) and PWM_D pins + +There are some Meson8m2 boards which don't use a PMIC (like Ricoh +RN5T618) but use two PWM regulators for VCCK and VDDEE. Add the PWM_C +(DV9) and PWM_D pins so the pinctrl settings can be applied on those +boards. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8.dtsi | 16 ++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -479,6 +479,22 @@ gpio: banks@80b0 { + gpio-ranges = <&pinctrl_cbus 0 0 120>; + }; + ++ pwm_c_dv9_pins: pwm-c-dv9 { ++ mux { ++ groups = "pwm_c_dv9"; ++ function = "pwm_c"; ++ bias-disable; ++ }; ++ }; ++ ++ pwm_d_pins: pwm-d { ++ mux { ++ groups = "pwm_d"; ++ function = "pwm_d"; ++ bias-disable; ++ }; ++ }; ++ + sd_a_pins: sd-a { + mux { + groups = "sd_d0_a", "sd_d1_a", "sd_d2_a", +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0045-dt-bindings-display-meson-vpu-add-support-for-Meson8.patch b/patch/kernel/archive/meson-6.10/0045-dt-bindings-display-meson-vpu-add-support-for-Meson8.patch new file mode 100644 index 000000000000..22a9eebf8ac7 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0045-dt-bindings-display-meson-vpu-add-support-for-Meson8.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 22:16:15 +0200 +Subject: dt-bindings: display: meson-vpu: add support for Meson8/8b/8m2 - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml ++++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +@@ -66,8 +66,12 @@ properties: + - const: amlogic,meson-gx-vpu + - enum: + - amlogic,meson-g12a-vpu # G12A (S905X2, S905Y2, S905D2) ++ - amlogic,meson8-vpu ++ - amlogic,meson8b-vpu ++ - amlogic,meson8m2-vpu + + reg: ++ minItems: 1 + maxItems: 2 + + reg-names: +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0046-drm-meson-add-Meson8-Meson8b-Meson8m2-specific-vpu_c.patch b/patch/kernel/archive/meson-6.10/0046-drm-meson-add-Meson8-Meson8b-Meson8m2-specific-vpu_c.patch new file mode 100644 index 000000000000..65820dd16898 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0046-drm-meson-add-Meson8-Meson8b-Meson8m2-specific-vpu_c.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 21:50:45 +0200 +Subject: drm/meson: add Meson8/Meson8b/Meson8m2 specific vpu_compatible + entries + +Add values for Meson8/Meson8b/Meson8m2 to enum vpu_compatible so quirks +for these earlier hardware generations can be added to the driver. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.h | 11 ++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.h ++++ b/drivers/gpu/drm/meson/meson_drv.h +@@ -20,10 +20,13 @@ struct phy; + struct platform_device; + + enum vpu_compatible { +- VPU_COMPATIBLE_GXBB = 0, +- VPU_COMPATIBLE_GXL = 1, +- VPU_COMPATIBLE_GXM = 2, +- VPU_COMPATIBLE_G12A = 3, ++ VPU_COMPATIBLE_M8 = 0, ++ VPU_COMPATIBLE_M8B = 1, ++ VPU_COMPATIBLE_M8M2 = 2, ++ VPU_COMPATIBLE_GXBB = 3, ++ VPU_COMPATIBLE_GXL = 4, ++ VPU_COMPATIBLE_GXM = 5, ++ VPU_COMPATIBLE_G12A = 6, + }; + + enum { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0047-drm-meson-Use-24-bits-per-pixel-for-the-framebuffer-.patch b/patch/kernel/archive/meson-6.10/0047-drm-meson-Use-24-bits-per-pixel-for-the-framebuffer-.patch new file mode 100644 index 000000000000..cd0b0904223b --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0047-drm-meson-Use-24-bits-per-pixel-for-the-framebuffer-.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 26 Apr 2020 00:00:09 +0200 +Subject: drm/meson: Use 24 bits per pixel for the framebuffer on Meson8/8b/8m2 + +All SoC generations before GXBB don't have a way to configure the +alpha value for DRM_FORMAT_XRGB8888 and DRM_FORMAT_XBGR8888. These +formats have an X component instead of an alpha component. On +Meson8/8b/8m2 there is no way to configure the alpha value to use +instead of the X component. This results in the fact that the +formats with X component are only supported on GXBB and newer. Use +24 bits per pixel and therefore DRM_FORMAT_RGB888 to get a +working framebuffer console. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.c | 26 +++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -159,6 +159,30 @@ static void meson_vpu_init(struct meson_drm *priv) + writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); + } + ++static void meson_fbdev_setup(struct meson_drm *priv) ++{ ++ unsigned int preferred_bpp; ++ ++ /* ++ * All SoC generations before GXBB don't have a way to configure the ++ * alpha value for DRM_FORMAT_XRGB8888 and DRM_FORMAT_XBGR8888. These ++ * formats have an X component instead of an alpha component. On ++ * Meson8/8b/8m2 there is no way to configure the alpha value to use ++ * instead of the X component. This results in the fact that the ++ * formats with X component are only supported on GXBB and newer. Use ++ * 24 bits per pixel and therefore DRM_FORMAT_RGB888 to get a ++ * working framebuffer console. ++ */ ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) ++ preferred_bpp = 24; ++ else ++ preferred_bpp = 32; ++ ++ drm_fbdev_dma_setup(priv->drm, preferred_bpp); ++} ++ + struct meson_drm_soc_attr { + struct meson_drm_soc_limits limits; + const struct soc_device_attribute *attrs; +@@ -362,7 +386,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + if (ret) + goto uninstall_irq; + +- drm_fbdev_dma_setup(drm, 32); ++ meson_fbdev_setup(priv); + + return 0; + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0048-drm-meson-Use-a-separate-list-of-supported-formats-f.patch b/patch/kernel/archive/meson-6.10/0048-drm-meson-Use-a-separate-list-of-supported-formats-f.patch new file mode 100644 index 000000000000..476a7933e8a7 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0048-drm-meson-Use-a-separate-list-of-supported-formats-f.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 21:53:21 +0200 +Subject: drm/meson: Use a separate list of supported formats for 32-bit SoCs + +The VIU_OSD1_CTRL_STAT2 and VIU_OSD2_CTRL_STAT2 registers on +Meson8/Meson8b/Meson8m2 don't have the following bits: +- replaced_alpha_en in bit [14] +- replaced_alpha in bits [13:6] + +This results in formats with X component (currently DRM_FORMAT_XRGB8888 +and DRM_FORMAT_XBGR8888 are supported on GXBB and later) are not +supported. Depending on the application this may work (kmscube for +example - which seems to properly set 0xff as alpha component), but +there's other examples (Kodi for example) where there are alpha blending +issues because the alpha value is not defined (and thus some random +value). + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_plane.c | 30 +++++++++- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_plane.c ++++ b/drivers/gpu/drm/meson/meson_plane.c +@@ -471,7 +471,20 @@ static const struct drm_plane_funcs meson_plane_funcs = { + .format_mod_supported = meson_plane_format_mod_supported, + }; + +-static const uint32_t supported_drm_formats[] = { ++/* ++ * X components (for example in DRM_FORMAT_XRGB8888 and DRM_FORMAT_XBGR8888) ++ * are not supported because these older SoC's are lacking the OSD_REPLACE_EN ++ * bit to replace the X alpha component with a static value, leaving the alpha ++ * component in an undefined state. ++ */ ++static const uint32_t supported_drm_formats_m8[] = { ++ DRM_FORMAT_ARGB8888, ++ DRM_FORMAT_ABGR8888, ++ DRM_FORMAT_RGB888, ++ DRM_FORMAT_RGB565, ++}; ++ ++static const uint32_t supported_drm_formats_gx[] = { + DRM_FORMAT_ARGB8888, + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XRGB8888, +@@ -533,6 +546,8 @@ int meson_plane_create(struct meson_drm *priv) + { + struct meson_plane *meson_plane; + struct drm_plane *plane; ++ unsigned int num_drm_formats; ++ const uint32_t *drm_formats; + const uint64_t *format_modifiers = format_modifiers_default; + + meson_plane = devm_kzalloc(priv->drm->dev, sizeof(*meson_plane), +@@ -548,10 +563,19 @@ int meson_plane_create(struct meson_drm *priv) + else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) + format_modifiers = format_modifiers_afbc_g12a; + ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ drm_formats = supported_drm_formats_m8; ++ num_drm_formats = ARRAY_SIZE(supported_drm_formats_m8); ++ } else { ++ drm_formats = supported_drm_formats_gx; ++ num_drm_formats = ARRAY_SIZE(supported_drm_formats_gx); ++ } ++ + drm_universal_plane_init(priv->drm, plane, 0xFF, + &meson_plane_funcs, +- supported_drm_formats, +- ARRAY_SIZE(supported_drm_formats), ++ drm_formats, num_drm_formats, + format_modifiers, + DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane"); + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0049-drm-meson-Skip-VIU_OSD1_CTRL_STAT2-alpha-replace-val.patch b/patch/kernel/archive/meson-6.10/0049-drm-meson-Skip-VIU_OSD1_CTRL_STAT2-alpha-replace-val.patch new file mode 100644 index 000000000000..3e3f2d47a692 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0049-drm-meson-Skip-VIU_OSD1_CTRL_STAT2-alpha-replace-val.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Mon, 31 Jan 2022 23:02:59 +0100 +Subject: drm/meson: Skip VIU_OSD1_CTRL_STAT2 alpha replace value + initialization + +The VIU_OSD1_CTRL_STAT2 and VIU_OSD2_CTRL_STAT2 registers on +Meson8/Meson8b/Meson8m2 don't have the following bits: +- replaced_alpha_en in bit [14] +- replaced_alpha in bits [13:6] + +Don't initialize the replaced_alpha register bits in VIU_OSD1_CTRL_STAT2 +on Meson8/Meson8b/Meson8m2 because they are not implemented on those +SoCs. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_viu.c | 18 ++++++---- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_viu.c ++++ b/drivers/gpu/drm/meson/meson_viu.c +@@ -448,13 +448,17 @@ void meson_viu_init(struct meson_drm *priv) + writel_relaxed(reg, priv->io_base + _REG(VIU_OSD1_FIFO_CTRL_STAT)); + writel_relaxed(reg, priv->io_base + _REG(VIU_OSD2_FIFO_CTRL_STAT)); + +- /* Set OSD alpha replace value */ +- writel_bits_relaxed(0xff << OSD_REPLACE_SHIFT, +- 0xff << OSD_REPLACE_SHIFT, +- priv->io_base + _REG(VIU_OSD1_CTRL_STAT2)); +- writel_bits_relaxed(0xff << OSD_REPLACE_SHIFT, +- 0xff << OSD_REPLACE_SHIFT, +- priv->io_base + _REG(VIU_OSD2_CTRL_STAT2)); ++ if (!meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) && ++ !meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) && ++ !meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ /* Set OSD alpha replace value */ ++ writel_bits_relaxed(0xff << OSD_REPLACE_SHIFT, ++ 0xff << OSD_REPLACE_SHIFT, ++ priv->io_base + _REG(VIU_OSD1_CTRL_STAT2)); ++ writel_bits_relaxed(0xff << OSD_REPLACE_SHIFT, ++ 0xff << OSD_REPLACE_SHIFT, ++ priv->io_base + _REG(VIU_OSD2_CTRL_STAT2)); ++ } + + /* Disable VD1 AFBC */ + /* di_mif0_en=0 mif0_to_vpp_en=0 di_mad_en=0 and afbc vd1 set=0*/ +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0050-drm-meson-Enable-the-RGB-to-YUV-converter-on-Meson8-.patch b/patch/kernel/archive/meson-6.10/0050-drm-meson-Enable-the-RGB-to-YUV-converter-on-Meson8-.patch new file mode 100644 index 000000000000..f8e8e65c2c98 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0050-drm-meson-Enable-the-RGB-to-YUV-converter-on-Meson8-.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 22:00:57 +0200 +Subject: drm/meson: Enable the RGB to YUV converter on Meson8/Meson8b/Meson8m2 + +Set VIU_OSD1_BLK0_CFG_W0[7] to 1 to enable RGB to YUV converter, just +like on GXBB. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_plane.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_plane.c ++++ b/drivers/gpu/drm/meson/meson_plane.c +@@ -200,8 +200,11 @@ static void meson_plane_atomic_update(struct drm_plane *plane, + priv->viu.osd1_ctrl_stat2 &= ~OSD_DPATH_MALI_AFBCD; + } + +- /* On GXBB, Use the old non-HDR RGB2YUV converter */ +- if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB)) ++ /* On GXBB and earlier, Use the old non-HDR RGB2YUV converter */ ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB)) + priv->viu.osd1_blk0_cfg[0] |= OSD_OUTPUT_COLOR_RGB; + + if (priv->viu.osd1_afbcd && +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0051-drm-meson-Update-meson_vpu_init-to-work-with-Meson8-.patch b/patch/kernel/archive/meson-6.10/0051-drm-meson-Update-meson_vpu_init-to-work-with-Meson8-.patch new file mode 100644 index 000000000000..6b9753736f3e --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0051-drm-meson-Update-meson_vpu_init-to-work-with-Meson8-.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 22:03:27 +0200 +Subject: drm/meson: Update meson_vpu_init to work with Meson8/Meson8b/Meson8m2 + +Don't modify the VPU_RDARB_MODE_* registers because they only exist on +GXBB and newer SoCs. Initialize the VPU_MEM_PD_REG0 and VPU_MEM_PD_REG1 +to 0x0 (meaning: enable everything), just like vendor u-boot does for +Meson8/Meson8b/Meson8m2. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.c | 55 ++++++---- + 1 file changed, 33 insertions(+), 22 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -135,28 +135,39 @@ static struct regmap_config meson_regmap_config = { + + static void meson_vpu_init(struct meson_drm *priv) + { +- u32 value; +- +- /* +- * Slave dc0 and dc5 connected to master port 1. +- * By default other slaves are connected to master port 0. +- */ +- value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1) | +- VPU_RDARB_SLAVE_TO_MASTER_PORT(5, 1); +- writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); +- +- /* Slave dc0 connected to master port 1 */ +- value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1); +- writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); +- +- /* Slave dc4 and dc7 connected to master port 1 */ +- value = VPU_RDARB_SLAVE_TO_MASTER_PORT(4, 1) | +- VPU_RDARB_SLAVE_TO_MASTER_PORT(7, 1); +- writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); +- +- /* Slave dc1 connected to master port 1 */ +- value = VPU_RDARB_SLAVE_TO_MASTER_PORT(1, 1); +- writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ writel(0x0, priv->io_base + _REG(VPU_MEM_PD_REG0)); ++ writel(0x0, priv->io_base + _REG(VPU_MEM_PD_REG1)); ++ } else { ++ u32 value; ++ ++ /* ++ * Slave dc0 and dc5 connected to master port 1. ++ * By default other slaves are connected to master port 0. ++ */ ++ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1) | ++ VPU_RDARB_SLAVE_TO_MASTER_PORT(5, 1); ++ writel_relaxed(value, ++ priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); ++ ++ /* Slave dc0 connected to master port 1 */ ++ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1); ++ writel_relaxed(value, ++ priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); ++ ++ /* Slave dc4 and dc7 connected to master port 1 */ ++ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(4, 1) | ++ VPU_RDARB_SLAVE_TO_MASTER_PORT(7, 1); ++ writel_relaxed(value, ++ priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); ++ ++ /* Slave dc1 connected to master port 1 */ ++ value = VPU_RDARB_SLAVE_TO_MASTER_PORT(1, 1); ++ writel_relaxed(value, ++ priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); ++ } + } + + static void meson_fbdev_setup(struct meson_drm *priv) +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0052-drm-meson-Describe-the-HDMI-PHY-frequency-limits-of-.patch b/patch/kernel/archive/meson-6.10/0052-drm-meson-Describe-the-HDMI-PHY-frequency-limits-of-.patch new file mode 100644 index 000000000000..831dc9e93104 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0052-drm-meson-Describe-the-HDMI-PHY-frequency-limits-of-.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 23 Dec 2020 21:18:35 +0100 +Subject: drm/meson: Describe the HDMI PHY frequency limits of Meson8/8b/8m2 + +The maximum HDMI PLL frequency used by the vendor kernel is 2.976GHz. +For Meson8 and Meson8b (both "HDMI 1.4 4k" capable) the maximum HDMI PHY +frequency therefore is 2.976GHz. This makes sure we don't expose any +HDMI 2.0 modes. +Meson8b only supports up to 1080p according to it's datasheet. Limit the +Meson8b SoC's to 1.65GHz (similar to what's already there for GXL S805X +and S805Y). + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.c | 18 +++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -200,13 +200,29 @@ struct meson_drm_soc_attr { + }; + + static const struct meson_drm_soc_attr meson_drm_soc_attrs[] = { +- /* S805X/S805Y HDMI PLL won't lock for HDMI PHY freq > 1,65GHz */ ++ /* The maximum frequency of HDMI PHY on Meson8 and Meson8m2 is ~3GHz */ ++ { ++ .limits = { ++ .max_hdmi_phy_freq = 2976000, ++ }, ++ .attrs = (const struct soc_device_attribute []) { ++ { .soc_id = "Meson8 (S802)", }, ++ { .soc_id = "Meson8m2 (S812)", }, ++ { /* sentinel */ }, ++ } ++ }, ++ /* ++ * GXL S805X/S805Y HDMI PLL won't lock for HDMI PHY freq > 1,65GHz. ++ * Meson8b (S805) only supports "1200p@60 max resolution" according to ++ * the public datasheet. ++ */ + { + .limits = { + .max_hdmi_phy_freq = 1650000, + }, + .attrs = (const struct soc_device_attribute []) { + { .soc_id = "GXL (S805*)", }, ++ { .soc_id = "Meson8b (S805)", }, + { /* sentinel */ } + } + }, +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0053-drm-meson-Update-the-HDMI-encoder-for-Meson8-8b-8m2.patch b/patch/kernel/archive/meson-6.10/0053-drm-meson-Update-the-HDMI-encoder-for-Meson8-8b-8m2.patch new file mode 100644 index 000000000000..bb2c0c6e4eba --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0053-drm-meson-Update-the-HDMI-encoder-for-Meson8-8b-8m2.patch @@ -0,0 +1,144 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 6 Oct 2021 23:34:04 +0200 +Subject: drm/meson: Update the HDMI encoder for Meson8/8b/8m2 + +Meson8/8b/8m2 uses VPU_HDMI_OUTPUT_YCBCR for YUV444 while newer SoCs use +VPU_HDMI_OUTPUT_CBYCR. Also the 32-bit SoCs use VPU_HDMI_OUTPUT_CRYCB +for RGB. These are the only two known mappings for the 32-bit SoCs. + +The VPU_HDMI_FMT_CTRL register with it's YUV444 to YUV422/YUV420 +converter is not present on these older SoCs. Avoid writing this +reserved register on these 32-bit SoCs. + +MEDIA_BUS_FMT_RGB888_1X24 cannot be exposed as output format because the +RGB to YUV converter is always enabled in meson_plane_atomic_update() +(so there's currently no way to configure it). + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 66 +++++++--- + 1 file changed, 49 insertions(+), 17 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c +@@ -190,13 +190,13 @@ static void meson_encoder_hdmi_atomic_enable(struct drm_bridge *bridge, + { + struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge); + struct drm_atomic_state *state = bridge_state->base.state; +- unsigned int ycrcb_map = VPU_HDMI_OUTPUT_CBYCR; + struct meson_drm *priv = encoder_hdmi->priv; + struct drm_connector_state *conn_state; + const struct drm_display_mode *mode; + struct drm_crtc_state *crtc_state; + struct drm_connector *connector; + bool yuv420_mode = false; ++ unsigned int ycrcb_map; + int vic; + + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); +@@ -217,11 +217,21 @@ static void meson_encoder_hdmi_atomic_enable(struct drm_bridge *bridge, + + dev_dbg(priv->dev, "\"%s\" vic %d\n", mode->name, vic); + +- if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) { ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_RGB888_1X24) ++ ycrcb_map = VPU_HDMI_OUTPUT_YCBCR; ++ else ++ ycrcb_map = VPU_HDMI_OUTPUT_CRYCB; ++ } else if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) { + ycrcb_map = VPU_HDMI_OUTPUT_CRYCB; + yuv420_mode = true; +- } else if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYVY8_1X16) ++ } else if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYVY8_1X16) { + ycrcb_map = VPU_HDMI_OUTPUT_CRYCB; ++ } else { ++ ycrcb_map = VPU_HDMI_OUTPUT_CBYCR; ++ } + + /* VENC + VENC-DVI Mode setup */ + meson_venc_hdmi_mode_set(priv, vic, ycrcb_map, yuv420_mode, mode); +@@ -229,17 +239,21 @@ static void meson_encoder_hdmi_atomic_enable(struct drm_bridge *bridge, + /* VCLK Set clock */ + meson_encoder_hdmi_set_vclk(encoder_hdmi, mode); + +- if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) +- /* Setup YUV420 to HDMI-TX, no 10bit diphering */ +- writel_relaxed(2 | (2 << 2), +- priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); +- else if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYVY8_1X16) +- /* Setup YUV422 to HDMI-TX, no 10bit diphering */ +- writel_relaxed(1 | (2 << 2), +- priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); +- else +- /* Setup YUV444 to HDMI-TX, no 10bit diphering */ +- writel_relaxed(0, priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); ++ if (!meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) && ++ !meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) && ++ !meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24) ++ /* Setup YUV420 to HDMI-TX, no 10bit diphering */ ++ writel_relaxed(2 | (2 << 2), ++ priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); ++ else if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYVY8_1X16) ++ /* Setup YUV422 to HDMI-TX, no 10bit diphering */ ++ writel_relaxed(1 | (2 << 2), ++ priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); ++ else ++ /* Setup YUV444 to HDMI-TX, no 10bit diphering */ ++ writel_relaxed(0, priv->io_base + _REG(VPU_HDMI_FMT_CTRL)); ++ } + + dev_dbg(priv->dev, "%s\n", priv->venc.hdmi_use_enci ? "VENCI" : "VENCP"); + +@@ -262,7 +276,11 @@ static void meson_encoder_hdmi_atomic_disable(struct drm_bridge *bridge, + writel_relaxed(0, priv->io_base + _REG(ENCP_VIDEO_EN)); + } + +-static const u32 meson_encoder_hdmi_out_bus_fmts[] = { ++static const u32 meson8_encoder_hdmi_out_bus_fmts[] = { ++ MEDIA_BUS_FMT_YUV8_1X24, ++}; ++ ++static const u32 meson_gx_encoder_hdmi_out_bus_fmts[] = { + MEDIA_BUS_FMT_YUV8_1X24, + MEDIA_BUS_FMT_UYVY8_1X16, + MEDIA_BUS_FMT_UYYVYY8_0_5X24, +@@ -276,13 +294,27 @@ meson_encoder_hdmi_get_inp_bus_fmts(struct drm_bridge *bridge, + u32 output_fmt, + unsigned int *num_input_fmts) + { ++ struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge); ++ struct meson_drm *priv = encoder_hdmi->priv; ++ unsigned int num_out_bus_fmts; ++ const u32 *out_bus_fmts; + u32 *input_fmts = NULL; + int i; + ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ num_out_bus_fmts = ARRAY_SIZE(meson8_encoder_hdmi_out_bus_fmts); ++ out_bus_fmts = meson8_encoder_hdmi_out_bus_fmts; ++ } else { ++ num_out_bus_fmts = ARRAY_SIZE(meson_gx_encoder_hdmi_out_bus_fmts); ++ out_bus_fmts = meson_gx_encoder_hdmi_out_bus_fmts; ++ } ++ + *num_input_fmts = 0; + +- for (i = 0 ; i < ARRAY_SIZE(meson_encoder_hdmi_out_bus_fmts) ; ++i) { +- if (output_fmt == meson_encoder_hdmi_out_bus_fmts[i]) { ++ for (i = 0 ; i < num_out_bus_fmts ; ++i) { ++ if (output_fmt == out_bus_fmts[i]) { + *num_input_fmts = 1; + input_fmts = kcalloc(*num_input_fmts, + sizeof(*input_fmts), +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0054-drm-meson-Only-set-ycbcr_420_allowed-on-64-bit-SoCs.patch b/patch/kernel/archive/meson-6.10/0054-drm-meson-Only-set-ycbcr_420_allowed-on-64-bit-SoCs.patch new file mode 100644 index 000000000000..45b855a35195 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0054-drm-meson-Only-set-ycbcr_420_allowed-on-64-bit-SoCs.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Wed, 6 Oct 2021 23:37:44 +0200 +Subject: drm/meson: Only set ycbcr_420_allowed on 64-bit SoCs + +The 32-bit SoCs don't support YUV420 so we don't enable that +functionality there. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c ++++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c +@@ -481,8 +481,11 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv) + + drm_connector_attach_max_bpc_property(meson_encoder_hdmi->connector, 8, 8); + +- /* Handle this here until handled by drm_bridge_connector_init() */ +- meson_encoder_hdmi->connector->ycbcr_420_allowed = true; ++ if (!meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) && ++ !meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) && ++ !meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) ++ /* Handle this here until handled by drm_bridge_connector_init() */ ++ meson_encoder_hdmi->connector->ycbcr_420_allowed = true; + + pdev = of_find_device_by_node(remote); + of_node_put(remote); +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0055-drm-meson-Make-the-HHI-registers-optional-WIP.patch b/patch/kernel/archive/meson-6.10/0055-drm-meson-Make-the-HHI-registers-optional-WIP.patch new file mode 100644 index 000000000000..c9b549bb4b9c --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0055-drm-meson-Make-the-HHI-registers-optional-WIP.patch @@ -0,0 +1,100 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Thu, 7 Oct 2021 19:09:49 +0200 +Subject: drm/meson: Make the HHI registers optional - WIP + +The HHI area contains the clock controller registers as well as the +registers for the CVBS DAC. Make the HHI registers optional because the +functionality provided by them can be handled by separate drivers +(especially on the 32-bit SoCs). + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.c | 35 +++++----- + drivers/gpu/drm/meson/meson_venc.c | 11 ++- + 2 files changed, 27 insertions(+), 19 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -271,24 +271,27 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + + priv->io_base = regs; + ++ /* ++ * The HHI resource is optional because it contains the clocks and CVBS ++ * encoder registers. These are managed by separate drivers though. ++ */ + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi"); +- if (!res) { +- ret = -EINVAL; +- goto free_drm; +- } +- /* Simply ioremap since it may be a shared register zone */ +- regs = devm_ioremap(dev, res->start, resource_size(res)); +- if (!regs) { +- ret = -EADDRNOTAVAIL; +- goto free_drm; +- } ++ if (res) { ++ /* Simply ioremap since it may be a shared register zone */ ++ regs = devm_ioremap(dev, res->start, resource_size(res)); ++ if (!regs) { ++ ret = -EADDRNOTAVAIL; ++ goto free_drm; ++ } + +- priv->hhi = devm_regmap_init_mmio(dev, regs, +- &meson_regmap_config); +- if (IS_ERR(priv->hhi)) { +- dev_err(&pdev->dev, "Couldn't create the HHI regmap\n"); +- ret = PTR_ERR(priv->hhi); +- goto free_drm; ++ priv->hhi = devm_regmap_init_mmio(dev, regs, ++ &meson_regmap_config); ++ if (IS_ERR(priv->hhi)) { ++ dev_err(&pdev->dev, ++ "Couldn't create the HHI regmap\n"); ++ ret = PTR_ERR(priv->hhi); ++ goto video_clock_exit; ++ } + } + + priv->canvas = meson_canvas_get(dev); +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -1953,12 +1953,16 @@ void meson_venc_enable_vsync(struct meson_drm *priv) + writel_relaxed(VENC_INTCTRL_ENCI_LNRST_INT_EN, + priv->io_base + _REG(VENC_INTCTRL)); + } +- regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25)); ++ ++ if (priv->hhi) ++ regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25)); + } + + void meson_venc_disable_vsync(struct meson_drm *priv) + { +- regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), 0); ++ if (priv->hhi) ++ regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), 0); ++ + writel_relaxed(0, priv->io_base + _REG(VENC_INTCTRL)); + } + +@@ -1968,7 +1972,8 @@ void meson_venc_init(struct meson_drm *priv) + writel_relaxed(0xff, priv->io_base + _REG(VENC_VDAC_SETTING)); + + /* Disable HDMI PHY */ +- regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0); ++ if (priv->hhi) ++ regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0); + + /* Disable HDMI */ + writel_bits_relaxed(VPU_HDMI_ENCI_DATA_TO_HDMI | +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0056-drm-meson-Add-support-for-the-Meson8-8b-8m2-TranSwit.patch b/patch/kernel/archive/meson-6.10/0056-drm-meson-Add-support-for-the-Meson8-8b-8m2-TranSwit.patch new file mode 100644 index 000000000000..f9bbd04e9ff5 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0056-drm-meson-Add-support-for-the-Meson8-8b-8m2-TranSwit.patch @@ -0,0 +1,2131 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 5 May 2019 02:29:42 +0200 +Subject: drm/meson: Add support for the Meson8/8b/8m2 TranSwitch HDMI + transmitter - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/Kconfig | 10 + + drivers/gpu/drm/meson/Makefile | 1 + + drivers/gpu/drm/meson/meson_transwitch_hdmi.c | 1537 ++++++++++ + drivers/gpu/drm/meson/meson_transwitch_hdmi.h | 536 ++++ + 4 files changed, 2084 insertions(+) + +diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/Kconfig ++++ b/drivers/gpu/drm/meson/Kconfig +@@ -25,3 +25,13 @@ config DRM_MESON_DW_MIPI_DSI + default y if DRM_MESON + select DRM_DW_MIPI_DSI + select GENERIC_PHY_MIPI_DPHY ++ ++config DRM_MESON_TRANSWITCH_HDMI ++ tristate "Amlogic Meson8/8b/8m2 TranSwitch HDMI 1.4 Controller support" ++ depends on ARM || COMPILE_TEST ++ depends on DRM_MESON ++ default y if DRM_MESON ++ select DRM_DISPLAY_HDMI_HELPER ++ select DRM_DISPLAY_HELPER ++ select REGMAP_MMIO ++ select SND_SOC_HDMI_CODEC if SND_SOC +diff --git a/drivers/gpu/drm/meson/Makefile b/drivers/gpu/drm/meson/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/Makefile ++++ b/drivers/gpu/drm/meson/Makefile +@@ -7,3 +7,4 @@ meson-drm-y += meson_encoder_hdmi.o meson_encoder_dsi.o + obj-$(CONFIG_DRM_MESON) += meson-drm.o + obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o + obj-$(CONFIG_DRM_MESON_DW_MIPI_DSI) += meson_dw_mipi_dsi.o ++obj-$(CONFIG_DRM_MESON_TRANSWITCH_HDMI) += meson_transwitch_hdmi.o +diff --git a/drivers/gpu/drm/meson/meson_transwitch_hdmi.c b/drivers/gpu/drm/meson/meson_transwitch_hdmi.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/gpu/drm/meson/meson_transwitch_hdmi.c +@@ -0,0 +1,1537 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2021 Martin Blumenstingl ++ * ++ * All registers and magic values are taken from Amlogic's GPL kernel sources: ++ * Copyright (C) 2010 Amlogic, Inc. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++ ++#include "meson_transwitch_hdmi.h" ++ ++#define HDMI_ADDR_PORT 0x0 ++#define HDMI_DATA_PORT 0x4 ++#define HDMI_CTRL_PORT 0x8 ++ #define HDMI_CTRL_PORT_APB3_ERR_EN BIT(15) ++ ++struct meson_txc_hdmi { ++ struct device *dev; ++ ++ struct regmap *regmap; ++ ++ struct clk *pclk; ++ struct clk *sys_clk; ++ ++ struct phy *phy; ++ bool phy_is_on; ++ ++ struct mutex codec_mutex; ++ enum drm_connector_status last_connector_status; ++ hdmi_codec_plugged_cb codec_plugged_cb; ++ struct device *codec_dev; ++ ++ struct platform_device *hdmi_codec_pdev; ++ ++ struct drm_connector *current_connector; ++ ++ struct drm_bridge bridge; ++ struct drm_bridge *next_bridge; ++}; ++ ++#define bridge_to_meson_txc_hdmi(x) container_of(x, struct meson_txc_hdmi, bridge) ++ ++static const struct regmap_range meson_txc_hdmi_regmap_ranges[] = { ++ regmap_reg_range(0x0000, 0x07ff), ++ regmap_reg_range(0x8000, 0x800c), ++}; ++ ++static const struct regmap_access_table meson_txc_hdmi_regmap_access = { ++ .yes_ranges = meson_txc_hdmi_regmap_ranges, ++ .n_yes_ranges = ARRAY_SIZE(meson_txc_hdmi_regmap_ranges), ++}; ++ ++static int meson_txc_hdmi_reg_read(void *context, unsigned int addr, ++ unsigned int *data) ++{ ++ void __iomem *base = context; ++ ++ writel(addr, base + HDMI_ADDR_PORT); ++ writel(addr, base + HDMI_ADDR_PORT); ++ ++ *data = readl(base + HDMI_DATA_PORT); ++ ++ return 0; ++} ++ ++static int meson_txc_hdmi_reg_write(void *context, unsigned int addr, ++ unsigned int data) ++{ ++ void __iomem *base = context; ++ ++ writel(addr, base + HDMI_ADDR_PORT); ++ writel(addr, base + HDMI_ADDR_PORT); ++ ++ writel(data, base + HDMI_DATA_PORT); ++ ++ return 0; ++} ++ ++static const struct regmap_config meson_txc_hdmi_regmap_config = { ++ .reg_bits = 16, ++ .val_bits = 16, ++ .reg_stride = 1, ++ .reg_read = meson_txc_hdmi_reg_read, ++ .reg_write = meson_txc_hdmi_reg_write, ++ .rd_table = &meson_txc_hdmi_regmap_access, ++ .wr_table = &meson_txc_hdmi_regmap_access, ++ .max_register = HDMI_OTHER_RX_PACKET_INTR_CLR, ++ .fast_io = true, ++}; ++ ++static void meson_txc_hdmi_write_infoframe(struct regmap *regmap, ++ unsigned int tx_pkt_reg, u8 *buf, ++ unsigned int len, bool enable) ++{ ++ unsigned int i; ++ ++ /* Write the data bytes by starting at register offset 1 */ ++ for (i = HDMI_INFOFRAME_HEADER_SIZE; i < len; i++) ++ regmap_write(regmap, ++ tx_pkt_reg + i - HDMI_INFOFRAME_HEADER_SIZE + 1, ++ buf[i]); ++ ++ /* Zero all remaining data bytes */ ++ for (; i < 0x1c; i++) ++ regmap_write(regmap, tx_pkt_reg + i, 0x00); ++ ++ /* Write the header (which we skipped above) */ ++ regmap_write(regmap, tx_pkt_reg + 0x00, buf[3]); ++ regmap_write(regmap, tx_pkt_reg + 0x1c, buf[0]); ++ regmap_write(regmap, tx_pkt_reg + 0x1d, buf[1]); ++ regmap_write(regmap, tx_pkt_reg + 0x1e, buf[2]); ++ ++ regmap_write(regmap, tx_pkt_reg + 0x1f, enable ? 0xff : 0x00); ++} ++ ++static void meson_txc_hdmi_disable_infoframe(struct meson_txc_hdmi *priv, ++ unsigned int tx_pkt_reg) ++{ ++ u8 buf[HDMI_INFOFRAME_HEADER_SIZE] = { 0 }; ++ ++ meson_txc_hdmi_write_infoframe(priv->regmap, tx_pkt_reg, buf, ++ HDMI_INFOFRAME_HEADER_SIZE, false); ++} ++ ++static void meson_txc_hdmi_sys5_reset_assert(struct meson_txc_hdmi *priv) ++{ ++ /* A comment in the vendor driver says: bit5,6 is converted */ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_2, ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH3_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH0_RST_IN); ++ usleep_range(10, 20); ++ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_2, ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH2_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH1_RST_IN); ++ usleep_range(10, 20); ++ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, ++ TX_SYS5_TX_SOFT_RESET_1_TX_PIXEL_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_TMDS_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_MASTER_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_RESAMPLE_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_I2S_RESET_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH2 | ++ TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH1 | ++ TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH0); ++ usleep_range(10, 20); ++} ++ ++static void meson_txc_hdmi_sys5_reset_deassert(struct meson_txc_hdmi *priv) ++{ ++ /* Release the resets except tmds_clk */ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, ++ TX_SYS5_TX_SOFT_RESET_1_TX_TMDS_RSTN); ++ usleep_range(10, 20); ++ ++ /* Release the tmds_clk reset as well */ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, 0x0); ++ usleep_range(10, 20); ++ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_2, ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH2_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH1_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_SR_RST); ++ usleep_range(10, 20); ++ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_2, ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH2_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH1_RST_IN); ++ usleep_range(10, 20); ++} ++ ++static void meson_txc_hdmi_config_hdcp_registers(struct meson_txc_hdmi *priv) ++{ ++ regmap_write(priv->regmap, TX_HDCP_CONFIG0, ++ FIELD_PREP(TX_HDCP_CONFIG0_ROM_ENCRYPT_OFF, 0x3)); ++ regmap_write(priv->regmap, TX_HDCP_MEM_CONFIG, 0x0); ++ regmap_write(priv->regmap, TX_HDCP_ENCRYPT_BYTE, 0x0); ++ ++ regmap_write(priv->regmap, TX_HDCP_MODE, TX_HDCP_MODE_CLEAR_AVMUTE); ++ ++ regmap_write(priv->regmap, TX_HDCP_MODE, TX_HDCP_MODE_ESS_CONFIG); ++} ++ ++static u8 meson_txc_hdmi_bus_fmt_to_color_depth(unsigned int bus_format) ++{ ++ switch (bus_format) { ++ case MEDIA_BUS_FMT_RGB888_1X24: ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ case MEDIA_BUS_FMT_UYVY8_1X16: ++ /* 8 bit */ ++ return 0x0; ++ ++ case MEDIA_BUS_FMT_RGB101010_1X30: ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ case MEDIA_BUS_FMT_UYVY10_1X20: ++ /* 10 bit */ ++ return 0x1; ++ ++ case MEDIA_BUS_FMT_RGB121212_1X36: ++ case MEDIA_BUS_FMT_YUV12_1X36: ++ case MEDIA_BUS_FMT_UYVY12_1X24: ++ /* 12 bit */ ++ return 0x2; ++ ++ case MEDIA_BUS_FMT_RGB161616_1X48: ++ case MEDIA_BUS_FMT_YUV16_1X48: ++ /* 16 bit */ ++ return 0x3; ++ ++ default: ++ /* unknown, default to 8 bit */ ++ return 0x0; ++ } ++} ++ ++static u8 meson_txc_hdmi_bus_fmt_to_color_format(unsigned int bus_format) ++{ ++ switch (bus_format) { ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ case MEDIA_BUS_FMT_YUV12_1X36: ++ case MEDIA_BUS_FMT_YUV16_1X48: ++ /* Documented as YCbCr444 */ ++ return 0x1; ++ ++ case MEDIA_BUS_FMT_UYVY8_1X16: ++ case MEDIA_BUS_FMT_UYVY10_1X20: ++ case MEDIA_BUS_FMT_UYVY12_1X24: ++ /* Documented as YCbCr422 */ ++ return 0x3; ++ ++ case MEDIA_BUS_FMT_RGB888_1X24: ++ case MEDIA_BUS_FMT_RGB101010_1X30: ++ case MEDIA_BUS_FMT_RGB121212_1X36: ++ case MEDIA_BUS_FMT_RGB161616_1X48: ++ default: ++ /* Documented as RGB444 */ ++ return 0x0; ++ } ++} ++ ++static void meson_txc_hdmi_config_color_space(struct meson_txc_hdmi *priv, ++ unsigned int input_bus_format, ++ unsigned int output_bus_format, ++ enum hdmi_quantization_range quant_range, ++ enum hdmi_colorimetry colorimetry) ++{ ++ unsigned int regval; ++ ++ regmap_write(priv->regmap, TX_VIDEO_DTV_MODE, ++ FIELD_PREP(TX_VIDEO_DTV_MODE_COLOR_DEPTH, ++ meson_txc_hdmi_bus_fmt_to_color_depth(output_bus_format))); ++ ++ regmap_write(priv->regmap, TX_VIDEO_DTV_OPTION_L, ++ FIELD_PREP(TX_VIDEO_DTV_OPTION_L_OUTPUT_COLOR_FORMAT, ++ meson_txc_hdmi_bus_fmt_to_color_format(output_bus_format)) | ++ FIELD_PREP(TX_VIDEO_DTV_OPTION_L_INPUT_COLOR_FORMAT, ++ meson_txc_hdmi_bus_fmt_to_color_format(input_bus_format)) | ++ FIELD_PREP(TX_VIDEO_DTV_OPTION_L_OUTPUT_COLOR_DEPTH, ++ meson_txc_hdmi_bus_fmt_to_color_depth(output_bus_format)) | ++ FIELD_PREP(TX_VIDEO_DTV_OPTION_L_INPUT_COLOR_DEPTH, ++ meson_txc_hdmi_bus_fmt_to_color_depth(input_bus_format))); ++ ++ if (quant_range == HDMI_QUANTIZATION_RANGE_LIMITED) ++ regval = FIELD_PREP(TX_VIDEO_DTV_OPTION_H_OUTPUT_COLOR_RANGE, ++ TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_16_235) | ++ FIELD_PREP(TX_VIDEO_DTV_OPTION_H_INPUT_COLOR_RANGE, ++ TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_16_235); ++ else ++ regval = FIELD_PREP(TX_VIDEO_DTV_OPTION_H_OUTPUT_COLOR_RANGE, ++ TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_0_255) | ++ FIELD_PREP(TX_VIDEO_DTV_OPTION_H_INPUT_COLOR_RANGE, ++ TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_0_255); ++ ++ regmap_write(priv->regmap, TX_VIDEO_DTV_OPTION_H, regval); ++ ++ if (colorimetry == HDMI_COLORIMETRY_ITU_601) { ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_B0, 0x2f); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_B1, 0x1d); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_R0, 0x8b); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_R1, 0x4c); ++ ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CB0, 0x18); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CB1, 0x58); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CR0, 0xd0); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CR1, 0xb6); ++ } else { ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_B0, 0x7b); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_B1, 0x12); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_R0, 0x6c); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_R1, 0x36); ++ ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CB0, 0xf2); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CB1, 0x2f); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CR0, 0xd4); ++ regmap_write(priv->regmap, TX_VIDEO_CSC_COEFF_CR1, 0x77); ++ } ++} ++ ++static void meson_txc_hdmi_config_serializer_clock(struct meson_txc_hdmi *priv, ++ enum hdmi_colorimetry colorimetry) ++{ ++ /* Serializer Internal clock setting */ ++ if (colorimetry == HDMI_COLORIMETRY_ITU_601) ++ regmap_write(priv->regmap, TX_SYS1_PLL, 0x24); ++ else ++ regmap_write(priv->regmap, TX_SYS1_PLL, 0x22); ++ ++#if 0 ++ // TODO: not ported yet ++ if ((param->VIC==HDMI_1080p60)&&(param->color_depth==COLOR_30BIT)&&(hdmi_rd_reg(0x018)==0x22)) { ++ regmap_write(priv->regmap, TX_SYS1_PLL, 0x12); ++ } ++#endif ++} ++ ++static void meson_txc_hdmi_reconfig_packet_setting(struct meson_txc_hdmi *priv, ++ u8 cea_mode) ++{ ++ u8 alloc_active2, alloc_eof1, alloc_sof1, alloc_sof2; ++ ++ regmap_write(priv->regmap, TX_PACKET_CONTROL_1, ++ FIELD_PREP(TX_PACKET_CONTROL_1_PACKET_START_LATENCY, 58)); ++ regmap_write(priv->regmap, TX_PACKET_CONTROL_2, ++ TX_PACKET_CONTROL_2_HORIZONTAL_GC_PACKET_TRANSPORT_EN); ++ ++ switch (cea_mode) { ++ case 31: ++ /* 1920x1080p50 */ ++ alloc_active2 = 0x12; ++ alloc_eof1 = 0x10; ++ alloc_sof1 = 0xb6; ++ alloc_sof2 = 0x11; ++ break; ++ case 93: ++ /* 3840x2160p24 */ ++ alloc_active2 = 0x12; ++ alloc_eof1 = 0x47; ++ alloc_sof1 = 0xf8; ++ alloc_sof2 = 0x52; ++ break; ++ case 94: ++ /* 3840x2160p25 */ ++ alloc_active2 = 0x12; ++ alloc_eof1 = 0x44; ++ alloc_sof1 = 0xda; ++ alloc_sof2 = 0x52; ++ break; ++ case 95: ++ /* 3840x2160p30 */ ++ alloc_active2 = 0x0f; ++ alloc_eof1 = 0x3a; ++ alloc_sof1 = 0x60; ++ alloc_sof2 = 0x52; ++ break; ++ case 98: ++ /* 4096x2160p24 */ ++ alloc_active2 = 0x12; ++ alloc_eof1 = 0x47; ++ alloc_sof1 = 0xf8; ++ alloc_sof2 = 0x52; ++ break; ++ default: ++ /* Disable the special packet settings only */ ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_ACTIVE_1, 0x00); ++ return; ++ } ++ ++ /* ++ * The vendor driver says: manually configure these register to get ++ * stable video timings. ++ */ ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_ACTIVE_1, 0x01); ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_ACTIVE_2, alloc_active2); ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_EOF_1, alloc_eof1); ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_EOF_2, 0x12); ++ regmap_write(priv->regmap, TX_CORE_ALLOC_VSYNC_0, 0x01); ++ regmap_write(priv->regmap, TX_CORE_ALLOC_VSYNC_1, 0x00); ++ regmap_write(priv->regmap, TX_CORE_ALLOC_VSYNC_2, 0x0a); ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_SOF_1, alloc_sof1); ++ regmap_write(priv->regmap, TX_PACKET_ALLOC_SOF_2, alloc_sof2); ++ regmap_update_bits(priv->regmap, TX_PACKET_CONTROL_1, ++ TX_PACKET_CONTROL_1_FORCE_PACKET_TIMING, ++ TX_PACKET_CONTROL_1_FORCE_PACKET_TIMING); ++} ++ ++static void meson_txc_hdmi_set_avi_infoframe(struct meson_txc_hdmi *priv, ++ struct drm_connector *conn, ++ const struct drm_display_mode *mode, ++ const struct drm_connector_state *conn_state, ++ unsigned int output_bus_format, ++ enum hdmi_quantization_range quant_range, ++ enum hdmi_colorimetry colorimetry) ++{ ++ u8 buf[HDMI_INFOFRAME_SIZE(AVI)], *video_code; ++ struct hdmi_avi_infoframe frame; ++ int ret; ++ ++ ret = drm_hdmi_avi_infoframe_from_display_mode(&frame, conn, mode); ++ if (ret < 0) { ++ drm_err(priv->bridge.dev, ++ "Failed to setup AVI infoframe: %d\n", ret); ++ return; ++ } ++ ++ switch (output_bus_format) { ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ case MEDIA_BUS_FMT_YUV12_1X36: ++ case MEDIA_BUS_FMT_YUV16_1X48: ++ frame.colorspace = HDMI_COLORSPACE_YUV444; ++ break; ++ ++ case MEDIA_BUS_FMT_UYVY8_1X16: ++ case MEDIA_BUS_FMT_UYVY10_1X20: ++ case MEDIA_BUS_FMT_UYVY12_1X24: ++ frame.colorspace = HDMI_COLORSPACE_YUV422; ++ break; ++ ++ case MEDIA_BUS_FMT_RGB888_1X24: ++ case MEDIA_BUS_FMT_RGB101010_1X30: ++ case MEDIA_BUS_FMT_RGB121212_1X36: ++ case MEDIA_BUS_FMT_RGB161616_1X48: ++ default: ++ frame.colorspace = HDMI_COLORSPACE_RGB; ++ break; ++ } ++ ++ drm_hdmi_avi_infoframe_colorimetry(&frame, conn_state); ++ drm_hdmi_avi_infoframe_quant_range(&frame, conn, mode, quant_range); ++ drm_hdmi_avi_infoframe_bars(&frame, conn_state); ++ ++ ret = hdmi_avi_infoframe_pack(&frame, buf, sizeof(buf)); ++ if (ret < 0) { ++ drm_err(priv->bridge.dev, ++ "Failed to pack AVI infoframe: %d\n", ret); ++ return; ++ } ++ ++ video_code = &buf[HDMI_INFOFRAME_HEADER_SIZE + 3]; ++ if (*video_code > 108) { ++ regmap_write(priv->regmap, TX_PKT_REG_EXCEPT0_BASE_ADDR, ++ *video_code); ++ *video_code = 0x00; ++ } else { ++ regmap_write(priv->regmap, TX_PKT_REG_EXCEPT0_BASE_ADDR, ++ 0x00); ++ } ++ ++ meson_txc_hdmi_write_infoframe(priv->regmap, ++ TX_PKT_REG_AVI_INFO_BASE_ADDR, buf, ++ sizeof(buf), true); ++} ++ ++static void meson_txc_hdmi_set_vendor_infoframe(struct meson_txc_hdmi *priv, ++ struct drm_connector *conn, ++ const struct drm_display_mode *mode) ++{ ++ u8 buf[HDMI_INFOFRAME_HEADER_SIZE + 6]; ++ struct hdmi_vendor_infoframe frame; ++ int ret; ++ ++ ret = drm_hdmi_vendor_infoframe_from_display_mode(&frame, conn, mode); ++ if (ret) { ++ drm_dbg(priv->bridge.dev, ++ "Failed to setup vendor infoframe: %d\n", ret); ++ return; ++ } ++ ++ ret = hdmi_vendor_infoframe_pack(&frame, buf, sizeof(buf)); ++ if (ret < 0) { ++ drm_err(priv->bridge.dev, ++ "Failed to pack vendor infoframe: %d\n", ret); ++ return; ++ } ++ ++ meson_txc_hdmi_write_infoframe(priv->regmap, ++ TX_PKT_REG_VEND_INFO_BASE_ADDR, buf, ++ sizeof(buf), true); ++} ++ ++static void meson_txc_hdmi_set_spd_infoframe(struct meson_txc_hdmi *priv) ++{ ++ u8 buf[HDMI_INFOFRAME_SIZE(SPD)]; ++ struct hdmi_spd_infoframe frame; ++ int ret; ++ ++ ret = hdmi_spd_infoframe_init(&frame, "Amlogic", "Meson TXC HDMI"); ++ if (ret < 0) { ++ drm_err(priv->bridge.dev, ++ "Failed to setup SPD infoframe: %d\n", ret); ++ return; ++ } ++ ++ ret = hdmi_spd_infoframe_pack(&frame, buf, sizeof(buf)); ++ if (ret < 0) { ++ drm_err(priv->bridge.dev, ++ "Failed to pack SDP infoframe: %d\n", ret); ++ return; ++ } ++ ++ meson_txc_hdmi_write_infoframe(priv->regmap, ++ TX_PKT_REG_SPD_INFO_BASE_ADDR, buf, ++ sizeof(buf), true); ++} ++ ++static void meson_txc_hdmi_handle_plugged_change(struct meson_txc_hdmi *priv) ++{ ++ bool plugged; ++ ++ plugged = priv->last_connector_status == connector_status_connected; ++ ++ if (priv->codec_dev && priv->codec_plugged_cb) ++ priv->codec_plugged_cb(priv->codec_dev, plugged); ++} ++ ++static int meson_txc_hdmi_bridge_attach(struct drm_bridge *bridge, ++ enum drm_bridge_attach_flags flags) ++{ ++ struct meson_txc_hdmi *priv = bridge->driver_private; ++ ++ if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { ++ drm_err(bridge->dev, ++ "DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is not set but needed\n"); ++ return -EINVAL; ++ } ++ ++ return drm_bridge_attach(bridge->encoder, priv->next_bridge, bridge, ++ flags); ++} ++ ++/* Can return a maximum of 11 possible output formats for a mode/connector */ ++#define MAX_OUTPUT_SEL_FORMATS 11 ++ ++static u32 * ++meson_txc_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ unsigned int *num_output_fmts) ++{ ++ struct drm_connector *conn = conn_state->connector; ++ struct drm_display_info *info = &conn->display_info; ++ u8 max_bpc = conn_state->max_requested_bpc; ++ unsigned int i = 0; ++ u32 *output_fmts; ++ ++ *num_output_fmts = 0; ++ ++ output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts), ++ GFP_KERNEL); ++ if (!output_fmts) ++ return NULL; ++ ++ /* If we are the only bridge, avoid negotiating with ourselves */ ++ if (list_is_singular(&bridge->encoder->bridge_chain)) { ++ *num_output_fmts = 1; ++ output_fmts[0] = MEDIA_BUS_FMT_FIXED; ++ ++ return output_fmts; ++ } ++ ++ /* ++ * Order bus formats from 16bit to 8bit and from YUV422 to RGB ++ * if supported. In any case the default RGB888 format is added ++ */ ++ ++ if (max_bpc >= 16 && info->bpc == 16) { ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; ++ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ } ++ ++ if (max_bpc >= 12 && info->bpc >= 12) { ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ } ++ ++ if (max_bpc >= 10 && info->bpc >= 10) { ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ } ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ ++ if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ ++ /* Default 8bit RGB fallback */ ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ ++ *num_output_fmts = i; ++ ++ return output_fmts; ++} ++ ++/* Can return a maximum of 3 possible input formats for an output format */ ++#define MAX_INPUT_SEL_FORMATS 3 ++ ++static u32 * ++meson_txc_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ u32 *input_fmts; ++ unsigned int i = 0; ++ ++ *num_input_fmts = 0; ++ ++ input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), ++ GFP_KERNEL); ++ if (!input_fmts) ++ return NULL; ++ ++ switch (output_fmt) { ++ /* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */ ++ case MEDIA_BUS_FMT_FIXED: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ break; ++ ++ /* 8bit */ ++ case MEDIA_BUS_FMT_RGB888_1X24: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ break; ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ break; ++ case MEDIA_BUS_FMT_UYVY8_1X16: ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ break; ++ ++ /* 10bit */ ++ case MEDIA_BUS_FMT_RGB101010_1X30: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ break; ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ break; ++ case MEDIA_BUS_FMT_UYVY10_1X20: ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ break; ++ ++ /* 12bit */ ++ case MEDIA_BUS_FMT_RGB121212_1X36: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ break; ++ case MEDIA_BUS_FMT_YUV12_1X36: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ break; ++ case MEDIA_BUS_FMT_UYVY12_1X24: ++ input_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ break; ++ ++ /* 16bit */ ++ case MEDIA_BUS_FMT_RGB161616_1X48: ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; ++ break; ++ case MEDIA_BUS_FMT_YUV16_1X48: ++ input_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; ++ input_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ break; ++ } ++ ++ *num_input_fmts = i; ++ ++ if (*num_input_fmts == 0) { ++ kfree(input_fmts); ++ input_fmts = NULL; ++ } ++ ++ return input_fmts; ++} ++ ++static void meson_txc_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_bridge_state) ++{ ++ struct meson_txc_hdmi *priv = bridge_to_meson_txc_hdmi(bridge); ++ struct drm_atomic_state *state = old_bridge_state->base.state; ++ enum hdmi_quantization_range quant_range; ++ struct drm_connector_state *conn_state; ++ struct drm_bridge_state *bridge_state; ++ const struct drm_display_mode *mode; ++ enum hdmi_colorimetry colorimetry; ++ struct drm_crtc_state *crtc_state; ++ struct drm_connector *connector; ++ unsigned int i; ++ u8 cea_mode; ++ ++ bridge_state = drm_atomic_get_new_bridge_state(state, bridge); ++ ++ connector = drm_atomic_get_new_connector_for_encoder(state, ++ bridge->encoder); ++ if (WARN_ON(!connector)) ++ return; ++ ++ conn_state = drm_atomic_get_new_connector_state(state, connector); ++ if (WARN_ON(!conn_state)) ++ return; ++ ++ crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); ++ if (WARN_ON(!crtc_state)) ++ return; ++ ++ priv->current_connector = connector; ++ ++ mode = &crtc_state->adjusted_mode; ++ ++ cea_mode = drm_match_cea_mode(mode); ++ ++ if (connector->display_info.is_hdmi) { ++ quant_range = drm_default_rgb_quant_range(mode); ++ ++ switch (cea_mode) { ++ case 2 ... 3: ++ case 6 ... 7: ++ case 17 ... 18: ++ case 21 ... 22: ++ colorimetry = HDMI_COLORIMETRY_ITU_601; ++ break; ++ ++ default: ++ colorimetry = HDMI_COLORIMETRY_ITU_709; ++ break; ++ } ++ ++ meson_txc_hdmi_set_avi_infoframe(priv, connector, mode, ++ conn_state, ++ bridge_state->output_bus_cfg.format, ++ quant_range, colorimetry); ++ meson_txc_hdmi_set_vendor_infoframe(priv, connector, mode); ++ meson_txc_hdmi_set_spd_infoframe(priv); ++ } else { ++ quant_range = HDMI_QUANTIZATION_RANGE_FULL; ++ colorimetry = HDMI_COLORIMETRY_NONE; ++ } ++ ++ meson_txc_hdmi_sys5_reset_assert(priv); ++ ++ meson_txc_hdmi_config_hdcp_registers(priv); ++ ++ if (cea_mode == 39) ++ regmap_write(priv->regmap, TX_VIDEO_DTV_TIMING, 0x0); ++ else ++ regmap_write(priv->regmap, TX_VIDEO_DTV_TIMING, ++ TX_VIDEO_DTV_TIMING_DISABLE_VIC39_CORRECTION); ++ ++ regmap_write(priv->regmap, TX_CORE_DATA_CAPTURE_2, ++ TX_CORE_DATA_CAPTURE_2_INTERNAL_PACKET_ENABLE); ++ regmap_write(priv->regmap, TX_CORE_DATA_MONITOR_1, ++ TX_CORE_DATA_MONITOR_1_LANE0 | ++ FIELD_PREP(TX_CORE_DATA_MONITOR_1_SELECT_LANE0, 0x7)); ++ regmap_write(priv->regmap, TX_CORE_DATA_MONITOR_2, ++ FIELD_PREP(TX_CORE_DATA_MONITOR_2_MONITOR_SELECT, 0x2)); ++ ++ if (connector->display_info.is_hdmi) ++ regmap_write(priv->regmap, TX_TMDS_MODE, ++ TX_TMDS_MODE_FORCED_HDMI | ++ TX_TMDS_MODE_HDMI_CONFIG); ++ else ++ regmap_write(priv->regmap, TX_TMDS_MODE, ++ TX_TMDS_MODE_FORCED_HDMI); ++ ++ regmap_write(priv->regmap, TX_SYS4_CONNECT_SEL_1, 0x0); ++ ++ /* ++ * Set tmds_clk pattern to be "0000011111" before being sent to AFE ++ * clock channel. ++ */ ++ regmap_write(priv->regmap, TX_SYS4_CK_INV_VIDEO, ++ TX_SYS4_CK_INV_VIDEO_TMDS_CLK_PATTERN); ++ ++ regmap_write(priv->regmap, TX_SYS5_FIFO_CONFIG, ++ TX_SYS5_FIFO_CONFIG_CLK_CHANNEL3_OUTPUT_ENABLE | ++ TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL2_ENABLE | ++ TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL1_ENABLE | ++ TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL0_ENABLE); ++ ++ meson_txc_hdmi_config_color_space(priv, ++ bridge_state->input_bus_cfg.format, ++ bridge_state->output_bus_cfg.format, ++ quant_range, colorimetry); ++ ++ meson_txc_hdmi_sys5_reset_deassert(priv); ++ ++ meson_txc_hdmi_config_serializer_clock(priv, colorimetry); ++ meson_txc_hdmi_reconfig_packet_setting(priv, cea_mode); ++ ++ /* all resets need to be applied twice */ ++ for (i = 0; i < 2; i++) { ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, ++ TX_SYS5_TX_SOFT_RESET_1_TX_PIXEL_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_TMDS_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_MASTER_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_RESAMPLE_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_I2S_RESET_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH2 | ++ TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH1 | ++ TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH0); ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_2, ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH3_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH2_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH1_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_CH0_RST_IN | ++ TX_SYS5_TX_SOFT_RESET_2_HDMI_SR_RST | ++ TX_SYS5_TX_SOFT_RESET_2_TX_DDC_HDCP_RSTN | ++ TX_SYS5_TX_SOFT_RESET_2_TX_DDC_EDID_RSTN | ++ TX_SYS5_TX_SOFT_RESET_2_TX_DIG_RESET_N_CH3); ++ usleep_range(5000, 10000); ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, 0x00); ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_2, 0x00); ++ usleep_range(5000, 10000); ++ } ++ ++ if (!priv->phy_is_on) { ++ int ret; ++ ++ ret = phy_power_on(priv->phy); ++ if (ret) ++ drm_err(bridge->dev, "Failed to turn on PHY\n"); ++ else ++ priv->phy_is_on = true; ++ } ++} ++ ++static void meson_txc_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_bridge_state) ++{ ++ struct meson_txc_hdmi *priv = bridge_to_meson_txc_hdmi(bridge); ++ ++ priv->current_connector = NULL; ++ ++ if (priv->phy_is_on) { ++ int ret; ++ ++ ret = phy_power_off(priv->phy); ++ if (ret) ++ drm_err(bridge->dev, "Failed to turn off PHY\n"); ++ else ++ priv->phy_is_on = false; ++ } ++ ++ meson_txc_hdmi_disable_infoframe(priv, TX_PKT_REG_AUDIO_INFO_BASE_ADDR); ++ meson_txc_hdmi_disable_infoframe(priv, TX_PKT_REG_AVI_INFO_BASE_ADDR); ++ meson_txc_hdmi_disable_infoframe(priv, TX_PKT_REG_EXCEPT0_BASE_ADDR); ++ meson_txc_hdmi_disable_infoframe(priv, TX_PKT_REG_VEND_INFO_BASE_ADDR); ++} ++ ++static enum drm_mode_status ++meson_txc_hdmi_bridge_mode_valid(struct drm_bridge *bridge, ++ const struct drm_display_info *info, ++ const struct drm_display_mode *mode) ++{ ++ return MODE_OK; ++} ++ ++static enum drm_connector_status meson_txc_hdmi_bridge_detect(struct drm_bridge *bridge) ++{ ++ struct meson_txc_hdmi *priv = bridge_to_meson_txc_hdmi(bridge); ++ enum drm_connector_status status; ++ unsigned int val; ++ ++ regmap_read(priv->regmap, TX_HDCP_ST_EDID_STATUS, &val); ++ if (val & TX_HDCP_ST_EDID_STATUS_HPD_STATUS) ++ status = connector_status_connected; ++ else ++ status = connector_status_disconnected; ++ ++ mutex_lock(&priv->codec_mutex); ++ if (priv->last_connector_status != status) { ++ priv->last_connector_status = status; ++ meson_txc_hdmi_handle_plugged_change(priv); ++ } ++ mutex_unlock(&priv->codec_mutex); ++ ++ return status; ++} ++ ++static int meson_txc_hdmi_get_edid_block(void *data, u8 *buf, unsigned int block, ++ size_t len) ++{ ++ unsigned int i, regval, start = block * EDID_LENGTH; ++ struct meson_txc_hdmi *priv = data; ++ int ret; ++ ++ /* Start the DDC transaction */ ++ regmap_update_bits(priv->regmap, TX_HDCP_EDID_CONFIG, ++ TX_HDCP_EDID_CONFIG_SYS_TRIGGER_CONFIG, 0); ++ regmap_update_bits(priv->regmap, TX_HDCP_EDID_CONFIG, ++ TX_HDCP_EDID_CONFIG_SYS_TRIGGER_CONFIG, ++ TX_HDCP_EDID_CONFIG_SYS_TRIGGER_CONFIG); ++ ++ ret = regmap_read_poll_timeout(priv->regmap, ++ TX_HDCP_ST_EDID_STATUS, ++ regval, ++ (regval & TX_HDCP_ST_EDID_STATUS_EDID_DATA_READY), ++ 1000, 200000); ++ ++ regmap_update_bits(priv->regmap, TX_HDCP_EDID_CONFIG, ++ TX_HDCP_EDID_CONFIG_SYS_TRIGGER_CONFIG, 0); ++ ++ if (ret) ++ return ret; ++ ++ for (i = 0; i < len; i++) { ++ regmap_read(priv->regmap, TX_RX_EDID_OFFSET + start + i, ++ ®val); ++ buf[i] = regval; ++ } ++ ++ return 0; ++} ++ ++static const struct drm_edid *meson_txc_hdmi_bridge_edid_read(struct drm_bridge *bridge, ++ struct drm_connector *connector) ++{ ++ struct meson_txc_hdmi *priv = bridge_to_meson_txc_hdmi(bridge); ++ const struct drm_edid *drm_edid; ++ ++ drm_edid = drm_edid_read_custom(connector, ++ meson_txc_hdmi_get_edid_block, priv); ++ if (!drm_edid) { ++ drm_dbg(priv->bridge.dev, "Failed to get EDID\n"); ++ return NULL; ++ } ++ ++ return drm_edid; ++} ++ ++static const struct drm_bridge_funcs meson_txc_hdmi_bridge_funcs = { ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_reset = drm_atomic_helper_bridge_reset, ++ .attach = meson_txc_hdmi_bridge_attach, ++ .atomic_get_output_bus_fmts = meson_txc_hdmi_bridge_atomic_get_output_bus_fmts, ++ .atomic_get_input_bus_fmts = meson_txc_hdmi_bridge_atomic_get_input_bus_fmts, ++ .atomic_enable = meson_txc_hdmi_bridge_atomic_enable, ++ .atomic_disable = meson_txc_hdmi_bridge_atomic_disable, ++ .mode_valid = meson_txc_hdmi_bridge_mode_valid, ++ .detect = meson_txc_hdmi_bridge_detect, ++ .edid_read = meson_txc_hdmi_bridge_edid_read, ++}; ++ ++static int meson_txc_hdmi_hw_init(struct meson_txc_hdmi *priv) ++{ ++ unsigned long ddc_i2c_bus_clk_hz = 500 * 1000; ++ unsigned long sys_clk_hz = 24 * 1000 * 1000; ++ int ret; ++ ++ ret = phy_init(priv->phy); ++ if (ret) { ++ dev_err(priv->dev, "Failed to initialize the PHY: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_set_rate(priv->sys_clk, sys_clk_hz); ++ if (ret) { ++ dev_err(priv->dev, "Failed to set HDMI system clock to 24MHz\n"); ++ goto err_phy_exit; ++ } ++ ++ ret = clk_prepare_enable(priv->sys_clk); ++ if (ret) { ++ dev_err(priv->dev, "Failed to enable the sys clk\n"); ++ goto err_phy_exit; ++ } ++ ++ regmap_update_bits(priv->regmap, HDMI_OTHER_CTRL1, ++ HDMI_OTHER_CTRL1_POWER_ON, ++ HDMI_OTHER_CTRL1_POWER_ON); ++ ++ regmap_write(priv->regmap, TX_HDMI_PHY_CONFIG0, ++ TX_HDMI_PHY_CONFIG0_HDMI_COMMON_B7_B0); ++ ++ regmap_write(priv->regmap, TX_HDCP_MODE, 0x40); ++ ++ /* ++ * The vendor driver comments that this is a setting for "Band-gap and ++ * main-bias". 0x1d = power-up, 0x00 = power-down. ++ */ ++ regmap_write(priv->regmap, TX_SYS1_AFE_TEST, 0x1d); ++ ++ meson_txc_hdmi_config_serializer_clock(priv, HDMI_COLORIMETRY_NONE); ++ ++ /* ++ * The vendor driver has a comment with the following information for ++ * the magic value: ++ * bit[2:0]=011: CK channel output TMDS CLOCK ++ * bit[2:0]=101, ck channel output PHYCLCK ++ */ ++ regmap_write(priv->regmap, TX_SYS1_AFE_CONNECT, 0xfb); ++ ++ /* Termination resistor calib value */ ++ regmap_write(priv->regmap, TX_CORE_CALIB_VALUE, 0x0f); ++ ++ /* HPD glitch filter */ ++ regmap_write(priv->regmap, TX_HDCP_HPD_FILTER_L, 0xa0); ++ regmap_write(priv->regmap, TX_HDCP_HPD_FILTER_H, 0xa0); ++ ++ /* Disable MEM power-down */ ++ regmap_write(priv->regmap, TX_MEM_PD_REG0, 0x0); ++ ++ regmap_write(priv->regmap, TX_HDCP_CONFIG3, ++ FIELD_PREP(TX_HDCP_CONFIG3_DDC_I2C_BUS_CLOCK_TIME_DIVIDER, ++ (sys_clk_hz / ddc_i2c_bus_clk_hz) - 1)); ++ ++ /* Enable software controlled DDC transaction */ ++ regmap_write(priv->regmap, TX_HDCP_EDID_CONFIG, ++ TX_HDCP_EDID_CONFIG_FORCED_MEM_COPY_DONE | ++ TX_HDCP_EDID_CONFIG_MEM_COPY_DONE_CONFIG); ++ regmap_write(priv->regmap, TX_CORE_EDID_CONFIG_MORE, ++ TX_CORE_EDID_CONFIG_MORE_SYS_TRIGGER_CONFIG_SEMI_MANU); ++ ++ /* mask (= disable) all interrupts */ ++ regmap_write(priv->regmap, HDMI_OTHER_INTR_MASKN, 0x0); ++ ++ /* clear any pending interrupt */ ++ regmap_write(priv->regmap, HDMI_OTHER_INTR_STAT_CLR, ++ HDMI_OTHER_INTR_STAT_CLR_EDID_RISING | ++ HDMI_OTHER_INTR_STAT_CLR_HPD_FALLING | ++ HDMI_OTHER_INTR_STAT_CLR_HPD_RISING); ++ ++ return 0; ++ ++err_phy_exit: ++ phy_exit(priv->phy); ++ return 0; ++} ++ ++static void meson_txc_hdmi_hw_exit(struct meson_txc_hdmi *priv) ++{ ++ int ret; ++ ++ /* mask (= disable) all interrupts */ ++ regmap_write(priv->regmap, HDMI_OTHER_INTR_MASKN, ++ HDMI_OTHER_INTR_MASKN_TX_EDID_INT_RISE | ++ HDMI_OTHER_INTR_MASKN_TX_HPD_INT_FALL | ++ HDMI_OTHER_INTR_MASKN_TX_HPD_INT_RISE); ++ ++ regmap_update_bits(priv->regmap, HDMI_OTHER_CTRL1, ++ HDMI_OTHER_CTRL1_POWER_ON, 0); ++ ++ clk_disable_unprepare(priv->sys_clk); ++ ++ ret = phy_exit(priv->phy); ++ if (ret) ++ dev_err(priv->dev, "Failed to exit the PHY: %d\n", ret); ++} ++ ++static u32 meson_txc_hdmi_hdmi_codec_calc_audio_n(struct hdmi_codec_params *hparms) ++{ ++ u32 audio_n; ++ ++ if ((hparms->sample_rate % 44100) == 0) ++ audio_n = (128 * hparms->sample_rate) / 900; ++ else ++ audio_n = (128 * hparms->sample_rate) / 1000; ++ ++ if (hparms->cea.coding_type == HDMI_AUDIO_CODING_TYPE_EAC3 || ++ hparms->cea.coding_type == HDMI_AUDIO_CODING_TYPE_DTS_HD) ++ audio_n *= 4; ++ ++ return audio_n; ++} ++ ++static u8 meson_txc_hdmi_hdmi_codec_coding_type(struct hdmi_codec_params *hparms) ++{ ++ switch (hparms->cea.coding_type) { ++ case HDMI_AUDIO_CODING_TYPE_MLP: ++ return TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_HBR_AUDIO_PACKET; ++ case HDMI_AUDIO_CODING_TYPE_DSD: ++ return TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_ONE_BIT_AUDIO; ++ case HDMI_AUDIO_CODING_TYPE_DST: ++ return TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_DST_AUDIO_PACKET; ++ default: ++ return TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_AUDIO_SAMPLE_PACKET; ++ } ++} ++ ++static int meson_txc_hdmi_hdmi_codec_hw_params(struct device *dev, void *data, ++ struct hdmi_codec_daifmt *fmt, ++ struct hdmi_codec_params *hparms) ++{ ++ struct meson_txc_hdmi *priv = dev_get_drvdata(dev); ++ u8 buf[HDMI_INFOFRAME_SIZE(AUDIO)]; ++ u16 audio_tx_format; ++ u32 audio_n; ++ int len, i; ++ ++ if (hparms->cea.coding_type == HDMI_AUDIO_CODING_TYPE_MLP) { ++ /* ++ * TODO: fixed CTS is not supported yet, it needs special ++ * TX_SYS1_ACR_N_* settings ++ */ ++ return -EINVAL; ++ } ++ ++ switch (hparms->sample_width) { ++ case 16: ++ audio_tx_format = FIELD_PREP(TX_AUDIO_FORMAT_BIT_WIDTH_MASK, ++ TX_AUDIO_FORMAT_BIT_WIDTH_16); ++ break; ++ ++ case 20: ++ audio_tx_format = FIELD_PREP(TX_AUDIO_FORMAT_BIT_WIDTH_MASK, ++ TX_AUDIO_FORMAT_BIT_WIDTH_20); ++ break; ++ ++ case 24: ++ audio_tx_format = FIELD_PREP(TX_AUDIO_FORMAT_BIT_WIDTH_MASK, ++ TX_AUDIO_FORMAT_BIT_WIDTH_24); ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt->fmt) { ++ case HDMI_I2S: ++ regmap_update_bits(priv->regmap, HDMI_OTHER_CTRL1, ++ HDMI_OTHER_CTRL1_HDMI_AUDIO_CLOCK_ON, ++ HDMI_OTHER_CTRL1_HDMI_AUDIO_CLOCK_ON); ++ ++ audio_tx_format |= TX_AUDIO_FORMAT_SPDIF_OR_I2S | ++ TX_AUDIO_FORMAT_I2S_ONE_BIT_OR_I2S | ++ FIELD_PREP(TX_AUDIO_FORMAT_I2S_FORMAT, 0x2); ++ ++ if (hparms->channels > 2) ++ audio_tx_format |= TX_AUDIO_FORMAT_I2S_2_OR_8_CH; ++ ++ regmap_write(priv->regmap, TX_AUDIO_FORMAT, audio_tx_format); ++ ++ regmap_write(priv->regmap, TX_AUDIO_I2S, TX_AUDIO_I2S_ENABLE); ++ regmap_write(priv->regmap, TX_AUDIO_SPDIF, 0x0); ++ break; ++ ++ case HDMI_SPDIF: ++ regmap_update_bits(priv->regmap, HDMI_OTHER_CTRL1, ++ HDMI_OTHER_CTRL1_HDMI_AUDIO_CLOCK_ON, 0x0); ++ ++ if (hparms->cea.coding_type == HDMI_AUDIO_CODING_TYPE_STREAM) ++ audio_tx_format |= TX_AUDIO_FORMAT_SPDIF_CHANNEL_STATUS_FROM_DATA_OR_REG; ++ ++ regmap_write(priv->regmap, TX_AUDIO_FORMAT, audio_tx_format); ++ ++ regmap_write(priv->regmap, TX_AUDIO_I2S, 0x0); ++ regmap_write(priv->regmap, TX_AUDIO_SPDIF, TX_AUDIO_SPDIF_ENABLE); ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ ++ if (hparms->channels > 2) ++ regmap_write(priv->regmap, TX_AUDIO_HEADER, ++ TX_AUDIO_HEADER_AUDIO_SAMPLE_PACKET_HEADER_LAYOUT1); ++ else ++ regmap_write(priv->regmap, TX_AUDIO_HEADER, 0x0); ++ ++ regmap_write(priv->regmap, TX_AUDIO_SAMPLE, ++ FIELD_PREP(TX_AUDIO_SAMPLE_CHANNEL_VALID, ++ BIT(hparms->channels) - 1)); ++ ++ audio_n = meson_txc_hdmi_hdmi_codec_calc_audio_n(hparms); ++ ++ regmap_write(priv->regmap, TX_SYS1_ACR_N_0, ++ FIELD_PREP(TX_SYS1_ACR_N_0_N_BYTE0, ++ (audio_n >> 0) & 0xff)); ++ regmap_write(priv->regmap, TX_SYS1_ACR_N_1, ++ FIELD_PREP(TX_SYS1_ACR_N_1_N_BYTE1, ++ (audio_n >> 8) & 0xff)); ++ regmap_update_bits(priv->regmap, TX_SYS1_ACR_N_2, ++ TX_SYS1_ACR_N_2_N_UPPER_NIBBLE, ++ FIELD_PREP(TX_SYS1_ACR_N_2_N_UPPER_NIBBLE, ++ (audio_n >> 16) & 0xf)); ++ ++ regmap_write(priv->regmap, TX_SYS0_ACR_CTS_0, 0x0); ++ regmap_write(priv->regmap, TX_SYS0_ACR_CTS_1, 0x0); ++ regmap_write(priv->regmap, TX_SYS0_ACR_CTS_2, ++ TX_SYS0_ACR_CTS_2_FORCE_ARC_STABLE); ++ ++ regmap_write(priv->regmap, TX_AUDIO_CONTROL, ++ TX_AUDIO_CONTROL_AUTO_AUDIO_FIFO_CLEAR | ++ FIELD_PREP(TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_MASK, ++ meson_txc_hdmi_hdmi_codec_coding_type(hparms)) | ++ TX_AUDIO_CONTROL_AUDIO_SAMPLE_PACKET_FLAT); ++ ++ len = hdmi_audio_infoframe_pack(&hparms->cea, buf, sizeof(buf)); ++ if (len < 0) ++ return len; ++ ++ meson_txc_hdmi_write_infoframe(priv->regmap, ++ TX_PKT_REG_AUDIO_INFO_BASE_ADDR, ++ buf, len, true); ++ ++ for (i = 0; i < ARRAY_SIZE(hparms->iec.status); i++) { ++ unsigned char sub1, sub2; ++ ++ sub1 = sub2 = hparms->iec.status[i]; ++ ++ if (i == 2) { ++ sub1 |= FIELD_PREP(IEC958_AES2_CON_CHANNEL, 1); ++ sub2 |= FIELD_PREP(IEC958_AES2_CON_CHANNEL, 2); ++ } ++ ++ regmap_write(priv->regmap, TX_IEC60958_SUB1_OFFSET + i, sub1); ++ regmap_write(priv->regmap, TX_IEC60958_SUB2_OFFSET + i, sub2); ++ } ++ ++ return 0; ++} ++ ++static int meson_txc_hdmi_hdmi_codec_audio_startup(struct device *dev, ++ void *data) ++{ ++ struct meson_txc_hdmi *priv = dev_get_drvdata(dev); ++ ++ regmap_update_bits(priv->regmap, TX_PACKET_CONTROL_2, ++ TX_PACKET_CONTROL_2_AUDIO_REQUEST_DISABLE, 0x0); ++ ++ /* reset audio master and sample */ ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, ++ TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_RESAMPLE_RSTN | ++ TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_MASTER_RSTN); ++ regmap_write(priv->regmap, TX_SYS5_TX_SOFT_RESET_1, 0x0); ++ ++ regmap_write(priv->regmap, TX_AUDIO_CONTROL_MORE, ++ TX_AUDIO_CONTROL_MORE_ENABLE); ++ ++ regmap_write(priv->regmap, TX_AUDIO_FIFO, ++ FIELD_PREP(TX_AUDIO_FIFO_FIFO_DEPTH_MASK, ++ TX_AUDIO_FIFO_FIFO_DEPTH_512) | ++ FIELD_PREP(TX_AUDIO_FIFO_CRITICAL_THRESHOLD_MASK, ++ TX_AUDIO_FIFO_CRITICAL_THRESHOLD_DEPTH_DIV16) | ++ FIELD_PREP(TX_AUDIO_FIFO_NORMAL_THRESHOLD_MASK, ++ TX_AUDIO_FIFO_NORMAL_THRESHOLD_DEPTH_DIV8)); ++ ++ regmap_write(priv->regmap, TX_AUDIO_LIPSYNC, 0x0); ++ ++ regmap_write(priv->regmap, TX_SYS1_ACR_N_2, ++ FIELD_PREP(TX_SYS1_ACR_N_2_N_MEAS_TOLERANCE, 0x3)); ++ ++ return 0; ++} ++ ++static void meson_txc_hdmi_hdmi_codec_audio_shutdown(struct device *dev, ++ void *data) ++{ ++ struct meson_txc_hdmi *priv = dev_get_drvdata(dev); ++ ++ meson_txc_hdmi_disable_infoframe(priv, TX_PKT_REG_AUDIO_INFO_BASE_ADDR); ++ ++ regmap_write(priv->regmap, TX_AUDIO_CONTROL_MORE, 0x0); ++ regmap_update_bits(priv->regmap, HDMI_OTHER_CTRL1, ++ HDMI_OTHER_CTRL1_HDMI_AUDIO_CLOCK_ON, 0x0); ++ ++ regmap_update_bits(priv->regmap, TX_PACKET_CONTROL_2, ++ TX_PACKET_CONTROL_2_AUDIO_REQUEST_DISABLE, ++ TX_PACKET_CONTROL_2_AUDIO_REQUEST_DISABLE); ++} ++ ++static int meson_txc_hdmi_hdmi_codec_mute_stream(struct device *dev, ++ void *data, bool enable, ++ int direction) ++{ ++ struct meson_txc_hdmi *priv = dev_get_drvdata(dev); ++ ++ regmap_write(priv->regmap, TX_AUDIO_PACK, ++ enable ? 0 : TX_AUDIO_PACK_AUDIO_SAMPLE_PACKETS_ENABLE); ++ ++ return 0; ++} ++ ++static int meson_txc_hdmi_hdmi_codec_get_eld(struct device *dev, void *data, ++ uint8_t *buf, size_t len) ++{ ++ struct meson_txc_hdmi *priv = dev_get_drvdata(dev); ++ ++ if (priv->current_connector) ++ memcpy(buf, priv->current_connector->eld, ++ min_t(size_t, MAX_ELD_BYTES, len)); ++ else ++ memset(buf, 0, len); ++ ++ return 0; ++} ++ ++static int meson_txc_hdmi_hdmi_codec_get_dai_id(struct snd_soc_component *component, ++ struct device_node *endpoint) ++{ ++ struct of_endpoint of_ep; ++ int ret; ++ ++ ret = of_graph_parse_endpoint(endpoint, &of_ep); ++ if (ret < 0) ++ return ret; ++ ++ /* ++ * HDMI sound should be located as reg = <2> ++ * Then, it is sound port 0 ++ */ ++ if (of_ep.port == 2) ++ return 0; ++ ++ return -EINVAL; ++} ++ ++static int meson_txc_hdmi_hdmi_codec_hook_plugged_cb(struct device *dev, ++ void *data, ++ hdmi_codec_plugged_cb fn, ++ struct device *codec_dev) ++{ ++ struct meson_txc_hdmi *priv = dev_get_drvdata(dev); ++ ++ mutex_lock(&priv->codec_mutex); ++ priv->codec_plugged_cb = fn; ++ priv->codec_dev = codec_dev; ++ meson_txc_hdmi_handle_plugged_change(priv); ++ mutex_unlock(&priv->codec_mutex); ++ ++ return 0; ++} ++ ++static struct hdmi_codec_ops meson_txc_hdmi_hdmi_codec_ops = { ++ .hw_params = meson_txc_hdmi_hdmi_codec_hw_params, ++ .audio_startup = meson_txc_hdmi_hdmi_codec_audio_startup, ++ .audio_shutdown = meson_txc_hdmi_hdmi_codec_audio_shutdown, ++ .mute_stream = meson_txc_hdmi_hdmi_codec_mute_stream, ++ .get_eld = meson_txc_hdmi_hdmi_codec_get_eld, ++ .get_dai_id = meson_txc_hdmi_hdmi_codec_get_dai_id, ++ .hook_plugged_cb = meson_txc_hdmi_hdmi_codec_hook_plugged_cb, ++}; ++ ++static const struct hdmi_codec_pdata meson_txc_hdmi_codec_pdata = { ++ .ops = &meson_txc_hdmi_hdmi_codec_ops, ++ .i2s = 1, ++ .spdif = 1, ++ .max_i2s_channels = 8, ++}; ++ ++static int meson_txc_hdmi_codec_init(struct meson_txc_hdmi *priv) ++{ ++ priv->hdmi_codec_pdev = platform_device_register_data(priv->dev, ++ HDMI_CODEC_DRV_NAME, ++ PLATFORM_DEVID_AUTO, ++ &meson_txc_hdmi_codec_pdata, ++ sizeof(meson_txc_hdmi_codec_pdata)); ++ return PTR_ERR_OR_ZERO(priv->hdmi_codec_pdev); ++} ++ ++static int meson_txc_hdmi_probe(struct platform_device *pdev) ++{ ++ struct device_node *endpoint, *remote; ++ struct device *dev = &pdev->dev; ++ struct meson_txc_hdmi *priv; ++ void __iomem *base; ++ u32 regval; ++ int ret; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->dev = dev; ++ ++ mutex_init(&priv->codec_mutex); ++ ++ platform_set_drvdata(pdev, priv); ++ ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ priv->regmap = devm_regmap_init(dev, NULL, base, ++ &meson_txc_hdmi_regmap_config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); ++ ++ priv->pclk = devm_clk_get(dev, "pclk"); ++ if (IS_ERR(priv->pclk)) ++ return dev_err_probe(dev, PTR_ERR(priv->pclk), ++ "Failed to get the pclk\n"); ++ ++ priv->sys_clk = devm_clk_get(dev, "sys"); ++ if (IS_ERR(priv->sys_clk)) ++ return dev_err_probe(dev, PTR_ERR(priv->sys_clk), ++ "Failed to get the sys clock\n"); ++ ++ priv->phy = devm_phy_get(dev, "hdmi"); ++ if (IS_ERR(priv->phy)) ++ return dev_err_probe(dev, PTR_ERR(priv->phy), ++ "Failed to get the HDMI PHY\n"); ++ ++ endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1); ++ if (!endpoint) ++ return dev_err_probe(dev, -ENODEV, ++ "Missing endpoint in port@1\n"); ++ ++ remote = of_graph_get_remote_port_parent(endpoint); ++ of_node_put(endpoint); ++ if (!remote) ++ return dev_err_probe(dev, -ENODEV, ++ "Endpoint in port@1 unconnected\n"); ++ ++ if (!of_device_is_available(remote)) { ++ of_node_put(remote); ++ return dev_err_probe(dev, -ENODEV, ++ "port@1 remote device is disabled\n"); ++ } ++ ++ priv->next_bridge = of_drm_find_bridge(remote); ++ of_node_put(remote); ++ if (!priv->next_bridge) ++ return -EPROBE_DEFER; ++ ++ ret = clk_prepare_enable(priv->pclk); ++ if (ret) ++ return dev_err_probe(dev, ret, "Failed to enable the pclk\n"); ++ ++ regval = readl(base + HDMI_CTRL_PORT); ++ regval |= HDMI_CTRL_PORT_APB3_ERR_EN; ++ writel(regval, base + HDMI_CTRL_PORT); ++ ++ ret = meson_txc_hdmi_hw_init(priv); ++ if (ret) ++ goto err_disable_clk; ++ ++ ret = meson_txc_hdmi_codec_init(priv); ++ if (ret) ++ goto err_hw_exit; ++ ++ priv->bridge.driver_private = priv; ++ priv->bridge.funcs = &meson_txc_hdmi_bridge_funcs; ++ priv->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; ++ priv->bridge.of_node = dev->of_node; ++ priv->bridge.interlace_allowed = true; ++ ++ drm_bridge_add(&priv->bridge); ++ ++ return 0; ++ ++err_hw_exit: ++ meson_txc_hdmi_hw_exit(priv); ++err_disable_clk: ++ clk_disable_unprepare(priv->pclk); ++ return ret; ++} ++ ++static void meson_txc_hdmi_remove(struct platform_device *pdev) ++{ ++ struct meson_txc_hdmi *priv = platform_get_drvdata(pdev); ++ ++ platform_device_unregister(priv->hdmi_codec_pdev); ++ ++ drm_bridge_remove(&priv->bridge); ++ ++ meson_txc_hdmi_hw_exit(priv); ++ ++ clk_disable_unprepare(priv->pclk); ++} ++ ++static const struct of_device_id meson_txc_hdmi_of_table[] = { ++ { .compatible = "amlogic,meson8-hdmi-tx" }, ++ { .compatible = "amlogic,meson8b-hdmi-tx" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, meson_txc_hdmi_of_table); ++ ++static struct platform_driver meson_txc_hdmi_platform_driver = { ++ .probe = meson_txc_hdmi_probe, ++ .remove_new = meson_txc_hdmi_remove, ++ .driver = { ++ .name = "meson-transwitch-hdmi", ++ .of_match_table = meson_txc_hdmi_of_table, ++ }, ++}; ++module_platform_driver(meson_txc_hdmi_platform_driver); ++ ++MODULE_AUTHOR("Martin Blumenstingl "); ++MODULE_DESCRIPTION("Amlogic Meson8 and Meson8b TranSwitch HDMI 1.4 TX driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/drivers/gpu/drm/meson/meson_transwitch_hdmi.h b/drivers/gpu/drm/meson/meson_transwitch_hdmi.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/gpu/drm/meson/meson_transwitch_hdmi.h +@@ -0,0 +1,536 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2021 Martin Blumenstingl ++ * ++ * All registers and magic values are taken from Amlogic's GPL kernel sources: ++ * Copyright (C) 2010 Amlogic, Inc. ++ */ ++ ++#include ++#include ++ ++#ifndef __MESON_TRANSWITCH_HDMI_H__ ++#define __MESON_TRANSWITCH_HDMI_H__ ++ ++/* HDMI TX register */ ++ ++// System config 0 ++#define TX_SYS0_AFE_SIGNAL 0x0000 ++#define TX_SYS0_AFE_LOOP 0x0001 ++#define TX_SYS0_ACR_CTS_0 0x0002 ++ #define TX_SYS0_ACR_CTS_0_AUDIO_CTS_BYTE0 GENMASK(7, 0) ++#define TX_SYS0_ACR_CTS_1 0x0003 ++ #define TX_SYS0_ACR_CTS_1_AUDIO_CTS_BYTE1 GENMASK(7, 0) ++#define TX_SYS0_ACR_CTS_2 0x0004 ++ #define TX_SYS0_ACR_CTS_2_FORCE_ARC_STABLE BIT(5) ++#define TX_SYS0_BIST_CONTROL 0x0005 ++ #define TX_SYS0_BIST_CONTROL_AFE_BIST_ENABLE BIT(7) ++ #define TX_SYS0_BIST_CONTROL_TMDS_SHIFT_PATTERN_SELECT BIT(6) ++ #define TX_SYS0_BIST_CONTROL_TMDS_PRBS_PATTERN_SELECT GENMASK(5, 4) ++ #define TX_SYS0_BIST_CONTROL_TMDS_REPEAT_BIST_PATTERN GENMASK(2, 0) ++ ++#define TX_SYS0_BIST_DATA_0 0x0006 ++#define TX_SYS0_BIST_DATA_1 0x0007 ++#define TX_SYS0_BIST_DATA_2 0x0008 ++#define TX_SYS0_BIST_DATA_3 0x0009 ++#define TX_SYS0_BIST_DATA_4 0x000A ++#define TX_SYS0_BIST_DATA_5 0x000B ++#define TX_SYS0_BIST_DATA_6 0x000C ++#define TX_SYS0_BIST_DATA_7 0x000D ++#define TX_SYS0_BIST_DATA_8 0x000E ++#define TX_SYS0_BIST_DATA_9 0x000F ++ ++// system config 1 ++#define TX_HDMI_PHY_CONFIG0 0x0010 ++ #define TX_HDMI_PHY_CONFIG0_HDMI_COMMON_B7_B0 GENMASK(7, 0) ++#define TX_HDMI_PHY_CONFIG1 0x0010 ++ #define TX_HDMI_PHY_CONFIG1_HDMI_COMMON_B11_B8 GENMASK(3, 0) ++ #define TX_HDMI_PHY_CONFIG1_HDMI_CTL_REG_B3_B0 GENMASK(7, 4) ++#define TX_HDMI_PHY_CONFIG2 0x0012 ++ #define TX_HDMI_PHY_CONFIG_HDMI_CTL_REG_B11_B4 GENMASK(7, 0) ++#define TX_HDMI_PHY_CONFIG3 0x0013 ++ #define TX_HDMI_PHY_CONFIG3_HDMI_L2H_CTL GENMASK(3, 0) ++ #define TX_HDMI_PHY_CONFIG3_HDMI_MDR_PU GENMASK(7, 4) ++#define TX_HDMI_PHY_CONFIG4 0x0014 ++ #define TX_HDMI_PHY_CONFIG4_HDMI_LF_PD BIT(0) ++ #define TX_HDMI_PHY_CONFIG4_HDMI_PHY_CLK_EN BIT(1) ++ #define TX_HDMI_PHY_CONFIG4_HDMI_MODE GENMASK(3, 2) ++ #define TX_HDMI_PHY_CONFIG4_HDMI_MODE_NORMAL 0x0 ++ #define TX_HDMI_PHY_CONFIG4_HDMI_MODE_CLK_CH3_EQUAL_CH0 0x1 ++ #define TX_HDMI_PHY_CONFIG4_HDMI_MODE_ALTERNATE_HIGH_LOW 0x2 ++ #define TX_HDMI_PHY_CONFIG4_HDMI_MODE_ALTERNATE_LOW_HIGH 0x3 ++ #define TX_HDMI_PHY_CONFIG4_HDMI_PREM_CTL GENMASK(7, 4) ++#define TX_HDMI_PHY_CONFIG5 0x0015 ++ #define TX_HDMI_PHY_CONFIG5_HDMI_VCM_CTL GENMASK(7, 5) ++ #define TX_HDMI_PHY_CONFIG5_HDMI_PREFCTL GENMASK(2, 0) ++#define TX_HDMI_PHY_CONFIG6 0x0016 ++ #define TX_HDMI_PHY_CONFIG6_HDMI_RTERM_CTL GENMASK(3, 0) ++ #define TX_HDMI_PHY_CONFIG6_HDMI_SWING_CTL GENMASK(7, 4) ++#define TX_SYS1_AFE_TEST 0x0017 ++#define TX_SYS1_PLL 0x0018 ++#define TX_SYS1_TUNE 0x0019 ++#define TX_SYS1_AFE_CONNECT 0x001A ++ ++#define TX_SYS1_ACR_N_0 0x001C ++ #define TX_SYS1_ACR_N_0_N_BYTE0 GENMASK(7, 0) ++#define TX_SYS1_ACR_N_1 0x001D ++ #define TX_SYS1_ACR_N_1_N_BYTE1 GENMASK(7, 0) ++#define TX_SYS1_ACR_N_2 0x001E ++ #define TX_SYS1_ACR_N_2_N_MEAS_TOLERANCE GENMASK(7, 4) ++ #define TX_SYS1_ACR_N_2_N_UPPER_NIBBLE GENMASK(3, 0) ++#define TX_SYS1_PRBS_DATA 0x001F ++ #define TX_SYS1_PRBS_DATA_PRBS_MODE GENMASK(1, 0) ++ #define TX_SYS1_PRBS_DATA_PRBS_MODE_11 0x0 ++ #define TX_SYS1_PRBS_DATA_PRBS_MODE_15 0x1 ++ #define TX_SYS1_PRBS_DATA_PRBS_MODE_7 0x2 ++ #define TX_SYS1_PRBS_DATA_PRBS_MODE_31 0x3 ++ ++// HDCP CONFIG ++#define TX_HDCP_ECC_CONFIG 0x0024 ++#define TX_HDCP_CRC_CONFIG 0x0025 ++#define TX_HDCP_EDID_CONFIG 0x0026 ++ #define TX_HDCP_EDID_CONFIG_FORCED_SYS_TRIGGER BIT(7) ++ #define TX_HDCP_EDID_CONFIG_SYS_TRIGGER_CONFIG BIT(6) ++ #define TX_HDCP_EDID_CONFIG_MEM_ACC_SEQ_MODE BIT(5) ++ #define TX_HDCP_EDID_CONFIG_MEM_ACC_SEQ_START BIT(4) ++ #define TX_HDCP_EDID_CONFIG_FORCED_MEM_COPY_DONE BIT(3) ++ #define TX_HDCP_EDID_CONFIG_MEM_COPY_DONE_CONFIG BIT(2) ++ #define TX_HDCP_EDID_CONFIG_SYS_TRIGGER_CONFIG_SEMI_MANU BIT(1) ++ ++#define TX_HDCP_MEM_CONFIG 0x0027 ++ #define TX_HDCP_MEM_CONFIG_READ_DECRYPT BIT(3) ++ ++#define TX_HDCP_HPD_FILTER_L 0x0028 ++#define TX_HDCP_HPD_FILTER_H 0x0029 ++#define TX_HDCP_ENCRYPT_BYTE 0x002A ++#define TX_HDCP_CONFIG0 0x002B ++ #define TX_HDCP_CONFIG0_ROM_ENCRYPT_OFF GENMASK(4, 3) ++ ++#define TX_HDCP_CONFIG1 0x002C ++#define TX_HDCP_CONFIG2 0x002D ++#define TX_HDCP_CONFIG3 0x002E ++ #define TX_HDCP_CONFIG3_DDC_I2C_BUS_CLOCK_TIME_DIVIDER GENMASK(7, 0) ++ ++#define TX_HDCP_MODE 0x002F ++ #define TX_HDCP_MODE_CP_DESIRED BIT(7) ++ #define TX_HDCP_MODE_ESS_CONFIG BIT(6) ++ #define TX_HDCP_MODE_SET_AVMUTE BIT(5) ++ #define TX_HDCP_MODE_CLEAR_AVMUTE BIT(4) ++ #define TX_HDCP_MODE_HDCP_1_1 BIT(3) ++ #define TX_HDCP_MODE_VSYNC_HSYNC_FORCED_POLARITY_SELECT BIT(2) ++ #define TX_HDCP_MODE_FORCED_VSYNC_POLARITY BIT(1) ++ #define TX_HDCP_MODE_FORCED_HSYNC_POLARITY BIT(0) ++ ++// Video config, part 1 ++#define TX_VIDEO_ACTIVE_PIXELS_0 0x0030 ++#define TX_VIDEO_ACTIVE_PIXELS_1 0x0031 ++#define TX_VIDEO_FRONT_PIXELS 0x0032 ++#define TX_VIDEO_HSYNC_PIXELS 0x0033 ++#define TX_VIDEO_BACK_PIXELS 0x0034 ++#define TX_VIDEO_ACTIVE_LINES_0 0x0035 ++#define TX_VIDEO_ACTIVE_LINES_1 0x0036 ++#define TX_VIDEO_EOF_LINES 0x0037 ++#define TX_VIDEO_VSYNC_LINES 0x0038 ++#define TX_VIDEO_SOF_LINES 0x0039 ++#define TX_VIDEO_DTV_TIMING 0x003A ++ #define TX_VIDEO_DTV_TIMING_FORCE_DTV_TIMING_AUTO BIT(7) ++ #define TX_VIDEO_DTV_TIMING_FORCE_VIDEO_SCAN BIT(6) ++ #define TX_VIDEO_DTV_TIMING_FORCE_VIDEO_FIELD BIT(5) ++ #define TX_VIDEO_DTV_TIMING_DISABLE_VIC39_CORRECTION BIT(4) ++ ++#define TX_VIDEO_DTV_MODE 0x003B ++ #define TX_VIDEO_DTV_MODE_FORCED_DEFAULT_PHASE BIT(7) ++ #define TX_VIDEO_DTV_MODE_COLOR_DEPTH GENMASK(1, 0) ++ ++#define TX_VIDEO_DTV_FORMAT0 0x003C ++#define TX_VIDEO_DTV_FORMAT1 0x003D ++#define TX_VIDEO_PIXEL_PACK 0x003F ++// video config, part 2 ++#define TX_VIDEO_CSC_COEFF_B0 0x0040 ++#define TX_VIDEO_CSC_COEFF_B1 0x0041 ++#define TX_VIDEO_CSC_COEFF_R0 0x0042 ++#define TX_VIDEO_CSC_COEFF_R1 0x0043 ++#define TX_VIDEO_CSC_COEFF_CB0 0x0044 ++#define TX_VIDEO_CSC_COEFF_CB1 0x0045 ++#define TX_VIDEO_CSC_COEFF_CR0 0x0046 ++#define TX_VIDEO_CSC_COEFF_CR1 0x0047 ++#define TX_VIDEO_DTV_OPTION_L 0x0048 ++ #define TX_VIDEO_DTV_OPTION_L_OUTPUT_COLOR_FORMAT GENMASK(7, 6) ++ #define TX_VIDEO_DTV_OPTION_L_INPUT_COLOR_FORMAT GENMASK(5, 4) ++ #define TX_VIDEO_DTV_OPTION_L_OUTPUT_COLOR_DEPTH GENMASK(3, 2) ++ #define TX_VIDEO_DTV_OPTION_L_INPUT_COLOR_DEPTH GENMASK(1, 0) ++ ++#define TX_VIDEO_DTV_OPTION_H 0x0049 ++ #define TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_16_235 0x0 ++ #define TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_16_240 0x1 ++ #define TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_1_254 0x2 ++ #define TX_VIDEO_DTV_OPTION_H_COLOR_RANGE_0_255 0x3 ++ #define TX_VIDEO_DTV_OPTION_H_OUTPUT_COLOR_RANGE GENMASK(3, 2) ++ #define TX_VIDEO_DTV_OPTION_H_INPUT_COLOR_RANGE GENMASK(1, 0) ++ ++#define TX_VIDEO_DTV_FILTER 0x004A ++#define TX_VIDEO_DTV_DITHER 0x004B ++#define TX_VIDEO_DTV_DEDITHER 0x004C ++#define TX_VIDEO_PROC_CONFIG0 0x004E ++#define TX_VIDEO_PROC_CONFIG1 0x004F ++ ++// Audio config ++#define TX_AUDIO_FORMAT 0x0058 ++ #define TX_AUDIO_FORMAT_SPDIF_OR_I2S BIT(7) ++ #define TX_AUDIO_FORMAT_I2S_2_OR_8_CH BIT(6) ++ #define TX_AUDIO_FORMAT_I2S_FORMAT GENMASK(5, 4) ++ #define TX_AUDIO_FORMAT_BIT_WIDTH_MASK GENMASK(3, 2) ++ #define TX_AUDIO_FORMAT_BIT_WIDTH_16 0x1 ++ #define TX_AUDIO_FORMAT_BIT_WIDTH_20 0x2 ++ #define TX_AUDIO_FORMAT_BIT_WIDTH_24 0x3 ++ #define TX_AUDIO_FORMAT_WS_POLARITY BIT(1) ++ #define TX_AUDIO_FORMAT_I2S_ONE_BIT_OR_I2S BIT(0) ++ #define TX_AUDIO_FORMAT_SPDIF_CHANNEL_STATUS_FROM_DATA_OR_REG BIT(0) ++ ++#define TX_AUDIO_SPDIF 0x0059 ++ #define TX_AUDIO_SPDIF_ENABLE BIT(0) ++#define TX_AUDIO_I2S 0x005A ++ #define TX_AUDIO_I2S_ENABLE BIT(0) ++#define TX_AUDIO_FIFO 0x005B ++ #define TX_AUDIO_FIFO_FIFO_DEPTH_MASK GENMASK(7, 4) ++ #define TX_AUDIO_FIFO_FIFO_DEPTH_512 0x4 ++ #define TX_AUDIO_FIFO_CRITICAL_THRESHOLD_MASK GENMASK(3, 2) ++ #define TX_AUDIO_FIFO_CRITICAL_THRESHOLD_DEPTH_DIV16 0x2 ++ #define TX_AUDIO_FIFO_NORMAL_THRESHOLD_MASK GENMASK(1, 0) ++ #define TX_AUDIO_FIFO_NORMAL_THRESHOLD_DEPTH_DIV8 0x1 ++#define TX_AUDIO_LIPSYNC 0x005C ++ #define TX_AUDIO_LIPSYNC_NORMALIZED_LIPSYNC_PARAM GENMASK(7, 0) ++#define TX_AUDIO_CONTROL 0x005D ++ #define TX_AUDIO_CONTROL_FORCED_AUDIO_FIFO_CLEAR BIT(7) ++ #define TX_AUDIO_CONTROL_AUTO_AUDIO_FIFO_CLEAR BIT(6) ++ #define TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_MASK GENMASK(5, 4) ++ #define TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_AUDIO_SAMPLE_PACKET 0x0 ++ #define TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_ONE_BIT_AUDIO 0x1 ++ #define TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_HBR_AUDIO_PACKET 0x2 ++ #define TX_AUDIO_CONTROL_AUDIO_PACKET_TYPE_DST_AUDIO_PACKET 0x3 ++ #define TX_AUDIO_CONTROL_AUDIO_SAMPLE_PACKET_VALID BIT(2) ++ #define TX_AUDIO_CONTROL_AUDIO_SAMPLE_PACKET_USER BIT(1) ++ #define TX_AUDIO_CONTROL_AUDIO_SAMPLE_PACKET_FLAT BIT(0) ++#define TX_AUDIO_HEADER 0x005E ++ #define TX_AUDIO_HEADER_AUDIO_SAMPLE_PACKET_HEADER_LAYOUT1 BIT(7) ++ #define TX_AUDIO_HEADER_SET_NORMAL_DOUBLE_IN_DST_PACKET_HEADER BIT(6) ++#define TX_AUDIO_SAMPLE 0x005F ++ #define TX_AUDIO_SAMPLE_CHANNEL_VALID GENMASK(7, 0) ++#define TX_AUDIO_VALID 0x0060 ++#define TX_AUDIO_USER 0x0061 ++#define TX_AUDIO_PACK 0x0062 ++ #define TX_AUDIO_PACK_AUDIO_SAMPLE_PACKETS_ENABLE BIT(0) ++#define TX_AUDIO_CONTROL_MORE 0x0064 ++ #define TX_AUDIO_CONTROL_MORE_ENABLE BIT(0) ++ ++// tmds config ++#define TX_TMDS_MODE 0x0068 ++ #define TX_TMDS_MODE_FORCED_HDMI BIT(7) ++ #define TX_TMDS_MODE_HDMI_CONFIG BIT(6) ++ #define TX_TMDS_MODE_BIT_SWAP BIT(3) ++ #define TX_TMDS_MODE_CHANNEL_SWAP GENMASK(2, 0) ++ ++#define TX_TMDS_CONFIG0 0x006C ++#define TX_TMDS_CONFIG1 0x006D ++ ++// packet config ++#define TX_PACKET_ALLOC_ACTIVE_1 0x0078 ++#define TX_PACKET_ALLOC_ACTIVE_2 0x0079 ++#define TX_PACKET_ALLOC_EOF_1 0x007A ++#define TX_PACKET_ALLOC_EOF_2 0x007B ++#define TX_PACKET_ALLOC_SOF_1 0x007C ++#define TX_PACKET_ALLOC_SOF_2 0x007D ++#define TX_PACKET_CONTROL_1 0x007E ++ #define TX_PACKET_CONTROL_1_FORCE_PACKET_TIMING BIT(7) ++ #define TX_PACKET_CONTROL_1_PACKET_ALLOC_MODE BIT(6) ++ #define TX_PACKET_CONTROL_1_PACKET_START_LATENCY GENMASK(5, 0) ++ ++#define TX_PACKET_CONTROL_2 0x007F ++ #define TX_PACKET_CONTROL_2_AUDIO_REQUEST_DISABLE BIT(3) ++ #define TX_PACKET_CONTROL_2_HORIZONTAL_GC_PACKET_TRANSPORT_EN BIT(1) ++ ++#define TX_CORE_EDID_CONFIG_MORE 0x0080 ++ #define TX_CORE_EDID_CONFIG_MORE_KEEP_EDID_ERROR BIT(1) ++ #define TX_CORE_EDID_CONFIG_MORE_SYS_TRIGGER_CONFIG_SEMI_MANU BIT(0) ++ ++#define TX_CORE_ALLOC_VSYNC_0 0x0081 ++#define TX_CORE_ALLOC_VSYNC_1 0x0082 ++#define TX_CORE_ALLOC_VSYNC_2 0x0083 ++#define TX_MEM_PD_REG0 0x0084 ++ ++// core config ++#define TX_CORE_DATA_CAPTURE_1 0x00F0 ++#define TX_CORE_DATA_CAPTURE_2 0x00F1 ++ #define TX_CORE_DATA_CAPTURE_2_AUDIO_SOURCE_SELECT GENMASK(7, 6) ++ #define TX_CORE_DATA_CAPTURE_2_EXTERNAL_PACKET_ENABLE BIT(5) ++ #define TX_CORE_DATA_CAPTURE_2_INTERNAL_PACKET_ENABLE BIT(4) ++ #define TX_CORE_DATA_CAPTURE_2_AFE_FIFO_SRC_LANE1 GENMASK(3, 2) ++ #define TX_CORE_DATA_CAPTURE_2_AFE_FIFO_SRC_LANE0 GENMASK(1, 0) ++ ++#define TX_CORE_DATA_MONITOR_1 0x00F2 ++ #define TX_CORE_DATA_MONITOR_1_LANE1 BIT(7) ++ #define TX_CORE_DATA_MONITOR_1_SELECT_LANE1 GENMASK(6, 4) ++ #define TX_CORE_DATA_MONITOR_1_LANE0 BIT(3) ++ #define TX_CORE_DATA_MONITOR_1_SELECT_LANE0 GENMASK(2, 0) ++ ++#define TX_CORE_DATA_MONITOR_2 0x00F3 ++ #define TX_CORE_DATA_MONITOR_2_MONITOR_SELECT GENMASK(2, 0) ++ ++#define TX_CORE_CALIB_MODE 0x00F4 ++#define TX_CORE_CALIB_SAMPLE_DELAY 0x00F5 ++#define TX_CORE_CALIB_VALUE_AUTO 0x00F6 ++#define TX_CORE_CALIB_VALUE 0x00F7 ++ ++// system config 4 ++#define TX_SYS4_TX_CKI_DDR 0x00A0 ++#define TX_SYS4_TX_CKO_DDR 0x00A1 ++#define TX_SYS4_RX_CKI_DDR 0x00A2 ++#define TX_SYS4_RX_CKO_DDR 0x00A3 ++#define TX_SYS4_CONNECT_SEL_0 0x00A4 ++#define TX_SYS4_CONNECT_SEL_1 0x00A5 ++ #define TX_SYS4_CONNECT_SEL_1_TX_CONNECT_SEL_UPPER_CHANNEL_DATA BIT(6) ++ ++#define TX_SYS4_CONNECT_SEL_2 0x00A6 ++#define TX_SYS4_CONNECT_SEL_3 0x00A7 ++#define TX_SYS4_CK_INV_VIDEO 0x00A8 ++ #define TX_SYS4_CK_INV_VIDEO_TMDS_CLK_PATTERN BIT(4) ++#define TX_SYS4_CK_INV_AUDIO 0x00A9 ++#define TX_SYS4_CK_INV_AFE 0x00AA ++#define TX_SYS4_CK_INV_CH01 0x00AB ++#define TX_SYS4_CK_INV_CH2 0x00AC ++#define TX_SYS4_CK_CEC 0x00AD ++#define TX_SYS4_CK_SOURCE_1 0x00AE ++#define TX_SYS4_CK_SOURCE_2 0x00AF ++ ++#define TX_IEC60958_SUB1_OFFSET 0x00B0 ++#define TX_IEC60958_SUB2_OFFSET 0x00C8 ++ ++// system config 5 ++#define TX_SYS5_TX_SOFT_RESET_1 0x00E0 ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_PIXEL_RSTN BIT(7) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_TMDS_RSTN BIT(6) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_MASTER_RSTN BIT(5) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_AUDIO_RESAMPLE_RSTN BIT(4) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_I2S_RESET_RSTN BIT(3) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH2 BIT(2) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH1 BIT(1) ++ #define TX_SYS5_TX_SOFT_RESET_1_TX_DIG_RESET_N_CH0 BIT(0) ++ ++#define TX_SYS5_TX_SOFT_RESET_2 0x00E1 ++ #define TX_SYS5_TX_SOFT_RESET_2_HDMI_CH3_RST_IN BIT(7) ++ #define TX_SYS5_TX_SOFT_RESET_2_HDMI_CH2_RST_IN BIT(6) ++ #define TX_SYS5_TX_SOFT_RESET_2_HDMI_CH1_RST_IN BIT(5) ++ #define TX_SYS5_TX_SOFT_RESET_2_HDMI_CH0_RST_IN BIT(4) ++ #define TX_SYS5_TX_SOFT_RESET_2_HDMI_SR_RST BIT(3) ++ #define TX_SYS5_TX_SOFT_RESET_2_TX_DDC_HDCP_RSTN BIT(2) ++ #define TX_SYS5_TX_SOFT_RESET_2_TX_DDC_EDID_RSTN BIT(1) ++ #define TX_SYS5_TX_SOFT_RESET_2_TX_DIG_RESET_N_CH3 BIT(0) ++ ++#define TX_SYS5_RX_SOFT_RESET_1 0x00E2 ++#define TX_SYS5_RX_SOFT_RESET_2 0x00E3 ++#define TX_SYS5_RX_SOFT_RESET_3 0x00E4 ++#define TX_SYS5_SSTL_BIDIR_IN 0x00E5 ++#define TX_SYS5_SSTL_IN 0x00E6 ++#define TX_SYS5_SSTL_DIFF_IN 0x00E7 ++#define TX_SYS5_FIFO_CONFIG 0x00E8 ++ #define TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL2_BYPASS BIT(6) ++ #define TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL1_BYPASS BIT(5) ++ #define TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL0_BYPASS BIT(4) ++ #define TX_SYS5_FIFO_CONFIG_CLK_CHANNEL3_OUTPUT_ENABLE BIT(3) ++ #define TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL2_ENABLE BIT(2) ++ #define TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL1_ENABLE BIT(1) ++ #define TX_SYS5_FIFO_CONFIG_AFE_FIFO_CHANNEL0_ENABLE BIT(0) ++ ++#define TX_SYS5_FIFO_SAMP01_CFG 0x00E9 ++#define TX_SYS5_FIFO_SAMP23_CFG 0x00EA ++#define TX_SYS5_CONNECT_FIFO_CFG 0x00EB ++#define TX_SYS5_IO_CALIB_CONTROL 0x00EC ++#define TX_SYS5_SSTL_BIDIR_OUT 0x00ED ++#define TX_SYS5_SSTL_OUT 0x00EE ++#define TX_SYS5_SSTL_DIFF_OUT 0x00EF ++ ++// HDCP shadow register ++#define TX_HDCP_SHW_BKSV_0 0x0100 ++#define TX_HDCP_SHW_BKSV_1 0x0101 ++#define TX_HDCP_SHW_BKSV_2 0x0102 ++#define TX_HDCP_SHW_BKSV_3 0x0103 ++#define TX_HDCP_SHW_BKSV_4 0x0104 ++#define TX_HDCP_SHW_RI1_0 0x0108 ++#define TX_HDCP_SHW_RI1_1 0x0109 ++#define TX_HDCP_SHW_PJ1 0x010A ++#define TX_HDCP_SHW_AKSV_0 0x0110 ++#define TX_HDCP_SHW_AKSV_1 0x0111 ++#define TX_HDCP_SHW_AKSV_2 0x0112 ++#define TX_HDCP_SHW_AKSV_3 0x0113 ++#define TX_HDCP_SHW_AKSV_4 0x0114 ++#define TX_HDCP_SHW_AINFO 0x0115 ++#define TX_HDCP_SHW_AN_0 0x0118 ++#define TX_HDCP_SHW_AN_1 0x0119 ++#define TX_HDCP_SHW_AN_2 0x011A ++#define TX_HDCP_SHW_AN_3 0x011B ++#define TX_HDCP_SHW_AN_4 0x011C ++#define TX_HDCP_SHW_AN_5 0x011D ++#define TX_HDCP_SHW_AN_6 0x011E ++#define TX_HDCP_SHW_AN_7 0x011F ++#define TX_HDCP_SHW_V1_H0_0 0x0120 ++#define TX_HDCP_SHW_V1_H0_1 0x0121 ++#define TX_HDCP_SHW_V1_H0_2 0x0122 ++#define TX_HDCP_SHW_V1_H0_3 0x0123 ++#define TX_HDCP_SHW_V1_H1_0 0x0124 ++#define TX_HDCP_SHW_V1_H1_1 0x0125 ++#define TX_HDCP_SHW_V1_H1_2 0x0126 ++#define TX_HDCP_SHW_V1_H1_3 0x0127 ++#define TX_HDCP_SHW_V1_H2_0 0x0128 ++#define TX_HDCP_SHW_V1_H2_1 0x0129 ++#define TX_HDCP_SHW_V1_H2_2 0x012A ++#define TX_HDCP_SHW_V1_H2_3 0x012B ++#define TX_HDCP_SHW_V1_H3_0 0x012C ++#define TX_HDCP_SHW_V1_H3_1 0x012D ++#define TX_HDCP_SHW_V1_H3_2 0x012E ++#define TX_HDCP_SHW_V1_H3_3 0x012F ++#define TX_HDCP_SHW_V1_H4_0 0x0130 ++#define TX_HDCP_SHW_V1_H4_1 0x0131 ++#define TX_HDCP_SHW_V1_H4_2 0x0132 ++#define TX_HDCP_SHW_V1_H4_3 0x0133 ++#define TX_HDCP_SHW_BCAPS 0x0140 ++#define TX_HDCP_SHW_BSTATUS_0 0x0141 ++#define TX_HDCP_SHW_BSTATUS_1 0x0142 ++#define TX_HDCP_SHW_KSV_FIFO 0x0143 ++ ++// system status 0 ++#define TX_SYSST0_CONNECT_FIFO 0x0180 ++#define TX_SYSST0_PLL_MONITOR 0x0181 ++#define TX_SYSST0_AFE_FIFO 0x0182 ++#define TX_SYSST0_ROM_STATUS 0x018F ++ ++// hdcp status ++#define TX_HDCP_ST_AUTHENTICATION 0x0190 ++#define TX_HDCP_ST_FRAME_COUNT 0x0191 ++#define TX_HDCP_ST_STATUS_0 0x0192 ++#define TX_HDCP_ST_STATUS_1 0x0193 ++#define TX_HDCP_ST_STATUS_2 0x0194 ++#define TX_HDCP_ST_STATUS_3 0x0195 ++#define TX_HDCP_ST_EDID_STATUS 0x0196 ++ #define TX_HDCP_ST_EDID_STATUS_SYSTEM_STATUS GENMASK(7, 6) ++ #define TX_HDCP_ST_EDID_STATUS_SYSTEM_STATUS_NO_SINK_ATTACHED 0x0 ++ #define TX_HDCP_ST_EDID_STATUS_SYSTEM_STATUS_READING_EDID 0x1 ++ #define TX_HDCP_ST_EDID_STATUS_SYSTEM_STATUS_DVI_MODE 0x2 ++ #define TX_HDCP_ST_EDID_STATUS_SYSTEM_STATUS_HDMI_MODE 0x3 ++ #define TX_HDCP_ST_EDID_STATUS_EDID_DATA_READY BIT(4) ++ #define TX_HDCP_ST_EDID_STATUS_HPD_STATUS BIT(1) ++ ++#define TX_HDCP_ST_MEM_STATUS 0x0197 ++#define TX_HDCP_ST_ST_MODE 0x019F ++ ++// video status ++#define TX_VIDEO_ST_ACTIVE_PIXELS_1 0x01A0 ++#define TX_VIDEO_ST_ACTIVE_PIXELS_2 0x01A1 ++#define TX_VIDEO_ST_FRONT_PIXELS 0x01A2 ++#define TX_VIDEO_ST_HSYNC_PIXELS 0x01A3 ++#define TX_VIDEO_ST_BACK_PIXELS 0x01A4 ++#define TX_VIDEO_ST_ACTIVE_LINES_1 0x01A5 ++#define TX_VIDEO_ST_ACTIVE_LINES_2 0x01A6 ++#define TX_VIDEO_ST_EOF_LINES 0x01A7 ++#define TX_VIDEO_ST_VSYNC_LINES 0x01A8 ++#define TX_VIDEO_ST_SOF_LINES 0x01A9 ++#define TX_VIDEO_ST_DTV_TIMING 0x01AA ++#define TX_VIDEO_ST_DTV_MODE 0x01AB ++// audio status ++#define TX_VIDEO_ST_AUDIO_STATUS 0x01AC ++#define TX_AFE_STATUS_0 0x01AE ++#define TX_AFE_STATUS_1 0x01AF ++ ++#define TX_IEC60958_ST_SUB1_OFFSET 0x01B0 ++#define TX_IEC60958_ST_SUB2_OFFSET 0x01C8 ++ ++// system status 1 ++#define TX_SYSST1_CALIB_BIT_RESULT_0 0x01E0 ++#define TX_SYSST1_CALIB_BIT_RESULT_1 0x01E1 ++//HDMI_STATUS_OUT[7:0] ++#define TX_HDMI_PHY_READBACK_0 0x01E2 ++//HDMI_COMP_OUT[4] ++//HDMI_STATUS_OUT[11:8] ++#define TX_HDMI_PHY_READBACK_1 0x01E3 ++#define TX_SYSST1_CALIB_BIT_RESULT_4 0x01E4 ++#define TX_SYSST1_CALIB_BIT_RESULT_5 0x01E5 ++#define TX_SYSST1_CALIB_BIT_RESULT_6 0x01E6 ++#define TX_SYSST1_CALIB_BIT_RESULT_7 0x01E7 ++#define TX_SYSST1_CALIB_BUS_RESULT_0 0x01E8 ++#define TX_SYSST1_CALIB_BUS_RESULT_1 0x01E9 ++#define TX_SYSST1_CALIB_BUS_RESULT_2 0x01EA ++#define TX_SYSST1_CALIB_BUS_RESULT_3 0x01EB ++#define TX_SYSST1_CALIB_BUS_RESULT_4 0x01EC ++#define TX_SYSST1_CALIB_BUS_RESULT_5 0x01ED ++#define TX_SYSST1_CALIB_BUS_RESULT_6 0x01EE ++#define TX_SYSST1_CALIB_BUS_RESULT_7 0x01EF ++ ++// Packet status ++#define TX_PACKET_ST_REQUEST_STATUS_1 0x01F0 ++#define TX_PACKET_ST_REQUEST_STATUS_2 0x01F1 ++#define TX_PACKET_ST_REQUEST_MISSED_1 0x01F2 ++#define TX_PACKET_ST_REQUEST_MISSED_2 0x01F3 ++#define TX_PACKET_ST_ENCODE_STATUS_0 0x01F4 ++#define TX_PACKET_ST_ENCODE_STATUS_1 0x01F5 ++#define TX_PACKET_ST_ENCODE_STATUS_2 0x01F6 ++#define TX_PACKET_ST_TIMER_STATUS 0x01F7 ++ ++// tmds status ++#define TX_TMDS_ST_CLOCK_METER_1 0x01F8 ++#define TX_TMDS_ST_CLOCK_METER_2 0x01F9 ++#define TX_TMDS_ST_CLOCK_METER_3 0x01FA ++#define TX_TMDS_ST_TMDS_STATUS_1 0x01FC ++#define TX_TMDS_ST_TMDS_STATUS_2 0x01FD ++#define TX_TMDS_ST_TMDS_STATUS_3 0x01FE ++#define TX_TMDS_ST_TMDS_STATUS_4 0x01FF ++ ++// Packet register ++#define TX_PKT_REG_SPD_INFO_BASE_ADDR 0x0200 ++#define TX_PKT_REG_VEND_INFO_BASE_ADDR 0x0220 ++#define TX_PKT_REG_MPEG_INFO_BASE_ADDR 0x0240 ++#define TX_PKT_REG_AVI_INFO_BASE_ADDR 0x0260 ++#define TX_PKT_REG_AUDIO_INFO_BASE_ADDR 0x0280 ++#define TX_PKT_REG_ACP_INFO_BASE_ADDR 0x02A0 ++#define TX_PKT_REG_ISRC1_BASE_ADDR 0x02C0 ++#define TX_PKT_REG_ISRC2_BASE_ADDR 0x02E0 ++#define TX_PKT_REG_EXCEPT0_BASE_ADDR 0x0300 ++#define TX_PKT_REG_EXCEPT1_BASE_ADDR 0x0320 ++#define TX_PKT_REG_EXCEPT2_BASE_ADDR 0x0340 ++#define TX_PKT_REG_EXCEPT3_BASE_ADDR 0x0360 ++#define TX_PKT_REG_EXCEPT4_BASE_ADDR 0x0380 ++#define TX_PKT_REG_GAMUT_P0_BASE_ADDR 0x03A0 ++#define TX_PKT_REG_GAMUT_P1_1_BASE_ADDR 0x03C0 ++#define TX_PKT_REG_GAMUT_P1_2_BASE_ADDR 0x03E0 ++ ++#define TX_RX_EDID_OFFSET 0x0600 ++ ++/* HDMI OTHER registers */ ++ ++#define HDMI_OTHER_CTRL0 0x8000 ++#define HDMI_OTHER_CTRL1 0x8001 ++ #define HDMI_OTHER_CTRL1_POWER_ON BIT(15) ++ #define HDMI_OTHER_CTRL1_HDMI_AUDIO_CLOCK_ON BIT(13) ++ ++#define HDMI_OTHER_STATUS0 0x8002 ++#define HDMI_OTHER_CTRL2 0x8003 ++#define HDMI_OTHER_INTR_MASKN 0x8004 ++ #define HDMI_OTHER_INTR_MASKN_TX_EDID_INT_RISE BIT(2) ++ #define HDMI_OTHER_INTR_MASKN_TX_HPD_INT_FALL BIT(1) ++ #define HDMI_OTHER_INTR_MASKN_TX_HPD_INT_RISE BIT(0) ++ ++#define HDMI_OTHER_INTR_STAT 0x8005 ++ #define HDMI_OTHER_INTR_STAT_EDID_RISING BIT(2) ++ #define HDMI_OTHER_INTR_STAT_HPD_FALLING BIT(1) ++ #define HDMI_OTHER_INTR_STAT_HPD_RISING BIT(0) ++ ++#define HDMI_OTHER_INTR_STAT_CLR 0x8006 ++ #define HDMI_OTHER_INTR_STAT_CLR_EDID_RISING BIT(2) ++ #define HDMI_OTHER_INTR_STAT_CLR_HPD_FALLING BIT(1) ++ #define HDMI_OTHER_INTR_STAT_CLR_HPD_RISING BIT(0) ++ ++#define HDMI_OTHER_AVI_INTR_MASKN0 0x8008 ++#define HDMI_OTHER_AVI_INTR_MASKN1 0x8009 ++#define HDMI_OTHER_RX_AINFO_INTR_MASKN0 0x800a ++#define HDMI_OTHER_RX_AINFO_INTR_MASKN1 0x800b ++#define HDMI_OTHER_RX_PACKET_INTR_CLR 0x800c ++ ++#endif /* __MESON_TRANSWITCH_HDMI_H__ */ +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0057-drm-meson-Meson8-Meson8b-Meson8m2-VCLK-HACK.patch b/patch/kernel/archive/meson-6.10/0057-drm-meson-Meson8-Meson8b-Meson8m2-VCLK-HACK.patch new file mode 100644 index 000000000000..54d3f132b155 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0057-drm-meson-Meson8-Meson8b-Meson8m2-VCLK-HACK.patch @@ -0,0 +1,458 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 22:13:51 +0200 +Subject: drm/meson: Meson8/Meson8b/Meson8m2 VCLK - HACK + +WiP + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.c | 101 ++++++- + drivers/gpu/drm/meson/meson_drv.h | 32 ++ + drivers/gpu/drm/meson/meson_vclk.c | 146 ++++++++++ + drivers/gpu/drm/meson/meson_venc.c | 24 +- + 4 files changed, 293 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -170,6 +170,35 @@ static void meson_vpu_init(struct meson_drm *priv) + } + } + ++static int meson_video_clock_init(struct meson_drm *priv) ++{ ++ int ret; ++ ++ ret = clk_bulk_prepare(VPU_VID_CLK_NUM, priv->vid_clks); ++ if (ret) ++ return dev_err_probe(priv->dev, ret, ++ "Failed to prepare the video clocks\n"); ++ ++ ret = clk_bulk_prepare(priv->num_intr_clks, priv->intr_clks); ++ if (ret) ++ return dev_err_probe(priv->dev, ret, ++ "Failed to prepare the interrupt clocks\n"); ++ ++ return 0; ++} ++ ++static void meson_video_clock_exit(struct meson_drm *priv) ++{ ++ if (priv->clk_dac_enabled) ++ clk_disable(priv->clk_dac); ++ ++ if (priv->clk_venc_enabled) ++ clk_disable(priv->clk_venc); ++ ++ clk_bulk_unprepare(priv->num_intr_clks, priv->intr_clks); ++ clk_bulk_unprepare(VPU_VID_CLK_NUM, priv->vid_clks); ++} ++ + static void meson_fbdev_setup(struct meson_drm *priv) + { + unsigned int preferred_bpp; +@@ -263,10 +292,59 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + priv->compat = match->compat; + priv->afbcd.ops = match->afbcd_ops; + ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ priv->vid_pll_resets[VPU_RESET_VID_PLL_PRE].id = "vid_pll_pre"; ++ priv->vid_pll_resets[VPU_RESET_VID_PLL_POST].id = "vid_pll_post"; ++ priv->vid_pll_resets[VPU_RESET_VID_PLL_SOFT_PRE].id = "vid_pll_soft_pre"; ++ priv->vid_pll_resets[VPU_RESET_VID_PLL_SOFT_POST].id = "vid_pll_soft_post"; ++ ++ ret = devm_reset_control_bulk_get_exclusive(dev, ++ VPU_RESET_VID_PLL_NUM, ++ priv->vid_pll_resets); ++ if (ret) ++ goto free_drm; ++ ++ priv->intr_clks[0].id = "vpu_intr"; ++ priv->intr_clks[1].id = "hdmi_intr_sync"; ++ priv->intr_clks[2].id = "venci_int"; ++ priv->num_intr_clks = 3; ++ ++ ret = devm_clk_bulk_get(dev, priv->num_intr_clks, ++ priv->intr_clks); ++ if (ret) ++ goto free_drm; ++ ++ priv->vid_clks[VPU_VID_CLK_TMDS].id = "tmds"; ++ priv->vid_clks[VPU_VID_CLK_HDMI_TX_PIXEL].id = "hdmi_tx_pixel"; ++ priv->vid_clks[VPU_VID_CLK_CTS_ENCP].id = "cts_encp"; ++ priv->vid_clks[VPU_VID_CLK_CTS_ENCI].id = "cts_enci"; ++ priv->vid_clks[VPU_VID_CLK_CTS_ENCT].id = "cts_enct"; ++ priv->vid_clks[VPU_VID_CLK_CTS_ENCL].id = "cts_encl"; ++ priv->vid_clks[VPU_VID_CLK_CTS_VDAC0].id = "cts_vdac0"; ++ ++ ret = devm_clk_bulk_get(dev, VPU_VID_CLK_NUM, priv->vid_clks); ++ if (ret) ++ goto free_drm; ++ } else { ++ priv->intr_clks[0].id = "vpu_intr"; ++ priv->num_intr_clks = 1; ++ ++ ret = devm_clk_bulk_get_optional(dev, priv->num_intr_clks, ++ priv->intr_clks); ++ if (ret) ++ goto free_drm; ++ } ++ ++ ret = meson_video_clock_init(priv); ++ if (ret) ++ goto free_drm; ++ + regs = devm_platform_ioremap_resource_byname(pdev, "vpu"); + if (IS_ERR(regs)) { + ret = PTR_ERR(regs); +- goto free_drm; ++ goto video_clock_exit; + } + + priv->io_base = regs; +@@ -281,7 +359,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + regs = devm_ioremap(dev, res->start, resource_size(res)); + if (!regs) { + ret = -EADDRNOTAVAIL; +- goto free_drm; ++ goto video_clock_exit; + } + + priv->hhi = devm_regmap_init_mmio(dev, regs, +@@ -290,13 +368,13 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + + priv->canvas = meson_canvas_get(dev); + if (IS_ERR(priv->canvas)) { + ret = PTR_ERR(priv->canvas); +- goto free_drm; ++ goto video_clock_exit; + } + + ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1); + if (ret) +- goto free_drm; ++ goto video_clock_exit; + ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_vd1_0); + if (ret) + goto free_canvas_osd1; +@@ -425,6 +503,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) + exit_afbcd: + if (priv->afbcd.ops) + priv->afbcd.ops->exit(priv); ++video_clock_exit: ++ meson_video_clock_exit(priv); + free_canvas_vd1_2: + meson_canvas_free(priv->canvas, priv->canvas_id_vd1_2); + free_canvas_vd1_1: +@@ -469,6 +549,8 @@ static void meson_drv_unbind(struct device *dev) + + if (priv->afbcd.ops) + priv->afbcd.ops->exit(priv); ++ ++ meson_video_clock_exit(priv); + } + + static const struct component_master_ops meson_drv_master_ops = { +@@ -483,6 +565,8 @@ static int __maybe_unused meson_drv_pm_suspend(struct device *dev) + if (!priv) + return 0; + ++ // TODO: video clock suspend ++ + return drm_mode_config_helper_suspend(priv->drm); + } + +@@ -493,6 +577,7 @@ static int __maybe_unused meson_drv_pm_resume(struct device *dev) + if (!priv) + return 0; + ++ meson_video_clock_init(priv); + meson_vpu_init(priv); + meson_venc_init(priv); + meson_vpp_init(priv); +diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.h ++++ b/drivers/gpu/drm/meson/meson_drv.h +@@ -7,9 +7,11 @@ + #ifndef __MESON_DRV_H + #define __MESON_DRV_H + ++#include + #include + #include + #include ++#include + + struct drm_crtc; + struct drm_device; +@@ -45,6 +47,25 @@ struct meson_drm_soc_limits { + unsigned int max_hdmi_phy_freq; + }; + ++enum vpu_bulk_clk_id { ++ VPU_VID_CLK_TMDS = 0, ++ VPU_VID_CLK_HDMI_TX_PIXEL, ++ VPU_VID_CLK_CTS_ENCP, ++ VPU_VID_CLK_CTS_ENCI, ++ VPU_VID_CLK_CTS_ENCT, ++ VPU_VID_CLK_CTS_ENCL, ++ VPU_VID_CLK_CTS_VDAC0, ++ VPU_VID_CLK_NUM ++}; ++ ++enum vpu_bulk_vid_pll_reset_id { ++ VPU_RESET_VID_PLL_PRE = 0, ++ VPU_RESET_VID_PLL_POST, ++ VPU_RESET_VID_PLL_SOFT_PRE, ++ VPU_RESET_VID_PLL_SOFT_POST, ++ VPU_RESET_VID_PLL_NUM ++}; ++ + struct meson_drm { + struct device *dev; + enum vpu_compatible compat; +@@ -70,6 +91,17 @@ struct meson_drm { + bool cvbs_dac_enabled; + struct platform_device *cvbs_dac_pdev; + ++ struct clk_bulk_data intr_clks[3]; ++ unsigned int num_intr_clks; ++ bool intr_clks_enabled; ++ struct clk_bulk_data vid_clks[VPU_VID_CLK_NUM]; ++ bool vid_clk_rate_exclusive[VPU_VID_CLK_NUM]; ++ struct clk *clk_venc; ++ bool clk_venc_enabled; ++ struct clk *clk_dac; ++ bool clk_dac_enabled; ++ struct reset_control_bulk_data vid_pll_resets[VPU_RESET_VID_PLL_NUM]; ++ + /* Components Data */ + struct { + bool osd1_enabled; +diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.c ++++ b/drivers/gpu/drm/meson/meson_vclk.c +@@ -732,6 +732,11 @@ meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned int freq) + return MODE_CLOCK_HIGH; + } + ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) ++ return MODE_OK; ++ + if (meson_hdmi_pll_find_params(priv, freq, &m, &frac, &od)) + return MODE_OK; + +@@ -784,6 +789,11 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq, + return MODE_CLOCK_HIGH; + } + ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) ++ return MODE_OK; ++ + for (i = 0 ; params[i].pixel_freq ; ++i) { + DRM_DEBUG_DRIVER("i = %d pixel_freq = %d alt = %d\n", + i, params[i].pixel_freq, +@@ -1024,6 +1034,128 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq, + regmap_update_bits(priv->hhi, HHI_VID_CLK_CNTL, VCLK_EN, VCLK_EN); + } + ++static int meson_vclk_set_rate_exclusive(struct meson_drm *priv, ++ enum vpu_bulk_clk_id clk_id, ++ unsigned int rate_khz) ++{ ++ struct clk *clk = priv->vid_clks[clk_id].clk; ++ int ret; ++ ++ ret = clk_set_rate_exclusive(clk, rate_khz * 1000UL); ++ if (ret) ++ return ret; ++ ++ priv->vid_clk_rate_exclusive[clk_id] = true; ++ ++ return 0; ++} ++ ++static void meson_vclk_disable_ccf(struct meson_drm *priv) ++{ ++ unsigned int i; ++ ++ /* allow all clocks to be changed in _enable again */ ++ for (i = 0; i < VPU_VID_CLK_NUM; i++) { ++ if (!priv->vid_clk_rate_exclusive[i]) ++ continue; ++ ++ clk_rate_exclusive_put(priv->vid_clks[i].clk); ++ priv->vid_clk_rate_exclusive[i] = false; ++ } ++ ++ if (priv->clk_dac_enabled) { ++ clk_disable(priv->clk_dac); ++ priv->clk_dac_enabled = false; ++ } ++ ++ if (priv->clk_venc_enabled) { ++ clk_disable(priv->clk_venc); ++ priv->clk_venc_enabled = false; ++ } ++} ++ ++static int meson_vclk_enable_ccf(struct meson_drm *priv, unsigned int target, ++ bool hdmi_use_enci, unsigned int phy_freq, ++ unsigned int dac_freq, unsigned int venc_freq) ++{ ++ enum vpu_bulk_clk_id venc_clk_id, dac_clk_id; ++ int ret; ++ ++ if (target == MESON_VCLK_TARGET_CVBS || hdmi_use_enci) ++ venc_clk_id = VPU_VID_CLK_CTS_ENCI; ++ else ++ venc_clk_id = VPU_VID_CLK_CTS_ENCP; ++ ++ if (target == MESON_VCLK_TARGET_CVBS) ++ dac_clk_id = VPU_VID_CLK_CTS_VDAC0; ++ else ++ dac_clk_id = VPU_VID_CLK_HDMI_TX_PIXEL; ++ ++ /* ++ * The TMDS clock also updates the PLL. Protect the PLL rate so all ++ * following clocks are derived from the PLL setting which matches the ++ * TMDS clock. ++ */ ++ ret = meson_vclk_set_rate_exclusive(priv, VPU_VID_CLK_TMDS, phy_freq); ++ if (ret) { ++ dev_err(priv->dev, "Failed to set TMDS clock to %ukHz: %d\n", ++ phy_freq, ret); ++ goto out_enable_clocks; ++ } ++ ++ /* ++ * The DAC clock may be derived from a parent of the VENC clock so we ++ * must protect the VENC clock from changing it's rate. This works ++ * because the DAC freq can be divided by the VENC clock. ++ */ ++ ret = meson_vclk_set_rate_exclusive(priv, venc_clk_id, venc_freq); ++ if (ret) { ++ dev_warn(priv->dev, ++ "Failed to set VENC clock to %ukHz while TMDS clock is %ukHz: %d\n", ++ venc_freq, phy_freq, ret); ++ goto out_enable_clocks; ++ } ++ ++ priv->clk_venc = priv->vid_clks[venc_clk_id].clk; ++ ++ /* ++ * after changing any of the VID_PLL_* clocks (which can happen when ++ * update the VENC clock rate) we need to assert and then de-assert the ++ * VID_DIVIDER_CNTL_* reset lines. ++ */ ++ reset_control_bulk_assert(VPU_RESET_VID_PLL_NUM, priv->vid_pll_resets); ++ reset_control_bulk_deassert(VPU_RESET_VID_PLL_NUM, priv->vid_pll_resets); ++ ++ ret = meson_vclk_set_rate_exclusive(priv, dac_clk_id, dac_freq); ++ if (ret) { ++ dev_warn(priv->dev, ++ "Failed to set pixel clock to %ukHz while TMDS clock is %ukHz: %d\n", ++ dac_freq, phy_freq, ret); ++ goto out_enable_clocks; ++ } ++ ++ priv->clk_dac = priv->vid_clks[dac_clk_id].clk; ++ ++out_enable_clocks: ++ ret = clk_enable(priv->clk_venc); ++ if (ret) ++ dev_err(priv->dev, ++ "Failed to re-enable the VENC clock at %ukHz: %d\n", ++ venc_freq, ret); ++ else ++ priv->clk_venc_enabled = true; ++ ++ ret = clk_enable(priv->clk_dac); ++ if (ret) ++ dev_err(priv->dev, ++ "Failed to re-enable the pixel clock at %ukHz: %d\n", ++ dac_freq, ret); ++ else ++ priv->clk_dac_enabled = true; ++ ++ return ret; ++} ++ + void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + unsigned int phy_freq, unsigned int vclk_freq, + unsigned int venc_freq, unsigned int dac_freq, +@@ -1034,6 +1166,20 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target, + unsigned int hdmi_tx_div; + unsigned int venc_div; + ++ if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8B) || ++ meson_vpu_is_compatible(priv, VPU_COMPATIBLE_M8M2)) { ++ /* CVBS video clocks are generated off a 1296MHz base clock */ ++ if (target == MESON_VCLK_TARGET_CVBS) ++ phy_freq = 1296000; ++ ++ dev_err(priv->dev, "%s(target: %u, phy: %u, dac: %u, venc: %u, hdmi_use_enci: %u)\n", __func__, target, phy_freq, dac_freq, venc_freq, hdmi_use_enci); ++ meson_vclk_disable_ccf(priv); ++ meson_vclk_enable_ccf(priv, target, hdmi_use_enci, phy_freq, ++ dac_freq, venc_freq); ++ return; ++ } ++ + if (target == MESON_VCLK_TARGET_CVBS) { + meson_venci_cvbs_clock_config(priv); + return; +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -1954,14 +1954,34 @@ void meson_venc_enable_vsync(struct meson_drm *priv) + priv->io_base + _REG(VENC_INTCTRL)); + } + +- if (priv->hhi) ++ if (priv->intr_clks[0].clk) { ++ if (!priv->intr_clks_enabled) { ++ int ret; ++ ++ ret = clk_bulk_enable(priv->num_intr_clks, ++ priv->intr_clks); ++ if (ret) ++ dev_err(priv->dev, ++ "Failed to enable the interrupt clocks\n"); ++ else ++ priv->intr_clks_enabled = true; ++ } ++ } else { + regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25)); ++ } + } + + void meson_venc_disable_vsync(struct meson_drm *priv) + { +- if (priv->hhi) ++ if (priv->intr_clks[0].clk) { ++ if (priv->intr_clks_enabled) { ++ clk_bulk_disable(priv->num_intr_clks, ++ priv->intr_clks); ++ priv->intr_clks_enabled = false; ++ } ++ } else { + regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), 0); ++ } + + writel_relaxed(0, priv->io_base + _REG(VENC_INTCTRL)); + } +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0058-drm-meson-Enable-support-for-Meson8-Meson8b-Meson8m2.patch b/patch/kernel/archive/meson-6.10/0058-drm-meson-Enable-support-for-Meson8-Meson8b-Meson8m2.patch new file mode 100644 index 000000000000..8fe8197ee463 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0058-drm-meson-Enable-support-for-Meson8-Meson8b-Meson8m2.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 25 Apr 2020 22:14:27 +0200 +Subject: drm/meson: Enable support for Meson8/Meson8b/Meson8m2 + +Add a compatible string for each of the three SoCs now that all hardware +specific quirks are added to the driver. + +Signed-off-by: Martin Blumenstingl +--- + drivers/gpu/drm/meson/meson_drv.c | 18 ++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -660,6 +660,18 @@ static void meson_drv_remove(struct platform_device *pdev) + component_master_del(&pdev->dev, &meson_drv_master_ops); + } + ++static struct meson_drm_match_data meson_drm_m8_data = { ++ .compat = VPU_COMPATIBLE_M8, ++}; ++ ++static struct meson_drm_match_data meson_drm_m8b_data = { ++ .compat = VPU_COMPATIBLE_M8B, ++}; ++ ++static struct meson_drm_match_data meson_drm_m8m2_data = { ++ .compat = VPU_COMPATIBLE_M8M2, ++}; ++ + static struct meson_drm_match_data meson_drm_gxbb_data = { + .compat = VPU_COMPATIBLE_GXBB, + }; +@@ -679,6 +691,12 @@ static struct meson_drm_match_data meson_drm_g12a_data = { + }; + + static const struct of_device_id dt_match[] = { ++ { .compatible = "amlogic,meson8-vpu", ++ .data = (void *)&meson_drm_m8_data }, ++ { .compatible = "amlogic,meson8b-vpu", ++ .data = (void *)&meson_drm_m8b_data }, ++ { .compatible = "amlogic,meson8m2-vpu", ++ .data = (void *)&meson_drm_m8m2_data }, + { .compatible = "amlogic,meson-gxbb-vpu", + .data = (void *)&meson_drm_gxbb_data }, + { .compatible = "amlogic,meson-gxl-vpu", +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0059-ARM-dts-meson-add-the-VPU-WiP.patch b/patch/kernel/archive/meson-6.10/0059-ARM-dts-meson-add-the-VPU-WiP.patch new file mode 100644 index 000000000000..a2b3f861b14e --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0059-ARM-dts-meson-add-the-VPU-WiP.patch @@ -0,0 +1,272 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sat, 8 Dec 2018 13:50:48 +0100 +Subject: ARM: dts: meson: add the VPU - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson.dtsi | 10 ++ + arch/arm/boot/dts/amlogic/meson8.dtsi | 80 +++++++++ + arch/arm/boot/dts/amlogic/meson8b.dtsi | 81 ++++++++++ + arch/arm/boot/dts/amlogic/meson8m2.dtsi | 4 + + 4 files changed, 175 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson.dtsi b/arch/arm/boot/dts/amlogic/meson.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson.dtsi +@@ -38,6 +38,16 @@ hhi: system-controller@4000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x4000 0x400>; ++ ++ ++ cvbs_dac: video-dac@2f4 { ++ compatible = "amlogic,meson-cvbs-dac"; ++ reg = <0x2f4 0x8>; ++ ++ #phy-cells = <0>; ++ ++ status = "disabled"; ++ }; + }; + + aiu: audio-controller@5400 { +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -314,6 +314,71 @@ mali: gpu@c0000 { + operating-points-v2 = <&gpu_opp_table>; + #cooling-cells = <2>; /* min followed by max */ + }; ++ ++ vpu: vpu@100000 { ++ compatible = "amlogic,meson8-vpu"; ++ ++ reg = <0x100000 0x10000>; ++ reg-names = "vpu"; ++ ++ interrupts = ; ++ ++ amlogic,canvas = <&canvas>; ++ ++ /* ++ * The VCLK{,2}_IN path always needs to derived from ++ * the CLKID_VID_PLL_FINAL_DIV so other clocks like ++ * MPLL1 are not used (MPLL1 is reserved for audio ++ * purposes). ++ */ ++ assigned-clocks = <&clkc CLKID_VCLK_IN_SEL>, ++ <&clkc CLKID_VCLK2_IN_SEL>; ++ assigned-clock-parents = <&clkc CLKID_VID_PLL_FINAL_DIV>, ++ <&clkc CLKID_VID_PLL_FINAL_DIV>; ++ ++ clocks = <&clkc CLKID_VPU_INTR>, ++ <&clkc CLKID_HDMI_INTR_SYNC>, ++ <&clkc CLKID_GCLK_VENCI_INT>, ++ <&clkc CLKID_HDMI_PLL_HDMI_OUT>, ++ <&clkc CLKID_HDMI_TX_PIXEL>, ++ <&clkc CLKID_CTS_ENCP>, ++ <&clkc CLKID_CTS_ENCI>, ++ <&clkc CLKID_CTS_ENCT>, ++ <&clkc CLKID_CTS_ENCL>, ++ <&clkc CLKID_CTS_VDAC0>; ++ clock-names = "vpu_intr", ++ "hdmi_intr_sync", ++ "venci_int", ++ "tmds", ++ "hdmi_tx_pixel", ++ "cts_encp", ++ "cts_enci", ++ "cts_enct", ++ "cts_encl", ++ "cts_vdac0"; ++ ++ resets = <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE>, ++ <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST>, ++ <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE>, ++ <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST>; ++ reset-names = "vid_pll_pre", ++ "vid_pll_post", ++ "vid_pll_soft_pre", ++ "vid_pll_soft_post"; ++ ++ phys = <&cvbs_dac>; ++ phy-names = "cvbs-dac"; ++ ++ power-domains = <&pwrc PWRC_MESON8_VPU_ID>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ /* CVBS VDAC output port */ ++ cvbs_vdac_port: port@0 { ++ reg = <0>; ++ }; ++ }; + }; + }; /* end of / */ + +@@ -617,6 +682,17 @@ smp-sram@1ff80 { + }; + }; + ++&cvbs_dac { ++ compatible = "amlogic,meson8-cvbs-dac", "amlogic,meson-cvbs-dac"; ++ ++ clocks = <&clkc CLKID_CTS_VDAC0>; ++ ++ nvmem-cells = <&cvbs_trimming>; ++ nvmem-cell-names = "cvbs_trimming"; ++ ++ status = "okay"; ++}; ++ + &efuse { + compatible = "amlogic,meson8-efuse"; + clocks = <&clkc CLKID_EFUSE>; +@@ -626,6 +702,10 @@ temperature_calib: calib@1f4 { + /* only the upper two bytes are relevant */ + reg = <0x1f4 0x4>; + }; ++ ++ cvbs_trimming: calib@1f8 { ++ reg = <0x1f8 0x2>; ++ }; + }; + + ðmac { +diff --git a/arch/arm/boot/dts/amlogic/meson8b.dtsi b/arch/arm/boot/dts/amlogic/meson8b.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8b.dtsi +@@ -276,6 +276,71 @@ mali: gpu@c0000 { + operating-points-v2 = <&gpu_opp_table>; + #cooling-cells = <2>; /* min followed by max */ + }; ++ ++ vpu: vpu@100000 { ++ compatible = "amlogic,meson8b-vpu"; ++ ++ reg = <0x100000 0x10000>; ++ reg-names = "vpu"; ++ ++ interrupts = ; ++ ++ amlogic,canvas = <&canvas>; ++ ++ /* ++ * The VCLK{,2}_IN path always needs to derived from ++ * the CLKID_VID_PLL_FINAL_DIV so other clocks like ++ * MPLL1 are not used (MPLL1 is reserved for audio ++ * purposes). ++ */ ++ assigned-clocks = <&clkc CLKID_VCLK_IN_SEL>, ++ <&clkc CLKID_VCLK2_IN_SEL>; ++ assigned-clock-parents = <&clkc CLKID_VID_PLL_FINAL_DIV>, ++ <&clkc CLKID_VID_PLL_FINAL_DIV>; ++ ++ clocks = <&clkc CLKID_VPU_INTR>, ++ <&clkc CLKID_HDMI_INTR_SYNC>, ++ <&clkc CLKID_GCLK_VENCI_INT>, ++ <&clkc CLKID_HDMI_PLL_HDMI_OUT>, ++ <&clkc CLKID_HDMI_TX_PIXEL>, ++ <&clkc CLKID_CTS_ENCP>, ++ <&clkc CLKID_CTS_ENCI>, ++ <&clkc CLKID_CTS_ENCT>, ++ <&clkc CLKID_CTS_ENCL>, ++ <&clkc CLKID_CTS_VDAC0>; ++ clock-names = "vpu_intr", ++ "hdmi_intr_sync", ++ "venci_int", ++ "tmds", ++ "hdmi_tx_pixel", ++ "cts_encp", ++ "cts_enci", ++ "cts_enct", ++ "cts_encl", ++ "cts_vdac0"; ++ ++ resets = <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE>, ++ <&clkc CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST>, ++ <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE>, ++ <&clkc CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST>; ++ reset-names = "vid_pll_pre", ++ "vid_pll_post", ++ "vid_pll_soft_pre", ++ "vid_pll_soft_post"; ++ ++ phys = <&cvbs_dac>; ++ phy-names = "cvbs-dac"; ++ ++ power-domains = <&pwrc PWRC_MESON8_VPU_ID>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ /* CVBS VDAC output port */ ++ cvbs_vdac_port: port@0 { ++ reg = <0>; ++ }; ++ }; + }; + }; /* end of / */ + +@@ -389,6 +454,8 @@ &ao_arc_rproc { + sram = <&ao_arc_sram>; + resets = <&reset RESET_MEDIA_CPU>; + clocks = <&clkc CLKID_AO_MEDIA_CPU>; ++ status = "okay"; ++ firmware-name = "zephyr.elf"; + }; + + &cbus { +@@ -547,6 +614,16 @@ smp-sram@1ff80 { + }; + }; + ++&cvbs_dac { ++ compatible = "amlogic,meson8b-cvbs-dac", "amlogic,meson-cvbs-dac"; ++ ++ clocks = <&clkc CLKID_CTS_VDAC0>; ++ ++ nvmem-cells = <&cvbs_trimming>; ++ nvmem-cell-names = "cvbs_trimming"; ++ ++ status = "okay"; ++}; + + &efuse { + compatible = "amlogic,meson8b-efuse"; +@@ -557,6 +634,10 @@ temperature_calib: calib@1f4 { + /* only the upper two bytes are relevant */ + reg = <0x1f4 0x4>; + }; ++ ++ cvbs_trimming: calib@1f8 { ++ reg = <0x1f8 0x2>; ++ }; + }; + + ðmac { +diff --git a/arch/arm/boot/dts/amlogic/meson8m2.dtsi b/arch/arm/boot/dts/amlogic/meson8m2.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8m2.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8m2.dtsi +@@ -96,6 +96,10 @@ &usb1_phy { + compatible = "amlogic,meson8m2-usb2-phy", "amlogic,meson-mx-usb2-phy"; + }; + ++&vpu { ++ compatible = "amlogic,meson8m2-vpu"; ++}; ++ + &wdt { + compatible = "amlogic,meson8m2-wdt", "amlogic,meson8b-wdt"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0060-ARM-dts-meson8-add-the-HDMI-controller-WiP.patch b/patch/kernel/archive/meson-6.10/0060-ARM-dts-meson8-add-the-HDMI-controller-WiP.patch new file mode 100644 index 000000000000..210b28a90799 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0060-ARM-dts-meson8-add-the-HDMI-controller-WiP.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 5 May 2019 02:30:11 +0200 +Subject: ARM: dts: meson8: add the HDMI controller - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8.dtsi | 67 +++++++++- + 1 file changed, 65 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -315,6 +315,39 @@ mali: gpu@c0000 { + #cooling-cells = <2>; /* min followed by max */ + }; + ++ hdmi_tx: hdmi-tx@42000 { ++ compatible = "amlogic,meson8-hdmi-tx"; ++ reg = <0x42000 0xc>; ++ interrupts = ; ++ phys = <&hdmi_tx_phy>; ++ phy-names = "hdmi"; ++ clocks = <&clkc CLKID_HDMI_PCLK>, ++ <&clkc CLKID_HDMI_SYS>; ++ clock-names = "pclk", "sys"; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ #sound-dai-cells = <1>; ++ sound-name-prefix = "HDMITX"; ++ ++ 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>; ++ }; ++ }; ++ + vpu: vpu@100000 { + compatible = "amlogic,meson8-vpu"; + +@@ -378,6 +411,15 @@ vpu: vpu@100000 { + 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>; ++ }; ++ }; + }; + }; + }; /* end of / */ +@@ -544,11 +586,26 @@ gpio: banks@80b0 { + gpio-ranges = <&pinctrl_cbus 0 0 120>; + }; + ++ hdmi_hpd_pins: hdmi-hpd { ++ mux { ++ groups = "hdmi_hpd"; ++ function = "hdmi"; ++ bias-disable; ++ }; ++ }; ++ ++ hdmi_i2c_pins: hdmi-i2c { ++ mux { ++ groups = "hdmi_sda", "hdmi_scl"; ++ function = "hdmi"; ++ bias-disable; ++ }; ++ }; ++ + pwm_c_dv9_pins: pwm-c-dv9 { + mux { + groups = "pwm_c_dv9"; + function = "pwm_c"; +- bias-disable; + }; + }; + +@@ -556,7 +613,6 @@ pwm_d_pins: pwm-d { + mux { + groups = "pwm_d"; + function = "pwm_d"; +- bias-disable; + }; + }; + +@@ -740,6 +796,13 @@ pwrc: power-controller@100 { + assigned-clocks = <&clkc CLKID_VPU>; + assigned-clock-rates = <364285714>; + }; ++ ++ hdmi_tx_phy: hdmi-phy@3a0 { ++ compatible = "amlogic,meson8-hdmi-tx-phy"; ++ clocks = <&clkc CLKID_HDMI_PLL_HDMI_OUT>; ++ reg = <0x3a0 0xc>; ++ #phy-cells = <0>; ++ }; + }; + + &hwrng { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0061-ARM-dts-meson8-Add-the-shared-CMA-dma-memory-pool.patch b/patch/kernel/archive/meson-6.10/0061-ARM-dts-meson8-Add-the-shared-CMA-dma-memory-pool.patch new file mode 100644 index 000000000000..4d04d132a2cc --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0061-ARM-dts-meson8-Add-the-shared-CMA-dma-memory-pool.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 4 Jun 2021 21:50:06 +0200 +Subject: ARM: dts: meson8: Add the shared CMA dma memory pool + +The 4K HDMI modes needs more CMA memory (than the default 64MiB) to be +reserved at boot-time. Add a shared-dma-pool with increased size so the +4K HDMI modes can be used. + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8.dtsi | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -193,6 +193,14 @@ power-firmware@4f00000 { + reg = <0x4f00000 0x100000>; + no-map; + }; ++ ++ linux,cma { ++ compatible = "shared-dma-pool"; ++ reusable; ++ size = <0x10000000>; ++ alignment = <0x400000>; ++ linux,cma-default; ++ }; + }; + + thermal-zones { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0062-ARM-dts-meson8-add-the-AO-CEC-controller-WiP.patch b/patch/kernel/archive/meson-6.10/0062-ARM-dts-meson8-add-the-AO-CEC-controller-WiP.patch new file mode 100644 index 000000000000..381efd34c424 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0062-ARM-dts-meson8-add-the-AO-CEC-controller-WiP.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 5 May 2019 11:44:08 +0200 +Subject: ARM: dts: meson8: add the AO CEC controller - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8.dtsi | 17 ++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8.dtsi b/arch/arm/boot/dts/amlogic/meson8.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8.dtsi +@@ -478,6 +478,14 @@ gpio_ao: ao-bank@14 { + gpio-ranges = <&pinctrl_aobus 0 0 16>; + }; + ++ hdmi_cec_ao_pins: hdmi-cec-ao { ++ mux { ++ groups = "hdmi_cec_ao"; ++ function = "hdmi_cec_ao"; ++ bias-pull-up; ++ }; ++ }; ++ + i2s_am_clk_pins: i2s-am-clk-out { + mux { + groups = "i2s_am_clk_out_ao"; +@@ -542,6 +550,15 @@ mux { + }; + }; + }; ++ ++ cec_AO: cec@100 { ++ compatible = "amlogic,meson-gx-ao-cec"; // FIXME ++ reg = <0x100 0x14>; ++ interrupts = ; ++ // TODO: 32768HZ clock ++ hdmi-phandle = <&hdmi_tx>; ++ status = "disabled"; ++ }; + }; + + &ao_arc_rproc { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0063-ARM-dts-meson8b-add-the-HDMI-controller-WiP.patch b/patch/kernel/archive/meson-6.10/0063-ARM-dts-meson8b-add-the-HDMI-controller-WiP.patch new file mode 100644 index 000000000000..a4f1d844ae11 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0063-ARM-dts-meson8b-add-the-HDMI-controller-WiP.patch @@ -0,0 +1,120 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 5 May 2019 02:30:29 +0200 +Subject: ARM: dts: meson8b: add the HDMI controller - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8b.dtsi | 69 ++++++++++ + 1 file changed, 69 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8b.dtsi b/arch/arm/boot/dts/amlogic/meson8b.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8b.dtsi +@@ -277,6 +277,39 @@ mali: gpu@c0000 { + #cooling-cells = <2>; /* min followed by max */ + }; + ++ hdmi_tx: hdmi-tx@42000 { ++ compatible = "amlogic,meson8b-hdmi-tx"; ++ reg = <0x42000 0xc>; ++ interrupts = ; ++ phys = <&hdmi_tx_phy>; ++ phy-names = "hdmi"; ++ clocks = <&clkc CLKID_HDMI_PCLK>, ++ <&clkc CLKID_HDMI_SYS>; ++ clock-names = "pclk", "sys"; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ #sound-dai-cells = <1>; ++ sound-name-prefix = "HDMITX"; ++ ++ 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>; ++ }; ++ }; ++ + vpu: vpu@100000 { + compatible = "amlogic,meson8b-vpu"; + +@@ -336,10 +369,22 @@ vpu: vpu@100000 { + #address-cells = <1>; + #size-cells = <0>; + ++ #sound-dai-cells = <0>; ++ sound-name-prefix = "HDMITX"; ++ + /* 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>; ++ }; ++ }; + }; + }; + }; /* end of / */ +@@ -538,6 +583,22 @@ mux { + }; + }; + ++ hdmi_hpd_pins: hdmi-hpd { ++ mux { ++ groups = "hdmi_hpd"; ++ function = "hdmi"; ++ bias-disable; ++ }; ++ }; ++ ++ hdmi_i2c_pins: hdmi-i2c { ++ mux { ++ groups = "hdmi_sda", "hdmi_scl"; ++ function = "hdmi"; ++ bias-disable; ++ }; ++ }; ++ + i2c_a_pins: i2c-a { + mux { + groups = "i2c_sda_a", "i2c_sck_a"; +@@ -700,6 +761,14 @@ pwrc: power-controller@100 { + assigned-clocks = <&clkc CLKID_VPU>; + assigned-clock-rates = <182142857>; + }; ++ ++ hdmi_tx_phy: hdmi-phy@3a0 { ++ compatible = "amlogic,meson8b-hdmi-tx-phy", ++ "amlogic,meson8-hdmi-tx-phy"; ++ clocks = <&clkc CLKID_HDMI_PLL_HDMI_OUT>; ++ reg = <0x3a0 0xc>; ++ #phy-cells = <0>; ++ }; + }; + + &hwrng { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0064-ARM-dts-meson8b-add-the-AO-CEC-controller-WiP.patch b/patch/kernel/archive/meson-6.10/0064-ARM-dts-meson8b-add-the-AO-CEC-controller-WiP.patch new file mode 100644 index 000000000000..a5b50dc4baf2 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0064-ARM-dts-meson8b-add-the-AO-CEC-controller-WiP.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 5 May 2019 11:44:20 +0200 +Subject: ARM: dts: meson8b: add the AO CEC controller - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8b.dtsi | 17 ++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8b.dtsi b/arch/arm/boot/dts/amlogic/meson8b.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b.dtsi ++++ b/arch/arm/boot/dts/amlogic/meson8b.dtsi +@@ -435,6 +435,14 @@ gpio_ao: ao-bank@14 { + gpio-ranges = <&pinctrl_aobus 0 0 16>; + }; + ++ hdmi_cec_ao_pins: hdmi-cec-ao { ++ mux { ++ groups = "hdmi_cec_1"; ++ function = "hdmi_cec"; ++ bias-pull-up; ++ }; ++ }; ++ + i2s_am_clk_pins: i2s-am-clk-out { + mux { + groups = "i2s_am_clk_out"; +@@ -491,6 +499,15 @@ mux { + }; + }; + }; ++ ++ cec_AO: cec@100 { ++ compatible = "amlogic,meson-gx-ao-cec"; // FIXME ++ reg = <0x100 0x14>; ++ interrupts = ; ++ // TODO: 32768HZ clock ++ hdmi-phandle = <&hdmi_tx>; ++ status = "disabled"; ++ }; + }; + + &ao_arc_rproc { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/0066-ARM-dts-meson8b-odroid-c1-enable-HDMI-for-the-Odroid.patch b/patch/kernel/archive/meson-6.10/0066-ARM-dts-meson8b-odroid-c1-enable-HDMI-for-the-Odroid.patch new file mode 100644 index 000000000000..59c7119076f2 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/0066-ARM-dts-meson8b-odroid-c1-enable-HDMI-for-the-Odroid.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Fri, 20 Mar 2020 15:17:51 +0100 +Subject: ARM: dts: meson8b: odroid-c1: enable HDMI for the Odroid-C1 - WiP + +WiP + +Signed-off-by: Martin Blumenstingl +--- + arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts | 59 ++++++++++ + 1 file changed, 59 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts b/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts ++++ b/arch/arm/boot/dts/amlogic/meson8b-odroidc1.dts +@@ -32,6 +32,17 @@ emmc_pwrseq: emmc-pwrseq { + reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; + }; + ++ hdmi-connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + led-blue { +@@ -93,6 +104,38 @@ rtc32k_xtal: rtc32k-xtal-clk { + #clock-cells = <0>; + }; + ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ model = "ODROID-C1"; ++ ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>; ++ assigned-clock-rates = <294912000>, ++ <270950400>; ++ ++ dai-link-0 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx 0>; ++ }; ++ }; ++ }; ++ + usb0_vbus: regulator-usb0-vbus { + /* Richtek RT9715EGB */ + compatible = "regulator-fixed"; +@@ -201,6 +244,10 @@ vdd_rtc: regulator-vdd-rtc { + }; + }; + ++&aiu { ++ status = "okay"; ++}; ++ + &cpu0 { + cpu-supply = <&vcck>; + }; +@@ -297,6 +344,18 @@ &gpio_ao { + "SYS_LED", "", ""; + }; + ++&hdmi_tx { ++ status = "okay"; ++ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&hdmi_tx_tmds_port { ++ hdmi_tx_tmds_out: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ + &ir_receiver { + status = "okay"; + pinctrl-0 = <&ir_recv_pins>; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/generic-Revert-mmc-core-Set-HS-clock-speed-before-sending-HS-CMD13.patch b/patch/kernel/archive/meson-6.10/generic-Revert-mmc-core-Set-HS-clock-speed-before-sending-HS-CMD13.patch new file mode 100644 index 000000000000..aca6b585a17d --- /dev/null +++ b/patch/kernel/archive/meson-6.10/generic-Revert-mmc-core-Set-HS-clock-speed-before-sending-HS-CMD13.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: hzy +Date: Sat, 18 Nov 2023 01:22:04 +0800 +Subject: Revert "mmc: core: Set HS clock speed before sending HS CMD13" + +This reverts commit 4bc31edebde51fcf8ad0794763b8679a7ecb5ec0. +--- + drivers/mmc/core/mmc.c | 23 ++-------- + 1 file changed, 4 insertions(+), 19 deletions(-) + +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c +index 111111111111..222222222222 100644 +--- a/drivers/mmc/core/mmc.c ++++ b/drivers/mmc/core/mmc.c +@@ -1401,17 +1401,13 @@ static int mmc_select_hs400es(struct mmc_card *card) + goto out_err; + } + +- /* +- * Bump to HS timing and frequency. Some cards don't handle +- * SEND_STATUS reliably at the initial frequency. +- */ + mmc_set_timing(host, MMC_TIMING_MMC_HS); +- mmc_set_bus_speed(card); +- + err = mmc_switch_status(card, true); + if (err) + goto out_err; + ++ mmc_set_clock(host, card->ext_csd.hs_max_dtr); ++ + /* Switch card to DDR with strobe bit */ + val = EXT_CSD_DDR_BUS_WIDTH_8 | EXT_CSD_BUS_WIDTH_STROBE; + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +@@ -1469,7 +1465,7 @@ static int mmc_select_hs400es(struct mmc_card *card) + static int mmc_select_hs200(struct mmc_card *card) + { + struct mmc_host *host = card->host; +- unsigned int old_timing, old_signal_voltage, old_clock; ++ unsigned int old_timing, old_signal_voltage; + int err = -EINVAL; + u8 val; + +@@ -1500,17 +1496,8 @@ static int mmc_select_hs200(struct mmc_card *card) + false, true, MMC_CMD_RETRIES); + if (err) + goto err; +- +- /* +- * Bump to HS timing and frequency. Some cards don't handle +- * SEND_STATUS reliably at the initial frequency. +- * NB: We can't move to full (HS200) speeds until after we've +- * successfully switched over. +- */ + old_timing = host->ios.timing; +- old_clock = host->ios.clock; + mmc_set_timing(host, MMC_TIMING_MMC_HS200); +- mmc_set_clock(card->host, card->ext_csd.hs_max_dtr); + + /* + * For HS200, CRC errors are not a reliable way to know the +@@ -1523,10 +1510,8 @@ static int mmc_select_hs200(struct mmc_card *card) + * mmc_select_timing() assumes timing has not changed if + * it is a switch error. + */ +- if (err == -EBADMSG) { +- mmc_set_clock(host, old_clock); ++ if (err == -EBADMSG) + mmc_set_timing(host, old_timing); +- } + } + err: + if (err) { +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/generic-Revert-pwm-meson-modify-and-simplify-calculation-in-.patch b/patch/kernel/archive/meson-6.10/generic-Revert-pwm-meson-modify-and-simplify-calculation-in-.patch new file mode 100644 index 000000000000..848cd3e4d562 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/generic-Revert-pwm-meson-modify-and-simplify-calculation-in-.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: hzy +Date: Sat, 18 Nov 2023 01:22:04 +0800 +Subject: Revert "pwm: meson: modify and simplify calculation in + meson_pwm_get_state" + +This reverts commit 6b9352f3f8a1a35faf0efc1ad1807ee303467796. +--- + drivers/pwm/pwm-meson.c | 14 ++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c +index 111111111111..222222222222 100644 +--- a/drivers/pwm/pwm-meson.c ++++ b/drivers/pwm/pwm-meson.c +@@ -322,8 +322,18 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + channel->lo = FIELD_GET(PWM_LOW_MASK, value); + channel->hi = FIELD_GET(PWM_HIGH_MASK, value); + +- state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->lo + channel->hi); +- state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, channel->hi); ++ if (channel->lo == 0) { ++ state->period = meson_pwm_cnt_to_ns(chip, pwm, channel->hi); ++ state->duty_cycle = state->period; ++ } else if (channel->lo >= channel->hi) { ++ state->period = meson_pwm_cnt_to_ns(chip, pwm, ++ channel->lo + channel->hi); ++ state->duty_cycle = meson_pwm_cnt_to_ns(chip, pwm, ++ channel->hi); ++ } else { ++ state->period = 0; ++ state->duty_cycle = 0; ++ } + + state->polarity = PWM_POLARITY_NORMAL; + +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/onecloud-0001-add-dts.patch b/patch/kernel/archive/meson-6.10/onecloud-0001-add-dts.patch new file mode 100644 index 000000000000..b9d9cc535d1a --- /dev/null +++ b/patch/kernel/archive/meson-6.10/onecloud-0001-add-dts.patch @@ -0,0 +1,440 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: hzy +Date: Sat, 1 Apr 2023 13:24:42 +0800 +Subject: ARM: dts: meson8b: Add DTS for Xunlei Onecloud + +Signed-off-by: hzy +--- + arch/arm/boot/dts/amlogic/Makefile | 1 + + arch/arm/boot/dts/amlogic/meson8b-onecloud.dts | 410 ++++++++++ + 2 files changed, 411 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/Makefile b/arch/arm/boot/dts/amlogic/Makefile +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/Makefile ++++ b/arch/arm/boot/dts/amlogic/Makefile +@@ -6,4 +6,5 @@ dtb-$(CONFIG_MACH_MESON8) += \ + meson8b-ec100.dtb \ + meson8b-mxq.dtb \ + meson8b-odroidc1.dtb \ ++ meson8b-onecloud.dtb \ + meson8m2-mxiii-plus.dtb +diff --git a/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts b/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts +@@ -0,0 +1,410 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Author: hzy ++ */ ++ ++/dts-v1/; ++ ++#include "meson8b.dtsi" ++#include ++#include ++ ++/ { ++ model = "Xunlei OneCloud"; ++ compatible = "xunlei,onecloud", "amlogic,meson8b"; ++ ++ aliases { ++ serial0 = &uart_AO; ++ mmc0 = &sd_card_slot; ++ mmc1 = &sdhc; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x40000000 0x40000000>; ++ }; ++ ++ emmc_pwrseq: emmc-pwrseq { ++ compatible = "mmc-pwrseq-emmc"; ++ reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ button { ++ // compatible = "gpio-keys-polled"; ++ // poll-interval = <100>; ++ ++ compatible = "gpio-keys"; ++ ++ autorepeat; ++ ++ reset-button { ++ label = "reset"; ++ linux,code = ; ++ ++ // gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_LOW>; ++ ++ interrupt-parent = <&gpio_intc>; ++ interrupts = <5 IRQ_TYPE_LEVEL_LOW>; // GPIOAO 5 ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ red { ++ label = "onecloud:red:alive"; ++ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; ++ ++ default-state = "on"; ++ linux,default-trigger = "default-on"; ++ }; ++ ++ green { ++ label = "onecloud:green:alive"; ++ gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++ ++ default-state = "off"; ++ linux,default-trigger = "mmc1"; ++ }; ++ ++ blue { ++ label = "onecloud:blue:alive"; ++ gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; ++ ++ default-state = "off"; ++ linux,default-trigger = "usb-host"; ++ }; ++ }; ++ ++ p12v: regulator-p12v { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "P12V"; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ vcc_5v: regulator-vcc-5v { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VCC5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ ++ vin-supply = <&p12v>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vcc_3v3: regulator-vcc-3v3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VCC3V3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ vin-supply = <&p12v>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vcc_1v8: regulator-vcc-1v8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VCC1V8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ vin-supply = <&p12v>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vcc_ddr: regulator-vcc-ddr { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VCC_DDR"; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ ++ vin-supply = <&vcc_3v3>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vcc_core: regulator-vcc-core { ++ compatible = "pwm-regulator"; ++ ++ regulator-name = "VCC_CORE"; ++ ++ // +---------------------------------------------------+ ++ // | The actual mapping in phyical | ++ // +------+--------+--------+--------+--------+--------+ ++ // | | 100% | 60% | 30% | 10% | 0% | ++ // +------+--------+--------+--------+--------+--------+ ++ // | V1.0 | 677mV | 857mV | 992mV | 1082mV | 1127mV | ++ // | V1.3 | 1116mV | 1121mV | 1125mV | 1128mV | 1129mV | ++ // +------+--------+--------+--------+--------+--------+ ++ // ++ // According to meson8b.dtsi, the CPU should be able to ++ // run at 504MHz with 870mV. But this regulator supplies ++ // not only CPU but also GPU. And according to the users' ++ // tests on V1.0, we need such higher voltages. ++ ++ pwms = <&pwm_cd 1 12001 0>; // PWM_D ++ pwm-dutycycle-range = <10 0>; ++ regulator-min-microvolt = <860000>; ++ regulator-max-microvolt = <1140000>; ++ ++ pwm-supply = <&p12v>; ++ ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&uart_AO { ++ status = "okay"; ++ pinctrl-0 = <&uart_ao_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&pwm_cd { ++ status = "okay"; ++ pinctrl-0 = <&pwm_c1_pins>, <&pwm_d_pins>; ++ pinctrl-names = "default"; ++ clocks = <&xtal>, <&xtal>; ++ clock-names = "clkin0", "clkin1"; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vcc_core>; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vcc_1v8>; ++}; ++ ++&mali { ++ // commented to allow cpufreq tweaking ++ // mali-supply = <&vcc_core>; ++}; ++ ++&gpio { ++ gpio-line-names = ++ /* 0 */ "WIFI_SDIO_D0 PIN18 (GPIOX_0)", ++ /* 1 */ "WIFI_SDIO_D1 PIN19 (GPIOX_1)", ++ /* 2 */ "WIFI_SDIO_D2 PIN14 (GPIOX_2)", ++ /* 3 */ "WIFI_SDIO_D3 PIN15 (GPIOX_3)", ++ /* 4 */ "WIFI_PCM_DIN PIN27 (GPIOX_4)", ++ /* 5 */ "WIFI_PCM_DOUT PIN25 (GPIOX_5)", ++ /* 6 */ "WIFI_PCM_SYNC PIN28 (GPIOX_6)", ++ /* 7 */ "WIFI_PCM_CLK PIN26 (GPIOX_7)", ++ /* 8 */ "WIFI_SDIO_CLK PIN17_Resistor (GPIOX_8)", ++ /* 9 */ "WIFI_SDIO_CMD PIN16 (GPIOX_9)", ++ /* 10 */ "GPIOX_10", ++ /* 11 */ "WIFI PIN12 (GPIOX_11)", ++ /* 12 */ "WIFI_UART_RX PIN43 (GPIOX_16)", ++ /* 13 */ "WIFI_UART_TX PIN42 (GPIOX_17)", ++ /* 14 */ "WIFI_UART_RTS PIN41_Resistor (GPIOX_18)", ++ /* 15 */ "WIFI_UART_CTS PIN44 (GPIOX_19)", ++ /* 16 */ "WIFI PIN34 (GPIOX_20)", ++ /* 17 */ "WIFI_WAKE PIN13 (GPIOX_21)", ++ ++ /* 18 */ "Resistor_TopOf_LED (GPIOY_0)", ++ /* 19 */ "GPIOY_1", ++ /* 20 */ "GPIOY_3", ++ /* 21 */ "GPIOY_6", ++ /* 22 */ "GPIOY_7", ++ /* 23 */ "GPIOY_8", ++ /* 24 */ "GPIOY_9", ++ /* 25 */ "GPIOY_10", ++ /* 26 */ "GPIOY_11", ++ /* 27 */ "GPIOY_12", ++ /* 28 */ "Left_BottomOf_CPU (GPIOY_13)", ++ /* 29 */ "Right_BottomOf_CPU (GPIOY_14)", ++ ++ /* 30 */ "GPIODV_9 (PWM_C)", ++ /* 31 */ "GPIODV_24", ++ /* 32 */ "GPIODV_25", ++ /* 33 */ "GPIODV_26", ++ /* 34 */ "GPIODV_27", ++ /* 35 */ "VCC_CPU_PWM (GPIODV_28)", ++ /* 36 */ "GPIODV_29", ++ ++ /* 37 */ "HDMI_HPD (GPIOH_0)", ++ /* 38 */ "HDMI_SDA (GPIOH_1)", ++ /* 39 */ "HDMI_SCL (GPIOH_2)", ++ /* 40 */ "ETH_PHY_INTR (GPIOH_3)", ++ /* 41 */ "ETH_PHY_nRST (GPIOH_4)", ++ /* 42 */ "ETH_TXD1 (GPIOH_5)", ++ /* 43 */ "ETH_TXD0 (GPIOH_6)", ++ /* 44 */ "ETH_TXD3 (GPIOH_7)", ++ /* 45 */ "ETH_TXD2 (GPIOH_8)", ++ /* 46 */ "ETH_TX_CLK (GPIOH_9)", ++ ++ /* 47 */ "SDCARD_D1 (CARD_0)", ++ /* 48 */ "SDCARD_D0 (CARD_1)", ++ /* 49 */ "SDCARD_CLK (CARD_2)", ++ /* 50 */ "SDCARD_CMD (CARD_3)", ++ /* 51 */ "SDCARD_D3 (CARD_4)", ++ /* 52 */ "SDCARD_D2 (CARD_5)", ++ /* 53 */ "SDCARD_CD (CARD_6)", ++ ++ /* 54 */ "EMMC_D0 (BOOT_0)", ++ /* 55 */ "EMMC_D1 (BOOT_1)", ++ /* 56 */ "EMMC_D2 (BOOT_2)", ++ /* 57 */ "EMMC_D3 (BOOT_3)", ++ /* 58 */ "EMMC_D4 (BOOT_4)", ++ /* 59 */ "EMMC_D5 (BOOT_5)", ++ /* 60 */ "EMMC_D6 (BOOT_6)", ++ /* 61 */ "EMMC_D7 (BOOT_7)", ++ /* 62 */ "EMMC_CLK (BOOT_8)", ++ /* 63 */ "EMMC_nRST (BOOT_9)", ++ /* 64 */ "EMMC_CMD (BOOT_10)", ++ /* 65 */ "BOOT_11", ++ /* 66 */ "BOOT_12", ++ /* 67 */ "BOOT_13", ++ /* 68 */ "BOOT_14", ++ /* 69 */ "BOOT_15", ++ /* 70 */ "BOOT_16", ++ /* 71 */ "BOOT_17", ++ /* 72 */ "BOOT_18", ++ ++ /* 73 */ "ETH_RXD1 (DIF_0_P)", ++ /* 74 */ "ETH_RXD0 (DIF_0_N)", ++ /* 75 */ "ETH_RX_DV (DIF_1_P)", ++ /* 76 */ "ETH_RX_CLK (DIF_1_N)", ++ /* 77 */ "ETH_RXD3 (DIF_2_P)", ++ /* 78 */ "ETH_RXD2 (DIF_2_N)", ++ /* 79 */ "ETH_TX_EN (DIF_3_P)", ++ /* 80 */ "ETH_REF_CLK (DIF_3_N)", ++ /* 81 */ "ETH_MDC (DIF_4_P)", ++ /* 82 */ "ETH_MDIO_EN (DIF_4_N)"; ++}; ++ ++&gpio_ao { ++ gpio-line-names = ++ /* 0 */ "UART TX (GPIOAO_0)", ++ /* 1 */ "UART RX (GPIOAO_1)", ++ /* 2 */ "RED_LED (GPIOAO_2)", ++ /* 3 */ "GREEN_LED (GPIOAO_3)", ++ /* 4 */ "BLUE_LED (GPIOAO_4)", ++ /* 5 */ "BUTTON (GPIOAO_5)", ++ /* 6 */ "GPIOAO_6", ++ /* 7 */ "IR_IN (GPIOAO_7)", ++ /* 8 */ "GPIOAO_8", ++ /* 9 */ "GPIOAO_9", ++ /* 10 */ "GPIOAO_10", ++ /* 11 */ "GPIOAO_11", ++ /* 12 */ "GPIOAO_12", ++ /* 13 */ "GPIOAO_13", ++ ++ /* 14 */ "GPIO_BSD_EN", ++ /* 15 */ "GPIO_TEST_N"; ++}; ++ ++// eMMC ++&sdhc { ++ status = "okay"; ++ ++ pinctrl-0 = <&sdxc_c_pins>; ++ pinctrl-names = "default"; ++ ++ non-removable; ++ bus-width = <8>; ++ max-frequency = <200000000>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ ++ mmc-pwrseq = <&emmc_pwrseq>; ++ vmmc-supply = <&vcc_3v3>; ++ // vqmmc-supply = <&vcc_3v3>; ++}; ++ ++&sdio { ++ status = "okay"; ++ ++ pinctrl-0 = <&sd_b_pins>; ++ pinctrl-names = "default"; ++ ++ // SD card ++ sd_card_slot: slot@1 { ++ compatible = "mmc-slot"; ++ reg = <1>; ++ status = "okay"; ++ ++ bus-width = <4>; ++ no-sdio; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ ++ cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; ++ ++ vmmc-supply = <&vcc_3v3>; ++ // vqmmc-supply = <&vcc_3v3>; ++ }; ++}; ++ ++ðmac { ++ status = "okay"; ++ ++ pinctrl-0 = <ð_rgmii_pins>; ++ pinctrl-names = "default"; ++ ++ phy-handle = <ð_phy>; ++ phy-mode = "rgmii-rxid"; ++ ++ mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ // Realtek RTL8211F (0x001cc916) ++ eth_phy: ethernet-phy@0 { ++ reg = <0>; ++ ++ reset-assert-us = <10000>; ++ reset-deassert-us = <80000>; ++ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>; ++ ++ interrupt-parent = <&gpio_intc>; ++ interrupts = <17 IRQ_TYPE_LEVEL_LOW>; // GPIOH 3 ++ }; ++ }; ++}; ++ ++&usb0 { ++ status = "okay"; ++ dr_mode = "otg"; ++ usb-role-switch; ++ role-switch-default-mode = "host"; ++}; ++ ++&usb0_phy { ++ status = "okay"; ++}; ++ ++&usb1 { ++ status = "okay"; ++}; ++ ++&usb1_phy { ++ status = "okay"; ++}; ++ ++&ir_receiver { ++ status = "okay"; ++ pinctrl-0 = <&ir_recv_pins>; ++ pinctrl-names = "default"; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson-6.10/onecloud-0002-dts-Support-HDMI.patch b/patch/kernel/archive/meson-6.10/onecloud-0002-dts-Support-HDMI.patch new file mode 100644 index 000000000000..597a2676b2c1 --- /dev/null +++ b/patch/kernel/archive/meson-6.10/onecloud-0002-dts-Support-HDMI.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: hzy +Date: Sat, 1 Apr 2023 10:26:14 +0800 +Subject: ARM: dts: meson8b: onecloud: Support HDMI + +Signed-off-by: hzy +--- + arch/arm/boot/dts/amlogic/meson8b-onecloud.dts | 58 ++++++++++ + 1 file changed, 58 insertions(+) + +diff --git a/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts b/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts +index 111111111111..222222222222 100644 +--- a/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts ++++ b/arch/arm/boot/dts/amlogic/meson8b-onecloud.dts +@@ -80,6 +80,48 @@ blue { + }; + }; + ++ hdmi-connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_tx_tmds_out>; ++ }; ++ }; ++ }; ++ ++ sound { ++ compatible = "amlogic,gx-sound-card"; ++ ++ assigned-clocks = <&clkc CLKID_MPLL0>, ++ <&clkc CLKID_MPLL1>; ++ assigned-clock-rates = <294912000>, ++ <270950400>; ++ ++ dai-link-0 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>; ++ }; ++ ++ dai-link-1 { ++ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>; ++ dai-format = "i2s"; ++ mclk-fs = <256>; ++ ++ codec-0 { ++ sound-dai = <&aiu AIU_HDMI CTRL_I2S>; ++ }; ++ }; ++ ++ dai-link-2 { ++ sound-dai = <&aiu AIU_HDMI CTRL_OUT>; ++ ++ codec-0 { ++ sound-dai = <&hdmi_tx 0>; ++ }; ++ }; ++ }; ++ + p12v: regulator-p12v { + compatible = "regulator-fixed"; + +@@ -199,6 +241,10 @@ &mali { + // mali-supply = <&vcc_core>; + }; + ++&aiu { ++ status = "okay"; ++}; ++ + &gpio { + gpio-line-names = + /* 0 */ "WIFI_SDIO_D0 PIN18 (GPIOX_0)", +@@ -403,6 +449,18 @@ &usb1_phy { + status = "okay"; + }; + ++&hdmi_tx { ++ status = "okay"; ++ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&hdmi_tx_tmds_port { ++ hdmi_tx_tmds_out: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ + &ir_receiver { + status = "okay"; + pinctrl-0 = <&ir_recv_pins>; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/0000.patching_config.yaml b/patch/kernel/archive/meson64-6.10/0000.patching_config.yaml new file mode 100644 index 000000000000..393d991777f2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/0000.patching_config.yaml @@ -0,0 +1,38 @@ +config: + + # Just some info stuff; not used by the patching scripts + name: meson64-6.7 + kind: kernel + type: mainline # or: vendor + branch: linux-6.7.y + last-known-good-tag: v6.7.0 + maintainers: + - { github: rpardini, name: Ricardo Pardini, email: ricardo@pardini.net, armbian-forum: rpardini } + + # .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones. + # This is meant to provide a way to "add a board DTS" without having to null-patch them in. + dts-directories: + # will copy patch/kernel/archive/meson64-MAJOR.MINOR/dt-boards/*.dts to arch/arm64/boot/dts/amlogic + - { source: "dt", target: "arch/arm64/boot/dts/amlogic" } + + # every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones + # This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in. + # @TODO need a solution to auto-Makefile the overlays as well + overlay-directories: + # will copy patch/kernel/archive/meson64-MAJOR.MINOR/overlay/**/* to arch/arm64/boot/dts/amlogic/overlay + - { source: "overlay", target: "arch/arm64/boot/dts/amlogic/overlay" } + + # the Makefile in each of these directories will be magically patched to include the dts files copied + # or patched-in; overlay subdir will be included "-y" if it exists. + # No more Makefile patching needed, yay! + auto-patch-dt-makefile: + - { directory: "arch/arm64/boot/dts/amlogic", config-var: "CONFIG_ARCH_MESON" } + + # configuration for when applying patches to git / auto-rewriting patches (development cycle helpers) + patches-to-git: + do-not-commit-files: + - "MAINTAINERS" # constant churn, drop them. sorry. + - "Documentation/devicetree/bindings/arm/amlogic.yaml" # constant churn, conflicts on every bump, drop it. sorry. + do-not-commit-regexes: # Python-style regexes + - "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now + diff --git a/patch/kernel/archive/meson64-6.10/board-bananapi-cm4-cm4io.patch b/patch/kernel/archive/meson64-6.10/board-bananapi-cm4-cm4io.patch new file mode 100644 index 000000000000..2d8de7211968 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-bananapi-cm4-cm4io.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Tue, 25 Jul 2023 13:31:54 -0400 +Subject: arch: arm64: dts: amlogic: meson g12b bananapi cm4 + +Signed-off-by: Patrick Yavitz +--- + arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts | 9 +++++-- + arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4.dtsi | 12 ++++++++-- + 2 files changed, 17 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts +@@ -50,14 +50,15 @@ leds { + led-blue { + color = ; + function = LED_FUNCTION_STATUS; +- gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>; ++ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + + led-green { + color = ; + function = LED_FUNCTION_STATUS; +- gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; ++ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; ++ linux,default-trigger = "default-on"; + }; + }; + +@@ -116,6 +117,10 @@ codec { + }; + }; + ++&reboot { ++ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++}; ++ + &cecb_AO { + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4.dtsi +@@ -12,6 +12,15 @@ aliases { + rtc1 = &vrtc; + }; + ++ reboot: meson64-reboot { ++ compatible = "meson64,reboot"; ++ sys_reset = <0x84000009>; ++ sys_poweroff = <0x84000008>; ++ ++ sd-vqsw = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; ++ sd-vmmc = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +@@ -369,8 +378,7 @@ &uart_A { + + bluetooth { + compatible = "realtek,rtl8822cs-bt"; +- enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; +- host-wake-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>; ++ enable-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>; + device-wake-gpios = <&gpio GPIOX_18 GPIO_ACTIVE_HIGH>; + }; + }; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-bananapi-m2s.patch b/patch/kernel/archive/meson64-6.10/board-bananapi-m2s.patch new file mode 100644 index 000000000000..2ee977f5c7ed --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-bananapi-m2s.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Tue, 25 Jul 2023 13:34:18 -0400 +Subject: arch: arm64: dts: amlogic: meson g12b bananapi m2s + +Signed-off-by: Patrick Yavitz +--- + arch/arm64/boot/dts/amlogic/meson-g12b-a311d-bananapi-m2s.dts | 4 ++++ + arch/arm64/boot/dts/amlogic/meson-g12b-bananapi.dtsi | 9 +++++++++ + arch/arm64/boot/dts/amlogic/meson-g12b-s922x-bananapi-m2s.dts | 4 ++++ + 3 files changed, 17 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-bananapi-m2s.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-bananapi-m2s.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-bananapi-m2s.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d-bananapi-m2s.dts +@@ -18,6 +18,10 @@ aliases { + }; + }; + ++&reboot { ++ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++}; ++ + /* Camera (CSI) bus */ + &i2c1 { + status = "okay"; +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi.dtsi +@@ -17,6 +17,15 @@ aliases { + rtc1 = &vrtc; + }; + ++ reboot: meson64-reboot { ++ compatible = "meson64,reboot"; ++ sys_reset = <0x84000009>; ++ sys_poweroff = <0x84000008>; ++ ++ sd-vqsw = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; ++ sd-vmmc = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>; ++ }; ++ + chosen { + stdout-path = "serial0:115200n8"; + }; +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-bananapi-m2s.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-bananapi-m2s.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-bananapi-m2s.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x-bananapi-m2s.dts +@@ -12,3 +12,7 @@ / { + compatible = "bananapi,bpi-m2s", "amlogic,s922x", "amlogic,g12b"; + model = "BananaPi M2S"; + }; ++ ++&reboot { ++ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-bananapim5-001-sd-use-270-mmc-clock-phase-via-dt.patch b/patch/kernel/archive/meson64-6.10/board-bananapim5-001-sd-use-270-mmc-clock-phase-via-dt.patch new file mode 100644 index 000000000000..a7fc8f521eca --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-bananapim5-001-sd-use-270-mmc-clock-phase-via-dt.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Sat, 11 Feb 2023 18:30:00 +0100 +Subject: BananaPi M5: 270 clock phase, via amlogic,mmc-phase + +Rework of Ricardo Pardini patch. + +Signed-off-by: Igor Pecovnik +--- + arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + + / { + adc-keys { +@@ -394,6 +395,8 @@ &sd_emmc_b { + cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; + vmmc-supply = <&tflash_vdd>; + vqmmc-supply = <&vddio_c>; ++ ++ amlogic,mmc-phase = ; + }; + + /* eMMC */ +@@ -413,6 +416,8 @@ &sd_emmc_c { + mmc-pwrseq = <&emmc_pwrseq>; + vmmc-supply = <&vddao_3v3>; + vqmmc-supply = <&emmc_1v8>; ++ ++ amlogic,mmc-phase = ; + }; + + &uart_AO { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-bananapim5-002-add-wifi-bt-support.patch b/patch/kernel/archive/meson64-6.10/board-bananapim5-002-add-wifi-bt-support.patch new file mode 100644 index 000000000000..66db01e2cdb3 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-bananapim5-002-add-wifi-bt-support.patch @@ -0,0 +1,112 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Wed, 2 Aug 2023 19:36:07 -0400 +Subject: arch: arm64: dts: amlogic: add wifi/bt support to bananapi m5 + +The BPI-M5 has an optional RTL8822CS WiFi/BT mezzanine board. Describe +the board but mark the sd_emmc_a and uart_A nodes disabled so they can +be enabled via overlay or fdtput when the board is connected. + +Signed-off-by: Patrick Yavitz +--- + arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts | 66 +++++++++- + 1 file changed, 65 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +@@ -25,6 +25,20 @@ cvbs_connector_in: endpoint { + }; + }; + ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; ++ clocks = <&wifi32k>; ++ clock-names = "ext_clock"; ++ }; ++ ++ wifi32k: wifi32k { ++ compatible = "pwm-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ ++ }; ++ + sound { + compatible = "amlogic,axg-sound-card"; + model = "BPI-M5"; +@@ -149,7 +163,6 @@ &acodec { + status = "okay"; + }; + +- + &clkc_audio { + status = "okay"; + }; +@@ -172,6 +185,42 @@ &frddr_c { + status = "okay"; + }; + ++&pwm_ef { ++ status = "okay"; ++ pinctrl-0 = <&pwm_e_pins>; ++ pinctrl-names = "default"; ++}; ++ ++/* SDIO */ ++&sd_emmc_a { ++ /* enable if WiFi/BT board connected */ ++ status = "disabled"; ++ pinctrl-0 = <&sdio_pins>; ++ pinctrl-1 = <&sdio_clk_gate_pins>; ++ pinctrl-names = "default", "clk-gate"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ bus-width = <4>; ++ sd-uhs-sdr104; ++ max-frequency = <50000000>; ++ ++ non-removable; ++ disable-wp; ++ ++ /* WiFi firmware requires power in suspend */ ++ keep-power-in-suspend; ++ ++ mmc-pwrseq = <&sdio_pwrseq>; ++ ++ vmmc-supply = <&vddao_3v3>; ++ vqmmc-supply = <&vddao_1v8>; ++ ++ rtl8822cs: wifi@1 { ++ reg = <1>; ++ }; ++}; ++ + &tdmif_b { + status = "okay"; + }; +@@ -219,3 +268,18 @@ &toddr_b { + &toddr_c { + status = "okay"; + }; ++ ++&uart_A { ++ /* enable if WiFi/BT board connected */ ++ status = "disabled"; ++ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; ++ pinctrl-names = "default"; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "realtek,rtl8822cs-bt"; ++ enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; ++ host-wake-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>; ++ device-wake-gpios = <&gpio GPIOX_18 GPIO_ACTIVE_HIGH>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-bananapism1-add-uart_A-and-AO_B.patch b/patch/kernel/archive/meson64-6.10/board-bananapism1-add-uart_A-and-AO_B.patch new file mode 100644 index 000000000000..c3b48d2eb9ec --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-bananapism1-add-uart_A-and-AO_B.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Thu, 21 Sep 2023 07:46:59 -0400 +Subject: arm64: dts: amlogic: meson-sm1-bananapi: add uart A and AO_B + +Signed-off-by: Patrick Yavitz +--- + arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 9 +++++++++ + arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m2-pro.dts | 10 ++++++++++ + arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi | 7 +++++++ + 3 files changed, 26 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +@@ -1919,6 +1919,15 @@ mux { + }; + }; + ++ uart_ao_b_pins: uart-b-ao { ++ mux { ++ groups = "uart_ao_b_tx_8", ++ "uart_ao_b_rx_9"; ++ function = "uart_ao_b"; ++ bias-disable; ++ }; ++ }; ++ + uart_ao_a_cts_rts_pins: uart-ao-a-cts-rts { + mux { + groups = "uart_ao_a_cts", +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m2-pro.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m2-pro.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m2-pro.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m2-pro.dts +@@ -13,6 +13,10 @@ / { + compatible = "bananapi,bpi-m2-pro", "amlogic,sm1"; + model = "Banana Pi BPI-M2-PRO"; + ++ aliases { ++ serial1 = &uart_A; ++ }; ++ + sound { + compatible = "amlogic,axg-sound-card"; + model = "BPI-M2-PRO"; +@@ -95,3 +99,9 @@ &tdmout_b { + &tohdmitx { + status = "okay"; + }; ++ ++&uart_A { ++ status = "disabled"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart_a_pins>; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi +@@ -26,6 +26,7 @@ button-sw3 { + + aliases { + serial0 = &uart_AO; ++ serial4 = &uart_AO_B; + ethernet0 = ðmac; + }; + +@@ -426,6 +427,12 @@ &uart_AO { + pinctrl-names = "default"; + }; + ++&uart_AO_B { ++ status = "disabled"; ++ pinctrl-0 = <&uart_ao_b_pins>; ++ pinctrl-names = "default"; ++}; ++ + &usb { + status = "okay"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-khadas-vim3-fix-missing-i2c3-nod.patch b/patch/kernel/archive/meson64-6.10/board-khadas-vim3-fix-missing-i2c3-nod.patch new file mode 100644 index 000000000000..46cf86cb4ac0 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-khadas-vim3-fix-missing-i2c3-nod.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Fri, 21 Feb 2020 04:43:22 +0000 +Subject: WIP: arm64: dts: meson: khadas-vim3: fix missing i2c3 node + +Fixes: c6d29c66e582 ("arm64: dts: meson-g12b-khadas-vim3: add initial device-tree") + +The i2c3 node was missed in the original device-tree and is required for the +optional Khadas 3705 fan to work. + +Suggested-by: Art Nikpal +Signed-off-by: Christian Hewittt +--- + arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +@@ -332,6 +332,13 @@ hdmi_tx_tmds_out: endpoint { + }; + }; + ++&i2c3 { ++ clock-frequency = <100000>; ++ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &i2c_AO { + status = "okay"; + pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-khadas-vims-add-rtc-vrtc-aliases.patch b/patch/kernel/archive/meson64-6.10/board-khadas-vims-add-rtc-vrtc-aliases.patch new file mode 100644 index 000000000000..173fa7e50956 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-khadas-vims-add-rtc-vrtc-aliases.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 21 Jan 2021 01:35:36 +0000 +Subject: HACK: arm64: dts: meson: add rtc/vrtc aliases to Khadas VIM + +Add aliases to ensure the vrtc time (which normally proves first) is /dev/rtc1 +while the onboard rtc chip claims /dev/rtc0. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +@@ -29,6 +29,8 @@ button-function { + aliases { + serial2 = &uart_AO_B; + ethernet0 = ðmac; ++ rtc0 = &rtc; ++ rtc1 = &vrtc; + }; + + gpio-keys-polled { +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 6 Nov 2021 13:01:08 +0000 +Subject: HACK: arm64: dts: meson: add rtc/vrtc aliases to Khadas VIM2 + +Add aliases to ensure the vrtc time (which normally proves first) is /dev/rtc1 +while the onboard rtc chip claims /dev/rtc0. + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +@@ -18,6 +18,8 @@ / { + aliases { + serial0 = &uart_AO; + serial2 = &uart_AO_B; ++ rtc0 = &rtc; ++ rtc1 = &vrtc; + }; + + chosen { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-nanopi-k2-add-uartC-alias.patch b/patch/kernel/archive/meson64-6.10/board-nanopi-k2-add-uartC-alias.patch new file mode 100644 index 000000000000..f0e9918bd7db --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-nanopi-k2-add-uartC-alias.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Thu, 6 Dec 2018 18:03:17 -0500 +Subject: add uartC alias for nanopi-k2 + +add uartC alias for nanopi-k2 +- 839f2f151073928ed1e62d415ba5317f525b9e24: 1553615840: Martin Ayotte : 'add uartA overlay for Odroid-C2' +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +@@ -15,6 +15,7 @@ / { + + aliases { + serial0 = &uart_AO; ++ serial2 = &uart_C; + ethernet0 = ðmac; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-nanopi-k2-enable-emmc.patch b/patch/kernel/archive/meson64-6.10/board-nanopi-k2-enable-emmc.patch new file mode 100644 index 000000000000..1ca16d7ef26b --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-nanopi-k2-enable-emmc.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Tue, 4 Jun 2019 21:35:48 +0200 +Subject: nanopik2 - enable eMMC + +[ nanopik2 ] enable eMMC support for u-boot and kernel +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +@@ -358,7 +358,7 @@ &sd_emmc_b { + + /* eMMC */ + &sd_emmc_c { +- status = "disabled"; ++ status = "okay"; + pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; + pinctrl-1 = <&emmc_clk_gate_pins>; + pinctrl-names = "default", "clk-gate"; +@@ -368,8 +368,6 @@ &sd_emmc_c { + non-removable; + disable-wp; + cap-mmc-highspeed; +- mmc-ddr-1_8v; +- mmc-hs200-1_8v; + + mmc-pwrseq = <&emmc_pwrseq>; + vmmc-supply = <&vcc3v3>; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidc2-add-uartA-uartC.patch b/patch/kernel/archive/meson64-6.10/board-odroidc2-add-uartA-uartC.patch new file mode 100644 index 000000000000..9388fecc5d67 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidc2-add-uartA-uartC.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Thu, 26 Oct 2017 16:31:22 +0300 +Subject: add uartA and uartC for Odroid-C2 + +add uartA and uartC for Odroid-C2 + +- 839f2f151073928ed1e62d415ba5317f525b9e24: Martin Ayotte : 'add uartA overlay for Odroid-C2' +- b5c9e6ee8d4a97c5092109a12164c131eb4b46e9: Martin Ayotte : 'add uartA for odroidc2 in NEXT' +- 22ca2b92a002fe22e2a61428741618295c424664: Martin Ayotte : 'fix missing pinctrl-0 for ODroidC2 uartA' +- 140da6ad43f4a0d47c221271f62bb7c0a57064ea: Martin Ayotte : 'add uartC to OdroidC2' +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 14 ++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +@@ -17,6 +17,8 @@ / { + + aliases { + serial0 = &uart_AO; ++ serial1 = &uart_A; ++ serial2 = &uart_C; + ethernet0 = ðmac; + }; + +@@ -383,6 +385,18 @@ &uart_AO { + pinctrl-names = "default"; + }; + ++&uart_A { ++ status = "disabled"; ++ pinctrl-0 = <&uart_a_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&uart_C { ++ status = "disabled"; ++ pinctrl-0 = <&uart_c_pins>; ++ pinctrl-names = "default"; ++}; ++ + &usb0_phy { + status = "disabled"; + phy-supply = <&usb_otg_pwr>; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidc2-enable-SPI.patch b/patch/kernel/archive/meson64-6.10/board-odroidc2-enable-SPI.patch new file mode 100644 index 000000000000..7c070a0abae3 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidc2-enable-SPI.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas McKahan +Date: Sat, 6 Oct 2018 22:50:14 -0400 +Subject: Odroid C2 enable SPI + +Odroid C2 enable SPI + +- f928b31d8a1983fd8cfd9c97de084e532283b106: 1543550719: Thomas McKahan : '[ meson64-dev ] fix Odroid C2 boot, add spidev' +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 26 ++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +@@ -176,6 +176,32 @@ hdmi_connector_in: endpoint { + }; + }; + ++ spi-gpio { ++ compatible = "spi-gpio"; ++ #address-cells = <0x1>; ++ #size-cells = <0x0>; ++ ranges; ++ status = "disabled"; ++ sck-gpios = <&gpio GPIOX_2 0>; ++ miso-gpios = <&gpio GPIOX_4 0>; ++ mosi-gpios = <&gpio GPIOX_7 0>; ++ cs-gpios = <&gpio GPIOX_3 0 ++ &gpio GPIOX_1 0>; ++ num-chipselects = <2>; ++ ++ /* clients */ ++ spidev0@0 { ++ compatible = "armbian,spi-dev"; ++ reg = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ spidev0@1 { ++ compatible = "armbian,spi-dev"; ++ reg = <1>; ++ spi-max-frequency = <500000>; ++ }; ++ }; ++ + sound { + compatible = "amlogic,gx-sound-card"; + model = "ODROID-C2"; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidc2-enable-scpi-dvfs.patch b/patch/kernel/archive/meson64-6.10/board-odroidc2-enable-scpi-dvfs.patch new file mode 100644 index 000000000000..be0dc2ae930f --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidc2-enable-scpi-dvfs.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: zador-blood-stained +Date: Thu, 26 Oct 2017 16:31:22 +0300 +Subject: Enable odroidc2-dev DVFS + +Enable odroidc2-dev DVFS (#763) +--- + arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +@@ -360,7 +360,8 @@ &saradc { + }; + + &scpi_clocks { +- status = "disabled"; ++ /* Works only with new blobs that have limited DVFS table */ ++ status = "okay"; + }; + + /* SD */ +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidc2-usb-hub-disable-autosuspend-for-Genesys-Logic-.patch b/patch/kernel/archive/meson64-6.10/board-odroidc2-usb-hub-disable-autosuspend-for-Genesys-Logic-.patch new file mode 100644 index 000000000000..10907691e923 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidc2-usb-hub-disable-autosuspend-for-Genesys-Logic-.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Mon, 3 Jan 2022 10:44:17 +0000 +Subject: LOCAL: usb: hub: disable autosuspend for Genesys Logic Hubs + +Disable autosuspend in Genesys Logic hubs to allow USB devices on the +Odroid C2 board to be used. The alternative to this patch is setting +usbcore.autosuspend=-1 in boot params. + +This patch only impacts GXBB devices as GXL/GXM onwards use the newer +dwc3 core which does not have the problem. + +Signed-off-by: Christian Hewitt +--- + drivers/usb/core/hub.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 111111111111..222222222222 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5965,7 +5965,7 @@ static const struct usb_device_id hub_id_table[] = { + | USB_DEVICE_ID_MATCH_INT_CLASS, + .idVendor = USB_VENDOR_GENESYS_LOGIC, + .bInterfaceClass = USB_CLASS_HUB, +- .driver_info = HUB_QUIRK_CHECK_PORT_AUTOSUSPEND}, ++ .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR + | USB_DEVICE_ID_MATCH_PRODUCT, + .idVendor = USB_VENDOR_TEXAS_INSTRUMENTS, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidc4-reset.patch b/patch/kernel/archive/meson64-6.10/board-odroidc4-reset.patch new file mode 100644 index 000000000000..8ad61c277cc6 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidc4-reset.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ash Hughes +Date: Sat, 18 Feb 2023 07:46:38 -0300 +Subject: adapted meson64-reboot driver, fix reboot on odroid C4 when using + UHS-II SD cards + +bring back fixed version of `odroid-reboot` driver (Fix reboot on odroid C4 when using UHS-II SD cards) +--- + arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts +@@ -11,6 +11,16 @@ / { + compatible = "hardkernel,odroid-c4", "amlogic,sm1"; + model = "Hardkernel ODROID-C4"; + ++ meson64-reboot { ++ compatible = "meson64,reboot"; ++ sys_reset = <0x84000009>; ++ sys_poweroff = <0x84000008>; ++ ++ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; ++ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; ++ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; ++ }; ++ + leds { + compatible = "gpio-leds"; + +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidhc4-enable-fan1_input.patch b/patch/kernel/archive/meson64-6.10/board-odroidhc4-enable-fan1_input.patch new file mode 100644 index 000000000000..26720cb2eb82 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidhc4-enable-fan1_input.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ricardo Pardini +Date: Sun, 26 Jun 2022 03:47:06 +0200 +Subject: ODROID-HC4: add DT attributes to enable fan1_input + +- from vendor kernel modified DT +- this allows userspace fancontrol/pwmconfig to work +--- + arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts +@@ -21,6 +21,10 @@ fan0: pwm-fan { + #cooling-cells = <2>; + cooling-levels = <0 120 170 220>; + pwms = <&pwm_cd 1 40000 0>; ++ fan-supply = <&vcc_5v>; ++ interrupt-parent = <&gpio_intc>; ++ interrupts = <84 IRQ_TYPE_EDGE_FALLING>; ++ pulses-per-revolutions = <2>; + }; + + leds { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-odroidn2plus-Add-missing-CPU-opp.patch b/patch/kernel/archive/meson64-6.10/board-odroidn2plus-Add-missing-CPU-opp.patch new file mode 100644 index 000000000000..d6511912b49c --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-odroidn2plus-Add-missing-CPU-opp.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Wed, 10 Feb 2021 18:07:08 +0100 +Subject: Add missing CPU opp values for clocking g12b / N2+ higher + +Signed-off-by: Igor Pecovnik +--- + arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 16 ++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi +@@ -45,6 +45,14 @@ opp-1800000000 { + opp-hz = /bits/ 64 <1800000000>; + opp-microvolt = <1001000>; + }; ++ opp-1908000000 { ++ opp-hz = /bits/ 64 <1908000000>; ++ opp-microvolt = <1030000>; ++ }; ++ opp-2016000000 { ++ opp-hz = /bits/ 64 <2016000000>; ++ opp-microvolt = <1040000>; ++ }; + }; + + cpub_opp_table_1: opp-table-1 { +@@ -105,5 +113,13 @@ opp-2208000000 { + opp-hz = /bits/ 64 <2208000000>; + opp-microvolt = <1011000>; + }; ++ opp-2304000000 { ++ opp-hz = /bits/ 64 <2304000000>; ++ opp-microvolt = <1030000>; ++ }; ++ opp-2400000000 { ++ opp-hz = /bits/ 64 <2400000000>; ++ opp-microvolt = <1040000>; ++ }; + }; + }; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-aliases-for-serial-i2c-and-spi.patch b/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-aliases-for-serial-i2c-and-spi.patch new file mode 100644 index 000000000000..720442f1255a --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-aliases-for-serial-i2c-and-spi.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Tue, 24 Oct 2023 08:17:17 -0400 +Subject: arm64: dts: Radxa Zero: set aliases for serial, i2c and spi + +Signed-off-by: Patrick Yavitz +--- + arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts | 12 ++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts +@@ -15,6 +15,18 @@ / { + + aliases { + serial0 = &uart_AO; ++ serial1 = &uart_AO_B; ++ serial2 = &uart_A; ++ serial3 = &uart_B; ++ serial4 = &uart_C; ++ i2c0 = &i2c0; ++ i2c1 = &i2c1; ++ i2c2 = &i2c2; ++ i2c3 = &i2c3; ++ i2c4 = &i2c_AO; ++ spi0 = &spicc0; ++ spi1 = &spicc1; ++ spi2 = &spifc; + }; + + chosen { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-support-for-the-usb-c-controller.patch b/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-support-for-the-usb-c-controller.patch new file mode 100644 index 000000000000..291b3494922d --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-add-support-for-the-usb-c-controller.patch @@ -0,0 +1,104 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 17 Aug 2021 16:16:43 +0000 +Subject: arm64: dts: meson: radxa-zero: add support for the usb type-c + controller + +Radxa Zero uses an FUSB302 type-c controller, so lets enable it. + +NB: Polarity swapping via GPIO is not implemented in the current driver +(see drivers/usb/typec/tcpm/fusb302.c) so it is not possible to handle +GPIOAO_6 for USB3 polarity control. + +Includes: +- arm64: dts: amlogic: fix interrupt storm from fusb302 on Radxa Zero + it makes load average >1. use correct pin for interrupt from fusb302. + +Signed-off-by: FUKAUMI Naoki +Suggested-by: Neil Armstrong +Signed-off-by: Christian Hewitt +Signed-off-by: Yuntian Zhang +--- + arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts | 48 ++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts +@@ -72,6 +72,14 @@ sdio_pwrseq: sdio-pwrseq { + clock-names = "ext_clock"; + }; + ++ typec2_vbus: regulator-typec2_vbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "TYPEC2_VBUS"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&ao_5v>; ++ }; ++ + ao_5v: regulator-ao-5v { + compatible = "regulator-fixed"; + regulator-name = "AO_5V"; +@@ -202,6 +210,18 @@ wifi32k: wifi32k { + }; + }; + ++&ao_pinctrl { ++ /* Ensure the TYPE C controller irq pin is not driven by the SoC */ ++ fusb302_irq_pins: fusb302_irq { ++ mux { ++ groups = "GPIOAO_5"; ++ function = "gpio_aobus"; ++ bias-pull-up; ++ output-disable; ++ }; ++ }; ++}; ++ + &arb { + status = "okay"; + }; +@@ -289,6 +309,26 @@ &ir { + pinctrl-names = "default"; + }; + ++&i2c3 { ++ pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ fusb302@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ ++ pinctrl-0 = <&fusb302_irq_pins>; ++ pinctrl-names = "default"; ++ interrupt-parent = <&gpio_intc>; ++ interrupts = <5 IRQ_TYPE_LEVEL_LOW>; ++ ++ vbus-supply = <&typec2_vbus>; ++ ++ status = "okay"; ++ }; ++}; ++ + &pwm_AO_cd { + pinctrl-0 = <&pwm_ao_d_e_pins>; + pinctrl-names = "default"; +@@ -413,3 +453,11 @@ &uart_AO { + &usb { + status = "okay"; + }; ++ ++&usb2_phy0 { ++ phy-supply = <&typec2_vbus>; ++}; ++ ++&usb3_pcie_phy { ++ phy-supply = <&typec2_vbus>; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-slow-down-sdio-for-working-wifi.patch b/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-slow-down-sdio-for-working-wifi.patch new file mode 100644 index 000000000000..d7aea9f2b106 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-radxa-zero-dts-slow-down-sdio-for-working-wifi.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yuntian Zhang +Date: Mon, 27 Jun 2022 15:06:32 +0800 +Subject: VENDOR: Radxa Zero Wi-Fi fix + +Credit: pyavitz from Armbian + +Signed-off-by: Yuntian Zhang +Signed-off-by: Patrick Yavitz +--- + arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts +@@ -361,7 +361,7 @@ &sd_emmc_a { + + bus-width = <4>; + cap-sd-highspeed; +- sd-uhs-sdr50; ++ cap-mmc-highspeed; + max-frequency = <100000000>; + + non-removable; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/board-t95z-add-rc-remote-keymap.patch b/patch/kernel/archive/meson64-6.10/board-t95z-add-rc-remote-keymap.patch new file mode 100644 index 000000000000..6c1722129a90 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/board-t95z-add-rc-remote-keymap.patch @@ -0,0 +1,153 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Mon, 13 Feb 2023 11:38:16 +0000 +Subject: add rc keymaps for Sunvell T95Z Plus + +WIP: media: rc: add keymap for Sunvell T95Z Plus +WIP: dt-bindings: media: rc: add rc-sunvell-t95z-plus +Add a binding for the rc-sunvell-t95z-plus remote keymap +WIP: dt-bindings: add sunvell vendor prefix +Add vendor prefix for Shenzhen Sunvell Electronics Co., Ltd + +Signed-off-by: Christian Hewitt +--- + Documentation/devicetree/bindings/media/rc.yaml | 1 + + Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 + + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c | 75 ++++++++++ + include/media/rc-map.h | 1 + + 5 files changed, 80 insertions(+) + +diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/media/rc.yaml ++++ b/Documentation/devicetree/bindings/media/rc.yaml +@@ -127,6 +127,7 @@ properties: + - rc-reddo + - rc-snapstream-firefly + - rc-streamzap ++ - rc-sunvell-t95z-plus + - rc-su3000 + - rc-tanix-tx3mini + - rc-tanix-tx5max +diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml ++++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml +@@ -1411,6 +1411,8 @@ patternProperties: + description: Sundance DSP Inc. + "^sunplus,.*": + description: Sunplus Technology Co., Ltd. ++ "^sunvell,.*": ++ description: Shenzhen Sunvell Electronics Co., Ltd + "^SUNW,.*": + description: Sun Microsystems, Inc + "^supermicro,.*": +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -107,6 +107,7 @@ obj-$(CONFIG_RC_MAP) += \ + rc-reddo.o \ + rc-snapstream-firefly.o \ + rc-streamzap.o \ ++ rc-sunvell-t95z-plus.o \ + rc-su3000.o \ + rc-tanix-tx3mini.o \ + rc-tanix-tx5max.o \ +diff --git a/drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c b/drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-sunvell-t95z-plus.c +@@ -0,0 +1,75 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (c) 2023 Christian Hewitt ++#include ++ ++/* ++ * Keytable for Sunvell T95Z Plus remote control ++ * ++ */ ++ ++static struct rc_map_table sunvell_t95z_plus[] = { ++ { 0xdf1c, KEY_POWER }, ++ // TV CONTROLS ++ ++ { 0xdf4b, KEY_PREVIOUS }, ++ { 0xdf01, KEY_SCREEN }, // TV ++ { 0xdf5d, KEY_VOLUMEUP }, ++ ++ { 0xdf4f, KEY_NEXT }, ++ { 0xdf5f, KEY_FAVORITES }, // KODI ++ { 0xdf5c, KEY_VOLUMEDOWN }, ++ ++ { 0xdf42, KEY_HOME }, ++ { 0xdf0a, KEY_BACK }, ++ ++ { 0xdf1a, KEY_UP }, ++ { 0xdf47, KEY_LEFT }, ++ { 0xdf06, KEY_ENTER }, ++ { 0xdf07, KEY_RIGHT }, ++ { 0xdf48, KEY_DOWN }, ++ ++ { 0xdf03, KEY_INFO }, // MOUSE ++ { 0xdf18, KEY_MENU }, ++ ++ { 0xdf54, KEY_1 }, ++ { 0xdf16, KEY_2 }, ++ { 0xdf15, KEY_3 }, ++ { 0xdf50, KEY_4 }, ++ { 0xdf12, KEY_5 }, ++ { 0xdf11, KEY_6 }, ++ { 0xdf4c, KEY_7 }, ++ { 0xdf0e, KEY_8 }, ++ { 0xdf0d, KEY_9 }, ++ { 0xdf41, KEY_WWW }, // WORLD ++ { 0xdf0c, KEY_0 }, ++ { 0xdf10, KEY_DELETE }, ++}; ++ ++static struct rc_map_list sunvell_t95z_plus_map = { ++ .map = { ++ .scan = sunvell_t95z_plus, ++ .size = ARRAY_SIZE(sunvell_t95z_plus), ++ .rc_proto = RC_PROTO_NEC, ++ .name = RC_MAP_SUNVELL_T95Z_PLUS, ++ } ++}; ++ ++static int __init init_rc_map_sunvell_t95z_plus(void) ++{ ++ return rc_map_register(&sunvell_t95z_plus_map); ++} ++ ++static void __exit exit_rc_map_sunvell_t95z_plus(void) ++{ ++ rc_map_unregister(&sunvell_t95z_plus_map); ++} ++ ++module_init(init_rc_map_sunvell_t95z_plus) ++module_exit(exit_rc_map_sunvell_t95z_plus) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Christian Hewitt "); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 111111111111..222222222222 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -314,6 +314,7 @@ struct rc_map *rc_map_get(const char *name); + #define RC_MAP_REDDO "rc-reddo" + #define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly" + #define RC_MAP_STREAMZAP "rc-streamzap" ++#define RC_MAP_SUNVELL_T95Z_PLUS "rc-sunvell-t95z-plus" + #define RC_MAP_SU3000 "rc-su3000" + #define RC_MAP_TANIX_TX3MINI "rc-tanix-tx3mini" + #define RC_MAP_TANIX_TX5MAX "rc-tanix-tx5max" +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/driver-power-meson64-reset.patch b/patch/kernel/archive/meson64-6.10/driver-power-meson64-reset.patch new file mode 100644 index 000000000000..7197289a5f33 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/driver-power-meson64-reset.patch @@ -0,0 +1,236 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Thu, 1 Jun 2023 06:32:23 +0200 +Subject: pyavitz meson64-generalized `odroid-reboot` driver + +--- + drivers/power/reset/Kconfig | 7 + + drivers/power/reset/Makefile | 1 + + drivers/power/reset/meson64-reboot.c | 186 ++++++++++ + 3 files changed, 194 insertions(+) + +diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/power/reset/Kconfig ++++ b/drivers/power/reset/Kconfig +@@ -148,6 +148,13 @@ config POWER_RESET_ODROID_GO_ULTRA_POWEROFF + help + This driver supports Power off for Odroid Go Ultra device. + ++config POWER_RESET_MESON64 ++ bool "Meson64 reboot/power-off driver" ++ depends on ARCH_MESON ++ help ++ The driver supports restart / power off for amlogic ++ g12a, g12b and sm1 SoCs ++ + config POWER_RESET_PIIX4_POWEROFF + tristate "Intel PIIX4 power-off driver" + depends on PCI +diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/power/reset/Makefile ++++ b/drivers/power/reset/Makefile +@@ -14,6 +14,7 @@ obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o + obj-$(CONFIG_POWER_RESET_LINKSTATION) += linkstation-poweroff.o + obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o + obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o ++obj-$(CONFIG_POWER_RESET_MESON64) += meson64-reboot.o + obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o + obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o + obj-$(CONFIG_POWER_RESET_ODROID_GO_ULTRA_POWEROFF) += odroid-go-ultra-poweroff.o +diff --git a/drivers/power/reset/meson64-reboot.c b/drivers/power/reset/meson64-reboot.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/power/reset/meson64-reboot.c +@@ -0,0 +1,186 @@ ++// SPDX-License-Identifier: (GPL-2.0) ++/* ++ * drivers/power/reset/meson64-reboot.c ++ * ++ * Copyright (C) 2017 Amlogic, Inc. All rights reserved. ++ * Copyright (C) 2023 Ash Hughes (sehguh.hsa@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. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++int sd_vqsw; ++int sd_vmmc; ++int sd_vqen; ++ ++static u32 psci_function_id_restart; ++static u32 psci_function_id_poweroff; ++ ++#define CHECK_RET(ret) { \ ++ if (ret) \ ++ pr_err("[%s] gpio op failed(%d) at line %d\n",\ ++ __func__, ret, __LINE__); \ ++} ++ ++static noinline int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, ++ u64 arg2) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc((unsigned long)function_id, ++ (unsigned long)arg0, ++ (unsigned long)arg1, ++ (unsigned long)arg2, ++ 0, 0, 0, 0, &res); ++ return res.a0; ++} ++ ++void meson64_card_reset(void) ++{ ++ int ret = 0; ++ ++ if ((sd_vqsw == 0) && (sd_vmmc == 0)) ++ return; ++ ++ if (sd_vqen == 0) { ++ gpio_free(sd_vqsw); ++ gpio_free(sd_vmmc); ++ ret = gpio_request_one(sd_vqsw, ++ GPIOF_OUT_INIT_LOW, "REBOOT"); ++ CHECK_RET(ret); ++ mdelay(10); ++ ret = gpio_direction_output(sd_vqsw, 1); ++ CHECK_RET(ret); ++ ret = gpio_request_one(sd_vmmc, ++ GPIOF_OUT_INIT_LOW, "REBOOT"); ++ CHECK_RET(ret); ++ mdelay(10); ++ ret = gpio_direction_output(sd_vqsw, 0); ++ CHECK_RET(ret); ++ ret = gpio_direction_output(sd_vmmc, 1); ++ CHECK_RET(ret); ++ mdelay(5); ++ gpio_free(sd_vqsw); ++ gpio_free(sd_vmmc); ++ } else { ++ gpio_free(sd_vqsw); ++ gpio_free(sd_vqen); ++ gpio_free(sd_vmmc); ++ ++ ret = gpio_request_one(sd_vqsw, ++ GPIOF_OUT_INIT_LOW, "REBOOT"); ++ CHECK_RET(ret); ++ ret = gpio_request_one(sd_vqen, ++ GPIOF_OUT_INIT_LOW, "REBOOT"); ++ CHECK_RET(ret); ++ ret = gpio_request_one(sd_vmmc, ++ GPIOF_OUT_INIT_LOW, "REBOOT"); ++ CHECK_RET(ret); ++ mdelay(100); ++ ret = gpio_direction_input(sd_vqen); ++ CHECK_RET(ret); ++ ret = gpio_direction_input(sd_vmmc); ++ CHECK_RET(ret); ++ ret = gpio_direction_input(sd_vqsw); ++ CHECK_RET(ret); ++ mdelay(5); ++ gpio_free(sd_vqen); ++ gpio_free(sd_vmmc); ++ gpio_free(sd_vqsw); ++ } ++} ++ ++static int do_meson64_restart(struct notifier_block *this, unsigned long mode, void *cmd) ++{ ++ meson64_card_reset(); ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block meson64_restart_handler = { ++ .notifier_call = do_meson64_restart, ++ .priority = 130, ++}; ++ ++static void do_meson64_poweroff(void) ++{ ++ meson64_card_reset(); ++ ++ __invoke_psci_fn_smc(0x82000042, 1, 0, 0); ++} ++ ++static int meson64_restart_probe(struct platform_device *pdev) ++{ ++ struct device_node *of_node; ++ u32 id; ++ ++ if (!of_property_read_u32(pdev->dev.of_node, "sys_reset", &id)) { ++ psci_function_id_restart = id; ++ register_restart_handler(&meson64_restart_handler); ++ } ++ ++ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) { ++ psci_function_id_poweroff = id; ++ pm_power_off = do_meson64_poweroff; ++ } ++ ++ of_node = pdev->dev.of_node; ++ ++ sd_vqsw = of_get_named_gpio(of_node, "sd-vqsw", 0); ++ if (!gpio_is_valid(sd_vqsw)) sd_vqsw = 0; ++ ++ sd_vmmc = of_get_named_gpio(of_node, "sd-vmmc", 0); ++ if (!gpio_is_valid(sd_vmmc)) sd_vmmc = 0; ++ ++ sd_vqen = of_get_named_gpio(of_node, "sd-vqen", 0); ++ if (!gpio_is_valid(sd_vqen)) sd_vqen = 0; ++ ++ return 0; ++} ++ ++static const struct of_device_id of_meson64_restart_match[] = { ++ { .compatible = "meson64,reboot", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, of_meson64_restart_match); ++ ++static struct platform_driver meson64_restart_driver = { ++ .probe = meson64_restart_probe, ++ .driver = { ++ .name = "meson64-restart", ++ .of_match_table = of_match_ptr(of_meson64_restart_match), ++ }, ++}; ++ ++static int __init meson64_restart_init(void) ++{ ++ return platform_driver_register(&meson64_restart_driver); ++} ++device_initcall(meson64_restart_init); ++ +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/drv-spi-spidev-remove-warnings.patch b/patch/kernel/archive/meson64-6.10/drv-spi-spidev-remove-warnings.patch new file mode 100644 index 000000000000..80987aa16384 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/drv-spi-spidev-remove-warnings.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Doe +Date: Wed, 14 Aug 2024 16:33:07 +0000 +Subject: rockchip64: edge: 6.10.5 drv:spi:spidev remove warnings + +Signed-off-by: John Doe +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 5304728c6..64c4280de 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -698,10 +698,11 @@ static const struct file_operations spidev_fops = { + static const struct class spidev_class = { + .name = "spidev", + }; + + static const struct spi_device_id spidev_spi_ids[] = { ++ { .name = "spi-dev" }, + { .name = "bh2228fv" }, + { .name = "dh2228fv" }, + { .name = "ltc2488" }, + { .name = "sx1301" }, + { .name = "bk4" }, +@@ -727,10 +728,11 @@ static int spidev_of_check(struct device *dev) + dev_err(dev, "spidev listed directly in DT is not supported\n"); + return -EINVAL; + } + + static const struct of_device_id spidev_dt_ids[] = { ++ { .compatible = "armbian,spi-dev", .data = &spidev_of_check }, + { .compatible = "cisco,spi-petra", .data = &spidev_of_check }, + { .compatible = "dh,dhcom-board", .data = &spidev_of_check }, + { .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check }, + { .compatible = "lwn,bk4", .data = &spidev_of_check }, + { .compatible = "menlo,m53cpld", .data = &spidev_of_check }, +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-axg-amper-gateway-am-gz80x.dts b/patch/kernel/archive/meson64-6.10/dt/meson-axg-amper-gateway-am-gz80x.dts new file mode 100644 index 000000000000..99b4cd095218 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-axg-amper-gateway-am-gz80x.dts @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 Patrick Yavitz + * + */ + +/dts-v1/; + +#include "meson-axg-jethome-jethub-j1xx.dtsi" +#include + +/ { + compatible = "amper,gateway-am-gz80x", "amlogic,a113x", "amlogic,meson-axg"; + model = "Amper Gateway AM-GZ80x"; + + aliases { + serial0 = &uart_AO; + serial1 = &uart_B; + serial2 = &uart_AO_B; + ethernet0 = ðmac; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led-blue { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + + led-green { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mmc1"; + }; + + led-red { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "usb-host"; + }; + }; + + /* 1024MB RAM */ + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x40000000>; + }; +}; + +/delete-node/ &i2c1; + +/* wifi module */ +&sd_emmc_b { + non-removable; + + rtl8189ftv: wifi@1 { + reg = <1>; + }; +}; + +&uart_B { + status = "okay"; + pinctrl-0 = <&uart_b_z_pins>; + pinctrl-names = "default"; +}; + +/* UART Wireless module */ +&uart_AO_B { + status = "okay"; + pinctrl-0 = <&uart_ao_b_z_pins>; + pinctrl-names = "default"; + reset-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>; +}; + +&usb_pwr { + gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>; + enable-active-high; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12-enable-spinor.dtsi b/patch/kernel/archive/meson64-6.10/dt/meson-g12-enable-spinor.dtsi new file mode 100644 index 000000000000..a6f11e8cdfbe --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12-enable-spinor.dtsi @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/* + * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0, and change bus-width to 4 then spifc can be enabled. + */ +&sd_emmc_c { + pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>; + bus-width = <4>; +}; + +&spifc { + status = "okay"; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12a-radxa-zero-spidev.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12a-radxa-zero-spidev.dts new file mode 100644 index 000000000000..5ee13525d158 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12a-radxa-zero-spidev.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12a-radxa-zero.dts" + +/ { + model = "Radxa Zero with SPIDEV and I2C - MOSI pin 19, CLK pin 23 - SDA pin 3, SCL pin 5"; +}; + +&spicc1 { + pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "okay"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sck_a_pins &i2c3_sda_a_pins>; + pinctrl-names = "default"; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spidev.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spidev.dts new file mode 100644 index 000000000000..8982a04c9d1f --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spidev.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12b-a311d-khadas-vim3.dts" + +/ { + model = "Khadas VIM3 with SPIDEV and I2C - MOSI pin 37, CLK pin 16 - SDA pin 23, SCL pin 23"; +}; + +&spicc1 { + pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "okay"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sck_a_pins &i2c3_sda_a_pins>; + pinctrl-names = "default"; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spinor.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spinor.dts new file mode 100644 index 000000000000..e21dd8fd3e00 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-a311d-khadas-vim3-spinor.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12b-a311d-khadas-vim3.dts" + +/ { + model = "Khadas VIM3 with SPI NOR flash"; +}; + +#include "meson-g12-enable-spinor.dtsi" diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spidev.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spidev.dts new file mode 100644 index 000000000000..a87ddd464773 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spidev.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12b-odroid-n2-plus.dts" + +/ { + model = "Hardkernel ODROID-N2Plus with SPIDEV - MISO is pin 19, CLK is pin 23"; +}; + +&spicc0 { + cs-gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>; + status = "okay"; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "okay"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spinor.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spinor.dts new file mode 100644 index 000000000000..0677d7725b01 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-plus-spinor.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12b-odroid-n2-plus.dts" + +/ { + model = "Hardkernel ODROID-N2Plus with SPI NOR flash"; +}; + +#include "meson-g12-enable-spinor.dtsi" diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-spinor.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-spinor.dts new file mode 100644 index 000000000000..521498d9f6fa --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-odroid-n2-spinor.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12b-odroid-n2.dts" + +/ { + model = "Hardkernel ODROID-N2 with SPI NOR flash"; +}; + +#include "meson-g12-enable-spinor.dtsi" diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-radxa-zero2-spidev.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-radxa-zero2-spidev.dts new file mode 100644 index 000000000000..0d16cde214a7 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-radxa-zero2-spidev.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-g12b-radxa-zero2.dts" + +/ { + model = "Radxa Zero2 with SPIDEV and I2C - MOSI pin 19, CLK pin 23 - SDA pin 3, SCL pin 5"; +}; + +&spicc1 { + pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "okay"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sck_a_pins &i2c3_sda_a_pins>; + pinctrl-names = "default"; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-g12b-waveshare-cm4-io-base-b.dts b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-waveshare-cm4-io-base-b.dts new file mode 100644 index 000000000000..3957c8592730 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-g12b-waveshare-cm4-io-base-b.dts @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 Patrick Yavitz + */ + +/dts-v1/; + +#include "meson-g12b-bananapi-cm4-cm4io.dts" + +/ { + compatible = "bananapi,bpi-cm4io", "bananapi,bpi-cm4", "amlogic,a311d", "amlogic,g12b"; + model = "Waveshare CM4-IO-BASE-B with BPI-CM4 Module"; + + aliases { + rtc0 = &rtc; + }; +}; + +&i2c1 { + rtc: rtc@51 { + compatible = "nxp,pcf85063a"; + reg = <0x51>; + wakeup-source; + }; + + fanctrl: emc2305@2f { + compatible = "smsc,emc2305"; + reg = <0x2f>; + #cooling-cells = <0x02>; + wakeup-source; + }; +}; + +&cpu_thermal { + trips { + fanmid0: fanmid0 { + temperature = <60000>; + hysteresis = <2000>; + type = "active"; + }; + + fanmax0: fanmax0 { + temperature = <65000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map0 { + trip = <&fanmid0>; + cooling-device = <&fanctrl 2 6>; + }; + + map1 { + trip = <&fanmax0>; + cooling-device = <&fanctrl 7 THERMAL_NO_LIMIT>; + }; + }; +}; + +&usb { + dr_mode = "host"; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-gxm-mini-m8s-pro.dts b/patch/kernel/archive/meson64-6.10/dt/meson-gxm-mini-m8s-pro.dts new file mode 100644 index 000000000000..ef56c270d099 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-gxm-mini-m8s-pro.dts @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) Christian Hewitt + */ + +/dts-v1/; + +#include "meson-gxm.dtsi" +#include "meson-gx-p23x-q20x.dtsi" +#include +#include + +/ { + compatible = "azw,gt1-ultimate", "amlogic,s912", "amlogic,meson-gxm"; + model = "Mini M8S Pro"; + + leds { + compatible = "gpio-leds"; + + led-white { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; + default-state = "on"; + panic-indicator; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1710000>; + + button-function { + label = "update"; + linux,code = ; + press-threshold-microvolt = <10000>; + }; + }; +}; + +ðmac { + pinctrl-0 = <ð_pins>; + pinctrl-names = "default"; + phy-handle = <&external_phy>; + amlogic,tx-delay-ns = <2>; + phy-mode = "rgmii"; +}; + +&external_mdio { + external_phy: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ + reg = <0>; + max-speed = <1000>; + + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_15 */ + interrupts = <25 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&ir { + linux,rc-map-name = "rc-beelink-gs1"; +}; + +&sd_emmc_a { + brcmf: wifi@1 { + reg = <1>; + compatible = "qcom,qca9377"; + }; +}; + +&uart_A { + status = "okay"; + pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; + pinctrl-names = "default"; + uart-has-rtscts; + + bluetooth { + compatible = "qcom,qca9377-bt"; + enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + max-speed = <2000000>; + clocks = <&wifi32k>; + clock-names = "lpo"; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-gxm-t95z-plus.dts b/patch/kernel/archive/meson64-6.10/dt/meson-gxm-t95z-plus.dts new file mode 100644 index 000000000000..5f4bd19d5d77 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-gxm-t95z-plus.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) Christian Hewitt + */ + +/dts-v1/; + +#include "meson-gxm.dtsi" +#include "meson-gx-p23x-q20x.dtsi" +#include +#include + +/ { + compatible = "sunvell,t95z-plus", "amlogic,s912", "amlogic,meson-gxm"; + model = "Sunvell T95Z Plus"; + + leds { + compatible = "gpio-leds"; + + led-green { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led-blue { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio GPIODV_25 GPIO_ACTIVE_HIGH>; + default-state = "off"; + panic-indicator; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1710000>; + + button-function { + label = "update"; + linux,code = ; + press-threshold-microvolt = <10000>; + }; + }; + + spi { + compatible = "spi-gpio"; + + /* T95Z v1 (enabled) */ + sck-gpios = <&gpio GPIODV_22 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio GPIODV_23 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio GPIODV_21 GPIO_ACTIVE_LOW>; + + /* T95Z v2 (disabled) + sck-gpios = <&gpio GPIODV_19 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio GPIODV_18 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio GPIODV_20 GPIO_ACTIVE_LOW>; + */ + + num-chipselects = <1>; + #address-cells = <1>; + #size-cells = <0>; + + tm1628: led-controller@0 { + compatible = "titanmec,tm1628"; + reg = <0>; + spi-3wire; + spi-lsb-first; + spi-rx-delay-us = <1>; + spi-max-frequency = <500000>; + #address-cells = <2>; + #size-cells = <0>; + + titanmec,segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + titanmec,grid = /bits/ 8 <2 3 4 5 1>; + + alarm@1,1 { + reg = <1 1>; + function = LED_FUNCTION_ALARM; + }; + + usb@1,2 { + reg = <1 2>; + function = LED_FUNCTION_USB; + }; + + play@1,3 { + reg = <1 3>; + function = "play"; + }; + + pause@1,4 { + reg = <1 4>; + function = "pause"; + }; + + colon@1,5 { + reg = <1 5>; + function = "colon"; + }; + + lan@1,6 { + reg = <1 6>; + function = LED_FUNCTION_LAN; + }; + + wlan@1,7 { + reg = <1 7>; + function = LED_FUNCTION_WLAN; + }; + }; + }; +}; + +ðmac { + pinctrl-0 = <ð_pins>; + pinctrl-names = "default"; + + phy-handle = <&external_phy>; + phy-mode = "rgmii"; + + amlogic,tx-delay-ns = <2>; +}; + +&external_mdio { + external_phy: ethernet-phy@1 { + /* ZTE ZX2AA500 */ + compatible = "ethernet-phy-id0381.5c11", + "ethernet-phy-ieee802.3-c22"; + reg = <1>; + max-speed = <1000>; + + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_15 */ + interrupts = <25 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&sd_emmc_a { + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + }; +}; + +&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>; + max-speed = <2000000>; + clocks = <&wifi32k>; + clock-names = "lpo"; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200-spinor.dts b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200-spinor.dts new file mode 100644 index 000000000000..a9e4749f8395 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200-spinor.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-sm1-jethome-jethub-j200.dts" + +/ { + model = "JetHub D2 with SPI NOR flash"; +}; + +#include "meson-g12-enable-spinor.dtsi" diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200.dts b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200.dts new file mode 100644 index 000000000000..d5c761aa0a65 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-jethome-jethub-j200.dts @@ -0,0 +1,705 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 JetHome + * Author: Viacheslav Bocharov + */ + +/dts-v1/; + +#include "meson-sm1.dtsi" + +#include +#include +#include + + +/ { + + compatible = "jethome,jethub-j200", "amlogic,sm1"; + model = "JetHome JetHub D2"; + + aliases { + serial0 = &uart_AO; + ethernet0 = ðmac; + rtc0 = &rtc; + rtc1 = &vrtc; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x40000000>; + }; + + emmc_pwrseq: emmc-pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; + }; + + tflash_vdd: regulator-tflash_vdd { + compatible = "regulator-fixed"; + + regulator-name = "TFLASH_VDD"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>; + enable-active-high; + regulator-always-on; + }; + + tf_io: gpio-regulator-tf_io { + compatible = "regulator-gpio"; + + regulator-name = "TF_IO"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_5v>; + + enable-gpios = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>; + enable-active-high; + regulator-always-on; + + gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_SOURCE>; + gpios-states = <0>; + + states = <3300000 0>, + <1800000 1>; + }; + + flash_1v8: regulator-flash_1v8 { + compatible = "regulator-fixed"; + regulator-name = "FLASH_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_3v3>; + regulator-always-on; + }; + + main_12v: regulator-main_12v { + compatible = "regulator-fixed"; + regulator-name = "12V"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; + }; + + vcc_5v: regulator-vcc_5v { + compatible = "regulator-fixed"; + regulator-name = "5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + vin-supply = <&main_12v>; + gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; + enable-active-high; + }; + + 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; + }; + + vddcpu: regulator-vddcpu { + /* + * MP8756GD Regulator. + */ + compatible = "pwm-regulator"; + + regulator-name = "VDDCPU"; + regulator-min-microvolt = <721000>; + regulator-max-microvolt = <1022000>; + + pwm-supply = <&main_12v>; + + pwms = <&pwm_AO_cd 1 1250 0>; + pwm-dutycycle-range = <100 0>; + + regulator-boot-on; + regulator-always-on; + }; + + usb_pwr_en: regulator-usb_pwr_en { + compatible = "regulator-fixed"; + regulator-name = "USB_PWR_EN"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v>; + + /* Connected to the internal USB-Hub */ + gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + vddao_1v8: regulator-vddao_1v8 { + compatible = "regulator-fixed"; + regulator-name = "VDDAO_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vddao_3v3>; + regulator-always-on; + }; + + vddao_3v3: regulator-vddao_3v3 { + compatible = "regulator-fixed"; + regulator-name = "VDDAO_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&main_12v>; + regulator-always-on; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi_tx_tmds_out>; + }; + }; + }; + + sound { + compatible = "amlogic,axg-sound-card"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDM_B Playback", "TDMOUT_B OUT"; + + assigned-clocks = <&clkc CLKID_MPLL2>, + <&clkc CLKID_MPLL0>, + <&clkc CLKID_MPLL1>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, + <393216000>; + + /* 8ch hdmi interface */ + dai-link-0 { + sound-dai = <&tdmif_b>; + dai-format = "i2s"; + dai-tdm-slot-tx-mask-0 = <1 1>; + dai-tdm-slot-tx-mask-1 = <1 1>; + dai-tdm-slot-tx-mask-2 = <1 1>; + dai-tdm-slot-tx-mask-3 = <1 1>; + mclk-fs = <256>; + + codec { + sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; + }; + }; + + /* hdmi glue */ + dai-link-1 { + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; + + codec { + sound-dai = <&hdmi_tx>; + }; + }; + }; + + meson64-reboot { + compatible = "meson64,reboot"; + sys_reset = <0x84000009>; + sys_poweroff = <0x84000008>; + + sd-vqen = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>; + sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led-green { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + panic-indicator; + }; + + led-red { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio GPIOH_5 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + }; + + sound { + model = "JETHUB-D2"; + }; + +}; + +&arb { + status = "okay"; +}; + +&cec_AO { + pinctrl-0 = <&cec_ao_a_h_pins>; + pinctrl-names = "default"; + status = "disabled"; + hdmi-phandle = <&hdmi_tx>; +}; + +&cecb_AO { + pinctrl-0 = <&cec_ao_b_h_pins>; + pinctrl-names = "default"; + status = "okay"; + hdmi-phandle = <&hdmi_tx>; +}; + +&clkc_audio { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU_CLK>; + clock-latency = <50000>; +}; + +&cpu1 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU1_CLK>; + clock-latency = <50000>; +}; + +&cpu2 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU2_CLK>; + clock-latency = <50000>; +}; + +&cpu3 { + cpu-supply = <&vddcpu>; + operating-points-v2 = <&cpu_opp_table>; + clocks = <&clkc CLKID_CPU3_CLK>; + clock-latency = <50000>; +}; + +&ext_mdio { + external_phy: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ + reg = <0>; + max-speed = <1000>; + + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_14 */ + interrupts = ; + }; +}; + +ðmac { + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&external_phy>; + amlogic,tx-delay-ns = <2>; +}; + +&gpio { + gpio-line-names = + /* GPIOZ */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + /* GPIOH */ + "HDMITX_SDA", /* GPIOH_0 */ + "HDMITX_SCL", /* GPIOH_1 */ + "HDMITX_HPD_IN", /* GPIOH_2 */ + "AO_CEC_A", /* GPIOH_3 */ + "HUB_RESET", /* GPIOH_4 */ + "LED_RED", /* GPIOH_5 */ + "I2C_SDA_MODULES", /* GPIOH_6 */ + "I2C_SCL_MODULES", /* GPIOH_7 */ + "5V_EN", /* GPIOH_8 */ + /* BOOT */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + /* GPIOC */ + "", "", "", "", "", "", "", "", + /* GPIOA */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", + "I2C_SDA_SYSBUS", /* GPIOA_14 */ + "I2C_SCL_SYSBUS", /* GPIOA_15 */ + /* GPIOX */ + "", "", "", "", "", "", /* GPIOX_0 - GPIOX_5 */ + "RS485_TX", /* GPIOX_6 */ + "RS485_RX", /* GPIOX_7 */ + "", "", "", "", "", "", /* GPIOX_8 - GPIOX_13 */ + "", "", "", /* GPIOX_14 - GPIOX_16 */ + "I2C_SDA_LCDBUS", /* GPIOX_17 */ + "I2C_SCL_LCDBUS", /* GPIOX_18 */ + ""; /* GPIOX_19 */ + /* + * WARNING: The USB Hub needs a reset signal to be turned low in + * order to be detected by the USB Controller. This signal should + * be handled by a USB specific power sequence to reset the Hub + * when the USB bus is powered down. + */ + usb-hub-hog { + gpio-hog; + gpios = ; + output-low; + line-name = "usb-hub-reset"; + }; + +}; + +&gpio_ao { + gpio-line-names = + /* GPIOAO */ + "CONSOLE_TX", /* GPIOAO_0 */ + "CONSOLE_RX", /* GPIOAO_1 */ + "USB_OTG_PWR_EN", /* GPIOAO_2 */ + "TFLASH_VDD_EN", /* GPIOAO_3 */ + "MCU_RESET", /* GPIOAO_4 */ + "POWER_GOOD", /* GPIOAO_5 */ + "TF_3V3N_1V8_EN", /* GPIOAO_6 */ + "GPIO_EXPANDER_INT", /* GPIOAO_7 */ + "MCU_UART_TX", /* GPIOAO_8 */ + "MCU_UART_RX", /* GPIOAO_9 */ + "BUTTON_USR", /* GPIOAO_10 */ + "LED_GREEN", /* GPIOAO_11 */ + /* GPIOE */ + "VDDEE_PWM", "VDDCPU_PWM", "TF_PWR_EN"; +}; + +&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>; + }; +}; + +&pwm_AO_cd { + pinctrl-0 = <&pwm_ao_d_e_pins>; + pinctrl-names = "default"; + clocks = <&xtal>; + clock-names = "clkin1"; + status = "okay"; +}; + +&saradc { + status = "okay"; +}; + +/* SD card */ +&sd_emmc_b { + status = "okay"; + pinctrl-0 = <&sdcard_c_pins>; + pinctrl-1 = <&sdcard_clk_gate_c_pins>; + pinctrl-names = "default", "clk-gate"; + + bus-width = <4>; + cap-sd-highspeed; + max-frequency = <200000000>; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + disable-wp; + + cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; + vmmc-supply = <&tflash_vdd>; + vqmmc-supply = <&tf_io>; +}; + +/* eMMC */ +&sd_emmc_c { + status = "okay"; + pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; + pinctrl-1 = <&emmc_clk_gate_pins>; + pinctrl-names = "default", "clk-gate"; + + bus-width = <8>; + cap-mmc-highspeed; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + max-frequency = <200000000>; + disable-wp; + + mmc-pwrseq = <&emmc_pwrseq>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&flash_1v8>; +}; + +&spifc { + status = "disabled"; + pinctrl-0 = <&nor_pins>; + pinctrl-names = "default"; + + flash: nor-flash@0 { + compatible = "sst,w25q256", "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <30000000>; + }; +}; + +&tdmif_b { + status = "okay"; +}; + +&tdmout_b { + status = "okay"; +}; + +&tohdmitx { + status = "okay"; +}; + +&uart_AO { + status = "okay"; + pinctrl-0 = <&uart_ao_a_pins>; + pinctrl-names = "default"; +}; + +&uart_AO_B { + status = "okay"; + pinctrl-0 = <&uart_ao_b_8_9_pins>; + pinctrl-names = "default"; +}; + +&uart_B { + status = "okay"; + pinctrl-0 = <&uart_b_pins>; + pinctrl-names = "default"; +}; + + +&usb { + status = "okay"; + vbus-supply = <&usb_pwr_en>; +}; + +&usb2_phy0 { + phy-supply = <&vcc_5v>; +}; + + +/* I2C for modules */ +&i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_sda_h6_pins>, <&i2c1_sck_h7_pins>; + pinctrl-names = "default"; + clock-frequency = <400000>; + + /* GPIO expander */ + u9: gpio@22 { + compatible = "nxp,pca9535"; + reg = <0x22>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gpio_intc>; + interrupts = ; + + gpio-line-names = + "RELAY_1", "RELAY_2", + "", "", + "UXM1_RESET", "UXM1_BOOT", + "UXM2_RESET", "UXM2_BOOT", + "DIN_1", "DIN_2", "DIN_3", + "","","","",""; + }; + + /* 1-wire */ + w1: onewire@18 { + compatible = "maxim,ds2482"; + reg = <0x18>; + }; + +}; + + +/* I2C for lcd/etc */ +&i2c2 { + status = "okay"; + pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>; + pinctrl-names = "default"; + clock-frequency = <400000>; +}; + +/* I2C_EE_M3: I2C for CPU board */ +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; + pinctrl-names = "default"; + clock-frequency = <400000>; + + /* I2C for rtc */ + rtc: rtc@51 { + status = "okay"; + compatible = "nxp,pcf8563"; + reg = <0x51>; + wakeup-source; + }; + + /* FRAM on base board */ + fram: eeprom@52 { + compatible = "atmel,24c64"; + reg = <0x52>; + pagesize = <0x20>; + label = "fram"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* EEPROM on CPU board */ + eepromc: eeprom@54 { + compatible = "atmel,24c64"; + reg = <0x54>; + pagesize = <0x20>; + label = "eepromc"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* EEPROM on base board */ + eeprompd: eeprom@56 { + compatible = "atmel,24c64"; + reg = <0x56>; + pagesize = <0x20>; + label = "eeprompd"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* EEPROM on power module */ + eeprompm: eeprom@57 { + compatible = "atmel,24c64"; + reg = <0x57>; + pagesize = <0x20>; + label = "eeprompm"; + address-width = <0x10>; + vcc-supply = <&vddao_3v3>; + }; + + /* temperature sensors */ + temp1: tmp102@48 { + compatible = "ti,tmp102"; + reg = <0x48>; + }; + + temp2: tmp102@49 { + compatible = "ti,tmp102"; + reg = <0x49>; + }; + +}; + +&efuse { + eth_mac: eth-mac@0 { + reg = <0x0 0x6>; + }; + + bt_mac: bt-mac@6 { + reg = <0x6 0x6>; + }; + + wifi_mac: wifi-mac@c { + reg = <0xc 0x6>; + }; + + bid: bid@12 { + reg = <0x12 0x20>; + }; + + sn: sn@32 { + reg = <0x32 0x20>; + }; +}; + +&cpu_thermal { + trips { + cpu_passive: cpu-passive { + temperature = <70000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + + cpu_hot: cpu-hot { + temperature = <85000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "hot"; + }; + + cpu_critical: cpu-critical { + temperature = <90000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&cpu_passive>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&cpu_hot>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&ddr_thermal { + trips { + ddr_passive: ddr-passive { + temperature = <70000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + + ddr_critical: ddr-critical { + temperature = <85000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spidev.dts b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spidev.dts new file mode 100644 index 000000000000..e7a0f5a3fc35 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spidev.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-sm1-khadas-vim3l.dts" + +/ { + model = "Khadas VIM3L with SPIDEV and I2C - MOSI pin 37, CLK pin 16 - SDA pin 23, SCL pin 23"; +}; + +&spicc1 { + pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "okay"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sck_a_pins &i2c3_sda_a_pins>; + pinctrl-names = "default"; +}; diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spinor.dts b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spinor.dts new file mode 100644 index 000000000000..f0d547e0c9a6 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-khadas-vim3l-spinor.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-sm1-khadas-vim3l.dts" + +/ { + model = "Khadas VIM3L with SPI NOR flash"; +}; + +#include "meson-g12-enable-spinor.dtsi" diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-sm1-odroid-c4-spidev.dts b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-odroid-c4-spidev.dts new file mode 100644 index 000000000000..4688b40052ca --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-odroid-c4-spidev.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "meson-sm1-odroid-c4.dts" + +/ { + model = "Hardkernel ODROID-C4 - MOSI is pin y, CLK is pin x"; +}; + +&spicc1 { + pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "okay"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + diff --git a/patch/kernel/archive/meson64-6.10/dt/meson-sm1-ugoos-x3.dts b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-ugoos-x3.dts new file mode 100644 index 000000000000..884a08836ae9 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/dt/meson-sm1-ugoos-x3.dts @@ -0,0 +1,293 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre SAS. All rights reserved. + * Copyright (c) 2020 Christian Hewitt + * Copyright (c) 2021 flippy + */ + +/dts-v1/; + +#include "meson-sm1-ac2xx.dtsi" +#include + +/ { + compatible = "amlogic,sm1"; + model = "Ugoos X3"; + + aliases { + rtc0 = &rtc; + rtc1 = &vrtc; + mmc0 = &sd_emmc_a; + mmc1 = &sd_emmc_b; + mmc2 = &sd_emmc_c; + }; + + leds { + compatible = "gpio-leds"; + + red_led { + label = "red"; + gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + blue_led { + label = "blue"; + gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + }; + + sound { + compatible = "amlogic,axg-sound-card"; + model = "UGOOS-X3"; + audio-aux-devs = <&tdmout_b>; + audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", + "TDMOUT_B IN 1", "FRDDR_B OUT 1", + "TDMOUT_B IN 2", "FRDDR_C OUT 1", + "TDM_B Playback", "TDMOUT_B OUT"; + + assigned-clocks = <&clkc CLKID_MPLL2>, + <&clkc CLKID_MPLL0>, + <&clkc CLKID_MPLL1>; + assigned-clock-parents = <0>, <0>, <0>; + assigned-clock-rates = <294912000>, + <270950400>, + <393216000>; + status = "okay"; + + dai-link-0 { + sound-dai = <&frddr_a>; + }; + + dai-link-1 { + sound-dai = <&frddr_b>; + }; + + dai-link-2 { + sound-dai = <&frddr_c>; + }; + + /* 8ch hdmi interface */ + dai-link-3 { + sound-dai = <&tdmif_b>; + dai-format = "i2s"; + dai-tdm-slot-tx-mask-0 = <1 1>; + dai-tdm-slot-tx-mask-1 = <1 1>; + dai-tdm-slot-tx-mask-2 = <1 1>; + dai-tdm-slot-tx-mask-3 = <1 1>; + mclk-fs = <256>; + + codec { + sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; + }; + }; + + /* hdmi glue */ + dai-link-4 { + sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; + + codec { + sound-dai = <&hdmi_tx>; + }; + }; + }; + + vddgpu: regulator-vddgpu { + compatible = "regulator-fixed"; + regulator-name = "mali"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <800000>; + vin-supply = <&ao_5v>; + regulator-always-on; + }; + + 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 = <&ao_5v>; + + gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; +}; + +&vddcpu { + regulator-min-microvolt = <721000>; + regulator-max-microvolt = <1022000>; + pwms = <&pwm_AO_cd 1 1250 0>; +}; + +&arb { + status = "okay"; +}; + +&clkc_audio { + status = "okay"; +}; + +ðmac { + status = "okay"; + + pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; + pinctrl-names = "default"; + phy-mode = "rgmii-txid"; + phy-handle = <&external_phy>; + + rx-internal-delay-ps = <800>; + + snps,aal; + snps,rxpbl = <0x8>; + snps,txpbl = <0x8>; + + rx-fifo-depth = <4096>; + tx-fifo-depth = <4096>; + + nvmem-cells = <ð_mac>; + nvmem-cell-names = "eth_mac"; +}; + +&ext_mdio { + external_phy: ethernet-phy@0 { + /* Realtek RTL8211F (0x001cc916) */ + reg = <0>; + max-speed = <1000>; + + reset-assert-us = <10000>; + reset-deassert-us = <80000>; + reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; + + interrupt-parent = <&gpio_intc>; + /* MAC_INTR on GPIOZ_14 */ + interrupts = ; + }; +}; + +&frddr_a { + status = "okay"; +}; + +&frddr_b { + status = "okay"; +}; + +&frddr_c { + status = "okay"; +}; + +&tdmif_b { + status = "okay"; +}; + +&tdmout_b { + status = "okay"; +}; + +&tohdmitx { + status = "okay"; +}; + +&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>; + max-speed = <2000000>; + clocks = <&wifi32k>; + clock-names = "lpo"; + }; +}; + +&mali { + mali-supply=<&vddgpu>; +}; + +&usb { + dr_mode = "host"; + vbus-supply = <&usb_pwr_en>; +}; + +&usb2_phy0 { + phy-supply = <&ao_5v>; +}; + +&usb2_phy1 { + phy-supply = <&ao_5v>; +}; + +&i2c3 { + status = "okay"; + pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>; + pinctrl-names = "default"; + + rtc: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + wakeup-source; + + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + }; +}; + +/* SDIO */ +&sd_emmc_a { + /delete-property/ sd-uhs-sdr104; + sd-uhs-sdr50; + max-frequency = <100000000>; + + //sd-uhs-ddr50; + //max-frequency = <50000000>; + + //sd-uhs-sdr104; + //max-frequency = <200000000>; +}; + +/* SD card */ +&sd_emmc_b { + cap-sd-highspeed; + max-frequency = <100000000>; +}; + +/* eMMC */ +&sd_emmc_c { + max-frequency = <200000000>; +}; + +&cpu_opp_table { + opp-2016000000 { + opp-hz = /bits/ 64 <2016000000>; + opp-microvolt = <1000000>; + }; +}; + +&efuse { + eth_mac: eth_mac@0 { + reg = <0x0 0x06>; + }; + + bt_mac: bt_mac@6 { + reg = <0x6 0x06>; + }; + + wifi_mac: wifi_mac@12 { + reg = <0x0c 0x06>; + }; + + usid: usid@18 { + reg = <0x12 0x10>; + }; +}; +/* +&openvfd { + status = "disabled"; +}; +*/ \ No newline at end of file diff --git a/patch/kernel/archive/meson64-6.10/general-add-Amlogic-Meson-GX-PM-Suspend.patch b/patch/kernel/archive/meson64-6.10/general-add-Amlogic-Meson-GX-PM-Suspend.patch new file mode 100644 index 000000000000..c4fc44b09655 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-add-Amlogic-Meson-GX-PM-Suspend.patch @@ -0,0 +1,134 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 3 Nov 2016 15:29:23 +0100 +Subject: HACK: arm64: meson: add Amlogic Meson GX PM Suspend + +The Amlogic Meson GX SoCs uses a non-standard argument to the +PSCI CPU_SUSPEND call to enter system suspend. + +Implement such call within platform_suspend_ops. + +Signed-off-by: Neil Armstrong +--- + drivers/firmware/meson/Kconfig | 6 + + drivers/firmware/meson/Makefile | 1 + + drivers/firmware/meson/meson_gx_pm.c | 86 ++++++++++ + 3 files changed, 93 insertions(+) + +diff --git a/drivers/firmware/meson/Kconfig b/drivers/firmware/meson/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/firmware/meson/Kconfig ++++ b/drivers/firmware/meson/Kconfig +@@ -9,3 +9,9 @@ config MESON_SM + depends on ARM64_4K_PAGES + help + Say y here to enable the Amlogic secure monitor driver ++ ++config MESON_GX_PM ++ bool ++ default ARCH_MESON if ARM64 ++ help ++ Say y here to enable the Amlogic GX SoC Power Management +diff --git a/drivers/firmware/meson/Makefile b/drivers/firmware/meson/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/firmware/meson/Makefile ++++ b/drivers/firmware/meson/Makefile +@@ -1,2 +1,3 @@ + # SPDX-License-Identifier: GPL-2.0-only + obj-$(CONFIG_MESON_SM) += meson_sm.o ++obj-$(CONFIG_MESON_GX_PM) += meson_gx_pm.o +diff --git a/drivers/firmware/meson/meson_gx_pm.c b/drivers/firmware/meson/meson_gx_pm.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/firmware/meson/meson_gx_pm.c +@@ -0,0 +1,86 @@ ++/* ++ * Amlogic Meson GX Power Management ++ * ++ * Copyright (c) 2016 Baylibre, SAS. ++ * Author: Neil Armstrong ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of version 2 of the GNU General Public License as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++ ++/* ++ * The Amlogic GX SoCs uses a special argument value to the ++ * PSCI CPU_SUSPEND method to enter SUSPEND_MEM. ++ */ ++ ++#define MESON_SUSPEND_PARAM 0x0010000 ++#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name ++ ++static int meson_gx_suspend_finish(unsigned long arg) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(PSCI_FN_NATIVE(0_2, CPU_SUSPEND), arg, ++ virt_to_phys(cpu_resume), 0, 0, 0, 0, 0, &res); ++ ++ return res.a0; ++} ++ ++static int meson_gx_suspend_enter(suspend_state_t state) ++{ ++ switch (state) { ++ case PM_SUSPEND_MEM: ++ return cpu_suspend(MESON_SUSPEND_PARAM, ++ meson_gx_suspend_finish); ++ } ++ ++ return -EINVAL; ++} ++ ++static const struct platform_suspend_ops meson_gx_pm_ops = { ++ .enter = meson_gx_suspend_enter, ++ .valid = suspend_valid_only_mem, ++}; ++ ++static const struct of_device_id meson_gx_pm_match[] = { ++ { .compatible = "amlogic,meson-gx-pm", }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, meson_gx_pm_match); ++ ++static int meson_gx_pm_probe(struct platform_device *pdev) ++{ ++ suspend_set_ops(&meson_gx_pm_ops); ++ ++ return 0; ++} ++ ++static struct platform_driver meson_gx_pm_driver = { ++ .probe = meson_gx_pm_probe, ++ .driver = { ++ .name = "meson-gx-pm", ++ .of_match_table = meson_gx_pm_match, ++ }, ++}; ++ ++module_platform_driver(meson_gx_pm_driver); ++ ++MODULE_AUTHOR("Neil Armstrong "); ++MODULE_DESCRIPTION("Amlogic Meson GX PM driver"); ++MODULE_LICENSE("GPL v2"); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-add-overlay-compilation-support.patch b/patch/kernel/archive/meson64-6.10/general-add-overlay-compilation-support.patch new file mode 100644 index 000000000000..6cad873b4e4d --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-add-overlay-compilation-support.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 20 Jul 2024 13:58:49 +0200 +Subject: compile .scr and install overlays in right path + +--- + scripts/Makefile.dtbinst | 13 +++++++++- + scripts/Makefile.lib | 8 +++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index 111111111111..222222222222 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -33,7 +33,18 @@ endef + + $(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) + +-dtbs := $(notdir $(dtbs)) ++# Very convoluted way to flatten all the device tree ++# directories, but keep the "/overlay/" directory ++ ++# topmost directory (ie: from rockchip/overlay/rk322x-emmc.dtbo extracts rockchip) ++topmost_dir = $(firstword $(subst /, ,$(dtbs))) ++# collect dtbs entries which starts with "$topmost_dir/overlay/", then remove "$topmost_dir" ++dtbs_overlays = $(subst $(topmost_dir)/,,$(filter $(topmost_dir)/overlay/%, $(dtbs))) ++# collect the non-overlay dtbs ++dtbs_regular = $(filter-out $(topmost_dir)/overlay/%, $(dtbs)) ++# compose the dtbs variable flattening all the non-overlays entries ++# and appending the overlays entries ++dtbs := $(notdir $(dtbs_regular)) $(dtbs_overlays) + + endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 111111111111..222222222222 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -394,15 +394,21 @@ quiet_cmd_wrap_S_dtb = WRAP $@ + echo '.balign STRUCT_ALIGNMENT'; \ + } > $@ + ++quiet_cmd_scr = MKIMAGE $@ ++cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ ++ + $(obj)/%.dtb.S: $(obj)/%.dtb FORCE + $(call if_changed,wrap_S_dtb) + + $(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE + $(call if_changed,wrap_S_dtb) + ++$(obj)/%.scr: $(src)/%.scr-cmd FORCE ++ $(call if_changed,scr) ++ + quiet_cmd_dtc = DTC $@ + cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(DTC) -o $@ -b 0 \ ++ $(DTC) -@ -o $@ -b 0 \ + $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-driver-tm1628-auxdisplay-add-support-for-Titanmec-TM16.patch b/patch/kernel/archive/meson64-6.10/general-driver-tm1628-auxdisplay-add-support-for-Titanmec-TM16.patch new file mode 100644 index 000000000000..0989fdb06d3f --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-driver-tm1628-auxdisplay-add-support-for-Titanmec-TM16.patch @@ -0,0 +1,585 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Sun, 20 Feb 2022 08:24:47 +0000 +Subject: FROMLIST(v5): auxdisplay: add support for Titanmec TM1628 7 segment + display controller + etc + +FROMLIST(v5): MAINTAINERS: Add entry for tm1628 auxdisplay driver + +Signed-off-by: Heiner Kallweit + +FROMLIST(v5): auxdisplay: add support for Titanmec TM1628 7 segment display controller + +This patch adds support for the Titanmec TM1628 7 segment display +controller. It's based on previous RFC work from Andreas Farber. +The RFC version placed the driver in the LED subsystem, but this was +NAK'ed by the LED maintainer. Therefore I moved the driver to +/drivers/auxdisplay what seems most reasonable to me. + +Further changes to the RFC version: +- Driver can be built also w/o LED class support, for displays that + don't have any symbols to be exposed as LED's. +- Simplified the code and rewrote a lot of it. +- Driver is now kind of a MVP, but functionality should be sufficient + for most use cases. +- Use the existing 7 segment support in uapi/linux/map_to_7segment.h + as suggested by Geert Uytterhoeven. + +Note: There's a number of chips from other manufacturers that are + almost identical, e.g. FD628, SM1628. Only difference I saw so + far is that they partially support other display modes. + TM1628: 6x12, 7x11 + SM1628C: 4x13, 5x12, 6x11, 7x10 + For typical displays on devices using these chips this + difference shouldn't matter. + +Successfully tested on a TX3 Mini TV box that has an SM1628C and a +display with 4 digits and 7 symbols. + +Co-developed-by: Andreas Farber +Signed-off-by: Andreas Farber +Signed-off-by: Heiner Kallweit + +FROMLIST(v5): docs: ABI: document tm1628 attribute display-text + +Document the attribute for reading / writing the text to be displayed on +the 7 segment display. + +Signed-off-by: Heiner Kallweit + +FROMLIST(v5): dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628 + +Add a YAML schema binding for TM1628 auxdisplay +(7/11-segment LED) controller. + +This patch is partially based on previous RFC work from +Andreas Farber . + +Co-developed-by: Andreas Farber +Signed-off-by: Andreas Farber +Signed-off-by: Heiner Kallweit +--- + Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 | 7 + + Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml | 82 ++ + drivers/auxdisplay/Kconfig | 11 + + drivers/auxdisplay/Makefile | 1 + + drivers/auxdisplay/tm1628.c | 376 ++++++++++ + 5 files changed, 477 insertions(+) + +diff --git a/Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 b/Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 +@@ -0,0 +1,7 @@ ++What: /sys/devices/.../display-text ++Date: February 2022 ++Contact: Heiner Kallweit ++Description: ++ The text to be displayed on the 7 segment display. ++ Any printable character is allowed as input, but some ++ can not be displayed in a readable way with 7 segments. +diff --git a/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml b/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml +@@ -0,0 +1,82 @@ ++# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/leds/titanmec,tm1628.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Titan Micro Electronics TM1628 LED controller ++ ++properties: ++ compatible: ++ enum: ++ - titanmec,tm1628 ++ ++ reg: ++ maxItems: 1 ++ ++ grid: ++ description: ++ Mapping of display digit position to grid number. ++ This implicitly defines the display size. ++ $ref: /schemas/types.yaml#/definitions/uint8-array ++ minItems: 1 ++ maxItems: 7 ++ ++ segment-mapping: ++ description: ++ Mapping of 7 segment display segments A-G to bit numbers 1-12. ++ $ref: /schemas/types.yaml#/definitions/uint8-array ++ minItems: 7 ++ maxItems: 7 ++ ++ "#address-cells": ++ const: 2 ++ ++ "#size-cells": ++ const: 0 ++ ++required: ++ - compatible ++ - reg ++ ++patternProperties: ++ "^.*@[1-7],([1-9]|1[0-6])$": ++ type: object ++ description: | ++ Properties for a single LED. ++ ++ properties: ++ reg: ++ description: | ++ 1-based grid number, followed by 1-based segment bit number. ++ maxItems: 1 ++ ++ required: ++ - reg ++ ++examples: ++ - | ++ #include ++ ++ spi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ led-controller@0 { ++ compatible = "titanmec,tm1628"; ++ reg = <0>; ++ spi-3-wire; ++ spi-lsb-first; ++ spi-max-frequency = <500000>; ++ grid = /bits/ 8 <4 3 2 1>; ++ segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; ++ #address-cells = <2>; ++ #size-cells = <0>; ++ ++ alarmn@5,4 { ++ reg = <5 4>; ++ function = LED_FUNCTION_ALARM; ++ }; ++ }; ++ }; ++... +diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/auxdisplay/Kconfig ++++ b/drivers/auxdisplay/Kconfig +@@ -59,6 +59,17 @@ config LCD2S + is a simple single color character display. You have to connect it + to an I2C bus. + ++config TM1628 ++ tristate "TM1628 driver for LED 7/11 segment displays" ++ depends on SPI ++ depends on OF || COMPILE_TEST ++ help ++ Say Y to enable support for Titan Micro Electronics TM1628 ++ LED controller. ++ ++ It's a 3-wire SPI device controlling a two-dimensional grid of ++ LEDs. Dimming is applied to all outputs through an internal PWM. ++ + menuconfig PARPORT_PANEL + tristate "Parallel port LCD/Keypad Panel support" + depends on PARPORT +diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/auxdisplay/Makefile ++++ b/drivers/auxdisplay/Makefile +@@ -16,3 +16,4 @@ obj-$(CONFIG_LINEDISP) += line-display.o + obj-$(CONFIG_MAX6959) += max6959.o + obj-$(CONFIG_PARPORT_PANEL) += panel.o + obj-$(CONFIG_SEG_LED_GPIO) += seg-led-gpio.o ++obj-$(CONFIG_TM1628) += tm1628.o +diff --git a/drivers/auxdisplay/tm1628.c b/drivers/auxdisplay/tm1628.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/auxdisplay/tm1628.c +@@ -0,0 +1,376 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Titan Micro Electronics TM1628 LED controller ++ * ++ * Copyright (c) 2019 Andreas Färber ++ * Copyright (c) 2022 Heiner Kallweit ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define TM1628_CMD_DISPLAY_MODE (0 << 6) ++#define TM1628_DISPLAY_MODE_6_12 0x02 ++#define TM1628_DISPLAY_MODE_7_11 0x03 ++ ++#define TM1628_CMD_DATA (1 << 6) ++#define TM1628_DATA_TEST_MODE BIT(3) ++#define TM1628_DATA_FIXED_ADDR BIT(2) ++#define TM1628_DATA_WRITE_DATA 0x00 ++#define TM1628_DATA_READ_DATA 0x02 ++ ++#define TM1628_CMD_DISPLAY_CTRL (2 << 6) ++#define TM1628_DISPLAY_CTRL_DISPLAY_ON BIT(3) ++ ++#define TM1628_CMD_SET_ADDRESS (3 << 6) ++ ++#define TM1628_BRIGHTNESS_MAX 7 ++#define NUM_LED_SEGS 7 ++ ++/* Physical limits, depending on the mode the chip may support less */ ++#define MAX_GRID_SIZE 7 ++#define MAX_SEGMENT_NUM 16 ++ ++struct tm1628_led { ++ struct led_classdev leddev; ++ struct tm1628 *ctrl; ++ u32 grid; ++ u32 seg; ++}; ++ ++struct tm1628 { ++ struct spi_device *spi; ++ __le16 data[MAX_GRID_SIZE]; ++ struct mutex disp_lock; ++ char text[MAX_GRID_SIZE + 1]; ++ u8 segment_mapping[NUM_LED_SEGS]; ++ u8 grid[MAX_GRID_SIZE]; ++ int grid_size; ++ struct tm1628_led leds[]; ++}; ++ ++/* Command 1: Display Mode Setting */ ++static int tm1628_set_display_mode(struct spi_device *spi, u8 grid_mode) ++{ ++ const u8 cmd = TM1628_CMD_DISPLAY_MODE | grid_mode; ++ ++ return spi_write(spi, &cmd, 1); ++} ++ ++/* Command 3: Address Setting */ ++static int tm1628_set_address(struct spi_device *spi, u8 offset) ++{ ++ const u8 cmd = TM1628_CMD_SET_ADDRESS | (offset * sizeof(__le16)); ++ ++ return spi_write(spi, &cmd, 1); ++} ++ ++/* Command 2: Data Setting */ ++static int tm1628_write_data(struct spi_device *spi, unsigned int offset, ++ unsigned int len) ++{ ++ struct tm1628 *s = spi_get_drvdata(spi); ++ const u8 cmd = TM1628_CMD_DATA | TM1628_DATA_WRITE_DATA; ++ struct spi_transfer xfers[] = { ++ { ++ .tx_buf = &cmd, ++ .len = 1, ++ }, ++ { ++ .tx_buf = (__force void *)(s->data + offset), ++ .len = len * sizeof(__le16), ++ }, ++ }; ++ ++ if (offset + len > MAX_GRID_SIZE) { ++ dev_err(&spi->dev, "Invalid data address offset %u len %u\n", ++ offset, len); ++ return -EINVAL; ++ } ++ ++ tm1628_set_address(spi, offset); ++ ++ return spi_sync_transfer(spi, xfers, ARRAY_SIZE(xfers)); ++} ++ ++/* Command 4: Display Control */ ++static int tm1628_set_display_ctrl(struct spi_device *spi, bool on) ++{ ++ u8 cmd = TM1628_CMD_DISPLAY_CTRL | TM1628_BRIGHTNESS_MAX; ++ ++ if (on) ++ cmd |= TM1628_DISPLAY_CTRL_DISPLAY_ON; ++ ++ return spi_write(spi, &cmd, 1); ++} ++ ++static int tm1628_show_text(struct tm1628 *s) ++{ ++ static SEG7_CONVERSION_MAP(map_seg7, MAP_ASCII7SEG_ALPHANUM); ++ int msg_len, i, ret; ++ ++ msg_len = strlen(s->text); ++ ++ mutex_lock(&s->disp_lock); ++ ++ for (i = 0; i < s->grid_size; i++) { ++ int pos = s->grid[i] - 1; ++ int j, char7_raw, char7; ++ ++ if (i >= msg_len) { ++ s->data[pos] = 0; ++ continue; ++ } ++ ++ char7_raw = map_to_seg7(&map_seg7, s->text[i]); ++ ++ for (j = 0, char7 = 0; j < NUM_LED_SEGS; j++) { ++ if (char7_raw & BIT(j)) ++ char7 |= BIT(s->segment_mapping[j] - 1); ++ } ++ ++ s->data[pos] = cpu_to_le16(char7); ++ } ++ ++ ret = tm1628_write_data(s->spi, 0, s->grid_size); ++ ++ mutex_unlock(&s->disp_lock); ++ ++ return ret; ++} ++ ++static int tm1628_led_set_brightness(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++{ ++ struct tm1628_led *led = container_of(led_cdev, struct tm1628_led, leddev); ++ struct tm1628 *s = led->ctrl; ++ int ret, offset = led->grid - 1; ++ __le16 bit = cpu_to_le16(BIT(led->seg - 1)); ++ ++ mutex_lock(&s->disp_lock); ++ ++ if (brightness == LED_OFF) ++ s->data[offset] &= ~bit; ++ else ++ s->data[offset] |= bit; ++ ++ ret = tm1628_write_data(s->spi, offset, 1); ++ ++ mutex_unlock(&s->disp_lock); ++ ++ return ret; ++} ++ ++static enum led_brightness tm1628_led_get_brightness(struct led_classdev *led_cdev) ++{ ++ struct tm1628_led *led = container_of(led_cdev, struct tm1628_led, leddev); ++ struct tm1628 *s = led->ctrl; ++ int offset = led->grid - 1; ++ __le16 bit = cpu_to_le16(BIT(led->seg - 1)); ++ bool on; ++ ++ mutex_lock(&s->disp_lock); ++ on = s->data[offset] & bit; ++ mutex_unlock(&s->disp_lock); ++ ++ return on ? LED_ON : LED_OFF; ++} ++ ++static int tm1628_register_led(struct tm1628 *s, struct fwnode_handle *node, ++ u32 grid, u32 seg, struct tm1628_led *led) ++{ ++ struct device *dev = &s->spi->dev; ++ struct led_init_data init_data = { .fwnode = node }; ++ ++ led->ctrl = s; ++ led->grid = grid; ++ led->seg = seg; ++ led->leddev.max_brightness = LED_ON; ++ led->leddev.brightness_set_blocking = tm1628_led_set_brightness; ++ led->leddev.brightness_get = tm1628_led_get_brightness; ++ ++ return devm_led_classdev_register_ext(dev, &led->leddev, &init_data); ++} ++ ++static ssize_t display_text_show(struct device *dev, struct device_attribute *attr, ++ char *buf) ++{ ++ struct tm1628 *s = dev_get_drvdata(dev); ++ ++ return sysfs_emit(buf, "%s\n", s->text); ++} ++ ++static ssize_t display_text_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct tm1628 *s = dev_get_drvdata(dev); ++ int ret, i; ++ ++ for (i = 0; i < count && i < s->grid_size && isprint(buf[i]); i++) ++ s->text[i] = buf[i]; ++ ++ s->text[i] = '\0'; ++ ++ ret = tm1628_show_text(s); ++ if (ret < 0) ++ return ret; ++ ++ return count; ++} ++ ++static const DEVICE_ATTR_RW(display_text); ++ ++static int tm1628_spi_probe(struct spi_device *spi) ++{ ++ struct fwnode_handle *child; ++ unsigned int num_leds; ++ struct tm1628 *s; ++ int ret, i; ++ ++ num_leds = device_get_child_node_count(&spi->dev); ++ ++ s = devm_kzalloc(&spi->dev, struct_size(s, leds, num_leds), GFP_KERNEL); ++ if (!s) ++ return -ENOMEM; ++ ++ s->spi = spi; ++ spi_set_drvdata(spi, s); ++ ++ mutex_init(&s->disp_lock); ++ ++ /* According to TM1628 datasheet */ ++ msleep(200); ++ ++ /* Clear screen */ ++ ret = tm1628_write_data(spi, 0, MAX_GRID_SIZE); ++ if (ret) ++ return ret; ++ ++ /* For now we support 6x12 mode only. This should be sufficient for most use cases */ ++ ret = tm1628_set_display_mode(spi, TM1628_DISPLAY_MODE_6_12); ++ if (ret) ++ return ret; ++ ++ ret = tm1628_set_display_ctrl(spi, true); ++ if (ret) ++ return ret; ++ ++ num_leds = 0; ++ ++ if (!IS_REACHABLE(CONFIG_LEDS_CLASS)) ++ goto no_leds; ++ ++ device_for_each_child_node(&spi->dev, child) { ++ u32 reg[2]; ++ ++ ret = fwnode_property_read_u32_array(child, "reg", reg, 2); ++ if (ret) { ++ dev_err(&spi->dev, "Reading %s reg property failed (%d)\n", ++ fwnode_get_name(child), ret); ++ continue; ++ } ++ ++ if (reg[0] == 0 || reg[0] > MAX_GRID_SIZE) { ++ dev_err(&spi->dev, "Invalid grid %u at %s\n", ++ reg[0], fwnode_get_name(child)); ++ continue; ++ } ++ ++ if (reg[1] == 0 || reg[1] > MAX_SEGMENT_NUM) { ++ dev_err(&spi->dev, "Invalid segment %u at %s\n", ++ reg[1], fwnode_get_name(child)); ++ continue; ++ } ++ ++ ret = tm1628_register_led(s, child, reg[0], reg[1], s->leds + num_leds); ++ if (ret) { ++ dev_err(&spi->dev, "Failed to register LED %s (%d)\n", ++ fwnode_get_name(child), ret); ++ continue; ++ } ++ num_leds++; ++ } ++ ++no_leds: ++ ret = device_property_count_u8(&spi->dev, "titanmec,grid"); ++ if (ret < 1 || ret > MAX_GRID_SIZE) { ++ dev_err(&spi->dev, "Invalid display length (%d)\n", ret); ++ return -EINVAL; ++ } ++ ++ s->grid_size = ret; ++ ++ ret = device_property_read_u8_array(&spi->dev, "titanmec,grid", s->grid, s->grid_size); ++ if (ret < 0) ++ return ret; ++ ++ for (i = 0; i < s->grid_size; i++) { ++ if (s->grid[i] < 1 || s->grid[i] > s->grid_size) ++ return -EINVAL; ++ } ++ ++ ret = device_property_read_u8_array(&spi->dev, "titanmec,segment-mapping", ++ s->segment_mapping, NUM_LED_SEGS); ++ if (ret < 0) ++ return ret; ++ ++ for (i = 0; i < NUM_LED_SEGS; i++) { ++ if (s->segment_mapping[i] < 1 || s->segment_mapping[i] > MAX_SEGMENT_NUM) ++ return -EINVAL; ++ } ++ ++ ret = device_create_file(&spi->dev, &dev_attr_display_text); ++ if (ret) ++ return ret; ++ ++ dev_info(&spi->dev, "Configured display with %u digits and %u symbols\n", ++ s->grid_size, num_leds); ++ ++ return 0; ++} ++ ++static void tm1628_spi_remove(struct spi_device *spi) ++{ ++ device_remove_file(&spi->dev, &dev_attr_display_text); ++ tm1628_set_display_ctrl(spi, false); ++} ++ ++static void tm1628_spi_shutdown(struct spi_device *spi) ++{ ++ tm1628_set_display_ctrl(spi, false); ++} ++ ++static const struct of_device_id tm1628_spi_of_matches[] = { ++ { .compatible = "titanmec,tm1628" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, tm1628_spi_of_matches); ++ ++static const struct spi_device_id tm1628_spi_id_table[] = { ++ { "tm1628" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(spi, tm1628_spi_id_table); ++ ++static struct spi_driver tm1628_spi_driver = { ++ .probe = tm1628_spi_probe, ++ .remove = tm1628_spi_remove, ++ .shutdown = tm1628_spi_shutdown, ++ .id_table = tm1628_spi_id_table, ++ ++ .driver = { ++ .name = "tm1628", ++ .of_match_table = tm1628_spi_of_matches, ++ }, ++}; ++module_spi_driver(tm1628_spi_driver); ++ ++MODULE_DESCRIPTION("TM1628 LED controller driver"); ++MODULE_AUTHOR("Andreas Färber "); ++MODULE_AUTHOR("Heiner Kallweit "); ++MODULE_LICENSE("GPL"); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock.patch b/patch/kernel/archive/meson64-6.10/general-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock.patch new file mode 100644 index 000000000000..e7d09fac12d2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-drm-dw-hdmi-call-hdmi_set_cts_n-after-clock.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 9 Jul 2018 21:25:15 +0200 +Subject: TEMP: drm: dw-hdmi: call hdmi_set_cts_n after clock is enabled + +Unknown patch. Archeology: +- 99f6bef7de297253a659c22d4a35343a209f98b8: Igor Pecovnik : 'Attach Meson64 CURRENT to 5.6.y and make DEV = CURRENT at this point. (#1956)' +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -768,6 +768,11 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) + else + hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE; + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); ++ ++ if (enable) { ++ hdmi_set_cts_n(hdmi, hdmi->audio_cts, 0); ++ hdmi_set_cts_n(hdmi, hdmi->audio_cts, hdmi->audio_n); ++ } + } + + static u8 *hdmi_audio_get_eld(struct dw_hdmi *hdmi) +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-drm-panfrost-fix-reference-leak.patch b/patch/kernel/archive/meson64-6.10/general-drm-panfrost-fix-reference-leak.patch new file mode 100644 index 000000000000..97fb7f4d7a77 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-drm-panfrost-fix-reference-leak.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +Date: Sat, 28 Nov 2020 16:10:04 +0000 +Subject: drm/panfrost: fix reference leak in panfrost_job_hw_submit + +pm_runtime_get_sync will increment pm usage counter even it +failed. Forgetting to putting operation will result in a +reference leak here. + +A new function pm_runtime_resume_and_get is introduced in +[0] to keep usage counter balanced. So We fix the reference +leak by replacing it with new funtion. + +[0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") + +Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") +Reported-by: Hulk Robot +Signed-off-by: Qinglang Miao +--- + drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -204,7 +204,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) + + panfrost_devfreq_record_busy(&pfdev->pfdevfreq); + +- ret = pm_runtime_get_sync(pfdev->dev); ++ ret = pm_runtime_resume_and_get(pfdev->dev); + if (ret < 0) + return; + +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-fix-Kodi-sysinfo-CPU-information.patch b/patch/kernel/archive/meson64-6.10/general-fix-Kodi-sysinfo-CPU-information.patch new file mode 100644 index 000000000000..fc69ccc7fd77 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-fix-Kodi-sysinfo-CPU-information.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sat, 13 Apr 2019 05:45:18 +0000 +Subject: HACK: arm64: fix Kodi sysinfo CPU information + +This allows the CPU information to show in the Kodi sysinfo screen, e.g. + +"ARMv8 Processor rev 4 (v81)" on Amlogic devices + +Signed-off-by: Christian Hewitt +--- + arch/arm64/kernel/cpuinfo.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c +index 111111111111..222222222222 100644 +--- a/arch/arm64/kernel/cpuinfo.c ++++ b/arch/arm64/kernel/cpuinfo.c +@@ -205,8 +205,7 @@ static int c_show(struct seq_file *m, void *v) + * "processor". Give glibc what it expects. + */ + seq_printf(m, "processor\t: %d\n", i); +- if (compat) +- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", ++ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", + MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); + + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-gpu-drm-add-new-display-resolution-2560x1440.patch b/patch/kernel/archive/meson64-6.10/general-gpu-drm-add-new-display-resolution-2560x1440.patch new file mode 100644 index 000000000000..58d2d168894a --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-gpu-drm-add-new-display-resolution-2560x1440.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dongjin Kim +Date: Thu, 10 Sep 2020 11:01:33 +0900 +Subject: ODROID-COMMON: gpu/drm: add new display resolution 2560x1440 + +Signed-off-by: Joy Cho +Signed-off-by: Dongjin Kim +- rpardini: hammer for 6.4-rc5 +--- + drivers/gpu/drm/meson/meson_vclk.c | 18 ++++++++++ + drivers/gpu/drm/meson/meson_venc.c | 2 +- + 2 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_vclk.c ++++ b/drivers/gpu/drm/meson/meson_vclk.c +@@ -357,6 +357,8 @@ enum { + MESON_VCLK_HDMI_594000, + /* 2970 /1 /1 /1 /5 /1 => /1 /2 */ + MESON_VCLK_HDMI_594000_YUV420, ++/* 4830 /2 /1 /2 /5 /1 => /1 /1 */ ++ MESON_VCLK_HDMI_241500, + }; + + struct meson_vclk_params { +@@ -467,6 +469,18 @@ struct meson_vclk_params { + .vid_pll_div = VID_PLL_DIV_5, + .vclk_div = 1, + }, ++ [MESON_VCLK_HDMI_241500] = { ++ .pll_freq = 4830000, ++ .phy_freq = 2415000, ++ .venc_freq = 241500, ++ .vclk_freq = 241500, ++ .pixel_freq = 241500, ++ .pll_od1 = 2, ++ .pll_od2 = 1, ++ .pll_od3 = 2, ++ .vid_pll_div = VID_PLL_DIV_5, ++ .vclk_div = 1, ++ }, + { /* sentinel */ }, + }; + +@@ -873,6 +887,10 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq, + m = 0xf7; + frac = vic_alternate_clock ? 0x8148 : 0x10000; + break; ++ case 4830000: ++ m = 0xc9; ++ frac = 0xd560; ++ break; + } + + meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3); +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -868,7 +868,7 @@ meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode) + DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)) + return MODE_BAD; + +- if (mode->hdisplay < 400 || mode->hdisplay > 1920) ++ if (mode->hdisplay < 400 || mode->hdisplay > 2560) + return MODE_BAD_HVALUE; + + if (mode->vdisplay < 480 || mode->vdisplay > 1920) +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-hdmi-codec-reorder-channel-allocation-list.patch b/patch/kernel/archive/meson64-6.10/general-hdmi-codec-reorder-channel-allocation-list.patch new file mode 100644 index 000000000000..78bb460cfc7d --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-hdmi-codec-reorder-channel-allocation-list.patch @@ -0,0 +1,202 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 23 Dec 2018 02:24:38 +0100 +Subject: WIP: ASoC: hdmi-codec: reorder channel allocation list + +Wrong channel allocation is selected by hdmi_codec_get_ch_alloc_table_idx(). + +E.g when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC + +ca_id 0x01 with speaker mask FL|FR|LFE gets selected instead of +ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels + +and + +ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of +ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels + +Fix this by reorder the channel allocation list with +most specific speaker mask at the top. + +Signed-off-by: Jonas Karlman +--- + sound/soc/codecs/hdmi-codec.c | 140 +++++----- + 1 file changed, 77 insertions(+), 63 deletions(-) + +diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c +index 111111111111..222222222222 100644 +--- a/sound/soc/codecs/hdmi-codec.c ++++ b/sound/soc/codecs/hdmi-codec.c +@@ -185,84 +185,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { + /* + * hdmi_codec_channel_alloc: speaker configuration available for CEA + * +- * This is an ordered list that must match with hdmi_codec_8ch_chmaps struct ++ * This is an ordered list where ca_id must exist in hdmi_codec_8ch_chmaps + * The preceding ones have better chances to be selected by + * hdmi_codec_get_ch_alloc_table_idx(). + */ + static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { + { .ca_id = 0x00, .n_ch = 2, +- .mask = FL | FR}, +- /* 2.1 */ +- { .ca_id = 0x01, .n_ch = 4, +- .mask = FL | FR | LFE}, +- /* Dolby Surround */ ++ .mask = FL | FR }, ++ { .ca_id = 0x03, .n_ch = 4, ++ .mask = FL | FR | LFE | FC }, + { .ca_id = 0x02, .n_ch = 4, + .mask = FL | FR | FC }, +- /* surround51 */ ++ { .ca_id = 0x01, .n_ch = 4, ++ .mask = FL | FR | LFE }, + { .ca_id = 0x0b, .n_ch = 6, +- .mask = FL | FR | LFE | FC | RL | RR}, +- /* surround40 */ +- { .ca_id = 0x08, .n_ch = 6, +- .mask = FL | FR | RL | RR }, +- /* surround41 */ +- { .ca_id = 0x09, .n_ch = 6, +- .mask = FL | FR | LFE | RL | RR }, +- /* surround50 */ ++ .mask = FL | FR | LFE | FC | RL | RR }, + { .ca_id = 0x0a, .n_ch = 6, + .mask = FL | FR | FC | RL | RR }, +- /* 6.1 */ +- { .ca_id = 0x0f, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RL | RR | RC }, +- /* surround71 */ ++ { .ca_id = 0x09, .n_ch = 6, ++ .mask = FL | FR | LFE | RL | RR }, ++ { .ca_id = 0x08, .n_ch = 6, ++ .mask = FL | FR | RL | RR }, ++ { .ca_id = 0x07, .n_ch = 6, ++ .mask = FL | FR | LFE | FC | RC }, ++ { .ca_id = 0x06, .n_ch = 6, ++ .mask = FL | FR | FC | RC }, ++ { .ca_id = 0x05, .n_ch = 6, ++ .mask = FL | FR | LFE | RC }, ++ { .ca_id = 0x04, .n_ch = 6, ++ .mask = FL | FR | RC }, + { .ca_id = 0x13, .n_ch = 8, + .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC }, +- /* others */ +- { .ca_id = 0x03, .n_ch = 8, +- .mask = FL | FR | LFE | FC }, +- { .ca_id = 0x04, .n_ch = 8, +- .mask = FL | FR | RC}, +- { .ca_id = 0x05, .n_ch = 8, +- .mask = FL | FR | LFE | RC }, +- { .ca_id = 0x06, .n_ch = 8, +- .mask = FL | FR | FC | RC }, +- { .ca_id = 0x07, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RC }, +- { .ca_id = 0x0c, .n_ch = 8, +- .mask = FL | FR | RC | RL | RR }, +- { .ca_id = 0x0d, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | RC }, +- { .ca_id = 0x0e, .n_ch = 8, +- .mask = FL | FR | FC | RL | RR | RC }, +- { .ca_id = 0x10, .n_ch = 8, +- .mask = FL | FR | RL | RR | RLC | RRC }, +- { .ca_id = 0x11, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, + { .ca_id = 0x12, .n_ch = 8, + .mask = FL | FR | FC | RL | RR | RLC | RRC }, +- { .ca_id = 0x14, .n_ch = 8, +- .mask = FL | FR | FLC | FRC }, +- { .ca_id = 0x15, .n_ch = 8, +- .mask = FL | FR | LFE | FLC | FRC }, +- { .ca_id = 0x16, .n_ch = 8, +- .mask = FL | FR | FC | FLC | FRC }, +- { .ca_id = 0x17, .n_ch = 8, +- .mask = FL | FR | LFE | FC | FLC | FRC }, +- { .ca_id = 0x18, .n_ch = 8, +- .mask = FL | FR | RC | FLC | FRC }, +- { .ca_id = 0x19, .n_ch = 8, +- .mask = FL | FR | LFE | RC | FLC | FRC }, +- { .ca_id = 0x1a, .n_ch = 8, +- .mask = FL | FR | RC | FC | FLC | FRC }, +- { .ca_id = 0x1b, .n_ch = 8, +- .mask = FL | FR | LFE | RC | FC | FLC | FRC }, +- { .ca_id = 0x1c, .n_ch = 8, +- .mask = FL | FR | RL | RR | FLC | FRC }, +- { .ca_id = 0x1d, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | FLC | FRC }, + { .ca_id = 0x1e, .n_ch = 8, + .mask = FL | FR | FC | RL | RR | FLC | FRC }, +- { .ca_id = 0x1f, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, ++ { .ca_id = 0x11, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | FLC | FRC }, ++ { .ca_id = 0x10, .n_ch = 8, ++ .mask = FL | FR | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1c, .n_ch = 8, ++ .mask = FL | FR | RL | RR | FLC | FRC }, ++ { .ca_id = 0x0f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | RC }, ++ { .ca_id = 0x1b, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FC | FLC | FRC }, ++ { .ca_id = 0x0e, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR | RC }, ++ { .ca_id = 0x1a, .n_ch = 8, ++ .mask = FL | FR | RC | FC | FLC | FRC }, ++ { .ca_id = 0x0d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RC }, ++ { .ca_id = 0x19, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FLC | FRC }, ++ { .ca_id = 0x0c, .n_ch = 8, ++ .mask = FL | FR | RC | RL | RR }, ++ { .ca_id = 0x18, .n_ch = 8, ++ .mask = FL | FR | RC | FLC | FRC }, ++ { .ca_id = 0x17, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | FLC | FRC }, ++ { .ca_id = 0x16, .n_ch = 8, ++ .mask = FL | FR | FC | FLC | FRC }, ++ { .ca_id = 0x15, .n_ch = 8, ++ .mask = FL | FR | LFE | FLC | FRC }, ++ { .ca_id = 0x14, .n_ch = 8, ++ .mask = FL | FR | FLC | FRC }, ++ { .ca_id = 0x0b, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR }, ++ { .ca_id = 0x0a, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR }, ++ { .ca_id = 0x09, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR }, ++ { .ca_id = 0x08, .n_ch = 8, ++ .mask = FL | FR | RL | RR }, ++ { .ca_id = 0x07, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RC }, ++ { .ca_id = 0x06, .n_ch = 8, ++ .mask = FL | FR | FC | RC }, ++ { .ca_id = 0x05, .n_ch = 8, ++ .mask = FL | FR | LFE | RC }, ++ { .ca_id = 0x04, .n_ch = 8, ++ .mask = FL | FR | RC }, ++ { .ca_id = 0x03, .n_ch = 8, ++ .mask = FL | FR | LFE | FC }, ++ { .ca_id = 0x02, .n_ch = 8, ++ .mask = FL | FR | FC }, ++ { .ca_id = 0x01, .n_ch = 8, ++ .mask = FL | FR | LFE }, + }; + + struct hdmi_codec_priv { +@@ -371,7 +384,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); + struct hdmi_codec_priv *hcp = info->private_data; + +- map = info->chmap[hcp->chmap_idx].map; ++ if (hcp->chmap_idx != HDMI_CODEC_CHMAP_IDX_UNKNOWN) ++ map = info->chmap[hcp->chmap_idx].map; + + for (i = 0; i < info->max_channels; i++) { + if (hcp->chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN) +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-input-touchscreen-Add-D-WAV-Multitouch.patch b/patch/kernel/archive/meson64-6.10/general-input-touchscreen-Add-D-WAV-Multitouch.patch new file mode 100644 index 000000000000..ba6d7f51ad52 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-input-touchscreen-Add-D-WAV-Multitouch.patch @@ -0,0 +1,636 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hyeonki Hong +Date: Thu, 5 Mar 2020 19:01:43 +0900 +Subject: ODROID-COMMON: input/touchscreen: Add D-WAV Multitouch driver. + +Change-Id: Ia1c8c29d3f69c6ba5d630279c4cc98119b68ab71 +--- + drivers/hid/hid-ids.h | 6 + + drivers/hid/hid-quirks.c | 3 + + drivers/input/touchscreen/Kconfig | 10 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/dwav-usb-mt.c | 554 ++++++++++ + 5 files changed, 574 insertions(+) + +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 111111111111..222222222222 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -1481,4 +1481,10 @@ + #define USB_VENDOR_ID_SIGNOTEC 0x2133 + #define USB_DEVICE_ID_SIGNOTEC_VIEWSONIC_PD1011 0x0018 + ++#define USB_DEVICE_ID_DWAV_MULTITOUCH 0x0005 ++ ++#define USB_VENDOR_ID_ODROID 0x16b4 ++#define USB_DEVICE_ID_VU5 0x0704 ++#define USB_DEVICE_ID_VU7PLUS 0x0705 ++ + #endif +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 111111111111..222222222222 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -891,6 +891,9 @@ static const struct hid_device_id hid_ignore_list[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) }, + #endif + { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, ++ ++ { HID_USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU5) }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU7PLUS) }, + { } + }; + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -1430,4 +1430,14 @@ config TOUCHSCREEN_HIMAX_HX83112B + To compile this driver as a module, choose M here: the + module will be called himax_hx83112b. + ++config TOUCHSCREEN_DWAV_USB_MT ++ tristate "D-WAV Scientific USB MultiTouch" ++ depends on USB_ARCH_HAS_HCD ++ select USB ++ help ++ Say Y here if you have a D-WAV Scientific USB(HID) based MultiTouch ++ controller. ++ ++ module will be called dwav-usb-mt. ++ + endif +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -120,4 +120,5 @@ obj-$(CONFIG_TOUCHSCREEN_RASPBERRYPI_FW) += raspberrypi-ts.o + obj-$(CONFIG_TOUCHSCREEN_IQS5XX) += iqs5xx.o + obj-$(CONFIG_TOUCHSCREEN_IQS7211) += iqs7211.o + obj-$(CONFIG_TOUCHSCREEN_ZINITIX) += zinitix.o ++obj-$(CONFIG_TOUCHSCREEN_DWAV_USB_MT) += dwav-usb-mt.o + obj-$(CONFIG_TOUCHSCREEN_HIMAX_HX83112B) += himax_hx83112b.o +diff --git a/drivers/input/touchscreen/dwav-usb-mt.c b/drivers/input/touchscreen/dwav-usb-mt.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/input/touchscreen/dwav-usb-mt.c +@@ -0,0 +1,554 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * D-WAV Scientific USB(HID) MultiTouch Screen Driver(Based on usbtouchscreen.c) ++ * ++ * Copyright (C) Hardkernel, 2015 ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define USB_VENDOR_ID_DWAV 0x0eef /* 800 x 480, 7" DWAV touch */ ++#define USB_DEVICE_ID_VU7 0x0005 ++ ++#define USB_VENDOR_ID_ODROID 0x16b4 ++#define USB_DEVICE_ID_VU5 0x0704 ++#define USB_DEVICE_ID_VU7PLUS 0x0705 ++ ++enum { ++ ODROID_VU7 = 0, /* 800 x 480, 7" Touch */ ++ ODROID_VU5, /* 800 x 480, 5" Touch */ ++ ODROID_VU7PLUS, /* 1024 x 600, 7" Touch */ ++}; ++ ++struct usbtouch_device_info { ++ char name[64]; ++ int max_x; ++ int max_y; ++ int max_press; ++ int max_finger; ++}; ++ ++const struct usbtouch_device_info DEV_INFO[] = { ++ [ODROID_VU7] = { ++ .name = "ODROID VU7 MultiTouch(800x480)", ++ .max_x = 800, ++ .max_y = 480, ++ .max_press = 255, ++ .max_finger = 5, ++ }, ++ [ODROID_VU5] = { ++ .name = "ODROID VU5 MultiTouch(800x480)", ++ .max_x = 800, ++ .max_y = 480, ++ .max_press = 255, ++ .max_finger = 5, ++ }, ++ [ODROID_VU7PLUS] = { ++ .name = "ODROID VU7 Plus MultiTouch(1024x600)", ++ .max_x = 1024, ++ .max_y = 600, ++ .max_press = 255, ++ .max_finger = 5, ++ }, ++}; ++ ++static const struct usb_device_id dwav_usb_mt_devices[] = { ++ {USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_VU7), ++ .driver_info = ODROID_VU7}, ++ {USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU5), ++ .driver_info = ODROID_VU5}, ++ {USB_DEVICE(USB_VENDOR_ID_ODROID, USB_DEVICE_ID_VU7PLUS), ++ .driver_info = ODROID_VU7PLUS}, ++ {} ++}; ++ ++struct dwav_raw { /* Total 25 bytes */ ++ unsigned char header; /* frame header 0xAA*/ ++ unsigned char press; ++ /* Touch flag (1:valid touch data, 0:touch finished) */ ++ unsigned short x1; /* 1st x */ ++ unsigned short y1; /* 1st y */ ++ unsigned char end; ++ /* 1st touch finish flags 0xBB, RPI only uses the first 7 bytes */ ++ unsigned char ids; /* touch ID(bit field) */ ++ unsigned short y2; ++ unsigned short x2; ++ unsigned short y3; ++ unsigned short x3; ++ unsigned short y4; ++ unsigned short x4; ++ unsigned short y5; ++ unsigned short x5; ++ unsigned char tail; /* frame end 0xCC */ ++}; ++ ++#define TS_EVENT_UNKNOWN 0x00 ++#define TS_EVENT_PRESS 0x01 ++#define TS_EVENT_RELEASE 0x02 ++ ++struct finger_t { ++ unsigned int status; /* ts event type */ ++ unsigned int x; /* ts data x */ ++ unsigned int y; /* ts data y */ ++} __packed; ++ ++struct dwav_usb_mt { ++ char name[128], phys[64]; ++ ++ int dev_id; ++ /* for URB Data DMA */ ++ dma_addr_t data_dma; ++ unsigned char *data; ++ int data_size; ++ ++ struct urb *irq; ++ struct usb_interface *interface; ++ struct input_dev *input; ++ ++ struct finger_t *finger; ++}; ++ ++static void dwav_usb_mt_report(struct dwav_usb_mt *dwav_usb_mt) ++{ ++ int id, max_x, max_y, max_press, max_finger; ++ ++ max_x = DEV_INFO[dwav_usb_mt->dev_id].max_x; ++ max_y = DEV_INFO[dwav_usb_mt->dev_id].max_y; ++ max_press = DEV_INFO[dwav_usb_mt->dev_id].max_press; ++ max_finger = DEV_INFO[dwav_usb_mt->dev_id].max_finger; ++ ++ for (id = 0; id < max_finger; id++) { ++ ++ if (dwav_usb_mt->finger[id].status == TS_EVENT_UNKNOWN) ++ continue; ++ ++ if (dwav_usb_mt->finger[id].x >= max_x || ++ dwav_usb_mt->finger[id].y >= max_y) ++ continue; ++ ++ input_mt_slot(dwav_usb_mt->input, id); ++ ++ if (dwav_usb_mt->finger[id].status != TS_EVENT_RELEASE) { ++ input_mt_report_slot_state(dwav_usb_mt->input, ++ MT_TOOL_FINGER, true); ++ input_report_abs(dwav_usb_mt->input, ++ ABS_MT_POSITION_X, ++ dwav_usb_mt->finger[id].x); ++ input_report_abs(dwav_usb_mt->input, ++ ABS_MT_POSITION_Y, ++ dwav_usb_mt->finger[id].y); ++ input_report_abs(dwav_usb_mt->input, ++ ABS_MT_PRESSURE, ++ max_press); ++ } else { ++ input_mt_report_slot_state(dwav_usb_mt->input, ++ MT_TOOL_FINGER, false); ++ dwav_usb_mt->finger[id].status = TS_EVENT_UNKNOWN; ++ } ++ input_mt_report_pointer_emulation(dwav_usb_mt->input, true); ++ input_sync(dwav_usb_mt->input); ++ } ++} ++ ++static void dwav_usb_mt_process(struct dwav_usb_mt *dwav_usb_mt, ++ unsigned char *pkt, int len) ++{ ++ struct dwav_raw *dwav_raw = (struct dwav_raw *)pkt; ++ unsigned char bit_mask, cnt; ++ ++ for (cnt = 0, bit_mask = 0x01; ++ cnt < DEV_INFO[dwav_usb_mt->dev_id].max_finger; ++ cnt++, bit_mask <<= 1) { ++ if ((dwav_raw->ids & bit_mask) && dwav_raw->press) { ++ dwav_usb_mt->finger[cnt].status = TS_EVENT_PRESS; ++ switch (cnt) { ++ case 0: ++ dwav_usb_mt->finger[cnt].x ++ = cpu_to_be16(dwav_raw->x1); ++ dwav_usb_mt->finger[cnt].y ++ = cpu_to_be16(dwav_raw->y1); ++ break; ++ case 1: ++ dwav_usb_mt->finger[cnt].x ++ = cpu_to_be16(dwav_raw->x2); ++ dwav_usb_mt->finger[cnt].y ++ = cpu_to_be16(dwav_raw->y2); ++ break; ++ case 2: ++ dwav_usb_mt->finger[cnt].x ++ = cpu_to_be16(dwav_raw->x3); ++ dwav_usb_mt->finger[cnt].y ++ = cpu_to_be16(dwav_raw->y3); ++ break; ++ case 3: ++ dwav_usb_mt->finger[cnt].x ++ = cpu_to_be16(dwav_raw->x4); ++ dwav_usb_mt->finger[cnt].y ++ = cpu_to_be16(dwav_raw->y4); ++ break; ++ case 4: ++ dwav_usb_mt->finger[cnt].x ++ = cpu_to_be16(dwav_raw->x5); ++ dwav_usb_mt->finger[cnt].y ++ = cpu_to_be16(dwav_raw->y5); ++ break; ++ default: ++ break; ++ } ++ } else { ++ if (dwav_usb_mt->finger[cnt].status == TS_EVENT_PRESS) ++ dwav_usb_mt->finger[cnt].status ++ = TS_EVENT_RELEASE; ++ else ++ dwav_usb_mt->finger[cnt].status ++ = TS_EVENT_UNKNOWN; ++ } ++ } ++ dwav_usb_mt_report(dwav_usb_mt); ++} ++ ++static void dwav_usb_mt_irq(struct urb *urb) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = urb->context; ++ struct device *dev = &dwav_usb_mt->interface->dev; ++ int retval; ++ ++ switch (urb->status) { ++ case 0: ++ /* success */ ++ break; ++ case -ETIME: ++ /* this urb is timing out */ ++ dev_dbg(dev, "%s - urb timed out - was the device unplugged?\n", ++ __func__); ++ return; ++ case -ECONNRESET: ++ case -ENOENT: ++ case -ESHUTDOWN: ++ case -EPIPE: ++ /* this urb is terminated, clean up */ ++ dev_dbg(dev, "%s - urb shutting down with status: %d\n", ++ __func__, urb->status); ++ return; ++ default: ++ dev_dbg(dev, "%s - nonzero urb status received: %d\n", ++ __func__, urb->status); ++ goto exit; ++ } ++ ++ dwav_usb_mt_process(dwav_usb_mt, dwav_usb_mt->data, urb->actual_length); ++ ++exit: ++ usb_mark_last_busy(interface_to_usbdev(dwav_usb_mt->interface)); ++ retval = usb_submit_urb(urb, GFP_ATOMIC); ++ if (retval) { ++ dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", ++ __func__, retval); ++ } ++} ++ ++static int dwav_usb_mt_open(struct input_dev *input) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = input_get_drvdata(input); ++ int r; ++ ++ dwav_usb_mt->irq->dev = interface_to_usbdev(dwav_usb_mt->interface); ++ ++ r = usb_autopm_get_interface(dwav_usb_mt->interface) ? -EIO : 0; ++ if (r < 0) ++ goto out; ++ ++ if (usb_submit_urb(dwav_usb_mt->irq, GFP_KERNEL)) { ++ r = -EIO; ++ goto out_put; ++ } ++ ++ dwav_usb_mt->interface->needs_remote_wakeup = 1; ++out_put: ++ usb_autopm_put_interface(dwav_usb_mt->interface); ++out: ++ return r; ++} ++ ++static void dwav_usb_mt_close(struct input_dev *input) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = input_get_drvdata(input); ++ int r; ++ ++ usb_kill_urb(dwav_usb_mt->irq); ++ ++ r = usb_autopm_get_interface(dwav_usb_mt->interface); ++ ++ dwav_usb_mt->interface->needs_remote_wakeup = 0; ++ if (!r) ++ usb_autopm_put_interface(dwav_usb_mt->interface); ++} ++ ++static int dwav_usb_mt_suspend(struct usb_interface *intf, pm_message_t message) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf); ++ ++ usb_kill_urb(dwav_usb_mt->irq); ++ ++ return 0; ++} ++ ++static int dwav_usb_mt_resume(struct usb_interface *intf) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf); ++ struct input_dev *input = dwav_usb_mt->input; ++ int result = 0; ++ ++ mutex_lock(&input->mutex); ++ if (input->users) ++ result = usb_submit_urb(dwav_usb_mt->irq, GFP_NOIO); ++ mutex_unlock(&input->mutex); ++ ++ return result; ++} ++ ++static int dwav_usb_mt_reset_resume(struct usb_interface *intf) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf); ++ struct input_dev *input = dwav_usb_mt->input; ++ int err = 0; ++ ++ /* restart IO if needed */ ++ mutex_lock(&input->mutex); ++ if (input->users) ++ err = usb_submit_urb(dwav_usb_mt->irq, GFP_NOIO); ++ mutex_unlock(&input->mutex); ++ ++ return err; ++} ++ ++static void dwav_usb_mt_free_buffers(struct usb_device *udev, ++ struct dwav_usb_mt *dwav_usb_mt) ++{ ++ usb_free_coherent(udev, dwav_usb_mt->data_size, ++ dwav_usb_mt->data, dwav_usb_mt->data_dma); ++} ++ ++static struct usb_endpoint_descriptor *dwav_usb_mt_get_input_endpoint( ++ struct usb_host_interface *interface) ++{ ++ int i; ++ ++ for (i = 0; i < interface->desc.bNumEndpoints; i++) { ++ if (usb_endpoint_dir_in(&interface->endpoint[i].desc)) ++ return &interface->endpoint[i].desc; ++ } ++ ++ return NULL; ++} ++ ++static int dwav_usb_mt_init(struct dwav_usb_mt *dwav_usb_mt, void *dev) ++{ ++ int err; ++ struct input_dev *input_dev = (struct input_dev *)dev; ++ ++ input_dev->name = dwav_usb_mt->name; ++ input_dev->phys = dwav_usb_mt->phys; ++ ++ input_set_drvdata(input_dev, dwav_usb_mt); ++ ++ input_dev->open = dwav_usb_mt_open; ++ input_dev->close = dwav_usb_mt_close; ++ ++ input_dev->id.bustype = BUS_USB; ++ ++ /* single touch */ ++ input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); ++ input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); ++ ++ input_set_abs_params(input_dev, ABS_X, 0, ++ DEV_INFO[dwav_usb_mt->dev_id].max_x, 0, 0); ++ input_set_abs_params(input_dev, ABS_Y, 0, ++ DEV_INFO[dwav_usb_mt->dev_id].max_y, 0, 0); ++ ++ /* multi touch */ ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ DEV_INFO[dwav_usb_mt->dev_id].max_x, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ DEV_INFO[dwav_usb_mt->dev_id].max_y, 0, 0); ++ input_mt_init_slots(input_dev, ++ DEV_INFO[dwav_usb_mt->dev_id].max_finger, 0); ++ ++ err = input_register_device(input_dev); ++ if (err) { ++ pr_err("%s - input_register_device failed, err: %d\n", ++ __func__, err); ++ return err; ++ } ++ ++ dwav_usb_mt->input = input_dev; ++ ++ return 0; ++} ++ ++static int dwav_usb_mt_probe(struct usb_interface *intf, ++ const struct usb_device_id *id) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = NULL; ++ struct input_dev *input_dev = NULL; ++ struct usb_endpoint_descriptor *endpoint; ++ struct usb_device *udev = interface_to_usbdev(intf); ++ ++ int err = 0; ++ ++ endpoint = dwav_usb_mt_get_input_endpoint(intf->cur_altsetting); ++ if (!endpoint) ++ return -ENXIO; ++ ++ dwav_usb_mt = kzalloc(sizeof(struct dwav_usb_mt), GFP_KERNEL); ++ if (!dwav_usb_mt) ++ return -ENOMEM; ++ ++ dwav_usb_mt->dev_id = id->driver_info; ++ ++ dwav_usb_mt->finger = kzalloc(sizeof(struct finger_t) * ++ DEV_INFO[dwav_usb_mt->dev_id].max_finger, ++ GFP_KERNEL); ++ ++ if (!dwav_usb_mt->finger) ++ goto err_free_mem; ++ ++ input_dev = input_allocate_device(); ++ if (!input_dev) ++ goto err_free_mem; ++ ++ dwav_usb_mt->data_size = sizeof(struct dwav_raw); ++ dwav_usb_mt->data = usb_alloc_coherent(udev, dwav_usb_mt->data_size, ++ GFP_KERNEL, &dwav_usb_mt->data_dma); ++ if (!dwav_usb_mt->data) ++ goto err_free_mem; ++ ++ dwav_usb_mt->irq = usb_alloc_urb(0, GFP_KERNEL); ++ if (!dwav_usb_mt->irq) { ++ dev_dbg(&intf->dev, ++ "%s - usb_alloc_urb failed: usbtouch->irq\n", ++ __func__); ++ goto err_free_buffers; ++ } ++ ++ if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) { ++ usb_fill_int_urb(dwav_usb_mt->irq, udev, ++ usb_rcvintpipe(udev, endpoint->bEndpointAddress), ++ dwav_usb_mt->data, dwav_usb_mt->data_size, ++ dwav_usb_mt_irq, dwav_usb_mt, endpoint->bInterval); ++ } else { ++ usb_fill_bulk_urb(dwav_usb_mt->irq, udev, ++ usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), ++ dwav_usb_mt->data, dwav_usb_mt->data_size, ++ dwav_usb_mt_irq, dwav_usb_mt); ++ } ++ ++ dwav_usb_mt->irq->dev = udev; ++ dwav_usb_mt->irq->transfer_dma = dwav_usb_mt->data_dma; ++ dwav_usb_mt->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; ++ ++ dwav_usb_mt->interface = intf; ++ ++ if (udev->manufacturer) ++ strscpy(dwav_usb_mt->name, ++ udev->manufacturer, sizeof(dwav_usb_mt->name)); ++ ++ if (udev->product) { ++ if (udev->manufacturer) ++ strlcat(dwav_usb_mt->name, ++ " ", sizeof(dwav_usb_mt->name)); ++ ++ strlcat(dwav_usb_mt->name, ++ udev->product, sizeof(dwav_usb_mt->name)); ++ } ++ ++ if (!strlen(dwav_usb_mt->name)) { ++ snprintf(dwav_usb_mt->name, sizeof(dwav_usb_mt->name), ++ "D-WAV Scientific MultiTouch %04x:%04x", ++ le16_to_cpu(udev->descriptor.idVendor), ++ le16_to_cpu(udev->descriptor.idProduct)); ++ } ++ ++ usb_make_path(udev, dwav_usb_mt->phys, sizeof(dwav_usb_mt->phys)); ++ strlcat(dwav_usb_mt->phys, "/input0", sizeof(dwav_usb_mt->phys)); ++ ++ usb_to_input_id(udev, &input_dev->id); ++ ++ input_dev->dev.parent = &intf->dev; ++ ++ err = dwav_usb_mt_init(dwav_usb_mt, (void *)input_dev); ++ if (err) ++ goto err_free_urb; ++ ++ usb_set_intfdata(intf, dwav_usb_mt); ++ ++ dev_info(&intf->dev, "%s\n", DEV_INFO[dwav_usb_mt->dev_id].name); ++ ++ return 0; ++ ++err_free_urb: ++ usb_free_urb(dwav_usb_mt->irq); ++ ++err_free_buffers: ++ dwav_usb_mt_free_buffers(udev, dwav_usb_mt); ++ ++err_free_mem: ++ if (input_dev) ++ input_free_device(input_dev); ++ kfree(dwav_usb_mt); ++ ++ return err; ++} ++ ++static void dwav_usb_mt_disconnect(struct usb_interface *intf) ++{ ++ struct dwav_usb_mt *dwav_usb_mt = usb_get_intfdata(intf); ++ ++ if (!dwav_usb_mt) ++ return; ++ ++ dev_dbg(&intf->dev, ++ "%s - dwav_usb_mt is initialized, cleaning up\n", ++ __func__); ++ ++ usb_set_intfdata(intf, NULL); ++ ++ /* this will stop IO via close */ ++ input_unregister_device(dwav_usb_mt->input); ++ ++ usb_free_urb(dwav_usb_mt->irq); ++ ++ dwav_usb_mt_free_buffers(interface_to_usbdev(intf), dwav_usb_mt); ++ ++ kfree(dwav_usb_mt); ++} ++ ++MODULE_DEVICE_TABLE(usb, dwav_usb_mt_devices); ++ ++static struct usb_driver dwav_usb_mt_driver = { ++ .name = "dwav_usb_mt", ++ .probe = dwav_usb_mt_probe, ++ .disconnect = dwav_usb_mt_disconnect, ++ .suspend = dwav_usb_mt_suspend, ++ .resume = dwav_usb_mt_resume, ++ .reset_resume = dwav_usb_mt_reset_resume, ++ .id_table = dwav_usb_mt_devices, ++ .supports_autosuspend = 1, ++}; ++ ++module_usb_driver(dwav_usb_mt_driver); ++ ++MODULE_AUTHOR("Hardkernel Co.,Ltd"); ++MODULE_DESCRIPTION("D-WAV USB(HID) MultiTouch Driver"); ++MODULE_LICENSE("GPL"); ++ ++MODULE_ALIAS("dwav_usb_mt"); +\ No newline at end of file +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-media-cec-silence-CEC-timeout-message-HACK.patch b/patch/kernel/archive/meson64-6.10/general-media-cec-silence-CEC-timeout-message-HACK.patch new file mode 100644 index 000000000000..4905e2e4fcb2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-media-cec-silence-CEC-timeout-message-HACK.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 7 Jan 2020 07:12:47 +0000 +Subject: HACK: media: cec: silence CEC timeout message + +If testing with an AVR that does not pass-through CEC state the system +log fills with timeout messages. Silence this to stop the log rotation +and ensure other issues are visible. + +[ 42.718009] cec-meson_ao_cec: message ff 84 50 00 01 timed out +[ 45.021994] cec-meson_ao_cec: message ff 87 00 15 82 timed out +[ 47.325965] cec-meson_ao_cec: message 10 timed out +[ 49.630023] cec-meson_ao_cec: message 10 timed out +[ 51.933960] cec-meson_ao_cec: message 10 timed out + +Signed-off-by: Christian Hewitt +--- + drivers/media/cec/core/cec-adap.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c +index 111111111111..222222222222 100644 +--- a/drivers/media/cec/core/cec-adap.c ++++ b/drivers/media/cec/core/cec-adap.c +@@ -510,9 +510,9 @@ int cec_thread_func(void *_adap) + * default). + */ + if (adap->transmitting) { +- pr_warn("cec-%s: message %*ph timed out\n", adap->name, +- adap->transmitting->msg.len, +- adap->transmitting->msg.msg); ++ //pr_warn("cec-%s: message %*ph timed out\n", adap->name, ++ // adap->transmitting->msg.len, ++ // adap->transmitting->msg.msg); + /* Just give up on this. */ + cec_data_cancel(adap->transmitting, + CEC_TX_STATUS_TIMEOUT, 0); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-memory-marked-nomap.patch b/patch/kernel/archive/meson64-6.10/general-memory-marked-nomap.patch new file mode 100644 index 000000000000..dc7329403333 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-memory-marked-nomap.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stefan Agner +Date: Wed, 15 Sep 2021 05:00:45 +0000 +Subject: HACK: of: partial revert of fdt.c changes + +This resolves reports similar to the below which are present in dmesg +since Linux 5.10; which are also causing crashes in some distros: + +[ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for node 'secmon@5000000': base 0x0000000005000000, size 3 MiB + +Signed-off-by: Christian Hewitt +--- + drivers/of/of_reserved_mem.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c +index 111111111111..222222222222 100644 +--- a/drivers/of/of_reserved_mem.c ++++ b/drivers/of/of_reserved_mem.c +@@ -82,15 +82,6 @@ static int __init early_init_dt_reserve_memory(phys_addr_t base, + phys_addr_t size, bool nomap) + { + if (nomap) { +- /* +- * If the memory is already reserved (by another region), we +- * should not allow it to be marked nomap, but don't worry +- * if the region isn't memory as it won't be mapped. +- */ +- if (memblock_overlaps_region(&memblock.memory, base, size) && +- memblock_is_region_reserved(base, size)) +- return -EBUSY; +- + return memblock_mark_nomap(base, size); + } + return memblock_reserve(base, size); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-aiu-Fix-HDMI-codec-control-selection.patch b/patch/kernel/archive/meson64-6.10/general-meson-aiu-Fix-HDMI-codec-control-selection.patch new file mode 100644 index 000000000000..70d874407f2f --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-aiu-Fix-HDMI-codec-control-selection.patch @@ -0,0 +1,232 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Blumenstingl +Date: Sun, 3 Oct 2021 05:35:48 +0000 +Subject: ASoC: meson: aiu: Fix HDMI codec control selection + +The HDMI controllers on Amlogic Meson SoCs which use the AIU +audio-controller have two different audio format inputs: +- I2S which is also the only configuration supported on GXBB, GXL and + GXM SoCs since there's no SPDIF support in the DesignWare HDMI + controller driver (at the time of writing this) +- SPDIF can be used optionally, including pass-through formats + +Switching between these requires us to set different registers: +AIU_HDMI_CLK_DATA_CTRL[1:0] "HDMI_DATA_CLK_SEL": +- 0x0 disables the HDMI output clock +- 0x1 selects the PCM clock +- 0x2 selects the AIU clock +- 0x3 is reserved + +AIU_HDMI_CLK_DATA_CTRL[5:4] "HDMI_DATA_SEL": +- 0x0 outputs constant zero, disables HDMI data +- 0x1 selects PCM data +- 0x2 selects AIU I2S data +- 0x3 is reserved + +AIU_CLK_CTRL_MORE[6] "HDMITX_SEL_AOCLKX2": +- 0x0 selects cts_i958 as AIU clk to hdmi_tx_audio_master_clk +- 0x1 selects cts_aoclkx2_int as AIU clk to hdmi_tx_audio_master_clk + +The Meson8/8b/8m2 vendor driver uses the following settings: +SPDIF output to the HDMI controller: +- 0x2 (AIU clock) in AIU_HDMI_CLK_DATA_CTRL[1:0] +- 0x0 (no HDMI data) in AIU_HDMI_CLK_DATA_CTRL[5:4] +- 0x0 (using cts_i958 as AIU clk) in AIU_CLK_CTRL_MORE[6] +I2S output to the HDMI controller: +- 0x2 (AIU clock) in AIU_HDMI_CLK_DATA_CTRL[1:0] +- 0x2 (I2S data) in AIU_HDMI_CLK_DATA_CTRL[5:4] +- 0x0 (using cts_aoclkx2_int as AIU clk) in AIU_CLK_CTRL_MORE[6] + +The GXBB/GXL/GXM vendor driver uses the following settings: +SPDIF output to the HDMI controller: +- not setting AIU_HDMI_CLK_DATA_CTRL at all +- 0x0 (using cts_i958 as AIU clk) in AIU_CLK_CTRL_MORE[6] +I2S output to the HDMI controller: +- 0x2 (AIU clock) in AIU_HDMI_CLK_DATA_CTRL[1:0] +- 0x2 (I2S data) in AIU_HDMI_CLK_DATA_CTRL[5:4] +- 0x0 (using cts_aoclkx2_int as AIU clk) in AIU_CLK_CTRL_MORE[6] + +Set the three registers at the same time following what the vendor +driver does on Meson8/8b/8m2 SoCs. This makes the SPDIF output to the +HDMI controller work. The entries and order of the entries in the enum +is not changed on purpose to not break old configurations. + +Fixes: b82b734c0e9a7 ("ASoC: meson: aiu: add hdmi codec control support") +Signed-off-by: Martin Blumenstingl +--- + sound/soc/meson/aiu-codec-ctrl.c | 108 +++++++--- + sound/soc/meson/aiu-encoder-i2s.c | 6 - + 2 files changed, 80 insertions(+), 34 deletions(-) + +diff --git a/sound/soc/meson/aiu-codec-ctrl.c b/sound/soc/meson/aiu-codec-ctrl.c +index 111111111111..222222222222 100644 +--- a/sound/soc/meson/aiu-codec-ctrl.c ++++ b/sound/soc/meson/aiu-codec-ctrl.c +@@ -12,14 +12,60 @@ + #include "aiu.h" + #include "meson-codec-glue.h" + +-#define CTRL_CLK_SEL GENMASK(1, 0) +-#define CTRL_DATA_SEL_SHIFT 4 +-#define CTRL_DATA_SEL (0x3 << CTRL_DATA_SEL_SHIFT) +- +-static const char * const aiu_codec_ctrl_mux_texts[] = { +- "DISABLED", "PCM", "I2S", ++#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL GENMASK(1, 0) ++#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_DISABLE 0x0 ++#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_PCM 0x1 ++#define AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_AIU 0x2 ++#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL GENMASK(5, 4) ++#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_OUTPUT_ZERO 0x0 ++#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_PCM_DATA 0x1 ++#define AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_I2S_DATA 0x2 ++ ++#define AIU_CLK_CTRL_MORE_AMCLK BIT(6) ++ ++#define AIU_HDMI_CTRL_MUX_DISABLED 0 ++#define AIU_HDMI_CTRL_MUX_PCM 1 ++#define AIU_HDMI_CTRL_MUX_I2S 2 ++ ++static const char * const aiu_codec_hdmi_ctrl_mux_texts[] = { ++ [AIU_HDMI_CTRL_MUX_DISABLED] = "DISABLED", ++ [AIU_HDMI_CTRL_MUX_PCM] = "PCM", ++ [AIU_HDMI_CTRL_MUX_I2S] = "I2S", + }; + ++static int aiu_codec_ctrl_mux_get_enum(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_component *component = ++ snd_soc_dapm_kcontrol_component(kcontrol); ++ unsigned int ctrl, more, mux = AIU_HDMI_CTRL_MUX_DISABLED; ++ ++ ctrl = snd_soc_component_read(component, AIU_HDMI_CLK_DATA_CTRL); ++ if (FIELD_GET(AIU_HDMI_CLK_DATA_CTRL_CLK_SEL, ctrl) != ++ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_AIU) { ++ goto out; ++ } ++ ++ more = snd_soc_component_read(component, AIU_CLK_CTRL_MORE); ++ if (FIELD_GET(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ctrl) == ++ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_I2S_DATA && ++ !!(more & AIU_CLK_CTRL_MORE_AMCLK)) { ++ mux = AIU_HDMI_CTRL_MUX_I2S; ++ goto out; ++ } ++ ++ if (FIELD_GET(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ctrl) == ++ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_OUTPUT_ZERO && ++ !(more & AIU_CLK_CTRL_MORE_AMCLK)) { ++ mux = AIU_HDMI_CTRL_MUX_PCM; ++ goto out; ++ } ++ ++out: ++ ucontrol->value.enumerated.item[0] = mux; ++ return 0; ++} ++ + static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +@@ -28,45 +74,51 @@ static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol, + struct snd_soc_dapm_context *dapm = + snd_soc_dapm_kcontrol_dapm(kcontrol); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; +- unsigned int mux, changed; ++ unsigned int mux, ctrl, more; + + mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); +- changed = snd_soc_component_test_bits(component, e->reg, +- CTRL_DATA_SEL, +- FIELD_PREP(CTRL_DATA_SEL, mux)); + +- if (!changed) +- return 0; ++ if (mux == AIU_HDMI_CTRL_MUX_I2S) { ++ ctrl = FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ++ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_I2S_DATA); ++ more = AIU_CLK_CTRL_MORE_AMCLK; ++ } else { ++ ctrl = FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ++ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL_OUTPUT_ZERO); ++ more = 0; ++ } ++ ++ if (mux == AIU_HDMI_CTRL_MUX_DISABLED) { ++ ctrl |= FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_CLK_SEL, ++ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_DISABLE); ++ } else { ++ ctrl |= FIELD_PREP(AIU_HDMI_CLK_DATA_CTRL_CLK_SEL, ++ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL_AIU); ++ } + + /* Force disconnect of the mux while updating */ + snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); + +- /* Reset the source first */ +- snd_soc_component_update_bits(component, e->reg, +- CTRL_CLK_SEL | +- CTRL_DATA_SEL, +- FIELD_PREP(CTRL_CLK_SEL, 0) | +- FIELD_PREP(CTRL_DATA_SEL, 0)); ++ snd_soc_component_update_bits(component, AIU_HDMI_CLK_DATA_CTRL, ++ AIU_HDMI_CLK_DATA_CTRL_CLK_SEL | ++ AIU_HDMI_CLK_DATA_CTRL_DATA_SEL, ++ ctrl); + +- /* Set the appropriate source */ +- snd_soc_component_update_bits(component, e->reg, +- CTRL_CLK_SEL | +- CTRL_DATA_SEL, +- FIELD_PREP(CTRL_CLK_SEL, mux) | +- FIELD_PREP(CTRL_DATA_SEL, mux)); ++ snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, ++ AIU_CLK_CTRL_MORE_AMCLK, ++ more); + + snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); + + return 1; + } + +-static SOC_ENUM_SINGLE_DECL(aiu_hdmi_ctrl_mux_enum, AIU_HDMI_CLK_DATA_CTRL, +- CTRL_DATA_SEL_SHIFT, +- aiu_codec_ctrl_mux_texts); ++static SOC_ENUM_SINGLE_VIRT_DECL(aiu_hdmi_ctrl_mux_enum, ++ aiu_codec_hdmi_ctrl_mux_texts); + + static const struct snd_kcontrol_new aiu_hdmi_ctrl_mux = + SOC_DAPM_ENUM_EXT("HDMI Source", aiu_hdmi_ctrl_mux_enum, +- snd_soc_dapm_get_enum_double, ++ aiu_codec_ctrl_mux_get_enum, + aiu_codec_ctrl_mux_put_enum); + + static const struct snd_soc_dapm_widget aiu_hdmi_ctrl_widgets[] = { +diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c +index 111111111111..222222222222 100644 +--- a/sound/soc/meson/aiu-encoder-i2s.c ++++ b/sound/soc/meson/aiu-encoder-i2s.c +@@ -23,7 +23,6 @@ + #define AIU_CLK_CTRL_AOCLK_INVERT BIT(6) + #define AIU_CLK_CTRL_LRCLK_INVERT BIT(7) + #define AIU_CLK_CTRL_LRCLK_SKEW GENMASK(9, 8) +-#define AIU_CLK_CTRL_MORE_HDMI_AMCLK BIT(6) + #define AIU_CLK_CTRL_MORE_I2S_DIV GENMASK(5, 0) + #define AIU_CODEC_DAC_LRCLK_CTRL_DIV GENMASK(11, 0) + +@@ -176,11 +175,6 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, + if (ret) + return ret; + +- /* Make sure amclk is used for HDMI i2s as well */ +- snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, +- AIU_CLK_CTRL_MORE_HDMI_AMCLK, +- AIU_CLK_CTRL_MORE_HDMI_AMCLK); +- + return 0; + } + +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-mmc-1-arm64-amlogic-mmc-meson-gx-Add-core-tx-rx-eMMC-SD-SD.patch b/patch/kernel/archive/meson64-6.10/general-meson-mmc-1-arm64-amlogic-mmc-meson-gx-Add-core-tx-rx-eMMC-SD-SD.patch new file mode 100644 index 000000000000..a0894a748f14 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-mmc-1-arm64-amlogic-mmc-meson-gx-Add-core-tx-rx-eMMC-SD-SD.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Vyacheslav Bocharov +Date: Mon, 7 Nov 2022 14:19:08 +0100 +Subject: arm64: amlogic: mmc: meson-gx: Add core, tx, rx eMMC/SD/SDIO phase + clock settings from devicetree data + +The mmc driver has the same phase values for all meson platforms. However, +some platforms (and even some boards) require different values. This patch +transfers the values from the set in the code to the variables in the +device-tree file. + +Signed-off-by: Vyacheslav Bocharov +--- + drivers/mmc/host/meson-gx-mmc.c | 19 +++-- + include/dt-bindings/mmc/meson-gx-mmc.h | 35 ++++++++++ + 2 files changed, 48 insertions(+), 6 deletions(-) + +diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c +index 111111111111..222222222222 100644 +--- a/drivers/mmc/host/meson-gx-mmc.c ++++ b/drivers/mmc/host/meson-gx-mmc.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #define DRIVER_NAME "meson-gx-mmc" + +@@ -36,8 +37,6 @@ + #define CLK_CORE_PHASE_MASK GENMASK(9, 8) + #define CLK_TX_PHASE_MASK GENMASK(11, 10) + #define CLK_RX_PHASE_MASK GENMASK(13, 12) +-#define CLK_PHASE_0 0 +-#define CLK_PHASE_180 2 + #define CLK_V2_TX_DELAY_MASK GENMASK(19, 16) + #define CLK_V2_RX_DELAY_MASK GENMASK(23, 20) + #define CLK_V2_ALWAYS_ON BIT(24) +@@ -426,13 +425,21 @@ static int meson_mmc_clk_init(struct meson_host *host) + const char *mux_parent_names[MUX_CLK_NUM_PARENTS]; + const char *clk_parent[1]; + u32 clk_reg; +- ++ u32 phase[3]; // ++ ++ if (!(host->dev && host->dev->of_node) || (device_property_read_u32_array(host->dev, ++ "amlogic,mmc-phase", phase, 3) < 0)) { ++ dev_dbg(host->dev, "get amlogic,mmc-phase failed, use default phase settings\n"); ++ phase[0] = CLK_PHASE_180; ++ phase[1] = CLK_PHASE_0; ++ phase[2] = CLK_PHASE_0; ++ } + /* init SD_EMMC_CLOCK to sane defaults w/min clock rate */ + clk_reg = CLK_ALWAYS_ON(host); + clk_reg |= CLK_DIV_MASK; +- clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180); +- clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0); +- clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0); ++ clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, phase[0]); ++ clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, phase[1]); ++ clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, phase[2]); + if (host->mmc->caps & MMC_CAP_SDIO_IRQ) + clk_reg |= CLK_IRQ_SDIO_SLEEP(host); + writel(clk_reg, host->regs + SD_EMMC_CLOCK); +diff --git a/include/dt-bindings/mmc/meson-gx-mmc.h b/include/dt-bindings/mmc/meson-gx-mmc.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/include/dt-bindings/mmc/meson-gx-mmc.h +@@ -0,0 +1,35 @@ ++/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ ++/* ++ * Copyright (c) 2022 Vyacheslav Bocharov ++ * Author: Vyacheslav Bocharov ++ */ ++ ++#ifndef _DT_BINDINGS_MESON_GX_MMC_H ++#define _DT_BINDINGS_MESON_GX_MMC_H ++ ++/* ++ * Cfg_rx_phase: RX clock phase ++ * bits: 9:8 R/W ++ * default: 0 ++ * Recommended value: 0 ++ * ++ * Cfg_tx_phase: TX clock phase ++ * bits: 9:8 R/W ++ * default: 0 ++ * Recommended value: 2 ++ * ++ * Cfg_co_phase: Core clock phase ++ * bits: 9:8 R/W ++ * default: 0 ++ * Recommended value: 2 ++ * ++ * values: 0: 0 phase, 1: 90 phase, 2: 180 phase, 3: 270 phase. ++ */ ++ ++#define CLK_PHASE_0 0 ++#define CLK_PHASE_90 1 ++#define CLK_PHASE_180 2 ++#define CLK_PHASE_270 3 ++ ++ ++#endif +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-mmc-2-arm64-amlogic-dts-meson-update-meson-axg-device-tree.patch b/patch/kernel/archive/meson64-6.10/general-meson-mmc-2-arm64-amlogic-dts-meson-update-meson-axg-device-tree.patch new file mode 100644 index 000000000000..da5343474d41 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-mmc-2-arm64-amlogic-dts-meson-update-meson-axg-device-tree.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Vyacheslav Bocharov +Date: Mon, 7 Nov 2022 16:19:08 +0300 +Subject: arm64: amlogic: dts: meson: update meson-axg device-tree for new + core, tx, rx phase clock settings. + +Use phase 270 for core MMC clock on axg meson boards. + +Signed-off-by: Vyacheslav Bocharov +--- + arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + / { + compatible = "amlogic,meson-axg"; +@@ -1922,6 +1923,7 @@ sd_emmc_b: mmc@5000 { + <&clkc CLKID_SD_EMMC_B_CLK0>, + <&clkc CLKID_FCLK_DIV2>; + clock-names = "core", "clkin0", "clkin1"; ++ amlogic,mmc-phase = ; + resets = <&reset RESET_SD_EMMC_B>; + }; + +@@ -1935,6 +1937,7 @@ sd_emmc_c: mmc@7000 { + <&clkc CLKID_FCLK_DIV2>; + clock-names = "core", "clkin0", "clkin1"; + resets = <&reset RESET_SD_EMMC_C>; ++ amlogic,mmc-phase = ; + }; + + nfc: nand-controller@7800 { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-mmc-3-arm64-dts-docs-Update-mmc-meson-gx-documentation-for.patch b/patch/kernel/archive/meson64-6.10/general-meson-mmc-3-arm64-dts-docs-Update-mmc-meson-gx-documentation-for.patch new file mode 100644 index 000000000000..3eb3b8314d0b --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-mmc-3-arm64-dts-docs-Update-mmc-meson-gx-documentation-for.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Vyacheslav Bocharov +Date: Thu, 10 Nov 2022 14:52:47 +0300 +Subject: arm64: dts: docs: Update mmc meson-gx documentation for new config + option amlogic,mmc-phase + +- amlogic,mmc-phases: 3-element array of clock phases for core, tx, rx +clock with values: + 0: CLK_PHASE_0 - 0 phase + 1: CLK_PHASE_90 - 90 phase + 2: CLK_PHASE_180 - 180 phase + 3: CLK_PHASE_270 - 270 phase +By default driver use value. + +Signed-off-by: Vyacheslav Bocharov +- rpardini: in 6.4, Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt is gone + and now replaced by Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml +--- + Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml b/Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml ++++ b/Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml +@@ -51,6 +51,16 @@ properties: + set when controller's internal DMA engine cannot access the DRAM memory, + like on the G12A dedicated SDIO controller. + ++ amlogic,mmc-phases: ++ type: integer ++ description: | ++ 3-element array of clock phases for core, tx, rx clock with values: ++ 0: CLK_PHASE_0 - 0 phase ++ 1: CLK_PHASE_90 - 90 phase ++ 2: CLK_PHASE_180 - 180 phase ++ 3: CLK_PHASE_270 - 270 phase ++ By default driver use value. ++ + required: + - compatible + - reg +@@ -73,4 +83,5 @@ examples: + clock-names = "core", "clkin0", "clkin1"; + pinctrl-0 = <&emm_pins>; + resets = <&reset_mmc>; ++ amlogic,mmc-phases = ; + }; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-vdec-add-HEVC-decode-codec.patch b/patch/kernel/archive/meson64-6.10/general-meson-vdec-add-HEVC-decode-codec.patch new file mode 100644 index 000000000000..44e1694e0236 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-vdec-add-HEVC-decode-codec.patch @@ -0,0 +1,1608 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: benjamin545 +Date: Thu, 15 Jul 2021 17:08:42 -0400 +Subject: WIP: drivers: meson: vdec: add HEVC decode codec + +Unknown patch. From LibreELEC? +--- + drivers/staging/media/meson/vdec/Makefile | 2 +- + drivers/staging/media/meson/vdec/codec_hevc.c | 1440 ++++++++++ + drivers/staging/media/meson/vdec/codec_hevc.h | 13 + + drivers/staging/media/meson/vdec/esparser.c | 2 +- + drivers/staging/media/meson/vdec/hevc_regs.h | 1 + + drivers/staging/media/meson/vdec/vdec_platform.c | 49 + + 6 files changed, 1505 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/Makefile ++++ b/drivers/staging/media/meson/vdec/Makefile +@@ -3,6 +3,6 @@ + + meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o + meson-vdec-objs += vdec_1.o vdec_hevc.o +-meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o codec_vp9.o ++meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o codec_vp9.o codec_hevc.o + + obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o +diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/codec_hevc.c +@@ -0,0 +1,1440 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ * Copyright (C) 2015 Amlogic, Inc. All rights reserved. ++ */ ++ ++#include ++#include ++ ++#include "codec_hevc.h" ++#include "dos_regs.h" ++#include "hevc_regs.h" ++#include "vdec_helpers.h" ++#include "codec_hevc_common.h" ++ ++/* HEVC reg mapping */ ++#define HEVC_DEC_STATUS_REG HEVC_ASSIST_SCRATCH_0 ++ #define HEVC_ACTION_DONE 0xff ++#define HEVC_RPM_BUFFER HEVC_ASSIST_SCRATCH_1 ++#define HEVC_SHORT_TERM_RPS HEVC_ASSIST_SCRATCH_2 ++#define HEVC_VPS_BUFFER HEVC_ASSIST_SCRATCH_3 ++#define HEVC_SPS_BUFFER HEVC_ASSIST_SCRATCH_4 ++#define HEVC_PPS_BUFFER HEVC_ASSIST_SCRATCH_5 ++#define HEVC_SAO_UP HEVC_ASSIST_SCRATCH_6 ++#define HEVC_STREAM_SWAP_BUFFER HEVC_ASSIST_SCRATCH_7 ++#define H265_MMU_MAP_BUFFER HEVC_ASSIST_SCRATCH_7 ++#define HEVC_STREAM_SWAP_BUFFER2 HEVC_ASSIST_SCRATCH_8 ++#define HEVC_sao_mem_unit HEVC_ASSIST_SCRATCH_9 ++#define HEVC_SAO_ABV HEVC_ASSIST_SCRATCH_A ++#define HEVC_sao_vb_size HEVC_ASSIST_SCRATCH_B ++#define HEVC_SAO_VB HEVC_ASSIST_SCRATCH_C ++#define HEVC_SCALELUT HEVC_ASSIST_SCRATCH_D ++#define HEVC_WAIT_FLAG HEVC_ASSIST_SCRATCH_E ++#define RPM_CMD_REG HEVC_ASSIST_SCRATCH_F ++#define LMEM_DUMP_ADR HEVC_ASSIST_SCRATCH_F ++#define DEBUG_REG1 HEVC_ASSIST_SCRATCH_G ++#define HEVC_DECODE_MODE2 HEVC_ASSIST_SCRATCH_H ++#define NAL_SEARCH_CTL HEVC_ASSIST_SCRATCH_I ++#define HEVC_DECODE_MODE HEVC_ASSIST_SCRATCH_J ++ #define DECODE_MODE_SINGLE 0 ++#define DECODE_STOP_POS HEVC_ASSIST_SCRATCH_K ++#define HEVC_AUX_ADR HEVC_ASSIST_SCRATCH_L ++#define HEVC_AUX_DATA_SIZE HEVC_ASSIST_SCRATCH_M ++#define HEVC_DECODE_SIZE HEVC_ASSIST_SCRATCH_N ++ ++#define AMRISC_MAIN_REQ 0x04 ++ ++/* HEVC Constants */ ++#define MAX_REF_PIC_NUM 24 ++#define MAX_REF_ACTIVE 16 ++#define MAX_TILE_COL_NUM 10 ++#define MAX_TILE_ROW_NUM 20 ++#define MAX_SLICE_NUM 800 ++#define INVALID_POC 0x80000000 ++ ++/* HEVC Workspace layout */ ++#define MPRED_MV_BUF_SIZE 0x120000 ++ ++#define IPP_SIZE 0x4000 ++#define SAO_ABV_SIZE 0x30000 ++#define SAO_VB_SIZE 0x30000 ++#define SH_TM_RPS_SIZE 0x800 ++#define VPS_SIZE 0x800 ++#define SPS_SIZE 0x800 ++#define PPS_SIZE 0x2000 ++#define SAO_UP_SIZE 0x2800 ++#define SWAP_BUF_SIZE 0x800 ++#define SWAP_BUF2_SIZE 0x800 ++#define SCALELUT_SIZE 0x8000 ++#define DBLK_PARA_SIZE 0x20000 ++#define DBLK_DATA_SIZE 0x80000 ++#define DBLK_DATA2_SIZE 0x80000 ++#define MMU_VBH_SIZE 0x5000 ++#define MPRED_ABV_SIZE 0x8000 ++#define MPRED_MV_SIZE (MPRED_MV_BUF_SIZE * MAX_REF_PIC_NUM) ++#define RPM_BUF_SIZE 0x100 ++#define LMEM_SIZE 0xA00 ++ ++#define IPP_OFFSET 0x00 ++#define SAO_ABV_OFFSET (IPP_OFFSET + IPP_SIZE) ++#define SAO_VB_OFFSET (SAO_ABV_OFFSET + SAO_ABV_SIZE) ++#define SH_TM_RPS_OFFSET (SAO_VB_OFFSET + SAO_VB_SIZE) ++#define VPS_OFFSET (SH_TM_RPS_OFFSET + SH_TM_RPS_SIZE) ++#define SPS_OFFSET (VPS_OFFSET + VPS_SIZE) ++#define PPS_OFFSET (SPS_OFFSET + SPS_SIZE) ++#define SAO_UP_OFFSET (PPS_OFFSET + PPS_SIZE) ++#define SWAP_BUF_OFFSET (SAO_UP_OFFSET + SAO_UP_SIZE) ++#define SWAP_BUF2_OFFSET (SWAP_BUF_OFFSET + SWAP_BUF_SIZE) ++#define SCALELUT_OFFSET (SWAP_BUF2_OFFSET + SWAP_BUF2_SIZE) ++#define DBLK_PARA_OFFSET (SCALELUT_OFFSET + SCALELUT_SIZE) ++#define DBLK_DATA_OFFSET (DBLK_PARA_OFFSET + DBLK_PARA_SIZE) ++#define DBLK_DATA2_OFFSET (DBLK_DATA_OFFSET + DBLK_DATA_SIZE) ++#define MMU_VBH_OFFSET (DBLK_DATA2_OFFSET + DBLK_DATA2_SIZE) ++#define MPRED_ABV_OFFSET (MMU_VBH_OFFSET + MMU_VBH_SIZE) ++#define MPRED_MV_OFFSET (MPRED_ABV_OFFSET + MPRED_ABV_SIZE) ++#define RPM_OFFSET (MPRED_MV_OFFSET + MPRED_MV_SIZE) ++#define LMEM_OFFSET (RPM_OFFSET + RPM_BUF_SIZE) ++ ++/* ISR decode status */ ++#define HEVC_DEC_IDLE 0x0 ++#define HEVC_NAL_UNIT_VPS 0x1 ++#define HEVC_NAL_UNIT_SPS 0x2 ++#define HEVC_NAL_UNIT_PPS 0x3 ++#define HEVC_NAL_UNIT_CODED_SLICE_SEGMENT 0x4 ++#define HEVC_CODED_SLICE_SEGMENT_DAT 0x5 ++#define HEVC_SLICE_DECODING 0x6 ++#define HEVC_NAL_UNIT_SEI 0x7 ++#define HEVC_SLICE_SEGMENT_DONE 0x8 ++#define HEVC_NAL_SEARCH_DONE 0x9 ++#define HEVC_DECPIC_DATA_DONE 0xa ++#define HEVC_DECPIC_DATA_ERROR 0xb ++#define HEVC_SEI_DAT 0xc ++#define HEVC_SEI_DAT_DONE 0xd ++ ++/* RPM misc_flag0 */ ++#define PCM_LOOP_FILTER_DISABLED_FLAG_BIT 0 ++#define PCM_ENABLE_FLAG_BIT 1 ++#define LOOP_FILER_ACROSS_TILES_ENABLED_FLAG_BIT 2 ++#define PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT 3 ++#define DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG_BIT 4 ++#define PPS_DEBLOCKING_FILTER_DISABLED_FLAG_BIT 5 ++#define DEBLOCKING_FILTER_OVERRIDE_FLAG_BIT 6 ++#define SLICE_DEBLOCKING_FILTER_DISABLED_FLAG_BIT 7 ++#define SLICE_SAO_LUMA_FLAG_BIT 8 ++#define SLICE_SAO_CHROMA_FLAG_BIT 9 ++#define SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT 10 ++ ++/* Constants for HEVC_MPRED_CTRL1 */ ++#define AMVP_MAX_NUM_CANDS_MEM 3 ++#define AMVP_MAX_NUM_CANDS 2 ++#define NUM_CHROMA_MODE 5 ++#define DM_CHROMA_IDX 36 ++ ++/* Buffer sizes */ ++#define SIZE_WORKSPACE ALIGN(LMEM_OFFSET + LMEM_SIZE, 64 * SZ_1K) ++#define SIZE_AUX (SZ_1K * 16) ++#define SIZE_FRAME_MMU (0x1200 * 4) ++#define RPM_SIZE 0x80 ++#define RPS_USED_BIT 14 ++ ++/* Data received from the HW in this form, do not rearrange */ ++union rpm_param { ++ struct { ++ u16 data[RPM_SIZE]; ++ } l; ++ struct { ++ u16 CUR_RPS[MAX_REF_ACTIVE]; ++ u16 num_ref_idx_l0_active; ++ u16 num_ref_idx_l1_active; ++ u16 slice_type; ++ u16 slice_temporal_mvp_enable_flag; ++ u16 dependent_slice_segment_flag; ++ u16 slice_segment_address; ++ u16 num_title_rows_minus1; ++ u16 pic_width_in_luma_samples; ++ u16 pic_height_in_luma_samples; ++ u16 log2_min_coding_block_size_minus3; ++ u16 log2_diff_max_min_coding_block_size; ++ u16 log2_max_pic_order_cnt_lsb_minus4; ++ u16 POClsb; ++ u16 collocated_from_l0_flag; ++ u16 collocated_ref_idx; ++ u16 log2_parallel_merge_level; ++ u16 five_minus_max_num_merge_cand; ++ u16 sps_num_reorder_pics_0; ++ u16 modification_flag; ++ u16 tiles_flags; ++ u16 num_tile_columns_minus1; ++ u16 num_tile_rows_minus1; ++ u16 tile_width[8]; ++ u16 tile_height[8]; ++ u16 misc_flag0; ++ u16 pps_beta_offset_div2; ++ u16 pps_tc_offset_div2; ++ u16 slice_beta_offset_div2; ++ u16 slice_tc_offset_div2; ++ u16 pps_cb_qp_offset; ++ u16 pps_cr_qp_offset; ++ u16 first_slice_segment_in_pic_flag; ++ u16 m_temporalId; ++ u16 m_nalUnitType; ++ u16 vui_num_units_in_tick_hi; ++ u16 vui_num_units_in_tick_lo; ++ u16 vui_time_scale_hi; ++ u16 vui_time_scale_lo; ++ u16 bit_depth; ++ u16 profile_etc; ++ u16 sei_frame_field_info; ++ u16 video_signal_type; ++ u16 modification_list[0x20]; ++ u16 conformance_window_flag; ++ u16 conf_win_left_offset; ++ u16 conf_win_right_offset; ++ u16 conf_win_top_offset; ++ u16 conf_win_bottom_offset; ++ u16 chroma_format_idc; ++ u16 color_description; ++ u16 aspect_ratio_idc; ++ u16 sar_width; ++ u16 sar_height; ++ } p; ++}; ++ ++enum nal_unit_type { ++ NAL_UNIT_CODED_SLICE_BLA = 16, ++ NAL_UNIT_CODED_SLICE_BLANT = 17, ++ NAL_UNIT_CODED_SLICE_BLA_N_LP = 18, ++ NAL_UNIT_CODED_SLICE_IDR = 19, ++ NAL_UNIT_CODED_SLICE_IDR_N_LP = 20, ++}; ++ ++enum slice_type { ++ B_SLICE = 0, ++ P_SLICE = 1, ++ I_SLICE = 2, ++}; ++ ++/* A frame being decoded */ ++struct hevc_frame { ++ struct list_head list; ++ struct vb2_v4l2_buffer *vbuf; ++ u32 offset; ++ u32 poc; ++ ++ int referenced; ++ u32 num_reorder_pic; ++ ++ u32 cur_slice_idx; ++ u32 cur_slice_type; ++ ++ /* 2 lists (L0/L1) ; 800 slices ; 16 refs */ ++ u32 ref_poc_list[2][MAX_SLICE_NUM][MAX_REF_ACTIVE]; ++ u32 ref_num[2]; ++}; ++ ++struct codec_hevc { ++ struct mutex lock; ++ ++ /* Common part of the HEVC decoder */ ++ struct codec_hevc_common common; ++ ++ /* Buffer for the HEVC Workspace */ ++ void *workspace_vaddr; ++ dma_addr_t workspace_paddr; ++ ++ /* AUX buffer */ ++ void *aux_vaddr; ++ dma_addr_t aux_paddr; ++ ++ /* Contains many information parsed from the bitstream */ ++ union rpm_param rpm_param; ++ ++ /* Information computed from the RPM */ ++ u32 lcu_size; // Largest Coding Unit ++ u32 lcu_x_num; ++ u32 lcu_y_num; ++ u32 lcu_total; ++ ++ /* Current Frame being handled */ ++ struct hevc_frame *cur_frame; ++ u32 curr_poc; ++ /* Collocated Reference Picture */ ++ struct hevc_frame *col_frame; ++ u32 col_poc; ++ ++ /* All ref frames used by the HW at a given time */ ++ struct list_head ref_frames_list; ++ u32 frames_num; ++ ++ /* Coded resolution reported by the hardware */ ++ u32 width, height; ++ /* Resolution minus the conformance window offsets */ ++ u32 dst_width, dst_height; ++ ++ u32 prev_tid0_poc; ++ u32 slice_segment_addr; ++ u32 slice_addr; ++ u32 ldc_flag; ++ ++ /* Whether we detected the bitstream as 10-bit */ ++ int is_10bit; ++}; ++ ++static u32 codec_hevc_num_pending_bufs(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc; ++ u32 ret; ++ ++ hevc = sess->priv; ++ if (!hevc) ++ return 0; ++ ++ mutex_lock(&hevc->lock); ++ ret = hevc->frames_num; ++ mutex_unlock(&hevc->lock); ++ ++ return ret; ++} ++ ++/* Update the L0 and L1 reference lists for a given frame */ ++static void codec_hevc_update_frame_refs(struct amvdec_session *sess, ++ struct hevc_frame *frame) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ union rpm_param *params = &hevc->rpm_param; ++ int num_ref_idx_l0_active = ++ (params->p.num_ref_idx_l0_active > MAX_REF_ACTIVE) ? ++ MAX_REF_ACTIVE : params->p.num_ref_idx_l0_active; ++ int num_ref_idx_l1_active = ++ (params->p.num_ref_idx_l1_active > MAX_REF_ACTIVE) ? ++ MAX_REF_ACTIVE : params->p.num_ref_idx_l1_active; ++ int ref_picset0[MAX_REF_ACTIVE] = { 0 }; ++ int ref_picset1[MAX_REF_ACTIVE] = { 0 }; ++ u16 *mod_list = params->p.modification_list; ++ int num_neg = 0; ++ int num_pos = 0; ++ int total_num; ++ int i; ++ ++ for (i = 0; i < MAX_REF_ACTIVE; i++) { ++ frame->ref_poc_list[0][frame->cur_slice_idx][i] = 0; ++ frame->ref_poc_list[1][frame->cur_slice_idx][i] = 0; ++ } ++ ++ for (i = 0; i < MAX_REF_ACTIVE; i++) { ++ u16 cur_rps = params->p.CUR_RPS[i]; ++ int delt = cur_rps & ((1 << (RPS_USED_BIT - 1)) - 1); ++ ++ if (cur_rps & 0x8000) ++ break; ++ ++ if (!((cur_rps >> RPS_USED_BIT) & 1)) ++ continue; ++ ++ if ((cur_rps >> (RPS_USED_BIT - 1)) & 1) { ++ ref_picset0[num_neg] = ++ frame->poc - ((1 << (RPS_USED_BIT - 1)) - delt); ++ num_neg++; ++ } else { ++ ref_picset1[num_pos] = frame->poc + delt; ++ num_pos++; ++ } ++ } ++ ++ total_num = num_neg + num_pos; ++ ++ if (total_num <= 0) ++ goto end; ++ ++ for (i = 0; i < num_ref_idx_l0_active; i++) { ++ int cidx; ++ if (params->p.modification_flag & 0x1) ++ cidx = mod_list[i]; ++ else ++ cidx = i % total_num; ++ ++ frame->ref_poc_list[0][frame->cur_slice_idx][i] = ++ cidx >= num_neg ? ref_picset1[cidx - num_neg] : ++ ref_picset0[cidx]; ++ } ++ ++ if (params->p.slice_type != B_SLICE) ++ goto end; ++ ++ if (params->p.modification_flag & 0x2) { ++ for (i = 0; i < num_ref_idx_l1_active; i++) { ++ int cidx; ++ if (params->p.modification_flag & 0x1) ++ cidx = mod_list[num_ref_idx_l0_active + i]; ++ else ++ cidx = mod_list[i]; ++ ++ frame->ref_poc_list[1][frame->cur_slice_idx][i] = ++ (cidx >= num_pos) ? ref_picset0[cidx - num_pos] ++ : ref_picset1[cidx]; ++ } ++ } else { ++ for (i = 0; i < num_ref_idx_l1_active; i++) { ++ int cidx = i % total_num; ++ frame->ref_poc_list[1][frame->cur_slice_idx][i] = ++ cidx >= num_pos ? ref_picset0[cidx - num_pos] : ++ ref_picset1[cidx]; ++ } ++ } ++ ++end: ++ frame->ref_num[0] = num_ref_idx_l0_active; ++ frame->ref_num[1] = num_ref_idx_l1_active; ++ ++ dev_dbg(sess->core->dev, ++ "Frame %u; slice %u; slice_type %u; num_l0 %u; num_l1 %u\n", ++ frame->poc, frame->cur_slice_idx, params->p.slice_type, ++ frame->ref_num[0], frame->ref_num[1]); ++} ++ ++static void codec_hevc_update_ldc_flag(struct codec_hevc *hevc) ++{ ++ struct hevc_frame *frame = hevc->cur_frame; ++ u32 slice_type = frame->cur_slice_type; ++ u32 slice_idx = frame->cur_slice_idx; ++ int i; ++ ++ hevc->ldc_flag = 0; ++ ++ if (slice_type == I_SLICE) ++ return; ++ ++ hevc->ldc_flag = 1; ++ for (i = 0; (i < frame->ref_num[0]) && hevc->ldc_flag; i++) { ++ if (frame->ref_poc_list[0][slice_idx][i] > frame->poc) { ++ hevc->ldc_flag = 0; ++ break; ++ } ++ } ++ ++ if (slice_type == P_SLICE) ++ return; ++ ++ for (i = 0; (i < frame->ref_num[1]) && hevc->ldc_flag; i++) { ++ if (frame->ref_poc_list[1][slice_idx][i] > frame->poc) { ++ hevc->ldc_flag = 0; ++ break; ++ } ++ } ++} ++ ++/* Tag "old" frames that are no longer referenced */ ++static void codec_hevc_update_referenced(struct codec_hevc *hevc) ++{ ++ union rpm_param *param = &hevc->rpm_param; ++ struct hevc_frame *frame; ++ int i; ++ u32 curr_poc = hevc->curr_poc; ++ ++ list_for_each_entry(frame, &hevc->ref_frames_list, list) { ++ int is_referenced = 0; ++ u32 poc_tmp; ++ ++ if (!frame->referenced) ++ continue; ++ ++ for (i = 0; i < MAX_REF_ACTIVE; i++) { ++ int delt; ++ if (param->p.CUR_RPS[i] & 0x8000) ++ break; ++ ++ delt = param->p.CUR_RPS[i] & ++ ((1 << (RPS_USED_BIT - 1)) - 1); ++ if (param->p.CUR_RPS[i] & (1 << (RPS_USED_BIT - 1))) { ++ poc_tmp = curr_poc - ++ ((1 << (RPS_USED_BIT - 1)) - delt); ++ } else ++ poc_tmp = curr_poc + delt; ++ if (poc_tmp == frame->poc) { ++ is_referenced = 1; ++ break; ++ } ++ } ++ ++ frame->referenced = is_referenced; ++ } ++} ++ ++static struct hevc_frame * ++codec_hevc_get_lowest_poc_frame(struct codec_hevc *hevc) ++{ ++ struct hevc_frame *tmp, *ret = NULL; ++ u32 poc = INT_MAX; ++ ++ list_for_each_entry(tmp, &hevc->ref_frames_list, list) { ++ if (tmp->poc < poc) { ++ ret = tmp; ++ poc = tmp->poc; ++ } ++ } ++ ++ return ret; ++} ++ ++/* Try to output as many frames as possible */ ++static void codec_hevc_output_frames(struct amvdec_session *sess) ++{ ++ struct hevc_frame *tmp; ++ struct codec_hevc *hevc = sess->priv; ++ ++ while ((tmp = codec_hevc_get_lowest_poc_frame(hevc))) { ++ if (hevc->curr_poc && ++ (tmp->referenced || ++ tmp->num_reorder_pic >= hevc->frames_num)) ++ break; ++ ++ dev_dbg(sess->core->dev, "DONE frame poc %u; vbuf %u\n", ++ tmp->poc, tmp->vbuf->vb2_buf.index); ++ amvdec_dst_buf_done_offset(sess, tmp->vbuf, tmp->offset, ++ V4L2_FIELD_NONE, false); ++ list_del(&tmp->list); ++ kfree(tmp); ++ hevc->frames_num--; ++ } ++} ++ ++ ++static int ++codec_hevc_setup_workspace(struct amvdec_session *sess, ++ struct codec_hevc *hevc) ++{ ++ struct amvdec_core *core = sess->core; ++ u32 revision = core->platform->revision; ++ dma_addr_t wkaddr; ++ ++ /* Allocate some memory for the HEVC decoder's state */ ++ hevc->workspace_vaddr = dma_alloc_coherent(core->dev, SIZE_WORKSPACE, ++ &wkaddr, GFP_KERNEL); ++ if (!hevc->workspace_vaddr) ++ return -ENOMEM; ++ ++ hevc->workspace_paddr = wkaddr; ++ ++ amvdec_write_dos(core, HEVCD_IPP_LINEBUFF_BASE, wkaddr + IPP_OFFSET); ++ amvdec_write_dos(core, HEVC_RPM_BUFFER, wkaddr + RPM_OFFSET); ++ amvdec_write_dos(core, HEVC_SHORT_TERM_RPS, wkaddr + SH_TM_RPS_OFFSET); ++ amvdec_write_dos(core, HEVC_VPS_BUFFER, wkaddr + VPS_OFFSET); ++ amvdec_write_dos(core, HEVC_SPS_BUFFER, wkaddr + SPS_OFFSET); ++ amvdec_write_dos(core, HEVC_PPS_BUFFER, wkaddr + PPS_OFFSET); ++ amvdec_write_dos(core, HEVC_SAO_UP, wkaddr + SAO_UP_OFFSET); ++ ++ if (codec_hevc_use_mmu(revision, sess->pixfmt_cap, hevc->is_10bit)) { ++ amvdec_write_dos(core, HEVC_SAO_MMU_VH0_ADDR, ++ wkaddr + MMU_VBH_OFFSET); ++ amvdec_write_dos(core, HEVC_SAO_MMU_VH1_ADDR, ++ wkaddr + MMU_VBH_OFFSET + (MMU_VBH_SIZE / 2)); ++ ++ if (revision >= VDEC_REVISION_G12A) ++ amvdec_write_dos(core, HEVC_ASSIST_MMU_MAP_ADDR, ++ hevc->common.mmu_map_paddr); ++ else ++ amvdec_write_dos(core, H265_MMU_MAP_BUFFER, ++ hevc->common.mmu_map_paddr); ++ } else if (revision < VDEC_REVISION_G12A) { ++ amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER, ++ wkaddr + SWAP_BUF_OFFSET); ++ amvdec_write_dos(core, HEVC_STREAM_SWAP_BUFFER2, ++ wkaddr + SWAP_BUF2_OFFSET); ++ } ++ ++ amvdec_write_dos(core, HEVC_SCALELUT, wkaddr + SCALELUT_OFFSET); ++ amvdec_write_dos(core, HEVC_DBLK_CFG4, wkaddr + DBLK_PARA_OFFSET); ++ amvdec_write_dos(core, HEVC_DBLK_CFG5, wkaddr + DBLK_DATA_OFFSET); ++ if (revision >= VDEC_REVISION_G12A) ++ amvdec_write_dos(core, HEVC_DBLK_CFGE, ++ wkaddr + DBLK_DATA2_OFFSET); ++ ++ amvdec_write_dos(core, LMEM_DUMP_ADR, wkaddr + LMEM_OFFSET); ++ ++ return 0; ++} ++ ++static int codec_hevc_start(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_hevc *hevc; ++ u32 val; ++ int i; ++ int ret; ++ ++ hevc = kzalloc(sizeof(*hevc), GFP_KERNEL); ++ if (!hevc) ++ return -ENOMEM; ++ ++ INIT_LIST_HEAD(&hevc->ref_frames_list); ++ hevc->curr_poc = INVALID_POC; ++ ++ ret = codec_hevc_setup_workspace(sess, hevc); ++ if (ret) ++ goto free_hevc; ++ ++ val = BIT(0); /* stream_fetch_enable */ ++ if (core->platform->revision >= VDEC_REVISION_G12A) ++ val |= (0xf << 25); /* arwlen_axi_max */ ++ amvdec_write_dos_bits(core, HEVC_STREAM_CONTROL, val); ++ ++ val = amvdec_read_dos(core, HEVC_PARSER_INT_CONTROL) & 0x03ffffff; ++ val |= (3 << 29) | BIT(27) | BIT(24) | BIT(22) | BIT(7) | BIT(4) | ++ BIT(0); ++ amvdec_write_dos(core, HEVC_PARSER_INT_CONTROL, val); ++ amvdec_write_dos_bits(core, HEVC_SHIFT_STATUS, BIT(1) | BIT(0)); ++ amvdec_write_dos(core, HEVC_SHIFT_CONTROL, ++ (3 << 6) | BIT(5) | BIT(2) | BIT(0)); ++ amvdec_write_dos(core, HEVC_CABAC_CONTROL, 1); ++ amvdec_write_dos(core, HEVC_PARSER_CORE_CONTROL, 1); ++ amvdec_write_dos(core, HEVC_DEC_STATUS_REG, 0); ++ ++ amvdec_write_dos(core, HEVC_IQIT_SCALELUT_WR_ADDR, 0); ++ for (i = 0; i < 1024; ++i) ++ amvdec_write_dos(core, HEVC_IQIT_SCALELUT_DATA, 0); ++ ++ amvdec_write_dos(core, HEVC_DECODE_SIZE, 0); ++ ++ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, BIT(16)); ++ for (i = 0; i < ARRAY_SIZE(vdec_hevc_parser_cmd); ++i) ++ amvdec_write_dos(core, HEVC_PARSER_CMD_WRITE, ++ vdec_hevc_parser_cmd[i]); ++ ++ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_0, PARSER_CMD_SKIP_CFG_0); ++ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_1, PARSER_CMD_SKIP_CFG_1); ++ amvdec_write_dos(core, HEVC_PARSER_CMD_SKIP_2, PARSER_CMD_SKIP_CFG_2); ++ amvdec_write_dos(core, HEVC_PARSER_IF_CONTROL, ++ BIT(5) | BIT(2) | BIT(0)); ++ ++ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(0)); ++ amvdec_write_dos(core, HEVCD_IPP_TOP_CNTL, BIT(1)); ++ ++ amvdec_write_dos(core, HEVC_WAIT_FLAG, 1); ++ ++ /* clear mailbox interrupt */ ++ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_CLR_REG, 1); ++ /* enable mailbox interrupt */ ++ amvdec_write_dos(core, HEVC_ASSIST_MBOX1_MASK, 1); ++ /* disable PSCALE for hardware sharing */ ++ amvdec_write_dos(core, HEVC_PSCALE_CTRL, 0); ++ /* Let the uCode do all the parsing */ ++ amvdec_write_dos(core, NAL_SEARCH_CTL, 0xc); ++ ++ amvdec_write_dos(core, DECODE_STOP_POS, 0); ++ amvdec_write_dos(core, HEVC_DECODE_MODE, DECODE_MODE_SINGLE); ++ amvdec_write_dos(core, HEVC_DECODE_MODE2, 0); ++ ++ /* AUX buffers */ ++ hevc->aux_vaddr = dma_alloc_coherent(core->dev, SIZE_AUX, ++ &hevc->aux_paddr, GFP_KERNEL); ++ if (!hevc->aux_vaddr) { ++ dev_err(core->dev, "Failed to request HEVC AUX\n"); ++ ret = -ENOMEM; ++ goto free_hevc; ++ } ++ ++ amvdec_write_dos(core, HEVC_AUX_ADR, hevc->aux_paddr); ++ amvdec_write_dos(core, HEVC_AUX_DATA_SIZE, ++ (((SIZE_AUX) >> 4) << 16) | 0); ++ mutex_init(&hevc->lock); ++ sess->priv = hevc; ++ ++ return 0; ++ ++free_hevc: ++ kfree(hevc); ++ return ret; ++} ++ ++static void codec_hevc_flush_output(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ struct hevc_frame *tmp; ++ ++ while (!list_empty(&hevc->ref_frames_list)) { ++ tmp = codec_hevc_get_lowest_poc_frame(hevc); ++ amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE); ++ list_del(&tmp->list); ++ kfree(tmp); ++ hevc->frames_num--; ++ } ++} ++ ++static int codec_hevc_stop(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ struct amvdec_core *core = sess->core; ++ ++ mutex_lock(&hevc->lock); ++ codec_hevc_flush_output(sess); ++ ++ if (hevc->workspace_vaddr) ++ dma_free_coherent(core->dev, SIZE_WORKSPACE, ++ hevc->workspace_vaddr, ++ hevc->workspace_paddr); ++ ++ if (hevc->aux_vaddr) ++ dma_free_coherent(core->dev, SIZE_AUX, ++ hevc->aux_vaddr, hevc->aux_paddr); ++ ++ codec_hevc_free_fbc_buffers(sess, &hevc->common); ++ mutex_unlock(&hevc->lock); ++ mutex_destroy(&hevc->lock); ++ ++ return 0; ++} ++ ++static struct hevc_frame * ++codec_hevc_get_frame_by_poc(struct codec_hevc *hevc, u32 poc) ++{ ++ struct hevc_frame *tmp; ++ ++ list_for_each_entry(tmp, &hevc->ref_frames_list, list) { ++ if (tmp->poc == poc) ++ return tmp; ++ } ++ ++ return NULL; ++} ++ ++static struct hevc_frame * ++codec_hevc_prepare_new_frame(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct hevc_frame *new_frame = NULL; ++ struct codec_hevc *hevc = sess->priv; ++ struct vb2_v4l2_buffer *vbuf; ++ union rpm_param *params = &hevc->rpm_param; ++ ++ new_frame = kzalloc(sizeof(*new_frame), GFP_KERNEL); ++ if (!new_frame) ++ return NULL; ++ ++ vbuf = v4l2_m2m_dst_buf_remove(sess->m2m_ctx); ++ if (!vbuf) { ++ dev_err(sess->core->dev, "No dst buffer available\n"); ++ return NULL; ++ } ++ ++ new_frame->vbuf = vbuf; ++ new_frame->referenced = 1; ++ new_frame->poc = hevc->curr_poc; ++ new_frame->cur_slice_type = params->p.slice_type; ++ new_frame->num_reorder_pic = params->p.sps_num_reorder_pics_0; ++ new_frame->offset = amvdec_read_dos(core, HEVC_SHIFT_BYTE_COUNT); ++ ++ list_add_tail(&new_frame->list, &hevc->ref_frames_list); ++ hevc->frames_num++; ++ ++ return new_frame; ++} ++ ++static void ++codec_hevc_set_sao(struct amvdec_session *sess, struct hevc_frame *frame) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_hevc *hevc = sess->priv; ++ struct vb2_buffer *vb = &frame->vbuf->vb2_buf; ++ union rpm_param *param = &hevc->rpm_param; ++ u32 pic_height_cu = ++ (hevc->height + hevc->lcu_size - 1) / hevc->lcu_size; ++ u32 sao_mem_unit = (hevc->lcu_size == 16 ? 9 : ++ hevc->lcu_size == 32 ? 14 : 24) << 4; ++ u32 sao_vb_size = (sao_mem_unit + (2 << 4)) * pic_height_cu; ++ u32 misc_flag0 = param->p.misc_flag0; ++ dma_addr_t buf_y_paddr; ++ dma_addr_t buf_u_v_paddr; ++ u32 slice_deblocking_filter_disabled_flag; ++ u32 val, val_2; ++ ++ val = (amvdec_read_dos(core, HEVC_SAO_CTRL0) & ~0xf) | ++ ilog2(hevc->lcu_size); ++ amvdec_write_dos(core, HEVC_SAO_CTRL0, val); ++ ++ amvdec_write_dos(core, HEVC_SAO_PIC_SIZE, ++ hevc->width | (hevc->height << 16)); ++ amvdec_write_dos(core, HEVC_SAO_PIC_SIZE_LCU, ++ (hevc->lcu_x_num - 1) | (hevc->lcu_y_num - 1) << 16); ++ ++ if (codec_hevc_use_downsample(sess->pixfmt_cap, hevc->is_10bit) || ++ codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, ++ hevc->is_10bit)) ++ buf_y_paddr = ++ hevc->common.fbc_buffer_paddr[vb->index]; ++ else ++ buf_y_paddr = ++ vb2_dma_contig_plane_dma_addr(vb, 0); ++ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { ++ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0000; ++ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); ++ amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); ++ } ++ ++ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { ++ buf_y_paddr = ++ vb2_dma_contig_plane_dma_addr(vb, 0); ++ buf_u_v_paddr = ++ vb2_dma_contig_plane_dma_addr(vb, 1); ++ amvdec_write_dos(core, HEVC_SAO_Y_START_ADDR, buf_y_paddr); ++ amvdec_write_dos(core, HEVC_SAO_C_START_ADDR, buf_u_v_paddr); ++ amvdec_write_dos(core, HEVC_SAO_Y_WPTR, buf_y_paddr); ++ amvdec_write_dos(core, HEVC_SAO_C_WPTR, buf_u_v_paddr); ++ } ++ ++ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, ++ hevc->is_10bit)) { ++ dma_addr_t header_adr = vb2_dma_contig_plane_dma_addr(vb, 0); ++ if (codec_hevc_use_downsample(sess->pixfmt_cap, hevc->is_10bit)) ++ header_adr = hevc->common.mmu_header_paddr[vb->index]; ++ amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, header_adr); ++ /* use HEVC_CM_HEADER_START_ADDR */ ++ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10)); ++ amvdec_write_dos_bits(core, HEVC_SAO_CTRL9, BIT(0)); ++ } ++ ++ amvdec_write_dos(core, HEVC_SAO_Y_LENGTH, ++ amvdec_get_output_size(sess)); ++ amvdec_write_dos(core, HEVC_SAO_C_LENGTH, ++ (amvdec_get_output_size(sess) / 2)); ++ ++ if (frame->cur_slice_idx == 0) { ++ if (core->platform->revision >= VDEC_REVISION_G12A) { ++ if (core->platform->revision >= VDEC_REVISION_SM1) ++ val = 0xfc << 8; ++ else ++ val = 0x54 << 8; ++ ++ /* enable first, compressed write */ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, ++ hevc->is_10bit)) ++ val |= BIT(8); ++ ++ /* enable second, uncompressed write */ ++ if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) ++ val |= BIT(9); ++ ++ /* dblk pipeline mode=1 for performance */ ++ if (hevc->width >= 1280) ++ val |= BIT(4); ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFGB, val); ++ amvdec_write_dos(core, HEVC_DBLK_STS1 + 16, BIT(28)); ++ } ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFG2, ++ hevc->width | (hevc->height << 16)); ++ ++ val = 0; ++ if ((misc_flag0 >> PCM_ENABLE_FLAG_BIT) & 0x1) ++ val |= ((misc_flag0 >> ++ PCM_LOOP_FILTER_DISABLED_FLAG_BIT) & 0x1) << 3; ++ ++ val |= (param->p.pps_cb_qp_offset & 0x1f) << 4; ++ val |= (param->p.pps_cr_qp_offset & 0x1f) << 9; ++ val |= (hevc->lcu_size == 64) ? 0 : ++ ((hevc->lcu_size == 32) ? 1 : 2); ++ amvdec_write_dos(core, HEVC_DBLK_CFG1, val); ++ } ++ ++ val = amvdec_read_dos(core, HEVC_SAO_CTRL1) & ~0x3ff3; ++ val |= 0xff0; /* Set endianness for 2-bytes swaps (nv12) */ ++ if (core->platform->revision < VDEC_REVISION_G12A) { ++ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) ++ val |= BIT(0); /* disable cm compression */ ++ /* TOFIX: Handle Amlogic Framebuffer compression */ ++ } ++ ++ amvdec_write_dos(core, HEVC_SAO_CTRL1, val); ++ ++ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { ++ /* no downscale for NV12 */ ++ val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0000; ++ amvdec_write_dos(core, HEVC_SAO_CTRL5, val); ++ } ++ ++ val = amvdec_read_dos(core, HEVCD_IPP_AXIIF_CONFIG) & ~0x30; ++ val |= 0xf; ++ amvdec_write_dos(core, HEVCD_IPP_AXIIF_CONFIG, val); ++ ++ val = 0; ++ val_2 = amvdec_read_dos(core, HEVC_SAO_CTRL0); ++ val_2 &= (~0x300); ++ ++ slice_deblocking_filter_disabled_flag = (misc_flag0 >> ++ SLICE_DEBLOCKING_FILTER_DISABLED_FLAG_BIT) & 0x1; ++ if ((misc_flag0 & (1 << DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG_BIT)) ++ && (misc_flag0 & (1 << DEBLOCKING_FILTER_OVERRIDE_FLAG_BIT))) { ++ val |= slice_deblocking_filter_disabled_flag << 2; ++ ++ if (!slice_deblocking_filter_disabled_flag) { ++ val |= (param->p.slice_beta_offset_div2 & 0xf) << 3; ++ val |= (param->p.slice_tc_offset_div2 & 0xf) << 7; ++ } ++ } else { ++ val |= ++ ((misc_flag0 >> ++ PPS_DEBLOCKING_FILTER_DISABLED_FLAG_BIT) & 0x1) << 2; ++ ++ if (((misc_flag0 >> PPS_DEBLOCKING_FILTER_DISABLED_FLAG_BIT) & ++ 0x1) == 0) { ++ val |= (param->p.pps_beta_offset_div2 & 0xf) << 3; ++ val |= (param->p.pps_tc_offset_div2 & 0xf) << 7; ++ } ++ } ++ if ((misc_flag0 & (1 << PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT)) ++ && ((misc_flag0 & (1 << SLICE_SAO_LUMA_FLAG_BIT)) ++ || (misc_flag0 & (1 << SLICE_SAO_CHROMA_FLAG_BIT)) ++ || (!slice_deblocking_filter_disabled_flag))) { ++ val |= ++ ((misc_flag0 >> ++ SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) ++ & 0x1) << 1; ++ val_2 |= ++ ((misc_flag0 >> ++ SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) ++ & 0x1) << 9; ++ } else { ++ val |= ++ ((misc_flag0 >> ++ PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) ++ & 0x1) << 1; ++ val_2 |= ++ ((misc_flag0 >> ++ PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG_BIT) ++ & 0x1) << 9; ++ } ++ ++ amvdec_write_dos(core, HEVC_DBLK_CFG9, val); ++ amvdec_write_dos(core, HEVC_SAO_CTRL0, val_2); ++ ++ amvdec_write_dos(core, HEVC_sao_mem_unit, sao_mem_unit); ++ amvdec_write_dos(core, HEVC_SAO_ABV, ++ hevc->workspace_paddr + SAO_ABV_OFFSET); ++ amvdec_write_dos(core, HEVC_sao_vb_size, sao_vb_size); ++ amvdec_write_dos(core, HEVC_SAO_VB, ++ hevc->workspace_paddr + SAO_VB_OFFSET); ++} ++ ++static dma_addr_t codec_hevc_get_frame_mv_paddr(struct codec_hevc *hevc, ++ struct hevc_frame *frame) ++{ ++ return hevc->workspace_paddr + MPRED_MV_OFFSET + ++ (frame->vbuf->vb2_buf.index * MPRED_MV_BUF_SIZE); ++} ++ ++static void ++codec_hevc_set_mpred_ctrl(struct amvdec_core *core, struct codec_hevc *hevc) ++{ ++ union rpm_param *param = &hevc->rpm_param; ++ u32 slice_type = param->p.slice_type; ++ u32 lcu_size_log2 = ilog2(hevc->lcu_size); ++ u32 val; ++ ++ val = slice_type | ++ MPRED_CTRL0_ABOVE_EN | ++ MPRED_CTRL0_MV_WR_EN | ++ MPRED_CTRL0_BUF_LINEAR | ++ (lcu_size_log2 << 16) | ++ (3 << 20) | /* cu_size_log2 */ ++ (param->p.log2_parallel_merge_level << 24); ++ ++ if (slice_type != I_SLICE) ++ val |= MPRED_CTRL0_MV_RD_EN; ++ ++ if (param->p.collocated_from_l0_flag) ++ val |= MPRED_CTRL0_COL_FROM_L0; ++ ++ if (param->p.slice_temporal_mvp_enable_flag) ++ val |= MPRED_CTRL0_TMVP; ++ ++ if (hevc->ldc_flag) ++ val |= MPRED_CTRL0_LDC; ++ ++ if (param->p.dependent_slice_segment_flag) ++ val |= MPRED_CTRL0_NEW_SLI_SEG; ++ ++ if (param->p.slice_segment_address == 0) ++ val |= MPRED_CTRL0_NEW_PIC | ++ MPRED_CTRL0_NEW_TILE; ++ ++ amvdec_write_dos(core, HEVC_MPRED_CTRL0, val); ++ ++ val = (5 - param->p.five_minus_max_num_merge_cand) | ++ (AMVP_MAX_NUM_CANDS << 4) | ++ (AMVP_MAX_NUM_CANDS_MEM << 8) | ++ (NUM_CHROMA_MODE << 12) | ++ (DM_CHROMA_IDX << 16); ++ amvdec_write_dos(core, HEVC_MPRED_CTRL1, val); ++} ++ ++static void codec_hevc_set_mpred_mv(struct amvdec_core *core, ++ struct codec_hevc *hevc, ++ struct hevc_frame *frame, ++ struct hevc_frame *col_frame) ++{ ++ union rpm_param *param = &hevc->rpm_param; ++ u32 lcu_size_log2 = ilog2(hevc->lcu_size); ++ u32 mv_mem_unit = lcu_size_log2 == 6 ? 0x200 : ++ lcu_size_log2 == 5 ? 0x80 : 0x20; ++ dma_addr_t col_mv_rd_start_addr, col_mv_rd_ptr, col_mv_rd_end_addr; ++ dma_addr_t mpred_mv_wr_ptr; ++ u32 val; ++ ++ val = amvdec_read_dos(core, HEVC_MPRED_CURR_LCU); ++ ++ col_mv_rd_start_addr = codec_hevc_get_frame_mv_paddr(hevc, col_frame); ++ mpred_mv_wr_ptr = codec_hevc_get_frame_mv_paddr(hevc, frame) + ++ (hevc->slice_addr * mv_mem_unit); ++ col_mv_rd_ptr = col_mv_rd_start_addr + ++ (hevc->slice_addr * mv_mem_unit); ++ col_mv_rd_end_addr = col_mv_rd_start_addr + ++ (hevc->lcu_total * mv_mem_unit); ++ ++ amvdec_write_dos(core, HEVC_MPRED_MV_WR_START_ADDR, ++ codec_hevc_get_frame_mv_paddr(hevc, frame)); ++ amvdec_write_dos(core, HEVC_MPRED_MV_RD_START_ADDR, ++ col_mv_rd_start_addr); ++ ++ if (param->p.slice_segment_address == 0) { ++ amvdec_write_dos(core, HEVC_MPRED_ABV_START_ADDR, ++ hevc->workspace_paddr + MPRED_ABV_OFFSET); ++ amvdec_write_dos(core, HEVC_MPRED_MV_WPTR, mpred_mv_wr_ptr); ++ amvdec_write_dos(core, HEVC_MPRED_MV_RPTR, ++ col_mv_rd_start_addr); ++ } else { ++ amvdec_write_dos(core, HEVC_MPRED_MV_RPTR, col_mv_rd_ptr); ++ } ++ ++ amvdec_write_dos(core, HEVC_MPRED_MV_RD_END_ADDR, col_mv_rd_end_addr); ++} ++ ++/* Update motion prediction with the current slice */ ++static void codec_hevc_set_mpred(struct amvdec_session *sess, ++ struct hevc_frame *frame, ++ struct hevc_frame *col_frame) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_hevc *hevc = sess->priv; ++ u32 *ref_num = frame->ref_num; ++ u32 *ref_poc_l0 = frame->ref_poc_list[0][frame->cur_slice_idx]; ++ u32 *ref_poc_l1 = frame->ref_poc_list[1][frame->cur_slice_idx]; ++ u32 val; ++ int i; ++ ++ codec_hevc_set_mpred_ctrl(core, hevc); ++ codec_hevc_set_mpred_mv(core, hevc, frame, col_frame); ++ ++ amvdec_write_dos(core, HEVC_MPRED_PIC_SIZE, ++ hevc->width | (hevc->height << 16)); ++ ++ val = ((hevc->lcu_x_num - 1) | (hevc->lcu_y_num - 1) << 16); ++ amvdec_write_dos(core, HEVC_MPRED_PIC_SIZE_LCU, val); ++ ++ amvdec_write_dos(core, HEVC_MPRED_REF_NUM, ++ (ref_num[1] << 8) | ref_num[0]); ++ amvdec_write_dos(core, HEVC_MPRED_REF_EN_L0, (1 << ref_num[0]) - 1); ++ amvdec_write_dos(core, HEVC_MPRED_REF_EN_L1, (1 << ref_num[1]) - 1); ++ ++ amvdec_write_dos(core, HEVC_MPRED_CUR_POC, hevc->curr_poc); ++ amvdec_write_dos(core, HEVC_MPRED_COL_POC, hevc->col_poc); ++ ++ for (i = 0; i < MAX_REF_ACTIVE; ++i) { ++ amvdec_write_dos(core, HEVC_MPRED_L0_REF00_POC + i * 4, ++ ref_poc_l0[i]); ++ amvdec_write_dos(core, HEVC_MPRED_L1_REF00_POC + i * 4, ++ ref_poc_l1[i]); ++ } ++} ++ ++/* motion compensation reference cache controller */ ++static void codec_hevc_set_mcrcc(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_hevc *hevc = sess->priv; ++ u32 val, val_2; ++ int l0_cnt = 0; ++ int l1_cnt = 0x7fff; ++ ++ if (!codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { ++ l0_cnt = hevc->cur_frame->ref_num[0]; ++ l1_cnt = hevc->cur_frame->ref_num[1]; ++ } ++ ++ if (hevc->cur_frame->cur_slice_type == I_SLICE) { ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0); ++ return; ++ } ++ ++ if (hevc->cur_frame->cur_slice_type == P_SLICE) { ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, ++ BIT(1)); ++ val = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR); ++ val &= 0xffff; ++ val |= (val << 16); ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL2, val); ++ ++ if (l0_cnt == 1) { ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); ++ } else { ++ val = amvdec_read_dos(core, ++ HEVCD_MPP_ANC_CANVAS_DATA_ADDR); ++ val &= 0xffff; ++ val |= (val << 16); ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); ++ } ++ } else { /* B_SLICE */ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 0); ++ val = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR); ++ val &= 0xffff; ++ val |= (val << 16); ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL2, val); ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, ++ BIT(12) | BIT(1)); ++ val_2 = amvdec_read_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR); ++ val_2 &= 0xffff; ++ val_2 |= (val_2 << 16); ++ if (val == val_2 && l1_cnt > 1) { ++ val_2 = amvdec_read_dos(core, ++ HEVCD_MPP_ANC_CANVAS_DATA_ADDR); ++ val_2 &= 0xffff; ++ val_2 |= (val_2 << 16); ++ } ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL3, val); ++ } ++ ++ /* enable mcrcc progressive-mode */ ++ amvdec_write_dos(core, HEVCD_MCRCC_CTL1, 0xff0); ++} ++ ++static void codec_hevc_set_ref_list(struct amvdec_session *sess, ++ u32 ref_num, u32 *ref_poc_list) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ struct hevc_frame *ref_frame; ++ struct amvdec_core *core = sess->core; ++ int i; ++ u32 buf_id_y; ++ u32 buf_id_uv; ++ ++ for (i = 0; i < ref_num; i++) { ++ ref_frame = codec_hevc_get_frame_by_poc(hevc, ref_poc_list[i]); ++ ++ if (!ref_frame) { ++ dev_warn(core->dev, "Couldn't find ref. frame %u\n", ++ ref_poc_list[i]); ++ continue; ++ } ++ ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, hevc->is_10bit)) { ++ buf_id_y = buf_id_uv = ref_frame->vbuf->vb2_buf.index; ++ } else { ++ buf_id_y = ref_frame->vbuf->vb2_buf.index * 2; ++ buf_id_uv = buf_id_y + 1; ++ } ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, ++ (buf_id_uv << 16) | ++ (buf_id_uv << 8) | ++ buf_id_y); ++ } ++} ++ ++static void codec_hevc_set_mc(struct amvdec_session *sess, ++ struct hevc_frame *frame) ++{ ++ struct amvdec_core *core = sess->core; ++ ++ if (frame->cur_slice_type == I_SLICE) ++ return; ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); ++ codec_hevc_set_ref_list(sess, frame->ref_num[0], ++ frame->ref_poc_list[0][frame->cur_slice_idx]); ++ ++ if (frame->cur_slice_type == P_SLICE) ++ return; ++ ++ amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, ++ BIT(12) | BIT(0)); ++ codec_hevc_set_ref_list(sess, frame->ref_num[1], ++ frame->ref_poc_list[1][frame->cur_slice_idx]); ++} ++ ++static void codec_hevc_update_col_frame(struct codec_hevc *hevc) ++{ ++ struct hevc_frame *cur_frame = hevc->cur_frame; ++ union rpm_param *param = &hevc->rpm_param; ++ u32 list_no = 0; ++ u32 col_ref = param->p.collocated_ref_idx; ++ u32 col_from_l0 = param->p.collocated_from_l0_flag; ++ u32 cur_slice_idx = cur_frame->cur_slice_idx; ++ ++ if (cur_frame->cur_slice_type == B_SLICE) ++ list_no = 1 - col_from_l0; ++ ++ if (col_ref >= cur_frame->ref_num[list_no]) ++ hevc->col_poc = INVALID_POC; ++ else ++ hevc->col_poc = cur_frame->ref_poc_list[list_no] ++ [cur_slice_idx] ++ [col_ref]; ++ ++ if (cur_frame->cur_slice_type == I_SLICE) ++ goto end; ++ ++ if (hevc->col_poc != INVALID_POC) ++ hevc->col_frame = codec_hevc_get_frame_by_poc(hevc, ++ hevc->col_poc); ++ else ++ hevc->col_frame = hevc->cur_frame; ++ ++end: ++ if (!hevc->col_frame) ++ hevc->col_frame = hevc->cur_frame; ++} ++ ++static void codec_hevc_update_pocs(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ union rpm_param *param = &hevc->rpm_param; ++ u32 nal_unit_type = param->p.m_nalUnitType; ++ u32 temporal_id = param->p.m_temporalId & 0x7; ++ int max_poc_lsb = ++ 1 << (param->p.log2_max_pic_order_cnt_lsb_minus4 + 4); ++ int prev_poc_lsb; ++ int prev_poc_msb; ++ int poc_msb; ++ int poc_lsb = param->p.POClsb; ++ ++ if (nal_unit_type == NAL_UNIT_CODED_SLICE_IDR || ++ nal_unit_type == NAL_UNIT_CODED_SLICE_IDR_N_LP) { ++ hevc->curr_poc = 0; ++ if ((temporal_id - 1) == 0) ++ hevc->prev_tid0_poc = hevc->curr_poc; ++ ++ return; ++ } ++ ++ prev_poc_lsb = hevc->prev_tid0_poc % max_poc_lsb; ++ prev_poc_msb = hevc->prev_tid0_poc - prev_poc_lsb; ++ ++ if ((poc_lsb < prev_poc_lsb) && ++ ((prev_poc_lsb - poc_lsb) >= (max_poc_lsb / 2))) ++ poc_msb = prev_poc_msb + max_poc_lsb; ++ else if ((poc_lsb > prev_poc_lsb) && ++ ((poc_lsb - prev_poc_lsb) > (max_poc_lsb / 2))) ++ poc_msb = prev_poc_msb - max_poc_lsb; ++ else ++ poc_msb = prev_poc_msb; ++ ++ if (nal_unit_type == NAL_UNIT_CODED_SLICE_BLA || ++ nal_unit_type == NAL_UNIT_CODED_SLICE_BLANT || ++ nal_unit_type == NAL_UNIT_CODED_SLICE_BLA_N_LP) ++ poc_msb = 0; ++ ++ hevc->curr_poc = (poc_msb + poc_lsb); ++ if ((temporal_id - 1) == 0) ++ hevc->prev_tid0_poc = hevc->curr_poc; ++} ++ ++static void codec_hevc_process_segment_header(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ union rpm_param *param = &hevc->rpm_param; ++ ++ if (param->p.first_slice_segment_in_pic_flag == 0) { ++ hevc->slice_segment_addr = param->p.slice_segment_address; ++ if (!param->p.dependent_slice_segment_flag) ++ hevc->slice_addr = hevc->slice_segment_addr; ++ } else { ++ hevc->slice_segment_addr = 0; ++ hevc->slice_addr = 0; ++ } ++ ++ codec_hevc_update_pocs(sess); ++} ++ ++static int codec_hevc_process_segment(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ struct amvdec_core *core = sess->core; ++ union rpm_param *param = &hevc->rpm_param; ++ u32 slice_segment_address = param->p.slice_segment_address; ++ ++ /* First slice: new frame */ ++ if (slice_segment_address == 0) { ++ codec_hevc_update_referenced(hevc); ++ codec_hevc_output_frames(sess); ++ ++ hevc->cur_frame = codec_hevc_prepare_new_frame(sess); ++ if (!hevc->cur_frame) ++ return -1; ++ } else { ++ hevc->cur_frame->cur_slice_idx++; ++ } ++ ++ codec_hevc_update_frame_refs(sess, hevc->cur_frame); ++ codec_hevc_update_col_frame(hevc); ++ codec_hevc_update_ldc_flag(hevc); ++ if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, ++ hevc->is_10bit)) ++ codec_hevc_fill_mmu_map(sess, &hevc->common, ++ &hevc->cur_frame->vbuf->vb2_buf, ++ hevc->is_10bit); ++ codec_hevc_set_mc(sess, hevc->cur_frame); ++ codec_hevc_set_mcrcc(sess); ++ codec_hevc_set_mpred(sess, hevc->cur_frame, hevc->col_frame); ++ codec_hevc_set_sao(sess, hevc->cur_frame); ++ ++ amvdec_write_dos_bits(core, HEVC_WAIT_FLAG, BIT(1)); ++ amvdec_write_dos(core, HEVC_DEC_STATUS_REG, ++ HEVC_CODED_SLICE_SEGMENT_DAT); ++ ++ /* Interrupt the firmware's processor */ ++ amvdec_write_dos(core, HEVC_MCPU_INTR_REQ, AMRISC_MAIN_REQ); ++ ++ return 0; ++} ++ ++static int codec_hevc_process_rpm(struct codec_hevc *hevc) ++{ ++ union rpm_param *param = &hevc->rpm_param; ++ int src_changed = 0; ++ u32 dst_width, dst_height; ++ u32 lcu_size; ++ u32 is_10bit = 0; ++ ++ if (param->p.slice_segment_address || ++ !param->p.pic_width_in_luma_samples || ++ !param->p.pic_height_in_luma_samples) ++ return 0; ++ ++ if (param->p.bit_depth) ++ is_10bit = 1; ++ ++ hevc->width = param->p.pic_width_in_luma_samples; ++ hevc->height = param->p.pic_height_in_luma_samples; ++ dst_width = hevc->width; ++ dst_height = hevc->height; ++ ++ lcu_size = 1 << (param->p.log2_min_coding_block_size_minus3 + ++ 3 + param->p.log2_diff_max_min_coding_block_size); ++ ++ hevc->lcu_x_num = (hevc->width + lcu_size - 1) / lcu_size; ++ hevc->lcu_y_num = (hevc->height + lcu_size - 1) / lcu_size; ++ hevc->lcu_total = hevc->lcu_x_num * hevc->lcu_y_num; ++ ++ if (param->p.conformance_window_flag) { ++ u32 sub_width = 1, sub_height = 1; ++ ++ switch (param->p.chroma_format_idc) { ++ case 1: ++ sub_height = 2; /* fallthrough */ ++ case 2: ++ sub_width = 2; ++ break; ++ } ++ ++ dst_width -= sub_width * ++ (param->p.conf_win_left_offset + ++ param->p.conf_win_right_offset); ++ dst_height -= sub_height * ++ (param->p.conf_win_top_offset + ++ param->p.conf_win_bottom_offset); ++ } ++ ++ if (dst_width != hevc->dst_width || ++ dst_height != hevc->dst_height || ++ lcu_size != hevc->lcu_size || ++ is_10bit != hevc->is_10bit) ++ src_changed = 1; ++ ++ hevc->dst_width = dst_width; ++ hevc->dst_height = dst_height; ++ hevc->lcu_size = lcu_size; ++ hevc->is_10bit = is_10bit; ++ ++ return src_changed; ++} ++ ++/* ++ * The RPM section within the workspace contains ++ * many information regarding the parsed bitstream ++ */ ++static void codec_hevc_fetch_rpm(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ u16 *rpm_vaddr = hevc->workspace_vaddr + RPM_OFFSET; ++ int i, j; ++ ++ for (i = 0; i < RPM_SIZE; i += 4) ++ for (j = 0; j < 4; j++) ++ hevc->rpm_param.l.data[i + j] = rpm_vaddr[i + 3 - j]; ++} ++ ++static void codec_hevc_resume(struct amvdec_session *sess) ++{ ++ struct codec_hevc *hevc = sess->priv; ++ ++ if (codec_hevc_setup_buffers(sess, &hevc->common, hevc->is_10bit)) { ++ amvdec_abort(sess); ++ return; ++ } ++ ++ codec_hevc_setup_decode_head(sess, hevc->is_10bit); ++ codec_hevc_process_segment_header(sess); ++ if (codec_hevc_process_segment(sess)) ++ amvdec_abort(sess); ++} ++ ++static irqreturn_t codec_hevc_threaded_isr(struct amvdec_session *sess) ++{ ++ struct amvdec_core *core = sess->core; ++ struct codec_hevc *hevc = sess->priv; ++ u32 dec_status = amvdec_read_dos(core, HEVC_DEC_STATUS_REG); ++ ++ if (!hevc) ++ return IRQ_HANDLED; ++ ++ mutex_lock(&hevc->lock); ++ if (dec_status != HEVC_SLICE_SEGMENT_DONE) { ++ dev_err(core->dev_dec, "Unrecognized dec_status: %08X\n", ++ dec_status); ++ amvdec_abort(sess); ++ goto unlock; ++ } ++ ++ sess->keyframe_found = 1; ++ codec_hevc_fetch_rpm(sess); ++ if (codec_hevc_process_rpm(hevc)) { ++ amvdec_src_change(sess, hevc->dst_width, hevc->dst_height, 16, ++ hevc->is_10bit ? 10 : 8); ++ goto unlock; ++ } ++ ++ codec_hevc_process_segment_header(sess); ++ if (codec_hevc_process_segment(sess)) ++ amvdec_abort(sess); ++ ++unlock: ++ mutex_unlock(&hevc->lock); ++ return IRQ_HANDLED; ++} ++ ++static irqreturn_t codec_hevc_isr(struct amvdec_session *sess) ++{ ++ return IRQ_WAKE_THREAD; ++} ++ ++struct amvdec_codec_ops codec_hevc_ops = { ++ .start = codec_hevc_start, ++ .stop = codec_hevc_stop, ++ .isr = codec_hevc_isr, ++ .threaded_isr = codec_hevc_threaded_isr, ++ .num_pending_bufs = codec_hevc_num_pending_bufs, ++ .drain = codec_hevc_flush_output, ++ .resume = codec_hevc_resume, ++}; +diff --git a/drivers/staging/media/meson/vdec/codec_hevc.h b/drivers/staging/media/meson/vdec/codec_hevc.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/staging/media/meson/vdec/codec_hevc.h +@@ -0,0 +1,13 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2018 Maxime Jourdan ++ */ ++ ++#ifndef __MESON_VDEC_CODEC_HEVC_H_ ++#define __MESON_VDEC_CODEC_HEVC_H_ ++ ++#include "vdec.h" ++ ++extern struct amvdec_codec_ops codec_hevc_ops; ++ ++#endif +diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/esparser.c ++++ b/drivers/staging/media/meson/vdec/esparser.c +@@ -308,7 +308,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + * they could pause when there is no capture buffer available and + * resume on this notification. + */ +- if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9) { ++ if (sess->fmt_out->pixfmt == V4L2_PIX_FMT_VP9 || sess->fmt_out->pixfmt ==V4L2_PIX_FMT_HEVC) { + if (codec_ops->num_pending_bufs) + num_dst_bufs = codec_ops->num_pending_bufs(sess); + +diff --git a/drivers/staging/media/meson/vdec/hevc_regs.h b/drivers/staging/media/meson/vdec/hevc_regs.h +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/hevc_regs.h ++++ b/drivers/staging/media/meson/vdec/hevc_regs.h +@@ -205,6 +205,7 @@ + #define HEVC_CM_HEADER_START_ADDR 0xd8a0 + #define HEVC_CM_HEADER_LENGTH 0xd8a4 + #define HEVC_CM_HEADER_OFFSET 0xd8ac ++#define HEVC_SAO_CTRL9 0xd8b4 + #define HEVC_SAO_MMU_VH0_ADDR 0xd8e8 + #define HEVC_SAO_MMU_VH1_ADDR 0xd8ec + +diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/vdec_platform.c ++++ b/drivers/staging/media/meson/vdec/vdec_platform.c +@@ -11,6 +11,7 @@ + #include "vdec_hevc.h" + #include "codec_mpeg12.h" + #include "codec_h264.h" ++#include "codec_hevc.h" + #include "codec_vp9.h" + + static const struct amvdec_format vdec_formats_gxbb[] = { +@@ -64,6 +65,18 @@ static const struct amvdec_format vdec_formats_gxl[] = { + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { ++ .pixfmt = V4L2_PIX_FMT_HEVC, ++ .min_buffers = 4, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_hevc_ops, ++ .firmware_path = "meson/vdec/gxl_hevc.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, +@@ -114,6 +127,18 @@ static const struct amvdec_format vdec_formats_gxm[] = { + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { ++ .pixfmt = V4L2_PIX_FMT_HEVC, ++ .min_buffers = 4, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_hevc_ops, ++ .firmware_path = "meson/vdec/gxl_hevc.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, +@@ -165,6 +190,18 @@ static const struct amvdec_format vdec_formats_g12a[] = { + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { ++ .pixfmt = V4L2_PIX_FMT_HEVC, ++ .min_buffers = 4, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_hevc_ops, ++ .firmware_path = "meson/vdec/g12a_hevc_mmu.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ },{ + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, + .max_buffers = 24, +@@ -214,6 +251,18 @@ static const struct amvdec_format vdec_formats_sm1[] = { + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { ++ .pixfmt = V4L2_PIX_FMT_HEVC, ++ .min_buffers = 4, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_hevc_ops, ++ .firmware_path = "meson/vdec/sm1_hevc_mmu.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, + }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-vdec-add-handling-to-HEVC-decoder-.patch b/patch/kernel/archive/meson64-6.10/general-meson-vdec-add-handling-to-HEVC-decoder-.patch new file mode 100644 index 000000000000..0db5d1468064 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-vdec-add-handling-to-HEVC-decoder-.patch @@ -0,0 +1,157 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: benjamin545 +Date: Mon, 2 Aug 2021 15:18:40 -0400 +Subject: WIP: drivers: meson: vdec: add handling to HEVC decoder to show + frames when ready + +..rather than when no longer referenced + +the HEVC decode driver would not show the next frame until it was no longer referenced, +this would cause a backup of frames that were ready to render but held up by one or more +frames that were still referenced. The decoded picture buffer would fill up and stall +playback as no new frames could be placed in the decoded picture buffer. +--- + drivers/staging/media/meson/vdec/codec_hevc.c | 52 ++++++---- + 1 file changed, 34 insertions(+), 18 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_hevc.c b/drivers/staging/media/meson/vdec/codec_hevc.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc.c ++++ b/drivers/staging/media/meson/vdec/codec_hevc.c +@@ -223,6 +223,7 @@ struct hevc_frame { + u32 poc; + + int referenced; ++ int show; + u32 num_reorder_pic; + + u32 cur_slice_idx; +@@ -448,9 +449,11 @@ static void codec_hevc_update_referenced(struct codec_hevc *hevc) + ((1 << (RPS_USED_BIT - 1)) - 1); + if (param->p.CUR_RPS[i] & (1 << (RPS_USED_BIT - 1))) { + poc_tmp = curr_poc - +- ((1 << (RPS_USED_BIT - 1)) - delt); +- } else ++ ((1 << (RPS_USED_BIT - 1)) - delt); ++ } else { + poc_tmp = curr_poc + delt; ++ } ++ + if (poc_tmp == frame->poc) { + is_referenced = 1; + break; +@@ -462,13 +465,13 @@ static void codec_hevc_update_referenced(struct codec_hevc *hevc) + } + + static struct hevc_frame * +-codec_hevc_get_lowest_poc_frame(struct codec_hevc *hevc) ++codec_hevc_get_next_ready_frame(struct codec_hevc *hevc) + { + struct hevc_frame *tmp, *ret = NULL; + u32 poc = INT_MAX; + + list_for_each_entry(tmp, &hevc->ref_frames_list, list) { +- if (tmp->poc < poc) { ++ if ((tmp->poc < poc) && tmp->show) { + ret = tmp; + poc = tmp->poc; + } +@@ -478,28 +481,35 @@ codec_hevc_get_lowest_poc_frame(struct codec_hevc *hevc) + } + + /* Try to output as many frames as possible */ +-static void codec_hevc_output_frames(struct amvdec_session *sess) ++static void codec_hevc_show_frames(struct amvdec_session *sess) + { +- struct hevc_frame *tmp; ++ struct hevc_frame *tmp, *n; + struct codec_hevc *hevc = sess->priv; + +- while ((tmp = codec_hevc_get_lowest_poc_frame(hevc))) { ++ while ((tmp = codec_hevc_get_next_ready_frame(hevc))) { + if (hevc->curr_poc && +- (tmp->referenced || +- tmp->num_reorder_pic >= hevc->frames_num)) ++ (hevc->frames_num <= tmp->num_reorder_pic)) + break; + + dev_dbg(sess->core->dev, "DONE frame poc %u; vbuf %u\n", + tmp->poc, tmp->vbuf->vb2_buf.index); + amvdec_dst_buf_done_offset(sess, tmp->vbuf, tmp->offset, + V4L2_FIELD_NONE, false); ++ ++ tmp->show = 0; ++ hevc->frames_num--; ++ } ++ ++ /* clean output frame buffer */ ++ list_for_each_entry_safe(tmp, n, &hevc->ref_frames_list, list) { ++ if (tmp->referenced || tmp->show) ++ continue; ++ + list_del(&tmp->list); + kfree(tmp); +- hevc->frames_num--; + } + } + +- + static int + codec_hevc_setup_workspace(struct amvdec_session *sess, + struct codec_hevc *hevc) +@@ -650,14 +660,17 @@ static int codec_hevc_start(struct amvdec_session *sess) + static void codec_hevc_flush_output(struct amvdec_session *sess) + { + struct codec_hevc *hevc = sess->priv; +- struct hevc_frame *tmp; ++ struct hevc_frame *tmp, *n; + +- while (!list_empty(&hevc->ref_frames_list)) { +- tmp = codec_hevc_get_lowest_poc_frame(hevc); ++ while ((tmp = codec_hevc_get_next_ready_frame(hevc))) { + amvdec_dst_buf_done(sess, tmp->vbuf, V4L2_FIELD_NONE); ++ tmp->show = 0; ++ hevc->frames_num--; ++ } ++ ++ list_for_each_entry_safe(tmp, n, &hevc->ref_frames_list, list) { + list_del(&tmp->list); + kfree(tmp); +- hevc->frames_num--; + } + } + +@@ -719,6 +732,7 @@ codec_hevc_prepare_new_frame(struct amvdec_session *sess) + + new_frame->vbuf = vbuf; + new_frame->referenced = 1; ++ new_frame->show = 1; + new_frame->poc = hevc->curr_poc; + new_frame->cur_slice_type = params->p.slice_type; + new_frame->num_reorder_pic = params->p.sps_num_reorder_pics_0; +@@ -1267,7 +1281,7 @@ static int codec_hevc_process_segment(struct amvdec_session *sess) + /* First slice: new frame */ + if (slice_segment_address == 0) { + codec_hevc_update_referenced(hevc); +- codec_hevc_output_frames(sess); ++ codec_hevc_show_frames(sess); + + hevc->cur_frame = codec_hevc_prepare_new_frame(sess); + if (!hevc->cur_frame) +@@ -1370,9 +1384,11 @@ static void codec_hevc_fetch_rpm(struct amvdec_session *sess) + u16 *rpm_vaddr = hevc->workspace_vaddr + RPM_OFFSET; + int i, j; + +- for (i = 0; i < RPM_SIZE; i += 4) ++ for (i = 0; i < RPM_SIZE; i += 4) { + for (j = 0; j < 4; j++) +- hevc->rpm_param.l.data[i + j] = rpm_vaddr[i + 3 - j]; ++ hevc->rpm_param.l.data[i + j] = ++ rpm_vaddr[i + 3 - j]; ++ } + } + + static void codec_hevc_resume(struct amvdec_session *sess) +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-vdec-check-if-parser-has-really-parser.patch b/patch/kernel/archive/meson64-6.10/general-meson-vdec-check-if-parser-has-really-parser.patch new file mode 100644 index 000000000000..068d55ce7189 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-vdec-check-if-parser-has-really-parser.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Mon, 22 Nov 2021 09:15:21 +0000 +Subject: WIP: drivers: meson: vdec: check if parser has really parser before + marking input buffer as error + +Signed-off-by: Neil Armstrong +--- + drivers/staging/media/meson/vdec/esparser.c | 14 +++++++--- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/esparser.c ++++ b/drivers/staging/media/meson/vdec/esparser.c +@@ -299,6 +299,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + u32 num_dst_bufs = 0; + u32 offset; + u32 pad_size; ++ u32 wp, wp2; + + /* + * When max ref frame is held by VP9, this should be -= 3 to prevent a +@@ -352,15 +353,20 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + } + + pad_size = esparser_pad_start_code(core, vb, payload_size); ++ wp = amvdec_read_parser(core, PARSER_VIDEO_WP); + ret = esparser_write_data(core, phy, payload_size + pad_size); ++ wp2 = amvdec_read_parser(core, PARSER_VIDEO_WP); + + if (ret <= 0) { +- dev_warn(core->dev, "esparser: input parsing error\n"); +- amvdec_remove_ts(sess, vb->timestamp); +- v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); + amvdec_write_parser(core, PARSER_FETCH_CMD, 0); + +- return 0; ++ if (ret < 0 || wp2 == wp) { ++ dev_err(core->dev, "esparser: input parsing error ret %d (%x <=> %x)\n", ret, wp, wp2); ++ amvdec_remove_ts(sess, vb->timestamp); ++ v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); ++ ++ return 0; ++ } + } + + atomic_inc(&sess->esparser_queued_bufs); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson-vdec-improve-mmu-and-fbc-handling-.patch b/patch/kernel/archive/meson64-6.10/general-meson-vdec-improve-mmu-and-fbc-handling-.patch new file mode 100644 index 000000000000..916ce5967629 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson-vdec-improve-mmu-and-fbc-handling-.patch @@ -0,0 +1,587 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: benjamin545 +Date: Thu, 15 Jul 2021 16:32:39 -0400 +Subject: WIP: drivers: meson: vdec: improve mmu and fbc handling and add 10 + bit handling + +Unknown patch. From LibreELEC? +--- + drivers/staging/media/meson/vdec/codec_h264.c | 3 +- + drivers/staging/media/meson/vdec/codec_hevc_common.c | 164 ++++++---- + drivers/staging/media/meson/vdec/codec_hevc_common.h | 3 +- + drivers/staging/media/meson/vdec/codec_vp9.c | 36 +- + drivers/staging/media/meson/vdec/esparser.c | 1 + + drivers/staging/media/meson/vdec/vdec.h | 1 + + drivers/staging/media/meson/vdec/vdec_helpers.c | 46 ++- + drivers/staging/media/meson/vdec/vdec_helpers.h | 10 +- + 8 files changed, 163 insertions(+), 101 deletions(-) + +diff --git a/drivers/staging/media/meson/vdec/codec_h264.c b/drivers/staging/media/meson/vdec/codec_h264.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/codec_h264.c ++++ b/drivers/staging/media/meson/vdec/codec_h264.c +@@ -353,7 +353,8 @@ static void codec_h264_src_change(struct amvdec_session *sess) + frame_width, frame_height, crop_right, crop_bottom); + + codec_h264_set_par(sess); +- amvdec_src_change(sess, frame_width, frame_height, h264->max_refs + 5); ++ amvdec_src_change(sess, frame_width, frame_height, ++ h264->max_refs + 5, 8); + } + + /* +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.c b/drivers/staging/media/meson/vdec/codec_hevc_common.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc_common.c ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.c +@@ -30,8 +30,11 @@ const u16 vdec_hevc_parser_cmd[] = { + void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) + { + struct amvdec_core *core = sess->core; +- u32 body_size = amvdec_am21c_body_size(sess->width, sess->height); +- u32 head_size = amvdec_am21c_head_size(sess->width, sess->height); ++ u32 use_mmu = codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, is_10bit); ++ u32 body_size = amvdec_amfbc_body_size(sess->width, sess->height, ++ is_10bit, use_mmu); ++ u32 head_size = amvdec_amfbc_head_size(sess->width, sess->height); + + if (!codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) { + /* Enable 2-plane reference read mode */ +@@ -39,9 +42,17 @@ void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit) + return; + } + ++ /* enable mem saving mode for 8-bit */ ++ if (!is_10bit) ++ amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(9)); ++ else ++ amvdec_clear_dos_bits(core, HEVC_SAO_CTRL5, BIT(9)); ++ + if (codec_hevc_use_mmu(core->platform->revision, + sess->pixfmt_cap, is_10bit)) + amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(4)); ++ else if (!is_10bit) ++ amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, BIT(3)); + else + amvdec_write_dos(core, HEVCD_MPP_DECOMP_CTL1, 0); + +@@ -73,7 +84,7 @@ static void codec_hevc_setup_buffers_gxbb(struct amvdec_session *sess, + + idx = vb->index; + +- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, is_10bit)) + buf_y_paddr = comm->fbc_buffer_paddr[idx]; + else + buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); +@@ -114,8 +125,8 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, + { + struct amvdec_core *core = sess->core; + struct v4l2_m2m_buffer *buf; +- u32 revision = core->platform->revision; + u32 pixfmt_cap = sess->pixfmt_cap; ++ const u32 revision = core->platform->revision; + int i; + + amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_CONF_ADDR, +@@ -127,12 +138,14 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, + dma_addr_t buf_uv_paddr = 0; + u32 idx = vb->index; + +- if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit)) +- buf_y_paddr = comm->mmu_header_paddr[idx]; +- else if (codec_hevc_use_downsample(pixfmt_cap, is_10bit)) +- buf_y_paddr = comm->fbc_buffer_paddr[idx]; +- else +- buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); ++ if (codec_hevc_use_downsample(pixfmt_cap, is_10bit)) { ++ if (codec_hevc_use_mmu(revision, pixfmt_cap, is_10bit)) ++ buf_y_paddr = comm->mmu_header_paddr[idx]; ++ else ++ buf_y_paddr = comm->fbc_buffer_paddr[idx]; ++ } else { ++ buf_y_paddr = vb2_dma_contig_plane_dma_addr(vb, 0); ++ } + + amvdec_write_dos(core, HEVCD_MPP_ANC2AXI_TBL_DATA, + buf_y_paddr >> 5); +@@ -150,60 +163,67 @@ static void codec_hevc_setup_buffers_gxl(struct amvdec_session *sess, + amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_DATA_ADDR, 0); + } + +-void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, ++void codec_hevc_free_mmu_headers(struct amvdec_session *sess, + struct codec_hevc_common *comm) + { + struct device *dev = sess->core->dev; +- u32 am21_size = amvdec_am21c_size(sess->width, sess->height); + int i; + + for (i = 0; i < MAX_REF_PIC_NUM; ++i) { +- if (comm->fbc_buffer_vaddr[i]) { +- dma_free_coherent(dev, am21_size, +- comm->fbc_buffer_vaddr[i], +- comm->fbc_buffer_paddr[i]); +- comm->fbc_buffer_vaddr[i] = NULL; ++ if (comm->mmu_header_vaddr[i]) { ++ dma_free_coherent(dev, MMU_COMPRESS_HEADER_SIZE, ++ comm->mmu_header_vaddr[i], ++ comm->mmu_header_paddr[i]); ++ comm->mmu_header_vaddr[i] = NULL; + } + } + } +-EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers); ++EXPORT_SYMBOL_GPL(codec_hevc_free_mmu_headers); + +-static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess, ++static int codec_hevc_alloc_mmu_headers(struct amvdec_session *sess, + struct codec_hevc_common *comm) + { + struct device *dev = sess->core->dev; + struct v4l2_m2m_buffer *buf; +- u32 am21_size = amvdec_am21c_size(sess->width, sess->height); + + v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { + u32 idx = buf->vb.vb2_buf.index; + dma_addr_t paddr; +- void *vaddr = dma_alloc_coherent(dev, am21_size, &paddr, +- GFP_KERNEL); ++ void *vaddr = dma_alloc_coherent(dev, MMU_COMPRESS_HEADER_SIZE, ++ &paddr, GFP_KERNEL); + if (!vaddr) { +- codec_hevc_free_fbc_buffers(sess, comm); ++ codec_hevc_free_mmu_headers(sess, comm); + return -ENOMEM; + } + +- comm->fbc_buffer_vaddr[idx] = vaddr; +- comm->fbc_buffer_paddr[idx] = paddr; ++ comm->mmu_header_vaddr[idx] = vaddr; ++ comm->mmu_header_paddr[idx] = paddr; + } + + return 0; + } + +-void codec_hevc_free_mmu_headers(struct amvdec_session *sess, ++void codec_hevc_free_fbc_buffers(struct amvdec_session *sess, + struct codec_hevc_common *comm) + { + struct device *dev = sess->core->dev; ++ u32 use_mmu; ++ u32 am21_size; + int i; + ++ use_mmu = codec_hevc_use_mmu(sess->core->platform->revision, ++ sess->pixfmt_cap, ++ sess->bitdepth == 10 ? 1 : 0); ++ ++ am21_size = amvdec_amfbc_size(sess->width, sess->height, ++ sess->bitdepth == 10 ? 1 : 0, use_mmu); ++ + for (i = 0; i < MAX_REF_PIC_NUM; ++i) { +- if (comm->mmu_header_vaddr[i]) { +- dma_free_coherent(dev, MMU_COMPRESS_HEADER_SIZE, +- comm->mmu_header_vaddr[i], +- comm->mmu_header_paddr[i]); +- comm->mmu_header_vaddr[i] = NULL; ++ if (comm->fbc_buffer_vaddr[i]) { ++ dma_free_coherent(dev, am21_size, ++ comm->fbc_buffer_vaddr[i], ++ comm->fbc_buffer_paddr[i]); ++ comm->fbc_buffer_vaddr[i] = NULL; + } + } + +@@ -213,33 +233,49 @@ void codec_hevc_free_mmu_headers(struct amvdec_session *sess, + comm->mmu_map_paddr); + comm->mmu_map_vaddr = NULL; + } ++ ++ codec_hevc_free_mmu_headers(sess, comm); + } +-EXPORT_SYMBOL_GPL(codec_hevc_free_mmu_headers); ++EXPORT_SYMBOL_GPL(codec_hevc_free_fbc_buffers); + +-static int codec_hevc_alloc_mmu_headers(struct amvdec_session *sess, ++static int codec_hevc_alloc_fbc_buffers(struct amvdec_session *sess, + struct codec_hevc_common *comm) + { + struct device *dev = sess->core->dev; + struct v4l2_m2m_buffer *buf; ++ u32 use_mmu; ++ u32 am21_size; ++ const u32 revision = sess->core->platform->revision; ++ const u32 is_10bit = sess->bitdepth == 10 ? 1 : 0; ++ int ret; + +- comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE, +- &comm->mmu_map_paddr, +- GFP_KERNEL); +- if (!comm->mmu_map_vaddr) +- return -ENOMEM; ++ use_mmu = codec_hevc_use_mmu(revision, sess->pixfmt_cap, ++ is_10bit); ++ ++ am21_size = amvdec_amfbc_size(sess->width, sess->height, ++ is_10bit, use_mmu); + + v4l2_m2m_for_each_dst_buf(sess->m2m_ctx, buf) { + u32 idx = buf->vb.vb2_buf.index; + dma_addr_t paddr; +- void *vaddr = dma_alloc_coherent(dev, MMU_COMPRESS_HEADER_SIZE, +- &paddr, GFP_KERNEL); ++ void *vaddr = dma_alloc_coherent(dev, am21_size, &paddr, ++ GFP_KERNEL); + if (!vaddr) { +- codec_hevc_free_mmu_headers(sess, comm); ++ codec_hevc_free_fbc_buffers(sess, comm); + return -ENOMEM; + } + +- comm->mmu_header_vaddr[idx] = vaddr; +- comm->mmu_header_paddr[idx] = paddr; ++ comm->fbc_buffer_vaddr[idx] = vaddr; ++ comm->fbc_buffer_paddr[idx] = paddr; ++ } ++ ++ if (codec_hevc_use_mmu(revision, sess->pixfmt_cap, is_10bit) && ++ codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { ++ ret = codec_hevc_alloc_mmu_headers(sess, comm); ++ if (ret) { ++ codec_hevc_free_fbc_buffers(sess, comm); ++ return ret; ++ } + } + + return 0; +@@ -250,21 +286,24 @@ int codec_hevc_setup_buffers(struct amvdec_session *sess, + int is_10bit) + { + struct amvdec_core *core = sess->core; ++ struct device *dev = core->dev; + int ret; + +- if (codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { +- ret = codec_hevc_alloc_fbc_buffers(sess, comm); +- if (ret) +- return ret; ++ if (codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, is_10bit)) { ++ comm->mmu_map_vaddr = dma_alloc_coherent(dev, MMU_MAP_SIZE, ++ &comm->mmu_map_paddr, ++ GFP_KERNEL); ++ if (!comm->mmu_map_vaddr) ++ return -ENOMEM; + } + + if (codec_hevc_use_mmu(core->platform->revision, +- sess->pixfmt_cap, is_10bit)) { +- ret = codec_hevc_alloc_mmu_headers(sess, comm); +- if (ret) { +- codec_hevc_free_fbc_buffers(sess, comm); +- return ret; +- } ++ sess->pixfmt_cap, is_10bit) || ++ codec_hevc_use_downsample(sess->pixfmt_cap, is_10bit)) { ++ ret = codec_hevc_alloc_fbc_buffers(sess, comm); ++ if (ret) ++ return ret; + } + + if (core->platform->revision == VDEC_REVISION_GXBB) +@@ -278,19 +317,24 @@ EXPORT_SYMBOL_GPL(codec_hevc_setup_buffers); + + void codec_hevc_fill_mmu_map(struct amvdec_session *sess, + struct codec_hevc_common *comm, +- struct vb2_buffer *vb) ++ struct vb2_buffer *vb, ++ u32 is_10bit) + { +- u32 size = amvdec_am21c_size(sess->width, sess->height); +- u32 nb_pages = size / PAGE_SIZE; ++ u32 use_mmu; ++ u32 size; ++ u32 nb_pages; + u32 *mmu_map = comm->mmu_map_vaddr; + u32 first_page; + u32 i; + +- if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) +- first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT; +- else +- first_page = vb2_dma_contig_plane_dma_addr(vb, 0) >> PAGE_SHIFT; ++ use_mmu = codec_hevc_use_mmu(sess->core->platform->revision, ++ sess->pixfmt_cap, is_10bit); ++ ++ size = amvdec_amfbc_size(sess->width, sess->height, is_10bit, ++ use_mmu); + ++ nb_pages = size / PAGE_SIZE; ++ first_page = comm->fbc_buffer_paddr[vb->index] >> PAGE_SHIFT; + for (i = 0; i < nb_pages; ++i) + mmu_map[i] = first_page + i; + } +diff --git a/drivers/staging/media/meson/vdec/codec_hevc_common.h b/drivers/staging/media/meson/vdec/codec_hevc_common.h +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/codec_hevc_common.h ++++ b/drivers/staging/media/meson/vdec/codec_hevc_common.h +@@ -64,6 +64,7 @@ int codec_hevc_setup_buffers(struct amvdec_session *sess, + + void codec_hevc_fill_mmu_map(struct amvdec_session *sess, + struct codec_hevc_common *comm, +- struct vb2_buffer *vb); ++ struct vb2_buffer *vb, ++ u32 is_10bit); + + #endif +diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/codec_vp9.c ++++ b/drivers/staging/media/meson/vdec/codec_vp9.c +@@ -458,12 +458,6 @@ struct codec_vp9 { + struct list_head ref_frames_list; + u32 frames_num; + +- /* In case of downsampling (decoding with FBC but outputting in NV12M), +- * we need to allocate additional buffers for FBC. +- */ +- void *fbc_buffer_vaddr[MAX_REF_PIC_NUM]; +- dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM]; +- + int ref_frame_map[REF_FRAMES]; + int next_ref_frame_map[REF_FRAMES]; + struct vp9_frame *frame_refs[REFS_PER_FRAME]; +@@ -901,11 +895,8 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, + buf_y_paddr = + vb2_dma_contig_plane_dma_addr(vb, 0); + +- if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) { +- val = amvdec_read_dos(core, HEVC_SAO_CTRL5) & ~0xff0200; +- amvdec_write_dos(core, HEVC_SAO_CTRL5, val); +- amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); +- } ++ if (codec_hevc_use_fbc(sess->pixfmt_cap, vp9->is_10bit)) ++ amvdec_write_dos(core, HEVC_CM_BODY_START_ADDR, buf_y_paddr); + + if (sess->pixfmt_cap == V4L2_PIX_FMT_NV12M) { + buf_y_paddr = +@@ -920,8 +911,12 @@ static void codec_vp9_set_sao(struct amvdec_session *sess, + + if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, + vp9->is_10bit)) { +- amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, +- vp9->common.mmu_header_paddr[vb->index]); ++ dma_addr_t header_adr; ++ if (codec_hevc_use_downsample(sess->pixfmt_cap, vp9->is_10bit)) ++ header_adr = vp9->common.mmu_header_paddr[vb->index]; ++ else ++ header_adr = vb2_dma_contig_plane_dma_addr(vb, 0); ++ amvdec_write_dos(core, HEVC_CM_HEADER_START_ADDR, header_adr); + /* use HEVC_CM_HEADER_START_ADDR */ + amvdec_write_dos_bits(core, HEVC_SAO_CTRL5, BIT(10)); + } +@@ -1148,9 +1143,13 @@ static void codec_vp9_set_mc(struct amvdec_session *sess, + { + struct amvdec_core *core = sess->core; + u32 scale = 0; ++ u32 use_mmu; + u32 sz; + int i; + ++ use_mmu = codec_hevc_use_mmu(core->platform->revision, ++ sess->pixfmt_cap, vp9->is_10bit); ++ + amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, 1); + codec_vp9_set_refs(sess, vp9); + amvdec_write_dos(core, HEVCD_MPP_ANC_CANVAS_ACCCONFIG_ADDR, +@@ -1166,8 +1165,9 @@ static void codec_vp9_set_mc(struct amvdec_session *sess, + vp9->frame_refs[i]->height != vp9->height) + scale = 1; + +- sz = amvdec_am21c_body_size(vp9->frame_refs[i]->width, +- vp9->frame_refs[i]->height); ++ sz = amvdec_amfbc_body_size(vp9->frame_refs[i]->width, ++ vp9->frame_refs[i]->height, ++ vp9->is_10bit, use_mmu); + + amvdec_write_dos(core, VP9D_MPP_REFINFO_DATA, + vp9->frame_refs[i]->width); +@@ -1283,7 +1283,8 @@ static void codec_vp9_process_frame(struct amvdec_session *sess) + if (codec_hevc_use_mmu(core->platform->revision, sess->pixfmt_cap, + vp9->is_10bit)) + codec_hevc_fill_mmu_map(sess, &vp9->common, +- &vp9->cur_frame->vbuf->vb2_buf); ++ &vp9->cur_frame->vbuf->vb2_buf, ++ vp9->is_10bit); + + intra_only = param->p.show_frame ? 0 : param->p.intra_only; + +@@ -2130,7 +2131,8 @@ static irqreturn_t codec_vp9_threaded_isr(struct amvdec_session *sess) + + codec_vp9_fetch_rpm(sess); + if (codec_vp9_process_rpm(vp9)) { +- amvdec_src_change(sess, vp9->width, vp9->height, 16); ++ amvdec_src_change(sess, vp9->width, vp9->height, 16, ++ vp9->is_10bit ? 10 : 8); + + /* No frame is actually processed */ + vp9->cur_frame = NULL; +diff --git a/drivers/staging/media/meson/vdec/esparser.c b/drivers/staging/media/meson/vdec/esparser.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/esparser.c ++++ b/drivers/staging/media/meson/vdec/esparser.c +@@ -319,6 +319,7 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) + if (esparser_vififo_get_free_space(sess) < payload_size || + atomic_read(&sess->esparser_queued_bufs) >= num_dst_bufs) + return -EAGAIN; ++ + } else if (esparser_vififo_get_free_space(sess) < payload_size) { + return -EAGAIN; + } +diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/media/meson/vdec/vdec.h +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/vdec.h ++++ b/drivers/staging/media/meson/vdec/vdec.h +@@ -243,6 +243,7 @@ struct amvdec_session { + u32 width; + u32 height; + u32 colorspace; ++ u32 bitdepth; + u8 ycbcr_enc; + u8 quantization; + u8 xfer_func; +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.c ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.c +@@ -50,32 +50,40 @@ void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val) + } + EXPORT_SYMBOL_GPL(amvdec_write_parser); + +-/* 4 KiB per 64x32 block */ +-u32 amvdec_am21c_body_size(u32 width, u32 height) ++/* AMFBC body is made out of 64x32 blocks with varying block size */ ++u32 amvdec_amfbc_body_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu) + { + u32 width_64 = ALIGN(width, 64) / 64; + u32 height_32 = ALIGN(height, 32) / 32; ++ u32 blk_size = 4096; + +- return SZ_4K * width_64 * height_32; ++ if (!is_10bit) { ++ if (use_mmu) ++ blk_size = 3200; ++ else ++ blk_size = 3072; ++ } ++ ++ return blk_size * width_64 * height_32; + } +-EXPORT_SYMBOL_GPL(amvdec_am21c_body_size); ++EXPORT_SYMBOL_GPL(amvdec_amfbc_body_size); + + /* 32 bytes per 128x64 block */ +-u32 amvdec_am21c_head_size(u32 width, u32 height) ++u32 amvdec_amfbc_head_size(u32 width, u32 height) + { + u32 width_128 = ALIGN(width, 128) / 128; + u32 height_64 = ALIGN(height, 64) / 64; + + return 32 * width_128 * height_64; + } +-EXPORT_SYMBOL_GPL(amvdec_am21c_head_size); ++EXPORT_SYMBOL_GPL(amvdec_amfbc_head_size); + +-u32 amvdec_am21c_size(u32 width, u32 height) ++u32 amvdec_amfbc_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu) + { +- return ALIGN(amvdec_am21c_body_size(width, height) + +- amvdec_am21c_head_size(width, height), SZ_64K); ++ return ALIGN(amvdec_amfbc_body_size(width, height, is_10bit, use_mmu) + ++ amvdec_amfbc_head_size(width, height), SZ_64K); + } +-EXPORT_SYMBOL_GPL(amvdec_am21c_size); ++EXPORT_SYMBOL_GPL(amvdec_amfbc_size); + + static int canvas_alloc(struct amvdec_session *sess, u8 *canvas_id) + { +@@ -440,7 +448,7 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess, + EXPORT_SYMBOL_GPL(amvdec_set_par_from_dar); + + void amvdec_src_change(struct amvdec_session *sess, u32 width, +- u32 height, u32 dpb_size) ++ u32 height, u32 dpb_size, u32 bitdepth) + { + static const struct v4l2_event ev = { + .type = V4L2_EVENT_SOURCE_CHANGE, +@@ -448,25 +456,27 @@ void amvdec_src_change(struct amvdec_session *sess, u32 width, + + v4l2_ctrl_s_ctrl(sess->ctrl_min_buf_capture, dpb_size); + ++ sess->bitdepth = bitdepth; ++ + /* + * Check if the capture queue is already configured well for our +- * usecase. If so, keep decoding with it and do not send the event ++ * usecase. If so, keep decoding with it. + */ + if (sess->streamon_cap && + sess->width == width && + sess->height == height && + dpb_size <= sess->num_dst_bufs) { + sess->fmt_out->codec_ops->resume(sess); +- return; +- } ++ } else { ++ sess->status = STATUS_NEEDS_RESUME; ++ sess->changed_format = 0; ++ } + +- sess->changed_format = 0; + sess->width = width; + sess->height = height; +- sess->status = STATUS_NEEDS_RESUME; + +- dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB size %u\n", +- width, height, dpb_size); ++ dev_dbg(sess->core->dev, "Res. changed (%ux%u), DPB %u, bitdepth %u\n", ++ width, height, dpb_size, bitdepth); + v4l2_event_queue_fh(&sess->fh, &ev); + } + EXPORT_SYMBOL_GPL(amvdec_src_change); +diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/vdec_helpers.h ++++ b/drivers/staging/media/meson/vdec/vdec_helpers.h +@@ -27,9 +27,10 @@ void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val); + u32 amvdec_read_parser(struct amvdec_core *core, u32 reg); + void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val); + +-u32 amvdec_am21c_body_size(u32 width, u32 height); +-u32 amvdec_am21c_head_size(u32 width, u32 height); +-u32 amvdec_am21c_size(u32 width, u32 height); ++/* Helpers for the Amlogic compressed framebuffer format */ ++u32 amvdec_amfbc_body_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu); ++u32 amvdec_amfbc_head_size(u32 width, u32 height); ++u32 amvdec_amfbc_size(u32 width, u32 height, u32 is_10bit, u32 use_mmu); + + /** + * amvdec_dst_buf_done_idx() - Signal that a buffer is done decoding +@@ -77,9 +78,10 @@ void amvdec_set_par_from_dar(struct amvdec_session *sess, + * @width: picture width detected by the hardware + * @height: picture height detected by the hardware + * @dpb_size: Decoded Picture Buffer size (= amount of buffers for decoding) ++ * @bitdepth: Bit depth (usually 10 or 8) of the coded content + */ + void amvdec_src_change(struct amvdec_session *sess, u32 width, +- u32 height, u32 dpb_size); ++ u32 height, u32 dpb_size, u32 bitdepth); + + /** + * amvdec_abort() - Abort the current decoding session +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-meson64-overlays.patch b/patch/kernel/archive/meson64-6.10/general-meson64-overlays.patch new file mode 100644 index 000000000000..2e10642b037c --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-meson64-overlays.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zhang Ning <832666+zhangn1985@users.noreply.github.com> +Date: Thu, 19 Sep 2019 16:20:31 +0800 +Subject: general: meson64 overlays + +Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com> +--- + scripts/Makefile.lib | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 111111111111..222222222222 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -93,6 +93,9 @@ base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs)) + + always-y += $(dtb-y) + ++# Overlay targets ++extra-y += $(dtbo-y) $(scr-y) $(dtbotxt-y) ++ + # Add subdir path + + ifneq ($(obj),.) +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-si2168-fix-cmd-timeout.patch b/patch/kernel/archive/meson64-6.10/general-si2168-fix-cmd-timeout.patch new file mode 100644 index 000000000000..5712b3ac8e64 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-si2168-fix-cmd-timeout.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Koumes +Date: Sat, 1 Jun 2019 21:20:26 +0000 +Subject: si2168: fix cmd timeout + +Some demuxer si2168 commands may take 130-140 ms. +(DVB-T/T2 tuner MyGica T230C v2). +Details: https://github.com/CoreELEC/CoreELEC/pull/208 +--- + drivers/media/dvb-frontends/si2168.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c +index 111111111111..222222222222 100644 +--- a/drivers/media/dvb-frontends/si2168.c ++++ b/drivers/media/dvb-frontends/si2168.c +@@ -40,7 +40,7 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd) + + if (cmd->rlen) { + /* wait cmd execution terminate */ +- #define TIMEOUT 70 ++ #define TIMEOUT 200 + timeout = jiffies + msecs_to_jiffies(TIMEOUT); + while (!time_after(jiffies, timeout)) { + ret = i2c_master_recv(client, cmd->args, cmd->rlen); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-socinfo-sm-1-soc-amlogic-meson-gx-socinfo-Add-S905L-ID.patch b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-1-soc-amlogic-meson-gx-socinfo-Add-S905L-ID.patch new file mode 100644 index 000000000000..67d3d3c7be90 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-1-soc-amlogic-meson-gx-socinfo-Add-S905L-ID.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 4 Jun 2024 05:07:52 +0000 +Subject: soc: amlogic: meson-gx-socinfo: Add S905L ID + +Add the S905L SoC ID observed in several P271 boards: + +kernel: soc soc0: Amlogic Meson GXLX (S905L) Revision 26:a (c1:2) Detected + +Signed-off-by: Christian Hewitt +Reviewed-by: Neil Armstrong +--- + drivers/soc/amlogic/meson-gx-socinfo.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/meson-gx-socinfo.c ++++ b/drivers/soc/amlogic/meson-gx-socinfo.c +@@ -64,6 +64,7 @@ static const struct meson_gx_package_id { + { "962E", 0x24, 0x20, 0xf0 }, + { "A113X", 0x25, 0x37, 0xff }, + { "A113D", 0x25, 0x22, 0xff }, ++ { "S905L", 0x26, 0, 0x0 }, + { "S905D2", 0x28, 0x10, 0xf0 }, + { "S905Y2", 0x28, 0x30, 0xf0 }, + { "S905X2", 0x28, 0x40, 0xf0 }, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-socinfo-sm-2-soc-amlogic-meson-gx-socinfo-add-new-A113X-SoC-id.patch b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-2-soc-amlogic-meson-gx-socinfo-add-new-A113X-SoC-id.patch new file mode 100644 index 000000000000..23b809425d0c --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-2-soc-amlogic-meson-gx-socinfo-add-new-A113X-SoC-id.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Tue, 4 Jun 2024 17:04:51 +0300 +Subject: soc: amlogic: meson-gx-socinfo: add new A113X SoC id + +Add new definition for Amlogix A113X SoC found in JetHub D1/D1+ devices: + +soc soc0: Amlogic Meson AXG (A113X) Revision 25:b (43:2) Detected + +Signed-off-by: Viacheslav Bocharov +--- + drivers/soc/amlogic/meson-gx-socinfo.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/meson-gx-socinfo.c ++++ b/drivers/soc/amlogic/meson-gx-socinfo.c +@@ -63,6 +63,7 @@ static const struct meson_gx_package_id { + { "962X", 0x24, 0x10, 0xf0 }, + { "962E", 0x24, 0x20, 0xf0 }, + { "A113X", 0x25, 0x37, 0xff }, ++ { "A113X", 0x25, 0x43, 0xff }, + { "A113D", 0x25, 0x22, 0xff }, + { "S905L", 0x26, 0, 0x0 }, + { "S905D2", 0x28, 0x10, 0xf0 }, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-socinfo-sm-3-soc-amlogic-meson-gx-socinfo-move-common-code-to-hea.patch b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-3-soc-amlogic-meson-gx-socinfo-move-common-code-to-hea.patch new file mode 100644 index 000000000000..25b9ece37c1e --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-3-soc-amlogic-meson-gx-socinfo-move-common-code-to-hea.patch @@ -0,0 +1,339 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Tue, 4 Jun 2024 17:18:08 +0300 +Subject: soc: amlogic: meson-gx-socinfo: move common code to header file + +Move common constants and inline functions from meson-gx-socinfo driver +to header file. Create new structures for store meson64 cpu_id and chip_id. + +Signed-off-by: Viacheslav Bocharov +--- + drivers/soc/amlogic/meson-gx-socinfo-internal.h | 122 ++++++++ + drivers/soc/amlogic/meson-gx-socinfo.c | 140 +--------- + 2 files changed, 137 insertions(+), 125 deletions(-) + +diff --git a/drivers/soc/amlogic/meson-gx-socinfo-internal.h b/drivers/soc/amlogic/meson-gx-socinfo-internal.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/soc/amlogic/meson-gx-socinfo-internal.h +@@ -0,0 +1,122 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (c) 2017 BayLibre, SAS ++ * Copyright (c) 2024 JetHome ++ * Author: Neil Armstrong ++ * Author: Viacheslav Bocharov ++ * ++ */ ++ ++#ifndef _MESON_GX_SOCINFO_INTERNAL_H_ ++#define _MESON_GX_SOCINFO_INTERNAL_H_ ++ ++#include ++ ++#define AO_SEC_SD_CFG8 0xe0 ++#define AO_SEC_SOCINFO_OFFSET AO_SEC_SD_CFG8 ++ ++union meson_cpu_id { ++ struct { // cpu_id v1 ++ u32 layout_ver:4; ++ u32 reserved:4; ++ u32 chip_rev:8; ++ u32 pack_id:8; ++ u32 major_id:8; ++ } v1; ++ struct { // cpu_id v2 ++ u32 major_id:8; ++ u32 chip_rev:8; ++ u32 pack_id:8; ++ u32 reserved:4; ++ u32 layout_ver:4; ++ } v2; ++ u32 raw; ++}; ++ ++struct meson_sm_chip_id { ++ u32 version; ++ union meson_cpu_id cpu_id; ++ u8 serial[12]; ++}; ++ ++static const struct meson_gx_soc_id { ++ const char *name; ++ unsigned int id; ++} soc_ids[] = { ++ { "GXBB", 0x1f }, ++ { "GXTVBB", 0x20 }, ++ { "GXL", 0x21 }, ++ { "GXM", 0x22 }, ++ { "TXL", 0x23 }, ++ { "TXLX", 0x24 }, ++ { "AXG", 0x25 }, ++ { "GXLX", 0x26 }, ++ { "TXHD", 0x27 }, ++ { "G12A", 0x28 }, ++ { "G12B", 0x29 }, ++ { "SM1", 0x2b }, ++ { "A1", 0x2c }, ++}; ++ ++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, 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 }, ++ { "A113X", 0x25, 0x43, 0xff }, ++ { "A113D", 0x25, 0x22, 0xff }, ++ { "S905L", 0x26, 0, 0x0 }, ++ { "S905D2", 0x28, 0x10, 0xf0 }, ++ { "S905Y2", 0x28, 0x30, 0xf0 }, ++ { "S905X2", 0x28, 0x40, 0xf0 }, ++ { "A311D", 0x29, 0x10, 0xf0 }, ++ { "S922X", 0x29, 0x40, 0xf0 }, ++ { "S905D3", 0x2b, 0x4, 0xf5 }, ++ { "S905X3", 0x2b, 0x5, 0xf5 }, ++ { "S905X3", 0x2b, 0x10, 0x3f }, ++ { "S905D3", 0x2b, 0x30, 0x3f }, ++ { "A113L", 0x2c, 0x0, 0xf8 }, ++}; ++ ++static inline const char *socinfo_v1_to_package_id(union meson_cpu_id socinfo) ++{ ++ int i; ++ ++ for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) { ++ if (soc_packages[i].major_id == socinfo.v1.major_id && ++ soc_packages[i].pack_id == ++ (socinfo.v1.pack_id & soc_packages[i].pack_mask)) ++ return soc_packages[i].name; ++ } ++ ++ return "Unknown"; ++} ++ ++static inline const char *socinfo_v1_to_soc_id(union meson_cpu_id socinfo) ++{ ++ int i; ++ ++ for (i = 0 ; i < ARRAY_SIZE(soc_ids) ; ++i) { ++ if (soc_ids[i].id == socinfo.v1.major_id) ++ return soc_ids[i].name; ++ } ++ ++ return "Unknown"; ++} ++ ++#endif /* _MESON_GX_SOCINFO_INTERNAL_H_ */ +diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/meson-gx-socinfo.c ++++ b/drivers/soc/amlogic/meson-gx-socinfo.c +@@ -1,8 +1,8 @@ ++// SPDX-License-Identifier: GPL-2.0+ + /* + * Copyright (c) 2017 BayLibre, SAS + * Author: Neil Armstrong + * +- * SPDX-License-Identifier: GPL-2.0+ + */ + + #include +@@ -12,120 +12,10 @@ + #include + #include + #include +-#include + #include + #include + +-#define AO_SEC_SD_CFG8 0xe0 +-#define AO_SEC_SOCINFO_OFFSET AO_SEC_SD_CFG8 +- +-#define SOCINFO_MAJOR GENMASK(31, 24) +-#define SOCINFO_PACK GENMASK(23, 16) +-#define SOCINFO_MINOR GENMASK(15, 8) +-#define SOCINFO_MISC GENMASK(7, 0) +- +-static const struct meson_gx_soc_id { +- const char *name; +- unsigned int id; +-} soc_ids[] = { +- { "GXBB", 0x1f }, +- { "GXTVBB", 0x20 }, +- { "GXL", 0x21 }, +- { "GXM", 0x22 }, +- { "TXL", 0x23 }, +- { "TXLX", 0x24 }, +- { "AXG", 0x25 }, +- { "GXLX", 0x26 }, +- { "TXHD", 0x27 }, +- { "G12A", 0x28 }, +- { "G12B", 0x29 }, +- { "SM1", 0x2b }, +- { "A1", 0x2c }, +-}; +- +-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, 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 }, +- { "A113X", 0x25, 0x43, 0xff }, +- { "A113D", 0x25, 0x22, 0xff }, +- { "S905L", 0x26, 0, 0x0 }, +- { "S905D2", 0x28, 0x10, 0xf0 }, +- { "S905Y2", 0x28, 0x30, 0xf0 }, +- { "S905X2", 0x28, 0x40, 0xf0 }, +- { "A311D", 0x29, 0x10, 0xf0 }, +- { "S922X", 0x29, 0x40, 0xf0 }, +- { "S905D3", 0x2b, 0x4, 0xf5 }, +- { "S905X3", 0x2b, 0x5, 0xf5 }, +- { "S905X3", 0x2b, 0x10, 0x3f }, +- { "S905D3", 0x2b, 0x30, 0x3f }, +- { "A113L", 0x2c, 0x0, 0xf8 }, +-}; +- +-static inline unsigned int socinfo_to_major(u32 socinfo) +-{ +- return FIELD_GET(SOCINFO_MAJOR, socinfo); +-} +- +-static inline unsigned int socinfo_to_minor(u32 socinfo) +-{ +- return FIELD_GET(SOCINFO_MINOR, socinfo); +-} +- +-static inline unsigned int socinfo_to_pack(u32 socinfo) +-{ +- return FIELD_GET(SOCINFO_PACK, socinfo); +-} +- +-static inline unsigned int socinfo_to_misc(u32 socinfo) +-{ +- return FIELD_GET(SOCINFO_MISC, socinfo); +-} +- +-static const char *socinfo_to_package_id(u32 socinfo) +-{ +- 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_mask)) +- return soc_packages[i].name; +- } +- +- return "Unknown"; +-} +- +-static const char *socinfo_to_soc_id(u32 socinfo) +-{ +- unsigned int id = socinfo_to_major(socinfo); +- int i; +- +- for (i = 0 ; i < ARRAY_SIZE(soc_ids) ; ++i) { +- if (soc_ids[i].id == id) +- return soc_ids[i].name; +- } +- +- return "Unknown"; +-} ++#include "meson-gx-socinfo-internal.h" + + static int __init meson_gx_socinfo_init(void) + { +@@ -133,7 +23,7 @@ static int __init meson_gx_socinfo_init(void) + struct soc_device *soc_dev; + struct device_node *np; + struct regmap *regmap; +- unsigned int socinfo; ++ union meson_cpu_id socinfo; + struct device *dev; + int ret; + +@@ -162,11 +52,11 @@ static int __init meson_gx_socinfo_init(void) + return -ENODEV; + } + +- ret = regmap_read(regmap, AO_SEC_SOCINFO_OFFSET, &socinfo); ++ ret = regmap_read(regmap, AO_SEC_SOCINFO_OFFSET, &socinfo.raw); + if (ret < 0) + return ret; + +- if (!socinfo) { ++ if (!socinfo.raw) { + pr_err("%s: invalid chipid value\n", __func__); + return -EINVAL; + } +@@ -177,13 +67,13 @@ static int __init meson_gx_socinfo_init(void) + + soc_dev_attr->family = "Amlogic Meson"; + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", +- socinfo_to_major(socinfo), +- socinfo_to_minor(socinfo), +- socinfo_to_pack(socinfo), +- socinfo_to_misc(socinfo)); ++ socinfo.v1.major_id, ++ socinfo.v1.chip_rev, ++ socinfo.v1.pack_id, ++ (socinfo.v1.reserved<<4) + socinfo.v1.layout_ver); + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", +- socinfo_to_soc_id(socinfo), +- socinfo_to_package_id(socinfo)); ++ socinfo_v1_to_soc_id(socinfo), ++ socinfo_v1_to_package_id(socinfo)); + + soc_dev = soc_device_register(soc_dev_attr); + if (IS_ERR(soc_dev)) { +@@ -196,10 +86,10 @@ static int __init meson_gx_socinfo_init(void) + + dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected\n", + soc_dev_attr->soc_id, +- socinfo_to_major(socinfo), +- socinfo_to_minor(socinfo), +- socinfo_to_pack(socinfo), +- socinfo_to_misc(socinfo)); ++ socinfo.v1.major_id, ++ socinfo.v1.chip_rev, ++ socinfo.v1.pack_id, ++ (socinfo.v1.reserved<<4) + socinfo.v1.layout_ver); + + return 0; + } +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-socinfo-sm-4-soc-amlogic-meson-gx-socinfo-sm-Add-Amlogic-secure-m.patch b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-4-soc-amlogic-meson-gx-socinfo-sm-Add-Amlogic-secure-m.patch new file mode 100644 index 000000000000..4948c0b8c79b --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-4-soc-amlogic-meson-gx-socinfo-sm-Add-Amlogic-secure-m.patch @@ -0,0 +1,275 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Wed, 21 Feb 2024 16:41:30 +0300 +Subject: soc: amlogic: meson-gx-socinfo-sm: Add Amlogic secure-monitor SoC + Information driver + +Amlogic SoCs have a SoC information secure-monitor call for SoC type, +package type, revision information and chipid. +This patchs adds support for secure-monitor call decoding and exposing +with the SoC bus infrastructure in addition to the previous SoC +Information driver. + +Signed-off-by: Viacheslav Bocharov +--- + drivers/soc/amlogic/Kconfig | 10 + + drivers/soc/amlogic/Makefile | 1 + + drivers/soc/amlogic/meson-gx-socinfo-internal.h | 14 +- + drivers/soc/amlogic/meson-gx-socinfo-sm.c | 190 ++++++++++ + 4 files changed, 211 insertions(+), 4 deletions(-) + +diff --git a/drivers/soc/amlogic/Kconfig b/drivers/soc/amlogic/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/Kconfig ++++ b/drivers/soc/amlogic/Kconfig +@@ -26,6 +26,16 @@ config MESON_GX_SOCINFO + Say yes to support decoding of Amlogic Meson GX SoC family + information about the type, package and version. + ++config MESON_GX_SOCINFO_SM ++ bool "Amlogic Meson GX SoC Information driver via Secure Monitor" ++ depends on (ARM64 && ARCH_MESON || COMPILE_TEST) && MESON_SM=y ++ default ARCH_MESON && MESON_SM ++ select SOC_BUS ++ help ++ Say yes to support decoding of Amlogic Meson GX SoC family ++ information about the type, package and version via secure ++ monitor call. ++ + config MESON_MX_SOCINFO + bool "Amlogic Meson MX SoC Information driver" + depends on (ARM && ARCH_MESON) || COMPILE_TEST +diff --git a/drivers/soc/amlogic/Makefile b/drivers/soc/amlogic/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/Makefile ++++ b/drivers/soc/amlogic/Makefile +@@ -2,4 +2,5 @@ + 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 ++obj-$(CONFIG_MESON_GX_SOCINFO_SM) += meson-gx-socinfo-sm.o + obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o +diff --git a/drivers/soc/amlogic/meson-gx-socinfo-internal.h b/drivers/soc/amlogic/meson-gx-socinfo-internal.h +index 111111111111..222222222222 100644 +--- a/drivers/soc/amlogic/meson-gx-socinfo-internal.h ++++ b/drivers/soc/amlogic/meson-gx-socinfo-internal.h +@@ -33,10 +33,16 @@ union meson_cpu_id { + u32 raw; + }; + +-struct meson_sm_chip_id { +- u32 version; +- union meson_cpu_id cpu_id; +- u8 serial[12]; ++union meson_sm_chip_id { ++ struct { // cpu_id v2 ++ u32 version; ++ union meson_cpu_id cpu_id; ++ u8 serial[12]; ++ } v2; ++ struct { // raw ++ u32 version; ++ u8 buf[12+sizeof(union meson_cpu_id)]; ++ } raw; + }; + + static const struct meson_gx_soc_id { +diff --git a/drivers/soc/amlogic/meson-gx-socinfo-sm.c b/drivers/soc/amlogic/meson-gx-socinfo-sm.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/soc/amlogic/meson-gx-socinfo-sm.c +@@ -0,0 +1,190 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (c) 2017 BayLibre, SAS ++ * Copyright (c) 2024 JetHome ++ * Author: Neil Armstrong ++ * Author: Viacheslav Bocharov ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "meson-gx-socinfo-internal.h" ++ ++static char *socinfo_get_chipid(struct device *dev, struct meson_sm_firmware *fw, ++ union meson_cpu_id *socinfo) ++{ ++ char *buf; ++ union meson_sm_chip_id *id_buf; ++ int ret; ++ ++ id_buf = kzalloc(sizeof(union meson_sm_chip_id)+1, GFP_KERNEL); ++ if (!id_buf) ++ return NULL; ++ ++ ret = meson_sm_call_read(fw, id_buf, sizeof(union meson_sm_chip_id), SM_GET_CHIP_ID, ++ 2, 0, 0, 0, 0); ++ if (ret < 0) { ++ kfree(id_buf); ++ return NULL; ++ } ++ dev_info(dev, "got sm version call %i\n", id_buf->raw.version); ++ ++ if (id_buf->raw.version != 2) { ++ ++ u8 tmp; ++ /** ++ * Legacy 12-byte chip ID read out, transform data ++ * to expected order format ++ */ ++ memmove((void *)&id_buf->v2.serial, (void *)&id_buf->raw.buf, 12); ++ for (int i = 0; i < 6; i++) { ++ tmp = id_buf->v2.serial[i]; ++ id_buf->v2.serial[i] = id_buf->v2.serial[11 - i]; ++ id_buf->v2.serial[11 - i] = tmp; ++ } ++ id_buf->v2.cpu_id.v2.major_id = socinfo->v1.major_id; ++ id_buf->v2.cpu_id.v2.pack_id = socinfo->v1.pack_id; ++ id_buf->v2.cpu_id.v2.chip_rev = socinfo->v1.chip_rev; ++ id_buf->v2.cpu_id.v2.reserved = socinfo->v1.reserved; ++ id_buf->v2.cpu_id.v2.layout_ver = socinfo->v1.layout_ver; ++ } else { ++ /** ++ * rewrite socinfo from regmap with value from secure monitor call ++ */ ++ socinfo->v1.major_id = id_buf->v2.cpu_id.v2.major_id; ++ socinfo->v1.pack_id = id_buf->v2.cpu_id.v2.pack_id; ++ socinfo->v1.chip_rev = id_buf->v2.cpu_id.v2.chip_rev; ++ socinfo->v1.reserved = id_buf->v2.cpu_id.v2.reserved; ++ socinfo->v1.layout_ver = id_buf->v2.cpu_id.v2.layout_ver; ++ } ++ ++ buf = devm_kasprintf(dev, GFP_KERNEL, "%4phN%12phN", &(id_buf->v2.cpu_id), ++ &(id_buf->v2.serial)); ++ ++ kfree(id_buf); ++ ++ return buf; ++} ++ ++static int meson_gx_socinfo_sm_probe(struct platform_device *pdev) ++{ ++ struct soc_device_attribute *soc_dev_attr; ++ struct soc_device *soc_dev; ++ struct device_node *sm_np; ++ struct meson_sm_firmware *fw; ++ struct regmap *regmap; ++ union meson_cpu_id socinfo; ++ struct device *dev; ++ int ret; ++ ++ /* check if chip-id is available */ ++ if (!of_property_read_bool(pdev->dev.of_node, "amlogic,has-chip-id")) ++ return -ENODEV; ++ ++ /* node should be a syscon */ ++ regmap = syscon_node_to_regmap(pdev->dev.of_node); ++ if (IS_ERR(regmap)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(regmap), "failed to get regmap\n"); ++ ++ sm_np = of_parse_phandle(pdev->dev.of_node, "secure-monitor", 0); ++ if (!sm_np) { ++ dev_err(&pdev->dev, "no secure-monitor node found\n"); ++ return -EINVAL; ++ } ++ ++ fw = meson_sm_get(sm_np); ++ of_node_put(sm_np); ++ if (!fw) { ++ dev_dbg(&pdev->dev, "secure-monitor device not ready, probe later\n"); ++ return -EPROBE_DEFER; ++ } ++ ++ ret = regmap_read(regmap, AO_SEC_SOCINFO_OFFSET, &socinfo.raw); ++ if (ret < 0) ++ return ret; ++ ++ if (!socinfo.raw) { ++ dev_err(&pdev->dev, "invalid regmap chipid value\n"); ++ return -EINVAL; ++ } ++ ++ soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), ++ GFP_KERNEL); ++ if (!soc_dev_attr) ++ return -ENOMEM; ++ ++ soc_dev_attr->serial_number = socinfo_get_chipid(&pdev->dev, fw, &socinfo); ++ ++ soc_dev_attr->family = "Amlogic Meson"; ++ soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x:%x - %x:%x", ++ socinfo.v1.major_id, ++ socinfo.v1.chip_rev, ++ socinfo.v1.pack_id, ++ (socinfo.v1.reserved<<4) + socinfo.v1.layout_ver); ++ soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%s (%s)", ++ socinfo_v1_to_soc_id(socinfo), ++ socinfo_v1_to_package_id(socinfo)); ++ ++ soc_dev = soc_device_register(soc_dev_attr); ++ ++ ++ if (IS_ERR(soc_dev)) { ++ kfree(soc_dev_attr->revision); ++ kfree_const(soc_dev_attr->soc_id); ++ return PTR_ERR(soc_dev); ++ } ++ ++ dev = soc_device_to_device(soc_dev); ++ platform_set_drvdata(pdev, soc_dev); ++ ++ dev_info(dev, "Amlogic Meson %s Revision %x:%x (%x:%x) Detected (SM)\n", ++ soc_dev_attr->soc_id, ++ socinfo.v1.major_id, ++ socinfo.v1.chip_rev, ++ socinfo.v1.pack_id, ++ (socinfo.v1.reserved<<4) + socinfo.v1.layout_ver); ++ ++ return PTR_ERR_OR_ZERO(dev); ++} ++ ++ ++static int meson_gx_socinfo_sm_remove(struct platform_device *pdev) ++{ ++ struct soc_device *soc_dev = platform_get_drvdata(pdev); ++ ++ soc_device_unregister(soc_dev); ++ return 0; ++} ++ ++static const struct of_device_id meson_gx_socinfo_match[] = { ++ { .compatible = "amlogic,meson-gx-ao-secure", }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, meson_gx_socinfo_match); ++ ++static struct platform_driver meson_gx_socinfo_driver = { ++ .probe = meson_gx_socinfo_sm_probe, ++ .remove = meson_gx_socinfo_sm_remove, ++ .driver = { ++ .name = "meson-gx-socinfo-sm", ++ .of_match_table = meson_gx_socinfo_match, ++ }, ++}; ++ ++ ++module_platform_driver(meson_gx_socinfo_driver); ++ ++MODULE_AUTHOR("Viacheslav Bocharov "); ++MODULE_DESCRIPTION("Amlogic Meson GX SOC SM driver"); ++MODULE_LICENSE("GPL"); +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-socinfo-sm-5-arm64-dts-meson-add-dts-links-to-secure-monitor-for-.patch b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-5-arm64-dts-meson-add-dts-links-to-secure-monitor-for-.patch new file mode 100644 index 000000000000..e37d769475d8 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-5-arm64-dts-meson-add-dts-links-to-secure-monitor-for-.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Thu, 14 Mar 2024 09:59:54 +0300 +Subject: arm64: dts: meson: add dts links to secure-monitor for soc driver in + a1, axg, gx, g12 + +Add links to secure-monitor in soc driver section for A1, AXG, GX, G12 +Amlogic family for use with meson-socinfo-sm driver. + +Signed-off-by: Viacheslav Bocharov +--- + arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 1 + + arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 1 + + arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 + + arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +@@ -407,6 +407,7 @@ hwrng: rng@5118 { + sec_AO: ao-secure@5a20 { + compatible = "amlogic,meson-gx-ao-secure", "syscon"; + reg = <0x0 0x5a20 0x0 0x140>; ++ secure-monitor = <&sm>; + amlogic,has-chip-id; + }; + +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +@@ -1690,6 +1690,7 @@ mux { + sec_AO: ao-secure@140 { + compatible = "amlogic,meson-gx-ao-secure", "syscon"; + reg = <0x0 0x140 0x0 0x140>; ++ secure-monitor = <&sm>; + amlogic,has-chip-id; + }; + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +@@ -2054,6 +2054,7 @@ cec_AO: cec@100 { + sec_AO: ao-secure@140 { + compatible = "amlogic,meson-gx-ao-secure", "syscon"; + reg = <0x0 0x140 0x0 0x140>; ++ secure-monitor = <&sm>; + amlogic,has-chip-id; + }; + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +@@ -471,6 +471,7 @@ cec_AO: cec@100 { + sec_AO: ao-secure@140 { + compatible = "amlogic,meson-gx-ao-secure", "syscon"; + reg = <0x0 0x140 0x0 0x140>; ++ secure-monitor = <&sm>; + amlogic,has-chip-id; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-socinfo-sm-6-dt-bindings-arm-amlogic-amlogic-meson-gx-ao-secure-a.patch b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-6-dt-bindings-arm-amlogic-amlogic-meson-gx-ao-secure-a.patch new file mode 100644 index 000000000000..0f5fa737b394 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-socinfo-sm-6-dt-bindings-arm-amlogic-amlogic-meson-gx-ao-secure-a.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Tue, 4 Jun 2024 17:54:53 +0300 +Subject: dt-bindings: arm: amlogic: amlogic,meson-gx-ao-secure: add + secure-monitor property + +Add secure-monitor property to schema for meson-gx-socinfo-sm driver. + +Signed-off-by: Viacheslav Bocharov +--- + Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml b/Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml +@@ -32,6 +32,10 @@ properties: + reg: + maxItems: 1 + ++ secure-monitor: ++ description: phandle to the secure-monitor node ++ $ref: /schemas/types.yaml#/definitions/phandle ++ + amlogic,has-chip-id: + description: | + A firmware register encodes the SoC type, package and revision +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-sound-soc-remove-mono-channel-as-it-curren.patch b/patch/kernel/archive/meson64-6.10/general-sound-soc-remove-mono-channel-as-it-curren.patch new file mode 100644 index 000000000000..90f716b22e64 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-sound-soc-remove-mono-channel-as-it-curren.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ckkim +Date: Thu, 20 Feb 2020 18:52:57 +0900 +Subject: ODROID-N2: sound/soc: remove mono channel as it currently doesn't + work hdmi output. + +Change-Id: I4d43b802815779687ade974f049f2b0517a411d1 +Signed-off-by: ckkim +--- + sound/soc/meson/axg-frddr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/meson/axg-frddr.c b/sound/soc/meson/axg-frddr.c +index 111111111111..222222222222 100644 +--- a/sound/soc/meson/axg-frddr.c ++++ b/sound/soc/meson/axg-frddr.c +@@ -108,7 +108,7 @@ static struct snd_soc_dai_driver axg_frddr_dai_drv = { + .name = "FRDDR", + .playback = { + .stream_name = "Playback", +- .channels_min = 1, ++ .channels_min = 2, + .channels_max = AXG_FIFO_CH_MAX, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 5515, +@@ -185,7 +185,7 @@ static struct snd_soc_dai_driver g12a_frddr_dai_drv = { + .name = "FRDDR", + .playback = { + .stream_name = "Playback", +- .channels_min = 1, ++ .channels_min = 2, + .channels_max = AXG_FIFO_CH_MAX, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 5515, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-spi-nor-add-support-for-XT25F128B.patch b/patch/kernel/archive/meson64-6.10/general-spi-nor-add-support-for-XT25F128B.patch new file mode 100644 index 000000000000..a2622bd020fd --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-spi-nor-add-support-for-XT25F128B.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Andreas Rammhold +Date: Thu, 28 Jan 2021 09:43:36 +0000 +Subject: spi-nor: add support for XT25F128B & XT25Q64 + +This adds support for the XT25F128B as found on the RockPi4b SBC. +- Ricardo Pardini 23/jan/2023: add XT25Q64 SPI NOR chip + - found on HK's vendor tree: https://github.com/hardkernel/linux/blame/05e3dc1688758bd401e0f7cdd9809a3f9251f7c1/drivers/mtd/spi-nor/spi-nor.c#L1024-L1026 +- Ricardo pardini 14/jan/2024: convert to new SNOR_ID format + - I just followed the lead Paolo used in rockchip64's 6.7 + +Signed-off-by: Andreas Rammhold +Signed-off-by: Ricardo Pardini + +This continues the efforts done in [1] & [2] that went stale. I've +tested this patch on my RockPi4b which only has the xt25f128b (and not +the xt25f32b as also propsed in [2]). I have tried to obtain a copy of +the datasheets but was unable to find them. Not sure whre you would get +them. + +While [1] was already for the new spi-nor layout it was missing the bits +in the core.{c,h} files. + +[1]: https://patchwork.ozlabs.org/project/linux-mtd/patch/CAMgqO2y9MYDj6antOaWLBRKU8vGEwqCB-Y1TkXTSWsmsed+W6A@mail.gmail.com/ +[2]: https://patchwork.ozlabs.org/project/linux-mtd/patch/20200206171941.GA2398@makrotopia.org/ +--- + drivers/mtd/spi-nor/Makefile | 1 + + drivers/mtd/spi-nor/core.c | 1 + + drivers/mtd/spi-nor/core.h | 1 + + drivers/mtd/spi-nor/xtx.c | 19 ++++++++++ + 4 files changed, 22 insertions(+) + +diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/mtd/spi-nor/Makefile ++++ b/drivers/mtd/spi-nor/Makefile +@@ -15,6 +15,7 @@ spi-nor-objs += sst.o + spi-nor-objs += winbond.o + spi-nor-objs += xilinx.o + spi-nor-objs += xmc.o ++spi-nor-objs += xtx.o + spi-nor-$(CONFIG_DEBUG_FS) += debugfs.o + obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o + +diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c +index 111111111111..222222222222 100644 +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c +@@ -1988,6 +1988,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = { + &spi_nor_winbond, + &spi_nor_xilinx, + &spi_nor_xmc, ++ &spi_nor_xtx, + }; + + static const struct flash_info spi_nor_generic_flash = { +diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h +index 111111111111..222222222222 100644 +--- a/drivers/mtd/spi-nor/core.h ++++ b/drivers/mtd/spi-nor/core.h +@@ -605,6 +605,7 @@ extern const struct spi_nor_manufacturer spi_nor_sst; + extern const struct spi_nor_manufacturer spi_nor_winbond; + extern const struct spi_nor_manufacturer spi_nor_xilinx; + extern const struct spi_nor_manufacturer spi_nor_xmc; ++extern const struct spi_nor_manufacturer spi_nor_xtx; + + extern const struct attribute_group *spi_nor_sysfs_groups[]; + +diff --git a/drivers/mtd/spi-nor/xtx.c b/drivers/mtd/spi-nor/xtx.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/mtd/spi-nor/xtx.c +@@ -0,0 +1,19 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++ ++#include "core.h" ++ ++static const struct flash_info xtx_parts[] = { ++ /* XTX (Shenzhen Xin Tian Xia Tech) */ ++ // { "xt25f128b", INFO(0x0b4018, 0, 64 * 1024, 256) }, ++ { "xt25f128b", SNOR_ID(0x0b, 0x40, 0x18) }, ++ // { "XT25Q64", INFO(0x0b6017, 0, 64 * 1024, 128) }, ++ { "XT25Q64", SNOR_ID(0x0b, 0x60, 0x17) }, ++}; ++ ++const struct spi_nor_manufacturer spi_nor_xtx = { ++ .name = "xtx", ++ .parts = xtx_parts, ++ .nparts = ARRAY_SIZE(xtx_parts), ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/general-usb-core-improve-handling-of-hubs-with-no-ports.patch b/patch/kernel/archive/meson64-6.10/general-usb-core-improve-handling-of-hubs-with-no-ports.patch new file mode 100644 index 000000000000..9b12a4079d18 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/general-usb-core-improve-handling-of-hubs-with-no-ports.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 23 Feb 2022 02:21:19 +0000 +Subject: usb: core: improve handling of hubs with no ports + +I get the "hub doesn't have any ports" error message on a system with +Amlogic S905W SoC. Seems the SoC has internal USB 3.0 supports but +is crippled with regard to USB 3.0 ports. +Maybe we shouldn't consider this scenario an error. So let's change +the message to info level, but otherwise keep the handling of the +scenario as it is today. With the patch it looks like this on my +system. + +dwc2 c9100000.usb: supply vusb_d not found, using dummy regulator +dwc2 c9100000.usb: supply vusb_a not found, using dummy regulator +dwc2 c9100000.usb: EPs: 7, dedicated fifos, 712 entries in SPRAM +xhci-hcd xhci-hcd.0.auto: xHCI Host Controller +xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1 +xhci-hcd xhci-hcd.0.auto: hcc params 0x0228f664 hci version 0x100 quirks 0x0000000002010010 +xhci-hcd xhci-hcd.0.auto: irq 49, io mem 0xc9000000 +hub 1-0:1.0: USB hub found +hub 1-0:1.0: 2 ports detected +xhci-hcd xhci-hcd.0.auto: xHCI Host Controller +xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2 +xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed +usb usb2: We don't know the algorithms for LPM for this host, disabling LPM. +hub 2-0:1.0: USB hub found +hub 2-0:1.0: hub has no ports, exiting + +Signed-off-by: Heiner Kallweit +--- + drivers/usb/core/hub.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 111111111111..222222222222 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1475,9 +1475,8 @@ static int hub_configure(struct usb_hub *hub, + ret = -ENODEV; + goto fail; + } else if (hub->descriptor->bNbrPorts == 0) { +- message = "hub doesn't have any ports!"; +- ret = -ENODEV; +- goto fail; ++ dev_info(hub_dev, "hub has no ports, exiting\n"); ++ return -ENODEV; + } + + /* +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/hwmon-emc2305-fixups-for-driver.patch b/patch/kernel/archive/meson64-6.10/hwmon-emc2305-fixups-for-driver.patch new file mode 100644 index 000000000000..14cbdd500365 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/hwmon-emc2305-fixups-for-driver.patch @@ -0,0 +1,212 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Patrick Yavitz +Date: Tue, 10 Oct 2023 18:54:22 -0400 +Subject: hwmon: emc2305: fixups for driver + +BPI-CM4 fan control + +hwmon: emc2305: fixups for driver +The driver had a number of issues, checkpatch warnings/errors, +and other limitations, so fix these up to make it usable. +hwmon: emc2305: Change OF properties pwm-min & pwm-max to u8 +hwmon: emc2305: Add calls to initialize cooling maps +https://github.com/raspberrypi/linux/commits/233096b8a9023f7e02960543c85447d46af81e81/drivers/hwmon/emc2305.c + +Tested-on: CM4-IO-BASE-B: https://www.waveshare.com/wiki/CM4-IO-BASE-B +Signed-off-by: Phil Elwell +Signed-off-by: Dave Stevenson +Signed-off-by: Patrick Yavitz +--- + drivers/hwmon/emc2305.c | 96 +++++++++- + 1 file changed, 88 insertions(+), 8 deletions(-) + +diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c +index 111111111111..222222222222 100644 +--- a/drivers/hwmon/emc2305.c ++++ b/drivers/hwmon/emc2305.c +@@ -12,12 +12,13 @@ + #include + #include + ++#define EMC2305_REG_FAN_STATUS 0x24 ++#define EMC2305_REG_FAN_STALL_STATUS 0x25 + #define EMC2305_REG_DRIVE_FAIL_STATUS 0x27 + #define EMC2305_REG_VENDOR 0xfe + #define EMC2305_FAN_MAX 0xff + #define EMC2305_FAN_MIN 0x00 + #define EMC2305_FAN_MAX_STATE 10 +-#define EMC2305_DEVICE 0x34 + #define EMC2305_VENDOR 0x5d + #define EMC2305_REG_PRODUCT_ID 0xfd + #define EMC2305_TACH_REGS_UNUSE_BITS 3 +@@ -36,6 +37,7 @@ + #define EMC2305_RPM_FACTOR 3932160 + + #define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * (n)) ++#define EMC2305_REG_FAN_CFG(n) (0x32 + 0x10 * (n)) + #define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * (n)) + #define EMC2305_REG_FAN_TACH(n) (0x3e + 0x10 * (n)) + +@@ -55,6 +57,16 @@ static const struct i2c_device_id emc2305_ids[] = { + }; + MODULE_DEVICE_TABLE(i2c, emc2305_ids); + ++static const struct of_device_id emc2305_dt_ids[] = { ++ { .compatible = "smsc,emc2305" }, ++ { .compatible = "microchip,emc2305" }, ++ { .compatible = "microchip,emc2303" }, ++ { .compatible = "microchip,emc2302" }, ++ { .compatible = "microchip,emc2301" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, emc2305_dt_ids); ++ + /** + * struct emc2305_cdev_data - device-specific cooling device state + * @cdev: cooling device +@@ -100,6 +112,7 @@ struct emc2305_data { + u8 pwm_num; + bool pwm_separate; + u8 pwm_min[EMC2305_PWM_MAX]; ++ u8 pwm_max; + struct emc2305_cdev_data cdev_data[EMC2305_PWM_MAX]; + }; + +@@ -272,7 +285,7 @@ static int emc2305_set_pwm(struct device *dev, long val, int channel) + struct i2c_client *client = data->client; + int ret; + +- if (val < data->pwm_min[channel] || val > EMC2305_FAN_MAX) ++ if (val < data->pwm_min[channel] || val > data->pwm_max) + return -EINVAL; + + ret = i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_DRIVE(channel), val); +@@ -283,6 +296,49 @@ static int emc2305_set_pwm(struct device *dev, long val, int channel) + return 0; + } + ++static int emc2305_get_tz_of(struct device *dev) ++{ ++ struct device_node *np = dev->of_node; ++ struct emc2305_data *data = dev_get_drvdata(dev); ++ int ret = 0; ++ u8 val; ++ int i; ++ ++ /* OF parameters are optional - overwrite default setting ++ * if some of them are provided. ++ */ ++ ++ ret = of_property_read_u8(np, "emc2305,cooling-levels", &val); ++ if (!ret) ++ data->max_state = val; ++ else if (ret != -EINVAL) ++ return ret; ++ ++ ret = of_property_read_u8(np, "emc2305,pwm-max", &val); ++ if (!ret) ++ data->pwm_max = val; ++ else if (ret != -EINVAL) ++ return ret; ++ ++ ret = of_property_read_u8(np, "emc2305,pwm-min", &val); ++ if (!ret) ++ for (i = 0; i < EMC2305_PWM_MAX; i++) ++ data->pwm_min[i] = val; ++ else if (ret != -EINVAL) ++ return ret; ++ ++ /* Not defined or 0 means one thermal zone over all cooling devices. ++ * Otherwise - separated thermal zones for each PWM channel. ++ */ ++ ret = of_property_read_u8(np, "emc2305,pwm-channel", &val); ++ if (!ret) ++ data->pwm_separate = (val != 0); ++ else if (ret != -EINVAL) ++ return ret; ++ ++ return 0; ++} ++ + static int emc2305_set_single_tz(struct device *dev, int idx) + { + struct emc2305_data *data = dev_get_drvdata(dev); +@@ -292,9 +348,17 @@ static int emc2305_set_single_tz(struct device *dev, int idx) + cdev_idx = (idx) ? idx - 1 : 0; + pwm = data->pwm_min[cdev_idx]; + +- data->cdev_data[cdev_idx].cdev = +- thermal_cooling_device_register(emc2305_fan_name[idx], data, +- &emc2305_cooling_ops); ++ if (dev->of_node) ++ data->cdev_data[cdev_idx].cdev = ++ devm_thermal_of_cooling_device_register(dev, dev->of_node, ++ emc2305_fan_name[idx], ++ data, ++ &emc2305_cooling_ops); ++ else ++ data->cdev_data[cdev_idx].cdev = ++ thermal_cooling_device_register(emc2305_fan_name[idx], ++ data, ++ &emc2305_cooling_ops); + + if (IS_ERR(data->cdev_data[cdev_idx].cdev)) { + dev_err(dev, "Failed to register cooling device %s\n", emc2305_fan_name[idx]); +@@ -347,9 +411,11 @@ static void emc2305_unset_tz(struct device *dev) + int i; + + /* Unregister cooling device. */ +- for (i = 0; i < EMC2305_PWM_MAX; i++) +- if (data->cdev_data[i].cdev) +- thermal_cooling_device_unregister(data->cdev_data[i].cdev); ++ if (!dev->of_node) { ++ for (i = 0; i < EMC2305_PWM_MAX; i++) ++ if (data->cdev_data[i].cdev) ++ thermal_cooling_device_unregister(data->cdev_data[i].cdev); ++ } + } + + static umode_t +@@ -571,11 +637,18 @@ static int emc2305_probe(struct i2c_client *client) + data->pwm_separate = pdata->pwm_separate; + for (i = 0; i < EMC2305_PWM_MAX; i++) + data->pwm_min[i] = pdata->pwm_min[i]; ++ data->pwm_max = EMC2305_FAN_MAX; + } else { + data->max_state = EMC2305_FAN_MAX_STATE; + data->pwm_separate = false; + for (i = 0; i < EMC2305_PWM_MAX; i++) + data->pwm_min[i] = EMC2305_FAN_MIN; ++ data->pwm_max = EMC2305_FAN_MAX; ++ if (dev->of_node) { ++ ret = emc2305_get_tz_of(dev); ++ if (ret < 0) ++ return ret; ++ } + } + + data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "emc2305", data, +@@ -596,6 +669,12 @@ static int emc2305_probe(struct i2c_client *client) + return ret; + } + ++ /* Acknowledge any existing faults. Stops the device responding on the ++ * SMBus alert address. ++ */ ++ i2c_smbus_read_byte_data(client, EMC2305_REG_FAN_STALL_STATUS); ++ i2c_smbus_read_byte_data(client, EMC2305_REG_FAN_STATUS); ++ + return 0; + } + +@@ -610,6 +689,7 @@ static void emc2305_remove(struct i2c_client *client) + static struct i2c_driver emc2305_driver = { + .driver = { + .name = "emc2305", ++ .of_match_table = emc2305_dt_ids, + }, + .probe = emc2305_probe, + .remove = emc2305_remove, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/jethome-0001-Fix-meson64-add-gpio-irq-patch-from-https-lkml.org-l.patch b/patch/kernel/archive/meson64-6.10/jethome-0001-Fix-meson64-add-gpio-irq-patch-from-https-lkml.org-l.patch new file mode 100644 index 000000000000..d6c0036fae99 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/jethome-0001-Fix-meson64-add-gpio-irq-patch-from-https-lkml.org-l.patch @@ -0,0 +1,100 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: usera +Date: Mon, 12 Apr 2021 16:16:42 +0200 +Subject: Fix:meson64: add gpio irq (patch from + https://lkml.org/lkml/2020/11/27/8) + +Signed-off-by: Vyacheslav Bocharov +--- + drivers/pinctrl/meson/pinctrl-meson.c | 41 ++++++++++ + drivers/pinctrl/meson/pinctrl-meson.h | 1 + + 2 files changed, 42 insertions(+) + +diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c +index 111111111111..222222222222 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson.c ++++ b/drivers/pinctrl/meson/pinctrl-meson.c +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + + #include "../core.h" + #include "../pinctrl-utils.h" +@@ -601,6 +602,40 @@ static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio) + return !!(val & BIT(bit)); + } + ++static int meson_gpio_to_irq(struct gpio_chip *chip, unsigned int gpio) ++{ ++ struct meson_pinctrl *pc = gpiochip_get_data(chip); ++ struct meson_bank *bank; ++ struct irq_fwspec fwspec; ++ int hwirq; ++ ++ if (meson_get_bank(pc, gpio, &bank)) ++ return -EINVAL; ++ ++ if (bank->irq_first < 0) { ++ dev_warn(pc->dev, "no support irq for pin[%d]\n", gpio); ++ return -EINVAL; ++ } ++ if (!pc->of_irq) { ++ dev_err(pc->dev, "invalid device node of gpio INTC\n"); ++ return -EINVAL; ++ } ++ ++ hwirq = gpio - bank->first + bank->irq_first; ++ printk("gpio irq setup: hwirq: 0x%X irqfirst: 0x%X irqlast: 0x%X pin[%d]\n", hwirq, bank->irq_first, bank->irq_last, gpio); ++ if (hwirq > bank->irq_last) ++ { ++ dev_warn(pc->dev, "no more irq for pin[%d]\n", gpio); ++ return -EINVAL; ++ } ++ fwspec.fwnode = of_node_to_fwnode(pc->of_irq); ++ fwspec.param_count = 2; ++ fwspec.param[0] = hwirq; ++ fwspec.param[1] = IRQ_TYPE_NONE; ++ ++ return irq_create_fwspec_mapping(&fwspec); ++} ++ + static int meson_gpiolib_register(struct meson_pinctrl *pc) + { + int ret; +@@ -616,6 +651,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) + pc->chip.direction_output = meson_gpio_direction_output; + pc->chip.get = meson_gpio_get; + pc->chip.set = meson_gpio_set; ++ pc->chip.to_irq = meson_gpio_to_irq; + pc->chip.base = -1; + pc->chip.ngpio = pc->data->num_pins; + pc->chip.can_sleep = false; +@@ -679,6 +715,11 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc) + pc->fwnode = gpiochip_node_get_first(pc->dev); + gpio_np = to_of_node(pc->fwnode); + ++ pc->of_irq = of_find_compatible_node(NULL, ++ NULL, "amlogic,meson-gpio-intc"); ++ if (!pc->of_irq) ++ pc->of_irq = of_find_compatible_node(NULL, ++ NULL, "amlogic,meson-gpio-intc-ext"); + pc->reg_mux = meson_map_resource(pc, gpio_np, "mux"); + if (IS_ERR_OR_NULL(pc->reg_mux)) { + dev_err(pc->dev, "mux registers not found\n"); +diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h +index 111111111111..222222222222 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson.h ++++ b/drivers/pinctrl/meson/pinctrl-meson.h +@@ -134,6 +134,7 @@ struct meson_pinctrl { + struct regmap *reg_ds; + struct gpio_chip chip; + struct fwnode_handle *fwnode; ++ struct device_node *of_irq; + }; + + #define FUNCTION(fn) \ +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch b/patch/kernel/archive/meson64-6.10/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch new file mode 100644 index 000000000000..c9f14793d7d2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/jethome-0002-arm64-dts-jethub-j1xx-add-eeprom-node.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Fri, 20 Oct 2023 14:06:58 +0300 +Subject: arm64: dts: jethub-j1xx: add eeprom node + +Add node for eeprom on baseboard in JetHub D1+ device +--- + arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-2.dts | 12 ++++++++++ + arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-3.dts | 12 ++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-2.dts b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-2.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-2.dts +@@ -47,3 +47,15 @@ eeprompd: eeprom@56 { + vcc-supply = <&vddao_3v3>; + }; + }; ++ ++&i2c_AO { ++ /* EEPROM on base board */ ++ eeprompd: eeprom@56 { ++ compatible = "atmel,24c64"; ++ reg = <0x56>; ++ pagesize = <0x20>; ++ label = "eeprompd"; ++ address-width = <0x10>; ++ vcc-supply = <&vddao_3v3>; ++ }; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-3.dts b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-3.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-3.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j110-rev-3.dts +@@ -37,3 +37,15 @@ eeprompd: eeprom@56 { + vcc-supply = <&vddao_3v3>; + }; + }; ++ ++&i2c_AO { ++ /* EEPROM on base board */ ++ eeprompd: eeprom@56 { ++ compatible = "atmel,24c64"; ++ reg = <0x56>; ++ pagesize = <0x20>; ++ label = "eeprompd"; ++ address-width = <0x10>; ++ vcc-supply = <&vddao_3v3>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/jethome-0003-arm64-dts-meson-add-dts-links-to-secure-monitor-for-jethub.patch.disabled b/patch/kernel/archive/meson64-6.10/jethome-0003-arm64-dts-meson-add-dts-links-to-secure-monitor-for-jethub.patch.disabled new file mode 100644 index 000000000000..a05a9a4e052e --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/jethome-0003-arm64-dts-meson-add-dts-links-to-secure-monitor-for-jethub.patch.disabled @@ -0,0 +1,39 @@ +From 728157ef8e377f74289dc7397c2de4b3b6416ccc Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Thu, 22 Feb 2024 12:02:20 +0300 +Subject: [PATCH 5/5] arm64: dts: meson: add dts links to secure-monitor for + JetHub devices + +Signed-off-by: Viacheslav Bocharov +--- + .../arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j1xx.dtsi | 4 ++++ + .../boot/dts/amlogic/meson-gxl-s905w-jethome-jethub-j80.dts | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j1xx.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j1xx.dtsi +index db605f3a22b4..f3e679030788 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j1xx.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j1xx.dtsi +@@ -348,3 +348,7 @@ &cpu2 { + &cpu3 { + #cooling-cells = <2>; + }; ++ ++&sec_AO { ++ secure-monitor = <&sm>; ++}; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-jethome-jethub-j80.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-jethome-jethub-j80.dts +index a18d6d241a5a..d75ba28d5e62 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-jethome-jethub-j80.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-jethome-jethub-j80.dts +@@ -245,3 +245,7 @@ pcf8563: rtc@51 { + status = "okay"; + }; + }; ++ ++&sec_AO { ++ secure-monitor = <&sm>; ++}; +-- +2.43.2 + diff --git a/patch/kernel/archive/meson64-6.10/jethome-0003-dt-bindings-arm-amlogic-add-binding-for-JetHome-JetH.patch b/patch/kernel/archive/meson64-6.10/jethome-0003-dt-bindings-arm-amlogic-add-binding-for-JetHome-JetH.patch new file mode 100644 index 000000000000..02e73c4f4b52 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/jethome-0003-dt-bindings-arm-amlogic-add-binding-for-JetHome-JetH.patch @@ -0,0 +1,28 @@ +From e38ecc4ec467c5eb1b7e510877532239a43f7db8 Mon Sep 17 00:00:00 2001 +From: Viacheslav Bocharov +Date: Thu, 6 Jun 2024 14:31:12 +0300 +Subject: [PATCH 1/2] dt-bindings: arm: amlogic: add binding for JetHome JetHub + D2 + +JetHome JetHub D2 is a home automation controller, based on Amlogic S905X3 SoC + +Signed-off-by: Viacheslav Bocharov +--- + Documentation/devicetree/bindings/arm/amlogic.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml +index a374b98080fe..1acfb184aa9e 100644 +--- a/Documentation/devicetree/bindings/arm/amlogic.yaml ++++ b/Documentation/devicetree/bindings/arm/amlogic.yaml +@@ -190,6 +190,7 @@ properties: + - hardkernel,odroid-c4 + - hardkernel,odroid-hc4 + - haochuangyi,h96-max ++ - jethome,jethub-j200 + - khadas,vim3l + - libretech,aml-s905d3-cc + - seirobotics,sei610 +-- +2.45.2 + diff --git a/patch/kernel/archive/meson64-6.10/kernel-6.8-tools-cgroup-makefile.patch b/patch/kernel/archive/meson64-6.10/kernel-6.8-tools-cgroup-makefile.patch new file mode 100644 index 000000000000..02f1e527e6e7 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/kernel-6.8-tools-cgroup-makefile.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ColorfulRhino <131405023+ColorfulRhino@users.noreply.github.com> +Date: Sat, 30 Mar 2024 21:09:12 +0100 +Subject: [ARCHEOLOGY] meson-s4t7: Fix custom_kernel_config: hash modification + has to happen inside the first function call + +> X-Git-Archeology: > recovered message: > Will be ignored on second time the function is called +> X-Git-Archeology: - Revision 6ced5cc02637fb6dbc980aa77fcdc77f2ccf5067: https://github.com/armbian/build/commit/6ced5cc02637fb6dbc980aa77fcdc77f2ccf5067 +> X-Git-Archeology: Date: Sat, 30 Mar 2024 21:09:12 +0100 +> X-Git-Archeology: From: ColorfulRhino <131405023+ColorfulRhino@users.noreply.github.com> +> X-Git-Archeology: Subject: meson-s4t7: Fix custom_kernel_config: hash modification has to happen inside the first function call +> X-Git-Archeology: +> X-Git-Archeology: - Revision caf0529240948df416b015aeea8c23e420a55ce6: https://github.com/armbian/build/commit/caf0529240948df416b015aeea8c23e420a55ce6 +> X-Git-Archeology: Date: Sun, 31 Mar 2024 18:21:26 -0400 +> X-Git-Archeology: From: Barry Lind (SteeManMI) +> X-Git-Archeology: Subject: Bump meson64 edge from 6.7 to 6.8 +> X-Git-Archeology: +--- + tools/cgroup/Makefile | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/tools/cgroup/Makefile b/tools/cgroup/Makefile +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/tools/cgroup/Makefile +@@ -0,0 +1,11 @@ ++# SPDX-License-Identifier: GPL-2.0 ++# Makefile for cgroup tools ++ ++CFLAGS = -Wall -Wextra ++ ++all: cgroup_event_listener ++%: %.c ++ $(CC) $(CFLAGS) -o $@ $^ ++ ++clean: ++ $(RM) cgroup_event_listener +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-g12a-pinctrl-add-missing-ir-options.patch b/patch/kernel/archive/meson64-6.10/meson-g12a-pinctrl-add-missing-ir-options.patch new file mode 100644 index 000000000000..93b424652897 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-g12a-pinctrl-add-missing-ir-options.patch @@ -0,0 +1,91 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yuntian Zhang +Date: Mon, 25 Jul 2022 15:31:31 +0800 +Subject: pinctrl: meson-g12a: add missing ir options + +Those pins are defined in S905Y2 and A311D reference manuals. + +Signed-off-by: Yuntian Zhang +--- + arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 16 ++++++++++ + drivers/pinctrl/meson/pinctrl-meson-g12a.c | 9 ++++++ + 2 files changed, 25 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +@@ -563,6 +563,14 @@ mux { + }; + }; + ++ remote_input_pins: remote-input { ++ mux { ++ groups = "remote_input"; ++ function = "remote_input"; ++ bias-disable; ++ }; ++ }; ++ + mclk0_a_pins: mclk0-a { + mux { + groups = "mclk0_a"; +@@ -2034,6 +2042,14 @@ mux { + bias-disable; + }; + }; ++ ++ remote_out_ao_pins: remote-out { ++ mux { ++ groups = "remote_ao_out"; ++ function = "remote_ao_out"; ++ bias-disable; ++ }; ++ }; + }; + }; + +diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c +index 111111111111..222222222222 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson-g12a.c ++++ b/drivers/pinctrl/meson/pinctrl-meson-g12a.c +@@ -216,6 +216,9 @@ static const unsigned int i2c3_sck_h_pins[] = { GPIOH_1 }; + static const unsigned int i2c3_sda_a_pins[] = { GPIOA_14 }; + static const unsigned int i2c3_sck_a_pins[] = { GPIOA_15 }; + ++/* ir_in */ ++static const unsigned int remote_input_pins[] = { GPIOA_15 }; ++ + /* uart_a */ + static const unsigned int uart_a_tx_pins[] = { GPIOX_12 }; + static const unsigned int uart_a_rx_pins[] = { GPIOX_13 }; +@@ -737,6 +740,7 @@ static struct meson_pmx_group meson_g12a_periphs_groups[] = { + /* bank GPIOA */ + GROUP(i2c3_sda_a, 2), + GROUP(i2c3_sck_a, 2), ++ GROUP(remote_input, 1), + GROUP(pdm_din0_a, 1), + GROUP(pdm_din1_a, 1), + GROUP(pdm_din2_a, 1), +@@ -1022,6 +1026,10 @@ static const char * const i2c3_groups[] = { + "i2c3_sda_a", "i2c3_sck_a", + }; + ++static const char * const remote_input_groups[] = { ++ "remote_input", ++}; ++ + static const char * const uart_a_groups[] = { + "uart_a_tx", "uart_a_rx", "uart_a_cts", "uart_a_rts", + }; +@@ -1266,6 +1274,7 @@ static struct meson_pmx_func meson_g12a_periphs_functions[] = { + FUNCTION(i2c1), + FUNCTION(i2c2), + FUNCTION(i2c3), ++ FUNCTION(remote_input), + FUNCTION(uart_a), + FUNCTION(uart_b), + FUNCTION(uart_c), +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-g12b-pinctrl-Add-missing-pinmux-for-pwm.patch b/patch/kernel/archive/meson64-6.10/meson-g12b-pinctrl-Add-missing-pinmux-for-pwm.patch new file mode 100644 index 000000000000..f929f37d34f1 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-g12b-pinctrl-Add-missing-pinmux-for-pwm.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yuntian Zhang +Date: Thu, 13 Jan 2022 21:34:10 +0800 +Subject: pinctrl: meson: Add several missing pinmux for pwm functions + +The following pin definitions are mentioned in A311D Quick +Reference Manual and S922X Public Datasheet, but not in S905Y2 +Quick Reference Manual, so adding them to meson-g12b family. + +They are currently exposed in Radxa Zero 2's GPIO header. + +Signed-off-by: Yuntian Zhang +--- + arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 34 ++++++++++ + drivers/pinctrl/meson/pinctrl-meson-g12a.c | 14 +++- + 2 files changed, 45 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi +@@ -149,3 +149,37 @@ &pmu { + &npu { + power-domains = <&pwrc PWRC_G12A_NNA_ID>; + }; ++ ++&periphs_pinctrl { ++ pwm_b_h_pins: pwm-b-h { ++ mux { ++ groups = "pwm_b_h"; ++ function = "pwm_b"; ++ bias-disable; ++ }; ++ }; ++ ++ pwm_b_z_pins: pwm-b-z { ++ mux { ++ groups = "pwm_b_z"; ++ function = "pwm_b"; ++ bias-disable; ++ }; ++ }; ++ ++ pwm_c_z_pins: pwm-c-z { ++ mux { ++ groups = "pwm_c_z"; ++ function = "pwm_c"; ++ bias-disable; ++ }; ++ }; ++ ++ pwm_d_z_pins: pwm-d-z { ++ mux { ++ groups = "pwm_d_z"; ++ function = "pwm_d"; ++ bias-disable; ++ }; ++ }; ++}; +diff --git a/drivers/pinctrl/meson/pinctrl-meson-g12a.c b/drivers/pinctrl/meson/pinctrl-meson-g12a.c +index 111111111111..222222222222 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson-g12a.c ++++ b/drivers/pinctrl/meson/pinctrl-meson-g12a.c +@@ -271,17 +271,21 @@ static const unsigned int eth_act_led_pins[] = { GPIOZ_15 }; + static const unsigned int pwm_a_pins[] = { GPIOX_6 }; + + /* pwm_b */ ++static const unsigned int pwm_b_h_pins[] = { GPIOH_7 }; + static const unsigned int pwm_b_x7_pins[] = { GPIOX_7 }; + static const unsigned int pwm_b_x19_pins[] = { GPIOX_19 }; ++static const unsigned int pwm_b_z_pins[] = { GPIOZ_0 }; + + /* pwm_c */ + static const unsigned int pwm_c_c_pins[] = { GPIOC_4 }; + static const unsigned int pwm_c_x5_pins[] = { GPIOX_5 }; + static const unsigned int pwm_c_x8_pins[] = { GPIOX_8 }; ++static const unsigned int pwm_c_z_pins[] = { GPIOZ_1 }; + + /* pwm_d */ + static const unsigned int pwm_d_x3_pins[] = { GPIOX_3 }; + static const unsigned int pwm_d_x6_pins[] = { GPIOX_6 }; ++static const unsigned int pwm_d_z_pins[] = { GPIOZ_2 }; + + /* pwm_e */ + static const unsigned int pwm_e_pins[] = { GPIOX_16 }; +@@ -594,6 +598,9 @@ static struct meson_pmx_group meson_g12a_periphs_groups[] = { + GROUP(bt565_a_din5, 2), + GROUP(bt565_a_din6, 2), + GROUP(bt565_a_din7, 2), ++ GROUP(pwm_b_z, 5), ++ GROUP(pwm_c_z, 5), ++ GROUP(pwm_d_z, 2), + GROUP(tsin_b_valid_z, 3), + GROUP(tsin_b_sop_z, 3), + GROUP(tsin_b_din0_z, 3), +@@ -726,6 +733,7 @@ static struct meson_pmx_group meson_g12a_periphs_groups[] = { + GROUP(uart_c_rts, 2), + GROUP(iso7816_clk_h, 1), + GROUP(iso7816_data_h, 1), ++ GROUP(pwm_b_h, 5), + GROUP(pwm_f_h, 4), + GROUP(cec_ao_a_h, 4), + GROUP(cec_ao_b_h, 5), +@@ -1066,15 +1074,15 @@ static const char * const pwm_a_groups[] = { + }; + + static const char * const pwm_b_groups[] = { +- "pwm_b_x7", "pwm_b_x19", ++ "pwm_b_h", "pwm_b_x7", "pwm_b_x19", "pwm_b_z", + }; + + static const char * const pwm_c_groups[] = { +- "pwm_c_c", "pwm_c_x5", "pwm_c_x8", ++ "pwm_c_c", "pwm_c_x5", "pwm_c_x8", "pwm_c_z", + }; + + static const char * const pwm_d_groups[] = { +- "pwm_d_x3", "pwm_d_x6", ++ "pwm_d_x3", "pwm_d_x6", "pwm_d_z", + }; + + static const char * const pwm_e_groups[] = { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-gx-dts-add-support-for-GX-PM-and-VRTC.patch b/patch/kernel/archive/meson64-6.10/meson-gx-dts-add-support-for-GX-PM-and-VRTC.patch new file mode 100644 index 000000000000..21d7667755ff --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-gx-dts-add-support-for-GX-PM-and-VRTC.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Neil Armstrong +Date: Thu, 3 Nov 2016 15:29:25 +0100 +Subject: HACK: arm64: dts: meson: add support for GX PM and Virtual RTC + +Signed-off-by: Neil Armstrong +--- + arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +@@ -223,6 +223,10 @@ sm: secure-monitor { + }; + }; + ++ system-suspend { ++ compatible = "amlogic,meson-gx-pm"; ++ }; ++ + efuse: efuse { + compatible = "amlogic,meson-gx-efuse", "amlogic,meson-gxbb-efuse"; + #address-cells = <1>; +@@ -461,6 +465,11 @@ clkc_AO: clock-controller { + }; + }; + ++ vrtc: rtc@a8 { ++ compatible = "amlogic,meson-vrtc"; ++ reg = <0x0 0x000a8 0x0 0x4>; ++ }; ++ + cec_AO: cec@100 { + compatible = "amlogic,meson-gx-ao-cec"; + reg = <0x0 0x00100 0x0 0x14>; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-gxbb-dts-i2cX-missing-pins.patch b/patch/kernel/archive/meson64-6.10/meson-gxbb-dts-i2cX-missing-pins.patch new file mode 100644 index 000000000000..57b65d9db285 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-gxbb-dts-i2cX-missing-pins.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Wed, 5 Dec 2018 17:35:05 -0500 +Subject: fix i2cA and i2cB miossing pins + +- c80617d145039a32b53e9f0908353aaea3d368a6: 1544111688: Martin Ayotte : 'add i2c_B missing pins' +--- + arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +@@ -333,6 +333,8 @@ &hwrng { + + &i2c_A { + clocks = <&clkc CLKID_I2C>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c_a_pins>; + }; + + &i2c_AO { +@@ -341,6 +343,8 @@ &i2c_AO { + + &i2c_B { + clocks = <&clkc CLKID_I2C>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c_b_pins>; + }; + + &i2c_C { +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-gxbb-vdec-add-HEVC-support-to-GXBB.patch b/patch/kernel/archive/meson64-6.10/meson-gxbb-vdec-add-HEVC-support-to-GXBB.patch new file mode 100644 index 000000000000..4d0717675485 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-gxbb-vdec-add-HEVC-support-to-GXBB.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Sun, 21 Nov 2021 19:12:07 +0000 +Subject: WIP: drivers: meson: vdec: add HEVC support to GXBB + +It's not clear whether the GXL firmware is the same one used with GXBB +but let's try it and see! + +Signed-off-by: Christian Hewitt +--- + drivers/staging/media/meson/vdec/vdec_platform.c | 12 ++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/vdec_platform.c ++++ b/drivers/staging/media/meson/vdec/vdec_platform.c +@@ -16,6 +16,18 @@ + + static const struct amvdec_format vdec_formats_gxbb[] = { + { ++ .pixfmt = V4L2_PIX_FMT_HEVC, ++ .min_buffers = 4, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_hevc_ops, ++ .firmware_path = "meson/vdec/gxl_hevc.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, + .max_buffers = 24, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-gxl-gxm-arm64-dts-meson-set-p212-p23x-q20x-SDIO-to-100MH.patch b/patch/kernel/archive/meson64-6.10/meson-gxl-gxm-arm64-dts-meson-set-p212-p23x-q20x-SDIO-to-100MH.patch new file mode 100644 index 000000000000..925ab80df2c2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-gxl-gxm-arm64-dts-meson-set-p212-p23x-q20x-SDIO-to-100MH.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Tue, 18 Jan 2022 15:09:12 +0000 +Subject: WIP: arm64: dts: meson: set p212/p23x/q20x SDIO to 100MHz + add UHS + SDIO capabilities + +WIP: arm64: dts: meson: add UHS SDIO capabilities to p212/p23x/q20x + +Add UHS capabilities to the SDIO node to enable 100MHz speeds. + +Signed-off-by: Christian Hewitt + +WIP: arm64: dts: meson: set p212/p23x/q20x SDIO to 100MHz + +Amlogic datasheets describe 50MHz max-frequency for SDIO on GXL/GXM but +real-world tests on an assortment of GXL and GXM boards show noteable +increases in throughput when max-frequency is 100MHz, so let's use it. + +Before results from a p231 device: + +Connecting to host 192.168.0.1, port 5201 +Reverse mode, remote host 192.168.0.1 is sending +[ 5] local 192.168.0.41 port 42550 connected to 192.168.0.1 port 5201 +[ ID] Interval Transfer Bitrate +[ 5] 0.00-1.00 sec 8.84 MBytes 74.2 Mbits/sec +[ 5] 1.00-2.00 sec 9.60 MBytes 80.5 Mbits/sec +[ 5] 2.00-3.00 sec 9.07 MBytes 76.1 Mbits/sec +[ 5] 3.00-4.00 sec 9.14 MBytes 76.6 Mbits/sec +[ 5] 4.00-5.00 sec 9.26 MBytes 77.7 Mbits/sec +[ 5] 5.00-6.00 sec 9.08 MBytes 76.2 Mbits/sec +[ 5] 6.00-7.00 sec 9.11 MBytes 76.4 Mbits/sec +[ 5] 7.00-8.00 sec 8.65 MBytes 72.5 Mbits/sec +[ 5] 8.00-9.00 sec 9.24 MBytes 77.5 Mbits/sec +[ 5] 9.00-10.00 sec 8.57 MBytes 71.9 Mbits/sec +- - - - - - - - - - - - - - - - - - - - - - - - - +[ ID] Interval Transfer Bitrate Retr +[ 5] 0.00-10.27 sec 94.1 MBytes 76.8 Mbits/sec 0 sender +[ 5] 0.00-10.00 sec 90.6 MBytes 76.0 Mbits/sec receiver + +clock: 50000000 Hz +actual clock: 50000000 Hz +vdd: 21 (3.3 ~ 3.4 V) +bus mode: 2 (push-pull) +chip select: 0 (don't care) +power mode: 2 (on) +bus width: 2 (4 bits) +timing spec: 2 (sd high-speed) +signal voltage: 1 (1.80 V) +driver type: 0 (driver type B) + +After results from a p231 device: + +Connecting to host 192.168.0.1, port 5201 +Reverse mode, remote host 192.168.0.1 is sending +[ 5] local 192.168.0.41 port 58534 connected to 192.168.0.1 port 5201 +[ ID] Interval Transfer Bitrate +[ 5] 0.00-1.00 sec 12.6 MBytes 106 Mbits/sec +[ 5] 1.00-2.00 sec 13.0 MBytes 109 Mbits/sec +[ 5] 2.00-3.00 sec 12.8 MBytes 107 Mbits/sec +[ 5] 3.00-4.00 sec 13.2 MBytes 111 Mbits/sec +[ 5] 4.00-5.00 sec 12.4 MBytes 104 Mbits/sec +[ 5] 5.00-6.00 sec 11.2 MBytes 93.9 Mbits/sec +[ 5] 6.00-7.00 sec 12.3 MBytes 103 Mbits/sec +[ 5] 7.00-8.00 sec 12.3 MBytes 103 Mbits/sec +[ 5] 8.00-9.00 sec 12.5 MBytes 105 Mbits/sec +[ 5] 9.00-10.00 sec 12.3 MBytes 103 Mbits/sec +- - - - - - - - - - - - - - - - - - - - - - - - - +[ ID] Interval Transfer Bitrate Retr +[ 5] 0.00-10.22 sec 127 MBytes 104 Mbits/sec 0 sender +[ 5] 0.00-10.00 sec 125 MBytes 105 Mbits/sec receiver + +clock: 100000000 Hz +actual clock: 100000000 Hz +vdd: 21 (3.3 ~ 3.4 V) +bus mode: 2 (push-pull) +chip select: 0 (don't care) +power mode: 2 (on) +bus width: 2 (4 bits) +timing spec: 6 (sd uhs SDR104) +signal voltage: 1 (1.80 V) +driver type: 0 (driver type B) + +Signed-off-by: Christian Hewitt +--- + arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 6 +++++- + arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +@@ -256,7 +256,11 @@ &sd_emmc_a { + + bus-width = <4>; + cap-sd-highspeed; +- max-frequency = <50000000>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ max-frequency = <100000000>; + + non-removable; + disable-wp; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +@@ -121,7 +121,11 @@ &sd_emmc_a { + + bus-width = <4>; + cap-sd-highspeed; +- max-frequency = <50000000>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; ++ max-frequency = <100000000>; + + non-removable; + disable-wp; +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-gxm-vdec-add-VP9-support-to-GXM.patch b/patch/kernel/archive/meson64-6.10/meson-gxm-vdec-add-VP9-support-to-GXM.patch new file mode 100644 index 000000000000..ec42754188b8 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-gxm-vdec-add-VP9-support-to-GXM.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Hewitt +Date: Thu, 25 Nov 2021 11:31:43 +0000 +Subject: drivers: meson: vdec: add VP9 support to GXM + +VP9 support for GXM appears to have been missed from the original +codec submission [0] but it works well, so let's add support. + +[0] https://github.com/torvalds/linux/commit/00c43088aa680989407b6afbda295f67b3f123f1 + +Signed-off-by: Christian Hewitt +--- + drivers/staging/media/meson/vdec/vdec_platform.c | 14 +++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/meson/vdec/vdec_platform.c ++++ b/drivers/staging/media/meson/vdec/vdec_platform.c +@@ -27,7 +27,19 @@ static const struct amvdec_format vdec_formats_gxbb[] = { + .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, + .flags = V4L2_FMT_FLAG_COMPRESSED | + V4L2_FMT_FLAG_DYN_RESOLUTION, +- }, { ++ }, { ++ .pixfmt = V4L2_PIX_FMT_VP9, ++ .min_buffers = 16, ++ .max_buffers = 24, ++ .max_width = 3840, ++ .max_height = 2160, ++ .vdec_ops = &vdec_hevc_ops, ++ .codec_ops = &codec_vp9_ops, ++ .firmware_path = "meson/vdec/gxl_vp9.bin", ++ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 }, ++ .flags = V4L2_FMT_FLAG_COMPRESSED | ++ V4L2_FMT_FLAG_DYN_RESOLUTION, ++ }, { + .pixfmt = V4L2_PIX_FMT_H264, + .min_buffers = 2, + .max_buffers = 24, +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/meson-sm1-dts-add-higher-clocks.patch b/patch/kernel/archive/meson64-6.10/meson-sm1-dts-add-higher-clocks.patch new file mode 100644 index 000000000000..fd5af09cfa28 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/meson-sm1-dts-add-higher-clocks.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Tue, 4 Aug 2020 22:51:56 +0200 +Subject: Add higher clocks for SM1 family + +Signed-off-by: Igor Pecovnik +--- + arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +@@ -136,6 +136,16 @@ opp-1908000000 { + opp-hz = /bits/ 64 <1908000000>; + opp-microvolt = <950000>; + }; ++ ++ opp-2016000000 { ++ opp-hz = /bits/ 64 <2016000000>; ++ opp-microvolt = <1000000>; ++ }; ++ ++ opp-2100000000 { ++ opp-hz = /bits/ 64 <2100000000>; ++ opp-microvolt = <1022000>; ++ }; + }; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/meson64-6.10/overlay/Makefile b/patch/kernel/archive/meson64-6.10/overlay/Makefile new file mode 100644 index 000000000000..bbd0103cf53a --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/Makefile @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_MESON) += \ + meson-i2cA.dtbo \ + meson-i2cB.dtbo \ + meson-uartA.dtbo \ + meson-uartC.dtbo \ + meson-w1-gpio.dtbo \ + meson-w1AB-gpio.dtbo \ + meson-g12-gxl-cma-pool-896MB.dtbo \ + meson-g12-pwm-gpiox-5-fan.dtbo \ + meson-g12a-radxa-zero-gpio-8-led.dtbo \ + meson-g12a-radxa-zero-gpio-10-led.dtbo \ + meson-g12a-radxa-zero-i2c-ao-m0-gpioao-2-gpioao-3.dtbo \ + meson-g12a-radxa-zero-i2c-ee-m1-gpioh-6-gpioh-7.dtbo \ + meson-g12a-radxa-zero-i2c-ee-m1-gpiox-10-gpiox-11.dtbo \ + meson-g12a-radxa-zero-i2c-ee-m3-gpioa-14-gpioa-15.dtbo \ + meson-g12a-radxa-zero-pwm-c-on-gpiox-8.dtbo \ + meson-g12a-radxa-zero-pwmao-a-on-gpioao-11.dtbo \ + meson-g12a-radxa-zero-spi-spidev.dtbo \ + meson-g12a-radxa-zero-uart-ao-a-on-gpioao-0-gpioao-1.dtbo \ + meson-g12a-radxa-zero-uart-ao-b-on-gpioao-2-gpioao-3.dtbo \ + meson-g12a-radxa-zero-uart-ao-b-on-gpioao-8-gpioao-9.dtbo \ + meson-g12a-radxa-zero-uart-ee-c.dtbo \ + meson-g12b-bananapi-cm4-pwm-gpioh-5-fan.dtbo \ + meson-g12b-bananapi-m2s-rtl8822cs.dtbo \ + meson-g12b-odroid-n2-spi.dtbo \ + meson-g12b-waveshare-cm4-io-base-usb.dtbo \ + meson-sm1-bananapi-m5-rtl8822cs.dtbo \ + meson-sm1-bananapi-uartA.dtbo \ + meson-sm1-bananapi-uartA_cts_rts.dtbo \ + meson-sm1-bananapi-uartAO_B.dtbo \ + meson-sm1-jethome-jethub-j200-spi.dtbo + +scr-$(CONFIG_ARCH_MESON) += \ + meson-fixup.scr + +dtbotxt-$(CONFIG_ARCH_MESON) += \ + README.meson-overlays + +dtb-y += $(dtbo-y) $(scr-y) $(dtbotxt-y) + +clean-files := *.dtbo *.scr diff --git a/patch/kernel/archive/meson64-6.10/overlay/README.meson-overlays b/patch/kernel/archive/meson64-6.10/overlay/README.meson-overlays new file mode 100644 index 000000000000..1b169a7a1525 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/README.meson-overlays @@ -0,0 +1,20 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ + +### Platform: + +meson (Amlogic) + +### Provided overlays: + +- i2c8 + +### Overlay details: + +### i2c8 + +Activates TWI/I2C bus 8 + +I2C8 pins (SCL, SDA): GPIO1-C4, GPIO1-C5 + diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-fixup.scr-cmd b/patch/kernel/archive/meson64-6.10/overlay/meson-fixup.scr-cmd new file mode 100644 index 000000000000..d4c39e20a3a2 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-fixup.scr-cmd @@ -0,0 +1,4 @@ +# overlays fixup script +# implements (or rather substitutes) overlay arguments functionality +# using u-boot scripting, environment variables and "fdt" command + diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12-gxl-cma-pool-896MB.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12-gxl-cma-pool-896MB.dtso new file mode 100644 index 000000000000..f8c476b04e8c --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12-gxl-cma-pool-896MB.dtso @@ -0,0 +1,19 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "amlogic,g12a", "amlogic,g12b", "amlogic,meson-gxl"; + + fragment@0 { + target-path = "/reserved-memory"; + __overlay__ { + linux,cma { + compatible = "shared-dma-pool"; + reusable; + size = <0x0 0x38000000>; + alignment = <0x0 0x400000>; + linux,cma-default; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12-pwm-gpiox-5-fan.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12-pwm-gpiox-5-fan.dtso new file mode 100644 index 000000000000..2042c7fed521 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12-pwm-gpiox-5-fan.dtso @@ -0,0 +1,43 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + compatible = "amlogic,a311d", "amlogic,g12a", "amlogic,g12b", "amlogic,sm1"; + + fragment@0 { + target-path = "/"; + __overlay__ { + fan: gpio-fan { + compatible = "gpio-fan"; + gpios = <&gpio GPIOX_5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <0 0>, <5000 1>; + #cooling-cells = <2>; + }; + }; + }; + + fragment@1 { + target = <&cpu_thermal>; + polling-delay = <2000>; + __overlay__ { + trips { + cpu_active: cpu-active { + temperature = <55000>; + hysteresis = <10000>; + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-10-led.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-10-led.dtso new file mode 100644 index 000000000000..d76430328955 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-10-led.dtso @@ -0,0 +1,26 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target-path = "/"; + __overlay__ { + + leds { + compatible = "gpio-leds"; + + led-green { + label = "radxa-zero:green"; + gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-8-led.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-8-led.dtso new file mode 100644 index 000000000000..9b294e97f79f --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-gpio-8-led.dtso @@ -0,0 +1,26 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target-path = "/"; + __overlay__ { + + leds { + compatible = "gpio-leds"; + + led-green { + label = "radxa-zero:green"; + gpios = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ao-m0-gpioao-2-gpioao-3.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ao-m0-gpioao-2-gpioao-3.dtso new file mode 100644 index 000000000000..3f241cb60179 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ao-m0-gpioao-2-gpioao-3.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&i2c_AO>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&i2c_ao_sck_pins &i2c_ao_sda_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpioh-6-gpioh-7.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpioh-6-gpioh-7.dtso new file mode 100644 index 000000000000..a68284bf61b8 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpioh-6-gpioh-7.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&i2c1>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&i2c1_sda_h6_pins &i2c1_sck_h7_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpiox-10-gpiox-11.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpiox-10-gpiox-11.dtso new file mode 100644 index 000000000000..eb9c402fb633 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m1-gpiox-10-gpiox-11.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&i2c1>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&i2c1_sda_x_pins &i2c1_sck_x_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m3-gpioa-14-gpioa-15.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m3-gpioa-14-gpioa-15.dtso new file mode 100644 index 000000000000..12a7bc4d460b --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-i2c-ee-m3-gpioa-14-gpioa-15.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&i2c3>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&i2c3_sck_a_pins &i2c3_sda_a_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwm-c-on-gpiox-8.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwm-c-on-gpiox-8.dtso new file mode 100644 index 000000000000..14ca6c1964f8 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwm-c-on-gpiox-8.dtso @@ -0,0 +1,17 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&pwm_cd>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm_c_x8_pins>; + pinctrl-names = "default"; + clocks = <&xtal>; + clock-names = "clkin2"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwmao-a-on-gpioao-11.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwmao-a-on-gpioao-11.dtso new file mode 100644 index 000000000000..6edbe62224cc --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-pwmao-a-on-gpioao-11.dtso @@ -0,0 +1,17 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&pwm_AO_ab>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm_ao_a_pins>; + pinctrl-names = "default"; + clocks = <&xtal>; + clock-names = "clkin3"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-spi-spidev.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-spi-spidev.dtso new file mode 100644 index 000000000000..3d49a512eafa --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-spi-spidev.dtso @@ -0,0 +1,38 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&spicc0>; + __overlay__ { + pinctrl-0 = <&spicc0_x_pins &spicc0_ss0_x_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "disabled"; + reg = <0>; + spi-max-frequency = <10000000>; + }; + }; + }; + + fragment@1 { + target = <&spicc1>; + __overlay__ { + pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + spidev@0 { + compatible = "armbian,spi-dev"; + status = "disabled"; + reg = <0>; + spi-max-frequency = <10000000>; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-a-on-gpioao-0-gpioao-1.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-a-on-gpioao-0-gpioao-1.dtso new file mode 100644 index 000000000000..350448d20d88 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-a-on-gpioao-0-gpioao-1.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&uart_AO>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart_ao_a_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-2-gpioao-3.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-2-gpioao-3.dtso new file mode 100644 index 000000000000..26790de42535 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-2-gpioao-3.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&uart_AO_B>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart_ao_b_2_3_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-8-gpioao-9.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-8-gpioao-9.dtso new file mode 100644 index 000000000000..ff3e522854b0 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ao-b-on-gpioao-8-gpioao-9.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&uart_AO_B>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart_ao_b_8_9_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ee-c.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ee-c.dtso new file mode 100644 index 000000000000..afcf79eeab21 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12a-radxa-zero-uart-ee-c.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "radxa,zero", "amlogic,g12a"; + + fragment@0 { + target = <&uart_C>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart_c_pins &uart_c_cts_rts_pins>; + pinctrl-names = "default"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-cm4-pwm-gpioh-5-fan.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-cm4-pwm-gpioh-5-fan.dtso new file mode 100644 index 000000000000..db8d326c8ab8 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-cm4-pwm-gpioh-5-fan.dtso @@ -0,0 +1,63 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + compatible = "bananapi,bpi-cm4io", "bananapi,bpi-cm4", "amlogic,a311d", "amlogic,g12b"; + + fragment@0 { + target-path = "/"; + __overlay__ { + fan: gpio-fan { + compatible = "gpio-fan"; + gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = <0 0>, <5000 1>; + #cooling-cells = <2>; + }; + }; + }; + + fragment@1 { + target = <&cpu_thermal>; + polling-delay = <2000>; + __overlay__ { + trips { + cpu_active: cpu-active { + temperature = <55000>; + hysteresis = <10000>; + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + + fragment@2 { + target = <&ddr_thermal>; + __overlay__ { + trips { + ddr_active: ddr-active { + temperature = <55000>; + hysteresis = <10000>; + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-m2s-rtl8822cs.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-m2s-rtl8822cs.dtso new file mode 100644 index 000000000000..f037f8ec4ad8 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-bananapi-m2s-rtl8822cs.dtso @@ -0,0 +1,22 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-m2s", "amlogic,a311d", "amlogic,g12b"; + + /* RTL8822CS SDIO WIFI */ + fragment@0 { + target = <&sd_emmc_a>; + __overlay__ { + status = "okay"; + }; + }; + + /* RTL8822CS BLUETOOTH */ + fragment@1 { + target = <&uart_A>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-odroid-n2-spi.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-odroid-n2-spi.dtso new file mode 100644 index 000000000000..658afb1fb58d --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-odroid-n2-spi.dtso @@ -0,0 +1,23 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + fragment@0 { + target = <&sd_emmc_c>; + __overlay__ { + pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>; + bus-width = <4>; + }; + }; + + fragment@1 { + target = <&spifc>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-waveshare-cm4-io-base-usb.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-waveshare-cm4-io-base-usb.dtso new file mode 100644 index 000000000000..0516113267d3 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-g12b-waveshare-cm4-io-base-usb.dtso @@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-cm4io", "bananapi,bpi-cm4", "amlogic,a311d", "amlogic,g12b"; + + fragment@0 { + target-path = "/"; + __overlay__ { + model = "Waveshare CM4-IO Baseboard with BPI-CM4 Module"; + }; + }; + + fragment@1 { + target = <&usb>; + __overlay__ { + dr_mode = "host"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-i2cA.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-i2cA.dtso new file mode 100644 index 000000000000..bfb72feb7e36 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-i2cA.dtso @@ -0,0 +1,17 @@ +/dts-v1/; + +/ { + compatible = "amlogic,meson-gxbb"; + fragment@0 { + target-path = "/aliases"; + __overlay__ { + i2cA = "/soc/bus@c1100000/i2c@8500"; + }; + }; + fragment@1 { + target-path = "/soc/bus@c1100000/i2c@8500"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-i2cB.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-i2cB.dtso new file mode 100644 index 000000000000..d75867bce99b --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-i2cB.dtso @@ -0,0 +1,17 @@ +/dts-v1/; + +/ { + compatible = "amlogic,meson-gxbb"; + fragment@0 { + target-path = "/aliases"; + __overlay__ { + i2cA = "/soc/bus@c1100000/i2c@87c0"; + }; + }; + fragment@1 { + target-path = "/soc/bus@c1100000/i2c@87c0"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-m5-rtl8822cs.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-m5-rtl8822cs.dtso new file mode 100644 index 000000000000..44323e6dac03 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-m5-rtl8822cs.dtso @@ -0,0 +1,22 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-m5", "amlogic,sm1"; + + /* RTL8822CS SDIO WIFI */ + fragment@0 { + target = <&sd_emmc_a>; + __overlay__ { + status = "okay"; + }; + }; + + /* RTL8822CS BLUETOOTH */ + fragment@1 { + target = <&uart_A>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA.dtso new file mode 100644 index 000000000000..ea2f401786e6 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA.dtso @@ -0,0 +1,15 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-m5", "bananapi,bpi-m2-pro", "amlogic,sm1"; + + fragment@0 { + target = <&uart_A>; + + __overlay__ { + status = "okay"; + }; + }; +}; + diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartAO_B.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartAO_B.dtso new file mode 100644 index 000000000000..efac8a5140b3 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartAO_B.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-m5", "bananapi,bpi-m2-pro", "amlogic,sm1"; + + fragment@0 { + target = <&uart_AO_B>; + + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA_cts_rts.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA_cts_rts.dtso new file mode 100644 index 000000000000..40276d8e5f8f --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-bananapi-uartA_cts_rts.dtso @@ -0,0 +1,17 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "bananapi,bpi-m5", "bananapi,bpi-m2-pro", "amlogic,sm1"; + + fragment@0 { + target = <&uart_A>; + + __overlay__ { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart_a_cts_rts_pins>; + }; + }; +}; + diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-jethome-jethub-j200-spi.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-jethome-jethub-j200-spi.dtso new file mode 100644 index 000000000000..eab65a1570db --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-sm1-jethome-jethub-j200-spi.dtso @@ -0,0 +1,19 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&sd_emmc_c>; + __overlay__ { + pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>; + bus-width = <4>; + }; + }; + + fragment@1 { + target = <&spifc>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-uartA.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-uartA.dtso new file mode 100644 index 000000000000..3aecd60aaf64 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-uartA.dtso @@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + compatible = "amlogic,meson-gxbb"; + fragment@0 { + target-path = "/soc/bus@c1100000/serial@84c0"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-uartC.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-uartC.dtso new file mode 100644 index 000000000000..2b40ee4c02d3 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-uartC.dtso @@ -0,0 +1,11 @@ +/dts-v1/; + +/ { + compatible = "amlogic,meson-gxbb"; + fragment@0 { + target-path = "/soc/bus@c1100000/serial@8700"; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-w1-gpio.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-w1-gpio.dtso new file mode 100644 index 000000000000..ac76a4f20ab7 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-w1-gpio.dtso @@ -0,0 +1,20 @@ +// Definitions for w1-gpio module (without external pullup) +/dts-v1/; +/plugin/; + +/ { + compatible = "amlogic,meson-gxbb"; + + fragment@0 { + target-path = "/"; + __overlay__ { + + w1: onewire@0 { + compatible = "w1-gpio"; + pinctrl-names = "default"; + gpios = <&gpio 91 6>; // GPIOY_16 + status = "okay"; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.10/overlay/meson-w1AB-gpio.dtso b/patch/kernel/archive/meson64-6.10/overlay/meson-w1AB-gpio.dtso new file mode 100644 index 000000000000..f6b0d7eff158 --- /dev/null +++ b/patch/kernel/archive/meson64-6.10/overlay/meson-w1AB-gpio.dtso @@ -0,0 +1,32 @@ +// Definitions for w1-gpio module (without external pullup) +/dts-v1/; +/plugin/; + +/ { + compatible = "amlogic,meson-gxbb"; + + fragment@0 { + target-path = "/"; + __overlay__ { + + w1a: onewire@0 { + compatible = "w1-gpio"; + pinctrl-names = "default"; + gpios = <&gpio 91 6>; // GPIOY_16 + status = "okay"; + }; + }; + }; + fragment@1 { + target-path = "/"; + __overlay__ { + + w1b: onewire@1 { + compatible = "w1-gpio"; + pinctrl-names = "default"; + gpios = <&gpio 90 6>; // GPIOY_15 + status = "okay"; + }; + }; + }; +}; diff --git a/patch/kernel/archive/meson64-6.6/dt/meson-axg-amper-gateway-am-gz80x.dts b/patch/kernel/archive/meson64-6.6/dt/meson-axg-amper-gateway-am-gz80x.dts new file mode 100644 index 000000000000..99b4cd095218 --- /dev/null +++ b/patch/kernel/archive/meson64-6.6/dt/meson-axg-amper-gateway-am-gz80x.dts @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2024 Patrick Yavitz + * + */ + +/dts-v1/; + +#include "meson-axg-jethome-jethub-j1xx.dtsi" +#include + +/ { + compatible = "amper,gateway-am-gz80x", "amlogic,a113x", "amlogic,meson-axg"; + model = "Amper Gateway AM-GZ80x"; + + aliases { + serial0 = &uart_AO; + serial1 = &uart_B; + serial2 = &uart_AO_B; + ethernet0 = ðmac; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led-blue { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + }; + + led-green { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "mmc1"; + }; + + led-red { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "usb-host"; + }; + }; + + /* 1024MB RAM */ + memory@0 { + device_type = "memory"; + reg = <0x0 0x0 0x0 0x40000000>; + }; +}; + +/delete-node/ &i2c1; + +/* wifi module */ +&sd_emmc_b { + non-removable; + + rtl8189ftv: wifi@1 { + reg = <1>; + }; +}; + +&uart_B { + status = "okay"; + pinctrl-0 = <&uart_b_z_pins>; + pinctrl-names = "default"; +}; + +/* UART Wireless module */ +&uart_AO_B { + status = "okay"; + pinctrl-0 = <&uart_ao_b_z_pins>; + pinctrl-names = "default"; + reset-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>; +}; + +&usb_pwr { + gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>; + enable-active-high; +}; diff --git a/patch/kernel/archive/mvebu-6.10/09-pci-link-retraining.patch.disabled b/patch/kernel/archive/mvebu-6.10/09-pci-link-retraining.patch.disabled new file mode 100644 index 000000000000..e04e8e17a6ba --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/09-pci-link-retraining.patch.disabled @@ -0,0 +1,219 @@ +Subject: [PATCH v3] PCI: Disallow retraining link for Atheros chips on non-Gen1 PCIe bridges +Atheros AR9xxx and QCA9xxx chips have behaviour issues not only after a +bus reset, but also after doing retrain link, if PCIe bridge is not in +GEN1 mode (at 2.5 GT/s speed): + +- QCA9880 and QCA9890 chips throw a Link Down event and completely + disappear from the bus and their config space is not accessible + afterwards. + +- QCA9377 chip throws a Link Down event followed by Link Up event, the + config space is accessible and PCI device ID is correct. But trying to + access chip's I/O space causes Uncorrected (Non-Fatal) AER error, + followed by Synchronous external abort 96000210 and Segmentation fault + of insmod while loading ath10k_pci.ko module. + +- AR9390 chip throws a Link Down event followed by Link Up event, config + space is accessible, but contains nonsense values. PCI device ID is + 0xABCD which indicates HW bug that chip itself was not able to read + values from internal EEPROM/OTP. + +- AR9287 chip throws also Link Down and Link Up events, also has + accessible config space containing correct values. But ath9k driver + fails to initialize card from this state as it is unable to access HW + registers. This also indicates that the chip iself is not able to read + values from internal EEPROM/OTP. + +These issues related to PCI device ID 0xABCD and to reading internal +EEPROM/OTP were previously discussed at ath9k-devel mailing list in +following thread: + + https://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg07529.html + +After experiments we've come up with a solution: it seems that Retrain +link can be called only when using GEN1 PCIe bridge or when PCIe bridge +link speed is forced to 2.5 GT/s. Applying this workaround fixes all +mentioned cards. + +This issue was reproduced with more cards: +- Compex WLE900VX (QCA9880 based / device ID 0x003c) +- QCNFA435 (QCA9377 based / device ID 0x0042) +- Compex WLE200NX (AR9287 based / device ID 0x002e) +- "noname" card (QCA9890 based / device ID 0x003c) +- Wistron NKR-DNXAH1 (AR9390 based / device ID 0x0030) +on Armada 385 with pci-mvebu.c driver and also on Armada 3720 with +pci-aardvark.c driver. + +To workaround this issue, this change introduces a new PCI quirk called +PCI_DEV_FLAGS_NO_RETRAIN_LINK_WHEN_NOT_GEN1, which is enabled for all +Atheros chips with PCI_DEV_FLAGS_NO_BUS_RESET quirk, and also for Atheros +chip AR9287. + +When this quirk is set, kernel disallows triggering PCI_EXP_LNKCTL_RL +bit in config space of PCIe Bridge in the case when PCIe Bridge is +capable of higher speed than 2.5 GT/s and this higher speed is already +allowed. When PCIe Bridge has accessible LNKCTL2 register, we try to +force target link speed to 2.5 GT/s. After this change it is possible +to trigger PCI_EXP_LNKCTL_RL bit without issues. + +Currently only PCIe ASPM kernel code triggers this PCI_EXP_LNKCTL_RL bit, +so quirk check is added only into pcie/aspm.c file. + +Signed-off-by: Pali Rohár +Reported-by: Toke Høiland-Jørgensen +Tested-by: Toke Høiland-Jørgensen +Tested-by: Marek Behún +BugLink: https://lore.kernel.org/linux-pci/87h7l8axqp.fsf@toke.dk/ +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=84821 +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=192441 +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209833 +Cc: stable@vger.kernel.org # c80851f6ce63a ("PCI: Add PCI_EXP_LNKCTL2_TLS* macros") + +--- +Changes since v1: +* Move whole quirk code into pcie_downgrade_link_to_gen1() function +* Reformat to 80 chars per line where possible +* Add quirk also for cards with AR9287 chip (PCI ID 0x002e) +* Extend commit message description and add information about 0xABCD + +Changes since v2: +* Add quirk also for Atheros QCA9377 chip +--- + drivers/pci/pcie/aspm.c | 44 +++++++++++++++++++++++++++++++++++++++++ + drivers/pci/quirks.c | 39 ++++++++++++++++++++++++++++-------- + include/linux/pci.h | 2 ++ + 3 files changed, 77 insertions(+), 8 deletions(-) + +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c +index ac0557a305af..729b0389562b 100644 +--- a/drivers/pci/pcie/aspm.c ++++ b/drivers/pci/pcie/aspm.c +@@ -192,12 +192,56 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist) + link->clkpm_disable = blacklist ? 1 : 0; + } + ++static int pcie_downgrade_link_to_gen1(struct pci_dev *parent) ++{ ++ u16 reg16; ++ u32 reg32; ++ int ret; ++ ++ /* Check if link is capable of higher speed than 2.5 GT/s */ ++ pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, ®32); ++ if ((reg32 & PCI_EXP_LNKCAP_SLS) <= PCI_EXP_LNKCAP_SLS_2_5GB) ++ return 0; ++ ++ /* Check if link speed can be downgraded to 2.5 GT/s */ ++ pcie_capability_read_dword(parent, PCI_EXP_LNKCAP2, ®32); ++ if (!(reg32 & PCI_EXP_LNKCAP2_SLS_2_5GB)) { ++ pci_err(parent, "ASPM: Bridge does not support changing Link Speed to 2.5 GT/s\n"); ++ return -EOPNOTSUPP; ++ } ++ ++ /* Force link speed to 2.5 GT/s */ ++ ret = pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL2, ++ PCI_EXP_LNKCTL2_TLS, ++ PCI_EXP_LNKCTL2_TLS_2_5GT); ++ if (!ret) { ++ /* Verify that new value was really set */ ++ pcie_capability_read_word(parent, PCI_EXP_LNKCTL2, ®16); ++ if ((reg16 & PCI_EXP_LNKCTL2_TLS) != PCI_EXP_LNKCTL2_TLS_2_5GT) ++ ret = -EINVAL; ++ } ++ ++ if (ret) { ++ pci_err(parent, "ASPM: Changing Target Link Speed to 2.5 GT/s failed: %d\n", ret); ++ return ret; ++ } ++ ++ pci_info(parent, "ASPM: Target Link Speed changed to 2.5 GT/s due to quirk\n"); ++ return 0; ++} ++ + static int pcie_retrain_link(struct pcie_link_state *link) + { + struct pci_dev *parent = link->pdev; + int rc; + u16 reg16; + ++ if ((link->downstream->dev_flags & PCI_DEV_FLAGS_NO_RETRAIN_LINK_WHEN_NOT_GEN1) && ++ pcie_downgrade_link_to_gen1(parent)) { ++ pci_err(parent, "ASPM: Retrain Link at higher speed is disallowed by quirk\n"); ++ return false; ++ } ++ + /* + * Ensure the updated LNKCTL parameters are used during link + * training by checking that there is no ongoing link training to +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 5d2acebc3..91d675e0d 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -3572,19 +3572,46 @@ static void quirk_nvidia_no_bus_reset(struct pci_dev *dev) + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, + quirk_nvidia_no_bus_reset); + ++ ++static void quirk_no_bus_reset_and_no_retrain_link(struct pci_dev *dev) ++{ ++ dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET | ++ PCI_DEV_FLAGS_NO_RETRAIN_LINK_WHEN_NOT_GEN1; ++} ++ + /* + * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset. ++ * Atheros AR9xxx and QCA9xxx chips do not behave after a bus reset and also ++ * after retrain link when PCIe bridge is not in GEN1 mode at 2.5 GT/s speed. + * The device will throw a Link Down error on AER-capable systems and + * regardless of AER, config space of the device is never accessible again + * and typically causes the system to hang or reset when access is attempted. ++ * Or if config space is accessible again then it contains only dummy values ++ * like fixed PCI device ID 0xABCD or values not initialized at all. ++ * Retrain link can be called only when using GEN1 PCIe bridge or when ++ * PCIe bridge has forced link speed to 2.5 GT/s via PCI_EXP_LNKCTL2 register. ++ * To reset these cards it is required to do PCIe Warm Reset via PERST# pin. + * https://lore.kernel.org/r/20140923210318.498dacbd@dualc.maya.org/ ++ * https://lore.kernel.org/r/87h7l8axqp.fsf@toke.dk/ ++ * https://www.mail-archive.com/ath9k-devel@lists.ath9k.org/msg07529.html + */ +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset); +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset); +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset); +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset); +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003e, quirk_no_bus_reset); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x002e, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003e, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, ++ quirk_no_bus_reset_and_no_retrain_link); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0042, ++ quirk_no_bus_reset_and_no_retrain_link); ++ + + /* + * Root port on some Cavium CN8xxx chips do not successfully complete a bus +diff --git a/include/linux/pci.h b/include/linux/pci.h +index 86c799c97b77..fdbf7254e4ab 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -227,6 +227,8 @@ enum pci_dev_flags { + PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11), + /* Device does honor MSI masking despite saying otherwise */ + PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12), ++ /* Don't Retrain Link for device when bridge is not in GEN1 mode */ ++ PCI_DEV_FLAGS_NO_RETRAIN_LINK_WHEN_NOT_GEN1 = (__force pci_dev_flags_t) (1 << 12), + }; + + enum pci_irq_reroute_variant { +-- +2.20.1 diff --git a/patch/kernel/archive/mvebu-6.10/91-01-libata-add-ledtrig-support.patch.disabled b/patch/kernel/archive/mvebu-6.10/91-01-libata-add-ledtrig-support.patch.disabled new file mode 100644 index 000000000000..983ccb75076a --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/91-01-libata-add-ledtrig-support.patch.disabled @@ -0,0 +1,136 @@ +Index: 6.1__mvebu__armhf/drivers/ata/Kconfig +=================================================================== +--- 6.1__mvebu__armhf.orig/drivers/ata/Kconfig ++++ 6.1__mvebu__armhf/drivers/ata/Kconfig +@@ -67,6 +67,22 @@ config ATA_FORCE + + If unsure, say Y. + ++config ARCH_WANT_LIBATA_LEDS ++ bool ++ ++config ATA_LEDS ++ bool "support ATA port LED triggers" ++ depends on ARCH_WANT_LIBATA_LEDS ++ select NEW_LEDS ++ select LEDS_CLASS ++ select LEDS_TRIGGERS ++ default y ++ help ++ This option adds a LED trigger for each registered ATA port. ++ It is used to drive disk activity leds connected via GPIO. ++ ++ If unsure, say N. ++ + config ATA_ACPI + bool "ATA ACPI Support" + depends on ACPI +Index: 6.1__mvebu__armhf/drivers/ata/libata-core.c +=================================================================== +--- 6.1__mvebu__armhf.orig/drivers/ata/libata-core.c ++++ 6.1__mvebu__armhf/drivers/ata/libata-core.c +@@ -663,6 +663,19 @@ u64 ata_tf_read_block(const struct ata_t + return block; + } + ++#ifdef CONFIG_ATA_LEDS ++#define LIBATA_BLINK_DELAY 20 /* ms */ ++static inline void ata_led_act(struct ata_port *ap) ++{ ++ unsigned long led_delay = LIBATA_BLINK_DELAY; ++ ++ if (unlikely(!ap->ledtrig)) ++ return; ++ ++ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); ++} ++#endif ++ + /** + * ata_build_rw_tf - Build ATA taskfile for given read/write request + * @qc: Metadata associated with the taskfile to build +@@ -4813,6 +4826,10 @@ void ata_qc_issue(struct ata_queued_cmd + struct ata_link *link = qc->dev->link; + u8 prot = qc->tf.protocol; + ++#ifdef CONFIG_ATA_LEDS ++ ata_led_act(ap); ++#endif ++ + /* Make sure only one non-NCQ command is outstanding. */ + WARN_ON_ONCE(ata_tag_valid(link->active_tag)); + +@@ -5328,6 +5345,9 @@ struct ata_port *ata_port_alloc(struct a + ap->stats.unhandled_irq = 1; + ap->stats.idle_irq = 1; + #endif ++#ifdef CONFIG_ATA_LEDS ++ ap->ledtrig = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); ++#endif + ata_sff_port_init(ap); + + return ap; +@@ -5363,6 +5383,12 @@ static void ata_host_release(struct kref + + kfree(ap->slave_link); + kfree(ap->ncq_sense_buf); ++#ifdef CONFIG_ATA_LEDS ++ if (ap->ledtrig) { ++ led_trigger_unregister(ap->ledtrig); ++ kfree(ap->ledtrig); ++ }; ++#endif + kfree(ap); + host->ports[i] = NULL; + } +@@ -5765,7 +5791,23 @@ int ata_host_register(struct ata_host *h + host->ports[i]->print_id = atomic_inc_return(&ata_print_id); + host->ports[i]->local_port_no = i + 1; + } ++#ifdef CONFIG_ATA_LEDS ++ for (i = 0; i < host->n_ports; i++) { ++ if (unlikely(!host->ports[i]->ledtrig)) ++ continue; + ++ snprintf(host->ports[i]->ledtrig_name, ++ sizeof(host->ports[i]->ledtrig_name), "ata%u", ++ host->ports[i]->print_id); ++ ++ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; ++ ++ if (led_trigger_register(host->ports[i]->ledtrig)) { ++ kfree(host->ports[i]->ledtrig); ++ host->ports[i]->ledtrig = NULL; ++ } ++ } ++#endif + /* Create associated sysfs transport objects */ + for (i = 0; i < host->n_ports; i++) { + rc = ata_tport_add(host->dev,host->ports[i]); +Index: 6.1__mvebu__armhf/include/linux/libata.h +=================================================================== +--- 6.1__mvebu__armhf.orig/include/linux/libata.h ++++ 6.1__mvebu__armhf/include/linux/libata.h +@@ -23,6 +23,9 @@ + #include + #include + #include ++#ifdef CONFIG_ATA_LEDS ++#include ++#endif + + /* + * Define if arch has non-standard setup. This is a _PCI_ standard +@@ -857,6 +860,12 @@ struct ata_port { + #ifdef CONFIG_ATA_ACPI + struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ + #endif ++ ++#ifdef CONFIG_ATA_LEDS ++ struct led_trigger *ledtrig; ++ char ledtrig_name[8]; ++#endif ++ + /* owned by EH */ + u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; + }; diff --git a/patch/kernel/archive/mvebu-6.10/91-02-Enable-ATA-port-LED-trigger.patch.disabled b/patch/kernel/archive/mvebu-6.10/91-02-Enable-ATA-port-LED-trigger.patch.disabled new file mode 100644 index 000000000000..10680f98cb84 --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/91-02-Enable-ATA-port-LED-trigger.patch.disabled @@ -0,0 +1,30 @@ +From 9ee6345ef82f7af5f98e17a40e667f8ad6b2fa1b Mon Sep 17 00:00:00 2001 +From: aprayoga +Date: Sun, 3 Sep 2017 18:10:12 +0800 +Subject: Enable ATA port LED trigger + +--- + arch/arm/configs/mvebu_v7_defconfig | 1 + + arch/arm/mach-mvebu/Kconfig | 1 + + 2 files changed, 2 insertions(+) + +--- a/arch/arm/configs/mvebu_v7_defconfig ++++ b/arch/arm/configs/mvebu_v7_defconfig +@@ -58,6 +58,7 @@ CONFIG_MTD_UBI=y + CONFIG_EEPROM_AT24=y + CONFIG_BLK_DEV_SD=y + CONFIG_ATA=y ++CONFIG_ATA_LEDS=y + CONFIG_SATA_AHCI=y + CONFIG_AHCI_MVEBU=y + CONFIG_SATA_MV=y +--- a/arch/arm/mach-mvebu/Kconfig ++++ b/arch/arm/mach-mvebu/Kconfig +@@ -56,6 +56,7 @@ config MACH_ARMADA_375 + config MACH_ARMADA_38X + bool "Marvell Armada 380/385 boards" + depends on ARCH_MULTI_V7 ++ select ARCH_WANT_LIBATA_LEDS + select ARM_ERRATA_720789 + select PL310_ERRATA_753970 + select ARM_GIC diff --git a/patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-add_wake_on_gpio_support.patch b/patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-add_wake_on_gpio_support.patch new file mode 100644 index 000000000000..9274f2b1a1d7 --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-add_wake_on_gpio_support.patch @@ -0,0 +1,88 @@ +--- a/drivers/gpio/gpio-mvebu.c ++++ b/drivers/gpio/gpio-mvebu.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -111,7 +112,7 @@ struct mvebu_gpio_chip { + struct regmap *regs; + u32 offset; + struct regmap *percpu_regs; +- int irqbase; ++ int bank_irq[4]; + struct irq_domain *domain; + int soc_variant; + +@@ -601,6 +602,33 @@ static void mvebu_gpio_irq_handler(struc + } + + /* ++ * Set interrupt number "irq" in the GPIO as a wake-up source. ++ * While system is running, all registered GPIO interrupts need to have ++ * wake-up enabled. When system is suspended, only selected GPIO interrupts ++ * need to have wake-up enabled. ++ * @param irq interrupt source number ++ * @param enable enable as wake-up if equal to non-zero ++ * @return This function returns 0 on success. ++ */ ++static int mvebu_gpio_set_wake_irq(struct irq_data *d, unsigned int enable) ++{ ++ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); ++ struct mvebu_gpio_chip *mvchip = gc->private; ++ int irq; ++ int bank; ++ ++ bank = d->hwirq % 8; ++ irq = mvchip->bank_irq[bank]; ++ ++ if (enable) ++ enable_irq_wake(irq); ++ else ++ disable_irq_wake(irq); ++ ++ return 0; ++} ++ ++/* + * Functions implementing the pwm_chip methods + */ + static struct mvebu_pwm *to_mvebu_pwm(struct pwm_chip *chip) +@@ -1219,7 +1247,7 @@ static int mvebu_gpio_probe(struct platf + + err = irq_alloc_domain_generic_chips( + mvchip->domain, ngpios, 2, np->name, handle_level_irq, +- IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0); ++ IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, IRQ_GC_INIT_NESTED_LOCK); + if (err) { + dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n", + mvchip->chip.label); +@@ -1237,6 +1265,8 @@ static int mvebu_gpio_probe(struct platf + ct->chip.irq_mask = mvebu_gpio_level_irq_mask; + ct->chip.irq_unmask = mvebu_gpio_level_irq_unmask; + ct->chip.irq_set_type = mvebu_gpio_irq_set_type; ++ ct->chip.irq_set_wake = mvebu_gpio_set_wake_irq; ++ ct->chip.flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND; + ct->chip.name = mvchip->chip.label; + + ct = &gc->chip_types[1]; +@@ -1245,6 +1275,8 @@ static int mvebu_gpio_probe(struct platf + ct->chip.irq_mask = mvebu_gpio_edge_irq_mask; + ct->chip.irq_unmask = mvebu_gpio_edge_irq_unmask; + ct->chip.irq_set_type = mvebu_gpio_irq_set_type; ++ ct->chip.irq_set_wake = mvebu_gpio_set_wake_irq; ++ ct->chip.flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND; + ct->handler = handle_edge_irq; + ct->chip.name = mvchip->chip.label; + +@@ -1260,6 +1292,7 @@ static int mvebu_gpio_probe(struct platf + continue; + irq_set_chained_handler_and_data(irq, mvebu_gpio_irq_handler, + mvchip); ++ mvchip->bank_irq[i] = irq; + } + + return 0; diff --git a/patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-remove-hardcoded-timer-assignment.patch.disabled b/patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-remove-hardcoded-timer-assignment.patch.disabled new file mode 100644 index 000000000000..c0cb9d68f96b --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/92-mvebu-gpio-remove-hardcoded-timer-assignment.patch.disabled @@ -0,0 +1,411 @@ +Removes the hardcoded timer assignment of timers to pwm controllers. +This allows to use more than one pwm per gpio bank. + +Original patch with chip_data interface by Heisath + +Link: https://wiki.kobol.io/helios4/pwm/#patch-requirement +Co-developed-by: Yureka Lilian +Signed-off-by: Yureka Lilian +Signed-off-by: Finn Behrens +--- + drivers/gpio/gpio-mvebu.c | 223 ++++++++++++++++++++++++-------------- + 1 file changed, 139 insertions(+), 84 deletions(-) + +diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c +index a13f3c18ccd4..303ea3be0b69 100644 +--- a/drivers/gpio/gpio-mvebu.c ++++ b/drivers/gpio/gpio-mvebu.c +@@ -94,21 +94,43 @@ + + #define MVEBU_MAX_GPIO_PER_BANK 32 + +-struct mvebu_pwm { ++enum mvebu_pwm_ctrl { ++ MVEBU_PWM_CTRL_SET_A = 0, ++ MVEBU_PWM_CTRL_SET_B, ++ MVEBU_PWM_CTRL_MAX ++}; ++ ++struct mvebu_pwmchip { + struct regmap *regs; + u32 offset; + unsigned long clk_rate; +- struct gpio_desc *gpiod; +- struct pwm_chip chip; + spinlock_t lock; +- struct mvebu_gpio_chip *mvchip; ++ bool in_use; + + /* Used to preserve GPIO/PWM registers across suspend/resume */ +- u32 blink_select; + u32 blink_on_duration; + u32 blink_off_duration; + }; + ++struct mvebu_pwm_chip_drv { ++ enum mvebu_pwm_ctrl ctrl; ++ struct gpio_desc *gpiod; ++ bool master; ++}; ++ ++struct mvebu_pwm { ++ struct pwm_chip chip; ++ struct mvebu_gpio_chip *mvchip; ++ struct mvebu_pwmchip controller; ++ enum mvebu_pwm_ctrl default_controller; ++ ++ /* Used to preserve GPIO/PWM registers across suspend/resume */ ++ u32 blink_select; ++ struct mvebu_pwm_chip_drv drv[]; ++}; ++ ++static struct mvebu_pwmchip *mvebu_pwm_list[MVEBU_PWM_CTRL_MAX]; ++ + struct mvebu_gpio_chip { + struct gpio_chip chip; + struct regmap *regs; +@@ -285,12 +307,12 @@ mvebu_gpio_write_level_mask(struct mvebu_gpio_chip *mvchip, u32 val) + * Functions returning offsets of individual registers for a given + * PWM controller. + */ +-static unsigned int mvebu_pwmreg_blink_on_duration(struct mvebu_pwm *mvpwm) ++static unsigned int mvebu_pwmreg_blink_on_duration(struct mvebu_pwmchip *mvpwm) + { + return mvpwm->offset + PWM_BLINK_ON_DURATION_OFF; + } + +-static unsigned int mvebu_pwmreg_blink_off_duration(struct mvebu_pwm *mvpwm) ++static unsigned int mvebu_pwmreg_blink_off_duration(struct mvebu_pwmchip *mvpwm) + { + return mvpwm->offset + PWM_BLINK_OFF_DURATION_OFF; + } +@@ -623,39 +645,71 @@ static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) + struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); + struct mvebu_gpio_chip *mvchip = mvpwm->mvchip; + struct gpio_desc *desc; ++ enum mvebu_pwm_ctrl id; + unsigned long flags; + int ret = 0; ++ struct mvebu_pwm_chip_drv *drv = &mvpwm->drv[pwm->hwpwm]; + +- spin_lock_irqsave(&mvpwm->lock, flags); ++ spin_lock_irqsave(&mvpwm->controller.lock, flags); + +- if (mvpwm->gpiod) { ++ if (drv->gpiod || (mvchip->blink_en_reg & BIT(pwm->hwpwm))) { + ret = -EBUSY; +- } else { +- desc = gpiochip_request_own_desc(&mvchip->chip, +- pwm->hwpwm, "mvebu-pwm", +- GPIO_ACTIVE_HIGH, +- GPIOD_OUT_LOW); +- if (IS_ERR(desc)) { +- ret = PTR_ERR(desc); +- goto out; +- } ++ goto out; ++ } ++ ++ desc = gpiochip_request_own_desc(&mvchip->chip, ++ pwm->hwpwm, "mvebu-pwm", ++ GPIO_ACTIVE_HIGH, ++ GPIOD_OUT_LOW); ++ if (IS_ERR(desc)) { ++ ret = PTR_ERR(desc); ++ goto out; ++ } + +- mvpwm->gpiod = desc; ++ ret = gpiod_direction_output(desc, 0); ++ if (ret) { ++ gpiochip_free_own_desc(desc); ++ goto out; + } ++ ++ for (id = MVEBU_PWM_CTRL_SET_A; id < MVEBU_PWM_CTRL_MAX; id++) { ++ if (!mvebu_pwm_list[id]->in_use) { ++ drv->ctrl = id; ++ drv->master = true; ++ mvebu_pwm_list[id]->in_use = true; ++ break; ++ } ++ } ++ ++ if (!drv->master) ++ drv->ctrl = mvpwm->default_controller; ++ ++ regmap_update_bits(mvchip->regs, GPIO_BLINK_CNT_SELECT_OFF + mvchip->offset, ++ BIT(pwm->hwpwm), drv->ctrl ? BIT(pwm->hwpwm) : 0); ++ ++ drv->gpiod = desc; ++ ++ regmap_read(mvchip->regs, GPIO_BLINK_CNT_SELECT_OFF + mvchip->offset, ++ &mvpwm->blink_select); + out: +- spin_unlock_irqrestore(&mvpwm->lock, flags); ++ spin_unlock_irqrestore(&mvpwm->controller.lock, flags); + return ret; + } + + static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) + { + struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); ++ struct mvebu_pwm_chip_drv *drv = &mvpwm->drv[pwm->hwpwm]; + unsigned long flags; + +- spin_lock_irqsave(&mvpwm->lock, flags); +- gpiochip_free_own_desc(mvpwm->gpiod); +- mvpwm->gpiod = NULL; +- spin_unlock_irqrestore(&mvpwm->lock, flags); ++ spin_lock_irqsave(&mvpwm->controller.lock, flags); ++ if (drv->master) ++ mvebu_pwm_list[drv->ctrl]->in_use = false; ++ ++ gpiochip_free_own_desc(drv->gpiod); ++ memset(drv, 0, sizeof(struct mvebu_pwm_chip_drv)); ++ ++ spin_unlock_irqrestore(&mvpwm->controller.lock, flags); + } + + static int mvebu_pwm_get_state(struct pwm_chip *chip, +@@ -665,28 +719,35 @@ static int mvebu_pwm_get_state(struct pwm_chip *chip, + + struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); + struct mvebu_gpio_chip *mvchip = mvpwm->mvchip; ++ struct mvebu_pwm_chip_drv *drv = &mvpwm->drv[pwm->hwpwm]; ++ struct mvebu_pwmchip *controller; + unsigned long long val; + unsigned long flags; + u32 u; + +- spin_lock_irqsave(&mvpwm->lock, flags); ++ if (drv->gpiod) ++ controller = mvebu_pwm_list[drv->ctrl]; ++ else ++ controller = &mvpwm->controller; ++ ++ spin_lock_irqsave(&controller->lock, flags); + +- regmap_read(mvpwm->regs, mvebu_pwmreg_blink_on_duration(mvpwm), &u); ++ regmap_read(controller->regs, mvebu_pwmreg_blink_on_duration(controller), &u); + /* Hardware treats zero as 2^32. See mvebu_pwm_apply(). */ + if (u > 0) + val = u; + else + val = UINT_MAX + 1ULL; + state->duty_cycle = DIV_ROUND_UP_ULL(val * NSEC_PER_SEC, +- mvpwm->clk_rate); ++ controller->clk_rate); + +- regmap_read(mvpwm->regs, mvebu_pwmreg_blink_off_duration(mvpwm), &u); ++ regmap_read(controller->regs, mvebu_pwmreg_blink_off_duration(controller), &u); + /* period = on + off duration */ + if (u > 0) + val += u; + else + val += UINT_MAX + 1ULL; +- state->period = DIV_ROUND_UP_ULL(val * NSEC_PER_SEC, mvpwm->clk_rate); ++ state->period = DIV_ROUND_UP_ULL(val * NSEC_PER_SEC, controller->clk_rate); + + regmap_read(mvchip->regs, GPIO_BLINK_EN_OFF + mvchip->offset, &u); + if (u) +@@ -694,7 +755,7 @@ static int mvebu_pwm_get_state(struct pwm_chip *chip, + else + state->enabled = false; + +- spin_unlock_irqrestore(&mvpwm->lock, flags); ++ spin_unlock_irqrestore(&controller->lock, flags); + + return 0; + } +@@ -703,6 +764,8 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) + { + struct mvebu_pwm *mvpwm = to_mvebu_pwm(chip); ++ struct mvebu_pwm_chip_drv *drv = &mvpwm->drv[pwm->hwpwm]; ++ struct mvebu_pwmchip *controller; + struct mvebu_gpio_chip *mvchip = mvpwm->mvchip; + unsigned long long val; + unsigned long flags; +@@ -711,7 +774,11 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + +- val = (unsigned long long) mvpwm->clk_rate * state->duty_cycle; ++ if (drv->gpiod) ++ controller = mvebu_pwm_list[drv->ctrl]; ++ else ++ controller = &mvpwm->controller; ++ val = (unsigned long long) controller->clk_rate * state->duty_cycle; + do_div(val, NSEC_PER_SEC); + if (val > UINT_MAX + 1ULL) + return -EINVAL; +@@ -726,7 +793,7 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + else + on = 1; + +- val = (unsigned long long) mvpwm->clk_rate * state->period; ++ val = (unsigned long long) controller->clk_rate * state->period; + do_div(val, NSEC_PER_SEC); + val -= on; + if (val > UINT_MAX + 1ULL) +@@ -738,16 +805,16 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + else + off = 1; + +- spin_lock_irqsave(&mvpwm->lock, flags); ++ spin_lock_irqsave(&controller->lock, flags); + +- regmap_write(mvpwm->regs, mvebu_pwmreg_blink_on_duration(mvpwm), on); +- regmap_write(mvpwm->regs, mvebu_pwmreg_blink_off_duration(mvpwm), off); ++ regmap_write(controller->regs, mvebu_pwmreg_blink_on_duration(controller), on); ++ regmap_write(controller->regs, mvebu_pwmreg_blink_off_duration(controller), off); + if (state->enabled) + mvebu_gpio_blink(&mvchip->chip, pwm->hwpwm, 1); + else + mvebu_gpio_blink(&mvchip->chip, pwm->hwpwm, 0); + +- spin_unlock_irqrestore(&mvpwm->lock, flags); ++ spin_unlock_irqrestore(&controller->lock, flags); + + return 0; + } +@@ -762,25 +829,27 @@ static const struct pwm_ops mvebu_pwm_ops = { + static void __maybe_unused mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip) + { + struct mvebu_pwm *mvpwm = mvchip->mvpwm; ++ struct mvebu_pwmchip *controller = &mvpwm->controller; + + regmap_read(mvchip->regs, GPIO_BLINK_CNT_SELECT_OFF + mvchip->offset, + &mvpwm->blink_select); +- regmap_read(mvpwm->regs, mvebu_pwmreg_blink_on_duration(mvpwm), +- &mvpwm->blink_on_duration); +- regmap_read(mvpwm->regs, mvebu_pwmreg_blink_off_duration(mvpwm), +- &mvpwm->blink_off_duration); ++ regmap_read(controller->regs, mvebu_pwmreg_blink_on_duration(controller), ++ &controller->blink_on_duration); ++ regmap_read(controller->regs, mvebu_pwmreg_blink_off_duration(controller), ++ &controller->blink_off_duration); + } + + static void __maybe_unused mvebu_pwm_resume(struct mvebu_gpio_chip *mvchip) + { + struct mvebu_pwm *mvpwm = mvchip->mvpwm; ++ struct mvebu_pwmchip *controller = &mvpwm->controller; + + regmap_write(mvchip->regs, GPIO_BLINK_CNT_SELECT_OFF + mvchip->offset, + mvpwm->blink_select); +- regmap_write(mvpwm->regs, mvebu_pwmreg_blink_on_duration(mvpwm), +- mvpwm->blink_on_duration); +- regmap_write(mvpwm->regs, mvebu_pwmreg_blink_off_duration(mvpwm), +- mvpwm->blink_off_duration); ++ regmap_write(controller->regs, mvebu_pwmreg_blink_on_duration(controller), ++ controller->blink_on_duration); ++ regmap_write(controller->regs, mvebu_pwmreg_blink_off_duration(controller), ++ controller->blink_off_duration); + } + + static int mvebu_pwm_probe(struct platform_device *pdev, +@@ -792,6 +861,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev, + void __iomem *base; + u32 offset; + u32 set; ++ enum mvebu_pwm_ctrl ctrl_set; + + if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) { + int ret = of_property_read_u32(dev->of_node, +@@ -813,57 +883,39 @@ static int mvebu_pwm_probe(struct platform_device *pdev, + if (IS_ERR(mvchip->clk)) + return PTR_ERR(mvchip->clk); + +- mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL); ++ mvpwm = devm_kzalloc(dev, struct_size(mvpwm, drv, mvchip->chip.ngpio), GFP_KERNEL); + if (!mvpwm) + return -ENOMEM; + mvchip->mvpwm = mvpwm; + mvpwm->mvchip = mvchip; +- mvpwm->offset = offset; + +- if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) { +- mvpwm->regs = mvchip->regs; ++ base = devm_platform_ioremap_resource_byname(pdev, "pwm"); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ mvpwm->controller.regs = devm_regmap_init_mmio(&pdev->dev, base, ++ &mvebu_gpio_regmap_config); ++ if (IS_ERR(mvpwm->controller.regs)) ++ return PTR_ERR(mvpwm->controller.regs); + +- switch (mvchip->offset) { +- case AP80X_GPIO0_OFF_A8K: +- case CP11X_GPIO0_OFF_A8K: +- /* Blink counter A */ +- set = 0; +- break; +- case CP11X_GPIO1_OFF_A8K: +- /* Blink counter B */ +- set = U32_MAX; +- mvpwm->offset += PWM_BLINK_COUNTER_B_OFF; +- break; +- default: +- return -EINVAL; +- } ++ /* ++ * User set A for lines of GPIO chip with id 0, B for GPIO chip ++ * with id 1. Don't allow further GPIO chips to be used for PWM. ++ */ ++ if (id == 0) { ++ set = 0; ++ ctrl_set = MVEBU_PWM_CTRL_SET_A; ++ } else if (id == 1) { ++ set = U32_MAX; ++ ctrl_set = MVEBU_PWM_CTRL_SET_B; + } else { +- base = devm_platform_ioremap_resource_byname(pdev, "pwm"); +- if (IS_ERR(base)) +- return PTR_ERR(base); +- +- mvpwm->regs = devm_regmap_init_mmio(&pdev->dev, base, +- &mvebu_gpio_regmap_config); +- if (IS_ERR(mvpwm->regs)) +- return PTR_ERR(mvpwm->regs); +- +- /* +- * Use set A for lines of GPIO chip with id 0, B for GPIO chip +- * with id 1. Don't allow further GPIO chips to be used for PWM. +- */ +- if (id == 0) +- set = 0; +- else if (id == 1) +- set = U32_MAX; +- else +- return -EINVAL; ++ return -EINVAL; + } + + regmap_write(mvchip->regs, + GPIO_BLINK_CNT_SELECT_OFF + mvchip->offset, set); + +- mvpwm->clk_rate = clk_get_rate(mvchip->clk); +- if (!mvpwm->clk_rate) { ++ mvpwm->controller.clk_rate = clk_get_rate(mvchip->clk); ++ if (!mvpwm->controller.clk_rate) { + dev_err(dev, "failed to get clock rate\n"); + return -EINVAL; + } +@@ -872,7 +924,10 @@ static int mvebu_pwm_probe(struct platform_device *pdev, + mvpwm->chip.ops = &mvebu_pwm_ops; + mvpwm->chip.npwm = mvchip->chip.ngpio; + +- spin_lock_init(&mvpwm->lock); ++ spin_lock_init(&mvpwm->controller.lock); ++ ++ mvpwm->default_controller = ctrl_set; ++ mvebu_pwm_list[ctrl_set] = &mvpwm->controller; + + return devm_pwmchip_add(dev, &mvpwm->chip); + } +-- +2.43.0 + + diff --git a/patch/kernel/archive/mvebu-6.10/94-helios4-dts-add-wake-on-lan-support.patch b/patch/kernel/archive/mvebu-6.10/94-helios4-dts-add-wake-on-lan-support.patch new file mode 100644 index 000000000000..2b75913fda46 --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/94-helios4-dts-add-wake-on-lan-support.patch @@ -0,0 +1,21 @@ +--- a/arch/arm/boot/dts/marvell/armada-388-helios4.dts ++++ b/arch/arm/boot/dts/marvell/armada-388-helios4.dts +@@ -84,6 +84,18 @@ + }; + }; + ++ gpio-keys { ++ compatible = "gpio-keys"; ++ pinctrl-0 = <µsom_phy0_int_pins>; ++ ++ wol { ++ label = "Wake-On-LAN"; ++ linux,code = ; ++ gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; ++ wakeup-source; ++ }; ++ }; ++ + io-leds { + compatible = "gpio-leds"; + sata1-led { diff --git a/patch/kernel/archive/mvebu-6.10/compile-dtb-with-symbol-support.patch b/patch/kernel/archive/mvebu-6.10/compile-dtb-with-symbol-support.patch new file mode 100644 index 000000000000..a2bd279ae41a --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/compile-dtb-with-symbol-support.patch @@ -0,0 +1,12 @@ +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -277,6 +277,9 @@ quiet_cmd_gzip = GZIP $@ + DTC ?= $(objtree)/scripts/dtc/dtc + DTC_FLAGS += -Wno-interrupt_provider + ++# Enable overlay support ++DTC_FLAGS += -@ ++ + # Disable noisy checks by default + ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) + DTC_FLAGS += -Wno-unit_address_vs_reg \ diff --git a/patch/kernel/archive/mvebu-6.10/dts-disable-spi-flash-on-a388-microsom.patch b/patch/kernel/archive/mvebu-6.10/dts-disable-spi-flash-on-a388-microsom.patch new file mode 100644 index 000000000000..db5c77e0f006 --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/dts-disable-spi-flash-on-a388-microsom.patch @@ -0,0 +1,10 @@ +--- a/arch/arm/boot/dts/marvell/armada-38x-solidrun-microsom.dtsi ++++ b/arch/arm/boot/dts/marvell/armada-38x-solidrun-microsom.dtsi +@@ -107,6 +107,7 @@ + compatible = "w25q32", "jedec,spi-nor"; + reg = <0>; /* Chip select 0 */ + spi-max-frequency = <3000000>; ++ status = "disabled"; + }; + }; + diff --git a/patch/kernel/archive/mvebu-6.10/general-increasing_DMA_block_memory_allocation_to_2048.patch b/patch/kernel/archive/mvebu-6.10/general-increasing_DMA_block_memory_allocation_to_2048.patch new file mode 100644 index 000000000000..eef7296e75df --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/general-increasing_DMA_block_memory_allocation_to_2048.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/mm/dma-mapping.c ++++ b/arch/arm/mm/dma-mapping.c +@@ -315,7 +315,7 @@ static void *__alloc_remap_buffer(struct + pgprot_t prot, struct page **ret_page, + const void *caller, bool want_vaddr); + +-#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K ++#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_2M + static struct gen_pool *atomic_pool __ro_after_init; + + static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE; diff --git a/patch/kernel/archive/mvebu-6.10/unlock_atheros_regulatory_restrictions.patch b/patch/kernel/archive/mvebu-6.10/unlock_atheros_regulatory_restrictions.patch new file mode 100644 index 000000000000..7e57c379ad88 --- /dev/null +++ b/patch/kernel/archive/mvebu-6.10/unlock_atheros_regulatory_restrictions.patch @@ -0,0 +1,70 @@ +--- a/drivers/net/wireless/ath/regd.c ++++ b/drivers/net/wireless/ath/regd.c +@@ -50,12 +50,9 @@ static int __ath_regd_init(struct ath_re + #define ATH_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 80, 0, 30,\ + NL80211_RRF_NO_IR) + +-#define ATH_2GHZ_ALL ATH_2GHZ_CH01_11, \ +- ATH_2GHZ_CH12_13, \ +- ATH_2GHZ_CH14 ++#define ATH_2GHZ_ALL REG_RULE(2400, 2483, 40, 0, 30, 0) + +-#define ATH_5GHZ_ALL ATH_5GHZ_5150_5350, \ +- ATH_5GHZ_5470_5850 ++#define ATH_5GHZ_ALL REG_RULE(5140, 5860, 40, 0, 30, 0) + + /* This one skips what we call "mid band" */ + #define ATH_5GHZ_NO_MIDBAND ATH_5GHZ_5150_5350, \ +@@ -77,9 +74,8 @@ static const struct ieee80211_regdomain + .n_reg_rules = 4, + .alpha2 = "99", + .reg_rules = { +- ATH_2GHZ_CH01_11, +- ATH_2GHZ_CH12_13, +- ATH_5GHZ_NO_MIDBAND, ++ ATH_2GHZ_ALL, ++ ATH_5GHZ_ALL, + } + }; + +@@ -88,8 +84,8 @@ static const struct ieee80211_regdomain + .n_reg_rules = 3, + .alpha2 = "99", + .reg_rules = { +- ATH_2GHZ_CH01_11, +- ATH_5GHZ_NO_MIDBAND, ++ ATH_2GHZ_ALL, ++ ATH_5GHZ_ALL, + } + }; + +@@ -98,7 +94,7 @@ static const struct ieee80211_regdomain + .n_reg_rules = 3, + .alpha2 = "99", + .reg_rules = { +- ATH_2GHZ_CH01_11, ++ ATH_2GHZ_ALL, + ATH_5GHZ_ALL, + } + }; +@@ -108,8 +104,7 @@ static const struct ieee80211_regdomain + .n_reg_rules = 4, + .alpha2 = "99", + .reg_rules = { +- ATH_2GHZ_CH01_11, +- ATH_2GHZ_CH12_13, ++ ATH_2GHZ_ALL, + ATH_5GHZ_ALL, + } + }; +@@ -258,9 +253,7 @@ static bool ath_is_radar_freq(u16 center + struct ath_regulatory *reg) + + { +- if (reg->country_code == CTRY_INDIA) +- return (center_freq >= 5500 && center_freq <= 5700); +- return (center_freq >= 5260 && center_freq <= 5700); ++ return false; + } + + static void ath_force_clear_no_ir_chan(struct wiphy *wiphy, diff --git a/patch/kernel/archive/odroidxu4-6.6/patch-6.6.44-45.patch b/patch/kernel/archive/odroidxu4-6.6/patch-6.6.44-45.patch new file mode 100644 index 000000000000..95da970d54ec --- /dev/null +++ b/patch/kernel/archive/odroidxu4-6.6/patch-6.6.44-45.patch @@ -0,0 +1,5821 @@ +diff --git a/Makefile b/Makefile +index 2e5d92ce2774d..0bd4bee2128b4 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 6 + PATCHLEVEL = 6 +-SUBLEVEL = 44 ++SUBLEVEL = 45 + EXTRAVERSION = + NAME = Hurr durr I'ma ninja sloth + +diff --git a/arch/arm/kernel/perf_callchain.c b/arch/arm/kernel/perf_callchain.c +index 7147edbe56c67..1d230ac9d0eb5 100644 +--- a/arch/arm/kernel/perf_callchain.c ++++ b/arch/arm/kernel/perf_callchain.c +@@ -85,8 +85,7 @@ static bool + callchain_trace(void *data, unsigned long pc) + { + struct perf_callchain_entry_ctx *entry = data; +- perf_callchain_store(entry, pc); +- return true; ++ return perf_callchain_store(entry, pc) == 0; + } + + void +diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +index 5effd8180cc41..e5993a365870c 100644 +--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +@@ -641,6 +641,7 @@ dwc_0: usb@8a00000 { + interrupts = ; + phys = <&qusb_phy_0>, <&usb0_ssphy>; + phy-names = "usb2-phy", "usb3-phy"; ++ snps,parkmode-disable-ss-quirk; + snps,is-utmi-l1-suspend; + snps,hird-threshold = /bits/ 8 <0x0>; + snps,dis_u2_susphy_quirk; +@@ -683,6 +684,7 @@ dwc_1: usb@8c00000 { + interrupts = ; + phys = <&qusb_phy_1>, <&usb1_ssphy>; + phy-names = "usb2-phy", "usb3-phy"; ++ snps,parkmode-disable-ss-quirk; + snps,is-utmi-l1-suspend; + snps,hird-threshold = /bits/ 8 <0x0>; + snps,dis_u2_susphy_quirk; +diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi +index 9c072ce197358..7fcc15b6946ae 100644 +--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi +@@ -2159,7 +2159,8 @@ usb3_dwc3: usb@a800000 { + interrupts = ; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; +- phys = <&qusb2phy>, <&usb1_ssphy>; ++ snps,parkmode-disable-ss-quirk; ++ phys = <&qusb2phy>, <&usb3phy>; + phy-names = "usb2-phy", "usb3-phy"; + snps,has-lpm-erratum; + snps,hird-threshold = /bits/ 8 <0x10>; +@@ -2168,33 +2169,26 @@ usb3_dwc3: usb@a800000 { + + usb3phy: phy@c010000 { + compatible = "qcom,msm8998-qmp-usb3-phy"; +- reg = <0x0c010000 0x18c>; +- status = "disabled"; +- #address-cells = <1>; +- #size-cells = <1>; +- ranges; ++ reg = <0x0c010000 0x1000>; + + clocks = <&gcc GCC_USB3_PHY_AUX_CLK>, ++ <&gcc GCC_USB3_CLKREF_CLK>, + <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, +- <&gcc GCC_USB3_CLKREF_CLK>; +- clock-names = "aux", "cfg_ahb", "ref"; ++ <&gcc GCC_USB3_PHY_PIPE_CLK>; ++ clock-names = "aux", ++ "ref", ++ "cfg_ahb", ++ "pipe"; ++ clock-output-names = "usb3_phy_pipe_clk_src"; ++ #clock-cells = <0>; ++ #phy-cells = <0>; + + resets = <&gcc GCC_USB3_PHY_BCR>, + <&gcc GCC_USB3PHY_PHY_BCR>; +- reset-names = "phy", "common"; ++ reset-names = "phy", ++ "phy_phy"; + +- usb1_ssphy: phy@c010200 { +- reg = <0xc010200 0x128>, +- <0xc010400 0x200>, +- <0xc010c00 0x20c>, +- <0xc010600 0x128>, +- <0xc010800 0x200>; +- #phy-cells = <0>; +- #clock-cells = <0>; +- clocks = <&gcc GCC_USB3_PHY_PIPE_CLK>; +- clock-names = "pipe0"; +- clock-output-names = "usb3_phy_pipe_clk_src"; +- }; ++ status = "disabled"; + }; + + qusb2phy: phy@c012000 { +diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi +index f7c528ecb224b..68b1c017a9fd5 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2795,49 +2796,28 @@ usb_1_hsphy: phy@88e3000 { + nvmem-cells = <&qusb2p_hstx_trim>; + }; + +- usb_1_qmpphy: phy-wrapper@88e9000 { ++ usb_1_qmpphy: phy@88e8000 { + compatible = "qcom,sc7180-qmp-usb3-dp-phy"; +- reg = <0 0x088e9000 0 0x18c>, +- <0 0x088e8000 0 0x3c>, +- <0 0x088ea000 0 0x18c>; ++ reg = <0 0x088e8000 0 0x3000>; + status = "disabled"; +- #address-cells = <2>; +- #size-cells = <2>; +- ranges; + + clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>, +- <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, + <&gcc GCC_USB3_PRIM_CLKREF_CLK>, +- <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>; +- clock-names = "aux", "cfg_ahb", "ref", "com_aux"; ++ <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>, ++ <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>, ++ <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>; ++ clock-names = "aux", ++ "ref", ++ "com_aux", ++ "usb3_pipe", ++ "cfg_ahb"; + + resets = <&gcc GCC_USB3_PHY_PRIM_BCR>, + <&gcc GCC_USB3_DP_PHY_PRIM_BCR>; + reset-names = "phy", "common"; + +- usb_1_ssphy: usb3-phy@88e9200 { +- reg = <0 0x088e9200 0 0x128>, +- <0 0x088e9400 0 0x200>, +- <0 0x088e9c00 0 0x218>, +- <0 0x088e9600 0 0x128>, +- <0 0x088e9800 0 0x200>, +- <0 0x088e9a00 0 0x18>; +- #clock-cells = <0>; +- #phy-cells = <0>; +- clocks = <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; +- clock-names = "pipe0"; +- clock-output-names = "usb3_phy_pipe_clk_src"; +- }; +- +- dp_phy: dp-phy@88ea200 { +- reg = <0 0x088ea200 0 0x200>, +- <0 0x088ea400 0 0x200>, +- <0 0x088eaa00 0 0x200>, +- <0 0x088ea600 0 0x200>, +- <0 0x088ea800 0 0x200>; +- #clock-cells = <1>; +- #phy-cells = <0>; +- }; ++ #clock-cells = <1>; ++ #phy-cells = <1>; + }; + + pmu@90b6300 { +@@ -3001,7 +2981,8 @@ usb_1_dwc3: usb@a600000 { + iommus = <&apps_smmu 0x540 0>; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; +- phys = <&usb_1_hsphy>, <&usb_1_ssphy>; ++ snps,parkmode-disable-ss-quirk; ++ phys = <&usb_1_hsphy>, <&usb_1_qmpphy QMP_USB43DP_USB3_PHY>; + phy-names = "usb2-phy", "usb3-phy"; + maximum-speed = "super-speed"; + }; +@@ -3307,8 +3288,9 @@ mdss_dp: displayport-controller@ae90000 { + "ctrl_link_iface", "stream_pixel"; + assigned-clocks = <&dispcc DISP_CC_MDSS_DP_LINK_CLK_SRC>, + <&dispcc DISP_CC_MDSS_DP_PIXEL_CLK_SRC>; +- assigned-clock-parents = <&dp_phy 0>, <&dp_phy 1>; +- phys = <&dp_phy>; ++ assigned-clock-parents = <&usb_1_qmpphy QMP_USB43DP_DP_LINK_CLK>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>; ++ phys = <&usb_1_qmpphy QMP_USB43DP_DP_PHY>; + phy-names = "dp"; + + operating-points-v2 = <&dp_opp_table>; +@@ -3365,8 +3347,8 @@ dispcc: clock-controller@af00000 { + <&gcc GCC_DISP_GPLL0_CLK_SRC>, + <&mdss_dsi0_phy 0>, + <&mdss_dsi0_phy 1>, +- <&dp_phy 0>, +- <&dp_phy 1>; ++ <&usb_1_qmpphy QMP_USB43DP_DP_LINK_CLK>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>; + clock-names = "bi_tcxo", + "gcc_disp_gpll0_clk_src", + "dsi0_phy_pll_out_byteclk", +diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi +index b75de7caaa7e5..149c7962f2cbb 100644 +--- a/arch/arm64/boot/dts/qcom/sc7280.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -858,7 +859,7 @@ gcc: clock-controller@100000 { + <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>, + <0>, <&pcie1_lane>, + <0>, <0>, <0>, +- <&usb_1_ssphy>; ++ <&usb_1_qmpphy QMP_USB43DP_USB3_PIPE_CLK>; + clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk", + "pcie_0_pipe_clk", "pcie_1_pipe_clk", + "ufs_phy_rx_symbol_0_clk", "ufs_phy_rx_symbol_1_clk", +@@ -3351,49 +3352,26 @@ usb_2_hsphy: phy@88e4000 { + resets = <&gcc GCC_QUSB2PHY_SEC_BCR>; + }; + +- usb_1_qmpphy: phy-wrapper@88e9000 { +- compatible = "qcom,sc7280-qmp-usb3-dp-phy", +- "qcom,sm8250-qmp-usb3-dp-phy"; +- reg = <0 0x088e9000 0 0x200>, +- <0 0x088e8000 0 0x40>, +- <0 0x088ea000 0 0x200>; ++ usb_1_qmpphy: phy@88e8000 { ++ compatible = "qcom,sc7280-qmp-usb3-dp-phy"; ++ reg = <0 0x088e8000 0 0x3000>; + status = "disabled"; +- #address-cells = <2>; +- #size-cells = <2>; +- ranges; + + clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>, + <&rpmhcc RPMH_CXO_CLK>, +- <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>; +- clock-names = "aux", "ref_clk_src", "com_aux"; ++ <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>, ++ <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; ++ clock-names = "aux", ++ "ref", ++ "com_aux", ++ "usb3_pipe"; + + resets = <&gcc GCC_USB3_DP_PHY_PRIM_BCR>, + <&gcc GCC_USB3_PHY_PRIM_BCR>; + reset-names = "phy", "common"; + +- usb_1_ssphy: usb3-phy@88e9200 { +- reg = <0 0x088e9200 0 0x200>, +- <0 0x088e9400 0 0x200>, +- <0 0x088e9c00 0 0x400>, +- <0 0x088e9600 0 0x200>, +- <0 0x088e9800 0 0x200>, +- <0 0x088e9a00 0 0x100>; +- #clock-cells = <0>; +- #phy-cells = <0>; +- clocks = <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; +- clock-names = "pipe0"; +- clock-output-names = "usb3_phy_pipe_clk_src"; +- }; +- +- dp_phy: dp-phy@88ea200 { +- reg = <0 0x088ea200 0 0x200>, +- <0 0x088ea400 0 0x200>, +- <0 0x088eaa00 0 0x200>, +- <0 0x088ea600 0 0x200>, +- <0 0x088ea800 0 0x200>; +- #phy-cells = <0>; +- #clock-cells = <1>; +- }; ++ #clock-cells = <1>; ++ #phy-cells = <1>; + }; + + usb_2: usb@8cf8800 { +@@ -3702,7 +3680,8 @@ usb_1_dwc3: usb@a600000 { + iommus = <&apps_smmu 0xe0 0x0>; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; +- phys = <&usb_1_hsphy>, <&usb_1_ssphy>; ++ snps,parkmode-disable-ss-quirk; ++ phys = <&usb_1_hsphy>, <&usb_1_qmpphy QMP_USB43DP_USB3_PHY>; + phy-names = "usb2-phy", "usb3-phy"; + maximum-speed = "super-speed"; + }; +@@ -3807,8 +3786,8 @@ dispcc: clock-controller@af00000 { + <&gcc GCC_DISP_GPLL0_CLK_SRC>, + <&mdss_dsi_phy 0>, + <&mdss_dsi_phy 1>, +- <&dp_phy 0>, +- <&dp_phy 1>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_LINK_CLK>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>, + <&mdss_edp_phy 0>, + <&mdss_edp_phy 1>; + clock-names = "bi_tcxo", +@@ -4144,8 +4123,9 @@ mdss_dp: displayport-controller@ae90000 { + "stream_pixel"; + assigned-clocks = <&dispcc DISP_CC_MDSS_DP_LINK_CLK_SRC>, + <&dispcc DISP_CC_MDSS_DP_PIXEL_CLK_SRC>; +- assigned-clock-parents = <&dp_phy 0>, <&dp_phy 1>; +- phys = <&dp_phy>; ++ assigned-clock-parents = <&usb_1_qmpphy QMP_USB43DP_DP_LINK_CLK>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>; ++ phys = <&usb_1_qmpphy QMP_USB43DP_DP_PHY>; + phy-names = "dp"; + + operating-points-v2 = <&dp_opp_table>; +diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi +index 9d9b378c07e14..dcdc8a0cd1819 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -3983,80 +3984,54 @@ usb_2_hsphy: phy@88e3000 { + nvmem-cells = <&qusb2s_hstx_trim>; + }; + +- usb_1_qmpphy: phy@88e9000 { ++ usb_1_qmpphy: phy@88e8000 { + compatible = "qcom,sdm845-qmp-usb3-dp-phy"; +- reg = <0 0x088e9000 0 0x18c>, +- <0 0x088e8000 0 0x38>, +- <0 0x088ea000 0 0x40>; ++ reg = <0 0x088e8000 0 0x3000>; + status = "disabled"; +- #address-cells = <2>; +- #size-cells = <2>; +- ranges; + + clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>, +- <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, + <&gcc GCC_USB3_PRIM_CLKREF_CLK>, +- <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>; +- clock-names = "aux", "cfg_ahb", "ref", "com_aux"; ++ <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>, ++ <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>, ++ <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>; ++ clock-names = "aux", ++ "ref", ++ "com_aux", ++ "usb3_pipe", ++ "cfg_ahb"; + + resets = <&gcc GCC_USB3_PHY_PRIM_BCR>, + <&gcc GCC_USB3_DP_PHY_PRIM_BCR>; + reset-names = "phy", "common"; + +- usb_1_ssphy: usb3-phy@88e9200 { +- reg = <0 0x088e9200 0 0x128>, +- <0 0x088e9400 0 0x200>, +- <0 0x088e9c00 0 0x218>, +- <0 0x088e9600 0 0x128>, +- <0 0x088e9800 0 0x200>, +- <0 0x088e9a00 0 0x100>; +- #clock-cells = <0>; +- #phy-cells = <0>; +- clocks = <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>; +- clock-names = "pipe0"; +- clock-output-names = "usb3_phy_pipe_clk_src"; +- }; +- +- dp_phy: dp-phy@88ea200 { +- reg = <0 0x088ea200 0 0x200>, +- <0 0x088ea400 0 0x200>, +- <0 0x088eaa00 0 0x200>, +- <0 0x088ea600 0 0x200>, +- <0 0x088ea800 0 0x200>; +- #clock-cells = <1>; +- #phy-cells = <0>; +- }; ++ #clock-cells = <1>; ++ #phy-cells = <1>; + }; + + usb_2_qmpphy: phy@88eb000 { + compatible = "qcom,sdm845-qmp-usb3-uni-phy"; +- reg = <0 0x088eb000 0 0x18c>; +- status = "disabled"; +- #address-cells = <2>; +- #size-cells = <2>; +- ranges; ++ reg = <0 0x088eb000 0 0x1000>; + + clocks = <&gcc GCC_USB3_SEC_PHY_AUX_CLK>, + <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, + <&gcc GCC_USB3_SEC_CLKREF_CLK>, +- <&gcc GCC_USB3_SEC_PHY_COM_AUX_CLK>; +- clock-names = "aux", "cfg_ahb", "ref", "com_aux"; ++ <&gcc GCC_USB3_SEC_PHY_COM_AUX_CLK>, ++ <&gcc GCC_USB3_SEC_PHY_PIPE_CLK>; ++ clock-names = "aux", ++ "cfg_ahb", ++ "ref", ++ "com_aux", ++ "pipe"; ++ clock-output-names = "usb3_uni_phy_pipe_clk_src"; ++ #clock-cells = <0>; ++ #phy-cells = <0>; + +- resets = <&gcc GCC_USB3PHY_PHY_SEC_BCR>, +- <&gcc GCC_USB3_PHY_SEC_BCR>; +- reset-names = "phy", "common"; ++ resets = <&gcc GCC_USB3_PHY_SEC_BCR>, ++ <&gcc GCC_USB3PHY_PHY_SEC_BCR>; ++ reset-names = "phy", ++ "phy_phy"; + +- usb_2_ssphy: phy@88eb200 { +- reg = <0 0x088eb200 0 0x128>, +- <0 0x088eb400 0 0x1fc>, +- <0 0x088eb800 0 0x218>, +- <0 0x088eb600 0 0x70>; +- #clock-cells = <0>; +- #phy-cells = <0>; +- clocks = <&gcc GCC_USB3_SEC_PHY_PIPE_CLK>; +- clock-names = "pipe0"; +- clock-output-names = "usb3_uni_phy_pipe_clk_src"; +- }; ++ status = "disabled"; + }; + + usb_1: usb@a6f8800 { +@@ -4105,7 +4080,8 @@ usb_1_dwc3: usb@a600000 { + iommus = <&apps_smmu 0x740 0>; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; +- phys = <&usb_1_hsphy>, <&usb_1_ssphy>; ++ snps,parkmode-disable-ss-quirk; ++ phys = <&usb_1_hsphy>, <&usb_1_qmpphy QMP_USB43DP_USB3_PHY>; + phy-names = "usb2-phy", "usb3-phy"; + }; + }; +@@ -4156,7 +4132,8 @@ usb_2_dwc3: usb@a800000 { + iommus = <&apps_smmu 0x760 0>; + snps,dis_u2_susphy_quirk; + snps,dis_enblslpm_quirk; +- phys = <&usb_2_hsphy>, <&usb_2_ssphy>; ++ snps,parkmode-disable-ss-quirk; ++ phys = <&usb_2_hsphy>, <&usb_2_qmpphy>; + phy-names = "usb2-phy", "usb3-phy"; + }; + }; +@@ -4573,8 +4550,9 @@ mdss_dp: displayport-controller@ae90000 { + "ctrl_link_iface", "stream_pixel"; + assigned-clocks = <&dispcc DISP_CC_MDSS_DP_LINK_CLK_SRC>, + <&dispcc DISP_CC_MDSS_DP_PIXEL_CLK_SRC>; +- assigned-clock-parents = <&dp_phy 0>, <&dp_phy 1>; +- phys = <&dp_phy>; ++ assigned-clock-parents = <&usb_1_qmpphy QMP_USB43DP_DP_LINK_CLK>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>; ++ phys = <&usb_1_qmpphy QMP_USB43DP_DP_PHY>; + phy-names = "dp"; + + operating-points-v2 = <&dp_opp_table>; +@@ -4912,8 +4890,8 @@ dispcc: clock-controller@af00000 { + <&mdss_dsi0_phy 1>, + <&mdss_dsi1_phy 0>, + <&mdss_dsi1_phy 1>, +- <&dp_phy 0>, +- <&dp_phy 1>; ++ <&usb_1_qmpphy QMP_USB43DP_DP_LINK_CLK>, ++ <&usb_1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>; + clock-names = "bi_tcxo", + "gcc_disp_gpll0_clk_src", + "gcc_disp_gpll0_div_clk_src", +diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h +index 6aafbb7899916..4b99159150829 100644 +--- a/arch/arm64/include/asm/jump_label.h ++++ b/arch/arm64/include/asm/jump_label.h +@@ -13,6 +13,7 @@ + #include + #include + ++#define HAVE_JUMP_LABEL_BATCH + #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE + + static __always_inline bool arch_static_branch(struct static_key * const key, +diff --git a/arch/arm64/kernel/jump_label.c b/arch/arm64/kernel/jump_label.c +index faf88ec9c48e8..f63ea915d6ad2 100644 +--- a/arch/arm64/kernel/jump_label.c ++++ b/arch/arm64/kernel/jump_label.c +@@ -7,11 +7,12 @@ + */ + #include + #include ++#include + #include + #include + +-void arch_jump_label_transform(struct jump_entry *entry, +- enum jump_label_type type) ++bool arch_jump_label_transform_queue(struct jump_entry *entry, ++ enum jump_label_type type) + { + void *addr = (void *)jump_entry_code(entry); + u32 insn; +@@ -25,4 +26,10 @@ void arch_jump_label_transform(struct jump_entry *entry, + } + + aarch64_insn_patch_text_nosync(addr, insn); ++ return true; ++} ++ ++void arch_jump_label_transform_apply(void) ++{ ++ kick_all_cpus_sync(); + } +diff --git a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi +index c0be84a6e81fd..cc7747c5f21f3 100644 +--- a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi ++++ b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi +@@ -99,8 +99,8 @@ liointc1: interrupt-controller@1fe11440 { + rtc0: rtc@1fe07800 { + compatible = "loongson,ls2k1000-rtc"; + reg = <0 0x1fe07800 0 0x78>; +- interrupt-parent = <&liointc0>; +- interrupts = <60 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-parent = <&liointc1>; ++ interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; + }; + + uart0: serial@1fe00000 { +@@ -108,7 +108,7 @@ uart0: serial@1fe00000 { + reg = <0 0x1fe00000 0 0x8>; + clock-frequency = <125000000>; + interrupt-parent = <&liointc0>; +- interrupts = <0 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + no-loopback-test; + }; + +@@ -117,7 +117,6 @@ pci@1a000000 { + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; +- #interrupt-cells = <2>; + + reg = <0 0x1a000000 0 0x02000000>, + <0xfe 0x00000000 0 0x20000000>; +@@ -132,8 +131,8 @@ gmac@3,0 { + "pciclass0c03"; + + reg = <0x1800 0x0 0x0 0x0 0x0>; +- interrupts = <12 IRQ_TYPE_LEVEL_LOW>, +- <13 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <12 IRQ_TYPE_LEVEL_HIGH>, ++ <13 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq", "eth_lpi"; + interrupt-parent = <&liointc0>; + phy-mode = "rgmii-id"; +@@ -156,8 +155,8 @@ gmac@3,1 { + "loongson, pci-gmac"; + + reg = <0x1900 0x0 0x0 0x0 0x0>; +- interrupts = <14 IRQ_TYPE_LEVEL_LOW>, +- <15 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <14 IRQ_TYPE_LEVEL_HIGH>, ++ <15 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq", "eth_lpi"; + interrupt-parent = <&liointc0>; + phy-mode = "rgmii-id"; +@@ -179,7 +178,7 @@ ehci@4,1 { + "pciclass0c03"; + + reg = <0x2100 0x0 0x0 0x0 0x0>; +- interrupts = <18 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <18 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + }; + +@@ -190,7 +189,7 @@ ohci@4,2 { + "pciclass0c03"; + + reg = <0x2200 0x0 0x0 0x0 0x0>; +- interrupts = <19 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + }; + +@@ -201,97 +200,121 @@ sata@8,0 { + "pciclass0106"; + + reg = <0x4000 0x0 0x0 0x0 0x0>; +- interrupts = <19 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc0>; + }; + +- pci_bridge@9,0 { ++ pcie@9,0 { + compatible = "pci0014,7a19.0", + "pci0014,7a19", + "pciclass060400", + "pciclass0604"; + + reg = <0x4800 0x0 0x0 0x0 0x0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ device_type = "pci"; + #interrupt-cells = <1>; +- interrupts = <0 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + interrupt-map-mask = <0 0 0 0>; +- interrupt-map = <0 0 0 0 &liointc1 0 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-map = <0 0 0 0 &liointc1 0 IRQ_TYPE_LEVEL_HIGH>; ++ ranges; + external-facing; + }; + +- pci_bridge@a,0 { ++ pcie@a,0 { + compatible = "pci0014,7a09.0", + "pci0014,7a09", + "pciclass060400", + "pciclass0604"; + + reg = <0x5000 0x0 0x0 0x0 0x0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ device_type = "pci"; + #interrupt-cells = <1>; +- interrupts = <1 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + interrupt-map-mask = <0 0 0 0>; +- interrupt-map = <0 0 0 0 &liointc1 1 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-map = <0 0 0 0 &liointc1 1 IRQ_TYPE_LEVEL_HIGH>; ++ ranges; + external-facing; + }; + +- pci_bridge@b,0 { ++ pcie@b,0 { + compatible = "pci0014,7a09.0", + "pci0014,7a09", + "pciclass060400", + "pciclass0604"; + + reg = <0x5800 0x0 0x0 0x0 0x0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ device_type = "pci"; + #interrupt-cells = <1>; +- interrupts = <2 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + interrupt-map-mask = <0 0 0 0>; +- interrupt-map = <0 0 0 0 &liointc1 2 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-map = <0 0 0 0 &liointc1 2 IRQ_TYPE_LEVEL_HIGH>; ++ ranges; + external-facing; + }; + +- pci_bridge@c,0 { ++ pcie@c,0 { + compatible = "pci0014,7a09.0", + "pci0014,7a09", + "pciclass060400", + "pciclass0604"; + + reg = <0x6000 0x0 0x0 0x0 0x0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ device_type = "pci"; + #interrupt-cells = <1>; +- interrupts = <3 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + interrupt-map-mask = <0 0 0 0>; +- interrupt-map = <0 0 0 0 &liointc1 3 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-map = <0 0 0 0 &liointc1 3 IRQ_TYPE_LEVEL_HIGH>; ++ ranges; + external-facing; + }; + +- pci_bridge@d,0 { ++ pcie@d,0 { + compatible = "pci0014,7a19.0", + "pci0014,7a19", + "pciclass060400", + "pciclass0604"; + + reg = <0x6800 0x0 0x0 0x0 0x0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ device_type = "pci"; + #interrupt-cells = <1>; +- interrupts = <4 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + interrupt-map-mask = <0 0 0 0>; +- interrupt-map = <0 0 0 0 &liointc1 4 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-map = <0 0 0 0 &liointc1 4 IRQ_TYPE_LEVEL_HIGH>; ++ ranges; + external-facing; + }; + +- pci_bridge@e,0 { ++ pcie@e,0 { + compatible = "pci0014,7a09.0", + "pci0014,7a09", + "pciclass060400", + "pciclass0604"; + + reg = <0x7000 0x0 0x0 0x0 0x0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ device_type = "pci"; + #interrupt-cells = <1>; +- interrupts = <5 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&liointc1>; + interrupt-map-mask = <0 0 0 0>; +- interrupt-map = <0 0 0 0 &liointc1 5 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-map = <0 0 0 0 &liointc1 5 IRQ_TYPE_LEVEL_HIGH>; ++ ranges; + external-facing; + }; + +diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c +index 5348d842c7453..e867fe465164e 100644 +--- a/arch/riscv/kernel/traps_misaligned.c ++++ b/arch/riscv/kernel/traps_misaligned.c +@@ -151,51 +151,19 @@ + #define PRECISION_S 0 + #define PRECISION_D 1 + +-#define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type, insn) \ +-static inline type load_##type(const type *addr) \ +-{ \ +- type val; \ +- asm (#insn " %0, %1" \ +- : "=&r" (val) : "m" (*addr)); \ +- return val; \ +-} ++static inline u8 load_u8(const u8 *addr) ++{ ++ u8 val; + +-#define DECLARE_UNPRIVILEGED_STORE_FUNCTION(type, insn) \ +-static inline void store_##type(type *addr, type val) \ +-{ \ +- asm volatile (#insn " %0, %1\n" \ +- : : "r" (val), "m" (*addr)); \ +-} ++ asm volatile("lbu %0, %1" : "=&r" (val) : "m" (*addr)); + +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u8, lbu) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u16, lhu) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s8, lb) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s16, lh) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s32, lw) +-DECLARE_UNPRIVILEGED_STORE_FUNCTION(u8, sb) +-DECLARE_UNPRIVILEGED_STORE_FUNCTION(u16, sh) +-DECLARE_UNPRIVILEGED_STORE_FUNCTION(u32, sw) +-#if defined(CONFIG_64BIT) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u32, lwu) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u64, ld) +-DECLARE_UNPRIVILEGED_STORE_FUNCTION(u64, sd) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(ulong, ld) +-#else +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u32, lw) +-DECLARE_UNPRIVILEGED_LOAD_FUNCTION(ulong, lw) +- +-static inline u64 load_u64(const u64 *addr) +-{ +- return load_u32((u32 *)addr) +- + ((u64)load_u32((u32 *)addr + 1) << 32); ++ return val; + } + +-static inline void store_u64(u64 *addr, u64 val) ++static inline void store_u8(u8 *addr, u8 val) + { +- store_u32((u32 *)addr, val); +- store_u32((u32 *)addr + 1, val >> 32); ++ asm volatile ("sb %0, %1\n" : : "r" (val), "m" (*addr)); + } +-#endif + + static inline ulong get_insn(ulong mepc) + { +diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c +index 90d4ba36d1d06..655b2b1bb529f 100644 +--- a/arch/riscv/mm/fault.c ++++ b/arch/riscv/mm/fault.c +@@ -61,26 +61,27 @@ static inline void no_context(struct pt_regs *regs, unsigned long addr) + + static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_fault_t fault) + { ++ if (!user_mode(regs)) { ++ no_context(regs, addr); ++ return; ++ } ++ + if (fault & VM_FAULT_OOM) { + /* + * We ran out of memory, call the OOM killer, and return the userspace + * (which will retry the fault, or kill us if we got oom-killed). + */ +- if (!user_mode(regs)) { +- no_context(regs, addr); +- return; +- } + pagefault_out_of_memory(); + return; + } else if (fault & (VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE)) { + /* Kernel mode? Handle exceptions or die */ +- if (!user_mode(regs)) { +- no_context(regs, addr); +- return; +- } + do_trap(regs, SIGBUS, BUS_ADRERR, addr); + return; ++ } else if (fault & VM_FAULT_SIGSEGV) { ++ do_trap(regs, SIGSEGV, SEGV_MAPERR, addr); ++ return; + } ++ + BUG(); + } + +diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c +index 8adcb9419ad50..9b10e9655df8c 100644 +--- a/arch/riscv/mm/init.c ++++ b/arch/riscv/mm/init.c +@@ -217,8 +217,6 @@ static void __init setup_bootmem(void) + */ + memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); + +- phys_ram_end = memblock_end_of_DRAM(); +- + /* + * Make sure we align the start of the memory on a PMD boundary so that + * at worst, we map the linear mapping with PMD mappings. +@@ -233,6 +231,16 @@ static void __init setup_bootmem(void) + if (IS_ENABLED(CONFIG_64BIT) && IS_ENABLED(CONFIG_MMU)) + kernel_map.va_pa_offset = PAGE_OFFSET - phys_ram_base; + ++ /* ++ * The size of the linear page mapping may restrict the amount of ++ * usable RAM. ++ */ ++ if (IS_ENABLED(CONFIG_64BIT)) { ++ max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; ++ memblock_cap_memory_range(phys_ram_base, ++ max_mapped_addr - phys_ram_base); ++ } ++ + /* + * Reserve physical address space that would be mapped to virtual + * addresses greater than (void *)(-PAGE_SIZE) because: +@@ -249,6 +257,7 @@ static void __init setup_bootmem(void) + memblock_reserve(max_mapped_addr, (phys_addr_t)-max_mapped_addr); + } + ++ phys_ram_end = memblock_end_of_DRAM(); + min_low_pfn = PFN_UP(phys_ram_base); + max_low_pfn = max_pfn = PFN_DOWN(phys_ram_end); + high_memory = (void *)(__va(PFN_PHYS(max_low_pfn))); +@@ -1269,8 +1278,6 @@ static void __init create_linear_mapping_page_table(void) + if (start <= __pa(PAGE_OFFSET) && + __pa(PAGE_OFFSET) < end) + start = __pa(PAGE_OFFSET); +- if (end >= __pa(PAGE_OFFSET) + memory_limit) +- end = __pa(PAGE_OFFSET) + memory_limit; + + create_linear_mapping_range(start, end, 0); + } +diff --git a/arch/x86/include/asm/posted_intr.h b/arch/x86/include/asm/posted_intr.h +new file mode 100644 +index 0000000000000..f0324c56f7af5 +--- /dev/null ++++ b/arch/x86/include/asm/posted_intr.h +@@ -0,0 +1,88 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _X86_POSTED_INTR_H ++#define _X86_POSTED_INTR_H ++ ++#define POSTED_INTR_ON 0 ++#define POSTED_INTR_SN 1 ++ ++#define PID_TABLE_ENTRY_VALID 1 ++ ++/* Posted-Interrupt Descriptor */ ++struct pi_desc { ++ u32 pir[8]; /* Posted interrupt requested */ ++ union { ++ struct { ++ /* bit 256 - Outstanding Notification */ ++ u16 on : 1, ++ /* bit 257 - Suppress Notification */ ++ sn : 1, ++ /* bit 271:258 - Reserved */ ++ rsvd_1 : 14; ++ /* bit 279:272 - Notification Vector */ ++ u8 nv; ++ /* bit 287:280 - Reserved */ ++ u8 rsvd_2; ++ /* bit 319:288 - Notification Destination */ ++ u32 ndst; ++ }; ++ u64 control; ++ }; ++ u32 rsvd[6]; ++} __aligned(64); ++ ++static inline bool pi_test_and_set_on(struct pi_desc *pi_desc) ++{ ++ return test_and_set_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); ++} ++ ++static inline bool pi_test_and_clear_on(struct pi_desc *pi_desc) ++{ ++ return test_and_clear_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); ++} ++ ++static inline bool pi_test_and_clear_sn(struct pi_desc *pi_desc) ++{ ++ return test_and_clear_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control); ++} ++ ++static inline bool pi_test_and_set_pir(int vector, struct pi_desc *pi_desc) ++{ ++ return test_and_set_bit(vector, (unsigned long *)pi_desc->pir); ++} ++ ++static inline bool pi_is_pir_empty(struct pi_desc *pi_desc) ++{ ++ return bitmap_empty((unsigned long *)pi_desc->pir, NR_VECTORS); ++} ++ ++static inline void pi_set_sn(struct pi_desc *pi_desc) ++{ ++ set_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control); ++} ++ ++static inline void pi_set_on(struct pi_desc *pi_desc) ++{ ++ set_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); ++} ++ ++static inline void pi_clear_on(struct pi_desc *pi_desc) ++{ ++ clear_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); ++} ++ ++static inline void pi_clear_sn(struct pi_desc *pi_desc) ++{ ++ clear_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control); ++} ++ ++static inline bool pi_test_on(struct pi_desc *pi_desc) ++{ ++ return test_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); ++} ++ ++static inline bool pi_test_sn(struct pi_desc *pi_desc) ++{ ++ return test_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control); ++} ++ ++#endif /* _X86_POSTED_INTR_H */ +diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile +index 80e3fe184d17e..a99ffc3f3a3fd 100644 +--- a/arch/x86/kvm/Makefile ++++ b/arch/x86/kvm/Makefile +@@ -26,6 +26,10 @@ kvm-intel-y += vmx/vmx.o vmx/vmenter.o vmx/pmu_intel.o vmx/vmcs12.o \ + vmx/hyperv.o vmx/nested.o vmx/posted_intr.o + kvm-intel-$(CONFIG_X86_SGX_KVM) += vmx/sgx.o + ++ifdef CONFIG_HYPERV ++kvm-intel-y += vmx/vmx_onhyperv.o ++endif ++ + kvm-amd-y += svm/svm.o svm/vmenter.o svm/pmu.o svm/nested.o svm/avic.o \ + svm/sev.o svm/hyperv.o + +diff --git a/arch/x86/kvm/vmx/hyperv.c b/arch/x86/kvm/vmx/hyperv.c +index 313b8bb5b8a7c..de13dc14fe1d2 100644 +--- a/arch/x86/kvm/vmx/hyperv.c ++++ b/arch/x86/kvm/vmx/hyperv.c +@@ -13,111 +13,6 @@ + + #define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK + +-/* +- * Enlightened VMCSv1 doesn't support these: +- * +- * POSTED_INTR_NV = 0x00000002, +- * GUEST_INTR_STATUS = 0x00000810, +- * APIC_ACCESS_ADDR = 0x00002014, +- * POSTED_INTR_DESC_ADDR = 0x00002016, +- * EOI_EXIT_BITMAP0 = 0x0000201c, +- * EOI_EXIT_BITMAP1 = 0x0000201e, +- * EOI_EXIT_BITMAP2 = 0x00002020, +- * EOI_EXIT_BITMAP3 = 0x00002022, +- * GUEST_PML_INDEX = 0x00000812, +- * PML_ADDRESS = 0x0000200e, +- * VM_FUNCTION_CONTROL = 0x00002018, +- * EPTP_LIST_ADDRESS = 0x00002024, +- * VMREAD_BITMAP = 0x00002026, +- * VMWRITE_BITMAP = 0x00002028, +- * +- * TSC_MULTIPLIER = 0x00002032, +- * PLE_GAP = 0x00004020, +- * PLE_WINDOW = 0x00004022, +- * VMX_PREEMPTION_TIMER_VALUE = 0x0000482E, +- * +- * Currently unsupported in KVM: +- * GUEST_IA32_RTIT_CTL = 0x00002814, +- */ +-#define EVMCS1_SUPPORTED_PINCTRL \ +- (PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR | \ +- PIN_BASED_EXT_INTR_MASK | \ +- PIN_BASED_NMI_EXITING | \ +- PIN_BASED_VIRTUAL_NMIS) +- +-#define EVMCS1_SUPPORTED_EXEC_CTRL \ +- (CPU_BASED_ALWAYSON_WITHOUT_TRUE_MSR | \ +- CPU_BASED_HLT_EXITING | \ +- CPU_BASED_CR3_LOAD_EXITING | \ +- CPU_BASED_CR3_STORE_EXITING | \ +- CPU_BASED_UNCOND_IO_EXITING | \ +- CPU_BASED_MOV_DR_EXITING | \ +- CPU_BASED_USE_TSC_OFFSETTING | \ +- CPU_BASED_MWAIT_EXITING | \ +- CPU_BASED_MONITOR_EXITING | \ +- CPU_BASED_INVLPG_EXITING | \ +- CPU_BASED_RDPMC_EXITING | \ +- CPU_BASED_INTR_WINDOW_EXITING | \ +- CPU_BASED_CR8_LOAD_EXITING | \ +- CPU_BASED_CR8_STORE_EXITING | \ +- CPU_BASED_RDTSC_EXITING | \ +- CPU_BASED_TPR_SHADOW | \ +- CPU_BASED_USE_IO_BITMAPS | \ +- CPU_BASED_MONITOR_TRAP_FLAG | \ +- CPU_BASED_USE_MSR_BITMAPS | \ +- CPU_BASED_NMI_WINDOW_EXITING | \ +- CPU_BASED_PAUSE_EXITING | \ +- CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) +- +-#define EVMCS1_SUPPORTED_2NDEXEC \ +- (SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | \ +- SECONDARY_EXEC_WBINVD_EXITING | \ +- SECONDARY_EXEC_ENABLE_VPID | \ +- SECONDARY_EXEC_ENABLE_EPT | \ +- SECONDARY_EXEC_UNRESTRICTED_GUEST | \ +- SECONDARY_EXEC_DESC | \ +- SECONDARY_EXEC_ENABLE_RDTSCP | \ +- SECONDARY_EXEC_ENABLE_INVPCID | \ +- SECONDARY_EXEC_ENABLE_XSAVES | \ +- SECONDARY_EXEC_RDSEED_EXITING | \ +- SECONDARY_EXEC_RDRAND_EXITING | \ +- SECONDARY_EXEC_TSC_SCALING | \ +- SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE | \ +- SECONDARY_EXEC_PT_USE_GPA | \ +- SECONDARY_EXEC_PT_CONCEAL_VMX | \ +- SECONDARY_EXEC_BUS_LOCK_DETECTION | \ +- SECONDARY_EXEC_NOTIFY_VM_EXITING | \ +- SECONDARY_EXEC_ENCLS_EXITING) +- +-#define EVMCS1_SUPPORTED_3RDEXEC (0ULL) +- +-#define EVMCS1_SUPPORTED_VMEXIT_CTRL \ +- (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | \ +- VM_EXIT_SAVE_DEBUG_CONTROLS | \ +- VM_EXIT_ACK_INTR_ON_EXIT | \ +- VM_EXIT_HOST_ADDR_SPACE_SIZE | \ +- VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \ +- VM_EXIT_SAVE_IA32_PAT | \ +- VM_EXIT_LOAD_IA32_PAT | \ +- VM_EXIT_SAVE_IA32_EFER | \ +- VM_EXIT_LOAD_IA32_EFER | \ +- VM_EXIT_CLEAR_BNDCFGS | \ +- VM_EXIT_PT_CONCEAL_PIP | \ +- VM_EXIT_CLEAR_IA32_RTIT_CTL) +- +-#define EVMCS1_SUPPORTED_VMENTRY_CTRL \ +- (VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR | \ +- VM_ENTRY_LOAD_DEBUG_CONTROLS | \ +- VM_ENTRY_IA32E_MODE | \ +- VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL | \ +- VM_ENTRY_LOAD_IA32_PAT | \ +- VM_ENTRY_LOAD_IA32_EFER | \ +- VM_ENTRY_LOAD_BNDCFGS | \ +- VM_ENTRY_PT_CONCEAL_PIP | \ +- VM_ENTRY_LOAD_IA32_RTIT_CTL) +- +-#define EVMCS1_SUPPORTED_VMFUNC (0) +- + #define EVMCS1_OFFSET(x) offsetof(struct hv_enlightened_vmcs, x) + #define EVMCS1_FIELD(number, name, clean_field)[ROL16(number, 6)] = \ + {EVMCS1_OFFSET(name), clean_field} +@@ -608,40 +503,6 @@ int nested_evmcs_check_controls(struct vmcs12 *vmcs12) + return 0; + } + +-#if IS_ENABLED(CONFIG_HYPERV) +-DEFINE_STATIC_KEY_FALSE(__kvm_is_using_evmcs); +- +-/* +- * KVM on Hyper-V always uses the latest known eVMCSv1 revision, the assumption +- * is: in case a feature has corresponding fields in eVMCS described and it was +- * exposed in VMX feature MSRs, KVM is free to use it. Warn if KVM meets a +- * feature which has no corresponding eVMCS field, this likely means that KVM +- * needs to be updated. +- */ +-#define evmcs_check_vmcs_conf(field, ctrl) \ +- do { \ +- typeof(vmcs_conf->field) unsupported; \ +- \ +- unsupported = vmcs_conf->field & ~EVMCS1_SUPPORTED_ ## ctrl; \ +- if (unsupported) { \ +- pr_warn_once(#field " unsupported with eVMCS: 0x%llx\n",\ +- (u64)unsupported); \ +- vmcs_conf->field &= EVMCS1_SUPPORTED_ ## ctrl; \ +- } \ +- } \ +- while (0) +- +-void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf) +-{ +- evmcs_check_vmcs_conf(cpu_based_exec_ctrl, EXEC_CTRL); +- evmcs_check_vmcs_conf(pin_based_exec_ctrl, PINCTRL); +- evmcs_check_vmcs_conf(cpu_based_2nd_exec_ctrl, 2NDEXEC); +- evmcs_check_vmcs_conf(cpu_based_3rd_exec_ctrl, 3RDEXEC); +- evmcs_check_vmcs_conf(vmentry_ctrl, VMENTRY_CTRL); +- evmcs_check_vmcs_conf(vmexit_ctrl, VMEXIT_CTRL); +-} +-#endif +- + int nested_enable_evmcs(struct kvm_vcpu *vcpu, + uint16_t *vmcs_version) + { +diff --git a/arch/x86/kvm/vmx/hyperv.h b/arch/x86/kvm/vmx/hyperv.h +index 9623fe1651c48..9401dbfaea7ce 100644 +--- a/arch/x86/kvm/vmx/hyperv.h ++++ b/arch/x86/kvm/vmx/hyperv.h +@@ -14,12 +14,113 @@ + #include "vmcs.h" + #include "vmcs12.h" + +-struct vmcs_config; +- +-#define current_evmcs ((struct hv_enlightened_vmcs *)this_cpu_read(current_vmcs)) +- + #define KVM_EVMCS_VERSION 1 + ++/* ++ * Enlightened VMCSv1 doesn't support these: ++ * ++ * POSTED_INTR_NV = 0x00000002, ++ * GUEST_INTR_STATUS = 0x00000810, ++ * APIC_ACCESS_ADDR = 0x00002014, ++ * POSTED_INTR_DESC_ADDR = 0x00002016, ++ * EOI_EXIT_BITMAP0 = 0x0000201c, ++ * EOI_EXIT_BITMAP1 = 0x0000201e, ++ * EOI_EXIT_BITMAP2 = 0x00002020, ++ * EOI_EXIT_BITMAP3 = 0x00002022, ++ * GUEST_PML_INDEX = 0x00000812, ++ * PML_ADDRESS = 0x0000200e, ++ * VM_FUNCTION_CONTROL = 0x00002018, ++ * EPTP_LIST_ADDRESS = 0x00002024, ++ * VMREAD_BITMAP = 0x00002026, ++ * VMWRITE_BITMAP = 0x00002028, ++ * ++ * TSC_MULTIPLIER = 0x00002032, ++ * PLE_GAP = 0x00004020, ++ * PLE_WINDOW = 0x00004022, ++ * VMX_PREEMPTION_TIMER_VALUE = 0x0000482E, ++ * ++ * Currently unsupported in KVM: ++ * GUEST_IA32_RTIT_CTL = 0x00002814, ++ */ ++#define EVMCS1_SUPPORTED_PINCTRL \ ++ (PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR | \ ++ PIN_BASED_EXT_INTR_MASK | \ ++ PIN_BASED_NMI_EXITING | \ ++ PIN_BASED_VIRTUAL_NMIS) ++ ++#define EVMCS1_SUPPORTED_EXEC_CTRL \ ++ (CPU_BASED_ALWAYSON_WITHOUT_TRUE_MSR | \ ++ CPU_BASED_HLT_EXITING | \ ++ CPU_BASED_CR3_LOAD_EXITING | \ ++ CPU_BASED_CR3_STORE_EXITING | \ ++ CPU_BASED_UNCOND_IO_EXITING | \ ++ CPU_BASED_MOV_DR_EXITING | \ ++ CPU_BASED_USE_TSC_OFFSETTING | \ ++ CPU_BASED_MWAIT_EXITING | \ ++ CPU_BASED_MONITOR_EXITING | \ ++ CPU_BASED_INVLPG_EXITING | \ ++ CPU_BASED_RDPMC_EXITING | \ ++ CPU_BASED_INTR_WINDOW_EXITING | \ ++ CPU_BASED_CR8_LOAD_EXITING | \ ++ CPU_BASED_CR8_STORE_EXITING | \ ++ CPU_BASED_RDTSC_EXITING | \ ++ CPU_BASED_TPR_SHADOW | \ ++ CPU_BASED_USE_IO_BITMAPS | \ ++ CPU_BASED_MONITOR_TRAP_FLAG | \ ++ CPU_BASED_USE_MSR_BITMAPS | \ ++ CPU_BASED_NMI_WINDOW_EXITING | \ ++ CPU_BASED_PAUSE_EXITING | \ ++ CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) ++ ++#define EVMCS1_SUPPORTED_2NDEXEC \ ++ (SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | \ ++ SECONDARY_EXEC_WBINVD_EXITING | \ ++ SECONDARY_EXEC_ENABLE_VPID | \ ++ SECONDARY_EXEC_ENABLE_EPT | \ ++ SECONDARY_EXEC_UNRESTRICTED_GUEST | \ ++ SECONDARY_EXEC_DESC | \ ++ SECONDARY_EXEC_ENABLE_RDTSCP | \ ++ SECONDARY_EXEC_ENABLE_INVPCID | \ ++ SECONDARY_EXEC_ENABLE_XSAVES | \ ++ SECONDARY_EXEC_RDSEED_EXITING | \ ++ SECONDARY_EXEC_RDRAND_EXITING | \ ++ SECONDARY_EXEC_TSC_SCALING | \ ++ SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE | \ ++ SECONDARY_EXEC_PT_USE_GPA | \ ++ SECONDARY_EXEC_PT_CONCEAL_VMX | \ ++ SECONDARY_EXEC_BUS_LOCK_DETECTION | \ ++ SECONDARY_EXEC_NOTIFY_VM_EXITING | \ ++ SECONDARY_EXEC_ENCLS_EXITING) ++ ++#define EVMCS1_SUPPORTED_3RDEXEC (0ULL) ++ ++#define EVMCS1_SUPPORTED_VMEXIT_CTRL \ ++ (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | \ ++ VM_EXIT_SAVE_DEBUG_CONTROLS | \ ++ VM_EXIT_ACK_INTR_ON_EXIT | \ ++ VM_EXIT_HOST_ADDR_SPACE_SIZE | \ ++ VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \ ++ VM_EXIT_SAVE_IA32_PAT | \ ++ VM_EXIT_LOAD_IA32_PAT | \ ++ VM_EXIT_SAVE_IA32_EFER | \ ++ VM_EXIT_LOAD_IA32_EFER | \ ++ VM_EXIT_CLEAR_BNDCFGS | \ ++ VM_EXIT_PT_CONCEAL_PIP | \ ++ VM_EXIT_CLEAR_IA32_RTIT_CTL) ++ ++#define EVMCS1_SUPPORTED_VMENTRY_CTRL \ ++ (VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR | \ ++ VM_ENTRY_LOAD_DEBUG_CONTROLS | \ ++ VM_ENTRY_IA32E_MODE | \ ++ VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL | \ ++ VM_ENTRY_LOAD_IA32_PAT | \ ++ VM_ENTRY_LOAD_IA32_EFER | \ ++ VM_ENTRY_LOAD_BNDCFGS | \ ++ VM_ENTRY_PT_CONCEAL_PIP | \ ++ VM_ENTRY_LOAD_IA32_RTIT_CTL) ++ ++#define EVMCS1_SUPPORTED_VMFUNC (0) ++ + struct evmcs_field { + u16 offset; + u16 clean_field; +@@ -65,114 +166,6 @@ static inline u64 evmcs_read_any(struct hv_enlightened_vmcs *evmcs, + return vmcs12_read_any((void *)evmcs, field, offset); + } + +-#if IS_ENABLED(CONFIG_HYPERV) +- +-DECLARE_STATIC_KEY_FALSE(__kvm_is_using_evmcs); +- +-static __always_inline bool kvm_is_using_evmcs(void) +-{ +- return static_branch_unlikely(&__kvm_is_using_evmcs); +-} +- +-static __always_inline int get_evmcs_offset(unsigned long field, +- u16 *clean_field) +-{ +- int offset = evmcs_field_offset(field, clean_field); +- +- WARN_ONCE(offset < 0, "accessing unsupported EVMCS field %lx\n", field); +- return offset; +-} +- +-static __always_inline void evmcs_write64(unsigned long field, u64 value) +-{ +- u16 clean_field; +- int offset = get_evmcs_offset(field, &clean_field); +- +- if (offset < 0) +- return; +- +- *(u64 *)((char *)current_evmcs + offset) = value; +- +- current_evmcs->hv_clean_fields &= ~clean_field; +-} +- +-static __always_inline void evmcs_write32(unsigned long field, u32 value) +-{ +- u16 clean_field; +- int offset = get_evmcs_offset(field, &clean_field); +- +- if (offset < 0) +- return; +- +- *(u32 *)((char *)current_evmcs + offset) = value; +- current_evmcs->hv_clean_fields &= ~clean_field; +-} +- +-static __always_inline void evmcs_write16(unsigned long field, u16 value) +-{ +- u16 clean_field; +- int offset = get_evmcs_offset(field, &clean_field); +- +- if (offset < 0) +- return; +- +- *(u16 *)((char *)current_evmcs + offset) = value; +- current_evmcs->hv_clean_fields &= ~clean_field; +-} +- +-static __always_inline u64 evmcs_read64(unsigned long field) +-{ +- int offset = get_evmcs_offset(field, NULL); +- +- if (offset < 0) +- return 0; +- +- return *(u64 *)((char *)current_evmcs + offset); +-} +- +-static __always_inline u32 evmcs_read32(unsigned long field) +-{ +- int offset = get_evmcs_offset(field, NULL); +- +- if (offset < 0) +- return 0; +- +- return *(u32 *)((char *)current_evmcs + offset); +-} +- +-static __always_inline u16 evmcs_read16(unsigned long field) +-{ +- int offset = get_evmcs_offset(field, NULL); +- +- if (offset < 0) +- return 0; +- +- return *(u16 *)((char *)current_evmcs + offset); +-} +- +-static inline void evmcs_load(u64 phys_addr) +-{ +- struct hv_vp_assist_page *vp_ap = +- hv_get_vp_assist_page(smp_processor_id()); +- +- if (current_evmcs->hv_enlightenments_control.nested_flush_hypercall) +- vp_ap->nested_control.features.directhypercall = 1; +- vp_ap->current_nested_vmcs = phys_addr; +- vp_ap->enlighten_vmentry = 1; +-} +- +-void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf); +-#else /* !IS_ENABLED(CONFIG_HYPERV) */ +-static __always_inline bool kvm_is_using_evmcs(void) { return false; } +-static __always_inline void evmcs_write64(unsigned long field, u64 value) {} +-static __always_inline void evmcs_write32(unsigned long field, u32 value) {} +-static __always_inline void evmcs_write16(unsigned long field, u16 value) {} +-static __always_inline u64 evmcs_read64(unsigned long field) { return 0; } +-static __always_inline u32 evmcs_read32(unsigned long field) { return 0; } +-static __always_inline u16 evmcs_read16(unsigned long field) { return 0; } +-static inline void evmcs_load(u64 phys_addr) {} +-#endif /* IS_ENABLED(CONFIG_HYPERV) */ +- + #define EVMPTR_INVALID (-1ULL) + #define EVMPTR_MAP_PENDING (-2ULL) + +diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c +index d1b4a85def0a6..0ad66b9207e85 100644 +--- a/arch/x86/kvm/vmx/nested.c ++++ b/arch/x86/kvm/vmx/nested.c +@@ -12,6 +12,7 @@ + #include "mmu.h" + #include "nested.h" + #include "pmu.h" ++#include "posted_intr.h" + #include "sgx.h" + #include "trace.h" + #include "vmx.h" +@@ -3830,8 +3831,8 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu) + if (!pi_test_and_clear_on(vmx->nested.pi_desc)) + return 0; + +- max_irr = find_last_bit((unsigned long *)vmx->nested.pi_desc->pir, 256); +- if (max_irr != 256) { ++ max_irr = pi_find_highest_vector(vmx->nested.pi_desc); ++ if (max_irr > 0) { + vapic_page = vmx->nested.virtual_apic_map.hva; + if (!vapic_page) + goto mmio_needed; +@@ -3964,8 +3965,40 @@ static bool nested_vmx_preemption_timer_pending(struct kvm_vcpu *vcpu) + + static bool vmx_has_nested_events(struct kvm_vcpu *vcpu, bool for_injection) + { +- return nested_vmx_preemption_timer_pending(vcpu) || +- to_vmx(vcpu)->nested.mtf_pending; ++ struct vcpu_vmx *vmx = to_vmx(vcpu); ++ void *vapic = vmx->nested.virtual_apic_map.hva; ++ int max_irr, vppr; ++ ++ if (nested_vmx_preemption_timer_pending(vcpu) || ++ vmx->nested.mtf_pending) ++ return true; ++ ++ /* ++ * Virtual Interrupt Delivery doesn't require manual injection. Either ++ * the interrupt is already in GUEST_RVI and will be recognized by CPU ++ * at VM-Entry, or there is a KVM_REQ_EVENT pending and KVM will move ++ * the interrupt from the PIR to RVI prior to entering the guest. ++ */ ++ if (for_injection) ++ return false; ++ ++ if (!nested_cpu_has_vid(get_vmcs12(vcpu)) || ++ __vmx_interrupt_blocked(vcpu)) ++ return false; ++ ++ if (!vapic) ++ return false; ++ ++ vppr = *((u32 *)(vapic + APIC_PROCPRI)); ++ ++ if (vmx->nested.pi_pending && vmx->nested.pi_desc && ++ pi_test_on(vmx->nested.pi_desc)) { ++ max_irr = pi_find_highest_vector(vmx->nested.pi_desc); ++ if (max_irr > 0 && (max_irr & 0xf0) > (vppr & 0xf0)) ++ return true; ++ } ++ ++ return false; + } + + /* +diff --git a/arch/x86/kvm/vmx/posted_intr.h b/arch/x86/kvm/vmx/posted_intr.h +index 26992076552ef..1715d2ab07be5 100644 +--- a/arch/x86/kvm/vmx/posted_intr.h ++++ b/arch/x86/kvm/vmx/posted_intr.h +@@ -2,97 +2,8 @@ + #ifndef __KVM_X86_VMX_POSTED_INTR_H + #define __KVM_X86_VMX_POSTED_INTR_H + +-#define POSTED_INTR_ON 0 +-#define POSTED_INTR_SN 1 +- +-#define PID_TABLE_ENTRY_VALID 1 +- +-/* Posted-Interrupt Descriptor */ +-struct pi_desc { +- u32 pir[8]; /* Posted interrupt requested */ +- union { +- struct { +- /* bit 256 - Outstanding Notification */ +- u16 on : 1, +- /* bit 257 - Suppress Notification */ +- sn : 1, +- /* bit 271:258 - Reserved */ +- rsvd_1 : 14; +- /* bit 279:272 - Notification Vector */ +- u8 nv; +- /* bit 287:280 - Reserved */ +- u8 rsvd_2; +- /* bit 319:288 - Notification Destination */ +- u32 ndst; +- }; +- u64 control; +- }; +- u32 rsvd[6]; +-} __aligned(64); +- +-static inline bool pi_test_and_set_on(struct pi_desc *pi_desc) +-{ +- return test_and_set_bit(POSTED_INTR_ON, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline bool pi_test_and_clear_on(struct pi_desc *pi_desc) +-{ +- return test_and_clear_bit(POSTED_INTR_ON, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline bool pi_test_and_clear_sn(struct pi_desc *pi_desc) +-{ +- return test_and_clear_bit(POSTED_INTR_SN, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline bool pi_test_and_set_pir(int vector, struct pi_desc *pi_desc) +-{ +- return test_and_set_bit(vector, (unsigned long *)pi_desc->pir); +-} +- +-static inline bool pi_is_pir_empty(struct pi_desc *pi_desc) +-{ +- return bitmap_empty((unsigned long *)pi_desc->pir, NR_VECTORS); +-} +- +-static inline void pi_set_sn(struct pi_desc *pi_desc) +-{ +- set_bit(POSTED_INTR_SN, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline void pi_set_on(struct pi_desc *pi_desc) +-{ +- set_bit(POSTED_INTR_ON, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline void pi_clear_on(struct pi_desc *pi_desc) +-{ +- clear_bit(POSTED_INTR_ON, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline void pi_clear_sn(struct pi_desc *pi_desc) +-{ +- clear_bit(POSTED_INTR_SN, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline bool pi_test_on(struct pi_desc *pi_desc) +-{ +- return test_bit(POSTED_INTR_ON, +- (unsigned long *)&pi_desc->control); +-} +- +-static inline bool pi_test_sn(struct pi_desc *pi_desc) +-{ +- return test_bit(POSTED_INTR_SN, +- (unsigned long *)&pi_desc->control); +-} ++#include ++#include + + void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu); + void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu); +@@ -103,4 +14,12 @@ int vmx_pi_update_irte(struct kvm *kvm, unsigned int host_irq, + uint32_t guest_irq, bool set); + void vmx_pi_start_assignment(struct kvm *kvm); + ++static inline int pi_find_highest_vector(struct pi_desc *pi_desc) ++{ ++ int vec; ++ ++ vec = find_last_bit((unsigned long *)pi_desc->pir, 256); ++ return vec < 256 ? vec : -1; ++} ++ + #endif /* __KVM_X86_VMX_POSTED_INTR_H */ +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c +index f5f652a546bf2..2e0106d9d371c 100644 +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -66,6 +66,8 @@ + #include "vmx.h" + #include "x86.h" + #include "smm.h" ++#include "vmx_onhyperv.h" ++#include "posted_intr.h" + + MODULE_AUTHOR("Qumranet"); + MODULE_LICENSE("GPL"); +diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h +index 912b0c4697429..6be1627d888e5 100644 +--- a/arch/x86/kvm/vmx/vmx.h ++++ b/arch/x86/kvm/vmx/vmx.h +@@ -7,10 +7,10 @@ + #include + #include + #include ++#include + + #include "capabilities.h" + #include "../kvm_cache_regs.h" +-#include "posted_intr.h" + #include "vmcs.h" + #include "vmx_ops.h" + #include "../cpuid.h" +diff --git a/arch/x86/kvm/vmx/vmx_onhyperv.c b/arch/x86/kvm/vmx/vmx_onhyperv.c +new file mode 100644 +index 0000000000000..b9a8b91166d02 +--- /dev/null ++++ b/arch/x86/kvm/vmx/vmx_onhyperv.c +@@ -0,0 +1,36 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++ ++#include "capabilities.h" ++#include "vmx_onhyperv.h" ++ ++DEFINE_STATIC_KEY_FALSE(__kvm_is_using_evmcs); ++ ++/* ++ * KVM on Hyper-V always uses the latest known eVMCSv1 revision, the assumption ++ * is: in case a feature has corresponding fields in eVMCS described and it was ++ * exposed in VMX feature MSRs, KVM is free to use it. Warn if KVM meets a ++ * feature which has no corresponding eVMCS field, this likely means that KVM ++ * needs to be updated. ++ */ ++#define evmcs_check_vmcs_conf(field, ctrl) \ ++ do { \ ++ typeof(vmcs_conf->field) unsupported; \ ++ \ ++ unsupported = vmcs_conf->field & ~EVMCS1_SUPPORTED_ ## ctrl; \ ++ if (unsupported) { \ ++ pr_warn_once(#field " unsupported with eVMCS: 0x%llx\n",\ ++ (u64)unsupported); \ ++ vmcs_conf->field &= EVMCS1_SUPPORTED_ ## ctrl; \ ++ } \ ++ } \ ++ while (0) ++ ++void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf) ++{ ++ evmcs_check_vmcs_conf(cpu_based_exec_ctrl, EXEC_CTRL); ++ evmcs_check_vmcs_conf(pin_based_exec_ctrl, PINCTRL); ++ evmcs_check_vmcs_conf(cpu_based_2nd_exec_ctrl, 2NDEXEC); ++ evmcs_check_vmcs_conf(cpu_based_3rd_exec_ctrl, 3RDEXEC); ++ evmcs_check_vmcs_conf(vmentry_ctrl, VMENTRY_CTRL); ++ evmcs_check_vmcs_conf(vmexit_ctrl, VMEXIT_CTRL); ++} +diff --git a/arch/x86/kvm/vmx/vmx_onhyperv.h b/arch/x86/kvm/vmx/vmx_onhyperv.h +new file mode 100644 +index 0000000000000..11541d272dbd8 +--- /dev/null ++++ b/arch/x86/kvm/vmx/vmx_onhyperv.h +@@ -0,0 +1,124 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++ ++#ifndef __ARCH_X86_KVM_VMX_ONHYPERV_H__ ++#define __ARCH_X86_KVM_VMX_ONHYPERV_H__ ++ ++#include ++ ++#include ++ ++#include "capabilities.h" ++#include "hyperv.h" ++#include "vmcs12.h" ++ ++#define current_evmcs ((struct hv_enlightened_vmcs *)this_cpu_read(current_vmcs)) ++ ++#if IS_ENABLED(CONFIG_HYPERV) ++ ++DECLARE_STATIC_KEY_FALSE(__kvm_is_using_evmcs); ++ ++static __always_inline bool kvm_is_using_evmcs(void) ++{ ++ return static_branch_unlikely(&__kvm_is_using_evmcs); ++} ++ ++static __always_inline int get_evmcs_offset(unsigned long field, ++ u16 *clean_field) ++{ ++ int offset = evmcs_field_offset(field, clean_field); ++ ++ WARN_ONCE(offset < 0, "accessing unsupported EVMCS field %lx\n", field); ++ return offset; ++} ++ ++static __always_inline void evmcs_write64(unsigned long field, u64 value) ++{ ++ u16 clean_field; ++ int offset = get_evmcs_offset(field, &clean_field); ++ ++ if (offset < 0) ++ return; ++ ++ *(u64 *)((char *)current_evmcs + offset) = value; ++ ++ current_evmcs->hv_clean_fields &= ~clean_field; ++} ++ ++static __always_inline void evmcs_write32(unsigned long field, u32 value) ++{ ++ u16 clean_field; ++ int offset = get_evmcs_offset(field, &clean_field); ++ ++ if (offset < 0) ++ return; ++ ++ *(u32 *)((char *)current_evmcs + offset) = value; ++ current_evmcs->hv_clean_fields &= ~clean_field; ++} ++ ++static __always_inline void evmcs_write16(unsigned long field, u16 value) ++{ ++ u16 clean_field; ++ int offset = get_evmcs_offset(field, &clean_field); ++ ++ if (offset < 0) ++ return; ++ ++ *(u16 *)((char *)current_evmcs + offset) = value; ++ current_evmcs->hv_clean_fields &= ~clean_field; ++} ++ ++static __always_inline u64 evmcs_read64(unsigned long field) ++{ ++ int offset = get_evmcs_offset(field, NULL); ++ ++ if (offset < 0) ++ return 0; ++ ++ return *(u64 *)((char *)current_evmcs + offset); ++} ++ ++static __always_inline u32 evmcs_read32(unsigned long field) ++{ ++ int offset = get_evmcs_offset(field, NULL); ++ ++ if (offset < 0) ++ return 0; ++ ++ return *(u32 *)((char *)current_evmcs + offset); ++} ++ ++static __always_inline u16 evmcs_read16(unsigned long field) ++{ ++ int offset = get_evmcs_offset(field, NULL); ++ ++ if (offset < 0) ++ return 0; ++ ++ return *(u16 *)((char *)current_evmcs + offset); ++} ++ ++static inline void evmcs_load(u64 phys_addr) ++{ ++ struct hv_vp_assist_page *vp_ap = ++ hv_get_vp_assist_page(smp_processor_id()); ++ ++ if (current_evmcs->hv_enlightenments_control.nested_flush_hypercall) ++ vp_ap->nested_control.features.directhypercall = 1; ++ vp_ap->current_nested_vmcs = phys_addr; ++ vp_ap->enlighten_vmentry = 1; ++} ++ ++void evmcs_sanitize_exec_ctrls(struct vmcs_config *vmcs_conf); ++#else /* !IS_ENABLED(CONFIG_HYPERV) */ ++static __always_inline bool kvm_is_using_evmcs(void) { return false; } ++static __always_inline void evmcs_write64(unsigned long field, u64 value) {} ++static __always_inline void evmcs_write32(unsigned long field, u32 value) {} ++static __always_inline void evmcs_write16(unsigned long field, u16 value) {} ++static __always_inline u64 evmcs_read64(unsigned long field) { return 0; } ++static __always_inline u32 evmcs_read32(unsigned long field) { return 0; } ++static __always_inline u16 evmcs_read16(unsigned long field) { return 0; } ++static inline void evmcs_load(u64 phys_addr) {} ++#endif /* IS_ENABLED(CONFIG_HYPERV) */ ++ ++#endif /* __ARCH_X86_KVM_VMX_ONHYPERV_H__ */ +diff --git a/arch/x86/kvm/vmx/vmx_ops.h b/arch/x86/kvm/vmx/vmx_ops.h +index 6a0c6e81f7f3e..8060e5fc6dbd8 100644 +--- a/arch/x86/kvm/vmx/vmx_ops.h ++++ b/arch/x86/kvm/vmx/vmx_ops.h +@@ -6,7 +6,7 @@ + + #include + +-#include "hyperv.h" ++#include "vmx_onhyperv.h" + #include "vmcs.h" + #include "../x86.h" + +diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c +index 3da3c266a66f3..a936219aebb81 100644 +--- a/drivers/bluetooth/btintel.c ++++ b/drivers/bluetooth/btintel.c +@@ -2845,6 +2845,9 @@ static int btintel_setup_combined(struct hci_dev *hdev) + btintel_set_dsm_reset_method(hdev, &ver_tlv); + + err = btintel_bootloader_setup_tlv(hdev, &ver_tlv); ++ if (err) ++ goto exit_error; ++ + btintel_register_devcoredump_support(hdev); + break; + default: +diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c +index 84d7033e5efe8..ef51dfb39baa9 100644 +--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c ++++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c +@@ -40,10 +40,14 @@ struct qcom_cpufreq_match_data { + const char **genpd_names; + }; + ++struct qcom_cpufreq_drv_cpu { ++ int opp_token; ++}; ++ + struct qcom_cpufreq_drv { +- int *opp_tokens; + u32 versions; + const struct qcom_cpufreq_match_data *data; ++ struct qcom_cpufreq_drv_cpu cpus[]; + }; + + static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev; +@@ -243,42 +247,39 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) + return -ENOENT; + } + +- drv = kzalloc(sizeof(*drv), GFP_KERNEL); +- if (!drv) ++ drv = devm_kzalloc(&pdev->dev, struct_size(drv, cpus, num_possible_cpus()), ++ GFP_KERNEL); ++ if (!drv) { ++ of_node_put(np); + return -ENOMEM; ++ } + + match = pdev->dev.platform_data; + drv->data = match->data; + if (!drv->data) { +- ret = -ENODEV; +- goto free_drv; ++ of_node_put(np); ++ return -ENODEV; + } + + if (drv->data->get_version) { + speedbin_nvmem = of_nvmem_cell_get(np, NULL); + if (IS_ERR(speedbin_nvmem)) { +- ret = dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem), +- "Could not get nvmem cell\n"); +- goto free_drv; ++ of_node_put(np); ++ return dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem), ++ "Could not get nvmem cell\n"); + } + + ret = drv->data->get_version(cpu_dev, + speedbin_nvmem, &pvs_name, drv); + if (ret) { ++ of_node_put(np); + nvmem_cell_put(speedbin_nvmem); +- goto free_drv; ++ return ret; + } + nvmem_cell_put(speedbin_nvmem); + } + of_node_put(np); + +- drv->opp_tokens = kcalloc(num_possible_cpus(), sizeof(*drv->opp_tokens), +- GFP_KERNEL); +- if (!drv->opp_tokens) { +- ret = -ENOMEM; +- goto free_drv; +- } +- + for_each_possible_cpu(cpu) { + struct dev_pm_opp_config config = { + .supported_hw = NULL, +@@ -304,9 +305,9 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) + } + + if (config.supported_hw || config.genpd_names) { +- drv->opp_tokens[cpu] = dev_pm_opp_set_config(cpu_dev, &config); +- if (drv->opp_tokens[cpu] < 0) { +- ret = drv->opp_tokens[cpu]; ++ drv->cpus[cpu].opp_token = dev_pm_opp_set_config(cpu_dev, &config); ++ if (drv->cpus[cpu].opp_token < 0) { ++ ret = drv->cpus[cpu].opp_token; + dev_err(cpu_dev, "Failed to set OPP config\n"); + goto free_opp; + } +@@ -325,11 +326,7 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) + + free_opp: + for_each_possible_cpu(cpu) +- dev_pm_opp_clear_config(drv->opp_tokens[cpu]); +- kfree(drv->opp_tokens); +-free_drv: +- kfree(drv); +- ++ dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); + return ret; + } + +@@ -341,10 +338,7 @@ static void qcom_cpufreq_remove(struct platform_device *pdev) + platform_device_unregister(cpufreq_dt_pdev); + + for_each_possible_cpu(cpu) +- dev_pm_opp_clear_config(drv->opp_tokens[cpu]); +- +- kfree(drv->opp_tokens); +- kfree(drv); ++ dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); + } + + static struct platform_driver qcom_cpufreq_driver = { +diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c +index 793f1a7ad5e34..53fdfd32a7e77 100644 +--- a/drivers/dma/fsl-edma-common.c ++++ b/drivers/dma/fsl-edma-common.c +@@ -3,6 +3,7 @@ + // Copyright (c) 2013-2014 Freescale Semiconductor, Inc + // Copyright (c) 2017 Sysam, Angelo Dureghello + ++#include + #include + #include + #include +@@ -74,18 +75,10 @@ static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) + + flags = fsl_edma_drvflags(fsl_chan); + val = edma_readl_chreg(fsl_chan, ch_sbr); +- /* Remote/local swapped wrongly on iMX8 QM Audio edma */ +- if (flags & FSL_EDMA_DRV_QUIRK_SWAPPED) { +- if (!fsl_chan->is_rxchan) +- val |= EDMA_V3_CH_SBR_RD; +- else +- val |= EDMA_V3_CH_SBR_WR; +- } else { +- if (fsl_chan->is_rxchan) +- val |= EDMA_V3_CH_SBR_RD; +- else +- val |= EDMA_V3_CH_SBR_WR; +- } ++ if (fsl_chan->is_rxchan) ++ val |= EDMA_V3_CH_SBR_RD; ++ else ++ val |= EDMA_V3_CH_SBR_WR; + + if (fsl_chan->is_remote) + val &= ~(EDMA_V3_CH_SBR_RD | EDMA_V3_CH_SBR_WR); +@@ -97,8 +90,8 @@ static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) + * ch_mux: With the exception of 0, attempts to write a value + * already in use will be forced to 0. + */ +- if (!edma_readl_chreg(fsl_chan, ch_mux)) +- edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux); ++ if (!edma_readl(fsl_chan->edma, fsl_chan->mux_addr)) ++ edma_writel(fsl_chan->edma, fsl_chan->srcid, fsl_chan->mux_addr); + } + + val = edma_readl_chreg(fsl_chan, ch_csr); +@@ -134,7 +127,7 @@ static void fsl_edma3_disable_request(struct fsl_edma_chan *fsl_chan) + flags = fsl_edma_drvflags(fsl_chan); + + if (flags & FSL_EDMA_DRV_HAS_CHMUX) +- edma_writel_chreg(fsl_chan, 0, ch_mux); ++ edma_writel(fsl_chan->edma, 0, fsl_chan->mux_addr); + + val &= ~EDMA_V3_CH_CSR_ERQ; + edma_writel_chreg(fsl_chan, val, ch_csr); +@@ -754,6 +747,8 @@ struct dma_async_tx_descriptor *fsl_edma_prep_memcpy(struct dma_chan *chan, + fsl_desc->iscyclic = false; + + fsl_chan->is_sw = true; ++ if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_MEM_REMOTE) ++ fsl_chan->is_remote = true; + + /* To match with copy_align and max_seg_size so 1 tcd is enough */ + fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[0].vtcd, dma_src, dma_dst, +@@ -802,6 +797,9 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) + { + struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); + ++ if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) ++ clk_prepare_enable(fsl_chan->clk); ++ + fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev, + sizeof(struct fsl_edma_hw_tcd), + 32, 0); +@@ -829,6 +827,9 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) + fsl_chan->tcd_pool = NULL; + fsl_chan->is_sw = false; + fsl_chan->srcid = 0; ++ fsl_chan->is_remote = false; ++ if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) ++ clk_disable_unprepare(fsl_chan->clk); + } + + void fsl_edma_cleanup_vchan(struct dma_device *dmadev) +diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h +index 92fe53faa53b1..6028389de408b 100644 +--- a/drivers/dma/fsl-edma-common.h ++++ b/drivers/dma/fsl-edma-common.h +@@ -146,6 +146,7 @@ struct fsl_edma_chan { + enum dma_data_direction dma_dir; + char chan_name[32]; + struct fsl_edma_hw_tcd __iomem *tcd; ++ void __iomem *mux_addr; + u32 real_count; + struct work_struct issue_worker; + struct platform_device *pdev; +@@ -177,8 +178,7 @@ struct fsl_edma_desc { + #define FSL_EDMA_DRV_HAS_PD BIT(5) + #define FSL_EDMA_DRV_HAS_CHCLK BIT(6) + #define FSL_EDMA_DRV_HAS_CHMUX BIT(7) +-/* imx8 QM audio edma remote local swapped */ +-#define FSL_EDMA_DRV_QUIRK_SWAPPED BIT(8) ++#define FSL_EDMA_DRV_MEM_REMOTE BIT(8) + /* control and status register is in tcd address space, edma3 reg layout */ + #define FSL_EDMA_DRV_SPLIT_REG BIT(9) + #define FSL_EDMA_DRV_BUS_8BYTE BIT(10) +@@ -207,6 +207,8 @@ struct fsl_edma_drvdata { + u32 chreg_off; + u32 chreg_space_sz; + u32 flags; ++ u32 mux_off; /* channel mux register offset */ ++ u32 mux_skip; /* how much skip for each channel */ + int (*setup_irq)(struct platform_device *pdev, + struct fsl_edma_engine *fsl_edma); + }; +diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c +index 42a338cbe6143..8a0ae90548997 100644 +--- a/drivers/dma/fsl-edma-main.c ++++ b/drivers/dma/fsl-edma-main.c +@@ -340,16 +340,19 @@ static struct fsl_edma_drvdata imx7ulp_data = { + }; + + static struct fsl_edma_drvdata imx8qm_data = { +- .flags = FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, ++ .flags = FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3 | FSL_EDMA_DRV_MEM_REMOTE, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, + .setup_irq = fsl_edma3_irq_init, + }; + +-static struct fsl_edma_drvdata imx8qm_audio_data = { +- .flags = FSL_EDMA_DRV_QUIRK_SWAPPED | FSL_EDMA_DRV_HAS_PD | FSL_EDMA_DRV_EDMA3, ++static struct fsl_edma_drvdata imx8ulp_data = { ++ .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_CHCLK | FSL_EDMA_DRV_HAS_DMACLK | ++ FSL_EDMA_DRV_EDMA3, + .chreg_space_sz = 0x10000, + .chreg_off = 0x10000, ++ .mux_off = 0x10000 + offsetof(struct fsl_edma3_ch_reg, ch_mux), ++ .mux_skip = 0x10000, + .setup_irq = fsl_edma3_irq_init, + }; + +@@ -364,6 +367,8 @@ static struct fsl_edma_drvdata imx93_data4 = { + .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA4, + .chreg_space_sz = 0x8000, + .chreg_off = 0x10000, ++ .mux_off = 0x10000 + offsetof(struct fsl_edma3_ch_reg, ch_mux), ++ .mux_skip = 0x8000, + .setup_irq = fsl_edma3_irq_init, + }; + +@@ -372,7 +377,7 @@ static const struct of_device_id fsl_edma_dt_ids[] = { + { .compatible = "fsl,ls1028a-edma", .data = &ls1028a_data}, + { .compatible = "fsl,imx7ulp-edma", .data = &imx7ulp_data}, + { .compatible = "fsl,imx8qm-edma", .data = &imx8qm_data}, +- { .compatible = "fsl,imx8qm-adma", .data = &imx8qm_audio_data}, ++ { .compatible = "fsl,imx8ulp-edma", .data = &imx8ulp_data}, + { .compatible = "fsl,imx93-edma3", .data = &imx93_data3}, + { .compatible = "fsl,imx93-edma4", .data = &imx93_data4}, + { /* sentinel */ } +@@ -427,6 +432,7 @@ static int fsl_edma_probe(struct platform_device *pdev) + struct fsl_edma_engine *fsl_edma; + const struct fsl_edma_drvdata *drvdata = NULL; + u32 chan_mask[2] = {0, 0}; ++ char clk_name[36]; + struct edma_regs *regs; + int chans; + int ret, i; +@@ -540,12 +546,23 @@ static int fsl_edma_probe(struct platform_device *pdev) + offsetof(struct fsl_edma3_ch_reg, tcd) : 0; + fsl_chan->tcd = fsl_edma->membase + + i * drvdata->chreg_space_sz + drvdata->chreg_off + len; ++ fsl_chan->mux_addr = fsl_edma->membase + drvdata->mux_off + i * drvdata->mux_skip; + ++ if (drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) { ++ snprintf(clk_name, sizeof(clk_name), "ch%02d", i); ++ fsl_chan->clk = devm_clk_get_enabled(&pdev->dev, ++ (const char *)clk_name); ++ ++ if (IS_ERR(fsl_chan->clk)) ++ return PTR_ERR(fsl_chan->clk); ++ } + fsl_chan->pdev = pdev; + vchan_init(&fsl_chan->vchan, &fsl_edma->dma_dev); + + edma_write_tcdreg(fsl_chan, 0, csr); + fsl_edma_chan_mux(fsl_chan, 0, false); ++ if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_HAS_CHCLK) ++ clk_disable_unprepare(fsl_chan->clk); + } + + ret = fsl_edma->drvdata->setup_irq(pdev, fsl_edma); +diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig +index b59e3041fd627..f0e9f250669e2 100644 +--- a/drivers/firmware/Kconfig ++++ b/drivers/firmware/Kconfig +@@ -229,6 +229,7 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT + config SYSFB + bool + select BOOT_VESA_SUPPORT ++ select SCREEN_INFO + + config SYSFB_SIMPLEFB + bool "Mark VGA/VBE/EFI FB as generic system framebuffer" +diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c +index 3c197db42c9d9..defd7a36cb08a 100644 +--- a/drivers/firmware/sysfb.c ++++ b/drivers/firmware/sysfb.c +@@ -77,6 +77,8 @@ static __init int sysfb_init(void) + bool compatible; + int ret = 0; + ++ screen_info_apply_fixups(); ++ + mutex_lock(&disable_lock); + if (disabled) + goto unlock_mutex; +diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c +index d0255ea98348d..247e7d675e2b9 100644 +--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c ++++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c +@@ -1556,7 +1556,7 @@ static void skl_wrpll_params_populate(struct skl_wrpll_params *params, + } + + static int +-skl_ddi_calculate_wrpll(int clock /* in Hz */, ++skl_ddi_calculate_wrpll(int clock, + int ref_clock, + struct skl_wrpll_params *wrpll_params) + { +@@ -1581,7 +1581,7 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */, + }; + unsigned int dco, d, i; + unsigned int p0, p1, p2; +- u64 afe_clock = clock * 5; /* AFE Clock is 5x Pixel clock */ ++ u64 afe_clock = (u64)clock * 1000 * 5; /* AFE Clock is 5x Pixel clock, in Hz */ + + for (d = 0; d < ARRAY_SIZE(dividers); d++) { + for (dco = 0; dco < ARRAY_SIZE(dco_central_freq); dco++) { +@@ -1713,7 +1713,7 @@ static int skl_ddi_hdmi_pll_dividers(struct intel_crtc_state *crtc_state) + + ctrl1 |= DPLL_CTRL1_HDMI_MODE(0); + +- ret = skl_ddi_calculate_wrpll(crtc_state->port_clock * 1000, ++ ret = skl_ddi_calculate_wrpll(crtc_state->port_clock, + i915->display.dpll.ref_clks.nssc, &wrpll_params); + if (ret) + return ret; +diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_regs.h b/drivers/gpu/drm/i915/display/intel_hdcp_regs.h +index 8023c85c7fa0e..74059384892af 100644 +--- a/drivers/gpu/drm/i915/display/intel_hdcp_regs.h ++++ b/drivers/gpu/drm/i915/display/intel_hdcp_regs.h +@@ -249,7 +249,7 @@ + #define HDCP2_STREAM_STATUS(dev_priv, trans, port) \ + (GRAPHICS_VER(dev_priv) >= 12 ? \ + TRANS_HDCP2_STREAM_STATUS(trans) : \ +- PIPE_HDCP2_STREAM_STATUS(pipe)) ++ PIPE_HDCP2_STREAM_STATUS(port)) + + #define _PORTA_HDCP2_AUTH_STREAM 0x66F00 + #define _PORTB_HDCP2_AUTH_STREAM 0x66F04 +diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c +index 3f90403d86cb4..0808b54d3c518 100644 +--- a/drivers/gpu/drm/i915/i915_perf.c ++++ b/drivers/gpu/drm/i915/i915_perf.c +@@ -2781,26 +2781,6 @@ oa_configure_all_contexts(struct i915_perf_stream *stream, + return 0; + } + +-static int +-gen12_configure_all_contexts(struct i915_perf_stream *stream, +- const struct i915_oa_config *oa_config, +- struct i915_active *active) +-{ +- struct flex regs[] = { +- { +- GEN8_R_PWR_CLK_STATE(RENDER_RING_BASE), +- CTX_R_PWR_CLK_STATE, +- }, +- }; +- +- if (stream->engine->class != RENDER_CLASS) +- return 0; +- +- return oa_configure_all_contexts(stream, +- regs, ARRAY_SIZE(regs), +- active); +-} +- + static int + lrc_configure_all_contexts(struct i915_perf_stream *stream, + const struct i915_oa_config *oa_config, +@@ -2907,7 +2887,6 @@ gen12_enable_metric_set(struct i915_perf_stream *stream, + { + struct drm_i915_private *i915 = stream->perf->i915; + struct intel_uncore *uncore = stream->uncore; +- struct i915_oa_config *oa_config = stream->oa_config; + bool periodic = stream->periodic; + u32 period_exponent = stream->period_exponent; + u32 sqcnt1; +@@ -2951,15 +2930,6 @@ gen12_enable_metric_set(struct i915_perf_stream *stream, + + intel_uncore_rmw(uncore, GEN12_SQCNT1, 0, sqcnt1); + +- /* +- * Update all contexts prior writing the mux configurations as we need +- * to make sure all slices/subslices are ON before writing to NOA +- * registers. +- */ +- ret = gen12_configure_all_contexts(stream, oa_config, active); +- if (ret) +- return ret; +- + /* + * For Gen12, performance counters are context + * saved/restored. Only enable it for the context that +@@ -3014,9 +2984,6 @@ static void gen12_disable_metric_set(struct i915_perf_stream *stream) + _MASKED_BIT_DISABLE(GEN12_DISABLE_DOP_GATING)); + } + +- /* Reset all contexts' slices/subslices configurations. */ +- gen12_configure_all_contexts(stream, NULL, NULL); +- + /* disable the context save/restore or OAR counters */ + if (stream->ctx) + gen12_configure_oar_context(stream, NULL); +diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c +index 1b2ff0c40fc1c..6c599a9f49ee4 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_prime.c ++++ b/drivers/gpu/drm/nouveau/nouveau_prime.c +@@ -64,7 +64,8 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev, + * to the caller, instead of a normal nouveau_bo ttm reference. */ + ret = drm_gem_object_init(dev, &nvbo->bo.base, size); + if (ret) { +- nouveau_bo_ref(NULL, &nvbo); ++ drm_gem_object_release(&nvbo->bo.base); ++ kfree(nvbo); + obj = ERR_PTR(-ENOMEM); + goto unlock; + } +diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c b/drivers/gpu/drm/virtio/virtgpu_submit.c +index 5c514946bbad9..d530c058f53e2 100644 +--- a/drivers/gpu/drm/virtio/virtgpu_submit.c ++++ b/drivers/gpu/drm/virtio/virtgpu_submit.c +@@ -48,7 +48,7 @@ struct virtio_gpu_submit { + static int virtio_gpu_do_fence_wait(struct virtio_gpu_submit *submit, + struct dma_fence *in_fence) + { +- u32 context = submit->fence_ctx + submit->ring_idx; ++ u64 context = submit->fence_ctx + submit->ring_idx; + + if (dma_fence_match_context(in_fence, context)) + return 0; +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +index 5efc6a766f64e..588d50ababf60 100644 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +@@ -32,7 +32,6 @@ + #define VMW_FENCE_WRAP (1 << 31) + + struct vmw_fence_manager { +- int num_fence_objects; + struct vmw_private *dev_priv; + spinlock_t lock; + struct list_head fence_list; +@@ -124,13 +123,13 @@ static void vmw_fence_obj_destroy(struct dma_fence *f) + { + struct vmw_fence_obj *fence = + container_of(f, struct vmw_fence_obj, base); +- + struct vmw_fence_manager *fman = fman_from_fence(fence); + +- spin_lock(&fman->lock); +- list_del_init(&fence->head); +- --fman->num_fence_objects; +- spin_unlock(&fman->lock); ++ if (!list_empty(&fence->head)) { ++ spin_lock(&fman->lock); ++ list_del_init(&fence->head); ++ spin_unlock(&fman->lock); ++ } + fence->destroy(fence); + } + +@@ -257,7 +256,6 @@ static const struct dma_fence_ops vmw_fence_ops = { + .release = vmw_fence_obj_destroy, + }; + +- + /* + * Execute signal actions on fences recently signaled. + * This is done from a workqueue so we don't have to execute +@@ -355,7 +353,6 @@ static int vmw_fence_obj_init(struct vmw_fence_manager *fman, + goto out_unlock; + } + list_add_tail(&fence->head, &fman->fence_list); +- ++fman->num_fence_objects; + + out_unlock: + spin_unlock(&fman->lock); +@@ -403,7 +400,7 @@ static bool vmw_fence_goal_new_locked(struct vmw_fence_manager *fman, + u32 passed_seqno) + { + u32 goal_seqno; +- struct vmw_fence_obj *fence; ++ struct vmw_fence_obj *fence, *next_fence; + + if (likely(!fman->seqno_valid)) + return false; +@@ -413,7 +410,7 @@ static bool vmw_fence_goal_new_locked(struct vmw_fence_manager *fman, + return false; + + fman->seqno_valid = false; +- list_for_each_entry(fence, &fman->fence_list, head) { ++ list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) { + if (!list_empty(&fence->seq_passed_actions)) { + fman->seqno_valid = true; + vmw_fence_goal_write(fman->dev_priv, +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +index c45b4724e4141..e20f64b67b266 100644 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +@@ -92,7 +92,7 @@ static int vmw_overlay_send_put(struct vmw_private *dev_priv, + { + struct vmw_escape_video_flush *flush; + size_t fifo_size; +- bool have_so = (dev_priv->active_display_unit == vmw_du_screen_object); ++ bool have_so = (dev_priv->active_display_unit != vmw_du_legacy); + int i, num_items; + SVGAGuestPtr ptr; + +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +index 4ccab07faff08..cb03c589ab226 100644 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +@@ -868,6 +868,32 @@ vmw_stdu_connector_mode_valid(struct drm_connector *connector, + return MODE_OK; + } + ++/* ++ * Trigger a modeset if the X,Y position of the Screen Target changes. ++ * This is needed when multi-mon is cycled. The original Screen Target will have ++ * the same mode but its relative X,Y position in the topology will change. ++ */ ++static int vmw_stdu_connector_atomic_check(struct drm_connector *conn, ++ struct drm_atomic_state *state) ++{ ++ struct drm_connector_state *conn_state; ++ struct vmw_screen_target_display_unit *du; ++ struct drm_crtc_state *new_crtc_state; ++ ++ conn_state = drm_atomic_get_connector_state(state, conn); ++ du = vmw_connector_to_stdu(conn); ++ ++ if (!conn_state->crtc) ++ return 0; ++ ++ new_crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); ++ if (du->base.gui_x != du->base.set_gui_x || ++ du->base.gui_y != du->base.set_gui_y) ++ new_crtc_state->mode_changed = true; ++ ++ return 0; ++} ++ + static const struct drm_connector_funcs vmw_stdu_connector_funcs = { + .dpms = vmw_du_connector_dpms, + .detect = vmw_du_connector_detect, +@@ -882,7 +908,8 @@ static const struct drm_connector_funcs vmw_stdu_connector_funcs = { + static const struct + drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = { + .get_modes = vmw_connector_get_modes, +- .mode_valid = vmw_stdu_connector_mode_valid ++ .mode_valid = vmw_stdu_connector_mode_valid, ++ .atomic_check = vmw_stdu_connector_atomic_check, + }; + + +diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +index bdb578e0899f5..4b59687ff5d82 100644 +--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c ++++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +@@ -288,12 +288,22 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) + mp2_ops->start(privdata, info); + cl_data->sensor_sts[i] = amd_sfh_wait_for_response + (privdata, cl_data->sensor_idx[i], SENSOR_ENABLED); ++ ++ if (cl_data->sensor_sts[i] == SENSOR_ENABLED) ++ cl_data->is_any_sensor_enabled = true; ++ } ++ ++ if (!cl_data->is_any_sensor_enabled || ++ (mp2_ops->discovery_status && mp2_ops->discovery_status(privdata) == 0)) { ++ dev_warn(dev, "Failed to discover, sensors not enabled is %d\n", ++ cl_data->is_any_sensor_enabled); ++ rc = -EOPNOTSUPP; ++ goto cleanup; + } + + for (i = 0; i < cl_data->num_hid_devices; i++) { + cl_data->cur_hid_dev = i; + if (cl_data->sensor_sts[i] == SENSOR_ENABLED) { +- cl_data->is_any_sensor_enabled = true; + rc = amdtp_hid_probe(i, cl_data); + if (rc) + goto cleanup; +@@ -305,12 +315,6 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) + cl_data->sensor_sts[i]); + } + +- if (!cl_data->is_any_sensor_enabled || +- (mp2_ops->discovery_status && mp2_ops->discovery_status(privdata) == 0)) { +- dev_warn(dev, "Failed to discover, sensors not enabled is %d\n", cl_data->is_any_sensor_enabled); +- rc = -EOPNOTSUPP; +- goto cleanup; +- } + schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP)); + return 0; + +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index 002cbaa16bd16..d2fe14ce423e2 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -714,13 +714,12 @@ static int wacom_intuos_get_tool_type(int tool_id) + case 0x8e2: /* IntuosHT2 pen */ + case 0x022: + case 0x200: /* Pro Pen 3 */ +- case 0x04200: /* Pro Pen 3 */ + case 0x10842: /* MobileStudio Pro Pro Pen slim */ + case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ + case 0x16802: /* Cintiq 13HD Pro Pen */ + case 0x18802: /* DTH2242 Pen */ + case 0x10802: /* Intuos4/5 13HD/24HD General Pen */ +- case 0x80842: /* Intuos Pro and Cintiq Pro 3D Pen */ ++ case 0x8842: /* Intuos Pro and Cintiq Pro 3D Pen */ + tool_type = BTN_TOOL_PEN; + break; + +diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c +index 4f5829b726a75..72fd2fe8f6fe8 100644 +--- a/drivers/leds/led-triggers.c ++++ b/drivers/leds/led-triggers.c +@@ -194,11 +194,24 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig) + spin_unlock(&trig->leddev_list_lock); + led_cdev->trigger = trig; + ++ /* ++ * Some activate() calls use led_trigger_event() to initialize ++ * the brightness of the LED for which the trigger is being set. ++ * Ensure the led_cdev is visible on trig->led_cdevs for this. ++ */ ++ synchronize_rcu(); ++ ++ /* ++ * If "set brightness to 0" is pending in workqueue, ++ * we don't want that to be reordered after ->activate() ++ */ ++ flush_work(&led_cdev->set_brightness_work); ++ ++ ret = 0; + if (trig->activate) + ret = trig->activate(led_cdev); + else +- ret = 0; +- ++ led_set_brightness(led_cdev, trig->brightness); + if (ret) + goto err_activate; + +@@ -269,19 +282,6 @@ void led_trigger_set_default(struct led_classdev *led_cdev) + } + EXPORT_SYMBOL_GPL(led_trigger_set_default); + +-void led_trigger_rename_static(const char *name, struct led_trigger *trig) +-{ +- /* new name must be on a temporary string to prevent races */ +- BUG_ON(name == trig->name); +- +- down_write(&triggers_list_lock); +- /* this assumes that trig->name was originaly allocated to +- * non constant storage */ +- strcpy((char *)trig->name, name); +- up_write(&triggers_list_lock); +-} +-EXPORT_SYMBOL_GPL(led_trigger_rename_static); +- + /* LED Trigger Interface */ + + int led_trigger_register(struct led_trigger *trig) +@@ -386,6 +386,8 @@ void led_trigger_event(struct led_trigger *trig, + if (!trig) + return; + ++ trig->brightness = brightness; ++ + rcu_read_lock(); + list_for_each_entry_rcu(led_cdev, &trig->led_cdevs, trig_list) + led_set_brightness(led_cdev, brightness); +diff --git a/drivers/leds/trigger/ledtrig-timer.c b/drivers/leds/trigger/ledtrig-timer.c +index b4688d1d9d2b2..1d213c999d40a 100644 +--- a/drivers/leds/trigger/ledtrig-timer.c ++++ b/drivers/leds/trigger/ledtrig-timer.c +@@ -110,11 +110,6 @@ static int timer_trig_activate(struct led_classdev *led_cdev) + led_cdev->flags &= ~LED_INIT_DEFAULT_TRIGGER; + } + +- /* +- * If "set brightness to 0" is pending in workqueue, we don't +- * want that to be reordered after blink_set() +- */ +- flush_work(&led_cdev->set_brightness_work); + led_blink_set(led_cdev, &led_cdev->blink_delay_on, + &led_cdev->blink_delay_off); + +diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c +index 24c914015973e..49b1fa9651161 100644 +--- a/drivers/net/ethernet/intel/ice/ice_txrx.c ++++ b/drivers/net/ethernet/intel/ice/ice_txrx.c +@@ -456,7 +456,7 @@ void ice_free_rx_ring(struct ice_rx_ring *rx_ring) + if (rx_ring->vsi->type == ICE_VSI_PF) + if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); +- rx_ring->xdp_prog = NULL; ++ WRITE_ONCE(rx_ring->xdp_prog, NULL); + if (rx_ring->xsk_pool) { + kfree(rx_ring->xdp_buf); + rx_ring->xdp_buf = NULL; +diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c +index f53566cb6bfbd..67511153081ae 100644 +--- a/drivers/net/ethernet/intel/ice/ice_xsk.c ++++ b/drivers/net/ethernet/intel/ice/ice_xsk.c +@@ -52,10 +52,8 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, u16 q_idx) + static void ice_qp_clean_rings(struct ice_vsi *vsi, u16 q_idx) + { + ice_clean_tx_ring(vsi->tx_rings[q_idx]); +- if (ice_is_xdp_ena_vsi(vsi)) { +- synchronize_rcu(); ++ if (ice_is_xdp_ena_vsi(vsi)) + ice_clean_tx_ring(vsi->xdp_rings[q_idx]); +- } + ice_clean_rx_ring(vsi->rx_rings[q_idx]); + } + +@@ -180,11 +178,12 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) + usleep_range(1000, 2000); + } + ++ synchronize_net(); ++ netif_tx_stop_queue(netdev_get_tx_queue(vsi->netdev, q_idx)); ++ + ice_qvec_dis_irq(vsi, rx_ring, q_vector); + ice_qvec_toggle_napi(vsi, q_vector, false); + +- netif_tx_stop_queue(netdev_get_tx_queue(vsi->netdev, q_idx)); +- + ice_fill_txq_meta(vsi, tx_ring, &txq_meta); + err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, tx_ring, &txq_meta); + if (err) +@@ -199,10 +198,8 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) + if (err) + return err; + } +- err = ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, true); +- if (err) +- return err; + ++ ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, false); + ice_qp_clean_rings(vsi, q_idx); + ice_qp_reset_stats(vsi, q_idx); + +@@ -1068,6 +1065,10 @@ bool ice_xmit_zc(struct ice_tx_ring *xdp_ring) + + ice_clean_xdp_irq_zc(xdp_ring); + ++ if (!netif_carrier_ok(xdp_ring->vsi->netdev) || ++ !netif_running(xdp_ring->vsi->netdev)) ++ return true; ++ + budget = ICE_DESC_UNUSED(xdp_ring); + budget = min_t(u16, budget, ICE_RING_QUARTER(xdp_ring)); + +@@ -1111,7 +1112,7 @@ ice_xsk_wakeup(struct net_device *netdev, u32 queue_id, + struct ice_vsi *vsi = np->vsi; + struct ice_tx_ring *ring; + +- if (test_bit(ICE_VSI_DOWN, vsi->state)) ++ if (test_bit(ICE_VSI_DOWN, vsi->state) || !netif_carrier_ok(netdev)) + return -ENETDOWN; + + if (!ice_is_xdp_ena_vsi(vsi)) +diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c +index e83700ad7e622..d80bbcdeb93ed 100644 +--- a/drivers/net/ethernet/intel/igc/igc_main.c ++++ b/drivers/net/ethernet/intel/igc/igc_main.c +@@ -6208,21 +6208,6 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter, + size_t n; + int i; + +- switch (qopt->cmd) { +- case TAPRIO_CMD_REPLACE: +- break; +- case TAPRIO_CMD_DESTROY: +- return igc_tsn_clear_schedule(adapter); +- case TAPRIO_CMD_STATS: +- igc_taprio_stats(adapter->netdev, &qopt->stats); +- return 0; +- case TAPRIO_CMD_QUEUE_STATS: +- igc_taprio_queue_stats(adapter->netdev, &qopt->queue_stats); +- return 0; +- default: +- return -EOPNOTSUPP; +- } +- + if (qopt->base_time < 0) + return -ERANGE; + +@@ -6331,7 +6316,23 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter, + if (hw->mac.type != igc_i225) + return -EOPNOTSUPP; + +- err = igc_save_qbv_schedule(adapter, qopt); ++ switch (qopt->cmd) { ++ case TAPRIO_CMD_REPLACE: ++ err = igc_save_qbv_schedule(adapter, qopt); ++ break; ++ case TAPRIO_CMD_DESTROY: ++ err = igc_tsn_clear_schedule(adapter); ++ break; ++ case TAPRIO_CMD_STATS: ++ igc_taprio_stats(adapter->netdev, &qopt->stats); ++ return 0; ++ case TAPRIO_CMD_QUEUE_STATS: ++ igc_taprio_queue_stats(adapter->netdev, &qopt->queue_stats); ++ return 0; ++ default: ++ return -EOPNOTSUPP; ++ } ++ + if (err) + return err; + +diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +index 05f4aa11b95c3..34051c9abd97d 100644 +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +@@ -953,13 +953,13 @@ static void mvpp2_bm_pool_update_fc(struct mvpp2_port *port, + static void mvpp2_bm_pool_update_priv_fc(struct mvpp2 *priv, bool en) + { + struct mvpp2_port *port; +- int i; ++ int i, j; + + for (i = 0; i < priv->port_count; i++) { + port = priv->port_list[i]; + if (port->priv->percpu_pools) { +- for (i = 0; i < port->nrxqs; i++) +- mvpp2_bm_pool_update_fc(port, &port->priv->bm_pools[i], ++ for (j = 0; j < port->nrxqs; j++) ++ mvpp2_bm_pool_update_fc(port, &port->priv->bm_pools[j], + port->tx_fc & en); + } else { + mvpp2_bm_pool_update_fc(port, port->pool_long, port->tx_fc & en); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +index fadfa8b50bebe..8c4e3ecef5901 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +@@ -920,6 +920,7 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv, + mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, mh); + mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + err_mod_hdr: ++ *attr = *old_attr; + kfree(old_attr); + err_attr: + kvfree(spec); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +index ce29e31721208..de83567aae791 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +@@ -50,9 +50,10 @@ u32 mlx5_ipsec_device_caps(struct mlx5_core_dev *mdev) + MLX5_CAP_FLOWTABLE_NIC_RX(mdev, decap)) + caps |= MLX5_IPSEC_CAP_PACKET_OFFLOAD; + +- if ((MLX5_CAP_FLOWTABLE_NIC_TX(mdev, ignore_flow_level) && +- MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ignore_flow_level)) || +- MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, ignore_flow_level)) ++ if (IS_ENABLED(CONFIG_MLX5_CLS_ACT) && ++ ((MLX5_CAP_FLOWTABLE_NIC_TX(mdev, ignore_flow_level) && ++ MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ignore_flow_level)) || ++ MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, ignore_flow_level))) + caps |= MLX5_IPSEC_CAP_PRIO; + + if (MLX5_CAP_FLOWTABLE_NIC_TX(mdev, +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +index 38263d5c98b34..50db127e6371b 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +@@ -1223,7 +1223,12 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, + if (!an_changes && link_modes == eproto.admin) + goto out; + +- mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext); ++ err = mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext); ++ if (err) { ++ netdev_err(priv->netdev, "%s: failed to set ptys reg: %d\n", __func__, err); ++ goto out; ++ } ++ + mlx5_toggle_port_link(mdev); + + out: +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +index 3a9cdf79403ae..6b17346aa4cef 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +@@ -206,6 +206,7 @@ int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev) + static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unloaded) + { + struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; ++ struct devlink *devlink = priv_to_devlink(dev); + + /* if this is the driver that initiated the fw reset, devlink completed the reload */ + if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) { +@@ -217,9 +218,11 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unload + mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n"); + else + mlx5_load_one(dev, true); +- devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0, ++ devl_lock(devlink); ++ devlink_remote_reload_actions_performed(devlink, 0, + BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | + BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE)); ++ devl_unlock(devlink); + } + } + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c +index 612e666ec2635..e2230c8f18152 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c +@@ -48,6 +48,7 @@ static struct mlx5_irq * + irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_desc) + { + struct irq_affinity_desc auto_desc = {}; ++ struct mlx5_irq *irq; + u32 irq_index; + int err; + +@@ -64,9 +65,12 @@ irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_de + else + cpu_get(pool, cpumask_first(&af_desc->mask)); + } +- return mlx5_irq_alloc(pool, irq_index, +- cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc, +- NULL); ++ irq = mlx5_irq_alloc(pool, irq_index, ++ cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc, ++ NULL); ++ if (IS_ERR(irq)) ++ xa_erase(&pool->irqs, irq_index); ++ return irq; + } + + /* Looking for the IRQ with the smallest refcount that fits req_mask. +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +index dfc2ba6f780a2..18cf756bad8cc 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +@@ -1512,7 +1512,7 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev, + goto unlock; + + for (i = 0; i < ldev->ports; i++) { +- if (ldev->pf[MLX5_LAG_P1].netdev == slave) { ++ if (ldev->pf[i].netdev == slave) { + port = i; + break; + } +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c +index 2237b3d01e0e5..11f11248feb8b 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c +@@ -2130,7 +2130,6 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) + /* Panic tear down fw command will stop the PCI bus communication + * with the HCA, so the health poll is no longer needed. + */ +- mlx5_drain_health_wq(dev); + mlx5_stop_health_poll(dev, false); + + ret = mlx5_cmd_fast_teardown_hca(dev); +@@ -2165,6 +2164,7 @@ static void shutdown(struct pci_dev *pdev) + + mlx5_core_info(dev, "Shutdown was called\n"); + set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state); ++ mlx5_drain_health_wq(dev); + err = mlx5_try_fast_unload(dev); + if (err) + mlx5_unload_one(dev, false); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c +index 30218f37d5285..2028acbe85ca2 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c +@@ -90,6 +90,7 @@ static void mlx5_sf_dev_shutdown(struct auxiliary_device *adev) + struct mlx5_core_dev *mdev = sf_dev->mdev; + + set_bit(MLX5_BREAK_FW_WAIT, &mdev->intf_state); ++ mlx5_drain_health_wq(mdev); + mlx5_unload_one(mdev, false); + } + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index d759f3373b175..8a732edac15a0 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -4256,7 +4256,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, + if (unlikely(!rtl_tx_slots_avail(tp))) { + if (net_ratelimit()) + netdev_err(dev, "BUG! Tx Ring full when queue awake!\n"); +- goto err_stop_0; ++ netif_stop_queue(dev); ++ return NETDEV_TX_BUSY; + } + + opts[1] = rtl8169_tx_vlan_tag(skb); +@@ -4312,11 +4313,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, + dev_kfree_skb_any(skb); + dev->stats.tx_dropped++; + return NETDEV_TX_OK; +- +-err_stop_0: +- netif_stop_queue(dev); +- dev->stats.tx_dropped++; +- return NETDEV_TX_BUSY; + } + + static unsigned int rtl_last_frag_len(struct sk_buff *skb) +diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +index 3297aff969c80..11e08cb8d3c3e 100644 +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +@@ -1826,9 +1826,9 @@ static void axienet_dma_err_handler(struct work_struct *work) + ~(XAE_OPTION_TXEN | XAE_OPTION_RXEN)); + axienet_set_mac_address(ndev, NULL); + axienet_set_multicast_list(ndev); +- axienet_setoptions(ndev, lp->options); + napi_enable(&lp->napi_rx); + napi_enable(&lp->napi_tx); ++ axienet_setoptions(ndev, lp->options); + } + + /** +diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c +index 029c82f88ee38..9a0432145645f 100644 +--- a/drivers/net/phy/micrel.c ++++ b/drivers/net/phy/micrel.c +@@ -1293,6 +1293,8 @@ static int ksz9131_config_init(struct phy_device *phydev) + const struct device *dev_walker; + int ret; + ++ phydev->mdix_ctrl = ETH_TP_MDI_AUTO; ++ + dev_walker = &phydev->mdio.dev; + do { + of_node = dev_walker->of_node; +@@ -1342,28 +1344,30 @@ static int ksz9131_config_init(struct phy_device *phydev) + #define MII_KSZ9131_AUTO_MDIX 0x1C + #define MII_KSZ9131_AUTO_MDI_SET BIT(7) + #define MII_KSZ9131_AUTO_MDIX_SWAP_OFF BIT(6) ++#define MII_KSZ9131_DIG_AXAN_STS 0x14 ++#define MII_KSZ9131_DIG_AXAN_STS_LINK_DET BIT(14) ++#define MII_KSZ9131_DIG_AXAN_STS_A_SELECT BIT(12) + + static int ksz9131_mdix_update(struct phy_device *phydev) + { + int ret; + +- ret = phy_read(phydev, MII_KSZ9131_AUTO_MDIX); +- if (ret < 0) +- return ret; +- +- if (ret & MII_KSZ9131_AUTO_MDIX_SWAP_OFF) { +- if (ret & MII_KSZ9131_AUTO_MDI_SET) +- phydev->mdix_ctrl = ETH_TP_MDI; +- else +- phydev->mdix_ctrl = ETH_TP_MDI_X; ++ if (phydev->mdix_ctrl != ETH_TP_MDI_AUTO) { ++ phydev->mdix = phydev->mdix_ctrl; + } else { +- phydev->mdix_ctrl = ETH_TP_MDI_AUTO; +- } ++ ret = phy_read(phydev, MII_KSZ9131_DIG_AXAN_STS); ++ if (ret < 0) ++ return ret; + +- if (ret & MII_KSZ9131_AUTO_MDI_SET) +- phydev->mdix = ETH_TP_MDI; +- else +- phydev->mdix = ETH_TP_MDI_X; ++ if (ret & MII_KSZ9131_DIG_AXAN_STS_LINK_DET) { ++ if (ret & MII_KSZ9131_DIG_AXAN_STS_A_SELECT) ++ phydev->mdix = ETH_TP_MDI; ++ else ++ phydev->mdix = ETH_TP_MDI_X; ++ } else { ++ phydev->mdix = ETH_TP_MDI_INVALID; ++ } ++ } + + return 0; + } +diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c +index 337899c69738e..2604d9663a5b2 100644 +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1083,6 +1083,13 @@ static struct phy_driver realtek_drvs[] = { + .handle_interrupt = genphy_handle_interrupt_no_ack, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ }, { ++ PHY_ID_MATCH_EXACT(0x001cc960), ++ .name = "RTL8366S Gigabit Ethernet", ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ .read_mmd = genphy_read_mmd_unsupported, ++ .write_mmd = genphy_write_mmd_unsupported, + }, + }; + +diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c +index 0a662e42ed965..cb7d2f798fb43 100644 +--- a/drivers/net/usb/sr9700.c ++++ b/drivers/net/usb/sr9700.c +@@ -179,6 +179,7 @@ static int sr_mdio_read(struct net_device *netdev, int phy_id, int loc) + struct usbnet *dev = netdev_priv(netdev); + __le16 res; + int rc = 0; ++ int err; + + if (phy_id) { + netdev_dbg(netdev, "Only internal phy supported\n"); +@@ -189,11 +190,17 @@ static int sr_mdio_read(struct net_device *netdev, int phy_id, int loc) + if (loc == MII_BMSR) { + u8 value; + +- sr_read_reg(dev, SR_NSR, &value); ++ err = sr_read_reg(dev, SR_NSR, &value); ++ if (err < 0) ++ return err; ++ + if (value & NSR_LINKST) + rc = 1; + } +- sr_share_read_word(dev, 1, loc, &res); ++ err = sr_share_read_word(dev, 1, loc, &res); ++ if (err < 0) ++ return err; ++ + if (rc == 1) + res = le16_to_cpu(res) | BMSR_LSTATUS; + else +diff --git a/drivers/pci/search.c b/drivers/pci/search.c +index b4c138a6ec025..53840634fbfc2 100644 +--- a/drivers/pci/search.c ++++ b/drivers/pci/search.c +@@ -363,6 +363,37 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) + } + EXPORT_SYMBOL(pci_get_class); + ++/** ++ * pci_get_base_class - searching for a PCI device by matching against the base class code only ++ * @class: search for a PCI device with this base class code ++ * @from: Previous PCI device found in search, or %NULL for new search. ++ * ++ * Iterates through the list of known PCI devices. If a PCI device is found ++ * with a matching base class code, the reference count to the device is ++ * incremented. See pci_match_one_device() to figure out how does this works. ++ * A new search is initiated by passing %NULL as the @from argument. ++ * Otherwise if @from is not %NULL, searches continue from next device on the ++ * global list. The reference count for @from is always decremented if it is ++ * not %NULL. ++ * ++ * Returns: ++ * A pointer to a matched PCI device, %NULL Otherwise. ++ */ ++struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from) ++{ ++ struct pci_device_id id = { ++ .vendor = PCI_ANY_ID, ++ .device = PCI_ANY_ID, ++ .subvendor = PCI_ANY_ID, ++ .subdevice = PCI_ANY_ID, ++ .class_mask = 0xFF0000, ++ .class = class << 16, ++ }; ++ ++ return pci_get_dev_by_id(&id, from); ++} ++EXPORT_SYMBOL(pci_get_base_class); ++ + /** + * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. + * @ids: A pointer to a null terminated list of struct pci_device_id structures +diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c +index 5cf770a1bc312..4f6eade522024 100644 +--- a/drivers/perf/fsl_imx9_ddr_perf.c ++++ b/drivers/perf/fsl_imx9_ddr_perf.c +@@ -476,12 +476,12 @@ static int ddr_perf_event_add(struct perf_event *event, int flags) + hwc->idx = counter; + hwc->state |= PERF_HES_STOPPED; + +- if (flags & PERF_EF_START) +- ddr_perf_event_start(event, flags); +- + /* read trans, write trans, read beat */ + ddr_perf_monitor_config(pmu, cfg, cfg1, cfg2); + ++ if (flags & PERF_EF_START) ++ ddr_perf_event_start(event, flags); ++ + return 0; + } + +diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c +index ae16ecb15f2d9..901da688ea3f8 100644 +--- a/drivers/perf/riscv_pmu_sbi.c ++++ b/drivers/perf/riscv_pmu_sbi.c +@@ -355,7 +355,7 @@ static int pmu_sbi_ctr_get_idx(struct perf_event *event) + * but not in the user access mode as we want to use the other counters + * that support sampling/filtering. + */ +- if (hwc->flags & PERF_EVENT_FLAG_LEGACY) { ++ if ((hwc->flags & PERF_EVENT_FLAG_LEGACY) && (event->attr.type == PERF_TYPE_HARDWARE)) { + if (event->attr.config == PERF_COUNT_HW_CPU_CYCLES) { + cflags |= SBI_PMU_CFG_FLAG_SKIP_MATCH; + cmask = 1; +diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c +index 475a6dd72db6b..809fabef3b44a 100644 +--- a/drivers/platform/chrome/cros_ec_proto.c ++++ b/drivers/platform/chrome/cros_ec_proto.c +@@ -805,9 +805,11 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, + if (ret == -ENOPROTOOPT) { + dev_dbg(ec_dev->dev, + "GET_NEXT_EVENT returned invalid version error.\n"); ++ mutex_lock(&ec_dev->lock); + ret = cros_ec_get_host_command_version_mask(ec_dev, + EC_CMD_GET_NEXT_EVENT, + &ver_mask); ++ mutex_unlock(&ec_dev->lock); + if (ret < 0 || ver_mask == 0) + /* + * Do not change the MKBP supported version if we can't +diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c +index 3acc9288b3105..3b1030fc4fbfe 100644 +--- a/drivers/thermal/broadcom/bcm2835_thermal.c ++++ b/drivers/thermal/broadcom/bcm2835_thermal.c +@@ -185,7 +185,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) + return err; + } + +- data->clk = devm_clk_get(&pdev->dev, NULL); ++ data->clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(data->clk)) { + err = PTR_ERR(data->clk); + if (err != -EPROBE_DEFER) +@@ -193,10 +193,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) + return err; + } + +- err = clk_prepare_enable(data->clk); +- if (err) +- return err; +- + rate = clk_get_rate(data->clk); + if ((rate < 1920000) || (rate > 5000000)) + dev_warn(&pdev->dev, +@@ -211,7 +207,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) + dev_err(&pdev->dev, + "Failed to register the thermal device: %d\n", + err); +- goto err_clk; ++ return err; + } + + /* +@@ -236,7 +232,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) + dev_err(&pdev->dev, + "Not able to read trip_temp: %d\n", + err); +- goto err_tz; ++ return err; + } + + /* set bandgap reference voltage and enable voltage regulator */ +@@ -269,32 +265,23 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) + */ + err = thermal_add_hwmon_sysfs(tz); + if (err) +- goto err_tz; ++ return err; + + bcm2835_thermal_debugfs(pdev); + + return 0; +-err_tz: +- devm_thermal_of_zone_unregister(&pdev->dev, tz); +-err_clk: +- clk_disable_unprepare(data->clk); +- +- return err; + } + +-static int bcm2835_thermal_remove(struct platform_device *pdev) ++static void bcm2835_thermal_remove(struct platform_device *pdev) + { + struct bcm2835_thermal_data *data = platform_get_drvdata(pdev); + + debugfs_remove_recursive(data->debugfsdir); +- clk_disable_unprepare(data->clk); +- +- return 0; + } + + static struct platform_driver bcm2835_thermal_driver = { + .probe = bcm2835_thermal_probe, +- .remove = bcm2835_thermal_remove, ++ .remove_new = bcm2835_thermal_remove, + .driver = { + .name = "bcm2835_thermal", + .of_match_table = bcm2835_thermal_of_match_table, +diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig +index b694d7669d320..1eb755a94940a 100644 +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -11,6 +11,10 @@ config APERTURE_HELPERS + Support tracking and hand-over of aperture ownership. Required + by graphics drivers for firmware-provided framebuffers. + ++config SCREEN_INFO ++ bool ++ default n ++ + config STI_CORE + bool + depends on PARISC +diff --git a/drivers/video/Makefile b/drivers/video/Makefile +index 6bbc039508995..6bbf87c1b579e 100644 +--- a/drivers/video/Makefile ++++ b/drivers/video/Makefile +@@ -1,12 +1,16 @@ + # SPDX-License-Identifier: GPL-2.0 + + obj-$(CONFIG_APERTURE_HELPERS) += aperture.o ++obj-$(CONFIG_SCREEN_INFO) += screen_info.o + obj-$(CONFIG_STI_CORE) += sticore.o + obj-$(CONFIG_VGASTATE) += vgastate.o + obj-$(CONFIG_VIDEO_CMDLINE) += cmdline.o + obj-$(CONFIG_VIDEO_NOMODESET) += nomodeset.o + obj-$(CONFIG_HDMI) += hdmi.o + ++screen_info-y := screen_info_generic.o ++screen_info-$(CONFIG_PCI) += screen_info_pci.o ++ + obj-$(CONFIG_VT) += console/ + obj-$(CONFIG_FB_STI) += console/ + obj-$(CONFIG_LOGO) += logo/ +diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c +index c0edceea0a793..a21581b40256c 100644 +--- a/drivers/video/fbdev/vesafb.c ++++ b/drivers/video/fbdev/vesafb.c +@@ -243,6 +243,7 @@ static int vesafb_setup(char *options) + + static int vesafb_probe(struct platform_device *dev) + { ++ struct screen_info *si = &screen_info; + struct fb_info *info; + struct vesafb_par *par; + int i, err; +@@ -255,17 +256,17 @@ static int vesafb_probe(struct platform_device *dev) + fb_get_options("vesafb", &option); + vesafb_setup(option); + +- if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) ++ if (si->orig_video_isVGA != VIDEO_TYPE_VLFB) + return -ENODEV; + +- vga_compat = (screen_info.capabilities & 2) ? 0 : 1; +- vesafb_fix.smem_start = screen_info.lfb_base; +- vesafb_defined.bits_per_pixel = screen_info.lfb_depth; ++ vga_compat = !__screen_info_vbe_mode_nonvga(si); ++ vesafb_fix.smem_start = si->lfb_base; ++ vesafb_defined.bits_per_pixel = si->lfb_depth; + if (15 == vesafb_defined.bits_per_pixel) + vesafb_defined.bits_per_pixel = 16; +- vesafb_defined.xres = screen_info.lfb_width; +- vesafb_defined.yres = screen_info.lfb_height; +- vesafb_fix.line_length = screen_info.lfb_linelength; ++ vesafb_defined.xres = si->lfb_width; ++ vesafb_defined.yres = si->lfb_height; ++ vesafb_fix.line_length = si->lfb_linelength; + vesafb_fix.visual = (vesafb_defined.bits_per_pixel == 8) ? + FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; + +@@ -277,7 +278,7 @@ static int vesafb_probe(struct platform_device *dev) + /* size_total -- all video memory we have. Used for mtrr + * entries, resource allocation and bounds + * checking. */ +- size_total = screen_info.lfb_size * 65536; ++ size_total = si->lfb_size * 65536; + if (vram_total) + size_total = vram_total * 1024 * 1024; + if (size_total < size_vmode) +@@ -297,7 +298,7 @@ static int vesafb_probe(struct platform_device *dev) + vesafb_fix.smem_len = size_remap; + + #ifndef __i386__ +- screen_info.vesapm_seg = 0; ++ si->vesapm_seg = 0; + #endif + + if (!request_mem_region(vesafb_fix.smem_start, size_total, "vesafb")) { +@@ -317,23 +318,26 @@ static int vesafb_probe(struct platform_device *dev) + par = info->par; + info->pseudo_palette = par->pseudo_palette; + +- par->base = screen_info.lfb_base; ++ par->base = si->lfb_base; + par->size = size_total; + + printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n", +- vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, vesafb_fix.line_length, screen_info.pages); ++ vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, ++ vesafb_fix.line_length, si->pages); + +- if (screen_info.vesapm_seg) { ++ if (si->vesapm_seg) { + printk(KERN_INFO "vesafb: protected mode interface info at %04x:%04x\n", +- screen_info.vesapm_seg,screen_info.vesapm_off); ++ si->vesapm_seg, si->vesapm_off); + } + +- if (screen_info.vesapm_seg < 0xc000) ++ if (si->vesapm_seg < 0xc000) + ypan = pmi_setpal = 0; /* not available or some DOS TSR ... */ + + if (ypan || pmi_setpal) { ++ unsigned long pmi_phys; + unsigned short *pmi_base; +- pmi_base = (unsigned short*)phys_to_virt(((unsigned long)screen_info.vesapm_seg << 4) + screen_info.vesapm_off); ++ pmi_phys = ((unsigned long)si->vesapm_seg << 4) + si->vesapm_off; ++ pmi_base = (unsigned short *)phys_to_virt(pmi_phys); + pmi_start = (void*)((char*)pmi_base + pmi_base[1]); + pmi_pal = (void*)((char*)pmi_base + pmi_base[2]); + printk(KERN_INFO "vesafb: pmi: set display start = %p, set palette = %p\n",pmi_start,pmi_pal); +@@ -377,14 +381,14 @@ static int vesafb_probe(struct platform_device *dev) + vesafb_defined.left_margin = (vesafb_defined.xres / 8) & 0xf8; + vesafb_defined.hsync_len = (vesafb_defined.xres / 8) & 0xf8; + +- vesafb_defined.red.offset = screen_info.red_pos; +- vesafb_defined.red.length = screen_info.red_size; +- vesafb_defined.green.offset = screen_info.green_pos; +- vesafb_defined.green.length = screen_info.green_size; +- vesafb_defined.blue.offset = screen_info.blue_pos; +- vesafb_defined.blue.length = screen_info.blue_size; +- vesafb_defined.transp.offset = screen_info.rsvd_pos; +- vesafb_defined.transp.length = screen_info.rsvd_size; ++ vesafb_defined.red.offset = si->red_pos; ++ vesafb_defined.red.length = si->red_size; ++ vesafb_defined.green.offset = si->green_pos; ++ vesafb_defined.green.length = si->green_size; ++ vesafb_defined.blue.offset = si->blue_pos; ++ vesafb_defined.blue.length = si->blue_size; ++ vesafb_defined.transp.offset = si->rsvd_pos; ++ vesafb_defined.transp.length = si->rsvd_size; + + if (vesafb_defined.bits_per_pixel <= 8) { + depth = vesafb_defined.green.length; +@@ -399,14 +403,14 @@ static int vesafb_probe(struct platform_device *dev) + (vesafb_defined.bits_per_pixel > 8) ? + "Truecolor" : (vga_compat || pmi_setpal) ? + "Pseudocolor" : "Static Pseudocolor", +- screen_info.rsvd_size, +- screen_info.red_size, +- screen_info.green_size, +- screen_info.blue_size, +- screen_info.rsvd_pos, +- screen_info.red_pos, +- screen_info.green_pos, +- screen_info.blue_pos); ++ si->rsvd_size, ++ si->red_size, ++ si->green_size, ++ si->blue_size, ++ si->rsvd_pos, ++ si->red_pos, ++ si->green_pos, ++ si->blue_pos); + + vesafb_fix.ypanstep = ypan ? 1 : 0; + vesafb_fix.ywrapstep = (ypan>1) ? 1 : 0; +diff --git a/drivers/video/screen_info_generic.c b/drivers/video/screen_info_generic.c +new file mode 100644 +index 0000000000000..64117c6367abb +--- /dev/null ++++ b/drivers/video/screen_info_generic.c +@@ -0,0 +1,146 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++ ++static void resource_init_named(struct resource *r, ++ resource_size_t start, resource_size_t size, ++ const char *name, unsigned int flags) ++{ ++ memset(r, 0, sizeof(*r)); ++ ++ r->start = start; ++ r->end = start + size - 1; ++ r->name = name; ++ r->flags = flags; ++} ++ ++static void resource_init_io_named(struct resource *r, ++ resource_size_t start, resource_size_t size, ++ const char *name) ++{ ++ resource_init_named(r, start, size, name, IORESOURCE_IO); ++} ++ ++static void resource_init_mem_named(struct resource *r, ++ resource_size_t start, resource_size_t size, ++ const char *name) ++{ ++ resource_init_named(r, start, size, name, IORESOURCE_MEM); ++} ++ ++static inline bool __screen_info_has_ega_gfx(unsigned int mode) ++{ ++ switch (mode) { ++ case 0x0d: /* 320x200-4 */ ++ case 0x0e: /* 640x200-4 */ ++ case 0x0f: /* 640x350-1 */ ++ case 0x10: /* 640x350-4 */ ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static inline bool __screen_info_has_vga_gfx(unsigned int mode) ++{ ++ switch (mode) { ++ case 0x10: /* 640x480-1 */ ++ case 0x12: /* 640x480-4 */ ++ case 0x13: /* 320-200-8 */ ++ case 0x6a: /* 800x600-4 (VESA) */ ++ return true; ++ default: ++ return __screen_info_has_ega_gfx(mode); ++ } ++} ++ ++/** ++ * screen_info_resources() - Get resources from screen_info structure ++ * @si: the screen_info ++ * @r: pointer to an array of resource structures ++ * @num: number of elements in @r: ++ * ++ * Returns: ++ * The number of resources stored in @r on success, or a negative errno code otherwise. ++ * ++ * A call to screen_info_resources() returns the resources consumed by the ++ * screen_info's device or framebuffer. The result is stored in the caller-supplied ++ * array @r with up to @num elements. The function returns the number of ++ * initialized elements. ++ */ ++ssize_t screen_info_resources(const struct screen_info *si, struct resource *r, size_t num) ++{ ++ struct resource *pos = r; ++ unsigned int type = screen_info_video_type(si); ++ u64 base, size; ++ ++ switch (type) { ++ case VIDEO_TYPE_MDA: ++ if (num > 0) ++ resource_init_io_named(pos++, 0x3b0, 12, "mda"); ++ if (num > 1) ++ resource_init_io_named(pos++, 0x3bf, 0x01, "mda"); ++ if (num > 2) ++ resource_init_mem_named(pos++, 0xb0000, 0x2000, "mda"); ++ break; ++ case VIDEO_TYPE_CGA: ++ if (num > 0) ++ resource_init_io_named(pos++, 0x3d4, 0x02, "cga"); ++ if (num > 1) ++ resource_init_mem_named(pos++, 0xb8000, 0x2000, "cga"); ++ break; ++ case VIDEO_TYPE_EGAM: ++ if (num > 0) ++ resource_init_io_named(pos++, 0x3bf, 0x10, "ega"); ++ if (num > 1) ++ resource_init_mem_named(pos++, 0xb0000, 0x8000, "ega"); ++ break; ++ case VIDEO_TYPE_EGAC: ++ if (num > 0) ++ resource_init_io_named(pos++, 0x3c0, 0x20, "ega"); ++ if (num > 1) { ++ if (__screen_info_has_ega_gfx(si->orig_video_mode)) ++ resource_init_mem_named(pos++, 0xa0000, 0x10000, "ega"); ++ else ++ resource_init_mem_named(pos++, 0xb8000, 0x8000, "ega"); ++ } ++ break; ++ case VIDEO_TYPE_VGAC: ++ if (num > 0) ++ resource_init_io_named(pos++, 0x3c0, 0x20, "vga+"); ++ if (num > 1) { ++ if (__screen_info_has_vga_gfx(si->orig_video_mode)) ++ resource_init_mem_named(pos++, 0xa0000, 0x10000, "vga+"); ++ else ++ resource_init_mem_named(pos++, 0xb8000, 0x8000, "vga+"); ++ } ++ break; ++ case VIDEO_TYPE_VLFB: ++ case VIDEO_TYPE_EFI: ++ base = __screen_info_lfb_base(si); ++ if (!base) ++ break; ++ size = __screen_info_lfb_size(si, type); ++ if (!size) ++ break; ++ if (num > 0) ++ resource_init_mem_named(pos++, base, size, "lfb"); ++ break; ++ case VIDEO_TYPE_PICA_S3: ++ case VIDEO_TYPE_MIPS_G364: ++ case VIDEO_TYPE_SGI: ++ case VIDEO_TYPE_TGAC: ++ case VIDEO_TYPE_SUN: ++ case VIDEO_TYPE_SUNPCI: ++ case VIDEO_TYPE_PMAC: ++ default: ++ /* not supported */ ++ return -EINVAL; ++ } ++ ++ return pos - r; ++} ++EXPORT_SYMBOL(screen_info_resources); +diff --git a/drivers/video/screen_info_pci.c b/drivers/video/screen_info_pci.c +new file mode 100644 +index 0000000000000..6c58335171410 +--- /dev/null ++++ b/drivers/video/screen_info_pci.c +@@ -0,0 +1,136 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++ ++static struct pci_dev *screen_info_lfb_pdev; ++static size_t screen_info_lfb_bar; ++static resource_size_t screen_info_lfb_offset; ++static struct resource screen_info_lfb_res = DEFINE_RES_MEM(0, 0); ++ ++static bool __screen_info_relocation_is_valid(const struct screen_info *si, struct resource *pr) ++{ ++ u64 size = __screen_info_lfb_size(si, screen_info_video_type(si)); ++ ++ if (screen_info_lfb_offset > resource_size(pr)) ++ return false; ++ if (size > resource_size(pr)) ++ return false; ++ if (resource_size(pr) - size < screen_info_lfb_offset) ++ return false; ++ ++ return true; ++} ++ ++void screen_info_apply_fixups(void) ++{ ++ struct screen_info *si = &screen_info; ++ ++ if (screen_info_lfb_pdev) { ++ struct resource *pr = &screen_info_lfb_pdev->resource[screen_info_lfb_bar]; ++ ++ if (pr->start != screen_info_lfb_res.start) { ++ if (__screen_info_relocation_is_valid(si, pr)) { ++ /* ++ * Only update base if we have an actual ++ * relocation to a valid I/O range. ++ */ ++ __screen_info_set_lfb_base(si, pr->start + screen_info_lfb_offset); ++ pr_info("Relocating firmware framebuffer to offset %pa[d] within %pr\n", ++ &screen_info_lfb_offset, pr); ++ } else { ++ pr_warn("Invalid relocating, disabling firmware framebuffer\n"); ++ } ++ } ++ } ++} ++ ++static void screen_info_fixup_lfb(struct pci_dev *pdev) ++{ ++ unsigned int type; ++ struct resource res[SCREEN_INFO_MAX_RESOURCES]; ++ size_t i, numres; ++ int ret; ++ const struct screen_info *si = &screen_info; ++ ++ if (screen_info_lfb_pdev) ++ return; // already found ++ ++ type = screen_info_video_type(si); ++ if (type != VIDEO_TYPE_EFI) ++ return; // only applies to EFI ++ ++ ret = screen_info_resources(si, res, ARRAY_SIZE(res)); ++ if (ret < 0) ++ return; ++ numres = ret; ++ ++ for (i = 0; i < numres; ++i) { ++ struct resource *r = &res[i]; ++ const struct resource *pr; ++ ++ if (!(r->flags & IORESOURCE_MEM)) ++ continue; ++ pr = pci_find_resource(pdev, r); ++ if (!pr) ++ continue; ++ ++ /* ++ * We've found a PCI device with the framebuffer ++ * resource. Store away the parameters to track ++ * relocation of the framebuffer aperture. ++ */ ++ screen_info_lfb_pdev = pdev; ++ screen_info_lfb_bar = pr - pdev->resource; ++ screen_info_lfb_offset = r->start - pr->start; ++ memcpy(&screen_info_lfb_res, r, sizeof(screen_info_lfb_res)); ++ } ++} ++DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY, 16, ++ screen_info_fixup_lfb); ++ ++static struct pci_dev *__screen_info_pci_dev(struct resource *res) ++{ ++ struct pci_dev *pdev = NULL; ++ const struct resource *r = NULL; ++ ++ if (!(res->flags & IORESOURCE_MEM)) ++ return NULL; ++ ++ while (!r && (pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) { ++ r = pci_find_resource(pdev, res); ++ } ++ ++ return pdev; ++} ++ ++/** ++ * screen_info_pci_dev() - Return PCI parent device that contains screen_info's framebuffer ++ * @si: the screen_info ++ * ++ * Returns: ++ * The screen_info's parent device or NULL on success, or a pointer-encoded ++ * errno value otherwise. The value NULL is not an error. It signals that no ++ * PCI device has been found. ++ */ ++struct pci_dev *screen_info_pci_dev(const struct screen_info *si) ++{ ++ struct resource res[SCREEN_INFO_MAX_RESOURCES]; ++ ssize_t i, numres; ++ ++ numres = screen_info_resources(si, res, ARRAY_SIZE(res)); ++ if (numres < 0) ++ return ERR_PTR(numres); ++ ++ for (i = 0; i < numres; ++i) { ++ struct pci_dev *pdev = __screen_info_pci_dev(&res[i]); ++ ++ if (pdev) ++ return pdev; ++ } ++ ++ return NULL; ++} ++EXPORT_SYMBOL(screen_info_pci_dev); +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c +index dd065349fae3a..4e999e1c14075 100644 +--- a/fs/btrfs/block-group.c ++++ b/fs/btrfs/block-group.c +@@ -1214,8 +1214,8 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, + block_group->space_info->total_bytes -= block_group->length; + block_group->space_info->bytes_readonly -= + (block_group->length - block_group->zone_unusable); +- block_group->space_info->bytes_zone_unusable -= +- block_group->zone_unusable; ++ btrfs_space_info_update_bytes_zone_unusable(fs_info, block_group->space_info, ++ -block_group->zone_unusable); + block_group->space_info->disk_total -= block_group->length * factor; + + spin_unlock(&block_group->space_info->lock); +@@ -1399,7 +1399,8 @@ static int inc_block_group_ro(struct btrfs_block_group *cache, int force) + if (btrfs_is_zoned(cache->fs_info)) { + /* Migrate zone_unusable bytes to readonly */ + sinfo->bytes_readonly += cache->zone_unusable; +- sinfo->bytes_zone_unusable -= cache->zone_unusable; ++ btrfs_space_info_update_bytes_zone_unusable(cache->fs_info, sinfo, ++ -cache->zone_unusable); + cache->zone_unusable = 0; + } + cache->ro++; +@@ -3023,9 +3024,11 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache) + if (btrfs_is_zoned(cache->fs_info)) { + /* Migrate zone_unusable bytes back */ + cache->zone_unusable = +- (cache->alloc_offset - cache->used) + ++ (cache->alloc_offset - cache->used - cache->pinned - ++ cache->reserved) + + (cache->length - cache->zone_capacity); +- sinfo->bytes_zone_unusable += cache->zone_unusable; ++ btrfs_space_info_update_bytes_zone_unusable(cache->fs_info, sinfo, ++ cache->zone_unusable); + sinfo->bytes_readonly -= cache->zone_unusable; + } + num_bytes = cache->length - cache->reserved - +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c +index b89b558b15926..c6ecfd05e1db9 100644 +--- a/fs/btrfs/extent-tree.c ++++ b/fs/btrfs/extent-tree.c +@@ -2749,7 +2749,8 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, + readonly = true; + } else if (btrfs_is_zoned(fs_info)) { + /* Need reset before reusing in a zoned block group */ +- space_info->bytes_zone_unusable += len; ++ btrfs_space_info_update_bytes_zone_unusable(fs_info, space_info, ++ len); + readonly = true; + } + spin_unlock(&cache->lock); +diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c +index dcfc0425115e9..f59e599766662 100644 +--- a/fs/btrfs/free-space-cache.c ++++ b/fs/btrfs/free-space-cache.c +@@ -2721,8 +2721,10 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group, + * If the block group is read-only, we should account freed space into + * bytes_readonly. + */ +- if (!block_group->ro) ++ if (!block_group->ro) { + block_group->zone_unusable += to_unusable; ++ WARN_ON(block_group->zone_unusable > block_group->length); ++ } + spin_unlock(&ctl->tree_lock); + if (!used) { + spin_lock(&block_group->lock); +diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c +index 3f7a9605e2d3a..581bdd709ee0d 100644 +--- a/fs/btrfs/space-info.c ++++ b/fs/btrfs/space-info.c +@@ -312,7 +312,7 @@ void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info, + found->bytes_used += block_group->used; + found->disk_used += block_group->used * factor; + found->bytes_readonly += block_group->bytes_super; +- found->bytes_zone_unusable += block_group->zone_unusable; ++ btrfs_space_info_update_bytes_zone_unusable(info, found, block_group->zone_unusable); + if (block_group->length > 0) + found->full = 0; + btrfs_try_granting_tickets(info, found); +@@ -524,8 +524,7 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info, + + spin_lock(&cache->lock); + avail = cache->length - cache->used - cache->pinned - +- cache->reserved - cache->delalloc_bytes - +- cache->bytes_super - cache->zone_unusable; ++ cache->reserved - cache->bytes_super - cache->zone_unusable; + btrfs_info(fs_info, + "block group %llu has %llu bytes, %llu used %llu pinned %llu reserved %llu delalloc %llu super %llu zone_unusable (%llu bytes available) %s", + cache->start, cache->length, cache->used, cache->pinned, +diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h +index 0bb9d14e60a82..08a3bd10addcf 100644 +--- a/fs/btrfs/space-info.h ++++ b/fs/btrfs/space-info.h +@@ -197,6 +197,7 @@ btrfs_space_info_update_##name(struct btrfs_fs_info *fs_info, \ + + DECLARE_SPACE_INFO_UPDATE(bytes_may_use, "space_info"); + DECLARE_SPACE_INFO_UPDATE(bytes_pinned, "pinned"); ++DECLARE_SPACE_INFO_UPDATE(bytes_zone_unusable, "zone_unusable"); + + int btrfs_init_space_info(struct btrfs_fs_info *fs_info); + void btrfs_add_bg_to_space_info(struct btrfs_fs_info *info, +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index d5eb8d44c6c81..cef119a2476bb 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -453,6 +453,35 @@ static void ext4_map_blocks_es_recheck(handle_t *handle, + } + #endif /* ES_AGGRESSIVE_TEST */ + ++static int ext4_map_query_blocks(handle_t *handle, struct inode *inode, ++ struct ext4_map_blocks *map) ++{ ++ unsigned int status; ++ int retval; ++ ++ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) ++ retval = ext4_ext_map_blocks(handle, inode, map, 0); ++ else ++ retval = ext4_ind_map_blocks(handle, inode, map, 0); ++ ++ if (retval <= 0) ++ return retval; ++ ++ if (unlikely(retval != map->m_len)) { ++ ext4_warning(inode->i_sb, ++ "ES len assertion failed for inode " ++ "%lu: retval %d != map->m_len %d", ++ inode->i_ino, retval, map->m_len); ++ WARN_ON(1); ++ } ++ ++ status = map->m_flags & EXT4_MAP_UNWRITTEN ? ++ EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; ++ ext4_es_insert_extent(inode, map->m_lblk, map->m_len, ++ map->m_pblk, status); ++ return retval; ++} ++ + /* + * The ext4_map_blocks() function tries to look up the requested blocks, + * and returns if the blocks are already mapped. +@@ -1705,12 +1734,10 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, + + /* Lookup extent status tree firstly */ + if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) { +- if (ext4_es_is_hole(&es)) { +- retval = 0; +- down_read(&EXT4_I(inode)->i_data_sem); ++ if (ext4_es_is_hole(&es)) + goto add_delayed; +- } + ++found: + /* + * Delayed extent could be allocated by fallocate. + * So we need to check it. +@@ -1747,49 +1774,42 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, + down_read(&EXT4_I(inode)->i_data_sem); + if (ext4_has_inline_data(inode)) + retval = 0; +- else if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) +- retval = ext4_ext_map_blocks(NULL, inode, map, 0); + else +- retval = ext4_ind_map_blocks(NULL, inode, map, 0); ++ retval = ext4_map_query_blocks(NULL, inode, map); ++ up_read(&EXT4_I(inode)->i_data_sem); ++ if (retval) ++ return retval; + + add_delayed: +- if (retval == 0) { +- int ret; +- +- /* +- * XXX: __block_prepare_write() unmaps passed block, +- * is it OK? +- */ +- +- ret = ext4_insert_delayed_block(inode, map->m_lblk); +- if (ret != 0) { +- retval = ret; +- goto out_unlock; ++ down_write(&EXT4_I(inode)->i_data_sem); ++ /* ++ * Page fault path (ext4_page_mkwrite does not take i_rwsem) ++ * and fallocate path (no folio lock) can race. Make sure we ++ * lookup the extent status tree here again while i_data_sem ++ * is held in write mode, before inserting a new da entry in ++ * the extent status tree. ++ */ ++ if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) { ++ if (!ext4_es_is_hole(&es)) { ++ up_write(&EXT4_I(inode)->i_data_sem); ++ goto found; + } +- +- map_bh(bh, inode->i_sb, invalid_block); +- set_buffer_new(bh); +- set_buffer_delay(bh); +- } else if (retval > 0) { +- unsigned int status; +- +- if (unlikely(retval != map->m_len)) { +- ext4_warning(inode->i_sb, +- "ES len assertion failed for inode " +- "%lu: retval %d != map->m_len %d", +- inode->i_ino, retval, map->m_len); +- WARN_ON(1); ++ } else if (!ext4_has_inline_data(inode)) { ++ retval = ext4_map_query_blocks(NULL, inode, map); ++ if (retval) { ++ up_write(&EXT4_I(inode)->i_data_sem); ++ return retval; + } +- +- status = map->m_flags & EXT4_MAP_UNWRITTEN ? +- EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; +- ext4_es_insert_extent(inode, map->m_lblk, map->m_len, +- map->m_pblk, status); + } + +-out_unlock: +- up_read((&EXT4_I(inode)->i_data_sem)); ++ retval = ext4_insert_delayed_block(inode, map->m_lblk); ++ up_write(&EXT4_I(inode)->i_data_sem); ++ if (retval) ++ return retval; + ++ map_bh(bh, inode->i_sb, invalid_block); ++ set_buffer_new(bh); ++ set_buffer_delay(bh); + return retval; + } + +diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c +index 22080606b8769..804958c6de34c 100644 +--- a/fs/f2fs/segment.c ++++ b/fs/f2fs/segment.c +@@ -3350,7 +3350,9 @@ static int __get_segment_type_6(struct f2fs_io_info *fio) + if (page_private_gcing(fio->page)) { + if (fio->sbi->am.atgc_enabled && + (fio->io_type == FS_DATA_IO) && +- (fio->sbi->gc_mode != GC_URGENT_HIGH)) ++ (fio->sbi->gc_mode != GC_URGENT_HIGH) && ++ __is_valid_data_blkaddr(fio->old_blkaddr) && ++ !is_inode_flag_set(inode, FI_OPU_WRITE)) + return CURSEG_ALL_DATA_ATGC; + else + return CURSEG_COLD_DATA; +diff --git a/fs/file.c b/fs/file.c +index a815f6eddc511..b64a84137c00f 100644 +--- a/fs/file.c ++++ b/fs/file.c +@@ -1124,6 +1124,7 @@ __releases(&files->file_lock) + * tables and this condition does not arise without those. + */ + fdt = files_fdtable(files); ++ fd = array_index_nospec(fd, fdt->max_fds); + tofree = fdt->fd[fd]; + if (!tofree && fd_is_open(fd, fdt)) + goto Ebusy; +diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c +index 5b5cdc747cef3..071a71eb1a2d4 100644 +--- a/fs/proc/proc_sysctl.c ++++ b/fs/proc/proc_sysctl.c +@@ -480,12 +480,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, + make_empty_dir_inode(inode); + } + ++ inode->i_uid = GLOBAL_ROOT_UID; ++ inode->i_gid = GLOBAL_ROOT_GID; + if (root->set_ownership) +- root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); +- else { +- inode->i_uid = GLOBAL_ROOT_UID; +- inode->i_gid = GLOBAL_ROOT_GID; +- } ++ root->set_ownership(head, &inode->i_uid, &inode->i_gid); + + return inode; + } +diff --git a/include/linux/leds.h b/include/linux/leds.h +index aa16dc2a8230f..d3056bc6f0a1a 100644 +--- a/include/linux/leds.h ++++ b/include/linux/leds.h +@@ -474,6 +474,9 @@ struct led_trigger { + int (*activate)(struct led_classdev *led_cdev); + void (*deactivate)(struct led_classdev *led_cdev); + ++ /* Brightness set by led_trigger_event */ ++ enum led_brightness brightness; ++ + /* LED-private triggers have this set */ + struct led_hw_trigger_type *trigger_type; + +@@ -527,22 +530,11 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev) + return led_cdev->trigger_data; + } + +-/** +- * led_trigger_rename_static - rename a trigger +- * @name: the new trigger name +- * @trig: the LED trigger to rename +- * +- * Change a LED trigger name by copying the string passed in +- * name into current trigger name, which MUST be large +- * enough for the new string. +- * +- * Note that name must NOT point to the same string used +- * during LED registration, as that could lead to races. +- * +- * This is meant to be used on triggers with statically +- * allocated name. +- */ +-void led_trigger_rename_static(const char *name, struct led_trigger *trig); ++static inline enum led_brightness ++led_trigger_get_brightness(const struct led_trigger *trigger) ++{ ++ return trigger ? trigger->brightness : LED_OFF; ++} + + #define module_led_trigger(__led_trigger) \ + module_driver(__led_trigger, led_trigger_register, \ +@@ -580,6 +572,12 @@ static inline void *led_get_trigger_data(struct led_classdev *led_cdev) + return NULL; + } + ++static inline enum led_brightness ++led_trigger_get_brightness(const struct led_trigger *trigger) ++{ ++ return LED_OFF; ++} ++ + #endif /* CONFIG_LEDS_TRIGGERS */ + + /* Trigger specific enum */ +diff --git a/include/linux/pci.h b/include/linux/pci.h +index f141300116219..7b18a4b3efb0e 100644 +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -1182,6 +1182,8 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); + struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, + unsigned int devfn); + struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); ++struct pci_dev *pci_get_base_class(unsigned int class, struct pci_dev *from); ++ + int pci_dev_present(const struct pci_device_id *ids); + + int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, +@@ -1958,6 +1960,9 @@ static inline struct pci_dev *pci_get_class(unsigned int class, + struct pci_dev *from) + { return NULL; } + ++static inline struct pci_dev *pci_get_base_class(unsigned int class, ++ struct pci_dev *from) ++{ return NULL; } + + static inline int pci_dev_present(const struct pci_device_id *ids) + { return 0; } +diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h +index eab7081392d50..6a4a3cec4638b 100644 +--- a/include/linux/screen_info.h ++++ b/include/linux/screen_info.h +@@ -4,6 +4,142 @@ + + #include + ++#include ++ ++/** ++ * SCREEN_INFO_MAX_RESOURCES - maximum number of resources per screen_info ++ */ ++#define SCREEN_INFO_MAX_RESOURCES 3 ++ ++struct pci_dev; ++struct resource; ++ ++static inline bool __screen_info_has_lfb(unsigned int type) ++{ ++ return (type == VIDEO_TYPE_VLFB) || (type == VIDEO_TYPE_EFI); ++} ++ ++static inline u64 __screen_info_lfb_base(const struct screen_info *si) ++{ ++ u64 lfb_base = si->lfb_base; ++ ++ if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) ++ lfb_base |= (u64)si->ext_lfb_base << 32; ++ ++ return lfb_base; ++} ++ ++static inline void __screen_info_set_lfb_base(struct screen_info *si, u64 lfb_base) ++{ ++ si->lfb_base = lfb_base & GENMASK_ULL(31, 0); ++ si->ext_lfb_base = (lfb_base & GENMASK_ULL(63, 32)) >> 32; ++ ++ if (si->ext_lfb_base) ++ si->capabilities |= VIDEO_CAPABILITY_64BIT_BASE; ++ else ++ si->capabilities &= ~VIDEO_CAPABILITY_64BIT_BASE; ++} ++ ++static inline u64 __screen_info_lfb_size(const struct screen_info *si, unsigned int type) ++{ ++ u64 lfb_size = si->lfb_size; ++ ++ if (type == VIDEO_TYPE_VLFB) ++ lfb_size <<= 16; ++ return lfb_size; ++} ++ ++static inline bool __screen_info_vbe_mode_nonvga(const struct screen_info *si) ++{ ++ /* ++ * VESA modes typically run on VGA hardware. Set bit 5 signals that this ++ * is not the case. Drivers can then not make use of VGA resources. See ++ * Sec 4.4 of the VBE 2.0 spec. ++ */ ++ return si->vesa_attributes & BIT(5); ++} ++ ++static inline unsigned int __screen_info_video_type(unsigned int type) ++{ ++ switch (type) { ++ case VIDEO_TYPE_MDA: ++ case VIDEO_TYPE_CGA: ++ case VIDEO_TYPE_EGAM: ++ case VIDEO_TYPE_EGAC: ++ case VIDEO_TYPE_VGAC: ++ case VIDEO_TYPE_VLFB: ++ case VIDEO_TYPE_PICA_S3: ++ case VIDEO_TYPE_MIPS_G364: ++ case VIDEO_TYPE_SGI: ++ case VIDEO_TYPE_TGAC: ++ case VIDEO_TYPE_SUN: ++ case VIDEO_TYPE_SUNPCI: ++ case VIDEO_TYPE_PMAC: ++ case VIDEO_TYPE_EFI: ++ return type; ++ default: ++ return 0; ++ } ++} ++ ++/** ++ * screen_info_video_type() - Decodes the video type from struct screen_info ++ * @si: an instance of struct screen_info ++ * ++ * Returns: ++ * A VIDEO_TYPE_ constant representing si's type of video display, or 0 otherwise. ++ */ ++static inline unsigned int screen_info_video_type(const struct screen_info *si) ++{ ++ unsigned int type; ++ ++ // check if display output is on ++ if (!si->orig_video_isVGA) ++ return 0; ++ ++ // check for a known VIDEO_TYPE_ constant ++ type = __screen_info_video_type(si->orig_video_isVGA); ++ if (type) ++ return si->orig_video_isVGA; ++ ++ // check if text mode has been initialized ++ if (!si->orig_video_lines || !si->orig_video_cols) ++ return 0; ++ ++ // 80x25 text, mono ++ if (si->orig_video_mode == 0x07) { ++ if ((si->orig_video_ega_bx & 0xff) != 0x10) ++ return VIDEO_TYPE_EGAM; ++ else ++ return VIDEO_TYPE_MDA; ++ } ++ ++ // EGA/VGA, 16 colors ++ if ((si->orig_video_ega_bx & 0xff) != 0x10) { ++ if (si->orig_video_isVGA) ++ return VIDEO_TYPE_VGAC; ++ else ++ return VIDEO_TYPE_EGAC; ++ } ++ ++ // the rest... ++ return VIDEO_TYPE_CGA; ++} ++ ++ssize_t screen_info_resources(const struct screen_info *si, struct resource *r, size_t num); ++ ++#if defined(CONFIG_PCI) ++void screen_info_apply_fixups(void); ++struct pci_dev *screen_info_pci_dev(const struct screen_info *si); ++#else ++static inline void screen_info_apply_fixups(void) ++{ } ++static inline struct pci_dev *screen_info_pci_dev(const struct screen_info *si) ++{ ++ return NULL; ++} ++#endif ++ + extern struct screen_info screen_info; + + #endif /* _SCREEN_INFO_H */ +diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h +index 61b40ea81f4d3..698a71422a14b 100644 +--- a/include/linux/sysctl.h ++++ b/include/linux/sysctl.h +@@ -205,7 +205,6 @@ struct ctl_table_root { + struct ctl_table_set default_set; + struct ctl_table_set *(*lookup)(struct ctl_table_root *root); + void (*set_ownership)(struct ctl_table_header *head, +- struct ctl_table *table, + kuid_t *uid, kgid_t *gid); + int (*permissions)(struct ctl_table_header *head, struct ctl_table *table); + }; +diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h +index b2db2c2f1c577..3c4d5ef6d4463 100644 +--- a/include/trace/events/btrfs.h ++++ b/include/trace/events/btrfs.h +@@ -2430,6 +2430,14 @@ DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, + TP_ARGS(fs_info, sinfo, old, diff) + ); + ++DEFINE_EVENT(btrfs__space_info_update, update_bytes_zone_unusable, ++ ++ TP_PROTO(const struct btrfs_fs_info *fs_info, ++ const struct btrfs_space_info *sinfo, u64 old, s64 diff), ++ ++ TP_ARGS(fs_info, sinfo, old, diff) ++); ++ + DECLARE_EVENT_CLASS(btrfs_raid56_bio, + + TP_PROTO(const struct btrfs_raid_bio *rbio, +diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h +index 563e48617374d..54e8fb5a229cd 100644 +--- a/include/trace/events/mptcp.h ++++ b/include/trace/events/mptcp.h +@@ -34,7 +34,7 @@ TRACE_EVENT(mptcp_subflow_get_send, + struct sock *ssk; + + __entry->active = mptcp_subflow_active(subflow); +- __entry->backup = subflow->backup; ++ __entry->backup = subflow->backup || subflow->request_bkup; + + if (subflow->tcp_sock && sk_fullsock(subflow->tcp_sock)) + __entry->free = sk_stream_memory_free(subflow->tcp_sock); +diff --git a/init/Kconfig b/init/Kconfig +index e403a29256357..e173364abd6c0 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1898,6 +1898,7 @@ config RUST + depends on !MODVERSIONS + depends on !GCC_PLUGINS + depends on !RANDSTRUCT ++ depends on !SHADOW_CALL_STACK + depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE + help + Enables Rust support in the kernel. +diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c +index 8c62e443f78b3..b2f39a86f4734 100644 +--- a/ipc/ipc_sysctl.c ++++ b/ipc/ipc_sysctl.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include "util.h" + + static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write, +@@ -190,25 +191,56 @@ static int set_is_seen(struct ctl_table_set *set) + return ¤t->nsproxy->ipc_ns->ipc_set == set; + } + ++static void ipc_set_ownership(struct ctl_table_header *head, ++ kuid_t *uid, kgid_t *gid) ++{ ++ struct ipc_namespace *ns = ++ container_of(head->set, struct ipc_namespace, ipc_set); ++ ++ kuid_t ns_root_uid = make_kuid(ns->user_ns, 0); ++ kgid_t ns_root_gid = make_kgid(ns->user_ns, 0); ++ ++ *uid = uid_valid(ns_root_uid) ? ns_root_uid : GLOBAL_ROOT_UID; ++ *gid = gid_valid(ns_root_gid) ? ns_root_gid : GLOBAL_ROOT_GID; ++} ++ + static int ipc_permissions(struct ctl_table_header *head, struct ctl_table *table) + { + int mode = table->mode; + + #ifdef CONFIG_CHECKPOINT_RESTORE +- struct ipc_namespace *ns = current->nsproxy->ipc_ns; ++ struct ipc_namespace *ns = ++ container_of(head->set, struct ipc_namespace, ipc_set); + + if (((table->data == &ns->ids[IPC_SEM_IDS].next_id) || + (table->data == &ns->ids[IPC_MSG_IDS].next_id) || + (table->data == &ns->ids[IPC_SHM_IDS].next_id)) && + checkpoint_restore_ns_capable(ns->user_ns)) + mode = 0666; ++ else + #endif +- return mode; ++ { ++ kuid_t ns_root_uid; ++ kgid_t ns_root_gid; ++ ++ ipc_set_ownership(head, &ns_root_uid, &ns_root_gid); ++ ++ if (uid_eq(current_euid(), ns_root_uid)) ++ mode >>= 6; ++ ++ else if (in_egroup_p(ns_root_gid)) ++ mode >>= 3; ++ } ++ ++ mode &= 7; ++ ++ return (mode << 6) | (mode << 3) | mode; + } + + static struct ctl_table_root set_root = { + .lookup = set_lookup, + .permissions = ipc_permissions, ++ .set_ownership = ipc_set_ownership, + }; + + bool setup_ipc_sysctls(struct ipc_namespace *ns) +diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c +index ebb5ed81c151a..6bb1c5397c69b 100644 +--- a/ipc/mq_sysctl.c ++++ b/ipc/mq_sysctl.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + static int msg_max_limit_min = MIN_MSGMAX; + static int msg_max_limit_max = HARD_MSGMAX; +@@ -76,8 +77,42 @@ static int set_is_seen(struct ctl_table_set *set) + return ¤t->nsproxy->ipc_ns->mq_set == set; + } + ++static void mq_set_ownership(struct ctl_table_header *head, ++ kuid_t *uid, kgid_t *gid) ++{ ++ struct ipc_namespace *ns = ++ container_of(head->set, struct ipc_namespace, mq_set); ++ ++ kuid_t ns_root_uid = make_kuid(ns->user_ns, 0); ++ kgid_t ns_root_gid = make_kgid(ns->user_ns, 0); ++ ++ *uid = uid_valid(ns_root_uid) ? ns_root_uid : GLOBAL_ROOT_UID; ++ *gid = gid_valid(ns_root_gid) ? ns_root_gid : GLOBAL_ROOT_GID; ++} ++ ++static int mq_permissions(struct ctl_table_header *head, struct ctl_table *table) ++{ ++ int mode = table->mode; ++ kuid_t ns_root_uid; ++ kgid_t ns_root_gid; ++ ++ mq_set_ownership(head, &ns_root_uid, &ns_root_gid); ++ ++ if (uid_eq(current_euid(), ns_root_uid)) ++ mode >>= 6; ++ ++ else if (in_egroup_p(ns_root_gid)) ++ mode >>= 3; ++ ++ mode &= 7; ++ ++ return (mode << 6) | (mode << 3) | mode; ++} ++ + static struct ctl_table_root set_root = { + .lookup = set_lookup, ++ .permissions = mq_permissions, ++ .set_ownership = mq_set_ownership, + }; + + bool setup_mq_sysctls(struct ipc_namespace *ns) +diff --git a/mm/Kconfig b/mm/Kconfig +index 264a2df5ecf5b..ece4f2847e2b4 100644 +--- a/mm/Kconfig ++++ b/mm/Kconfig +@@ -704,6 +704,17 @@ config HUGETLB_PAGE_SIZE_VARIABLE + config CONTIG_ALLOC + def_bool (MEMORY_ISOLATION && COMPACTION) || CMA + ++config PCP_BATCH_SCALE_MAX ++ int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free" ++ default 5 ++ range 0 6 ++ help ++ In page allocator, PCP (Per-CPU pageset) is refilled and drained in ++ batches. The batch number is scaled automatically to improve page ++ allocation/free throughput. But too large scale factor may hurt ++ latency. This option sets the upper limit of scale factor to limit ++ the maximum latency. ++ + config PHYS_ADDR_T_64BIT + def_bool 64BIT + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index e99d3223f0fc2..39bdbfb5313fb 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -2185,14 +2185,21 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) + */ + static void drain_pages_zone(unsigned int cpu, struct zone *zone) + { +- struct per_cpu_pages *pcp; ++ struct per_cpu_pages *pcp = per_cpu_ptr(zone->per_cpu_pageset, cpu); ++ int count; + +- pcp = per_cpu_ptr(zone->per_cpu_pageset, cpu); +- if (pcp->count) { ++ do { + spin_lock(&pcp->lock); +- free_pcppages_bulk(zone, pcp->count, pcp, 0); ++ count = pcp->count; ++ if (count) { ++ int to_drain = min(count, ++ pcp->batch << CONFIG_PCP_BATCH_SCALE_MAX); ++ ++ free_pcppages_bulk(zone, to_drain, pcp, 0); ++ count -= to_drain; ++ } + spin_unlock(&pcp->lock); +- } ++ } while (count); + } + + /* +@@ -2343,7 +2350,7 @@ static int nr_pcp_free(struct per_cpu_pages *pcp, int high, bool free_high) + * freeing of pages without any allocation. + */ + batch <<= pcp->free_factor; +- if (batch < max_nr_free) ++ if (batch < max_nr_free && pcp->free_factor < CONFIG_PCP_BATCH_SCALE_MAX) + pcp->free_factor++; + batch = clamp(batch, min_nr_free, max_nr_free); + +diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c +index b3f5714dab342..6dab0c99c82c7 100644 +--- a/net/bluetooth/hci_sync.c ++++ b/net/bluetooth/hci_sync.c +@@ -2862,6 +2862,27 @@ static int hci_passive_scan_sync(struct hci_dev *hdev) + */ + filter_policy = hci_update_accept_list_sync(hdev); + ++ /* If suspended and filter_policy set to 0x00 (no acceptlist) then ++ * passive scanning cannot be started since that would require the host ++ * to be woken up to process the reports. ++ */ ++ if (hdev->suspended && !filter_policy) { ++ /* Check if accept list is empty then there is no need to scan ++ * while suspended. ++ */ ++ if (list_empty(&hdev->le_accept_list)) ++ return 0; ++ ++ /* If there are devices is the accept_list that means some ++ * devices could not be programmed which in non-suspended case ++ * means filter_policy needs to be set to 0x00 so the host needs ++ * to filter, but since this is treating suspended case we ++ * can ignore device needing host to filter to allow devices in ++ * the acceptlist to be able to wakeup the system. ++ */ ++ filter_policy = 0x01; ++ } ++ + /* When the controller is using random resolvable addresses and + * with that having LE privacy enabled, then controllers with + * Extended Scanner Filter Policies support can now enable support +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c +index 7ea66de1442cc..8573dad6d8171 100644 +--- a/net/core/rtnetlink.c ++++ b/net/core/rtnetlink.c +@@ -3263,7 +3263,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, + if (ifm->ifi_index > 0) + dev = __dev_get_by_index(tgt_net, ifm->ifi_index); + else if (tb[IFLA_IFNAME] || tb[IFLA_ALT_IFNAME]) +- dev = rtnl_dev_get(net, tb); ++ dev = rtnl_dev_get(tgt_net, tb); + else if (tb[IFLA_GROUP]) + err = rtnl_group_dellink(tgt_net, nla_get_u32(tb[IFLA_GROUP])); + else +diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c +index 56f6ecc43451e..12ca666d6e2c1 100644 +--- a/net/ipv4/netfilter/iptable_nat.c ++++ b/net/ipv4/netfilter/iptable_nat.c +@@ -145,25 +145,27 @@ static struct pernet_operations iptable_nat_net_ops = { + + static int __init iptable_nat_init(void) + { +- int ret = xt_register_template(&nf_nat_ipv4_table, +- iptable_nat_table_init); ++ int ret; + ++ /* net->gen->ptr[iptable_nat_net_id] must be allocated ++ * before calling iptable_nat_table_init(). ++ */ ++ ret = register_pernet_subsys(&iptable_nat_net_ops); + if (ret < 0) + return ret; + +- ret = register_pernet_subsys(&iptable_nat_net_ops); +- if (ret < 0) { +- xt_unregister_template(&nf_nat_ipv4_table); +- return ret; +- } ++ ret = xt_register_template(&nf_nat_ipv4_table, ++ iptable_nat_table_init); ++ if (ret < 0) ++ unregister_pernet_subsys(&iptable_nat_net_ops); + + return ret; + } + + static void __exit iptable_nat_exit(void) + { +- unregister_pernet_subsys(&iptable_nat_net_ops); + xt_unregister_template(&nf_nat_ipv4_table); ++ unregister_pernet_subsys(&iptable_nat_net_ops); + } + + module_init(iptable_nat_init); +diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c +index 3b4dafefb4b03..e143562077958 100644 +--- a/net/ipv4/syncookies.c ++++ b/net/ipv4/syncookies.c +@@ -424,7 +424,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) + } + + /* Try to redo what tcp_v4_send_synack did. */ +- req->rsk_window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW); ++ req->rsk_window_clamp = READ_ONCE(tp->window_clamp) ? : ++ dst_metric(&rt->dst, RTAX_WINDOW); + /* limit the window selection if the user enforce a smaller rx buffer */ + full_space = tcp_full_space(sk); + if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c +index 91c3d8264059d..1e3202f2b7a87 100644 +--- a/net/ipv4/tcp.c ++++ b/net/ipv4/tcp.c +@@ -1723,7 +1723,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val) + space = tcp_space_from_win(sk, val); + if (space > sk->sk_rcvbuf) { + WRITE_ONCE(sk->sk_rcvbuf, space); +- tcp_sk(sk)->window_clamp = val; ++ WRITE_ONCE(tcp_sk(sk)->window_clamp, val); + } + return 0; + } +@@ -3386,7 +3386,7 @@ int tcp_set_window_clamp(struct sock *sk, int val) + if (!val) { + if (sk->sk_state != TCP_CLOSE) + return -EINVAL; +- tp->window_clamp = 0; ++ WRITE_ONCE(tp->window_clamp, 0); + } else { + u32 new_rcv_ssthresh, old_window_clamp = tp->window_clamp; + u32 new_window_clamp = val < SOCK_MIN_RCVBUF / 2 ? +@@ -3395,7 +3395,7 @@ int tcp_set_window_clamp(struct sock *sk, int val) + if (new_window_clamp == old_window_clamp) + return 0; + +- tp->window_clamp = new_window_clamp; ++ WRITE_ONCE(tp->window_clamp, new_window_clamp); + if (new_window_clamp < old_window_clamp) { + /* need to apply the reserved mem provisioning only + * when shrinking the window clamp +@@ -4020,7 +4020,7 @@ int do_tcp_getsockopt(struct sock *sk, int level, + TCP_RTO_MAX / HZ); + break; + case TCP_WINDOW_CLAMP: +- val = tp->window_clamp; ++ val = READ_ONCE(tp->window_clamp); + break; + case TCP_INFO: { + struct tcp_info info; +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index c2e4dac42453b..d0364cff65c9f 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -570,19 +570,20 @@ static void tcp_init_buffer_space(struct sock *sk) + maxwin = tcp_full_space(sk); + + if (tp->window_clamp >= maxwin) { +- tp->window_clamp = maxwin; ++ WRITE_ONCE(tp->window_clamp, maxwin); + + if (tcp_app_win && maxwin > 4 * tp->advmss) +- tp->window_clamp = max(maxwin - +- (maxwin >> tcp_app_win), +- 4 * tp->advmss); ++ WRITE_ONCE(tp->window_clamp, ++ max(maxwin - (maxwin >> tcp_app_win), ++ 4 * tp->advmss)); + } + + /* Force reservation of one segment. */ + if (tcp_app_win && + tp->window_clamp > 2 * tp->advmss && + tp->window_clamp + tp->advmss > maxwin) +- tp->window_clamp = max(2 * tp->advmss, maxwin - tp->advmss); ++ WRITE_ONCE(tp->window_clamp, ++ max(2 * tp->advmss, maxwin - tp->advmss)); + + tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp); + tp->snd_cwnd_stamp = tcp_jiffies32; +@@ -747,8 +748,7 @@ void tcp_rcv_space_adjust(struct sock *sk) + * + */ + +- if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && +- !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { ++ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf)) { + u64 rcvwin, grow; + int rcvbuf; + +@@ -764,11 +764,22 @@ void tcp_rcv_space_adjust(struct sock *sk) + + rcvbuf = min_t(u64, tcp_space_from_win(sk, rcvwin), + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); +- if (rcvbuf > sk->sk_rcvbuf) { +- WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); ++ if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { ++ if (rcvbuf > sk->sk_rcvbuf) { ++ WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); + +- /* Make the window clamp follow along. */ +- tp->window_clamp = tcp_win_from_space(sk, rcvbuf); ++ /* Make the window clamp follow along. */ ++ WRITE_ONCE(tp->window_clamp, ++ tcp_win_from_space(sk, rcvbuf)); ++ } ++ } else { ++ /* Make the window clamp follow along while being bounded ++ * by SO_RCVBUF. ++ */ ++ int clamp = tcp_win_from_space(sk, min(rcvbuf, sk->sk_rcvbuf)); ++ ++ if (clamp > tp->window_clamp) ++ WRITE_ONCE(tp->window_clamp, clamp); + } + } + tp->rcvq_space.space = copied; +@@ -6347,7 +6358,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, + + if (!tp->rx_opt.wscale_ok) { + tp->rx_opt.snd_wscale = tp->rx_opt.rcv_wscale = 0; +- tp->window_clamp = min(tp->window_clamp, 65535U); ++ WRITE_ONCE(tp->window_clamp, ++ min(tp->window_clamp, 65535U)); + } + + if (tp->rx_opt.saw_tstamp) { +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 5631041ae12cb..15c49d559db53 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -203,16 +203,17 @@ static inline void tcp_event_ack_sent(struct sock *sk, u32 rcv_nxt) + * This MUST be enforced by all callers. + */ + void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss, +- __u32 *rcv_wnd, __u32 *window_clamp, ++ __u32 *rcv_wnd, __u32 *__window_clamp, + int wscale_ok, __u8 *rcv_wscale, + __u32 init_rcv_wnd) + { + unsigned int space = (__space < 0 ? 0 : __space); ++ u32 window_clamp = READ_ONCE(*__window_clamp); + + /* If no clamp set the clamp to the max possible scaled window */ +- if (*window_clamp == 0) +- (*window_clamp) = (U16_MAX << TCP_MAX_WSCALE); +- space = min(*window_clamp, space); ++ if (window_clamp == 0) ++ window_clamp = (U16_MAX << TCP_MAX_WSCALE); ++ space = min(window_clamp, space); + + /* Quantize space offering to a multiple of mss if possible. */ + if (space > mss) +@@ -239,12 +240,13 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss, + /* Set window scaling on max possible window */ + space = max_t(u32, space, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); + space = max_t(u32, space, READ_ONCE(sysctl_rmem_max)); +- space = min_t(u32, space, *window_clamp); ++ space = min_t(u32, space, window_clamp); + *rcv_wscale = clamp_t(int, ilog2(space) - 15, + 0, TCP_MAX_WSCALE); + } + /* Set the clamp no higher than max representable value */ +- (*window_clamp) = min_t(__u32, U16_MAX << (*rcv_wscale), *window_clamp); ++ WRITE_ONCE(*__window_clamp, ++ min_t(__u32, U16_MAX << (*rcv_wscale), window_clamp)); + } + EXPORT_SYMBOL(tcp_select_initial_window); + +@@ -3787,7 +3789,7 @@ static void tcp_connect_init(struct sock *sk) + tcp_ca_dst_init(sk, dst); + + if (!tp->window_clamp) +- tp->window_clamp = dst_metric(dst, RTAX_WINDOW); ++ WRITE_ONCE(tp->window_clamp, dst_metric(dst, RTAX_WINDOW)); + tp->advmss = tcp_mss_clamp(tp, dst_metric_advmss(dst)); + + tcp_initialize_rcv_mss(sk); +@@ -3795,7 +3797,7 @@ static void tcp_connect_init(struct sock *sk) + /* limit the window selection if the user enforce a smaller rx buffer */ + if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && + (tp->window_clamp > tcp_full_space(sk) || tp->window_clamp == 0)) +- tp->window_clamp = tcp_full_space(sk); ++ WRITE_ONCE(tp->window_clamp, tcp_full_space(sk)); + + rcv_wnd = tcp_rwnd_init_bpf(sk); + if (rcv_wnd == 0) +diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c +index 68debc78189c2..2062ab94721e3 100644 +--- a/net/ipv6/ndisc.c ++++ b/net/ipv6/ndisc.c +@@ -227,6 +227,7 @@ struct ndisc_options *ndisc_parse_options(const struct net_device *dev, + return NULL; + memset(ndopts, 0, sizeof(*ndopts)); + while (opt_len) { ++ bool unknown = false; + int l; + if (opt_len < sizeof(struct nd_opt_hdr)) + return NULL; +@@ -262,22 +263,23 @@ struct ndisc_options *ndisc_parse_options(const struct net_device *dev, + break; + #endif + default: +- if (ndisc_is_useropt(dev, nd_opt)) { +- ndopts->nd_useropts_end = nd_opt; +- if (!ndopts->nd_useropts) +- ndopts->nd_useropts = nd_opt; +- } else { +- /* +- * Unknown options must be silently ignored, +- * to accommodate future extension to the +- * protocol. +- */ +- ND_PRINTK(2, notice, +- "%s: ignored unsupported option; type=%d, len=%d\n", +- __func__, +- nd_opt->nd_opt_type, +- nd_opt->nd_opt_len); +- } ++ unknown = true; ++ } ++ if (ndisc_is_useropt(dev, nd_opt)) { ++ ndopts->nd_useropts_end = nd_opt; ++ if (!ndopts->nd_useropts) ++ ndopts->nd_useropts = nd_opt; ++ } else if (unknown) { ++ /* ++ * Unknown options must be silently ignored, ++ * to accommodate future extension to the ++ * protocol. ++ */ ++ ND_PRINTK(2, notice, ++ "%s: ignored unsupported option; type=%d, len=%d\n", ++ __func__, ++ nd_opt->nd_opt_type, ++ nd_opt->nd_opt_len); + } + next_opt: + opt_len -= l; +diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c +index bf3cb3a13600c..52d597b16b658 100644 +--- a/net/ipv6/netfilter/ip6table_nat.c ++++ b/net/ipv6/netfilter/ip6table_nat.c +@@ -147,23 +147,27 @@ static struct pernet_operations ip6table_nat_net_ops = { + + static int __init ip6table_nat_init(void) + { +- int ret = xt_register_template(&nf_nat_ipv6_table, +- ip6table_nat_table_init); ++ int ret; + ++ /* net->gen->ptr[ip6table_nat_net_id] must be allocated ++ * before calling ip6t_nat_register_lookups(). ++ */ ++ ret = register_pernet_subsys(&ip6table_nat_net_ops); + if (ret < 0) + return ret; + +- ret = register_pernet_subsys(&ip6table_nat_net_ops); ++ ret = xt_register_template(&nf_nat_ipv6_table, ++ ip6table_nat_table_init); + if (ret) +- xt_unregister_template(&nf_nat_ipv6_table); ++ unregister_pernet_subsys(&ip6table_nat_net_ops); + + return ret; + } + + static void __exit ip6table_nat_exit(void) + { +- unregister_pernet_subsys(&ip6table_nat_net_ops); + xt_unregister_template(&nf_nat_ipv6_table); ++ unregister_pernet_subsys(&ip6table_nat_net_ops); + } + + module_init(ip6table_nat_init); +diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c +index 8698b49dfc8de..593ead8a45d79 100644 +--- a/net/ipv6/syncookies.c ++++ b/net/ipv6/syncookies.c +@@ -243,7 +243,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) + goto out_free; + } + +- req->rsk_window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW); ++ req->rsk_window_clamp = READ_ONCE(tp->window_clamp) ? :dst_metric(dst, RTAX_WINDOW); + /* limit the window selection if the user enforce a smaller rx buffer */ + full_space = tcp_full_space(sk); + if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && +diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c +index 498a0c35b7bb2..815b1df0b2d19 100644 +--- a/net/iucv/af_iucv.c ++++ b/net/iucv/af_iucv.c +@@ -335,8 +335,8 @@ static void iucv_sever_path(struct sock *sk, int with_user_data) + struct iucv_sock *iucv = iucv_sk(sk); + struct iucv_path *path = iucv->path; + +- if (iucv->path) { +- iucv->path = NULL; ++ /* Whoever resets the path pointer, must sever and free it. */ ++ if (xchg(&iucv->path, NULL)) { + if (with_user_data) { + low_nmcpy(user_data, iucv->src_name); + high_nmcpy(user_data, iucv->dst_name); +diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c +index c30405e768337..7884217f33eb2 100644 +--- a/net/mptcp/mib.c ++++ b/net/mptcp/mib.c +@@ -19,7 +19,9 @@ static const struct snmp_mib mptcp_snmp_list[] = { + SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS), + SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN), + SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX), ++ SNMP_MIB_ITEM("MPJoinSynBackupRx", MPTCP_MIB_JOINSYNBACKUPRX), + SNMP_MIB_ITEM("MPJoinSynAckRx", MPTCP_MIB_JOINSYNACKRX), ++ SNMP_MIB_ITEM("MPJoinSynAckBackupRx", MPTCP_MIB_JOINSYNACKBACKUPRX), + SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC), + SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), + SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), +diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h +index dd7fd1f246b5f..443604462ace8 100644 +--- a/net/mptcp/mib.h ++++ b/net/mptcp/mib.h +@@ -12,7 +12,9 @@ enum linux_mptcp_mib_field { + MPTCP_MIB_RETRANSSEGS, /* Segments retransmitted at the MPTCP-level */ + MPTCP_MIB_JOINNOTOKEN, /* Received MP_JOIN but the token was not found */ + MPTCP_MIB_JOINSYNRX, /* Received a SYN + MP_JOIN */ ++ MPTCP_MIB_JOINSYNBACKUPRX, /* Received a SYN + MP_JOIN + backup flag */ + MPTCP_MIB_JOINSYNACKRX, /* Received a SYN/ACK + MP_JOIN */ ++ MPTCP_MIB_JOINSYNACKBACKUPRX, /* Received a SYN/ACK + MP_JOIN + backup flag */ + MPTCP_MIB_JOINSYNACKMAC, /* HMAC was wrong on SYN/ACK + MP_JOIN */ + MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ + MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ +diff --git a/net/mptcp/options.c b/net/mptcp/options.c +index 63fc0758c22d4..85aafa94cc8ab 100644 +--- a/net/mptcp/options.c ++++ b/net/mptcp/options.c +@@ -909,7 +909,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, + return true; + } else if (subflow_req->mp_join) { + opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; +- opts->backup = subflow_req->backup; ++ opts->backup = subflow_req->request_bkup; + opts->join_id = subflow_req->local_id; + opts->thmac = subflow_req->thmac; + opts->nonce = subflow_req->local_nonce; +diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c +index f58bf77d76b81..db621933b2035 100644 +--- a/net/mptcp/pm_netlink.c ++++ b/net/mptcp/pm_netlink.c +@@ -476,7 +476,6 @@ static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_con + slow = lock_sock_fast(ssk); + if (prio) { + subflow->send_mp_prio = 1; +- subflow->backup = backup; + subflow->request_bkup = backup; + } + +@@ -1432,6 +1431,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk, + ret = remove_anno_list_by_saddr(msk, addr); + if (ret || force) { + spin_lock_bh(&msk->pm.lock); ++ msk->pm.add_addr_signaled -= ret; + mptcp_pm_remove_addr(msk, &list); + spin_unlock_bh(&msk->pm.lock); + } +@@ -1565,16 +1565,25 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) + { + struct mptcp_rm_list alist = { .nr = 0 }; + struct mptcp_pm_addr_entry *entry; ++ int anno_nr = 0; + + list_for_each_entry(entry, rm_list, list) { +- if ((remove_anno_list_by_saddr(msk, &entry->addr) || +- lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) && +- alist.nr < MPTCP_RM_IDS_MAX) +- alist.ids[alist.nr++] = entry->addr.id; ++ if (alist.nr >= MPTCP_RM_IDS_MAX) ++ break; ++ ++ /* only delete if either announced or matching a subflow */ ++ if (remove_anno_list_by_saddr(msk, &entry->addr)) ++ anno_nr++; ++ else if (!lookup_subflow_by_saddr(&msk->conn_list, ++ &entry->addr)) ++ continue; ++ ++ alist.ids[alist.nr++] = entry->addr.id; + } + + if (alist.nr) { + spin_lock_bh(&msk->pm.lock); ++ msk->pm.add_addr_signaled -= anno_nr; + mptcp_pm_remove_addr(msk, &alist); + spin_unlock_bh(&msk->pm.lock); + } +@@ -1587,17 +1596,18 @@ void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, + struct mptcp_pm_addr_entry *entry; + + list_for_each_entry(entry, rm_list, list) { +- if (lookup_subflow_by_saddr(&msk->conn_list, &entry->addr) && +- slist.nr < MPTCP_RM_IDS_MAX) ++ if (slist.nr < MPTCP_RM_IDS_MAX && ++ lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) + slist.ids[slist.nr++] = entry->addr.id; + +- if (remove_anno_list_by_saddr(msk, &entry->addr) && +- alist.nr < MPTCP_RM_IDS_MAX) ++ if (alist.nr < MPTCP_RM_IDS_MAX && ++ remove_anno_list_by_saddr(msk, &entry->addr)) + alist.ids[alist.nr++] = entry->addr.id; + } + + if (alist.nr) { + spin_lock_bh(&msk->pm.lock); ++ msk->pm.add_addr_signaled -= alist.nr; + mptcp_pm_remove_addr(msk, &alist); + spin_unlock_bh(&msk->pm.lock); + } +diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c +index fbf2b26760731..c1d652a3f7a9b 100644 +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -352,8 +352,10 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, + skb_orphan(skb); + + /* try to fetch required memory from subflow */ +- if (!mptcp_rmem_schedule(sk, ssk, skb->truesize)) ++ if (!mptcp_rmem_schedule(sk, ssk, skb->truesize)) { ++ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED); + goto drop; ++ } + + has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp; + +@@ -842,16 +844,13 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk) + sk_rbuf = ssk_rbuf; + + /* over limit? can't append more skbs to msk, Also, no need to wake-up*/ +- if (__mptcp_rmem(sk) > sk_rbuf) { +- MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED); ++ if (__mptcp_rmem(sk) > sk_rbuf) + return; +- } + + /* Wake-up the reader only for in-sequence data */ + mptcp_data_lock(sk); +- if (move_skbs_to_msk(msk, ssk)) ++ if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) + sk->sk_data_ready(sk); +- + mptcp_data_unlock(sk); + } + +@@ -1418,13 +1417,15 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) + } + + mptcp_for_each_subflow(msk, subflow) { ++ bool backup = subflow->backup || subflow->request_bkup; ++ + trace_mptcp_subflow_get_send(subflow); + ssk = mptcp_subflow_tcp_sock(subflow); + if (!mptcp_subflow_active(subflow)) + continue; + + tout = max(tout, mptcp_timeout_from_subflow(subflow)); +- nr_active += !subflow->backup; ++ nr_active += !backup; + pace = subflow->avg_pacing_rate; + if (unlikely(!pace)) { + /* init pacing rate from socket */ +@@ -1435,9 +1436,9 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) + } + + linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); +- if (linger_time < send_info[subflow->backup].linger_time) { +- send_info[subflow->backup].ssk = ssk; +- send_info[subflow->backup].linger_time = linger_time; ++ if (linger_time < send_info[backup].linger_time) { ++ send_info[backup].ssk = ssk; ++ send_info[backup].linger_time = linger_time; + } + } + __mptcp_set_timeout(sk, tout); +@@ -1918,6 +1919,7 @@ static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, + if (!(flags & MSG_PEEK)) { + MPTCP_SKB_CB(skb)->offset += count; + MPTCP_SKB_CB(skb)->map_seq += count; ++ msk->bytes_consumed += count; + } + break; + } +@@ -1928,6 +1930,7 @@ static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, + WRITE_ONCE(msk->rmem_released, msk->rmem_released + skb->truesize); + __skb_unlink(skb, &msk->receive_queue); + __kfree_skb(skb); ++ msk->bytes_consumed += count; + } + + if (copied >= len) +@@ -2023,7 +2026,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) + ssk = mptcp_subflow_tcp_sock(subflow); + slow = lock_sock_fast(ssk); + WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); +- tcp_sk(ssk)->window_clamp = window_clamp; ++ WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); + tcp_cleanup_rbuf(ssk, 1); + unlock_sock_fast(ssk, slow); + } +@@ -2752,6 +2755,7 @@ static void __mptcp_init_sock(struct sock *sk) + msk->rmem_fwd_alloc = 0; + WRITE_ONCE(msk->rmem_released, 0); + msk->timer_ival = TCP_RTO_MIN; ++ msk->scaling_ratio = TCP_DEFAULT_SCALING_RATIO; + + WRITE_ONCE(msk->first, NULL); + inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss; +@@ -2984,16 +2988,9 @@ void __mptcp_unaccepted_force_close(struct sock *sk) + __mptcp_destroy_sock(sk); + } + +-static __poll_t mptcp_check_readable(struct mptcp_sock *msk) ++static __poll_t mptcp_check_readable(struct sock *sk) + { +- /* Concurrent splices from sk_receive_queue into receive_queue will +- * always show at least one non-empty queue when checked in this order. +- */ +- if (skb_queue_empty_lockless(&((struct sock *)msk)->sk_receive_queue) && +- skb_queue_empty_lockless(&msk->receive_queue)) +- return 0; +- +- return EPOLLIN | EPOLLRDNORM; ++ return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; + } + + static void mptcp_check_listen_stop(struct sock *sk) +@@ -3031,7 +3028,7 @@ bool __mptcp_close(struct sock *sk, long timeout) + goto cleanup; + } + +- if (mptcp_check_readable(msk) || timeout < 0) { ++ if (mptcp_data_avail(msk) || timeout < 0) { + /* If the msk has read data, or the caller explicitly ask it, + * do the MPTCP equivalent of TCP reset, aka MPTCP fastclose + */ +@@ -3157,6 +3154,7 @@ static int mptcp_disconnect(struct sock *sk, int flags) + msk->snd_data_fin_enable = false; + msk->rcv_fastclose = false; + msk->use_64bit_ack = false; ++ msk->bytes_consumed = 0; + WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk))); + mptcp_pm_data_reset(msk); + mptcp_ca_reset(sk); +@@ -3983,7 +3981,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, + mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; + + if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { +- mask |= mptcp_check_readable(msk); ++ mask |= mptcp_check_readable(sk); + if (shutdown & SEND_SHUTDOWN) + mask |= EPOLLOUT | EPOLLWRNORM; + else +@@ -4021,6 +4019,7 @@ static const struct proto_ops mptcp_stream_ops = { + .sendmsg = inet_sendmsg, + .recvmsg = inet_recvmsg, + .mmap = sock_no_mmap, ++ .set_rcvlowat = mptcp_set_rcvlowat, + }; + + static struct inet_protosw mptcp_protosw = { +@@ -4122,6 +4121,7 @@ static const struct proto_ops mptcp_v6_stream_ops = { + #ifdef CONFIG_COMPAT + .compat_ioctl = inet6_compat_ioctl, + #endif ++ .set_rcvlowat = mptcp_set_rcvlowat, + }; + + static struct proto mptcp_v6_prot; +diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h +index 93ba48f4ae386..c28ac5dfd0b58 100644 +--- a/net/mptcp/protocol.h ++++ b/net/mptcp/protocol.h +@@ -268,6 +268,7 @@ struct mptcp_sock { + atomic64_t rcv_wnd_sent; + u64 rcv_data_fin_seq; + u64 bytes_retrans; ++ u64 bytes_consumed; + int rmem_fwd_alloc; + int snd_burst; + int old_wspace; +@@ -418,6 +419,7 @@ struct mptcp_subflow_request_sock { + u16 mp_capable : 1, + mp_join : 1, + backup : 1, ++ request_bkup : 1, + csum_reqd : 1, + allow_join_id0 : 1; + u8 local_id; +@@ -674,6 +676,24 @@ struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk); + int mptcp_sched_get_send(struct mptcp_sock *msk); + int mptcp_sched_get_retrans(struct mptcp_sock *msk); + ++static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) ++{ ++ return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); ++} ++ ++static inline bool mptcp_epollin_ready(const struct sock *sk) ++{ ++ /* mptcp doesn't have to deal with small skbs in the receive queue, ++ * at it can always coalesce them ++ */ ++ return (mptcp_data_avail(mptcp_sk(sk)) >= sk->sk_rcvlowat) || ++ (mem_cgroup_sockets_enabled && sk->sk_memcg && ++ mem_cgroup_under_socket_pressure(sk->sk_memcg)) || ++ READ_ONCE(tcp_memory_pressure); ++} ++ ++int mptcp_set_rcvlowat(struct sock *sk, int val); ++ + static inline bool __tcp_can_send(const struct sock *ssk) + { + /* only send if our side has not closed yet */ +@@ -748,6 +768,7 @@ static inline bool mptcp_is_fully_established(struct sock *sk) + return inet_sk_state_load(sk) == TCP_ESTABLISHED && + READ_ONCE(mptcp_sk(sk)->fully_established); + } ++ + void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk); + void mptcp_data_ready(struct sock *sk, struct sock *ssk); + bool mptcp_finish_join(struct sock *sk); +diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c +index cc04b5e29dd35..bdfeecea814f3 100644 +--- a/net/mptcp/sockopt.c ++++ b/net/mptcp/sockopt.c +@@ -1521,9 +1521,55 @@ void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) + + msk_owned_by_me(msk); + ++ ssk->sk_rcvlowat = 0; ++ + if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { + sync_socket_options(msk, ssk); + + subflow->setsockopt_seq = msk->setsockopt_seq; + } + } ++ ++/* unfortunately this is different enough from the tcp version so ++ * that we can't factor it out ++ */ ++int mptcp_set_rcvlowat(struct sock *sk, int val) ++{ ++ struct mptcp_subflow_context *subflow; ++ int space, cap; ++ ++ /* bpf can land here with a wrong sk type */ ++ if (sk->sk_protocol == IPPROTO_TCP) ++ return -EINVAL; ++ ++ if (sk->sk_userlocks & SOCK_RCVBUF_LOCK) ++ cap = sk->sk_rcvbuf >> 1; ++ else ++ cap = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]) >> 1; ++ val = min(val, cap); ++ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); ++ ++ /* Check if we need to signal EPOLLIN right now */ ++ if (mptcp_epollin_ready(sk)) ++ sk->sk_data_ready(sk); ++ ++ if (sk->sk_userlocks & SOCK_RCVBUF_LOCK) ++ return 0; ++ ++ space = __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, val); ++ if (space <= sk->sk_rcvbuf) ++ return 0; ++ ++ /* propagate the rcvbuf changes to all the subflows */ ++ WRITE_ONCE(sk->sk_rcvbuf, space); ++ mptcp_for_each_subflow(mptcp_sk(sk), subflow) { ++ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); ++ bool slow; ++ ++ slow = lock_sock_fast(ssk); ++ WRITE_ONCE(ssk->sk_rcvbuf, space); ++ WRITE_ONCE(tcp_sk(ssk)->window_clamp, val); ++ unlock_sock_fast(ssk, slow); ++ } ++ return 0; ++} +diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c +index 23ee96c6abcbf..bc1efc1787720 100644 +--- a/net/mptcp/subflow.c ++++ b/net/mptcp/subflow.c +@@ -166,6 +166,9 @@ static int subflow_check_req(struct request_sock *req, + return 0; + } else if (opt_mp_join) { + SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); ++ ++ if (mp_opt.backup) ++ SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNBACKUPRX); + } + + if (opt_mp_capable && listener->request_mptcp) { +@@ -558,6 +561,9 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) + subflow->mp_join = 1; + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); + ++ if (subflow->backup) ++ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX); ++ + if (subflow_use_different_dport(msk, sk)) { + pr_debug("synack inet_dport=%d %d", + ntohs(inet_sk(sk)->inet_dport), +@@ -1192,14 +1198,22 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, + { + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; +- u32 incr; ++ struct tcp_sock *tp = tcp_sk(ssk); ++ u32 offset, incr, avail_len; ++ ++ offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; ++ if (WARN_ON_ONCE(offset > skb->len)) ++ goto out; + +- incr = limit >= skb->len ? skb->len + fin : limit; ++ avail_len = skb->len - offset; ++ incr = limit >= avail_len ? avail_len + fin : limit; + +- pr_debug("discarding=%d len=%d seq=%d", incr, skb->len, +- subflow->map_subflow_seq); ++ pr_debug("discarding=%d len=%d offset=%d seq=%d", incr, skb->len, ++ offset, subflow->map_subflow_seq); + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); + tcp_sk(ssk)->copied_seq += incr; ++ ++out: + if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) + sk_eat_skb(ssk, skb); + if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) +@@ -1432,10 +1446,18 @@ static void subflow_data_ready(struct sock *sk) + WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && + !subflow->mp_join && !(state & TCPF_CLOSE)); + +- if (mptcp_subflow_data_available(sk)) ++ if (mptcp_subflow_data_available(sk)) { + mptcp_data_ready(parent, sk); +- else if (unlikely(sk->sk_err)) ++ ++ /* subflow-level lowat test are not relevant. ++ * respect the msk-level threshold eventually mandating an immediate ack ++ */ ++ if (mptcp_data_avail(msk) < parent->sk_rcvlowat && ++ (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) ++ inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; ++ } else if (unlikely(sk->sk_err)) { + subflow_error_report(sk); ++ } + } + + static void subflow_write_space(struct sock *ssk) +@@ -1968,6 +1990,7 @@ static void subflow_ulp_clone(const struct request_sock *req, + new_ctx->fully_established = 1; + new_ctx->remote_key_valid = 1; + new_ctx->backup = subflow_req->backup; ++ new_ctx->request_bkup = subflow_req->request_bkup; + WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id); + new_ctx->token = subflow_req->token; + new_ctx->thmac = subflow_req->thmac; +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c +index 3ac19516ed803..50d24e240e8fb 100644 +--- a/net/sched/act_ct.c ++++ b/net/sched/act_ct.c +@@ -44,6 +44,8 @@ static DEFINE_MUTEX(zones_mutex); + struct zones_ht_key { + struct net *net; + u16 zone; ++ /* Note : pad[] must be the last field. */ ++ u8 pad[]; + }; + + struct tcf_ct_flow_table { +@@ -60,7 +62,7 @@ struct tcf_ct_flow_table { + static const struct rhashtable_params zones_params = { + .head_offset = offsetof(struct tcf_ct_flow_table, node), + .key_offset = offsetof(struct tcf_ct_flow_table, key), +- .key_len = sizeof_field(struct tcf_ct_flow_table, key), ++ .key_len = offsetof(struct zones_ht_key, pad), + .automatic_shrinking = true, + }; + +diff --git a/net/sysctl_net.c b/net/sysctl_net.c +index 051ed5f6fc937..a0a7a79991f9f 100644 +--- a/net/sysctl_net.c ++++ b/net/sysctl_net.c +@@ -54,7 +54,6 @@ static int net_ctl_permissions(struct ctl_table_header *head, + } + + static void net_ctl_set_ownership(struct ctl_table_header *head, +- struct ctl_table *table, + kuid_t *uid, kgid_t *gid) + { + struct net *net = container_of(head->set, struct net, sysctls); +diff --git a/net/wireless/sme.c b/net/wireless/sme.c +index 9bba233b5a6ec..72d78dbc55ffd 100644 +--- a/net/wireless/sme.c ++++ b/net/wireless/sme.c +@@ -1057,6 +1057,7 @@ void cfg80211_connect_done(struct net_device *dev, + cfg80211_hold_bss( + bss_from_pub(params->links[link].bss)); + ev->cr.links[link].bss = params->links[link].bss; ++ ev->cr.links[link].status = params->links[link].status; + + if (params->links[link].addr) { + ev->cr.links[link].addr = next; +diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c +index e90b27a135e6f..d9dacfbe4a9ae 100644 +--- a/sound/core/seq/seq_ump_convert.c ++++ b/sound/core/seq/seq_ump_convert.c +@@ -1192,44 +1192,53 @@ static int cvt_sysex_to_ump(struct snd_seq_client *dest, + { + struct snd_seq_ump_event ev_cvt; + unsigned char status; +- u8 buf[6], *xbuf; ++ u8 buf[8], *xbuf; + int offset = 0; + int len, err; ++ bool finished = false; + + if (!snd_seq_ev_is_variable(event)) + return 0; + + setup_ump_event(&ev_cvt, event); +- for (;;) { ++ while (!finished) { + len = snd_seq_expand_var_event_at(event, sizeof(buf), buf, offset); + if (len <= 0) + break; +- if (WARN_ON(len > 6)) ++ if (WARN_ON(len > sizeof(buf))) + break; +- offset += len; ++ + xbuf = buf; ++ status = UMP_SYSEX_STATUS_CONTINUE; ++ /* truncate the sysex start-marker */ + if (*xbuf == UMP_MIDI1_MSG_SYSEX_START) { + status = UMP_SYSEX_STATUS_START; +- xbuf++; + len--; +- if (len > 0 && xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) { ++ offset++; ++ xbuf++; ++ } ++ ++ /* if the last of this packet or the 1st byte of the next packet ++ * is the end-marker, finish the transfer with this packet ++ */ ++ if (len > 0 && len < 8 && ++ xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) { ++ if (status == UMP_SYSEX_STATUS_START) + status = UMP_SYSEX_STATUS_SINGLE; +- len--; +- } +- } else { +- if (xbuf[len - 1] == UMP_MIDI1_MSG_SYSEX_END) { ++ else + status = UMP_SYSEX_STATUS_END; +- len--; +- } else { +- status = UMP_SYSEX_STATUS_CONTINUE; +- } ++ len--; ++ finished = true; + } ++ ++ len = min(len, 6); + fill_sysex7_ump(dest_port, ev_cvt.ump, status, xbuf, len); + err = __snd_seq_deliver_single_event(dest, dest_port, + (struct snd_seq_event *)&ev_cvt, + atomic, hop); + if (err < 0) + return err; ++ offset += len; + } + return 0; + } +diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c +index c9f153f85ae6b..5f0f8d9c08d1e 100644 +--- a/sound/firewire/amdtp-stream.c ++++ b/sound/firewire/amdtp-stream.c +@@ -77,6 +77,8 @@ + // overrun. Actual device can skip more, then this module stops the packet streaming. + #define IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES 5 + ++static void pcm_period_work(struct work_struct *work); ++ + /** + * amdtp_stream_init - initialize an AMDTP stream structure + * @s: the AMDTP stream to initialize +@@ -105,6 +107,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, + s->flags = flags; + s->context = ERR_PTR(-1); + mutex_init(&s->mutex); ++ INIT_WORK(&s->period_work, pcm_period_work); + s->packet_index = 0; + + init_waitqueue_head(&s->ready_wait); +@@ -347,6 +350,7 @@ EXPORT_SYMBOL(amdtp_stream_get_max_payload); + */ + void amdtp_stream_pcm_prepare(struct amdtp_stream *s) + { ++ cancel_work_sync(&s->period_work); + s->pcm_buffer_pointer = 0; + s->pcm_period_pointer = 0; + } +@@ -611,19 +615,21 @@ static void update_pcm_pointers(struct amdtp_stream *s, + // The program in user process should periodically check the status of intermediate + // buffer associated to PCM substream to process PCM frames in the buffer, instead + // of receiving notification of period elapsed by poll wait. +- if (!pcm->runtime->no_period_wakeup) { +- if (in_softirq()) { +- // In software IRQ context for 1394 OHCI. +- snd_pcm_period_elapsed(pcm); +- } else { +- // In process context of ALSA PCM application under acquired lock of +- // PCM substream. +- snd_pcm_period_elapsed_under_stream_lock(pcm); +- } +- } ++ if (!pcm->runtime->no_period_wakeup) ++ queue_work(system_highpri_wq, &s->period_work); + } + } + ++static void pcm_period_work(struct work_struct *work) ++{ ++ struct amdtp_stream *s = container_of(work, struct amdtp_stream, ++ period_work); ++ struct snd_pcm_substream *pcm = READ_ONCE(s->pcm); ++ ++ if (pcm) ++ snd_pcm_period_elapsed(pcm); ++} ++ + static int queue_packet(struct amdtp_stream *s, struct fw_iso_packet *params, + bool sched_irq) + { +@@ -1852,11 +1858,14 @@ unsigned long amdtp_domain_stream_pcm_pointer(struct amdtp_domain *d, + { + struct amdtp_stream *irq_target = d->irq_target; + +- // Process isochronous packets queued till recent isochronous cycle to handle PCM frames. + if (irq_target && amdtp_stream_running(irq_target)) { +- // In software IRQ context, the call causes dead-lock to disable the tasklet +- // synchronously. +- if (!in_softirq()) ++ // use wq to prevent AB/BA deadlock competition for ++ // substream lock: ++ // fw_iso_context_flush_completions() acquires ++ // lock by ohci_flush_iso_completions(), ++ // amdtp-stream process_rx_packets() attempts to ++ // acquire same lock by snd_pcm_elapsed() ++ if (current_work() != &s->period_work) + fw_iso_context_flush_completions(irq_target->context); + } + +@@ -1912,6 +1921,7 @@ static void amdtp_stream_stop(struct amdtp_stream *s) + return; + } + ++ cancel_work_sync(&s->period_work); + fw_iso_context_stop(s->context); + fw_iso_context_destroy(s->context); + s->context = ERR_PTR(-1); +diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h +index a1ed2e80f91a7..775db3fc4959f 100644 +--- a/sound/firewire/amdtp-stream.h ++++ b/sound/firewire/amdtp-stream.h +@@ -191,6 +191,7 @@ struct amdtp_stream { + + /* For a PCM substream processing. */ + struct snd_pcm_substream *pcm; ++ struct work_struct period_work; + snd_pcm_uframes_t pcm_buffer_pointer; + unsigned int pcm_period_pointer; + unsigned int pcm_frame_multiplier; +diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h +index 8556031bcd68e..f31cb31d46362 100644 +--- a/sound/pci/hda/hda_controller.h ++++ b/sound/pci/hda/hda_controller.h +@@ -28,7 +28,7 @@ + #else + #define AZX_DCAPS_I915_COMPONENT 0 /* NOP */ + #endif +-/* 14 unused */ ++#define AZX_DCAPS_AMD_ALLOC_FIX (1 << 14) /* AMD allocation workaround */ + #define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */ + #define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */ + #define AZX_DCAPS_AMD_WORKAROUND (1 << 17) /* AMD-specific workaround */ +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index a6a9d353fe635..d5c9f113e477a 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -40,6 +40,7 @@ + + #ifdef CONFIG_X86 + /* for snoop control */ ++#include + #include + #include + #endif +@@ -301,7 +302,7 @@ enum { + + /* quirks for ATI HDMI with snoop off */ + #define AZX_DCAPS_PRESET_ATI_HDMI_NS \ +- (AZX_DCAPS_PRESET_ATI_HDMI | AZX_DCAPS_SNOOP_OFF) ++ (AZX_DCAPS_PRESET_ATI_HDMI | AZX_DCAPS_AMD_ALLOC_FIX) + + /* quirks for AMD SB */ + #define AZX_DCAPS_PRESET_AMD_SB \ +@@ -1715,6 +1716,13 @@ static void azx_check_snoop_available(struct azx *chip) + if (chip->driver_caps & AZX_DCAPS_SNOOP_OFF) + snoop = false; + ++#ifdef CONFIG_X86 ++ /* check the presence of DMA ops (i.e. IOMMU), disable snoop conditionally */ ++ if ((chip->driver_caps & AZX_DCAPS_AMD_ALLOC_FIX) && ++ !get_dma_ops(chip->card->dev)) ++ snoop = false; ++#endif ++ + chip->snoop = snoop; + if (!snoop) { + dev_info(chip->card->dev, "Force to non-snoop mode\n"); +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c +index e8209178d87bb..af921364195e4 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -21,12 +21,6 @@ + #include "hda_jack.h" + #include "hda_generic.h" + +-enum { +- CX_HEADSET_NOPRESENT = 0, +- CX_HEADSET_PARTPRESENT, +- CX_HEADSET_ALLPRESENT, +-}; +- + struct conexant_spec { + struct hda_gen_spec gen; + +@@ -48,7 +42,6 @@ struct conexant_spec { + unsigned int gpio_led; + unsigned int gpio_mute_led_mask; + unsigned int gpio_mic_led_mask; +- unsigned int headset_present_flag; + bool is_cx8070_sn6140; + }; + +@@ -250,48 +243,19 @@ static void cx_process_headset_plugin(struct hda_codec *codec) + } + } + +-static void cx_update_headset_mic_vref(struct hda_codec *codec, unsigned int res) ++static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_callback *event) + { +- unsigned int phone_present, mic_persent, phone_tag, mic_tag; +- struct conexant_spec *spec = codec->spec; ++ unsigned int mic_present; + + /* In cx8070 and sn6140, the node 16 can only be config to headphone or disabled, + * the node 19 can only be config to microphone or disabled. + * Check hp&mic tag to process headset pulgin&plugout. + */ +- phone_tag = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); +- mic_tag = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); +- if ((phone_tag & (res >> AC_UNSOL_RES_TAG_SHIFT)) || +- (mic_tag & (res >> AC_UNSOL_RES_TAG_SHIFT))) { +- phone_present = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_PIN_SENSE, 0x0); +- if (!(phone_present & AC_PINSENSE_PRESENCE)) {/* headphone plugout */ +- spec->headset_present_flag = CX_HEADSET_NOPRESENT; +- snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); +- return; +- } +- if (spec->headset_present_flag == CX_HEADSET_NOPRESENT) { +- spec->headset_present_flag = CX_HEADSET_PARTPRESENT; +- } else if (spec->headset_present_flag == CX_HEADSET_PARTPRESENT) { +- mic_persent = snd_hda_codec_read(codec, 0x19, 0, +- AC_VERB_GET_PIN_SENSE, 0x0); +- /* headset is present */ +- if ((phone_present & AC_PINSENSE_PRESENCE) && +- (mic_persent & AC_PINSENSE_PRESENCE)) { +- cx_process_headset_plugin(codec); +- spec->headset_present_flag = CX_HEADSET_ALLPRESENT; +- } +- } +- } +-} +- +-static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res) +-{ +- struct conexant_spec *spec = codec->spec; +- +- if (spec->is_cx8070_sn6140) +- cx_update_headset_mic_vref(codec, res); +- +- snd_hda_jack_unsol_event(codec, res); ++ mic_present = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); ++ if (!(mic_present & AC_PINSENSE_PRESENCE)) /* mic plugout */ ++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); ++ else ++ cx_process_headset_plugin(codec); + } + + #ifdef CONFIG_PM +@@ -307,7 +271,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = { + .build_pcms = snd_hda_gen_build_pcms, + .init = cx_auto_init, + .free = cx_auto_free, +- .unsol_event = cx_jack_unsol_event, ++ .unsol_event = snd_hda_jack_unsol_event, + #ifdef CONFIG_PM + .suspend = cx_auto_suspend, + .check_power_status = snd_hda_gen_check_power_status, +@@ -1167,7 +1131,7 @@ static int patch_conexant_auto(struct hda_codec *codec) + case 0x14f11f86: + case 0x14f11f87: + spec->is_cx8070_sn6140 = true; +- spec->headset_present_flag = CX_HEADSET_NOPRESENT; ++ snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref); + break; + } + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index f3aca1c38b77d..0b33a00771450 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9639,6 +9639,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), + SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF), ++ SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST), + SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), +diff --git a/sound/usb/stream.c b/sound/usb/stream.c +index d5409f3879455..e14c725acebf2 100644 +--- a/sound/usb/stream.c ++++ b/sound/usb/stream.c +@@ -244,8 +244,8 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, + SNDRV_CHMAP_FR, /* right front */ + SNDRV_CHMAP_FC, /* center front */ + SNDRV_CHMAP_LFE, /* LFE */ +- SNDRV_CHMAP_SL, /* left surround */ +- SNDRV_CHMAP_SR, /* right surround */ ++ SNDRV_CHMAP_RL, /* left surround */ ++ SNDRV_CHMAP_RR, /* right surround */ + SNDRV_CHMAP_FLC, /* left of center */ + SNDRV_CHMAP_FRC, /* right of center */ + SNDRV_CHMAP_RC, /* surround */ +diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c +index aee937d14fbbf..09e6b4e1401c9 100644 +--- a/tools/perf/util/callchain.c ++++ b/tools/perf/util/callchain.c +@@ -1126,7 +1126,7 @@ int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *samp + int fill_callchain_info(struct addr_location *al, struct callchain_cursor_node *node, + bool hide_unresolved) + { +- struct machine *machine = maps__machine(node->ms.maps); ++ struct machine *machine = node->ms.maps ? maps__machine(node->ms.maps) : NULL; + + maps__put(al->maps); + al->maps = maps__get(node->ms.maps); +diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c +index d2043ec3bf6d6..4209b95690394 100644 +--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c ++++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c +@@ -1115,11 +1115,11 @@ int main_loop_s(int listensock) + return 1; + } + +- if (--cfg_repeat > 0) { +- if (cfg_input) +- close(fd); ++ if (cfg_input) ++ close(fd); ++ ++ if (--cfg_repeat > 0) + goto again; +- } + + return 0; + } +diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh +index 231a95a8de9ee..a2dae2a3a93e0 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -1778,6 +1778,8 @@ chk_prio_nr() + { + local mp_prio_nr_tx=$1 + local mp_prio_nr_rx=$2 ++ local mpj_syn=$3 ++ local mpj_syn_ack=$4 + local count + + print_check "ptx" +@@ -1799,6 +1801,26 @@ chk_prio_nr() + else + print_ok + fi ++ ++ print_check "syn backup" ++ count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinSynBackupRx") ++ if [ -z "$count" ]; then ++ print_skip ++ elif [ "$count" != "$mpj_syn" ]; then ++ fail_test "got $count JOIN[s] syn with Backup expected $mpj_syn" ++ else ++ print_ok ++ fi ++ ++ print_check "synack backup" ++ count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckBackupRx") ++ if [ -z "$count" ]; then ++ print_skip ++ elif [ "$count" != "$mpj_syn_ack" ]; then ++ fail_test "got $count JOIN[s] synack with Backup expected $mpj_syn_ack" ++ else ++ print_ok ++ fi + } + + chk_subflow_nr() +@@ -2751,11 +2773,24 @@ backup_tests() + sflags=nobackup speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 1 1 1 +- chk_prio_nr 0 1 ++ chk_prio_nr 0 1 1 0 + fi + + # single address, backup + if reset "single address, backup" && ++ continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then ++ pm_nl_set_limits $ns1 0 1 ++ pm_nl_add_endpoint $ns1 10.0.2.1 flags signal,backup ++ pm_nl_set_limits $ns2 1 1 ++ sflags=nobackup speed=slow \ ++ run_tests $ns1 $ns2 10.0.1.1 ++ chk_join_nr 1 1 1 ++ chk_add_nr 1 1 ++ chk_prio_nr 1 0 0 1 ++ fi ++ ++ # single address, switch to backup ++ if reset "single address, switch to backup" && + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then + pm_nl_set_limits $ns1 0 1 + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal +@@ -2764,20 +2799,20 @@ backup_tests() + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 1 1 1 + chk_add_nr 1 1 +- chk_prio_nr 1 1 ++ chk_prio_nr 1 1 0 0 + fi + + # single address with port, backup + if reset "single address with port, backup" && + continue_if mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then + pm_nl_set_limits $ns1 0 1 +- pm_nl_add_endpoint $ns1 10.0.2.1 flags signal port 10100 ++ pm_nl_add_endpoint $ns1 10.0.2.1 flags signal,backup port 10100 + pm_nl_set_limits $ns2 1 1 +- sflags=backup speed=slow \ ++ sflags=nobackup speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 1 1 1 + chk_add_nr 1 1 +- chk_prio_nr 1 1 ++ chk_prio_nr 1 0 0 1 + fi + + if reset "mpc backup" && +@@ -2786,17 +2821,26 @@ backup_tests() + speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 0 0 0 +- chk_prio_nr 0 1 ++ chk_prio_nr 0 1 0 0 + fi + + if reset "mpc backup both sides" && + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then +- pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup ++ pm_nl_set_limits $ns1 0 2 ++ pm_nl_set_limits $ns2 1 2 ++ pm_nl_add_endpoint $ns1 10.0.1.1 flags signal,backup + pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup ++ ++ # 10.0.2.2 (non-backup) -> 10.0.1.1 (backup) ++ pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow ++ # 10.0.1.2 (backup) -> 10.0.2.1 (non-backup) ++ pm_nl_add_endpoint $ns1 10.0.2.1 flags signal ++ ip -net "$ns2" route add 10.0.2.1 via 10.0.1.1 dev ns2eth1 # force this path ++ + speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 +- chk_join_nr 0 0 0 +- chk_prio_nr 1 1 ++ chk_join_nr 2 2 2 ++ chk_prio_nr 1 1 1 1 + fi + + if reset "mpc switch to backup" && +@@ -2805,7 +2849,7 @@ backup_tests() + sflags=backup speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 0 0 0 +- chk_prio_nr 0 1 ++ chk_prio_nr 0 1 0 0 + fi + + if reset "mpc switch to backup both sides" && +@@ -2815,7 +2859,7 @@ backup_tests() + sflags=backup speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 0 0 0 +- chk_prio_nr 1 1 ++ chk_prio_nr 1 1 0 0 + fi + } + +@@ -3215,7 +3259,7 @@ fullmesh_tests() + addr_nr_ns2=1 sflags=backup,fullmesh speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 2 2 2 +- chk_prio_nr 0 1 ++ chk_prio_nr 0 1 1 0 + chk_rm_nr 0 1 + fi + +@@ -3228,7 +3272,7 @@ fullmesh_tests() + sflags=nobackup,nofullmesh speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 2 2 2 +- chk_prio_nr 0 1 ++ chk_prio_nr 0 1 1 0 + chk_rm_nr 0 1 + fi + } +@@ -3407,7 +3451,7 @@ userspace_tests() + sflags=backup speed=slow \ + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 1 1 0 +- chk_prio_nr 0 0 ++ chk_prio_nr 0 0 0 0 + fi + + # userspace pm type prevents rm_addr diff --git a/patch/kernel/archive/odroidxu4-6.6/patch-6.6.45-46.patch b/patch/kernel/archive/odroidxu4-6.6/patch-6.6.45-46.patch new file mode 100644 index 000000000000..359d52eccf87 --- /dev/null +++ b/patch/kernel/archive/odroidxu4-6.6/patch-6.6.45-46.patch @@ -0,0 +1,6300 @@ +diff --git a/Documentation/admin-guide/cifs/usage.rst b/Documentation/admin-guide/cifs/usage.rst +index 20aba92dfc5f5..3de599cf0779a 100644 +--- a/Documentation/admin-guide/cifs/usage.rst ++++ b/Documentation/admin-guide/cifs/usage.rst +@@ -741,7 +741,7 @@ SecurityFlags Flags which control security negotiation and + may use NTLMSSP 0x00080 + must use NTLMSSP 0x80080 + seal (packet encryption) 0x00040 +- must seal (not implemented yet) 0x40040 ++ must seal 0x40040 + + cifsFYI If set to non-zero value, additional debug information + will be logged to the system error log. This field +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 8d2f9ed3f1076..a7fe113897361 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -664,12 +664,6 @@ + loops can be debugged more effectively on production + systems. + +- clocksource.max_cswd_read_retries= [KNL] +- Number of clocksource_watchdog() retries due to +- external delays before the clock will be marked +- unstable. Defaults to two retries, that is, +- three attempts to read the clock under test. +- + clocksource.verify_n_cpus= [KNL] + Limit the number of CPUs checked for clocksources + marked with CLOCK_SOURCE_VERIFY_PERCPU that +@@ -4655,11 +4649,9 @@ + + profile= [KNL] Enable kernel profiling via /proc/profile + Format: [,] +- Param: : "schedule", "sleep", or "kvm" ++ Param: : "schedule" or "kvm" + [defaults to kernel profiling] + Param: "schedule" - profile schedule points. +- Param: "sleep" - profile D-state sleeping (millisecs). +- Requires CONFIG_SCHEDSTATS + Param: "kvm" - profile VM exits. + Param: - step/bucket size as a power of 2 for + statistical time based profiling. +diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst +index 29fd5213eeb2b..357d6cb98161f 100644 +--- a/Documentation/arch/arm64/silicon-errata.rst ++++ b/Documentation/arch/arm64/silicon-errata.rst +@@ -119,32 +119,68 @@ stable kernels. + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A76 | #1463225 | ARM64_ERRATUM_1463225 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A76 | #3324349 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A77 | #3324348 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A78 | #3324344 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A78C | #3324346,3324347| ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A710 | #3324338 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-A715 | #2645198 | ARM64_ERRATUM_2645198 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A720 | #3456091 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-X1 | #3324344 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-X1C | #3324346 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_2224489 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-X2 | #3324338 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-X3 | #3324335 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-X4 | #3194386 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Cortex-X925 | #3324334 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N1 | #1349291 | N/A | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N1 | #1542419 | ARM64_ERRATUM_1542419 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Neoverse-N1 | #3324349 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N2 | #2139208 | ARM64_ERRATUM_2139208 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N2 | #2067961 | ARM64_ERRATUM_2067961 | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | Neoverse-N2 | #2253138 | ARM64_ERRATUM_2253138 | + +----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Neoverse-N2 | #3324339 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Neoverse-V1 | #3324341 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Neoverse-V2 | #3324336 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ ++| ARM | Neoverse-V3 | #3312417 | ARM64_ERRATUM_3194386 | +++----------------+-----------------+-----------------+-----------------------------+ + | ARM | MMU-500 | #841119,826419 | N/A | + +----------------+-----------------+-----------------+-----------------------------+ + | ARM | MMU-600 | #1076982,1209401| N/A | +diff --git a/Documentation/hwmon/corsair-psu.rst b/Documentation/hwmon/corsair-psu.rst +index 16db34d464dd6..7ed794087f848 100644 +--- a/Documentation/hwmon/corsair-psu.rst ++++ b/Documentation/hwmon/corsair-psu.rst +@@ -15,11 +15,11 @@ Supported devices: + + Corsair HX850i + +- Corsair HX1000i (Series 2022 and 2023) ++ Corsair HX1000i (Legacy and Series 2023) + +- Corsair HX1200i ++ Corsair HX1200i (Legacy and Series 2023) + +- Corsair HX1500i (Series 2022 and 2023) ++ Corsair HX1500i (Legacy and Series 2023) + + Corsair RM550i + +diff --git a/Makefile b/Makefile +index 0bd4bee2128b4..77de99984c2f1 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 6 + PATCHLEVEL = 6 +-SUBLEVEL = 45 ++SUBLEVEL = 46 + EXTRAVERSION = + NAME = Hurr durr I'ma ninja sloth + +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index f9777ce2ccb2d..9e0c1ac3d13ee 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -1068,6 +1068,44 @@ config ARM64_ERRATUM_3117295 + + If unsure, say Y. + ++config ARM64_ERRATUM_3194386 ++ bool "Cortex-*/Neoverse-*: workaround for MSR SSBS not self-synchronizing" ++ default y ++ help ++ This option adds the workaround for the following errata: ++ ++ * ARM Cortex-A76 erratum 3324349 ++ * ARM Cortex-A77 erratum 3324348 ++ * ARM Cortex-A78 erratum 3324344 ++ * ARM Cortex-A78C erratum 3324346 ++ * ARM Cortex-A78C erratum 3324347 ++ * ARM Cortex-A710 erratam 3324338 ++ * ARM Cortex-A720 erratum 3456091 ++ * ARM Cortex-A725 erratum 3456106 ++ * ARM Cortex-X1 erratum 3324344 ++ * ARM Cortex-X1C erratum 3324346 ++ * ARM Cortex-X2 erratum 3324338 ++ * ARM Cortex-X3 erratum 3324335 ++ * ARM Cortex-X4 erratum 3194386 ++ * ARM Cortex-X925 erratum 3324334 ++ * ARM Neoverse-N1 erratum 3324349 ++ * ARM Neoverse N2 erratum 3324339 ++ * ARM Neoverse-V1 erratum 3324341 ++ * ARM Neoverse V2 erratum 3324336 ++ * ARM Neoverse-V3 erratum 3312417 ++ ++ On affected cores "MSR SSBS, #0" instructions may not affect ++ subsequent speculative instructions, which may permit unexepected ++ speculative store bypassing. ++ ++ Work around this problem by placing a Speculation Barrier (SB) or ++ Instruction Synchronization Barrier (ISB) after kernel changes to ++ SSBS. The presence of the SSBS special-purpose register is hidden ++ from hwcaps and EL0 reads of ID_AA64PFR1_EL1, such that userspace ++ will use the PR_SPEC_STORE_BYPASS prctl to change SSBS. ++ ++ If unsure, say Y. ++ + config CAVIUM_ERRATUM_22375 + bool "Cavium erratum 22375, 24313" + default y +diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h +index cf2987464c186..1ca947d5c9396 100644 +--- a/arch/arm64/include/asm/barrier.h ++++ b/arch/arm64/include/asm/barrier.h +@@ -40,6 +40,10 @@ + */ + #define dgh() asm volatile("hint #6" : : : "memory") + ++#define spec_bar() asm volatile(ALTERNATIVE("dsb nsh\nisb\n", \ ++ SB_BARRIER_INSN"nop\n", \ ++ ARM64_HAS_SB)) ++ + #ifdef CONFIG_ARM64_PSEUDO_NMI + #define pmr_sync() \ + do { \ +diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h +index 52f076afeb960..5fd7caea44193 100644 +--- a/arch/arm64/include/asm/cputype.h ++++ b/arch/arm64/include/asm/cputype.h +@@ -86,6 +86,14 @@ + #define ARM_CPU_PART_CORTEX_X2 0xD48 + #define ARM_CPU_PART_NEOVERSE_N2 0xD49 + #define ARM_CPU_PART_CORTEX_A78C 0xD4B ++#define ARM_CPU_PART_CORTEX_X1C 0xD4C ++#define ARM_CPU_PART_CORTEX_X3 0xD4E ++#define ARM_CPU_PART_NEOVERSE_V2 0xD4F ++#define ARM_CPU_PART_CORTEX_A720 0xD81 ++#define ARM_CPU_PART_CORTEX_X4 0xD82 ++#define ARM_CPU_PART_NEOVERSE_V3 0xD84 ++#define ARM_CPU_PART_CORTEX_X925 0xD85 ++#define ARM_CPU_PART_CORTEX_A725 0xD87 + + #define APM_CPU_PART_XGENE 0x000 + #define APM_CPU_VAR_POTENZA 0x00 +@@ -159,6 +167,14 @@ + #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) + #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) + #define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C) ++#define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C) ++#define MIDR_CORTEX_X3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X3) ++#define MIDR_NEOVERSE_V2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V2) ++#define MIDR_CORTEX_A720 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A720) ++#define MIDR_CORTEX_X4 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X4) ++#define MIDR_NEOVERSE_V3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V3) ++#define MIDR_CORTEX_X925 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X925) ++#define MIDR_CORTEX_A725 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A725) + #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) + #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) + #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX) +diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c +index 7bba831f62c33..57b1d6a68256b 100644 +--- a/arch/arm64/kernel/cpu_errata.c ++++ b/arch/arm64/kernel/cpu_errata.c +@@ -448,6 +448,30 @@ static const struct midr_range erratum_spec_unpriv_load_list[] = { + }; + #endif + ++#ifdef CONFIG_ARM64_ERRATUM_3194386 ++static const struct midr_range erratum_spec_ssbs_list[] = { ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A76), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A77), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A78), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A78C), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A720), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A725), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_X1), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_X1C), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_X2), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_X3), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_X4), ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_X925), ++ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), ++ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2), ++ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V1), ++ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V2), ++ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3), ++ {} ++}; ++#endif ++ + const struct arm64_cpu_capabilities arm64_errata[] = { + #ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE + { +@@ -746,6 +770,13 @@ const struct arm64_cpu_capabilities arm64_errata[] = { + .cpu_enable = cpu_clear_bf16_from_user_emulation, + }, + #endif ++#ifdef CONFIG_ARM64_ERRATUM_3194386 ++ { ++ .desc = "SSBS not fully self-synchronizing", ++ .capability = ARM64_WORKAROUND_SPECULATIVE_SSBS, ++ ERRATA_MIDR_RANGE_LIST(erratum_spec_ssbs_list), ++ }, ++#endif + #ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD + { + .desc = "ARM errata 2966298, 3117295", +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c +index 444a73c2e6385..7e96604559004 100644 +--- a/arch/arm64/kernel/cpufeature.c ++++ b/arch/arm64/kernel/cpufeature.c +@@ -2190,6 +2190,17 @@ static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) + } + #endif /* CONFIG_ARM64_MTE */ + ++static void user_feature_fixup(void) ++{ ++ if (cpus_have_cap(ARM64_WORKAROUND_SPECULATIVE_SSBS)) { ++ struct arm64_ftr_reg *regp; ++ ++ regp = get_arm64_ftr_reg(SYS_ID_AA64PFR1_EL1); ++ if (regp) ++ regp->user_mask &= ~ID_AA64PFR1_EL1_SSBS_MASK; ++ } ++} ++ + static void elf_hwcap_fixup(void) + { + #ifdef CONFIG_ARM64_ERRATUM_1742098 +@@ -3345,6 +3356,7 @@ void __init setup_cpu_features(void) + u32 cwg; + + setup_system_capabilities(); ++ user_feature_fixup(); + setup_elf_hwcaps(arm64_elf_hwcaps); + + if (system_supports_32bit_el0()) { +diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c +index 05f40c4e18fda..57503dc4b22fa 100644 +--- a/arch/arm64/kernel/proton-pack.c ++++ b/arch/arm64/kernel/proton-pack.c +@@ -558,6 +558,18 @@ static enum mitigation_state spectre_v4_enable_hw_mitigation(void) + + /* SCTLR_EL1.DSSBS was initialised to 0 during boot */ + set_pstate_ssbs(0); ++ ++ /* ++ * SSBS is self-synchronizing and is intended to affect subsequent ++ * speculative instructions, but some CPUs can speculate with a stale ++ * value of SSBS. ++ * ++ * Mitigate this with an unconditional speculation barrier, as CPUs ++ * could mis-speculate branches and bypass a conditional barrier. ++ */ ++ if (IS_ENABLED(CONFIG_ARM64_ERRATUM_3194386)) ++ spec_bar(); ++ + return SPECTRE_MITIGATED; + } + +diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps +index 5511bee15603a..c251ef3caae56 100644 +--- a/arch/arm64/tools/cpucaps ++++ b/arch/arm64/tools/cpucaps +@@ -99,4 +99,5 @@ WORKAROUND_NVIDIA_CARMEL_CNP + WORKAROUND_QCOM_FALKOR_E1003 + WORKAROUND_REPEAT_TLBI + WORKAROUND_SPECULATIVE_AT ++WORKAROUND_SPECULATIVE_SSBS + WORKAROUND_SPECULATIVE_UNPRIV_LOAD +diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c +index 9fc10cea21e10..de4f3def4af0b 100644 +--- a/arch/loongarch/kernel/efi.c ++++ b/arch/loongarch/kernel/efi.c +@@ -66,6 +66,12 @@ void __init efi_runtime_init(void) + set_bit(EFI_RUNTIME_SERVICES, &efi.flags); + } + ++bool efi_poweroff_required(void) ++{ ++ return efi_enabled(EFI_RUNTIME_SERVICES) && ++ (acpi_gbl_reduced_hardware || acpi_no_s5); ++} ++ + unsigned long __initdata screen_info_table = EFI_INVALID_TABLE_ADDR; + + static void __init init_screen_info(void) +diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig +index 2834a64064970..a077e6bf9475f 100644 +--- a/arch/parisc/Kconfig ++++ b/arch/parisc/Kconfig +@@ -18,6 +18,7 @@ config PARISC + select ARCH_SUPPORTS_HUGETLBFS if PA20 + select ARCH_SUPPORTS_MEMORY_FAILURE + select ARCH_STACKWALK ++ select ARCH_HAS_CACHE_LINE_SIZE + select ARCH_HAS_DEBUG_VM_PGTABLE + select HAVE_RELIABLE_STACKTRACE + select DMA_OPS +diff --git a/arch/parisc/include/asm/cache.h b/arch/parisc/include/asm/cache.h +index 2a60d7a72f1fa..a3f0f100f2194 100644 +--- a/arch/parisc/include/asm/cache.h ++++ b/arch/parisc/include/asm/cache.h +@@ -20,7 +20,16 @@ + + #define SMP_CACHE_BYTES L1_CACHE_BYTES + +-#define ARCH_DMA_MINALIGN L1_CACHE_BYTES ++#ifdef CONFIG_PA20 ++#define ARCH_DMA_MINALIGN 128 ++#else ++#define ARCH_DMA_MINALIGN 32 ++#endif ++#define ARCH_KMALLOC_MINALIGN 16 /* ldcw requires 16-byte alignment */ ++ ++#define arch_slab_minalign() ((unsigned)dcache_stride) ++#define cache_line_size() dcache_stride ++#define dma_get_cache_alignment cache_line_size + + #define __read_mostly __section(".data..read_mostly") + +diff --git a/arch/parisc/net/bpf_jit_core.c b/arch/parisc/net/bpf_jit_core.c +index d6ee2fd455503..7b9cb3cda27ee 100644 +--- a/arch/parisc/net/bpf_jit_core.c ++++ b/arch/parisc/net/bpf_jit_core.c +@@ -114,7 +114,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) + jit_data->header = + bpf_jit_binary_alloc(prog_size + extable_size, + &jit_data->image, +- sizeof(u32), ++ sizeof(long), + bpf_fill_ill_insns); + if (!jit_data->header) { + prog = orig_prog; +diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h +index 621bac6b74011..24b7bd255e983 100644 +--- a/arch/x86/include/asm/msr-index.h ++++ b/arch/x86/include/asm/msr-index.h +@@ -237,6 +237,7 @@ + #define MSR_INTEGRITY_CAPS_ARRAY_BIST BIT(MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT) + #define MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT 4 + #define MSR_INTEGRITY_CAPS_PERIODIC_BIST BIT(MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT) ++#define MSR_INTEGRITY_CAPS_SAF_GEN_MASK GENMASK_ULL(10, 9) + + #define MSR_LBR_NHM_FROM 0x00000680 + #define MSR_LBR_NHM_TO 0x000006c0 +diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h +index cde8357bb226d..e897046c5d2c6 100644 +--- a/arch/x86/include/asm/qspinlock.h ++++ b/arch/x86/include/asm/qspinlock.h +@@ -66,13 +66,15 @@ static inline bool vcpu_is_preempted(long cpu) + + #ifdef CONFIG_PARAVIRT + /* +- * virt_spin_lock_key - enables (by default) the virt_spin_lock() hijack. ++ * virt_spin_lock_key - disables by default the virt_spin_lock() hijack. + * +- * Native (and PV wanting native due to vCPU pinning) should disable this key. +- * It is done in this backwards fashion to only have a single direction change, +- * which removes ordering between native_pv_spin_init() and HV setup. ++ * Native (and PV wanting native due to vCPU pinning) should keep this key ++ * disabled. Native does not touch the key. ++ * ++ * When in a guest then native_pv_lock_init() enables the key first and ++ * KVM/XEN might conditionally disable it later in the boot process again. + */ +-DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key); ++DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key); + + /* + * Shortcut for the queued_spin_lock_slowpath() function that allows +diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c +index 767bf1c71aadd..2a2fc14955cd3 100644 +--- a/arch/x86/kernel/cpu/mtrr/mtrr.c ++++ b/arch/x86/kernel/cpu/mtrr/mtrr.c +@@ -609,7 +609,7 @@ void mtrr_save_state(void) + { + int first_cpu; + +- if (!mtrr_enabled()) ++ if (!mtrr_enabled() || !mtrr_state.have_fixed) + return; + + first_cpu = cpumask_first(cpu_online_mask); +diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c +index 97f1436c1a203..8d51c86caa415 100644 +--- a/arch/x86/kernel/paravirt.c ++++ b/arch/x86/kernel/paravirt.c +@@ -71,13 +71,12 @@ DEFINE_PARAVIRT_ASM(pv_native_irq_enable, "sti", .noinstr.text); + DEFINE_PARAVIRT_ASM(pv_native_read_cr2, "mov %cr2, %rax", .noinstr.text); + #endif + +-DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key); ++DEFINE_STATIC_KEY_FALSE(virt_spin_lock_key); + + void __init native_pv_lock_init(void) + { +- if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) && +- !boot_cpu_has(X86_FEATURE_HYPERVISOR)) +- static_branch_disable(&virt_spin_lock_key); ++ if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) ++ static_branch_enable(&virt_spin_lock_key); + } + + static void native_tlb_remove_table(struct mmu_gather *tlb, void *table) +diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c +index 51b6b78e6b175..41d8c8f475a7c 100644 +--- a/arch/x86/mm/pti.c ++++ b/arch/x86/mm/pti.c +@@ -374,14 +374,14 @@ pti_clone_pgtable(unsigned long start, unsigned long end, + */ + *target_pmd = *pmd; + +- addr += PMD_SIZE; ++ addr = round_up(addr + 1, PMD_SIZE); + + } else if (level == PTI_CLONE_PTE) { + + /* Walk the page-table down to the pte level */ + pte = pte_offset_kernel(pmd, addr); + if (pte_none(*pte)) { +- addr += PAGE_SIZE; ++ addr = round_up(addr + 1, PAGE_SIZE); + continue; + } + +@@ -401,7 +401,7 @@ pti_clone_pgtable(unsigned long start, unsigned long end, + /* Clone the PTE */ + *target_pte = *pte; + +- addr += PAGE_SIZE; ++ addr = round_up(addr + 1, PAGE_SIZE); + + } else { + BUG(); +@@ -496,7 +496,7 @@ static void pti_clone_entry_text(void) + { + pti_clone_pgtable((unsigned long) __entry_text_start, + (unsigned long) __entry_text_end, +- PTI_CLONE_PMD); ++ PTI_LEVEL_KERNEL_IMAGE); + } + + /* +diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c +index 969bf81e8d546..7f7ad94f22b91 100644 +--- a/drivers/acpi/battery.c ++++ b/drivers/acpi/battery.c +@@ -678,12 +678,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, + return count; + } + +-static const struct device_attribute alarm_attr = { ++static struct device_attribute alarm_attr = { + .attr = {.name = "alarm", .mode = 0644}, + .show = acpi_battery_alarm_show, + .store = acpi_battery_alarm_store, + }; + ++static struct attribute *acpi_battery_attrs[] = { ++ &alarm_attr.attr, ++ NULL ++}; ++ATTRIBUTE_GROUPS(acpi_battery); ++ + /* + * The Battery Hooking API + * +@@ -823,7 +829,10 @@ static void __exit battery_hook_exit(void) + + static int sysfs_add_battery(struct acpi_battery *battery) + { +- struct power_supply_config psy_cfg = { .drv_data = battery, }; ++ struct power_supply_config psy_cfg = { ++ .drv_data = battery, ++ .attr_grp = acpi_battery_groups, ++ }; + bool full_cap_broken = false; + + if (!ACPI_BATTERY_CAPACITY_VALID(battery->full_charge_capacity) && +@@ -868,7 +877,7 @@ static int sysfs_add_battery(struct acpi_battery *battery) + return result; + } + battery_hook_add_battery(battery); +- return device_create_file(&battery->bat->dev, &alarm_attr); ++ return 0; + } + + static void sysfs_remove_battery(struct acpi_battery *battery) +@@ -879,7 +888,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery) + return; + } + battery_hook_remove_battery(battery); +- device_remove_file(&battery->bat->dev, &alarm_attr); + power_supply_unregister(battery->bat); + battery->bat = NULL; + mutex_unlock(&battery->sysfs_lock); +diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c +index 94e3c000df2e1..fdeb46ed21d69 100644 +--- a/drivers/acpi/sbs.c ++++ b/drivers/acpi/sbs.c +@@ -77,7 +77,6 @@ struct acpi_battery { + u16 spec; + u8 id; + u8 present:1; +- u8 have_sysfs_alarm:1; + }; + + #define to_acpi_battery(x) power_supply_get_drvdata(x) +@@ -462,12 +461,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, + return count; + } + +-static const struct device_attribute alarm_attr = { ++static struct device_attribute alarm_attr = { + .attr = {.name = "alarm", .mode = 0644}, + .show = acpi_battery_alarm_show, + .store = acpi_battery_alarm_store, + }; + ++static struct attribute *acpi_battery_attrs[] = { ++ &alarm_attr.attr, ++ NULL ++}; ++ATTRIBUTE_GROUPS(acpi_battery); ++ + /* -------------------------------------------------------------------------- + Driver Interface + -------------------------------------------------------------------------- */ +@@ -518,7 +523,10 @@ static int acpi_battery_read(struct acpi_battery *battery) + static int acpi_battery_add(struct acpi_sbs *sbs, int id) + { + struct acpi_battery *battery = &sbs->battery[id]; +- struct power_supply_config psy_cfg = { .drv_data = battery, }; ++ struct power_supply_config psy_cfg = { ++ .drv_data = battery, ++ .attr_grp = acpi_battery_groups, ++ }; + int result; + + battery->id = id; +@@ -548,10 +556,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) + goto end; + } + +- result = device_create_file(&battery->bat->dev, &alarm_attr); +- if (result) +- goto end; +- battery->have_sysfs_alarm = 1; + end: + pr_info("%s [%s]: Battery Slot [%s] (battery %s)\n", + ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), +@@ -563,11 +567,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id) + { + struct acpi_battery *battery = &sbs->battery[id]; + +- if (battery->bat) { +- if (battery->have_sysfs_alarm) +- device_remove_file(&battery->bat->dev, &alarm_attr); ++ if (battery->bat) + power_supply_unregister(battery->bat); +- } + } + + static int acpi_charger_add(struct acpi_sbs *sbs) +diff --git a/drivers/base/core.c b/drivers/base/core.c +index aeb4644817d57..cb323700e952f 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -2565,6 +2566,7 @@ static const char *dev_uevent_name(const struct kobject *kobj) + static int dev_uevent(const struct kobject *kobj, struct kobj_uevent_env *env) + { + const struct device *dev = kobj_to_dev(kobj); ++ struct device_driver *driver; + int retval = 0; + + /* add device node properties if present */ +@@ -2593,8 +2595,12 @@ static int dev_uevent(const struct kobject *kobj, struct kobj_uevent_env *env) + if (dev->type && dev->type->name) + add_uevent_var(env, "DEVTYPE=%s", dev->type->name); + +- if (dev->driver) +- add_uevent_var(env, "DRIVER=%s", dev->driver->name); ++ /* Synchronize with module_remove_driver() */ ++ rcu_read_lock(); ++ driver = READ_ONCE(dev->driver); ++ if (driver) ++ add_uevent_var(env, "DRIVER=%s", driver->name); ++ rcu_read_unlock(); + + /* Add common DT information about the device */ + of_device_uevent(dev, env); +@@ -2664,11 +2670,8 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr, + if (!env) + return -ENOMEM; + +- /* Synchronize with really_probe() */ +- device_lock(dev); + /* let the kset specific function add its keys */ + retval = kset->uevent_ops->uevent(&dev->kobj, env); +- device_unlock(dev); + if (retval) + goto out; + +diff --git a/drivers/base/module.c b/drivers/base/module.c +index a1b55da07127d..b0b79b9c189d4 100644 +--- a/drivers/base/module.c ++++ b/drivers/base/module.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + #include "base.h" + + static char *make_driver_name(struct device_driver *drv) +@@ -97,6 +98,9 @@ void module_remove_driver(struct device_driver *drv) + if (!drv) + return; + ++ /* Synchronize with dev_uevent() */ ++ synchronize_rcu(); ++ + sysfs_remove_link(&drv->p->kobj, "module"); + + if (drv->owner) +diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c +index 83e8e27a5ecec..b5d40e0e05f31 100644 +--- a/drivers/bluetooth/btnxpuart.c ++++ b/drivers/bluetooth/btnxpuart.c +@@ -340,7 +340,7 @@ static void ps_cancel_timer(struct btnxpuart_dev *nxpdev) + struct ps_data *psdata = &nxpdev->psdata; + + flush_work(&psdata->work); +- del_timer_sync(&psdata->ps_timer); ++ timer_shutdown_sync(&psdata->ps_timer); + } + + static void ps_control(struct hci_dev *hdev, u8 ps_state) +diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c +index 26919556ef5f0..b72b36e0abed8 100644 +--- a/drivers/clocksource/sh_cmt.c ++++ b/drivers/clocksource/sh_cmt.c +@@ -528,6 +528,7 @@ static void sh_cmt_set_next(struct sh_cmt_channel *ch, unsigned long delta) + static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) + { + struct sh_cmt_channel *ch = dev_id; ++ unsigned long flags; + + /* clear flags */ + sh_cmt_write_cmcsr(ch, sh_cmt_read_cmcsr(ch) & +@@ -558,6 +559,8 @@ static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) + + ch->flags &= ~FLAG_SKIPEVENT; + ++ raw_spin_lock_irqsave(&ch->lock, flags); ++ + if (ch->flags & FLAG_REPROGRAM) { + ch->flags &= ~FLAG_REPROGRAM; + sh_cmt_clock_event_program_verify(ch, 1); +@@ -570,6 +573,8 @@ static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) + + ch->flags &= ~FLAG_IRQCONTEXT; + ++ raw_spin_unlock_irqrestore(&ch->lock, flags); ++ + return IRQ_HANDLED; + } + +@@ -780,12 +785,18 @@ static int sh_cmt_clock_event_next(unsigned long delta, + struct clock_event_device *ced) + { + struct sh_cmt_channel *ch = ced_to_sh_cmt(ced); ++ unsigned long flags; + + BUG_ON(!clockevent_state_oneshot(ced)); ++ ++ raw_spin_lock_irqsave(&ch->lock, flags); ++ + if (likely(ch->flags & FLAG_IRQCONTEXT)) + ch->next_match_value = delta - 1; + else +- sh_cmt_set_next(ch, delta - 1); ++ __sh_cmt_set_next(ch, delta - 1); ++ ++ raw_spin_unlock_irqrestore(&ch->lock, flags); + + return 0; + } +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 1c512ed3fa6d9..5c0016c77d2ab 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -164,7 +165,7 @@ struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, + if (hwnum >= gdev->ngpio) + return ERR_PTR(-EINVAL); + +- return &gdev->descs[hwnum]; ++ return &gdev->descs[array_index_nospec(hwnum, gdev->ngpio)]; + } + EXPORT_SYMBOL_GPL(gpiochip_get_desc); + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index ea1bce13db941..eb663eb811563 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -3561,6 +3561,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, + mutex_init(&adev->grbm_idx_mutex); + mutex_init(&adev->mn_lock); + mutex_init(&adev->virt.vf_errors.lock); ++ mutex_init(&adev->virt.rlcg_reg_lock); + hash_init(adev->mn_hash); + mutex_init(&adev->psp.mutex); + mutex_init(&adev->notifier_lock); +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +index de9d7f3dc2336..99dd86337e841 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +@@ -258,9 +258,8 @@ amdgpu_job_prepare_job(struct drm_sched_job *sched_job, + struct dma_fence *fence = NULL; + int r; + +- /* Ignore soft recovered fences here */ + r = drm_sched_entity_error(s_entity); +- if (r && r != -ENODATA) ++ if (r) + goto error; + + if (!fence && job->gang_submit) +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c +index ca5c86e5f7cd6..8e8afbd237bcd 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c +@@ -334,7 +334,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size + + set_ta_context_funcs(psp, ta_type, &context); + +- if (!context->initialized) { ++ if (!context || !context->initialized) { + dev_err(adev->dev, "TA is not initialized\n"); + ret = -EINVAL; + goto err_free_shared_buf; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +index 67b75ff0f7c37..7cba98f8bbdca 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +@@ -1780,12 +1780,15 @@ static void amdgpu_ras_interrupt_process_handler(struct work_struct *work) + int amdgpu_ras_interrupt_dispatch(struct amdgpu_device *adev, + struct ras_dispatch_if *info) + { +- struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head); +- struct ras_ih_data *data = &obj->ih_data; ++ struct ras_manager *obj; ++ struct ras_ih_data *data; + ++ obj = amdgpu_ras_find_obj(adev, &info->head); + if (!obj) + return -EINVAL; + ++ data = &obj->ih_data; ++ + if (data->inuse == 0) + return 0; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +index 96857ae7fb5bc..ff4f52e07cc0d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +@@ -1003,6 +1003,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v + scratch_reg1 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg1; + scratch_reg2 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg2; + scratch_reg3 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg3; ++ ++ mutex_lock(&adev->virt.rlcg_reg_lock); ++ + if (reg_access_ctrl->spare_int) + spare_int = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->spare_int; + +@@ -1058,6 +1061,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v + } + + ret = readl(scratch_reg0); ++ ++ mutex_unlock(&adev->virt.rlcg_reg_lock); ++ + return ret; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +index fabb83e9d9aec..23b6efa9d25df 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +@@ -263,6 +263,8 @@ struct amdgpu_virt { + + /* the ucode id to signal the autoload */ + uint32_t autoload_ucode_id; ++ ++ struct mutex rlcg_reg_lock; + }; + + struct amdgpu_video_codec_info; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +index 349416e176a12..1cf1498204678 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +@@ -102,6 +102,11 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p, + if (!r) + r = amdgpu_sync_push_to_job(&sync, p->job); + amdgpu_sync_free(&sync); ++ ++ if (r) { ++ p->num_dw_left = 0; ++ amdgpu_job_free(p->job); ++ } + return r; + } + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 60db3800666ec..94059aef762be 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -2628,7 +2628,8 @@ static int dm_suspend(void *handle) + + dm->cached_dc_state = dc_copy_state(dm->dc->current_state); + +- dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); ++ if (dm->cached_dc_state) ++ dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); + + amdgpu_dm_commit_zero_streams(dm->dc); + +@@ -6483,7 +6484,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) + aconnector->dc_sink = aconnector->dc_link->local_sink ? + aconnector->dc_link->local_sink : + aconnector->dc_em_sink; +- dc_sink_retain(aconnector->dc_sink); ++ if (aconnector->dc_sink) ++ dc_sink_retain(aconnector->dc_sink); + } + } + +@@ -7296,7 +7298,8 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector) + drm_add_modes_noedid(connector, 1920, 1080); + } else { + amdgpu_dm_connector_ddc_get_modes(connector, edid); +- amdgpu_dm_connector_add_common_modes(encoder, connector); ++ if (encoder) ++ amdgpu_dm_connector_add_common_modes(encoder, connector); + amdgpu_dm_connector_add_freesync_modes(connector, edid); + } + amdgpu_dm_fbc_init(connector); +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +index 2104511f3b863..3880ddf1c820f 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +@@ -1266,6 +1266,9 @@ static bool is_dsc_need_re_compute( + } + } + ++ if (new_stream_on_link_num == 0) ++ return false; ++ + /* check current_state if there stream on link but it is not in + * new request state + */ +diff --git a/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c b/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c +index b621b97711b61..a7f5b0f6272ce 100644 +--- a/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c ++++ b/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c +@@ -162,7 +162,12 @@ static void set_hpo_fixed_vs_pe_retimer_dp_link_test_pattern(struct dc_link *lin + link_res->hpo_dp_link_enc->funcs->set_link_test_pattern( + link_res->hpo_dp_link_enc, tp_params); + } ++ + link->dc->link_srv->dp_trace_source_sequence(link, DPCD_SOURCE_SEQ_AFTER_SET_SOURCE_PATTERN); ++ ++ // Give retimer extra time to lock before updating DP_TRAINING_PATTERN_SET to TPS1 ++ if (tp_params->dp_phy_pattern == DP_TEST_PATTERN_128b_132b_TPS1_TRAINING_MODE) ++ msleep(30); + } + + static void set_hpo_fixed_vs_pe_retimer_dp_lane_settings(struct dc_link *link, +diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +index 9e4f8a4104a34..7bf46e4974f88 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +@@ -927,7 +927,7 @@ static int pp_dpm_switch_power_profile(void *handle, + enum PP_SMC_POWER_PROFILE type, bool en) + { + struct pp_hwmgr *hwmgr = handle; +- long workload; ++ long workload[1]; + uint32_t index; + + if (!hwmgr || !hwmgr->pm_en) +@@ -945,12 +945,12 @@ static int pp_dpm_switch_power_profile(void *handle, + hwmgr->workload_mask &= ~(1 << hwmgr->workload_prority[type]); + index = fls(hwmgr->workload_mask); + index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0; +- workload = hwmgr->workload_setting[index]; ++ workload[0] = hwmgr->workload_setting[index]; + } else { + hwmgr->workload_mask |= (1 << hwmgr->workload_prority[type]); + index = fls(hwmgr->workload_mask); + index = index <= Workload_Policy_Max ? index - 1 : 0; +- workload = hwmgr->workload_setting[index]; ++ workload[0] = hwmgr->workload_setting[index]; + } + + if (type == PP_SMC_POWER_PROFILE_COMPUTE && +@@ -960,7 +960,7 @@ static int pp_dpm_switch_power_profile(void *handle, + } + + if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) +- hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0); ++ hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, workload, 0); + + return 0; + } +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c +index 1d829402cd2e2..f4bd8e9357e22 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c +@@ -269,7 +269,7 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip_display_set + struct pp_power_state *new_ps) + { + uint32_t index; +- long workload; ++ long workload[1]; + + if (hwmgr->not_vf) { + if (!skip_display_settings) +@@ -294,10 +294,10 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip_display_set + if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) { + index = fls(hwmgr->workload_mask); + index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0; +- workload = hwmgr->workload_setting[index]; ++ workload[0] = hwmgr->workload_setting[index]; + +- if (hwmgr->power_profile_mode != workload && hwmgr->hwmgr_func->set_power_profile_mode) +- hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0); ++ if (hwmgr->power_profile_mode != workload[0] && hwmgr->hwmgr_func->set_power_profile_mode) ++ hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, workload, 0); + } + + return 0; +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +index aa91730e4eaff..163864bd51c34 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +@@ -2957,6 +2957,7 @@ static int smu7_update_edc_leakage_table(struct pp_hwmgr *hwmgr) + + static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) + { ++ struct amdgpu_device *adev = hwmgr->adev; + struct smu7_hwmgr *data; + int result = 0; + +@@ -2993,40 +2994,37 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) + /* Initalize Dynamic State Adjustment Rule Settings */ + result = phm_initializa_dynamic_state_adjustment_rule_settings(hwmgr); + +- if (0 == result) { +- struct amdgpu_device *adev = hwmgr->adev; ++ if (result) ++ goto fail; + +- data->is_tlu_enabled = false; ++ data->is_tlu_enabled = false; + +- hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = ++ hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = + SMU7_MAX_HARDWARE_POWERLEVELS; +- hwmgr->platform_descriptor.hardwarePerformanceLevels = 2; +- hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50; ++ hwmgr->platform_descriptor.hardwarePerformanceLevels = 2; ++ hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50; + +- data->pcie_gen_cap = adev->pm.pcie_gen_mask; +- if (data->pcie_gen_cap & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) +- data->pcie_spc_cap = 20; +- else +- data->pcie_spc_cap = 16; +- data->pcie_lane_cap = adev->pm.pcie_mlw_mask; +- +- hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */ +-/* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ +- hwmgr->platform_descriptor.clockStep.engineClock = 500; +- hwmgr->platform_descriptor.clockStep.memoryClock = 500; +- smu7_thermal_parameter_init(hwmgr); +- } else { +- /* Ignore return value in here, we are cleaning up a mess. */ +- smu7_hwmgr_backend_fini(hwmgr); +- } ++ data->pcie_gen_cap = adev->pm.pcie_gen_mask; ++ if (data->pcie_gen_cap & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) ++ data->pcie_spc_cap = 20; ++ else ++ data->pcie_spc_cap = 16; ++ data->pcie_lane_cap = adev->pm.pcie_mlw_mask; ++ ++ hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */ ++ /* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ ++ hwmgr->platform_descriptor.clockStep.engineClock = 500; ++ hwmgr->platform_descriptor.clockStep.memoryClock = 500; ++ smu7_thermal_parameter_init(hwmgr); + + result = smu7_update_edc_leakage_table(hwmgr); +- if (result) { +- smu7_hwmgr_backend_fini(hwmgr); +- return result; +- } ++ if (result) ++ goto fail; + + return 0; ++fail: ++ smu7_hwmgr_backend_fini(hwmgr); ++ return result; + } + + static int smu7_force_dpm_highest(struct pp_hwmgr *hwmgr) +@@ -3316,8 +3314,7 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, + const struct pp_power_state *current_ps) + { + struct amdgpu_device *adev = hwmgr->adev; +- struct smu7_power_state *smu7_ps = +- cast_phw_smu7_power_state(&request_ps->hardware); ++ struct smu7_power_state *smu7_ps; + uint32_t sclk; + uint32_t mclk; + struct PP_Clocks minimum_clocks = {0}; +@@ -3334,6 +3331,10 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, + uint32_t latency; + bool latency_allowed = false; + ++ smu7_ps = cast_phw_smu7_power_state(&request_ps->hardware); ++ if (!smu7_ps) ++ return -EINVAL; ++ + data->battery_state = (PP_StateUILabel_Battery == + request_ps->classification.ui_label); + data->mclk_ignore_signal = false; +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +index b015a601b385a..eb744401e0567 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c +@@ -1065,16 +1065,18 @@ static int smu8_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, + struct pp_power_state *prequest_ps, + const struct pp_power_state *pcurrent_ps) + { +- struct smu8_power_state *smu8_ps = +- cast_smu8_power_state(&prequest_ps->hardware); +- +- const struct smu8_power_state *smu8_current_ps = +- cast_const_smu8_power_state(&pcurrent_ps->hardware); +- ++ struct smu8_power_state *smu8_ps; ++ const struct smu8_power_state *smu8_current_ps; + struct smu8_hwmgr *data = hwmgr->backend; + struct PP_Clocks clocks = {0, 0, 0, 0}; + bool force_high; + ++ smu8_ps = cast_smu8_power_state(&prequest_ps->hardware); ++ smu8_current_ps = cast_const_smu8_power_state(&pcurrent_ps->hardware); ++ ++ if (!smu8_ps || !smu8_current_ps) ++ return -EINVAL; ++ + smu8_ps->need_dfs_bypass = true; + + data->battery_state = (PP_StateUILabel_Battery == prequest_ps->classification.ui_label); +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +index 6d6bc6a380b36..d43a530aba0e3 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +@@ -3259,8 +3259,7 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, + const struct pp_power_state *current_ps) + { + struct amdgpu_device *adev = hwmgr->adev; +- struct vega10_power_state *vega10_ps = +- cast_phw_vega10_power_state(&request_ps->hardware); ++ struct vega10_power_state *vega10_ps; + uint32_t sclk; + uint32_t mclk; + struct PP_Clocks minimum_clocks = {0}; +@@ -3278,6 +3277,10 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, + uint32_t stable_pstate_sclk = 0, stable_pstate_mclk = 0; + uint32_t latency; + ++ vega10_ps = cast_phw_vega10_power_state(&request_ps->hardware); ++ if (!vega10_ps) ++ return -EINVAL; ++ + data->battery_state = (PP_StateUILabel_Battery == + request_ps->classification.ui_label); + +@@ -3415,13 +3418,17 @@ static int vega10_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, co + const struct vega10_power_state *vega10_ps = + cast_const_phw_vega10_power_state(states->pnew_state); + struct vega10_single_dpm_table *sclk_table = &(data->dpm_table.gfx_table); +- uint32_t sclk = vega10_ps->performance_levels +- [vega10_ps->performance_level_count - 1].gfx_clock; + struct vega10_single_dpm_table *mclk_table = &(data->dpm_table.mem_table); +- uint32_t mclk = vega10_ps->performance_levels +- [vega10_ps->performance_level_count - 1].mem_clock; ++ uint32_t sclk, mclk; + uint32_t i; + ++ if (vega10_ps == NULL) ++ return -EINVAL; ++ sclk = vega10_ps->performance_levels ++ [vega10_ps->performance_level_count - 1].gfx_clock; ++ mclk = vega10_ps->performance_levels ++ [vega10_ps->performance_level_count - 1].mem_clock; ++ + for (i = 0; i < sclk_table->count; i++) { + if (sclk == sclk_table->dpm_levels[i].value) + break; +@@ -3728,6 +3735,9 @@ static int vega10_generate_dpm_level_enable_mask( + cast_const_phw_vega10_power_state(states->pnew_state); + int i; + ++ if (vega10_ps == NULL) ++ return -EINVAL; ++ + PP_ASSERT_WITH_CODE(!vega10_trim_dpm_states(hwmgr, vega10_ps), + "Attempt to Trim DPM States Failed!", + return -1); +@@ -4995,6 +5005,8 @@ static int vega10_check_states_equal(struct pp_hwmgr *hwmgr, + + vega10_psa = cast_const_phw_vega10_power_state(pstate1); + vega10_psb = cast_const_phw_vega10_power_state(pstate2); ++ if (vega10_psa == NULL || vega10_psb == NULL) ++ return -EINVAL; + + /* If the two states don't even have the same number of performance levels + * they cannot be the same state. +@@ -5128,6 +5140,8 @@ static int vega10_set_sclk_od(struct pp_hwmgr *hwmgr, uint32_t value) + return -EINVAL; + + vega10_ps = cast_phw_vega10_power_state(&ps->hardware); ++ if (vega10_ps == NULL) ++ return -EINVAL; + + vega10_ps->performance_levels + [vega10_ps->performance_level_count - 1].gfx_clock = +@@ -5179,6 +5193,8 @@ static int vega10_set_mclk_od(struct pp_hwmgr *hwmgr, uint32_t value) + return -EINVAL; + + vega10_ps = cast_phw_vega10_power_state(&ps->hardware); ++ if (vega10_ps == NULL) ++ return -EINVAL; + + vega10_ps->performance_levels + [vega10_ps->performance_level_count - 1].mem_clock = +@@ -5420,6 +5436,9 @@ static void vega10_odn_update_power_state(struct pp_hwmgr *hwmgr) + return; + + vega10_ps = cast_phw_vega10_power_state(&ps->hardware); ++ if (vega10_ps == NULL) ++ return; ++ + max_level = vega10_ps->performance_level_count - 1; + + if (vega10_ps->performance_levels[max_level].gfx_clock != +@@ -5442,6 +5461,9 @@ static void vega10_odn_update_power_state(struct pp_hwmgr *hwmgr) + + ps = (struct pp_power_state *)((unsigned long)(hwmgr->ps) + hwmgr->ps_size * (hwmgr->num_ps - 1)); + vega10_ps = cast_phw_vega10_power_state(&ps->hardware); ++ if (vega10_ps == NULL) ++ return; ++ + max_level = vega10_ps->performance_level_count - 1; + + if (vega10_ps->performance_levels[max_level].gfx_clock != +@@ -5632,6 +5654,8 @@ static int vega10_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_ + return -EINVAL; + + vega10_ps = cast_const_phw_vega10_power_state(state); ++ if (vega10_ps == NULL) ++ return -EINVAL; + + i = index > vega10_ps->performance_level_count - 1 ? + vega10_ps->performance_level_count - 1 : index; +diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +index 56e4c312cb7a9..1402e468aa90f 100644 +--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +@@ -1846,7 +1846,7 @@ static int smu_adjust_power_state_dynamic(struct smu_context *smu, + { + int ret = 0; + int index = 0; +- long workload; ++ long workload[1]; + struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); + + if (!skip_display_settings) { +@@ -1886,10 +1886,10 @@ static int smu_adjust_power_state_dynamic(struct smu_context *smu, + smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM) { + index = fls(smu->workload_mask); + index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0; +- workload = smu->workload_setting[index]; ++ workload[0] = smu->workload_setting[index]; + +- if (smu->power_profile_mode != workload) +- smu_bump_power_profile_mode(smu, &workload, 0); ++ if (smu->power_profile_mode != workload[0]) ++ smu_bump_power_profile_mode(smu, workload, 0); + } + + return ret; +@@ -1939,7 +1939,7 @@ static int smu_switch_power_profile(void *handle, + { + struct smu_context *smu = handle; + struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); +- long workload; ++ long workload[1]; + uint32_t index; + + if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) +@@ -1952,17 +1952,17 @@ static int smu_switch_power_profile(void *handle, + smu->workload_mask &= ~(1 << smu->workload_prority[type]); + index = fls(smu->workload_mask); + index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0; +- workload = smu->workload_setting[index]; ++ workload[0] = smu->workload_setting[index]; + } else { + smu->workload_mask |= (1 << smu->workload_prority[type]); + index = fls(smu->workload_mask); + index = index <= WORKLOAD_POLICY_MAX ? index - 1 : 0; +- workload = smu->workload_setting[index]; ++ workload[0] = smu->workload_setting[index]; + } + + if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL && + smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM) +- smu_bump_power_profile_mode(smu, &workload, 0); ++ smu_bump_power_profile_mode(smu, workload, 0); + + return 0; + } +diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +index 6a4f20fccf841..7b0bc9704eacb 100644 +--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c ++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +@@ -1027,7 +1027,6 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, + u32 status_reg; + u8 *buffer = msg->buffer; + unsigned int i; +- int num_transferred = 0; + int ret; + + /* Buffer size of AUX CH is 16 bytes */ +@@ -1079,7 +1078,6 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, + reg = buffer[i]; + writel(reg, dp->reg_base + ANALOGIX_DP_BUF_DATA_0 + + 4 * i); +- num_transferred++; + } + } + +@@ -1127,7 +1125,6 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, + reg = readl(dp->reg_base + ANALOGIX_DP_BUF_DATA_0 + + 4 * i); + buffer[i] = (unsigned char)reg; +- num_transferred++; + } + } + +@@ -1144,7 +1141,7 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, + (msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_NATIVE_READ) + msg->reply = DP_AUX_NATIVE_REPLY_ACK; + +- return num_transferred > 0 ? num_transferred : -EBUSY; ++ return msg->size; + + aux_error: + /* if aux err happen, reset aux */ +diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c +index 9023c0216a8a4..6ead31701e79e 100644 +--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c ++++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c +@@ -4024,6 +4024,7 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) + if (up_req->msg.req_type == DP_CONNECTION_STATUS_NOTIFY) { + const struct drm_dp_connection_status_notify *conn_stat = + &up_req->msg.u.conn_stat; ++ bool handle_csn; + + drm_dbg_kms(mgr->dev, "Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", + conn_stat->port_number, +@@ -4032,6 +4033,16 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) + conn_stat->message_capability_status, + conn_stat->input_port, + conn_stat->peer_device_type); ++ ++ mutex_lock(&mgr->probe_lock); ++ handle_csn = mgr->mst_primary->link_address_sent; ++ mutex_unlock(&mgr->probe_lock); ++ ++ if (!handle_csn) { ++ drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it."); ++ kfree(up_req); ++ goto out; ++ } + } else if (up_req->msg.req_type == DP_RESOURCE_STATUS_NOTIFY) { + const struct drm_dp_resource_status_notify *res_stat = + &up_req->msg.u.resource_stat; +diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c +index 0683a129b3628..51df7244de718 100644 +--- a/drivers/gpu/drm/drm_client_modeset.c ++++ b/drivers/gpu/drm/drm_client_modeset.c +@@ -869,6 +869,11 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, + + kfree(modeset->mode); + modeset->mode = drm_mode_duplicate(dev, mode); ++ if (!modeset->mode) { ++ ret = -ENOMEM; ++ break; ++ } ++ + drm_connector_get(connector); + modeset->connectors[modeset->num_connectors++] = connector; + modeset->x = offset->x; +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +index 310654542b42c..a59c17ec7fa36 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c +@@ -290,6 +290,41 @@ static vm_fault_t vm_fault_cpu(struct vm_fault *vmf) + return i915_error_to_vmf_fault(err); + } + ++static void set_address_limits(struct vm_area_struct *area, ++ struct i915_vma *vma, ++ unsigned long obj_offset, ++ unsigned long *start_vaddr, ++ unsigned long *end_vaddr) ++{ ++ unsigned long vm_start, vm_end, vma_size; /* user's memory parameters */ ++ long start, end; /* memory boundaries */ ++ ++ /* ++ * Let's move into the ">> PAGE_SHIFT" ++ * domain to be sure not to lose bits ++ */ ++ vm_start = area->vm_start >> PAGE_SHIFT; ++ vm_end = area->vm_end >> PAGE_SHIFT; ++ vma_size = vma->size >> PAGE_SHIFT; ++ ++ /* ++ * Calculate the memory boundaries by considering the offset ++ * provided by the user during memory mapping and the offset ++ * provided for the partial mapping. ++ */ ++ start = vm_start; ++ start -= obj_offset; ++ start += vma->gtt_view.partial.offset; ++ end = start + vma_size; ++ ++ start = max_t(long, start, vm_start); ++ end = min_t(long, end, vm_end); ++ ++ /* Let's move back into the "<< PAGE_SHIFT" domain */ ++ *start_vaddr = (unsigned long)start << PAGE_SHIFT; ++ *end_vaddr = (unsigned long)end << PAGE_SHIFT; ++} ++ + static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) + { + #define MIN_CHUNK_PAGES (SZ_1M >> PAGE_SHIFT) +@@ -302,14 +337,18 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) + struct i915_ggtt *ggtt = to_gt(i915)->ggtt; + bool write = area->vm_flags & VM_WRITE; + struct i915_gem_ww_ctx ww; ++ unsigned long obj_offset; ++ unsigned long start, end; /* memory boundaries */ + intel_wakeref_t wakeref; + struct i915_vma *vma; + pgoff_t page_offset; ++ unsigned long pfn; + int srcu; + int ret; + +- /* We don't use vmf->pgoff since that has the fake offset */ ++ obj_offset = area->vm_pgoff - drm_vma_node_start(&mmo->vma_node); + page_offset = (vmf->address - area->vm_start) >> PAGE_SHIFT; ++ page_offset += obj_offset; + + trace_i915_gem_object_fault(obj, page_offset, true, write); + +@@ -402,12 +441,14 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) + if (ret) + goto err_unpin; + ++ set_address_limits(area, vma, obj_offset, &start, &end); ++ ++ pfn = (ggtt->gmadr.start + i915_ggtt_offset(vma)) >> PAGE_SHIFT; ++ pfn += (start - area->vm_start) >> PAGE_SHIFT; ++ pfn += obj_offset - vma->gtt_view.partial.offset; ++ + /* Finally, remap it using the new GTT offset */ +- ret = remap_io_mapping(area, +- area->vm_start + (vma->gtt_view.partial.offset << PAGE_SHIFT), +- (ggtt->gmadr.start + i915_ggtt_offset(vma)) >> PAGE_SHIFT, +- min_t(u64, vma->size, area->vm_end - area->vm_start), +- &ggtt->iomap); ++ ret = remap_io_mapping(area, start, pfn, end - start, &ggtt->iomap); + if (ret) + goto err_fence; + +@@ -1088,6 +1129,8 @@ int i915_gem_fb_mmap(struct drm_i915_gem_object *obj, struct vm_area_struct *vma + mmo = mmap_offset_attach(obj, mmap_type, NULL); + if (IS_ERR(mmo)) + return PTR_ERR(mmo); ++ ++ vma->vm_pgoff += drm_vma_node_start(&mmo->vma_node); + } + + /* +diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c +index 10fd9154cc465..8c9b656eeb59d 100644 +--- a/drivers/gpu/drm/lima/lima_drv.c ++++ b/drivers/gpu/drm/lima/lima_drv.c +@@ -486,3 +486,4 @@ module_platform_driver(lima_platform_driver); + MODULE_AUTHOR("Lima Project Developers"); + MODULE_DESCRIPTION("Lima DRM Driver"); + MODULE_LICENSE("GPL v2"); ++MODULE_SOFTDEP("pre: governor_simpleondemand"); +diff --git a/drivers/gpu/drm/mgag200/mgag200_i2c.c b/drivers/gpu/drm/mgag200/mgag200_i2c.c +index 0c48bdf3e7f80..f5c5d06d0d4bb 100644 +--- a/drivers/gpu/drm/mgag200/mgag200_i2c.c ++++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c +@@ -31,6 +31,8 @@ + #include + #include + ++#include ++ + #include "mgag200_drv.h" + + static int mga_i2c_read_gpio(struct mga_device *mdev) +@@ -86,7 +88,7 @@ static int mga_gpio_getscl(void *data) + return (mga_i2c_read_gpio(mdev) & i2c->clock) ? 1 : 0; + } + +-static void mgag200_i2c_release(void *res) ++static void mgag200_i2c_release(struct drm_device *dev, void *res) + { + struct mga_i2c_chan *i2c = res; + +@@ -115,7 +117,7 @@ int mgag200_i2c_init(struct mga_device *mdev, struct mga_i2c_chan *i2c) + i2c->adapter.algo_data = &i2c->bit; + + i2c->bit.udelay = 10; +- i2c->bit.timeout = 2; ++ i2c->bit.timeout = usecs_to_jiffies(2200); + i2c->bit.data = i2c; + i2c->bit.setsda = mga_gpio_setsda; + i2c->bit.setscl = mga_gpio_setscl; +@@ -126,5 +128,5 @@ int mgag200_i2c_init(struct mga_device *mdev, struct mga_i2c_chan *i2c) + if (ret) + return ret; + +- return devm_add_action_or_reset(dev->dev, mgag200_i2c_release, i2c); ++ return drmm_add_action_or_reset(dev, mgag200_i2c_release, i2c); + } +diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c +index 2bbcdc649e862..3d41e590d4712 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c ++++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c +@@ -1320,6 +1320,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job) + + drm_gpuva_for_each_op(va_op, op->ops) { + struct drm_gem_object *obj = op_gem_obj(va_op); ++ struct nouveau_bo *nvbo; + + if (unlikely(!obj)) + continue; +@@ -1330,8 +1331,9 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job) + if (unlikely(va_op->op == DRM_GPUVA_OP_UNMAP)) + continue; + +- ret = nouveau_bo_validate(nouveau_gem_object(obj), +- true, false); ++ nvbo = nouveau_gem_object(obj); ++ nouveau_bo_placement_set(nvbo, nvbo->valid_domains, 0); ++ ret = nouveau_bo_validate(nvbo, true, false); + if (ret) { + op = list_last_op(&bind_job->ops); + goto unwind; +diff --git a/drivers/gpu/drm/radeon/pptable.h b/drivers/gpu/drm/radeon/pptable.h +index 844f0490bf31f..ce8832916704f 100644 +--- a/drivers/gpu/drm/radeon/pptable.h ++++ b/drivers/gpu/drm/radeon/pptable.h +@@ -439,7 +439,7 @@ typedef struct _StateArray{ + //how many states we have + UCHAR ucNumEntries; + +- ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries); ++ ATOM_PPLIB_STATE_V2 states[] /* __counted_by(ucNumEntries) */; + }StateArray; + + +diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c +index 2c7c92272fe39..f8f22b8a67cdf 100644 +--- a/drivers/hwmon/corsair-psu.c ++++ b/drivers/hwmon/corsair-psu.c +@@ -875,15 +875,16 @@ static const struct hid_device_id corsairpsu_idtable[] = { + { HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */ + { HID_USB_DEVICE(0x1b1c, 0x1c05) }, /* Corsair HX750i */ + { HID_USB_DEVICE(0x1b1c, 0x1c06) }, /* Corsair HX850i */ +- { HID_USB_DEVICE(0x1b1c, 0x1c07) }, /* Corsair HX1000i Series 2022 */ +- { HID_USB_DEVICE(0x1b1c, 0x1c08) }, /* Corsair HX1200i */ ++ { HID_USB_DEVICE(0x1b1c, 0x1c07) }, /* Corsair HX1000i Legacy */ ++ { HID_USB_DEVICE(0x1b1c, 0x1c08) }, /* Corsair HX1200i Legacy */ + { HID_USB_DEVICE(0x1b1c, 0x1c09) }, /* Corsair RM550i */ + { HID_USB_DEVICE(0x1b1c, 0x1c0a) }, /* Corsair RM650i */ + { HID_USB_DEVICE(0x1b1c, 0x1c0b) }, /* Corsair RM750i */ + { HID_USB_DEVICE(0x1b1c, 0x1c0c) }, /* Corsair RM850i */ + { HID_USB_DEVICE(0x1b1c, 0x1c0d) }, /* Corsair RM1000i */ + { HID_USB_DEVICE(0x1b1c, 0x1c1e) }, /* Corsair HX1000i Series 2023 */ +- { HID_USB_DEVICE(0x1b1c, 0x1c1f) }, /* Corsair HX1500i Series 2022 and 2023 */ ++ { HID_USB_DEVICE(0x1b1c, 0x1c1f) }, /* Corsair HX1500i Legacy and Series 2023 */ ++ { HID_USB_DEVICE(0x1b1c, 0x1c23) }, /* Corsair HX1200i Series 2023 */ + { }, + }; + MODULE_DEVICE_TABLE(hid, corsairpsu_idtable); +diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c +index 5cc32a465f12e..b17411e97be68 100644 +--- a/drivers/i2c/busses/i2c-qcom-geni.c ++++ b/drivers/i2c/busses/i2c-qcom-geni.c +@@ -991,8 +991,11 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev) + return ret; + + ret = geni_se_resources_on(&gi2c->se); +- if (ret) ++ if (ret) { ++ clk_disable_unprepare(gi2c->core_clk); ++ geni_icc_disable(&gi2c->se); + return ret; ++ } + + enable_irq(gi2c->irq); + gi2c->suspended = 0; +diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c +index 138c3f5e0093a..6520e09743912 100644 +--- a/drivers/i2c/i2c-smbus.c ++++ b/drivers/i2c/i2c-smbus.c +@@ -34,6 +34,7 @@ static int smbus_do_alert(struct device *dev, void *addrp) + struct i2c_client *client = i2c_verify_client(dev); + struct alert_data *data = addrp; + struct i2c_driver *driver; ++ int ret; + + if (!client || client->addr != data->addr) + return 0; +@@ -47,16 +48,47 @@ static int smbus_do_alert(struct device *dev, void *addrp) + device_lock(dev); + if (client->dev.driver) { + driver = to_i2c_driver(client->dev.driver); +- if (driver->alert) ++ if (driver->alert) { ++ /* Stop iterating after we find the device */ + driver->alert(client, data->type, data->data); +- else ++ ret = -EBUSY; ++ } else { + dev_warn(&client->dev, "no driver alert()!\n"); +- } else ++ ret = -EOPNOTSUPP; ++ } ++ } else { + dev_dbg(&client->dev, "alert with no driver\n"); ++ ret = -ENODEV; ++ } ++ device_unlock(dev); ++ ++ return ret; ++} ++ ++/* Same as above, but call back all drivers with alert handler */ ++ ++static int smbus_do_alert_force(struct device *dev, void *addrp) ++{ ++ struct i2c_client *client = i2c_verify_client(dev); ++ struct alert_data *data = addrp; ++ struct i2c_driver *driver; ++ ++ if (!client || (client->flags & I2C_CLIENT_TEN)) ++ return 0; ++ ++ /* ++ * Drivers should either disable alerts, or provide at least ++ * a minimal handler. Lock so the driver won't change. ++ */ ++ device_lock(dev); ++ if (client->dev.driver) { ++ driver = to_i2c_driver(client->dev.driver); ++ if (driver->alert) ++ driver->alert(client, data->type, data->data); ++ } + device_unlock(dev); + +- /* Stop iterating after we find the device */ +- return -EBUSY; ++ return 0; + } + + /* +@@ -67,6 +99,7 @@ static irqreturn_t smbus_alert(int irq, void *d) + { + struct i2c_smbus_alert *alert = d; + struct i2c_client *ara; ++ unsigned short prev_addr = I2C_CLIENT_END; /* Not a valid address */ + + ara = alert->ara; + +@@ -94,8 +127,25 @@ static irqreturn_t smbus_alert(int irq, void *d) + data.addr, data.data); + + /* Notify driver for the device which issued the alert */ +- device_for_each_child(&ara->adapter->dev, &data, +- smbus_do_alert); ++ status = device_for_each_child(&ara->adapter->dev, &data, ++ smbus_do_alert); ++ /* ++ * If we read the same address more than once, and the alert ++ * was not handled by a driver, it won't do any good to repeat ++ * the loop because it will never terminate. Try again, this ++ * time calling the alert handlers of all devices connected to ++ * the bus, and abort the loop afterwards. If this helps, we ++ * are all set. If it doesn't, there is nothing else we can do, ++ * so we might as well abort the loop. ++ * Note: This assumes that a driver with alert handler handles ++ * the alert properly and clears it if necessary. ++ */ ++ if (data.addr == prev_addr && status != -EBUSY) { ++ device_for_each_child(&ara->adapter->dev, &data, ++ smbus_do_alert_force); ++ break; ++ } ++ prev_addr = data.addr; + } + + return IRQ_HANDLED; +diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c +index 9d8f2c4060431..b35903a06902f 100644 +--- a/drivers/irqchip/irq-loongarch-cpu.c ++++ b/drivers/irqchip/irq-loongarch-cpu.c +@@ -18,11 +18,13 @@ struct fwnode_handle *cpuintc_handle; + + static u32 lpic_gsi_to_irq(u32 gsi) + { ++ int irq = 0; ++ + /* Only pch irqdomain transferring is required for LoongArch. */ + if (gsi >= GSI_MIN_PCH_IRQ && gsi <= GSI_MAX_PCH_IRQ) +- return acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH); ++ irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH); + +- return 0; ++ return (irq > 0) ? irq : 0; + } + + static struct fwnode_handle *lpic_get_gsi_domain_id(u32 gsi) +diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c +index 58881d3139792..244a8d489cac6 100644 +--- a/drivers/irqchip/irq-mbigen.c ++++ b/drivers/irqchip/irq-mbigen.c +@@ -64,6 +64,20 @@ struct mbigen_device { + void __iomem *base; + }; + ++static inline unsigned int get_mbigen_node_offset(unsigned int nid) ++{ ++ unsigned int offset = nid * MBIGEN_NODE_OFFSET; ++ ++ /* ++ * To avoid touched clear register in unexpected way, we need to directly ++ * skip clear register when access to more than 10 mbigen nodes. ++ */ ++ if (nid >= (REG_MBIGEN_CLEAR_OFFSET / MBIGEN_NODE_OFFSET)) ++ offset += MBIGEN_NODE_OFFSET; ++ ++ return offset; ++} ++ + static inline unsigned int get_mbigen_vec_reg(irq_hw_number_t hwirq) + { + unsigned int nid, pin; +@@ -72,8 +86,7 @@ static inline unsigned int get_mbigen_vec_reg(irq_hw_number_t hwirq) + nid = hwirq / IRQS_PER_MBIGEN_NODE + 1; + pin = hwirq % IRQS_PER_MBIGEN_NODE; + +- return pin * 4 + nid * MBIGEN_NODE_OFFSET +- + REG_MBIGEN_VEC_OFFSET; ++ return pin * 4 + get_mbigen_node_offset(nid) + REG_MBIGEN_VEC_OFFSET; + } + + static inline void get_mbigen_type_reg(irq_hw_number_t hwirq, +@@ -88,8 +101,7 @@ static inline void get_mbigen_type_reg(irq_hw_number_t hwirq, + *mask = 1 << (irq_ofst % 32); + ofst = irq_ofst / 32 * 4; + +- *addr = ofst + nid * MBIGEN_NODE_OFFSET +- + REG_MBIGEN_TYPE_OFFSET; ++ *addr = ofst + get_mbigen_node_offset(nid) + REG_MBIGEN_TYPE_OFFSET; + } + + static inline void get_mbigen_clear_reg(irq_hw_number_t hwirq, +diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c +index f88df39f41291..471e04eaf3230 100644 +--- a/drivers/irqchip/irq-meson-gpio.c ++++ b/drivers/irqchip/irq-meson-gpio.c +@@ -173,7 +173,7 @@ struct meson_gpio_irq_controller { + void __iomem *base; + u32 channel_irqs[MAX_NUM_CHANNEL]; + DECLARE_BITMAP(channel_map, MAX_NUM_CHANNEL); +- spinlock_t lock; ++ raw_spinlock_t lock; + }; + + static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl, +@@ -182,14 +182,14 @@ static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl, + unsigned long flags; + u32 tmp; + +- spin_lock_irqsave(&ctl->lock, flags); ++ raw_spin_lock_irqsave(&ctl->lock, flags); + + tmp = readl_relaxed(ctl->base + reg); + tmp &= ~mask; + tmp |= val; + writel_relaxed(tmp, ctl->base + reg); + +- spin_unlock_irqrestore(&ctl->lock, flags); ++ raw_spin_unlock_irqrestore(&ctl->lock, flags); + } + + static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl) +@@ -239,12 +239,12 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl, + unsigned long flags; + unsigned int idx; + +- spin_lock_irqsave(&ctl->lock, flags); ++ raw_spin_lock_irqsave(&ctl->lock, flags); + + /* Find a free channel */ + idx = find_first_zero_bit(ctl->channel_map, ctl->params->nr_channels); + if (idx >= ctl->params->nr_channels) { +- spin_unlock_irqrestore(&ctl->lock, flags); ++ raw_spin_unlock_irqrestore(&ctl->lock, flags); + pr_err("No channel available\n"); + return -ENOSPC; + } +@@ -252,7 +252,7 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl, + /* Mark the channel as used */ + set_bit(idx, ctl->channel_map); + +- spin_unlock_irqrestore(&ctl->lock, flags); ++ raw_spin_unlock_irqrestore(&ctl->lock, flags); + + /* + * Setup the mux of the channel to route the signal of the pad +@@ -562,7 +562,7 @@ static int meson_gpio_irq_of_init(struct device_node *node, struct device_node * + if (!ctl) + return -ENOMEM; + +- spin_lock_init(&ctl->lock); ++ raw_spin_lock_init(&ctl->lock); + + ctl->base = of_iomap(node, 0); + if (!ctl->base) { +diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c +index 238d3d3449496..7e08714d507f4 100644 +--- a/drivers/irqchip/irq-xilinx-intc.c ++++ b/drivers/irqchip/irq-xilinx-intc.c +@@ -189,7 +189,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc, + irqc->intr_mask = 0; + } + +- if (irqc->intr_mask >> irqc->nr_irq) ++ if ((u64)irqc->intr_mask >> irqc->nr_irq) + pr_warn("irq-xilinx: mismatch in kind-of-intr param\n"); + + pr_info("irq-xilinx: %pOF: num_irq=%d, edge=0x%x\n", +diff --git a/drivers/md/md.c b/drivers/md/md.c +index b5dea664f946d..35b003b83ef1b 100644 +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -456,7 +456,6 @@ void mddev_suspend(struct mddev *mddev) + clear_bit_unlock(MD_ALLOW_SB_UPDATE, &mddev->flags); + wait_event(mddev->sb_wait, !test_bit(MD_UPDATING_SB, &mddev->flags)); + +- del_timer_sync(&mddev->safemode_timer); + /* restrict memory reclaim I/O during raid array is suspend */ + mddev->noio_flag = memalloc_noio_save(); + } +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c +index 1507540a9cb4e..2c7f11e576673 100644 +--- a/drivers/md/raid5.c ++++ b/drivers/md/raid5.c +@@ -6326,7 +6326,9 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, int *sk + safepos = conf->reshape_safe; + sector_div(safepos, data_disks); + if (mddev->reshape_backwards) { +- BUG_ON(writepos < reshape_sectors); ++ if (WARN_ON(writepos < reshape_sectors)) ++ return MaxSector; ++ + writepos -= reshape_sectors; + readpos += reshape_sectors; + safepos += reshape_sectors; +@@ -6344,14 +6346,18 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, int *sk + * to set 'stripe_addr' which is where we will write to. + */ + if (mddev->reshape_backwards) { +- BUG_ON(conf->reshape_progress == 0); ++ if (WARN_ON(conf->reshape_progress == 0)) ++ return MaxSector; ++ + stripe_addr = writepos; +- BUG_ON((mddev->dev_sectors & +- ~((sector_t)reshape_sectors - 1)) +- - reshape_sectors - stripe_addr +- != sector_nr); ++ if (WARN_ON((mddev->dev_sectors & ++ ~((sector_t)reshape_sectors - 1)) - ++ reshape_sectors - stripe_addr != sector_nr)) ++ return MaxSector; + } else { +- BUG_ON(writepos != sector_nr + reshape_sectors); ++ if (WARN_ON(writepos != sector_nr + reshape_sectors)) ++ return MaxSector; ++ + stripe_addr = sector_nr; + } + +diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c +index 133d77d1ea0c3..4f438eaa7d385 100644 +--- a/drivers/media/platform/amphion/vdec.c ++++ b/drivers/media/platform/amphion/vdec.c +@@ -195,7 +195,6 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) + struct vdec_t *vdec = inst->priv; + int ret = 0; + +- vpu_inst_lock(inst); + switch (ctrl->id) { + case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE: + vdec->params.display_delay_enable = ctrl->val; +@@ -207,7 +206,6 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) + ret = -EINVAL; + break; + } +- vpu_inst_unlock(inst); + + return ret; + } +diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c +index 4eb57d793a9c0..16ed4d21519cd 100644 +--- a/drivers/media/platform/amphion/venc.c ++++ b/drivers/media/platform/amphion/venc.c +@@ -518,7 +518,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) + struct venc_t *venc = inst->priv; + int ret = 0; + +- vpu_inst_lock(inst); + switch (ctrl->id) { + case V4L2_CID_MPEG_VIDEO_H264_PROFILE: + venc->params.profile = ctrl->val; +@@ -579,7 +578,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) + ret = -EINVAL; + break; + } +- vpu_inst_unlock(inst); + + return ret; + } +diff --git a/drivers/media/tuners/xc2028.c b/drivers/media/tuners/xc2028.c +index 5a967edceca93..352b8a3679b72 100644 +--- a/drivers/media/tuners/xc2028.c ++++ b/drivers/media/tuners/xc2028.c +@@ -1361,9 +1361,16 @@ static void load_firmware_cb(const struct firmware *fw, + void *context) + { + struct dvb_frontend *fe = context; +- struct xc2028_data *priv = fe->tuner_priv; ++ struct xc2028_data *priv; + int rc; + ++ if (!fe) { ++ pr_warn("xc2028: No frontend in %s\n", __func__); ++ return; ++ } ++ ++ priv = fe->tuner_priv; ++ + tuner_dbg("request_firmware_nowait(): %s\n", fw ? "OK" : "error"); + if (!fw) { + tuner_err("Could not load firmware %s.\n", priv->fname); +diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c +index 5eef560bc8cd8..91c350b254126 100644 +--- a/drivers/media/usb/uvc/uvc_video.c ++++ b/drivers/media/usb/uvc/uvc_video.c +@@ -214,13 +214,13 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, + * Compute a bandwidth estimation by multiplying the frame + * size by the number of video frames per second, divide the + * result by the number of USB frames (or micro-frames for +- * high-speed devices) per second and add the UVC header size +- * (assumed to be 12 bytes long). ++ * high- and super-speed devices) per second and add the UVC ++ * header size (assumed to be 12 bytes long). + */ + bandwidth = frame->wWidth * frame->wHeight / 8 * format->bpp; + bandwidth *= 10000000 / interval + 1; + bandwidth /= 1000; +- if (stream->dev->udev->speed == USB_SPEED_HIGH) ++ if (stream->dev->udev->speed >= USB_SPEED_HIGH) + bandwidth /= 8; + bandwidth += 12; + +@@ -478,6 +478,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, + ktime_t time; + u16 host_sof; + u16 dev_sof; ++ u32 dev_stc; + + switch (data[1] & (UVC_STREAM_PTS | UVC_STREAM_SCR)) { + case UVC_STREAM_PTS | UVC_STREAM_SCR: +@@ -526,6 +527,34 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, + if (dev_sof == stream->clock.last_sof) + return; + ++ dev_stc = get_unaligned_le32(&data[header_size - 6]); ++ ++ /* ++ * STC (Source Time Clock) is the clock used by the camera. The UVC 1.5 ++ * standard states that it "must be captured when the first video data ++ * of a video frame is put on the USB bus". This is generally understood ++ * as requiring devices to clear the payload header's SCR bit before ++ * the first packet containing video data. ++ * ++ * Most vendors follow that interpretation, but some (namely SunplusIT ++ * on some devices) always set the `UVC_STREAM_SCR` bit, fill the SCR ++ * field with 0's,and expect that the driver only processes the SCR if ++ * there is data in the packet. ++ * ++ * Ignore all the hardware timestamp information if we haven't received ++ * any data for this frame yet, the packet contains no data, and both ++ * STC and SOF are zero. This heuristics should be safe on compliant ++ * devices. This should be safe with compliant devices, as in the very ++ * unlikely case where a UVC 1.1 device would send timing information ++ * only before the first packet containing data, and both STC and SOF ++ * happen to be zero for a particular frame, we would only miss one ++ * clock sample from many and the clock recovery algorithm wouldn't ++ * suffer from this condition. ++ */ ++ if (buf && buf->bytesused == 0 && len == header_size && ++ dev_stc == 0 && dev_sof == 0) ++ return; ++ + stream->clock.last_sof = dev_sof; + + host_sof = usb_get_current_frame_number(stream->dev->udev); +@@ -575,7 +604,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, + spin_lock_irqsave(&stream->clock.lock, flags); + + sample = &stream->clock.samples[stream->clock.head]; +- sample->dev_stc = get_unaligned_le32(&data[header_size - 6]); ++ sample->dev_stc = dev_stc; + sample->dev_sof = dev_sof; + sample->host_sof = host_sof; + sample->host_time = time; +diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c +index bfe4caa0c99d4..4cb79a4f24612 100644 +--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c ++++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c +@@ -485,6 +485,8 @@ int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv) + clear_bit(MCP251XFD_FLAGS_FD_MODE, priv->flags); + } + ++ tx_ring->obj_num_shift_to_u8 = BITS_PER_TYPE(tx_ring->obj_num) - ++ ilog2(tx_ring->obj_num); + tx_ring->obj_size = tx_obj_size; + + rem = priv->rx_obj_num; +diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c +index e5bd57b65aafe..5b0c7890d4b44 100644 +--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c ++++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c +@@ -2,7 +2,7 @@ + // + // mcp251xfd - Microchip MCP251xFD Family CAN controller driver + // +-// Copyright (c) 2019, 2020, 2021 Pengutronix, ++// Copyright (c) 2019, 2020, 2021, 2023 Pengutronix, + // Marc Kleine-Budde + // + // Based on: +@@ -16,6 +16,11 @@ + + #include "mcp251xfd.h" + ++static inline bool mcp251xfd_tx_fifo_sta_full(u32 fifo_sta) ++{ ++ return !(fifo_sta & MCP251XFD_REG_FIFOSTA_TFNRFNIF); ++} ++ + static inline int + mcp251xfd_tef_tail_get_from_chip(const struct mcp251xfd_priv *priv, + u8 *tef_tail) +@@ -55,56 +60,39 @@ static int mcp251xfd_check_tef_tail(const struct mcp251xfd_priv *priv) + return 0; + } + +-static int +-mcp251xfd_handle_tefif_recover(const struct mcp251xfd_priv *priv, const u32 seq) +-{ +- const struct mcp251xfd_tx_ring *tx_ring = priv->tx; +- u32 tef_sta; +- int err; +- +- err = regmap_read(priv->map_reg, MCP251XFD_REG_TEFSTA, &tef_sta); +- if (err) +- return err; +- +- if (tef_sta & MCP251XFD_REG_TEFSTA_TEFOVIF) { +- netdev_err(priv->ndev, +- "Transmit Event FIFO buffer overflow.\n"); +- return -ENOBUFS; +- } +- +- netdev_info(priv->ndev, +- "Transmit Event FIFO buffer %s. (seq=0x%08x, tef_tail=0x%08x, tef_head=0x%08x, tx_head=0x%08x).\n", +- tef_sta & MCP251XFD_REG_TEFSTA_TEFFIF ? +- "full" : tef_sta & MCP251XFD_REG_TEFSTA_TEFNEIF ? +- "not empty" : "empty", +- seq, priv->tef->tail, priv->tef->head, tx_ring->head); +- +- /* The Sequence Number in the TEF doesn't match our tef_tail. */ +- return -EAGAIN; +-} +- + static int + mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv, + const struct mcp251xfd_hw_tef_obj *hw_tef_obj, + unsigned int *frame_len_ptr) + { + struct net_device_stats *stats = &priv->ndev->stats; ++ u32 seq, tef_tail_masked, tef_tail; + struct sk_buff *skb; +- u32 seq, seq_masked, tef_tail_masked, tef_tail; + +- seq = FIELD_GET(MCP251XFD_OBJ_FLAGS_SEQ_MCP2518FD_MASK, ++ /* Use the MCP2517FD mask on the MCP2518FD, too. We only ++ * compare 7 bits, this is enough to detect old TEF objects. ++ */ ++ seq = FIELD_GET(MCP251XFD_OBJ_FLAGS_SEQ_MCP2517FD_MASK, + hw_tef_obj->flags); +- +- /* Use the MCP2517FD mask on the MCP2518FD, too. We only +- * compare 7 bits, this should be enough to detect +- * net-yet-completed, i.e. old TEF objects. +- */ +- seq_masked = seq & +- field_mask(MCP251XFD_OBJ_FLAGS_SEQ_MCP2517FD_MASK); + tef_tail_masked = priv->tef->tail & + field_mask(MCP251XFD_OBJ_FLAGS_SEQ_MCP2517FD_MASK); +- if (seq_masked != tef_tail_masked) +- return mcp251xfd_handle_tefif_recover(priv, seq); ++ ++ /* According to mcp2518fd erratum DS80000789E 6. the FIFOCI ++ * bits of a FIFOSTA register, here the TX FIFO tail index ++ * might be corrupted and we might process past the TEF FIFO's ++ * head into old CAN frames. ++ * ++ * Compare the sequence number of the currently processed CAN ++ * frame with the expected sequence number. Abort with ++ * -EBADMSG if an old CAN frame is detected. ++ */ ++ if (seq != tef_tail_masked) { ++ netdev_dbg(priv->ndev, "%s: chip=0x%02x ring=0x%02x\n", __func__, ++ seq, tef_tail_masked); ++ stats->tx_fifo_errors++; ++ ++ return -EBADMSG; ++ } + + tef_tail = mcp251xfd_get_tef_tail(priv); + skb = priv->can.echo_skb[tef_tail]; +@@ -120,28 +108,44 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv, + return 0; + } + +-static int mcp251xfd_tef_ring_update(struct mcp251xfd_priv *priv) ++static int ++mcp251xfd_get_tef_len(struct mcp251xfd_priv *priv, u8 *len_p) + { + const struct mcp251xfd_tx_ring *tx_ring = priv->tx; +- unsigned int new_head; +- u8 chip_tx_tail; ++ const u8 shift = tx_ring->obj_num_shift_to_u8; ++ u8 chip_tx_tail, tail, len; ++ u32 fifo_sta; + int err; + +- err = mcp251xfd_tx_tail_get_from_chip(priv, &chip_tx_tail); ++ err = regmap_read(priv->map_reg, MCP251XFD_REG_FIFOSTA(priv->tx->fifo_nr), ++ &fifo_sta); + if (err) + return err; + +- /* chip_tx_tail, is the next TX-Object send by the HW. +- * The new TEF head must be >= the old head, ... ++ if (mcp251xfd_tx_fifo_sta_full(fifo_sta)) { ++ *len_p = tx_ring->obj_num; ++ return 0; ++ } ++ ++ chip_tx_tail = FIELD_GET(MCP251XFD_REG_FIFOSTA_FIFOCI_MASK, fifo_sta); ++ ++ err = mcp251xfd_check_tef_tail(priv); ++ if (err) ++ return err; ++ tail = mcp251xfd_get_tef_tail(priv); ++ ++ /* First shift to full u8. The subtraction works on signed ++ * values, that keeps the difference steady around the u8 ++ * overflow. The right shift acts on len, which is an u8. + */ +- new_head = round_down(priv->tef->head, tx_ring->obj_num) + chip_tx_tail; +- if (new_head <= priv->tef->head) +- new_head += tx_ring->obj_num; ++ BUILD_BUG_ON(sizeof(tx_ring->obj_num) != sizeof(chip_tx_tail)); ++ BUILD_BUG_ON(sizeof(tx_ring->obj_num) != sizeof(tail)); ++ BUILD_BUG_ON(sizeof(tx_ring->obj_num) != sizeof(len)); + +- /* ... but it cannot exceed the TX head. */ +- priv->tef->head = min(new_head, tx_ring->head); ++ len = (chip_tx_tail << shift) - (tail << shift); ++ *len_p = len >> shift; + +- return mcp251xfd_check_tef_tail(priv); ++ return 0; + } + + static inline int +@@ -182,13 +186,12 @@ int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) + u8 tef_tail, len, l; + int err, i; + +- err = mcp251xfd_tef_ring_update(priv); ++ err = mcp251xfd_get_tef_len(priv, &len); + if (err) + return err; + + tef_tail = mcp251xfd_get_tef_tail(priv); +- len = mcp251xfd_get_tef_len(priv); +- l = mcp251xfd_get_tef_linear_len(priv); ++ l = mcp251xfd_get_tef_linear_len(priv, len); + err = mcp251xfd_tef_obj_read(priv, hw_tef_obj, tef_tail, l); + if (err) + return err; +@@ -203,12 +206,12 @@ int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) + unsigned int frame_len = 0; + + err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i], &frame_len); +- /* -EAGAIN means the Sequence Number in the TEF +- * doesn't match our tef_tail. This can happen if we +- * read the TEF objects too early. Leave loop let the +- * interrupt handler call us again. ++ /* -EBADMSG means we're affected by mcp2518fd erratum ++ * DS80000789E 6., i.e. the Sequence Number in the TEF ++ * doesn't match our tef_tail. Don't process any ++ * further and mark processed frames as good. + */ +- if (err == -EAGAIN) ++ if (err == -EBADMSG) + goto out_netif_wake_queue; + if (err) + return err; +@@ -223,6 +226,8 @@ int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) + struct mcp251xfd_tx_ring *tx_ring = priv->tx; + int offset; + ++ ring->head += len; ++ + /* Increment the TEF FIFO tail pointer 'len' times in + * a single SPI message. + * +diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +index b35bfebd23f29..4628bf847bc9b 100644 +--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h ++++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +@@ -524,6 +524,7 @@ struct mcp251xfd_tef_ring { + + /* u8 obj_num equals tx_ring->obj_num */ + /* u8 obj_size equals sizeof(struct mcp251xfd_hw_tef_obj) */ ++ /* u8 obj_num_shift_to_u8 equals tx_ring->obj_num_shift_to_u8 */ + + union mcp251xfd_write_reg_buf irq_enable_buf; + struct spi_transfer irq_enable_xfer; +@@ -542,6 +543,7 @@ struct mcp251xfd_tx_ring { + u8 nr; + u8 fifo_nr; + u8 obj_num; ++ u8 obj_num_shift_to_u8; + u8 obj_size; + + struct mcp251xfd_tx_obj obj[MCP251XFD_TX_OBJ_NUM_MAX]; +@@ -861,17 +863,8 @@ static inline u8 mcp251xfd_get_tef_tail(const struct mcp251xfd_priv *priv) + return priv->tef->tail & (priv->tx->obj_num - 1); + } + +-static inline u8 mcp251xfd_get_tef_len(const struct mcp251xfd_priv *priv) ++static inline u8 mcp251xfd_get_tef_linear_len(const struct mcp251xfd_priv *priv, u8 len) + { +- return priv->tef->head - priv->tef->tail; +-} +- +-static inline u8 mcp251xfd_get_tef_linear_len(const struct mcp251xfd_priv *priv) +-{ +- u8 len; +- +- len = mcp251xfd_get_tef_len(priv); +- + return min_t(u8, len, priv->tx->obj_num - mcp251xfd_get_tef_tail(priv)); + } + +diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c +index cd1f240c90f39..257df16768750 100644 +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -678,8 +678,10 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) + of_remove_property(child, prop); + + phydev = of_phy_find_device(child); +- if (phydev) ++ if (phydev) { + phy_device_remove(phydev); ++ phy_device_free(phydev); ++ } + } + + err = mdiobus_register(priv->slave_mii_bus); +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +index 1248792d7fd4d..0715ea5bf13ed 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +@@ -42,19 +42,15 @@ void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) + struct bcmgenet_priv *priv = netdev_priv(dev); + struct device *kdev = &priv->pdev->dev; + +- if (dev->phydev) { ++ if (dev->phydev) + phy_ethtool_get_wol(dev->phydev, wol); +- if (wol->supported) +- return; +- } + +- if (!device_can_wakeup(kdev)) { +- wol->supported = 0; +- wol->wolopts = 0; ++ /* MAC is not wake-up capable, return what the PHY does */ ++ if (!device_can_wakeup(kdev)) + return; +- } + +- wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; ++ /* Overlay MAC capabilities with that of the PHY queried before */ ++ wol->supported |= WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; + wol->wolopts = priv->wolopts; + memset(wol->sopass, 0, sizeof(wol->sopass)); + +diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c +index e32f6724f5681..2e4f3e1782a25 100644 +--- a/drivers/net/ethernet/freescale/fec_ptp.c ++++ b/drivers/net/ethernet/freescale/fec_ptp.c +@@ -775,6 +775,9 @@ void fec_ptp_stop(struct platform_device *pdev) + struct net_device *ndev = platform_get_drvdata(pdev); + struct fec_enet_private *fep = netdev_priv(ndev); + ++ if (fep->pps_enable) ++ fec_ptp_enable_pps(fep, 0); ++ + cancel_delayed_work_sync(&fep->time_keep); + hrtimer_cancel(&fep->perout_timer); + if (fep->ptp_clock) +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index 600a2f5370875..b168a37a5dfff 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -557,6 +557,8 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type) + if (test_bit(ICE_PREPARED_FOR_RESET, pf->state)) + return; + ++ synchronize_irq(pf->oicr_irq.virq); ++ + ice_unplug_aux_dev(pf); + + /* Notify VFs of impending reset */ +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +index 8d9743a5e42c7..79ec6fcc9e259 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +@@ -2374,6 +2374,9 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq + if (likely(wi->consumed_strides < rq->mpwqe.num_strides)) + return; + ++ if (unlikely(!cstrides)) ++ return; ++ + wq = &rq->mpwqe.wq; + wqe = mlx5_wq_ll_get_wqe(wq, wqe_id); + mlx5_wq_ll_pop(wq, cqe->wqe_id, &wqe->next.next_wqe_index); +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +index d5d2a4c776c1c..ded1bbda5266f 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +@@ -21,6 +21,7 @@ + #define RGMII_IO_MACRO_CONFIG2 0x1C + #define RGMII_IO_MACRO_DEBUG1 0x20 + #define EMAC_SYSTEM_LOW_POWER_DEBUG 0x28 ++#define EMAC_WRAPPER_SGMII_PHY_CNTRL1 0xf4 + + /* RGMII_IO_MACRO_CONFIG fields */ + #define RGMII_CONFIG_FUNC_CLK_EN BIT(30) +@@ -79,6 +80,9 @@ + #define ETHQOS_MAC_CTRL_SPEED_MODE BIT(14) + #define ETHQOS_MAC_CTRL_PORT_SEL BIT(15) + ++/* EMAC_WRAPPER_SGMII_PHY_CNTRL1 bits */ ++#define SGMII_PHY_CNTRL1_SGMII_TX_TO_RX_LOOPBACK_EN BIT(3) ++ + #define SGMII_10M_RX_CLK_DVDR 0x31 + + struct ethqos_emac_por { +@@ -95,6 +99,7 @@ struct ethqos_emac_driver_data { + bool has_integrated_pcs; + u32 dma_addr_width; + struct dwmac4_addrs dwmac4_addrs; ++ bool needs_sgmii_loopback; + }; + + struct qcom_ethqos { +@@ -113,6 +118,7 @@ struct qcom_ethqos { + unsigned int num_por; + bool rgmii_config_loopback_en; + bool has_emac_ge_3; ++ bool needs_sgmii_loopback; + }; + + static int rgmii_readl(struct qcom_ethqos *ethqos, unsigned int offset) +@@ -187,8 +193,22 @@ ethqos_update_link_clk(struct qcom_ethqos *ethqos, unsigned int speed) + clk_set_rate(ethqos->link_clk, ethqos->link_clk_rate); + } + ++static void ++qcom_ethqos_set_sgmii_loopback(struct qcom_ethqos *ethqos, bool enable) ++{ ++ if (!ethqos->needs_sgmii_loopback || ++ ethqos->phy_mode != PHY_INTERFACE_MODE_2500BASEX) ++ return; ++ ++ rgmii_updatel(ethqos, ++ SGMII_PHY_CNTRL1_SGMII_TX_TO_RX_LOOPBACK_EN, ++ enable ? SGMII_PHY_CNTRL1_SGMII_TX_TO_RX_LOOPBACK_EN : 0, ++ EMAC_WRAPPER_SGMII_PHY_CNTRL1); ++} ++ + static void ethqos_set_func_clk_en(struct qcom_ethqos *ethqos) + { ++ qcom_ethqos_set_sgmii_loopback(ethqos, true); + rgmii_updatel(ethqos, RGMII_CONFIG_FUNC_CLK_EN, + RGMII_CONFIG_FUNC_CLK_EN, RGMII_IO_MACRO_CONFIG); + } +@@ -273,6 +293,7 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = { + .has_emac_ge_3 = true, + .link_clk_name = "phyaux", + .has_integrated_pcs = true, ++ .needs_sgmii_loopback = true, + .dma_addr_width = 36, + .dwmac4_addrs = { + .dma_chan = 0x00008100, +@@ -646,6 +667,7 @@ static void ethqos_fix_mac_speed(void *priv, unsigned int speed, unsigned int mo + { + struct qcom_ethqos *ethqos = priv; + ++ qcom_ethqos_set_sgmii_loopback(ethqos, false); + ethqos->speed = speed; + ethqos_update_link_clk(ethqos, speed); + ethqos_configure(ethqos); +@@ -781,6 +803,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) + ethqos->num_por = data->num_por; + ethqos->rgmii_config_loopback_en = data->rgmii_config_loopback_en; + ethqos->has_emac_ge_3 = data->has_emac_ge_3; ++ ethqos->needs_sgmii_loopback = data->needs_sgmii_loopback; + + ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii"); + if (IS_ERR(ethqos->link_clk)) +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index befbca01bfe37..b1380cf1b13ab 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -201,6 +201,7 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + break; + default: + /* not ip - do not know what to do */ ++ kfree_skb(skbn); + goto skip; + } + +diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h +index c926952c956ef..33f4706af880d 100644 +--- a/drivers/net/wireless/ath/ath12k/core.h ++++ b/drivers/net/wireless/ath/ath12k/core.h +@@ -181,6 +181,8 @@ enum ath12k_dev_flags { + ATH12K_FLAG_REGISTERED, + ATH12K_FLAG_QMI_FAIL, + ATH12K_FLAG_HTC_SUSPEND_COMPLETE, ++ ATH12K_FLAG_CE_IRQ_ENABLED, ++ ATH12K_FLAG_EXT_IRQ_ENABLED, + }; + + enum ath12k_monitor_flags { +diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c +index 2c17b1e7681a5..d9bc07844fb71 100644 +--- a/drivers/net/wireless/ath/ath12k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath12k/dp_rx.c +@@ -2759,6 +2759,7 @@ int ath12k_dp_rx_peer_frag_setup(struct ath12k *ar, const u8 *peer_mac, int vdev + peer = ath12k_peer_find(ab, vdev_id, peer_mac); + if (!peer) { + spin_unlock_bh(&ab->base_lock); ++ crypto_free_shash(tfm); + ath12k_warn(ab, "failed to find the peer to set up fragment info\n"); + return -ENOENT; + } +diff --git a/drivers/net/wireless/ath/ath12k/hif.h b/drivers/net/wireless/ath/ath12k/hif.h +index 4cbf9b5c04b9c..c653ca1f59b22 100644 +--- a/drivers/net/wireless/ath/ath12k/hif.h ++++ b/drivers/net/wireless/ath/ath12k/hif.h +@@ -10,17 +10,17 @@ + #include "core.h" + + struct ath12k_hif_ops { +- u32 (*read32)(struct ath12k_base *sc, u32 address); +- void (*write32)(struct ath12k_base *sc, u32 address, u32 data); +- void (*irq_enable)(struct ath12k_base *sc); +- void (*irq_disable)(struct ath12k_base *sc); +- int (*start)(struct ath12k_base *sc); +- void (*stop)(struct ath12k_base *sc); +- int (*power_up)(struct ath12k_base *sc); +- void (*power_down)(struct ath12k_base *sc); ++ u32 (*read32)(struct ath12k_base *ab, u32 address); ++ void (*write32)(struct ath12k_base *ab, u32 address, u32 data); ++ void (*irq_enable)(struct ath12k_base *ab); ++ void (*irq_disable)(struct ath12k_base *ab); ++ int (*start)(struct ath12k_base *ab); ++ void (*stop)(struct ath12k_base *ab); ++ int (*power_up)(struct ath12k_base *ab); ++ void (*power_down)(struct ath12k_base *ab); + int (*suspend)(struct ath12k_base *ab); + int (*resume)(struct ath12k_base *ab); +- int (*map_service_to_pipe)(struct ath12k_base *sc, u16 service_id, ++ int (*map_service_to_pipe)(struct ath12k_base *ab, u16 service_id, + u8 *ul_pipe, u8 *dl_pipe); + int (*get_user_msi_vector)(struct ath12k_base *ab, char *user_name, + int *num_vectors, u32 *user_base_data, +diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c +index 58cd678555964..041a9602f0e15 100644 +--- a/drivers/net/wireless/ath/ath12k/pci.c ++++ b/drivers/net/wireless/ath/ath12k/pci.c +@@ -373,6 +373,8 @@ static void ath12k_pci_ce_irqs_disable(struct ath12k_base *ab) + { + int i; + ++ clear_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); ++ + for (i = 0; i < ab->hw_params->ce_count; i++) { + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; +@@ -406,6 +408,10 @@ static void ath12k_pci_ce_tasklet(struct tasklet_struct *t) + static irqreturn_t ath12k_pci_ce_interrupt_handler(int irq, void *arg) + { + struct ath12k_ce_pipe *ce_pipe = arg; ++ struct ath12k_base *ab = ce_pipe->ab; ++ ++ if (!test_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) ++ return IRQ_HANDLED; + + /* last interrupt received for this CE */ + ce_pipe->timestamp = jiffies; +@@ -424,12 +430,15 @@ static void ath12k_pci_ext_grp_disable(struct ath12k_ext_irq_grp *irq_grp) + disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); + } + +-static void __ath12k_pci_ext_irq_disable(struct ath12k_base *sc) ++static void __ath12k_pci_ext_irq_disable(struct ath12k_base *ab) + { + int i; + ++ if (!test_and_clear_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) ++ return; ++ + for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { +- struct ath12k_ext_irq_grp *irq_grp = &sc->ext_irq_grp[i]; ++ struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + + ath12k_pci_ext_grp_disable(irq_grp); + +@@ -483,6 +492,10 @@ static int ath12k_pci_ext_grp_napi_poll(struct napi_struct *napi, int budget) + static irqreturn_t ath12k_pci_ext_interrupt_handler(int irq, void *arg) + { + struct ath12k_ext_irq_grp *irq_grp = arg; ++ struct ath12k_base *ab = irq_grp->ab; ++ ++ if (!test_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) ++ return IRQ_HANDLED; + + ath12k_dbg(irq_grp->ab, ATH12K_DBG_PCI, "ext irq:%d\n", irq); + +@@ -626,6 +639,8 @@ static void ath12k_pci_ce_irqs_enable(struct ath12k_base *ab) + { + int i; + ++ set_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); ++ + for (i = 0; i < ab->hw_params->ce_count; i++) { + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; +@@ -956,6 +971,8 @@ void ath12k_pci_ext_irq_enable(struct ath12k_base *ab) + { + int i; + ++ set_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); ++ + for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { + struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 796c2a00fea4a..0fc7aa78b2e5b 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -826,9 +826,9 @@ static blk_status_t nvme_map_metadata(struct nvme_dev *dev, struct request *req, + struct nvme_command *cmnd) + { + struct nvme_iod *iod = blk_mq_rq_to_pdu(req); ++ struct bio_vec bv = rq_integrity_vec(req); + +- iod->meta_dma = dma_map_bvec(dev->dev, rq_integrity_vec(req), +- rq_dma_dir(req), 0); ++ iod->meta_dma = dma_map_bvec(dev->dev, &bv, rq_dma_dir(req), 0); + if (dma_mapping_error(dev->dev, iod->meta_dma)) + return BLK_STS_IOERR; + cmnd->rw.metadata = cpu_to_le64(iod->meta_dma); +@@ -969,7 +969,7 @@ static __always_inline void nvme_pci_unmap_rq(struct request *req) + struct nvme_iod *iod = blk_mq_rq_to_pdu(req); + + dma_unmap_page(dev->dev, iod->meta_dma, +- rq_integrity_vec(req)->bv_len, rq_dma_dir(req)); ++ rq_integrity_vec(req).bv_len, rq_dma_dir(req)); + } + + if (blk_rq_nr_phys_segments(req)) +diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c +index 306f886b52d20..4ff2aa4b484bc 100644 +--- a/drivers/platform/x86/intel/ifs/core.c ++++ b/drivers/platform/x86/intel/ifs/core.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0-only + /* Copyright(c) 2022 Intel Corporation. */ + ++#include + #include + #include + #include +@@ -94,6 +95,8 @@ static int __init ifs_init(void) + for (i = 0; i < IFS_NUMTESTS; i++) { + if (!(msrval & BIT(ifs_devices[i].test_caps->integrity_cap_bit))) + continue; ++ ifs_devices[i].rw_data.generation = FIELD_GET(MSR_INTEGRITY_CAPS_SAF_GEN_MASK, ++ msrval); + ret = misc_register(&ifs_devices[i].misc); + if (ret) + goto err_exit; +diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h +index 93191855890f2..6bc63ab705175 100644 +--- a/drivers/platform/x86/intel/ifs/ifs.h ++++ b/drivers/platform/x86/intel/ifs/ifs.h +@@ -174,9 +174,17 @@ union ifs_chunks_auth_status { + union ifs_scan { + u64 data; + struct { +- u32 start :8; +- u32 stop :8; +- u32 rsvd :16; ++ union { ++ struct { ++ u8 start; ++ u8 stop; ++ u16 rsvd; ++ } gen0; ++ struct { ++ u16 start; ++ u16 stop; ++ } gen2; ++ }; + u32 delay :31; + u32 sigmce :1; + }; +@@ -186,9 +194,17 @@ union ifs_scan { + union ifs_status { + u64 data; + struct { +- u32 chunk_num :8; +- u32 chunk_stop_index :8; +- u32 rsvd1 :16; ++ union { ++ struct { ++ u8 chunk_num; ++ u8 chunk_stop_index; ++ u16 rsvd1; ++ } gen0; ++ struct { ++ u16 chunk_num; ++ u16 chunk_stop_index; ++ } gen2; ++ }; + u32 error_code :8; + u32 rsvd2 :22; + u32 control_error :1; +@@ -229,6 +245,7 @@ struct ifs_test_caps { + * @status: it holds simple status pass/fail/untested + * @scan_details: opaque scan status code from h/w + * @cur_batch: number indicating the currently loaded test file ++ * @generation: IFS test generation enumerated by hardware + */ + struct ifs_data { + int loaded_version; +@@ -238,6 +255,7 @@ struct ifs_data { + int status; + u64 scan_details; + u32 cur_batch; ++ u32 generation; + }; + + struct ifs_work { +diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c +index 43c864add778f..c7a5bf24bef35 100644 +--- a/drivers/platform/x86/intel/ifs/runtest.c ++++ b/drivers/platform/x86/intel/ifs/runtest.c +@@ -167,25 +167,35 @@ static int doscan(void *data) + */ + static void ifs_test_core(int cpu, struct device *dev) + { ++ union ifs_status status = {}; + union ifs_scan activate; +- union ifs_status status; + unsigned long timeout; + struct ifs_data *ifsd; ++ int to_start, to_stop; ++ int status_chunk; + u64 msrvals[2]; + int retries; + + ifsd = ifs_get_data(dev); + +- activate.rsvd = 0; ++ activate.gen0.rsvd = 0; + activate.delay = IFS_THREAD_WAIT; + activate.sigmce = 0; +- activate.start = 0; +- activate.stop = ifsd->valid_chunks - 1; ++ to_start = 0; ++ to_stop = ifsd->valid_chunks - 1; ++ ++ if (ifsd->generation) { ++ activate.gen2.start = to_start; ++ activate.gen2.stop = to_stop; ++ } else { ++ activate.gen0.start = to_start; ++ activate.gen0.stop = to_stop; ++ } + + timeout = jiffies + HZ / 2; + retries = MAX_IFS_RETRIES; + +- while (activate.start <= activate.stop) { ++ while (to_start <= to_stop) { + if (time_after(jiffies, timeout)) { + status.error_code = IFS_SW_TIMEOUT; + break; +@@ -196,13 +206,14 @@ static void ifs_test_core(int cpu, struct device *dev) + + status.data = msrvals[1]; + +- trace_ifs_status(cpu, activate, status); ++ trace_ifs_status(cpu, to_start, to_stop, status.data); + + /* Some cases can be retried, give up for others */ + if (!can_restart(status)) + break; + +- if (status.chunk_num == activate.start) { ++ status_chunk = ifsd->generation ? status.gen2.chunk_num : status.gen0.chunk_num; ++ if (status_chunk == to_start) { + /* Check for forward progress */ + if (--retries == 0) { + if (status.error_code == IFS_NO_ERROR) +@@ -211,7 +222,11 @@ static void ifs_test_core(int cpu, struct device *dev) + } + } else { + retries = MAX_IFS_RETRIES; +- activate.start = status.chunk_num; ++ if (ifsd->generation) ++ activate.gen2.start = status_chunk; ++ else ++ activate.gen0.start = status_chunk; ++ to_start = status_chunk; + } + } + +diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c +index b5903193e2f96..ac05942e4e6ac 100644 +--- a/drivers/power/supply/axp288_charger.c ++++ b/drivers/power/supply/axp288_charger.c +@@ -178,18 +178,18 @@ static inline int axp288_charger_set_cv(struct axp288_chrg_info *info, int cv) + u8 reg_val; + int ret; + +- if (cv <= CV_4100MV) { +- reg_val = CHRG_CCCV_CV_4100MV; +- cv = CV_4100MV; +- } else if (cv <= CV_4150MV) { +- reg_val = CHRG_CCCV_CV_4150MV; +- cv = CV_4150MV; +- } else if (cv <= CV_4200MV) { ++ if (cv >= CV_4350MV) { ++ reg_val = CHRG_CCCV_CV_4350MV; ++ cv = CV_4350MV; ++ } else if (cv >= CV_4200MV) { + reg_val = CHRG_CCCV_CV_4200MV; + cv = CV_4200MV; ++ } else if (cv >= CV_4150MV) { ++ reg_val = CHRG_CCCV_CV_4150MV; ++ cv = CV_4150MV; + } else { +- reg_val = CHRG_CCCV_CV_4350MV; +- cv = CV_4350MV; ++ reg_val = CHRG_CCCV_CV_4100MV; ++ cv = CV_4100MV; + } + + reg_val = reg_val << CHRG_CCCV_CV_BIT_POS; +@@ -337,8 +337,8 @@ static int axp288_charger_usb_set_property(struct power_supply *psy, + } + break; + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: +- scaled_val = min(val->intval, info->max_cv); +- scaled_val = DIV_ROUND_CLOSEST(scaled_val, 1000); ++ scaled_val = DIV_ROUND_CLOSEST(val->intval, 1000); ++ scaled_val = min(scaled_val, info->max_cv); + ret = axp288_charger_set_cv(info, scaled_val); + if (ret < 0) { + dev_warn(&info->pdev->dev, "set charge voltage failed\n"); +diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c +index ec163d1bcd189..44c6301f5f174 100644 +--- a/drivers/power/supply/qcom_battmgr.c ++++ b/drivers/power/supply/qcom_battmgr.c +@@ -486,7 +486,7 @@ static int qcom_battmgr_bat_get_property(struct power_supply *psy, + int ret; + + if (!battmgr->service_up) +- return -ENODEV; ++ return -EAGAIN; + + if (battmgr->variant == QCOM_BATTMGR_SC8280XP) + ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); +@@ -683,7 +683,7 @@ static int qcom_battmgr_ac_get_property(struct power_supply *psy, + int ret; + + if (!battmgr->service_up) +- return -ENODEV; ++ return -EAGAIN; + + ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); + if (ret) +@@ -748,7 +748,7 @@ static int qcom_battmgr_usb_get_property(struct power_supply *psy, + int ret; + + if (!battmgr->service_up) +- return -ENODEV; ++ return -EAGAIN; + + if (battmgr->variant == QCOM_BATTMGR_SC8280XP) + ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); +@@ -867,7 +867,7 @@ static int qcom_battmgr_wls_get_property(struct power_supply *psy, + int ret; + + if (!battmgr->service_up) +- return -ENODEV; ++ return -EAGAIN; + + if (battmgr->variant == QCOM_BATTMGR_SC8280XP) + ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); +diff --git a/drivers/s390/char/sclp_sd.c b/drivers/s390/char/sclp_sd.c +index f9e164be7568f..944e75beb160c 100644 +--- a/drivers/s390/char/sclp_sd.c ++++ b/drivers/s390/char/sclp_sd.c +@@ -320,8 +320,14 @@ static int sclp_sd_store_data(struct sclp_sd_data *result, u8 di) + &esize); + if (rc) { + /* Cancel running request if interrupted */ +- if (rc == -ERESTARTSYS) +- sclp_sd_sync(page, SD_EQ_HALT, di, 0, 0, NULL, NULL); ++ if (rc == -ERESTARTSYS) { ++ if (sclp_sd_sync(page, SD_EQ_HALT, di, 0, 0, NULL, NULL)) { ++ pr_warn("Could not stop Store Data request - leaking at least %zu bytes\n", ++ (size_t)dsize * PAGE_SIZE); ++ data = NULL; ++ asce = 0; ++ } ++ } + vfree(data); + goto out; + } +diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c +index 80d71041086e1..7f32619234696 100644 +--- a/drivers/scsi/mpi3mr/mpi3mr_os.c ++++ b/drivers/scsi/mpi3mr/mpi3mr_os.c +@@ -3447,6 +3447,17 @@ static int mpi3mr_prepare_sg_scmd(struct mpi3mr_ioc *mrioc, + scmd->sc_data_direction); + priv->meta_sg_valid = 1; /* To unmap meta sg DMA */ + } else { ++ /* ++ * Some firmware versions byte-swap the REPORT ZONES command ++ * reply from ATA-ZAC devices by directly accessing in the host ++ * buffer. This does not respect the default command DMA ++ * direction and causes IOMMU page faults on some architectures ++ * with an IOMMU enforcing write mappings (e.g. AMD hosts). ++ * Avoid such issue by making the REPORT ZONES buffer mapping ++ * bi-directional. ++ */ ++ if (scmd->cmnd[0] == ZBC_IN && scmd->cmnd[1] == ZI_REPORT_ZONES) ++ scmd->sc_data_direction = DMA_BIDIRECTIONAL; + sg_scmd = scsi_sglist(scmd); + sges_left = scsi_dma_map(scmd); + } +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c +index 04116e02ffe8c..8acf586dc8b2e 100644 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c +@@ -2671,6 +2671,22 @@ _base_build_zero_len_sge_ieee(struct MPT3SAS_ADAPTER *ioc, void *paddr) + _base_add_sg_single_ieee(paddr, sgl_flags, 0, 0, -1); + } + ++static inline int _base_scsi_dma_map(struct scsi_cmnd *cmd) ++{ ++ /* ++ * Some firmware versions byte-swap the REPORT ZONES command reply from ++ * ATA-ZAC devices by directly accessing in the host buffer. This does ++ * not respect the default command DMA direction and causes IOMMU page ++ * faults on some architectures with an IOMMU enforcing write mappings ++ * (e.g. AMD hosts). Avoid such issue by making the report zones buffer ++ * mapping bi-directional. ++ */ ++ if (cmd->cmnd[0] == ZBC_IN && cmd->cmnd[1] == ZI_REPORT_ZONES) ++ cmd->sc_data_direction = DMA_BIDIRECTIONAL; ++ ++ return scsi_dma_map(cmd); ++} ++ + /** + * _base_build_sg_scmd - main sg creation routine + * pcie_device is unused here! +@@ -2717,7 +2733,7 @@ _base_build_sg_scmd(struct MPT3SAS_ADAPTER *ioc, + sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; + + sg_scmd = scsi_sglist(scmd); +- sges_left = scsi_dma_map(scmd); ++ sges_left = _base_scsi_dma_map(scmd); + if (sges_left < 0) + return -ENOMEM; + +@@ -2861,7 +2877,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, + } + + sg_scmd = scsi_sglist(scmd); +- sges_left = scsi_dma_map(scmd); ++ sges_left = _base_scsi_dma_map(scmd); + if (sges_left < 0) + return -ENOMEM; + +diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c +index 079035db7dd85..3c0f7dc9614d1 100644 +--- a/drivers/spi/spi-fsl-lpspi.c ++++ b/drivers/spi/spi-fsl-lpspi.c +@@ -296,7 +296,7 @@ static void fsl_lpspi_set_watermark(struct fsl_lpspi_data *fsl_lpspi) + static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi) + { + struct lpspi_config config = fsl_lpspi->config; +- unsigned int perclk_rate, scldiv; ++ unsigned int perclk_rate, scldiv, div; + u8 prescale; + + perclk_rate = clk_get_rate(fsl_lpspi->clk_per); +@@ -313,8 +313,10 @@ static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi) + return -EINVAL; + } + ++ div = DIV_ROUND_UP(perclk_rate, config.speed_hz); ++ + for (prescale = 0; prescale < 8; prescale++) { +- scldiv = perclk_rate / config.speed_hz / (1 << prescale) - 2; ++ scldiv = div / (1 << prescale) - 2; + if (scldiv < 256) { + fsl_lpspi->config.prescale = prescale; + break; +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 1a8dd10012448..b97206d47ec6d 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -704,6 +704,7 @@ static const struct file_operations spidev_fops = { + static struct class *spidev_class; + + static const struct spi_device_id spidev_spi_ids[] = { ++ { .name = "bh2228fv" }, + { .name = "dh2228fv" }, + { .name = "ltc2488" }, + { .name = "sx1301" }, +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c +index 2eceef54e0b30..ed8798fdf522a 100644 +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -876,6 +876,14 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, + new_flags = (__force upf_t)new_info->flags; + old_custom_divisor = uport->custom_divisor; + ++ if (!(uport->flags & UPF_FIXED_PORT)) { ++ unsigned int uartclk = new_info->baud_base * 16; ++ /* check needs to be done here before other settings made */ ++ if (uartclk == 0) { ++ retval = -EINVAL; ++ goto exit; ++ } ++ } + if (!capable(CAP_SYS_ADMIN)) { + retval = -EPERM; + if (change_irq || change_port || +diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c +index 808979a093505..94edac17b95f8 100644 +--- a/drivers/ufs/core/ufshcd.c ++++ b/drivers/ufs/core/ufshcd.c +@@ -3971,11 +3971,16 @@ static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba) + min_sleep_time_us = + MIN_DELAY_BEFORE_DME_CMDS_US - delta; + else +- return; /* no more delay required */ ++ min_sleep_time_us = 0; /* no more delay required */ + } + +- /* allow sleep for extra 50us if needed */ +- usleep_range(min_sleep_time_us, min_sleep_time_us + 50); ++ if (min_sleep_time_us > 0) { ++ /* allow sleep for extra 50us if needed */ ++ usleep_range(min_sleep_time_us, min_sleep_time_us + 50); ++ } ++ ++ /* update the last_dme_cmd_tstamp */ ++ hba->last_dme_cmd_tstamp = ktime_get(); + } + + /** +@@ -10157,9 +10162,6 @@ int ufshcd_system_restore(struct device *dev) + */ + ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H); + +- /* Resuming from hibernate, assume that link was OFF */ +- ufshcd_set_link_off(hba); +- + return 0; + + } +diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c +index 0e38bb145e8f5..6908fdd4a83f3 100644 +--- a/drivers/usb/gadget/function/f_midi2.c ++++ b/drivers/usb/gadget/function/f_midi2.c +@@ -642,12 +642,21 @@ static void process_ump_stream_msg(struct f_midi2_ep *ep, const u32 *data) + if (format) + return; // invalid + blk = (*data >> 8) & 0xff; +- if (blk >= ep->num_blks) +- return; +- if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO) +- reply_ump_stream_fb_info(ep, blk); +- if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME) +- reply_ump_stream_fb_name(ep, blk); ++ if (blk == 0xff) { ++ /* inquiry for all blocks */ ++ for (blk = 0; blk < ep->num_blks; blk++) { ++ if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO) ++ reply_ump_stream_fb_info(ep, blk); ++ if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME) ++ reply_ump_stream_fb_name(ep, blk); ++ } ++ } else if (blk < ep->num_blks) { ++ /* only the specified block */ ++ if (*data & UMP_STREAM_MSG_REQUEST_FB_INFO) ++ reply_ump_stream_fb_info(ep, blk); ++ if (*data & UMP_STREAM_MSG_REQUEST_FB_NAME) ++ reply_ump_stream_fb_name(ep, blk); ++ } + return; + } + } +diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c +index ec1dceb087293..0be0966973c7f 100644 +--- a/drivers/usb/gadget/function/u_audio.c ++++ b/drivers/usb/gadget/function/u_audio.c +@@ -592,16 +592,25 @@ int u_audio_start_capture(struct g_audio *audio_dev) + struct usb_ep *ep, *ep_fback; + struct uac_rtd_params *prm; + struct uac_params *params = &audio_dev->params; +- int req_len, i; ++ int req_len, i, ret; + + prm = &uac->c_prm; + dev_dbg(dev, "start capture with rate %d\n", prm->srate); + ep = audio_dev->out_ep; +- config_ep_by_speed(gadget, &audio_dev->func, ep); ++ ret = config_ep_by_speed(gadget, &audio_dev->func, ep); ++ if (ret < 0) { ++ dev_err(dev, "config_ep_by_speed for out_ep failed (%d)\n", ret); ++ return ret; ++ } ++ + req_len = ep->maxpacket; + + prm->ep_enabled = true; +- usb_ep_enable(ep); ++ ret = usb_ep_enable(ep); ++ if (ret < 0) { ++ dev_err(dev, "usb_ep_enable failed for out_ep (%d)\n", ret); ++ return ret; ++ } + + for (i = 0; i < params->req_number; i++) { + if (!prm->reqs[i]) { +@@ -629,9 +638,18 @@ int u_audio_start_capture(struct g_audio *audio_dev) + return 0; + + /* Setup feedback endpoint */ +- config_ep_by_speed(gadget, &audio_dev->func, ep_fback); ++ ret = config_ep_by_speed(gadget, &audio_dev->func, ep_fback); ++ if (ret < 0) { ++ dev_err(dev, "config_ep_by_speed in_ep_fback failed (%d)\n", ret); ++ return ret; // TODO: Clean up out_ep ++ } ++ + prm->fb_ep_enabled = true; +- usb_ep_enable(ep_fback); ++ ret = usb_ep_enable(ep_fback); ++ if (ret < 0) { ++ dev_err(dev, "usb_ep_enable failed for in_ep_fback (%d)\n", ret); ++ return ret; // TODO: Clean up out_ep ++ } + req_len = ep_fback->maxpacket; + + req_fback = usb_ep_alloc_request(ep_fback, GFP_ATOMIC); +@@ -687,13 +705,17 @@ int u_audio_start_playback(struct g_audio *audio_dev) + struct uac_params *params = &audio_dev->params; + unsigned int factor; + const struct usb_endpoint_descriptor *ep_desc; +- int req_len, i; ++ int req_len, i, ret; + unsigned int p_pktsize; + + prm = &uac->p_prm; + dev_dbg(dev, "start playback with rate %d\n", prm->srate); + ep = audio_dev->in_ep; +- config_ep_by_speed(gadget, &audio_dev->func, ep); ++ ret = config_ep_by_speed(gadget, &audio_dev->func, ep); ++ if (ret < 0) { ++ dev_err(dev, "config_ep_by_speed for in_ep failed (%d)\n", ret); ++ return ret; ++ } + + ep_desc = ep->desc; + /* +@@ -720,7 +742,11 @@ int u_audio_start_playback(struct g_audio *audio_dev) + uac->p_residue_mil = 0; + + prm->ep_enabled = true; +- usb_ep_enable(ep); ++ ret = usb_ep_enable(ep); ++ if (ret < 0) { ++ dev_err(dev, "usb_ep_enable failed for in_ep (%d)\n", ret); ++ return ret; ++ } + + for (i = 0; i < params->req_number; i++) { + if (!prm->reqs[i]) { +diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c +index a92eb6d909768..8962f96ae7294 100644 +--- a/drivers/usb/gadget/function/u_serial.c ++++ b/drivers/usb/gadget/function/u_serial.c +@@ -1441,6 +1441,7 @@ void gserial_suspend(struct gserial *gser) + spin_lock(&port->port_lock); + spin_unlock(&serial_port_lock); + port->suspended = true; ++ port->start_delayed = true; + spin_unlock_irqrestore(&port->port_lock, flags); + } + EXPORT_SYMBOL_GPL(gserial_suspend); +diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c +index 358394fc3db93..9886e1cb13985 100644 +--- a/drivers/usb/gadget/udc/core.c ++++ b/drivers/usb/gadget/udc/core.c +@@ -118,12 +118,10 @@ int usb_ep_enable(struct usb_ep *ep) + goto out; + + /* UDC drivers can't handle endpoints with maxpacket size 0 */ +- if (usb_endpoint_maxp(ep->desc) == 0) { +- /* +- * We should log an error message here, but we can't call +- * dev_err() because there's no way to find the gadget +- * given only ep. +- */ ++ if (!ep->desc || usb_endpoint_maxp(ep->desc) == 0) { ++ WARN_ONCE(1, "%s: ep%d (%s) has %s\n", __func__, ep->address, ep->name, ++ (!ep->desc) ? "NULL descriptor" : "maxpacket 0"); ++ + ret = -EINVAL; + goto out; + } +diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c +index 6934970f180d7..5a8869cd95d52 100644 +--- a/drivers/usb/serial/usb_debug.c ++++ b/drivers/usb/serial/usb_debug.c +@@ -76,6 +76,11 @@ static void usb_debug_process_read_urb(struct urb *urb) + usb_serial_generic_process_read_urb(urb); + } + ++static void usb_debug_init_termios(struct tty_struct *tty) ++{ ++ tty->termios.c_lflag &= ~(ECHO | ECHONL); ++} ++ + static struct usb_serial_driver debug_device = { + .driver = { + .owner = THIS_MODULE, +@@ -85,6 +90,7 @@ static struct usb_serial_driver debug_device = { + .num_ports = 1, + .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, + .break_ctl = usb_debug_break_ctl, ++ .init_termios = usb_debug_init_termios, + .process_read_urb = usb_debug_process_read_urb, + }; + +@@ -96,6 +102,7 @@ static struct usb_serial_driver dbc_device = { + .id_table = dbc_id_table, + .num_ports = 1, + .break_ctl = usb_debug_break_ctl, ++ .init_termios = usb_debug_init_termios, + .process_read_urb = usb_debug_process_read_urb, + }; + +diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c +index 37d1fc34e8a56..14a5f55f24fc8 100644 +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -745,6 +745,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag + * + */ + if (usb_pipedevice(urb->pipe) == 0) { ++ struct usb_device *old; + __u8 type = usb_pipetype(urb->pipe); + struct usb_ctrlrequest *ctrlreq = + (struct usb_ctrlrequest *) urb->setup_packet; +@@ -755,14 +756,15 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag + goto no_need_xmit; + } + ++ old = vdev->udev; + switch (ctrlreq->bRequest) { + case USB_REQ_SET_ADDRESS: + /* set_address may come when a device is reset */ + dev_info(dev, "SetAddress Request (%d) to port %d\n", + ctrlreq->wValue, vdev->rhport); + +- usb_put_dev(vdev->udev); + vdev->udev = usb_get_dev(urb->dev); ++ usb_put_dev(old); + + spin_lock(&vdev->ud.lock); + vdev->ud.status = VDEV_ST_USED; +@@ -781,8 +783,8 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag + usbip_dbg_vhci_hc( + "Not yet?:Get_Descriptor to device 0 (get max pipe size)\n"); + +- usb_put_dev(vdev->udev); + vdev->udev = usb_get_dev(urb->dev); ++ usb_put_dev(old); + goto out; + + default: +@@ -1067,6 +1069,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud) + static void vhci_device_reset(struct usbip_device *ud) + { + struct vhci_device *vdev = container_of(ud, struct vhci_device, ud); ++ struct usb_device *old = vdev->udev; + unsigned long flags; + + spin_lock_irqsave(&ud->lock, flags); +@@ -1074,8 +1077,8 @@ static void vhci_device_reset(struct usbip_device *ud) + vdev->speed = 0; + vdev->devid = 0; + +- usb_put_dev(vdev->udev); + vdev->udev = NULL; ++ usb_put_dev(old); + + if (ud->tcp_socket) { + sockfd_put(ud->tcp_socket); +diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c +index fb590e346e43d..da2c31ccc1380 100644 +--- a/drivers/vhost/vdpa.c ++++ b/drivers/vhost/vdpa.c +@@ -1378,13 +1378,7 @@ static vm_fault_t vhost_vdpa_fault(struct vm_fault *vmf) + + notify = ops->get_vq_notification(vdpa, index); + +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- if (remap_pfn_range(vma, vmf->address & PAGE_MASK, +- PFN_DOWN(notify.addr), PAGE_SIZE, +- vma->vm_page_prot)) +- return VM_FAULT_SIGBUS; +- +- return VM_FAULT_NOPAGE; ++ return vmf_insert_pfn(vma, vmf->address & PAGE_MASK, PFN_DOWN(notify.addr)); + } + + static const struct vm_operations_struct vhost_vdpa_vm_ops = { +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c +index da88173bac432..923f064c7e3e9 100644 +--- a/drivers/xen/privcmd.c ++++ b/drivers/xen/privcmd.c +@@ -841,7 +841,7 @@ static long privcmd_ioctl_mmap_resource(struct file *file, + #ifdef CONFIG_XEN_PRIVCMD_IRQFD + /* Irqfd support */ + static struct workqueue_struct *irqfd_cleanup_wq; +-static DEFINE_MUTEX(irqfds_lock); ++static DEFINE_SPINLOCK(irqfds_lock); + static LIST_HEAD(irqfds_list); + + struct privcmd_kernel_irqfd { +@@ -905,9 +905,11 @@ irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key) + irqfd_inject(kirqfd); + + if (flags & EPOLLHUP) { +- mutex_lock(&irqfds_lock); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&irqfds_lock, flags); + irqfd_deactivate(kirqfd); +- mutex_unlock(&irqfds_lock); ++ spin_unlock_irqrestore(&irqfds_lock, flags); + } + + return 0; +@@ -925,6 +927,7 @@ irqfd_poll_func(struct file *file, wait_queue_head_t *wqh, poll_table *pt) + static int privcmd_irqfd_assign(struct privcmd_irqfd *irqfd) + { + struct privcmd_kernel_irqfd *kirqfd, *tmp; ++ unsigned long flags; + __poll_t events; + struct fd f; + void *dm_op; +@@ -964,18 +967,18 @@ static int privcmd_irqfd_assign(struct privcmd_irqfd *irqfd) + init_waitqueue_func_entry(&kirqfd->wait, irqfd_wakeup); + init_poll_funcptr(&kirqfd->pt, irqfd_poll_func); + +- mutex_lock(&irqfds_lock); ++ spin_lock_irqsave(&irqfds_lock, flags); + + list_for_each_entry(tmp, &irqfds_list, list) { + if (kirqfd->eventfd == tmp->eventfd) { + ret = -EBUSY; +- mutex_unlock(&irqfds_lock); ++ spin_unlock_irqrestore(&irqfds_lock, flags); + goto error_eventfd; + } + } + + list_add_tail(&kirqfd->list, &irqfds_list); +- mutex_unlock(&irqfds_lock); ++ spin_unlock_irqrestore(&irqfds_lock, flags); + + /* + * Check if there was an event already pending on the eventfd before we +@@ -1007,12 +1010,13 @@ static int privcmd_irqfd_deassign(struct privcmd_irqfd *irqfd) + { + struct privcmd_kernel_irqfd *kirqfd; + struct eventfd_ctx *eventfd; ++ unsigned long flags; + + eventfd = eventfd_ctx_fdget(irqfd->fd); + if (IS_ERR(eventfd)) + return PTR_ERR(eventfd); + +- mutex_lock(&irqfds_lock); ++ spin_lock_irqsave(&irqfds_lock, flags); + + list_for_each_entry(kirqfd, &irqfds_list, list) { + if (kirqfd->eventfd == eventfd) { +@@ -1021,7 +1025,7 @@ static int privcmd_irqfd_deassign(struct privcmd_irqfd *irqfd) + } + } + +- mutex_unlock(&irqfds_lock); ++ spin_unlock_irqrestore(&irqfds_lock, flags); + + eventfd_ctx_put(eventfd); + +@@ -1069,13 +1073,14 @@ static int privcmd_irqfd_init(void) + static void privcmd_irqfd_exit(void) + { + struct privcmd_kernel_irqfd *kirqfd, *tmp; ++ unsigned long flags; + +- mutex_lock(&irqfds_lock); ++ spin_lock_irqsave(&irqfds_lock, flags); + + list_for_each_entry_safe(kirqfd, tmp, &irqfds_list, list) + irqfd_deactivate(kirqfd); + +- mutex_unlock(&irqfds_lock); ++ spin_unlock_irqrestore(&irqfds_lock, flags); + + destroy_workqueue(irqfd_cleanup_wq); + } +diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h +index 06333a74d6c4c..86c7f8ce1715e 100644 +--- a/fs/btrfs/ctree.h ++++ b/fs/btrfs/ctree.h +@@ -445,6 +445,7 @@ struct btrfs_file_private { + void *filldir_buf; + u64 last_index; + struct extent_state *llseek_cached_state; ++ bool fsync_skip_inode_lock; + }; + + static inline u32 BTRFS_LEAF_DATA_SIZE(const struct btrfs_fs_info *info) +diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c +index 9fbffd84b16c5..c6a95dfa59c81 100644 +--- a/fs/btrfs/extent_io.c ++++ b/fs/btrfs/extent_io.c +@@ -2172,10 +2172,8 @@ void extent_write_locked_range(struct inode *inode, struct page *locked_page, + + page = find_get_page(mapping, cur >> PAGE_SHIFT); + ASSERT(PageLocked(page)); +- if (pages_dirty && page != locked_page) { ++ if (pages_dirty && page != locked_page) + ASSERT(PageDirty(page)); +- clear_page_dirty_for_io(page); +- } + + ret = __extent_writepage_io(BTRFS_I(inode), page, &bio_ctrl, + i_size, &nr); +diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c +index c997b790568fa..952cf145c6295 100644 +--- a/fs/btrfs/file.c ++++ b/fs/btrfs/file.c +@@ -1535,21 +1535,37 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from) + * So here we disable page faults in the iov_iter and then retry if we + * got -EFAULT, faulting in the pages before the retry. + */ ++again: + from->nofault = true; + dio = btrfs_dio_write(iocb, from, written); + from->nofault = false; + +- /* +- * iomap_dio_complete() will call btrfs_sync_file() if we have a dsync +- * iocb, and that needs to lock the inode. So unlock it before calling +- * iomap_dio_complete() to avoid a deadlock. +- */ +- btrfs_inode_unlock(BTRFS_I(inode), ilock_flags); +- +- if (IS_ERR_OR_NULL(dio)) ++ if (IS_ERR_OR_NULL(dio)) { + err = PTR_ERR_OR_ZERO(dio); +- else ++ } else { ++ struct btrfs_file_private stack_private = { 0 }; ++ struct btrfs_file_private *private; ++ const bool have_private = (file->private_data != NULL); ++ ++ if (!have_private) ++ file->private_data = &stack_private; ++ ++ /* ++ * If we have a synchoronous write, we must make sure the fsync ++ * triggered by the iomap_dio_complete() call below doesn't ++ * deadlock on the inode lock - we are already holding it and we ++ * can't call it after unlocking because we may need to complete ++ * partial writes due to the input buffer (or parts of it) not ++ * being already faulted in. ++ */ ++ private = file->private_data; ++ private->fsync_skip_inode_lock = true; + err = iomap_dio_complete(dio); ++ private->fsync_skip_inode_lock = false; ++ ++ if (!have_private) ++ file->private_data = NULL; ++ } + + /* No increment (+=) because iomap returns a cumulative value. */ + if (err > 0) +@@ -1576,10 +1592,12 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from) + } else { + fault_in_iov_iter_readable(from, left); + prev_left = left; +- goto relock; ++ goto again; + } + } + ++ btrfs_inode_unlock(BTRFS_I(inode), ilock_flags); ++ + /* + * If 'err' is -ENOTBLK or we have not written all data, then it means + * we must fallback to buffered IO. +@@ -1778,6 +1796,7 @@ static inline bool skip_inode_logging(const struct btrfs_log_ctx *ctx) + */ + int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) + { ++ struct btrfs_file_private *private = file->private_data; + struct dentry *dentry = file_dentry(file); + struct inode *inode = d_inode(dentry); + struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); +@@ -1787,6 +1806,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) + int ret = 0, err; + u64 len; + bool full_sync; ++ const bool skip_ilock = (private ? private->fsync_skip_inode_lock : false); + + trace_btrfs_sync_file(file, datasync); + +@@ -1814,7 +1834,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) + if (ret) + goto out; + +- btrfs_inode_lock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); ++ if (skip_ilock) ++ down_write(&BTRFS_I(inode)->i_mmap_lock); ++ else ++ btrfs_inode_lock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); + + atomic_inc(&root->log_batch); + +@@ -1838,7 +1861,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) + */ + ret = start_ordered_ops(inode, start, end); + if (ret) { +- btrfs_inode_unlock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); ++ if (skip_ilock) ++ up_write(&BTRFS_I(inode)->i_mmap_lock); ++ else ++ btrfs_inode_unlock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); + goto out; + } + +@@ -1941,7 +1967,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) + * file again, but that will end up using the synchronization + * inside btrfs_sync_log to keep things safe. + */ +- btrfs_inode_unlock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); ++ if (skip_ilock) ++ up_write(&BTRFS_I(inode)->i_mmap_lock); ++ else ++ btrfs_inode_unlock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); + + if (ret == BTRFS_NO_LOG_SYNC) { + ret = btrfs_end_transaction(trans); +@@ -2009,7 +2038,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) + + out_release_extents: + btrfs_release_log_ctx_extents(&ctx); +- btrfs_inode_unlock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); ++ if (skip_ilock) ++ up_write(&BTRFS_I(inode)->i_mmap_lock); ++ else ++ btrfs_inode_unlock(BTRFS_I(inode), BTRFS_ILOCK_MMAP); + goto out; + } + +diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c +index f59e599766662..3e141c4dd2630 100644 +--- a/fs/btrfs/free-space-cache.c ++++ b/fs/btrfs/free-space-cache.c +@@ -855,6 +855,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, + spin_unlock(&ctl->tree_lock); + btrfs_err(fs_info, + "Duplicate entries in free space cache, dumping"); ++ kmem_cache_free(btrfs_free_space_bitmap_cachep, e->bitmap); + kmem_cache_free(btrfs_free_space_cachep, e); + goto free_cache; + } +diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c +index 0c93439e929fb..815a5fc3ff9d8 100644 +--- a/fs/btrfs/print-tree.c ++++ b/fs/btrfs/print-tree.c +@@ -12,7 +12,7 @@ + + struct root_name_map { + u64 id; +- char name[16]; ++ const char *name; + }; + + static const struct root_name_map root_map[] = { +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c +index 012d9259ff532..a604aa1d23aed 100644 +--- a/fs/ext4/inline.c ++++ b/fs/ext4/inline.c +@@ -1411,7 +1411,11 @@ int ext4_inlinedir_to_tree(struct file *dir_file, + hinfo->hash = EXT4_DIRENT_HASH(de); + hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de); + } else { +- ext4fs_dirhash(dir, de->name, de->name_len, hinfo); ++ err = ext4fs_dirhash(dir, de->name, de->name_len, hinfo); ++ if (err) { ++ ret = err; ++ goto out; ++ } + } + if ((hinfo->hash < start_hash) || + ((hinfo->hash == start_hash) && +diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c +index 0168d28427077..57264eb4d9da3 100644 +--- a/fs/jbd2/journal.c ++++ b/fs/jbd2/journal.c +@@ -399,6 +399,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction, + tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS); + if (!tmp) { + brelse(new_bh); ++ free_buffer_head(new_bh); + return -ENOMEM; + } + spin_lock(&jh_in->b_state_lock); +diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c +index c71ae5c043060..4a20e92474b23 100644 +--- a/fs/smb/client/cifs_debug.c ++++ b/fs/smb/client/cifs_debug.c +@@ -1072,7 +1072,7 @@ static int cifs_security_flags_proc_open(struct inode *inode, struct file *file) + static void + cifs_security_flags_handle_must_flags(unsigned int *flags) + { +- unsigned int signflags = *flags & CIFSSEC_MUST_SIGN; ++ unsigned int signflags = *flags & (CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL); + + if ((*flags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5) + *flags = CIFSSEC_MUST_KRB5; +diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h +index 53e00255d96b6..54a84003950a4 100644 +--- a/fs/smb/client/cifsglob.h ++++ b/fs/smb/client/cifsglob.h +@@ -1922,7 +1922,7 @@ static inline bool is_replayable_error(int error) + #define CIFSSEC_MAY_SIGN 0x00001 + #define CIFSSEC_MAY_NTLMV2 0x00004 + #define CIFSSEC_MAY_KRB5 0x00008 +-#define CIFSSEC_MAY_SEAL 0x00040 /* not supported yet */ ++#define CIFSSEC_MAY_SEAL 0x00040 + #define CIFSSEC_MAY_NTLMSSP 0x00080 /* raw ntlmssp with ntlmv2 */ + + #define CIFSSEC_MUST_SIGN 0x01001 +@@ -1932,11 +1932,11 @@ require use of the stronger protocol */ + #define CIFSSEC_MUST_NTLMV2 0x04004 + #define CIFSSEC_MUST_KRB5 0x08008 + #ifdef CONFIG_CIFS_UPCALL +-#define CIFSSEC_MASK 0x8F08F /* flags supported if no weak allowed */ ++#define CIFSSEC_MASK 0xCF0CF /* flags supported if no weak allowed */ + #else +-#define CIFSSEC_MASK 0x87087 /* flags supported if no weak allowed */ ++#define CIFSSEC_MASK 0xC70C7 /* flags supported if no weak allowed */ + #endif /* UPCALL */ +-#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ ++#define CIFSSEC_MUST_SEAL 0x40040 + #define CIFSSEC_MUST_NTLMSSP 0x80080 /* raw ntlmssp with ntlmv2 */ + + #define CIFSSEC_DEF (CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_NTLMSSP | CIFSSEC_MAY_SEAL) +diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c +index 9cdbc3ccc1d14..e74ba047902d8 100644 +--- a/fs/smb/client/inode.c ++++ b/fs/smb/client/inode.c +@@ -1023,13 +1023,26 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data, + } + + rc = -EOPNOTSUPP; +- switch ((data->reparse.tag = tag)) { +- case 0: /* SMB1 symlink */ ++ data->reparse.tag = tag; ++ if (!data->reparse.tag) { + if (server->ops->query_symlink) { + rc = server->ops->query_symlink(xid, tcon, + cifs_sb, full_path, + &data->symlink_target); + } ++ if (rc == -EOPNOTSUPP) ++ data->reparse.tag = IO_REPARSE_TAG_INTERNAL; ++ } ++ ++ switch (data->reparse.tag) { ++ case 0: /* SMB1 symlink */ ++ break; ++ case IO_REPARSE_TAG_INTERNAL: ++ rc = 0; ++ if (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY) { ++ cifs_create_junction_fattr(fattr, sb); ++ goto out; ++ } + break; + case IO_REPARSE_TAG_MOUNT_POINT: + cifs_create_junction_fattr(fattr, sb); +diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c +index 07c468ddb88a8..65d4b72b4d51a 100644 +--- a/fs/smb/client/misc.c ++++ b/fs/smb/client/misc.c +@@ -1288,6 +1288,7 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid, + const char *full_path, + bool *islink) + { ++ struct TCP_Server_Info *server = tcon->ses->server; + struct cifs_ses *ses = tcon->ses; + size_t len; + char *path; +@@ -1304,12 +1305,12 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid, + !is_tcon_dfs(tcon)) + return 0; + +- spin_lock(&tcon->tc_lock); +- if (!tcon->origin_fullpath) { +- spin_unlock(&tcon->tc_lock); ++ spin_lock(&server->srv_lock); ++ if (!server->leaf_fullpath) { ++ spin_unlock(&server->srv_lock); + return 0; + } +- spin_unlock(&tcon->tc_lock); ++ spin_unlock(&server->srv_lock); + + /* + * Slow path - tcon is DFS and @full_path has prefix path, so attempt +diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c +index a0ffbda907331..689d8a506d459 100644 +--- a/fs/smb/client/reparse.c ++++ b/fs/smb/client/reparse.c +@@ -505,6 +505,10 @@ bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb, + } + + switch (tag) { ++ case IO_REPARSE_TAG_INTERNAL: ++ if (!(fattr->cf_cifsattrs & ATTR_DIRECTORY)) ++ return false; ++ fallthrough; + case IO_REPARSE_TAG_DFS: + case IO_REPARSE_TAG_DFSR: + case IO_REPARSE_TAG_MOUNT_POINT: +diff --git a/fs/smb/client/reparse.h b/fs/smb/client/reparse.h +index 6b55d1df9e2f8..2c0644bc4e65a 100644 +--- a/fs/smb/client/reparse.h ++++ b/fs/smb/client/reparse.h +@@ -12,6 +12,12 @@ + #include "fs_context.h" + #include "cifsglob.h" + ++/* ++ * Used only by cifs.ko to ignore reparse points from files when client or ++ * server doesn't support FSCTL_GET_REPARSE_POINT. ++ */ ++#define IO_REPARSE_TAG_INTERNAL ((__u32)~0U) ++ + static inline dev_t reparse_nfs_mkdev(struct reparse_posix_data *buf) + { + u64 v = le64_to_cpu(*(__le64 *)buf->DataBuffer); +@@ -78,10 +84,19 @@ static inline u32 reparse_mode_wsl_tag(mode_t mode) + static inline bool reparse_inode_match(struct inode *inode, + struct cifs_fattr *fattr) + { ++ struct cifsInodeInfo *cinode = CIFS_I(inode); + struct timespec64 ctime = inode_get_ctime(inode); + +- return (CIFS_I(inode)->cifsAttrs & ATTR_REPARSE) && +- CIFS_I(inode)->reparse_tag == fattr->cf_cifstag && ++ /* ++ * Do not match reparse tags when client or server doesn't support ++ * FSCTL_GET_REPARSE_POINT. @fattr->cf_cifstag should contain correct ++ * reparse tag from query dir response but the client won't be able to ++ * read the reparse point data anyway. This spares us a revalidation. ++ */ ++ if (cinode->reparse_tag != IO_REPARSE_TAG_INTERNAL && ++ cinode->reparse_tag != fattr->cf_cifstag) ++ return false; ++ return (cinode->cifsAttrs & ATTR_REPARSE) && + timespec64_equal(&ctime, &fattr->cf_ctime); + } + +diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c +index 86f8c81791374..28031c7ba6b19 100644 +--- a/fs/smb/client/smb2inode.c ++++ b/fs/smb/client/smb2inode.c +@@ -930,6 +930,8 @@ int smb2_query_path_info(const unsigned int xid, + + switch (rc) { + case 0: ++ rc = parse_create_response(data, cifs_sb, &out_iov[0]); ++ break; + case -EOPNOTSUPP: + /* + * BB TODO: When support for special files added to Samba +diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c +index a5efce03cb58e..61df8a5c68242 100644 +--- a/fs/smb/client/smb2pdu.c ++++ b/fs/smb/client/smb2pdu.c +@@ -80,6 +80,9 @@ int smb3_encryption_required(const struct cifs_tcon *tcon) + if (tcon->seal && + (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) + return 1; ++ if (((global_secflags & CIFSSEC_MUST_SEAL) == CIFSSEC_MUST_SEAL) && ++ (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION)) ++ return 1; + return 0; + } + +diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c +index b406bb3430f3d..aa54be1ce1242 100644 +--- a/fs/tracefs/event_inode.c ++++ b/fs/tracefs/event_inode.c +@@ -113,7 +113,7 @@ static void release_ei(struct kref *ref) + entry->release(entry->name, ei->data); + } + +- call_rcu(&ei->rcu, free_ei_rcu); ++ call_srcu(&eventfs_srcu, &ei->rcu, free_ei_rcu); + } + + static inline void put_ei(struct eventfs_inode *ei) +@@ -806,7 +806,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode + /* Was the parent freed? */ + if (list_empty(&ei->list)) { + cleanup_ei(ei); +- ei = NULL; ++ ei = ERR_PTR(-EBUSY); + } + return ei; + } +diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c +index 4ea11d1f72ace..7d389dd5ed519 100644 +--- a/fs/tracefs/inode.c ++++ b/fs/tracefs/inode.c +@@ -42,7 +42,7 @@ static struct inode *tracefs_alloc_inode(struct super_block *sb) + struct tracefs_inode *ti; + unsigned long flags; + +- ti = kmem_cache_alloc(tracefs_inode_cachep, GFP_KERNEL); ++ ti = alloc_inode_sb(sb, tracefs_inode_cachep, GFP_KERNEL); + if (!ti) + return NULL; + +@@ -53,15 +53,14 @@ static struct inode *tracefs_alloc_inode(struct super_block *sb) + return &ti->vfs_inode; + } + +-static void tracefs_free_inode_rcu(struct rcu_head *rcu) ++static void tracefs_free_inode(struct inode *inode) + { +- struct tracefs_inode *ti; ++ struct tracefs_inode *ti = get_tracefs(inode); + +- ti = container_of(rcu, struct tracefs_inode, rcu); + kmem_cache_free(tracefs_inode_cachep, ti); + } + +-static void tracefs_free_inode(struct inode *inode) ++static void tracefs_destroy_inode(struct inode *inode) + { + struct tracefs_inode *ti = get_tracefs(inode); + unsigned long flags; +@@ -69,8 +68,6 @@ static void tracefs_free_inode(struct inode *inode) + spin_lock_irqsave(&tracefs_inode_lock, flags); + list_del_rcu(&ti->list); + spin_unlock_irqrestore(&tracefs_inode_lock, flags); +- +- call_rcu(&ti->rcu, tracefs_free_inode_rcu); + } + + static ssize_t default_read_file(struct file *file, char __user *buf, +@@ -458,6 +455,7 @@ static int tracefs_drop_inode(struct inode *inode) + static const struct super_operations tracefs_super_operations = { + .alloc_inode = tracefs_alloc_inode, + .free_inode = tracefs_free_inode, ++ .destroy_inode = tracefs_destroy_inode, + .drop_inode = tracefs_drop_inode, + .statfs = simple_statfs, + .remount_fs = tracefs_remount, +diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h +index f704d8348357e..d83c2a25f288e 100644 +--- a/fs/tracefs/internal.h ++++ b/fs/tracefs/internal.h +@@ -10,10 +10,7 @@ enum { + }; + + struct tracefs_inode { +- union { +- struct inode vfs_inode; +- struct rcu_head rcu; +- }; ++ struct inode vfs_inode; + /* The below gets initialized with memset_after(ti, 0, vfs_inode) */ + struct list_head list; + unsigned long flags; +diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c +index 558ad046972ad..bb471ec364046 100644 +--- a/fs/udf/balloc.c ++++ b/fs/udf/balloc.c +@@ -18,6 +18,7 @@ + #include "udfdecl.h" + + #include ++#include + + #include "udf_i.h" + #include "udf_sb.h" +@@ -140,7 +141,6 @@ static void udf_bitmap_free_blocks(struct super_block *sb, + { + struct udf_sb_info *sbi = UDF_SB(sb); + struct buffer_head *bh = NULL; +- struct udf_part_map *partmap; + unsigned long block; + unsigned long block_group; + unsigned long bit; +@@ -149,19 +149,9 @@ static void udf_bitmap_free_blocks(struct super_block *sb, + unsigned long overflow; + + mutex_lock(&sbi->s_alloc_mutex); +- partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; +- if (bloc->logicalBlockNum + count < count || +- (bloc->logicalBlockNum + count) > partmap->s_partition_len) { +- udf_debug("%u < %d || %u + %u > %u\n", +- bloc->logicalBlockNum, 0, +- bloc->logicalBlockNum, count, +- partmap->s_partition_len); +- goto error_return; +- } +- ++ /* We make sure this cannot overflow when mounting the filesystem */ + block = bloc->logicalBlockNum + offset + + (sizeof(struct spaceBitmapDesc) << 3); +- + do { + overflow = 0; + block_group = block >> (sb->s_blocksize_bits + 3); +@@ -391,7 +381,6 @@ static void udf_table_free_blocks(struct super_block *sb, + uint32_t count) + { + struct udf_sb_info *sbi = UDF_SB(sb); +- struct udf_part_map *partmap; + uint32_t start, end; + uint32_t elen; + struct kernel_lb_addr eloc; +@@ -400,16 +389,6 @@ static void udf_table_free_blocks(struct super_block *sb, + struct udf_inode_info *iinfo; + + mutex_lock(&sbi->s_alloc_mutex); +- partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; +- if (bloc->logicalBlockNum + count < count || +- (bloc->logicalBlockNum + count) > partmap->s_partition_len) { +- udf_debug("%u < %d || %u + %u > %u\n", +- bloc->logicalBlockNum, 0, +- bloc->logicalBlockNum, count, +- partmap->s_partition_len); +- goto error_return; +- } +- + iinfo = UDF_I(table); + udf_add_free_space(sb, sbi->s_partition, count); + +@@ -684,6 +663,17 @@ void udf_free_blocks(struct super_block *sb, struct inode *inode, + { + uint16_t partition = bloc->partitionReferenceNum; + struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition]; ++ uint32_t blk; ++ ++ if (check_add_overflow(bloc->logicalBlockNum, offset, &blk) || ++ check_add_overflow(blk, count, &blk) || ++ bloc->logicalBlockNum + count > map->s_partition_len) { ++ udf_debug("Invalid request to free blocks: (%d, %u), off %u, " ++ "len %u, partition len %u\n", ++ partition, bloc->logicalBlockNum, offset, count, ++ map->s_partition_len); ++ return; ++ } + + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) { + udf_bitmap_free_blocks(sb, map->s_uspace.s_bitmap, +diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c +index 57f366c3d3554..9f9d3abad2cf3 100644 +--- a/fs/xfs/xfs_log_recover.c ++++ b/fs/xfs/xfs_log_recover.c +@@ -2965,7 +2965,7 @@ xlog_do_recovery_pass( + int error = 0, h_size, h_len; + int error2 = 0; + int bblks, split_bblks; +- int hblks, split_hblks, wrapped_hblks; ++ int hblks = 1, split_hblks, wrapped_hblks; + int i; + struct hlist_head rhash[XLOG_RHASH_SIZE]; + LIST_HEAD (buffer_list); +@@ -3021,14 +3021,22 @@ xlog_do_recovery_pass( + if (error) + goto bread_err1; + +- hblks = xlog_logrec_hblks(log, rhead); +- if (hblks != 1) { +- kmem_free(hbp); +- hbp = xlog_alloc_buffer(log, hblks); ++ /* ++ * This open codes xlog_logrec_hblks so that we can reuse the ++ * fixed up h_size value calculated above. Without that we'd ++ * still allocate the buffer based on the incorrect on-disk ++ * size. ++ */ ++ if (h_size > XLOG_HEADER_CYCLE_SIZE && ++ (rhead->h_version & cpu_to_be32(XLOG_VERSION_2))) { ++ hblks = DIV_ROUND_UP(h_size, XLOG_HEADER_CYCLE_SIZE); ++ if (hblks > 1) { ++ kmem_free(hbp); ++ hbp = xlog_alloc_buffer(log, hblks); ++ } + } + } else { + ASSERT(log->l_sectBBsize == 1); +- hblks = 1; + hbp = xlog_alloc_buffer(log, 1); + h_size = XLOG_BIG_RECORD_BSIZE; + } +diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h +index 378b2459efe2d..f7cc8080672cc 100644 +--- a/include/linux/blk-integrity.h ++++ b/include/linux/blk-integrity.h +@@ -105,14 +105,13 @@ static inline bool blk_integrity_rq(struct request *rq) + } + + /* +- * Return the first bvec that contains integrity data. Only drivers that are +- * limited to a single integrity segment should use this helper. ++ * Return the current bvec that contains the integrity data. bip_iter may be ++ * advanced to iterate over the integrity data. + */ +-static inline struct bio_vec *rq_integrity_vec(struct request *rq) ++static inline struct bio_vec rq_integrity_vec(struct request *rq) + { +- if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1)) +- return NULL; +- return rq->bio->bi_integrity->bip_vec; ++ return mp_bvec_iter_bvec(rq->bio->bi_integrity->bip_vec, ++ rq->bio->bi_integrity->bip_iter); + } + #else /* CONFIG_BLK_DEV_INTEGRITY */ + static inline int blk_rq_count_integrity_sg(struct request_queue *q, +@@ -176,9 +175,10 @@ static inline int blk_integrity_rq(struct request *rq) + return 0; + } + +-static inline struct bio_vec *rq_integrity_vec(struct request *rq) ++static inline struct bio_vec rq_integrity_vec(struct request *rq) + { +- return NULL; ++ /* the optimizer will remove all calls to this function */ ++ return (struct bio_vec){ }; + } + #endif /* CONFIG_BLK_DEV_INTEGRITY */ + #endif /* _LINUX_BLK_INTEGRITY_H */ +diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h +index 1d42d4b173271..0ad8b550bb4b4 100644 +--- a/include/linux/clocksource.h ++++ b/include/linux/clocksource.h +@@ -291,7 +291,19 @@ static inline void timer_probe(void) {} + #define TIMER_ACPI_DECLARE(name, table_id, fn) \ + ACPI_DECLARE_PROBE_ENTRY(timer, name, table_id, 0, NULL, 0, fn) + +-extern ulong max_cswd_read_retries; ++static inline unsigned int clocksource_get_max_watchdog_retry(void) ++{ ++ /* ++ * When system is in the boot phase or under heavy workload, there ++ * can be random big latencies during the clocksource/watchdog ++ * read, so allow retries to filter the noise latency. As the ++ * latency's frequency and maximum value goes up with the number of ++ * CPUs, scale the number of retries with the number of online ++ * CPUs. ++ */ ++ return (ilog2(num_online_cpus()) / 2) + 1; ++} ++ + void clocksource_verify_percpu(struct clocksource *cs); + + #endif /* _LINUX_CLOCKSOURCE_H */ +diff --git a/include/linux/fs.h b/include/linux/fs.h +index ee5efad0d7801..56dce38c47862 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -642,6 +642,7 @@ struct inode { + umode_t i_mode; + unsigned short i_opflags; + kuid_t i_uid; ++ struct list_head i_lru; /* inode LRU list */ + kgid_t i_gid; + unsigned int i_flags; + +@@ -703,7 +704,6 @@ struct inode { + u16 i_wb_frn_avg_time; + u16 i_wb_frn_history; + #endif +- struct list_head i_lru; /* inode LRU list */ + struct list_head i_sb_list; + struct list_head i_wb_list; /* backing dev writeback list */ + union { +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h +index 0a85ff5c8db3c..abff4e3b6a58b 100644 +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -2124,6 +2124,8 @@ + + #define PCI_VENDOR_ID_CHELSIO 0x1425 + ++#define PCI_VENDOR_ID_EDIMAX 0x1432 ++ + #define PCI_VENDOR_ID_ADLINK 0x144a + + #define PCI_VENDOR_ID_SAMSUNG 0x144d +diff --git a/include/linux/profile.h b/include/linux/profile.h +index 11db1ec516e27..12da750a88a04 100644 +--- a/include/linux/profile.h ++++ b/include/linux/profile.h +@@ -11,7 +11,6 @@ + + #define CPU_PROFILING 1 + #define SCHED_PROFILING 2 +-#define SLEEP_PROFILING 3 + #define KVM_PROFILING 4 + + struct proc_dir_entry; +diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h +index 696f8dc4aa53c..cb8bd759e8005 100644 +--- a/include/linux/trace_events.h ++++ b/include/linux/trace_events.h +@@ -869,7 +869,6 @@ do { \ + struct perf_event; + + DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); +-DECLARE_PER_CPU(int, bpf_kprobe_override); + + extern int perf_trace_init(struct perf_event *event); + extern void perf_trace_destroy(struct perf_event *event); +diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h +index d1d7825318c32..6c395a2600e8d 100644 +--- a/include/linux/virtio_net.h ++++ b/include/linux/virtio_net.h +@@ -56,7 +56,6 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + unsigned int thlen = 0; + unsigned int p_off = 0; + unsigned int ip_proto; +- u64 ret, remainder, gso_size; + + if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { +@@ -99,16 +98,6 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + u32 off = __virtio16_to_cpu(little_endian, hdr->csum_offset); + u32 needed = start + max_t(u32, thlen, off + sizeof(__sum16)); + +- if (hdr->gso_size) { +- gso_size = __virtio16_to_cpu(little_endian, hdr->gso_size); +- ret = div64_u64_rem(skb->len, gso_size, &remainder); +- if (!(ret && (hdr->gso_size > needed) && +- ((remainder > needed) || (remainder == 0)))) { +- return -EINVAL; +- } +- skb_shinfo(skb)->tx_flags |= SKBFL_SHARED_FRAG; +- } +- + if (!pskb_may_pull(skb, needed)) + return -EINVAL; + +@@ -182,6 +171,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + if (gso_type != SKB_GSO_UDP_L4) + return -EINVAL; + break; ++ case SKB_GSO_TCPV4: ++ case SKB_GSO_TCPV6: ++ if (skb->csum_offset != offsetof(struct tcphdr, check)) ++ return -EINVAL; ++ break; + } + + /* Kernel has a special handling for GSO_BY_FRAGS. */ +diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h +index b32539bb0fb05..61cfc8891f820 100644 +--- a/include/net/ip6_route.h ++++ b/include/net/ip6_route.h +@@ -128,18 +128,26 @@ void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args, + + static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i, + const struct in6_addr *daddr, +- unsigned int prefs, ++ unsigned int prefs, int l3mdev_index, + struct in6_addr *saddr) + { ++ struct net_device *l3mdev; ++ struct net_device *dev; ++ bool same_vrf; + int err = 0; + +- if (f6i && f6i->fib6_prefsrc.plen) { ++ rcu_read_lock(); ++ ++ l3mdev = dev_get_by_index_rcu(net, l3mdev_index); ++ if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev) ++ dev = f6i ? fib6_info_nh_dev(f6i) : NULL; ++ same_vrf = !l3mdev || l3mdev_master_dev_rcu(dev) == l3mdev; ++ if (f6i && f6i->fib6_prefsrc.plen && same_vrf) + *saddr = f6i->fib6_prefsrc.addr; +- } else { +- struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL; ++ else ++ err = ipv6_dev_get_saddr(net, same_vrf ? dev : l3mdev, daddr, prefs, saddr); + +- err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr); +- } ++ rcu_read_unlock(); + + return err; + } +diff --git a/include/trace/events/intel_ifs.h b/include/trace/events/intel_ifs.h +index d7353024016cc..af0af3f1d9b7c 100644 +--- a/include/trace/events/intel_ifs.h ++++ b/include/trace/events/intel_ifs.h +@@ -10,25 +10,25 @@ + + TRACE_EVENT(ifs_status, + +- TP_PROTO(int cpu, union ifs_scan activate, union ifs_status status), ++ TP_PROTO(int cpu, int start, int stop, u64 status), + +- TP_ARGS(cpu, activate, status), ++ TP_ARGS(cpu, start, stop, status), + + TP_STRUCT__entry( + __field( u64, status ) + __field( int, cpu ) +- __field( u8, start ) +- __field( u8, stop ) ++ __field( u16, start ) ++ __field( u16, stop ) + ), + + TP_fast_assign( + __entry->cpu = cpu; +- __entry->start = activate.start; +- __entry->stop = activate.stop; +- __entry->status = status.data; ++ __entry->start = start; ++ __entry->stop = stop; ++ __entry->status = status; + ), + +- TP_printk("cpu: %d, start: %.2x, stop: %.2x, status: %llx", ++ TP_printk("cpu: %d, start: %.4x, stop: %.4x, status: %.16llx", + __entry->cpu, + __entry->start, + __entry->stop, +diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c +index 5c9888901ef44..46094f0c9fcda 100644 +--- a/kernel/irq/irqdesc.c ++++ b/kernel/irq/irqdesc.c +@@ -517,6 +517,7 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node, + flags = IRQD_AFFINITY_MANAGED | + IRQD_MANAGED_SHUTDOWN; + } ++ flags |= IRQD_AFFINITY_SET; + mask = &affinity->mask; + node = cpu_to_node(cpumask_first(mask)); + affinity++; +diff --git a/kernel/jump_label.c b/kernel/jump_label.c +index eec802175ccc6..1ed269b2c4035 100644 +--- a/kernel/jump_label.c ++++ b/kernel/jump_label.c +@@ -231,7 +231,7 @@ void static_key_disable_cpuslocked(struct static_key *key) + } + + jump_label_lock(); +- if (atomic_cmpxchg(&key->enabled, 1, 0)) ++ if (atomic_cmpxchg(&key->enabled, 1, 0) == 1) + jump_label_update(key); + jump_label_unlock(); + } +@@ -284,7 +284,7 @@ static void __static_key_slow_dec_cpuslocked(struct static_key *key) + return; + + guard(mutex)(&jump_label_mutex); +- if (atomic_cmpxchg(&key->enabled, 1, 0)) ++ if (atomic_cmpxchg(&key->enabled, 1, 0) == 1) + jump_label_update(key); + else + WARN_ON_ONCE(!static_key_slow_try_dec(key)); +diff --git a/kernel/kcov.c b/kernel/kcov.c +index 9f4affae4fad4..72d9aa6fb50c3 100644 +--- a/kernel/kcov.c ++++ b/kernel/kcov.c +@@ -161,6 +161,15 @@ static void kcov_remote_area_put(struct kcov_remote_area *area, + kmsan_unpoison_memory(&area->list, sizeof(area->list)); + } + ++/* ++ * Unlike in_serving_softirq(), this function returns false when called during ++ * a hardirq or an NMI that happened in the softirq context. ++ */ ++static inline bool in_softirq_really(void) ++{ ++ return in_serving_softirq() && !in_hardirq() && !in_nmi(); ++} ++ + static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) + { + unsigned int mode; +@@ -170,7 +179,7 @@ static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_stru + * so we ignore code executed in interrupts, unless we are in a remote + * coverage collection section in a softirq. + */ +- if (!in_task() && !(in_serving_softirq() && t->kcov_softirq)) ++ if (!in_task() && !(in_softirq_really() && t->kcov_softirq)) + return false; + mode = READ_ONCE(t->kcov_mode); + /* +@@ -848,7 +857,7 @@ void kcov_remote_start(u64 handle) + + if (WARN_ON(!kcov_check_handle(handle, true, true, true))) + return; +- if (!in_task() && !in_serving_softirq()) ++ if (!in_task() && !in_softirq_really()) + return; + + local_lock_irqsave(&kcov_percpu_data.lock, flags); +@@ -990,7 +999,7 @@ void kcov_remote_stop(void) + int sequence; + unsigned long flags; + +- if (!in_task() && !in_serving_softirq()) ++ if (!in_task() && !in_softirq_really()) + return; + + local_lock_irqsave(&kcov_percpu_data.lock, flags); +diff --git a/kernel/kprobes.c b/kernel/kprobes.c +index add63428c0b40..c10954bd84448 100644 +--- a/kernel/kprobes.c ++++ b/kernel/kprobes.c +@@ -1558,8 +1558,8 @@ static bool is_cfi_preamble_symbol(unsigned long addr) + if (lookup_symbol_name(addr, symbuf)) + return false; + +- return str_has_prefix("__cfi_", symbuf) || +- str_has_prefix("__pfx_", symbuf); ++ return str_has_prefix(symbuf, "__cfi_") || ++ str_has_prefix(symbuf, "__pfx_"); + } + + static int check_kprobe_address_safe(struct kprobe *p, +diff --git a/kernel/module/main.c b/kernel/module/main.c +index 34d9e718c2c7d..b00e31721a73e 100644 +--- a/kernel/module/main.c ++++ b/kernel/module/main.c +@@ -3081,7 +3081,7 @@ static bool idempotent(struct idempotent *u, const void *cookie) + struct idempotent *existing; + bool first; + +- u->ret = 0; ++ u->ret = -EINTR; + u->cookie = cookie; + init_completion(&u->complete); + +@@ -3117,7 +3117,7 @@ static int idempotent_complete(struct idempotent *u, int ret) + hlist_for_each_entry_safe(pos, next, head, entry) { + if (pos->cookie != cookie) + continue; +- hlist_del(&pos->entry); ++ hlist_del_init(&pos->entry); + pos->ret = ret; + complete(&pos->complete); + } +@@ -3125,6 +3125,28 @@ static int idempotent_complete(struct idempotent *u, int ret) + return ret; + } + ++/* ++ * Wait for the idempotent worker. ++ * ++ * If we get interrupted, we need to remove ourselves from the ++ * the idempotent list, and the completion may still come in. ++ * ++ * The 'idem_lock' protects against the race, and 'idem.ret' was ++ * initialized to -EINTR and is thus always the right return ++ * value even if the idempotent work then completes between ++ * the wait_for_completion and the cleanup. ++ */ ++static int idempotent_wait_for_completion(struct idempotent *u) ++{ ++ if (wait_for_completion_interruptible(&u->complete)) { ++ spin_lock(&idem_lock); ++ if (!hlist_unhashed(&u->entry)) ++ hlist_del(&u->entry); ++ spin_unlock(&idem_lock); ++ } ++ return u->ret; ++} ++ + static int init_module_from_file(struct file *f, const char __user * uargs, int flags) + { + struct load_info info = { }; +@@ -3160,15 +3182,16 @@ static int idempotent_init_module(struct file *f, const char __user * uargs, int + if (!f || !(f->f_mode & FMODE_READ)) + return -EBADF; + +- /* See if somebody else is doing the operation? */ +- if (idempotent(&idem, file_inode(f))) { +- wait_for_completion(&idem.complete); +- return idem.ret; ++ /* Are we the winners of the race and get to do this? */ ++ if (!idempotent(&idem, file_inode(f))) { ++ int ret = init_module_from_file(f, uargs, flags); ++ return idempotent_complete(&idem, ret); + } + +- /* Otherwise, we'll do it and complete others */ +- return idempotent_complete(&idem, +- init_module_from_file(f, uargs, flags)); ++ /* ++ * Somebody else won the race and is loading the module. ++ */ ++ return idempotent_wait_for_completion(&idem); + } + + SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags) +diff --git a/kernel/padata.c b/kernel/padata.c +index c974568f65f5d..29545dd6dd53d 100644 +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -516,6 +516,13 @@ void __init padata_do_multithreaded(struct padata_mt_job *job) + ps.chunk_size = max(ps.chunk_size, job->min_chunk); + ps.chunk_size = roundup(ps.chunk_size, job->align); + ++ /* ++ * chunk_size can be 0 if the caller sets min_chunk to 0. So force it ++ * to at least 1 to prevent divide-by-0 panic in padata_mt_helper().` ++ */ ++ if (!ps.chunk_size) ++ ps.chunk_size = 1U; ++ + list_for_each_entry(pw, &works, pw_list) + queue_work(system_unbound_wq, &pw->pw_work); + +diff --git a/kernel/profile.c b/kernel/profile.c +index 8a77769bc4b4c..984f819b701c9 100644 +--- a/kernel/profile.c ++++ b/kernel/profile.c +@@ -57,20 +57,11 @@ static DEFINE_MUTEX(profile_flip_mutex); + int profile_setup(char *str) + { + static const char schedstr[] = "schedule"; +- static const char sleepstr[] = "sleep"; + static const char kvmstr[] = "kvm"; + const char *select = NULL; + int par; + +- if (!strncmp(str, sleepstr, strlen(sleepstr))) { +-#ifdef CONFIG_SCHEDSTATS +- force_schedstat_enabled(); +- prof_on = SLEEP_PROFILING; +- select = sleepstr; +-#else +- pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n"); +-#endif /* CONFIG_SCHEDSTATS */ +- } else if (!strncmp(str, schedstr, strlen(schedstr))) { ++ if (!strncmp(str, schedstr, strlen(schedstr))) { + prof_on = SCHED_PROFILING; + select = schedstr; + } else if (!strncmp(str, kvmstr, strlen(kvmstr))) { +diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c +index 781146600aa49..46612fb15fc6d 100644 +--- a/kernel/rcu/rcutorture.c ++++ b/kernel/rcu/rcutorture.c +@@ -2592,7 +2592,7 @@ static void rcu_torture_fwd_cb_cr(struct rcu_head *rhp) + spin_lock_irqsave(&rfp->rcu_fwd_lock, flags); + rfcpp = rfp->rcu_fwd_cb_tail; + rfp->rcu_fwd_cb_tail = &rfcp->rfc_next; +- WRITE_ONCE(*rfcpp, rfcp); ++ smp_store_release(rfcpp, rfcp); + WRITE_ONCE(rfp->n_launders_cb, rfp->n_launders_cb + 1); + i = ((jiffies - rfp->rcu_fwd_startat) / (HZ / FWD_CBS_HIST_DIV)); + if (i >= ARRAY_SIZE(rfp->n_launders_hist)) +diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c +index 8cf6a6fef7965..583cc29080764 100644 +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -4595,11 +4595,15 @@ void rcutree_migrate_callbacks(int cpu) + struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); + bool needwake; + +- if (rcu_rdp_is_offloaded(rdp) || +- rcu_segcblist_empty(&rdp->cblist)) +- return; /* No callbacks to migrate. */ ++ if (rcu_rdp_is_offloaded(rdp)) ++ return; + + raw_spin_lock_irqsave(&rcu_state.barrier_lock, flags); ++ if (rcu_segcblist_empty(&rdp->cblist)) { ++ raw_spin_unlock_irqrestore(&rcu_state.barrier_lock, flags); ++ return; /* No callbacks to migrate. */ ++ } ++ + WARN_ON_ONCE(rcu_rdp_cpu_online(rdp)); + rcu_barrier_entrain(rdp); + my_rdp = this_cpu_ptr(&rcu_data); +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 92e4afeb71add..97571d390f184 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -9596,6 +9596,30 @@ void set_rq_offline(struct rq *rq) + } + } + ++static inline void sched_set_rq_online(struct rq *rq, int cpu) ++{ ++ struct rq_flags rf; ++ ++ rq_lock_irqsave(rq, &rf); ++ if (rq->rd) { ++ BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); ++ set_rq_online(rq); ++ } ++ rq_unlock_irqrestore(rq, &rf); ++} ++ ++static inline void sched_set_rq_offline(struct rq *rq, int cpu) ++{ ++ struct rq_flags rf; ++ ++ rq_lock_irqsave(rq, &rf); ++ if (rq->rd) { ++ BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); ++ set_rq_offline(rq); ++ } ++ rq_unlock_irqrestore(rq, &rf); ++} ++ + /* + * used to mark begin/end of suspend/resume: + */ +@@ -9646,10 +9670,25 @@ static int cpuset_cpu_inactive(unsigned int cpu) + return 0; + } + ++static inline void sched_smt_present_inc(int cpu) ++{ ++#ifdef CONFIG_SCHED_SMT ++ if (cpumask_weight(cpu_smt_mask(cpu)) == 2) ++ static_branch_inc_cpuslocked(&sched_smt_present); ++#endif ++} ++ ++static inline void sched_smt_present_dec(int cpu) ++{ ++#ifdef CONFIG_SCHED_SMT ++ if (cpumask_weight(cpu_smt_mask(cpu)) == 2) ++ static_branch_dec_cpuslocked(&sched_smt_present); ++#endif ++} ++ + int sched_cpu_activate(unsigned int cpu) + { + struct rq *rq = cpu_rq(cpu); +- struct rq_flags rf; + + /* + * Clear the balance_push callback and prepare to schedule +@@ -9657,13 +9696,10 @@ int sched_cpu_activate(unsigned int cpu) + */ + balance_push_set(cpu, false); + +-#ifdef CONFIG_SCHED_SMT + /* + * When going up, increment the number of cores with SMT present. + */ +- if (cpumask_weight(cpu_smt_mask(cpu)) == 2) +- static_branch_inc_cpuslocked(&sched_smt_present); +-#endif ++ sched_smt_present_inc(cpu); + set_cpu_active(cpu, true); + + if (sched_smp_initialized) { +@@ -9681,12 +9717,7 @@ int sched_cpu_activate(unsigned int cpu) + * 2) At runtime, if cpuset_cpu_active() fails to rebuild the + * domains. + */ +- rq_lock_irqsave(rq, &rf); +- if (rq->rd) { +- BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); +- set_rq_online(rq); +- } +- rq_unlock_irqrestore(rq, &rf); ++ sched_set_rq_online(rq, cpu); + + return 0; + } +@@ -9694,7 +9725,6 @@ int sched_cpu_activate(unsigned int cpu) + int sched_cpu_deactivate(unsigned int cpu) + { + struct rq *rq = cpu_rq(cpu); +- struct rq_flags rf; + int ret; + + /* +@@ -9725,20 +9755,14 @@ int sched_cpu_deactivate(unsigned int cpu) + */ + synchronize_rcu(); + +- rq_lock_irqsave(rq, &rf); +- if (rq->rd) { +- BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); +- set_rq_offline(rq); +- } +- rq_unlock_irqrestore(rq, &rf); ++ sched_set_rq_offline(rq, cpu); + +-#ifdef CONFIG_SCHED_SMT + /* + * When going down, decrement the number of cores with SMT present. + */ +- if (cpumask_weight(cpu_smt_mask(cpu)) == 2) +- static_branch_dec_cpuslocked(&sched_smt_present); ++ sched_smt_present_dec(cpu); + ++#ifdef CONFIG_SCHED_SMT + sched_core_cpu_deactivate(cpu); + #endif + +@@ -9748,6 +9772,8 @@ int sched_cpu_deactivate(unsigned int cpu) + sched_update_numa(cpu, false); + ret = cpuset_cpu_inactive(cpu); + if (ret) { ++ sched_smt_present_inc(cpu); ++ sched_set_rq_online(rq, cpu); + balance_push_set(cpu, false); + set_cpu_active(cpu, true); + sched_update_numa(cpu, true); +diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c +index af7952f12e6cf..b453f8a6a7c76 100644 +--- a/kernel/sched/cputime.c ++++ b/kernel/sched/cputime.c +@@ -595,6 +595,12 @@ void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev, + } + + stime = mul_u64_u64_div_u64(stime, rtime, stime + utime); ++ /* ++ * Because mul_u64_u64_div_u64() can approximate on some ++ * achitectures; enforce the constraint that: a*b/(b+c) <= a. ++ */ ++ if (unlikely(stime > rtime)) ++ stime = rtime; + + update: + /* +diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c +index 857f837f52cbe..966f4eacfe51d 100644 +--- a/kernel/sched/stats.c ++++ b/kernel/sched/stats.c +@@ -92,16 +92,6 @@ void __update_stats_enqueue_sleeper(struct rq *rq, struct task_struct *p, + + trace_sched_stat_blocked(p, delta); + +- /* +- * Blocking time is in units of nanosecs, so shift by +- * 20 to get a milliseconds-range estimation of the +- * amount of time that the task spent sleeping: +- */ +- if (unlikely(prof_on == SLEEP_PROFILING)) { +- profile_hits(SLEEP_PROFILING, +- (void *)get_wchan(p), +- delta >> 20); +- } + account_scheduler_latency(p, delta >> 10, 0); + } + } +diff --git a/kernel/time/clocksource-wdtest.c b/kernel/time/clocksource-wdtest.c +index df922f49d171b..d06185e054ea2 100644 +--- a/kernel/time/clocksource-wdtest.c ++++ b/kernel/time/clocksource-wdtest.c +@@ -104,8 +104,8 @@ static void wdtest_ktime_clocksource_reset(void) + static int wdtest_func(void *arg) + { + unsigned long j1, j2; ++ int i, max_retries; + char *s; +- int i; + + schedule_timeout_uninterruptible(holdoff * HZ); + +@@ -139,18 +139,19 @@ static int wdtest_func(void *arg) + WARN_ON_ONCE(time_before(j2, j1 + NSEC_PER_USEC)); + + /* Verify tsc-like stability with various numbers of errors injected. */ +- for (i = 0; i <= max_cswd_read_retries + 1; i++) { +- if (i <= 1 && i < max_cswd_read_retries) ++ max_retries = clocksource_get_max_watchdog_retry(); ++ for (i = 0; i <= max_retries + 1; i++) { ++ if (i <= 1 && i < max_retries) + s = ""; +- else if (i <= max_cswd_read_retries) ++ else if (i <= max_retries) + s = ", expect message"; + else + s = ", expect clock skew"; +- pr_info("--- Watchdog with %dx error injection, %lu retries%s.\n", i, max_cswd_read_retries, s); ++ pr_info("--- Watchdog with %dx error injection, %d retries%s.\n", i, max_retries, s); + WRITE_ONCE(wdtest_ktime_read_ndelays, i); + schedule_timeout_uninterruptible(2 * HZ); + WARN_ON_ONCE(READ_ONCE(wdtest_ktime_read_ndelays)); +- WARN_ON_ONCE((i <= max_cswd_read_retries) != ++ WARN_ON_ONCE((i <= max_retries) != + !(clocksource_wdtest_ktime.flags & CLOCK_SOURCE_UNSTABLE)); + wdtest_ktime_clocksource_reset(); + } +diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c +index 3052b1f1168e2..3260bbe98894b 100644 +--- a/kernel/time/clocksource.c ++++ b/kernel/time/clocksource.c +@@ -210,9 +210,6 @@ void clocksource_mark_unstable(struct clocksource *cs) + spin_unlock_irqrestore(&watchdog_lock, flags); + } + +-ulong max_cswd_read_retries = 2; +-module_param(max_cswd_read_retries, ulong, 0644); +-EXPORT_SYMBOL_GPL(max_cswd_read_retries); + static int verify_n_cpus = 8; + module_param(verify_n_cpus, int, 0644); + +@@ -224,11 +221,12 @@ enum wd_read_status { + + static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) + { +- unsigned int nretries; ++ unsigned int nretries, max_retries; + u64 wd_end, wd_end2, wd_delta; + int64_t wd_delay, wd_seq_delay; + +- for (nretries = 0; nretries <= max_cswd_read_retries; nretries++) { ++ max_retries = clocksource_get_max_watchdog_retry(); ++ for (nretries = 0; nretries <= max_retries; nretries++) { + local_irq_disable(); + *wdnow = watchdog->read(watchdog); + *csnow = cs->read(cs); +@@ -240,7 +238,7 @@ static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow, + wd_delay = clocksource_cyc2ns(wd_delta, watchdog->mult, + watchdog->shift); + if (wd_delay <= WATCHDOG_MAX_SKEW) { +- if (nretries > 1 || nretries >= max_cswd_read_retries) { ++ if (nretries > 1 && nretries >= max_retries) { + pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n", + smp_processor_id(), watchdog->name, nretries); + } +diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c +index 406dccb79c2b6..8d2dd214ec682 100644 +--- a/kernel/time/ntp.c ++++ b/kernel/time/ntp.c +@@ -727,17 +727,16 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc, + } + + if (txc->modes & ADJ_MAXERROR) +- time_maxerror = txc->maxerror; ++ time_maxerror = clamp(txc->maxerror, 0, NTP_PHASE_LIMIT); + + if (txc->modes & ADJ_ESTERROR) +- time_esterror = txc->esterror; ++ time_esterror = clamp(txc->esterror, 0, NTP_PHASE_LIMIT); + + if (txc->modes & ADJ_TIMECONST) { +- time_constant = txc->constant; ++ time_constant = clamp(txc->constant, 0, MAXTC); + if (!(time_status & STA_NANO)) + time_constant += 4; +- time_constant = min(time_constant, (long)MAXTC); +- time_constant = max(time_constant, 0l); ++ time_constant = clamp(time_constant, 0, MAXTC); + } + + if (txc->modes & ADJ_TAI && +diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c +index b4843099a8da7..ed58eebb4e8f4 100644 +--- a/kernel/time/tick-broadcast.c ++++ b/kernel/time/tick-broadcast.c +@@ -1141,7 +1141,6 @@ void tick_broadcast_switch_to_oneshot(void) + #ifdef CONFIG_HOTPLUG_CPU + void hotplug_cpu__broadcast_tick_pull(int deadcpu) + { +- struct tick_device *td = this_cpu_ptr(&tick_cpu_device); + struct clock_event_device *bc; + unsigned long flags; + +@@ -1167,6 +1166,8 @@ void hotplug_cpu__broadcast_tick_pull(int deadcpu) + * device to avoid the starvation. + */ + if (tick_check_broadcast_expired()) { ++ struct tick_device *td = this_cpu_ptr(&tick_cpu_device); ++ + cpumask_clear_cpu(smp_processor_id(), tick_broadcast_force_mask); + tick_program_event(td->evtdev->next_event, 1); + } +diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c +index 8aab7ed414907..11b7000d5e1d4 100644 +--- a/kernel/time/timekeeping.c ++++ b/kernel/time/timekeeping.c +@@ -2476,7 +2476,7 @@ int do_adjtimex(struct __kernel_timex *txc) + clock_set |= timekeeping_advance(TK_ADV_FREQ); + + if (clock_set) +- clock_was_set(CLOCK_REALTIME); ++ clock_was_set(CLOCK_SET_WALL); + + ntp_notify_cmos_timer(); + +diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c +index a4dcf0f243521..3a56e7c8aa4f6 100644 +--- a/kernel/trace/tracing_map.c ++++ b/kernel/trace/tracing_map.c +@@ -454,7 +454,7 @@ static struct tracing_map_elt *get_free_elt(struct tracing_map *map) + struct tracing_map_elt *elt = NULL; + int idx; + +- idx = atomic_inc_return(&map->next_elt); ++ idx = atomic_fetch_add_unless(&map->next_elt, 1, map->max_elts); + if (idx < map->max_elts) { + elt = *(TRACING_MAP_ELT(map->elts, idx)); + if (map->ops && map->ops->elt_init) +@@ -699,7 +699,7 @@ void tracing_map_clear(struct tracing_map *map) + { + unsigned int i; + +- atomic_set(&map->next_elt, -1); ++ atomic_set(&map->next_elt, 0); + atomic64_set(&map->hits, 0); + atomic64_set(&map->drops, 0); + +@@ -783,7 +783,7 @@ struct tracing_map *tracing_map_create(unsigned int map_bits, + + map->map_bits = map_bits; + map->max_elts = (1 << map_bits); +- atomic_set(&map->next_elt, -1); ++ atomic_set(&map->next_elt, 0); + + map->map_size = (1 << (map_bits + 1)); + map->ops = ops; +diff --git a/mm/huge_memory.c b/mm/huge_memory.c +index 79fbd6ddec49f..7ac2877e76629 100644 +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -601,6 +602,9 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, + loff_t off_align = round_up(off, size); + unsigned long len_pad, ret; + ++ if (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()) ++ return 0; ++ + if (off_end <= off_align || (off_end - off_align) < size) + return 0; + +diff --git a/mm/hugetlb.c b/mm/hugetlb.c +index a480affd475bf..fb7a531fce717 100644 +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -1769,13 +1769,6 @@ static void __update_and_free_hugetlb_folio(struct hstate *h, + return; + } + +- /* +- * Move PageHWPoison flag from head page to the raw error pages, +- * which makes any healthy subpages reusable. +- */ +- if (unlikely(folio_test_hwpoison(folio))) +- folio_clear_hugetlb_hwpoison(folio); +- + /* + * If vmemmap pages were allocated above, then we need to clear the + * hugetlb destructor under the hugetlb lock. +@@ -1786,6 +1779,13 @@ static void __update_and_free_hugetlb_folio(struct hstate *h, + spin_unlock_irq(&hugetlb_lock); + } + ++ /* ++ * Move PageHWPoison flag from head page to the raw error pages, ++ * which makes any healthy subpages reusable. ++ */ ++ if (unlikely(folio_test_hwpoison(folio))) ++ folio_clear_hugetlb_hwpoison(folio); ++ + /* + * Non-gigantic pages demoted from CMA allocated gigantic pages + * need to be given back to CMA in free_gigantic_folio. +diff --git a/mm/memcontrol.c b/mm/memcontrol.c +index dd854cc65fd9d..fd1b707f5de40 100644 +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -5167,11 +5167,28 @@ static struct cftype mem_cgroup_legacy_files[] = { + + #define MEM_CGROUP_ID_MAX ((1UL << MEM_CGROUP_ID_SHIFT) - 1) + static DEFINE_IDR(mem_cgroup_idr); ++static DEFINE_SPINLOCK(memcg_idr_lock); ++ ++static int mem_cgroup_alloc_id(void) ++{ ++ int ret; ++ ++ idr_preload(GFP_KERNEL); ++ spin_lock(&memcg_idr_lock); ++ ret = idr_alloc(&mem_cgroup_idr, NULL, 1, MEM_CGROUP_ID_MAX + 1, ++ GFP_NOWAIT); ++ spin_unlock(&memcg_idr_lock); ++ idr_preload_end(); ++ return ret; ++} + + static void mem_cgroup_id_remove(struct mem_cgroup *memcg) + { + if (memcg->id.id > 0) { ++ spin_lock(&memcg_idr_lock); + idr_remove(&mem_cgroup_idr, memcg->id.id); ++ spin_unlock(&memcg_idr_lock); ++ + memcg->id.id = 0; + } + } +@@ -5294,8 +5311,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) + if (!memcg) + return ERR_PTR(error); + +- memcg->id.id = idr_alloc(&mem_cgroup_idr, NULL, +- 1, MEM_CGROUP_ID_MAX + 1, GFP_KERNEL); ++ memcg->id.id = mem_cgroup_alloc_id(); + if (memcg->id.id < 0) { + error = memcg->id.id; + goto fail; +@@ -5430,7 +5446,9 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css) + * publish it here at the end of onlining. This matches the + * regular ID destruction during offlining. + */ ++ spin_lock(&memcg_idr_lock); + idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); ++ spin_unlock(&memcg_idr_lock); + + return 0; + offline_kmem: +diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c +index 6dab0c99c82c7..38fee34887d8a 100644 +--- a/net/bluetooth/hci_sync.c ++++ b/net/bluetooth/hci_sync.c +@@ -2905,6 +2905,20 @@ static int hci_passive_scan_sync(struct hci_dev *hdev) + } else if (hci_is_adv_monitoring(hdev)) { + window = hdev->le_scan_window_adv_monitor; + interval = hdev->le_scan_int_adv_monitor; ++ ++ /* Disable duplicates filter when scanning for advertisement ++ * monitor for the following reasons. ++ * ++ * For HW pattern filtering (ex. MSFT), Realtek and Qualcomm ++ * controllers ignore RSSI_Sampling_Period when the duplicates ++ * filter is enabled. ++ * ++ * For SW pattern filtering, when we're not doing interleaved ++ * scanning, it is necessary to disable duplicates filter, ++ * otherwise hosts can only receive one advertisement and it's ++ * impossible to know if a peer is still in range. ++ */ ++ filter_dups = LE_SCAN_FILTER_DUP_DISABLE; + } else { + window = hdev->le_scan_window; + interval = hdev->le_scan_interval; +diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c +index 1164c6d927281..2651cc2d5c283 100644 +--- a/net/bluetooth/l2cap_core.c ++++ b/net/bluetooth/l2cap_core.c +@@ -6775,6 +6775,7 @@ static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, + bt_cb(skb)->l2cap.psm = psm; + + if (!chan->ops->recv(chan, skb)) { ++ l2cap_chan_unlock(chan); + l2cap_chan_put(chan); + return; + } +diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c +index 38373b4fb7ddf..c38244d60ff86 100644 +--- a/net/bridge/br_multicast.c ++++ b/net/bridge/br_multicast.c +@@ -2044,16 +2044,14 @@ void br_multicast_del_port(struct net_bridge_port *port) + { + struct net_bridge *br = port->br; + struct net_bridge_port_group *pg; +- HLIST_HEAD(deleted_head); + struct hlist_node *n; + + /* Take care of the remaining groups, only perm ones should be left */ + spin_lock_bh(&br->multicast_lock); + hlist_for_each_entry_safe(pg, n, &port->mglist, mglist) + br_multicast_find_del_pg(br, pg); +- hlist_move_list(&br->mcast_gc_list, &deleted_head); + spin_unlock_bh(&br->multicast_lock); +- br_multicast_gc(&deleted_head); ++ flush_work(&br->mcast_gc_work); + br_multicast_port_ctx_deinit(&port->multicast_ctx); + free_percpu(port->mcast_stats); + } +diff --git a/net/core/link_watch.c b/net/core/link_watch.c +index cb43f5aebfbcc..cf867f6e38bf1 100644 +--- a/net/core/link_watch.c ++++ b/net/core/link_watch.c +@@ -153,9 +153,9 @@ static void linkwatch_schedule_work(int urgent) + * override the existing timer. + */ + if (test_bit(LW_URGENT, &linkwatch_flags)) +- mod_delayed_work(system_wq, &linkwatch_work, 0); ++ mod_delayed_work(system_unbound_wq, &linkwatch_work, 0); + else +- schedule_delayed_work(&linkwatch_work, delay); ++ queue_delayed_work(system_unbound_wq, &linkwatch_work, delay); + } + + +diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c +index 8311c38267b55..69e6012ae82fb 100644 +--- a/net/ipv4/tcp_offload.c ++++ b/net/ipv4/tcp_offload.c +@@ -73,6 +73,9 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, + if (thlen < sizeof(*th)) + goto out; + ++ if (unlikely(skb_checksum_start(skb) != skb_transport_header(skb))) ++ goto out; ++ + if (!pskb_may_pull(skb, thlen)) + goto out; + +diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c +index e5971890d637d..9cb13a50011ef 100644 +--- a/net/ipv4/udp_offload.c ++++ b/net/ipv4/udp_offload.c +@@ -278,6 +278,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, + if (gso_skb->len <= sizeof(*uh) + mss) + return ERR_PTR(-EINVAL); + ++ if (unlikely(skb_checksum_start(gso_skb) != ++ skb_transport_header(gso_skb))) ++ return ERR_PTR(-EINVAL); ++ + if (skb_gso_ok(gso_skb, features | NETIF_F_GSO_ROBUST)) { + /* Packet is from an untrusted source, reset gso_segs. */ + skb_shinfo(gso_skb)->gso_segs = DIV_ROUND_UP(gso_skb->len - sizeof(*uh), +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index f97cb368e5a81..db8d0e1bf69ff 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -1122,6 +1122,7 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk, + from = rt ? rcu_dereference(rt->from) : NULL; + err = ip6_route_get_saddr(net, from, &fl6->daddr, + sk ? inet6_sk(sk)->srcprefs : 0, ++ fl6->flowi6_l3mdev, + &fl6->saddr); + rcu_read_unlock(); + +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index eb3afaee62e8f..49ef5623c55e2 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -5678,7 +5678,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, + goto nla_put_failure; + } else if (dest) { + struct in6_addr saddr_buf; +- if (ip6_route_get_saddr(net, rt, dest, 0, &saddr_buf) == 0 && ++ if (ip6_route_get_saddr(net, rt, dest, 0, 0, &saddr_buf) == 0 && + nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf)) + goto nla_put_failure; + } +diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c +index 8d21ff25f1602..70da78ab95202 100644 +--- a/net/l2tp/l2tp_core.c ++++ b/net/l2tp/l2tp_core.c +@@ -88,6 +88,11 @@ + /* Default trace flags */ + #define L2TP_DEFAULT_DEBUG_FLAGS 0 + ++#define L2TP_DEPTH_NESTING 2 ++#if L2TP_DEPTH_NESTING == SINGLE_DEPTH_NESTING ++#error "L2TP requires its own lockdep subclass" ++#endif ++ + /* Private data stored for received packets in the skb. + */ + struct l2tp_skb_cb { +@@ -1041,7 +1046,13 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, uns + IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED); + nf_reset_ct(skb); + +- bh_lock_sock_nested(sk); ++ /* L2TP uses its own lockdep subclass to avoid lockdep splats caused by ++ * nested socket calls on the same lockdep socket class. This can ++ * happen when data from a user socket is routed over l2tp, which uses ++ * another userspace socket. ++ */ ++ spin_lock_nested(&sk->sk_lock.slock, L2TP_DEPTH_NESTING); ++ + if (sock_owned_by_user(sk)) { + kfree_skb(skb); + ret = NET_XMIT_DROP; +@@ -1093,7 +1104,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, uns + ret = l2tp_xmit_queue(tunnel, skb, &inet->cork.fl); + + out_unlock: +- bh_unlock_sock(sk); ++ spin_unlock(&sk->sk_lock.slock); + + return ret; + } +diff --git a/net/mptcp/options.c b/net/mptcp/options.c +index 85aafa94cc8ab..604724cca887f 100644 +--- a/net/mptcp/options.c ++++ b/net/mptcp/options.c +@@ -958,7 +958,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, + + if (subflow->remote_key_valid && + (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) || +- ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && !mp_opt->echo))) { ++ ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && ++ (!mp_opt->echo || subflow->mp_join)))) { + /* subflows are fully established as soon as we get any + * additional ack, including ADD_ADDR. + */ +diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c +index d8da5374d9e13..cf70a376398be 100644 +--- a/net/mptcp/pm.c ++++ b/net/mptcp/pm.c +@@ -427,6 +427,18 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) + return mptcp_pm_nl_get_local_id(msk, &skc_local); + } + ++bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) ++{ ++ struct mptcp_addr_info skc_local; ++ ++ mptcp_local_address((struct sock_common *)skc, &skc_local); ++ ++ if (mptcp_pm_is_userspace(msk)) ++ return mptcp_userspace_pm_is_backup(msk, &skc_local); ++ ++ return mptcp_pm_nl_is_backup(msk, &skc_local); ++} ++ + int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, + u8 *flags, int *ifindex) + { +diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c +index db621933b2035..2c49182c674f3 100644 +--- a/net/mptcp/pm_netlink.c ++++ b/net/mptcp/pm_netlink.c +@@ -353,7 +353,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, + add_entry = mptcp_lookup_anno_list_by_saddr(msk, addr); + + if (add_entry) { +- if (mptcp_pm_is_kernel(msk)) ++ if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk))) + return false; + + sk_reset_timer(sk, &add_entry->add_timer, +@@ -520,8 +520,8 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info, + + static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) + { ++ struct mptcp_pm_addr_entry *local, *signal_and_subflow = NULL; + struct sock *sk = (struct sock *)msk; +- struct mptcp_pm_addr_entry *local; + unsigned int add_addr_signal_max; + unsigned int local_addr_max; + struct pm_nl_pernet *pernet; +@@ -563,8 +563,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) + + /* check first for announce */ + if (msk->pm.add_addr_signaled < add_addr_signal_max) { +- local = select_signal_address(pernet, msk); +- + /* due to racing events on both ends we can reach here while + * previous add address is still running: if we invoke now + * mptcp_pm_announce_addr(), that will fail and the +@@ -575,16 +573,26 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) + if (msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL)) + return; + +- if (local) { +- if (mptcp_pm_alloc_anno_list(msk, &local->addr)) { +- __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); +- msk->pm.add_addr_signaled++; +- mptcp_pm_announce_addr(msk, &local->addr, false); +- mptcp_pm_nl_addr_send_ack(msk); +- } +- } ++ local = select_signal_address(pernet, msk); ++ if (!local) ++ goto subflow; ++ ++ /* If the alloc fails, we are on memory pressure, not worth ++ * continuing, and trying to create subflows. ++ */ ++ if (!mptcp_pm_alloc_anno_list(msk, &local->addr)) ++ return; ++ ++ __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); ++ msk->pm.add_addr_signaled++; ++ mptcp_pm_announce_addr(msk, &local->addr, false); ++ mptcp_pm_nl_addr_send_ack(msk); ++ ++ if (local->flags & MPTCP_PM_ADDR_FLAG_SUBFLOW) ++ signal_and_subflow = local; + } + ++subflow: + /* check if should create a new subflow */ + while (msk->pm.local_addr_used < local_addr_max && + msk->pm.subflows < subflows_max) { +@@ -592,9 +600,14 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) + bool fullmesh; + int i, nr; + +- local = select_local_address(pernet, msk); +- if (!local) +- break; ++ if (signal_and_subflow) { ++ local = signal_and_subflow; ++ signal_and_subflow = NULL; ++ } else { ++ local = select_local_address(pernet, msk); ++ if (!local) ++ break; ++ } + + fullmesh = !!(local->flags & MPTCP_PM_ADDR_FLAG_FULLMESH); + +@@ -1109,6 +1122,24 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc + return ret; + } + ++bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) ++{ ++ struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); ++ struct mptcp_pm_addr_entry *entry; ++ bool backup = false; ++ ++ rcu_read_lock(); ++ list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { ++ if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port)) { ++ backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); ++ break; ++ } ++ } ++ rcu_read_unlock(); ++ ++ return backup; ++} ++ + #define MPTCP_PM_CMD_GRP_OFFSET 0 + #define MPTCP_PM_EV_GRP_OFFSET 1 + +@@ -1341,8 +1372,8 @@ static int mptcp_nl_cmd_add_addr(struct sk_buff *skb, struct genl_info *info) + if (ret < 0) + return ret; + +- if (addr.addr.port && !(addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { +- GENL_SET_ERR_MSG(info, "flags must have signal when using port"); ++ if (addr.addr.port && !address_use_port(&addr)) { ++ GENL_SET_ERR_MSG(info, "flags must have signal and not subflow when using port"); + return -EINVAL; + } + +diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c +index f36f87a62dd0d..6738bad048cec 100644 +--- a/net/mptcp/pm_userspace.c ++++ b/net/mptcp/pm_userspace.c +@@ -157,6 +157,24 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, + return mptcp_userspace_pm_append_new_local_addr(msk, &new_entry, true); + } + ++bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, ++ struct mptcp_addr_info *skc) ++{ ++ struct mptcp_pm_addr_entry *entry; ++ bool backup = false; ++ ++ spin_lock_bh(&msk->pm.lock); ++ list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { ++ if (mptcp_addresses_equal(&entry->addr, skc, false)) { ++ backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); ++ break; ++ } ++ } ++ spin_unlock_bh(&msk->pm.lock); ++ ++ return backup; ++} ++ + int mptcp_nl_cmd_announce(struct sk_buff *skb, struct genl_info *info) + { + struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; +diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h +index c28ac5dfd0b58..0201b1004a3b9 100644 +--- a/net/mptcp/protocol.h ++++ b/net/mptcp/protocol.h +@@ -1032,6 +1032,9 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, + int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); + int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); + int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); ++bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc); ++bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc); ++bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc); + + static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow) + { +diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c +index bc1efc1787720..927c2d5997dc7 100644 +--- a/net/mptcp/subflow.c ++++ b/net/mptcp/subflow.c +@@ -100,6 +100,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) + return NULL; + } + subflow_req->local_id = local_id; ++ subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); + + return msk; + } +@@ -601,6 +602,8 @@ static int subflow_chk_local_id(struct sock *sk) + return err; + + subflow_set_local_id(subflow, err); ++ subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); ++ + return 0; + } + +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index dd044a47c8723..ea139fca74cb9 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -3743,6 +3743,15 @@ static void nf_tables_rule_release(const struct nft_ctx *ctx, struct nft_rule *r + nf_tables_rule_destroy(ctx, rule); + } + ++/** nft_chain_validate - loop detection and hook validation ++ * ++ * @ctx: context containing call depth and base chain ++ * @chain: chain to validate ++ * ++ * Walk through the rules of the given chain and chase all jumps/gotos ++ * and set lookups until either the jump limit is hit or all reachable ++ * chains have been validated. ++ */ + int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain) + { + struct nft_expr *expr, *last; +@@ -3764,6 +3773,9 @@ int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain) + if (!expr->ops->validate) + continue; + ++ /* This may call nft_chain_validate() recursively, ++ * callers that do so must increment ctx->level. ++ */ + err = expr->ops->validate(ctx, expr, &data); + if (err < 0) + return err; +@@ -10621,146 +10633,6 @@ int nft_chain_validate_hooks(const struct nft_chain *chain, + } + EXPORT_SYMBOL_GPL(nft_chain_validate_hooks); + +-/* +- * Loop detection - walk through the ruleset beginning at the destination chain +- * of a new jump until either the source chain is reached (loop) or all +- * reachable chains have been traversed. +- * +- * The loop check is performed whenever a new jump verdict is added to an +- * expression or verdict map or a verdict map is bound to a new chain. +- */ +- +-static int nf_tables_check_loops(const struct nft_ctx *ctx, +- const struct nft_chain *chain); +- +-static int nft_check_loops(const struct nft_ctx *ctx, +- const struct nft_set_ext *ext) +-{ +- const struct nft_data *data; +- int ret; +- +- data = nft_set_ext_data(ext); +- switch (data->verdict.code) { +- case NFT_JUMP: +- case NFT_GOTO: +- ret = nf_tables_check_loops(ctx, data->verdict.chain); +- break; +- default: +- ret = 0; +- break; +- } +- +- return ret; +-} +- +-static int nf_tables_loop_check_setelem(const struct nft_ctx *ctx, +- struct nft_set *set, +- const struct nft_set_iter *iter, +- struct nft_set_elem *elem) +-{ +- const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv); +- +- if (nft_set_ext_exists(ext, NFT_SET_EXT_FLAGS) && +- *nft_set_ext_flags(ext) & NFT_SET_ELEM_INTERVAL_END) +- return 0; +- +- return nft_check_loops(ctx, ext); +-} +- +-static int nft_set_catchall_loops(const struct nft_ctx *ctx, +- struct nft_set *set) +-{ +- u8 genmask = nft_genmask_next(ctx->net); +- struct nft_set_elem_catchall *catchall; +- struct nft_set_ext *ext; +- int ret = 0; +- +- list_for_each_entry_rcu(catchall, &set->catchall_list, list) { +- ext = nft_set_elem_ext(set, catchall->elem); +- if (!nft_set_elem_active(ext, genmask)) +- continue; +- +- ret = nft_check_loops(ctx, ext); +- if (ret < 0) +- return ret; +- } +- +- return ret; +-} +- +-static int nf_tables_check_loops(const struct nft_ctx *ctx, +- const struct nft_chain *chain) +-{ +- const struct nft_rule *rule; +- const struct nft_expr *expr, *last; +- struct nft_set *set; +- struct nft_set_binding *binding; +- struct nft_set_iter iter; +- +- if (ctx->chain == chain) +- return -ELOOP; +- +- if (fatal_signal_pending(current)) +- return -EINTR; +- +- list_for_each_entry(rule, &chain->rules, list) { +- nft_rule_for_each_expr(expr, last, rule) { +- struct nft_immediate_expr *priv; +- const struct nft_data *data; +- int err; +- +- if (strcmp(expr->ops->type->name, "immediate")) +- continue; +- +- priv = nft_expr_priv(expr); +- if (priv->dreg != NFT_REG_VERDICT) +- continue; +- +- data = &priv->data; +- switch (data->verdict.code) { +- case NFT_JUMP: +- case NFT_GOTO: +- err = nf_tables_check_loops(ctx, +- data->verdict.chain); +- if (err < 0) +- return err; +- break; +- default: +- break; +- } +- } +- } +- +- list_for_each_entry(set, &ctx->table->sets, list) { +- if (!nft_is_active_next(ctx->net, set)) +- continue; +- if (!(set->flags & NFT_SET_MAP) || +- set->dtype != NFT_DATA_VERDICT) +- continue; +- +- list_for_each_entry(binding, &set->bindings, list) { +- if (!(binding->flags & NFT_SET_MAP) || +- binding->chain != chain) +- continue; +- +- iter.genmask = nft_genmask_next(ctx->net); +- iter.skip = 0; +- iter.count = 0; +- iter.err = 0; +- iter.fn = nf_tables_loop_check_setelem; +- +- set->ops->walk(ctx, set, &iter); +- if (!iter.err) +- iter.err = nft_set_catchall_loops(ctx, set); +- +- if (iter.err < 0) +- return iter.err; +- } +- } +- +- return 0; +-} +- + /** + * nft_parse_u32_check - fetch u32 attribute and check for maximum value + * +@@ -10873,7 +10745,7 @@ static int nft_validate_register_store(const struct nft_ctx *ctx, + if (data != NULL && + (data->verdict.code == NFT_GOTO || + data->verdict.code == NFT_JUMP)) { +- err = nf_tables_check_loops(ctx, data->verdict.chain); ++ err = nft_chain_validate(ctx, data->verdict.chain); + if (err < 0) + return err; + } +diff --git a/net/sctp/input.c b/net/sctp/input.c +index 17fcaa9b0df94..a8a254a5008e5 100644 +--- a/net/sctp/input.c ++++ b/net/sctp/input.c +@@ -735,15 +735,19 @@ static int __sctp_hash_endpoint(struct sctp_endpoint *ep) + struct sock *sk = ep->base.sk; + struct net *net = sock_net(sk); + struct sctp_hashbucket *head; ++ int err = 0; + + ep->hashent = sctp_ep_hashfn(net, ep->base.bind_addr.port); + head = &sctp_ep_hashtable[ep->hashent]; + ++ write_lock(&head->lock); + if (sk->sk_reuseport) { + bool any = sctp_is_ep_boundall(sk); + struct sctp_endpoint *ep2; + struct list_head *list; +- int cnt = 0, err = 1; ++ int cnt = 0; ++ ++ err = 1; + + list_for_each(list, &ep->base.bind_addr.address_list) + cnt++; +@@ -761,24 +765,24 @@ static int __sctp_hash_endpoint(struct sctp_endpoint *ep) + if (!err) { + err = reuseport_add_sock(sk, sk2, any); + if (err) +- return err; ++ goto out; + break; + } else if (err < 0) { +- return err; ++ goto out; + } + } + + if (err) { + err = reuseport_alloc(sk, any); + if (err) +- return err; ++ goto out; + } + } + +- write_lock(&head->lock); + hlist_add_head(&ep->node, &head->chain); ++out: + write_unlock(&head->lock); +- return 0; ++ return err; + } + + /* Add an endpoint to the hash. Local BH-safe. */ +@@ -803,10 +807,9 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) + + head = &sctp_ep_hashtable[ep->hashent]; + ++ write_lock(&head->lock); + if (rcu_access_pointer(sk->sk_reuseport_cb)) + reuseport_detach_sock(sk); +- +- write_lock(&head->lock); + hlist_del_init(&ep->node); + write_unlock(&head->lock); + } +diff --git a/net/smc/smc_stats.h b/net/smc/smc_stats.h +index 9d32058db2b5d..e19177ce40923 100644 +--- a/net/smc/smc_stats.h ++++ b/net/smc/smc_stats.h +@@ -19,7 +19,7 @@ + + #include "smc_clc.h" + +-#define SMC_MAX_FBACK_RSN_CNT 30 ++#define SMC_MAX_FBACK_RSN_CNT 36 + + enum { + SMC_BUF_8K, +diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c +index 6debf4fd42d4e..cef623ea15060 100644 +--- a/net/sunrpc/sched.c ++++ b/net/sunrpc/sched.c +@@ -369,8 +369,10 @@ static void rpc_make_runnable(struct workqueue_struct *wq, + if (RPC_IS_ASYNC(task)) { + INIT_WORK(&task->u.tk_work, rpc_async_schedule); + queue_work(wq, &task->u.tk_work); +- } else ++ } else { ++ smp_mb__after_atomic(); + wake_up_bit(&task->tk_runstate, RPC_TASK_QUEUED); ++ } + } + + /* +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index a551be47cb6c6..b7f62442d8268 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -1483,6 +1483,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, + struct unix_sock *u = unix_sk(sk), *newu, *otheru; + struct net *net = sock_net(sk); + struct sk_buff *skb = NULL; ++ unsigned char state; + long timeo; + int err; + +@@ -1529,7 +1530,6 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, + goto out; + } + +- /* Latch state of peer */ + unix_state_lock(other); + + /* Apparently VFS overslept socket death. Retry. */ +@@ -1559,37 +1559,21 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, + goto restart; + } + +- /* Latch our state. +- +- It is tricky place. We need to grab our state lock and cannot +- drop lock on peer. It is dangerous because deadlock is +- possible. Connect to self case and simultaneous +- attempt to connect are eliminated by checking socket +- state. other is TCP_LISTEN, if sk is TCP_LISTEN we +- check this before attempt to grab lock. +- +- Well, and we have to recheck the state after socket locked. ++ /* self connect and simultaneous connect are eliminated ++ * by rejecting TCP_LISTEN socket to avoid deadlock. + */ +- switch (READ_ONCE(sk->sk_state)) { +- case TCP_CLOSE: +- /* This is ok... continue with connect */ +- break; +- case TCP_ESTABLISHED: +- /* Socket is already connected */ +- err = -EISCONN; +- goto out_unlock; +- default: +- err = -EINVAL; ++ state = READ_ONCE(sk->sk_state); ++ if (unlikely(state != TCP_CLOSE)) { ++ err = state == TCP_ESTABLISHED ? -EISCONN : -EINVAL; + goto out_unlock; + } + + unix_state_lock_nested(sk, U_LOCK_SECOND); + +- if (sk->sk_state != TCP_CLOSE) { ++ if (unlikely(sk->sk_state != TCP_CLOSE)) { ++ err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EINVAL; + unix_state_unlock(sk); +- unix_state_unlock(other); +- sock_put(other); +- goto restart; ++ goto out_unlock; + } + + err = security_unix_stream_connect(sk, other, newsk); +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 8f8f077e6cd40..be5c42d6ffbea 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -3398,6 +3398,33 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, + if (chandef.chan != cur_chan) + return -EBUSY; + ++ /* only allow this for regular channel widths */ ++ switch (wdev->links[link_id].ap.chandef.width) { ++ case NL80211_CHAN_WIDTH_20_NOHT: ++ case NL80211_CHAN_WIDTH_20: ++ case NL80211_CHAN_WIDTH_40: ++ case NL80211_CHAN_WIDTH_80: ++ case NL80211_CHAN_WIDTH_80P80: ++ case NL80211_CHAN_WIDTH_160: ++ case NL80211_CHAN_WIDTH_320: ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (chandef.width) { ++ case NL80211_CHAN_WIDTH_20_NOHT: ++ case NL80211_CHAN_WIDTH_20: ++ case NL80211_CHAN_WIDTH_40: ++ case NL80211_CHAN_WIDTH_80: ++ case NL80211_CHAN_WIDTH_80P80: ++ case NL80211_CHAN_WIDTH_160: ++ case NL80211_CHAN_WIDTH_320: ++ break; ++ default: ++ return -EINVAL; ++ } ++ + result = rdev_set_ap_chanwidth(rdev, dev, link_id, + &chandef); + if (result) +@@ -4446,10 +4473,7 @@ static void get_key_callback(void *c, struct key_params *params) + struct nlattr *key; + struct get_key_cookie *cookie = c; + +- if ((params->key && +- nla_put(cookie->msg, NL80211_ATTR_KEY_DATA, +- params->key_len, params->key)) || +- (params->seq && ++ if ((params->seq && + nla_put(cookie->msg, NL80211_ATTR_KEY_SEQ, + params->seq_len, params->seq)) || + (params->cipher && +@@ -4461,10 +4485,7 @@ static void get_key_callback(void *c, struct key_params *params) + if (!key) + goto nla_put_failure; + +- if ((params->key && +- nla_put(cookie->msg, NL80211_KEY_DATA, +- params->key_len, params->key)) || +- (params->seq && ++ if ((params->seq && + nla_put(cookie->msg, NL80211_KEY_SEQ, + params->seq_len, params->seq)) || + (params->cipher && +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c +index 038db8902c9ed..82c0d3a3327ab 100644 +--- a/sound/pci/hda/patch_hdmi.c ++++ b/sound/pci/hda/patch_hdmi.c +@@ -1989,6 +1989,8 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) + } + + static const struct snd_pci_quirk force_connect_list[] = { ++ SND_PCI_QUIRK(0x103c, 0x83e2, "HP EliteDesk 800 G4", 1), ++ SND_PCI_QUIRK(0x103c, 0x83ef, "HP MP9 G4 Retail System AMS", 1), + SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), + SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), + SND_PCI_QUIRK(0x103c, 0x8711, "HP", 1), +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 0b33a00771450..82dcea2b78000 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -10360,6 +10360,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE), + + #if 0 + /* Below is a quirk table taken from the old code. +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index 36dddf230c2c4..d597e59863ee3 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -409,6 +409,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_BOARD_NAME, "8A43"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "HP"), ++ DMI_MATCH(DMI_BOARD_NAME, "8A44"), ++ } ++ }, + { + .driver_data = &acp6x_card, + .matches = { +diff --git a/sound/soc/codecs/wcd938x-sdw.c b/sound/soc/codecs/wcd938x-sdw.c +index a1f04010da95f..132c1d24f8f6e 100644 +--- a/sound/soc/codecs/wcd938x-sdw.c ++++ b/sound/soc/codecs/wcd938x-sdw.c +@@ -1252,12 +1252,12 @@ static int wcd9380_probe(struct sdw_slave *pdev, + pdev->prop.lane_control_support = true; + pdev->prop.simple_clk_stop_capable = true; + if (wcd->is_tx) { +- pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); ++ pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS - 1, 0); + pdev->prop.src_dpn_prop = wcd938x_dpn_prop; + wcd->ch_info = &wcd938x_sdw_tx_ch_info[0]; + pdev->prop.wake_capable = true; + } else { +- pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); ++ pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS - 1, 0); + pdev->prop.sink_dpn_prop = wcd938x_dpn_prop; + wcd->ch_info = &wcd938x_sdw_rx_ch_info[0]; + } +diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c +index 1253695bebd86..53b828f681020 100644 +--- a/sound/soc/codecs/wsa881x.c ++++ b/sound/soc/codecs/wsa881x.c +@@ -1152,7 +1152,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, + wsa881x->sconfig.frame_rate = 48000; + wsa881x->sconfig.direction = SDW_DATA_DIR_RX; + wsa881x->sconfig.type = SDW_STREAM_PDM; +- pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0); ++ pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS - 1, 0); + pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; + pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; + pdev->prop.clk_stop_mode1 = true; +diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c +index a2e86ef7d18f5..2169d93989841 100644 +--- a/sound/soc/codecs/wsa883x.c ++++ b/sound/soc/codecs/wsa883x.c +@@ -1399,7 +1399,15 @@ static int wsa883x_probe(struct sdw_slave *pdev, + wsa883x->sconfig.direction = SDW_DATA_DIR_RX; + wsa883x->sconfig.type = SDW_STREAM_PDM; + +- pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS, 0); ++ /** ++ * Port map index starts with 0, however the data port for this codec ++ * are from index 1 ++ */ ++ if (of_property_read_u32_array(dev->of_node, "qcom,port-mapping", &pdev->m_port_map[1], ++ WSA883X_MAX_SWR_PORTS)) ++ dev_dbg(dev, "Static Port mapping not specified\n"); ++ ++ pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS - 1, 0); + pdev->prop.simple_clk_stop_capable = true; + pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; + pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; +diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c +index 993d76b18b536..1cd52fab7b40d 100644 +--- a/sound/soc/codecs/wsa884x.c ++++ b/sound/soc/codecs/wsa884x.c +@@ -1858,7 +1858,15 @@ static int wsa884x_probe(struct sdw_slave *pdev, + wsa884x->sconfig.direction = SDW_DATA_DIR_RX; + wsa884x->sconfig.type = SDW_STREAM_PDM; + +- pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS, 0); ++ /** ++ * Port map index starts with 0, however the data port for this codec ++ * are from index 1 ++ */ ++ if (of_property_read_u32_array(dev->of_node, "qcom,port-mapping", &pdev->m_port_map[1], ++ WSA884X_MAX_SWR_PORTS)) ++ dev_dbg(dev, "Static Port mapping not specified\n"); ++ ++ pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS - 1, 0); + pdev->prop.simple_clk_stop_capable = true; + pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop; + pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; +diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c +index 94b169a5493b5..5218e40aeb1bb 100644 +--- a/sound/soc/meson/axg-fifo.c ++++ b/sound/soc/meson/axg-fifo.c +@@ -207,25 +207,18 @@ static irqreturn_t axg_fifo_pcm_irq_block(int irq, void *dev_id) + status = FIELD_GET(STATUS1_INT_STS, status); + axg_fifo_ack_irq(fifo, status); + +- /* Use the thread to call period elapsed on nonatomic links */ +- if (status & FIFO_INT_COUNT_REPEAT) +- return IRQ_WAKE_THREAD; ++ if (status & ~FIFO_INT_COUNT_REPEAT) ++ dev_dbg(axg_fifo_dev(ss), "unexpected irq - STS 0x%02x\n", ++ status); + +- dev_dbg(axg_fifo_dev(ss), "unexpected irq - STS 0x%02x\n", +- status); ++ if (status & FIFO_INT_COUNT_REPEAT) { ++ snd_pcm_period_elapsed(ss); ++ return IRQ_HANDLED; ++ } + + return IRQ_NONE; + } + +-static irqreturn_t axg_fifo_pcm_irq_block_thread(int irq, void *dev_id) +-{ +- struct snd_pcm_substream *ss = dev_id; +- +- snd_pcm_period_elapsed(ss); +- +- return IRQ_HANDLED; +-} +- + int axg_fifo_pcm_open(struct snd_soc_component *component, + struct snd_pcm_substream *ss) + { +@@ -251,8 +244,9 @@ int axg_fifo_pcm_open(struct snd_soc_component *component, + if (ret) + return ret; + +- ret = request_threaded_irq(fifo->irq, axg_fifo_pcm_irq_block, +- axg_fifo_pcm_irq_block_thread, ++ /* Use the threaded irq handler only with non-atomic links */ ++ ret = request_threaded_irq(fifo->irq, NULL, ++ axg_fifo_pcm_irq_block, + IRQF_ONESHOT, dev_name(dev), ss); + if (ret) + return ret; +diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c +index 7d6a568556ea4..b5b4ea854da4b 100644 +--- a/sound/soc/sof/mediatek/mt8195/mt8195.c ++++ b/sound/soc/sof/mediatek/mt8195/mt8195.c +@@ -624,7 +624,7 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = { + static struct snd_sof_of_mach sof_mt8195_machs[] = { + { + .compatible = "google,tomato", +- .sof_tplg_filename = "sof-mt8195-mt6359-rt1019-rt5682-dts.tplg" ++ .sof_tplg_filename = "sof-mt8195-mt6359-rt1019-rt5682.tplg" + }, { + .compatible = "mediatek,mt8195", + .sof_tplg_filename = "sof-mt8195.tplg" +diff --git a/sound/soc/sti/sti_uniperif.c b/sound/soc/sti/sti_uniperif.c +index 2c21a86421e66..cc9a8122b9bc2 100644 +--- a/sound/soc/sti/sti_uniperif.c ++++ b/sound/soc/sti/sti_uniperif.c +@@ -352,7 +352,7 @@ static int sti_uniperiph_resume(struct snd_soc_component *component) + return ret; + } + +-static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai) ++int sti_uniperiph_dai_probe(struct snd_soc_dai *dai) + { + struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai); + struct sti_uniperiph_dai *dai_data = &priv->dai_data; +diff --git a/sound/soc/sti/uniperif.h b/sound/soc/sti/uniperif.h +index 2a5de328501c1..74e51f0ff85c8 100644 +--- a/sound/soc/sti/uniperif.h ++++ b/sound/soc/sti/uniperif.h +@@ -1380,6 +1380,7 @@ int uni_reader_init(struct platform_device *pdev, + struct uniperif *reader); + + /* common */ ++int sti_uniperiph_dai_probe(struct snd_soc_dai *dai); + int sti_uniperiph_dai_set_fmt(struct snd_soc_dai *dai, + unsigned int fmt); + +diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c +index dd9013c476649..6d1ce030963c6 100644 +--- a/sound/soc/sti/uniperif_player.c ++++ b/sound/soc/sti/uniperif_player.c +@@ -1038,6 +1038,7 @@ static const struct snd_soc_dai_ops uni_player_dai_ops = { + .startup = uni_player_startup, + .shutdown = uni_player_shutdown, + .prepare = uni_player_prepare, ++ .probe = sti_uniperiph_dai_probe, + .trigger = uni_player_trigger, + .hw_params = sti_uniperiph_dai_hw_params, + .set_fmt = sti_uniperiph_dai_set_fmt, +diff --git a/sound/soc/sti/uniperif_reader.c b/sound/soc/sti/uniperif_reader.c +index 065c5f0d1f5f0..05ea2b794eb92 100644 +--- a/sound/soc/sti/uniperif_reader.c ++++ b/sound/soc/sti/uniperif_reader.c +@@ -401,6 +401,7 @@ static const struct snd_soc_dai_ops uni_reader_dai_ops = { + .startup = uni_reader_startup, + .shutdown = uni_reader_shutdown, + .prepare = uni_reader_prepare, ++ .probe = sti_uniperiph_dai_probe, + .trigger = uni_reader_trigger, + .hw_params = sti_uniperiph_dai_hw_params, + .set_fmt = sti_uniperiph_dai_set_fmt, +diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c +index f4437015d43a7..9df49a880b750 100644 +--- a/sound/usb/line6/driver.c ++++ b/sound/usb/line6/driver.c +@@ -286,12 +286,14 @@ static void line6_data_received(struct urb *urb) + { + struct usb_line6 *line6 = (struct usb_line6 *)urb->context; + struct midi_buffer *mb = &line6->line6midi->midibuf_in; ++ unsigned long flags; + int done; + + if (urb->status == -ESHUTDOWN) + return; + + if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) { ++ spin_lock_irqsave(&line6->line6midi->lock, flags); + done = + line6_midibuf_write(mb, urb->transfer_buffer, urb->actual_length); + +@@ -300,12 +302,15 @@ static void line6_data_received(struct urb *urb) + dev_dbg(line6->ifcdev, "%d %d buffer overflow - message skipped\n", + done, urb->actual_length); + } ++ spin_unlock_irqrestore(&line6->line6midi->lock, flags); + + for (;;) { ++ spin_lock_irqsave(&line6->line6midi->lock, flags); + done = + line6_midibuf_read(mb, line6->buffer_message, + LINE6_MIDI_MESSAGE_MAXLEN, + LINE6_MIDIBUF_READ_RX); ++ spin_unlock_irqrestore(&line6->line6midi->lock, flags); + + if (done <= 0) + break; +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 5d72dc8441cbb..af1b8cf5a9883 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -2594,6 +2594,10 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + }, + ++/* Stanton ScratchAmp */ ++{ USB_DEVICE(0x103d, 0x0100) }, ++{ USB_DEVICE(0x103d, 0x0101) }, ++ + /* Novation EMS devices */ + { + USB_DEVICE_VENDOR_SPEC(0x1235, 0x0001), +diff --git a/tools/arch/arm64/include/asm/cputype.h b/tools/arch/arm64/include/asm/cputype.h +index 5f6f84837a490..329d41f8c9237 100644 +--- a/tools/arch/arm64/include/asm/cputype.h ++++ b/tools/arch/arm64/include/asm/cputype.h +@@ -84,6 +84,9 @@ + #define ARM_CPU_PART_CORTEX_X2 0xD48 + #define ARM_CPU_PART_NEOVERSE_N2 0xD49 + #define ARM_CPU_PART_CORTEX_A78C 0xD4B ++#define ARM_CPU_PART_NEOVERSE_V2 0xD4F ++#define ARM_CPU_PART_CORTEX_X4 0xD82 ++#define ARM_CPU_PART_NEOVERSE_V3 0xD84 + + #define APM_CPU_PART_POTENZA 0x000 + +@@ -153,6 +156,9 @@ + #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) + #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) + #define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C) ++#define MIDR_NEOVERSE_V2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V2) ++#define MIDR_CORTEX_X4 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X4) ++#define MIDR_NEOVERSE_V3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V3) + #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) + #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) + #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX) +diff --git a/tools/testing/selftests/bpf/prog_tests/send_signal.c b/tools/testing/selftests/bpf/prog_tests/send_signal.c +index b15b343ebb6b1..9adcda7f1fedc 100644 +--- a/tools/testing/selftests/bpf/prog_tests/send_signal.c ++++ b/tools/testing/selftests/bpf/prog_tests/send_signal.c +@@ -156,7 +156,8 @@ static void test_send_signal_tracepoint(bool signal_thread) + static void test_send_signal_perf(bool signal_thread) + { + struct perf_event_attr attr = { +- .sample_period = 1, ++ .freq = 1, ++ .sample_freq = 1000, + .type = PERF_TYPE_SOFTWARE, + .config = PERF_COUNT_SW_CPU_CLOCK, + }; +diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile +index 292359a542429..8b2b9bb8bad10 100644 +--- a/tools/testing/selftests/mm/Makefile ++++ b/tools/testing/selftests/mm/Makefile +@@ -101,7 +101,7 @@ endif + + endif + +-ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64)) ++ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390)) + TEST_GEN_FILES += va_high_addr_switch + TEST_GEN_FILES += virtual_address_range + TEST_GEN_FILES += write_to_hugetlbfs +diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh +index a2dae2a3a93e0..b16b8278c4cea 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -812,7 +812,7 @@ pm_nl_check_endpoint() + done + + if [ -z "$id" ]; then +- test_fail "bad test - missing endpoint id" ++ fail_test "bad test - missing endpoint id" + return + fi + +@@ -1559,18 +1559,28 @@ chk_add_nr() + local add_nr=$1 + local echo_nr=$2 + local port_nr=${3:-0} +- local syn_nr=${4:-$port_nr} +- local syn_ack_nr=${5:-$port_nr} +- local ack_nr=${6:-$port_nr} +- local mis_syn_nr=${7:-0} +- local mis_ack_nr=${8:-0} ++ local ns_invert=${4:-""} ++ local syn_nr=$port_nr ++ local syn_ack_nr=$port_nr ++ local ack_nr=$port_nr ++ local mis_syn_nr=0 ++ local mis_ack_nr=0 ++ local ns_tx=$ns1 ++ local ns_rx=$ns2 ++ local extra_msg="" + local count + local timeout + +- timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) ++ if [[ $ns_invert = "invert" ]]; then ++ ns_tx=$ns2 ++ ns_rx=$ns1 ++ extra_msg="invert" ++ fi ++ ++ timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout) + + print_check "add" +- count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtAddAddr") ++ count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr") + if [ -z "$count" ]; then + print_skip + # if the test configured a short timeout tolerate greater then expected +@@ -1582,7 +1592,7 @@ chk_add_nr() + fi + + print_check "echo" +- count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtEchoAdd") ++ count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$echo_nr" ]; then +@@ -1593,7 +1603,7 @@ chk_add_nr() + + if [ $port_nr -gt 0 ]; then + print_check "pt" +- count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtPortAdd") ++ count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$port_nr" ]; then +@@ -1603,7 +1613,7 @@ chk_add_nr() + fi + + print_check "syn" +- count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortSynRx") ++ count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$syn_nr" ]; then +@@ -1614,7 +1624,7 @@ chk_add_nr() + fi + + print_check "synack" +- count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinPortSynAckRx") ++ count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$syn_ack_nr" ]; then +@@ -1625,7 +1635,7 @@ chk_add_nr() + fi + + print_check "ack" +- count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortAckRx") ++ count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$ack_nr" ]; then +@@ -1636,7 +1646,7 @@ chk_add_nr() + fi + + print_check "syn" +- count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortSynRx") ++ count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$mis_syn_nr" ]; then +@@ -1647,7 +1657,7 @@ chk_add_nr() + fi + + print_check "ack" +- count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortAckRx") ++ count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx") + if [ -z "$count" ]; then + print_skip + elif [ "$count" != "$mis_ack_nr" ]; then +@@ -1657,6 +1667,8 @@ chk_add_nr() + print_ok + fi + fi ++ ++ print_info "$extra_msg" + } + + chk_add_tx_nr() +@@ -2121,6 +2133,21 @@ signal_address_tests() + chk_add_nr 1 1 + fi + ++ # uncommon: subflow and signal flags on the same endpoint ++ # or because the user wrongly picked both, but still expects the client ++ # to create additional subflows ++ if reset "subflow and signal together"; then ++ pm_nl_set_limits $ns1 0 2 ++ pm_nl_set_limits $ns2 0 2 ++ pm_nl_add_endpoint $ns2 10.0.3.2 flags signal,subflow ++ run_tests $ns1 $ns2 10.0.1.1 ++ chk_join_nr 1 1 1 ++ chk_add_nr 1 1 0 invert # only initiated by ns2 ++ chk_add_nr 0 0 0 # none initiated by ns1 ++ chk_rst_nr 0 0 invert # no RST sent by the client ++ chk_rst_nr 0 0 # no RST sent by the server ++ fi ++ + # accept and use add_addr with additional subflows + if reset "multiple subflows and signal"; then + pm_nl_set_limits $ns1 0 3 +diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh +index be97a7ed09503..f24bd2bf08311 100755 +--- a/tools/testing/selftests/net/mptcp/simult_flows.sh ++++ b/tools/testing/selftests/net/mptcp/simult_flows.sh +@@ -262,7 +262,7 @@ run_test() + do_transfer $small $large $time + lret=$? + mptcp_lib_result_code "${lret}" "${msg}" +- if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then ++ if [ $lret -ne 0 ]; then + ret=$lret + [ $bail -eq 0 ] || exit $ret + fi +@@ -272,7 +272,7 @@ run_test() + do_transfer $large $small $time + lret=$? + mptcp_lib_result_code "${lret}" "${msg}" +- if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then ++ if [ $lret -ne 0 ]; then + ret=$lret + [ $bail -eq 0 ] || exit $ret + fi +@@ -305,7 +305,7 @@ run_test 10 10 0 0 "balanced bwidth" + run_test 10 10 1 25 "balanced bwidth with unbalanced delay" + + # we still need some additional infrastructure to pass the following test-cases +-MPTCP_LIB_SUBTEST_FLAKY=1 run_test 10 3 0 0 "unbalanced bwidth" ++run_test 10 3 0 0 "unbalanced bwidth" + run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay" + run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay" + +diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh +index 12b50a4a881ac..89a82f6f140ef 100755 +--- a/tools/testing/selftests/rcutorture/bin/torture.sh ++++ b/tools/testing/selftests/rcutorture/bin/torture.sh +@@ -567,7 +567,7 @@ then + torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 tsc=watchdog" + torture_set "clocksourcewd-1" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 45s --configs TREE03 --kconfig "CONFIG_TEST_CLOCKSOURCE_WATCHDOG=y" --trust-make + +- torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 clocksource.max_cswd_read_retries=1 tsc=watchdog" ++ torture_bootargs="rcupdate.rcu_cpu_stall_suppress_at_boot=1 torture.disable_onoff_at_boot rcupdate.rcu_task_stall_timeout=30000 tsc=watchdog" + torture_set "clocksourcewd-2" tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 45s --configs TREE03 --kconfig "CONFIG_TEST_CLOCKSOURCE_WATCHDOG=y" --trust-make + + # In case our work is already done... diff --git a/patch/kernel/archive/odroidxu4-6.6/patch-6.6.46-47.patch b/patch/kernel/archive/odroidxu4-6.6/patch-6.6.46-47.patch new file mode 100644 index 000000000000..830bd4b9a097 --- /dev/null +++ b/patch/kernel/archive/odroidxu4-6.6/patch-6.6.46-47.patch @@ -0,0 +1,4211 @@ +diff --git a/Documentation/bpf/map_lpm_trie.rst b/Documentation/bpf/map_lpm_trie.rst +index 74d64a30f50073..f9cd579496c9ce 100644 +--- a/Documentation/bpf/map_lpm_trie.rst ++++ b/Documentation/bpf/map_lpm_trie.rst +@@ -17,7 +17,7 @@ significant byte. + + LPM tries may be created with a maximum prefix length that is a multiple + of 8, in the range from 8 to 2048. The key used for lookup and update +-operations is a ``struct bpf_lpm_trie_key``, extended by ++operations is a ``struct bpf_lpm_trie_key_u8``, extended by + ``max_prefixlen/8`` bytes. + + - For IPv4 addresses the data length is 4 bytes +diff --git a/Documentation/mm/page_table_check.rst b/Documentation/mm/page_table_check.rst +index c12838ce6b8de2..c59f22eb6a0f9a 100644 +--- a/Documentation/mm/page_table_check.rst ++++ b/Documentation/mm/page_table_check.rst +@@ -14,7 +14,7 @@ Page table check performs extra verifications at the time when new pages become + accessible from the userspace by getting their page table entries (PTEs PMDs + etc.) added into the table. + +-In case of detected corruption, the kernel is crashed. There is a small ++In case of most detected corruption, the kernel is crashed. There is a small + performance and memory overhead associated with the page table check. Therefore, + it is disabled by default, but can be optionally enabled on systems where the + extra hardening outweighs the performance costs. Also, because page table check +@@ -22,6 +22,13 @@ is synchronous, it can help with debugging double map memory corruption issues, + by crashing kernel at the time wrong mapping occurs instead of later which is + often the case with memory corruptions bugs. + ++It can also be used to do page table entry checks over various flags, dump ++warnings when illegal combinations of entry flags are detected. Currently, ++userfaultfd is the only user of such to sanity check wr-protect bit against ++any writable flags. Illegal flag combinations will not directly cause data ++corruption in this case immediately, but that will cause read-only data to ++be writable, leading to corrupt when the page content is later modified. ++ + Double mapping detection logic + ============================== + +diff --git a/Makefile b/Makefile +index 77de99984c2f18..6b967e135c80f0 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 6 + PATCHLEVEL = 6 +-SUBLEVEL = 46 ++SUBLEVEL = 47 + EXTRAVERSION = + NAME = Hurr durr I'ma ninja sloth + +diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c +index 15aa9bad1c280b..ca0bf0b92ca09e 100644 +--- a/arch/arm64/kvm/hyp/pgtable.c ++++ b/arch/arm64/kvm/hyp/pgtable.c +@@ -523,7 +523,7 @@ static int hyp_unmap_walker(const struct kvm_pgtable_visit_ctx *ctx, + + kvm_clear_pte(ctx->ptep); + dsb(ishst); +- __tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), ctx->level); ++ __tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), 0); + } else { + if (ctx->end - ctx->addr < granule) + return -EINVAL; +@@ -861,9 +861,13 @@ static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx, + if (kvm_pte_valid(ctx->old)) { + kvm_clear_pte(ctx->ptep); + +- if (!stage2_unmap_defer_tlb_flush(pgt)) +- kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, +- ctx->addr, ctx->level); ++ if (kvm_pte_table(ctx->old, ctx->level)) { ++ kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr, ++ 0); ++ } else if (!stage2_unmap_defer_tlb_flush(pgt)) { ++ kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr, ++ ctx->level); ++ } + } + + mm_ops->put_page(ctx->ptep); +diff --git a/arch/loongarch/include/uapi/asm/unistd.h b/arch/loongarch/include/uapi/asm/unistd.h +index fcb668984f0336..b344b1f917153b 100644 +--- a/arch/loongarch/include/uapi/asm/unistd.h ++++ b/arch/loongarch/include/uapi/asm/unistd.h +@@ -1,4 +1,5 @@ + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#define __ARCH_WANT_NEW_STAT + #define __ARCH_WANT_SYS_CLONE + #define __ARCH_WANT_SYS_CLONE3 + +diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h +index e02b179ec65989..d03fe4fb41f43c 100644 +--- a/arch/x86/include/asm/pgtable.h ++++ b/arch/x86/include/asm/pgtable.h +@@ -387,23 +387,7 @@ static inline pte_t pte_wrprotect(pte_t pte) + #ifdef CONFIG_HAVE_ARCH_USERFAULTFD_WP + static inline int pte_uffd_wp(pte_t pte) + { +- bool wp = pte_flags(pte) & _PAGE_UFFD_WP; +- +-#ifdef CONFIG_DEBUG_VM +- /* +- * Having write bit for wr-protect-marked present ptes is fatal, +- * because it means the uffd-wp bit will be ignored and write will +- * just go through. +- * +- * Use any chance of pgtable walking to verify this (e.g., when +- * page swapped out or being migrated for all purposes). It means +- * something is already wrong. Tell the admin even before the +- * process crashes. We also nail it with wrong pgtable setup. +- */ +- WARN_ON_ONCE(wp && pte_write(pte)); +-#endif +- +- return wp; ++ return pte_flags(pte) & _PAGE_UFFD_WP; + } + + static inline pte_t pte_mkuffd_wp(pte_t pte) +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c +index 77dbd516a05463..277bf0e8ed0918 100644 +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -941,8 +941,19 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) + &sense_key, &asc, &ascq); + ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq); + } else { +- /* ATA PASS-THROUGH INFORMATION AVAILABLE */ +- ata_scsi_set_sense(qc->dev, cmd, RECOVERED_ERROR, 0, 0x1D); ++ /* ++ * ATA PASS-THROUGH INFORMATION AVAILABLE ++ * ++ * Note: we are supposed to call ata_scsi_set_sense(), which ++ * respects the D_SENSE bit, instead of unconditionally ++ * generating the sense data in descriptor format. However, ++ * because hdparm, hddtemp, and udisks incorrectly assume sense ++ * data in descriptor format, without even looking at the ++ * RESPONSE CODE field in the returned sense data (to see which ++ * format the returned sense data is in), we are stuck with ++ * being bug compatible with older kernels. ++ */ ++ scsi_build_sense(cmd, 1, RECOVERED_ERROR, 0, 0x1D); + } + } + +diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c +index 2776ca5fc33f39..b215b28cad7b76 100644 +--- a/drivers/isdn/mISDN/socket.c ++++ b/drivers/isdn/mISDN/socket.c +@@ -401,23 +401,23 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) + } + + static int data_sock_setsockopt(struct socket *sock, int level, int optname, +- sockptr_t optval, unsigned int len) ++ sockptr_t optval, unsigned int optlen) + { + struct sock *sk = sock->sk; + int err = 0, opt = 0; + + if (*debug & DEBUG_SOCKET) + printk(KERN_DEBUG "%s(%p, %d, %x, optval, %d)\n", __func__, sock, +- level, optname, len); ++ level, optname, optlen); + + lock_sock(sk); + + switch (optname) { + case MISDN_TIME_STAMP: +- if (copy_from_sockptr(&opt, optval, sizeof(int))) { +- err = -EFAULT; ++ err = copy_safe_from_sockptr(&opt, sizeof(opt), ++ optval, optlen); ++ if (err) + break; +- } + + if (opt) + _pms(sk)->cmask |= MISDN_TIME_STAMP; +diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c +index 22d83ac18eb735..fbf58012becdf2 100644 +--- a/drivers/media/usb/dvb-usb/dvb-usb-init.c ++++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c +@@ -23,40 +23,11 @@ static int dvb_usb_force_pid_filter_usage; + module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444); + MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0)."); + +-static int dvb_usb_check_bulk_endpoint(struct dvb_usb_device *d, u8 endpoint) +-{ +- if (endpoint) { +- int ret; +- +- ret = usb_pipe_type_check(d->udev, usb_sndbulkpipe(d->udev, endpoint)); +- if (ret) +- return ret; +- ret = usb_pipe_type_check(d->udev, usb_rcvbulkpipe(d->udev, endpoint)); +- if (ret) +- return ret; +- } +- return 0; +-} +- +-static void dvb_usb_clear_halt(struct dvb_usb_device *d, u8 endpoint) +-{ +- if (endpoint) { +- usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, endpoint)); +- usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, endpoint)); +- } +-} +- + static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) + { + struct dvb_usb_adapter *adap; + int ret, n, o; + +- ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint); +- if (ret) +- return ret; +- ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint_response); +- if (ret) +- return ret; + for (n = 0; n < d->props.num_adapters; n++) { + adap = &d->adapter[n]; + adap->dev = d; +@@ -132,8 +103,10 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) + * when reloading the driver w/o replugging the device + * sometimes a timeout occurs, this helps + */ +- dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint); +- dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint_response); ++ if (d->props.generic_bulk_ctrl_endpoint != 0) { ++ usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); ++ usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); ++ } + + return 0; + +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c +index ba8b6bd8233cad..96cca4ee470a4b 100644 +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -1007,26 +1007,21 @@ static int pppoe_recvmsg(struct socket *sock, struct msghdr *m, + struct sk_buff *skb; + int error = 0; + +- if (sk->sk_state & PPPOX_BOUND) { +- error = -EIO; +- goto end; +- } ++ if (sk->sk_state & PPPOX_BOUND) ++ return -EIO; + + skb = skb_recv_datagram(sk, flags, &error); +- if (error < 0) +- goto end; ++ if (!skb) ++ return error; + +- if (skb) { +- total_len = min_t(size_t, total_len, skb->len); +- error = skb_copy_datagram_msg(skb, 0, m, total_len); +- if (error == 0) { +- consume_skb(skb); +- return total_len; +- } ++ total_len = min_t(size_t, total_len, skb->len); ++ error = skb_copy_datagram_msg(skb, 0, m, total_len); ++ if (error == 0) { ++ consume_skb(skb); ++ return total_len; + } + + kfree_skb(skb); +-end: + return error; + } + +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 0fc7aa78b2e5b9..2c3f55877a1134 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -2931,6 +2931,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev) + return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND; + } + ++ /* ++ * NVMe SSD drops off the PCIe bus after system idle ++ * for 10 hours on a Lenovo N60z board. ++ */ ++ if (dmi_match(DMI_BOARD_NAME, "LXKT-ZXEG-N6")) ++ return NVME_QUIRK_NO_APST; ++ + return 0; + } + +diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c +index c26545d71d39a3..cd6d5bbb4b9df5 100644 +--- a/fs/binfmt_flat.c ++++ b/fs/binfmt_flat.c +@@ -72,8 +72,10 @@ + + #ifdef CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET + #define DATA_START_OFFSET_WORDS (0) ++#define MAX_SHARED_LIBS_UPDATE (0) + #else + #define DATA_START_OFFSET_WORDS (MAX_SHARED_LIBS) ++#define MAX_SHARED_LIBS_UPDATE (MAX_SHARED_LIBS) + #endif + + struct lib_info { +@@ -880,7 +882,7 @@ static int load_flat_binary(struct linux_binprm *bprm) + return res; + + /* Update data segment pointers for all libraries */ +- for (i = 0; i < MAX_SHARED_LIBS; i++) { ++ for (i = 0; i < MAX_SHARED_LIBS_UPDATE; i++) { + if (!libinfo.lib_list[i].loaded) + continue; + for (j = 0; j < MAX_SHARED_LIBS; j++) { +diff --git a/fs/buffer.c b/fs/buffer.c +index 12e9a71c693d74..ecd8b47507ff80 100644 +--- a/fs/buffer.c ++++ b/fs/buffer.c +@@ -2179,6 +2179,8 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to) + struct buffer_head *bh, *head; + + bh = head = folio_buffers(folio); ++ if (!bh) ++ return; + blocksize = bh->b_size; + + block_start = 0; +diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c +index 5ee7d7bbb361ce..2fbf97077ce910 100644 +--- a/fs/cramfs/inode.c ++++ b/fs/cramfs/inode.c +@@ -495,7 +495,7 @@ static void cramfs_kill_sb(struct super_block *sb) + sb->s_mtd = NULL; + } else if (IS_ENABLED(CONFIG_CRAMFS_BLOCKDEV) && sb->s_bdev) { + sync_blockdev(sb->s_bdev); +- blkdev_put(sb->s_bdev, sb); ++ bdev_release(sb->s_bdev_handle); + } + kfree(sbi); + } +diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c +index d36b3963c0bf3c..aa59788a61e6e4 100644 +--- a/fs/erofs/decompressor.c ++++ b/fs/erofs/decompressor.c +@@ -248,15 +248,9 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx, + if (ret != rq->outputsize) { + erofs_err(rq->sb, "failed to decompress %d in[%u, %u] out[%u]", + ret, rq->inputsize, inputmargin, rq->outputsize); +- +- print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET, +- 16, 1, src + inputmargin, rq->inputsize, true); +- print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET, +- 16, 1, out, rq->outputsize, true); +- + if (ret >= 0) + memset(out + ret, 0, rq->outputsize - ret); +- ret = -EIO; ++ ret = -EFSCORRUPTED; + } else { + ret = 0; + } +diff --git a/fs/exec.c b/fs/exec.c +index 89a9017af7e86f..1cbbef281f8cfe 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1609,6 +1609,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file) + unsigned int mode; + vfsuid_t vfsuid; + vfsgid_t vfsgid; ++ int err; + + if (!mnt_may_suid(file->f_path.mnt)) + return; +@@ -1625,12 +1626,17 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file) + /* Be careful if suid/sgid is set */ + inode_lock(inode); + +- /* reload atomically mode/uid/gid now that lock held */ ++ /* Atomically reload and check mode/uid/gid now that lock held. */ + mode = inode->i_mode; + vfsuid = i_uid_into_vfsuid(idmap, inode); + vfsgid = i_gid_into_vfsgid(idmap, inode); ++ err = inode_permission(idmap, inode, MAY_EXEC); + inode_unlock(inode); + ++ /* Did the exec bit vanish out from under us? Give up. */ ++ if (err) ++ return; ++ + /* We ignore suid/sgid if there are no mappings for them in the ns */ + if (!vfsuid_has_mapping(bprm->cred->user_ns, vfsuid) || + !vfsgid_has_mapping(bprm->cred->user_ns, vfsgid)) +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index cef119a2476bb4..a4ffd1acac6514 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -2966,23 +2966,29 @@ static int ext4_da_should_update_i_disksize(struct folio *folio, + + static int ext4_da_do_write_end(struct address_space *mapping, + loff_t pos, unsigned len, unsigned copied, +- struct page *page) ++ struct folio *folio) + { + struct inode *inode = mapping->host; + loff_t old_size = inode->i_size; + bool disksize_changed = false; + loff_t new_i_size; + ++ if (unlikely(!folio_buffers(folio))) { ++ folio_unlock(folio); ++ folio_put(folio); ++ return -EIO; ++ } + /* + * block_write_end() will mark the inode as dirty with I_DIRTY_PAGES + * flag, which all that's needed to trigger page writeback. + */ +- copied = block_write_end(NULL, mapping, pos, len, copied, page, NULL); ++ copied = block_write_end(NULL, mapping, pos, len, copied, ++ &folio->page, NULL); + new_i_size = pos + copied; + + /* +- * It's important to update i_size while still holding page lock, +- * because page writeout could otherwise come in and zero beyond ++ * It's important to update i_size while still holding folio lock, ++ * because folio writeout could otherwise come in and zero beyond + * i_size. + * + * Since we are holding inode lock, we are sure i_disksize <= +@@ -3000,14 +3006,14 @@ static int ext4_da_do_write_end(struct address_space *mapping, + + i_size_write(inode, new_i_size); + end = (new_i_size - 1) & (PAGE_SIZE - 1); +- if (copied && ext4_da_should_update_i_disksize(page_folio(page), end)) { ++ if (copied && ext4_da_should_update_i_disksize(folio, end)) { + ext4_update_i_disksize(inode, new_i_size); + disksize_changed = true; + } + } + +- unlock_page(page); +- put_page(page); ++ folio_unlock(folio); ++ folio_put(folio); + + if (old_size < pos) + pagecache_isize_extended(inode, old_size, pos); +@@ -3046,10 +3052,10 @@ static int ext4_da_write_end(struct file *file, + return ext4_write_inline_data_end(inode, pos, len, copied, + folio); + +- if (unlikely(copied < len) && !PageUptodate(page)) ++ if (unlikely(copied < len) && !folio_test_uptodate(folio)) + copied = 0; + +- return ext4_da_do_write_end(mapping, pos, len, copied, &folio->page); ++ return ext4_da_do_write_end(mapping, pos, len, copied, folio); + } + + /* +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c +index c58cbe9f7809c1..c368ff671d7739 100644 +--- a/fs/ext4/xattr.c ++++ b/fs/ext4/xattr.c +@@ -1571,46 +1571,49 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value, + /* + * Add value of the EA in an inode. + */ +-static int ext4_xattr_inode_lookup_create(handle_t *handle, struct inode *inode, +- const void *value, size_t value_len, +- struct inode **ret_inode) ++static struct inode *ext4_xattr_inode_lookup_create(handle_t *handle, ++ struct inode *inode, const void *value, size_t value_len) + { + struct inode *ea_inode; + u32 hash; + int err; + ++ /* Account inode & space to quota even if sharing... */ ++ err = ext4_xattr_inode_alloc_quota(inode, value_len); ++ if (err) ++ return ERR_PTR(err); ++ + hash = ext4_xattr_inode_hash(EXT4_SB(inode->i_sb), value, value_len); + ea_inode = ext4_xattr_inode_cache_find(inode, value, value_len, hash); + if (ea_inode) { + err = ext4_xattr_inode_inc_ref(handle, ea_inode); +- if (err) { +- iput(ea_inode); +- return err; +- } +- +- *ret_inode = ea_inode; +- return 0; ++ if (err) ++ goto out_err; ++ return ea_inode; + } + + /* Create an inode for the EA value */ + ea_inode = ext4_xattr_inode_create(handle, inode, hash); +- if (IS_ERR(ea_inode)) +- return PTR_ERR(ea_inode); ++ if (IS_ERR(ea_inode)) { ++ ext4_xattr_inode_free_quota(inode, NULL, value_len); ++ return ea_inode; ++ } + + err = ext4_xattr_inode_write(handle, ea_inode, value, value_len); + if (err) { + if (ext4_xattr_inode_dec_ref(handle, ea_inode)) + ext4_warning_inode(ea_inode, "cleanup dec ref error %d", err); +- iput(ea_inode); +- return err; ++ goto out_err; + } + + if (EA_INODE_CACHE(inode)) + mb_cache_entry_create(EA_INODE_CACHE(inode), GFP_NOFS, hash, + ea_inode->i_ino, true /* reusable */); +- +- *ret_inode = ea_inode; +- return 0; ++ return ea_inode; ++out_err: ++ iput(ea_inode); ++ ext4_xattr_inode_free_quota(inode, NULL, value_len); ++ return ERR_PTR(err); + } + + /* +@@ -1622,6 +1625,7 @@ static int ext4_xattr_inode_lookup_create(handle_t *handle, struct inode *inode, + static int ext4_xattr_set_entry(struct ext4_xattr_info *i, + struct ext4_xattr_search *s, + handle_t *handle, struct inode *inode, ++ struct inode *new_ea_inode, + bool is_block) + { + struct ext4_xattr_entry *last, *next; +@@ -1629,7 +1633,6 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, + size_t min_offs = s->end - s->base, name_len = strlen(i->name); + int in_inode = i->in_inode; + struct inode *old_ea_inode = NULL; +- struct inode *new_ea_inode = NULL; + size_t old_size, new_size; + int ret; + +@@ -1714,43 +1717,11 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, + old_ea_inode = NULL; + goto out; + } +- } +- if (i->value && in_inode) { +- WARN_ON_ONCE(!i->value_len); +- +- ret = ext4_xattr_inode_alloc_quota(inode, i->value_len); +- if (ret) +- goto out; +- +- ret = ext4_xattr_inode_lookup_create(handle, inode, i->value, +- i->value_len, +- &new_ea_inode); +- if (ret) { +- new_ea_inode = NULL; +- ext4_xattr_inode_free_quota(inode, NULL, i->value_len); +- goto out; +- } +- } + +- if (old_ea_inode) { + /* We are ready to release ref count on the old_ea_inode. */ + ret = ext4_xattr_inode_dec_ref(handle, old_ea_inode); +- if (ret) { +- /* Release newly required ref count on new_ea_inode. */ +- if (new_ea_inode) { +- int err; +- +- err = ext4_xattr_inode_dec_ref(handle, +- new_ea_inode); +- if (err) +- ext4_warning_inode(new_ea_inode, +- "dec ref new_ea_inode err=%d", +- err); +- ext4_xattr_inode_free_quota(inode, new_ea_inode, +- i->value_len); +- } ++ if (ret) + goto out; +- } + + ext4_xattr_inode_free_quota(inode, old_ea_inode, + le32_to_cpu(here->e_value_size)); +@@ -1874,7 +1845,6 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, + ret = 0; + out: + iput(old_ea_inode); +- iput(new_ea_inode); + return ret; + } + +@@ -1937,9 +1907,21 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + size_t old_ea_inode_quota = 0; + unsigned int ea_ino; + +- + #define header(x) ((struct ext4_xattr_header *)(x)) + ++ /* If we need EA inode, prepare it before locking the buffer */ ++ if (i->value && i->in_inode) { ++ WARN_ON_ONCE(!i->value_len); ++ ++ ea_inode = ext4_xattr_inode_lookup_create(handle, inode, ++ i->value, i->value_len); ++ if (IS_ERR(ea_inode)) { ++ error = PTR_ERR(ea_inode); ++ ea_inode = NULL; ++ goto cleanup; ++ } ++ } ++ + if (s->base) { + int offset = (char *)s->here - bs->bh->b_data; + +@@ -1948,6 +1930,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + EXT4_JTR_NONE); + if (error) + goto cleanup; ++ + lock_buffer(bs->bh); + + if (header(s->base)->h_refcount == cpu_to_le32(1)) { +@@ -1974,7 +1957,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + } + ea_bdebug(bs->bh, "modifying in-place"); + error = ext4_xattr_set_entry(i, s, handle, inode, +- true /* is_block */); ++ ea_inode, true /* is_block */); + ext4_xattr_block_csum_set(inode, bs->bh); + unlock_buffer(bs->bh); + if (error == -EFSCORRUPTED) +@@ -2042,29 +2025,13 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + s->end = s->base + sb->s_blocksize; + } + +- error = ext4_xattr_set_entry(i, s, handle, inode, true /* is_block */); ++ error = ext4_xattr_set_entry(i, s, handle, inode, ea_inode, ++ true /* is_block */); + if (error == -EFSCORRUPTED) + goto bad_block; + if (error) + goto cleanup; + +- if (i->value && s->here->e_value_inum) { +- /* +- * A ref count on ea_inode has been taken as part of the call to +- * ext4_xattr_set_entry() above. We would like to drop this +- * extra ref but we have to wait until the xattr block is +- * initialized and has its own ref count on the ea_inode. +- */ +- ea_ino = le32_to_cpu(s->here->e_value_inum); +- error = ext4_xattr_inode_iget(inode, ea_ino, +- le32_to_cpu(s->here->e_hash), +- &ea_inode); +- if (error) { +- ea_inode = NULL; +- goto cleanup; +- } +- } +- + inserted: + if (!IS_LAST_ENTRY(s->first)) { + new_bh = ext4_xattr_block_cache_find(inode, header(s->base), +@@ -2217,17 +2184,16 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + + cleanup: + if (ea_inode) { +- int error2; +- +- error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); +- if (error2) +- ext4_warning_inode(ea_inode, "dec ref error=%d", +- error2); ++ if (error) { ++ int error2; + +- /* If there was an error, revert the quota charge. */ +- if (error) ++ error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); ++ if (error2) ++ ext4_warning_inode(ea_inode, "dec ref error=%d", ++ error2); + ext4_xattr_inode_free_quota(inode, ea_inode, + i_size_read(ea_inode)); ++ } + iput(ea_inode); + } + if (ce) +@@ -2285,14 +2251,38 @@ int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode, + { + struct ext4_xattr_ibody_header *header; + struct ext4_xattr_search *s = &is->s; ++ struct inode *ea_inode = NULL; + int error; + + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) + return -ENOSPC; + +- error = ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */); +- if (error) ++ /* If we need EA inode, prepare it before locking the buffer */ ++ if (i->value && i->in_inode) { ++ WARN_ON_ONCE(!i->value_len); ++ ++ ea_inode = ext4_xattr_inode_lookup_create(handle, inode, ++ i->value, i->value_len); ++ if (IS_ERR(ea_inode)) ++ return PTR_ERR(ea_inode); ++ } ++ error = ext4_xattr_set_entry(i, s, handle, inode, ea_inode, ++ false /* is_block */); ++ if (error) { ++ if (ea_inode) { ++ int error2; ++ ++ error2 = ext4_xattr_inode_dec_ref(handle, ea_inode); ++ if (error2) ++ ext4_warning_inode(ea_inode, "dec ref error=%d", ++ error2); ++ ++ ext4_xattr_inode_free_quota(inode, ea_inode, ++ i_size_read(ea_inode)); ++ iput(ea_inode); ++ } + return error; ++ } + header = IHDR(inode, ext4_raw_inode(&is->iloc)); + if (!IS_LAST_ENTRY(s->first)) { + header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); +@@ -2301,6 +2291,7 @@ int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode, + header->h_magic = cpu_to_le32(0); + ext4_clear_inode_state(inode, EXT4_STATE_XATTR); + } ++ iput(ea_inode); + return 0; + } + +diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c +index ad8dfac73bd446..6a9a470345bfc7 100644 +--- a/fs/f2fs/extent_cache.c ++++ b/fs/f2fs/extent_cache.c +@@ -19,34 +19,24 @@ + #include "node.h" + #include + +-bool sanity_check_extent_cache(struct inode *inode) ++bool sanity_check_extent_cache(struct inode *inode, struct page *ipage) + { + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); +- struct f2fs_inode_info *fi = F2FS_I(inode); +- struct extent_tree *et = fi->extent_tree[EX_READ]; +- struct extent_info *ei; +- +- if (!et) +- return true; ++ struct f2fs_extent *i_ext = &F2FS_INODE(ipage)->i_ext; ++ struct extent_info ei; + +- ei = &et->largest; +- if (!ei->len) +- return true; ++ get_read_extent_info(&ei, i_ext); + +- /* Let's drop, if checkpoint got corrupted. */ +- if (is_set_ckpt_flags(sbi, CP_ERROR_FLAG)) { +- ei->len = 0; +- et->largest_updated = true; ++ if (!ei.len) + return true; +- } + +- if (!f2fs_is_valid_blkaddr(sbi, ei->blk, DATA_GENERIC_ENHANCE) || +- !f2fs_is_valid_blkaddr(sbi, ei->blk + ei->len - 1, ++ if (!f2fs_is_valid_blkaddr(sbi, ei.blk, DATA_GENERIC_ENHANCE) || ++ !f2fs_is_valid_blkaddr(sbi, ei.blk + ei.len - 1, + DATA_GENERIC_ENHANCE)) { + set_sbi_flag(sbi, SBI_NEED_FSCK); + f2fs_warn(sbi, "%s: inode (ino=%lx) extent info [%u, %u, %u] is incorrect, run fsck to fix", + __func__, inode->i_ino, +- ei->blk, ei->fofs, ei->len); ++ ei.blk, ei.fofs, ei.len); + return false; + } + return true; +@@ -395,24 +385,22 @@ void f2fs_init_read_extent_tree(struct inode *inode, struct page *ipage) + + if (!__may_extent_tree(inode, EX_READ)) { + /* drop largest read extent */ +- if (i_ext && i_ext->len) { ++ if (i_ext->len) { + f2fs_wait_on_page_writeback(ipage, NODE, true, true); + i_ext->len = 0; + set_page_dirty(ipage); + } +- goto out; ++ set_inode_flag(inode, FI_NO_EXTENT); ++ return; + } + + et = __grab_extent_tree(inode, EX_READ); + +- if (!i_ext || !i_ext->len) +- goto out; +- + get_read_extent_info(&ei, i_ext); + + write_lock(&et->lock); +- if (atomic_read(&et->node_cnt)) +- goto unlock_out; ++ if (atomic_read(&et->node_cnt) || !ei.len) ++ goto skip; + + en = __attach_extent_node(sbi, et, &ei, NULL, + &et->root.rb_root.rb_node, true); +@@ -424,11 +412,13 @@ void f2fs_init_read_extent_tree(struct inode *inode, struct page *ipage) + list_add_tail(&en->list, &eti->extent_list); + spin_unlock(&eti->extent_lock); + } +-unlock_out: ++skip: ++ /* Let's drop, if checkpoint got corrupted. */ ++ if (f2fs_cp_error(sbi)) { ++ et->largest.len = 0; ++ et->largest_updated = true; ++ } + write_unlock(&et->lock); +-out: +- if (!F2FS_I(inode)->extent_tree[EX_READ]) +- set_inode_flag(inode, FI_NO_EXTENT); + } + + void f2fs_init_age_extent_tree(struct inode *inode) +diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h +index 19490dd8321943..00eff023cd9d63 100644 +--- a/fs/f2fs/f2fs.h ++++ b/fs/f2fs/f2fs.h +@@ -4189,7 +4189,7 @@ void f2fs_leave_shrinker(struct f2fs_sb_info *sbi); + /* + * extent_cache.c + */ +-bool sanity_check_extent_cache(struct inode *inode); ++bool sanity_check_extent_cache(struct inode *inode, struct page *ipage); + void f2fs_init_extent_tree(struct inode *inode); + void f2fs_drop_extent_tree(struct inode *inode); + void f2fs_destroy_extent_node(struct inode *inode); +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c +index afb7c88ba06b2c..888c301ffe8f4c 100644 +--- a/fs/f2fs/gc.c ++++ b/fs/f2fs/gc.c +@@ -1563,6 +1563,16 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, + continue; + } + ++ if (f2fs_has_inline_data(inode)) { ++ iput(inode); ++ set_sbi_flag(sbi, SBI_NEED_FSCK); ++ f2fs_err_ratelimited(sbi, ++ "inode %lx has both inline_data flag and " ++ "data block, nid=%u, ofs_in_node=%u", ++ inode->i_ino, dni.nid, ofs_in_node); ++ continue; ++ } ++ + err = f2fs_gc_pinned_control(inode, gc_type, segno); + if (err == -EAGAIN) { + iput(inode); +diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c +index 0172f4e503061d..26e857fee631d9 100644 +--- a/fs/f2fs/inode.c ++++ b/fs/f2fs/inode.c +@@ -511,16 +511,16 @@ static int do_read_inode(struct inode *inode) + + init_idisk_time(inode); + +- /* Need all the flag bits */ +- f2fs_init_read_extent_tree(inode, node_page); +- f2fs_init_age_extent_tree(inode); +- +- if (!sanity_check_extent_cache(inode)) { ++ if (!sanity_check_extent_cache(inode, node_page)) { + f2fs_put_page(node_page, 1); + f2fs_handle_error(sbi, ERROR_CORRUPTED_INODE); + return -EFSCORRUPTED; + } + ++ /* Need all the flag bits */ ++ f2fs_init_read_extent_tree(inode, node_page); ++ f2fs_init_age_extent_tree(inode); ++ + f2fs_put_page(node_page, 1); + + stat_inc_inline_xattr(inode); +diff --git a/fs/fhandle.c b/fs/fhandle.c +index 99dcf07cfecfe1..c361d7ff1b88dd 100644 +--- a/fs/fhandle.c ++++ b/fs/fhandle.c +@@ -40,7 +40,7 @@ static long do_sys_name_to_handle(const struct path *path, + if (f_handle.handle_bytes > MAX_HANDLE_SZ) + return -EINVAL; + +- handle = kzalloc(sizeof(struct file_handle) + f_handle.handle_bytes, ++ handle = kzalloc(struct_size(handle, f_handle, f_handle.handle_bytes), + GFP_KERNEL); + if (!handle) + return -ENOMEM; +@@ -75,7 +75,7 @@ static long do_sys_name_to_handle(const struct path *path, + /* copy the mount id */ + if (put_user(real_mount(path->mnt)->mnt_id, mnt_id) || + copy_to_user(ufh, handle, +- sizeof(struct file_handle) + handle_bytes)) ++ struct_size(handle, f_handle, handle_bytes))) + retval = -EFAULT; + kfree(handle); + return retval; +@@ -196,7 +196,7 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, + retval = -EINVAL; + goto out_err; + } +- handle = kmalloc(sizeof(struct file_handle) + f_handle.handle_bytes, ++ handle = kmalloc(struct_size(handle, f_handle, f_handle.handle_bytes), + GFP_KERNEL); + if (!handle) { + retval = -ENOMEM; +diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c +index cb3cda1390adb1..5713994328cbcb 100644 +--- a/fs/jfs/jfs_dmap.c ++++ b/fs/jfs/jfs_dmap.c +@@ -1626,6 +1626,8 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen) + } else if (rc == -ENOSPC) { + /* search for next smaller log2 block */ + l2nb = BLKSTOL2(nblocks) - 1; ++ if (unlikely(l2nb < 0)) ++ break; + nblocks = 1LL << l2nb; + } else { + /* Trim any already allocated blocks */ +diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c +index 031d8f570f581f..5d3127ca68a42d 100644 +--- a/fs/jfs/jfs_dtree.c ++++ b/fs/jfs/jfs_dtree.c +@@ -834,6 +834,8 @@ int dtInsert(tid_t tid, struct inode *ip, + * the full page. + */ + DT_GETSEARCH(ip, btstack->top, bn, mp, p, index); ++ if (p->header.freelist == 0) ++ return -EINVAL; + + /* + * insert entry for new key +diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c +index e855b8fde76ce1..cb6d1fda66a702 100644 +--- a/fs/jfs/jfs_logmgr.c ++++ b/fs/jfs/jfs_logmgr.c +@@ -1058,7 +1058,7 @@ void jfs_syncpt(struct jfs_log *log, int hard_sync) + int lmLogOpen(struct super_block *sb) + { + int rc; +- struct block_device *bdev; ++ struct bdev_handle *bdev_handle; + struct jfs_log *log; + struct jfs_sb_info *sbi = JFS_SBI(sb); + +@@ -1070,7 +1070,7 @@ int lmLogOpen(struct super_block *sb) + + mutex_lock(&jfs_log_mutex); + list_for_each_entry(log, &jfs_external_logs, journal_list) { +- if (log->bdev->bd_dev == sbi->logdev) { ++ if (log->bdev_handle->bdev->bd_dev == sbi->logdev) { + if (!uuid_equal(&log->uuid, &sbi->loguuid)) { + jfs_warn("wrong uuid on JFS journal"); + mutex_unlock(&jfs_log_mutex); +@@ -1100,14 +1100,14 @@ int lmLogOpen(struct super_block *sb) + * file systems to log may have n-to-1 relationship; + */ + +- bdev = blkdev_get_by_dev(sbi->logdev, BLK_OPEN_READ | BLK_OPEN_WRITE, +- log, NULL); +- if (IS_ERR(bdev)) { +- rc = PTR_ERR(bdev); ++ bdev_handle = bdev_open_by_dev(sbi->logdev, ++ BLK_OPEN_READ | BLK_OPEN_WRITE, log, NULL); ++ if (IS_ERR(bdev_handle)) { ++ rc = PTR_ERR(bdev_handle); + goto free; + } + +- log->bdev = bdev; ++ log->bdev_handle = bdev_handle; + uuid_copy(&log->uuid, &sbi->loguuid); + + /* +@@ -1141,7 +1141,7 @@ int lmLogOpen(struct super_block *sb) + lbmLogShutdown(log); + + close: /* close external log device */ +- blkdev_put(bdev, log); ++ bdev_release(bdev_handle); + + free: /* free log descriptor */ + mutex_unlock(&jfs_log_mutex); +@@ -1162,7 +1162,7 @@ static int open_inline_log(struct super_block *sb) + init_waitqueue_head(&log->syncwait); + + set_bit(log_INLINELOG, &log->flag); +- log->bdev = sb->s_bdev; ++ log->bdev_handle = sb->s_bdev_handle; + log->base = addressPXD(&JFS_SBI(sb)->logpxd); + log->size = lengthPXD(&JFS_SBI(sb)->logpxd) >> + (L2LOGPSIZE - sb->s_blocksize_bits); +@@ -1436,7 +1436,7 @@ int lmLogClose(struct super_block *sb) + { + struct jfs_sb_info *sbi = JFS_SBI(sb); + struct jfs_log *log = sbi->log; +- struct block_device *bdev; ++ struct bdev_handle *bdev_handle; + int rc = 0; + + jfs_info("lmLogClose: log:0x%p", log); +@@ -1482,10 +1482,10 @@ int lmLogClose(struct super_block *sb) + * external log as separate logical volume + */ + list_del(&log->journal_list); +- bdev = log->bdev; ++ bdev_handle = log->bdev_handle; + rc = lmLogShutdown(log); + +- blkdev_put(bdev, log); ++ bdev_release(bdev_handle); + + kfree(log); + +@@ -1972,7 +1972,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) + + bp->l_flag |= lbmREAD; + +- bio = bio_alloc(log->bdev, 1, REQ_OP_READ, GFP_NOFS); ++ bio = bio_alloc(log->bdev_handle->bdev, 1, REQ_OP_READ, GFP_NOFS); + bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); +@@ -2110,10 +2110,15 @@ static void lbmStartIO(struct lbuf * bp) + { + struct bio *bio; + struct jfs_log *log = bp->l_log; ++ struct block_device *bdev = NULL; + + jfs_info("lbmStartIO"); + +- bio = bio_alloc(log->bdev, 1, REQ_OP_WRITE | REQ_SYNC, GFP_NOFS); ++ if (!log->no_integrity) ++ bdev = log->bdev_handle->bdev; ++ ++ bio = bio_alloc(bdev, 1, REQ_OP_WRITE | REQ_SYNC, ++ GFP_NOFS); + bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); +diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h +index 805877ce502044..84aa2d25390743 100644 +--- a/fs/jfs/jfs_logmgr.h ++++ b/fs/jfs/jfs_logmgr.h +@@ -356,7 +356,7 @@ struct jfs_log { + * before writing syncpt. + */ + struct list_head journal_list; /* Global list */ +- struct block_device *bdev; /* 4: log lv pointer */ ++ struct bdev_handle *bdev_handle; /* 4: log lv pointer */ + int serial; /* 4: log mount serial number */ + + s64 base; /* @8: log extent address (inline log ) */ +diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c +index 631b8bd3e43849..9b5c6a20b30c83 100644 +--- a/fs/jfs/jfs_mount.c ++++ b/fs/jfs/jfs_mount.c +@@ -430,7 +430,8 @@ int updateSuper(struct super_block *sb, uint state) + + if (state == FM_MOUNT) { + /* record log's dev_t and mount serial number */ +- j_sb->s_logdev = cpu_to_le32(new_encode_dev(sbi->log->bdev->bd_dev)); ++ j_sb->s_logdev = cpu_to_le32( ++ new_encode_dev(sbi->log->bdev_handle->bdev->bd_dev)); + j_sb->s_logserial = cpu_to_le32(sbi->log->serial); + } else if (state == FM_CLEAN) { + /* +diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c +index 6579948070a482..a62331487ebf16 100644 +--- a/fs/lockd/svc.c ++++ b/fs/lockd/svc.c +@@ -712,8 +712,6 @@ static const struct svc_version *nlmsvc_version[] = { + #endif + }; + +-static struct svc_stat nlmsvc_stats; +- + #define NLM_NRVERS ARRAY_SIZE(nlmsvc_version) + static struct svc_program nlmsvc_program = { + .pg_prog = NLM_PROGRAM, /* program number */ +@@ -721,7 +719,6 @@ static struct svc_program nlmsvc_program = { + .pg_vers = nlmsvc_version, /* version table */ + .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_init_request = svc_generic_init_request, + .pg_rpcbind_set = svc_generic_rpcbind_set, +diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c +index 466ebf1d41b2b7..869c88978899c0 100644 +--- a/fs/nfs/callback.c ++++ b/fs/nfs/callback.c +@@ -399,15 +399,12 @@ static const struct svc_version *nfs4_callback_version[] = { + [4] = &nfs4_callback_version4, + }; + +-static struct svc_stat nfs4_callback_stats; +- + static struct svc_program nfs4_callback_program = { + .pg_prog = NFS4_CALLBACK, /* RPC service number */ + .pg_nvers = ARRAY_SIZE(nfs4_callback_version), /* Number of entries */ + .pg_vers = nfs4_callback_version, /* version table */ + .pg_name = "NFSv4 callback", /* service name */ + .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, +diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h +index 4cbe0434cbb8ce..66a05fefae98ea 100644 +--- a/fs/nfsd/cache.h ++++ b/fs/nfsd/cache.h +@@ -80,8 +80,6 @@ enum { + + int nfsd_drc_slab_create(void); + void nfsd_drc_slab_free(void); +-int nfsd_net_reply_cache_init(struct nfsd_net *nn); +-void nfsd_net_reply_cache_destroy(struct nfsd_net *nn); + int nfsd_reply_cache_init(struct nfsd_net *); + void nfsd_reply_cache_shutdown(struct nfsd_net *); + int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, +diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c +index 11a0eaa2f91407..b7da17e530077e 100644 +--- a/fs/nfsd/export.c ++++ b/fs/nfsd/export.c +@@ -339,12 +339,16 @@ static int export_stats_init(struct export_stats *stats) + + static void export_stats_reset(struct export_stats *stats) + { +- nfsd_percpu_counters_reset(stats->counter, EXP_STATS_COUNTERS_NUM); ++ if (stats) ++ nfsd_percpu_counters_reset(stats->counter, ++ EXP_STATS_COUNTERS_NUM); + } + + static void export_stats_destroy(struct export_stats *stats) + { +- nfsd_percpu_counters_destroy(stats->counter, EXP_STATS_COUNTERS_NUM); ++ if (stats) ++ nfsd_percpu_counters_destroy(stats->counter, ++ EXP_STATS_COUNTERS_NUM); + } + + static void svc_export_put(struct kref *ref) +@@ -353,7 +357,8 @@ static void svc_export_put(struct kref *ref) + path_put(&exp->ex_path); + auth_domain_put(exp->ex_client); + nfsd4_fslocs_free(&exp->ex_fslocs); +- export_stats_destroy(&exp->ex_stats); ++ export_stats_destroy(exp->ex_stats); ++ kfree(exp->ex_stats); + kfree(exp->ex_uuid); + kfree_rcu(exp, ex_rcu); + } +@@ -767,13 +772,15 @@ static int svc_export_show(struct seq_file *m, + seq_putc(m, '\t'); + seq_escape(m, exp->ex_client->name, " \t\n\\"); + if (export_stats) { +- seq_printf(m, "\t%lld\n", exp->ex_stats.start_time); ++ struct percpu_counter *counter = exp->ex_stats->counter; ++ ++ seq_printf(m, "\t%lld\n", exp->ex_stats->start_time); + seq_printf(m, "\tfh_stale: %lld\n", +- percpu_counter_sum_positive(&exp->ex_stats.counter[EXP_STATS_FH_STALE])); ++ percpu_counter_sum_positive(&counter[EXP_STATS_FH_STALE])); + seq_printf(m, "\tio_read: %lld\n", +- percpu_counter_sum_positive(&exp->ex_stats.counter[EXP_STATS_IO_READ])); ++ percpu_counter_sum_positive(&counter[EXP_STATS_IO_READ])); + seq_printf(m, "\tio_write: %lld\n", +- percpu_counter_sum_positive(&exp->ex_stats.counter[EXP_STATS_IO_WRITE])); ++ percpu_counter_sum_positive(&counter[EXP_STATS_IO_WRITE])); + seq_putc(m, '\n'); + return 0; + } +@@ -819,7 +826,7 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem) + new->ex_layout_types = 0; + new->ex_uuid = NULL; + new->cd = item->cd; +- export_stats_reset(&new->ex_stats); ++ export_stats_reset(new->ex_stats); + } + + static void export_update(struct cache_head *cnew, struct cache_head *citem) +@@ -856,7 +863,14 @@ static struct cache_head *svc_export_alloc(void) + if (!i) + return NULL; + +- if (export_stats_init(&i->ex_stats)) { ++ i->ex_stats = kmalloc(sizeof(*(i->ex_stats)), GFP_KERNEL); ++ if (!i->ex_stats) { ++ kfree(i); ++ return NULL; ++ } ++ ++ if (export_stats_init(i->ex_stats)) { ++ kfree(i->ex_stats); + kfree(i); + return NULL; + } +diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h +index 2df8ae25aad302..ca9dc230ae3d0b 100644 +--- a/fs/nfsd/export.h ++++ b/fs/nfsd/export.h +@@ -64,10 +64,10 @@ struct svc_export { + struct cache_head h; + struct auth_domain * ex_client; + int ex_flags; ++ int ex_fsid; + struct path ex_path; + kuid_t ex_anon_uid; + kgid_t ex_anon_gid; +- int ex_fsid; + unsigned char * ex_uuid; /* 16 byte fsid */ + struct nfsd4_fs_locations ex_fslocs; + uint32_t ex_nflavors; +@@ -76,8 +76,8 @@ struct svc_export { + struct nfsd4_deviceid_map *ex_devid_map; + struct cache_detail *cd; + struct rcu_head ex_rcu; +- struct export_stats ex_stats; + unsigned long ex_xprtsec_modes; ++ struct export_stats *ex_stats; + }; + + /* an "export key" (expkey) maps a filehandlefragement to an +diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h +index ec49b200b79762..9bfca3dda63d33 100644 +--- a/fs/nfsd/netns.h ++++ b/fs/nfsd/netns.h +@@ -11,8 +11,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + + /* Hash tables for nfs4_clientid state */ + #define CLIENT_HASH_BITS 4 +@@ -26,10 +28,22 @@ struct nfsd4_client_tracking_ops; + + enum { + /* cache misses due only to checksum comparison failures */ +- NFSD_NET_PAYLOAD_MISSES, ++ NFSD_STATS_PAYLOAD_MISSES, + /* amount of memory (in bytes) currently consumed by the DRC */ +- NFSD_NET_DRC_MEM_USAGE, +- NFSD_NET_COUNTERS_NUM ++ NFSD_STATS_DRC_MEM_USAGE, ++ NFSD_STATS_RC_HITS, /* repcache hits */ ++ NFSD_STATS_RC_MISSES, /* repcache misses */ ++ NFSD_STATS_RC_NOCACHE, /* uncached reqs */ ++ NFSD_STATS_FH_STALE, /* FH stale error */ ++ NFSD_STATS_IO_READ, /* bytes returned to read requests */ ++ NFSD_STATS_IO_WRITE, /* bytes passed in write requests */ ++#ifdef CONFIG_NFSD_V4 ++ NFSD_STATS_FIRST_NFS4_OP, /* count of individual nfsv4 operations */ ++ NFSD_STATS_LAST_NFS4_OP = NFSD_STATS_FIRST_NFS4_OP + LAST_NFS4_OP, ++#define NFSD_STATS_NFS4_OP(op) (NFSD_STATS_FIRST_NFS4_OP + (op)) ++ NFSD_STATS_WDELEG_GETATTR, /* count of getattr conflict with wdeleg */ ++#endif ++ NFSD_STATS_COUNTERS_NUM + }; + + /* +@@ -169,7 +183,10 @@ struct nfsd_net { + atomic_t num_drc_entries; + + /* Per-netns stats counters */ +- struct percpu_counter counter[NFSD_NET_COUNTERS_NUM]; ++ struct percpu_counter counter[NFSD_STATS_COUNTERS_NUM]; ++ ++ /* sunrpc svc stats */ ++ struct svc_stat nfsd_svcstats; + + /* longest hash chain seen */ + unsigned int longest_chain; +diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c +index 451026f9986b61..ae0057c54ef4ed 100644 +--- a/fs/nfsd/nfs4proc.c ++++ b/fs/nfsd/nfs4proc.c +@@ -2478,10 +2478,10 @@ nfsd4_proc_null(struct svc_rqst *rqstp) + return rpc_success; + } + +-static inline void nfsd4_increment_op_stats(u32 opnum) ++static inline void nfsd4_increment_op_stats(struct nfsd_net *nn, u32 opnum) + { + if (opnum >= FIRST_NFS4_OP && opnum <= LAST_NFS4_OP) +- percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_NFS4_OP(opnum)]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_NFS4_OP(opnum)]); + } + + static const struct nfsd4_operation nfsd4_ops[]; +@@ -2756,7 +2756,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) + status, nfsd4_op_name(op->opnum)); + + nfsd4_cstate_clear_replay(cstate); +- nfsd4_increment_op_stats(op->opnum); ++ nfsd4_increment_op_stats(nn, op->opnum); + } + + fh_put(current_fh); +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index c7e52d980cd75f..cdad1eaa4a3180 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -8422,6 +8422,7 @@ __be32 + nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode) + { + __be32 status; ++ struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); + struct file_lock_context *ctx; + struct file_lock *fl; + struct nfs4_delegation *dp; +@@ -8451,7 +8452,7 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode) + } + break_lease: + spin_unlock(&ctx->flc_lock); +- nfsd_stats_wdeleg_getattr_inc(); ++ nfsd_stats_wdeleg_getattr_inc(nn); + status = nfserrno(nfsd_open_break_lease(inode, NFSD_MAY_READ)); + if (status != nfserr_jukebox || + !nfsd_wait_for_delegreturn(rqstp, inode)) +diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c +index 6cd36af2f97e10..c52132ecb339d5 100644 +--- a/fs/nfsd/nfscache.c ++++ b/fs/nfsd/nfscache.c +@@ -176,27 +176,6 @@ void nfsd_drc_slab_free(void) + kmem_cache_destroy(drc_slab); + } + +-/** +- * nfsd_net_reply_cache_init - per net namespace reply cache set-up +- * @nn: nfsd_net being initialized +- * +- * Returns zero on succes; otherwise a negative errno is returned. +- */ +-int nfsd_net_reply_cache_init(struct nfsd_net *nn) +-{ +- return nfsd_percpu_counters_init(nn->counter, NFSD_NET_COUNTERS_NUM); +-} +- +-/** +- * nfsd_net_reply_cache_destroy - per net namespace reply cache tear-down +- * @nn: nfsd_net being freed +- * +- */ +-void nfsd_net_reply_cache_destroy(struct nfsd_net *nn) +-{ +- nfsd_percpu_counters_destroy(nn->counter, NFSD_NET_COUNTERS_NUM); +-} +- + int nfsd_reply_cache_init(struct nfsd_net *nn) + { + unsigned int hashsize; +@@ -502,7 +481,7 @@ nfsd_cache_insert(struct nfsd_drc_bucket *b, struct nfsd_cacherep *key, + int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, + unsigned int len, struct nfsd_cacherep **cacherep) + { +- struct nfsd_net *nn; ++ struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); + struct nfsd_cacherep *rp, *found; + __wsum csum; + struct nfsd_drc_bucket *b; +@@ -512,7 +491,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, + int rtn = RC_DOIT; + + if (type == RC_NOCACHE) { +- nfsd_stats_rc_nocache_inc(); ++ nfsd_stats_rc_nocache_inc(nn); + goto out; + } + +@@ -522,7 +501,6 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, + * Since the common case is a cache miss followed by an insert, + * preallocate an entry. + */ +- nn = net_generic(SVC_NET(rqstp), nfsd_net_id); + rp = nfsd_cacherep_alloc(rqstp, csum, nn); + if (!rp) + goto out; +@@ -540,7 +518,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, + freed = nfsd_cacherep_dispose(&dispose); + trace_nfsd_drc_gc(nn, freed); + +- nfsd_stats_rc_misses_inc(); ++ nfsd_stats_rc_misses_inc(nn); + atomic_inc(&nn->num_drc_entries); + nfsd_stats_drc_mem_usage_add(nn, sizeof(*rp)); + goto out; +@@ -548,7 +526,7 @@ int nfsd_cache_lookup(struct svc_rqst *rqstp, unsigned int start, + found_entry: + /* We found a matching entry which is either in progress or done. */ + nfsd_reply_cache_free_locked(NULL, rp, nn); +- nfsd_stats_rc_hits_inc(); ++ nfsd_stats_rc_hits_inc(nn); + rtn = RC_DROPIT; + rp = found; + +@@ -690,15 +668,15 @@ int nfsd_reply_cache_stats_show(struct seq_file *m, void *v) + atomic_read(&nn->num_drc_entries)); + seq_printf(m, "hash buckets: %u\n", 1 << nn->maskbits); + seq_printf(m, "mem usage: %lld\n", +- percpu_counter_sum_positive(&nn->counter[NFSD_NET_DRC_MEM_USAGE])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_DRC_MEM_USAGE])); + seq_printf(m, "cache hits: %lld\n", +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_HITS])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_HITS])); + seq_printf(m, "cache misses: %lld\n", +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_MISSES])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_MISSES])); + seq_printf(m, "not cached: %lld\n", +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_NOCACHE])); + seq_printf(m, "payload misses: %lld\n", +- percpu_counter_sum_positive(&nn->counter[NFSD_NET_PAYLOAD_MISSES])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_PAYLOAD_MISSES])); + seq_printf(m, "longest chain len: %u\n", nn->longest_chain); + seq_printf(m, "cachesize at longest: %u\n", nn->longest_chain_cachesize); + return 0; +diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c +index a13e81e450718a..887035b7446763 100644 +--- a/fs/nfsd/nfsctl.c ++++ b/fs/nfsd/nfsctl.c +@@ -1524,14 +1524,17 @@ static __net_init int nfsd_net_init(struct net *net) + retval = nfsd_idmap_init(net); + if (retval) + goto out_idmap_error; +- retval = nfsd_net_reply_cache_init(nn); ++ retval = nfsd_stat_counters_init(nn); + if (retval) + goto out_repcache_error; ++ memset(&nn->nfsd_svcstats, 0, sizeof(nn->nfsd_svcstats)); ++ nn->nfsd_svcstats.program = &nfsd_program; + nn->nfsd_versions = NULL; + nn->nfsd4_minorversions = NULL; + nfsd4_init_leases_net(nn); + get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key)); + seqlock_init(&nn->writeverf_lock); ++ nfsd_proc_stat_init(net); + + return 0; + +@@ -1552,7 +1555,8 @@ static __net_exit void nfsd_net_exit(struct net *net) + { + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + +- nfsd_net_reply_cache_destroy(nn); ++ nfsd_proc_stat_shutdown(net); ++ nfsd_stat_counters_destroy(nn); + nfsd_idmap_shutdown(net); + nfsd_export_shutdown(net); + nfsd_netns_free_versions(nn); +@@ -1575,12 +1579,9 @@ static int __init init_nfsd(void) + retval = nfsd4_init_pnfs(); + if (retval) + goto out_free_slabs; +- retval = nfsd_stat_init(); /* Statistics */ +- if (retval) +- goto out_free_pnfs; + retval = nfsd_drc_slab_create(); + if (retval) +- goto out_free_stat; ++ goto out_free_pnfs; + nfsd_lockd_init(); /* lockd->nfsd callbacks */ + retval = create_proc_exports_entry(); + if (retval) +@@ -1610,8 +1611,6 @@ static int __init init_nfsd(void) + out_free_lockd: + nfsd_lockd_shutdown(); + nfsd_drc_slab_free(); +-out_free_stat: +- nfsd_stat_shutdown(); + out_free_pnfs: + nfsd4_exit_pnfs(); + out_free_slabs: +@@ -1628,7 +1627,6 @@ static void __exit exit_nfsd(void) + nfsd_drc_slab_free(); + remove_proc_entry("fs/nfs/exports", NULL); + remove_proc_entry("fs/nfs", NULL); +- nfsd_stat_shutdown(); + nfsd_lockd_shutdown(); + nfsd4_free_slabs(); + nfsd4_exit_pnfs(); +diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h +index fe846a360ae18d..d05bd2b811f377 100644 +--- a/fs/nfsd/nfsd.h ++++ b/fs/nfsd/nfsd.h +@@ -69,6 +69,7 @@ extern struct mutex nfsd_mutex; + extern spinlock_t nfsd_drc_lock; + extern unsigned long nfsd_drc_max_mem; + extern unsigned long nfsd_drc_mem_used; ++extern atomic_t nfsd_th_cnt; /* number of available threads */ + + extern const struct seq_operations nfs_exports_op; + +diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c +index 937be276bb6b48..c2495d98c18928 100644 +--- a/fs/nfsd/nfsfh.c ++++ b/fs/nfsd/nfsfh.c +@@ -327,6 +327,7 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) + __be32 + fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) + { ++ struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); + struct svc_export *exp = NULL; + struct dentry *dentry; + __be32 error; +@@ -395,7 +396,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) + out: + trace_nfsd_fh_verify_err(rqstp, fhp, type, access, error); + if (error == nfserr_stale) +- nfsd_stats_fh_stale_inc(exp); ++ nfsd_stats_fh_stale_inc(nn, exp); + return error; + } + +diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c +index 7ef6af908faacb..7911c4b3b5d355 100644 +--- a/fs/nfsd/nfssvc.c ++++ b/fs/nfsd/nfssvc.c +@@ -34,6 +34,7 @@ + + #define NFSDDBG_FACILITY NFSDDBG_SVC + ++atomic_t nfsd_th_cnt = ATOMIC_INIT(0); + extern struct svc_program nfsd_program; + static int nfsd(void *vrqstp); + #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) +@@ -89,7 +90,6 @@ unsigned long nfsd_drc_max_mem; + unsigned long nfsd_drc_mem_used; + + #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) +-static struct svc_stat nfsd_acl_svcstats; + static const struct svc_version *nfsd_acl_version[] = { + # if defined(CONFIG_NFSD_V2_ACL) + [2] = &nfsd_acl_version2, +@@ -108,15 +108,11 @@ static struct svc_program nfsd_acl_program = { + .pg_vers = nfsd_acl_version, + .pg_name = "nfsacl", + .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 = { +- .program = &nfsd_acl_program, +-}; + #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ + + static const struct svc_version *nfsd_version[] = { +@@ -141,7 +137,6 @@ struct svc_program nfsd_program = { + .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, +@@ -675,7 +670,8 @@ int nfsd_create_serv(struct net *net) + if (nfsd_max_blksize == 0) + nfsd_max_blksize = nfsd_get_default_max_blksize(); + nfsd_reset_versions(nn); +- serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, nfsd); ++ serv = svc_create_pooled(&nfsd_program, &nn->nfsd_svcstats, ++ nfsd_max_blksize, nfsd); + if (serv == NULL) + return -ENOMEM; + +@@ -950,7 +946,7 @@ nfsd(void *vrqstp) + + current->fs->umask = 0; + +- atomic_inc(&nfsdstats.th_cnt); ++ atomic_inc(&nfsd_th_cnt); + + set_freezable(); + +@@ -964,7 +960,7 @@ nfsd(void *vrqstp) + svc_recv(rqstp); + } + +- atomic_dec(&nfsdstats.th_cnt); ++ atomic_dec(&nfsd_th_cnt); + + out: + /* Release the thread */ +diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c +index 63797635e1c328..9f606fa08bd4b8 100644 +--- a/fs/nfsd/stats.c ++++ b/fs/nfsd/stats.c +@@ -27,25 +27,22 @@ + + #include "nfsd.h" + +-struct nfsd_stats nfsdstats; +-struct svc_stat nfsd_svcstats = { +- .program = &nfsd_program, +-}; +- + static int nfsd_show(struct seq_file *seq, void *v) + { ++ struct net *net = pde_data(file_inode(seq->file)); ++ struct nfsd_net *nn = net_generic(net, nfsd_net_id); + int i; + + seq_printf(seq, "rc %lld %lld %lld\nfh %lld 0 0 0 0\nio %lld %lld\n", +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_HITS]), +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_MISSES]), +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE]), +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_FH_STALE]), +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_IO_READ]), +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_IO_WRITE])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_HITS]), ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_MISSES]), ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_NOCACHE]), ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_FH_STALE]), ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_READ]), ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_WRITE])); + + /* thread usage: */ +- seq_printf(seq, "th %u 0", atomic_read(&nfsdstats.th_cnt)); ++ seq_printf(seq, "th %u 0", atomic_read(&nfsd_th_cnt)); + + /* deprecated thread usage histogram stats */ + for (i = 0; i < 10; i++) +@@ -55,7 +52,7 @@ static int nfsd_show(struct seq_file *seq, void *v) + seq_puts(seq, "\nra 0 0 0 0 0 0 0 0 0 0 0 0\n"); + + /* show my rpc info */ +- svc_seq_show(seq, &nfsd_svcstats); ++ svc_seq_show(seq, &nn->nfsd_svcstats); + + #ifdef CONFIG_NFSD_V4 + /* Show count for individual nfsv4 operations */ +@@ -63,10 +60,10 @@ static int nfsd_show(struct seq_file *seq, void *v) + seq_printf(seq,"proc4ops %u", LAST_NFS4_OP + 1); + for (i = 0; i <= LAST_NFS4_OP; i++) { + seq_printf(seq, " %lld", +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_NFS4_OP(i)])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_NFS4_OP(i)])); + } + seq_printf(seq, "\nwdeleg_getattr %lld", +- percpu_counter_sum_positive(&nfsdstats.counter[NFSD_STATS_WDELEG_GETATTR])); ++ percpu_counter_sum_positive(&nn->counter[NFSD_STATS_WDELEG_GETATTR])); + + seq_putc(seq, '\n'); + #endif +@@ -76,7 +73,7 @@ static int nfsd_show(struct seq_file *seq, void *v) + + DEFINE_PROC_SHOW_ATTRIBUTE(nfsd); + +-int nfsd_percpu_counters_init(struct percpu_counter counters[], int num) ++int nfsd_percpu_counters_init(struct percpu_counter *counters, int num) + { + int i, err = 0; + +@@ -108,31 +105,24 @@ void nfsd_percpu_counters_destroy(struct percpu_counter counters[], int num) + percpu_counter_destroy(&counters[i]); + } + +-static int nfsd_stat_counters_init(void) ++int nfsd_stat_counters_init(struct nfsd_net *nn) + { +- return nfsd_percpu_counters_init(nfsdstats.counter, NFSD_STATS_COUNTERS_NUM); ++ return nfsd_percpu_counters_init(nn->counter, NFSD_STATS_COUNTERS_NUM); + } + +-static void nfsd_stat_counters_destroy(void) ++void nfsd_stat_counters_destroy(struct nfsd_net *nn) + { +- nfsd_percpu_counters_destroy(nfsdstats.counter, NFSD_STATS_COUNTERS_NUM); ++ nfsd_percpu_counters_destroy(nn->counter, NFSD_STATS_COUNTERS_NUM); + } + +-int nfsd_stat_init(void) ++void nfsd_proc_stat_init(struct net *net) + { +- int err; +- +- err = nfsd_stat_counters_init(); +- if (err) +- return err; ++ struct nfsd_net *nn = net_generic(net, nfsd_net_id); + +- svc_proc_register(&init_net, &nfsd_svcstats, &nfsd_proc_ops); +- +- return 0; ++ svc_proc_register(net, &nn->nfsd_svcstats, &nfsd_proc_ops); + } + +-void nfsd_stat_shutdown(void) ++void nfsd_proc_stat_shutdown(struct net *net) + { +- nfsd_stat_counters_destroy(); +- svc_proc_unregister(&init_net, "nfsd"); ++ svc_proc_unregister(net, "nfsd"); + } +diff --git a/fs/nfsd/stats.h b/fs/nfsd/stats.h +index cf5524e7ca0623..d2753e975dfd34 100644 +--- a/fs/nfsd/stats.h ++++ b/fs/nfsd/stats.h +@@ -10,94 +10,72 @@ + #include + #include + +- +-enum { +- NFSD_STATS_RC_HITS, /* repcache hits */ +- NFSD_STATS_RC_MISSES, /* repcache misses */ +- NFSD_STATS_RC_NOCACHE, /* uncached reqs */ +- NFSD_STATS_FH_STALE, /* FH stale error */ +- NFSD_STATS_IO_READ, /* bytes returned to read requests */ +- NFSD_STATS_IO_WRITE, /* bytes passed in write requests */ +-#ifdef CONFIG_NFSD_V4 +- NFSD_STATS_FIRST_NFS4_OP, /* count of individual nfsv4 operations */ +- NFSD_STATS_LAST_NFS4_OP = NFSD_STATS_FIRST_NFS4_OP + LAST_NFS4_OP, +-#define NFSD_STATS_NFS4_OP(op) (NFSD_STATS_FIRST_NFS4_OP + (op)) +- NFSD_STATS_WDELEG_GETATTR, /* count of getattr conflict with wdeleg */ +-#endif +- NFSD_STATS_COUNTERS_NUM +-}; +- +-struct nfsd_stats { +- struct percpu_counter counter[NFSD_STATS_COUNTERS_NUM]; +- +- atomic_t th_cnt; /* number of available threads */ +-}; +- +-extern struct nfsd_stats nfsdstats; +- +-extern struct svc_stat nfsd_svcstats; +- +-int nfsd_percpu_counters_init(struct percpu_counter counters[], int num); +-void nfsd_percpu_counters_reset(struct percpu_counter counters[], int num); +-void nfsd_percpu_counters_destroy(struct percpu_counter counters[], int num); +-int nfsd_stat_init(void); +-void nfsd_stat_shutdown(void); +- +-static inline void nfsd_stats_rc_hits_inc(void) ++int nfsd_percpu_counters_init(struct percpu_counter *counters, int num); ++void nfsd_percpu_counters_reset(struct percpu_counter *counters, int num); ++void nfsd_percpu_counters_destroy(struct percpu_counter *counters, int num); ++int nfsd_stat_counters_init(struct nfsd_net *nn); ++void nfsd_stat_counters_destroy(struct nfsd_net *nn); ++void nfsd_proc_stat_init(struct net *net); ++void nfsd_proc_stat_shutdown(struct net *net); ++ ++static inline void nfsd_stats_rc_hits_inc(struct nfsd_net *nn) + { +- percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_RC_HITS]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_RC_HITS]); + } + +-static inline void nfsd_stats_rc_misses_inc(void) ++static inline void nfsd_stats_rc_misses_inc(struct nfsd_net *nn) + { +- percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_RC_MISSES]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_RC_MISSES]); + } + +-static inline void nfsd_stats_rc_nocache_inc(void) ++static inline void nfsd_stats_rc_nocache_inc(struct nfsd_net *nn) + { +- percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_RC_NOCACHE]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_RC_NOCACHE]); + } + +-static inline void nfsd_stats_fh_stale_inc(struct svc_export *exp) ++static inline void nfsd_stats_fh_stale_inc(struct nfsd_net *nn, ++ struct svc_export *exp) + { +- percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_FH_STALE]); +- if (exp) +- percpu_counter_inc(&exp->ex_stats.counter[EXP_STATS_FH_STALE]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_FH_STALE]); ++ if (exp && exp->ex_stats) ++ percpu_counter_inc(&exp->ex_stats->counter[EXP_STATS_FH_STALE]); + } + +-static inline void nfsd_stats_io_read_add(struct svc_export *exp, s64 amount) ++static inline void nfsd_stats_io_read_add(struct nfsd_net *nn, ++ struct svc_export *exp, s64 amount) + { +- percpu_counter_add(&nfsdstats.counter[NFSD_STATS_IO_READ], amount); +- if (exp) +- percpu_counter_add(&exp->ex_stats.counter[EXP_STATS_IO_READ], amount); ++ percpu_counter_add(&nn->counter[NFSD_STATS_IO_READ], amount); ++ if (exp && exp->ex_stats) ++ percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_READ], amount); + } + +-static inline void nfsd_stats_io_write_add(struct svc_export *exp, s64 amount) ++static inline void nfsd_stats_io_write_add(struct nfsd_net *nn, ++ struct svc_export *exp, s64 amount) + { +- percpu_counter_add(&nfsdstats.counter[NFSD_STATS_IO_WRITE], amount); +- if (exp) +- percpu_counter_add(&exp->ex_stats.counter[EXP_STATS_IO_WRITE], amount); ++ percpu_counter_add(&nn->counter[NFSD_STATS_IO_WRITE], amount); ++ if (exp && exp->ex_stats) ++ percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_WRITE], amount); + } + + static inline void nfsd_stats_payload_misses_inc(struct nfsd_net *nn) + { +- percpu_counter_inc(&nn->counter[NFSD_NET_PAYLOAD_MISSES]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_PAYLOAD_MISSES]); + } + + static inline void nfsd_stats_drc_mem_usage_add(struct nfsd_net *nn, s64 amount) + { +- percpu_counter_add(&nn->counter[NFSD_NET_DRC_MEM_USAGE], amount); ++ percpu_counter_add(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount); + } + + static inline void nfsd_stats_drc_mem_usage_sub(struct nfsd_net *nn, s64 amount) + { +- percpu_counter_sub(&nn->counter[NFSD_NET_DRC_MEM_USAGE], amount); ++ percpu_counter_sub(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount); + } + + #ifdef CONFIG_NFSD_V4 +-static inline void nfsd_stats_wdeleg_getattr_inc(void) ++static inline void nfsd_stats_wdeleg_getattr_inc(struct nfsd_net *nn) + { +- percpu_counter_inc(&nfsdstats.counter[NFSD_STATS_WDELEG_GETATTR]); ++ percpu_counter_inc(&nn->counter[NFSD_STATS_WDELEG_GETATTR]); + } + #endif + #endif /* _NFSD_STATS_H */ +diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c +index d0fdf70ab20d36..1f2a5b22b6498e 100644 +--- a/fs/nfsd/vfs.c ++++ b/fs/nfsd/vfs.c +@@ -985,7 +985,9 @@ static __be32 nfsd_finish_read(struct svc_rqst *rqstp, struct svc_fh *fhp, + unsigned long *count, u32 *eof, ssize_t host_err) + { + if (host_err >= 0) { +- nfsd_stats_io_read_add(fhp->fh_export, host_err); ++ struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); ++ ++ nfsd_stats_io_read_add(nn, fhp->fh_export, host_err); + *eof = nfsd_eof_on_read(file, offset, host_err, *count); + *count = host_err; + fsnotify_access(file); +@@ -1168,7 +1170,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf, + goto out_nfserr; + } + *cnt = host_err; +- nfsd_stats_io_write_add(exp, *cnt); ++ nfsd_stats_io_write_add(nn, exp, *cnt); + fsnotify_modify(file); + host_err = filemap_check_wb_err(file->f_mapping, since); + if (host_err < 0) +diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c +index 424865dfca74ba..45b687aff700be 100644 +--- a/fs/ntfs3/frecord.c ++++ b/fs/ntfs3/frecord.c +@@ -1896,6 +1896,47 @@ enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr, + return REPARSE_LINK; + } + ++/* ++ * fiemap_fill_next_extent_k - a copy of fiemap_fill_next_extent ++ * but it accepts kernel address for fi_extents_start ++ */ ++static int fiemap_fill_next_extent_k(struct fiemap_extent_info *fieinfo, ++ u64 logical, u64 phys, u64 len, u32 flags) ++{ ++ struct fiemap_extent extent; ++ struct fiemap_extent __user *dest = fieinfo->fi_extents_start; ++ ++ /* only count the extents */ ++ if (fieinfo->fi_extents_max == 0) { ++ fieinfo->fi_extents_mapped++; ++ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; ++ } ++ ++ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max) ++ return 1; ++ ++ if (flags & FIEMAP_EXTENT_DELALLOC) ++ flags |= FIEMAP_EXTENT_UNKNOWN; ++ if (flags & FIEMAP_EXTENT_DATA_ENCRYPTED) ++ flags |= FIEMAP_EXTENT_ENCODED; ++ if (flags & (FIEMAP_EXTENT_DATA_TAIL | FIEMAP_EXTENT_DATA_INLINE)) ++ flags |= FIEMAP_EXTENT_NOT_ALIGNED; ++ ++ memset(&extent, 0, sizeof(extent)); ++ extent.fe_logical = logical; ++ extent.fe_physical = phys; ++ extent.fe_length = len; ++ extent.fe_flags = flags; ++ ++ dest += fieinfo->fi_extents_mapped; ++ memcpy(dest, &extent, sizeof(extent)); ++ ++ fieinfo->fi_extents_mapped++; ++ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max) ++ return 1; ++ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; ++} ++ + /* + * ni_fiemap - Helper for file_fiemap(). + * +@@ -1906,6 +1947,8 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + __u64 vbo, __u64 len) + { + int err = 0; ++ struct fiemap_extent __user *fe_u = fieinfo->fi_extents_start; ++ struct fiemap_extent *fe_k = NULL; + struct ntfs_sb_info *sbi = ni->mi.sbi; + u8 cluster_bits = sbi->cluster_bits; + struct runs_tree *run; +@@ -1953,6 +1996,18 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + goto out; + } + ++ /* ++ * To avoid lock problems replace pointer to user memory by pointer to kernel memory. ++ */ ++ fe_k = kmalloc_array(fieinfo->fi_extents_max, ++ sizeof(struct fiemap_extent), ++ GFP_NOFS | __GFP_ZERO); ++ if (!fe_k) { ++ err = -ENOMEM; ++ goto out; ++ } ++ fieinfo->fi_extents_start = fe_k; ++ + end = vbo + len; + alloc_size = le64_to_cpu(attr->nres.alloc_size); + if (end > alloc_size) +@@ -2041,8 +2096,9 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + if (vbo + dlen >= end) + flags |= FIEMAP_EXTENT_LAST; + +- err = fiemap_fill_next_extent(fieinfo, vbo, lbo, dlen, +- flags); ++ err = fiemap_fill_next_extent_k(fieinfo, vbo, lbo, dlen, ++ flags); ++ + if (err < 0) + break; + if (err == 1) { +@@ -2062,7 +2118,8 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + if (vbo + bytes >= end) + flags |= FIEMAP_EXTENT_LAST; + +- err = fiemap_fill_next_extent(fieinfo, vbo, lbo, bytes, flags); ++ err = fiemap_fill_next_extent_k(fieinfo, vbo, lbo, bytes, ++ flags); + if (err < 0) + break; + if (err == 1) { +@@ -2075,7 +2132,19 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + + up_read(run_lock); + ++ /* ++ * Copy to user memory out of lock ++ */ ++ if (copy_to_user(fe_u, fe_k, ++ fieinfo->fi_extents_max * ++ sizeof(struct fiemap_extent))) { ++ err = -EFAULT; ++ } ++ + out: ++ /* Restore original pointer. */ ++ fieinfo->fi_extents_start = fe_u; ++ kfree(fe_k); + return err; + } + +diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c +index 0f1493e0f6d059..254f6359b287fa 100644 +--- a/fs/quota/quota_tree.c ++++ b/fs/quota/quota_tree.c +@@ -21,6 +21,12 @@ MODULE_AUTHOR("Jan Kara"); + MODULE_DESCRIPTION("Quota trie support"); + MODULE_LICENSE("GPL"); + ++/* ++ * Maximum quota tree depth we support. Only to limit recursion when working ++ * with the tree. ++ */ ++#define MAX_QTREE_DEPTH 6 ++ + #define __QUOTA_QT_PARANOIA + + static int __get_index(struct qtree_mem_dqinfo *info, qid_t id, int depth) +@@ -327,27 +333,36 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, + + /* Insert reference to structure into the trie */ + static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, +- uint *treeblk, int depth) ++ uint *blks, int depth) + { + char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); + int ret = 0, newson = 0, newact = 0; + __le32 *ref; + uint newblk; ++ int i; + + if (!buf) + return -ENOMEM; +- if (!*treeblk) { ++ if (!blks[depth]) { + ret = get_free_dqblk(info); + if (ret < 0) + goto out_buf; +- *treeblk = ret; ++ for (i = 0; i < depth; i++) ++ if (ret == blks[i]) { ++ quota_error(dquot->dq_sb, ++ "Free block already used in tree: block %u", ++ ret); ++ ret = -EIO; ++ goto out_buf; ++ } ++ blks[depth] = ret; + memset(buf, 0, info->dqi_usable_bs); + newact = 1; + } else { +- ret = read_blk(info, *treeblk, buf); ++ ret = read_blk(info, blks[depth], buf); + if (ret < 0) { + quota_error(dquot->dq_sb, "Can't read tree quota " +- "block %u", *treeblk); ++ "block %u", blks[depth]); + goto out_buf; + } + } +@@ -357,8 +372,20 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, + info->dqi_blocks - 1); + if (ret) + goto out_buf; +- if (!newblk) ++ if (!newblk) { + newson = 1; ++ } else { ++ for (i = 0; i <= depth; i++) ++ if (newblk == blks[i]) { ++ quota_error(dquot->dq_sb, ++ "Cycle in quota tree detected: block %u index %u", ++ blks[depth], ++ get_index(info, dquot->dq_id, depth)); ++ ret = -EIO; ++ goto out_buf; ++ } ++ } ++ blks[depth + 1] = newblk; + if (depth == info->dqi_qtree_depth - 1) { + #ifdef __QUOTA_QT_PARANOIA + if (newblk) { +@@ -370,16 +397,16 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, + goto out_buf; + } + #endif +- newblk = find_free_dqentry(info, dquot, &ret); ++ blks[depth + 1] = find_free_dqentry(info, dquot, &ret); + } else { +- ret = do_insert_tree(info, dquot, &newblk, depth+1); ++ ret = do_insert_tree(info, dquot, blks, depth + 1); + } + if (newson && ret >= 0) { + ref[get_index(info, dquot->dq_id, depth)] = +- cpu_to_le32(newblk); +- ret = write_blk(info, *treeblk, buf); ++ cpu_to_le32(blks[depth + 1]); ++ ret = write_blk(info, blks[depth], buf); + } else if (newact && ret < 0) { +- put_free_dqblk(info, buf, *treeblk); ++ put_free_dqblk(info, buf, blks[depth]); + } + out_buf: + kfree(buf); +@@ -390,7 +417,7 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, + static inline int dq_insert_tree(struct qtree_mem_dqinfo *info, + struct dquot *dquot) + { +- int tmp = QT_TREEOFF; ++ uint blks[MAX_QTREE_DEPTH] = { QT_TREEOFF }; + + #ifdef __QUOTA_QT_PARANOIA + if (info->dqi_blocks <= QT_TREEOFF) { +@@ -398,7 +425,11 @@ static inline int dq_insert_tree(struct qtree_mem_dqinfo *info, + return -EIO; + } + #endif +- return do_insert_tree(info, dquot, &tmp, 0); ++ if (info->dqi_qtree_depth >= MAX_QTREE_DEPTH) { ++ quota_error(dquot->dq_sb, "Quota tree depth too big!"); ++ return -EIO; ++ } ++ return do_insert_tree(info, dquot, blks, 0); + } + + /* +@@ -511,19 +542,20 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, + + /* Remove reference to dquot from tree */ + static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, +- uint *blk, int depth) ++ uint *blks, int depth) + { + char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); + int ret = 0; + uint newblk; + __le32 *ref = (__le32 *)buf; ++ int i; + + if (!buf) + return -ENOMEM; +- ret = read_blk(info, *blk, buf); ++ ret = read_blk(info, blks[depth], buf); + if (ret < 0) { + quota_error(dquot->dq_sb, "Can't read quota data block %u", +- *blk); ++ blks[depth]); + goto out_buf; + } + newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); +@@ -532,29 +564,38 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, + if (ret) + goto out_buf; + ++ for (i = 0; i <= depth; i++) ++ if (newblk == blks[i]) { ++ quota_error(dquot->dq_sb, ++ "Cycle in quota tree detected: block %u index %u", ++ blks[depth], ++ get_index(info, dquot->dq_id, depth)); ++ ret = -EIO; ++ goto out_buf; ++ } + if (depth == info->dqi_qtree_depth - 1) { + ret = free_dqentry(info, dquot, newblk); +- newblk = 0; ++ blks[depth + 1] = 0; + } else { +- ret = remove_tree(info, dquot, &newblk, depth+1); ++ blks[depth + 1] = newblk; ++ ret = remove_tree(info, dquot, blks, depth + 1); + } +- if (ret >= 0 && !newblk) { +- int i; ++ if (ret >= 0 && !blks[depth + 1]) { + ref[get_index(info, dquot->dq_id, depth)] = cpu_to_le32(0); + /* Block got empty? */ + for (i = 0; i < (info->dqi_usable_bs >> 2) && !ref[i]; i++) + ; + /* Don't put the root block into the free block list */ + if (i == (info->dqi_usable_bs >> 2) +- && *blk != QT_TREEOFF) { +- put_free_dqblk(info, buf, *blk); +- *blk = 0; ++ && blks[depth] != QT_TREEOFF) { ++ put_free_dqblk(info, buf, blks[depth]); ++ blks[depth] = 0; + } else { +- ret = write_blk(info, *blk, buf); ++ ret = write_blk(info, blks[depth], buf); + if (ret < 0) + quota_error(dquot->dq_sb, + "Can't write quota tree block %u", +- *blk); ++ blks[depth]); + } + } + out_buf: +@@ -565,11 +606,15 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, + /* Delete dquot from tree */ + int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) + { +- uint tmp = QT_TREEOFF; ++ uint blks[MAX_QTREE_DEPTH] = { QT_TREEOFF }; + + if (!dquot->dq_off) /* Even not allocated? */ + return 0; +- return remove_tree(info, dquot, &tmp, 0); ++ if (info->dqi_qtree_depth >= MAX_QTREE_DEPTH) { ++ quota_error(dquot->dq_sb, "Quota tree depth too big!"); ++ return -EIO; ++ } ++ return remove_tree(info, dquot, blks, 0); + } + EXPORT_SYMBOL(qtree_delete_dquot); + +@@ -613,18 +658,20 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, + + /* Find entry for given id in the tree */ + static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, +- struct dquot *dquot, uint blk, int depth) ++ struct dquot *dquot, uint *blks, int depth) + { + char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); + loff_t ret = 0; + __le32 *ref = (__le32 *)buf; ++ uint blk; ++ int i; + + if (!buf) + return -ENOMEM; +- ret = read_blk(info, blk, buf); ++ ret = read_blk(info, blks[depth], buf); + if (ret < 0) { + quota_error(dquot->dq_sb, "Can't read quota tree block %u", +- blk); ++ blks[depth]); + goto out_buf; + } + ret = 0; +@@ -636,8 +683,19 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, + if (ret) + goto out_buf; + ++ /* Check for cycles in the tree */ ++ for (i = 0; i <= depth; i++) ++ if (blk == blks[i]) { ++ quota_error(dquot->dq_sb, ++ "Cycle in quota tree detected: block %u index %u", ++ blks[depth], ++ get_index(info, dquot->dq_id, depth)); ++ ret = -EIO; ++ goto out_buf; ++ } ++ blks[depth + 1] = blk; + if (depth < info->dqi_qtree_depth - 1) +- ret = find_tree_dqentry(info, dquot, blk, depth+1); ++ ret = find_tree_dqentry(info, dquot, blks, depth + 1); + else + ret = find_block_dqentry(info, dquot, blk); + out_buf: +@@ -649,7 +707,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, + static inline loff_t find_dqentry(struct qtree_mem_dqinfo *info, + struct dquot *dquot) + { +- return find_tree_dqentry(info, dquot, QT_TREEOFF, 0); ++ uint blks[MAX_QTREE_DEPTH] = { QT_TREEOFF }; ++ ++ if (info->dqi_qtree_depth >= MAX_QTREE_DEPTH) { ++ quota_error(dquot->dq_sb, "Quota tree depth too big!"); ++ return -EIO; ++ } ++ return find_tree_dqentry(info, dquot, blks, 0); + } + + int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) +diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c +index ae99e7b88205b2..7978ab671e0c6a 100644 +--- a/fs/quota/quota_v2.c ++++ b/fs/quota/quota_v2.c +@@ -166,14 +166,17 @@ static int v2_read_file_info(struct super_block *sb, int type) + i_size_read(sb_dqopt(sb)->files[type])); + goto out_free; + } +- if (qinfo->dqi_free_blk >= qinfo->dqi_blocks) { +- quota_error(sb, "Free block number too big (%u >= %u).", +- qinfo->dqi_free_blk, qinfo->dqi_blocks); ++ if (qinfo->dqi_free_blk && (qinfo->dqi_free_blk <= QT_TREEOFF || ++ qinfo->dqi_free_blk >= qinfo->dqi_blocks)) { ++ quota_error(sb, "Free block number %u out of range (%u, %u).", ++ qinfo->dqi_free_blk, QT_TREEOFF, qinfo->dqi_blocks); + goto out_free; + } +- if (qinfo->dqi_free_entry >= qinfo->dqi_blocks) { +- quota_error(sb, "Block with free entry too big (%u >= %u).", +- qinfo->dqi_free_entry, qinfo->dqi_blocks); ++ if (qinfo->dqi_free_entry && (qinfo->dqi_free_entry <= QT_TREEOFF || ++ qinfo->dqi_free_entry >= qinfo->dqi_blocks)) { ++ quota_error(sb, "Block with free entry %u out of range (%u, %u).", ++ qinfo->dqi_free_entry, QT_TREEOFF, ++ qinfo->dqi_blocks); + goto out_free; + } + ret = 0; +diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c +index 3676e02a0232a4..4ab8cab6ea6147 100644 +--- a/fs/reiserfs/stree.c ++++ b/fs/reiserfs/stree.c +@@ -1407,7 +1407,7 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, + INITIALIZE_PATH(path); + int item_len = 0; + int tb_init = 0; +- struct cpu_key cpu_key; ++ struct cpu_key cpu_key = {}; + int retval; + int quota_cut_bytes = 0; + +diff --git a/fs/romfs/super.c b/fs/romfs/super.c +index 5c35f6c760377e..b1bdfbc211c3c0 100644 +--- a/fs/romfs/super.c ++++ b/fs/romfs/super.c +@@ -593,7 +593,7 @@ static void romfs_kill_sb(struct super_block *sb) + #ifdef CONFIG_ROMFS_ON_BLOCK + if (sb->s_bdev) { + sync_blockdev(sb->s_bdev); +- blkdev_put(sb->s_bdev, sb); ++ bdev_release(sb->s_bdev_handle); + } + #endif + } +diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c +index 581ce951933901..2dc730800f448d 100644 +--- a/fs/squashfs/block.c ++++ b/fs/squashfs/block.c +@@ -321,7 +321,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length, + TRACE("Block @ 0x%llx, %scompressed size %d\n", index - 2, + compressed ? "" : "un", length); + } +- if (length < 0 || length > output->length || ++ if (length <= 0 || length > output->length || + (index + length) > msblk->bytes_used) { + res = -EIO; + goto out; +diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c +index 8ba8c4c5077078..e8df6430444b01 100644 +--- a/fs/squashfs/file.c ++++ b/fs/squashfs/file.c +@@ -544,7 +544,8 @@ static void squashfs_readahead(struct readahead_control *ractl) + struct squashfs_page_actor *actor; + unsigned int nr_pages = 0; + struct page **pages; +- int i, file_end = i_size_read(inode) >> msblk->block_log; ++ int i; ++ loff_t file_end = i_size_read(inode) >> msblk->block_log; + unsigned int max_pages = 1UL << shift; + + readahead_expand(ractl, start, (len | mask) + 1); +diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c +index f1ccad519e28cc..763a3f7a75f6dd 100644 +--- a/fs/squashfs/file_direct.c ++++ b/fs/squashfs/file_direct.c +@@ -26,10 +26,10 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize, + struct inode *inode = target_page->mapping->host; + struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; + +- int file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT; ++ loff_t file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT; + int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1; +- int start_index = target_page->index & ~mask; +- int end_index = start_index | mask; ++ loff_t start_index = target_page->index & ~mask; ++ loff_t end_index = start_index | mask; + int i, n, pages, bytes, res = -ENOMEM; + struct page **page; + struct squashfs_page_actor *actor; +diff --git a/fs/super.c b/fs/super.c +index 576abb1ff0403d..b142e71eb8dfdd 100644 +--- a/fs/super.c ++++ b/fs/super.c +@@ -1490,14 +1490,16 @@ int setup_bdev_super(struct super_block *sb, int sb_flags, + struct fs_context *fc) + { + blk_mode_t mode = sb_open_mode(sb_flags); ++ struct bdev_handle *bdev_handle; + struct block_device *bdev; + +- bdev = blkdev_get_by_dev(sb->s_dev, mode, sb, &fs_holder_ops); +- if (IS_ERR(bdev)) { ++ bdev_handle = bdev_open_by_dev(sb->s_dev, mode, sb, &fs_holder_ops); ++ if (IS_ERR(bdev_handle)) { + if (fc) + errorf(fc, "%s: Can't open blockdev", fc->source); +- return PTR_ERR(bdev); ++ return PTR_ERR(bdev_handle); + } ++ bdev = bdev_handle->bdev; + + /* + * This really should be in blkdev_get_by_dev, but right now can't due +@@ -1505,7 +1507,7 @@ int setup_bdev_super(struct super_block *sb, int sb_flags, + * writable from userspace even for a read-only block device. + */ + if ((mode & BLK_OPEN_WRITE) && bdev_read_only(bdev)) { +- blkdev_put(bdev, sb); ++ bdev_release(bdev_handle); + return -EACCES; + } + +@@ -1521,10 +1523,11 @@ int setup_bdev_super(struct super_block *sb, int sb_flags, + mutex_unlock(&bdev->bd_fsfreeze_mutex); + if (fc) + warnf(fc, "%pg: Can't mount, blockdev is frozen", bdev); +- blkdev_put(bdev, sb); ++ bdev_release(bdev_handle); + return -EBUSY; + } + spin_lock(&sb_lock); ++ sb->s_bdev_handle = bdev_handle; + sb->s_bdev = bdev; + sb->s_bdi = bdi_get(bdev->bd_disk->bdi); + if (bdev_stable_writes(bdev)) +@@ -1657,7 +1660,7 @@ void kill_block_super(struct super_block *sb) + generic_shutdown_super(sb); + if (bdev) { + sync_blockdev(bdev); +- blkdev_put(bdev, sb); ++ bdev_release(sb->s_bdev_handle); + } + } + +diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h +index 265da00a1a8b1b..6eefe5153a6ff7 100644 +--- a/include/linux/cgroup-defs.h ++++ b/include/linux/cgroup-defs.h +@@ -543,6 +543,10 @@ struct cgroup_root { + /* Unique id for this hierarchy. */ + int hierarchy_id; + ++ /* A list running through the active hierarchies */ ++ struct list_head root_list; ++ struct rcu_head rcu; /* Must be near the top */ ++ + /* + * The root cgroup. The containing cgroup_root will be destroyed on its + * release. cgrp->ancestors[0] will be used overflowing into the +@@ -556,9 +560,6 @@ struct cgroup_root { + /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ + atomic_t nr_cgrps; + +- /* A list running through the active hierarchies */ +- struct list_head root_list; +- + /* Hierarchy-specific flags */ + unsigned int flags; + +diff --git a/include/linux/fs.h b/include/linux/fs.h +index 56dce38c478627..43e640fb4a7f77 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -1036,7 +1036,7 @@ struct file_handle { + __u32 handle_bytes; + int handle_type; + /* file identifier */ +- unsigned char f_handle[]; ++ unsigned char f_handle[] __counted_by(handle_bytes); + }; + + static inline struct file *get_file(struct file *f) +@@ -1223,6 +1223,7 @@ struct super_block { + struct hlist_bl_head s_roots; /* alternate root dentries for NFS */ + struct list_head s_mounts; /* list of mounts; _not_ for fs use */ + struct block_device *s_bdev; ++ struct bdev_handle *s_bdev_handle; + struct backing_dev_info *s_bdi; + struct mtd_info *s_mtd; + struct hlist_node s_instances; +diff --git a/include/linux/sockptr.h b/include/linux/sockptr.h +index bae5e2369b4f7a..1c1a5d926b1713 100644 +--- a/include/linux/sockptr.h ++++ b/include/linux/sockptr.h +@@ -50,11 +50,36 @@ static inline int copy_from_sockptr_offset(void *dst, sockptr_t src, + return 0; + } + ++/* Deprecated. ++ * This is unsafe, unless caller checked user provided optlen. ++ * Prefer copy_safe_from_sockptr() instead. ++ */ + static inline int copy_from_sockptr(void *dst, sockptr_t src, size_t size) + { + return copy_from_sockptr_offset(dst, src, 0, size); + } + ++/** ++ * copy_safe_from_sockptr: copy a struct from sockptr ++ * @dst: Destination address, in kernel space. This buffer must be @ksize ++ * bytes long. ++ * @ksize: Size of @dst struct. ++ * @optval: Source address. (in user or kernel space) ++ * @optlen: Size of @optval data. ++ * ++ * Returns: ++ * * -EINVAL: @optlen < @ksize ++ * * -EFAULT: access to userspace failed. ++ * * 0 : @ksize bytes were copied ++ */ ++static inline int copy_safe_from_sockptr(void *dst, size_t ksize, ++ sockptr_t optval, unsigned int optlen) ++{ ++ if (optlen < ksize) ++ return -EINVAL; ++ return copy_from_sockptr(dst, optval, ksize); ++} ++ + static inline int copy_to_sockptr_offset(sockptr_t dst, size_t offset, + const void *src, size_t size) + { +diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h +index dbf5b21feafe48..3d8b215f32d5b0 100644 +--- a/include/linux/sunrpc/svc.h ++++ b/include/linux/sunrpc/svc.h +@@ -336,7 +336,6 @@ struct svc_program { + const struct svc_version **pg_vers; /* version array */ + char * pg_name; /* service name */ + char * pg_class; /* class name: services sharing authentication */ +- struct svc_stat * pg_stats; /* rpc statistics */ + enum svc_auth_status (*pg_authenticate)(struct svc_rqst *rqstp); + __be32 (*pg_init_request)(struct svc_rqst *, + const struct svc_program *, +@@ -408,7 +407,9 @@ bool svc_rqst_replace_page(struct svc_rqst *rqstp, + void svc_rqst_release_pages(struct svc_rqst *rqstp); + void svc_rqst_free(struct svc_rqst *); + void svc_exit_thread(struct svc_rqst *); +-struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, ++struct svc_serv * svc_create_pooled(struct svc_program *prog, ++ struct svc_stat *stats, ++ unsigned int bufsize, + int (*threadfn)(void *data)); + int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); + int svc_pool_stats_open(struct svc_serv *serv, struct file *file); +diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h +index fb09fd1767f289..ba6e346c8d669a 100644 +--- a/include/uapi/linux/bpf.h ++++ b/include/uapi/linux/bpf.h +@@ -77,12 +77,29 @@ struct bpf_insn { + __s32 imm; /* signed immediate constant */ + }; + +-/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ ++/* Deprecated: use struct bpf_lpm_trie_key_u8 (when the "data" member is needed for ++ * byte access) or struct bpf_lpm_trie_key_hdr (when using an alternative type for ++ * the trailing flexible array member) instead. ++ */ + struct bpf_lpm_trie_key { + __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */ + __u8 data[0]; /* Arbitrary size */ + }; + ++/* Header for bpf_lpm_trie_key structs */ ++struct bpf_lpm_trie_key_hdr { ++ __u32 prefixlen; ++}; ++ ++/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry, with trailing byte array. */ ++struct bpf_lpm_trie_key_u8 { ++ union { ++ struct bpf_lpm_trie_key_hdr hdr; ++ __u32 prefixlen; ++ }; ++ __u8 data[]; /* Arbitrary size */ ++}; ++ + struct bpf_cgroup_storage_key { + __u64 cgroup_inode_id; /* cgroup inode id */ + __u32 attach_type; /* program attach type (enum bpf_attach_type) */ +diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c +index b32be680da6cdc..d0febf07051edf 100644 +--- a/kernel/bpf/lpm_trie.c ++++ b/kernel/bpf/lpm_trie.c +@@ -164,13 +164,13 @@ static inline int extract_bit(const u8 *data, size_t index) + */ + static size_t longest_prefix_match(const struct lpm_trie *trie, + const struct lpm_trie_node *node, +- const struct bpf_lpm_trie_key *key) ++ const struct bpf_lpm_trie_key_u8 *key) + { + u32 limit = min(node->prefixlen, key->prefixlen); + u32 prefixlen = 0, i = 0; + + BUILD_BUG_ON(offsetof(struct lpm_trie_node, data) % sizeof(u32)); +- BUILD_BUG_ON(offsetof(struct bpf_lpm_trie_key, data) % sizeof(u32)); ++ BUILD_BUG_ON(offsetof(struct bpf_lpm_trie_key_u8, data) % sizeof(u32)); + + #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && defined(CONFIG_64BIT) + +@@ -229,7 +229,7 @@ static void *trie_lookup_elem(struct bpf_map *map, void *_key) + { + struct lpm_trie *trie = container_of(map, struct lpm_trie, map); + struct lpm_trie_node *node, *found = NULL; +- struct bpf_lpm_trie_key *key = _key; ++ struct bpf_lpm_trie_key_u8 *key = _key; + + if (key->prefixlen > trie->max_prefixlen) + return NULL; +@@ -308,8 +308,9 @@ static long trie_update_elem(struct bpf_map *map, + { + struct lpm_trie *trie = container_of(map, struct lpm_trie, map); + struct lpm_trie_node *node, *im_node = NULL, *new_node = NULL; ++ struct lpm_trie_node *free_node = NULL; + struct lpm_trie_node __rcu **slot; +- struct bpf_lpm_trie_key *key = _key; ++ struct bpf_lpm_trie_key_u8 *key = _key; + unsigned long irq_flags; + unsigned int next_bit; + size_t matchlen = 0; +@@ -382,7 +383,7 @@ static long trie_update_elem(struct bpf_map *map, + trie->n_entries--; + + rcu_assign_pointer(*slot, new_node); +- kfree_rcu(node, rcu); ++ free_node = node; + + goto out; + } +@@ -429,6 +430,7 @@ static long trie_update_elem(struct bpf_map *map, + } + + spin_unlock_irqrestore(&trie->lock, irq_flags); ++ kfree_rcu(free_node, rcu); + + return ret; + } +@@ -437,7 +439,8 @@ static long trie_update_elem(struct bpf_map *map, + static long trie_delete_elem(struct bpf_map *map, void *_key) + { + struct lpm_trie *trie = container_of(map, struct lpm_trie, map); +- struct bpf_lpm_trie_key *key = _key; ++ struct lpm_trie_node *free_node = NULL, *free_parent = NULL; ++ struct bpf_lpm_trie_key_u8 *key = _key; + struct lpm_trie_node __rcu **trim, **trim2; + struct lpm_trie_node *node, *parent; + unsigned long irq_flags; +@@ -506,8 +509,8 @@ static long trie_delete_elem(struct bpf_map *map, void *_key) + else + rcu_assign_pointer( + *trim2, rcu_access_pointer(parent->child[0])); +- kfree_rcu(parent, rcu); +- kfree_rcu(node, rcu); ++ free_parent = parent; ++ free_node = node; + goto out; + } + +@@ -521,10 +524,12 @@ static long trie_delete_elem(struct bpf_map *map, void *_key) + rcu_assign_pointer(*trim, rcu_access_pointer(node->child[1])); + else + RCU_INIT_POINTER(*trim, NULL); +- kfree_rcu(node, rcu); ++ free_node = node; + + out: + spin_unlock_irqrestore(&trie->lock, irq_flags); ++ kfree_rcu(free_parent, rcu); ++ kfree_rcu(free_node, rcu); + + return ret; + } +@@ -536,7 +541,7 @@ static long trie_delete_elem(struct bpf_map *map, void *_key) + sizeof(struct lpm_trie_node)) + #define LPM_VAL_SIZE_MIN 1 + +-#define LPM_KEY_SIZE(X) (sizeof(struct bpf_lpm_trie_key) + (X)) ++#define LPM_KEY_SIZE(X) (sizeof(struct bpf_lpm_trie_key_u8) + (X)) + #define LPM_KEY_SIZE_MAX LPM_KEY_SIZE(LPM_DATA_SIZE_MAX) + #define LPM_KEY_SIZE_MIN LPM_KEY_SIZE(LPM_DATA_SIZE_MIN) + +@@ -565,7 +570,7 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr) + /* copy mandatory map attributes */ + bpf_map_init_from_attr(&trie->map, attr); + trie->data_size = attr->key_size - +- offsetof(struct bpf_lpm_trie_key, data); ++ offsetof(struct bpf_lpm_trie_key_u8, data); + trie->max_prefixlen = trie->data_size * 8; + + spin_lock_init(&trie->lock); +@@ -616,7 +621,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key) + { + struct lpm_trie_node *node, *next_node = NULL, *parent, *search_root; + struct lpm_trie *trie = container_of(map, struct lpm_trie, map); +- struct bpf_lpm_trie_key *key = _key, *next_key = _next_key; ++ struct bpf_lpm_trie_key_u8 *key = _key, *next_key = _next_key; + struct lpm_trie_node **node_stack = NULL; + int err = 0, stack_ptr = -1; + unsigned int next_bit; +@@ -703,7 +708,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key) + } + do_copy: + next_key->prefixlen = next_node->prefixlen; +- memcpy((void *)next_key + offsetof(struct bpf_lpm_trie_key, data), ++ memcpy((void *)next_key + offsetof(struct bpf_lpm_trie_key_u8, data), + next_node->data, trie->data_size); + free_stack: + kfree(node_stack); +@@ -715,7 +720,7 @@ static int trie_check_btf(const struct bpf_map *map, + const struct btf_type *key_type, + const struct btf_type *value_type) + { +- /* Keys must have struct bpf_lpm_trie_key embedded. */ ++ /* Keys must have struct bpf_lpm_trie_key_u8 embedded. */ + return BTF_INFO_KIND(key_type->info) != BTF_KIND_STRUCT ? + -EINVAL : 0; + } +diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h +index c56071f150f2ae..5e17f01ced9fd2 100644 +--- a/kernel/cgroup/cgroup-internal.h ++++ b/kernel/cgroup/cgroup-internal.h +@@ -170,7 +170,8 @@ extern struct list_head cgroup_roots; + + /* iterate across the hierarchies */ + #define for_each_root(root) \ +- list_for_each_entry((root), &cgroup_roots, root_list) ++ list_for_each_entry_rcu((root), &cgroup_roots, root_list, \ ++ lockdep_is_held(&cgroup_mutex)) + + /** + * for_each_subsys - iterate all enabled cgroup subsystems +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c +index 094f513319259d..d872fff901073f 100644 +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -1313,7 +1313,7 @@ static void cgroup_exit_root_id(struct cgroup_root *root) + + void cgroup_free_root(struct cgroup_root *root) + { +- kfree(root); ++ kfree_rcu(root, rcu); + } + + static void cgroup_destroy_root(struct cgroup_root *root) +@@ -1346,7 +1346,7 @@ static void cgroup_destroy_root(struct cgroup_root *root) + spin_unlock_irq(&css_set_lock); + + if (!list_empty(&root->root_list)) { +- list_del(&root->root_list); ++ list_del_rcu(&root->root_list); + cgroup_root_count--; + } + +@@ -1386,7 +1386,15 @@ static inline struct cgroup *__cset_cgroup_from_root(struct css_set *cset, + } + } + +- BUG_ON(!res_cgroup); ++ /* ++ * If cgroup_mutex is not held, the cgrp_cset_link will be freed ++ * before we remove the cgroup root from the root_list. Consequently, ++ * when accessing a cgroup root, the cset_link may have already been ++ * freed, resulting in a NULL res_cgroup. However, by holding the ++ * cgroup_mutex, we ensure that res_cgroup can't be NULL. ++ * If we don't hold cgroup_mutex in the caller, we must do the NULL ++ * check. ++ */ + return res_cgroup; + } + +@@ -1445,7 +1453,6 @@ static struct cgroup *current_cgns_cgroup_dfl(void) + static struct cgroup *cset_cgroup_from_root(struct css_set *cset, + struct cgroup_root *root) + { +- lockdep_assert_held(&cgroup_mutex); + lockdep_assert_held(&css_set_lock); + + return __cset_cgroup_from_root(cset, root); +@@ -1453,7 +1460,9 @@ static struct cgroup *cset_cgroup_from_root(struct css_set *cset, + + /* + * Return the cgroup for "task" from the given hierarchy. Must be +- * called with cgroup_mutex and css_set_lock held. ++ * called with css_set_lock held to prevent task's groups from being modified. ++ * Must be called with either cgroup_mutex or rcu read lock to prevent the ++ * cgroup root from being destroyed. + */ + struct cgroup *task_cgroup_from_root(struct task_struct *task, + struct cgroup_root *root) +@@ -2014,7 +2023,7 @@ void init_cgroup_root(struct cgroup_fs_context *ctx) + struct cgroup_root *root = ctx->root; + struct cgroup *cgrp = &root->cgrp; + +- INIT_LIST_HEAD(&root->root_list); ++ INIT_LIST_HEAD_RCU(&root->root_list); + atomic_set(&root->nr_cgrps, 1); + cgrp->root = root; + init_cgroup_housekeeping(cgrp); +@@ -2097,7 +2106,7 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask) + * care of subsystems' refcounts, which are explicitly dropped in + * the failure exit path. + */ +- list_add(&root->root_list, &cgroup_roots); ++ list_add_rcu(&root->root_list, &cgroup_roots); + cgroup_root_count++; + + /* +diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c +index 5ecd072a34fe72..eb86283901565b 100644 +--- a/kernel/irq/cpuhotplug.c ++++ b/kernel/irq/cpuhotplug.c +@@ -130,6 +130,22 @@ static bool migrate_one_irq(struct irq_desc *desc) + * CPU. + */ + err = irq_do_set_affinity(d, affinity, false); ++ ++ /* ++ * If there are online CPUs in the affinity mask, but they have no ++ * vectors left to make the migration work, try to break the ++ * affinity by migrating to any online CPU. ++ */ ++ if (err == -ENOSPC && !irqd_affinity_is_managed(d) && affinity != cpu_online_mask) { ++ pr_debug("IRQ%u: set affinity failed for %*pbl, re-try with online CPUs\n", ++ d->irq, cpumask_pr_args(affinity)); ++ ++ affinity = cpu_online_mask; ++ brokeaff = true; ++ ++ err = irq_do_set_affinity(d, affinity, false); ++ } ++ + if (err) { + pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", + d->irq, err); +@@ -195,10 +211,15 @@ static void irq_restore_affinity_of_irq(struct irq_desc *desc, unsigned int cpu) + !irq_data_get_irq_chip(data) || !cpumask_test_cpu(cpu, affinity)) + return; + +- if (irqd_is_managed_and_shutdown(data)) { +- irq_startup(desc, IRQ_RESEND, IRQ_START_COND); ++ /* ++ * Don't restore suspended interrupts here when a system comes back ++ * from S3. They are reenabled via resume_device_irqs(). ++ */ ++ if (desc->istate & IRQS_SUSPENDED) + return; +- } ++ ++ if (irqd_is_managed_and_shutdown(data)) ++ irq_startup(desc, IRQ_RESEND, IRQ_START_COND); + + /* + * If the interrupt can only be directed to a single target +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c +index a054cd5ec08bce..8a936c1ffad390 100644 +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -796,10 +796,14 @@ void __enable_irq(struct irq_desc *desc) + irq_settings_set_noprobe(desc); + /* + * Call irq_startup() not irq_enable() here because the +- * interrupt might be marked NOAUTOEN. So irq_startup() +- * needs to be invoked when it gets enabled the first +- * time. If it was already started up, then irq_startup() +- * will invoke irq_enable() under the hood. ++ * interrupt might be marked NOAUTOEN so irq_startup() ++ * needs to be invoked when it gets enabled the first time. ++ * This is also required when __enable_irq() is invoked for ++ * a managed and shutdown interrupt from the S3 resume ++ * path. ++ * ++ * If it was already started up, then irq_startup() will ++ * invoke irq_enable() under the hood. + */ + irq_startup(desc, IRQ_RESEND, IRQ_START_FORCE); + break; +diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c +index 13f0d11927074a..68af76ca8bc992 100644 +--- a/mm/debug_vm_pgtable.c ++++ b/mm/debug_vm_pgtable.c +@@ -39,22 +39,7 @@ + * Please refer Documentation/mm/arch_pgtable_helpers.rst for the semantics + * expectations that are being validated here. All future changes in here + * or the documentation need to be in sync. +- * +- * On s390 platform, the lower 4 bits are used to identify given page table +- * entry type. But these bits might affect the ability to clear entries with +- * pxx_clear() because of how dynamic page table folding works on s390. So +- * while loading up the entries do not change the lower 4 bits. It does not +- * have affect any other platform. Also avoid the 62nd bit on ppc64 that is +- * used to mark a pte entry. + */ +-#define S390_SKIP_MASK GENMASK(3, 0) +-#if __BITS_PER_LONG == 64 +-#define PPC64_SKIP_MASK GENMASK(62, 62) +-#else +-#define PPC64_SKIP_MASK 0x0 +-#endif +-#define ARCH_SKIP_MASK (S390_SKIP_MASK | PPC64_SKIP_MASK) +-#define RANDOM_ORVALUE (GENMASK(BITS_PER_LONG - 1, 0) & ~ARCH_SKIP_MASK) + #define RANDOM_NZVALUE GENMASK(7, 0) + + struct pgtable_debug_args { +@@ -510,8 +495,7 @@ static void __init pud_clear_tests(struct pgtable_debug_args *args) + return; + + pr_debug("Validating PUD clear\n"); +- pud = __pud(pud_val(pud) | RANDOM_ORVALUE); +- WRITE_ONCE(*args->pudp, pud); ++ WARN_ON(pud_none(pud)); + pud_clear(args->pudp); + pud = READ_ONCE(*args->pudp); + WARN_ON(!pud_none(pud)); +@@ -547,8 +531,7 @@ static void __init p4d_clear_tests(struct pgtable_debug_args *args) + return; + + pr_debug("Validating P4D clear\n"); +- p4d = __p4d(p4d_val(p4d) | RANDOM_ORVALUE); +- WRITE_ONCE(*args->p4dp, p4d); ++ WARN_ON(p4d_none(p4d)); + p4d_clear(args->p4dp); + p4d = READ_ONCE(*args->p4dp); + WARN_ON(!p4d_none(p4d)); +@@ -581,8 +564,7 @@ static void __init pgd_clear_tests(struct pgtable_debug_args *args) + return; + + pr_debug("Validating PGD clear\n"); +- pgd = __pgd(pgd_val(pgd) | RANDOM_ORVALUE); +- WRITE_ONCE(*args->pgdp, pgd); ++ WARN_ON(pgd_none(pgd)); + pgd_clear(args->pgdp); + pgd = READ_ONCE(*args->pgdp); + WARN_ON(!pgd_none(pgd)); +@@ -633,10 +615,8 @@ static void __init pte_clear_tests(struct pgtable_debug_args *args) + if (WARN_ON(!args->ptep)) + return; + +-#ifndef CONFIG_RISCV +- pte = __pte(pte_val(pte) | RANDOM_ORVALUE); +-#endif + set_pte_at(args->mm, args->vaddr, args->ptep, pte); ++ WARN_ON(pte_none(pte)); + flush_dcache_page(page); + barrier(); + ptep_clear(args->mm, args->vaddr, args->ptep); +@@ -649,8 +629,7 @@ static void __init pmd_clear_tests(struct pgtable_debug_args *args) + pmd_t pmd = READ_ONCE(*args->pmdp); + + pr_debug("Validating PMD clear\n"); +- pmd = __pmd(pmd_val(pmd) | RANDOM_ORVALUE); +- WRITE_ONCE(*args->pmdp, pmd); ++ WARN_ON(pmd_none(pmd)); + pmd_clear(args->pmdp); + pmd = READ_ONCE(*args->pmdp); + WARN_ON(!pmd_none(pmd)); +diff --git a/mm/gup.c b/mm/gup.c +index f50fe2219a13b6..fdd75384160d8d 100644 +--- a/mm/gup.c ++++ b/mm/gup.c +@@ -97,95 +97,6 @@ static inline struct folio *try_get_folio(struct page *page, int refs) + return folio; + } + +-/** +- * try_grab_folio() - Attempt to get or pin a folio. +- * @page: pointer to page to be grabbed +- * @refs: the value to (effectively) add to the folio's refcount +- * @flags: gup flags: these are the FOLL_* flag values. +- * +- * "grab" names in this file mean, "look at flags to decide whether to use +- * FOLL_PIN or FOLL_GET behavior, when incrementing the folio's refcount. +- * +- * Either FOLL_PIN or FOLL_GET (or neither) must be set, but not both at the +- * same time. (That's true throughout the get_user_pages*() and +- * pin_user_pages*() APIs.) Cases: +- * +- * FOLL_GET: folio's refcount will be incremented by @refs. +- * +- * FOLL_PIN on large folios: folio's refcount will be incremented by +- * @refs, and its pincount will be incremented by @refs. +- * +- * FOLL_PIN on single-page folios: folio's refcount will be incremented by +- * @refs * GUP_PIN_COUNTING_BIAS. +- * +- * Return: The folio containing @page (with refcount appropriately +- * incremented) for success, or NULL upon failure. If neither FOLL_GET +- * nor FOLL_PIN was set, that's considered failure, and furthermore, +- * a likely bug in the caller, so a warning is also emitted. +- */ +-struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags) +-{ +- struct folio *folio; +- +- if (WARN_ON_ONCE((flags & (FOLL_GET | FOLL_PIN)) == 0)) +- return NULL; +- +- if (unlikely(!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(page))) +- return NULL; +- +- if (flags & FOLL_GET) +- return try_get_folio(page, refs); +- +- /* FOLL_PIN is set */ +- +- /* +- * Don't take a pin on the zero page - it's not going anywhere +- * and it is used in a *lot* of places. +- */ +- if (is_zero_page(page)) +- return page_folio(page); +- +- folio = try_get_folio(page, refs); +- if (!folio) +- return NULL; +- +- /* +- * Can't do FOLL_LONGTERM + FOLL_PIN gup fast path if not in a +- * right zone, so fail and let the caller fall back to the slow +- * path. +- */ +- if (unlikely((flags & FOLL_LONGTERM) && +- !folio_is_longterm_pinnable(folio))) { +- if (!put_devmap_managed_page_refs(&folio->page, refs)) +- folio_put_refs(folio, refs); +- return NULL; +- } +- +- /* +- * When pinning a large folio, use an exact count to track it. +- * +- * However, be sure to *also* increment the normal folio +- * refcount field at least once, so that the folio really +- * is pinned. That's why the refcount from the earlier +- * try_get_folio() is left intact. +- */ +- if (folio_test_large(folio)) +- atomic_add(refs, &folio->_pincount); +- else +- folio_ref_add(folio, +- refs * (GUP_PIN_COUNTING_BIAS - 1)); +- /* +- * Adjust the pincount before re-checking the PTE for changes. +- * This is essentially a smp_mb() and is paired with a memory +- * barrier in page_try_share_anon_rmap(). +- */ +- smp_mb__after_atomic(); +- +- node_stat_mod_folio(folio, NR_FOLL_PIN_ACQUIRED, refs); +- +- return folio; +-} +- + static void gup_put_folio(struct folio *folio, int refs, unsigned int flags) + { + if (flags & FOLL_PIN) { +@@ -203,58 +114,59 @@ static void gup_put_folio(struct folio *folio, int refs, unsigned int flags) + } + + /** +- * try_grab_page() - elevate a page's refcount by a flag-dependent amount +- * @page: pointer to page to be grabbed +- * @flags: gup flags: these are the FOLL_* flag values. ++ * try_grab_folio() - add a folio's refcount by a flag-dependent amount ++ * @folio: pointer to folio to be grabbed ++ * @refs: the value to (effectively) add to the folio's refcount ++ * @flags: gup flags: these are the FOLL_* flag values + * + * This might not do anything at all, depending on the flags argument. + * + * "grab" names in this file mean, "look at flags to decide whether to use +- * FOLL_PIN or FOLL_GET behavior, when incrementing the page's refcount. ++ * FOLL_PIN or FOLL_GET behavior, when incrementing the folio's refcount. + * + * Either FOLL_PIN or FOLL_GET (or neither) may be set, but not both at the same +- * time. Cases: please see the try_grab_folio() documentation, with +- * "refs=1". ++ * time. + * + * Return: 0 for success, or if no action was required (if neither FOLL_PIN + * nor FOLL_GET was set, nothing is done). A negative error code for failure: + * +- * -ENOMEM FOLL_GET or FOLL_PIN was set, but the page could not ++ * -ENOMEM FOLL_GET or FOLL_PIN was set, but the folio could not + * be grabbed. ++ * ++ * It is called when we have a stable reference for the folio, typically in ++ * GUP slow path. + */ +-int __must_check try_grab_page(struct page *page, unsigned int flags) ++int __must_check try_grab_folio(struct folio *folio, int refs, ++ unsigned int flags) + { +- struct folio *folio = page_folio(page); +- + if (WARN_ON_ONCE(folio_ref_count(folio) <= 0)) + return -ENOMEM; + +- if (unlikely(!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(page))) ++ if (unlikely(!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(&folio->page))) + return -EREMOTEIO; + + if (flags & FOLL_GET) +- folio_ref_inc(folio); ++ folio_ref_add(folio, refs); + else if (flags & FOLL_PIN) { + /* + * Don't take a pin on the zero page - it's not going anywhere + * and it is used in a *lot* of places. + */ +- if (is_zero_page(page)) ++ if (is_zero_folio(folio)) + return 0; + + /* +- * Similar to try_grab_folio(): be sure to *also* +- * increment the normal page refcount field at least once, ++ * Increment the normal page refcount field at least once, + * so that the page really is pinned. + */ + if (folio_test_large(folio)) { +- folio_ref_add(folio, 1); +- atomic_add(1, &folio->_pincount); ++ folio_ref_add(folio, refs); ++ atomic_add(refs, &folio->_pincount); + } else { +- folio_ref_add(folio, GUP_PIN_COUNTING_BIAS); ++ folio_ref_add(folio, refs * GUP_PIN_COUNTING_BIAS); + } + +- node_stat_mod_folio(folio, NR_FOLL_PIN_ACQUIRED, 1); ++ node_stat_mod_folio(folio, NR_FOLL_PIN_ACQUIRED, refs); + } + + return 0; +@@ -647,8 +559,8 @@ static struct page *follow_page_pte(struct vm_area_struct *vma, + VM_BUG_ON_PAGE((flags & FOLL_PIN) && PageAnon(page) && + !PageAnonExclusive(page), page); + +- /* try_grab_page() does nothing unless FOLL_GET or FOLL_PIN is set. */ +- ret = try_grab_page(page, flags); ++ /* try_grab_folio() does nothing unless FOLL_GET or FOLL_PIN is set. */ ++ ret = try_grab_folio(page_folio(page), 1, flags); + if (unlikely(ret)) { + page = ERR_PTR(ret); + goto out; +@@ -899,7 +811,7 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, + goto unmap; + *page = pte_page(entry); + } +- ret = try_grab_page(*page, gup_flags); ++ ret = try_grab_folio(page_folio(*page), 1, gup_flags); + if (unlikely(ret)) + goto unmap; + out: +@@ -1302,20 +1214,19 @@ static long __get_user_pages(struct mm_struct *mm, + * pages. + */ + if (page_increm > 1) { +- struct folio *folio; ++ struct folio *folio = page_folio(page); + + /* + * Since we already hold refcount on the + * large folio, this should never fail. + */ +- folio = try_grab_folio(page, page_increm - 1, +- foll_flags); +- if (WARN_ON_ONCE(!folio)) { ++ if (try_grab_folio(folio, page_increm - 1, ++ foll_flags)) { + /* + * Release the 1st page ref if the + * folio is problematic, fail hard. + */ +- gup_put_folio(page_folio(page), 1, ++ gup_put_folio(folio, 1, + foll_flags); + ret = -EFAULT; + goto out; +@@ -2541,6 +2452,102 @@ static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start, + } + } + ++/** ++ * try_grab_folio_fast() - Attempt to get or pin a folio in fast path. ++ * @page: pointer to page to be grabbed ++ * @refs: the value to (effectively) add to the folio's refcount ++ * @flags: gup flags: these are the FOLL_* flag values. ++ * ++ * "grab" names in this file mean, "look at flags to decide whether to use ++ * FOLL_PIN or FOLL_GET behavior, when incrementing the folio's refcount. ++ * ++ * Either FOLL_PIN or FOLL_GET (or neither) must be set, but not both at the ++ * same time. (That's true throughout the get_user_pages*() and ++ * pin_user_pages*() APIs.) Cases: ++ * ++ * FOLL_GET: folio's refcount will be incremented by @refs. ++ * ++ * FOLL_PIN on large folios: folio's refcount will be incremented by ++ * @refs, and its pincount will be incremented by @refs. ++ * ++ * FOLL_PIN on single-page folios: folio's refcount will be incremented by ++ * @refs * GUP_PIN_COUNTING_BIAS. ++ * ++ * Return: The folio containing @page (with refcount appropriately ++ * incremented) for success, or NULL upon failure. If neither FOLL_GET ++ * nor FOLL_PIN was set, that's considered failure, and furthermore, ++ * a likely bug in the caller, so a warning is also emitted. ++ * ++ * It uses add ref unless zero to elevate the folio refcount and must be called ++ * in fast path only. ++ */ ++static struct folio *try_grab_folio_fast(struct page *page, int refs, ++ unsigned int flags) ++{ ++ struct folio *folio; ++ ++ /* Raise warn if it is not called in fast GUP */ ++ VM_WARN_ON_ONCE(!irqs_disabled()); ++ ++ if (WARN_ON_ONCE((flags & (FOLL_GET | FOLL_PIN)) == 0)) ++ return NULL; ++ ++ if (unlikely(!(flags & FOLL_PCI_P2PDMA) && is_pci_p2pdma_page(page))) ++ return NULL; ++ ++ if (flags & FOLL_GET) ++ return try_get_folio(page, refs); ++ ++ /* FOLL_PIN is set */ ++ ++ /* ++ * Don't take a pin on the zero page - it's not going anywhere ++ * and it is used in a *lot* of places. ++ */ ++ if (is_zero_page(page)) ++ return page_folio(page); ++ ++ folio = try_get_folio(page, refs); ++ if (!folio) ++ return NULL; ++ ++ /* ++ * Can't do FOLL_LONGTERM + FOLL_PIN gup fast path if not in a ++ * right zone, so fail and let the caller fall back to the slow ++ * path. ++ */ ++ if (unlikely((flags & FOLL_LONGTERM) && ++ !folio_is_longterm_pinnable(folio))) { ++ if (!put_devmap_managed_page_refs(&folio->page, refs)) ++ folio_put_refs(folio, refs); ++ return NULL; ++ } ++ ++ /* ++ * When pinning a large folio, use an exact count to track it. ++ * ++ * However, be sure to *also* increment the normal folio ++ * refcount field at least once, so that the folio really ++ * is pinned. That's why the refcount from the earlier ++ * try_get_folio() is left intact. ++ */ ++ if (folio_test_large(folio)) ++ atomic_add(refs, &folio->_pincount); ++ else ++ folio_ref_add(folio, ++ refs * (GUP_PIN_COUNTING_BIAS - 1)); ++ /* ++ * Adjust the pincount before re-checking the PTE for changes. ++ * This is essentially a smp_mb() and is paired with a memory ++ * barrier in folio_try_share_anon_rmap_*(). ++ */ ++ smp_mb__after_atomic(); ++ ++ node_stat_mod_folio(folio, NR_FOLL_PIN_ACQUIRED, refs); ++ ++ return folio; ++} ++ + #ifdef CONFIG_ARCH_HAS_PTE_SPECIAL + /* + * Fast-gup relies on pte change detection to avoid concurrent pgtable +@@ -2605,7 +2612,7 @@ static int gup_pte_range(pmd_t pmd, pmd_t *pmdp, unsigned long addr, + VM_BUG_ON(!pfn_valid(pte_pfn(pte))); + page = pte_page(pte); + +- folio = try_grab_folio(page, 1, flags); ++ folio = try_grab_folio_fast(page, 1, flags); + if (!folio) + goto pte_unmap; + +@@ -2699,7 +2706,7 @@ static int __gup_device_huge(unsigned long pfn, unsigned long addr, + + SetPageReferenced(page); + pages[*nr] = page; +- if (unlikely(try_grab_page(page, flags))) { ++ if (unlikely(try_grab_folio(page_folio(page), 1, flags))) { + undo_dev_pagemap(nr, nr_start, flags, pages); + break; + } +@@ -2808,7 +2815,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, + page = nth_page(pte_page(pte), (addr & (sz - 1)) >> PAGE_SHIFT); + refs = record_subpages(page, addr, end, pages + *nr); + +- folio = try_grab_folio(page, refs, flags); ++ folio = try_grab_folio_fast(page, refs, flags); + if (!folio) + return 0; + +@@ -2879,7 +2886,7 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, + page = nth_page(pmd_page(orig), (addr & ~PMD_MASK) >> PAGE_SHIFT); + refs = record_subpages(page, addr, end, pages + *nr); + +- folio = try_grab_folio(page, refs, flags); ++ folio = try_grab_folio_fast(page, refs, flags); + if (!folio) + return 0; + +@@ -2923,7 +2930,7 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, + page = nth_page(pud_page(orig), (addr & ~PUD_MASK) >> PAGE_SHIFT); + refs = record_subpages(page, addr, end, pages + *nr); + +- folio = try_grab_folio(page, refs, flags); ++ folio = try_grab_folio_fast(page, refs, flags); + if (!folio) + return 0; + +@@ -2963,7 +2970,7 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr, + page = nth_page(pgd_page(orig), (addr & ~PGDIR_MASK) >> PAGE_SHIFT); + refs = record_subpages(page, addr, end, pages + *nr); + +- folio = try_grab_folio(page, refs, flags); ++ folio = try_grab_folio_fast(page, refs, flags); + if (!folio) + return 0; + +diff --git a/mm/huge_memory.c b/mm/huge_memory.c +index 7ac2877e76629b..f2816c9a1f3ec8 100644 +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -1056,7 +1056,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr, + if (!*pgmap) + return ERR_PTR(-EFAULT); + page = pfn_to_page(pfn); +- ret = try_grab_page(page, flags); ++ ret = try_grab_folio(page_folio(page), 1, flags); + if (ret) + page = ERR_PTR(ret); + +@@ -1214,7 +1214,7 @@ struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr, + return ERR_PTR(-EFAULT); + page = pfn_to_page(pfn); + +- ret = try_grab_page(page, flags); ++ ret = try_grab_folio(page_folio(page), 1, flags); + if (ret) + page = ERR_PTR(ret); + +@@ -1475,7 +1475,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, + VM_BUG_ON_PAGE((flags & FOLL_PIN) && PageAnon(page) && + !PageAnonExclusive(page), page); + +- ret = try_grab_page(page, flags); ++ ret = try_grab_folio(page_folio(page), 1, flags); + if (ret) + return ERR_PTR(ret); + +diff --git a/mm/hugetlb.c b/mm/hugetlb.c +index fb7a531fce7174..0acb04c3e95291 100644 +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -6532,7 +6532,7 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, + * try_grab_page() should always be able to get the page here, + * because we hold the ptl lock and have verified pte_present(). + */ +- ret = try_grab_page(page, flags); ++ ret = try_grab_folio(page_folio(page), 1, flags); + + if (WARN_ON_ONCE(ret)) { + page = ERR_PTR(ret); +diff --git a/mm/internal.h b/mm/internal.h +index abed947f784b7b..ef8d787a510c5c 100644 +--- a/mm/internal.h ++++ b/mm/internal.h +@@ -938,8 +938,8 @@ int migrate_device_coherent_page(struct page *page); + /* + * mm/gup.c + */ +-struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags); +-int __must_check try_grab_page(struct page *page, unsigned int flags); ++int __must_check try_grab_folio(struct folio *folio, int refs, ++ unsigned int flags); + + /* + * mm/huge_memory.c +diff --git a/mm/page_table_check.c b/mm/page_table_check.c +index 6363f93a47c691..509c6ef8de400e 100644 +--- a/mm/page_table_check.c ++++ b/mm/page_table_check.c +@@ -7,6 +7,8 @@ + #include + #include + #include ++#include ++#include + + #undef pr_fmt + #define pr_fmt(fmt) "page_table_check: " fmt +@@ -191,6 +193,22 @@ void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) + } + EXPORT_SYMBOL(__page_table_check_pud_clear); + ++/* Whether the swap entry cached writable information */ ++static inline bool swap_cached_writable(swp_entry_t entry) ++{ ++ return is_writable_device_exclusive_entry(entry) || ++ is_writable_device_private_entry(entry) || ++ is_writable_migration_entry(entry); ++} ++ ++static inline void page_table_check_pte_flags(pte_t pte) ++{ ++ if (pte_present(pte) && pte_uffd_wp(pte)) ++ WARN_ON_ONCE(pte_write(pte)); ++ else if (is_swap_pte(pte) && pte_swp_uffd_wp(pte)) ++ WARN_ON_ONCE(swap_cached_writable(pte_to_swp_entry(pte))); ++} ++ + void __page_table_check_ptes_set(struct mm_struct *mm, pte_t *ptep, pte_t pte, + unsigned int nr) + { +@@ -199,6 +217,8 @@ void __page_table_check_ptes_set(struct mm_struct *mm, pte_t *ptep, pte_t pte, + if (&init_mm == mm) + return; + ++ page_table_check_pte_flags(pte); ++ + for (i = 0; i < nr; i++) + __page_table_check_pte_clear(mm, ptep_get(ptep + i)); + if (pte_user_accessible_page(pte)) +@@ -206,11 +226,21 @@ void __page_table_check_ptes_set(struct mm_struct *mm, pte_t *ptep, pte_t pte, + } + EXPORT_SYMBOL(__page_table_check_ptes_set); + ++static inline void page_table_check_pmd_flags(pmd_t pmd) ++{ ++ if (pmd_present(pmd) && pmd_uffd_wp(pmd)) ++ WARN_ON_ONCE(pmd_write(pmd)); ++ else if (is_swap_pmd(pmd) && pmd_swp_uffd_wp(pmd)) ++ WARN_ON_ONCE(swap_cached_writable(pmd_to_swp_entry(pmd))); ++} ++ + void __page_table_check_pmd_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t pmd) + { + if (&init_mm == mm) + return; + ++ page_table_check_pmd_flags(pmd); ++ + __page_table_check_pmd_clear(mm, *pmdp); + if (pmd_user_accessible_page(pmd)) { + page_table_check_set(pmd_pfn(pmd), PMD_SIZE >> PAGE_SHIFT, +diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c +index b54e8a530f55a1..29aa07e9db9d71 100644 +--- a/net/bluetooth/rfcomm/sock.c ++++ b/net/bluetooth/rfcomm/sock.c +@@ -629,7 +629,7 @@ static int rfcomm_sock_setsockopt_old(struct socket *sock, int optname, + + switch (optname) { + case RFCOMM_LM: +- if (copy_from_sockptr(&opt, optval, sizeof(u32))) { ++ if (bt_copy_from_sockptr(&opt, sizeof(opt), optval, optlen)) { + err = -EFAULT; + break; + } +@@ -664,7 +664,6 @@ static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, + struct sock *sk = sock->sk; + struct bt_security sec; + int err = 0; +- size_t len; + u32 opt; + + BT_DBG("sk %p", sk); +@@ -686,11 +685,9 @@ static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, + + sec.level = BT_SECURITY_LOW; + +- len = min_t(unsigned int, sizeof(sec), optlen); +- if (copy_from_sockptr(&sec, optval, len)) { +- err = -EFAULT; ++ err = bt_copy_from_sockptr(&sec, sizeof(sec), optval, optlen); ++ if (err) + break; +- } + + if (sec.level > BT_SECURITY_HIGH) { + err = -EINVAL; +@@ -706,10 +703,9 @@ static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, + break; + } + +- if (copy_from_sockptr(&opt, optval, sizeof(u32))) { +- err = -EFAULT; ++ err = bt_copy_from_sockptr(&opt, sizeof(opt), optval, optlen); ++ if (err) + break; +- } + + if (opt) + set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags); +diff --git a/net/core/filter.c b/net/core/filter.c +index 8cb44cd29967bb..be313928d272c6 100644 +--- a/net/core/filter.c ++++ b/net/core/filter.c +@@ -2271,12 +2271,12 @@ static int __bpf_redirect_neigh_v6(struct sk_buff *skb, struct net_device *dev, + + err = bpf_out_neigh_v6(net, skb, dev, nh); + if (unlikely(net_xmit_eval(err))) +- dev->stats.tx_errors++; ++ DEV_STATS_INC(dev, tx_errors); + else + ret = NET_XMIT_SUCCESS; + goto out_xmit; + out_drop: +- dev->stats.tx_errors++; ++ DEV_STATS_INC(dev, tx_errors); + kfree_skb(skb); + out_xmit: + return ret; +@@ -2378,12 +2378,12 @@ static int __bpf_redirect_neigh_v4(struct sk_buff *skb, struct net_device *dev, + + err = bpf_out_neigh_v4(net, skb, dev, nh); + if (unlikely(net_xmit_eval(err))) +- dev->stats.tx_errors++; ++ DEV_STATS_INC(dev, tx_errors); + else + ret = NET_XMIT_SUCCESS; + goto out_xmit; + out_drop: +- dev->stats.tx_errors++; ++ DEV_STATS_INC(dev, tx_errors); + kfree_skb(skb); + out_xmit: + return ret; +diff --git a/net/ipv4/fou_core.c b/net/ipv4/fou_core.c +index 0c41076e31edad..b38b82ae903de0 100644 +--- a/net/ipv4/fou_core.c ++++ b/net/ipv4/fou_core.c +@@ -433,7 +433,7 @@ static struct sk_buff *gue_gro_receive(struct sock *sk, + + offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; + ops = rcu_dereference(offloads[proto]); +- if (WARN_ON_ONCE(!ops || !ops->callbacks.gro_receive)) ++ if (!ops || !ops->callbacks.gro_receive) + goto out; + + pp = call_gro_receive(ops->callbacks.gro_receive, head, skb); +diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c +index b71f94a5932ac0..e0883ba709b0bf 100644 +--- a/net/ipv4/tcp_metrics.c ++++ b/net/ipv4/tcp_metrics.c +@@ -899,11 +899,13 @@ static void tcp_metrics_flush_all(struct net *net) + unsigned int row; + + for (row = 0; row < max_rows; row++, hb++) { +- struct tcp_metrics_block __rcu **pp; ++ struct tcp_metrics_block __rcu **pp = &hb->chain; + bool match; + ++ if (!rcu_access_pointer(*pp)) ++ continue; ++ + spin_lock_bh(&tcp_metrics_lock); +- pp = &hb->chain; + for (tm = deref_locked(*pp); tm; tm = deref_locked(*pp)) { + match = net ? net_eq(tm_net(tm), net) : + !refcount_read(&tm_net(tm)->ns.count); +@@ -915,6 +917,7 @@ static void tcp_metrics_flush_all(struct net *net) + } + } + spin_unlock_bh(&tcp_metrics_lock); ++ cond_resched(); + } + } + +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c +index 6e3bfb46af44d3..52b048807feae5 100644 +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -251,9 +251,9 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata + return ret; + } + +-static int ieee80211_change_mac(struct net_device *dev, void *addr) ++static int _ieee80211_change_mac(struct ieee80211_sub_if_data *sdata, ++ void *addr) + { +- struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_local *local = sdata->local; + struct sockaddr *sa = addr; + bool check_dup = true; +@@ -278,7 +278,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr) + + if (live) + drv_remove_interface(local, sdata); +- ret = eth_mac_addr(dev, sa); ++ ret = eth_mac_addr(sdata->dev, sa); + + if (ret == 0) { + memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); +@@ -294,6 +294,27 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr) + return ret; + } + ++static int ieee80211_change_mac(struct net_device *dev, void *addr) ++{ ++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ++ struct ieee80211_local *local = sdata->local; ++ int ret; ++ ++ /* ++ * This happens during unregistration if there's a bond device ++ * active (maybe other cases?) and we must get removed from it. ++ * But we really don't care anymore if it's not registered now. ++ */ ++ if (!dev->ieee80211_ptr->registered) ++ return 0; ++ ++ wiphy_lock(local->hw.wiphy); ++ ret = _ieee80211_change_mac(sdata, addr); ++ wiphy_unlock(local->hw.wiphy); ++ ++ return ret; ++} ++ + static inline int identical_mac_addr_allowed(int type1, int type2) + { + return type1 == NL80211_IFTYPE_MONITOR || +diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c +index 819157bbb5a2c6..d5344563e525c9 100644 +--- a/net/nfc/llcp_sock.c ++++ b/net/nfc/llcp_sock.c +@@ -252,10 +252,10 @@ static int nfc_llcp_setsockopt(struct socket *sock, int level, int optname, + break; + } + +- if (copy_from_sockptr(&opt, optval, sizeof(u32))) { +- err = -EFAULT; ++ err = copy_safe_from_sockptr(&opt, sizeof(opt), ++ optval, optlen); ++ if (err) + break; +- } + + if (opt > LLCP_MAX_RW) { + err = -EINVAL; +@@ -274,10 +274,10 @@ static int nfc_llcp_setsockopt(struct socket *sock, int level, int optname, + break; + } + +- if (copy_from_sockptr(&opt, optval, sizeof(u32))) { +- err = -EFAULT; ++ err = copy_safe_from_sockptr(&opt, sizeof(opt), ++ optval, optlen); ++ if (err) + break; +- } + + if (opt > LLCP_MAX_MIUX) { + err = -EINVAL; +diff --git a/net/rds/recv.c b/net/rds/recv.c +index c71b923764fd7c..5627f80013f8b1 100644 +--- a/net/rds/recv.c ++++ b/net/rds/recv.c +@@ -425,6 +425,7 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, + struct sock *sk = rds_rs_to_sk(rs); + int ret = 0; + unsigned long flags; ++ struct rds_incoming *to_drop = NULL; + + write_lock_irqsave(&rs->rs_recv_lock, flags); + if (!list_empty(&inc->i_item)) { +@@ -435,11 +436,14 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, + -be32_to_cpu(inc->i_hdr.h_len), + inc->i_hdr.h_dport); + list_del_init(&inc->i_item); +- rds_inc_put(inc); ++ to_drop = inc; + } + } + write_unlock_irqrestore(&rs->rs_recv_lock, flags); + ++ if (to_drop) ++ rds_inc_put(to_drop); ++ + rdsdebug("inc %p rs %p still %d dropped %d\n", inc, rs, ret, drop); + return ret; + } +@@ -758,16 +762,21 @@ void rds_clear_recv_queue(struct rds_sock *rs) + struct sock *sk = rds_rs_to_sk(rs); + struct rds_incoming *inc, *tmp; + unsigned long flags; ++ LIST_HEAD(to_drop); + + write_lock_irqsave(&rs->rs_recv_lock, flags); + list_for_each_entry_safe(inc, tmp, &rs->rs_recv_queue, i_item) { + rds_recv_rcvbuf_delta(rs, sk, inc->i_conn->c_lcong, + -be32_to_cpu(inc->i_hdr.h_len), + inc->i_hdr.h_dport); ++ list_move(&inc->i_item, &to_drop); ++ } ++ write_unlock_irqrestore(&rs->rs_recv_lock, flags); ++ ++ list_for_each_entry_safe(inc, tmp, &to_drop, i_item) { + list_del_init(&inc->i_item); + rds_inc_put(inc); + } +- write_unlock_irqrestore(&rs->rs_recv_lock, flags); + } + + /* +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c +index 4023c955036b12..6ab9359c1706f1 100644 +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -522,8 +522,9 @@ static void dev_watchdog(struct timer_list *t) + + if (unlikely(timedout_ms)) { + trace_net_dev_xmit_timeout(dev, i); +- WARN_ONCE(1, "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out %u ms\n", +- dev->name, netdev_drivername(dev), i, timedout_ms); ++ netdev_crit(dev, "NETDEV WATCHDOG: CPU: %d: transmit queue %u timed out %u ms\n", ++ raw_smp_processor_id(), ++ i, timedout_ms); + netif_freeze_queues(dev); + dev->netdev_ops->ndo_tx_timeout(dev, i); + netif_unfreeze_queues(dev); +diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c +index 7182c5a450fb5b..5c165218180588 100644 +--- a/net/sctp/inqueue.c ++++ b/net/sctp/inqueue.c +@@ -38,6 +38,14 @@ void sctp_inq_init(struct sctp_inq *queue) + INIT_WORK(&queue->immediate, NULL); + } + ++/* Properly release the chunk which is being worked on. */ ++static inline void sctp_inq_chunk_free(struct sctp_chunk *chunk) ++{ ++ if (chunk->head_skb) ++ chunk->skb = chunk->head_skb; ++ sctp_chunk_free(chunk); ++} ++ + /* Release the memory associated with an SCTP inqueue. */ + void sctp_inq_free(struct sctp_inq *queue) + { +@@ -53,7 +61,7 @@ void sctp_inq_free(struct sctp_inq *queue) + * free it as well. + */ + if (queue->in_progress) { +- sctp_chunk_free(queue->in_progress); ++ sctp_inq_chunk_free(queue->in_progress); + queue->in_progress = NULL; + } + } +@@ -130,9 +138,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) + goto new_skb; + } + +- if (chunk->head_skb) +- chunk->skb = chunk->head_skb; +- sctp_chunk_free(chunk); ++ sctp_inq_chunk_free(chunk); + chunk = queue->in_progress = NULL; + } else { + /* Nothing to do. Next chunk in the packet, please. */ +diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c +index 65fc1297c6dfa4..383860cb1d5b0f 100644 +--- a/net/sunrpc/stats.c ++++ b/net/sunrpc/stats.c +@@ -314,7 +314,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister); + struct proc_dir_entry * + svc_proc_register(struct net *net, struct svc_stat *statp, const struct proc_ops *proc_ops) + { +- return do_register(net, statp->program->pg_name, statp, proc_ops); ++ return do_register(net, statp->program->pg_name, net, proc_ops); + } + EXPORT_SYMBOL_GPL(svc_proc_register); + +diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c +index 691499d1d2315c..029c49065016ac 100644 +--- a/net/sunrpc/svc.c ++++ b/net/sunrpc/svc.c +@@ -453,8 +453,8 @@ __svc_init_bc(struct svc_serv *serv) + * Create an RPC service + */ + static struct svc_serv * +-__svc_create(struct svc_program *prog, unsigned int bufsize, int npools, +- int (*threadfn)(void *data)) ++__svc_create(struct svc_program *prog, struct svc_stat *stats, ++ unsigned int bufsize, int npools, int (*threadfn)(void *data)) + { + struct svc_serv *serv; + unsigned int vers; +@@ -466,7 +466,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, + serv->sv_name = prog->pg_name; + serv->sv_program = prog; + kref_init(&serv->sv_refcnt); +- serv->sv_stats = prog->pg_stats; ++ serv->sv_stats = stats; + if (bufsize > RPCSVC_MAXPAYLOAD) + bufsize = RPCSVC_MAXPAYLOAD; + serv->sv_max_payload = bufsize? bufsize : 4096; +@@ -532,26 +532,28 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, + struct svc_serv *svc_create(struct svc_program *prog, unsigned int bufsize, + int (*threadfn)(void *data)) + { +- return __svc_create(prog, bufsize, 1, threadfn); ++ return __svc_create(prog, NULL, bufsize, 1, threadfn); + } + EXPORT_SYMBOL_GPL(svc_create); + + /** + * svc_create_pooled - Create an RPC service with pooled threads + * @prog: the RPC program the new service will handle ++ * @stats: the stats struct if desired + * @bufsize: maximum message size for @prog + * @threadfn: a function to service RPC requests for @prog + * + * Returns an instantiated struct svc_serv object or NULL. + */ + struct svc_serv *svc_create_pooled(struct svc_program *prog, ++ struct svc_stat *stats, + unsigned int bufsize, + int (*threadfn)(void *data)) + { + struct svc_serv *serv; + unsigned int npools = svc_pool_map_get(); + +- serv = __svc_create(prog, bufsize, npools, threadfn); ++ serv = __svc_create(prog, stats, bufsize, npools, threadfn); + if (!serv) + goto out_err; + return serv; +@@ -1377,7 +1379,8 @@ svc_process_common(struct svc_rqst *rqstp) + goto err_bad_proc; + + /* Syntactic check complete */ +- serv->sv_stats->rpccnt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpccnt++; + trace_svc_process(rqstp, progp->pg_name); + + aoffset = xdr_stream_pos(xdr); +@@ -1429,7 +1432,8 @@ svc_process_common(struct svc_rqst *rqstp) + goto close_xprt; + + err_bad_rpc: +- serv->sv_stats->rpcbadfmt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadfmt++; + xdr_stream_encode_u32(xdr, RPC_MSG_DENIED); + xdr_stream_encode_u32(xdr, RPC_MISMATCH); + /* Only RPCv2 supported */ +@@ -1440,7 +1444,8 @@ svc_process_common(struct svc_rqst *rqstp) + err_bad_auth: + dprintk("svc: authentication failed (%d)\n", + be32_to_cpu(rqstp->rq_auth_stat)); +- serv->sv_stats->rpcbadauth++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadauth++; + /* Restore write pointer to location of reply status: */ + xdr_truncate_encode(xdr, XDR_UNIT * 2); + xdr_stream_encode_u32(xdr, RPC_MSG_DENIED); +@@ -1450,7 +1455,8 @@ svc_process_common(struct svc_rqst *rqstp) + + err_bad_prog: + dprintk("svc: unknown program %d\n", rqstp->rq_prog); +- serv->sv_stats->rpcbadfmt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadfmt++; + *rqstp->rq_accept_statp = rpc_prog_unavail; + goto sendit; + +@@ -1458,7 +1464,8 @@ svc_process_common(struct svc_rqst *rqstp) + svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n", + rqstp->rq_vers, rqstp->rq_prog, progp->pg_name); + +- serv->sv_stats->rpcbadfmt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadfmt++; + *rqstp->rq_accept_statp = rpc_prog_mismatch; + + /* +@@ -1472,19 +1479,22 @@ svc_process_common(struct svc_rqst *rqstp) + err_bad_proc: + svc_printk(rqstp, "unknown procedure (%d)\n", rqstp->rq_proc); + +- serv->sv_stats->rpcbadfmt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadfmt++; + *rqstp->rq_accept_statp = rpc_proc_unavail; + goto sendit; + + err_garbage_args: + svc_printk(rqstp, "failed to decode RPC header\n"); + +- serv->sv_stats->rpcbadfmt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadfmt++; + *rqstp->rq_accept_statp = rpc_garbage_args; + goto sendit; + + err_system_err: +- serv->sv_stats->rpcbadfmt++; ++ if (serv->sv_stats) ++ serv->sv_stats->rpcbadfmt++; + *rqstp->rq_accept_statp = rpc_system_err; + goto sendit; + } +@@ -1536,7 +1546,8 @@ void svc_process(struct svc_rqst *rqstp) + out_baddir: + svc_printk(rqstp, "bad direction 0x%08x, dropping request\n", + be32_to_cpu(*p)); +- rqstp->rq_server->sv_stats->rpcbadfmt++; ++ if (rqstp->rq_server->sv_stats) ++ rqstp->rq_server->sv_stats->rpcbadfmt++; + out_drop: + svc_drop(rqstp); + } +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index be5c42d6ffbeab..2b2dc46dc701f9 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -468,6 +468,10 @@ static struct netlink_range_validation nl80211_punct_bitmap_range = { + .max = 0xffff, + }; + ++static struct netlink_range_validation q_range = { ++ .max = INT_MAX, ++}; ++ + static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { + [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, + [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, +@@ -750,7 +754,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { + + [NL80211_ATTR_TXQ_LIMIT] = { .type = NLA_U32 }, + [NL80211_ATTR_TXQ_MEMORY_LIMIT] = { .type = NLA_U32 }, +- [NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 }, ++ [NL80211_ATTR_TXQ_QUANTUM] = NLA_POLICY_FULL_RANGE(NLA_U32, &q_range), + [NL80211_ATTR_HE_CAPABILITY] = + NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_he_capa, + NL80211_HE_MAX_CAPABILITY_LEN), +diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c +index d2fbcf963cdf6d..07ff471ed6aee0 100644 +--- a/samples/bpf/map_perf_test_user.c ++++ b/samples/bpf/map_perf_test_user.c +@@ -370,7 +370,7 @@ static void run_perf_test(int tasks) + + static void fill_lpm_trie(void) + { +- struct bpf_lpm_trie_key *key; ++ struct bpf_lpm_trie_key_u8 *key; + unsigned long value = 0; + unsigned int i; + int r; +diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c +index 9d41db09c4800f..266fdd0b025dc6 100644 +--- a/samples/bpf/xdp_router_ipv4_user.c ++++ b/samples/bpf/xdp_router_ipv4_user.c +@@ -91,7 +91,7 @@ static int recv_msg(struct sockaddr_nl sock_addr, int sock) + static void read_route(struct nlmsghdr *nh, int nll) + { + char dsts[24], gws[24], ifs[16], dsts_len[24], metrics[24]; +- struct bpf_lpm_trie_key *prefix_key; ++ struct bpf_lpm_trie_key_u8 *prefix_key; + struct rtattr *rt_attr; + struct rtmsg *rt_msg; + int rtm_family; +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c +index 8b58a7864703ee..7e8fca0b066280 100644 +--- a/sound/soc/soc-topology.c ++++ b/sound/soc/soc-topology.c +@@ -1021,6 +1021,7 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, + struct snd_soc_tplg_hdr *hdr) + { + struct snd_soc_dapm_context *dapm = &tplg->comp->dapm; ++ const size_t maxlen = SNDRV_CTL_ELEM_ID_NAME_MAXLEN; + struct snd_soc_tplg_dapm_graph_elem *elem; + struct snd_soc_dapm_route *route; + int count, i; +@@ -1044,39 +1045,22 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, + tplg->pos += sizeof(struct snd_soc_tplg_dapm_graph_elem); + + /* validate routes */ +- if (strnlen(elem->source, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN) { +- ret = -EINVAL; +- break; +- } +- if (strnlen(elem->sink, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN) { +- ret = -EINVAL; +- break; +- } +- if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN) { ++ if ((strnlen(elem->source, maxlen) == maxlen) || ++ (strnlen(elem->sink, maxlen) == maxlen) || ++ (strnlen(elem->control, maxlen) == maxlen)) { + ret = -EINVAL; + break; + } + +- route->source = devm_kmemdup(tplg->dev, elem->source, +- min(strlen(elem->source), +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN), +- GFP_KERNEL); +- route->sink = devm_kmemdup(tplg->dev, elem->sink, +- min(strlen(elem->sink), SNDRV_CTL_ELEM_ID_NAME_MAXLEN), +- GFP_KERNEL); ++ route->source = devm_kstrdup(tplg->dev, elem->source, GFP_KERNEL); ++ route->sink = devm_kstrdup(tplg->dev, elem->sink, GFP_KERNEL); + if (!route->source || !route->sink) { + ret = -ENOMEM; + break; + } + +- if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) != 0) { +- route->control = devm_kmemdup(tplg->dev, elem->control, +- min(strlen(elem->control), +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN), +- GFP_KERNEL); ++ if (strnlen(elem->control, maxlen) != 0) { ++ route->control = devm_kstrdup(tplg->dev, elem->control, GFP_KERNEL); + if (!route->control) { + ret = -ENOMEM; + break; +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c +index d1bdb0b93bda0c..8cc2d4937f3403 100644 +--- a/sound/usb/mixer.c ++++ b/sound/usb/mixer.c +@@ -2021,6 +2021,13 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, + bmaControls = ftr->bmaControls; + } + ++ if (channels > 32) { ++ usb_audio_info(state->chip, ++ "usbmixer: too many channels (%d) in unit %d\n", ++ channels, unitid); ++ return -EINVAL; ++ } ++ + /* parse the source unit */ + err = parse_audio_unit(state, hdr->bSourceID); + if (err < 0) +diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h +index fb09fd1767f289..ba6e346c8d669a 100644 +--- a/tools/include/uapi/linux/bpf.h ++++ b/tools/include/uapi/linux/bpf.h +@@ -77,12 +77,29 @@ struct bpf_insn { + __s32 imm; /* signed immediate constant */ + }; + +-/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ ++/* Deprecated: use struct bpf_lpm_trie_key_u8 (when the "data" member is needed for ++ * byte access) or struct bpf_lpm_trie_key_hdr (when using an alternative type for ++ * the trailing flexible array member) instead. ++ */ + struct bpf_lpm_trie_key { + __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */ + __u8 data[0]; /* Arbitrary size */ + }; + ++/* Header for bpf_lpm_trie_key structs */ ++struct bpf_lpm_trie_key_hdr { ++ __u32 prefixlen; ++}; ++ ++/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry, with trailing byte array. */ ++struct bpf_lpm_trie_key_u8 { ++ union { ++ struct bpf_lpm_trie_key_hdr hdr; ++ __u32 prefixlen; ++ }; ++ __u8 data[]; /* Arbitrary size */ ++}; ++ + struct bpf_cgroup_storage_key { + __u64 cgroup_inode_id; /* cgroup inode id */ + __u32 attach_type; /* program attach type (enum bpf_attach_type) */ +diff --git a/tools/testing/selftests/bpf/progs/map_ptr_kern.c b/tools/testing/selftests/bpf/progs/map_ptr_kern.c +index 3325da17ec81af..efaf622c28ddec 100644 +--- a/tools/testing/selftests/bpf/progs/map_ptr_kern.c ++++ b/tools/testing/selftests/bpf/progs/map_ptr_kern.c +@@ -316,7 +316,7 @@ struct lpm_trie { + } __attribute__((preserve_access_index)); + + struct lpm_key { +- struct bpf_lpm_trie_key trie_key; ++ struct bpf_lpm_trie_key_hdr trie_key; + __u32 data; + }; + +diff --git a/tools/testing/selftests/bpf/test_lpm_map.c b/tools/testing/selftests/bpf/test_lpm_map.c +index c028d621c744da..d98c72dc563eaf 100644 +--- a/tools/testing/selftests/bpf/test_lpm_map.c ++++ b/tools/testing/selftests/bpf/test_lpm_map.c +@@ -211,7 +211,7 @@ static void test_lpm_map(int keysize) + volatile size_t n_matches, n_matches_after_delete; + size_t i, j, n_nodes, n_lookups; + struct tlpm_node *t, *list = NULL; +- struct bpf_lpm_trie_key *key; ++ struct bpf_lpm_trie_key_u8 *key; + uint8_t *data, *value; + int r, map; + +@@ -331,8 +331,8 @@ static void test_lpm_map(int keysize) + static void test_lpm_ipaddr(void) + { + LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags = BPF_F_NO_PREALLOC); +- struct bpf_lpm_trie_key *key_ipv4; +- struct bpf_lpm_trie_key *key_ipv6; ++ struct bpf_lpm_trie_key_u8 *key_ipv4; ++ struct bpf_lpm_trie_key_u8 *key_ipv6; + size_t key_size_ipv4; + size_t key_size_ipv6; + int map_fd_ipv4; +@@ -423,7 +423,7 @@ static void test_lpm_ipaddr(void) + static void test_lpm_delete(void) + { + LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags = BPF_F_NO_PREALLOC); +- struct bpf_lpm_trie_key *key; ++ struct bpf_lpm_trie_key_u8 *key; + size_t key_size; + int map_fd; + __u64 value; +@@ -532,7 +532,7 @@ static void test_lpm_delete(void) + static void test_lpm_get_next_key(void) + { + LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags = BPF_F_NO_PREALLOC); +- struct bpf_lpm_trie_key *key_p, *next_key_p; ++ struct bpf_lpm_trie_key_u8 *key_p, *next_key_p; + size_t key_size; + __u32 value = 0; + int map_fd; +@@ -693,9 +693,9 @@ static void *lpm_test_command(void *arg) + { + int i, j, ret, iter, key_size; + struct lpm_mt_test_info *info = arg; +- struct bpf_lpm_trie_key *key_p; ++ struct bpf_lpm_trie_key_u8 *key_p; + +- key_size = sizeof(struct bpf_lpm_trie_key) + sizeof(__u32); ++ key_size = sizeof(*key_p) + sizeof(__u32); + key_p = alloca(key_size); + for (iter = 0; iter < info->iter; iter++) + for (i = 0; i < MAX_TEST_KEYS; i++) { +@@ -717,7 +717,7 @@ static void *lpm_test_command(void *arg) + ret = bpf_map_lookup_elem(info->map_fd, key_p, &value); + assert(ret == 0 || errno == ENOENT); + } else { +- struct bpf_lpm_trie_key *next_key_p = alloca(key_size); ++ struct bpf_lpm_trie_key_u8 *next_key_p = alloca(key_size); + ret = bpf_map_get_next_key(info->map_fd, key_p, next_key_p); + assert(ret == 0 || errno == ENOENT || errno == ENOMEM); + } +@@ -752,7 +752,7 @@ static void test_lpm_multi_thread(void) + + /* create a trie */ + value_size = sizeof(__u32); +- key_size = sizeof(struct bpf_lpm_trie_key) + value_size; ++ key_size = sizeof(struct bpf_lpm_trie_key_hdr) + value_size; + map_fd = bpf_map_create(BPF_MAP_TYPE_LPM_TRIE, NULL, key_size, value_size, 100, &opts); + + /* create 4 threads to test update, delete, lookup and get_next_key */ +diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c +index ad993ab3ac1819..bc36c91c4480f5 100644 +--- a/tools/testing/selftests/net/tls.c ++++ b/tools/testing/selftests/net/tls.c +@@ -707,6 +707,20 @@ TEST_F(tls, splice_from_pipe) + EXPECT_EQ(memcmp(mem_send, mem_recv, send_len), 0); + } + ++TEST_F(tls, splice_more) ++{ ++ unsigned int f = SPLICE_F_NONBLOCK | SPLICE_F_MORE | SPLICE_F_GIFT; ++ int send_len = TLS_PAYLOAD_MAX_LEN; ++ char mem_send[TLS_PAYLOAD_MAX_LEN]; ++ int i, send_pipe = 1; ++ int p[2]; ++ ++ ASSERT_GE(pipe(p), 0); ++ EXPECT_GE(write(p[1], mem_send, send_len), 0); ++ for (i = 0; i < 32; i++) ++ EXPECT_EQ(splice(p[0], NULL, self->fd, NULL, send_pipe, f), 1); ++} ++ + TEST_F(tls, splice_from_pipe2) + { + int send_len = 16000; diff --git a/patch/kernel/archive/rockchip-6.10/0000.patching_config.yaml b/patch/kernel/archive/rockchip-6.10/0000.patching_config.yaml new file mode 100644 index 000000000000..04f7f87716b0 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/0000.patching_config.yaml @@ -0,0 +1,35 @@ +config: + # Just some info stuff; not used by the patching scripts + name: rockchip-6.10 + kind: kernel + type: mainline # or: vendor + branch: linux-6.10.y + last-known-good-tag: v6.10 + maintainers: + - { github: paolo.sabatino, name: Paolo Sabatino, email: paolo.sabatino@gmail.com, armbian-forum: jock } + + # .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones. + # This is meant to provide a way to "add a board DTS" without having to null-patch them in. + dts-directories: + - { source: "dt", target: "arch/arm/boot/dts/rockchip" } + + # every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones + # This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in. + # @TODO need a solution to auto-Makefile the overlays as well + overlay-directories: + - { source: "overlay", target: "arch/arm/boot/dts/rockchip/overlay" } + + # the Makefile in each of these directories will be magically patched to include the dts files copied + # or patched-in; overlay subdir will be included "-y" if it exists. + # No more Makefile patching needed, yay! + auto-patch-dt-makefile: + - { directory: "arch/arm/boot/dts/rockchip", config-var: "CONFIG_ARCH_ROCKCHIP" } + + # configuration for when applying patches to git / auto-rewriting patches (development cycle helpers) + patches-to-git: + do-not-commit-files: + - "MAINTAINERS" # constant churn, drop them. sorry. + - "Documentation/devicetree/bindings/arm/rockchip.yaml" # constant churn, conflicts on every bump, drop it. sorry. + do-not-commit-regexes: # Python-style regexes + - "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now + diff --git a/patch/kernel/archive/rockchip-6.10/armbian.series b/patch/kernel/archive/rockchip-6.10/armbian.series new file mode 100644 index 000000000000..afd8f3b90306 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/armbian.series @@ -0,0 +1,53 @@ +# Series from patches.armbian/ + patches.armbian/bt-broadcom-serdev-workaround.patch + patches.armbian/clk-rk322x-composite-mmc-clk.patch + patches.armbian/clk-rockchip-max-frac-divider.patch + patches.armbian/driver-rk322x-audio-codec.patch + patches.armbian/driver-rk3288-gpiomem.patch + patches.armbian/driver-tinkerboard-alc4040-codec.patch + patches.armbian/drm-rk322x-plane-overlay.patch + patches.armbian/drm-rk322x-yuv-10bit-modes.patch + patches.armbian/drm-rockchip-hardware-cursor.patch + patches.armbian/dts-miqi-fan.patch + patches.armbian/dts-miqi-hevc-rga.patch + patches.armbian/dts-miqi-mali-gpu.patch + patches.armbian/dts-miqi-regulator-fix.patch + patches.armbian/dts-rk322x-iep-node.patch + patches.armbian/dts-rk322x-pinctrl-nand.patch + patches.armbian/dts-rk3288-disable-serial-dma.patch + patches.armbian/dts-rk3288-fix-mmc-aliases.patch + patches.armbian/dts-rk3288-gpu-500mhz-opp.patch + patches.armbian/dts-rk3288-pinctrl-spi2.patch + patches.armbian/dts-rk3288-thermal-rearrange-zones.patch + patches.armbian/dts-tinkerboard-bt-rtl8723bs.patch + patches.armbian/dts-tinkerboard-bt-uart-pins.patch + patches.armbian/dts-tinkerboard-hevc-rga.patch + patches.armbian/dts-tinkerboard-sdio-wifi.patch + patches.armbian/dts-tinkerboard-sdmmc-properties.patch + patches.armbian/dts-tinkerboard-spi-interface.patch + patches.armbian/dts-veyron-flag-cache-flush.patch + patches.armbian/general-add-overlay-compilation-support.patch + patches.armbian/general-add-overlay-configfs.patch + patches.armbian/general-add-restart-handler-for-act8846.patch + patches.armbian/general-dwc2-fix-wait-peripheral.patch + patches.armbian/general-dwc2-fix-wait-time.patch + patches.armbian/general-dwc2-nak-gadget.patch + patches.armbian/general-fix-reboot-from-kwiboo.patch + patches.armbian/general-linux-export-mm-trace-rss-stats.patch + patches.armbian/general-rk322x-gpio-ir-driver.patch + patches.armbian/general-rockchip-various-fixes.patch + patches.armbian/ir-keymap-rk322x-box.patch + patches.armbian/ir-keymap-xt-q8l-v10.patch + patches.armbian/misc-tinkerboard-spi-interface.patch + patches.armbian/mmc-tinkerboard-sdmmc-reboot-fix.patch + patches.armbian/rk322x-dmc-driver-01-sipv2-calls.patch + patches.armbian/rk322x-dmc-driver-02-sip-constants.patch + patches.armbian/rk322x-dmc-driver-03-dfi-driver.patch + patches.armbian/rk322x-dmc-driver-04-driver.patch + patches.armbian/rk322x-dwc2-no-clock-gating.patch + patches.armbian/rk322x-usb-reset-props.patch + patches.armbian/wifi-ath9k-no-bulk-EP3-EP4.patch + patches.armbian/wifi-brcmfmac-add-bcm43342.patch + patches.armbian/wifi-brcmfmac-ap6330-firmware.patch + patches.armbian/wifi-driver-esp8089.patch + patches.armbian/wifi-driver-ssv6051.patch diff --git a/patch/kernel/archive/rockchip-6.10/dt/rk322x-box.dts b/patch/kernel/archive/rockchip-6.10/dt/rk322x-box.dts new file mode 100644 index 000000000000..ddc25ec77f7f --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/dt/rk322x-box.dts @@ -0,0 +1,782 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include +#include "rk322x.dtsi" + +/ { + + model = "Generic RK322x Tv Box board"; + compatible = "rockchip,rk3229"; + + /* + * No need to reserve memory manually as long as u-boot v2020.10 and + * OPTEE autoconfigure the reserved zones + */ + /delete-node/ reserved-memory; + + /* + * We rebuild the cpu-opp-table by ourselves + */ + /delete-node/ opp-table-0; + + /* + * Rebuild the thermal zones and cooling maps ourselved + */ + /delete-node/ thermal-zones; + + /* + * Include the mmc devices into aliases table + */ + aliases { + mmc0 = &sdmmc; + mmc1 = &sdio; + mmc2 = &emmc; + }; + + analog-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "analog"; + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + + simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; + + chosen { + bootargs = "earlyprintk=uart8250,mmio32,0x11030000"; + }; + + cpu0_opp_table: opp-table-0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <975000>; + clock-latency-ns = <40000>; + opp-suspend; + }; + + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1000000>; + }; + + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1175000>; + }; + + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <1275000>; + }; + + }; + + gpio_leds: gpio-leds { + + compatible = "gpio-leds"; + + /* + * Working led, available on all boards + */ + working { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "working"; + default-state = "on"; + linux,default-trigger = "timer"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_working>; + }; + + }; + + gpio_keys: gpio-keys { + + compatible = "gpio-keys"; + + #address-cells = <1>; + #size-cells = <0>; + + }; + + ir_receiver: ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&ir_int>; + pinctrl-names = "default"; + status = "okay"; + linux,rc-map-name = "rc-rk322x-tvbox"; + }; + + rockchip_ir_receiver: rockchip-ir-receiver { + compatible = "rockchip-ir-receiver"; + reg = <0x110b0030 0x10>; + gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>; + clocks = <&cru PCLK_PWM>; + interrupts = ; + linux,rc-map-name = "rc-rk322x-tvbox"; + pinctrl-names = "default", "suspend"; + pinctrl-0 = <&ir_int>; + pinctrl-1 = <&pwm3_pin>; + pwm-id = <3>; + shutdown-is-virtual-poweroff; + wakeup-source; + status = "disabled"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>; + }; + + + spdif_out: spdif-out { + status = "okay"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + spdif-sound { + status = "okay"; + compatible = "simple-audio-card"; + simple-audio-card,name = "SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + vcc_sys: vcc-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_host: vcc-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&host_vbus_drv>; + regulator-name = "vcc_host"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + }; + + vccio_1v8: vccio-1v8-regulator { + compatible = "regulator-fixed"; + regulator-name = "vccio_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + vin-supply = <&vcc_sys>; + }; + + vccio_3v3: vccio-3v3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vccio_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + vin-supply = <&vcc_sys>; + }; + + vcc_otg: vcc-otg-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&otg_vbus_drv>; + regulator-name = "vcc_otg_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + enable-active-high; + regulator-name = "vcc_phy"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vccio_1v8>; + }; + + vdd_arm: vdd-arm-regulator { + compatible = "pwm-regulator"; + pwms = <&pwm1 0 5000 PWM_POLARITY_INVERTED>; + pwm-supply = <&vcc_sys>; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + }; + + vdd_log: vdd-log-regulator { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 5000 PWM_POLARITY_INVERTED>; + pwm-supply = <&vcc_sys>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1300000>; + regulator-always-on; + regulator-boot-on; + }; + + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive = <1000>; /* milliseconds */ + polling-delay = <5000>; /* milliseconds */ + + thermal-sensors = <&tsadc 0>; + + trips { + cpu_alert0: cpu_alert0 { + temperature = <90000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + cpu_alert1: cpu_alert1 { + temperature = <95000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + cpu_crit: cpu_crit { + temperature = <105000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + + cpu_throttle_low: map-cpu-throttle-low { + trip = <&cpu_alert0>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT 1>, + <&cpu1 THERMAL_NO_LIMIT 1>, + <&cpu2 THERMAL_NO_LIMIT 1>, + <&cpu3 THERMAL_NO_LIMIT 1>; + }; + + cpu_throttle_high: map-cpu-throttle-high { + trip = <&cpu_alert1>; + cooling-device = + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + gpu_throttle_low: map-gpu-throttle-low { + trip = <&cpu_alert0>; + cooling-device = + <&gpu THERMAL_NO_LIMIT 1>; + }; + + gpu_throttle_high: map-gpu-throttle-high { + trip = <&cpu_alert1>; + cooling-device = + <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + dmc_throttle_low: map-dmc-throttle-low { + trip = <&cpu_alert0>; + cooling-device = <&dmc THERMAL_NO_LIMIT 1>; + }; + + dmc_throttle_high: map-dmc-throttle-high { + trip = <&cpu_alert1>; + cooling-device = <&dmc THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + }; + }; + }; + +}; + +&codec { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&cru { + assigned-clocks = <&cru PLL_GPLL>, <&cru ARMCLK>, + <&cru PLL_CPLL>, <&cru ACLK_PERI>, + <&cru HCLK_PERI>, <&cru PCLK_PERI>, + <&cru ACLK_CPU>, <&cru HCLK_CPU>, + <&cru PCLK_CPU>, <&cru ACLK_VOP>; + + assigned-clock-rates = <1200000000>, <816000000>, + <500000000>, <150000000>, + <150000000>, <75000000>, + <150000000>, <150000000>, + <75000000>, <400000000>; +}; + +&dmc { + logic-supply = <&vdd_log>; +}; + +&emmc { + cap-mmc-highspeed; + keep-power-in-suspend; + non-removable; + status = "okay"; + /delete-property/ mmc-ddr-1_8v; + /delete-property/ pinctrl-names; + /delete-property/ pinctrl-0; + /delete-property/ rockchip,default-sample-phase; + rockchip,default-sample-phase = <90>; +}; + +&gmac { + assigned-clocks = <&cru SCLK_MAC_SRC>; + assigned-clock-rates = <50000000>; + clock_in_out = "output"; + phy-handle = <&phy>; + phy-mode = "rmii"; + phy-supply = <&vcc_phy>; + tx_delay = <0x26>; + rx_delay = <0x11>; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + phy: phy@0 { + compatible = "ethernet-phy-id1234.d400", + "ethernet-phy-ieee802.3-c22"; + reg = <0>; + clocks = <&cru SCLK_MAC_PHY>; + phy-is-integrated; + resets = <&cru SRST_MACPHY>; + }; + }; +}; + +&gpu { + assigned-clocks = <&cru ACLK_GPU>; + assigned-clock-rates = <300000000>; + mali-supply = <&vdd_log>; +}; + +&gpu_opp_table { + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <1100000 1000000 1200000>; + }; +}; + +&io_domains { + vccio1-supply = <&vccio_3v3>; + vccio2-supply = <&vccio_1v8>; + vccio4-supply = <&vccio_3v3>; + status = "okay"; +}; + +&nfc { + + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + + /delete-property/ pinctrl-names; + /delete-property/ pinctrl-0; + + nand@0 { + reg = <0>; + label = "rk-nand"; + nand-bus-width = <8>; + nand-ecc-mode = "hw"; + nand-ecc-step-size = <1024>; + nand-ecc-strength = <60>; + nand-is-boot-medium; + rockchip,boot-blks = <8>; + rockchip,boot-ecc-strength = <60>; + }; + +}; + +&iep { + status = "okay"; +}; + +&iep_mmu { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; +}; + +&hdmi { + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&hdmi_phy { + status = "okay"; +}; + +&i2s0 { + status = "okay"; +}; + +&i2s1 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +/** Integration to pin controller */ +&pinctrl { + + pcfg_pull_up_12ma: pcfg-pull-up-12ma { + drive-strength = <12>; + bias-pull-up; + }; + + pcfg_pull_down_12ma: pcfg-pull-down-12ma { + drive-strength = <12>; + bias-pull-down; + }; + + pcfg_pull_none_12ma: pcfg-pull-none-12ma { + drive-strength = <12>; + bias-disable; + }; + + pcfg_pull_up_8ma: pcfg-pull-up-8ma { + drive-strength = <8>; + bias-pull-up; + }; + + pcfg_pull_down_8ma: pcfg-pull-down-8ma { + drive-strength = <8>; + bias-pull-down; + }; + + pcfg_pull_none_8ma: pcfg-pull-none-8ma { + drive-strength = <8>; + bias-disable; + }; + + pcfg_pull_up_2ma: pcfg-pull-up-2ma { + drive-strength = <2>; + bias-pull-up; + }; + + pcfg_pull_down_2ma: pcfg-pull-down-2ma { + drive-strength = <2>; + bias-pull-down; + }; + + pcfg_pull_none_2ma: pcfg-pull-none-2ma { + drive-strength = <2>; + bias-disable; + }; + + /* + * Some rk322x electrical schemes report this kind of pull-up/down + * pin configurations. We set them here, but we don't use it in this + * device tree. These instead are useful for overlays, because they seem + * to increase stability on at least one board I got here + */ + sdmmc { + sdmmc_clk: sdmmc-clk { + rockchip,pins = <1 16 1 &pcfg_pull_down>; + }; + + sdmmc_cmd: sdmmc-cmd { + rockchip,pins = <1 15 1 &pcfg_pull_up>; + }; + + sdmmc_bus4: sdmmc-bus4 { + rockchip,pins = <1 18 1 &pcfg_pull_up>, + <1 19 1 &pcfg_pull_up>, + <1 20 1 &pcfg_pull_up>, + <1 21 1 &pcfg_pull_up>; + }; + }; + + /* + * Same as above, decreasing strength of SDIO pins seems to be benefical + * to stability + */ + sdio { + sdio_clk: sdio-clk { + rockchip,pins = <3 0 1 &pcfg_pull_down_2ma>; + }; + + sdio_cmd: sdio-cmd { + rockchip,pins = <3 1 1 &pcfg_pull_up_2ma>; + }; + + sdio_bus4: sdio-bus4 { + rockchip,pins = <3 2 1 &pcfg_pull_up_2ma>, + <3 3 1 &pcfg_pull_up_2ma>, + <3 4 1 &pcfg_pull_up_2ma>, + <3 5 1 &pcfg_pull_up_2ma>; + }; + }; + + /* + * Same drill as above, electrical schemes also report this pull-up/down + * configurations. + */ + emmc { + emmc_clk: emmc-clk { + rockchip,pins = <2 7 2 &pcfg_pull_up>; + }; + + emmc_cmd: emmc-cmd { + rockchip,pins = <1 22 2 &pcfg_pull_up>; + }; + + emmc_bus8: emmc-bus8 { + rockchip,pins = <1 24 2 &pcfg_pull_up>, + <1 25 2 &pcfg_pull_up>, + <1 26 2 &pcfg_pull_up>, + <1 27 2 &pcfg_pull_up>, + <1 28 2 &pcfg_pull_up>, + <1 29 2 &pcfg_pull_up>, + <1 30 2 &pcfg_pull_up>, + <1 31 2 &pcfg_pull_up>; + }; + + emmc_pwr: emmc-pwr { + rockchip,pins = <2 RK_PA5 2 &pcfg_pull_down>; + }; + + emmc_rst: emmc-rst { + rockchip,pins = <1 RK_PC7 2 &pcfg_pull_up>; + }; + + }; + + gpio-items { + gpio_led_working: gpio-led-working { + rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pwm1 { + pwm1_pin_pull_down: pwm1-pin-pull-down { + rockchip,pins = <0 RK_PD6 2 &pcfg_pull_down>; + }; + }; + + pwm2 { + pwm2_pin_pull_up: pwm2-pin-pull-up { + rockchip,pins = <1 RK_PB4 2 &pcfg_pull_up>; + }; + }; + + usb { + host_vbus_drv: host-vbus-drv { + rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart11_xfer &uart11_rts &uart11_cts>; +}; + +&uart2 { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + u2phy0_host: host-port { + phy-supply = <&vcc_host>; + }; + + u2phy0_otg: otg-port { + phy-supply = <&vcc_otg>; + }; +}; + +&u2phy0_otg { + status = "okay"; +}; + +&u2phy0_host { + status = "okay"; +}; + +&u2phy1 { + status = "okay"; + u2phy1_host: host-port { + phy-supply = <&vcc_host>; + }; + + u2phy1_otg: otg-port { + phy-supply = <&vcc_otg>; + }; +}; + +&u2phy1_otg { + status = "okay"; +}; + +&u2phy1_host { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host2_ehci { + status = "okay"; +}; + +&usb_host2_ohci { + status = "okay"; +}; + +&usb_otg { + dr_mode = "host"; + status = "okay"; +}; + +&sdio { + mmc-pwrseq = <&sdio_pwrseq>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + non-removable; + no-sd; + status = "okay"; +}; + +&sdmmc { + cd-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_LOW>; + cd-debounce-delay-ms = <500>; + cap-sd-highspeed; + keep-power-in-suspend; + no-sdio; + status = "okay"; +}; + +&spdif { + status = "okay"; +}; + +&tsadc { + rockchip,grf = <&grf>; + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <1>; + rockchip,hw-tshut-temp = <110000>; + + /* delete the pinctrl-* properties because, on mainline kernel, they (in particular "default") + change the GPIO configuration of the associated PIN. On most boards that pin is not connected + so it does not do anything, but some other boards (X96-Mini) have that pin connected to + a reset pin of the soc or whatever, thus changing the configuration of the pin at boot + causes them to bootloop. + We don't really need these ones though, because since hw-tshut-mode is set to 0, the CRU + unit of the SoC does the reboot*/ + /delete-property/ pinctrl-names; + /delete-property/ pinctrl-0; + /delete-property/ pinctrl-1; + /delete-property/ pinctrl-2; + + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP>; + assigned-clock-parents = <&cru SCLK_HDMI_PHY>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&wdt { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip-6.10/dt/rk3288-xt-q8l-v10.dts b/patch/kernel/archive/rockchip-6.10/dt/rk3288-xt-q8l-v10.dts new file mode 100644 index 000000000000..b715818fe691 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/dt/rk3288-xt-q8l-v10.dts @@ -0,0 +1,1128 @@ +/* + * Copyright (c) 2014, 2015 FUKAUMI Naoki + * 2018 Paolo Sabatino + * + * 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 "rk3288.dtsi" +#include +#include + +/ { + model = "XT-Q8L-V10-RK3288"; + compatible = "generic,xt-q8l-v10-rk3288", "rockchip,rk3288"; + + memory@0 { + reg = <0x0 0x0 0x0 0x80000000>; + device_type = "memory"; + }; + + /* + * Peripheral from original q8 device tree, currently no references + * for drivers in linux kernel. + rockchip-hsadc@ff080000 { + compatible = "rockchip-hsadc"; + reg = <0xff080000 0x4000>; + interrupts = <0x0 0x1f 0x4>; + #address-cells = <0x1>; + #size-cells = <0x0>; + pinctrl-names = "default"; + pinctrl-0 = <0x9a>; + clocks = <0x79 0x7 0x8 0x39>; + clock-names = "hclk_hsadc", "clk_hsadc_out", "clk_hsadc_ext"; + dmas = <0x9b 0x0>; + dma-names = "data"; + status = "disabled"; + }; + */ + + ext_gmac: external-gmac-clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + clock-output-names = "ext_gmac"; + }; + + bt_xtal: bluetooth-xtal-clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <37400000>; + clock-output-names = "txco"; + }; + + /* + * Handle the IR receiver using the gpio-ir-receiver kernel module. + * This works flawlessy, the original xt-q8l-v10 remote uses a NEC + * protocol and the keymap rc-xt-q8l-v10 has to be compiled in the + * kernel for the remote to work as an input device + */ + ir: ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio7 RK_PA0 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_int>; + linux,rc-map-name = "rc-xt-q8l-v10"; + wakeup-source; + }; + + keys: gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&pwr_key>; + + button@0 { + gpio-key,wakeup = <1>; + gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; + label = "GPIO Power"; + linux,code = ; + wakeup-source; + debounce-interval = <100>; + }; + + }; + + leds { + compatible = "gpio-leds"; + + power { + /* + Power led is active high, but we set it here active low + so while there is mass storage access it turns red and + when it is idle is blue + */ + gpios = <&gpio7 2 GPIO_ACTIVE_LOW>; + label = "power"; + linux,default-trigger = "mmc0"; + pinctrl-names = "default"; + pinctrl-0 = <&power_led>; + }; + + }; + + vcc_sys: vsys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio7 11 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_pwr>; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + startup-delay-us = <100000>; + vin-supply = <&vcc_io>; + }; + + vcc_flash: flash-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_flash"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + /*gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>; + states = <1800000 0>, + <3300000 1>; + */ + vin-supply = <&vcc_io>; + startup-delay-us = <100000>; + }; + + vcc_host_5v: usb-host-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>; + regulator-name = "vcc_host_5v"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + enable-active-high; + vin-supply = <&vcc_sys>; + }; + + + vcc_otg_5v: usb-otg-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; + regulator-name = "vcc_otg_5v"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + enable-active-high; + vin-supply = <&vcc_sys>; + }; + + /* + * Required power sequence to properly enable the wireless/bluetooth + * module connected to sdio0 + */ + sdio0_pwrseq: sdio0_pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>; + post-power-on-delay-ms = <100>; + }; + + /* + * Not really needed, and also break some eMMC configuraions + emmc_pwrseq: emmc-pwrseq { + compatible = "mmc-pwrseq-emmc"; + pinctrl-0 = <&emmc_reset>; + pinctrl-names = "default"; + reset-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>; + }; + */ + + /* + * Sound taken from tinkerboard device tree, adapted to q8. + */ + soundcard-hdmi { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "DW-I2S-HDMI"; + simple-audio-card,mclk-fs = <512>; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s>; + }; + }; + + soundcard-spdif { + compatible = "simple-audio-card"; + simple-audio-card,name = "SPDIF"; + simple-audio-card,dai-link@1 { + + cpu { + sound-dai = <&spdif>; + }; + + codec { + sound-dai = <&spdif_out>; + }; + + }; + }; + + spdif_out: spdif-out { + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + +}; + + +&io_domains { + status = "okay"; + + audio-supply = <&vcca_33>; + bb-supply = <&vcc_io>; + dvp-supply = <&vcc_18>; + flash0-supply = <&vcc_flash>; + flash1-supply = <&vcc_lan>; + gpio30-supply = <&vcc_io>; + gpio1830-supply = <&vcc_io>; + lcdc-supply = <&vcc_io>; + sdcard-supply = <&vccio_sd>; + wifi-supply = <&vcc_18>; +}; + +&cpu0 { + cpu0-supply = <&vdd_cpu>; +}; + +&gmac { + assigned-clocks = <&cru SCLK_MAC>; + assigned-clock-parents = <&ext_gmac>; + clock_in_out = "input"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>, <&phy_rst>, <&phy_pmeb>, <&phy_int>; + phy-supply = <&vcc_lan>; + phy-mode = "rgmii"; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 1000000>; + snps,reset-gpio = <&gpio4 8 GPIO_ACTIVE_LOW>; + tx_delay = <0x30>; + rx_delay = <0x10>; + status = "ok"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c5>; + status = "ok"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "ok"; +}; + +&i2c0 { + clock-frequency = <400000>; + status = "ok"; + + vdd_cpu: syr827@40 { + compatible = "silergy,syr827"; + fcs,suspend-voltage-selector = <1>; + reg = <0x40>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <8000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: syr828@41 { + compatible = "silergy,syr828"; + fcs,suspend-voltage-selector = <1>; + reg = <0x41>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <8000>; + regulator-always-on; + vin-supply = <&vcc_sys>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + hym8563: hym8563@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + interrupt-parent = <&gpio0>; + interrupts = <4 IRQ_TYPE_EDGE_FALLING>; + pinctrl-names = "default"; + pinctrl-0 = <&rtc_int>; + }; + + act8846: act8846@5a { + compatible = "active-semi,act8846"; + reg = <0x5a>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_vsel>; + system-power-controller; + + vp1-supply = <&vcc_sys>; + vp2-supply = <&vcc_sys>; + vp3-supply = <&vcc_sys>; + vp4-supply = <&vcc_sys>; + inl1-supply = <&vcc_sys>; + inl2-supply = <&vcc_sys>; + inl3-supply = <&vcc_20>; + wakeup-source; + + regulators { + + /* + * Regulator controlling DDR memory - always on + */ + vcc_ddr: REG1 { + regulator-name = "vcc_ddr"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * Regulator controlling various IO functions of the rk3288. + * Always on + */ + vcc_io: REG2 { + regulator-name = "vcc_io"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * Regulator controlling various board logic. + * Always on. + * rk3288 electrical datasheet says it should have variable + * voltage depending upon dvfs + */ + vdd_log: REG3 { + regulator-name = "vdd_log"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-always-on; + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * No reference for this on electrical datasheet. Maybe this + * is vcc_18? Maybe this is vcc18_flash on electrical datasheet. + * So far we disable it. + */ + vcc_20: REG4 { + regulator-name = "vcc_20"; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-always-on; + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * This regulator controls SDIO. Electrical datasheet says + * this regulator can be operated between 1.8 and 3.3 volts + */ + vccio_sd: REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + */ + }; + + /* + * Controlling HDMI and LCD controller on rk3288. 1.0 volts + * by reference + */ + vdd10_lcd: REG6 { + regulator-name = "vdd10_lcd"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * From the rk3288 electrical datasheet, this regulator powers + * the rk1000 chip, which is absent in our device, but it + * is also supplying bluetooth, so we enable it. + */ + vcca_18: REG7 { + regulator-name = "vcca_18"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + + /* + The regulator can be set off in suspend, but kernel 5.4 modifications + to enable suspend for ACT8865 device break the ACT8846 + regulator-state-mem { + regulator-off-in-suspend; + }; + */ + }; + + /* + * This regulator controls, among other things, the SPDIF + * interface, so we enable it + */ + vcca_33: REG8 { + regulator-name = "vcca_33"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; // Turn this on to get SPDIF! + + /* + The regulator can be set off in suspend, but kernel 5.4 modifications + to enable suspend for ACT8865 device break the ACT8846 + regulator-state-mem { + regulator-off-in-suspend; + }; + */ + }; + + /* + * LAN regulator + */ + vcc_lan: REG9 { + regulator-name = "vcc_lan"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * Regulator controlling PMU, USB PHY and rk3288 PLLs. + * 1.0 volts by reference + */ + vdd_10: REG10 { + regulator-name = "vdd_10"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * Regulator controlling Wifi over SDIO, SARADC and USB PHY. + * Better turn this on + */ + vccio_wl: vcc_18: REG11 { + regulator-name = "vcc_18"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + + /* + * Broken in kernel 5.4 + regulator-state-mem { + regulator-on-in-suspend; + }; + */ + }; + + /* + * Not clear: apparently this controls HDMI and LCD controller + * on rk3368 devices. + * 1.8 volts by reference + */ + vcc18_lcd: REG12 { + regulator-name = "vcc18_lcd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + + /* + The regulator can be set off in suspend, but kernel 5.4 modifications + to enable suspend for ACT8865 device break the ACT8846 + regulator-state-mem { + regulator-off-in-suspend; + }; + */ + }; + }; + }; +}; + +&i2c1 { + status = "disabled"; +}; + +&i2c2 { + status = "disabled"; +}; + +&i2c4 { + + /* + * Here should go the RK1000 audio codec parts, but seems that + * there is no driver in linux kernel at the moment, so we can't + * describe it. + * Also, most important, there is no RK1000 on our board :) + * Datasheet is available here: + * http://dl.radxa.com/rock/docs/hw/ds/RK1000-S%20DATASHEET%20V14.pdf + */ + status = "disabled"; + +}; + +&i2c5 { + status = "okay"; +}; + +&pinctrl { + + /* + These two lines here, these must be commented out! Otherwise for some reason the kernel + does not see the boot device anymore and will stay stuck in initramfs! + On the contrary, these are required by u-boot to keep the power holding so the device does not + automatically turns off after a small timeout + */ + /*pinctrl-names = "default";*/ + /*pinctrl-0 = <&pwr_hold>;*/ + + pcfg_output_high: pcfg-output-high { + output-high; + }; + + pcfg_output_low: pcfg-output-low { + output-low; + }; + + pcfg_wl: pcfg-wl { + bias-pull-up; + drive-strength = <8>; + }; + + pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma { + bias-pull-up; + drive-strength = <8>; + }; + + pcfg_pull_none_8ma: pcfg-pull-none-8ma { + bias-disable; + drive-strength = <8>; + }; + + pcfg_wl_clk: pcfg-wl-clk { + bias-disable; + drive-strength = <12>; + }; + + pcfg_wl_int: pcfg-wl-int { + bias-pull-up; + }; + + act8846 { + + /* + * Original q8 device tree says: + * - gpio0 11 HIGH -> power hold + * - gpio7 1 LOW -> possibly pmic-vsel, we don't care + */ + pmic_vsel: pmic-vsel { + rockchip,pins = <7 1 RK_FUNC_GPIO &pcfg_output_low>; + }; + + pwr_hold: pwr-hold { + rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gmac { + phy_int: phy-int { + rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + phy_pmeb: phy-pmeb { + rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + phy_rst: phy-rst { + rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; + + hym8563 { + rtc_int: rtc-int { + rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + keys { + pwr_key: pwr-key { + rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + power_led: power-led { + rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <7 0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdmmc { + + /* + * Copied from firefly board definition to give more drive to + * the sdmmc pins. The Q8 seems to be quite able to drive + * ultra high speed uSD cards, so we give a bit more energy + * to the gpio pins + */ + sdmmc_bus4: sdmmc-bus4 { + rockchip,pins = <6 16 1 &pcfg_pull_up_drv_8ma>, + <6 17 1 &pcfg_pull_up_drv_8ma>, + <6 18 1 &pcfg_pull_up_drv_8ma>, + <6 19 1 &pcfg_pull_up_drv_8ma>; + }; + + sdmmc_clk: sdmmc-clk { + rockchip,pins = <6 20 1 &pcfg_pull_none_8ma>; + }; + + sdmmc_cmd: sdmmc-cmd { + rockchip,pins = <6 21 1 &pcfg_pull_up_drv_8ma>; + }; + + sdmmc_pwr: sdmmc-pwr { + rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + + usb_host1 { + host_vbus_drv: host-vbus-drv { + rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + + usb_otg { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdio0 { + wifi_enable_h: wifienable-h { + rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_output_high>; + }; + + }; + + + bluetooth { + + uart0_rts_gpio: uart0-rts-gpio { + rockchip,pins = <4 19 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_enable_h: bt-enable-h { + rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_reset_l: bt-reset-l { + rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + bt_wake_h: bt-wake-h { + rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_h: bt-host-wake-h { + rockchip,pins = <4 RK_PD7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + + emmc { + + emmc_reset: emmc-reset { + rockchip,pins = <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + +}; + +&saradc { + vref-supply = <&vcc_18>; + status = "okay"; +}; + +&emmc { + + /* + * eMMC is a 52Mhz DDR device on q8 devices, so set it here. + * Setting default-sample-rate to 180 degrees is very important, + * otherwise the eMMC is not stable and may not be able to negotiate + * the right clock. + * Despite the code already seems to use 180 degree phase when + * MMC + 8bit bus is set, we need to set default phase here too. + * + * Huge hint came from this patch: + * https://patchwork.kernel.org/patch/11129183/ + * + */ + broken-cd; + bus-width = <8>; + cap-mmc-highspeed; + + disable-wp; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_bus8>; + + vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc_flash>; + + mmc-ddr-1_8v; + rockchip,default-sample-phase = <180>; + + status = "okay"; +}; + +&sdmmc { + supports-sd; + + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + cd-gpios = <&gpio6 RK_PC6 GPIO_ACTIVE_LOW>; + cd-debounce-delay-ms = <500>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + sd-uhs-ddr50; + + status = "okay"; +}; + +&sdio0 { + #address-cells = <1>; + #size-cells = <0>; + + bus-width = <4>; + mmc-pwrseq = <&sdio0_pwrseq>; + + vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc_18>; // This must be the same as in io_domains, + // otherwise the mmc1 device won't be detected properly + + // clock-frequency = <50000000>; + // max-frequency = <50000000>; + + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4>, <&sdio0_cmd>, <&sdio0_clk>, <&sdio0_int>; + + cap-sdio-irq; + no-mmc; + no-sd; + cap-sd-highspeed; // required, otherwise does not work! + supports-sdio; + non-removable; + + keep-power-in-suspend; + disable-wp; + + + status = "okay"; + + brcmf: bcrmf@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio4>; + interrupts = ; + interrupt-names = "host-wake"; + status = "okay"; + }; + + //sd-uhs-sdr104; // required to be disabled, otherwise the device get + // detected, but there is no communication + +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_clk>, <&spi0_cs0>, <&spi0_tx>, <&spi0_rx>, <&spi0_cs1>; + status = "okay"; +}; + +&tsadc { + rockchip,grf = <&grf>; + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +/* + * These dmas described here for uarts are present in original q8 board + * dts, so I replicate them here because documentation says that serial + * ports can have dmas. + * note: + * - uart0 is the serial port connected to the bluetooth module + * - uart2 is the onboard serial port + * + * As ok kernel 4.19 DMA for serial ports is disabled because it makes + * the ports unusable + * + */ +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer>, <&uart0_rts>, <&uart0_cts>; + +// dmas = <&dmac_peri 1 &dmac_peri 2>; +// dma-names = "tx", "rx"; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4330-bt"; + max-speed = <4000000>; + + shutdown-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; + device-wakeup-gpios = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; + //interrupt-parent = <&gpio4>; + //interrupt-names = "host-wakeup"; + //interrupts = ; + clock-names = "lpo", "txco"; + clocks = <&hym8563>, <&bt_xtal>; + vddio-supply = <&vcca_18>; + vbat-supply = <&vcca_18>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_enable_h>, <&bt_wake_h>, <&bt_host_wake_h>, <&bt_reset_l>; + brcm,bt-pcm-int-params = [01 02 00 01 01]; + status = "okay"; + }; + +}; + +&uart1 { + //dmas = <&dmac_peri 3 &dmac_peri 4>; + //dma-names = "tx", "rx"; + status = "okay"; +}; + +&uart2 { + //dmas = <&dmac_bus_s 4 &dmac_bus_s 5>; + //dma-names = "tx", "rx"; + status = "okay"; +}; + +&uart3 { + //dmas = <&dmac_peri 7 &dmac_peri 8>; + //dma-names = "tx", "rx"; + status = "okay"; +}; + +&uart4 { + //dmas = <&dmac_peri 9 &dmac_peri 10>; + //dma-names = "tx", "rx"; + status = "disabled"; +}; + +/* + * Here usbphy* should have their proper reset lines described in rk3288.dtsi + * Describing resets for usb phy is important because otherwise the USB + * port gets stuck in case it goes into autosuspend: plugging any device + * when the port is autosuspended will actually kill the port itself and + * require a power cycle. + * This is required for the usbphy1 phy, nonetheless it is a good idea to + * specify the proper resources for all the phys though. + * The reference patch which works in conjuction with the reset lines: + * https://patchwork.kernel.org/patch/9469811/ + * + */ +&usbphy { + status = "okay"; +}; + +&usb_host0_ehci { + reg = <0x0 0xff500000 0x0 0x20000>; + status = "disable"; +}; + +&usb_host1 { + vbus-supply = <&vcc_host_5v>; + status = "okay"; +}; + +&usb_otg { + vbus-supply = <&vcc_otg_5v>; + status = "okay"; +}; + +/* + * Enable VPU services and complete the relative IOMMU configurations + */ +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vpu_mmu { + status = "okay"; +}; + +&hevc { + status = "okay"; +}; + +&hevc_mmu { + status = "okay"; +}; + +&rga { + status = "okay"; +}; + +&wdt { + status = "okay"; +}; + +// i2s bus is present on q8 device, enable it +&i2s { + #sound-dai-cells = <0>; + status = "okay"; +}; + +// spdif is present on q8 device, enable it +&spdif { + status = "okay"; +}; + +/* + * Redefine some thermals to give a bit more headroom (+5°C) + */ +&cpu_alert0 { + temperature = <75000>; +}; + +&cpu_alert1 { + temperature = <80000>; +}; + +&gpu_alert0 { + temperature = <75000>; +}; + +/* + * Retouch the operating points for higher frequencies to reduce + * the voltage required + */ +&cpu_opp_table { + opp-1512000000 { + opp-microvolt = <1250000>; + }; + + opp-1608000000 { + opp-microvolt = <1300000>; + }; + + /* + Remove the overclocking/turbo frequencies + */ + /delete-node/ opp@1704000000; + /delete-node/ opp@1800000000; + /delete-node/ opp@1896000000; + /delete-node/ opp@1920000000; + /delete-node/ opp@1992000000; + /delete-node/ opp@2016000000; + /delete-node/ opp@2040000000; + /delete-node/ opp@2064000000; + /delete-node/ opp@2088000000; + /delete-node/ opp@2112000000; + /delete-node/ opp@2136000000; + /delete-node/ opp@2160000000; + /delete-node/ opp@2184000000; + /delete-node/ opp@2208000000; + + +}; + +&gpu_opp_table { + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <1150000>; + }; + + opp-600000000 { + status = "disabled"; + }; + +}; + + +&gpiomem { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip-6.10/kernel-6.8-tools-cgroup-makefile.patch b/patch/kernel/archive/rockchip-6.10/kernel-6.8-tools-cgroup-makefile.patch new file mode 100644 index 000000000000..068fe83689d6 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/kernel-6.8-tools-cgroup-makefile.patch @@ -0,0 +1,17 @@ +diff --git a/tools/cgroup/Makefile b/tools/cgroup/Makefile +new file mode 100644 +index 000000000000..ffca068e4a76 +--- /dev/null ++++ b/tools/cgroup/Makefile +@@ -0,0 +1,11 @@ ++# SPDX-License-Identifier: GPL-2.0 ++# Makefile for cgroup tools ++ ++CFLAGS = -Wall -Wextra ++ ++all: cgroup_event_listener ++%: %.c ++ $(CC) $(CFLAGS) -o $@ $^ ++ ++clean: ++ $(RM) cgroup_event_listener diff --git a/patch/kernel/archive/rockchip-6.10/libreelec.series b/patch/kernel/archive/rockchip-6.10/libreelec.series new file mode 100644 index 000000000000..6d4878166c87 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/libreelec.series @@ -0,0 +1,9 @@ +# Series from patches.libreelec/ + patches.libreelec/linux-0002-rockchip-from-list.patch + patches.libreelec/linux-0011-v4l2-from-list.patch + patches.libreelec/linux-1000-drm-rockchip.patch + patches.libreelec/linux-1001-v4l2-rockchip.patch + patches.libreelec/linux-1002-for-libreelec.patch + patches.libreelec/linux-1003-temp-dw_hdmi-rockchip.patch + patches.libreelec/linux-2000-v4l2-wip-rkvdec-hevc.patch + patches.libreelec/linux-2001-v4l2-wip-iep-driver.patch diff --git a/patch/kernel/archive/rockchip-6.10/overlay/Makefile b/patch/kernel/archive/rockchip-6.10/overlay/Makefile new file mode 100644 index 000000000000..9aa0bda64de5 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/Makefile @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ + rockchip-ds1307.dtbo \ + rockchip-i2c1.dtbo \ + rockchip-i2c4.dtbo \ + rockchip-spi0.dtbo \ + rockchip-spi2.dtbo \ + rockchip-spidev0.dtbo \ + rockchip-spidev2.dtbo \ + rockchip-uart1.dtbo \ + rockchip-uart2.dtbo \ + rockchip-uart3.dtbo \ + rockchip-uart4.dtbo \ + rockchip-w1-gpio.dtbo \ + rk322x-emmc.dtbo \ + rk322x-emmc-pins.dtbo \ + rk322x-emmc-ddr-ph45.dtbo \ + rk322x-emmc-ddr-ph180.dtbo \ + rk322x-emmc-hs200.dtbo \ + rk322x-nand.dtbo \ + rk322x-led-conf-default.dtbo \ + rk322x-led-conf1.dtbo \ + rk322x-led-conf2.dtbo \ + rk322x-led-conf3.dtbo \ + rk322x-led-conf4.dtbo \ + rk322x-led-conf5.dtbo \ + rk322x-led-conf6.dtbo \ + rk322x-led-conf7.dtbo \ + rk322x-led-conf8.dtbo \ + rk322x-cpu-hs.dtbo \ + rk322x-cpu-hs-lv.dtbo \ + rk322x-wlan-alt-wiring.dtbo \ + rk322x-cpu-stability.dtbo \ + rk322x-ir-wakeup.dtbo \ + rk322x-ddr3-330.dtbo \ + rk322x-ddr3-528.dtbo \ + rk322x-ddr3-660.dtbo \ + rk322x-ddr3-800.dtbo \ + rk322x-bt-8723cs.dtbo \ + rk322x-usb-otg-peripheral.dtbo + + +scr-$(CONFIG_ARCH_ROCKCHIP) += \ + rk322x-fixup.scr \ + rockchip-fixup.scr + +dtbotxt-$(CONFIG_ARCH_ROCKCHIP) += \ + README.rk322x-overlays \ + README.rockchip-overlays + +dtb-y += $(dtbo-y) $(scr-y) $(dtbotxt-y) + +clean-files := *.dtbo *.scr + diff --git a/patch/kernel/archive/rockchip-6.10/overlay/README.rk322x-overlays b/patch/kernel/archive/rockchip-6.10/overlay/README.rk322x-overlays new file mode 100644 index 000000000000..1d36d171746f --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/README.rk322x-overlays @@ -0,0 +1,98 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ + +### Platform: + +rk322x (Rockchip) + +### Provided overlays: + +- rk322x-cpu-hs +- rk322x-cpu-stability +- rk322x-emmc* +- rk322x-nand +- rk322x-emmc-nand +- rk322x-led-conf* +- rk322x-wlan-alt-wiring +- rk322x-ddr3-* +- rk322x-bt-* +- rk322x-usb-otg-peripheral +- rk322x-ir-wakeup + +### Overlay details: + +### rk322x-cpu-hs + +Activates higher CPU speed (up to 1.4ghz) for rk3228b/rk3229 boxes + +### rk322x-cpu-stability + +Increases the voltage of the lowest operating point to increase stability +on some boards which have power regulation issues. Also adds a settling +time to allow power regulator stabilize voltage. + +### emmc* + +rk322x-emmc activates onboard emmc device node and deactivates the +nand controller. +rk322x-emmc-pins sets the pin controller default pull up/down +configuration, not all boards are happy with this overlay, so your +mileage may vary and may want to not use it. +rk322x-emmc-ddr-ph45/ph180 sets the emmc ddr mode. First overlay +sets the default phase clock shifting to 45 degrees, the second +overlay to 180 degrees. They are alternative, choose the one that +makes your emmc perform better. +rk322x-emmc-hs200 enables the hs200 mode. It is preferable to +ddr mode because it is more stable, but old emmc parts don't +support it. + +### nand + +Activates onboard nand device node and deactivates the emmc controller. +Also sets up the pin controller default pull up/down configuration + +### rk322x-led-conf* + +Each device tree of this kind provides a different known wiring configuration +(ie: gpio and active low/high) of the onboard leds. Each board manufacturer +usually choose a different GPIO for the auxiliary led, but the main "working" +led is always wired to the same gpio (although it may be active high or low) +led-conf1 is commonly found in boards made by Chiptrip manufacturer +led-conf2 is found in other boards with R329Q and MXQ_RK3229 marking +led-conf3 is found in boards with R28-MXQ marking +led-conf4 is found on boards with T066 marking +led-conf5 is found on boards with IPB900 marking from AEMS PVT +led-conf6 is found on boards with MXQ_PRO_V72 and similar markings, possibly +with eMCP module. +led-conf7 is found on boards with R29_MXQ, R2B_MXQ and H20 markings +led-conf8 is specific for H20_221_V1.71 boards, but may work on other variants + +### rk322x-alt-wiring + +Some boards have different SDIO wiring setup for wifi chips. This overlay +enables the different pin controller wiring and power enable + +### rk322x-ddr3-* + +Enable DRAM memory controller and sets the speed to the given speed bin. +The DRAM memory controller reclocking only works with DDR3/LPDDR3, if +you enable one of these overlays on boards with DDR2 memory the system +will not boot anymore + +### rk322x-bt-* + +Overlays that enable bluetooth devices. Most common bluetooth chips are +realtek ones. +rk322x-bt-8723cs: enable this overlay for 8723cs and 8703bs wifi/bluetooth + +### rk322x-usb-otg-peripheral + +Set the OTG USB port to peripheral mode to be used as USB slave instead +of USB host + +### rk322x-ir-wakeup + +Enable the rockchip-ir-driver in place of the standard gpio-ir-receiver. +The rockchip-specific driver exploits the Trust OS and Virtual Poweroff mode +to allow power up via remote controller power button. diff --git a/patch/kernel/archive/rockchip-6.10/overlay/README.rockchip-overlays b/patch/kernel/archive/rockchip-6.10/overlay/README.rockchip-overlays new file mode 100644 index 000000000000..df4559ca2623 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/README.rockchip-overlays @@ -0,0 +1,78 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ + +### Platform: + +rockchip (Rockchip) + +### Provided overlays: + +- ds1307 +- i2c1 +- i2c4 +- spi0 +- spi2 +- spidev0 +- spidev2 +- uart1 +- uart2 +- uart3 +- uart4 +- w1-gpio + +### Overlay details: + +### ds1307 + +Activates ds1307 rtc on i2c1 + +### i2c1 + +Activate i2c1 + +### i2c4 + +Activate i2c4 + +### spi0 + +Activate spi0 +conflicts with uart4 + +### spi2 + +Activate spi2 + +### spidev0 + +Activate spidev on spi0 +Depends on spi0 + +### spidev2 + +Activate spidev on spi2 +depends on spi2 + +### uart1 + +Activate uart1 + +### uart2 + +Activate uart2 + +### uart3 + +Activate uart3 + +### uart4 + +Activate uart4 +Conflicts with spi0 + +### w1-gpio + +Activates 1-wire gpio master on GPIO0 17 + + diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-bt-8723cs.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-bt-8723cs.dtso new file mode 100644 index 000000000000..48bb04f779fa --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-bt-8723cs.dtso @@ -0,0 +1,19 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +&uart1 { + pinctrl-0 = <&uart11_xfer>, <&uart11_rts>, <&uart11_cts>; + pinctrl-names = "default"; + uart-has-rtscts; + status = "okay"; + bluetooth { + compatible = "realtek,rtl8723cs-bt"; + enable-gpios = <&gpio2 RK_PD5 GPIO_ACTIVE_HIGH>; + device-wake-gpios = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio3 RK_PD2 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs-lv.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs-lv.dtso new file mode 100644 index 000000000000..5f7d2dcf42d0 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs-lv.dtso @@ -0,0 +1,68 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&cpu0_opp_table>; + __overlay__ { + opp-600000000 { + opp-microvolt = <950000 950000 1275000>; + }; + opp-816000000 { + opp-microvolt = <950000 950000 1275000>; + }; + opp-1008000000 { + opp-microvolt = <1000000 1000000 1275000>; + }; + opp-1200000000 { + opp-microvolt = <1100000 1100000 1275000>; + }; + opp-1296000000 { + opp-hz = /bits/ 64 <1296000000>; + opp-microvolt = <1150000 1150000 1275000>; + }; + opp-1392000000 { + opp-hz = /bits/ 64 <1392000000>; + opp-microvolt = <1225000 1225000 1275000>; + }; + }; + }; + + fragment@1 { + target = <&gpu_opp_table>; + __overlay__ { + opp-200000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + opp-300000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + opp-400000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + opp-500000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + }; + }; + + fragment@2 { + target = <&dmc_opp_table>; + __overlay__ { + opp-330000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + opp-534000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + opp-660000000 { + opp-microvolt = <1050000 1050000 1200000>; + }; + opp-786000000 { + opp-microvolt = <1100000 1050000 1200000>; + }; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs.dtso new file mode 100644 index 000000000000..1c2fc79e1ccf --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-hs.dtso @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&cpu0_opp_table>; + __overlay__ { + + opp-1296000000 { + opp-hz = /bits/ 64 <1296000000>; + opp-microvolt = <1325000 1325000 1400000>; + }; + opp-1392000000 { + opp-hz = /bits/ 64 <1392000000>; + opp-microvolt = <1350000 1350000 1400000>; + }; + /* + opp-1464000000 { + opp-hz = /bits/ 64 <1464000000>; + opp-microvolt = <1400000 1400000 1400000>; + }; + */ + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-stability.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-stability.dtso new file mode 100644 index 000000000000..f434af9268fb --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-cpu-stability.dtso @@ -0,0 +1,52 @@ +/dts-v1/; +/plugin/; + +/ { + + /* + Device tree overlay that tries to overcome issues on power regulators (expecially ARM + power regulator) increasing lowest voltage and adding settling time to allow voltage + stabilization + */ + + fragment@0 { + target = <&cpu0_opp_table>; + __overlay__ { + + /* + Increase 600 and 800 Mhz operating points voltage to decrease the range + between minimum and maximum voltages + */ + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1100000>; + }; + + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1100000>; + }; + + }; + }; + + fragment@1 { + target = <&vdd_arm>; + __overlay__ { + + regulator-ramp-delay = <300>; // 30 uV/us, so 0.3v transition settling time is 1ms + + }; + }; + + fragment@2 { + target = <&vdd_log>; + __overlay__ { + + regulator-ramp-delay = <600>; // 600 uV/us, so 0,3v transition settling time is 0.5ms + + }; + + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-330.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-330.dtso new file mode 100644 index 000000000000..78145548ed7c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-330.dtso @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&dmc>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&dmc_opp_table>; + __overlay__ { + opp-534000000 { + status = "disabled"; + }; + opp-660000000 { + status = "disabled"; + }; + opp-786000000 { + status = "disabled"; + }; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-528.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-528.dtso new file mode 100644 index 000000000000..dbbd222dd8df --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-528.dtso @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&dmc>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&dmc_opp_table>; + __overlay__ { + opp-534000000 { + status = "okay"; + }; + opp-660000000 { + status = "disabled"; + }; + opp-786000000 { + status = "disabled"; + }; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-660.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-660.dtso new file mode 100644 index 000000000000..65b707515bfb --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-660.dtso @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&dmc>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&dmc_opp_table>; + __overlay__ { + opp-534000000 { + status = "okay"; + }; + opp-660000000 { + status = "okay"; + }; + opp-786000000 { + status = "disabled"; + }; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-800.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-800.dtso new file mode 100644 index 000000000000..7d11453adf9d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ddr3-800.dtso @@ -0,0 +1,28 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&dmc>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&dmc_opp_table>; + __overlay__ { + opp-534000000 { + status = "okay"; + }; + opp-660000000 { + status = "okay"; + }; + opp-786000000 { + status = "okay"; + }; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph180.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph180.dtso new file mode 100644 index 000000000000..4ba0afb8a3a4 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph180.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&emmc>; + __overlay__ { + mmc-ddr-1_8v; + rockchip,default-sample-phase = <180>; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph45.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph45.dtso new file mode 100644 index 000000000000..73104525de57 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-ddr-ph45.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&emmc>; + __overlay__ { + mmc-ddr-1_8v; + rockchip,default-sample-phase = <45>; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-hs200.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-hs200.dtso new file mode 100644 index 000000000000..6ea81f5e74b0 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-hs200.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&emmc>; + __overlay__ { + mmc-hs200-1_8v; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-pins.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-pins.dtso new file mode 100644 index 000000000000..9b918e3172fd --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc-pins.dtso @@ -0,0 +1,34 @@ +/dts-v1/; +/plugin/; + +#include +#include + +&{/} { + + emmc_pwrseq: emmc-pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>; + }; + + sdmmc_pwrseq: sdmmc-pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + }; + +}; + +&emmc { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8 &emmc_pwr &emmc_rst>; + mmc-pwrseq = <&emmc_pwrseq>; +}; + +&sdmmc { + mmc-pwrseq = <&sdmmc_pwrseq>; +}; + +&nfc { + status = "disabled"; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc.dtso new file mode 100644 index 000000000000..0a59ee30e5ee --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-emmc.dtso @@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&emmc>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&nfc>; + __overlay__ { + status = "disabled"; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-fixup.scr-cmd b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-fixup.scr-cmd new file mode 100644 index 000000000000..d4c39e20a3a2 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-fixup.scr-cmd @@ -0,0 +1,4 @@ +# overlays fixup script +# implements (or rather substitutes) overlay arguments functionality +# using u-boot scripting, environment variables and "fdt" command + diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ir-wakeup.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ir-wakeup.dtso new file mode 100644 index 000000000000..f479a1e28d8e --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-ir-wakeup.dtso @@ -0,0 +1,16 @@ +/dts-v1/; +/plugin/; + +/* + * Disable regular gpio-ir-receiver and enable + * rockchip-ir-receiver driver; also enables virtual + * poweroff on shutdown to allow restart with power key + * on remote controller + */ +&ir_receiver { + status = "disabled"; +}; + +&rockchip_ir_receiver { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf-default.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf-default.dtso new file mode 100644 index 000000000000..7e4b35e333e7 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf-default.dtso @@ -0,0 +1,22 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + + fragment@0 { + target-path = "/gpio-leds"; + __overlay__ { + + working { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + }; + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf1.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf1.dtso new file mode 100644 index 000000000000..7c76621c410d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf1.dtso @@ -0,0 +1,64 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + + fragment@0 { + target-path = "/gpio-leds"; + __overlay__ { + + working { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + }; + + auxiliary { + gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_aux>; + }; + + }; + }; + + fragment@1 { + target-path = "/pinctrl/gpio-items"; + __overlay__ { + + gpio_led_aux: gpio-led-aux { + rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + }; + }; + + fragment@2 { + target = <&gpio_keys>; + __overlay__ { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf2.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf2.dtso new file mode 100644 index 000000000000..79892261647c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf2.dtso @@ -0,0 +1,64 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + + fragment@0 { + target-path = "/gpio-leds"; + __overlay__ { + + working { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + + auxiliary { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_aux>; + }; + + }; + }; + + fragment@1 { + target-path = "/pinctrl/gpio-items"; + __overlay__ { + + gpio_led_aux: gpio-led-aux { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + }; + }; + + fragment@2 { + target = <&gpio_keys>; + __overlay__ { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf3.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf3.dtso new file mode 100644 index 000000000000..9ec6d2ed0114 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf3.dtso @@ -0,0 +1,64 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + + fragment@0 { + target-path = "/gpio-leds"; + __overlay__ { + + working { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + }; + + auxiliary { + gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_aux>; + }; + + }; + }; + + fragment@1 { + target-path = "/pinctrl/gpio-items"; + __overlay__ { + + gpio_led_aux: gpio-led-aux { + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + }; + }; + + fragment@2 { + target = <&gpio_keys>; + __overlay__ { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf4.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf4.dtso new file mode 100644 index 000000000000..6c2ca95e6351 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf4.dtso @@ -0,0 +1,96 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + + fragment@0 { + target-path = "/gpio-leds"; + __overlay__ { + + working { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + }; + + auxiliary { + gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_aux>; + }; + + }; + }; + + fragment@1 { + target-path = "/pinctrl/gpio-items"; + __overlay__ { + + gpio_led_working: gpio-led-working { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_aux: gpio-led-aux { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + }; + + fragment@2 { + target = <&gpio_keys>; + __overlay__ { + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + + }; + }; + + fragment@3 { + target = <&sdio_pwrseq>; + __overlay__ { + + reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; /* GPIO2_D3 */ + + }; + + }; + + fragment@4 { + target = <&wifi_enable_h>; + __overlay__ { + + rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + + }; + + }; + + fragment@5 { + target = <&sdio>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + wifi@1 { + compatible = "esp,esp8089"; + reg = <1>; + esp,crystal-26M-en = <0>; + }; + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf5.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf5.dtso new file mode 100644 index 000000000000..5173872d116f --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf5.dtso @@ -0,0 +1,97 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/* + * gpio configuration for AEMS IPB900 boards + * + * - enables working and auxiliary leds + * - fixes low strength on sdio pins for wifi + */ + +/ { + + fragment@0 { + target-path = "/gpio-leds"; + __overlay__ { + + working { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + + auxiliary { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_LOW>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_aux>; + }; + + }; + }; + + fragment@1 { + target-path = "/pinctrl/gpio-items"; + __overlay__ { + + gpio_led_aux: gpio-led-aux { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + }; + }; + + fragment@2 { + target = <&gpio_keys>; + __overlay__ { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + + }; + }; + + fragment@3 { + target = <&sdio_bus4>; + __overlay__ { + rockchip,pins = <3 2 1 &pcfg_pull_none_8ma>, + <3 3 1 &pcfg_pull_none_8ma>, + <3 4 1 &pcfg_pull_none_8ma>, + <3 5 1 &pcfg_pull_none_8ma>; + }; + + }; + + fragment@4 { + target = <&sdio_clk>; + __overlay__ { + rockchip,pins = <3 0 1 &pcfg_pull_none_8ma>; + }; + }; + + fragment@5 { + target = <&sdio_cmd>; + __overlay__ { + rockchip,pins = <3 1 1 &pcfg_pull_none_8ma>; + }; + }; + + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf6.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf6.dtso new file mode 100644 index 000000000000..f7169eb5f29e --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf6.dtso @@ -0,0 +1,96 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/* + * gpio configuration for MXQ_PRO eMCP boards + * + * - fixes low strength on sdio pins for wifi + * - correct gpio pins for wifi + * - set emmc pins and default phase shift + */ + +/ { + + fragment@0 { + target-path = "/pinctrl/gpio-items"; + __overlay__ { + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + }; + }; + + fragment@1 { + target = <&gpio_keys>; + __overlay__ { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + + }; + }; + + fragment@2 { + target = <&sdio_bus4>; + __overlay__ { + rockchip,pins = <3 2 1 &pcfg_pull_up>, + <3 3 1 &pcfg_pull_up>, + <3 4 1 &pcfg_pull_up>, + <3 5 1 &pcfg_pull_up>; + }; + + }; + + fragment@3 { + target = <&sdio_clk>; + __overlay__ { + rockchip,pins = <3 0 1 &pcfg_pull_none>; + }; + }; + + fragment@4 { + target = <&sdio_cmd>; + __overlay__ { + rockchip,pins = <3 1 1 &pcfg_pull_up>; + }; + }; + + fragment@5 { + target = <&sdio_pwrseq>; + __overlay__ { + post-power-on-delay-ms = <300>; + power-off-delay-us = <200000>; + reset-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>; + }; + }; + + fragment@6 { + target = <&sdio>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + wifi@1 { + compatible = "esp,esp8089"; + reg = <1>; + esp,crystal-26M-en = <1>; + }; + + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf7.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf7.dtso new file mode 100644 index 000000000000..e37c3ab004ee --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf7.dtso @@ -0,0 +1,180 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/* + * gpio configuration for R29_MXQ boards + * + */ + +&{/gpio-leds} { + + working { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + pinctrl-0 = <&gpio_led_working>; + }; + + auxiliary { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_auxiliary>; + }; + +}; + +&{/pinctrl/gpio-items} { + + gpio_led_working: gpio-led-working { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_auxiliary: gpio-led-auxiliary { + rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_ethlink: gpio-led-ethlink{ + rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_ethled: gpio-led-ethled{ + rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + +}; + +&gpio_keys { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + +}; + +&emmc { + + rockchip,default-sample-phase = <112>; + bus-width = <8>; + clock-frequency = <125000000>; + max-frequency = <125000000>; + +}; + +&vdd_arm { + + compatible = "regulator-fixed"; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + +}; + +&vdd_log { + + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + +}; + +/* + * R29, R2B ad H20 boards require a GPIO to be turned low to enable HDMI output, we simulate it + * here as a regulator that must be always on. + * Also these boards don't have the necessary power regulators for CPU and Logic. + * R29 and R2B have a single power regulator fixed to 1.2v, hence the CPU can't go over 1.0 ghz + */ +&{/} { + + vdd_hdmi_phy: vdd-hdmi-phy-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_phy_enable>; + regulator-name = "vdd-hdmi-phy"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + }; + + cpu_opp_table_r29: cpu-opp-table-r29 { + compatible = "operating-points-v2"; + opp-shared; + + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1200000>; + clock-latency-ns = <40000>; + opp-suspend; + }; + + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1200000>; + }; + + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1200000>; + }; + + }; + +}; + +&pinctrl { + + hdmi-phy { + hdmi_phy_enable: hdmi-phy-enable { + rockchip,pins = <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + +}; + +&pwm1 { + status = "disabled"; +}; + +&pwm2 { + status = "disabled"; +}; + +&cpu0 { + operating-points-v2 = <&cpu_opp_table_r29>; +}; + +&cpu1 { + operating-points-v2 = <&cpu_opp_table_r29>; +}; + +&cpu2 { + operating-points-v2 = <&cpu_opp_table_r29>; +}; + +&cpu3 { + operating-points-v2 = <&cpu_opp_table_r29>; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf8.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf8.dtso new file mode 100644 index 000000000000..b1be4e41077a --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-led-conf8.dtso @@ -0,0 +1,109 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/* + * gpio configuration for H20_221_V1.71 boards + * + */ + +&{/gpio-leds} { + + working { + gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "none"; + pinctrl-0 = <&gpio_led_working>; + }; + + auxiliary { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "auxiliary"; + linux,default-trigger = "mmc2"; + default-state = "off"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_led_auxiliary>; + }; + +}; + +&{/pinctrl/gpio-items} { + + gpio_led_working: gpio-led-working { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_auxiliary: gpio-led-auxiliary { + rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_ethlink: gpio-led-ethlink{ + rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + gpio_led_ethled: gpio-led-ethled{ + rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + reset_key: reset-key { + rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + +}; + +&gpio_keys { + + pinctrl-names = "default"; + pinctrl-0 = <&reset_key>; + + reset { + gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + debounce-interval = <200>; + wakeup-source; + }; + +}; + +&emmc { + + rockchip,default-sample-phase = <112>; + bus-width = <8>; + clock-frequency = <125000000>; + max-frequency = <125000000>; + +}; + +/* + * R29, R2B ad H20 boards require a GPIO to be turned low to enable HDMI output, we simulate it + * here as a regulator that must be always on. + * Also these boards don't have the necessary power regulators for CPU and Logic. + * R29 and R2B have a single power regulator fixed to 1.2v, hence the CPU can't go over 1.0 ghz + */ +&{/} { + + vdd_hdmi_phy: vdd-hdmi-phy-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_phy_enable>; + regulator-name = "vdd-hdmi-phy"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + }; + +}; + +&pinctrl { + + hdmi-phy { + hdmi_phy_enable: hdmi-phy-enable { + rockchip,pins = <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-nand.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-nand.dtso new file mode 100644 index 000000000000..2a939ab492c8 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-nand.dtso @@ -0,0 +1,22 @@ +/dts-v1/; +/plugin/; + +/ { + + fragment@0 { + target = <&nfc>; + __overlay__ { + status = "okay"; + pinctrl-0 = <&flash_cs0 &flash_cs1 &flash_cs2 &flash_cs3 &flash_rdy &flash_ale &flash_cle &flash_wrn &flash_bus8 &flash_dqs &flash_wp>; + pinctrl-names = "default"; + }; + }; + + fragment@1 { + target = <&emmc>; + __overlay__ { + status = "disabled"; + }; + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-usb-otg-peripheral.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-usb-otg-peripheral.dtso new file mode 100644 index 000000000000..01e03d816c1d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-usb-otg-peripheral.dtso @@ -0,0 +1,11 @@ +/dts-v1/; +/plugin/; + +/* + * change OTG USB port mode to "peripheral" + * + */ + +&usb_otg { + dr_mode = "peripheral"; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rk322x-wlan-alt-wiring.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-wlan-alt-wiring.dtso new file mode 100644 index 000000000000..f04c9ac166be --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rk322x-wlan-alt-wiring.dtso @@ -0,0 +1,67 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + + fragment@0 { + target = <&pinctrl>; + __overlay__ { + + pcfg_pull_none_drv_4ma: pcfg-pull-none-drv-4ma { + bias-disable; + drive-strength = <0x04>; + }; + + pcfg_pull_up_drv_4ma: pcfg-pull-up-drv-4ma { + bias-pull-up; + drive-strength = <0x04>; + }; + + sdio { + sdio_clk: sdio-clk { + rockchip,pins = <1 0 1 &pcfg_pull_none_drv_4ma>; + }; + + sdio_cmd: sdio-cmd { + rockchip,pins = <0 3 2 &pcfg_pull_up_drv_4ma>; + }; + + sdio_bus4: sdio-bus4 { + rockchip,pins = <1 1 1 &pcfg_pull_up_drv_4ma>, + <1 2 1 &pcfg_pull_up_drv_4ma>, + <1 4 1 &pcfg_pull_up_drv_4ma>, + <1 5 1 &pcfg_pull_up_drv_4ma>; + }; + }; + + }; + + }; + + fragment@1 { + target = <&sdio_pwrseq>; + __overlay__ { + reset-gpios = <&gpio2 RK_PD5 GPIO_ACTIVE_HIGH>; + }; + }; + + fragment@2 { + target = <&wifi_enable_h>; + __overlay__ { + rockchip,pins = <2 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + fragment@3 { + target = <&sdio>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&sdio_clk &sdio_cmd &sdio_bus4>; + }; + + }; + +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..937c261aecb88dda45e04b491b7e7337455b3dce GIT binary patch literal 485 zcmZ8dOHRWu5S>t1AXEfM900mu(JDVbbrfM8lP zHw`c~daW7eMOU9;OialdjAX}oBuDd329CSArrH|q`rYmkPvibk@nHY>-)^LZ8awrR zs5^;v-Yxc@2O4Y7Y%cve{7}EcIX6|!yxM9BfdUgIgq6!= literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtso new file mode 100644 index 000000000000..ab7d648c2aa5 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-ds1307.dtso @@ -0,0 +1,23 @@ +/* Definitions for ds1307 +* From ASUS: https://github.com/TinkerBoard/debian_kernel/commits/develop/arch/arm/boot/dts/overlays/ds1307-overlay.dts +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + + fragment@0 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + rtc: ds1307@68 { + compatible = "dallas,ds1307"; + reg = <0x68>; + status = "okay"; + }; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-fixup.scr-cmd b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-fixup.scr-cmd new file mode 100644 index 000000000000..d4c39e20a3a2 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-fixup.scr-cmd @@ -0,0 +1,4 @@ +# overlays fixup script +# implements (or rather substitutes) overlay arguments functionality +# using u-boot scripting, environment variables and "fdt" command + diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..fd1b3d988f6d737cd0ed7d3ee0bccf85574e1152 GIT binary patch literal 262 zcmcb>`|m9S10x#)1A_$+zW`zlAQl8-0U!neIUwEuW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= RhT@XMlG0*^OrvB&1_1ePE@A)x literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtso new file mode 100644 index 000000000000..f09f85e42cba --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c1.dtso @@ -0,0 +1,16 @@ +/* Definitions for i2c1 +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + + fragment@0 { + target = <&i2c1>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..aa2836e20269ccec3d71ac5b9dd1f4b011b4ec1a GIT binary patch literal 262 zcmcb>`|m9S10x#)1A_$+zW`zlAQl8-0U!neIUwEuW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= RhT@XMlG0*^OrvBI1_1eVE@c1! literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtso new file mode 100644 index 000000000000..5b43b85045fb --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-i2c4.dtso @@ -0,0 +1,16 @@ +/* Definitions for i2c4 +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + + fragment@0 { + target = <&i2c4>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..060d23bcebaf469a4b9b3069172300779f3a23dd GIT binary patch literal 262 zcmcb>`|m9S10x#)1A_$+zW`zlAQl8-0U!neIUwEuW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= RhT@XMlG0*^;(|;A1_1h~F0TLp literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtso new file mode 100644 index 000000000000..d2dfcd6220e3 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi0.dtso @@ -0,0 +1,16 @@ +/* Definitions for spi0 +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + + fragment@0 { + target = <&spi0>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..7bedbcbee8695eba83dac21dd5be5e93977b23e7 GIT binary patch literal 262 zcmcb>`|m9S10x#)1A_$+zW`zlAQl8-0U!neIUwEuW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= RhT@XMlG0*^;(|;g1_1i3F0lXr literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtso new file mode 100644 index 000000000000..2cd50ae4b9d1 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spi2.dtso @@ -0,0 +1,16 @@ +/* Definitions for spi2 +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + + fragment@0 { + target = <&spi2>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..2423a6ca4de16215567d477b22b6265ac2d627a4 GIT binary patch literal 572 zcmb7Ay-ve05WWN$5JCb34}iKb5YfU?RSZb1Y%JX@<2b36Uu>spn0O!_hKFE9VrBsD z>=??}lg{_^eRrRHulrx`0P!^dOaY=djA!VF=m+RzbL_wP^xqo|)fPs_)r}~`Lbd0* zxVoI;IvmV2&nsEmo3UdPcN=~08;x+rnx)hw?-?UPz>f%9t4|3;i%hFhxg556{xJc+ z+DKql)rHj54*L=+&_X?lKR=$=>RZf%-VWw>O~HGNWHEZsow&|sx?wN1hM;zzXQ)K*SWMae`!BQv%8|HT5i=tDZx`<#M4wuV-g|D(!j{5CpqL= d=72X$D!xiGEgw5si{5oayWn6fx1FJS3_sXVVlV&z literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtso new file mode 100644 index 000000000000..728cde523510 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev0.dtso @@ -0,0 +1,35 @@ +/* Definition for SPI0 Spidev + * spi port for Tinker Board + */ + +/dts-v1/; +/plugin/; + +/{ + compatible = "rockchip,rk3288"; + + fragment@0 { + + target = <&spi0>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + spidev@0 { + compatible = "rockchip,spi_tinker"; + reg = <0>; + spi-max-frequency = <50000000>; + spi-cpha = <1>; + status = "okay"; + }; + + spidev@1 { + compatible = "rockchip,spi_tinker"; + reg = <1>; + spi-max-frequency = <50000000>; + spi-cpha = <1>; + status = "okay"; + }; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..65f6860c6d78836ce11e2933599e826dc459dae4 GIT binary patch literal 572 zcmb7Ay-ve05WWN$5JCb34}iKb5JAgQRSZb1Y%JX@<2b36Uu>spn0O!_hKFE9VrBsD z>=??}lg{_^eRrRHulrx`0P!^dOaY=djA!VF=m+RzbL_wP^xqo|)fPs_)r}~`Lbd0* zxSC9H9S&xi=asDO&81@#cN=~08;x+rnx)hw?-?UPz>f%9t4|3;i%hFhxg556{xJc+ z+DKql)rHj54*L=+&_X?qKR=$=>RZf%-VWw>O~HGNWHEZs9lOqEx?wN1hM;zzXQ)K*SWMae`!BQv%8|HT5i=tDZx`<#M4wuV-g|D(!j{5CpqL= d=72X$D!xiGEgw5si{5oayWn6fx1FJS0zcSPVln^# literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtso new file mode 100644 index 000000000000..262bb61d9590 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-spidev2.dtso @@ -0,0 +1,35 @@ +/* Definition for SPI2 Spidev + * spi port for Tinker Board + */ + +/dts-v1/; +/plugin/; + +/{ + compatible = "rockchip,rk3288"; + + fragment@0 { + + target = <&spi2>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + spidev@0 { + compatible = "rockchip,spi_tinker"; + reg = <0>; + spi-max-frequency = <50000000>; + spi-cpha = <1>; + status = "okay"; + }; + + spidev@1 { + compatible = "rockchip,spi_tinker"; + reg = <1>; + spi-max-frequency = <50000000>; + spi-cpha = <1>; + status = "okay"; + }; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart1.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart1.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..0b820aa447eca40ed0a6d5321fc4033e30d9963e GIT binary patch literal 263 zcmcb>`|m9S10y>F1A_$+zW`zlAQl8-0U!nec_7{ZW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= ShT@XMlG0*^(!`; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart2.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart2.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..3e57168c2ed4dbbe08b9a1d39df9dfe55b9badfb GIT binary patch literal 263 zcmcb>`|m9S10y>F1A_$+zW`zlAQl8-0U!nec_7{ZW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= ShT@XMlG0*^(!`; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..d171ece89929fa9341ad19261559b59d1ca4f9cf GIT binary patch literal 263 zcmcb>`|m9S10y>F1A_$+zW`zlAQl8-0U!nec_7{ZW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= ShT@XMlG0*^(!`A literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtso new file mode 100644 index 000000000000..d1b77ffbf31b --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart3.dtso @@ -0,0 +1,16 @@ +/* Definitions for uart3 +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + + fragment@0 { + target = <&uart3>; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart4.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-uart4.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..795fdebae94b3e1539f524396b129e2cb5bb514b GIT binary patch literal 263 zcmcb>`|m9S10y>F1A_$+zW`zlAQl8-0U!nec_7{ZW}y;{P%bl&2CFT~PtH!x$Slw) z$~HE#02#-?m{ydSo|~Fi;$Q$)4N}Vj#N7XZ03;tDpI??*l#^H)9}iLhl4k{Cq5SN` zN{|2$FhMa;ZCYkUX+beWDOjy2P)<@GVTn~qVo`c(i50{)gkH|%{M>@XlFX!>R0fC= ShT@XMlG0*^(!`; + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtbo b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtbo new file mode 100644 index 0000000000000000000000000000000000000000..6bbc114521d84f9b257d602be5f843e9274d8186 GIT binary patch literal 487 zcmah_+e*YR5S@AfMFoBGU04vcba#DO3WDH=lx#O`LoW$QYVH5{LH>nL{(^d@?RtB0 z;B;nAP9|sia`OI06uc7A3i%oN5;y}+0geao)mZ-e22;0-JZP;>%d}AD#+J9s6~^IW zW<_4h#^28eHEVZ(qiAR;ND}=hZ6*37VJ6Ux?39(0oLGOr2i+pfjnZ6hx$}+8L|geS zcZ_28fk0;e9IV|3u5~GTCJ@Z+0ZV{)U_V>HkL&BTuH5K{wHH7feJ>LI@ErZ|%X2Uz zQ%|j#Mhx#=fxr8AM$9X^c>Gmgo(@x88{yTulH`TWr4P{-WK@%STZN6NrK900IWK(c O$P}X4K;A6|eomhcOJ7a^ literal 0 HcmV?d00001 diff --git a/patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtso b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtso new file mode 100644 index 000000000000..cc1f50a91bb7 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/overlay/rockchip-w1-gpio.dtso @@ -0,0 +1,23 @@ +/* 1-Wire GPIO +* From ASUS: https://github.com/TinkerBoard/debian_kernel/blob/develop/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +* +* +*/ + +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3288"; + fragment@0 { + target-path = "/"; + __overlay__ { + w1: onewire@0 { + compatible = "w1-gpio"; + pinctrl-names = "default"; + gpios = <&gpio0 17 0>; + status = "okay"; + }; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/bt-broadcom-serdev-workaround.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/bt-broadcom-serdev-workaround.patch new file mode 100644 index 000000000000..8f641846c338 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/bt-broadcom-serdev-workaround.patch @@ -0,0 +1,27 @@ +From e5c9702bd2ffd09e48c118ab40c2764590af7929 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 1 May 2021 12:41:14 +0000 +Subject: [PATCH] Workaround to make several broadcom bluetooth serdev devices + work even without proper MAC address + +--- + drivers/bluetooth/btbcm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c +index 1b9743b7f..b274f1cdd 100644 +--- a/drivers/bluetooth/btbcm.c ++++ b/drivers/bluetooth/btbcm.c +@@ -129,7 +129,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) + if (btbcm_set_bdaddr_from_efi(hdev) != 0) { + bt_dev_info(hdev, "BCM: Using default device address (%pMR)", + &bda->bdaddr); +- set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); ++ //set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); + } + } + + +-- +2.25.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rk322x-composite-mmc-clk.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rk322x-composite-mmc-clk.patch new file mode 100644 index 000000000000..1c889e35852b --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rk322x-composite-mmc-clk.patch @@ -0,0 +1,38 @@ +From 9e105544fcb63f8f79b199d1b194a36a354519b3 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sun, 2 Apr 2023 10:53:07 +0000 +Subject: [PATCH 2/2] rk322x: better handle mmc/sdio clocks + +--- + drivers/clk/rockchip/clk-rk3228.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c +index 996f8bfee..0f690dd84 100644 +--- a/drivers/clk/rockchip/clk-rk3228.c ++++ b/drivers/clk/rockchip/clk-rk3228.c +@@ -371,17 +371,15 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_CLKSEL_CON(11), 8, 2, MFLAGS, 0, 8, DFLAGS, + RK2928_CLKGATE_CON(2), 11, GFLAGS), + +- COMPOSITE_NODIV(SCLK_SDIO_SRC, "sclk_sdio_src", mux_mmc_src_p, 0, ++ COMPOSITE_DIV_OFFSET(SCLK_SDIO, "sclk_sdio", mux_mmc_src_p, 0, + RK2928_CLKSEL_CON(11), 10, 2, MFLAGS, ++ RK2928_CLKSEL_CON(12), 0, 8, DFLAGS, + RK2928_CLKGATE_CON(2), 13, GFLAGS), +- DIV(SCLK_SDIO, "sclk_sdio", "sclk_sdio_src", 0, +- RK2928_CLKSEL_CON(12), 0, 8, DFLAGS), + +- COMPOSITE_NODIV(0, "sclk_emmc_src", mux_mmc_src_p, 0, ++ COMPOSITE_DIV_OFFSET(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0, + RK2928_CLKSEL_CON(11), 12, 2, MFLAGS, ++ RK2928_CLKSEL_CON(12), 8, 8, DFLAGS, + RK2928_CLKGATE_CON(2), 14, GFLAGS), +- DIV(SCLK_EMMC, "sclk_emmc", "sclk_emmc_src", 0, +- RK2928_CLKSEL_CON(12), 8, 8, DFLAGS), + + /* + * Clock-Architecture Diagram 2 +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rockchip-max-frac-divider.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rockchip-max-frac-divider.patch new file mode 100644 index 000000000000..dc81f8cd31f2 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/clk-rockchip-max-frac-divider.patch @@ -0,0 +1,1536 @@ +From 2e1f975bbfd3ff9e50889ce8fd8d737b7f2d2c9d Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Wed, 20 Dec 2023 18:29:52 +0100 +Subject: [PATCH] rockchip fracmux limit support + +--- + drivers/clk/rockchip/clk-pll.c | 236 ++++++++++++++++++++++++++++-- + drivers/clk/rockchip/clk-px30.c | 29 ++-- + drivers/clk/rockchip/clk-rk3036.c | 13 +- + drivers/clk/rockchip/clk-rk3128.c | 15 +- + drivers/clk/rockchip/clk-rk3188.c | 24 +-- + drivers/clk/rockchip/clk-rk3228.c | 18 ++- + drivers/clk/rockchip/clk-rk3288.c | 19 ++- + drivers/clk/rockchip/clk-rk3308.c | 46 +++--- + drivers/clk/rockchip/clk-rk3328.c | 17 ++- + drivers/clk/rockchip/clk-rk3368.c | 17 ++- + drivers/clk/rockchip/clk-rk3399.c | 32 ++-- + drivers/clk/rockchip/clk-rv1108.c | 14 +- + drivers/clk/rockchip/clk.c | 31 +++- + drivers/clk/rockchip/clk.h | 27 +++- + include/linux/clk-provider.h | 2 + + 15 files changed, 416 insertions(+), 124 deletions(-) + +diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c +index 6e5e502be44a..906b813382d9 100644 +--- a/drivers/clk/rockchip/clk-pll.c ++++ b/drivers/clk/rockchip/clk-pll.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include "clk.h" + + #define PLL_MODE_MASK 0x3 +@@ -47,6 +48,198 @@ struct rockchip_clk_pll { + #define to_rockchip_clk_pll_nb(nb) \ + container_of(nb, struct rockchip_clk_pll, clk_nb) + ++#define MHZ (1000UL * 1000UL) ++#define KHZ (1000UL) ++ ++/* CLK_PLL_TYPE_RK3066_AUTO type ops */ ++#define PLL_FREF_MIN (269 * KHZ) ++#define PLL_FREF_MAX (2200 * MHZ) ++ ++#define PLL_FVCO_MIN (440 * MHZ) ++#define PLL_FVCO_MAX (2200 * MHZ) ++ ++#define PLL_FOUT_MIN (27500 * KHZ) ++#define PLL_FOUT_MAX (2200 * MHZ) ++ ++#define PLL_NF_MAX (4096) ++#define PLL_NR_MAX (64) ++#define PLL_NO_MAX (16) ++ ++/* CLK_PLL_TYPE_RK3036/3366/3399_AUTO type ops */ ++#define MIN_FOUTVCO_FREQ (800 * MHZ) ++#define MAX_FOUTVCO_FREQ (2000 * MHZ) ++ ++static struct rockchip_pll_rate_table auto_table; ++ ++static struct rockchip_pll_rate_table *rk_pll_rate_table_get(void) ++{ ++ return &auto_table; ++} ++ ++static int rockchip_pll_clk_set_postdiv(unsigned long fout_hz, ++ u32 *postdiv1, ++ u32 *postdiv2, ++ u32 *foutvco) ++{ ++ unsigned long freq; ++ ++ if (fout_hz < MIN_FOUTVCO_FREQ) { ++ for (*postdiv1 = 1; *postdiv1 <= 7; (*postdiv1)++) { ++ for (*postdiv2 = 1; *postdiv2 <= 7; (*postdiv2)++) { ++ freq = fout_hz * (*postdiv1) * (*postdiv2); ++ if (freq >= MIN_FOUTVCO_FREQ && ++ freq <= MAX_FOUTVCO_FREQ) { ++ *foutvco = freq; ++ return 0; ++ } ++ } ++ } ++ pr_err("CANNOT FIND postdiv1/2 to make fout in range from 800M to 2000M,fout = %lu\n", ++ fout_hz); ++ } else { ++ *postdiv1 = 1; ++ *postdiv2 = 1; ++ } ++ return 0; ++} ++ ++static struct rockchip_pll_rate_table * ++rockchip_pll_clk_set_by_auto(struct rockchip_clk_pll *pll, ++ unsigned long fin_hz, ++ unsigned long fout_hz) ++{ ++ struct rockchip_pll_rate_table *rate_table = rk_pll_rate_table_get(); ++ /* FIXME set postdiv1/2 always 1*/ ++ u32 foutvco = fout_hz; ++ u64 fin_64, frac_64; ++ u32 f_frac, postdiv1, postdiv2; ++ unsigned long clk_gcd = 0; ++ ++ if (fin_hz == 0 || fout_hz == 0 || fout_hz == fin_hz) ++ return NULL; ++ ++ rockchip_pll_clk_set_postdiv(fout_hz, &postdiv1, &postdiv2, &foutvco); ++ rate_table->postdiv1 = postdiv1; ++ rate_table->postdiv2 = postdiv2; ++ rate_table->dsmpd = 1; ++ ++ if (fin_hz / MHZ * MHZ == fin_hz && fout_hz / MHZ * MHZ == fout_hz) { ++ fin_hz /= MHZ; ++ foutvco /= MHZ; ++ clk_gcd = gcd(fin_hz, foutvco); ++ rate_table->refdiv = fin_hz / clk_gcd; ++ rate_table->fbdiv = foutvco / clk_gcd; ++ ++ rate_table->frac = 0; ++ ++ pr_debug("fin = %lu, fout = %lu, clk_gcd = %lu, refdiv = %u, fbdiv = %u, postdiv1 = %u, postdiv2 = %u, frac = %u\n", ++ fin_hz, fout_hz, clk_gcd, rate_table->refdiv, ++ rate_table->fbdiv, rate_table->postdiv1, ++ rate_table->postdiv2, rate_table->frac); ++ } else { ++ pr_debug("frac div running, fin_hz = %lu, fout_hz = %lu, fin_INT_mhz = %lu, fout_INT_mhz = %lu\n", ++ fin_hz, fout_hz, ++ fin_hz / MHZ * MHZ, ++ fout_hz / MHZ * MHZ); ++ pr_debug("frac get postdiv1 = %u, postdiv2 = %u, foutvco = %u\n", ++ rate_table->postdiv1, rate_table->postdiv2, foutvco); ++ clk_gcd = gcd(fin_hz / MHZ, foutvco / MHZ); ++ rate_table->refdiv = fin_hz / MHZ / clk_gcd; ++ rate_table->fbdiv = foutvco / MHZ / clk_gcd; ++ pr_debug("frac get refdiv = %u, fbdiv = %u\n", ++ rate_table->refdiv, rate_table->fbdiv); ++ ++ rate_table->frac = 0; ++ ++ f_frac = (foutvco % MHZ); ++ fin_64 = fin_hz; ++ do_div(fin_64, (u64)rate_table->refdiv); ++ frac_64 = (u64)f_frac << 24; ++ do_div(frac_64, fin_64); ++ rate_table->frac = (u32)frac_64; ++ if (rate_table->frac > 0) ++ rate_table->dsmpd = 0; ++ pr_debug("frac = %x\n", rate_table->frac); ++ } ++ return rate_table; ++} ++ ++static struct rockchip_pll_rate_table * ++rockchip_rk3066_pll_clk_set_by_auto(struct rockchip_clk_pll *pll, ++ unsigned long fin_hz, ++ unsigned long fout_hz) ++{ ++ struct rockchip_pll_rate_table *rate_table = rk_pll_rate_table_get(); ++ u32 nr, nf, no, nonr; ++ u32 nr_out, nf_out, no_out; ++ u32 n; ++ u32 numerator, denominator; ++ u64 fref, fvco, fout; ++ unsigned long clk_gcd = 0; ++ ++ nr_out = PLL_NR_MAX + 1; ++ no_out = 0; ++ nf_out = 0; ++ ++ if (fin_hz == 0 || fout_hz == 0 || fout_hz == fin_hz) ++ return NULL; ++ ++ clk_gcd = gcd(fin_hz, fout_hz); ++ ++ numerator = fout_hz / clk_gcd; ++ denominator = fin_hz / clk_gcd; ++ ++ for (n = 1;; n++) { ++ nf = numerator * n; ++ nonr = denominator * n; ++ if (nf > PLL_NF_MAX || nonr > (PLL_NO_MAX * PLL_NR_MAX)) ++ break; ++ ++ for (no = 1; no <= PLL_NO_MAX; no++) { ++ if (!(no == 1 || !(no % 2))) ++ continue; ++ ++ if (nonr % no) ++ continue; ++ nr = nonr / no; ++ ++ if (nr > PLL_NR_MAX) ++ continue; ++ ++ fref = fin_hz / nr; ++ if (fref < PLL_FREF_MIN || fref > PLL_FREF_MAX) ++ continue; ++ ++ fvco = fref * nf; ++ if (fvco < PLL_FVCO_MIN || fvco > PLL_FVCO_MAX) ++ continue; ++ ++ fout = fvco / no; ++ if (fout < PLL_FOUT_MIN || fout > PLL_FOUT_MAX) ++ continue; ++ ++ /* select the best from all available PLL settings */ ++ if ((no > no_out) || ++ ((no == no_out) && (nr < nr_out))) { ++ nr_out = nr; ++ nf_out = nf; ++ no_out = no; ++ } ++ } ++ } ++ ++ /* output the best PLL setting */ ++ if ((nr_out <= PLL_NR_MAX) && (no_out > 0)) { ++ rate_table->nr = nr_out; ++ rate_table->nf = nf_out; ++ rate_table->no = no_out; ++ } else { ++ return NULL; ++ } ++ ++ return rate_table; ++} ++ + static const struct rockchip_pll_rate_table *rockchip_get_pll_settings( + struct rockchip_clk_pll *pll, unsigned long rate) + { +@@ -58,24 +251,16 @@ static const struct rockchip_pll_rate_table *rockchip_get_pll_settings( + return &rate_table[i]; + } + +- return NULL; ++ if (pll->type == pll_rk3066) ++ return rockchip_rk3066_pll_clk_set_by_auto(pll, 24 * MHZ, rate); ++ else ++ return rockchip_pll_clk_set_by_auto(pll, 24 * MHZ, rate); + } + + static long rockchip_pll_round_rate(struct clk_hw *hw, + unsigned long drate, unsigned long *prate) + { +- struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw); +- const struct rockchip_pll_rate_table *rate_table = pll->rate_table; +- int i; +- +- /* Assumming rate_table is in descending order */ +- for (i = 0; i < pll->rate_count; i++) { +- if (drate >= rate_table[i].rate) +- return rate_table[i].rate; +- } +- +- /* return minimum supported value */ +- return rate_table[i - 1].rate; ++ return drate; + } + + /* +@@ -165,7 +350,7 @@ static unsigned long rockchip_rk3036_pll_recalc_rate(struct clk_hw *hw, + { + struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw); + struct rockchip_pll_rate_table cur; +- u64 rate64 = prate; ++ u64 rate64 = prate, frac_rate64 = prate; + + rockchip_rk3036_pll_get_params(pll, &cur); + +@@ -174,7 +359,7 @@ static unsigned long rockchip_rk3036_pll_recalc_rate(struct clk_hw *hw, + + if (cur.dsmpd == 0) { + /* fractional mode */ +- u64 frac_rate64 = prate * cur.frac; ++ frac_rate64 *= cur.frac; + + do_div(frac_rate64, cur.refdiv); + rate64 += frac_rate64 >> 24; +@@ -210,6 +395,11 @@ static int rockchip_rk3036_pll_set_params(struct rockchip_clk_pll *pll, + rate_change_remuxed = 1; + } + ++ /* set pll power down */ ++ writel(HIWORD_UPDATE(RK3036_PLLCON1_PWRDOWN, ++ RK3036_PLLCON1_PWRDOWN, 0), ++ pll->reg_base + RK3036_PLLCON(1)); ++ + /* update pll values */ + writel_relaxed(HIWORD_UPDATE(rate->fbdiv, RK3036_PLLCON0_FBDIV_MASK, + RK3036_PLLCON0_FBDIV_SHIFT) | +@@ -231,6 +421,11 @@ static int rockchip_rk3036_pll_set_params(struct rockchip_clk_pll *pll, + pllcon |= rate->frac << RK3036_PLLCON2_FRAC_SHIFT; + writel_relaxed(pllcon, pll->reg_base + RK3036_PLLCON(2)); + ++ /* set pll power up */ ++ writel(HIWORD_UPDATE(0, RK3036_PLLCON1_PWRDOWN, 0), ++ pll->reg_base + RK3036_PLLCON(1)); ++ udelay(1); ++ + /* wait for the pll to lock */ + ret = rockchip_rk3036_pll_wait_lock(pll); + if (ret) { +@@ -692,6 +887,11 @@ static int rockchip_rk3399_pll_set_params(struct rockchip_clk_pll *pll, + rate_change_remuxed = 1; + } + ++ /* set pll power down */ ++ writel(HIWORD_UPDATE(RK3399_PLLCON3_PWRDOWN, ++ RK3399_PLLCON3_PWRDOWN, 0), ++ pll->reg_base + RK3399_PLLCON(3)); ++ + /* update pll values */ + writel_relaxed(HIWORD_UPDATE(rate->fbdiv, RK3399_PLLCON0_FBDIV_MASK, + RK3399_PLLCON0_FBDIV_SHIFT), +@@ -715,6 +915,12 @@ static int rockchip_rk3399_pll_set_params(struct rockchip_clk_pll *pll, + RK3399_PLLCON3_DSMPD_SHIFT), + pll->reg_base + RK3399_PLLCON(3)); + ++ /* set pll power up */ ++ writel(HIWORD_UPDATE(0, ++ RK3399_PLLCON3_PWRDOWN, 0), ++ pll->reg_base + RK3399_PLLCON(3)); ++ udelay(1); ++ + /* wait for the pll to lock */ + ret = rockchip_rk3399_pll_wait_lock(pll); + if (ret) { +diff --git a/drivers/clk/rockchip/clk-px30.c b/drivers/clk/rockchip/clk-px30.c +index b58619eb412b..8274f344b6b5 100644 +--- a/drivers/clk/rockchip/clk-px30.c ++++ b/drivers/clk/rockchip/clk-px30.c +@@ -13,6 +13,7 @@ + #include "clk.h" + + #define PX30_GRF_SOC_STATUS0 0x480 ++#define PX30_FRAC_MAX_PRATE 600000000 + + enum px30_plls { + apll, dpll, cpll, npll, apll_b_h, apll_b_l, +@@ -425,7 +426,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "dclk_vopb_frac", "dclk_vopb_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(6), 0, + PX30_CLKGATE_CON(2), 3, GFLAGS, +- &px30_dclk_vopb_fracmux), ++ &px30_dclk_vopb_fracmux, 0), + GATE(DCLK_VOPB, "dclk_vopb", "dclk_vopb_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(2), 4, GFLAGS), + COMPOSITE(0, "dclk_vopl_src", mux_npll_cpll_p, 0, +@@ -434,7 +435,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "dclk_vopl_frac", "dclk_vopl_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(9), 0, + PX30_CLKGATE_CON(2), 7, GFLAGS, +- &px30_dclk_vopl_fracmux), ++ &px30_dclk_vopl_fracmux, 0), + GATE(DCLK_VOPL, "dclk_vopl", "dclk_vopl_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(2), 8, GFLAGS), + +@@ -592,7 +593,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_pdm_frac", "clk_pdm_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(27), 0, + PX30_CLKGATE_CON(9), 10, GFLAGS, +- &px30_pdm_fracmux), ++ &px30_pdm_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_PDM, "clk_pdm", "clk_pdm_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(9), 11, GFLAGS), + +@@ -602,7 +603,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_tx_frac", "clk_i2s0_tx_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(29), 0, + PX30_CLKGATE_CON(9), 13, GFLAGS, +- &px30_i2s0_tx_fracmux), ++ &px30_i2s0_tx_fracmux, PX30_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S0_TX, "clk_i2s0_tx", mux_i2s0_tx_rx_p, CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(28), 12, 1, MFLAGS, + PX30_CLKGATE_CON(9), 14, GFLAGS), +@@ -618,7 +619,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_rx_frac", "clk_i2s0_rx_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(59), 0, + PX30_CLKGATE_CON(17), 1, GFLAGS, +- &px30_i2s0_rx_fracmux), ++ &px30_i2s0_rx_fracmux, PX30_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S0_RX, "clk_i2s0_rx", mux_i2s0_rx_tx_p, CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(58), 12, 1, MFLAGS, + PX30_CLKGATE_CON(17), 2, GFLAGS), +@@ -634,7 +635,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(31), 0, + PX30_CLKGATE_CON(10), 1, GFLAGS, +- &px30_i2s1_fracmux), ++ &px30_i2s1_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_I2S1, "clk_i2s1", "clk_i2s1_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(10), 2, GFLAGS), + COMPOSITE_NODIV(0, "clk_i2s1_out_pre", mux_i2s1_out_p, 0, +@@ -649,7 +650,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(33), 0, + PX30_CLKGATE_CON(10), 5, GFLAGS, +- &px30_i2s2_fracmux), ++ &px30_i2s2_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_I2S2, "clk_i2s2", "clk_i2s2_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(10), 6, GFLAGS), + COMPOSITE_NODIV(0, "clk_i2s2_out_pre", mux_i2s2_out_p, 0, +@@ -667,7 +668,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(36), 0, + PX30_CLKGATE_CON(10), 14, GFLAGS, +- &px30_uart1_fracmux), ++ &px30_uart1_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_UART1, "clk_uart1", "clk_uart1_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(10), 15, GFLAGS), + +@@ -680,7 +681,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(39), 0, + PX30_CLKGATE_CON(11), 2, GFLAGS, +- &px30_uart2_fracmux), ++ &px30_uart2_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_UART2, "clk_uart2", "clk_uart2_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(11), 3, GFLAGS), + +@@ -693,7 +694,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart3_frac", "clk_uart3_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(42), 0, + PX30_CLKGATE_CON(11), 6, GFLAGS, +- &px30_uart3_fracmux), ++ &px30_uart3_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_UART3, "clk_uart3", "clk_uart3_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(11), 7, GFLAGS), + +@@ -706,7 +707,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart4_frac", "clk_uart4_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(45), 0, + PX30_CLKGATE_CON(11), 10, GFLAGS, +- &px30_uart4_fracmux), ++ &px30_uart4_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_UART4, "clk_uart4", "clk_uart4_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(11), 11, GFLAGS), + +@@ -719,7 +720,7 @@ static struct rockchip_clk_branch px30_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart5_frac", "clk_uart5_src", CLK_SET_RATE_PARENT, + PX30_CLKSEL_CON(48), 0, + PX30_CLKGATE_CON(11), 14, GFLAGS, +- &px30_uart5_fracmux), ++ &px30_uart5_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_UART5, "clk_uart5", "clk_uart5_mux", CLK_SET_RATE_PARENT, + PX30_CLKGATE_CON(11), 15, GFLAGS), + +@@ -919,7 +920,7 @@ static struct rockchip_clk_branch px30_clk_pmu_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_rtc32k_frac", "xin24m", CLK_IGNORE_UNUSED, + PX30_PMU_CLKSEL_CON(1), 0, + PX30_PMU_CLKGATE_CON(0), 13, GFLAGS, +- &px30_rtc32k_pmu_fracmux), ++ &px30_rtc32k_pmu_fracmux, 0), + + COMPOSITE_NOMUX(XIN24M_DIV, "xin24m_div", "xin24m", CLK_IGNORE_UNUSED, + PX30_PMU_CLKSEL_CON(0), 8, 5, DFLAGS, +@@ -941,7 +942,7 @@ static struct rockchip_clk_branch px30_clk_pmu_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_pmu_src", CLK_SET_RATE_PARENT, + PX30_PMU_CLKSEL_CON(5), 0, + PX30_PMU_CLKGATE_CON(1), 2, GFLAGS, +- &px30_uart0_pmu_fracmux), ++ &px30_uart0_pmu_fracmux, PX30_FRAC_MAX_PRATE), + GATE(SCLK_UART0_PMU, "clk_uart0_pmu", "clk_uart0_pmu_mux", CLK_SET_RATE_PARENT, + PX30_PMU_CLKGATE_CON(1), 3, GFLAGS), + +diff --git a/drivers/clk/rockchip/clk-rk3036.c b/drivers/clk/rockchip/clk-rk3036.c +index d644bc155ec6..1f86bb6bb1bb 100644 +--- a/drivers/clk/rockchip/clk-rk3036.c ++++ b/drivers/clk/rockchip/clk-rk3036.c +@@ -16,6 +16,9 @@ + #include "clk.h" + + #define RK3036_GRF_SOC_STATUS0 0x14c ++#define RK3036_UART_FRAC_MAX_PRATE 600000000 ++#define RK3036_I2S_FRAC_MAX_PRATE 600000000 ++#define RK3036_SPDIF_FRAC_MAX_PRATE 600000000 + + enum rk3036_plls { + apll, dpll, gpll, +@@ -250,15 +253,15 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(17), 0, + RK2928_CLKGATE_CON(1), 9, GFLAGS, +- &rk3036_uart0_fracmux), ++ &rk3036_uart0_fracmux, RK3036_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(18), 0, + RK2928_CLKGATE_CON(1), 11, GFLAGS, +- &rk3036_uart1_fracmux), ++ &rk3036_uart1_fracmux, RK3036_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(19), 0, + RK2928_CLKGATE_CON(1), 13, GFLAGS, +- &rk3036_uart2_fracmux), ++ &rk3036_uart2_fracmux, RK3036_UART_FRAC_MAX_PRATE), + + COMPOSITE(ACLK_VCODEC, "aclk_vcodec", mux_pll_src_3plls_p, 0, + RK2928_CLKSEL_CON(32), 14, 2, MFLAGS, 8, 5, DFLAGS, +@@ -311,7 +314,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s_frac", "i2s_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(7), 0, + RK2928_CLKGATE_CON(0), 10, GFLAGS, +- &rk3036_i2s_fracmux), ++ &rk3036_i2s_fracmux, RK3036_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S_OUT, "i2s_clkout", mux_i2s_clkout_p, 0, + RK2928_CLKSEL_CON(3), 12, 1, MFLAGS, + RK2928_CLKGATE_CON(0), 13, GFLAGS), +@@ -324,7 +327,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_frac", "spdif_src", 0, + RK2928_CLKSEL_CON(9), 0, + RK2928_CLKGATE_CON(2), 12, GFLAGS, +- &rk3036_spdif_fracmux), ++ &rk3036_spdif_fracmux, RK3036_SPDIF_FRAC_MAX_PRATE), + + GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin12m", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(1), 5, GFLAGS), +diff --git a/drivers/clk/rockchip/clk-rk3128.c b/drivers/clk/rockchip/clk-rk3128.c +index aa53797dbfc1..0cc478d74d17 100644 +--- a/drivers/clk/rockchip/clk-rk3128.c ++++ b/drivers/clk/rockchip/clk-rk3128.c +@@ -13,6 +13,9 @@ + #include "clk.h" + + #define RK3128_GRF_SOC_STATUS0 0x14c ++#define RK3128_UART_FRAC_MAX_PRATE 600000000 ++#define RK3128_I2S_FRAC_MAX_PRATE 600000000 ++#define RK3128_SPDIF_FRAC_MAX_PRATE 600000000 + + enum rk3128_plls { + apll, dpll, cpll, gpll, +@@ -360,7 +363,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s0_frac", "i2s0_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(8), 0, + RK2928_CLKGATE_CON(4), 5, GFLAGS, +- &rk3128_i2s0_fracmux), ++ &rk3128_i2s0_fracmux, RK3128_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S0, "sclk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT, + RK2928_CLKGATE_CON(4), 6, GFLAGS), + +@@ -370,7 +373,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s1_frac", "i2s1_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(7), 0, + RK2928_CLKGATE_CON(0), 10, GFLAGS, +- &rk3128_i2s1_fracmux), ++ &rk3128_i2s1_fracmux, RK3128_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S1, "sclk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT, + RK2928_CLKGATE_CON(0), 14, GFLAGS), + COMPOSITE_NODIV(SCLK_I2S_OUT, "i2s_out", mux_i2s_out_p, 0, +@@ -383,7 +386,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_frac", "sclk_spdif_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(20), 0, + RK2928_CLKGATE_CON(2), 12, GFLAGS, +- &rk3128_spdif_fracmux), ++ &rk3128_spdif_fracmux, RK3128_SPDIF_FRAC_MAX_PRATE), + + GATE(0, "jtag", "ext_jtag", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(1), 3, GFLAGS), +@@ -420,15 +423,15 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(17), 0, + RK2928_CLKGATE_CON(1), 9, GFLAGS, +- &rk3128_uart0_fracmux), ++ &rk3128_uart0_fracmux, RK3128_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(18), 0, + RK2928_CLKGATE_CON(1), 11, GFLAGS, +- &rk3128_uart1_fracmux), ++ &rk3128_uart1_fracmux, RK3128_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(19), 0, + RK2928_CLKGATE_CON(1), 13, GFLAGS, +- &rk3128_uart2_fracmux), ++ &rk3128_uart2_fracmux, RK3128_UART_FRAC_MAX_PRATE), + + COMPOSITE(SCLK_MAC_SRC, "sclk_gmac_src", mux_pll_src_3plls_p, 0, + RK2928_CLKSEL_CON(5), 6, 2, MFLAGS, 0, 5, DFLAGS, +diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c +index 9c8af4d1dae0..42c517409818 100644 +--- a/drivers/clk/rockchip/clk-rk3188.c ++++ b/drivers/clk/rockchip/clk-rk3188.c +@@ -14,6 +14,10 @@ + + #define RK3066_GRF_SOC_STATUS 0x15c + #define RK3188_GRF_SOC_STATUS 0xac ++#define RK3188_UART_FRAC_MAX_PRATE 600000000 ++#define RK3188_I2S_FRAC_MAX_PRATE 600000000 ++#define RK3188_SPDIF_FRAC_MAX_PRATE 600000000 ++#define RK3188_HSADC_FRAC_MAX_PRATE 300000000 + + enum rk3188_plls { + apll, cpll, dpll, gpll, +@@ -365,7 +369,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "hsadc_frac", "hsadc_src", 0, + RK2928_CLKSEL_CON(23), 0, + RK2928_CLKGATE_CON(2), 7, GFLAGS, +- &common_hsadc_out_fracmux), ++ &common_hsadc_out_fracmux, RK3188_HSADC_FRAC_MAX_PRATE), + INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out", + RK2928_CLKSEL_CON(22), 7, IFLAGS), + +@@ -379,7 +383,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_frac", "spdif_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(9), 0, + RK2928_CLKGATE_CON(0), 14, GFLAGS, +- &common_spdif_fracmux), ++ &common_spdif_fracmux, RK3188_SPDIF_FRAC_MAX_PRATE), + + /* + * Clock-Architecture Diagram 4 +@@ -413,28 +417,28 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(17), 0, + RK2928_CLKGATE_CON(1), 9, GFLAGS, +- &common_uart0_fracmux), ++ &common_uart0_fracmux, RK3188_UART_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "uart1_pre", "uart_src", 0, + RK2928_CLKSEL_CON(14), 0, 7, DFLAGS, + RK2928_CLKGATE_CON(1), 10, GFLAGS), + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(18), 0, + RK2928_CLKGATE_CON(1), 11, GFLAGS, +- &common_uart1_fracmux), ++ &common_uart1_fracmux, RK3188_UART_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "uart2_pre", "uart_src", 0, + RK2928_CLKSEL_CON(15), 0, 7, DFLAGS, + RK2928_CLKGATE_CON(1), 12, GFLAGS), + COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(19), 0, + RK2928_CLKGATE_CON(1), 13, GFLAGS, +- &common_uart2_fracmux), ++ &common_uart2_fracmux, RK3188_UART_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "uart3_pre", "uart_src", 0, + RK2928_CLKSEL_CON(16), 0, 7, DFLAGS, + RK2928_CLKGATE_CON(1), 14, GFLAGS), + COMPOSITE_FRACMUX(0, "uart3_frac", "uart3_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(20), 0, + RK2928_CLKGATE_CON(1), 15, GFLAGS, +- &common_uart3_fracmux), ++ &common_uart3_fracmux, RK3188_UART_FRAC_MAX_PRATE), + + GATE(SCLK_JTAG, "jtag", "ext_jtag", 0, RK2928_CLKGATE_CON(1), 3, GFLAGS), + +@@ -619,21 +623,21 @@ static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s0_frac", "i2s0_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(6), 0, + RK2928_CLKGATE_CON(0), 8, GFLAGS, +- &rk3066a_i2s0_fracmux), ++ &rk3066a_i2s0_fracmux, RK3188_I2S_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "i2s1_pre", "i2s_src", 0, + RK2928_CLKSEL_CON(3), 0, 7, DFLAGS, + RK2928_CLKGATE_CON(0), 9, GFLAGS), + COMPOSITE_FRACMUX(0, "i2s1_frac", "i2s1_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(7), 0, + RK2928_CLKGATE_CON(0), 10, GFLAGS, +- &rk3066a_i2s1_fracmux), ++ &rk3066a_i2s1_fracmux, RK3188_I2S_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "i2s2_pre", "i2s_src", 0, + RK2928_CLKSEL_CON(4), 0, 7, DFLAGS, + RK2928_CLKGATE_CON(0), 11, GFLAGS), + COMPOSITE_FRACMUX(0, "i2s2_frac", "i2s2_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(8), 0, + RK2928_CLKGATE_CON(0), 12, GFLAGS, +- &rk3066a_i2s2_fracmux), ++ &rk3066a_i2s2_fracmux, RK3188_I2S_FRAC_MAX_PRATE), + + GATE(HCLK_I2S0, "hclk_i2s0", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 4, GFLAGS), + GATE(HCLK_I2S1, "hclk_i2s1", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 2, GFLAGS), +@@ -728,7 +732,7 @@ static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s0_frac", "i2s0_pre", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(7), 0, + RK2928_CLKGATE_CON(0), 10, GFLAGS, +- &rk3188_i2s0_fracmux), ++ &rk3188_i2s0_fracmux, RK3188_I2S_FRAC_MAX_PRATE), + + GATE(HCLK_I2S0, "hclk_i2s0", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 2, GFLAGS), + GATE(0, "hclk_imem0", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS), +diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c +index a24a35553e13..5dda8c9c9dad 100644 +--- a/drivers/clk/rockchip/clk-rk3228.c ++++ b/drivers/clk/rockchip/clk-rk3228.c +@@ -15,6 +15,10 @@ + + #define RK3228_GRF_SOC_STATUS0 0x480 + ++#define RK3228_UART_FRAC_MAX_PRATE 600000000 ++#define RK3228_SPDIF_FRAC_MAX_PRATE 600000000 ++#define RK3228_I2S_FRAC_MAX_PRATE 600000000 ++ + enum rk3228_plls { + apll, dpll, cpll, gpll, + }; +@@ -420,7 +424,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s0_frac", "i2s0_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(8), 0, + RK2928_CLKGATE_CON(0), 4, GFLAGS, +- &rk3228_i2s0_fracmux), ++ &rk3228_i2s0_fracmux, RK3228_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S0, "sclk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT, + RK2928_CLKGATE_CON(0), 5, GFLAGS), + +@@ -430,7 +434,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s1_frac", "i2s1_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(7), 0, + RK2928_CLKGATE_CON(0), 11, GFLAGS, +- &rk3228_i2s1_fracmux), ++ &rk3228_i2s1_fracmux, RK3228_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S1, "sclk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT, + RK2928_CLKGATE_CON(0), 14, GFLAGS), + COMPOSITE_NODIV(SCLK_I2S_OUT, "i2s_out", mux_i2s_out_p, 0, +@@ -443,7 +447,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s2_frac", "i2s2_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(30), 0, + RK2928_CLKGATE_CON(0), 8, GFLAGS, +- &rk3228_i2s2_fracmux), ++ &rk3228_i2s2_fracmux, RK3228_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S2, "sclk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT, + RK2928_CLKGATE_CON(0), 9, GFLAGS), + +@@ -453,7 +457,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_frac", "sclk_spdif_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(20), 0, + RK2928_CLKGATE_CON(2), 12, GFLAGS, +- &rk3228_spdif_fracmux), ++ &rk3228_spdif_fracmux, RK3228_SPDIF_FRAC_MAX_PRATE), + + GATE(0, "jtag", "ext_jtag", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(1), 3, GFLAGS), +@@ -488,15 +492,15 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(17), 0, + RK2928_CLKGATE_CON(1), 9, GFLAGS, +- &rk3228_uart0_fracmux), ++ &rk3228_uart0_fracmux, RK3228_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(18), 0, + RK2928_CLKGATE_CON(1), 11, GFLAGS, +- &rk3228_uart1_fracmux), ++ &rk3228_uart1_fracmux, RK3228_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(19), 0, + RK2928_CLKGATE_CON(1), 13, GFLAGS, +- &rk3228_uart2_fracmux), ++ &rk3228_uart2_fracmux, RK3228_UART_FRAC_MAX_PRATE), + + COMPOSITE(SCLK_NANDC, "sclk_nandc", mux_pll_src_2plls_p, 0, + RK2928_CLKSEL_CON(2), 14, 1, MFLAGS, 8, 5, DFLAGS, +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index baa5aebd3277..b72d3d230747 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -14,6 +14,9 @@ + + #define RK3288_GRF_SOC_CON(x) (0x244 + x * 4) + #define RK3288_GRF_SOC_STATUS1 0x284 ++#define RK3288_UART_FRAC_MAX_PRATE 600000000 ++#define RK3288_I2S_FRAC_MAX_PRATE 600000000 ++#define RK3288_SPDIF_FRAC_MAX_PRATE 600000000 + + enum rk3288_variant { + RK3288_CRU, +@@ -363,7 +366,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s_frac", "i2s_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(8), 0, + RK3288_CLKGATE_CON(4), 2, GFLAGS, +- &rk3288_i2s_fracmux), ++ &rk3288_i2s_fracmux, RK3288_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S0_OUT, "i2s0_clkout", mux_i2s_clkout_p, 0, + RK3288_CLKSEL_CON(4), 12, 1, MFLAGS, + RK3288_CLKGATE_CON(4), 0, GFLAGS), +@@ -378,7 +381,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_frac", "spdif_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(9), 0, + RK3288_CLKGATE_CON(4), 5, GFLAGS, +- &rk3288_spdif_fracmux), ++ &rk3288_spdif_fracmux, RK3288_SPDIF_FRAC_MAX_PRATE), + GATE(SCLK_SPDIF, "sclk_spdif", "spdif_mux", CLK_SET_RATE_PARENT, + RK3288_CLKGATE_CON(4), 6, GFLAGS), + COMPOSITE_NOMUX(0, "spdif_8ch_pre", "spdif_src", CLK_SET_RATE_PARENT, +@@ -387,7 +390,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_8ch_frac", "spdif_8ch_pre", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(41), 0, + RK3288_CLKGATE_CON(4), 8, GFLAGS, +- &rk3288_spdif_8ch_fracmux), ++ &rk3288_spdif_8ch_fracmux, RK3288_SPDIF_FRAC_MAX_PRATE), + GATE(SCLK_SPDIF8CH, "sclk_spdif_8ch", "spdif_8ch_mux", CLK_SET_RATE_PARENT, + RK3288_CLKGATE_CON(4), 9, GFLAGS), + +@@ -588,7 +591,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(17), 0, + RK3288_CLKGATE_CON(1), 9, GFLAGS, +- &rk3288_uart0_fracmux), ++ &rk3288_uart0_fracmux, RK3288_UART_FRAC_MAX_PRATE), + MUX(0, "uart_src", mux_pll_src_cpll_gpll_p, 0, + RK3288_CLKSEL_CON(13), 15, 1, MFLAGS), + COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0, +@@ -597,28 +600,28 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(18), 0, + RK3288_CLKGATE_CON(1), 11, GFLAGS, +- &rk3288_uart1_fracmux), ++ &rk3288_uart1_fracmux, RK3288_UART_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "uart2_src", "uart_src", 0, + RK3288_CLKSEL_CON(15), 0, 7, DFLAGS, + RK3288_CLKGATE_CON(1), 12, GFLAGS), + COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(19), 0, + RK3288_CLKGATE_CON(1), 13, GFLAGS, +- &rk3288_uart2_fracmux), ++ &rk3288_uart2_fracmux, RK3288_UART_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0, + RK3288_CLKSEL_CON(16), 0, 7, DFLAGS, + RK3288_CLKGATE_CON(1), 14, GFLAGS), + COMPOSITE_FRACMUX(0, "uart3_frac", "uart3_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(20), 0, + RK3288_CLKGATE_CON(1), 15, GFLAGS, +- &rk3288_uart3_fracmux), ++ &rk3288_uart3_fracmux, RK3288_UART_FRAC_MAX_PRATE), + COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0, + RK3288_CLKSEL_CON(3), 0, 7, DFLAGS, + RK3288_CLKGATE_CON(2), 12, GFLAGS), + COMPOSITE_FRACMUX(0, "uart4_frac", "uart4_src", CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(7), 0, + RK3288_CLKGATE_CON(2), 13, GFLAGS, +- &rk3288_uart4_fracmux), ++ &rk3288_uart4_fracmux, RK3288_UART_FRAC_MAX_PRATE), + + COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0, + RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS, +diff --git a/drivers/clk/rockchip/clk-rk3308.c b/drivers/clk/rockchip/clk-rk3308.c +index db3396c3e6e9..bd8e6b564132 100644 +--- a/drivers/clk/rockchip/clk-rk3308.c ++++ b/drivers/clk/rockchip/clk-rk3308.c +@@ -13,6 +13,12 @@ + #include "clk.h" + + #define RK3308_GRF_SOC_STATUS0 0x380 ++#define RK3308_VOP_FRAC_MAX_PRATE 270000000 ++#define RK3308B_VOP_FRAC_MAX_PRATE 800000000 ++#define RK3308_UART_FRAC_MAX_PRATE 800000000 ++#define RK3308_PDM_FRAC_MAX_PRATE 800000000 ++#define RK3308_SPDIF_FRAC_MAX_PRATE 800000000 ++#define RK3308_I2S_FRAC_MAX_PRATE 800000000 + + enum rk3308_plls { + apll, dpll, vpll0, vpll1, +@@ -333,7 +339,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(12), 0, + RK3308_CLKGATE_CON(1), 11, GFLAGS, +- &rk3308_uart0_fracmux), ++ &rk3308_uart0_fracmux, RK3308_UART_FRAC_MAX_PRATE), + GATE(SCLK_UART0, "clk_uart0", "clk_uart0_mux", 0, + RK3308_CLKGATE_CON(1), 12, GFLAGS), + +@@ -343,7 +349,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(15), 0, + RK3308_CLKGATE_CON(1), 15, GFLAGS, +- &rk3308_uart1_fracmux), ++ &rk3308_uart1_fracmux, RK3308_UART_FRAC_MAX_PRATE), + GATE(SCLK_UART1, "clk_uart1", "clk_uart1_mux", 0, + RK3308_CLKGATE_CON(2), 0, GFLAGS), + +@@ -353,7 +359,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(18), 0, + RK3308_CLKGATE_CON(2), 3, GFLAGS, +- &rk3308_uart2_fracmux), ++ &rk3308_uart2_fracmux, RK3308_UART_FRAC_MAX_PRATE), + GATE(SCLK_UART2, "clk_uart2", "clk_uart2_mux", CLK_SET_RATE_PARENT, + RK3308_CLKGATE_CON(2), 4, GFLAGS), + +@@ -363,7 +369,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart3_frac", "clk_uart3_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(21), 0, + RK3308_CLKGATE_CON(2), 7, GFLAGS, +- &rk3308_uart3_fracmux), ++ &rk3308_uart3_fracmux, RK3308_UART_FRAC_MAX_PRATE), + GATE(SCLK_UART3, "clk_uart3", "clk_uart3_mux", 0, + RK3308_CLKGATE_CON(2), 8, GFLAGS), + +@@ -373,7 +379,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart4_frac", "clk_uart4_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(24), 0, + RK3308_CLKGATE_CON(2), 11, GFLAGS, +- &rk3308_uart4_fracmux), ++ &rk3308_uart4_fracmux, RK3308_UART_FRAC_MAX_PRATE), + GATE(SCLK_UART4, "clk_uart4", "clk_uart4_mux", 0, + RK3308_CLKGATE_CON(2), 12, GFLAGS), + +@@ -453,7 +459,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "dclk_vop_frac", "dclk_vop_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(9), 0, + RK3308_CLKGATE_CON(1), 7, GFLAGS, +- &rk3308_dclk_vop_fracmux), ++ &rk3308_dclk_vop_fracmux, RK3308B_VOP_FRAC_MAX_PRATE), + GATE(DCLK_VOP, "dclk_vop", "dclk_vop_mux", 0, + RK3308_CLKGATE_CON(1), 8, GFLAGS), + +@@ -584,7 +590,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_rtc32k_frac", "xin24m", CLK_IGNORE_UNUSED, + RK3308_CLKSEL_CON(3), 0, + RK3308_CLKGATE_CON(4), 3, GFLAGS, +- &rk3308_rtc32k_fracmux), ++ &rk3308_rtc32k_fracmux, 0), + MUX(0, "clk_rtc32k_div_src", mux_vpll0_vpll1_p, 0, + RK3308_CLKSEL_CON(2), 10, 1, MFLAGS), + COMPOSITE_NOMUX(0, "clk_rtc32k_div", "clk_rtc32k_div_src", CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, +@@ -634,7 +640,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_pdm_frac", "clk_pdm_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(47), 0, + RK3308_CLKGATE_CON(10), 4, GFLAGS, +- &rk3308_pdm_fracmux), ++ &rk3308_pdm_fracmux, RK3308_PDM_FRAC_MAX_PRATE), + GATE(SCLK_PDM, "clk_pdm", "clk_pdm_mux", 0, + RK3308_CLKGATE_CON(10), 5, GFLAGS), + +@@ -644,7 +650,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_8ch_tx_frac", "clk_i2s0_8ch_tx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(53), 0, + RK3308_CLKGATE_CON(10), 13, GFLAGS, +- &rk3308_i2s0_8ch_tx_fracmux), ++ &rk3308_i2s0_8ch_tx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S0_8CH_TX, "clk_i2s0_8ch_tx", mux_i2s0_8ch_tx_rx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(52), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(10), 14, GFLAGS), +@@ -658,7 +664,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_8ch_rx_frac", "clk_i2s0_8ch_rx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(55), 0, + RK3308_CLKGATE_CON(11), 1, GFLAGS, +- &rk3308_i2s0_8ch_rx_fracmux), ++ &rk3308_i2s0_8ch_rx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S0_8CH_RX, "clk_i2s0_8ch_rx", mux_i2s0_8ch_rx_tx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(54), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(11), 2, GFLAGS), +@@ -671,7 +677,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s1_8ch_tx_frac", "clk_i2s1_8ch_tx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(57), 0, + RK3308_CLKGATE_CON(11), 5, GFLAGS, +- &rk3308_i2s1_8ch_tx_fracmux), ++ &rk3308_i2s1_8ch_tx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S1_8CH_TX, "clk_i2s1_8ch_tx", mux_i2s1_8ch_tx_rx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(56), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(11), 6, GFLAGS), +@@ -685,7 +691,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s1_8ch_rx_frac", "clk_i2s1_8ch_rx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(59), 0, + RK3308_CLKGATE_CON(11), 9, GFLAGS, +- &rk3308_i2s1_8ch_rx_fracmux), ++ &rk3308_i2s1_8ch_rx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S1_8CH_RX, "clk_i2s1_8ch_rx", mux_i2s1_8ch_rx_tx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(58), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(11), 10, GFLAGS), +@@ -698,7 +704,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s2_8ch_tx_frac", "clk_i2s2_8ch_tx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(61), 0, + RK3308_CLKGATE_CON(11), 13, GFLAGS, +- &rk3308_i2s2_8ch_tx_fracmux), ++ &rk3308_i2s2_8ch_tx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S2_8CH_TX, "clk_i2s2_8ch_tx", mux_i2s2_8ch_tx_rx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(60), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(11), 14, GFLAGS), +@@ -712,7 +718,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s2_8ch_rx_frac", "clk_i2s2_8ch_rx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(63), 0, + RK3308_CLKGATE_CON(12), 1, GFLAGS, +- &rk3308_i2s2_8ch_rx_fracmux), ++ &rk3308_i2s2_8ch_rx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S2_8CH_RX, "clk_i2s2_8ch_rx", mux_i2s2_8ch_rx_tx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(62), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(12), 2, GFLAGS), +@@ -725,7 +731,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s3_8ch_tx_frac", "clk_i2s3_8ch_tx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(65), 0, + RK3308_CLKGATE_CON(12), 5, GFLAGS, +- &rk3308_i2s3_8ch_tx_fracmux), ++ &rk3308_i2s3_8ch_tx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S3_8CH_TX, "clk_i2s3_8ch_tx", mux_i2s3_8ch_tx_rx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(64), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(12), 6, GFLAGS), +@@ -739,7 +745,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s3_8ch_rx_frac", "clk_i2s3_8ch_rx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(67), 0, + RK3308_CLKGATE_CON(12), 9, GFLAGS, +- &rk3308_i2s3_8ch_rx_fracmux), ++ &rk3308_i2s3_8ch_rx_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S3_8CH_RX, "clk_i2s3_8ch_rx", mux_i2s3_8ch_rx_tx_p, CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(66), 12, 1, MFLAGS, + RK3308_CLKGATE_CON(12), 10, GFLAGS), +@@ -752,7 +758,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_2ch_frac", "clk_i2s0_2ch_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(69), 0, + RK3308_CLKGATE_CON(12), 13, GFLAGS, +- &rk3308_i2s0_2ch_fracmux), ++ &rk3308_i2s0_2ch_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S0_2CH, "clk_i2s0_2ch", "clk_i2s0_2ch_mux", 0, + RK3308_CLKGATE_CON(12), 14, GFLAGS), + COMPOSITE_NODIV(SCLK_I2S0_2CH_OUT, "clk_i2s0_2ch_out", mux_i2s0_2ch_out_p, CLK_SET_RATE_PARENT, +@@ -765,7 +771,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s1_2ch_frac", "clk_i2s1_2ch_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(71), 0, + RK3308_CLKGATE_CON(13), 1, GFLAGS, +- &rk3308_i2s1_2ch_fracmux), ++ &rk3308_i2s1_2ch_fracmux, RK3308_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S1_2CH, "clk_i2s1_2ch", "clk_i2s1_2ch_mux", 0, + RK3308_CLKGATE_CON(13), 2, GFLAGS), + COMPOSITE_NODIV(SCLK_I2S1_2CH_OUT, "clk_i2s1_2ch_out", mux_i2s1_2ch_out_p, CLK_SET_RATE_PARENT, +@@ -783,7 +789,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_spdif_tx_frac", "clk_spdif_tx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(49), 0, + RK3308_CLKGATE_CON(10), 7, GFLAGS, +- &rk3308_spdif_tx_fracmux), ++ &rk3308_spdif_tx_fracmux, RK3308_SPDIF_FRAC_MAX_PRATE), + GATE(SCLK_SPDIF_TX, "clk_spdif_tx", "clk_spdif_tx_mux", 0, + RK3308_CLKGATE_CON(10), 8, GFLAGS), + +@@ -798,7 +804,7 @@ static struct rockchip_clk_branch rk3308_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_spdif_rx_frac", "clk_spdif_rx_src", CLK_SET_RATE_PARENT, + RK3308_CLKSEL_CON(51), 0, + RK3308_CLKGATE_CON(10), 10, GFLAGS, +- &rk3308_spdif_rx_fracmux), ++ &rk3308_spdif_rx_fracmux, RK3308_SPDIF_FRAC_MAX_PRATE), + GATE(SCLK_SPDIF_RX, "clk_spdif_rx", "clk_spdif_rx_mux", 0, + RK3308_CLKGATE_CON(10), 11, GFLAGS), + +diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c +index 267ab54937d3..483456f4da93 100644 +--- a/drivers/clk/rockchip/clk-rk3328.c ++++ b/drivers/clk/rockchip/clk-rk3328.c +@@ -16,6 +16,9 @@ + #define RK3328_GRF_SOC_STATUS0 0x480 + #define RK3328_GRF_MAC_CON1 0x904 + #define RK3328_GRF_MAC_CON2 0x908 ++#define RK3328_I2S_FRAC_MAX_PRATE 600000000 ++#define RK3328_UART_FRAC_MAX_PRATE 600000000 ++#define RK3328_SPDIF_FRAC_MAX_PRATE 600000000 + + enum rk3328_plls { + apll, dpll, cpll, gpll, npll, +@@ -373,7 +376,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(7), 0, + RK3328_CLKGATE_CON(1), 2, GFLAGS, +- &rk3328_i2s0_fracmux), ++ &rk3328_i2s0_fracmux, RK3328_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S0, "clk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT, + RK3328_CLKGATE_CON(1), 3, GFLAGS), + +@@ -383,7 +386,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(9), 0, + RK3328_CLKGATE_CON(1), 5, GFLAGS, +- &rk3328_i2s1_fracmux), ++ &rk3328_i2s1_fracmux, RK3328_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S1, "clk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT, + RK3328_CLKGATE_CON(1), 6, GFLAGS), + COMPOSITE_NODIV(SCLK_I2S1_OUT, "i2s1_out", mux_i2s1out_p, 0, +@@ -396,7 +399,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(11), 0, + RK3328_CLKGATE_CON(1), 9, GFLAGS, +- &rk3328_i2s2_fracmux), ++ &rk3328_i2s2_fracmux, RK3328_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S2, "clk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT, + RK3328_CLKGATE_CON(1), 10, GFLAGS), + COMPOSITE_NODIV(SCLK_I2S2_OUT, "i2s2_out", mux_i2s2out_p, 0, +@@ -409,7 +412,7 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_spdif_frac", "clk_spdif_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(13), 0, + RK3328_CLKGATE_CON(1), 13, GFLAGS, +- &rk3328_spdif_fracmux), ++ &rk3328_spdif_fracmux, RK3328_SPDIF_FRAC_MAX_PRATE), + + /* PD_UART */ + COMPOSITE(0, "clk_uart0_div", mux_2plls_u480m_p, 0, +@@ -424,15 +427,15 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(15), 0, + RK3328_CLKGATE_CON(1), 15, GFLAGS, +- &rk3328_uart0_fracmux), ++ &rk3328_uart0_fracmux, RK3328_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(17), 0, + RK3328_CLKGATE_CON(2), 1, GFLAGS, +- &rk3328_uart1_fracmux), ++ &rk3328_uart1_fracmux, RK3328_UART_FRAC_MAX_PRATE), + COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_div", CLK_SET_RATE_PARENT, + RK3328_CLKSEL_CON(19), 0, + RK3328_CLKGATE_CON(2), 3, GFLAGS, +- &rk3328_uart2_fracmux), ++ &rk3328_uart2_fracmux, RK3328_UART_FRAC_MAX_PRATE), + + /* + * Clock-Architecture Diagram 4 +diff --git a/drivers/clk/rockchip/clk-rk3368.c b/drivers/clk/rockchip/clk-rk3368.c +index 2c50cc2cc6db..8d5960f58cb2 100644 +--- a/drivers/clk/rockchip/clk-rk3368.c ++++ b/drivers/clk/rockchip/clk-rk3368.c +@@ -12,6 +12,9 @@ + #include "clk.h" + + #define RK3368_GRF_SOC_STATUS0 0x480 ++#define RK3368_I2S_FRAC_MAX_PRATE 600000000 ++#define RK3368_UART_FRAC_MAX_PRATE 600000000 ++#define RK3368_SPDIF_FRAC_MAX_PRATE 600000000 + + enum rk3368_plls { + apllb, aplll, dpll, cpll, gpll, npll, +@@ -370,7 +373,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s_8ch_frac", "i2s_8ch_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(28), 0, + RK3368_CLKGATE_CON(6), 2, GFLAGS, +- &rk3368_i2s_8ch_fracmux), ++ &rk3368_i2s_8ch_fracmux, RK3368_I2S_FRAC_MAX_PRATE), + COMPOSITE_NODIV(SCLK_I2S_8CH_OUT, "i2s_8ch_clkout", mux_i2s_8ch_clkout_p, 0, + RK3368_CLKSEL_CON(27), 15, 1, MFLAGS, + RK3368_CLKGATE_CON(6), 0, GFLAGS), +@@ -382,7 +385,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "spdif_8ch_frac", "spdif_8ch_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(32), 0, + RK3368_CLKGATE_CON(6), 5, GFLAGS, +- &rk3368_spdif_8ch_fracmux), ++ &rk3368_spdif_8ch_fracmux, RK3368_SPDIF_FRAC_MAX_PRATE), + GATE(SCLK_SPDIF_8CH, "sclk_spdif_8ch", "spdif_8ch_pre", CLK_SET_RATE_PARENT, + RK3368_CLKGATE_CON(6), 6, GFLAGS), + COMPOSITE(0, "i2s_2ch_src", mux_pll_src_cpll_gpll_p, 0, +@@ -391,7 +394,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s_2ch_frac", "i2s_2ch_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(54), 0, + RK3368_CLKGATE_CON(5), 14, GFLAGS, +- &rk3368_i2s_2ch_fracmux), ++ &rk3368_i2s_2ch_fracmux, RK3368_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S_2CH, "sclk_i2s_2ch", "i2s_2ch_pre", CLK_SET_RATE_PARENT, + RK3368_CLKGATE_CON(5), 15, GFLAGS), + +@@ -592,7 +595,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(34), 0, + RK3368_CLKGATE_CON(2), 1, GFLAGS, +- &rk3368_uart0_fracmux), ++ &rk3368_uart0_fracmux, RK3368_UART_FRAC_MAX_PRATE), + + COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0, + RK3368_CLKSEL_CON(35), 0, 7, DFLAGS, +@@ -600,7 +603,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(36), 0, + RK3368_CLKGATE_CON(2), 3, GFLAGS, +- &rk3368_uart1_fracmux), ++ &rk3368_uart1_fracmux, RK3368_UART_FRAC_MAX_PRATE), + + COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0, + RK3368_CLKSEL_CON(39), 0, 7, DFLAGS, +@@ -608,7 +611,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart3_frac", "uart3_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(40), 0, + RK3368_CLKGATE_CON(2), 7, GFLAGS, +- &rk3368_uart3_fracmux), ++ &rk3368_uart3_fracmux, RK3368_UART_FRAC_MAX_PRATE), + + COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0, + RK3368_CLKSEL_CON(41), 0, 7, DFLAGS, +@@ -616,7 +619,7 @@ static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart4_frac", "uart4_src", CLK_SET_RATE_PARENT, + RK3368_CLKSEL_CON(42), 0, + RK3368_CLKGATE_CON(2), 9, GFLAGS, +- &rk3368_uart4_fracmux), ++ &rk3368_uart4_fracmux, RK3368_UART_FRAC_MAX_PRATE), + + COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0, + RK3368_CLKSEL_CON(43), 6, 2, MFLAGS, 0, 5, DFLAGS, +diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c +index 9ebd6c451b3d..16dc6d498971 100644 +--- a/drivers/clk/rockchip/clk-rk3399.c ++++ b/drivers/clk/rockchip/clk-rk3399.c +@@ -15,6 +15,12 @@ + #include + #include "clk.h" + ++#define RK3399_I2S_FRAC_MAX_PRATE 800000000 ++#define RK3399_UART_FRAC_MAX_PRATE 800000000 ++#define RK3399_SPDIF_FRAC_MAX_PRATE 600000000 ++#define RK3399_VOP_FRAC_MAX_PRATE 600000000 ++#define RK3399_WIFI_FRAC_MAX_PRATE 600000000 ++ + enum rk3399_plls { + lpll, bpll, dpll, cpll, gpll, npll, vpll, + }; +@@ -586,7 +592,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_spdif_frac", "clk_spdif_div", 0, + RK3399_CLKSEL_CON(99), 0, + RK3399_CLKGATE_CON(8), 14, GFLAGS, +- &rk3399_spdif_fracmux), ++ &rk3399_spdif_fracmux, RK3399_SPDIF_FRAC_MAX_PRATE), + GATE(SCLK_SPDIF_8CH, "clk_spdif", "clk_spdif_mux", CLK_SET_RATE_PARENT, + RK3399_CLKGATE_CON(8), 15, GFLAGS), + +@@ -600,7 +606,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", 0, + RK3399_CLKSEL_CON(96), 0, + RK3399_CLKGATE_CON(8), 4, GFLAGS, +- &rk3399_i2s0_fracmux), ++ &rk3399_i2s0_fracmux, RK3399_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S0_8CH, "clk_i2s0", "clk_i2s0_mux", CLK_SET_RATE_PARENT, + RK3399_CLKGATE_CON(8), 5, GFLAGS), + +@@ -610,7 +616,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", 0, + RK3399_CLKSEL_CON(97), 0, + RK3399_CLKGATE_CON(8), 7, GFLAGS, +- &rk3399_i2s1_fracmux), ++ &rk3399_i2s1_fracmux, RK3399_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S1_8CH, "clk_i2s1", "clk_i2s1_mux", CLK_SET_RATE_PARENT, + RK3399_CLKGATE_CON(8), 8, GFLAGS), + +@@ -620,7 +626,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", 0, + RK3399_CLKSEL_CON(98), 0, + RK3399_CLKGATE_CON(8), 10, GFLAGS, +- &rk3399_i2s2_fracmux), ++ &rk3399_i2s2_fracmux, RK3399_I2S_FRAC_MAX_PRATE), + GATE(SCLK_I2S2_8CH, "clk_i2s2", "clk_i2s2_mux", CLK_SET_RATE_PARENT, + RK3399_CLKGATE_CON(8), 11, GFLAGS), + +@@ -639,7 +645,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_div", 0, + RK3399_CLKSEL_CON(100), 0, + RK3399_CLKGATE_CON(9), 1, GFLAGS, +- &rk3399_uart0_fracmux), ++ &rk3399_uart0_fracmux, RK3399_UART_FRAC_MAX_PRATE), + + MUX(0, "clk_uart_src", mux_pll_src_cpll_gpll_p, 0, + RK3399_CLKSEL_CON(33), 15, 1, MFLAGS), +@@ -649,7 +655,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_div", 0, + RK3399_CLKSEL_CON(101), 0, + RK3399_CLKGATE_CON(9), 3, GFLAGS, +- &rk3399_uart1_fracmux), ++ &rk3399_uart1_fracmux, RK3399_UART_FRAC_MAX_PRATE), + + COMPOSITE_NOMUX(0, "clk_uart2_div", "clk_uart_src", 0, + RK3399_CLKSEL_CON(35), 0, 7, DFLAGS, +@@ -657,7 +663,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_div", 0, + RK3399_CLKSEL_CON(102), 0, + RK3399_CLKGATE_CON(9), 5, GFLAGS, +- &rk3399_uart2_fracmux), ++ &rk3399_uart2_fracmux, RK3399_UART_FRAC_MAX_PRATE), + + COMPOSITE_NOMUX(0, "clk_uart3_div", "clk_uart_src", 0, + RK3399_CLKSEL_CON(36), 0, 7, DFLAGS, +@@ -665,7 +671,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart3_frac", "clk_uart3_div", 0, + RK3399_CLKSEL_CON(103), 0, + RK3399_CLKGATE_CON(9), 7, GFLAGS, +- &rk3399_uart3_fracmux), ++ &rk3399_uart3_fracmux, RK3399_UART_FRAC_MAX_PRATE), + + COMPOSITE(PCLK_DDR, "pclk_ddr", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED, + RK3399_CLKSEL_CON(6), 15, 1, MFLAGS, 8, 5, DFLAGS, +@@ -1168,7 +1174,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + + COMPOSITE_FRACMUX_NOGATE(DCLK_VOP0_FRAC, "dclk_vop0_frac", "dclk_vop0_div", 0, + RK3399_CLKSEL_CON(106), 0, +- &rk3399_dclk_vop0_fracmux), ++ &rk3399_dclk_vop0_fracmux, RK3399_VOP_FRAC_MAX_PRATE), + + COMPOSITE(SCLK_VOP0_PWM, "clk_vop0_pwm", mux_pll_src_vpll_cpll_gpll_24m_p, 0, + RK3399_CLKSEL_CON(51), 6, 2, MFLAGS, 0, 5, DFLAGS, +@@ -1198,7 +1204,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + + COMPOSITE_FRACMUX_NOGATE(DCLK_VOP1_FRAC, "dclk_vop1_frac", "dclk_vop1_div", 0, + RK3399_CLKSEL_CON(107), 0, +- &rk3399_dclk_vop1_fracmux), ++ &rk3399_dclk_vop1_fracmux, RK3399_VOP_FRAC_MAX_PRATE), + + COMPOSITE(SCLK_VOP1_PWM, "clk_vop1_pwm", mux_pll_src_vpll_cpll_gpll_24m_p, CLK_IGNORE_UNUSED, + RK3399_CLKSEL_CON(52), 6, 2, MFLAGS, 0, 5, DFLAGS, +@@ -1315,7 +1321,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + RK3399_CLKSEL_CON(58), 7, 1, MFLAGS), + COMPOSITE_FRAC(0, "clk_test_frac", "clk_test_pre", 0, + RK3399_CLKSEL_CON(105), 0, +- RK3399_CLKGATE_CON(13), 9, GFLAGS), ++ RK3399_CLKGATE_CON(13), 9, GFLAGS, 0), + + DIV(0, "clk_test_24m", "xin24m", 0, + RK3399_CLKSEL_CON(57), 6, 10, DFLAGS), +@@ -1420,7 +1426,7 @@ static struct rockchip_clk_branch rk3399_clk_pmu_branches[] __initdata = { + + COMPOSITE_FRACMUX_NOGATE(0, "clk_wifi_frac", "clk_wifi_div", 0, + RK3399_PMU_CLKSEL_CON(7), 0, +- &rk3399_pmuclk_wifi_fracmux), ++ &rk3399_pmuclk_wifi_fracmux, RK3399_WIFI_FRAC_MAX_PRATE), + + MUX(0, "clk_timer_src_pmu", mux_pll_p, CLK_IGNORE_UNUSED, + RK3399_PMU_CLKSEL_CON(1), 15, 1, MFLAGS), +@@ -1449,7 +1455,7 @@ static struct rockchip_clk_branch rk3399_clk_pmu_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "clk_uart4_frac", "clk_uart4_div", 0, + RK3399_PMU_CLKSEL_CON(6), 0, + RK3399_PMU_CLKGATE_CON(0), 6, GFLAGS, +- &rk3399_uart4_pmu_fracmux), ++ &rk3399_uart4_pmu_fracmux, RK3399_UART_FRAC_MAX_PRATE), + + DIV(PCLK_SRC_PMU, "pclk_pmu_src", "ppll", CLK_IGNORE_UNUSED, + RK3399_PMU_CLKSEL_CON(0), 0, 5, DFLAGS), +diff --git a/drivers/clk/rockchip/clk-rv1108.c b/drivers/clk/rockchip/clk-rv1108.c +index 5f49af3c970a..95c89800a87a 100644 +--- a/drivers/clk/rockchip/clk-rv1108.c ++++ b/drivers/clk/rockchip/clk-rv1108.c +@@ -14,6 +14,8 @@ + #include "clk.h" + + #define RV1108_GRF_SOC_STATUS0 0x480 ++#define RV1108_I2S_FRAC_MAX_RATE 600000000 ++#define RV1108_UART_FRAC_MAX_RATE 600000000 + + enum rv1108_plls { + apll, dpll, gpll, +@@ -504,7 +506,7 @@ static struct rockchip_clk_branch rv1108_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s0_frac", "i2s0_src", CLK_SET_RATE_PARENT, + RV1108_CLKSEL_CON(8), 0, + RV1108_CLKGATE_CON(2), 1, GFLAGS, +- &rv1108_i2s0_fracmux), ++ &rv1108_i2s0_fracmux, RV1108_I2S_FRAC_MAX_RATE), + GATE(SCLK_I2S0, "sclk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT, + RV1108_CLKGATE_CON(2), 2, GFLAGS), + COMPOSITE_NODIV(0, "i2s_out", mux_i2s_out_p, 0, +@@ -517,7 +519,7 @@ static struct rockchip_clk_branch rv1108_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s1_frac", "i2s1_src", CLK_SET_RATE_PARENT, + RK2928_CLKSEL_CON(9), 0, + RK2928_CLKGATE_CON(2), 5, GFLAGS, +- &rv1108_i2s1_fracmux), ++ &rv1108_i2s1_fracmux, RV1108_I2S_FRAC_MAX_RATE), + GATE(SCLK_I2S1, "sclk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT, + RV1108_CLKGATE_CON(2), 6, GFLAGS), + +@@ -527,7 +529,7 @@ static struct rockchip_clk_branch rv1108_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "i2s2_frac", "i2s2_src", CLK_SET_RATE_PARENT, + RV1108_CLKSEL_CON(10), 0, + RV1108_CLKGATE_CON(2), 9, GFLAGS, +- &rv1108_i2s2_fracmux), ++ &rv1108_i2s2_fracmux, RV1108_I2S_FRAC_MAX_RATE), + GATE(SCLK_I2S2, "sclk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT, + RV1108_CLKGATE_CON(2), 10, GFLAGS), + +@@ -593,15 +595,15 @@ static struct rockchip_clk_branch rv1108_clk_branches[] __initdata = { + COMPOSITE_FRACMUX(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, + RV1108_CLKSEL_CON(16), 0, + RV1108_CLKGATE_CON(3), 2, GFLAGS, +- &rv1108_uart0_fracmux), ++ &rv1108_uart0_fracmux, RV1108_UART_FRAC_MAX_RATE), + COMPOSITE_FRACMUX(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, + RV1108_CLKSEL_CON(17), 0, + RV1108_CLKGATE_CON(3), 4, GFLAGS, +- &rv1108_uart1_fracmux), ++ &rv1108_uart1_fracmux, RV1108_UART_FRAC_MAX_RATE), + COMPOSITE_FRACMUX(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT, + RV1108_CLKSEL_CON(18), 0, + RV1108_CLKGATE_CON(3), 6, GFLAGS, +- &rv1108_uart2_fracmux), ++ &rv1108_uart2_fracmux, RV1108_UART_FRAC_MAX_RATE), + GATE(PCLK_UART0, "pclk_uart0", "pclk_bus_pre", 0, + RV1108_CLKGATE_CON(13), 10, GFLAGS), + GATE(PCLK_UART1, "pclk_uart1", "pclk_bus_pre", 0, +diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c +index e63d4f20b479..74ab9f25834a 100644 +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -204,7 +219,7 @@ static struct clk *rockchip_clk_register_frac_branch( + void __iomem *base, int muxdiv_offset, u8 div_flags, + int gate_offset, u8 gate_shift, u8 gate_flags, + unsigned long flags, struct rockchip_clk_branch *child, +- spinlock_t *lock) ++ unsigned long max_prate, spinlock_t *lock) + { + struct clk_hw *hw; + struct rockchip_clk_frac *frac; +@@ -245,6 +260,7 @@ static struct clk *rockchip_clk_register_frac_branch( + div->nmask = GENMASK(div->nwidth - 1, 0) << div->nshift; + div->lock = lock; + div->approximation = rockchip_fractional_approximation; ++ div->max_prate = max_prate; + div_ops = &clk_fractional_divider_ops; + + hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, +@@ -383,6 +399,8 @@ struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, + + ctx->grf = syscon_regmap_lookup_by_phandle(ctx->cru_node, + "rockchip,grf"); ++ ctx->pmugrf = syscon_regmap_lookup_by_phandle(ctx->cru_node, ++ "rockchip,pmugrf"); + + return ctx; + +@@ -471,6 +489,13 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx, + list->mux_shift, list->mux_width, + list->mux_flags); + break; ++ case branch_muxpmugrf: ++ clk = rockchip_clk_register_muxgrf(list->name, ++ list->parent_names, list->num_parents, ++ flags, ctx->pmugrf, list->muxdiv_offset, ++ list->mux_shift, list->mux_width, ++ list->mux_flags); ++ break; + case branch_divider: + if (list->div_table) + clk = clk_register_divider_table(NULL, +@@ -494,7 +519,7 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx, + list->div_flags, + list->gate_offset, list->gate_shift, + list->gate_flags, flags, list->child, +- &ctx->lock); ++ list->max_prate, &ctx->lock); + break; + case branch_half_divider: + clk = rockchip_clk_register_halfdiv(list->name, +diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h +index ee01739e4a7c..38403e03cd1e 100644 +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -285,6 +285,7 @@ struct rockchip_clk_provider { + struct clk_onecell_data clk_data; + struct device_node *cru_node; + struct regmap *grf; ++ struct regmap *pmugrf; + spinlock_t lock; + }; + +@@ -446,6 +447,7 @@ enum rockchip_clk_branch_type { + branch_composite, + branch_mux, + branch_muxgrf, ++ branch_muxpmugrf, + branch_divider, + branch_fraction_divider, + branch_gate, +@@ -477,6 +479,7 @@ struct rockchip_clk_branch { + u8 gate_shift; + u8 gate_flags; + struct rockchip_clk_branch *child; ++ unsigned long max_prate; + }; + + #define COMPOSITE(_id, cname, pnames, f, mo, ms, mw, mf, ds, dw,\ +@@ -616,7 +619,7 @@ struct rockchip_clk_branch { + .gate_offset = -1, \ + } + +-#define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf)\ ++#define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf, prate)\ + { \ + .id = _id, \ + .branch_type = branch_fraction_divider, \ +@@ -631,9 +634,10 @@ struct rockchip_clk_branch { + .gate_offset = go, \ + .gate_shift = gs, \ + .gate_flags = gf, \ ++ .max_prate = prate, \ + } + +-#define COMPOSITE_FRACMUX(_id, cname, pname, f, mo, df, go, gs, gf, ch) \ ++#define COMPOSITE_FRACMUX(_id, cname, pname, f, mo, df, go, gs, gf, ch, prate) \ + { \ + .id = _id, \ + .branch_type = branch_fraction_divider, \ +@@ -649,9 +653,10 @@ struct rockchip_clk_branch { + .gate_shift = gs, \ + .gate_flags = gf, \ + .child = ch, \ ++ .max_prate = prate, \ + } + +-#define COMPOSITE_FRACMUX_NOGATE(_id, cname, pname, f, mo, df, ch) \ ++#define COMPOSITE_FRACMUX_NOGATE(_id, cname, pname, f, mo, df, ch, prate) \ + { \ + .id = _id, \ + .branch_type = branch_fraction_divider, \ +@@ -665,6 +670,7 @@ struct rockchip_clk_branch { + .div_flags = df, \ + .gate_offset = -1, \ + .child = ch, \ ++ .max_prate = prate, \ + } + + #define COMPOSITE_DDRCLK(_id, cname, pnames, f, mo, ms, mw, \ +@@ -731,6 +737,21 @@ struct rockchip_clk_branch { + .gate_offset = -1, \ + } + ++#define MUXPMUGRF(_id, cname, pnames, f, o, s, w, mf) \ ++ { \ ++ .id = _id, \ ++ .branch_type = branch_muxpmugrf, \ ++ .name = cname, \ ++ .parent_names = pnames, \ ++ .num_parents = ARRAY_SIZE(pnames), \ ++ .flags = f, \ ++ .muxdiv_offset = o, \ ++ .mux_shift = s, \ ++ .mux_width = w, \ ++ .mux_flags = mf, \ ++ .gate_offset = -1, \ ++ } ++ + #define DIV(_id, cname, pname, f, o, s, w, df) \ + { \ + .id = _id, \ +diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h +index 15e336281d1f..ca7e21d0251f 100644 +--- a/include/linux/clk-provider.h ++++ b/include/linux/clk-provider.h +@@ -1109,6 +1109,7 @@ struct clk_hw *clk_hw_register_fixed_factor_parent_hw(struct device *dev, + * @mwidth: width of the numerator bit field + * @nshift: shift to the denominator bit field + * @nwidth: width of the denominator bit field ++ * @max_parent: the maximum frequency of fractional divider parent clock + * @approximation: clk driver's callback for calculating the divider clock + * @lock: register lock + * +@@ -1139,6 +1140,7 @@ struct clk_fractional_divider { + u8 nwidth; + u32 nmask; + u8 flags; ++ unsigned long max_prate; + void (*approximation)(struct clk_hw *hw, + unsigned long rate, unsigned long *parent_rate, + unsigned long *m, unsigned long *n); +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk322x-audio-codec.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk322x-audio-codec.patch new file mode 100644 index 000000000000..b202614fd797 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk322x-audio-codec.patch @@ -0,0 +1,914 @@ +From 50a8db983c682918cd2efe02ede48db93892d52a Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 20 Jul 2024 13:51:55 +0200 +Subject: [PATCH] rk3228: add analog audio codec + +--- + .../bindings/sound/rockchip,rk3228-codec.txt | 22 + + arch/arm/boot/dts/rockchip/rk322x.dtsi | 9 + + drivers/clk/rockchip/clk-rk3228.c | 2 +- + include/dt-bindings/clock/rk3228-cru.h | 1 + + sound/soc/codecs/Kconfig | 6 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/rk3228_codec.c | 545 ++++++++++++++++++ + sound/soc/codecs/rk3228_codec.h | 218 +++++++ + 8 files changed, 804 insertions(+), 1 deletion(-) + create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt + create mode 100644 sound/soc/codecs/rk3228_codec.c + create mode 100644 sound/soc/codecs/rk3228_codec.h + +diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt +new file mode 100644 +index 000000000000..9191a8593380 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/rockchip,rk3228-codec.txt +@@ -0,0 +1,22 @@ ++* Rockchip Rk3228 internal codec ++ ++Required properties: ++ ++- compatible: "rockchip,rk3228-codec" ++- reg: physical base address of the controller and length of memory mapped ++ region. ++- clocks: a list of phandle + clock-specifer pairs, one for each entry in clock-names. ++- clock-names: a list of clock names, one for each entry in clocks. ++- spk-en-gpio: speaker enable gpio. ++- spk-depop-time-ms: speaker depop time msec. ++ ++Example for rk3228 internal codec: ++ ++codec: codec@12010000 { ++ compatible = "rockchip,rk3228-codec"; ++ reg = <0x12010000 0x1000>; ++ clocks = <&cru SCLK_I2S_OUT>, <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>; ++ clock-names = "mclk", "pclk", "sclk"; ++ spk-en-gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ status = "disabled"; ++}; +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index cc5a5e609f04..d13dc979a67e 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -249,6 +249,15 @@ i2s1: i2s1@100b0000 { + status = "disabled"; + }; + ++ codec: codec@12010000 { ++ compatible = "rockchip,rk3228-codec"; ++ reg = <0x12010000 0x1000>; ++ clocks = <&cru SCLK_I2S_OUT>, <&cru PCLK_ACODECPHY>, <&cru SCLK_I2S1>; ++ clock-names = "mclk", "pclk", "sclk"; ++ spk-en-gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ status = "disabled"; ++ }; ++ + i2s0: i2s0@100c0000 { + compatible = "rockchip,rk3228-i2s", "rockchip,rk3066-i2s"; + reg = <0x100c0000 0x4000>; +diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c +index 0db8a97007f2..0f690dd84650 100644 +--- a/drivers/clk/rockchip/clk-rk3228.c ++++ b/drivers/clk/rockchip/clk-rk3228.c +@@ -603,7 +603,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + GATE(0, "pclk_sim", "pclk_cpu", 0, RK2928_CLKGATE_CON(10), 3, GFLAGS), + + GATE(0, "pclk_ddrphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 3, GFLAGS), +- GATE(0, "pclk_acodecphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 5, GFLAGS), ++ GATE(PCLK_ACODECPHY, "pclk_acodecphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 5, GFLAGS), + GATE(PCLK_HDMI_PHY, "pclk_hdmiphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 7, GFLAGS), + GATE(0, "pclk_vdacphy", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 8, GFLAGS), + GATE(0, "pclk_phy_noc", "pclk_phy_pre", 0, RK2928_CLKGATE_CON(10), 9, GFLAGS), +diff --git a/include/dt-bindings/clock/rk3228-cru.h b/include/dt-bindings/clock/rk3228-cru.h +index 911824731866..9162f9132657 100644 +--- a/include/dt-bindings/clock/rk3228-cru.h ++++ b/include/dt-bindings/clock/rk3228-cru.h +@@ -116,6 +116,7 @@ + #define PCLK_HDMI_CTRL 364 + #define PCLK_HDMI_PHY 365 + #define PCLK_GMAC 367 ++#define PCLK_ACODECPHY 368 + + /* hclk gates */ + #define HCLK_I2S0_8CH 442 +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 4afc43d3f71f..183a69249160 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -182,6 +182,7 @@ config SND_SOC_ALL_CODECS + imply SND_SOC_PCM6240 + imply SND_SOC_PEB2466 + imply SND_SOC_RK3308 ++ imply SND_SOC_RK3228 + imply SND_SOC_RK3328 + imply SND_SOC_RK817 + imply SND_SOC_RT274 +@@ -1457,6 +1458,11 @@ config SND_SOC_RK3308 + It has 8 24-bit ADCs and 2 24-bit DACs. The maximum supported + sampling rate is 192 kHz. + ++config SND_SOC_RK3228 ++ tristate "Rockchip RK3228 audio CODEC" ++ depends on ARCH_ROCKCHIP || COMPILE_TEST ++ select REGMAP_MMIO ++ + config SND_SOC_RK3328 + tristate "Rockchip RK3328 audio CODEC" + depends on ARCH_ROCKCHIP || COMPILE_TEST +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index b4df22186e25..454179eb7b73 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -207,6 +207,7 @@ snd-soc-pcm512x-spi-y := pcm512x-spi.o + snd-soc-pcm6240-y := pcm6240.o + snd-soc-peb2466-y := peb2466.o + snd-soc-rk3308-y := rk3308_codec.o ++snd-soc-rk3228-y := rk3228_codec.o + snd-soc-rk3328-y := rk3328_codec.o + snd-soc-rk817-y := rk817_codec.o + snd-soc-rl6231-y := rl6231.o +@@ -599,6 +600,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o + obj-$(CONFIG_SND_SOC_PCM6240) += snd-soc-pcm6240.o + obj-$(CONFIG_SND_SOC_PEB2466) += snd-soc-peb2466.o + obj-$(CONFIG_SND_SOC_RK3308) += snd-soc-rk3308.o ++obj-$(CONFIG_SND_SOC_RK3228) += snd-soc-rk3228.o + obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o + obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o + obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o +diff --git a/sound/soc/codecs/rk3228_codec.c b/sound/soc/codecs/rk3228_codec.c +new file mode 100644 +index 000000000000..197e7e2e0d8b +--- /dev/null ++++ b/sound/soc/codecs/rk3228_codec.c +@@ -0,0 +1,545 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// ++// rk3228_codec.c -- rk3228 ALSA Soc Audio driver ++// ++// Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "rk3228_codec.h" ++ ++/* ++ * volume setting ++ * 0: -39dB ++ * 26: 0dB ++ * 31: 6dB ++ * Step: 1.5dB ++ */ ++#define OUT_VOLUME (0x18) ++#define INITIAL_FREQ (11289600) ++ ++struct rk3228_codec_priv { ++ struct regmap *regmap; ++ struct clk *mclk; ++ struct clk *pclk; ++ struct clk *sclk; ++ struct gpio_desc *spk_en_gpio; ++ int spk_depop_time; /* msec */ ++}; ++ ++static const struct reg_default rk3228_codec_reg_defaults[] = { ++ { CODEC_RESET, 0x03 }, ++ { DAC_INIT_CTRL1, 0x00 }, ++ { DAC_INIT_CTRL2, 0x50 }, ++ { DAC_INIT_CTRL3, 0x0e }, ++ { DAC_PRECHARGE_CTRL, 0x01 }, ++ { DAC_PWR_CTRL, 0x00 }, ++ { DAC_CLK_CTRL, 0x00 }, ++ { HPMIX_CTRL, 0x00 }, ++ { HPOUT_CTRL, 0x00 }, ++ { HPOUTL_GAIN_CTRL, 0x00 }, ++ { HPOUTR_GAIN_CTRL, 0x00 }, ++ { HPOUT_POP_CTRL, 0x11 }, ++}; ++ ++static int rk3228_codec_reset(struct snd_soc_component *component) ++{ ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ ++ regmap_write(rk3228->regmap, CODEC_RESET, 0); ++ mdelay(10); ++ regmap_write(rk3228->regmap, CODEC_RESET, 0x03); ++ ++ return 0; ++} ++ ++static int rk3228_set_dai_fmt(struct snd_soc_dai *dai, ++ unsigned int fmt) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ unsigned int val = 0; ++ ++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ val |= PIN_DIRECTION_IN | DAC_I2S_MODE_SLAVE; ++ break; ++ case SND_SOC_DAIFMT_CBM_CFM: ++ val |= PIN_DIRECTION_OUT | DAC_I2S_MODE_MASTER; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL1, ++ PIN_DIRECTION_MASK | DAC_I2S_MODE_MASK, val); ++ ++ val = 0; ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_DSP_A: ++ case SND_SOC_DAIFMT_DSP_B: ++ val |= DAC_MODE_PCM; ++ break; ++ case SND_SOC_DAIFMT_I2S: ++ val |= DAC_MODE_I2S; ++ break; ++ case SND_SOC_DAIFMT_RIGHT_J: ++ val |= DAC_MODE_RJM; ++ break; ++ case SND_SOC_DAIFMT_LEFT_J: ++ val |= DAC_MODE_LJM; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL2, ++ DAC_MODE_MASK, val); ++ return 0; ++} ++ ++static void rk3228_analog_output(struct rk3228_codec_priv *rk3228, int mute) ++{ ++ if (rk3228->spk_en_gpio) ++ gpiod_set_value(rk3228->spk_en_gpio, mute); ++} ++ ++static int rk3228_mute_stream(struct snd_soc_dai *dai, int mute, int direction) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ unsigned int val = 0; ++ ++ if (direction != SNDRV_PCM_STREAM_PLAYBACK) ++ return 0; ++ ++ if (mute) ++ val = HPOUTL_MUTE | HPOUTR_MUTE; ++ else ++ val = HPOUTL_UNMUTE | HPOUTR_UNMUTE; ++ ++ regmap_update_bits(rk3228->regmap, HPOUT_CTRL, ++ HPOUTL_MUTE_MASK | HPOUTR_MUTE_MASK, val); ++ return 0; ++} ++ ++static int rk3228_codec_power_on(struct snd_soc_component *component, int wait_ms) ++{ ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ ++ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL, ++ DAC_CHARGE_XCHARGE_MASK, DAC_CHARGE_PRECHARGE); ++ mdelay(10); ++ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL, ++ DAC_CHARGE_CURRENT_ALL_MASK, ++ DAC_CHARGE_CURRENT_ALL_ON); ++ ++ mdelay(wait_ms); ++ ++ return 0; ++} ++ ++static int rk3228_codec_power_off(struct snd_soc_component *component, int wait_ms) ++{ ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ ++ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL, ++ DAC_CHARGE_XCHARGE_MASK, DAC_CHARGE_DISCHARGE); ++ mdelay(10); ++ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL, ++ DAC_CHARGE_CURRENT_ALL_MASK, ++ DAC_CHARGE_CURRENT_ALL_ON); ++ ++ mdelay(wait_ms); ++ ++ return 0; ++} ++ ++static struct rk3228_reg_msk_val playback_open_list[] = { ++ { DAC_PWR_CTRL, DAC_PWR_MASK, DAC_PWR_ON }, ++ { DAC_PWR_CTRL, DACL_PATH_REFV_MASK | DACR_PATH_REFV_MASK, ++ DACL_PATH_REFV_ON | DACR_PATH_REFV_ON }, ++ { DAC_PWR_CTRL, HPOUTL_ZERO_CROSSING_ON | HPOUTR_ZERO_CROSSING_ON, ++ HPOUTL_ZERO_CROSSING_ON | HPOUTR_ZERO_CROSSING_ON }, ++ { HPOUT_POP_CTRL, HPOUTR_POP_MASK | HPOUTL_POP_MASK, ++ HPOUTR_POP_WORK | HPOUTL_POP_WORK }, ++ { HPMIX_CTRL, HPMIXL_MASK | HPMIXR_MASK, HPMIXL_EN | HPMIXR_EN }, ++ { HPMIX_CTRL, HPMIXL_INIT_MASK | HPMIXR_INIT_MASK, ++ HPMIXL_INIT_EN | HPMIXR_INIT_EN }, ++ { HPOUT_CTRL, HPOUTL_MASK | HPOUTR_MASK, HPOUTL_EN | HPOUTR_EN }, ++ { HPOUT_CTRL, HPOUTL_INIT_MASK | HPOUTR_INIT_MASK, ++ HPOUTL_INIT_EN | HPOUTR_INIT_EN }, ++ { DAC_CLK_CTRL, DACL_REFV_MASK | DACR_REFV_MASK, ++ DACL_REFV_ON | DACR_REFV_ON }, ++ { DAC_CLK_CTRL, DACL_CLK_MASK | DACR_CLK_MASK, ++ DACL_CLK_ON | DACR_CLK_ON }, ++ { DAC_CLK_CTRL, DACL_MASK | DACR_MASK, DACL_ON | DACR_ON }, ++ { DAC_CLK_CTRL, DACL_INIT_MASK | DACR_INIT_MASK, ++ DACL_INIT_ON | DACR_INIT_ON }, ++ { DAC_SELECT, DACL_SELECT_MASK | DACR_SELECT_MASK, ++ DACL_SELECT | DACR_SELECT }, ++ { HPMIX_CTRL, HPMIXL_INIT2_MASK | HPMIXR_INIT2_MASK, ++ HPMIXL_INIT2_EN | HPMIXR_INIT2_EN }, ++ { HPOUT_CTRL, HPOUTL_MUTE_MASK | HPOUTR_MUTE_MASK, ++ HPOUTL_UNMUTE | HPOUTR_UNMUTE }, ++}; ++ ++#define PLAYBACK_OPEN_LIST_LEN ARRAY_SIZE(playback_open_list) ++ ++static int rk3228_codec_open_playback(struct snd_soc_component *component) ++{ ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ int i = 0; ++ ++ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL, ++ DAC_CHARGE_CURRENT_ALL_MASK, ++ DAC_CHARGE_CURRENT_I); ++ ++ for (i = 0; i < PLAYBACK_OPEN_LIST_LEN; i++) { ++ regmap_update_bits(rk3228->regmap, ++ playback_open_list[i].reg, ++ playback_open_list[i].msk, ++ playback_open_list[i].val); ++ mdelay(1); ++ } ++ ++ msleep(rk3228->spk_depop_time); ++ rk3228_analog_output(rk3228, 1); ++ ++ regmap_update_bits(rk3228->regmap, HPOUTL_GAIN_CTRL, ++ HPOUTL_GAIN_MASK, OUT_VOLUME); ++ regmap_update_bits(rk3228->regmap, HPOUTR_GAIN_CTRL, ++ HPOUTR_GAIN_MASK, OUT_VOLUME); ++ return 0; ++} ++ ++static struct rk3228_reg_msk_val playback_close_list[] = { ++ { HPMIX_CTRL, HPMIXL_INIT2_MASK | HPMIXR_INIT2_MASK, ++ HPMIXL_INIT2_DIS | HPMIXR_INIT2_DIS }, ++ { DAC_SELECT, DACL_SELECT_MASK | DACR_SELECT_MASK, ++ DACL_DESELECT | DACR_DESELECT }, ++ { HPOUT_CTRL, HPOUTL_MUTE_MASK | HPOUTR_MUTE_MASK, ++ HPOUTL_MUTE | HPOUTR_MUTE }, ++ { HPOUT_CTRL, HPOUTL_INIT_MASK | HPOUTR_INIT_MASK, ++ HPOUTL_INIT_DIS | HPOUTR_INIT_DIS }, ++ { HPOUT_CTRL, HPOUTL_MASK | HPOUTR_MASK, HPOUTL_DIS | HPOUTR_DIS }, ++ { HPMIX_CTRL, HPMIXL_MASK | HPMIXR_MASK, HPMIXL_DIS | HPMIXR_DIS }, ++ { DAC_CLK_CTRL, DACL_MASK | DACR_MASK, DACL_OFF | DACR_OFF }, ++ { DAC_CLK_CTRL, DACL_CLK_MASK | DACR_CLK_MASK, ++ DACL_CLK_OFF | DACR_CLK_OFF }, ++ { DAC_CLK_CTRL, DACL_REFV_MASK | DACR_REFV_MASK, ++ DACL_REFV_OFF | DACR_REFV_OFF }, ++ { HPOUT_POP_CTRL, HPOUTR_POP_MASK | HPOUTL_POP_MASK, ++ HPOUTR_POP_XCHARGE | HPOUTL_POP_XCHARGE }, ++ { DAC_PWR_CTRL, DACL_PATH_REFV_MASK | DACR_PATH_REFV_MASK, ++ DACL_PATH_REFV_OFF | DACR_PATH_REFV_OFF }, ++ { DAC_PWR_CTRL, DAC_PWR_MASK, DAC_PWR_OFF }, ++ { HPMIX_CTRL, HPMIXL_INIT_MASK | HPMIXR_INIT_MASK, ++ HPMIXL_INIT_DIS | HPMIXR_INIT_DIS }, ++ { DAC_CLK_CTRL, DACL_INIT_MASK | DACR_INIT_MASK, ++ DACL_INIT_OFF | DACR_INIT_OFF }, ++}; ++ ++#define PLAYBACK_CLOSE_LIST_LEN ARRAY_SIZE(playback_close_list) ++ ++static int rk3228_codec_close_playback(struct snd_soc_component *component) ++{ ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ int i = 0; ++ ++ rk3228_analog_output(rk3228, 0); ++ ++ regmap_update_bits(rk3228->regmap, HPOUTL_GAIN_CTRL, ++ HPOUTL_GAIN_MASK, 0); ++ regmap_update_bits(rk3228->regmap, HPOUTR_GAIN_CTRL, ++ HPOUTR_GAIN_MASK, 0); ++ ++ for (i = 0; i < PLAYBACK_CLOSE_LIST_LEN; i++) { ++ regmap_update_bits(rk3228->regmap, ++ playback_close_list[i].reg, ++ playback_close_list[i].msk, ++ playback_close_list[i].val); ++ mdelay(1); ++ } ++ ++ regmap_update_bits(rk3228->regmap, DAC_PRECHARGE_CTRL, ++ DAC_CHARGE_CURRENT_ALL_MASK, ++ DAC_CHARGE_CURRENT_I); ++ return 0; ++} ++ ++static int rk3228_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ struct rk3228_codec_priv *rk3228 = snd_soc_component_get_drvdata(component); ++ unsigned int val = 0; ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ val |= DAC_VDL_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ val |= DAC_VDL_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ val |= DAC_VDL_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ val |= DAC_VDL_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL2, DAC_VDL_MASK, val); ++ val = DAC_WL_32BITS | DAC_RST_DIS; ++ regmap_update_bits(rk3228->regmap, DAC_INIT_CTRL3, ++ DAC_WL_MASK | DAC_RST_MASK, val); ++ ++ return 0; ++} ++ ++static int rk3228_pcm_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ ++ return rk3228_codec_open_playback(component); ++} ++ ++static void rk3228_pcm_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_component *component = dai->component; ++ ++ rk3228_codec_close_playback(component); ++} ++ ++static struct snd_soc_dai_ops rk3228_dai_ops = { ++ .hw_params = rk3228_hw_params, ++ .set_fmt = rk3228_set_dai_fmt, ++ .mute_stream = rk3228_mute_stream, ++ .startup = rk3228_pcm_startup, ++ .shutdown = rk3228_pcm_shutdown, ++}; ++ ++static struct snd_soc_dai_driver rk3228_dai[] = { ++ { ++ .name = "rk3228-hifi", ++ .id = RK3228_HIFI, ++ .playback = { ++ .stream_name = "HIFI Playback", ++ .channels_min = 1, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ /*.capture = { ++ .stream_name = "HIFI Capture", ++ .channels_min = 2, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ },*/ ++ .ops = &rk3228_dai_ops, ++ }, ++}; ++ ++static int rk3228_codec_probe(struct snd_soc_component *component) ++{ ++ rk3228_codec_reset(component); ++ rk3228_codec_power_on(component, 0); ++ ++ return 0; ++} ++ ++static void rk3228_codec_remove(struct snd_soc_component *component) ++{ ++ rk3228_codec_close_playback(component); ++ rk3228_codec_power_off(component, 0); ++} ++ ++static struct snd_soc_component_driver soc_codec_dev_rk3228 = { ++ .probe = rk3228_codec_probe, ++ .remove = rk3228_codec_remove, ++}; ++ ++static bool rk3228_codec_write_read_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case CODEC_RESET: ++ case DAC_INIT_CTRL1: ++ case DAC_INIT_CTRL2: ++ case DAC_INIT_CTRL3: ++ case DAC_PRECHARGE_CTRL: ++ case DAC_PWR_CTRL: ++ case DAC_CLK_CTRL: ++ case HPMIX_CTRL: ++ case DAC_SELECT: ++ case HPOUT_CTRL: ++ case HPOUTL_GAIN_CTRL: ++ case HPOUTR_GAIN_CTRL: ++ case HPOUT_POP_CTRL: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static bool rk3228_codec_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case CODEC_RESET: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static const struct regmap_config rk3228_codec_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = HPOUT_POP_CTRL, ++ .writeable_reg = rk3228_codec_write_read_reg, ++ .readable_reg = rk3228_codec_write_read_reg, ++ .volatile_reg = rk3228_codec_volatile_reg, ++ .reg_defaults = rk3228_codec_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(rk3228_codec_reg_defaults), ++ .cache_type = REGCACHE_FLAT, ++}; ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rk3228codec_of_match[] = { ++ { .compatible = "rockchip,rk3228-codec", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rk3228codec_of_match); ++#endif ++ ++static int rk3228_platform_probe(struct platform_device *pdev) ++{ ++ struct device_node *rk3228_np = pdev->dev.of_node; ++ struct rk3228_codec_priv *rk3228; ++ struct resource *res; ++ void __iomem *base; ++ int ret = 0; ++ ++ rk3228 = devm_kzalloc(&pdev->dev, sizeof(*rk3228), GFP_KERNEL); ++ if (!rk3228) ++ return -ENOMEM; ++ ++ rk3228->mclk = devm_clk_get(&pdev->dev, "mclk"); ++ if (PTR_ERR(rk3228->mclk) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ ++ rk3228->pclk = devm_clk_get(&pdev->dev, "pclk"); ++ if (IS_ERR(rk3228->pclk)) ++ return PTR_ERR(rk3228->pclk); ++ ++ rk3228->sclk = devm_clk_get(&pdev->dev, "sclk"); ++ if (IS_ERR(rk3228->sclk)) ++ return PTR_ERR(rk3228->sclk); ++ ++ rk3228->spk_en_gpio = devm_gpiod_get_optional(&pdev->dev, ++ "spk-en", ++ GPIOD_OUT_LOW); ++ if (IS_ERR(rk3228->spk_en_gpio)) ++ return PTR_ERR(rk3228->spk_en_gpio); ++ ++ ret = of_property_read_u32(rk3228_np, "spk-depop-time-ms", ++ &rk3228->spk_depop_time); ++ if (ret < 0) { ++ dev_info(&pdev->dev, "spk_depop_time use default value.\n"); ++ rk3228->spk_depop_time = 100; ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); ++ ++ ret = clk_prepare_enable(rk3228->mclk); ++ if (ret) ++ return ret; ++ ++ ret = clk_prepare_enable(rk3228->pclk); ++ if (ret < 0) ++ goto err_pclk; ++ ++ ret = clk_prepare_enable(rk3228->sclk); ++ if (ret) ++ goto err_sclk; ++ ++ clk_set_rate(rk3228->sclk, INITIAL_FREQ); ++ ++ rk3228->regmap = devm_regmap_init_mmio(&pdev->dev, base, ++ &rk3228_codec_regmap_config); ++ if (IS_ERR(rk3228->regmap)) { ++ ret = PTR_ERR(rk3228->regmap); ++ goto err_clk; ++ } ++ ++ platform_set_drvdata(pdev, rk3228); ++ ++ ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk3228, ++ rk3228_dai, ARRAY_SIZE(rk3228_dai)); ++ if (!ret) ++ return 0; ++ ++err_clk: ++ clk_disable_unprepare(rk3228->sclk); ++err_sclk: ++ clk_disable_unprepare(rk3228->pclk); ++err_pclk: ++ clk_disable_unprepare(rk3228->mclk); ++ ++ return ret; ++} ++ ++static int rk3228_platform_remove(struct platform_device *pdev) ++{ ++ struct rk3228_codec_priv *rk3228 = platform_get_drvdata(pdev); ++ ++ if (!IS_ERR(rk3228->mclk)) ++ clk_disable_unprepare(rk3228->mclk); ++ ++ if (!IS_ERR(rk3228->pclk)) ++ clk_disable_unprepare(rk3228->pclk); ++ ++ if (!IS_ERR(rk3228->sclk)) ++ clk_disable_unprepare(rk3228->sclk); ++ ++ return 0; ++} ++ ++static struct platform_driver rk3228_codec_driver = { ++ .driver = { ++ .name = "rk3228-codec", ++ .of_match_table = of_match_ptr(rk3228codec_of_match), ++ }, ++ .probe = rk3228_platform_probe, ++ .remove = rk3228_platform_remove, ++}; ++module_platform_driver(rk3228_codec_driver); ++ ++MODULE_AUTHOR("Sugar Zhang "); ++MODULE_DESCRIPTION("ASoC rk3228 codec driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/rk3228_codec.h b/sound/soc/codecs/rk3228_codec.h +new file mode 100644 +index 000000000000..7283d0ba86e8 +--- /dev/null ++++ b/sound/soc/codecs/rk3228_codec.h +@@ -0,0 +1,218 @@ ++/* ++ * rk3228_codec.h -- rk3228 ALSA Soc Audio driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef _RK3228_CODEC_H ++#define _RK3228_CODEC_H ++ ++/* codec register */ ++#define CODEC_RESET (0x00 << 2) ++#define DAC_INIT_CTRL1 (0x03 << 2) ++#define DAC_INIT_CTRL2 (0x04 << 2) ++#define DAC_INIT_CTRL3 (0x05 << 2) ++#define DAC_PRECHARGE_CTRL (0x22 << 2) ++#define DAC_PWR_CTRL (0x23 << 2) ++#define DAC_CLK_CTRL (0x24 << 2) ++#define HPMIX_CTRL (0x25 << 2) ++#define DAC_SELECT (0x26 << 2) ++#define HPOUT_CTRL (0x27 << 2) ++#define HPOUTL_GAIN_CTRL (0x28 << 2) ++#define HPOUTR_GAIN_CTRL (0x29 << 2) ++#define HPOUT_POP_CTRL (0x2a << 2) ++ ++/* REG00: CODEC_RESET */ ++#define PWR_RST_BYPASS_DIS BIT(6) ++#define PWR_RST_BYPASS_EN BIT(6) ++#define DIG_CORE_RST (0 << 1) ++#define DIG_CORE_WORK BIT(1) ++#define SYS_RST (0) ++#define SYS_WORK BIT(0) ++ ++/* REG03: DAC_INIT_CTRL1 */ ++#define PIN_DIRECTION_MASK BIT(5) ++#define PIN_DIRECTION_IN (0 << 5) ++#define PIN_DIRECTION_OUT BIT(5) ++#define DAC_I2S_MODE_MASK BIT(4) ++#define DAC_I2S_MODE_SLAVE (0 << 4) ++#define DAC_I2S_MODE_MASTER BIT(4) ++ ++/* REG04: DAC_INIT_CTRL2 */ ++#define DAC_I2S_LRP_MASK BIT(7) ++#define DAC_I2S_LRP_NORMAL (0 << 7) ++#define DAC_I2S_LRP_REVERSAL BIT(7) ++#define DAC_VDL_MASK (3 << 5) ++#define DAC_VDL_16BITS (0 << 5) ++#define DAC_VDL_20BITS BIT(5) ++#define DAC_VDL_24BITS (2 << 5) ++#define DAC_VDL_32BITS (3 << 5) ++#define DAC_MODE_MASK (3 << 3) ++#define DAC_MODE_RJM (0 << 3) ++#define DAC_MODE_LJM BIT(3) ++#define DAC_MODE_I2S (2 << 3) ++#define DAC_MODE_PCM (3 << 3) ++#define DAC_LR_SWAP_MASK BIT(2) ++#define DAC_LR_SWAP_DIS (0 << 2) ++#define DAC_LR_SWAP_EN BIT(2) ++ ++/* REG05: DAC_INIT_CTRL3 */ ++#define DAC_WL_MASK (3 << 2) ++#define DAC_WL_16BITS (0 << 2) ++#define DAC_WL_20BITS BIT(2) ++#define DAC_WL_24BITS (2 << 2) ++#define DAC_WL_32BITS (3 << 2) ++#define DAC_RST_MASK BIT(1) ++#define DAC_RST_EN (0 << 1) ++#define DAC_RST_DIS BIT(1) ++#define DAC_BCP_MASK BIT(0) ++#define DAC_BCP_NORMAL (0 << 0) ++#define DAC_BCP_REVERSAL BIT(0) ++ ++/* REG22: DAC_PRECHARGE_CTRL */ ++#define DAC_CHARGE_PRECHARGE BIT(7) ++#define DAC_CHARGE_DISCHARGE (0 << 7) ++#define DAC_CHARGE_XCHARGE_MASK BIT(7) ++#define DAC_CHARGE_CURRENT_64I BIT(6) ++#define DAC_CHARGE_CURRENT_64I_MASK BIT(6) ++#define DAC_CHARGE_CURRENT_32I BIT(5) ++#define DAC_CHARGE_CURRENT_32I_MASK BIT(5) ++#define DAC_CHARGE_CURRENT_16I BIT(4) ++#define DAC_CHARGE_CURRENT_16I_MASK BIT(4) ++#define DAC_CHARGE_CURRENT_08I BIT(3) ++#define DAC_CHARGE_CURRENT_08I_MASK BIT(3) ++#define DAC_CHARGE_CURRENT_04I BIT(2) ++#define DAC_CHARGE_CURRENT_04I_MASK BIT(2) ++#define DAC_CHARGE_CURRENT_02I BIT(1) ++#define DAC_CHARGE_CURRENT_02I_MASK BIT(1) ++#define DAC_CHARGE_CURRENT_I BIT(0) ++#define DAC_CHARGE_CURRENT_I_MASK BIT(0) ++#define DAC_CHARGE_CURRENT_ALL_MASK (0x7f) ++#define DAC_CHARGE_CURRENT_ALL_OFF (0x0) ++#define DAC_CHARGE_CURRENT_ALL_ON (0x7f) ++ ++/* REG23: DAC_PWR_CTRL */ ++#define DAC_PWR_OFF (0 << 6) ++#define DAC_PWR_ON BIT(6) ++#define DAC_PWR_MASK BIT(6) ++#define DACL_PATH_REFV_OFF (0 << 5) ++#define DACL_PATH_REFV_ON BIT(5) ++#define DACL_PATH_REFV_MASK BIT(5) ++#define HPOUTL_ZERO_CROSSING_OFF (0 << 4) ++#define HPOUTL_ZERO_CROSSING_ON BIT(4) ++#define DACR_PATH_REFV_OFF (0 << 1) ++#define DACR_PATH_REFV_ON BIT(1) ++#define DACR_PATH_REFV_MASK BIT(1) ++#define HPOUTR_ZERO_CROSSING_OFF (0 << 0) ++#define HPOUTR_ZERO_CROSSING_ON BIT(0) ++ ++/* REG24: DAC_CLK_CTRL */ ++#define DACL_REFV_OFF (0 << 7) ++#define DACL_REFV_ON BIT(7) ++#define DACL_REFV_MASK BIT(7) ++#define DACL_CLK_OFF (0 << 6) ++#define DACL_CLK_ON BIT(6) ++#define DACL_CLK_MASK BIT(6) ++#define DACL_OFF (0 << 5) ++#define DACL_ON BIT(5) ++#define DACL_MASK BIT(5) ++#define DACL_INIT_OFF (0 << 4) ++#define DACL_INIT_ON BIT(4) ++#define DACL_INIT_MASK BIT(4) ++#define DACR_REFV_OFF (0 << 3) ++#define DACR_REFV_ON BIT(3) ++#define DACR_REFV_MASK BIT(3) ++#define DACR_CLK_OFF (0 << 2) ++#define DACR_CLK_ON BIT(2) ++#define DACR_CLK_MASK BIT(2) ++#define DACR_OFF (0 << 1) ++#define DACR_ON BIT(1) ++#define DACR_MASK BIT(1) ++#define DACR_INIT_OFF (0 << 0) ++#define DACR_INIT_ON BIT(0) ++#define DACR_INIT_MASK BIT(0) ++ ++/* REG25: HPMIX_CTRL*/ ++#define HPMIXL_DIS (0 << 6) ++#define HPMIXL_EN BIT(6) ++#define HPMIXL_MASK BIT(6) ++#define HPMIXL_INIT_DIS (0 << 5) ++#define HPMIXL_INIT_EN BIT(5) ++#define HPMIXL_INIT_MASK BIT(5) ++#define HPMIXL_INIT2_DIS (0 << 4) ++#define HPMIXL_INIT2_EN BIT(4) ++#define HPMIXL_INIT2_MASK BIT(4) ++#define HPMIXR_DIS (0 << 2) ++#define HPMIXR_EN BIT(2) ++#define HPMIXR_MASK BIT(2) ++#define HPMIXR_INIT_DIS (0 << 1) ++#define HPMIXR_INIT_EN BIT(1) ++#define HPMIXR_INIT_MASK BIT(1) ++#define HPMIXR_INIT2_DIS (0 << 0) ++#define HPMIXR_INIT2_EN BIT(0) ++#define HPMIXR_INIT2_MASK BIT(0) ++ ++/* REG26: DAC_SELECT */ ++#define DACL_SELECT BIT(4) ++#define DACL_SELECT_MASK BIT(4) ++#define DACL_DESELECT (0 << 4) ++#define DACR_SELECT BIT(0) ++#define DACR_SELECT_MASK BIT(0) ++#define DACR_DESELECT (0 << 0) ++ ++/* REG27: HPOUT_CTRL */ ++#define HPOUTL_DIS (0 << 7) ++#define HPOUTL_EN BIT(7) ++#define HPOUTL_MASK BIT(7) ++#define HPOUTL_INIT_DIS (0 << 6) ++#define HPOUTL_INIT_EN BIT(6) ++#define HPOUTL_INIT_MASK BIT(6) ++#define HPOUTL_MUTE (0 << 5) ++#define HPOUTL_UNMUTE BIT(5) ++#define HPOUTL_MUTE_MASK BIT(5) ++#define HPOUTR_DIS (0 << 4) ++#define HPOUTR_EN BIT(4) ++#define HPOUTR_MASK BIT(4) ++#define HPOUTR_INIT_DIS (0 << 3) ++#define HPOUTR_INIT_EN BIT(3) ++#define HPOUTR_INIT_MASK BIT(3) ++#define HPOUTR_MUTE (0 << 2) ++#define HPOUTR_UNMUTE BIT(2) ++#define HPOUTR_MUTE_MASK BIT(2) ++ ++/* REG28: HPOUTL_GAIN_CTRL */ ++#define HPOUTL_GAIN_MASK (0X1f << 0) ++ ++/* REG29: HPOUTR_GAIN_CTRL */ ++#define HPOUTR_GAIN_MASK (0X1f << 0) ++ ++/* REG2a: HPOUT_POP_CTRL */ ++#define HPOUTR_POP_XCHARGE BIT(4) ++#define HPOUTR_POP_WORK (2 << 4) ++#define HPOUTR_POP_MASK (3 << 4) ++#define HPOUTL_POP_XCHARGE BIT(0) ++#define HPOUTL_POP_WORK (2 << 0) ++#define HPOUTL_POP_MASK (3 << 0) ++ ++#define RK3228_HIFI (0) ++ ++struct rk3228_reg_msk_val { ++ unsigned int reg; ++ unsigned int msk; ++ unsigned int val; ++}; ++ ++#endif +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk3288-gpiomem.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk3288-gpiomem.patch new file mode 100644 index 000000000000..b0ab1b22ad9d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-rk3288-gpiomem.patch @@ -0,0 +1,395 @@ +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +index e5b7ef1a5..f88c913ff 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +@@ -544,3 +544,6 @@ + &wdt { + status = "okay"; + }; ++&gpiomem { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index f3ca55496..14bbcb192 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -1418,6 +1418,12 @@ + interrupts = ; + }; + ++ gpiomem: rk3288-gpiomem@ff750000 { ++ compatible = "rockchip,rk3288-gpiomem"; ++ reg = <0x0 0xff750000 0x0 0x1000>; ++ status = "disabled"; ++ }; ++ + pinctrl: pinctrl { + compatible = "rockchip,rk3288-pinctrl"; + rockchip,grf = <&grf>; + +diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig +index 3143db5..9c18b74 100644 +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig +@@ -5,6 +5,7 @@ + menu "Character devices" + + source "drivers/tty/Kconfig" ++source "drivers/char/rockchip/Kconfig" + + config DEVMEM + bool "/dev/mem virtual device support" +diff --git a/drivers/char/Makefile b/drivers/char/Makefile +index 264eb398f..9fd5f240b 100644 +--- a/drivers/char/Makefile ++++ b/drivers/char/Makefile +@@ -43,6 +43,8 @@ obj-$(CONFIG_TCG_TPM) += tpm/ + + obj-$(CONFIG_PS3_FLASH) += ps3flash.o + ++obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ ++ + obj-$(CONFIG_XILLYBUS_CLASS) += xillybus/ + obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o + obj-$(CONFIG_ADI) += adi.o +diff --git a/drivers/char/rockchip/Kconfig b/drivers/char/rockchip/Kconfig +new file mode 100644 +index 0000000..6e97486 +--- /dev/null ++++ b/drivers/char/rockchip/Kconfig +@@ -0,0 +1,16 @@ ++# ++# Broadcom char driver config ++# ++ ++menuconfig RK_CHAR_DRIVERS ++ bool "Rockchip Char Drivers" ++ help ++ Rockchip's char drivers ++ ++config RK3288_DEVGPIOMEM ++ tristate "/dev/gpiomem rootless GPIO access via mmap() on the RK3288" ++ default y ++ help ++ Provides users with root-free access to the GPIO registers ++ on the 3288. Calling mmap(/dev/gpiomem) will map the GPIO ++ register page to the user's pointer. +\ No newline at end of file +diff --git a/drivers/char/rockchip/Makefile b/drivers/char/rockchip/Makefile +new file mode 100644 +index 0000000..2287ec2 +--- /dev/null ++++ b/drivers/char/rockchip/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_RK3288_DEVGPIOMEM)+= rk3288-gpiomem.o +\ No newline at end of file +diff --git a/drivers/char/rockchip/rk3288-gpiomem.c b/drivers/char/rockchip/rk3288-gpiomem.c +new file mode 100644 +index 0000000..984471c +--- /dev/null ++++ b/drivers/char/rockchip/rk3288-gpiomem.c +@@ -0,0 +1,303 @@ ++/** ++ * GPIO memory device driver ++ * ++ * Creates a chardev /dev/gpiomem which will provide user access to ++ * the rk3288's GPIO registers when it is mmap()'d. ++ * No longer need root for user GPIO access, but without relaxing permissions ++ * on /dev/mem. ++ * ++ * Written by Luke Wren ++ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions, and the following disclaimer, ++ * without modification. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS ++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DEVICE_NAME "rk3288-gpiomem" ++#define DRIVER_NAME "gpiomem-rk3288" ++#define DEVICE_MINOR 0 ++ ++struct rk3288_gpiomem_instance { ++ unsigned long gpio_regs_phys; ++ struct device *dev; ++}; ++ ++static struct cdev rk3288_gpiomem_cdev; ++static dev_t rk3288_gpiomem_devid; ++static struct class *rk3288_gpiomem_class; ++static struct device *rk3288_gpiomem_dev; ++static struct rk3288_gpiomem_instance *inst; ++ ++ ++/**************************************************************************** ++* ++* GPIO mem chardev file ops ++* ++***************************************************************************/ ++ ++static int rk3288_gpiomem_open(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ int ret = 0; ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, "Unknown minor device: %d", dev); ++ ret = -ENXIO; ++ } ++ return ret; ++} ++ ++static int rk3288_gpiomem_release(struct inode *inode, struct file *file) ++{ ++ int dev = iminor(inode); ++ int ret = 0; ++ ++ if (dev != DEVICE_MINOR) { ++ dev_err(inst->dev, "Unknown minor device %d", dev); ++ ret = -ENXIO; ++ } ++ return ret; ++} ++ ++static const struct vm_operations_struct rk3288_gpiomem_vm_ops = { ++#ifdef CONFIG_HAVE_IOREMAP_PROT ++ .access = generic_access_phys ++#endif ++}; ++static int address_is_allowed(unsigned long pfn, unsigned long size) ++{ ++ unsigned long address = pfn << PAGE_SHIFT; ++ ++ dev_info(inst->dev, "address_is_allowed.pfn: 0x%08lx", address); ++ ++ switch(address) { ++ ++ case 0xff750000: ++ case 0xff760000: ++ case 0xff780000: ++ case 0xff790000: ++ case 0xff7a0000: ++ case 0xff7b0000: ++ case 0xff7c0000: ++ case 0xff7d0000: ++ case 0xff7e0000: ++ case 0xff7f0000: ++ case 0xff7f2000: ++ case 0xff770000: ++ case 0xff730000: ++ case 0xff680000: ++ dev_info(inst->dev, "address_is_allowed.return 1"); ++ return 1; ++ break; ++ default : ++ dev_info(inst->dev, "address_is_allowed.return 0"); ++ return 0; ++ } ++} ++ ++static int rk3288_gpiomem_mmap(struct file *file, struct vm_area_struct *vma) ++{ ++ ++ size_t size; ++ ++ size = vma->vm_end - vma->vm_start; ++ ++ ++ if (!address_is_allowed(vma->vm_pgoff, size)) ++ return -EPERM; ++ ++ vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, ++ size, ++ vma->vm_page_prot); ++ ++ vma->vm_ops = &rk3288_gpiomem_vm_ops; ++ ++ /* Remap-pfn-range will mark the range VM_IO */ ++ if (remap_pfn_range(vma, ++ vma->vm_start, ++ vma->vm_pgoff, ++ size, ++ vma->vm_page_prot)) { ++ return -EAGAIN; ++ } ++ ++ return 0; ++} ++ ++static const struct file_operations ++rk3288_gpiomem_fops = { ++ .owner = THIS_MODULE, ++ .open = rk3288_gpiomem_open, ++ .release = rk3288_gpiomem_release, ++ .mmap = rk3288_gpiomem_mmap, ++}; ++ ++static int rk3288_gpiomem_dev_uevent(const struct device *dev, struct kobj_uevent_env *env) ++{ ++ add_uevent_var(env, "DEVMODE=%#o", 0666); ++ return 0; ++} ++ ++ /**************************************************************************** ++* ++* Probe and remove functions ++* ++***************************************************************************/ ++ ++ ++static int rk3288_gpiomem_probe(struct platform_device *pdev) ++{ ++ int err; ++ void *ptr_err; ++ struct device *dev = &pdev->dev; ++ struct resource *ioresource; ++ ++ /* Allocate buffers and instance data */ ++ ++ inst = kzalloc(sizeof(struct rk3288_gpiomem_instance), GFP_KERNEL); ++ ++ if (!inst) { ++ err = -ENOMEM; ++ goto failed_inst_alloc; ++ } ++ ++ inst->dev = dev; ++ ++ ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (ioresource) { ++ inst->gpio_regs_phys = ioresource->start; ++ } else { ++ dev_err(inst->dev, "failed to get IO resource"); ++ err = -ENOENT; ++ goto failed_get_resource; ++ } ++ ++ /* Create character device entries */ ++ ++ err = alloc_chrdev_region(&rk3288_gpiomem_devid, ++ DEVICE_MINOR, 1, DEVICE_NAME); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to allocate device number"); ++ goto failed_alloc_chrdev; ++ } ++ cdev_init(&rk3288_gpiomem_cdev, &rk3288_gpiomem_fops); ++ rk3288_gpiomem_cdev.owner = THIS_MODULE; ++ err = cdev_add(&rk3288_gpiomem_cdev, rk3288_gpiomem_devid, 1); ++ if (err != 0) { ++ dev_err(inst->dev, "unable to register device"); ++ goto failed_cdev_add; ++ } ++ ++ /* Create sysfs entries */ ++ ++ rk3288_gpiomem_class = class_create(DEVICE_NAME); ++ ptr_err = rk3288_gpiomem_class; ++ if (IS_ERR(ptr_err)) ++ goto failed_class_create; ++ rk3288_gpiomem_class->dev_uevent = rk3288_gpiomem_dev_uevent; ++ rk3288_gpiomem_dev = device_create(rk3288_gpiomem_class, NULL, ++ rk3288_gpiomem_devid, NULL, ++ "gpiomem"); ++ ptr_err = rk3288_gpiomem_dev; ++ if (IS_ERR(ptr_err)) ++ goto failed_device_create; ++ ++ dev_info(inst->dev, "Initialised: Registers at 0x%08lx", ++ inst->gpio_regs_phys); ++ ++ return 0; ++ ++failed_device_create: ++ class_destroy(rk3288_gpiomem_class); ++failed_class_create: ++ cdev_del(&rk3288_gpiomem_cdev); ++ err = PTR_ERR(ptr_err); ++failed_cdev_add: ++ unregister_chrdev_region(rk3288_gpiomem_devid, 1); ++failed_alloc_chrdev: ++failed_get_resource: ++ kfree(inst); ++failed_inst_alloc: ++ dev_err(inst->dev, "could not load rk3288_gpiomem"); ++ return err; ++} ++ ++static int rk3288_gpiomem_remove(struct platform_device *pdev) ++{ ++ struct device *dev = inst->dev; ++ ++ kfree(inst); ++ device_destroy(rk3288_gpiomem_class, rk3288_gpiomem_devid); ++ class_destroy(rk3288_gpiomem_class); ++ cdev_del(&rk3288_gpiomem_cdev); ++ unregister_chrdev_region(rk3288_gpiomem_devid, 1); ++ ++ dev_info(dev, "GPIO mem driver removed - OK"); ++ return 0; ++} ++ ++ /**************************************************************************** ++* ++* Register the driver with device tree ++* ++***************************************************************************/ ++ ++static const struct of_device_id rk3288_gpiomem_of_match[] = { ++ {.compatible = "rockchip,rk3288-gpiomem",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, rk3288_gpiomem_of_match); ++ ++static struct platform_driver rk3288_gpiomem_driver = { ++ .probe = rk3288_gpiomem_probe, ++ .remove = rk3288_gpiomem_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = rk3288_gpiomem_of_match, ++ }, ++}; ++ ++module_platform_driver(rk3288_gpiomem_driver); ++ ++MODULE_ALIAS("platform:gpiomem-rk3288"); ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); ++MODULE_AUTHOR("Luke Wren "); +\ No newline at end of file diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-tinkerboard-alc4040-codec.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-tinkerboard-alc4040-codec.patch new file mode 100644 index 000000000000..f85f24fb7adc --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/driver-tinkerboard-alc4040-codec.patch @@ -0,0 +1,19 @@ +diff --git a/sound/usb/card.c b/sound/usb/card.c +index 2bfe4e80a..cea93aaf5 100644 +--- a/sound/usb/card.c ++++ b/sound/usb/card.c +@@ -382,6 +382,14 @@ static void usb_audio_make_shortname(struct usb_device *dev, + } + + strim(card->shortname); ++ ++ /* Tinker Board ALC4040 CODEC */ ++ ++ if(USB_ID_VENDOR(chip->usb_id) == 0x0bda && ++ USB_ID_PRODUCT(chip->usb_id) == 0x481a) { ++ strlcat(card->shortname, " OnBoard", sizeof(card->shortname)); ++ } ++ + } + + static void usb_audio_make_longname(struct usb_device *dev, diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-plane-overlay.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-plane-overlay.patch new file mode 100644 index 000000000000..15319a894f38 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-plane-overlay.patch @@ -0,0 +1,66 @@ +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index 73d24c6bbf05..d4ac6e161ef2 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -614,6 +614,44 @@ static const struct vop_common rk3288_common = { + .dsp_background = VOP_REG(RK3288_DSP_BG, 0xffffffff, 0), + }; + ++static const struct vop_win_phy rk3228_win0_data = { ++ .scl = &rk3288_win_full_scl, ++ .data_formats = formats_win_full, ++ .nformats = ARRAY_SIZE(formats_win_full), ++ .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0), ++ .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), ++ .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), ++ .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), ++ .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0), ++ .dsp_st = VOP_REG(RK3288_WIN0_DSP_ST, 0x1fff1fff, 0), ++ .yrgb_mst = VOP_REG(RK3288_WIN0_YRGB_MST, 0xffffffff, 0), ++ .uv_mst = VOP_REG(RK3288_WIN0_CBR_MST, 0xffffffff, 0), ++ .yrgb_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 0), ++ .uv_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16), ++ .src_alpha_ctl = VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0), ++ .dst_alpha_ctl = VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0), ++ .channel = VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0), ++}; ++ ++static const struct vop_win_phy rk3228_win1_data = { ++ .scl = &rk3288_win_full_scl, ++ .data_formats = formats_win_lite, ++ .nformats = ARRAY_SIZE(formats_win_lite), ++ .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0), ++ .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), ++ .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), ++ .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), ++ .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0), ++ .dsp_st = VOP_REG(RK3288_WIN0_DSP_ST, 0x1fff1fff, 0), ++ .yrgb_mst = VOP_REG(RK3288_WIN0_YRGB_MST, 0xffffffff, 0), ++ .uv_mst = VOP_REG(RK3288_WIN0_CBR_MST, 0xffffffff, 0), ++ .yrgb_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 0), ++ .uv_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16), ++ .src_alpha_ctl = VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0), ++ .dst_alpha_ctl = VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0), ++ .channel = VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0), ++}; ++ + /* + * Note: rk3288 has a dedicated 'cursor' window, however, that window requires + * special support to get alpha blending working. For now, just use overlay +@@ -864,10 +902,10 @@ static const struct vop_data rk3399_vop_lit = { + }; + + static const struct vop_win_data rk3228_vop_win_data[] = { +- { .base = 0x00, .phy = &rk3288_win01_data, ++ { .base = 0x00, .phy = &rk3228_win0_data, + .type = DRM_PLANE_TYPE_PRIMARY }, +- { .base = 0x40, .phy = &rk3288_win01_data, +- .type = DRM_PLANE_TYPE_CURSOR }, ++ { .base = 0x40, .phy = &rk3228_win1_data, ++ .type = DRM_PLANE_TYPE_OVERLAY }, + }; + + static const struct vop_data rk3228_vop = { +-- +2.17.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-yuv-10bit-modes.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-yuv-10bit-modes.patch new file mode 100644 index 000000000000..acd738f00d04 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rk322x-yuv-10bit-modes.patch @@ -0,0 +1,44 @@ +From 2d42546642fa4299d88fa4ae414fa1ab205dad70 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 11 Sep 2021 17:38:48 +0000 +Subject: [PATCH] rk322x: enable YUV modes for win1, 10-bit for win0/win1 + +--- + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index 70930b410..3fd00b323 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -719,10 +719,11 @@ static const struct vop_common rk3288_common = { + + static const struct vop_win_phy rk3228_win0_data = { + .scl = &rk3288_win_full_scl, +- .data_formats = formats_win_full, +- .nformats = ARRAY_SIZE(formats_win_full), ++ .data_formats = formats_win_full_10, ++ .nformats = ARRAY_SIZE(formats_win_full_10), + .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0), + .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), ++ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4), + .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), + .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), + .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0), +@@ -738,10 +739,11 @@ static const struct vop_win_phy rk3228_win0_data = { + + static const struct vop_win_phy rk3228_win1_data = { + .scl = &rk3288_win_full_scl, +- .data_formats = formats_win_lite, +- .nformats = ARRAY_SIZE(formats_win_lite), ++ .data_formats = formats_win_full_10, ++ .nformats = ARRAY_SIZE(formats_win_full_10), + .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0), + .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), ++ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4), + .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), + .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), + .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0), +-- +2.25.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rockchip-hardware-cursor.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rockchip-hardware-cursor.patch new file mode 100644 index 000000000000..863a70aaa42e --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/drm-rockchip-hardware-cursor.patch @@ -0,0 +1,358 @@ +From ff9a0ab9d920d4a855b4be9912a57ac65e8906e2 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Fri, 10 Sep 2021 14:10:18 +0000 +Subject: [PATCH] drm rockchip hardware cursor + +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 218 +++++++++++++++++++- + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 3 + + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 19 +- + 3 files changed, 238 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 83a926c0a..b0832320e 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1160,6 +1160,207 @@ static void vop_plane_atomic_async_update(struct drm_plane *plane, + } + } + ++static void vop_cursor_atomic_update(struct drm_plane *plane, ++ struct drm_atomic_state *state) ++{ ++ ++ struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, ++ plane); ++ struct drm_crtc *crtc = new_state->crtc; ++ struct vop_win *vop_win = to_vop_win(plane); ++ const struct vop_win_data *win = vop_win->data; ++ struct vop *vop = to_vop(new_state->crtc); ++ struct drm_framebuffer *fb = new_state->fb; ++ unsigned int actual_w, actual_h; ++ unsigned int dsp_stx, dsp_sty; ++ uint32_t dsp_st; ++ struct drm_rect *src = &new_state->src; ++ struct drm_rect *dest = &new_state->dst; ++ struct drm_gem_object *obj; ++ struct rockchip_gem_object *rk_obj; ++ dma_addr_t dma_addr; ++ uint32_t val; ++ bool rb_swap; ++ int win_index = VOP_WIN_TO_INDEX(vop_win); ++ int format; ++ ++ /* ++ * can't update plane when vop is disabled. ++ */ ++ if (WARN_ON(!crtc)) ++ return; ++ ++ if (WARN_ON(!vop->is_enabled)) ++ return; ++ ++ if (!new_state->visible) { ++ vop_plane_atomic_disable(plane, state); ++ return; ++ } ++ ++ obj = fb->obj[0]; ++ rk_obj = to_rockchip_obj(obj); ++ ++// actual_w = drm_rect_width(src) >> 16; ++// actual_h = drm_rect_height(src) >> 16; ++ ++ dsp_stx = dest->x1 + crtc->mode.htotal - crtc->mode.hsync_start; ++ dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start; ++ dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff); ++ ++ dma_addr = rk_obj->dma_addr; ++ ++ /* ++ * For y-mirroring we need to move address ++ * to the beginning of the last line. ++ */ ++// if (new_state->rotation & DRM_MODE_REFLECT_Y) ++// dma_addr += (actual_h - 1) * fb->pitches[0]; ++ ++ spin_lock(&vop->reg_lock); ++ ++ if (!(vop->win_enabled & BIT(win_index))) { ++ ++ format = vop_convert_format(fb->format->format); ++ ++ VOP_WIN_SET(vop, win, format, format); ++ ++// if (win->phy->scl) ++// scl_vop_cal_scl_fac(vop, win, actual_w, actual_h, ++// drm_rect_width(dest), drm_rect_height(dest), ++// fb->format); ++ ++ rb_swap = has_rb_swapped(vop->data->version, fb->format->format); ++ VOP_WIN_SET(vop, win, rb_swap, rb_swap); ++ ++ /* ++ * Blending win0 with the background color doesn't seem to work ++ * correctly. We only get the background color, no matter the contents ++ * of the win0 framebuffer. However, blending pre-multiplied color ++ * with the default opaque black default background color is a no-op, ++ * so we can just disable blending to get the correct result. ++ */ ++ if (fb->format->has_alpha && win_index > 0) { ++ VOP_WIN_SET(vop, win, dst_alpha_ctl, ++ DST_FACTOR_M0(ALPHA_SRC_INVERSE)); ++ val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) | ++ SRC_ALPHA_M0(ALPHA_STRAIGHT) | ++ SRC_BLEND_M0(ALPHA_PER_PIX) | ++ SRC_ALPHA_CAL_M0(ALPHA_NO_SATURATION) | ++ SRC_FACTOR_M0(ALPHA_ONE); ++ VOP_WIN_SET(vop, win, src_alpha_ctl, val); ++ ++ VOP_WIN_SET(vop, win, alpha_pre_mul, ALPHA_SRC_PRE_MUL); ++ VOP_WIN_SET(vop, win, alpha_mode, ALPHA_PER_PIX); ++ VOP_WIN_SET(vop, win, alpha_en, 1); ++ } else { ++ VOP_WIN_SET(vop, win, src_alpha_ctl, SRC_ALPHA_EN(0)); ++ VOP_WIN_SET(vop, win, alpha_en, 0); ++ } ++ ++ // 32x32 = 0, 64x64 = 1, 96x96 = 2, 128x128 = 3 ++ VOP_WIN_SET(vop, win, hwc_size, (new_state->crtc_w >> 5) - 1); ++ ++ VOP_WIN_SET(vop, win, enable, 1); ++ vop->win_enabled |= BIT(win_index); ++ ++ } ++ ++ VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); ++ VOP_WIN_SET(vop, win, dsp_st, dsp_st); ++ ++ spin_unlock(&vop->reg_lock); ++ ++} ++ ++static void vop_cursor_atomic_async_update(struct drm_plane *plane, ++ struct drm_atomic_state *state) ++{ ++ ++ struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, ++ plane); ++ struct vop *vop = to_vop(plane->state->crtc); ++ struct drm_framebuffer *old_fb = plane->state->fb; ++ ++ plane->state->crtc_x = new_state->crtc_x; ++ plane->state->crtc_y = new_state->crtc_y; ++ plane->state->crtc_h = new_state->crtc_h; ++ plane->state->crtc_w = new_state->crtc_w; ++ plane->state->src_x = new_state->src_x; ++ plane->state->src_y = new_state->src_y; ++ plane->state->src_h = new_state->src_h; ++ plane->state->src_w = new_state->src_w; ++ swap(plane->state->fb, new_state->fb); ++ ++ if (vop->is_enabled) { ++ vop_cursor_atomic_update(plane, state); ++ spin_lock(&vop->reg_lock); ++ vop_cfg_done(vop); ++ spin_unlock(&vop->reg_lock); ++ ++ /* ++ * A scanout can still be occurring, so we can't drop the ++ * reference to the old framebuffer. To solve this we get a ++ * reference to old_fb and set a worker to release it later. ++ * FIXME: if we perform 500 async_update calls before the ++ * vblank, then we can have 500 different framebuffers waiting ++ * to be released. ++ */ ++ if (old_fb && plane->state->fb != old_fb) { ++ drm_framebuffer_get(old_fb); ++ WARN_ON(drm_crtc_vblank_get(plane->state->crtc) != 0); ++ drm_flip_work_queue(&vop->fb_unref_work, old_fb); ++ set_bit(VOP_PENDING_FB_UNREF, &vop->pending); ++ } ++ } ++ ++} ++ ++static int vop_cursor_atomic_check(struct drm_plane *plane, ++ struct drm_atomic_state *state) ++{ ++ struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, ++ plane); ++ struct drm_crtc *crtc = new_plane_state->crtc; ++ struct drm_crtc_state *crtc_state; ++ struct drm_framebuffer *fb = new_plane_state->fb; ++ int ret; ++ ++ if (!crtc || WARN_ON(!fb)) ++ return 0; ++ ++ crtc_state = drm_atomic_get_existing_crtc_state(state, crtc); ++ if (WARN_ON(!crtc_state)) ++ return -EINVAL; ++ ++ ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state, ++ DRM_PLANE_NO_SCALING, DRM_PLANE_NO_SCALING, ++ true, true); ++ ++ if (ret) ++ return ret; ++ ++ if (!new_plane_state->visible) ++ return 0; ++ ++ ret = vop_convert_format(fb->format->format); ++ if (ret < 0) ++ return ret; ++ ++ if (new_plane_state->crtc_w != new_plane_state->crtc_h) ++ return -EINVAL; ++ ++ if (new_plane_state->crtc_w != 0 && ++ new_plane_state->crtc_w != 32 && ++ new_plane_state->crtc_w != 64 && ++ new_plane_state->crtc_w != 96 && ++ new_plane_state->crtc_w != 128) ++ return -EINVAL; ++ ++ return 0; ++ ++} ++ + static const struct drm_plane_helper_funcs plane_helper_funcs = { + .atomic_check = vop_plane_atomic_check, + .atomic_update = vop_plane_atomic_update, +@@ -1169,6 +1370,15 @@ static const struct drm_plane_helper_funcs plane_helper_funcs = { + .prepare_fb = drm_gem_plane_helper_prepare_fb, + }; + ++static const struct drm_plane_helper_funcs cursor_plane_helper_funcs = { ++ .atomic_check = vop_cursor_atomic_check, ++ .atomic_update = vop_cursor_atomic_update, ++ .atomic_disable = vop_plane_atomic_disable, ++ .atomic_async_check = vop_plane_atomic_async_check, ++ .atomic_async_update = vop_cursor_atomic_async_update, ++ .prepare_fb = drm_gem_plane_helper_prepare_fb, ++}; ++ + static const struct drm_plane_funcs vop_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, +@@ -1956,6 +2166,7 @@ static int vop_create_crtc(struct vop *vop) + struct drm_plane *primary = NULL, *cursor = NULL, *plane, *tmp; + struct drm_crtc *crtc = &vop->crtc; + struct device_node *port; ++ const struct drm_plane_helper_funcs *helper_funcs; + int ret; + int i; + +@@ -1976,7 +2187,12 @@ static int vop_create_crtc(struct vop *vop) + } + + plane = &vop_win->base; +- drm_plane_helper_add(plane, &plane_helper_funcs); ++ helper_funcs = &plane_helper_funcs; ++ ++ if ((plane->type == DRM_PLANE_TYPE_CURSOR) && (vop_data->feature & VOP_FEATURE_SPECIAL_CURSOR_PLANE)) ++ helper_funcs = &cursor_plane_helper_funcs; ++ ++ drm_plane_helper_add(plane, helper_funcs); + vop_plane_add_properties(plane, i, win_data, vop_data); + if (plane->type == DRM_PLANE_TYPE_PRIMARY) + primary = plane; +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +index a997578e1..42dc299d9 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +@@ -190,6 +190,8 @@ struct vop_win_phy { + struct vop_reg alpha_mode; + struct vop_reg alpha_en; + struct vop_reg channel; ++ ++ struct vop_reg hwc_size; + }; + + struct vop_win_yuv2yuv_data { +@@ -225,6 +227,7 @@ struct vop_data { + + #define VOP_FEATURE_OUTPUT_RGB10 BIT(0) + #define VOP_FEATURE_INTERNAL_RGB BIT(1) ++#define VOP_FEATURE_SPECIAL_CURSOR_PLANE BIT(2) + u64 feature; + }; + +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index ab0a78097..70930b410 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -665,6 +665,19 @@ static const struct vop_win_phy rk3288_win23_data = { + .dst_alpha_ctl = VOP_REG(RK3288_WIN2_DST_ALPHA_CTRL, 0xff, 0), + }; + ++static const struct vop_win_phy rk3288_cursor_data = { ++ .data_formats = formats_win_lite, ++ .nformats = ARRAY_SIZE(formats_win_lite), ++ .enable = VOP_REG(RK3288_HWC_CTRL0, 0x1, 0), ++ .format = VOP_REG(RK3288_HWC_CTRL0, 0x7, 1), ++ .rb_swap = VOP_REG(RK3288_HWC_CTRL0, 0x1, 12), ++ .dsp_st = VOP_REG(RK3288_HWC_DSP_ST, 0x1fff1fff, 0), ++ .yrgb_mst = VOP_REG(RK3288_HWC_MST, 0xffffffff, 0), ++ .src_alpha_ctl = VOP_REG(RK3288_HWC_SRC_ALPHA_CTRL, 0xff, 0), ++ .dst_alpha_ctl = VOP_REG(RK3288_HWC_DST_ALPHA_CTRL, 0xff, 0), ++ .hwc_size = VOP_REG(RK3288_HWC_CTRL0, 0x3, 5), ++}; ++ + static const struct vop_modeset rk3288_modeset = { + .htotal_pw = VOP_REG(RK3288_DSP_HTOTAL_HS_END, 0x1fff1fff, 0), + .hact_st_end = VOP_REG(RK3288_DSP_HACT_ST_END, 0x1fff1fff, 0), +@@ -756,6 +769,8 @@ static const struct vop_win_data rk3288_vop_win_data[] = { + { .base = 0x00, .phy = &rk3288_win23_data, + .type = DRM_PLANE_TYPE_OVERLAY }, + { .base = 0x50, .phy = &rk3288_win23_data, ++ .type = DRM_PLANE_TYPE_OVERLAY }, ++ { .base = 0x00, .phy = &rk3288_cursor_data, + .type = DRM_PLANE_TYPE_CURSOR }, + }; + +@@ -1132,11 +1132,13 @@ static const struct vop_win_data rk3228_vop_win_data[] = { + .type = DRM_PLANE_TYPE_PRIMARY }, + { .base = 0x40, .phy = &rk3228_win1_data, + .type = DRM_PLANE_TYPE_OVERLAY }, ++ { .base = 0x00, .phy = &rk3288_cursor_data, ++ .type = DRM_PLANE_TYPE_CURSOR }, + }; + + static const struct vop_data rk3228_vop = { + .version = VOP_VERSION(3, 7), +- .feature = VOP_FEATURE_OUTPUT_RGB10, ++ .feature = VOP_FEATURE_OUTPUT_RGB10 | VOP_FEATURE_SPECIAL_CURSOR_PLANE, + .intr = &rk3366_vop_intr, + .common = &rk3288_common, + .modeset = &rk3288_modeset, + +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index 04e30bdc8a0e..26a246a0fe1d 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -809,7 +809,7 @@ static const struct vop_intr rk3288_vop_intr = { + + static const struct vop_data rk3288_vop_big = { + .version = VOP_VERSION(3, 1), +- .feature = VOP_FEATURE_OUTPUT_RGB10, ++ .feature = VOP_FEATURE_OUTPUT_RGB10 | VOP_FEATURE_SPECIAL_CURSOR_PLANE, + .intr = &rk3288_vop_intr, + .common = &rk3288_common, + .modeset = &rk3288_modeset, +@@ -827,7 +827,7 @@ static const struct vop_data rk3288_vop_big = { + + static const struct vop_data rk3288_vop_lit = { + .version = VOP_VERSION(3, 1), +- .feature = VOP_FEATURE_OUTPUT_RGB10, ++ .feature = VOP_FEATURE_OUTPUT_RGB10 | VOP_FEATURE_SPECIAL_CURSOR_PLANE, + .max_output = { 2560, 1600 }, + .intr = &rk3288_vop_intr, + .common = &rk3288_common, + +-- +2.25.1 + + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-fan.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-fan.patch new file mode 100644 index 000000000000..b4b05a4abee1 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-fan.patch @@ -0,0 +1,45 @@ +From c27e445527e949f3ef46d5326066196969c17d23 Mon Sep 17 00:00:00 2001 +From: Myy +Date: Sun, 12 Mar 2017 19:43:15 +0000 +Subject: [PATCH 06/28] ARM: dts: rockchip: add the MiQi board's fan definition + +The MiQi board is sold with an enclosure in which a fan is connected +to the second LED output, and configured by default in "heartbeat" +mode so that it rotates slowly and increases when the CPU load +increases, ensuring appropriate cooling by default. This LED output +is called "Fan" in the original kernel and connected to GPIO18 +(gpiochip 0, pin 18). Here we called it "miqi:green:fan" to stay +consistent with the kernel's naming conventions. + +It's worth noting that without this patch the fan doesn't work at +all, risking to make the board overheat. + +Fixes: 162718c (v4.7) +Cc: Heiko Stuebner +Signed-off-by: Willy Tarreau + +Signed-off-by: Myy +--- + arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +index a1c3cdaa..0e383595 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +@@ -67,6 +67,13 @@ + leds { + compatible = "gpio-leds"; + ++ fan { ++ gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>; ++ label = "miqi:green:fan"; ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ + work_led: led-0 { + gpios = <&gpio7 RK_PA2 GPIO_ACTIVE_HIGH>; + label = "miqi:green:user"; +-- +2.11.0 diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-hevc-rga.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-hevc-rga.patch new file mode 100644 index 000000000000..f1d54b97c3c3 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-hevc-rga.patch @@ -0,0 +1,42 @@ +From 2fdd826a704ef70df42d92b38ad88ef869c3729b Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 18 Sep 2021 12:32:05 +0000 +Subject: [PATCH 2/2] rockchip: enable hevc, hevc_mmu and rga nodes for miqi + +--- + arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +index 94bc76099..68eb766f0 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +@@ -162,6 +162,14 @@ &hdmi { + status = "okay"; + }; + ++&hevc { ++ status = "okay"; ++}; ++ ++&hevc_mmu { ++ status = "okay"; ++}; ++ + &i2c0 { + clock-frequency = <400000>; + status = "okay"; +@@ -405,6 +413,10 @@ host_vbus_drv: host-vbus-drv { + }; + }; + ++&rga { ++ status = "okay"; ++}; ++ + &saradc { + vref-supply = <&vcc_18>; + status = "okay"; +-- +2.30.2 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-mali-gpu.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-mali-gpu.patch new file mode 100644 index 000000000000..6a07886e7326 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-mali-gpu.patch @@ -0,0 +1,35 @@ +From 604ea7fc311af2b3a41e7fe3b4fbde0ee03dfb9c Mon Sep 17 00:00:00 2001 +From: Myy Miouyouyou +Date: Thu, 19 Oct 2017 21:09:50 +0200 +Subject: [PATCH 04/28] dts: rk3288: miqi: Enabling the Mali GPU node + +Why is the MiQi the only one left without a working mali GPU node ? + +Seriously, is there a rk3288 chipset WITHOUT a mali GPU ? Couldn't +they enable it once in the DTSI, instead of defining it as "disabled" +and enabling it in every DTS file ? + +Signed-off-by: Myy Miouyouyou +--- + arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +index 4d923aa6..3cd60674 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +@@ -149,6 +149,11 @@ + status = "ok"; + }; + ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ + &hdmi { + ddc-i2c-bus = <&i2c5>; + status = "okay"; +-- +2.11.0 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-regulator-fix.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-regulator-fix.patch new file mode 100644 index 000000000000..01c66a95fa32 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-miqi-regulator-fix.patch @@ -0,0 +1,45 @@ +From 89e5763110ca77d68a4be00cd97a638adc2401d5 Mon Sep 17 00:00:00 2001 +From: Willy Tarreau +Date: Tue, 2 Aug 2016 08:31:00 +0200 +Subject: [PATCH 05/28] ARM: dts: rockchip: fix the regulator's voltage range + on MiQi board + +The board declared too narrow a voltage range for the CPU and GPU +regulators, preventing it from using the full CPU frequency range. +The regulators support 712500 to 1500000 microvolts. + +Signed-off-by: Willy Tarreau +(cherry picked from commit 95330e63a9295a2632cee8cce5db80677f01857a) +--- + arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +index 3cd60674..a1c3cdaa 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +@@ -168,8 +168,8 @@ + fcs,suspend-voltage-selector = <1>; + reg = <0x40>; + regulator-name = "vdd_cpu"; +- regulator-min-microvolt = <850000>; +- regulator-max-microvolt = <1350000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; + regulator-always-on; + regulator-boot-on; + regulator-enable-ramp-delay = <300>; +@@ -182,8 +182,8 @@ + fcs,suspend-voltage-selector = <1>; + reg = <0x41>; + regulator-name = "vdd_gpu"; +- regulator-min-microvolt = <850000>; +- regulator-max-microvolt = <1350000>; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; + regulator-always-on; + vin-supply = <&vcc_sys>; + }; +-- +2.11.0 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-iep-node.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-iep-node.patch new file mode 100644 index 000000000000..994f01e8ea29 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-iep-node.patch @@ -0,0 +1,34 @@ +From adecdd57a0155e0d96af2c84cc4fa52309fbb535 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Thu, 9 Sep 2021 19:14:08 +0000 +Subject: [PATCH] add iep node for rk322x + +--- + arch/arm/boot/dts/rockchip/rk322x.dtsi | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index 0ae753c1d..271e7835f 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -834,6 +834,17 @@ rga: rga@20060000 { + reset-names = "core", "axi", "ahb"; + }; + ++ iep: iep@20070000 { ++ compatible = "rockchip,rk3228-iep"; ++ reg = <0x20070000 0x800>; ++ interrupts = ; ++ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; ++ clock-names = "axi", "ahb"; ++ iommus = <&iep_mmu>; ++ power-domains = <&power RK3228_PD_VIO>; ++ status = "disabled"; ++ }; ++ + iep_mmu: iommu@20070800 { + compatible = "rockchip,iommu"; + reg = <0x20070800 0x100>; +-- +2.25.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-pinctrl-nand.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-pinctrl-nand.patch new file mode 100644 index 000000000000..6c6ab33ff04e --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk322x-pinctrl-nand.patch @@ -0,0 +1,93 @@ +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index 48e6e8d44..1dfd27f9f 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -712,6 +712,22 @@ emmc: mmc@30020000 { + status = "disabled"; + }; + ++ nfc: nand-controller@30030000 { ++ compatible = "rockchip,rk3228-nfc", "rockchip,rk2928-nfc"; ++ reg = <0x30030000 0x4000>; ++ interrupts = ; ++ clocks = <&cru SCLK_NANDC>, <&cru HCLK_NANDC>; ++ clock-names = "nfc", "ahb"; ++ assigned-clocks = <&cru SCLK_NANDC>; ++ assigned-clock-rates = <150000000>; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&flash_cs0 &flash_rdy &flash_ale &flash_cle ++ &flash_wrn &flash_rdn &flash_bus8>; ++ status = "disabled"; ++ ++ }; ++ + usb_otg: usb@30040000 { + compatible = "rockchip,rk3228-usb", "rockchip,rk3066-usb", + "snps,dwc2"; +@@ -950,6 +966,65 @@ emmc_bus8: emmc-bus8 { + }; + }; + ++ flash { ++ ++ flash_cs0: flash-cs0 { ++ rockchip,pins = <2 RK_PA6 1 &pcfg_pull_up>; ++ }; ++ ++ flash_cs1: flash-cs1 { ++ rockchip,pins = <0 RK_PC7 1 &pcfg_pull_up>; ++ }; ++ ++ flash_cs2: flash-cs2 { ++ rockchip,pins = <1 RK_PC6 1 &pcfg_pull_up>; ++ }; ++ ++ flash_cs3: flash-cs3 { ++ rockchip,pins = <1 RK_PC7 1 &pcfg_pull_up>; ++ }; ++ ++ flash_rdy: flash-rdy { ++ rockchip,pins = <2 RK_PA4 1 &pcfg_pull_up>; ++ }; ++ ++ flash_ale: flash-ale { ++ rockchip,pins = <2 RK_PA0 1 &pcfg_pull_down>; ++ }; ++ ++ flash_cle: flash-cle { ++ rockchip,pins = <2 RK_PA1 1 &pcfg_pull_down>; ++ }; ++ ++ flash_wrn: flash-wrn { ++ rockchip,pins = <2 RK_PA2 1 &pcfg_pull_up>; ++ }; ++ ++ flash_rdn: flash-rdn { ++ rockchip,pins = <2 RK_PA3 1 &pcfg_pull_up>; ++ }; ++ ++ flash_bus8: flash-bus8 { ++ rockchip,pins = <1 RK_PD0 1 &pcfg_pull_up>, ++ <1 RK_PD1 1 &pcfg_pull_up>, ++ <1 RK_PD2 1 &pcfg_pull_up>, ++ <1 RK_PD3 1 &pcfg_pull_up>, ++ <1 RK_PD4 1 &pcfg_pull_up>, ++ <1 RK_PD5 1 &pcfg_pull_up>, ++ <1 RK_PD6 1 &pcfg_pull_up>, ++ <1 RK_PD7 1 &pcfg_pull_up>; ++ }; ++ ++ flash_dqs: flash-dqs { ++ rockchip,pins = <2 RK_PA7 1 &pcfg_pull_up>; ++ }; ++ ++ flash_wp: flash-wp { ++ rockchip,pins = <2 RK_PA5 1 &pcfg_pull_down>; ++ }; ++ ++ }; ++ + gmac { + rgmii_pins: rgmii-pins { + rockchip,pins = <2 RK_PB6 1 &pcfg_pull_none>, diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-disable-serial-dma.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-disable-serial-dma.patch new file mode 100644 index 000000000000..b54cf9d59060 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-disable-serial-dma.patch @@ -0,0 +1,40 @@ +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index 0cd88774d..07681f1f0 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -420,8 +420,6 @@ + reg-io-width = <4>; + clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>; + clock-names = "baudclk", "apb_pclk"; +- dmas = <&dmac_peri 1>, <&dmac_peri 2>; +- dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer>; + status = "disabled"; +@@ -435,8 +433,6 @@ + reg-io-width = <4>; + clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>; + clock-names = "baudclk", "apb_pclk"; +- dmas = <&dmac_peri 3>, <&dmac_peri 4>; +- dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1_xfer>; + status = "disabled"; +@@ -463,8 +459,6 @@ + reg-io-width = <4>; + clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>; + clock-names = "baudclk", "apb_pclk"; +- dmas = <&dmac_peri 7>, <&dmac_peri 8>; +- dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart3_xfer>; + status = "disabled"; +@@ -478,8 +472,6 @@ + reg-io-width = <4>; + clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>; + clock-names = "baudclk", "apb_pclk"; +- dmas = <&dmac_peri 9>, <&dmac_peri 10>; +- dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart4_xfer>; + status = "disabled"; diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-fix-mmc-aliases.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-fix-mmc-aliases.patch new file mode 100644 index 000000000000..dede52866679 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-fix-mmc-aliases.patch @@ -0,0 +1,20 @@ +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index 511ca864c1b2..d7ecb6b4de40 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -25,10 +25,10 @@ aliases { + i2c3 = &i2c3; + i2c4 = &i2c4; + i2c5 = &i2c5; +- mshc0 = &emmc; +- mshc1 = &sdmmc; +- mshc2 = &sdio0; +- mshc3 = &sdio1; ++ mmc0 = &sdmmc; ++ mmc1 = &sdio0; ++ mmc2 = &emmc; ++ mmc3 = &sdio1; + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-gpu-500mhz-opp.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-gpu-500mhz-opp.patch new file mode 100644 index 000000000000..6a91d9226c56 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-gpu-500mhz-opp.patch @@ -0,0 +1,42 @@ +From 73258d32daf3a661281bb5c77c5e2e06c7ff714e Mon Sep 17 00:00:00 2001 +From: "Miouyouyou (Myy)" +Date: Fri, 3 Jul 2020 02:02:18 +0200 +Subject: [PATCH] arm: dtsi: rk3288: add GPU 500 Mhz OPP again + +Undoing the very bizarre mainline kernel patch, +75481833c6dbab4c29d15452f6b4337c16f5407b +which main purpose is to sync some 3.14 kernels hacks to +mainline kernels, for reasons that only matter for a few Chromebooks, +and shove it down the throat of every RK3288 user. + +If you need to avoid the GPU going to 500 Mhz on Chromebooks, +remove the OPP entry inside the DTS that actually matters to RK3288 +Chromebooks. + +Meanwhile, the 600 Mhz operating point can prove to be unstable on +some RK3288 boards, while 500 Mhz works fine. +https://forum.armbian.com/topic/13515-panfrost-on-rk3288-and-gpu-on-600mhz-problems/ + +Signed-off-by: Miouyouyou (Myy) +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index a66412547..ef7457f79 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -1312,6 +1312,10 @@ opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <1100000>; + }; ++ opp-500000000 { ++ opp-hz = /bits/ 64 <500000000>; ++ opp-microvolt = <1200000>; ++ }; + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1250000>; +-- +2.27.0 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-pinctrl-spi2.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-pinctrl-spi2.patch new file mode 100644 index 000000000000..f34e8fa8e417 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-pinctrl-spi2.patch @@ -0,0 +1,31 @@ +From 062488e4b8fd552c01e1104b3bc91a6f7ffe6c41 Mon Sep 17 00:00:00 2001 +From: Myy Miouyouyou +Date: Thu, 19 Oct 2017 21:24:47 +0200 +Subject: [PATCH 10/28] RK3288: DTSI: rk3288.dtsi: Add missing SPI2 pinctrl + +The spi2_cs1 pin reference is missing in the spi2 first pin control +definition. + +This patch is taken from the patches provided by the ARMbian team. + +Signed-off-by: Myy Miouyouyou +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index 5b789528..9ed532cc 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -334,7 +334,7 @@ + dma-names = "tx", "rx"; + interrupts = ; + pinctrl-names = "default"; +- pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0>; ++ pinctrl-0 = <&spi2_clk &spi2_tx &spi2_rx &spi2_cs0 &spi2_cs1>; + reg = <0x0 0xff130000 0x0 0x1000>; + #address-cells = <1>; + #size-cells = <0>; +-- +2.11.0 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-thermal-rearrange-zones.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-thermal-rearrange-zones.patch new file mode 100644 index 000000000000..c9ae49db37cf --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-rk3288-thermal-rearrange-zones.patch @@ -0,0 +1,32 @@ +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index bc3601a..37ae378 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -467,13 +467,6 @@ + }; + + thermal-zones { +- reserve_thermal: reserve-thermal { +- polling-delay-passive = <1000>; /* milliseconds */ +- polling-delay = <5000>; /* milliseconds */ +- +- thermal-sensors = <&tsadc 0>; +- }; +- + cpu_thermal: cpu-thermal { + polling-delay-passive = <100>; /* milliseconds */ + polling-delay = <5000>; /* milliseconds */ +@@ -539,6 +532,13 @@ + }; + }; + }; ++ ++ reserve_thermal: reserve-thermal { ++ polling-delay-passive = <1000>; /* milliseconds */ ++ polling-delay = <5000>; /* milliseconds */ ++ ++ thermal-sensors = <&tsadc 0>; ++ }; + }; + + tsadc: tsadc@ff280000 { diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-rtl8723bs.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-rtl8723bs.patch new file mode 100644 index 000000000000..e56921406c2d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-rtl8723bs.patch @@ -0,0 +1,34 @@ +From 87313f95f809fc34f499c1ceff1b95cd4efa0f3f Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 22 Mar 2022 22:02:46 +0000 +Subject: [PATCH] rockchip: add tinkerboard bluetooth + +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +index ff2c6de3216..23acfdecee7 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +@@ -510,6 +510,17 @@ &tsadc { + + &uart0 { + status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; ++ uart-has-rtscts; ++ ++ bluetooth { ++ compatible = "realtek,rtl8723bs-bt"; ++ enable-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; ++ device-wake-gpios = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; ++ host-wake-gpios = <&gpio4 RK_PD7 GPIO_ACTIVE_HIGH>; ++ }; ++ + }; + + &uart1 { +-- +2.30.2 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-uart-pins.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-uart-pins.patch new file mode 100644 index 000000000000..50da0ecae05d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-bt-uart-pins.patch @@ -0,0 +1,62 @@ +From 2c2e60256f2cbb2fce50a6317f85b1500efd1a6c Mon Sep 17 00:00:00 2001 +From: "Miouyouyou (Myy)" +Date: Mon, 5 Nov 2018 22:03:26 +0100 +Subject: [PATCH] ARM: DTS: rk3288-tinker: Setup the Bluetooth UART pins + +The most essential being the RTS pin, which is clearly needed to +upload the initial configuration into the Realtek Bluetooth +chip, and make the Bluetooth chip work. + +Now, the Bluetooth chip also needs 3 other GPIOS to be enabled. +I'll see how I do that through the DTS file in a near future. + +The 3 GPIOS being : +Bluetooth Reset : <&gpio4 29 GPIO_ACTIVE_HIGH> +Bluetooth Wake : <&gpio4 26 GPIO_ACTIVE_HIGH> +Bluetooth Wake_Host_IRQ : <&gpio4 31 GPIO_ACTIVE_HIGH> + +These are currently setup manually, through scripts. But it seems that +GPIO handling through /sys entries might not be possible in the long +term, the replacement being libgpio. +Anyway, if you're interesting in enabling the Bluetooth GPIO by hand, +here are the commands : + +cd /sys/class/gpio && +echo 146 > export && +echo 149 > export && +echo 151 > export && +echo high > gpio146/direction && +echo high > gpio149/direction && +echo high > gpio151/direction + +Resetting the chip is done like this : + +echo "Resetting the Bluetooth chip" +cd /sys/class/gpio/gpio149 && +echo 0 > value && +sleep 1 && +echo 1 > value && +sleep 1 + +Signed-off-by: Miouyouyou (Myy) +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts +index d4df13bed..b92e59c1e 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts +@@ -73,3 +73,9 @@ + status = "okay"; + supports-sdio; + }; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>; ++}; ++ +-- +2.16.4 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-hevc-rga.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-hevc-rga.patch new file mode 100644 index 000000000000..a5175c9e5b61 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-hevc-rga.patch @@ -0,0 +1,43 @@ +From 0bcc81848ec1fb34fee9d3c7eb1550495cc8efc9 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 18 Sep 2021 12:31:19 +0000 +Subject: [PATCH 1/2] rockchip: enable hevc, hevc_mmu and rga nodes for + tinkerboard (both) + +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +index aa36aedf9..ff2c6de32 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +@@ -150,6 +150,14 @@ &hdmi { + status = "okay"; + }; + ++&hevc { ++ status = "okay"; ++}; ++ ++&hevc_mmu { ++ status = "okay"; ++}; ++ + &i2c0 { + clock-frequency = <400000>; + status = "okay"; +@@ -449,6 +457,10 @@ &pwm0 { + status = "okay"; + }; + ++&rga { ++ status = "okay"; ++}; ++ + &saradc { + vref-supply = <&vcc18_ldo1>; + status = "okay"; +-- +2.30.2 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdio-wifi.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdio-wifi.patch new file mode 100644 index 000000000000..85974972be0a --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdio-wifi.patch @@ -0,0 +1,98 @@ +From d5d5c53173c484a13cda62a537cbf75a5df4b0e4 Mon Sep 17 00:00:00 2001 +From: "Miouyouyou (Myy)" +Date: Mon, 5 Nov 2018 21:58:56 +0100 +Subject: [PATCH] ARM: DTS: rk3288-tinker: Enabling SDIO and Wifi + +Adding the appropriate nodes in order to exploit the WiFi capabilities +of the board. +Since these capabilities are provided through SDIO, and the SDIO +nodes were not defined, these were added too. + +These seems to depend on each other so they are added in one big +patch. + +Split if necessary. + +Signed-off-by: Miouyouyou (Myy) +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 62 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 62 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts +index 1e43527aa..d4df13bed 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts +@@ -6,8 +6,70 @@ + /dts-v1/; + + #include "rk3288-tinker.dtsi" ++#include + + / { + model = "Rockchip RK3288 Asus Tinker Board"; + compatible = "asus,rk3288-tinker", "rockchip,rk3288"; ++ ++ /* This is essential to get SDIO devices working. ++ The Wifi depends on SDIO ! */ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 RK808_CLKOUT1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&chip_enable_h>, <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>, <&gpio4 27 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ sdio_vref = <1800>; ++ status = "okay"; ++ wifi_chip_type = "8723bs"; ++ WIFI,host_wake_irq = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&io_domains { ++ wifi-supply = <&vcc_18>; ++}; ++ ++&pinctrl { ++ sdio-pwrseq { ++ wifi_enable_h: wifienable-h { ++ rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ chip_enable_h: chip-enable-h { ++ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&sdio0 { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ clock-frequency = <50000000>; ++ clock-freq-min-max = <200000 50000000>; ++ disable-wp; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++ supports-sdio; + }; +-- +2.16.4 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdmmc-properties.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdmmc-properties.patch new file mode 100644 index 000000000000..5486d60188c1 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-sdmmc-properties.patch @@ -0,0 +1,33 @@ +From 487db7cefc9861fdaf30579c378a98f0360690ae Mon Sep 17 00:00:00 2001 +From: "Miouyouyou (Myy)" +Date: Mon, 5 Nov 2018 20:27:14 +0100 +Subject: [PATCH] ARM: DTSI: rk3288-tinker: Defining SDMMC properties + +I never knew if these properties were required to fix the dreaded +reboot issue... + +Signed-off-by: Miouyouyou (Myy) +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +index dd1090728..8edd6f681 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +@@ -436,7 +436,12 @@ + disable-wp; /* wp not hooked up */ + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ sd-uhs-sdr12; ++ sd-uhs-sdr25; ++ sd-uhs-sdr50; ++ sd-uhs-sdr104; + status = "okay"; ++ supports-sd; + vmmc-supply = <&vcc33_sd>; + vqmmc-supply = <&vccio_sd>; + }; +-- +2.16.4 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-spi-interface.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-spi-interface.patch new file mode 100644 index 000000000000..db2b09b1595c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-tinkerboard-spi-interface.patch @@ -0,0 +1,50 @@ +From b24b8f83e150811ad54ee2a4843e44cd1421fafa Mon Sep 17 00:00:00 2001 +From: "Miouyouyou (Myy)" +Date: Mon, 5 Nov 2018 22:15:14 +0100 +Subject: [PATCH] ARM: DTS: rk3288-tinker: Defining the SPI interface + +Taken from, and tested by @TonyMac32 . + +Well, the original one was tested by him but I had to adapt the +registers definitions to the new 64-bits LPAE-compliant syntax. + +Therefore that *might* break, along with a few other patches. + +Signed-off-by: Miouyouyou (Myy) +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dts | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts +index 96d05fc6b..17bfea298 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dts +@@ -99,6 +99,25 @@ + supports-sdio; + }; + ++&spi2 { ++ max-freq = <50000000>; ++ status = "okay"; ++ ++ spidev@0 { ++ compatible = "rockchip,spi_tinker"; ++ reg = <0x0 0>; ++ spi-max-frequency = <50000000>; ++ spi-cpha = <1>; ++ }; ++ ++ spidev@1 { ++ compatible = "rockchip,spi_tinker"; ++ reg = <0x1>; ++ spi-max-frequency = <50000000>; ++ spi-cpha = <1>; ++ }; ++}; ++ + &uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>; +-- +2.16.4 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-veyron-flag-cache-flush.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-veyron-flag-cache-flush.patch new file mode 100644 index 000000000000..89cb36c0a24c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/dts-veyron-flag-cache-flush.patch @@ -0,0 +1,32 @@ +From 9177b30ab083dbda2bede3b3d61ef71ad4b1ffe0 Mon Sep 17 00:00:00 2001 +From: "Miouyouyou (Myy)" +Date: Thu, 1 Nov 2018 21:31:26 +0100 +Subject: [PATCH 2/2] arm: dts: veyron: Added a flag to disable cache flush + during reset + +Flushing the MMC cache of ASUS Chromebooks during initialization or +"recovery" generates 10 minutes hangup, according to @SolidHal. + +This is an adaptation of @SolidHal, in order to pinpoint the fix to +Veyron Chromebooks, and avoiding issues other RK3288 boards. + +Signed-off-by: Miouyouyou (Myy) +--- + arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi b/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi +index 2075120cf..fa4951fd7 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288-veyron.dtsi +@@ -123,6 +123,7 @@ + mmc-hs200-1_8v; + mmc-pwrseq = <&emmc_pwrseq>; + non-removable; ++ no-recovery-cache-flush; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; + }; +-- +2.16.4 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-compilation-support.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-compilation-support.patch new file mode 100644 index 000000000000..3a0c05e60cab --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-compilation-support.patch @@ -0,0 +1,64 @@ +From a8f9689004d59f0a454ce8cb06bf1556971c1bad Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 20 Jul 2024 13:58:49 +0200 +Subject: [PATCH] compile .scr and install overlays in right path + +--- + scripts/Makefile.dtbinst | 13 ++++++++++++- + scripts/Makefile.lib | 8 +++++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index 9d920419a62c..9144a1b7c909 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -33,7 +33,18 @@ endef + + $(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) + +-dtbs := $(notdir $(dtbs)) ++# Very convoluted way to flatten all the device tree ++# directories, but keep the "/overlay/" directory ++ ++# topmost directory (ie: from rockchip/overlay/rk322x-emmc.dtbo extracts rockchip) ++topmost_dir = $(firstword $(subst /, ,$(dtbs))) ++# collect dtbs entries which starts with "$topmost_dir/overlay/", then remove "$topmost_dir" ++dtbs_overlays = $(subst $(topmost_dir)/,,$(filter $(topmost_dir)/overlay/%, $(dtbs))) ++# collect the non-overlay dtbs ++dtbs_regular = $(filter-out $(topmost_dir)/overlay/%, $(dtbs)) ++# compose the dtbs variable flattening all the non-overlays entries ++# and appending the overlays entries ++dtbs := $(notdir $(dtbs_regular)) $(dtbs_overlays) + + endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 9f06f6aaf7fc..67a7b73b6688 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -394,15 +394,21 @@ quiet_cmd_wrap_S_dtb = WRAP $@ + echo '.balign STRUCT_ALIGNMENT'; \ + } > $@ + ++quiet_cmd_scr = MKIMAGE $@ ++cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ ++ + $(obj)/%.dtb.S: $(obj)/%.dtb FORCE + $(call if_changed,wrap_S_dtb) + + $(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE + $(call if_changed,wrap_S_dtb) + ++$(obj)/%.scr: $(src)/%.scr-cmd FORCE ++ $(call if_changed,scr) ++ + quiet_cmd_dtc = DTC $@ + cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(DTC) -o $@ -b 0 \ ++ $(DTC) -@ -o $@ -b 0 \ + $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-configfs.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-configfs.patch new file mode 100644 index 000000000000..0aa88542fc4a --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-overlay-configfs.patch @@ -0,0 +1,358 @@ +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. ++ ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. ++ ++* To create an overlay you mkdir the directory: ++ ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index 37c2ccbefecdc..d3fc81a40c0e7 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -103,4 +103,11 @@ config OF_OVERLAY + config OF_NUMA + bool + ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index 663a4af0cccd5..b00a95adf5199 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + obj-y = base.o device.o platform.o property.o + obj-$(CONFIG_OF_KOBJ) += kobj.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 000000000..5dd509e8f +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,290 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "of_private.h" ++ ++struct cfs_overlay_item { ++ struct config_item item; ++ ++ char path[PATH_MAX]; ++ ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static int create_overlay(struct cfs_overlay_item *overlay, void *blob, u32 blob_size) ++{ ++ int err; ++ ++ err = of_overlay_fdt_apply(blob, blob_size, &overlay->ov_id, NULL); ++ if (err < 0) { ++ pr_err("%s: Failed to create overlay (err=%d)\n", ++ __func__, err); ++ goto out_err; ++ } ++ ++out_err: ++ return err; ++} ++ ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) ++{ ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} ++ ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} ++ ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; ++ ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; ++ ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); ++ ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ err = create_overlay(overlay, (void *)overlay->fw->data, overlay->fw->size); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; ++ ++ overlay->path[0] = '\0'; ++ return err; ++} ++ ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ return sprintf(page, "%s\n", ++ overlay->ov_id >= 0 ? "applied" : "unapplied"); ++} ++ ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); ++ ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; ++ ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); ++ ++ if (overlay->dtbo == NULL) ++ return 0; ++ ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; ++ ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } ++ ++ return overlay->dtbo_size; ++} ++ ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; ++ ++ overlay->dtbo_size = count; ++ ++ err = create_overlay(overlay, overlay->dtbo, overlay->dtbo_size); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; ++ ++ return err; ++} ++ ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id >= 0) ++ of_overlay_remove(&overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); ++} ++ ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; ++ ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; ++ ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ overlay->ov_id = -1; ++ ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} ++ ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ config_item_put(&overlay->item); ++} ++ ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; ++ ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; ++ ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++struct config_group of_cfs_overlay_group; ++ ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; ++ } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-restart-handler-for-act8846.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-restart-handler-for-act8846.patch new file mode 100644 index 000000000000..055ba8eeee68 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-add-restart-handler-for-act8846.patch @@ -0,0 +1,71 @@ +From 7f2d6a02498ce3fa7771893072e81b31f9bd64b2 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Fri, 24 Mar 2023 17:15:16 +0000 +Subject: [PATCH] register act8846 restart handler for SIPC function + +--- + drivers/regulator/act8865-regulator.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c +index 53f2c75cd..e45ad8430 100644 +--- a/drivers/regulator/act8865-regulator.c ++++ b/drivers/regulator/act8865-regulator.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + /* + * ACT8600 Global Register Map. +@@ -141,6 +142,8 @@ + #define ACT8865_VOLTAGE_NUM 64 + #define ACT8600_SUDCDC_VOLTAGE_NUM 256 + ++#define ACT8846_SIPC_MASK 0x01 ++ + struct act8865 { + struct regmap *regmap; + int off_reg; +@@ -582,6 +585,22 @@ static void act8865_power_off(void) + while (1); + } + ++static int act8846_power_cycle(struct notifier_block *this, ++ unsigned long code, void *unused) ++{ ++ struct act8865 *act8846; ++ ++ act8846 = i2c_get_clientdata(act8865_i2c_client); ++ regmap_write(act8846->regmap, ACT8846_GLB_OFF_CTRL, ACT8846_SIPC_MASK); ++ ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block act8846_restart_handler = { ++ .notifier_call = act8846_power_cycle, ++ .priority = 129, ++}; ++ + static int act8600_charger_get_status(struct regmap *map) + { + unsigned int val; +@@ -733,6 +752,14 @@ static int act8865_pmic_probe(struct i2c_client *client) + } else { + dev_err(dev, "Failed to set poweroff capability, already defined\n"); + } ++ ++ if (type == ACT8846) { ++ act8865_i2c_client = client; ++ ret = register_restart_handler(&act8846_restart_handler); ++ if (ret) ++ pr_err("%s: cannot register restart handler, %d\n", ++ __func__, ret); ++ } + } + + /* Finally register devices */ +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-peripheral.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-peripheral.patch new file mode 100644 index 000000000000..9a5c933fdf8e --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-peripheral.patch @@ -0,0 +1,26 @@ +From e477f1546f2739e9ea053d677f421e01a9babff4 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 2 Mar 2024 21:56:44 +0100 +Subject: [PATCH] dwc2: add fixes for rk322x peripheral mode + +--- + drivers/usb/dwc2/core.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c +index 5635e4d7ec88..0a3d387a497a 100644 +--- a/drivers/usb/dwc2/core.c ++++ b/drivers/usb/dwc2/core.c +@@ -532,6 +532,9 @@ void dwc2_force_mode(struct dwc2_hsotg *hsotg, bool host) + gusbcfg |= set; + dwc2_writel(hsotg, gusbcfg, GUSBCFG); + ++ /* On some rockchip platforms, this fixes hang on reset in peripheral mode */ ++ msleep(10); ++ + dwc2_wait_for_mode(hsotg, host); + return; + } +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-time.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-time.patch new file mode 100644 index 000000000000..f8517ac54733 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-fix-wait-time.patch @@ -0,0 +1,56 @@ +From ee7c3ab6b5a4d284a04f110792508a7f8decd7f7 Mon Sep 17 00:00:00 2001 +From: William Wu +Date: Tue, 6 Dec 2022 14:45:54 +0800 +Subject: [PATCH] usb: dwc2: fix waiting time for host only mode + +The current code uses 50ms sleep to wait for host only +mode, the delay time is not enough for some Rockchip +platforms (e.g RK3036G EVB1). + +Test on RK3036G EVB1, the dwc2 host only controller reg +GOTGCTL.ConIDSts = 1'b1 (device mode) if only wait for +50ms. And the host fails to detect usb2 device with the +following error log: + +usb usb2-port1: connect-debounce failed + +This patch checks the GOTGCTL.ConIDSts for host only +mode and increases the maximum waiting time to 200ms. + +Signed-off-by: William Wu +Change-Id: Ie28299934aba09907ea08f5fd3b34bf2fb35822e +--- + drivers/usb/dwc2/core.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c +index 15911ac7582b4..cbd5f1142f35e 100644 +--- a/drivers/usb/dwc2/core.c ++++ b/drivers/usb/dwc2/core.c +@@ -656,14 +656,24 @@ static void dwc2_clear_force_mode(struct dwc2_hsotg *hsotg) + */ + void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg) + { ++ u32 count = 0; ++ + switch (hsotg->dr_mode) { + case USB_DR_MODE_HOST: + /* + * NOTE: This is required for some rockchip soc based + * platforms on their host-only dwc2. + */ +- if (!dwc2_hw_is_otg(hsotg)) +- msleep(50); ++ if (!dwc2_hw_is_otg(hsotg)) { ++ while (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_CONID_B) { ++ msleep(20); ++ if (++count > 10) ++ break; ++ } ++ if (count > 10) ++ dev_err(hsotg->dev, ++ "Waiting for Host Mode timed out"); ++ } + + break; + case USB_DR_MODE_PERIPHERAL: diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-nak-gadget.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-nak-gadget.patch new file mode 100644 index 000000000000..1162a96d9301 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-dwc2-nak-gadget.patch @@ -0,0 +1,88 @@ +From 15b317ff84dc09faa47995b1d973d96a6172fa4c Mon Sep 17 00:00:00 2001 +From: William Wu +Date: Thu, 15 Dec 2022 14:19:28 +0800 +Subject: [PATCH] usb: dwc2: gadget: Disable nak interrupt when get first isoc + in token + +The dwc2 driver use the nak interrupt for the starting point +of isoc-in transfer. The first nak interrupt for isoc-in means +that in token has arrived and the dwc2 driver can obtain the +(micro) frame of the token to set the even/odd (micro) frame +field of DIEPCTL. + +However, on some platforms (e.g Rockchip rk3308) which don't +support the "OTG_MULTI_PROC_INTRPT", it means that all device +endpoints share the same nak mask and interrupt. If the nak +interrupt is always enabled, it may trigger nak interrupt storm +by other endpoints except the isoc-in endpoint. So we disable +the nak interrupt when get first isoc in token if the feature +"OTG_MULTI_PROC_INTRPT" isn't enabled. + +Signed-off-by: William Wu +Change-Id: I99c71a5e0d7903346fd8f71619b6736c3181c0ec +--- + drivers/usb/dwc2/gadget.c | 37 +++++++++++++++++++++++++++++++++++-- + 1 file changed, 35 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c +index e1dc4735a99c..0e185ef474ac 100644 +--- a/drivers/usb/dwc2/gadget.c ++++ b/drivers/usb/dwc2/gadget.c +@@ -1402,6 +1402,8 @@ static int dwc2_gadget_set_ep0_desc_chain(struct dwc2_hsotg *hsotg, + return 0; + } + ++static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep); ++ + static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, + gfp_t gfp_flags) + { +@@ -1518,6 +1520,20 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, + + if (hs_ep->target_frame != TARGET_FRAME_INITIAL) + dwc2_hsotg_start_req(hs, hs_ep, hs_req, false); ++ } else if (hs_ep->isochronous && hs_ep->dir_in && !hs_ep->req && ++ !(dwc2_readl(hs, GHWCFG2) & GHWCFG2_MULTI_PROC_INT)) { ++ /* Update current frame number value. */ ++ hs->frame_number = dwc2_hsotg_read_frameno(hs); ++ while (dwc2_gadget_target_frame_elapsed(hs_ep)) { ++ dwc2_gadget_incr_frame_num(hs_ep); ++ /* Update current frame number value once more as it ++ * changes here. ++ */ ++ hs->frame_number = dwc2_hsotg_read_frameno(hs); ++ } ++ ++ if (hs_ep->target_frame != TARGET_FRAME_INITIAL) ++ dwc2_gadget_start_next_request(hs_ep); + } + return 0; + } +@@ -2989,8 +3005,25 @@ static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) + + hs_ep->target_frame = hsotg->frame_number; + if (hs_ep->interval > 1) { +- u32 ctrl = dwc2_readl(hsotg, +- DIEPCTL(hs_ep->index)); ++ u32 mask; ++ u32 ctrl; ++ ++ /* ++ * Disable nak interrupt when we have got the first ++ * isoc in token. This can avoid nak interrupt storm ++ * on the Rockchip platforms which don't support the ++ * "OTG_MULTI_PROC_INTRPT", and all device endpoints ++ * share the same nak mask and interrupt. ++ */ ++ if (!(dwc2_readl(hsotg, GHWCFG2) & ++ GHWCFG2_MULTI_PROC_INT)) { ++ mask = dwc2_readl(hsotg, DIEPMSK); ++ mask &= ~DIEPMSK_NAKMSK; ++ dwc2_writel(hsotg, mask, DIEPMSK); ++ } ++ ++ ctrl = dwc2_readl(hsotg, ++ DIEPCTL(hs_ep->index)); + if (hs_ep->target_frame & 0x1) + ctrl |= DXEPCTL_SETODDFR; + else diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-fix-reboot-from-kwiboo.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-fix-reboot-from-kwiboo.patch new file mode 100644 index 000000000000..088b7ebe8b06 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-fix-reboot-from-kwiboo.patch @@ -0,0 +1,19 @@ +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 5bd58b95d..48ebe081f 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1684,6 +1684,14 @@ void mmc_power_off(struct mmc_host *host) + if (host->ios.power_mode == MMC_POWER_OFF) + return; + ++ mmc_set_initial_signal_voltage(host); ++ ++ /* ++ * This delay should be sufficient to allow the power supply ++ * to reach the minimum voltage. ++ */ ++ mmc_delay(host->ios.power_delay_ms); ++ + mmc_pwrseq_power_off(host); + + host->ios.clock = 0; diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-linux-export-mm-trace-rss-stats.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-linux-export-mm-trace-rss-stats.patch new file mode 100644 index 000000000000..45c975a46cc8 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-linux-export-mm-trace-rss-stats.patch @@ -0,0 +1,24 @@ +From 6408e6688b18e5c712c711110d196a4e95f3f870 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Thu, 9 Sep 2021 16:37:28 +0000 +Subject: [PATCH 2/4] 01-linux-1000-export-mm_trace_rss_stat + +--- + mm/memory.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mm/memory.c b/mm/memory.c +index 25fc46e87..7ef0adaa5 100644 +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -171,6 +171,7 @@ void mm_trace_rss_stat(struct mm_struct *mm, int member, long count) + { + trace_rss_stat(mm, member, count); + } ++EXPORT_SYMBOL(mm_trace_rss_stat); + + #if defined(SPLIT_RSS_COUNTING) + +-- +2.25.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-rk322x-gpio-ir-driver.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-rk322x-gpio-ir-driver.patch new file mode 100644 index 000000000000..0c5ddf94bd4f --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-rk322x-gpio-ir-driver.patch @@ -0,0 +1,786 @@ +From 13498feb91614d59ebece61d0c278e31529bb8c8 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 10 Oct 2023 21:54:51 +0200 +Subject: [PATCH] rockchip gpio IR driver + +--- + drivers/media/rc/Kconfig | 11 + + drivers/media/rc/Makefile | 1 + + drivers/media/rc/rockchip-ir.c | 723 +++++++++++++++++++++++++++++++++ + 3 files changed, 735 insertions(+) + create mode 100644 drivers/media/rc/rockchip-ir.c + +diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig +index 2afe67ffa285..0fd671f5873c 100644 +--- a/drivers/media/rc/Kconfig ++++ b/drivers/media/rc/Kconfig +@@ -338,6 +338,16 @@ config IR_REDRAT3 + To compile this driver as a module, choose M here: the + module will be called redrat3. + ++config IR_ROCKCHIP_CIR ++ tristate "Rockchip GPIO IR receiver" ++ depends on (OF && GPIOLIB) || COMPILE_TEST ++ help ++ Say Y here if you want to use the Rockchip IR receiver with ++ virtual poweroff features provided by rockchip Trust OS ++ ++ To compile this driver as a module, choose M here: the ++ module will be called rockchip-ir ++ + config IR_SERIAL + tristate "Homebrew Serial Port Receiver" + depends on HAS_IOPORT +diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile +index 2bca6f7f07bc..2ec037f8b939 100644 +--- a/drivers/media/rc/Makefile ++++ b/drivers/media/rc/Makefile +@@ -43,6 +43,7 @@ obj-$(CONFIG_IR_MTK) += mtk-cir.o + obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o + obj-$(CONFIG_IR_PWM_TX) += pwm-ir-tx.o + obj-$(CONFIG_IR_REDRAT3) += redrat3.o ++obj-$(CONFIG_IR_ROCKCHIP_CIR) += rockchip-ir.o + obj-$(CONFIG_IR_SERIAL) += serial_ir.o + obj-$(CONFIG_IR_SPI) += ir-spi.o + obj-$(CONFIG_IR_STREAMZAP) += streamzap.o +diff --git a/drivers/media/rc/rockchip-ir.c b/drivers/media/rc/rockchip-ir.c +new file mode 100644 +index 000000000000..43ade8c4adce +--- /dev/null ++++ b/drivers/media/rc/rockchip-ir.c +@@ -0,0 +1,733 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* Copyright (c) 2012, Code Aurora Forum. All rights reserved. ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define ROCKCHIP_IR_DEVICE_NAME "rockchip_ir_recv" ++ ++#ifdef CONFIG_64BIT ++#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name ++#else ++#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN_##name ++#endif ++ ++/* ++* SIP/TEE constants for remote calls ++*/ ++#define SIP_REMOTECTL_CFG 0x8200000b ++#define SIP_SUSPEND_MODE 0x82000003 ++#define SIP_REMOTECTL_CFG 0x8200000b ++#define SUSPEND_MODE_CONFIG 0x01 ++#define WKUP_SOURCE_CONFIG 0x02 ++#define PWM_REGULATOR_CONFIG 0x03 ++#define GPIO_POWER_CONFIG 0x04 ++#define SUSPEND_DEBUG_ENABLE 0x05 ++#define APIOS_SUSPEND_CONFIG 0x06 ++#define VIRTUAL_POWEROFF 0x07 ++ ++#define REMOTECTL_SET_IRQ 0xf0 ++#define REMOTECTL_SET_PWM_CH 0xf1 ++#define REMOTECTL_SET_PWRKEY 0xf2 ++#define REMOTECTL_GET_WAKEUP_STATE 0xf3 ++#define REMOTECTL_ENABLE 0xf4 ++#define REMOTECTL_PWRKEY_WAKEUP 0xdeadbeaf /* wakeup state */ ++ ++/* ++* PWM Registers ++* Each PWM has its own control registers ++*/ ++#define PWM_REG_CNTR 0x00 /* Counter Register */ ++#define PWM_REG_HPR 0x04 /* Period Register */ ++#define PWM_REG_LPR 0x08 /* Duty Cycle Register */ ++#define PWM_REG_CTRL 0x0c /* Control Register */ ++ ++/* ++* PWM General registers ++* Registers shared among PWMs ++*/ ++#define PWM_REG_INT_EN 0x44 ++ ++/*REG_CTRL bits definitions*/ ++#define PWM_ENABLE (1 << 0) ++#define PWM_DISABLE (0 << 0) ++ ++/*operation mode*/ ++#define PWM_MODE_ONESHOT (0x00 << 1) ++#define PWM_MODE_CONTINUMOUS (0x01 << 1) ++#define PWM_MODE_CAPTURE (0x02 << 1) ++ ++/* Channel interrupt enable bit */ ++#define PWM_CH_INT_ENABLE(n) BIT(n) ++ ++enum pwm_div { ++ PWM_DIV1 = (0x0 << 12), ++ PWM_DIV2 = (0x1 << 12), ++ PWM_DIV4 = (0x2 << 12), ++ PWM_DIV8 = (0x3 << 12), ++ PWM_DIV16 = (0x4 << 12), ++ PWM_DIV32 = (0x5 << 12), ++ PWM_DIV64 = (0x6 << 12), ++ PWM_DIV128 = (0x7 << 12), ++}; ++ ++#define PWM_INT_ENABLE 1 ++#define PWM_INT_DISABLE 0 ++ ++struct rockchip_rc_dev { ++ struct rc_dev *rcdev; ++ struct gpio_desc *gpiod; ++ int irq; ++ struct device *pmdev; ++ struct pm_qos_request qos; ++ void __iomem *pwm_base; ++ int pwm_wake_irq; ++ int pwm_id; ++ bool use_shutdown_handler; // if true, installs a shutdown handler and triggers virtual poweroff ++ bool use_suspend_handler; // if true, virtual poweroff is used as suspend mode otherwise use as regular suspend ++ struct pinctrl *pinctrl; ++ struct pinctrl_state *pinctrl_state_default; ++ struct pinctrl_state *pinctrl_state_suspend; ++}; ++ ++static struct arm_smccc_res __invoke_sip_fn_smc(unsigned long function_id, ++ unsigned long arg0, ++ unsigned long arg1, ++ unsigned long arg2) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); ++ ++ return res; ++} ++ ++int sip_smc_remotectl_config(u32 func, u32 data) ++{ ++ struct arm_smccc_res res; ++ ++ res = __invoke_sip_fn_smc(SIP_REMOTECTL_CFG, func, data, 0); ++ ++ return res.a0; ++} ++ ++int sip_smc_set_suspend_mode(u32 ctrl, u32 config1, u32 config2) ++{ ++ struct arm_smccc_res res; ++ ++ res = __invoke_sip_fn_smc(SIP_SUSPEND_MODE, ctrl, config1, config2); ++ return res.a0; ++} ++ ++int sip_smc_virtual_poweroff(void) ++{ ++ struct arm_smccc_res res; ++ ++ res = __invoke_sip_fn_smc(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND), 0, 0, 0); ++ return res.a0; ++} ++ ++static irqreturn_t rockchip_ir_recv_irq(int irq, void *dev_id) ++{ ++ int val; ++ struct rockchip_rc_dev *gpio_dev = dev_id; ++ struct device *pmdev = gpio_dev->pmdev; ++ ++ /* ++ * For some cpuidle systems, not all: ++ * Respond to interrupt taking more latency when cpu in idle. ++ * Invoke asynchronous pm runtime get from interrupt context, ++ * this may introduce a millisecond delay to call resume callback, ++ * where to disable cpuilde. ++ * ++ * Two issues lead to fail to decode first frame, one is latency to ++ * respond to interrupt, another is delay introduced by async api. ++ */ ++ if (pmdev) ++ pm_runtime_get(pmdev); ++ ++ val = gpiod_get_value(gpio_dev->gpiod); ++ if (val >= 0) ++ ir_raw_event_store_edge(gpio_dev->rcdev, val == 1); ++ ++ if (pmdev) { ++ pm_runtime_mark_last_busy(pmdev); ++ pm_runtime_put_autosuspend(pmdev); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static void rockchip_pwm_int_ctrl(struct rockchip_rc_dev *gpio_dev, bool enable) ++{ ++ ++ void __iomem *pwm_base = gpio_dev->pwm_base; ++ struct device *dev = &gpio_dev->rcdev->dev; ++ int pwm_id = gpio_dev->pwm_id; ++ ++ void __iomem *reg_int_ctrl; ++ int val; ++ ++ reg_int_ctrl= pwm_base - (0x10 * pwm_id) + PWM_REG_INT_EN; ++ ++ val = readl_relaxed(reg_int_ctrl); ++ ++ if (enable) { ++ val |= PWM_CH_INT_ENABLE(pwm_id); ++ dev_info(dev, "PWM interrupt enabled, register value %x\n", val); ++ } else { ++ val &= ~PWM_CH_INT_ENABLE(pwm_id); ++ dev_info(dev, "PWM interrupt disabled, register value %x\n", val); ++ } ++ ++ writel_relaxed(val, reg_int_ctrl); ++ ++} ++ ++static int rockchip_pwm_hw_init(struct rockchip_rc_dev *gpio_dev) ++{ ++ ++ void __iomem *pwm_base = gpio_dev->pwm_base; ++ int val; ++ ++ //1. disabled pwm ++ val = readl_relaxed(pwm_base + PWM_REG_CTRL); ++ val = (val & 0xFFFFFFFE) | PWM_DISABLE; ++ writel_relaxed(val, pwm_base + PWM_REG_CTRL); ++ ++ //2. capture mode ++ val = readl_relaxed(pwm_base + PWM_REG_CTRL); ++ val = (val & 0xFFFFFFF9) | PWM_MODE_CAPTURE; ++ writel_relaxed(val, pwm_base + PWM_REG_CTRL); ++ ++ //set clk div, clk div to 64 ++ val = readl_relaxed(pwm_base + PWM_REG_CTRL); ++ val = (val & 0xFF0001FF) | PWM_DIV64; ++ writel_relaxed(val, pwm_base + PWM_REG_CTRL); ++ ++ //4. enabled pwm int ++ rockchip_pwm_int_ctrl(gpio_dev, true); ++ ++ //5. enabled pwm ++ val = readl_relaxed(pwm_base + PWM_REG_CTRL); ++ val = (val & 0xFFFFFFFE) | PWM_ENABLE; ++ writel_relaxed(val, pwm_base + PWM_REG_CTRL); ++ ++ return 0; ++ ++} ++ ++static int rockchip_pwm_hw_stop(struct rockchip_rc_dev *gpio_dev) ++{ ++ ++ void __iomem *pwm_base = gpio_dev->pwm_base; ++ int val; ++ ++ //disable pwm interrupt ++ rockchip_pwm_int_ctrl(gpio_dev, false); ++ ++ //disable pwm ++ val = readl_relaxed(pwm_base + PWM_REG_CTRL); ++ val = (val & 0xFFFFFFFE) | PWM_DISABLE; ++ writel_relaxed(val, pwm_base + PWM_REG_CTRL); ++ ++ return 0; ++ ++} ++ ++static int rockchip_pwm_sip_wakeup_init(struct rockchip_rc_dev *gpio_dev) ++{ ++ ++ struct device *dev = &gpio_dev->rcdev->dev; ++ ++ struct irq_data *irq_data; ++ long hwirq; ++ int ret; ++ ++ irq_data = irq_get_irq_data(gpio_dev->pwm_wake_irq); ++ if (!irq_data) { ++ dev_err(dev, "could not get irq data\n"); ++ return -1; ++ } ++ ++ hwirq = irq_data->hwirq; ++ dev_info(dev, "use hwirq %ld, pwm chip id %d for PWM SIP wakeup\n", hwirq, gpio_dev->pwm_id); ++ ++ ret = 0; ++ ++ ret |= sip_smc_remotectl_config(REMOTECTL_SET_IRQ, (int)hwirq); ++ ret |= sip_smc_remotectl_config(REMOTECTL_SET_PWM_CH, gpio_dev->pwm_id); ++ ret |= sip_smc_remotectl_config(REMOTECTL_ENABLE, 1); ++ ++ if (ret) { ++ dev_err(dev, "SIP remote controller mode, TEE does not support feature\n"); ++ return ret; ++ } ++ ++ sip_smc_set_suspend_mode(SUSPEND_MODE_CONFIG, 0x10042, 0); ++ sip_smc_set_suspend_mode(WKUP_SOURCE_CONFIG, 0x0, 0); ++ sip_smc_set_suspend_mode(PWM_REGULATOR_CONFIG, 0x0, 0); ++ //sip_smc_set_suspend_mode(GPIO_POWER_CONFIG, i, gpio_temp[i]); ++ sip_smc_set_suspend_mode(SUSPEND_DEBUG_ENABLE, 0x1, 0); ++ sip_smc_set_suspend_mode(APIOS_SUSPEND_CONFIG, 0x0, 0); ++ sip_smc_set_suspend_mode(VIRTUAL_POWEROFF, 0, 1); ++ ++ dev_info(dev, "TEE remote controller wakeup installed\n"); ++ ++ return 0; ++ ++} ++ ++static int rockchip_ir_recv_remove(struct platform_device *pdev) ++{ ++ struct rockchip_rc_dev *gpio_dev = platform_get_drvdata(pdev); ++ struct device *pmdev = gpio_dev->pmdev; ++ ++ if (pmdev) { ++ pm_runtime_get_sync(pmdev); ++ cpu_latency_qos_remove_request(&gpio_dev->qos); ++ ++ pm_runtime_disable(pmdev); ++ pm_runtime_put_noidle(pmdev); ++ pm_runtime_set_suspended(pmdev); ++ } ++ ++ // Disable the remote controller handling of the Trust OS ++ sip_smc_remotectl_config(REMOTECTL_ENABLE, 0); ++ ++ // Disable the virtual poweroff of the Trust OS ++ sip_smc_set_suspend_mode(VIRTUAL_POWEROFF, 0, 0); ++ ++ return 0; ++} ++ ++static int rockchip_ir_register_power_key(struct device *dev) ++{ ++ ++ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev); ++ ++ struct rc_map *key_map; ++ struct rc_map_table *key; ++ int idx, key_scancode, rev_scancode; ++ int tee_scancode; ++ ++ key_map = &gpio_dev->rcdev->rc_map; ++ ++ dev_info(dev, "remote key table %s, key map of %d items\n", key_map->name, key_map->len); ++ ++ for (idx = 0; idx < key_map->len; idx++) { ++ ++ key = &key_map->scan[idx]; ++ ++ if (key->keycode != KEY_POWER) ++ continue; ++ ++ key_scancode = key->scancode; ++ rev_scancode = ~key_scancode; ++ ++ // If key_scancode has higher 16 bits set to 0, then the scancode is NEC protocol, otherwise it is NECX/NEC32 ++ if ((key_scancode & 0xffff) == key_scancode) ++ tee_scancode = (key_scancode & 0xff00) | ((rev_scancode & 0xff00) << 8); // NEC protocol ++ else ++ tee_scancode = ((key_scancode & 0xff0000) >> 8) | ((key_scancode & 0xff00) << 8); // NECX/NEC32 protocol ++ ++ tee_scancode |= rev_scancode & 0xff; ++ tee_scancode <<= 8; ++ ++ sip_smc_remotectl_config(REMOTECTL_SET_PWRKEY, tee_scancode); ++ ++ dev_info(dev, "registered scancode %08x (SIP: %8x)\n", key_scancode, tee_scancode); ++ ++ } ++ ++ return 0; ++ ++} ++ ++static int rockchip_ir_recv_suspend_prepare(struct device *dev) ++{ ++ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev); ++ int ret; ++ ++ dev_info(dev, "initialize rockchip SIP virtual poweroff\n"); ++ ret = rockchip_pwm_sip_wakeup_init(gpio_dev); ++ ++ if (ret) ++ return ret; ++ ++ rockchip_ir_register_power_key(dev); ++ ++ disable_irq(gpio_dev->irq); ++ dev_info(dev, "GPIO IRQ disabled\n"); ++ ++ ret = pinctrl_select_state(gpio_dev->pinctrl, gpio_dev->pinctrl_state_suspend); ++ if (ret) { ++ dev_err(dev, "unable to set pin in PWM mode\n"); ++ return ret; ++ } ++ ++ dev_info(dev, "set pin configuration to PWM mode\n"); ++ ++ rockchip_pwm_hw_init(gpio_dev); ++ dev_info(dev, "started pin PWM mode\n"); ++ ++ return 0; ++ ++} ++ ++#ifdef CONFIG_PM ++static int rockchip_ir_recv_suspend(struct device *dev) ++{ ++ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev); ++ ++ /* ++ * if property suspend-is-virtual-poweroff is set, we can disable ++ * the regular gpio wakeup and enable the PWM mode for the Trust OS ++ * to take control and react to remote control. ++ * If the property is not set, we instead enable the wake up for the ++ * regular gpio. ++ */ ++ if (gpio_dev->use_suspend_handler) { ++ ++ rockchip_ir_recv_suspend_prepare(dev); ++ ++ } else { ++ ++ if (device_may_wakeup(dev)) ++ enable_irq_wake(gpio_dev->irq); ++ else ++ disable_irq(gpio_dev->irq); ++ ++ } ++ ++ return 0; ++} ++ ++static int rockchip_ir_recv_resume(struct device *dev) ++{ ++ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev); ++ int ret; ++ ++ /* ++ * In case suspend-is-virtual-poweroff property is set, ++ * restore the pin from PWM mode to regular GPIO configuration ++ * and stop the PWM function. ++ * Otherwise, just enable the regular GPIO irq ++ */ ++ if (gpio_dev->use_suspend_handler) { ++ ++ rockchip_pwm_hw_stop(gpio_dev); ++ dev_info(dev, "stopped pin PWM mode\n"); ++ ++ ret = pinctrl_select_state(gpio_dev->pinctrl, gpio_dev->pinctrl_state_default); ++ if (ret) { ++ dev_err(dev, "unable to restore pin in GPIO mode\n"); ++ return ret; ++ } ++ dev_info(dev, "restored pin configuration di GPIO\n"); ++ ++ enable_irq(gpio_dev->irq); ++ dev_info(dev, "restored GPIO IRQ\n"); ++ ++ } else { ++ ++ if (device_may_wakeup(dev)) ++ disable_irq_wake(gpio_dev->irq); ++ else ++ enable_irq(gpio_dev->irq); ++ ++ } ++ ++ return 0; ++} ++ ++static void rockchip_ir_recv_shutdown(struct platform_device *pdev) ++{ ++ ++ struct device *dev = &pdev->dev; ++ struct rockchip_rc_dev *gpio_dev = dev_get_drvdata(dev); ++ ++ if (gpio_dev->use_shutdown_handler) ++ rockchip_ir_recv_suspend_prepare(dev); ++ ++ return; ++ ++} ++ ++static int rockchip_ir_recv_sys_off(struct sys_off_data *data) ++{ ++ ++ sip_smc_virtual_poweroff(); ++ ++ return 0; ++ ++} ++ ++static int rockchip_ir_recv_init_sip(void) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_SIP_VERSION, ROCKCHIP_SIP_IMPLEMENT_V2, SECURE_REG_WR, 0, 0, 0, 0, 0, &res); ++ ++ if (res.a0) ++ return 0; ++ ++ return res.a1; ++ ++} ++ ++static int rockchip_ir_recv_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct rockchip_rc_dev *gpio_dev; ++ struct rc_dev *rcdev; ++ struct clk *clk; ++ struct clk *p_clk; ++ struct resource *res; ++ u32 period = 0; ++ int rc; ++ int ret; ++ int pwm_wake_irq; ++ int clocks; ++ ++ if (!np) ++ return -ENODEV; ++ ++ gpio_dev = devm_kzalloc(dev, sizeof(*gpio_dev), GFP_KERNEL); ++ if (!gpio_dev) ++ return -ENOMEM; ++ ++ gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN); ++ if (IS_ERR(gpio_dev->gpiod)) { ++ rc = PTR_ERR(gpio_dev->gpiod); ++ /* Just try again if this happens */ ++ if (rc != -EPROBE_DEFER) ++ dev_err(dev, "error getting gpio (%d)\n", rc); ++ return rc; ++ } ++ gpio_dev->irq = gpiod_to_irq(gpio_dev->gpiod); ++ if (gpio_dev->irq < 0) ++ return gpio_dev->irq; ++ ++ rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW); ++ if (!rcdev) ++ return -ENOMEM; ++ ++ rcdev->priv = gpio_dev; ++ rcdev->device_name = ROCKCHIP_IR_DEVICE_NAME; ++ rcdev->input_phys = ROCKCHIP_IR_DEVICE_NAME "/input0"; ++ rcdev->input_id.bustype = BUS_HOST; ++ rcdev->input_id.vendor = 0x0001; ++ rcdev->input_id.product = 0x0001; ++ rcdev->input_id.version = 0x0100; ++ rcdev->dev.parent = dev; ++ rcdev->driver_name = KBUILD_MODNAME; ++ rcdev->min_timeout = 1; ++ rcdev->timeout = IR_DEFAULT_TIMEOUT; ++ rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; ++ rcdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; ++ rcdev->map_name = of_get_property(np, "linux,rc-map-name", NULL); ++ if (!rcdev->map_name) ++ rcdev->map_name = RC_MAP_EMPTY; ++ ++ gpio_dev->rcdev = rcdev; ++ if (of_property_read_bool(np, "wakeup-source")) { ++ ++ ret = device_init_wakeup(dev, true); ++ ++ if (ret) ++ dev_err(dev, "could not init wakeup device\n"); ++ ++ } ++ ++ rc = devm_rc_register_device(dev, rcdev); ++ if (rc < 0) { ++ dev_err(dev, "failed to register rc device (%d)\n", rc); ++ return rc; ++ } ++ ++ of_property_read_u32(np, "linux,autosuspend-period", &period); ++ if (period) { ++ gpio_dev->pmdev = dev; ++ pm_runtime_set_autosuspend_delay(dev, period); ++ pm_runtime_use_autosuspend(dev); ++ pm_runtime_set_suspended(dev); ++ pm_runtime_enable(dev); ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ dev_err(dev, "no memory resources defined\n"); ++ return -ENODEV; ++ } ++ ++ gpio_dev->pwm_base = devm_ioremap_resource(dev, res); ++ if (IS_ERR(gpio_dev->pwm_base)) ++ return PTR_ERR(gpio_dev->pwm_base); ++ ++ clocks = of_property_count_strings(np, "clock-names"); ++ if (clocks == 2) { ++ clk = devm_clk_get(dev, "pwm"); ++ p_clk = devm_clk_get(dev, "pclk"); ++ } else { ++ clk = devm_clk_get(dev, NULL); ++ p_clk = clk; ++ } ++ ++ if (IS_ERR(clk)) { ++ ret = PTR_ERR(clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Can't get bus clock: %d\n", ret); ++ return ret; ++ } ++ ++ if (IS_ERR(p_clk)) { ++ ret = PTR_ERR(p_clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(dev, "Can't get peripheral clock: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(clk); ++ if (ret) { ++ dev_err(dev, "Can't enable bus clk: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(p_clk); ++ if (ret) { ++ dev_err(dev, "Can't enable peripheral clk: %d\n", ret); ++ goto error_clk; ++ } ++ ++ pwm_wake_irq = platform_get_irq(pdev, 0); ++ if (pwm_wake_irq < 0) { ++ dev_err(&pdev->dev, "cannot find PWM wake interrupt\n"); ++ goto error_pclk; ++ } ++ ++ gpio_dev->pwm_wake_irq = pwm_wake_irq; ++ ret = enable_irq_wake(pwm_wake_irq); ++ if (ret) { ++ dev_err(dev, "could not enable IRQ wakeup\n"); ++ } ++ ++ ret = of_property_read_u32(np, "pwm-id", &gpio_dev->pwm_id); ++ if (ret) { ++ dev_err(dev, "missing pwm-id property\n"); ++ goto error_pclk; ++ } ++ ++ if (gpio_dev->pwm_id > 3) { ++ dev_err(dev, "invalid pwm-id property\n"); ++ goto error_pclk; ++ } ++ ++ gpio_dev->use_shutdown_handler = of_property_read_bool(np, "shutdown-is-virtual-poweroff"); ++ gpio_dev->use_suspend_handler = of_property_read_bool(np, "suspend-is-virtual-poweroff"); ++ ++ gpio_dev->pinctrl = devm_pinctrl_get(dev); ++ if (IS_ERR(gpio_dev->pinctrl)) { ++ dev_err(dev, "Unable to get pinctrl\n"); ++ goto error_pclk; ++ } ++ ++ gpio_dev->pinctrl_state_default = pinctrl_lookup_state(gpio_dev->pinctrl, "default"); ++ if (IS_ERR(gpio_dev->pinctrl_state_default)) { ++ dev_err(dev, "Unable to get default pinctrl state\n"); ++ goto error_pclk; ++ } ++ ++ gpio_dev->pinctrl_state_suspend = pinctrl_lookup_state(gpio_dev->pinctrl, "suspend"); ++ if (IS_ERR(gpio_dev->pinctrl_state_suspend)) { ++ dev_err(dev, "Unable to get suspend pinctrl state\n"); ++ goto error_pclk; ++ } ++ ++ platform_set_drvdata(pdev, gpio_dev); ++ ++ ret = devm_request_irq(dev, gpio_dev->irq, rockchip_ir_recv_irq, ++ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, ++ "gpio-ir-recv-irq", gpio_dev); ++ if (ret) { ++ dev_err(dev, "Can't request GPIO interrupt\n"); ++ goto error_pclk; ++ } ++ ++ if (gpio_dev->use_shutdown_handler) { ++ ++ ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF, ++ SYS_OFF_PRIO_FIRMWARE, rockchip_ir_recv_sys_off, NULL); ++ ++ if (ret) ++ dev_err(dev, "could not register sys_off handler\n"); ++ ++ } ++ ++ ret = rockchip_ir_recv_init_sip(); ++ if (!ret) { ++ dev_err(dev, "Unable to initialize Rockchip SIP v2, virtual poweroff unavailable\n"); ++ gpio_dev->use_shutdown_handler = false; ++ gpio_dev->use_suspend_handler = false; ++ } else { ++ dev_info(dev, "rockchip SIP initialized, version 0x%x\n", ret); ++ } ++ ++ return 0; ++ ++error_pclk: ++ clk_unprepare(p_clk); ++error_clk: ++ clk_unprepare(clk); ++ ++ return -ENODEV; ++ ++} ++ ++static const struct dev_pm_ops rockchip_ir_recv_pm_ops = { ++ .suspend = rockchip_ir_recv_suspend, ++ .resume = rockchip_ir_recv_resume, ++}; ++#endif ++ ++static const struct of_device_id rockchip_ir_recv_of_match[] = { ++ { .compatible = "rockchip-ir-receiver", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rockchip_ir_recv_of_match); ++ ++static struct platform_driver rockchip_ir_recv_driver = { ++ .probe = rockchip_ir_recv_probe, ++ .remove = rockchip_ir_recv_remove, ++ .shutdown = rockchip_ir_recv_shutdown, ++ .driver = { ++ .name = KBUILD_MODNAME, ++ .of_match_table = of_match_ptr(rockchip_ir_recv_of_match), ++#ifdef CONFIG_PM ++ .pm = &rockchip_ir_recv_pm_ops, ++#endif ++ }, ++}; ++module_platform_driver(rockchip_ir_recv_driver); ++ ++MODULE_DESCRIPTION("Rockchip IR Receiver driver"); ++MODULE_LICENSE("GPL v2"); + + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/general-rockchip-various-fixes.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-rockchip-various-fixes.patch new file mode 100644 index 000000000000..206f44442540 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/general-rockchip-various-fixes.patch @@ -0,0 +1,770 @@ +From 92a42b2df843c0f6c2937dc6bdbfe72332c9e557 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Thu, 9 Sep 2021 16:46:33 +0000 +Subject: [PATCH 3/4] 01-linux-1000-rockchip-wip + +--- + arch/arm/boot/dts/rockchip/rk322x.dtsi | 101 +++++++++++++++++- + arch/arm/boot/dts/rockchip/rk3xxx.dtsi | 2 + + drivers/clk/rockchip/clk-rk3228.c | 61 ++++------- + drivers/net/ethernet/arc/emac.h | 14 +++ + drivers/net/ethernet/arc/emac_main.c | 81 ++++++++++++-- + drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 38 ++++++- + drivers/pmdomain/rockchip/pm-domains.c | 23 ++++ + drivers/usb/dwc2/core.c | 2 +- + 8 files changed, 266 insertions(+), 56 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index 831561fc1814..24e963b01d87 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -19,6 +19,7 @@ aliases { + gpio1 = &gpio1; + gpio2 = &gpio2; + gpio3 = &gpio3; ++ ethernet0 = &gmac; + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; +@@ -105,6 +106,22 @@ arm-pmu { + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + ++ hdmi_sound: hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "hdmi-sound"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ status = "disabled"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s0>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ + psci { + compatible = "arm,psci-1.0", "arm,psci-0.2"; + method = "smc"; +@@ -132,6 +149,17 @@ display_subsystem: display-subsystem { + ports = <&vop_out>; + }; + ++ crypto: cypto-controller@100a0000 { ++ compatible = "rockchip,rk3288-crypto"; ++ reg = <0x100a0000 0x4000>; ++ interrupts = ; ++ clocks = <&cru HCLK_M_CRYPTO>, <&cru HCLK_S_CRYPTO>, ++ <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC>; ++ clock-names = "aclk", "hclk", "sclk", "apb_pclk"; ++ resets = <&cru SRST_CRYPTO>; ++ reset-names = "crypto-rst"; ++ }; ++ + i2s1: i2s1@100b0000 { + compatible = "rockchip,rk3228-i2s", "rockchip,rk3066-i2s"; + reg = <0x100b0000 0x4000>; +@@ -142,6 +170,7 @@ i2s1: i2s1@100b0000 { + dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1_bus>; ++ #sound-dai-cells = <0>; + status = "disabled"; + }; + +@@ -153,6 +182,7 @@ i2s0: i2s0@100c0000 { + clocks = <&cru SCLK_I2S0>, <&cru HCLK_I2S0_8CH>; + dmas = <&pdma 11>, <&pdma 12>; + dma-names = "tx", "rx"; ++ #sound-dai-cells = <0>; + status = "disabled"; + }; + +@@ -166,6 +196,7 @@ spdif: spdif@100d0000 { + dma-names = "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&spdif_tx>; ++ #sound-dai-cells = <0>; + status = "disabled"; + }; + +@@ -337,7 +368,7 @@ uart2: serial@11030000 { + clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>; + clock-names = "baudclk", "apb_pclk"; + pinctrl-names = "default"; +- pinctrl-0 = <&uart2_xfer>; ++ pinctrl-0 = <&uart21_xfer>; + reg-shift = <2>; + reg-io-width = <4>; + status = "disabled"; +@@ -358,6 +389,10 @@ efuse_id: id@7 { + cpu_leakage: cpu_leakage@17 { + reg = <0x17 0x1>; + }; ++ hdmi_phy_flag: hdmi-phy-flag@1d { ++ reg = <0x1d 0x1>; ++ bits = <1 1>; ++ }; + }; + + i2c0: i2c@11050000 { +@@ -554,6 +589,11 @@ map1 { + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; ++ map2 { ++ trip = <&cpu_alert1>; ++ cooling-device = ++ <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; + }; + }; + }; +@@ -584,6 +624,8 @@ hdmi_phy: hdmi-phy@12030000 { + clock-names = "sysclk", "refoclk", "refpclk"; + #clock-cells = <0>; + clock-output-names = "hdmiphy_phy"; ++ nvmem-cells = <&hdmi_phy_flag>; ++ nvmem-cell-names = "hdmi-phy-flag"; + #phy-cells = <0>; + status = "disabled"; + }; +@@ -607,7 +649,27 @@ gpu: gpu@20000000 { + clock-names = "bus", "core"; + power-domains = <&power RK3228_PD_GPU>; + resets = <&cru SRST_GPU_A>; +- status = "disabled"; ++ operating-points-v2 = <&gpu_opp_table>; ++ #cooling-cells = <2>; /* min followed by max */ ++ }; ++ ++ gpu_opp_table: opp-table2 { ++ compatible = "operating-points-v2"; ++ ++ opp-200000000 { ++ opp-hz = /bits/ 64 <200000000>; ++ opp-microvolt = <1050000>; ++ }; ++ ++ opp-300000000 { ++ opp-hz = /bits/ 64 <300000000>; ++ opp-microvolt = <1050000>; ++ }; ++ ++ opp-500000000 { ++ opp-hz = /bits/ 64 <500000000>; ++ opp-microvolt = <1150000>; ++ }; + }; + + vpu: video-codec@20020000 { +@@ -727,6 +789,7 @@ hdmi: hdmi@200a0000 { + phys = <&hdmi_phy>; + phy-names = "hdmi"; + rockchip,grf = <&grf>; ++ #sound-dai-cells = <0>; + status = "disabled"; + + ports { +@@ -748,9 +811,13 @@ sdmmc: mmc@30000000 { + clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, + <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; ++ bus-width = <4>; + fifo-depth = <0x100>; ++ max-frequency = <150000000>; + pinctrl-names = "default"; +- pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4 &sdmmc_pwr>; ++ resets = <&cru SRST_SDMMC>; ++ reset-names = "reset"; + status = "disabled"; + }; + +@@ -760,10 +827,14 @@ sdio: mmc@30010000 { + interrupts = ; + clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>, + <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>; ++ bus-width = <4>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; ++ max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio_clk &sdio_cmd &sdio_bus4>; ++ resets = <&cru SRST_SDIO>; ++ reset-names = "reset"; + status = "disabled"; + }; + +@@ -771,14 +842,13 @@ emmc: mmc@30020000 { + compatible = "rockchip,rk3228-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x30020000 0x4000>; + interrupts = ; +- clock-frequency = <37500000>; +- max-frequency = <37500000>; + clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, + <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + bus-width = <8>; + rockchip,default-sample-phase = <158>; + fifo-depth = <0x100>; ++ max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; + resets = <&cru SRST_EMMC>; +@@ -1029,6 +1099,10 @@ sdmmc_bus4: sdmmc-bus4 { + <1 RK_PC4 1 &pcfg_pull_none_drv_12ma>, + <1 RK_PC5 1 &pcfg_pull_none_drv_12ma>; + }; ++ ++ sdmmc_pwr: sdmmc-pwr { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + sdio { +@@ -1261,13 +1335,30 @@ uart1_xfer: uart1-xfer { + <1 RK_PB2 1 &pcfg_pull_none>; + }; + ++ uart11_xfer: uart11-xfer { ++ rockchip,pins = <3 RK_PB6 1 &pcfg_pull_up>, ++ <3 RK_PB5 1 &pcfg_pull_none>; ++ }; ++ + uart1_cts: uart1-cts { + rockchip,pins = <1 RK_PB0 1 &pcfg_pull_none>; + }; + ++ uart11_cts: uart11-cts { ++ rockchip,pins = <3 RK_PA7 1 &pcfg_pull_none>; ++ }; ++ + uart1_rts: uart1-rts { + rockchip,pins = <1 RK_PB3 1 &pcfg_pull_none>; + }; ++ ++ uart11_rts: uart11-rts { ++ rockchip,pins = <3 RK_PA6 1 &pcfg_pull_none>; ++ }; ++ ++ uart11_rts_gpio: uart11-rts-gpio { ++ rockchip,pins = <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + uart2 { +diff --git a/arch/arm/boot/dts/rockchip/rk3xxx.dtsi b/arch/arm/boot/dts/rockchip/rk3xxx.dtsi +index 616a828e0..f233b7a77 100644 +--- a/arch/arm/boot/dts/rockchip/rk3xxx.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3xxx.dtsi +@@ -64,6 +64,8 @@ L2: cache-controller@10138000 { + reg = <0x10138000 0x1000>; + cache-unified; + cache-level = <2>; ++ prefetch-data = <1>; ++ prefetch-instr = <1>; + }; + + scu@1013c000 { +diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c +index aca1a483a..7250adc64 100644 +--- a/drivers/clk/rockchip/clk-rk3228.c ++++ b/drivers/clk/rockchip/clk-rk3228.c +@@ -135,24 +135,22 @@ static const struct rockchip_cpuclk_reg_data rk3228_cpuclk_data = { + + PNAME(mux_pll_p) = { "clk_24m", "xin24m" }; + +-PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr", "apll_ddr" }; ++PNAME(mux_ddrphy_p) = { "dpll", "gpll", "apll" }; + PNAME(mux_armclk_p) = { "apll_core", "gpll_core", "dpll_core" }; + PNAME(mux_usb480m_phy_p) = { "usb480m_phy0", "usb480m_phy1" }; + PNAME(mux_usb480m_p) = { "usb480m_phy", "xin24m" }; + PNAME(mux_hdmiphy_p) = { "hdmiphy_phy", "xin24m" }; +-PNAME(mux_aclk_cpu_src_p) = { "cpll_aclk_cpu", "gpll_aclk_cpu", "hdmiphy_aclk_cpu" }; + + PNAME(mux_pll_src_4plls_p) = { "cpll", "gpll", "hdmiphy", "usb480m" }; + PNAME(mux_pll_src_3plls_p) = { "cpll", "gpll", "hdmiphy" }; + PNAME(mux_pll_src_2plls_p) = { "cpll", "gpll" }; + PNAME(mux_sclk_hdmi_cec_p) = { "cpll", "gpll", "xin24m" }; +-PNAME(mux_aclk_peri_src_p) = { "cpll_peri", "gpll_peri", "hdmiphy_peri" }; + PNAME(mux_mmc_src_p) = { "cpll", "gpll", "xin24m", "usb480m" }; + PNAME(mux_pll_src_cpll_gpll_usb480m_p) = { "cpll", "gpll", "usb480m" }; + + PNAME(mux_sclk_rga_p) = { "gpll", "cpll", "sclk_rga_src" }; + +-PNAME(mux_sclk_vop_src_p) = { "gpll_vop", "cpll_vop" }; ++PNAME(mux_sclk_vop_src_p) = { "gpll", "cpll" }; + PNAME(mux_dclk_vop_p) = { "hdmiphy", "sclk_vop_pre" }; + + PNAME(mux_i2s0_p) = { "i2s0_src", "i2s0_frac", "ext_i2s", "xin12m" }; +@@ -221,27 +219,23 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_CLKSEL_CON(4), 8, 5, DFLAGS), + + /* PD_DDR */ +- GATE(0, "apll_ddr", "apll", CLK_IGNORE_UNUSED, ++ COMPOSITE(0, "clk_ddrphy_src", mux_ddrphy_p, CLK_IGNORE_UNUSED, ++ RK2928_CLKSEL_CON(26), 8, 2, MFLAGS, 0, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, + RK2928_CLKGATE_CON(0), 2, GFLAGS), +- GATE(0, "dpll_ddr", "dpll", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(0), 2, GFLAGS), +- GATE(0, "gpll_ddr", "gpll", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(0), 2, GFLAGS), +- COMPOSITE(0, "ddrphy4x", mux_ddrphy_p, CLK_IGNORE_UNUSED, +- RK2928_CLKSEL_CON(26), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, ++ GATE(0, "ddrphy4x", "clk_ddrphy_src", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(7), 1, GFLAGS), +- GATE(0, "ddrc", "ddrphy_pre", CLK_IGNORE_UNUSED, ++ FACTOR_GATE(0, "ddrc", "clk_ddrphy_src", CLK_IGNORE_UNUSED, 1, 4, + RK2928_CLKGATE_CON(8), 5, GFLAGS), +- FACTOR_GATE(0, "ddrphy", "ddrphy4x", CLK_IGNORE_UNUSED, 1, 4, ++ FACTOR_GATE(0, "ddrphy", "clk_ddrphy_src", CLK_IGNORE_UNUSED, 1, 4, + RK2928_CLKGATE_CON(7), 0, GFLAGS), + + /* PD_CORE */ +- GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(0), 6, GFLAGS), + GATE(0, "apll_core", "apll", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(0), 6, GFLAGS), + GATE(0, "gpll_core", "gpll", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(0), 6, GFLAGS), ++ GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED, ++ RK2928_CLKGATE_CON(0), 6, GFLAGS), + COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IGNORE_UNUSED, + RK2928_CLKSEL_CON(1), 0, 4, DFLAGS | CLK_DIVIDER_READ_ONLY, + RK2928_CLKGATE_CON(4), 1, GFLAGS), +@@ -258,14 +252,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_MISC_CON, 15, 1, MFLAGS), + + /* PD_BUS */ +- GATE(0, "hdmiphy_aclk_cpu", "hdmiphy", CLK_IGNORE_UNUSED, ++ COMPOSITE(0, "aclk_cpu_src", mux_pll_src_3plls_p, 0, ++ RK2928_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS, + RK2928_CLKGATE_CON(0), 1, GFLAGS), +- GATE(0, "gpll_aclk_cpu", "gpll", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(0), 1, GFLAGS), +- GATE(0, "cpll_aclk_cpu", "cpll", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(0), 1, GFLAGS), +- COMPOSITE_NOGATE(0, "aclk_cpu_src", mux_aclk_cpu_src_p, 0, +- RK2928_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS), + GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_src", 0, + RK2928_CLKGATE_CON(6), 0, GFLAGS), + COMPOSITE_NOMUX(HCLK_CPU, "hclk_cpu", "aclk_cpu_src", 0, +@@ -338,14 +327,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_CLKGATE_CON(3), 8, GFLAGS), + + /* PD_PERI */ +- GATE(0, "cpll_peri", "cpll", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(2), 0, GFLAGS), +- GATE(0, "gpll_peri", "gpll", CLK_IGNORE_UNUSED, ++ COMPOSITE(0, "aclk_peri_src", mux_pll_src_3plls_p, 0, ++ RK2928_CLKSEL_CON(10), 10, 2, MFLAGS, 0, 5, DFLAGS, + RK2928_CLKGATE_CON(2), 0, GFLAGS), +- GATE(0, "hdmiphy_peri", "hdmiphy", CLK_IGNORE_UNUSED, +- RK2928_CLKGATE_CON(2), 0, GFLAGS), +- COMPOSITE_NOGATE(0, "aclk_peri_src", mux_aclk_peri_src_p, 0, +- RK2928_CLKSEL_CON(10), 10, 2, MFLAGS, 0, 5, DFLAGS), + COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_src", 0, + RK2928_CLKSEL_CON(10), 12, 3, DFLAGS, + RK2928_CLKGATE_CON(5), 2, GFLAGS), +@@ -380,7 +364,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_CLKGATE_CON(10), 12, GFLAGS), + + COMPOSITE(SCLK_WIFI, "sclk_wifi", mux_pll_src_cpll_gpll_usb480m_p, 0, +- RK2928_CLKSEL_CON(23), 5, 2, MFLAGS, 0, 6, DFLAGS, ++ RK2928_CLKSEL_CON(23), 5, 2, MFLAGS, 0, 5, DFLAGS, + RK2928_CLKGATE_CON(2), 15, GFLAGS), + + COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, +@@ -403,12 +387,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + * Clock-Architecture Diagram 2 + */ + +- GATE(0, "gpll_vop", "gpll", 0, +- RK2928_CLKGATE_CON(3), 1, GFLAGS), +- GATE(0, "cpll_vop", "cpll", 0, ++ COMPOSITE_NODIV(0, "sclk_vop_src", mux_sclk_vop_src_p, 0, ++ RK2928_CLKSEL_CON(27), 0, 1, MFLAGS, + RK2928_CLKGATE_CON(3), 1, GFLAGS), +- MUX(0, "sclk_vop_src", mux_sclk_vop_src_p, 0, +- RK2928_CLKSEL_CON(27), 0, 1, MFLAGS), + DIV(DCLK_HDMI_PHY, "dclk_hdmiphy", "sclk_vop_src", 0, + RK2928_CLKSEL_CON(29), 0, 3, DFLAGS), + DIV(0, "sclk_vop_pre", "sclk_vop_src", 0, +@@ -640,13 +621,13 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + + /* PD_MMC */ + MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3228_SDMMC_CON0, 1), +- MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 0), ++ MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 1), + + MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio", RK3228_SDIO_CON0, 1), +- MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", RK3228_SDIO_CON1, 0), ++ MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", RK3228_SDIO_CON1, 1), + + MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc", RK3228_EMMC_CON0, 1), +- MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3228_EMMC_CON1, 0), ++ MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3228_EMMC_CON1, 1), + }; + + static const char *const rk3228_critical_clocks[] __initconst = { +@@ -661,6 +642,7 @@ static const char *const rk3228_critical_clocks[] __initconst = { + "aclk_vop_noc", + "aclk_hdcp_noc", + "hclk_vio_ahb_arbi", ++ "hclk_vio_h2p", + "hclk_vio_noc", + "hclk_vop_noc", + "hclk_host0_arb", +@@ -678,10 +660,13 @@ static const char *const rk3228_critical_clocks[] __initconst = { + "pclk_ddrphy", + "pclk_acodecphy", + "pclk_phy_noc", ++ "pclk_vio_h2p", + "aclk_vpu_noc", + "aclk_rkvdec_noc", ++ "aclk_rkvdec", + "hclk_vpu_noc", + "hclk_rkvdec_noc", ++ "hclk_rkvdec", + }; + + static void __init rk3228_clk_init(struct device_node *np) +diff --git a/drivers/net/ethernet/arc/emac.h b/drivers/net/ethernet/arc/emac.h +index d820ae03a..0ac87288b 100644 +--- a/drivers/net/ethernet/arc/emac.h ++++ b/drivers/net/ethernet/arc/emac.h +@@ -91,6 +91,20 @@ struct arc_emac_bd { + #define RX_RING_SZ (RX_BD_NUM * sizeof(struct arc_emac_bd)) + #define TX_RING_SZ (TX_BD_NUM * sizeof(struct arc_emac_bd)) + ++/* PHY fixups */ ++#define RTL_8201F_PHY_ID 0x001cc816 ++ ++#define RTL_8201F_PG_SELECT_REG 0x1f ++#define RTL_8201F_PG4_EEE_REG 0x10 ++#define RTL_8201F_PG4_EEE_RX_QUIET_EN BIT(8) ++#define RTL_8201F_PG4_EEE_TX_QUIET_EN BIT(9) ++#define RTL_8201F_PG4_EEE_NWAY_EN BIT(12) ++#define RTL_8201F_PG4_EEE_10M_CAP BIT(13) ++#define RTL_8201F_PG7_RMSR_REG 0x10 ++#define RTL_8201F_PG7_RMSR_CLK_DIR_IN BIT(12) ++#define RTL_8201F_PG0_PSMR_REG 0x18 ++#define RTL_8201F_PG0_PSMR_PWRSVE_EN BIT(15) ++ + /** + * struct buffer_state - Stores Rx/Tx buffer state. + * @sk_buff: Pointer to socket buffer. +diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c +index 67b8113a2..40332a976 100644 +--- a/drivers/net/ethernet/arc/emac_main.c ++++ b/drivers/net/ethernet/arc/emac_main.c +@@ -140,7 +140,7 @@ static void arc_emac_tx_clean(struct net_device *ndev) + stats->tx_bytes += skb->len; + } + +- dma_unmap_single(&ndev->dev, dma_unmap_addr(tx_buff, addr), ++ dma_unmap_single(ndev->dev.parent, dma_unmap_addr(tx_buff, addr), + dma_unmap_len(tx_buff, len), DMA_TO_DEVICE); + + /* return the sk_buff to system */ +@@ -223,9 +223,9 @@ static int arc_emac_rx(struct net_device *ndev, int budget) + continue; + } + +- addr = dma_map_single(&ndev->dev, (void *)skb->data, ++ addr = dma_map_single(ndev->dev.parent, (void *)skb->data, + EMAC_BUFFER_SIZE, DMA_FROM_DEVICE); +- if (dma_mapping_error(&ndev->dev, addr)) { ++ if (dma_mapping_error(ndev->dev.parent, addr)) { + if (net_ratelimit()) + netdev_err(ndev, "cannot map dma buffer\n"); + dev_kfree_skb(skb); +@@ -237,7 +237,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget) + } + + /* unmap previosly mapped skb */ +- dma_unmap_single(&ndev->dev, dma_unmap_addr(rx_buff, addr), ++ dma_unmap_single(ndev->dev.parent, dma_unmap_addr(rx_buff, addr), + dma_unmap_len(rx_buff, len), DMA_FROM_DEVICE); + + pktlen = info & LEN_MASK; +@@ -445,9 +445,9 @@ static int arc_emac_open(struct net_device *ndev) + if (unlikely(!rx_buff->skb)) + return -ENOMEM; + +- addr = dma_map_single(&ndev->dev, (void *)rx_buff->skb->data, ++ addr = dma_map_single(ndev->dev.parent, (void *)rx_buff->skb->data, + EMAC_BUFFER_SIZE, DMA_FROM_DEVICE); +- if (dma_mapping_error(&ndev->dev, addr)) { ++ if (dma_mapping_error(ndev->dev.parent, addr)) { + netdev_err(ndev, "cannot dma map\n"); + dev_kfree_skb(rx_buff->skb); + return -ENOMEM; +@@ -555,7 +555,7 @@ static void arc_free_tx_queue(struct net_device *ndev) + struct buffer_state *tx_buff = &priv->tx_buff[i]; + + if (tx_buff->skb) { +- dma_unmap_single(&ndev->dev, ++ dma_unmap_single(ndev->dev.parent, + dma_unmap_addr(tx_buff, addr), + dma_unmap_len(tx_buff, len), + DMA_TO_DEVICE); +@@ -586,7 +586,7 @@ static void arc_free_rx_queue(struct net_device *ndev) + struct buffer_state *rx_buff = &priv->rx_buff[i]; + + if (rx_buff->skb) { +- dma_unmap_single(&ndev->dev, ++ dma_unmap_single(ndev->dev.parent, + dma_unmap_addr(rx_buff, addr), + dma_unmap_len(rx_buff, len), + DMA_FROM_DEVICE); +@@ -692,10 +692,10 @@ static netdev_tx_t arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) + return NETDEV_TX_BUSY; + } + +- addr = dma_map_single(&ndev->dev, (void *)skb->data, len, ++ addr = dma_map_single(ndev->dev.parent, (void *)skb->data, len, + DMA_TO_DEVICE); + +- if (unlikely(dma_mapping_error(&ndev->dev, addr))) { ++ if (unlikely(dma_mapping_error(ndev->dev.parent, addr))) { + stats->tx_dropped++; + stats->tx_errors++; + dev_kfree_skb_any(skb); +@@ -850,6 +850,62 @@ static const struct net_device_ops arc_emac_netdev_ops = { + #endif + }; + ++/** ++ * arc_emac_rtl8201f_phy_fixup ++ * @phydev: Pointer to phy_device structure. ++ * ++ * This function registers a fixup in case RTL8201F's phy ++ * clockout is used as reference for the mac interface ++ * and disable EEE, since emac can't handle it ++ */ ++static int arc_emac_rtl8201f_phy_fixup(struct phy_device *phydev) ++{ ++ unsigned int reg, curr_pg; ++ int err = 0; ++ ++ curr_pg = phy_read(phydev, RTL_8201F_PG_SELECT_REG); ++ err = phy_write(phydev, RTL_8201F_PG_SELECT_REG, 4); ++ if (err) ++ goto out_err; ++ mdelay(10); ++ ++ /* disable EEE */ ++ reg = phy_read(phydev, RTL_8201F_PG4_EEE_REG); ++ reg &= ~RTL_8201F_PG4_EEE_RX_QUIET_EN & ++ ~RTL_8201F_PG4_EEE_TX_QUIET_EN & ++ ~RTL_8201F_PG4_EEE_NWAY_EN & ++ ~RTL_8201F_PG4_EEE_10M_CAP; ++ err = phy_write(phydev, RTL_8201F_PG4_EEE_REG, reg); ++ if (err) ++ goto out_err; ++ ++ if (phydev->interface == PHY_INTERFACE_MODE_RMII) { ++ err = phy_write(phydev, RTL_8201F_PG_SELECT_REG, 7); ++ if (err) ++ goto out_err; ++ mdelay(10); ++ ++ reg = phy_read(phydev, RTL_8201F_PG7_RMSR_REG); ++ err = phy_write(phydev, RTL_8201F_PG_SELECT_REG, 0); ++ if (err) ++ goto out_err; ++ mdelay(10); ++ ++ if (!(reg & RTL_8201F_PG7_RMSR_CLK_DIR_IN)) { ++ /* disable powersave if phy's clock output is used */ ++ reg = phy_read(phydev, RTL_8201F_PG0_PSMR_REG); ++ reg &= ~RTL_8201F_PG0_PSMR_PWRSVE_EN & 0xffff; ++ err = phy_write(phydev, RTL_8201F_PG0_PSMR_REG, reg); ++ } ++ } ++ ++out_err: ++ phy_write(phydev, RTL_8201F_PG_SELECT_REG, curr_pg); ++ mdelay(10); ++ ++ return err; ++}; ++ + int arc_emac_probe(struct net_device *ndev, int interface) + { + struct device *dev = ndev->dev.parent; +@@ -970,6 +1026,11 @@ int arc_emac_probe(struct net_device *ndev, int interface) + goto out_clken; + } + ++ err = phy_register_fixup_for_uid(RTL_8201F_PHY_ID, 0xfffff0, ++ arc_emac_rtl8201f_phy_fixup); ++ if (err) ++ dev_warn(dev, "Cannot register PHY board fixup.\n"); ++ + phydev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0, + interface); + if (!phydev) { +diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +index 1889e78e1..6209f51b3 100644 +--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +@@ -237,6 +237,9 @@ struct inno_hdmi_phy { + struct clk *refoclk; + struct clk *refpclk; + ++ /* phy_flag flag */ ++ bool phy_flag; ++ + /* platform data */ + const struct inno_hdmi_phy_drv_data *plat_data; + int chip_version; +@@ -471,6 +474,7 @@ static const struct pre_pll_config pre_pll_cfg_table[] = { + static const struct post_pll_config post_pll_cfg_table[] = { + {33750000, 1, 40, 8, 1}, + {33750000, 1, 80, 8, 2}, ++ {33750000, 1, 10, 2, 4}, + {74250000, 1, 40, 8, 1}, + {74250000, 18, 80, 8, 2}, + {148500000, 2, 40, 4, 3}, +@@ -621,8 +625,11 @@ static int inno_hdmi_phy_power_on(struct phy *phy) + return -EINVAL; + + for (; cfg->tmdsclock != 0; cfg++) +- if (tmdsclock <= cfg->tmdsclock && +- cfg->version & inno->chip_version) ++ if (((!inno->phy_flag || tmdsclock > 33750000) ++ && tmdsclock <= cfg->tmdsclock ++ && cfg->version & inno->chip_version) || ++ (inno->phy_flag && tmdsclock <= 33750000 ++ && cfg->version & 4)) + break; + + for (; phy_cfg->tmdsclock != 0; phy_cfg++) +@@ -1033,6 +1040,10 @@ static int inno_hdmi_phy_clk_register(struct inno_hdmi_phy *inno) + + static int inno_hdmi_phy_rk3228_init(struct inno_hdmi_phy *inno) + { ++ struct nvmem_cell *cell; ++ unsigned char *efuse_buf; ++ size_t len; ++ + /* + * Use phy internal register control + * rxsense/poweron/pllpd/pdataen signal. +@@ -1047,7 +1058,28 @@ static int inno_hdmi_phy_rk3228_init(struct inno_hdmi_phy *inno) + inno_update_bits(inno, 0xaa, RK3228_POST_PLL_CTRL_MANUAL, + RK3228_POST_PLL_CTRL_MANUAL); + ++ + inno->chip_version = 1; ++ inno->phy_flag = false; ++ ++ cell = nvmem_cell_get(inno->dev, "hdmi-phy-flag"); ++ if (IS_ERR(cell)) { ++ if (PTR_ERR(cell) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ ++ return 0; ++ } ++ ++ efuse_buf = nvmem_cell_read(cell, &len); ++ nvmem_cell_put(cell); ++ ++ if (IS_ERR(efuse_buf)) ++ return 0; ++ if (len == 1) ++ inno->phy_flag = (efuse_buf[0] & BIT(1)) ? true : false; ++ kfree(efuse_buf); ++ ++ dev_info(inno->dev, "phy_flag is: %d\n", inno->phy_flag); + + return 0; + } +@@ -1147,6 +1179,8 @@ static int inno_hdmi_phy_rk3328_init(struct inno_hdmi_phy *inno) + + /* try to read the chip-version */ + inno->chip_version = 1; ++ inno->phy_flag = false; ++ + cell = nvmem_cell_get(inno->dev, "cpu-version"); + if (IS_ERR(cell)) { + if (PTR_ERR(cell) == -EPROBE_DEFER) +diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c +index fddb4022c..9583c76b4 100644 +--- a/drivers/pmdomain/rockchip/pm-domains.c ++++ b/drivers/pmdomain/rockchip/pm-domains.c +@@ -73,6 +73,7 @@ struct rockchip_pm_domain { + struct regmap **qos_regmap; + u32 *qos_save_regs[MAX_QOS_REGS_NUM]; + int num_clks; ++ bool is_ignore_pwr; + struct clk_bulk_data *clks; + }; + +@@ -361,6 +362,9 @@ static int rockchip_pd_power_on(struct generic_pm_domain *domain) + { + struct rockchip_pm_domain *pd = to_rockchip_pd(domain); + ++ if (pd->is_ignore_pwr) ++ return 0; ++ + return rockchip_pd_power(pd, true); + } + +@@ -368,6 +372,9 @@ static int rockchip_pd_power_off(struct generic_pm_domain *domain) + { + struct rockchip_pm_domain *pd = to_rockchip_pd(domain); + ++ if (pd->is_ignore_pwr) ++ return 0; ++ + return rockchip_pd_power(pd, false); + } + +@@ -447,6 +454,9 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, + pd->info = pd_info; + pd->pmu = pmu; + ++ if (!pd_info->pwr_mask) ++ pd->is_ignore_pwr = true; ++ + pd->num_clks = of_clk_get_parent_count(node); + if (pd->num_clks > 0) { + pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, +@@ -600,6 +610,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu, + { + struct device_node *np; + struct generic_pm_domain *child_domain, *parent_domain; ++ struct rockchip_pm_domain *child_pd, *parent_pd; + int error; + + for_each_child_of_node(parent, np) { +@@ -640,6 +651,18 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu, + parent_domain->name, child_domain->name); + } + ++ /* ++ * If child_pd doesn't do idle request or power on/off, ++ * parent_pd may fail to do power on/off, so if parent_pd ++ * need to power on/off, child_pd can't ignore to do idle ++ * request and power on/off. ++ */ ++ child_pd = to_rockchip_pd(child_domain); ++ parent_pd = to_rockchip_pd(parent_domain); ++ if (!parent_pd->is_ignore_pwr) ++ child_pd->is_ignore_pwr = false; ++ ++ + rockchip_pm_add_subdomain(pmu, np); + } + +-- +2.25.1 + + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-rk322x-box.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-rk322x-box.patch new file mode 100644 index 000000000000..2c10b95bc042 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-rk322x-box.patch @@ -0,0 +1,119 @@ +From f14539f8d08328ae5aad165a4deea25c7d6b09bf Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Mon, 25 Apr 2022 13:25:09 +0000 +Subject: [PATCH] add generic rk322x tv box remote controller keymap + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-rk322x-tvbox.c | 74 ++++++++++++++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 77 insertions(+) + create mode 100644 drivers/media/rc/keymaps/rc-rk322x-tvbox.c + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index 5fe5c9e1a46..1aa49b78a65 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -99,6 +99,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-rc6-mce.o \ + rc-real-audio-220-32-keys.o \ + rc-reddo.o \ ++ rc-rk322x-tvbox.o \ + rc-snapstream-firefly.o \ + rc-streamzap.o \ + rc-tanix-tx3mini.o \ +diff --git a/drivers/media/rc/keymaps/rc-rk322x-tvbox.c b/drivers/media/rc/keymaps/rc-rk322x-tvbox.c +new file mode 100644 +index 00000000000..91e24ee52ee +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-rk322x-tvbox.c +@@ -0,0 +1,74 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++// rc-rk322x-tvbox.c - Keytable for rk322x generic tv box remote controller ++// ++// keymap imported from ir-keymaps.c ++// ++// Copyright (c) 2022 Paolo Sabatino ++ ++#include ++#include ++ ++/* ++ ++*/ ++ ++static struct rc_map_table rk322x_tvbox[] = { ++ ++ { 0x40400d, KEY_ENTER }, ++ { 0x40404d, KEY_POWER }, ++ { 0x40401e, KEY_PREVIOUSSONG }, ++ { 0x40401f, KEY_NEXTSONG }, ++ { 0x404001, KEY_1 }, ++ { 0x404002, KEY_2 }, ++ { 0x404003, KEY_3 }, ++ { 0x404004, KEY_4 }, ++ { 0x404005, KEY_5 }, ++ { 0x404006, KEY_6 }, ++ { 0x404007, KEY_7 }, ++ { 0x404008, KEY_8 }, ++ { 0x404009, KEY_9 }, ++ { 0x404000, KEY_0 }, ++ { 0x40400c, KEY_BACKSPACE }, ++ { 0x404044, KEY_F6 }, ++ { 0x40401a, KEY_HOME }, ++ { 0x404042, KEY_BACK }, ++ { 0x404045, KEY_MENU }, ++ { 0x40400f, KEY_TEXT }, ++ { 0x404010, KEY_LEFT }, ++ { 0x404011, KEY_RIGHT }, ++ { 0x40400e, KEY_DOWN }, ++ { 0x40400b, KEY_UP }, ++ { 0x40401c, KEY_VOLUMEDOWN }, ++ { 0x404043, KEY_MUTE }, ++ { 0x404015, KEY_VOLUMEUP }, ++ { 0x404053, KEY_F1 }, ++ { 0x40405b, KEY_F2 }, ++ { 0x404057, KEY_F3 }, ++ { 0x404054, KEY_F4 }, ++ ++}; ++ ++static struct rc_map_list rk322x_tvbox_map = { ++ .map = { ++ .scan = rk322x_tvbox, ++ .size = ARRAY_SIZE(rk322x_tvbox), ++ .rc_proto = RC_PROTO_NEC, /* Legacy IR type */ ++ .name = RC_MAP_RK322X_TVBOX, ++ } ++}; ++ ++static int __init init_rc_map_rk322x_tvbox(void) ++{ ++ return rc_map_register(&rk322x_tvbox_map); ++} ++ ++static void __exit exit_rc_map_rk322x_tvbox(void) ++{ ++ rc_map_unregister(&rk322x_tvbox_map); ++} ++ ++module_init(init_rc_map_rk322x_tvbox) ++module_exit(exit_rc_map_rk322x_tvbox) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Paolo Sabatino"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 793b54342df..35aba84be9f 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -310,6 +310,7 @@ struct rc_map *rc_map_get(const char *name); + #define RC_MAP_RC6_MCE "rc-rc6-mce" + #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" + #define RC_MAP_REDDO "rc-reddo" ++#define RC_MAP_RK322X_TVBOX "rc-rk322x-tvbox" + #define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly" + #define RC_MAP_STREAMZAP "rc-streamzap" + #define RC_MAP_SU3000 "rc-su3000" +-- +2.30.2 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-xt-q8l-v10.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-xt-q8l-v10.patch new file mode 100644 index 000000000000..eb4faa632591 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/ir-keymap-xt-q8l-v10.patch @@ -0,0 +1,118 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Fri, 10 Jun 2022 15:59:15 +0000 +Subject: add xt-q8l-v10 keymap and makefile + +--- + drivers/media/rc/keymaps/Makefile | 1 + + drivers/media/rc/keymaps/rc-xt-q8l-v10.c | 76 ++++++++++ + include/media/rc-map.h | 1 + + 3 files changed, 78 insertions(+) + +diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile +index f513ff5caf4e..198ef8bc2614 100644 +--- a/drivers/media/rc/keymaps/Makefile ++++ b/drivers/media/rc/keymaps/Makefile +@@ -136,4 +136,5 @@ obj-$(CONFIG_RC_MAP) += \ + rc-x96max.o \ + rc-xbox-360.o \ + rc-xbox-dvd.o \ ++ rc-xt-q8l-v10.o \ + rc-zx-irdec.o +diff --git a/drivers/media/rc/keymaps/rc-xt-q8l-v10.c b/drivers/media/rc/keymaps/rc-xt-q8l-v10.c +new file mode 100644 +index 000000000000..19c7d9ec8325 +--- /dev/null ++++ b/drivers/media/rc/keymaps/rc-xt-q8l-v10.c +@@ -0,0 +1,76 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++// rc-xt-q8l-v10.c - Keytable for xt-q8l-v10 tv box remote controller ++// ++// keymap imported from ir-keymaps.c ++// ++// Copyright (c) 2018 Paolo Sabatino ++ ++#include ++#include ++ ++/* ++ ++*/ ++ ++static struct rc_map_table xt_q8l_v10[] = { ++ ++ { 0xcc1d11, KEY_ENTER }, ++ { 0xcc1d00, KEY_POWER }, ++ { 0xcc1d15, KEY_PLAYPAUSE }, ++ { 0xcc1d16, KEY_STOP }, ++ { 0xcc1d06, KEY_PREVIOUSSONG }, ++ { 0xcc1d0a, KEY_NEXTSONG }, ++ { 0xcc1d41, KEY_1 }, ++ { 0xcc1d45, KEY_2 }, ++ { 0xcc1d4d, KEY_3 }, ++ { 0xcc1d42, KEY_4 }, ++ { 0xcc1d46, KEY_5 }, ++ { 0xcc1d4e, KEY_6 }, ++ { 0xcc1d43, KEY_7 }, ++ { 0xcc1d47, KEY_8 }, ++ { 0xcc1d4f, KEY_9 }, ++ { 0xcc1d49, KEY_0 }, ++ { 0xcc1d4a, KEY_BACKSPACE }, ++ { 0xcc1d48, KEY_F6 }, ++ { 0xcc1d03, KEY_HOME }, ++ { 0xcc1d0f, KEY_BACK }, ++ { 0xcc1d40, KEY_MENU }, ++ { 0xcc1d4c, KEY_TEXT }, ++ { 0xcc1d10, KEY_LEFT }, ++ { 0xcc1d12, KEY_RIGHT }, ++ { 0xcc1d44, KEY_DOWN }, ++ { 0xcc1d07, KEY_UP }, ++ { 0xcc1d02, KEY_VOLUMEDOWN }, ++ { 0xcc1d0c, KEY_MUTE }, ++ { 0xcc1d0e, KEY_VOLUMEUP }, ++ { 0xcc1d01, KEY_F1 }, ++ { 0xcc1d05, KEY_F2 }, ++ { 0xcc1d09, KEY_F3 }, ++ { 0xcc1d0d, KEY_F4 }, ++ ++}; ++ ++static struct rc_map_list xt_q8l_v10_map = { ++ .map = { ++ .scan = xt_q8l_v10, ++ .size = ARRAY_SIZE(xt_q8l_v10), ++ .rc_proto = RC_PROTO_NEC, /* Legacy IR type */ ++ .name = RC_MAP_XT_Q8L_V10, ++ } ++}; ++ ++static int __init init_rc_map_xt_q8l_v10(void) ++{ ++ return rc_map_register(&xt_q8l_v10_map); ++} ++ ++static void __exit exit_rc_map_xt_q8l_v10(void) ++{ ++ rc_map_unregister(&xt_q8l_v10_map); ++} ++ ++module_init(init_rc_map_xt_q8l_v10) ++module_exit(exit_rc_map_xt_q8l_v10) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Paolo Sabatino"); +diff --git a/include/media/rc-map.h b/include/media/rc-map.h +index 793b54342dff..ef7f3710eafe 100644 +--- a/include/media/rc-map.h ++++ b/include/media/rc-map.h +@@ -343,6 +343,7 @@ struct rc_map *rc_map_get(const char *name); + #define RC_MAP_X96MAX "rc-x96max" + #define RC_MAP_XBOX_360 "rc-xbox-360" + #define RC_MAP_XBOX_DVD "rc-xbox-dvd" ++#define RC_MAP_XT_Q8L_V10 "rc-xt-q8l-v10" + #define RC_MAP_ZX_IRDEC "rc-zx-irdec" + + /* +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/misc-tinkerboard-spi-interface.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/misc-tinkerboard-spi-interface.patch new file mode 100644 index 000000000000..f3a1f6b83963 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/misc-tinkerboard-spi-interface.patch @@ -0,0 +1,20 @@ +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 5a038c667401..5dd1acf7f12a 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -713,6 +713,7 @@ static const struct spi_device_id spidev_spi_ids[] = { + { .name = "spi-authenta" }, + { .name = "em3581" }, + { .name = "si3210" }, ++ { .name = "spi_tinker" }, + {}, + }; + MODULE_DEVICE_TABLE(spi, spidev_spi_ids); +@@ -741,6 +742,7 @@ static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "semtech,sx1301", .data = &spidev_of_check }, + { .compatible = "silabs,em3581", .data = &spidev_of_check }, + { .compatible = "silabs,si3210", .data = &spidev_of_check }, ++ { .compatible = "rockchip,spi_tinker", .data = &spidev_of_check }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/mmc-tinkerboard-sdmmc-reboot-fix.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/mmc-tinkerboard-sdmmc-reboot-fix.patch new file mode 100644 index 000000000000..77385b14be1e --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/mmc-tinkerboard-sdmmc-reboot-fix.patch @@ -0,0 +1,116 @@ +From 302cd9b8a9f1f8a7735fabea3b9a7645dc40f9cc Mon Sep 17 00:00:00 2001 +From: Myy Miouyouyou +Date: Sun, 7 Jan 2018 01:52:44 +0100 +Subject: [PATCH] drivers: mmc: dw-mci-rockchip: Handle ASUS Tinkerboard reboot + +On ASUS Tinkerboard systems, if the SDMMC hardware is shutdown before +rebooting, the system will be dead, as the SDMMC is the only way to +boot anything, and the hardware doesn't power up the SDMMC hardware +automatically when rebooting. + +So, when using an ASUS Tinkerboard system, a new reboot handler is +installed. This reboot handler takes care of powering the SDMMC +hardware again before restarting the system, resolving the issue. + +The code was inspired by the pwrseq_emmc.c, which seems to overcome +similar effects with eMMC hardware. + +Signed-off-by: Myy Miouyouyou +--- + drivers/mmc/host/dw_mmc-rockchip.c | 66 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 66 insertions(+) + +diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c +index a3f1c2b30..7eac1f221 100644 +--- a/drivers/mmc/host/dw_mmc-rockchip.c ++++ b/drivers/mmc/host/dw_mmc-rockchip.c +@@ -16,6 +16,11 @@ + #include + #include + ++#include ++#include ++#include ++#include "../core/core.h" ++ + #include "dw_mmc.h" + #include "dw_mmc-pltfm.h" + +@@ -334,6 +339,66 @@ static const struct of_device_id dw_mci_rockchip_match[] = { + }; + MODULE_DEVICE_TABLE(of, dw_mci_rockchip_match); + ++struct dw_mci_rockchip_broken_boards_data { ++ struct notifier_block reset_nb; ++ struct platform_device *pdev; ++}; ++ ++/* This reboot handler handles cases where disabling the SDMMC on ++ * reboot will cause the hardware to be unable to start correctly ++ * after rebooting. ++ * ++ * This happens with Tinkerboard systems... ++ */ ++static int dw_mci_rockchip_broken_boards_reset_nb( ++ struct notifier_block *this, ++ unsigned long mode, void *cmd) ++{ ++ struct dw_mci_rockchip_broken_boards_data const *data = ++ container_of(this, ++ struct dw_mci_rockchip_broken_boards_data, ++ reset_nb); ++ struct dw_mci *host = platform_get_drvdata(data->pdev); ++ struct mmc_host *mmc = host->slot->mmc; ++ ++ printk(KERN_ERR "Meow.\n"); ++ ++ mmc_power_off(mmc); ++ ++ mdelay(20); ++ ++ if (!IS_ERR(mmc->supply.vmmc)) ++ regulator_enable(mmc->supply.vmmc); ++ ++ if (!IS_ERR(mmc->supply.vqmmc)) ++ regulator_set_voltage(mmc->supply.vqmmc, 3000000, 3300000); ++ ++ printk(KERN_ERR "woeM.\n"); ++ ++ return NOTIFY_DONE; ++} ++ ++static void dw_mci_rockchip_register_broken_boards_reboot_handler( ++ struct platform_device *pdev) ++{ ++ struct dw_mci_rockchip_broken_boards_data *data; ++ ++ if (!of_machine_is_compatible("asus,rk3288-tinker")) ++ return; ++ ++ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); ++ ++ if (!data) ++ return; ++ ++ data->reset_nb.notifier_call = ++ dw_mci_rockchip_broken_boards_reset_nb; ++ data->reset_nb.priority = 255; ++ register_restart_handler(&data->reset_nb); ++ ++ data->pdev = pdev; ++} ++ + static int dw_mci_rockchip_probe(struct platform_device *pdev) + { + const struct dw_mci_drv_data *drv_data; +@@ -361,6 +426,7 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev) + } + + pm_runtime_put_autosuspend(&pdev->dev); ++ dw_mci_rockchip_register_broken_boards_reboot_handler(pdev); + + return 0; + } +-- +2.14.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-01-sipv2-calls.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-01-sipv2-calls.patch new file mode 100644 index 000000000000..ed7158039f5c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-01-sipv2-calls.patch @@ -0,0 +1,234 @@ +From e039790fb29227f646e91e6d7ec7c3e89c584243 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 6 Jul 2021 14:21:52 +0000 +Subject: [PATCH 1/5] rk3228/rk3328: fix ddr clock gate, add SIP v2 calls + +--- + drivers/clk/rockchip/clk-ddr.c | 130 ++++++++++++++++++++++++++++++ + drivers/clk/rockchip/clk-rk3228.c | 14 ++-- + drivers/clk/rockchip/clk-rk3328.c | 7 +- + drivers/clk/rockchip/clk.h | 3 +- + 4 files changed, 143 insertions(+), 11 deletions(-) + +diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c +index 86718c54e..b16b3795f 100644 +--- a/drivers/clk/rockchip/clk-ddr.c ++++ b/drivers/clk/rockchip/clk-ddr.c +@@ -87,6 +87,133 @@ static const struct clk_ops rockchip_ddrclk_sip_ops = { + .get_parent = rockchip_ddrclk_get_parent, + }; + ++/* See v4.4/include/dt-bindings/display/rk_fb.h */ ++#define SCREEN_NULL 0 ++#define SCREEN_HDMI 6 ++ ++static inline int rk_drm_get_lcdc_type(void) ++{ ++ return SCREEN_NULL; ++} ++ ++struct share_params { ++ u32 hz; ++ u32 lcdc_type; ++ u32 vop; ++ u32 vop_dclk_mode; ++ u32 sr_idle_en; ++ u32 addr_mcu_el3; ++ /* ++ * 1: need to wait flag1 ++ * 0: never wait flag1 ++ */ ++ u32 wait_flag1; ++ /* ++ * 1: need to wait flag1 ++ * 0: never wait flag1 ++ */ ++ u32 wait_flag0; ++ u32 complt_hwirq; ++ /* if need, add parameter after */ ++}; ++ ++struct rockchip_ddrclk_data { ++ u32 inited_flag; ++ void __iomem *share_memory; ++}; ++ ++static struct rockchip_ddrclk_data ddr_data; ++ ++static void rockchip_ddrclk_data_init(void) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_SHARE_MEM, ++ 1, SHARE_PAGE_TYPE_DDR, 0, ++ 0, 0, 0, 0, &res); ++ ++ if (!res.a0) { ++ ddr_data.share_memory = (void __iomem *)ioremap(res.a1, 1<<12); ++ ddr_data.inited_flag = 1; ++ } ++} ++ ++static int rockchip_ddrclk_sip_set_rate_v2(struct clk_hw *hw, ++ unsigned long drate, ++ unsigned long prate) ++{ ++ struct share_params *p; ++ struct arm_smccc_res res; ++ ++ if (!ddr_data.inited_flag) ++ rockchip_ddrclk_data_init(); ++ ++ p = (struct share_params *)ddr_data.share_memory; ++ ++ p->hz = drate; ++ p->lcdc_type = rk_drm_get_lcdc_type(); ++ p->wait_flag1 = 1; ++ p->wait_flag0 = 1; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, ++ SHARE_PAGE_TYPE_DDR, 0, ++ ROCKCHIP_SIP_CONFIG_DRAM_SET_RATE, ++ 0, 0, 0, 0, &res); ++ ++ if ((int)res.a1 == -6) { ++ pr_err("%s: timeout, drate = %lumhz\n", __func__, drate/1000000); ++ /* TODO: rockchip_dmcfreq_wait_complete(); */ ++ } ++ ++ return res.a0; ++} ++ ++static unsigned long rockchip_ddrclk_sip_recalc_rate_v2 ++ (struct clk_hw *hw, unsigned long parent_rate) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, ++ SHARE_PAGE_TYPE_DDR, 0, ++ ROCKCHIP_SIP_CONFIG_DRAM_GET_RATE, ++ 0, 0, 0, 0, &res); ++ if (!res.a0) ++ return res.a1; ++ else ++ return 0; ++} ++ ++static long rockchip_ddrclk_sip_round_rate_v2(struct clk_hw *hw, ++ unsigned long rate, ++ unsigned long *prate) ++{ ++ struct share_params *p; ++ struct arm_smccc_res res; ++ ++ if (!ddr_data.inited_flag) ++ rockchip_ddrclk_data_init(); ++ ++ p = (struct share_params *)ddr_data.share_memory; ++ ++ p->hz = rate; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, ++ SHARE_PAGE_TYPE_DDR, 0, ++ ROCKCHIP_SIP_CONFIG_DRAM_ROUND_RATE, ++ 0, 0, 0, 0, &res); ++ if (!res.a0) ++ return res.a1; ++ else ++ return 0; ++} ++ ++static const struct clk_ops rockchip_ddrclk_sip_ops_v2 = { ++ .recalc_rate = rockchip_ddrclk_sip_recalc_rate_v2, ++ .set_rate = rockchip_ddrclk_sip_set_rate_v2, ++ .round_rate = rockchip_ddrclk_sip_round_rate_v2, ++ .get_parent = rockchip_ddrclk_get_parent, ++}; ++ + struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, + const char *const *parent_names, + u8 num_parents, int mux_offset, +@@ -114,6 +241,9 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, + case ROCKCHIP_DDRCLK_SIP: + init.ops = &rockchip_ddrclk_sip_ops; + break; ++ case ROCKCHIP_DDRCLK_SIP_V2: ++ init.ops = &rockchip_ddrclk_sip_ops_v2; ++ break; + default: + pr_err("%s: unsupported ddrclk type %d\n", __func__, ddr_flag); + kfree(ddrclk); +diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c +index 1f9176a5c..96393aa16 100644 +--- a/drivers/clk/rockchip/clk-rk3228.c ++++ b/drivers/clk/rockchip/clk-rk3228.c +@@ -218,9 +218,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_CLKSEL_CON(4), 8, 5, DFLAGS), + + /* PD_DDR */ +- COMPOSITE(0, "clk_ddrphy_src", mux_ddrphy_p, CLK_IGNORE_UNUSED, +- RK2928_CLKSEL_CON(26), 8, 2, MFLAGS, 0, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, +- RK2928_CLKGATE_CON(0), 2, GFLAGS), ++ COMPOSITE_DDRCLK(SCLK_DDRCLK, "sclk_ddrc", mux_ddrphy_p, 0, ++ RK2928_CLKSEL_CON(26), 8, 2, 0, 2, ++ ROCKCHIP_DDRCLK_SIP_V2), + GATE(0, "ddrphy4x", "clk_ddrphy_src", CLK_IGNORE_UNUSED, + RK2928_CLKGATE_CON(7), 1, GFLAGS), + FACTOR_GATE(0, "ddrc", "clk_ddrphy_src", CLK_IGNORE_UNUSED, 1, 4, +@@ -576,8 +576,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + GATE(HCLK_M_CRYPTO, "hclk_crypto_mst", "hclk_cpu", 0, RK2928_CLKGATE_CON(8), 11, GFLAGS), + GATE(HCLK_S_CRYPTO, "hclk_crypto_slv", "hclk_cpu", 0, RK2928_CLKGATE_CON(8), 12, GFLAGS), + +- GATE(0, "pclk_ddrupctl", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 4, GFLAGS), +- GATE(0, "pclk_ddrmon", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 6, GFLAGS), ++ GATE(0, "pclk_ddr_upctl", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 4, GFLAGS), ++ GATE(0, "pclk_ddr_mon", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(8), 6, GFLAGS), + GATE(0, "pclk_msch_noc", "pclk_ddr_pre", 0, RK2928_CLKGATE_CON(10), 2, GFLAGS), + + GATE(PCLK_EFUSE_1024, "pclk_efuse_1024", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 13, GFLAGS), +@@ -652,8 +652,8 @@ static const char *const rk3228_critical_clocks[] __initconst = { + "sclk_initmem_mbist", + "aclk_initmem", + "hclk_rom", +- "pclk_ddrupctl", +- "pclk_ddrmon", ++ "pclk_ddr_upctl", ++ "pclk_ddr_mon", + "pclk_msch_noc", + "pclk_stimer", + "pclk_ddrphy", +diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c +index cc18dbc18..5fdd611bb 100644 +--- a/drivers/clk/rockchip/clk-rk3328.c ++++ b/drivers/clk/rockchip/clk-rk3328.c +@@ -317,9 +317,10 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { + RK3328_CLKGATE_CON(14), 1, GFLAGS), + + /* PD_DDR */ +- COMPOSITE(0, "clk_ddr", mux_ddrphy_p, CLK_IGNORE_UNUSED, +- RK3328_CLKSEL_CON(3), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, +- RK3328_CLKGATE_CON(0), 4, GFLAGS), ++ COMPOSITE_DDRCLK(SCLK_DDRCLK, "sclk_ddrc", mux_ddrphy_p, 0, ++ RK3328_CLKSEL_CON(3), 8, 2, 0, 3, ++ ROCKCHIP_DDRCLK_SIP_V2), ++ + GATE(0, "clk_ddrmsch", "clk_ddr", CLK_IGNORE_UNUSED, + RK3328_CLKGATE_CON(18), 6, GFLAGS), + GATE(0, "clk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED, +diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h +index ae059b774..fdaa81ebb 100644 +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -363,7 +363,8 @@ struct clk *rockchip_clk_register_mmc(const char *name, + * DDRCLK flags, including method of setting the rate + * ROCKCHIP_DDRCLK_SIP: use SIP call to bl31 to change ddrclk rate. + */ +-#define ROCKCHIP_DDRCLK_SIP BIT(0) ++#define ROCKCHIP_DDRCLK_SIP 0x01 ++#define ROCKCHIP_DDRCLK_SIP_V2 0x03 + + struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, + const char *const *parent_names, +-- +2.25.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-02-sip-constants.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-02-sip-constants.patch new file mode 100644 index 000000000000..efeaace36252 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-02-sip-constants.patch @@ -0,0 +1,67 @@ +From 95358ea4a4434ad4af5545b3f762508e4f015fc3 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 6 Jul 2021 14:23:36 +0000 +Subject: [PATCH 2/5] rk3228/rk3328: add ddr clock and SIP related constants + and defines + +--- + include/dt-bindings/clock/rk3228-cru.h | 1 + + include/soc/rockchip/rockchip_sip.h | 24 ++++++++++++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/include/dt-bindings/clock/rk3228-cru.h b/include/dt-bindings/clock/rk3228-cru.h +index de550ea56..911824731 100644 +--- a/include/dt-bindings/clock/rk3228-cru.h ++++ b/include/dt-bindings/clock/rk3228-cru.h +@@ -15,6 +15,7 @@ + #define ARMCLK 5 + + /* sclk gates (special clocks) */ ++#define SCLK_DDRCLK 64 + #define SCLK_SPI0 65 + #define SCLK_NANDC 67 + #define SCLK_SDMMC 68 +diff --git a/include/soc/rockchip/rockchip_sip.h b/include/soc/rockchip/rockchip_sip.h +index c46a9ae2a..34e653751 100644 +--- a/include/soc/rockchip/rockchip_sip.h ++++ b/include/soc/rockchip/rockchip_sip.h +@@ -6,6 +6,7 @@ + #ifndef __SOC_ROCKCHIP_SIP_H + #define __SOC_ROCKCHIP_SIP_H + ++#define ROCKCHIP_SIP_ATF_VERSION 0x82000001 + #define ROCKCHIP_SIP_DRAM_FREQ 0x82000008 + #define ROCKCHIP_SIP_CONFIG_DRAM_INIT 0x00 + #define ROCKCHIP_SIP_CONFIG_DRAM_SET_RATE 0x01 +@@ -16,5 +17,28 @@ + #define ROCKCHIP_SIP_CONFIG_DRAM_CLR_IRQ 0x06 + #define ROCKCHIP_SIP_CONFIG_DRAM_SET_PARAM 0x07 + #define ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD 0x08 ++#define ROCKCHIP_SIP_CONFIG_DRAM_GET_VERSION 0x08 ++#define ROCKCHIP_SIP_CONFIG_DRAM_POST_SET_RATE 0x09 ++#define ROCKCHIP_SIP_CONFIG_DRAM_SET_MSCH_RL 0x0a ++#define ROCKCHIP_SIP_CONFIG_DRAM_DEBUG 0x0b ++ ++#define ROCKCHIP_SIP_SHARE_MEM 0x82000009 ++#define ROCKCHIP_SIP_SIP_VERSION 0x8200000a ++ ++/* Rockchip Sip version */ ++#define ROCKCHIP_SIP_IMPLEMENT_V1 (1) ++#define ROCKCHIP_SIP_IMPLEMENT_V2 (2) ++ ++/* SIP_ACCESS_REG: read or write */ ++#define SECURE_REG_RD 0x0 ++#define SECURE_REG_WR 0x1 ++ ++/* Share mem page types */ ++typedef enum { ++ SHARE_PAGE_TYPE_INVALID = 0, ++ SHARE_PAGE_TYPE_UARTDBG, ++ SHARE_PAGE_TYPE_DDR, ++ SHARE_PAGE_TYPE_MAX, ++} share_page_type_t; + + #endif +-- +2.25.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-03-dfi-driver.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-03-dfi-driver.patch new file mode 100644 index 000000000000..b1b3aa8a5b14 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-03-dfi-driver.patch @@ -0,0 +1,199 @@ +From de9678fab28f23bdc3969cdea397f4057d42ba5a Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Thu, 11 Jan 2024 20:42:48 +0100 +Subject: [PATCH] add rk3228/rk3328 to rockchip dfi driver + +--- + arch/arm/boot/dts/rockchip/rk322x.dtsi | 7 +++ + drivers/devfreq/event/rockchip-dfi.c | 77 +++++++++++++++++++++++--- + include/soc/rockchip/rk3228_grf.h | 14 +++++ + include/soc/rockchip/rk3328_grf.h | 14 +++++ + 4 files changed, 105 insertions(+), 7 deletions(-) + create mode 100644 include/soc/rockchip/rk3228_grf.h + create mode 100644 include/soc/rockchip/rk3328_grf.h + +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index 571626d879f8..e87096b97610 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -208,6 +208,13 @@ xin24m: oscillator { + #clock-cells = <0>; + }; + ++ dfi: dfi@11210000 { ++ reg = <0x11210000 0x400>; ++ compatible = "rockchip,rk3228-dfi"; ++ rockchip,grf = <&grf>; ++ status = "okay"; ++ }; ++ + display_subsystem: display-subsystem { + compatible = "rockchip,display-subsystem"; + ports = <&vop_out>; +diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c +index e2a1e4463b6f..fba3a958b352 100644 +--- a/drivers/devfreq/event/rockchip-dfi.c ++++ b/drivers/devfreq/event/rockchip-dfi.c +@@ -24,6 +24,8 @@ + #include + + #include ++#include ++#include + #include + #include + #include +@@ -99,6 +101,7 @@ struct rockchip_dfi { + + struct device *dev; + void __iomem *regs; ++ struct regmap *regmap_grf; + struct regmap *regmap_pmu; + struct clk *clk; + int usecount; +@@ -669,6 +672,46 @@ static int rockchip_ddr_perf_init(struct rockchip_dfi *dfi) + } + #endif + ++static int rk3228_dfi_init(struct rockchip_dfi *dfi) ++{ ++ u32 val; ++ ++ regmap_read(dfi->regmap_grf, RK3228_GRF_OS_REG2, &val); ++ dfi->ddr_type = FIELD_GET(RK3228_GRF_OS_REG2_DDRTYPE, val); ++ ++ dfi->channel_mask = GENMASK(0, 0); ++ dfi->max_channels = 1; ++ ++ dfi->buswidth[0] = 2; // 16 bit bus width ++ ++ dfi->ddrmon_stride = 0x0; // single channel controller ++ dfi->ddrmon_ctrl_single = true; ++ ++ dfi->clk = NULL; ++ ++ return 0; ++} ++ ++static int rk3328_dfi_init(struct rockchip_dfi *dfi) ++{ ++ u32 val; ++ ++ regmap_read(dfi->regmap_grf, RK3328_GRF_OS_REG2, &val); ++ dfi->ddr_type = FIELD_GET(RK3328_GRF_OS_REG2_DDRTYPE, val); ++ ++ dfi->channel_mask = GENMASK(0, 0); ++ dfi->max_channels = 1; ++ ++ dfi->buswidth[0] = 2; // 16 bit bus width ++ ++ dfi->ddrmon_stride = 0x0; // single channel controller ++ dfi->ddrmon_ctrl_single = true; ++ ++ dfi->clk = NULL; ++ ++ return 0; ++} ++ + static int rk3399_dfi_init(struct rockchip_dfi *dfi) + { + struct regmap *regmap_pmu = dfi->regmap_pmu; +@@ -757,6 +800,8 @@ static int rk3588_dfi_init(struct rockchip_dfi *dfi) + }; + + static const struct of_device_id rockchip_dfi_id_match[] = { ++ { .compatible = "rockchip,rk3228-dfi", .data = rk3228_dfi_init }, ++ { .compatible = "rockchip,rk3328-dfi", .data = rk3328_dfi_init }, + { .compatible = "rockchip,rk3399-dfi", .data = rk3399_dfi_init }, + { .compatible = "rockchip,rk3568-dfi", .data = rk3568_dfi_init }, + { .compatible = "rockchip,rk3588-dfi", .data = rk3588_dfi_init }, +@@ -786,14 +831,30 @@ static int rockchip_dfi_probe(struct platform_device *pdev) + if (IS_ERR(dfi->regs)) + return PTR_ERR(dfi->regs); + +- node = of_parse_phandle(np, "rockchip,pmu", 0); +- if (!node) +- return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n"); ++ if (soc_init == rk3228_dfi_init || ++ soc_init == rk3328_dfi_init) { ++ node = of_parse_phandle(np, "rockchip,grf", 0); ++ if (!node) ++ return dev_err_probe(&pdev->dev, -ENODEV, "Can't find grf registers"); + +- dfi->regmap_pmu = syscon_node_to_regmap(node); +- of_node_put(node); +- if (IS_ERR(dfi->regmap_pmu)) +- return PTR_ERR(dfi->regmap_pmu); ++ dfi->regmap_grf = syscon_node_to_regmap(node); ++ of_node_put(node); ++ if (IS_ERR(dfi->regmap_grf)) ++ return PTR_ERR(dfi->regmap_grf); ++ } ++ ++ if (soc_init == rk3399_dfi_init || ++ soc_init == rk3568_dfi_init || ++ soc_init == rk3588_dfi_init) { ++ node = of_parse_phandle(np, "rockchip,pmu", 0); ++ if (!node) ++ return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n"); ++ ++ dfi->regmap_pmu = syscon_node_to_regmap(node); ++ of_node_put(node); ++ if (IS_ERR(dfi->regmap_pmu)) ++ return PTR_ERR(dfi->regmap_pmu); ++ } + + dfi->dev = dev; + mutex_init(&dfi->mutex); +@@ -818,6 +879,8 @@ static int rockchip_dfi_probe(struct platform_device *pdev) + if (ret) + return ret; + ++ dev_notice(dfi->dev, "dfi initialized, dram type: 0x%x, channels: %d\n", dfi->ddr_type, dfi->max_channels); ++ + platform_set_drvdata(pdev, dfi); + + return 0; +diff --git a/include/soc/rockchip/rk3228_grf.h b/include/soc/rockchip/rk3228_grf.h +new file mode 100644 +index 000000000000..e37406814fad +--- /dev/null ++++ b/include/soc/rockchip/rk3228_grf.h +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Rockchip General Register Files definitions for RK3228 ++ * ++ * Author: Paolo Sabatino ++ */ ++ ++#ifndef __SOC_RK3228_GRF_H ++#define __SOC_RK3228_GRF_H ++ ++#define RK3228_GRF_OS_REG2 0x5d0 ++#define RK3228_GRF_OS_REG2_DDRTYPE GENMASK(15, 13) ++ ++#endif +diff --git a/include/soc/rockchip/rk3328_grf.h b/include/soc/rockchip/rk3328_grf.h +new file mode 100644 +index 000000000000..bf6d209be7e6 +--- /dev/null ++++ b/include/soc/rockchip/rk3328_grf.h +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Rockchip General Register Files definitions for RK3328 ++ * ++ * Author: Paolo Sabatino ++ */ ++ ++#ifndef __SOC_RK3328_GRF_H ++#define __SOC_RK3328_GRF_H ++ ++#define RK3328_GRF_OS_REG2 0x5d0 ++#define RK3328_GRF_OS_REG2_DDRTYPE GENMASK(15, 13) ++ ++#endif +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-04-driver.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-04-driver.patch new file mode 100644 index 000000000000..3dfa3754e56d --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dmc-driver-04-driver.patch @@ -0,0 +1,1155 @@ +From 8529e1141bf84ff4e0120eeb42e45a59c8e666c7 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Wed, 27 Dec 2023 15:29:29 +0100 +Subject: [PATCH] rockchip: add rk3228 dmc driver + +--- + arch/arm/boot/dts/rockchip/rk322x.dtsi | 70 +- + drivers/devfreq/Kconfig | 12 + + drivers/devfreq/Makefile | 1 + + drivers/devfreq/rk3228_dmc.c | 696 +++++++++++++++++++ + include/dt-bindings/clock/rockchip-ddr.h | 63 ++ + include/dt-bindings/memory/rockchip,rk322x.h | 90 +++ + 6 files changed, 929 insertions(+), 3 deletions(-) + create mode 100644 drivers/devfreq/rk3228_dmc.c + create mode 100644 include/dt-bindings/clock/rockchip-ddr.h + create mode 100644 include/dt-bindings/memory/rockchip,rk322x.h + +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index 41374aff62c8..c9d71a776587 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -7,6 +7,8 @@ + #include + #include + #include ++#include ++#include + + / { + #address-cells = <1>; +@@ -104,6 +106,68 @@ dfi: dfi@11210000 { + status = "okay"; + }; + ++ dmc: dmc@11200000 { ++ compatible = "rockchip,rk3228-dmc", "rockchip,rk322x-dram"; ++ reg = <0x11200000 0x400>; ++ clocks = <&cru SCLK_DDRCLK>; ++ clock-names = "ddr_sclk"; ++ operating-points-v2 = <&dmc_opp_table>; ++ rockchip,dram_timing = <&dram_timing>; ++ rockchip,grf = <&grf>; ++ devfreq-events = <&dfi>; ++ upthreshold = <15>; ++ downdifferential = <10>; ++ #cooling-cells = <2>; ++ status = "disabled"; ++ }; ++ ++ dmc_opp_table: dmc-opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-330000000 { ++ opp-hz = /bits/ 64 <330000000>; ++ opp-microvolt = <1050000 1000000 1200000>; ++ }; ++ opp-534000000 { ++ opp-hz = /bits/ 64 <534000000>; ++ opp-microvolt = <1050000 1000000 1200000>; ++ }; ++ opp-660000000 { ++ opp-hz = /bits/ 64 <660000000>; ++ opp-microvolt = <1100000 1000000 1200000>; ++ }; ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1150000 1000000 1200000>; ++ status = "disabled"; ++ }; ++ }; ++ ++ dram_timing: dram-timing { ++ compatible = "rockchip,dram-timing"; ++ dram_spd_bin = ; ++ sr_idle = <0x18>; ++ pd_idle = <0x20>; ++ dram_dll_disb_freq = <300>; ++ phy_dll_disb_freq = <400>; ++ dram_odt_disb_freq = <333>; ++ phy_odt_disb_freq = <333>; ++ ddr3_drv = ; ++ ddr3_odt = ; ++ lpddr3_drv = ; ++ lpddr3_odt = ; ++ lpddr2_drv = ; ++ /* lpddr2 not supported odt */ ++ phy_ddr3_clk_drv = ; ++ phy_ddr3_cmd_drv = ; ++ phy_ddr3_dqs_drv = ; ++ phy_ddr3_odt = ; ++ phy_lp23_clk_drv = ; ++ phy_lp23_cmd_drv = ; ++ phy_lp23_dqs_drv = ; ++ phy_lp3_odt = ; ++ }; ++ + arm-pmu { + compatible = "arm,cortex-a7-pmu"; + interrupts = , +@@ -676,17 +740,17 @@ gpu_opp_table: opp-table2 { + + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; +- opp-microvolt = <1050000>; ++ opp-microvolt = <1050000 1000000 1200000>; + }; + + opp-300000000 { + opp-hz = /bits/ 64 <300000000>; +- opp-microvolt = <1050000>; ++ opp-microvolt = <1050000 1000000 1200000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; +- opp-microvolt = <1150000>; ++ opp-microvolt = <1150000 1000000 1200000>; + }; + }; + +diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig +index 3c4862a752b5..066be239a16a 100644 +--- a/drivers/devfreq/Kconfig ++++ b/drivers/devfreq/Kconfig +@@ -129,6 +129,18 @@ config ARM_MEDIATEK_CCI_DEVFREQ + buck voltages and update a proper CCI frequency. Use the notification + to get the regulator status. + ++config ARM_RK3228_DMC_DEVFREQ ++ tristate "ARM RK3228 DMC DEVFREQ Driver" ++ depends on ARCH_ROCKCHIP ++ select DEVFREQ_EVENT_ROCKCHIP_DFI ++ select DEVFREQ_GOV_SIMPLE_ONDEMAND ++ select PM_DEVFREQ_EVENT ++ select PM_OPP ++ help ++ This adds the DEVFREQ driver for the RK3228 DMC(Dynamic Memory Controller). ++ It sets the frequency for the memory controller and reads the usage counts ++ from hardware. ++ + config ARM_RK3399_DMC_DEVFREQ + tristate "ARM RK3399 DMC DEVFREQ Driver" + depends on (ARCH_ROCKCHIP && HAVE_ARM_SMCCC) || \ +diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile +index bf40d04928d0..059712bfe5f5 100644 +--- a/drivers/devfreq/Makefile ++++ b/drivers/devfreq/Makefile +@@ -13,6 +13,7 @@ obj-$(CONFIG_ARM_IMX_BUS_DEVFREQ) += imx-bus.o + obj-$(CONFIG_ARM_IMX8M_DDRC_DEVFREQ) += imx8m-ddrc.o + obj-$(CONFIG_ARM_MEDIATEK_CCI_DEVFREQ) += mtk-cci-devfreq.o + obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ) += rk3399_dmc.o ++obj-$(CONFIG_ARM_RK3228_DMC_DEVFREQ) += rk3228_dmc.o + obj-$(CONFIG_ARM_SUN8I_A33_MBUS_DEVFREQ) += sun8i-a33-mbus.o + obj-$(CONFIG_ARM_TEGRA_DEVFREQ) += tegra30-devfreq.o + +diff --git a/include/dt-bindings/clock/rockchip-ddr.h b/include/dt-bindings/clock/rockchip-ddr.h +new file mode 100644 +index 000000000000..b065432e7793 +--- /dev/null ++++ b/include/dt-bindings/clock/rockchip-ddr.h +@@ -0,0 +1,63 @@ ++/* ++ * ++ * Copyright (C) 2017 ROCKCHIP, Inc. ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef _DT_BINDINGS_CLOCK_ROCKCHIP_DDR_H ++#define _DT_BINDINGS_CLOCK_ROCKCHIP_DDR_H ++ ++#define DDR2_DEFAULT (0) ++ ++#define DDR3_800D (0) /* 5-5-5 */ ++#define DDR3_800E (1) /* 6-6-6 */ ++#define DDR3_1066E (2) /* 6-6-6 */ ++#define DDR3_1066F (3) /* 7-7-7 */ ++#define DDR3_1066G (4) /* 8-8-8 */ ++#define DDR3_1333F (5) /* 7-7-7 */ ++#define DDR3_1333G (6) /* 8-8-8 */ ++#define DDR3_1333H (7) /* 9-9-9 */ ++#define DDR3_1333J (8) /* 10-10-10 */ ++#define DDR3_1600G (9) /* 8-8-8 */ ++#define DDR3_1600H (10) /* 9-9-9 */ ++#define DDR3_1600J (11) /* 10-10-10 */ ++#define DDR3_1600K (12) /* 11-11-11 */ ++#define DDR3_1866J (13) /* 10-10-10 */ ++#define DDR3_1866K (14) /* 11-11-11 */ ++#define DDR3_1866L (15) /* 12-12-12 */ ++#define DDR3_1866M (16) /* 13-13-13 */ ++#define DDR3_2133K (17) /* 11-11-11 */ ++#define DDR3_2133L (18) /* 12-12-12 */ ++#define DDR3_2133M (19) /* 13-13-13 */ ++#define DDR3_2133N (20) /* 14-14-14 */ ++#define DDR3_DEFAULT (21) ++#define DDR_DDR2 (22) ++#define DDR_LPDDR (23) ++#define DDR_LPDDR2 (24) ++ ++#define DDR4_1600J (0) /* 10-10-10 */ ++#define DDR4_1600K (1) /* 11-11-11 */ ++#define DDR4_1600L (2) /* 12-12-12 */ ++#define DDR4_1866L (3) /* 12-12-12 */ ++#define DDR4_1866M (4) /* 13-13-13 */ ++#define DDR4_1866N (5) /* 14-14-14 */ ++#define DDR4_2133N (6) /* 14-14-14 */ ++#define DDR4_2133P (7) /* 15-15-15 */ ++#define DDR4_2133R (8) /* 16-16-16 */ ++#define DDR4_2400P (9) /* 15-15-15 */ ++#define DDR4_2400R (10) /* 16-16-16 */ ++#define DDR4_2400U (11) /* 18-18-18 */ ++#define DDR4_DEFAULT (12) ++ ++#define PAUSE_CPU_STACK_SIZE 16 ++ ++#endif +diff --git a/include/dt-bindings/memory/rockchip,rk322x.h b/include/dt-bindings/memory/rockchip,rk322x.h +new file mode 100644 +index 000000000000..1ab3317d700e +--- /dev/null ++++ b/include/dt-bindings/memory/rockchip,rk322x.h +@@ -0,0 +1,90 @@ ++/* ++ * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++#ifndef _DT_BINDINGS_DRAM_ROCKCHIP_RK322X_H ++#define _DT_BINDINGS_DRAM_ROCKCHIP_RK322X_H ++ ++#define DDR3_DS_34ohm (1 << 1) ++#define DDR3_DS_40ohm (0x0) ++ ++#define LP2_DS_34ohm (0x1) ++#define LP2_DS_40ohm (0x2) ++#define LP2_DS_48ohm (0x3) ++#define LP2_DS_60ohm (0x4) ++#define LP2_DS_68_6ohm (0x5)/* optional */ ++#define LP2_DS_80ohm (0x6) ++#define LP2_DS_120ohm (0x7)/* optional */ ++ ++#define LP3_DS_34ohm (0x1) ++#define LP3_DS_40ohm (0x2) ++#define LP3_DS_48ohm (0x3) ++#define LP3_DS_60ohm (0x4) ++#define LP3_DS_80ohm (0x6) ++#define LP3_DS_34D_40U (0x9) ++#define LP3_DS_40D_48U (0xa) ++#define LP3_DS_34D_48U (0xb) ++ ++#define DDR3_ODT_DIS (0) ++#define DDR3_ODT_40ohm ((1 << 2) | (1 << 6)) ++#define DDR3_ODT_60ohm (1 << 2) ++#define DDR3_ODT_120ohm (1 << 6) ++ ++#define LP3_ODT_DIS (0) ++#define LP3_ODT_60ohm (1) ++#define LP3_ODT_120ohm (2) ++#define LP3_ODT_240ohm (3) ++ ++#define PHY_DDR3_RON_RTT_DISABLE (0) ++#define PHY_DDR3_RON_RTT_451ohm (1) ++#define PHY_DDR3_RON_RTT_225ohm (2) ++#define PHY_DDR3_RON_RTT_150ohm (3) ++#define PHY_DDR3_RON_RTT_112ohm (4) ++#define PHY_DDR3_RON_RTT_90ohm (5) ++#define PHY_DDR3_RON_RTT_75ohm (6) ++#define PHY_DDR3_RON_RTT_64ohm (7) ++#define PHY_DDR3_RON_RTT_56ohm (16) ++#define PHY_DDR3_RON_RTT_50ohm (17) ++#define PHY_DDR3_RON_RTT_45ohm (18) ++#define PHY_DDR3_RON_RTT_41ohm (19) ++#define PHY_DDR3_RON_RTT_37ohm (20) ++#define PHY_DDR3_RON_RTT_34ohm (21) ++#define PHY_DDR3_RON_RTT_33ohm (22) ++#define PHY_DDR3_RON_RTT_30ohm (23) ++#define PHY_DDR3_RON_RTT_28ohm (24) ++#define PHY_DDR3_RON_RTT_26ohm (25) ++#define PHY_DDR3_RON_RTT_25ohm (26) ++#define PHY_DDR3_RON_RTT_23ohm (27) ++#define PHY_DDR3_RON_RTT_22ohm (28) ++#define PHY_DDR3_RON_RTT_21ohm (29) ++#define PHY_DDR3_RON_RTT_20ohm (30) ++#define PHY_DDR3_RON_RTT_19ohm (31) ++ ++#define PHY_LP23_RON_RTT_DISABLE (0) ++#define PHY_LP23_RON_RTT_480ohm (1) ++#define PHY_LP23_RON_RTT_240ohm (2) ++#define PHY_LP23_RON_RTT_160ohm (3) ++#define PHY_LP23_RON_RTT_120ohm (4) ++#define PHY_LP23_RON_RTT_96ohm (5) ++#define PHY_LP23_RON_RTT_80ohm (6) ++#define PHY_LP23_RON_RTT_68ohm (7) ++#define PHY_LP23_RON_RTT_60ohm (16) ++#define PHY_LP23_RON_RTT_53ohm (17) ++#define PHY_LP23_RON_RTT_48ohm (18) ++#define PHY_LP23_RON_RTT_43ohm (19) ++#define PHY_LP23_RON_RTT_40ohm (20) ++#define PHY_LP23_RON_RTT_37ohm (21) ++#define PHY_LP23_RON_RTT_34ohm (22) ++#define PHY_LP23_RON_RTT_32ohm (23) ++#define PHY_LP23_RON_RTT_30ohm (24) ++#define PHY_LP23_RON_RTT_28ohm (25) ++#define PHY_LP23_RON_RTT_26ohm (26) ++#define PHY_LP23_RON_RTT_25ohm (27) ++#define PHY_LP23_RON_RTT_24ohm (28) ++#define PHY_LP23_RON_RTT_22ohm (29) ++#define PHY_LP23_RON_RTT_21ohm (30) ++#define PHY_LP23_RON_RTT_20ohm (31) ++ ++#endif /* _DT_BINDINGS_DRAM_ROCKCHIP_RK322X_H */ +diff --git a/drivers/devfreq/rk3228_dmc.c b/drivers/devfreq/rk3228_dmc.c +new file mode 100644 +index 000000000000..1dbf53043f69 +--- /dev/null ++++ b/drivers/devfreq/rk3228_dmc.c +@@ -0,0 +1,827 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd. ++ * Author: Lin Huang ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define DTS_PAR_OFFSET (4096) ++ ++#define RK3228_GRF_OS_REG2 0x5d0 ++#define DDR_PCTL_MCFG 0x80 ++#define DDR_PCTL_TCL 0xe8 ++#define DDR_PCTL_TRAS 0xf0 ++#define DDR_PCTL_TRCD 0xf8 ++#define DDR_PCTL_TRP 0xdc ++ ++/* MCFG */ ++#define MDDR_LPDDR2_CLK_STOP_IDLE_SHIFT 24 ++#define PD_IDLE_SHIFT 8 ++#define MDDR_EN (2 << 22) ++#define LPDDR2_EN (3 << 22) ++#define LPDDR3_EN (1 << 22) ++#define DDR2_EN (0 << 5) ++#define DDR3_EN (1 << 5) ++#define LPDDR2_S2 (0 << 6) ++#define LPDDR2_S4 (1 << 6) ++#define MDDR_LPDDR2_BL_2 (0 << 20) ++#define MDDR_LPDDR2_BL_4 (1 << 20) ++#define MDDR_LPDDR2_BL_8 (2 << 20) ++#define MDDR_LPDDR2_BL_16 (3 << 20) ++#define DDR2_DDR3_BL_4 0 ++#define DDR2_DDR3_BL_8 1 ++#define TFAW_SHIFT 18 ++#define PD_EXIT_SLOW (0 << 17) ++#define PD_EXIT_FAST (1 << 17) ++#define PD_TYPE_SHIFT 16 ++#define BURSTLENGTH_SHIFT 20 ++ ++#define MCFG_CR_2T_BIT(x) ((x & (1 << 3)) >> 3) ++#define MCFG_DDR_MASK 0x60 ++#define MCFG_DDR_SHIFT 5 ++#define MCFG_LPDDR_MASK 0xC00000 ++#define MCFG_LPDDR_SHIFT 22 ++ ++#define MCFG_LPDDR2_S2 0x0 ++#define MCFG_DDR3 0x1 ++#define MCFG_LPDDR2_S4 0x2 ++ ++#define READ_DRAMTYPE_INFO(n) (((n) >> 13) & 0x7) ++ ++enum { ++ DDR4 = 0, ++ DDR2 = 2, ++ DDR3 = 3, ++ LPDDR2 = 5, ++ LPDDR3 = 6, ++ LPDDR4 = 7, ++ UNUSED = 0xFF ++}; ++ ++struct share_params { ++ u32 hz; ++ u32 lcdc_type; ++ u32 vop; ++ u32 vop_dclk_mode; ++ u32 sr_idle_en; ++ u32 addr_mcu_el3; ++ /* ++ * 1: need to wait flag1 ++ * 0: never wait flag1 ++ */ ++ u32 wait_flag1; ++ /* ++ * 1: need to wait flag1 ++ * 0: never wait flag1 ++ */ ++ u32 wait_flag0; ++ u32 complt_hwirq; ++ /* if need, add parameter after */ ++}; ++ ++static struct share_params *ddr_psci_param = NULL; ++ ++static const char * const rk3228_dts_timing[] = { ++ "dram_spd_bin", ++ "sr_idle", ++ "pd_idle", ++ "dram_dll_disb_freq", ++ "phy_dll_disb_freq", ++ "dram_odt_disb_freq", ++ "phy_odt_disb_freq", ++ "ddr3_drv", ++ "ddr3_odt", ++ "lpddr3_drv", ++ "lpddr3_odt", ++ "lpddr2_drv", ++ "phy_ddr3_clk_drv", ++ "phy_ddr3_cmd_drv", ++ "phy_ddr3_dqs_drv", ++ "phy_ddr3_odt", ++ "phy_lp23_clk_drv", ++ "phy_lp23_cmd_drv", ++ "phy_lp23_dqs_drv", ++ "phy_lp3_odt" ++}; ++ ++struct rk3228_ddr_dts_config_timing { ++ u32 dram_spd_bin; ++ u32 sr_idle; ++ u32 pd_idle; ++ u32 dram_dll_dis_freq; ++ u32 phy_dll_dis_freq; ++ u32 dram_odt_dis_freq; ++ u32 phy_odt_dis_freq; ++ u32 ddr3_drv; ++ u32 ddr3_odt; ++ u32 lpddr3_drv; ++ u32 lpddr3_odt; ++ u32 lpddr2_drv; ++ u32 phy_ddr3_clk_drv; ++ u32 phy_ddr3_cmd_drv; ++ u32 phy_ddr3_dqs_drv; ++ u32 phy_ddr3_odt; ++ u32 phy_lp23_clk_drv; ++ u32 phy_lp23_cmd_drv; ++ u32 phy_lp23_dqs_drv; ++ u32 phy_lp3_odt; ++}; ++ ++struct rk3228_devfreq { ++ struct devfreq *devfreq; ++ struct thermal_cooling_device *cooling; ++}; ++ ++struct rk3228_dmc { ++ struct device *dev; ++ void __iomem *iomem; ++ ++ int rate; ++ struct devfreq_simple_ondemand_data ondemand_data; ++ struct devfreq_event_dev *edev; ++ struct clk *dmc_clk; ++ struct rk3228_devfreq devfreq; ++ u32 load; ++ ++ uint32_t dram_type; ++ ++ //struct mutex lock; ++ ++ int (*set_auto_self_refresh)(u32 en); ++}; ++ ++static uint32_t of_get_rk3228_timings(struct device *dev, ++ struct device_node *np, uint32_t *timing) ++{ ++ struct device_node *np_tim; ++ uint32_t offset; ++ int ret = 0; ++ u32 idx; ++ ++ // first 4kb page is reserved for interface parameters, we calculate an offset ++ // after which the timing parameters start ++ offset = DTS_PAR_OFFSET / sizeof(uint32_t); ++ ++ np_tim = of_parse_phandle(np, "rockchip,dram_timing", 0); ++ ++ if (!np_tim) { ++ ret = -EINVAL; ++ goto end; ++ } ++ ++ for (idx = 0; idx < ARRAY_SIZE(rk3228_dts_timing); idx++) ++ ret |= of_property_read_u32(np_tim, rk3228_dts_timing[idx], &timing[offset + idx]); ++ ++end: ++ if (ret) ++ dev_err(dev, "of_get_ddr_timings: fail\n"); ++ ++ of_node_put(np_tim); ++ ++ return ret; ++ ++} ++ ++static int rockchip_ddr_set_auto_self_refresh(uint32_t en) ++{ ++ struct arm_smccc_res res; ++ ++ ddr_psci_param->sr_idle_en = en; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, ++ SHARE_PAGE_TYPE_DDR, 0, ROCKCHIP_SIP_CONFIG_DRAM_SET_AT_SR, ++ 0, 0, 0, 0, &res); ++ ++ return res.a0; ++} ++ ++static int rk3228_dmc_init_sip(void) ++{ ++ struct arm_smccc_res res; ++ ++ arm_smccc_smc(ROCKCHIP_SIP_SIP_VERSION, ROCKCHIP_SIP_IMPLEMENT_V2, SECURE_REG_WR, 0, 0, 0, 0, 0, &res); ++ ++ if (res.a0) ++ return 0; ++ ++ return res.a1; ++ ++} ++ ++static int rk3228_dmc_target(struct device *dev, unsigned long *freq, ++ u32 flags) ++{ ++ ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ struct dev_pm_opp *opp; ++ int err; ++ ++ opp = devfreq_recommended_opp(dev, freq, flags); ++ if (IS_ERR(opp)) ++ return PTR_ERR(opp); ++ dev_pm_opp_put(opp); ++ ++ err = dev_pm_opp_set_rate(dev, *freq); ++ if (err) ++ return err; ++ ++ rdev->rate = *freq; ++ ++ return 0; ++ ++} ++ ++static int rk3228_dmc_get_dev_status(struct device *dev, ++ struct devfreq_dev_status *stat) ++{ ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ struct devfreq_event_data edata; ++ int ret = 0; ++ ++ ret = devfreq_event_get_event(rdev->edev, &edata); ++ if (ret < 0) ++ return ret; ++ ++ stat->current_frequency = rdev->rate; ++ stat->busy_time = edata.load_count; ++ stat->total_time = edata.total_count; ++ rdev->load = (edata.load_count * 100) / edata.total_count; ++ ++ return ret; ++} ++ ++static int rk3228_dmc_get_cur_freq(struct device *dev, unsigned long *freq) ++{ ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ ++ *freq = rdev->rate; ++ ++ return 0; ++} ++ ++static struct devfreq_dev_profile rk3228_devfreq_profile = { ++ .polling_ms = 50, ++ .target = rk3228_dmc_target, ++ .get_dev_status = rk3228_dmc_get_dev_status, ++ .get_cur_freq = rk3228_dmc_get_cur_freq, ++}; ++ ++void rk3228_devfreq_fini(struct rk3228_dmc *rdev) ++{ ++ struct rk3228_devfreq *devfreq = &rdev->devfreq; ++ ++ if (devfreq->cooling) { ++ devfreq_cooling_unregister(devfreq->cooling); ++ devfreq->cooling = NULL; ++ } ++ ++ if (devfreq->devfreq) { ++ devm_devfreq_remove_device(rdev->dev, devfreq->devfreq); ++ devfreq->devfreq = NULL; ++ } ++ ++} ++ ++int rk3228_devfreq_init(struct rk3228_dmc *rdev) ++{ ++ struct thermal_cooling_device *cooling; ++ struct device *dev = rdev->dev; ++ struct devfreq *devfreq; ++ struct rk3228_devfreq *rdevfreq = &rdev->devfreq; ++ const char *regulator_names[] = { "logic", NULL }; ++ ++ struct dev_pm_opp *opp; ++ unsigned long cur_freq; ++ int ret; ++ ++ if (!device_property_present(dev, "operating-points-v2")) ++ /* Optional, continue without devfreq */ ++ return 0; ++ ++ ret = devm_pm_opp_set_clkname(dev, "ddr_sclk"); ++ if (ret) ++ goto err_fini; ++ ++ ret = devm_pm_opp_set_regulators(dev, regulator_names); ++ ++ /* Continue if the optional regulator is missing */ ++ if (ret && ret != -ENODEV) ++ goto err_fini; ++ ++ ret = devm_pm_opp_of_add_table(dev); ++ if (ret) ++ goto err_fini; ++ ++ cur_freq = 0; ++ ++ opp = devfreq_recommended_opp(dev, &cur_freq, 0); ++ if (IS_ERR(opp)) { ++ ret = PTR_ERR(opp); ++ goto err_fini; ++ } ++ ++ rk3228_devfreq_profile.initial_freq = cur_freq; ++ dev_pm_opp_put(opp); ++ ++ rdev->ondemand_data.upthreshold = 30; ++ rdev->ondemand_data.downdifferential = 5; ++ ++ devfreq = devm_devfreq_add_device(dev, &rk3228_devfreq_profile, ++ DEVFREQ_GOV_SIMPLE_ONDEMAND, &rdev->ondemand_data); ++ if (IS_ERR(devfreq)) { ++ dev_err(dev, "Couldn't initialize GPU devfreq\n"); ++ ret = PTR_ERR(devfreq); ++ goto err_fini; ++ } ++ ++ rdevfreq->devfreq = devfreq; ++ ++ cooling = of_devfreq_cooling_register(dev->of_node, devfreq); ++ if (IS_ERR(cooling)) ++ dev_warn(dev, "Failed to register cooling device\n"); ++ else ++ rdevfreq->cooling = cooling; ++ ++ return 0; ++ ++err_fini: ++ rk3228_devfreq_fini(rdev); ++ return ret; ++} ++ ++static int rk3228_dmc_init(struct platform_device *pdev, ++ struct rk3228_dmc *rdev) ++{ ++ struct arm_smccc_res res; ++ u32 page_num; ++ ++ // Count of pages to request to trust os, in pages of 4kb ++ page_num = DIV_ROUND_UP(sizeof(struct rk3228_ddr_dts_config_timing), PAGE_SIZE) + 1; ++ ++ dev_dbg(&pdev->dev, "trying to allocate %d pages\n", page_num); ++ ++ // Do request to trust OS. res.a0 contains error code, res.a1 the *physical* ++ // initial location of pages ++ arm_smccc_smc( ++ ROCKCHIP_SIP_SHARE_MEM, ++ page_num, SHARE_PAGE_TYPE_DDR, 0, ++ 0, 0, 0, 0, &res ++ ); ++ ++ if (res.a0) { ++ dev_err(&pdev->dev, "no ATF memory for init\n"); ++ return -ENOMEM; ++ } ++ ++ dev_dbg(&pdev->dev, "allocated %d shared memory pages\n", page_num); ++ ++ // Remap the physical location to kernel space using ioremap ++ ddr_psci_param = (struct share_params *)ioremap(res.a1, page_num << PAGE_SHIFT); ++ ++ if (of_get_rk3228_timings(&pdev->dev, pdev->dev.of_node, ++ (uint32_t *)ddr_psci_param)) ++ return -ENOMEM; ++ ++ // Reset Hz value ++ ddr_psci_param->hz = 0; ++ ++ arm_smccc_smc( ++ ROCKCHIP_SIP_DRAM_FREQ, ++ SHARE_PAGE_TYPE_DDR, 0, ROCKCHIP_SIP_CONFIG_DRAM_INIT, ++ 0, 0, 0, 0, &res ++ ); ++ ++ if (res.a0) { ++ dev_err(&pdev->dev, "rockchip_sip_config_dram_init error:%lx\n", ++ res.a0); ++ return -EINVAL; ++ } ++ ++ dev_notice(&pdev->dev, "TEE DRAM configuration initialized\n"); ++ ++ rdev->set_auto_self_refresh = rockchip_ddr_set_auto_self_refresh; ++ ++ return 0; ++ ++} ++ ++static __maybe_unused int rk3228_dmc_suspend(struct device *dev) ++{ ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ int ret = 0; ++ ++ ret = devfreq_event_disable_edev(rdev->edev); ++ if (ret < 0) { ++ dev_err(dev, "failed to disable the devfreq-event devices\n"); ++ return ret; ++ } ++ ++ ret = devfreq_suspend_device(rdev->devfreq.devfreq); ++ if (ret < 0) { ++ dev_err(dev, "failed to suspend the devfreq devices\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static __maybe_unused int rk3228_dmc_resume(struct device *dev) ++{ ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ int ret = 0; ++ ++ ret = devfreq_event_enable_edev(rdev->edev); ++ if (ret < 0) { ++ dev_err(dev, "failed to enable the devfreq-event devices\n"); ++ return ret; ++ } ++ ++ ret = devfreq_resume_device(rdev->devfreq.devfreq); ++ if (ret < 0) { ++ dev_err(dev, "failed to resume the devfreq devices\n"); ++ return ret; ++ } ++ return ret; ++} ++ ++static uint32_t rk3228_get_dram_type(struct device *dev, struct device_node *node_grf, struct rk3228_dmc *data) ++{ ++ ++ struct regmap *regmap_grf; ++ uint32_t dram_type; ++ uint32_t val; ++ ++ dram_type = UNUSED; ++ ++ regmap_grf = syscon_node_to_regmap(node_grf); ++ ++ if (IS_ERR(regmap_grf)) { ++ dev_err(dev, "Cannot map rockchip,grf\n"); ++ goto err; ++ } ++ ++ regmap_read(regmap_grf, RK3228_GRF_OS_REG2, &val); ++ dram_type = READ_DRAMTYPE_INFO(val); ++ ++err: ++ ++ return dram_type; ++ ++} ++ ++static SIMPLE_DEV_PM_OPS(rk3228_dmc_pm, rk3228_dmc_suspend, ++ rk3228_dmc_resume); ++ ++static int rk3328_dmc_print_info(struct rk3228_dmc *rdev) ++{ ++ ++ u32 tcl; ++ u32 tras; ++ u32 trp; ++ u32 trcd; ++ ++ u32 mcfg; ++ // u32 reg_ddr_type1; ++ // u32 reg_ddr_type2; ++ ++ u32 cr; ++ ++ const char * const cr_types[] = { ++ "1T", ++ "2T" ++ }; ++ ++ ++ tcl = readl(rdev->iomem + DDR_PCTL_TCL) & 0xf; ++ tras = readl(rdev->iomem + DDR_PCTL_TRAS) & 0x3f; ++ trp = readl(rdev->iomem + DDR_PCTL_TRP) & 0xf; ++ trcd = readl(rdev->iomem + DDR_PCTL_TRCD) & 0xf; ++ ++ mcfg = readl(rdev->iomem + DDR_PCTL_MCFG); ++ ++ cr = MCFG_CR_2T_BIT(mcfg); ++ ++ dev_info(rdev->dev, ++ "Memory timings (tCL, tRCD, tRP, tRAS): CL%d-%d-%d-%d command rate: %s (mcfg register: 0x%x)\n", ++ tcl, trcd, trp, tras, cr_types[cr], mcfg); ++ ++ return 0; ++ ++} ++ ++/** ++ * Callback to return the current load on DRAM in percentage exported via sysfs; see DEVICE_ATTR_RO(SYSFS_LOAD) ++ */ ++#define SYSFS_LOAD load ++static ssize_t load_show(struct device *dev, struct device_attribute *attr, char *buf) ++{ ++ ++ int ret; ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ ++ mutex_lock(&rdev->devfreq.devfreq->lock); ++ ++ ret = sysfs_emit(buf, "%u", rdev->load); ++ ++ mutex_unlock(&rdev->devfreq.devfreq->lock); ++ ++ return ret; ++ ++} ++static DEVICE_ATTR_RO(SYSFS_LOAD); ++ ++#define SYSFS_UPTHRESHOLD upthreshold ++static ssize_t upthreshold_show(struct device *dev, struct device_attribute *attr, char *buf) ++{ ++ ++ int ret; ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ ++ mutex_lock(&rdev->devfreq.devfreq->lock); ++ ++ ret = sysfs_emit(buf, "%u", rdev->ondemand_data.upthreshold); ++ ++ mutex_unlock(&rdev->devfreq.devfreq->lock); ++ ++ return ret; ++ ++} ++ ++static ssize_t upthreshold_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ ++ int ret; ++ u32 upthreshold; ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ ++ mutex_lock(&rdev->devfreq.devfreq->lock); ++ ++ ret = kstrtouint(buf, 0, &upthreshold); ++ ++ if (ret < 0) ++ goto out; ++ ++ if (upthreshold > 100) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ rdev->ondemand_data.upthreshold = upthreshold; ++ ++ ret = count; ++ ++out: ++ mutex_unlock(&rdev->devfreq.devfreq->lock); ++ ++ return ret; ++ ++} ++static DEVICE_ATTR_RW(SYSFS_UPTHRESHOLD); ++ ++#define SYSFS_DOWNDIFFERENTIAL downdifferential ++static ssize_t downdifferential_show(struct device *dev, struct device_attribute *attr, char *buf) ++{ ++ ++ int ret; ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ ++ mutex_lock(&rdev->devfreq.devfreq->lock); ++ ++ ret = sysfs_emit(buf, "%u", rdev->ondemand_data.downdifferential); ++ ++ mutex_unlock(&rdev->devfreq.devfreq->lock); ++ ++ return ret; ++ ++} ++ ++static ssize_t downdifferential_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ ++ int ret; ++ u32 downdifferential; ++ struct rk3228_dmc *rdev = dev_get_drvdata(dev); ++ ++ mutex_lock(&rdev->devfreq.devfreq->lock); ++ ++ ret = kstrtouint(buf, 0, &downdifferential); ++ ++ if (ret < 0) ++ goto out; ++ ++ if (downdifferential > 100) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ rdev->ondemand_data.downdifferential = downdifferential; ++ ++ ret = count; ++ ++out: ++ mutex_unlock(&rdev->devfreq.devfreq->lock); ++ ++ return ret; ++ ++} ++static DEVICE_ATTR_RW(SYSFS_DOWNDIFFERENTIAL); ++ ++static int rk3228_dmc_sysfs_create(struct device *dev) ++{ ++ ++ int ret; ++ ++ ret = device_create_file(dev, &dev_attr_SYSFS_LOAD); ++ if (ret < 0) ++ goto out; ++ ++ ret = device_create_file(dev, &dev_attr_SYSFS_UPTHRESHOLD); ++ if (ret < 0) ++ goto out; ++ ++ ret = device_create_file(dev, &dev_attr_SYSFS_DOWNDIFFERENTIAL); ++ if (ret < 0) ++ goto out; ++ ++out: ++ return ret; ++ ++} ++ ++static void rk3228_dmc_sysfs_remove(struct device *dev) ++{ ++ ++ device_remove_file(dev, &dev_attr_SYSFS_LOAD); ++ device_remove_file(dev, &dev_attr_SYSFS_UPTHRESHOLD); ++ device_remove_file(dev, &dev_attr_SYSFS_DOWNDIFFERENTIAL); ++ ++} ++ ++ ++static int rk3228_dmc_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = pdev->dev.of_node; ++ struct rk3228_dmc *data; ++ struct device_node *node_grf; ++ int ret; ++ ++ ret = rk3228_dmc_init_sip(); ++ if (ret == 0) { ++ dev_err(dev, "Rockchip SIP initialization failed\n"); ++ return -ENODEV; ++ } ++ ++ dev_info(dev, "Rockchip SIP initialized, version %x\n", ret); ++ ++ data = devm_kzalloc(dev, sizeof(struct rk3228_dmc), GFP_KERNEL); ++ if (!data) ++ return -ENOMEM; ++ ++ data->dmc_clk = devm_clk_get(dev, "ddr_sclk"); ++ if (IS_ERR(data->dmc_clk)) { ++ if (PTR_ERR(data->dmc_clk) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ ++ dev_err(dev, "Cannot get the clk dmc_clk\n"); ++ return PTR_ERR(data->dmc_clk); ++ } ++ ++ data->edev = devfreq_event_get_edev_by_phandle(dev, "devfreq-events", 0); ++ if (IS_ERR(data->edev)) ++ return -EPROBE_DEFER; ++ ++ data->iomem = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(data->iomem)) { ++ dev_err(dev, "fail to ioremap iomem\n"); ++ ret = PTR_ERR(data->iomem); ++ return ret; ++ } ++ ++ data->dev = dev; ++ ++ rk3328_dmc_print_info(data); ++ ++ node_grf = of_parse_phandle(np, "rockchip,grf", 0); ++ if (node_grf) { ++ ++ data->dram_type = rk3228_get_dram_type(dev, node_grf, data); ++ ++ if (data->dram_type == LPDDR2) { ++ dev_warn(dev, "detected LPDDR2 memory\n"); ++ } else if (data->dram_type == DDR2) { ++ dev_warn(dev, "detected DDR2 memory\n"); ++ } else if (data->dram_type == DDR3) { ++ dev_info(dev, "detected DDR3 memory\n"); ++ } else if (data->dram_type == LPDDR3) { ++ dev_info(dev, "detected LPDDR3 memory\n"); ++ } else if (data->dram_type == DDR4) { ++ dev_info(dev, "detected DDR4 memory\n"); ++ } else if (data->dram_type == LPDDR4) { ++ dev_info(dev, "detected LPDDR4 memory\n"); ++ } else if (data->dram_type == UNUSED) { ++ dev_info(dev, "memory type not detected\n"); ++ } else { ++ dev_info(dev, "unknown memory type: 0x%x\n", data->dram_type); ++ } ++ ++ } else { ++ ++ dev_warn(dev, "Cannot get rockchip,grf\n"); ++ data->dram_type = UNUSED; ++ ++ } ++ ++ if (data->dram_type == DDR3 || ++ data->dram_type == LPDDR3 || ++ data->dram_type == DDR4 || ++ data->dram_type == LPDDR4) { ++ ++ ret = devfreq_event_enable_edev(data->edev); ++ if (ret < 0) { ++ dev_err(dev, "failed to enable devfreq-event devices\n"); ++ return ret; ++ } ++ ++ ret = rk3228_dmc_init(pdev, data); ++ if (ret) ++ return ret; ++ ++ ret = rk3228_devfreq_init(data); ++ if (ret) ++ return ret; ++ ++ } else { ++ ++ dev_warn(dev, "detected memory type does not support clock scaling\n"); ++ ++ } ++ ++ platform_set_drvdata(pdev, data); ++ ++ ret = rk3228_dmc_sysfs_create(dev); ++ if (ret < 0) ++ dev_err(dev, "could not create sysfs interface files, ret=%d\n", ret); ++ ++ return 0; ++ ++} ++ ++static int rk3228_dmc_remove(struct platform_device *pdev) ++{ ++ struct rk3228_dmc *rdev = dev_get_drvdata(&pdev->dev); ++ ++ rk3228_dmc_sysfs_remove(&pdev->dev); ++ ++ /* ++ * Before remove the opp table we need to unregister the opp notifier. ++ */ ++ rk3228_devfreq_fini(rdev); ++ ++ if (ddr_psci_param) ++ iounmap(ddr_psci_param); ++ ++ return 0; ++} ++ ++static const struct of_device_id rk3228_dmc_of_match[] = { ++ { .compatible = "rockchip,rk3228-dmc" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rk3228_dmc_of_match); ++ ++static struct platform_driver rk3228_dmc_driver = { ++ .probe = rk3228_dmc_probe, ++ .remove = rk3228_dmc_remove, ++ .driver = { ++ .name = "rk3228-dmc", ++ .pm = &rk3228_dmc_pm, ++ .of_match_table = rk3228_dmc_of_match, ++ }, ++}; ++module_platform_driver(rk3228_dmc_driver); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Lin Huang "); ++MODULE_AUTHOR("Paolo Sabatino "); ++MODULE_DESCRIPTION("RK3228 dmcfreq driver with devfreq framework"); +-- +2.34.1 diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dwc2-no-clock-gating.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dwc2-no-clock-gating.patch new file mode 100644 index 000000000000..1059c68868b2 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-dwc2-no-clock-gating.patch @@ -0,0 +1,27 @@ +diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c +index 93f52e371cdd..fb135f62cf26 100644 +--- a/drivers/usb/dwc2/params.c ++++ b/drivers/usb/dwc2/params.c +@@ -132,6 +132,14 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) + p->hird_threshold_en = false; + } + ++static void dwc2_set_rk3228_params(struct dwc2_hsotg *hsotg) ++{ ++ struct dwc2_core_params *p = &hsotg->params; ++ ++ dwc2_set_rk_params(hsotg); ++ p->no_clock_gating = true; ++} ++ + static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg) + { + struct dwc2_core_params *p = &hsotg->params; +@@ -277,6 +285,7 @@ const struct of_device_id dwc2_of_match_table[] = { + { .compatible = "ingenic,x1830-otg", .data = dwc2_set_x1600_params }, + { .compatible = "ingenic,x2000-otg", .data = dwc2_set_x2000_params }, + { .compatible = "rockchip,rk3066-usb", .data = dwc2_set_rk_params }, ++ { .compatible = "rockchip,rk3228-usb", .data = dwc2_set_rk3228_params }, + { .compatible = "lantiq,arx100-usb", .data = dwc2_set_ltq_params }, + { .compatible = "lantiq,xrx200-usb", .data = dwc2_set_ltq_params }, + { .compatible = "snps,dwc2" }, diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-usb-reset-props.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-usb-reset-props.patch new file mode 100644 index 000000000000..81deaa758e18 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/rk322x-usb-reset-props.patch @@ -0,0 +1,75 @@ +From 6668d12fd4a628299ffbf89794b6f7f67416e3fa Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 4 May 2024 15:12:43 +0200 +Subject: [PATCH] add reset props to usb otg/ehci ports + +usb resets are needed in case u-boot does its own reset +of the devices, otherwise ports are left in a +non-functional state. Also fixes occasional missing +device detection on the OTG port. + +In any case, when reset are present, the iddig filter +wait time always times out, so we comment it as it +looks unnecessary (the port works fine, the device is +always detected also in case of timeout) +--- + arch/arm/boot/dts/rockchip/rk322x.dtsi | 8 ++++++++ + drivers/usb/dwc2/core.c | 2 +- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk322x.dtsi b/arch/arm/boot/dts/rockchip/rk322x.dtsi +index 03d9baddcbab..17c5f0a8fcf3 100644 +--- a/arch/arm/boot/dts/rockchip/rk322x.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk322x.dtsi +@@ -807,6 +807,8 @@ usb_otg: usb@30040000 { + g-tx-fifo-size = <256 128 128 64 32 16>; + phys = <&u2phy0_otg>; + phy-names = "usb2-phy"; ++ resets = <&cru SRST_USBOTG>; ++ reset-names = "dwc2"; + status = "disabled"; + }; + +@@ -817,6 +819,8 @@ usb_host0_ehci: usb@30080000 { + clocks = <&cru HCLK_HOST0>, <&u2phy0>; + phys = <&u2phy0_host>; + phy-names = "usb"; ++ resets = <&cru SRST_USBHOST0>; ++ reset-names = "ehci"; + status = "disabled"; + }; + +@@ -837,6 +841,8 @@ usb_host1_ehci: usb@300c0000 { + clocks = <&cru HCLK_HOST1>, <&u2phy1>; + phys = <&u2phy1_otg>; + phy-names = "usb"; ++ resets = <&cru SRST_USBHOST1>; ++ reset-names = "ehci"; + status = "disabled"; + }; + +@@ -857,6 +863,8 @@ usb_host2_ehci: usb@30100000 { + clocks = <&cru HCLK_HOST2>, <&u2phy1>; + phys = <&u2phy1_host>; + phy-names = "usb"; ++ resets = <&cru SRST_USBHOST2>; ++ reset-names = "ehci"; + status = "disabled"; + }; + +diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c +index 5635e4d7ec88..1e20aabc2033 100644 +--- a/drivers/usb/dwc2/core.c ++++ b/drivers/usb/dwc2/core.c +@@ -413,7 +413,7 @@ int dwc2_core_reset(struct dwc2_hsotg *hsotg, bool skip_wait) + + if (!(gotgctl & GOTGCTL_CONID_B) || + (gusbcfg & GUSBCFG_FORCEHOSTMODE)) { +- wait_for_host_mode = true; ++ wait_for_host_mode = false; + } + } + +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-ath9k-no-bulk-EP3-EP4.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-ath9k-no-bulk-EP3-EP4.patch new file mode 100644 index 000000000000..17b44a5f331f --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-ath9k-no-bulk-EP3-EP4.patch @@ -0,0 +1,102 @@ +FROM: Solidhal + +This patch reverses commit 2b721118b7821107757eb1d37af4b60e877b27e7, as can bee seen here: +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2b721118b7821107757eb1d37af4b60e877b27e7 + +This commit caused issues on veyron speedy with ath9k and dwc2 drivers. Any ath9k device (ar9271) +would intermittently work, most of the time ending in errors as can bee seen here: +https://github.com/SolidHal/PrawnOS/issues/38 +This commit fixes that issue. +This is only a temporary work around while a permenant fix is found, as this commit seems to only cause issues +with dwc2 + + +diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c +index 3f563e02d..903851481 100644 +--- a/drivers/net/wireless/ath/ath9k/hif_usb.c ++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c +@@ -118,10 +118,10 @@ static int hif_usb_send_regout(struct hif_device_usb *hif_dev, + cmd->skb = skb; + cmd->hif_dev = hif_dev; + +- usb_fill_int_urb(urb, hif_dev->udev, +- usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE), ++ usb_fill_bulk_urb(urb, hif_dev->udev, ++ usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE), + skb->data, skb->len, +- hif_usb_regout_cb, cmd, 1); ++ hif_usb_regout_cb, cmd); + + usb_anchor_urb(urb, &hif_dev->regout_submitted); + ret = usb_submit_urb(urb, GFP_KERNEL); +@@ -735,11 +735,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) + + rx_buf->skb = skb; + +- usb_fill_int_urb(urb, hif_dev->udev, +- usb_rcvintpipe(hif_dev->udev, ++ usb_fill_bulk_urb(urb, hif_dev->udev, ++ usb_rcvbulkpipe(hif_dev->udev, + USB_REG_IN_PIPE), + skb->data, MAX_REG_IN_BUF_SIZE, +- ath9k_hif_usb_reg_in_cb, rx_buf, 1); ++ ath9k_hif_usb_reg_in_cb, rx_buf); + } + + resubmit: +@@ -944,11 +944,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) + rx_buf->hif_dev = hif_dev; + rx_buf->skb = skb; + +- usb_fill_int_urb(urb, hif_dev->udev, +- usb_rcvintpipe(hif_dev->udev, ++ usb_fill_bulk_urb(urb, hif_dev->udev, ++ usb_rcvbulkpipe(hif_dev->udev, + USB_REG_IN_PIPE), + skb->data, MAX_REG_IN_BUF_SIZE, +- ath9k_hif_usb_reg_in_cb, rx_buf, 1); ++ ath9k_hif_usb_reg_in_cb, skb); + + /* Anchor URB */ + usb_anchor_urb(urb, &hif_dev->reg_in_submitted); +@@ -1069,7 +1069,9 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) + + static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) + { +- int ret; ++ struct usb_host_interface *alt = &hif_dev->interface->altsetting[0]; ++ struct usb_endpoint_descriptor *endp; ++ int ret, idx; + + ret = ath9k_hif_usb_download_fw(hif_dev); + if (ret) { +@@ -1079,6 +1081,20 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) + return ret; + } + ++ /* On downloading the firmware to the target, the USB descriptor of EP4 ++ * is 'patched' to change the type of the endpoint to Bulk. This will ++ * bring down CPU usage during the scan period. ++ */ ++ for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) { ++ endp = &alt->endpoint[idx].desc; ++ if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ++ == USB_ENDPOINT_XFER_INT) { ++ endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK; ++ endp->bmAttributes |= USB_ENDPOINT_XFER_BULK; ++ endp->bInterval = 0; ++ } ++ } ++ + /* Alloc URBs */ + ret = ath9k_hif_usb_alloc_urbs(hif_dev); + if (ret) { +@@ -1353,7 +1369,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev) + if (!buf) + return; + +- ret = usb_interrupt_msg(udev, usb_sndintpipe(udev, USB_REG_OUT_PIPE), ++ ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE), + buf, 4, NULL, USB_MSG_TIMEOUT); + if (ret) + dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n"); diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-add-bcm43342.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-add-bcm43342.patch new file mode 100644 index 000000000000..e0307dc9c54b --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-add-bcm43342.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Thu, 10 Feb 2022 21:30:54 +0000 +Subject: add broadcom bcm43342 chip id + +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 6b38d9de71af..6a603d045103 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -609,6 +609,7 @@ BRCMF_FW_DEF(4329, "brcmfmac4329-sdio"); + BRCMF_FW_DEF(4330, "brcmfmac4330-sdio"); + BRCMF_FW_DEF(4334, "brcmfmac4334-sdio"); + BRCMF_FW_DEF(43340, "brcmfmac43340-sdio"); ++BRCMF_FW_DEF(43342, "brcmfmac43342-sdio"); + BRCMF_FW_DEF(4335, "brcmfmac4335-sdio"); + BRCMF_FW_DEF(43362, "brcmfmac43362-sdio"); + BRCMF_FW_DEF(4339, "brcmfmac4339-sdio"); +@@ -642,6 +643,7 @@ static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), + BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_ENTRY(BRCM_CC_43342_CHIP_ID, 0xFFFFFFFF, 43342), + BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), + BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), + BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), +diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +index 44684bf1b9ac..bcf48de78d53 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -27,6 +27,7 @@ + #define BRCM_CC_4334_CHIP_ID 0x4334 + #define BRCM_CC_43340_CHIP_ID 43340 + #define BRCM_CC_43341_CHIP_ID 43341 ++#define BRCM_CC_43342_CHIP_ID 43342 + #define BRCM_CC_43362_CHIP_ID 43362 + #define BRCM_CC_4335_CHIP_ID 0x4335 + #define BRCM_CC_4339_CHIP_ID 0x4339 +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-ap6330-firmware.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-ap6330-firmware.patch new file mode 100644 index 000000000000..affb86e4e7e6 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-brcmfmac-ap6330-firmware.patch @@ -0,0 +1,23 @@ +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index a907d7b06..ec71996c7 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -619,13 +619,17 @@ BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); + BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); + BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); + ++/* AMPAK */ ++BRCMF_FW_DEF(AP6330, "brcmfmac-ap6330-sdio"); ++ + static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), + BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), + BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), + BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5), + BRCMF_FW_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329), +- BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), ++ BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFEF, 4330), ++ BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0x10, AP6330), + BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), + BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), + BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-esp8089.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-esp8089.patch new file mode 100644 index 000000000000..d76d3aed6a87 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-esp8089.patch @@ -0,0 +1,10931 @@ +From 2d6165af6e9d5ed5026cdf250536c0a00d84fd75 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 1 Oct 2022 12:43:53 +0000 +Subject: [PATCH] add esp8089 kernel driver + +--- + drivers/net/wireless/Kconfig | 1 + + drivers/net/wireless/Makefile | 1 + + drivers/net/wireless/esp8089/.gitignore | 7 + + drivers/net/wireless/esp8089/Kconfig | 13 + + drivers/net/wireless/esp8089/LICENSE | 340 +++ + drivers/net/wireless/esp8089/Makefile | 7 + + drivers/net/wireless/esp8089/Makefile.old | 99 + + drivers/net/wireless/esp8089/README.md | 31 + + drivers/net/wireless/esp8089/esp_ctrl.c | 801 ++++++ + drivers/net/wireless/esp8089/esp_ctrl.h | 58 + + drivers/net/wireless/esp8089/esp_debug.c | 297 ++ + drivers/net/wireless/esp8089/esp_debug.h | 101 + + drivers/net/wireless/esp8089/esp_ext.c | 542 ++++ + drivers/net/wireless/esp8089/esp_ext.h | 100 + + drivers/net/wireless/esp8089/esp_file.c | 258 ++ + drivers/net/wireless/esp8089/esp_file.h | 43 + + drivers/net/wireless/esp8089/esp_init_data.h | 7 + + drivers/net/wireless/esp8089/esp_io.c | 639 +++++ + drivers/net/wireless/esp8089/esp_mac80211.c | 1727 ++++++++++++ + drivers/net/wireless/esp8089/esp_mac80211.h | 38 + + drivers/net/wireless/esp8089/esp_main.c | 263 ++ + drivers/net/wireless/esp8089/esp_path.h | 6 + + drivers/net/wireless/esp8089/esp_pub.h | 222 ++ + drivers/net/wireless/esp8089/esp_sif.h | 207 ++ + drivers/net/wireless/esp8089/esp_sip.c | 2418 +++++++++++++++++ + drivers/net/wireless/esp8089/esp_sip.h | 171 ++ + drivers/net/wireless/esp8089/esp_utils.c | 262 ++ + drivers/net/wireless/esp8089/esp_utils.h | 41 + + drivers/net/wireless/esp8089/esp_version.h | 1 + + drivers/net/wireless/esp8089/esp_wl.h | 63 + + drivers/net/wireless/esp8089/esp_wmac.h | 92 + + .../wireless/esp8089/firmware/LICENSE-2.0.txt | 203 ++ + drivers/net/wireless/esp8089/sdio_sif_esp.c | 811 ++++++ + drivers/net/wireless/esp8089/sip2_common.h | 475 ++++ + .../net/wireless/esp8089/slc_host_register.h | 271 ++ + 35 files changed, 10616 insertions(+) + create mode 100644 drivers/net/wireless/esp8089/.gitignore + create mode 100644 drivers/net/wireless/esp8089/Kconfig + create mode 100644 drivers/net/wireless/esp8089/LICENSE + create mode 100644 drivers/net/wireless/esp8089/Makefile + create mode 100644 drivers/net/wireless/esp8089/Makefile.old + create mode 100644 drivers/net/wireless/esp8089/README.md + create mode 100644 drivers/net/wireless/esp8089/esp_ctrl.c + create mode 100644 drivers/net/wireless/esp8089/esp_ctrl.h + create mode 100644 drivers/net/wireless/esp8089/esp_debug.c + create mode 100644 drivers/net/wireless/esp8089/esp_debug.h + create mode 100644 drivers/net/wireless/esp8089/esp_ext.c + create mode 100644 drivers/net/wireless/esp8089/esp_ext.h + create mode 100644 drivers/net/wireless/esp8089/esp_file.c + create mode 100644 drivers/net/wireless/esp8089/esp_file.h + create mode 100644 drivers/net/wireless/esp8089/esp_init_data.h + create mode 100644 drivers/net/wireless/esp8089/esp_io.c + create mode 100644 drivers/net/wireless/esp8089/esp_mac80211.c + create mode 100644 drivers/net/wireless/esp8089/esp_mac80211.h + create mode 100644 drivers/net/wireless/esp8089/esp_main.c + create mode 100644 drivers/net/wireless/esp8089/esp_path.h + create mode 100644 drivers/net/wireless/esp8089/esp_pub.h + create mode 100644 drivers/net/wireless/esp8089/esp_sif.h + create mode 100644 drivers/net/wireless/esp8089/esp_sip.c + create mode 100644 drivers/net/wireless/esp8089/esp_sip.h + create mode 100644 drivers/net/wireless/esp8089/esp_utils.c + create mode 100644 drivers/net/wireless/esp8089/esp_utils.h + create mode 100644 drivers/net/wireless/esp8089/esp_version.h + create mode 100644 drivers/net/wireless/esp8089/esp_wl.h + create mode 100644 drivers/net/wireless/esp8089/esp_wmac.h + create mode 100644 drivers/net/wireless/esp8089/firmware/LICENSE-2.0.txt + create mode 100644 drivers/net/wireless/esp8089/sdio_sif_esp.c + create mode 100644 drivers/net/wireless/esp8089/sip2_common.h + create mode 100644 drivers/net/wireless/esp8089/slc_host_register.h + +diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig +index cb1c15012dd0..de5e37846397 100644 +--- a/drivers/net/wireless/Kconfig ++++ b/drivers/net/wireless/Kconfig +@@ -37,6 +37,7 @@ source "drivers/net/wireless/st/Kconfig" + source "drivers/net/wireless/ti/Kconfig" + source "drivers/net/wireless/zydas/Kconfig" + source "drivers/net/wireless/quantenna/Kconfig" ++source "drivers/net/wireless/esp8089/Kconfig" + + config PCMCIA_RAYCS + tristate "Aviator/Raytheon 2.4GHz wireless support" +diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile +index a61cf6c90343..92ffd2cef51c 100644 +--- a/drivers/net/wireless/Makefile ++++ b/drivers/net/wireless/Makefile +@@ -22,6 +22,7 @@ obj-$(CONFIG_WLAN_VENDOR_SILABS) += silabs/ + obj-$(CONFIG_WLAN_VENDOR_ST) += st/ + obj-$(CONFIG_WLAN_VENDOR_TI) += ti/ + obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/ ++obj-$(CONFIG_ESP8089) += esp8089/ + + # 16-bit wireless PCMCIA client drivers + obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o +diff --git a/drivers/net/wireless/esp8089/.gitignore b/drivers/net/wireless/esp8089/.gitignore +new file mode 100644 +index 000000000000..eae6529085d0 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/.gitignore +@@ -0,0 +1,7 @@ ++*.cmd ++*.o ++Module.symvers ++modules.order ++.tmp_versions ++*.ko ++*.mod.c +diff --git a/drivers/net/wireless/esp8089/Kconfig b/drivers/net/wireless/esp8089/Kconfig +new file mode 100644 +index 000000000000..8db1fc54712d +--- /dev/null ++++ b/drivers/net/wireless/esp8089/Kconfig +@@ -0,0 +1,13 @@ ++config ESP8089 ++ tristate "Espressif ESP8089 SDIO WiFi" ++ depends on MAC80211 ++ help ++ ESP8089 is a low-budget 2.4GHz WiFi chip by Espressif, used in many ++ cheap tablets with Allwinner or Rockchip SoC ++ ++config ESP8089_DEBUG_FS ++ bool "Enable DebugFS support for ESP8089" ++ depends on ESP8089 ++ default y ++ help ++ DebugFS support for ESP8089 +diff --git a/drivers/net/wireless/esp8089/LICENSE b/drivers/net/wireless/esp8089/LICENSE +new file mode 100644 +index 000000000000..d6a93266f748 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/LICENSE +@@ -0,0 +1,340 @@ ++GNU GENERAL PUBLIC LICENSE ++ Version 2, June 1991 ++ ++ Copyright (C) 1989, 1991 Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++License is intended to guarantee your freedom to share and change free ++software--to make sure the software is free for all its users. This ++General Public License applies to most of the Free Software ++Foundation's software and to any other program whose authors commit to ++using it. (Some other Free Software Foundation software is covered by ++the GNU Lesser General Public License instead.) You can apply it to ++your programs, too. ++ ++ When we speak of free software, we are referring to freedom, not ++price. Our General Public Licenses are designed to make sure that you ++have the freedom to distribute copies of free software (and charge for ++this service if you wish), that you receive source code or can get it ++if you want it, that you can change the software or use pieces of it ++in new free programs; and that you know you can do these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++anyone to deny you these rights or to ask you to surrender the rights. ++These restrictions translate to certain responsibilities for you if you ++distribute copies of the software, or if you modify it. ++ ++ For example, if you distribute copies of such a program, whether ++gratis or for a fee, you must give the recipients all the rights that ++you have. You must make sure that they, too, receive or can get the ++source code. And you must show them these terms so they know their ++rights. ++ ++ We protect your rights with two steps: (1) copyright the software, and ++(2) offer you this license which gives you legal permission to copy, ++distribute and/or modify the software. ++ ++ Also, for each author's protection and ours, we want to make certain ++that everyone understands that there is no warranty for this free ++software. If the software is modified by someone else and passed on, we ++want its recipients to know that what they have is not the original, so ++that any problems introduced by others will not reflect on the original ++authors' reputations. ++ ++ Finally, any free program is threatened constantly by software ++patents. We wish to avoid the danger that redistributors of a free ++program will individually obtain patent licenses, in effect making the ++program proprietary. To prevent this, we have made it clear that any ++patent must be licensed for everyone's free use or not licensed at all. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. ++ ++ GNU GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License applies to any program or other work which contains ++a notice placed by the copyright holder saying it may be distributed ++under the terms of this General Public License. The "Program", below, ++refers to any such program or work, and a "work based on the Program" ++means either the Program or any derivative work under copyright law: ++that is to say, a work containing the Program or a portion of it, ++either verbatim or with modifications and/or translated into another ++language. (Hereinafter, translation is included without limitation in ++the term "modification".) Each licensee is addressed as "you". ++ ++Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running the Program is not restricted, and the output from the Program ++is covered only if its contents constitute a work based on the ++Program (independent of having been made by running the Program). ++Whether that is true depends on what the Program does. ++ ++ 1. You may copy and distribute verbatim copies of the Program's ++source code as you receive it, in any medium, provided that you ++conspicuously and appropriately publish on each copy an appropriate ++copyright notice and disclaimer of warranty; keep intact all the ++notices that refer to this License and to the absence of any warranty; ++and give any other recipients of the Program a copy of this License ++along with the Program. ++ ++You may charge a fee for the physical act of transferring a copy, and ++you may at your option offer warranty protection in exchange for a fee. ++ ++ 2. You may modify your copy or copies of the Program or any portion ++of it, thus forming a work based on the Program, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) You must cause the modified files to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ b) You must cause any work that you distribute or publish, that in ++ whole or in part contains or is derived from the Program or any ++ part thereof, to be licensed as a whole at no charge to all third ++ parties under the terms of this License. ++ ++ c) If the modified program normally reads commands interactively ++ when run, you must cause it, when started running for such ++ interactive use in the most ordinary way, to print or display an ++ announcement including an appropriate copyright notice and a ++ notice that there is no warranty (or else, saying that you provide ++ a warranty) and that users may redistribute the program under ++ these conditions, and telling the user how to view a copy of this ++ License. (Exception: if the Program itself is interactive but ++ does not normally print such an announcement, your work based on ++ the Program is not required to print an announcement.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Program, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Program, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Program. ++ ++In addition, mere aggregation of another work not based on the Program ++with the Program (or with a work based on the Program) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may copy and distribute the Program (or a work based on it, ++under Section 2) in object code or executable form under the terms of ++Sections 1 and 2 above provided that you also do one of the following: ++ ++ a) Accompany it with the complete corresponding machine-readable ++ source code, which must be distributed under the terms of Sections ++ 1 and 2 above on a medium customarily used for software interchange; or, ++ ++ b) Accompany it with a written offer, valid for at least three ++ years, to give any third party, for a charge no more than your ++ cost of physically performing source distribution, a complete ++ machine-readable copy of the corresponding source code, to be ++ distributed under the terms of Sections 1 and 2 above on a medium ++ customarily used for software interchange; or, ++ ++ c) Accompany it with the information you received as to the offer ++ to distribute corresponding source code. (This alternative is ++ allowed only for noncommercial distribution and only if you ++ received the program in object code or executable form with such ++ an offer, in accord with Subsection b above.) ++ ++The source code for a work means the preferred form of the work for ++making modifications to it. For an executable work, complete source ++code means all the source code for all modules it contains, plus any ++associated interface definition files, plus the scripts used to ++control compilation and installation of the executable. However, as a ++special exception, the source code distributed need not include ++anything that is normally distributed (in either source or binary ++form) with the major components (compiler, kernel, and so on) of the ++operating system on which the executable runs, unless that component ++itself accompanies the executable. ++ ++If distribution of executable or object code is made by offering ++access to copy from a designated place, then offering equivalent ++access to copy the source code from the same place counts as ++distribution of the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 4. You may not copy, modify, sublicense, or distribute the Program ++except as expressly provided under this License. Any attempt ++otherwise to copy, modify, sublicense or distribute the Program is ++void, and will automatically terminate your rights under this License. ++However, parties who have received copies, or rights, from you under ++this License will not have their licenses terminated so long as such ++parties remain in full compliance. ++ ++ 5. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Program or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Program (or any work based on the ++Program), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Program or works based on it. ++ ++ 6. Each time you redistribute the Program (or any work based on the ++Program), the recipient automatically receives a license from the ++original licensor to copy, distribute or modify the Program subject to ++these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties to ++this License. ++ ++ 7. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Program at all. For example, if a patent ++license would not permit royalty-free redistribution of the Program by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Program. ++ ++If any portion of this section is held invalid or unenforceable under ++any particular circumstance, the balance of the section is intended to ++apply and the section as a whole is intended to apply in other ++circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system, which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 8. If the distribution and/or use of the Program is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Program under this License ++may add an explicit geographical distribution limitation excluding ++those countries, so that distribution is permitted only in or among ++countries not thus excluded. In such case, this License incorporates ++the limitation as if written in the body of this License. ++ ++ 9. The Free Software Foundation may publish revised and/or new versions ++of the General Public License from time to time. Such new versions will ++be similar in spirit to the present version, but may differ in detail to ++address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Program ++specifies a version number of this License which applies to it and "any ++later version", you have the option of following the terms and conditions ++either of that version or of any later version published by the Free ++Software Foundation. If the Program does not specify a version number of ++this License, you may choose any version ever published by the Free Software ++Foundation. ++ ++ 10. If you wish to incorporate parts of the Program into other free ++programs whose distribution conditions are different, write to the author ++to ask for permission. For software which is copyrighted by the Free ++Software Foundation, write to the Free Software Foundation; we sometimes ++make exceptions for this. Our decision will be guided by the two goals ++of preserving the free status of all derivatives of our free software and ++of promoting the sharing and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY ++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN ++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES ++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED ++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS ++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE ++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, ++REPAIR OR CORRECTION. ++ ++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING ++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR ++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, ++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING ++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED ++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY ++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER ++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE ++POSSIBILITY OF SUCH DAMAGES. ++ ++ END OF TERMS AND CONDITIONS ++ ++ How to Apply These Terms to Your New Programs ++ ++ If you develop a new program, and you want it to be of the greatest ++possible use to the public, the best way to achieve this is to make it ++free software which everyone can redistribute and change under these terms. ++ ++ To do so, attach the following notices to the program. It is safest ++to attach them to the start of each source file to most effectively ++convey the exclusion of warranty; and each file should have at least ++the "copyright" line and a pointer to where the full notice is found. ++ ++ {description} ++ Copyright (C) {year} {fullname} ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU 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. ++ ++Also add information on how to contact you by electronic and paper mail. ++ ++If the program is interactive, make it output a short notice like this ++when it starts in an interactive mode: ++ ++ Gnomovision version 69, Copyright (C) year name of author ++ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. ++ This is free software, and you are welcome to redistribute it ++ under certain conditions; type `show c' for details. ++ ++The hypothetical commands `show w' and `show c' should show the appropriate ++parts of the General Public License. Of course, the commands you use may ++be called something other than `show w' and `show c'; they could even be ++mouse-clicks or menu items--whatever suits your program. ++ ++You should also get your employer (if you work as a programmer) or your ++school, if any, to sign a "copyright disclaimer" for the program, if ++necessary. Here is a sample; alter the names: ++ ++ Yoyodyne, Inc., hereby disclaims all copyright interest in the program ++ `Gnomovision' (which makes passes at compilers) written by James Hacker. ++ ++ {signature of Ty Coon}, 1 April 1989 ++ Ty Coon, President of Vice ++ ++This General Public License does not permit incorporating your program into ++proprietary programs. If your program is a subroutine library, you may ++consider it more useful to permit linking proprietary applications with the ++library. If this is what you want to do, use the GNU Lesser General ++Public License instead of this License. ++ +diff --git a/drivers/net/wireless/esp8089/Makefile b/drivers/net/wireless/esp8089/Makefile +new file mode 100644 +index 000000000000..36decfd20ecd +--- /dev/null ++++ b/drivers/net/wireless/esp8089/Makefile +@@ -0,0 +1,7 @@ ++MODULE_NAME = esp8089 ++ ++$(MODULE_NAME)-y := esp_debug.o sdio_sif_esp.o esp_io.o \ ++ esp_file.o esp_main.o esp_sip.o esp_ext.o esp_ctrl.o \ ++ esp_mac80211.o esp_debug.o esp_utils.o ++ ++obj-$(CONFIG_ESP8089) := esp8089.o +diff --git a/drivers/net/wireless/esp8089/Makefile.old b/drivers/net/wireless/esp8089/Makefile.old +new file mode 100644 +index 000000000000..b7b1a47b159c +--- /dev/null ++++ b/drivers/net/wireless/esp8089/Makefile.old +@@ -0,0 +1,99 @@ ++MODNAME = esp8089 ++ ++# By default, we try to compile the modules for the currently running ++# kernel. But it's the first approximation, as we will re-read the ++# version from the kernel sources. ++KVERS_UNAME ?= $(shell uname -r) ++ ++# KBUILD is the path to the Linux kernel build tree. It is usually the ++# same as the kernel source tree, except when the kernel was compiled in ++# a separate directory. ++KBUILD ?= $(shell readlink -f /lib/modules/$(KVERS_UNAME)/build) ++ ++ifeq (,$(KBUILD)) ++$(error Kernel build tree not found - please set KBUILD to configured kernel) ++endif ++ ++KCONFIG := $(KBUILD)/.config ++ifeq (,$(wildcard $(KCONFIG))) ++$(error No .config found in $(KBUILD), please set KBUILD to configured kernel) ++endif ++ ++ifneq (,$(wildcard $(KBUILD)/include/linux/version.h)) ++ifneq (,$(wildcard $(KBUILD)/include/generated/uapi/linux/version.h)) ++$(error Multiple copies of version.h found, please clean your build tree) ++endif ++endif ++ ++# Kernel Makefile doesn't always know the exact kernel version, so we ++# get it from the kernel headers instead and pass it to make. ++VERSION_H := $(KBUILD)/include/generated/utsrelease.h ++ifeq (,$(wildcard $(VERSION_H))) ++VERSION_H := $(KBUILD)/include/linux/utsrelease.h ++endif ++ifeq (,$(wildcard $(VERSION_H))) ++VERSION_H := $(KBUILD)/include/linux/version.h ++endif ++ifeq (,$(wildcard $(VERSION_H))) ++$(error Please run 'make modules_prepare' in $(KBUILD)) ++endif ++ ++KVERS := $(shell sed -ne 's/"//g;s/^\#define UTS_RELEASE //p' $(VERSION_H)) ++ ++ifeq (,$(KVERS)) ++$(error Cannot find UTS_RELEASE in $(VERSION_H), please report) ++endif ++ ++INST_DIR = /lib/modules/$(KVERS)/misc ++ ++SRC_DIR=$(shell pwd) ++ ++include $(KCONFIG) ++ ++EXTRA_CFLAGS += -DCONFIG_ESP8089_DEBUG_FS ++ ++OBJS = esp_debug.o sdio_sif_esp.o esp_io.o \ ++ esp_file.o esp_main.o esp_sip.o esp_ext.o esp_ctrl.o \ ++ esp_mac80211.o esp_debug.o esp_utils.o esp_pm.o ++ ++all: config_check modules ++ ++MODULE := $(MODNAME).ko ++obj-m := $(MODNAME).o ++ ++$(MODNAME)-objs := $(OBJS) ++ ++config_check: ++ @if [ -z "$(CONFIG_WIRELESS_EXT)$(CONFIG_NET_RADIO)" ]; then \ ++ echo; echo; \ ++ echo "*** WARNING: This kernel lacks wireless extensions."; \ ++ echo "Wireless drivers will not work properly."; \ ++ echo; echo; \ ++ fi ++ ++modules: ++ $(MAKE) -C $(KBUILD) M=$(SRC_DIR) ++ ++$(MODULE): ++ $(MAKE) modules ++ ++clean: ++ rm -f *.o *.ko .*.cmd *.mod.c *.symvers modules.order ++ rm -rf .tmp_versions ++ ++install: config_check $(MODULE) ++ @/sbin/modinfo $(MODULE) | grep -q "^vermagic: *$(KVERS) " || \ ++ { echo "$(MODULE)" is not for Linux $(KVERS); exit 1; } ++ mkdir -p -m 755 $(DESTDIR)$(INST_DIR) ++ install -m 0644 $(MODULE) $(DESTDIR)$(INST_DIR) ++ifndef DESTDIR ++ -/sbin/depmod -a $(KVERS) ++endif ++ ++uninstall: ++ rm -f $(DESTDIR)$(INST_DIR)/$(MODULE) ++ifndef DESTDIR ++ -/sbin/depmod -a $(KVERS) ++endif ++ ++.PHONY: all modules clean install config_check +diff --git a/drivers/net/wireless/esp8089/README.md b/drivers/net/wireless/esp8089/README.md +new file mode 100644 +index 000000000000..56b40db272f3 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/README.md +@@ -0,0 +1,31 @@ ++esp8089 ++====== ++ ++ESP8089 Linux driver ++ ++v1.9 imported from the Rockchip Linux kernel github repo ++ ++Modified to build as a standalone module for SDIO devices. ++ ++ ++ ++ ++Building: ++ ++ make ++ ++Using: ++ ++Must load mac80211.ko first if not baked in. ++ ++ sudo modprobe esp8089.ko ++ ++If you get a wlan interface, but scanning shows no networks try using: ++ ++ sudo modprobe esp8089.ko config=crystal_26M_en=1 ++ ++or: ++ ++ sudo modprobe esp8089.ko config=crystal_26M_en=2 ++ ++To load the module. +diff --git a/drivers/net/wireless/esp8089/esp_ctrl.c b/drivers/net/wireless/esp8089/esp_ctrl.c +new file mode 100644 +index 000000000000..a19d2437dd82 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_ctrl.c +@@ -0,0 +1,801 @@ ++/* ++ * Copyright (c) 2009 - 2014 Espressif System. ++ * ++ * SIP ctrl packet parse and pack ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++#include ++#include ++#include ++ ++#include "esp_pub.h" ++#include "esp_sip.h" ++#include "esp_ctrl.h" ++#include "esp_sif.h" ++#include "esp_debug.h" ++#include "esp_wmac.h" ++#include "esp_utils.h" ++#include "esp_wl.h" ++#include "esp_file.h" ++#include "esp_path.h" ++#ifdef TEST_MODE ++#include "testmode.h" ++#endif /* TEST_MODE */ ++#include "esp_version.h" ++ ++extern struct completion *gl_bootup_cplx; ++ ++static void esp_tx_ba_session_op(struct esp_sip *sip, ++ struct esp_node *node, ++ trc_ampdu_state_t state, u8 tid) ++{ ++ struct esp_tx_tid *txtid; ++ ++ txtid = &node->tid[tid]; ++ if (state == TRC_TX_AMPDU_STOPPED) { ++ if (txtid->state == ESP_TID_STATE_OPERATIONAL) { ++ esp_dbg(ESP_DBG_TXAMPDU, ++ "%s tid %d TXAMPDU GOT STOP EVT\n", ++ __func__, tid); ++ ++ spin_lock_bh(&sip->epub->tx_ampdu_lock); ++ txtid->state = ESP_TID_STATE_WAIT_STOP; ++ spin_unlock_bh(&sip->epub->tx_ampdu_lock); ++ ieee80211_stop_tx_ba_session(node->sta, (u16) tid); ++ } else { ++ esp_dbg(ESP_DBG_TXAMPDU, ++ "%s tid %d TXAMPDU GOT STOP EVT IN WRONG STATE %d\n", ++ __func__, tid, txtid->state); ++ } ++ } else if (state == TRC_TX_AMPDU_OPERATIONAL) { ++ if (txtid->state == ESP_TID_STATE_STOP) { ++ esp_dbg(ESP_DBG_TXAMPDU, ++ "%s tid %d TXAMPDU GOT OPERATIONAL\n", ++ __func__, tid); ++ ++ spin_lock_bh(&sip->epub->tx_ampdu_lock); ++ txtid->state = ESP_TID_STATE_TRIGGER; ++ spin_unlock_bh(&sip->epub->tx_ampdu_lock); ++ ieee80211_start_tx_ba_session(node->sta, (u16) tid, ++ 0); ++ ++ } else if (txtid->state == ESP_TID_STATE_OPERATIONAL) { ++ sip_send_ampdu_action(sip->epub, ++ SIP_AMPDU_TX_OPERATIONAL, ++ node->sta->addr, tid, ++ node->ifidx, 0); ++ } else { ++ esp_dbg(ESP_DBG_TXAMPDU, ++ "%s tid %d TXAMPDU GOT OPERATIONAL EVT IN WRONG STATE %d\n", ++ __func__, tid, txtid->state); ++ } ++ } ++} ++ ++int sip_parse_events(struct esp_sip *sip, u8 * buf) ++{ ++ struct sip_hdr *hdr = (struct sip_hdr *) buf; ++ ++ switch (hdr->c_evtid) { ++ case SIP_EVT_TARGET_ON:{ ++ /* use rx work queue to send... */ ++ if (atomic_read(&sip->state) == SIP_PREPARE_BOOT ++ || atomic_read(&sip->state) == SIP_BOOT) { ++ atomic_set(&sip->state, SIP_SEND_INIT); ++ queue_work(sip->epub->esp_wkq, ++ &sip->rx_process_work); ++ } else { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s boot during wrong state %d\n", ++ __func__, ++ atomic_read(&sip->state)); ++ } ++ break; ++ } ++ ++ case SIP_EVT_BOOTUP:{ ++ struct sip_evt_bootup2 *bootup_evt = ++ (struct sip_evt_bootup2 *) (buf + ++ SIP_CTRL_HDR_LEN); ++ if (sip->rawbuf) ++ kfree(sip->rawbuf); ++ ++ sip_post_init(sip, bootup_evt); ++ ++ if (gl_bootup_cplx) ++ complete(gl_bootup_cplx); ++ ++ break; ++ } ++ case SIP_EVT_RESETTING:{ ++ sip->epub->wait_reset = 1; ++ if (gl_bootup_cplx) ++ complete(gl_bootup_cplx); ++ break; ++ } ++ case SIP_EVT_SLEEP:{ ++ //atomic_set(&sip->epub->ps.state, ESP_PM_ON); ++ break; ++ } ++ case SIP_EVT_TXIDLE:{ ++ //struct sip_evt_txidle *txidle = (struct sip_evt_txidle *)(buf + SIP_CTRL_HDR_LEN); ++ //sip_txdone_clear(sip, txidle->last_seq); ++ break; ++ } ++ ++ case SIP_EVT_SCAN_RESULT:{ ++ struct sip_evt_scan_report *report = ++ (struct sip_evt_scan_report *) (buf + ++ SIP_CTRL_HDR_LEN); ++ if (atomic_read(&sip->epub->wl.off)) { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s scan result while wlan off\n", ++ __func__); ++ return 0; ++ } ++ sip_scandone_process(sip, report); ++ ++ break; ++ } ++ ++ case SIP_EVT_ROC:{ ++ struct sip_evt_roc *report = ++ (struct sip_evt_roc *) (buf + ++ SIP_CTRL_HDR_LEN); ++ esp_rocdone_process(sip->epub->hw, report); ++ break; ++ } ++ ++ ++#ifdef ESP_RX_COPYBACK_TEST ++ ++ case SIP_EVT_COPYBACK:{ ++ u32 len = hdr->len - SIP_CTRL_HDR_LEN; ++ ++ esp_dbg(ESP_DBG_TRACE, ++ "%s copyback len %d seq %u\n", __func__, ++ len, hdr->seq); ++ ++ memcpy(copyback_buf + copyback_offset, ++ pkt->buf + SIP_CTRL_HDR_LEN, len); ++ copyback_offset += len; ++ ++ //show_buf(pkt->buf, 256); ++ ++ //how about totlen % 256 == 0?? ++ if (hdr->hdr.len < 256) { ++ kfree(copyback_buf); ++ } ++ } ++ break; ++#endif /* ESP_RX_COPYBACK_TEST */ ++ case SIP_EVT_CREDIT_RPT: ++ break; ++ ++#ifdef TEST_MODE ++ case SIP_EVT_WAKEUP:{ ++ u8 check_str[12]; ++ struct sip_evt_wakeup *wakeup_evt = ++ (struct sip_evt_wakeup *) (buf + ++ SIP_CTRL_HDR_LEN); ++ sprintf((char *) &check_str, "%d", ++ wakeup_evt->check_data); ++ esp_test_cmd_event(TEST_CMD_WAKEUP, ++ (char *) &check_str); ++ break; ++ } ++ ++ case SIP_EVT_DEBUG:{ ++ u8 check_str[640]; ++ sip_parse_event_debug(sip->epub, buf, check_str); ++ esp_dbg(ESP_DBG_TRACE, "%s", check_str); ++ esp_test_cmd_event(TEST_CMD_DEBUG, ++ (char *) &check_str); ++ break; ++ } ++ ++ case SIP_EVT_LOOPBACK:{ ++ u8 check_str[12]; ++ struct sip_evt_loopback *loopback_evt = ++ (struct sip_evt_loopback *) (buf + ++ SIP_CTRL_HDR_LEN); ++ esp_dbg(ESP_DBG_LOG, "%s loopback len %d seq %u\n", ++ __func__, hdr->len, hdr->seq); ++ ++ if (loopback_evt->pack_id != get_loopback_id()) { ++ sprintf((char *) &check_str, ++ "seq id error %d, expect %d", ++ loopback_evt->pack_id, ++ get_loopback_id()); ++ esp_test_cmd_event(TEST_CMD_LOOPBACK, ++ (char *) &check_str); ++ } ++ ++ if ((loopback_evt->pack_id + 1) < ++ get_loopback_num()) { ++ inc_loopback_id(); ++ sip_send_loopback_mblk(sip, ++ loopback_evt->txlen, ++ loopback_evt->rxlen, ++ get_loopback_id()); ++ } else { ++ sprintf((char *) &check_str, "test over!"); ++ esp_test_cmd_event(TEST_CMD_LOOPBACK, ++ (char *) &check_str); ++ } ++ break; ++ } ++#endif /*TEST_MODE */ ++ ++ case SIP_EVT_SNPRINTF_TO_HOST:{ ++ u8 *p = ++ (buf + sizeof(struct sip_hdr) + sizeof(u16)); ++ u16 *len = (u16 *) (buf + sizeof(struct sip_hdr)); ++ char test_res_str[560]; ++ sprintf(test_res_str, ++ "esp_host:%llx\nesp_target: %.*s", ++ DRIVER_VER, *len, p); ++ ++ esp_dbg(ESP_DBG_TRACE, "%s\n", test_res_str); ++ if (*len ++ && sip->epub->sdio_state == ++ ESP_SDIO_STATE_FIRST_INIT) { ++ char filename[256]; ++ if (mod_eagle_path_get() == NULL) ++ sprintf(filename, "%s/%s", FWPATH, ++ "test_results"); ++ else ++ sprintf(filename, "%s/%s", ++ mod_eagle_path_get(), ++ "test_results"); ++ esp_dbg(ESP_DBG_TRACE, ++ "SNPRINTF TO HOST: %s\n", ++ test_res_str); ++ } ++ break; ++ } ++ case SIP_EVT_TRC_AMPDU:{ ++ struct sip_evt_trc_ampdu *ep = ++ (struct sip_evt_trc_ampdu *) (buf + ++ SIP_CTRL_HDR_LEN); ++ struct esp_node *node = NULL; ++ int i = 0; ++ ++ if (atomic_read(&sip->epub->wl.off)) { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s scan result while wlan off\n", ++ __func__); ++ return 0; ++ } ++ ++ node = esp_get_node_by_addr(sip->epub, ep->addr); ++ if (node == NULL) ++ break; ++ for (i = 0; i < 8; i++) { ++ if (ep->tid & (1 << i)) { ++ esp_tx_ba_session_op(sip, node, ++ ep->state, i); ++ } ++ } ++ break; ++ } ++ ++#ifdef TEST_MODE ++ case SIP_EVT_EP:{ ++ char *ep = (char *) (buf + SIP_CTRL_HDR_LEN); ++ static int counter = 0; ++ ++ esp_dbg(ESP_ATE, "%s EVT_EP \n\n", __func__); ++ if (counter++ < 2) { ++ esp_dbg(ESP_ATE, "ATE: %s \n", ep); ++ } ++ ++ esp_test_ate_done_cb(ep); ++ ++ break; ++ } ++#endif /*TEST_MODE */ ++ ++ case SIP_EVT_INIT_EP:{ ++ char *ep = (char *) (buf + SIP_CTRL_HDR_LEN); ++ esp_dbg(ESP_ATE, "Phy Init: %s \n", ep); ++ break; ++ } ++ ++ case SIP_EVT_NOISEFLOOR:{ ++ struct sip_evt_noisefloor *ep = ++ (struct sip_evt_noisefloor *) (buf + ++ SIP_CTRL_HDR_LEN); ++ atomic_set(&sip->noise_floor, ep->noise_floor); ++ break; ++ } ++ default: ++ break; ++ } ++ ++ return 0; ++} ++ ++#include "esp_init_data.h" ++ ++void sip_send_chip_init(struct esp_sip *sip) ++{ ++ size_t size = 0; ++ size = sizeof(esp_init_data); ++ ++ esp_conf_upload_second(esp_init_data, size); ++ ++ atomic_sub(1, &sip->tx_credits); ++ ++ sip_send_cmd(sip, SIP_CMD_INIT, size, (void *) esp_init_data); ++ ++} ++ ++int sip_send_config(struct esp_pub *epub, struct ieee80211_conf *conf) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_config *configcmd; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_config) + ++ sizeof(struct sip_hdr), SIP_CMD_CONFIG); ++ if (!skb) ++ return -EINVAL; ++ esp_dbg(ESP_DBG_TRACE, "%s config center freq %d\n", __func__, ++ conf->chandef.chan->center_freq); ++ configcmd = ++ (struct sip_cmd_config *) (skb->data + sizeof(struct sip_hdr)); ++ configcmd->center_freq = conf->chandef.chan->center_freq; ++ configcmd->duration = 0; ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++int sip_send_bss_info_update(struct esp_pub *epub, struct esp_vif *evif, ++ u8 * bssid, int assoc) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_bss_info_update *bsscmd; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_bss_info_update) + ++ sizeof(struct sip_hdr), ++ SIP_CMD_BSS_INFO_UPDATE); ++ if (!skb) ++ return -EINVAL; ++ ++ bsscmd = ++ (struct sip_cmd_bss_info_update *) (skb->data + ++ sizeof(struct sip_hdr)); ++ if (assoc == 2) { //hack for softAP mode ++ bsscmd->beacon_int = evif->beacon_interval; ++ } else if (assoc == 1) { ++ set_bit(ESP_WL_FLAG_CONNECT, &epub->wl.flags); ++ } else { ++ clear_bit(ESP_WL_FLAG_CONNECT, &epub->wl.flags); ++ } ++ bsscmd->bssid_no = evif->index; ++ bsscmd->isassoc = assoc; ++ bsscmd->beacon_int = evif->beacon_interval; ++ memcpy(bsscmd->bssid, bssid, ETH_ALEN); ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++int sip_send_wmm_params(struct esp_pub *epub, u8 aci, ++ const struct ieee80211_tx_queue_params *params) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_set_wmm_params *bsscmd; ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_set_wmm_params) + ++ sizeof(struct sip_hdr), ++ SIP_CMD_SET_WMM_PARAM); ++ if (!skb) ++ return -EINVAL; ++ ++ bsscmd = ++ (struct sip_cmd_set_wmm_params *) (skb->data + ++ sizeof(struct sip_hdr)); ++ bsscmd->aci = aci; ++ bsscmd->aifs = params->aifs; ++ bsscmd->txop_us = params->txop * 32; ++ ++ bsscmd->ecw_min = 32 - __builtin_clz(params->cw_min); ++ bsscmd->ecw_max = 32 - __builtin_clz(params->cw_max); ++ ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++int sip_send_ampdu_action(struct esp_pub *epub, u8 action_num, ++ const u8 * addr, u16 tid, u16 ssn, u8 buf_size) ++{ ++ int index = 0; ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_ampdu_action *action; ++ if (action_num == SIP_AMPDU_RX_START) { ++ index = esp_get_empty_rxampdu(epub, addr, tid); ++ } else if (action_num == SIP_AMPDU_RX_STOP) { ++ index = esp_get_exist_rxampdu(epub, addr, tid); ++ } ++ if (index < 0) ++ return -EACCES; ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_ampdu_action) + ++ sizeof(struct sip_hdr), ++ SIP_CMD_AMPDU_ACTION); ++ if (!skb) ++ return -EINVAL; ++ ++ action = ++ (struct sip_cmd_ampdu_action *) (skb->data + ++ sizeof(struct sip_hdr)); ++ action->action = action_num; ++ //for TX, it means interface index ++ action->index = ssn; ++ ++ switch (action_num) { ++ case SIP_AMPDU_RX_START: ++ action->ssn = ssn; ++ // fall through ++ case SIP_AMPDU_RX_STOP: ++ action->index = index; ++ // fall through ++ case SIP_AMPDU_TX_OPERATIONAL: ++ case SIP_AMPDU_TX_STOP: ++ action->win_size = buf_size; ++ action->tid = tid; ++ memcpy(action->addr, addr, ETH_ALEN); ++ break; ++ } ++ ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++#ifdef HW_SCAN ++/*send cmd to target, if aborted is true, inform target stop scan, report scan complete imediately ++ return 1: complete over, 0: success, still have next scan, -1: hardware failure ++ */ ++int sip_send_scan(struct esp_pub *epub) ++{ ++ struct cfg80211_scan_request *scan_req = epub->wl.scan_req; ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_scan *scancmd; ++ u8 *ptr = NULL; ++ int i; ++ u8 append_len, ssid_len; ++ ++ ESSERT(scan_req != NULL); ++ ssid_len = scan_req->n_ssids == 0 ? 0 : ++ (scan_req->n_ssids == ++ 1 ? scan_req->ssids->ssid_len : scan_req->ssids->ssid_len + ++ (scan_req->ssids + 1)->ssid_len); ++ append_len = ssid_len + scan_req->n_channels + scan_req->ie_len; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_scan) + ++ sizeof(struct sip_hdr) + append_len, ++ SIP_CMD_SCAN); ++ ++ if (!skb) ++ return -EINVAL; ++ ++ ptr = skb->data; ++ scancmd = (struct sip_cmd_scan *) (ptr + sizeof(struct sip_hdr)); ++ ptr += sizeof(struct sip_hdr); ++ ++ scancmd->aborted = false; ++ ++ if (scancmd->aborted == false) { ++ ptr += sizeof(struct sip_cmd_scan); ++ if (scan_req->n_ssids <= 0 ++ || (scan_req->n_ssids == 1 && ssid_len == 0)) { ++ scancmd->ssid_len = 0; ++ } else { ++ scancmd->ssid_len = ssid_len; ++ if (scan_req->ssids->ssid_len == ssid_len) ++ memcpy(ptr, scan_req->ssids->ssid, ++ scancmd->ssid_len); ++ else ++ memcpy(ptr, (scan_req->ssids + 1)->ssid, ++ scancmd->ssid_len); ++ } ++ ++ ptr += scancmd->ssid_len; ++ scancmd->n_channels = scan_req->n_channels; ++ for (i = 0; i < scan_req->n_channels; i++) ++ ptr[i] = scan_req->channels[i]->hw_value; ++ ++ ptr += scancmd->n_channels; ++ if (scan_req->ie_len && scan_req->ie != NULL) { ++ scancmd->ie_len = scan_req->ie_len; ++ memcpy(ptr, scan_req->ie, scan_req->ie_len); ++ } else { ++ scancmd->ie_len = 0; ++ } ++ //add a flag that support two ssids, ++ if (scan_req->n_ssids > 1) ++ scancmd->ssid_len |= 0x80; ++ ++ } ++ ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++#endif ++ ++int sip_send_suspend_config(struct esp_pub *epub, u8 suspend) ++{ ++ struct sip_cmd_suspend *cmd = NULL; ++ struct sk_buff *skb = NULL; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_suspend) + ++ sizeof(struct sip_hdr), SIP_CMD_SUSPEND); ++ ++ if (!skb) ++ return -EINVAL; ++ ++ cmd = ++ (struct sip_cmd_suspend *) (skb->data + ++ sizeof(struct sip_hdr)); ++ cmd->suspend = suspend; ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++int sip_send_ps_config(struct esp_pub *epub, struct esp_ps *ps) ++{ ++ struct sip_cmd_ps *pscmd = NULL; ++ struct sk_buff *skb = NULL; ++ struct sip_hdr *shdr = NULL; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_ps) + ++ sizeof(struct sip_hdr), SIP_CMD_PS); ++ ++ if (!skb) ++ return -EINVAL; ++ ++ ++ shdr = (struct sip_hdr *) skb->data; ++ pscmd = (struct sip_cmd_ps *) (skb->data + sizeof(struct sip_hdr)); ++ ++ pscmd->dtim_period = ps->dtim_period; ++ pscmd->max_sleep_period = ps->max_sleep_period; ++ ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++void sip_scandone_process(struct esp_sip *sip, ++ struct sip_evt_scan_report *scan_report) ++{ ++ struct esp_pub *epub = sip->epub; ++ ++ esp_dbg(ESP_DBG_TRACE, "eagle hw scan report\n"); ++ ++ if (epub->wl.scan_req) { ++ hw_scan_done(epub, scan_report->aborted); ++ epub->wl.scan_req = NULL; ++ } ++} ++ ++int sip_send_setkey(struct esp_pub *epub, u8 bssid_no, u8 * peer_addr, ++ struct ieee80211_key_conf *key, u8 isvalid) ++{ ++ struct sip_cmd_setkey *setkeycmd; ++ struct sk_buff *skb = NULL; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_setkey) + ++ sizeof(struct sip_hdr), SIP_CMD_SETKEY); ++ ++ if (!skb) ++ return -EINVAL; ++ ++ setkeycmd = ++ (struct sip_cmd_setkey *) (skb->data + sizeof(struct sip_hdr)); ++ ++ if (peer_addr) { ++ memcpy(setkeycmd->addr, peer_addr, ETH_ALEN); ++ } else { ++ memset(setkeycmd->addr, 0, ETH_ALEN); ++ } ++ ++ setkeycmd->bssid_no = bssid_no; ++ setkeycmd->hw_key_idx = key->hw_key_idx; ++ ++ if (isvalid) { ++ setkeycmd->alg = esp_cipher2alg(key->cipher); ++ setkeycmd->keyidx = key->keyidx; ++ setkeycmd->keylen = key->keylen; ++ if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { ++ memcpy(setkeycmd->key, key->key, 16); ++ memcpy(setkeycmd->key + 16, key->key + 24, 8); ++ memcpy(setkeycmd->key + 24, key->key + 16, 8); ++ } else { ++ memcpy(setkeycmd->key, key->key, key->keylen); ++ } ++ ++ setkeycmd->flags = 1; ++ } else { ++ setkeycmd->flags = 0; ++ } ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++#ifdef FPGA_LOOPBACK ++#define LOOPBACK_PKT_LEN 200 ++int sip_send_loopback_cmd_mblk(struct esp_sip *sip) ++{ ++ int cnt, ret; ++ ++ for (cnt = 0; cnt < 4; cnt++) { ++ if (0 != ++ (ret = ++ sip_send_loopback_mblk(sip, LOOPBACK_PKT_LEN, ++ LOOPBACK_PKT_LEN, 0))) ++ return ret; ++ } ++ return 0; ++} ++#endif /* FPGA_LOOPBACK */ ++ ++int sip_send_loopback_mblk(struct esp_sip *sip, int txpacket_len, ++ int rxpacket_len, int packet_id) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_loopback *cmd; ++ u8 *ptr = NULL; ++ int i, ret; ++ ++ //send 100 loopback pkt ++ if (txpacket_len) ++ skb = ++ sip_alloc_ctrl_skbuf(sip, ++ sizeof(struct sip_cmd_loopback) + ++ sizeof(struct sip_hdr) + ++ txpacket_len, SIP_CMD_LOOPBACK); ++ else ++ skb = ++ sip_alloc_ctrl_skbuf(sip, ++ sizeof(struct sip_cmd_loopback) + ++ sizeof(struct sip_hdr), ++ SIP_CMD_LOOPBACK); ++ ++ if (!skb) ++ return -ENOMEM; ++ ++ ptr = skb->data; ++ cmd = (struct sip_cmd_loopback *) (ptr + sizeof(struct sip_hdr)); ++ ptr += sizeof(struct sip_hdr); ++ cmd->txlen = txpacket_len; ++ cmd->rxlen = rxpacket_len; ++ cmd->pack_id = packet_id; ++ ++ if (txpacket_len) { ++ ptr += sizeof(struct sip_cmd_loopback); ++ /* fill up pkt payload */ ++ for (i = 0; i < txpacket_len; i++) { ++ ptr[i] = i; ++ } ++ } ++ ++ ret = sip_cmd_enqueue(sip, skb, ENQUEUE_PRIOR_TAIL); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++//remain_on_channel ++int sip_send_roc(struct esp_pub *epub, u16 center_freq, u16 duration) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_config *configcmd; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_config) + ++ sizeof(struct sip_hdr), SIP_CMD_CONFIG); ++ if (!skb) ++ return -EINVAL; ++ ++ configcmd = ++ (struct sip_cmd_config *) (skb->data + sizeof(struct sip_hdr)); ++ configcmd->center_freq = center_freq; ++ configcmd->duration = duration; ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++int sip_send_set_sta(struct esp_pub *epub, u8 ifidx, u8 set, ++ struct ieee80211_sta *sta, struct ieee80211_vif *vif, ++ u8 index) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_setsta *setstacmd; ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_setsta) + ++ sizeof(struct sip_hdr), SIP_CMD_SETSTA); ++ if (!skb) ++ return -EINVAL; ++ ++ setstacmd = ++ (struct sip_cmd_setsta *) (skb->data + sizeof(struct sip_hdr)); ++ setstacmd->ifidx = ifidx; ++ setstacmd->index = index; ++ setstacmd->set = set; ++ if (sta->aid == 0) ++ setstacmd->aid = vif->cfg.aid; ++ else ++ setstacmd->aid = sta->aid; ++ memcpy(setstacmd->mac, sta->addr, ETH_ALEN); ++ if (set) { ++ if (sta->deflink.ht_cap.ht_supported) { ++ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ++ setstacmd->phymode = ++ ESP_IEEE80211_T_HT20_S; ++ else ++ setstacmd->phymode = ++ ESP_IEEE80211_T_HT20_L; ++ setstacmd->ampdu_factor = sta->deflink.ht_cap.ampdu_factor; ++ setstacmd->ampdu_density = ++ sta->deflink.ht_cap.ampdu_density; ++ } else { ++ if (sta->deflink.supp_rates[NL80211_BAND_2GHZ] & (~(u32) ++ CONF_HW_BIT_RATE_11B_MASK)) ++ { ++ setstacmd->phymode = ESP_IEEE80211_T_OFDM; ++ } else { ++ setstacmd->phymode = ESP_IEEE80211_T_CCK; ++ } ++ } ++ } ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++ ++int sip_send_recalc_credit(struct esp_pub *epub) ++{ ++ struct sk_buff *skb = NULL; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, 0 + sizeof(struct sip_hdr), ++ SIP_CMD_RECALC_CREDIT); ++ if (!skb) ++ return -ENOMEM; ++ ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_HEAD); ++} ++ ++int sip_cmd(struct esp_pub *epub, enum sip_cmd_id cmd_id, u8 * cmd_buf, ++ u8 cmd_len) ++{ ++ struct sk_buff *skb = NULL; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ cmd_len + sizeof(struct sip_hdr), cmd_id); ++ if (!skb) ++ return -ENOMEM; ++ ++ memcpy(skb->data + sizeof(struct sip_hdr), cmd_buf, cmd_len); ++ ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} +diff --git a/drivers/net/wireless/esp8089/esp_ctrl.h b/drivers/net/wireless/esp8089/esp_ctrl.h +new file mode 100644 +index 000000000000..29c18caa9ede +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_ctrl.h +@@ -0,0 +1,58 @@ ++/* ++ * Copyright (c) 2009- 2014 Espressif System. ++ * ++ * SIP ctrl packet parse and pack ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_CTRL_H_ ++#define _ESP_CTRL_H_ ++ ++int sip_send_loopback_mblk(struct esp_sip *sip, int txpacket_len, ++ int rxpacket_len, int packet_id); ++ ++int sip_send_config(struct esp_pub *epub, struct ieee80211_conf *conf); ++ ++int sip_send_setkey(struct esp_pub *epub, u8 bssid_no, u8 * peer_addr, ++ struct ieee80211_key_conf *key, u8 isvalid); ++ ++int sip_send_scan(struct esp_pub *epub); ++ ++void sip_scandone_process(struct esp_sip *sip, ++ struct sip_evt_scan_report *scan_report); ++ ++int sip_send_bss_info_update(struct esp_pub *epub, struct esp_vif *evif, ++ u8 * bssid, int assoc); ++ ++int sip_send_wmm_params(struct esp_pub *epub, u8 aci, ++ const struct ieee80211_tx_queue_params *params); ++ ++int sip_send_ampdu_action(struct esp_pub *epub, u8 action_num, ++ const u8 * addr, u16 tid, u16 ssn, u8 buf_size); ++ ++int sip_send_roc(struct esp_pub *epub, u16 center_freq, u16 duration); ++ ++int sip_send_set_sta(struct esp_pub *epub, u8 ifidx, u8 set, ++ struct ieee80211_sta *sta, struct ieee80211_vif *vif, ++ u8 index); ++ ++int sip_send_suspend_config(struct esp_pub *epub, u8 suspend); ++ ++int sip_send_ps_config(struct esp_pub *epub, struct esp_ps *ps); ++ ++int sip_parse_events(struct esp_sip *sip, u8 * buf); ++ ++int sip_send_recalc_credit(struct esp_pub *epub); ++ ++int sip_cmd(struct esp_pub *epub, enum sip_cmd_id cmd_id, u8 * cmd_buf, ++ u8 cmd_len); ++ ++#endif /* _ESP_CTRL_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_debug.c b/drivers/net/wireless/esp8089/esp_debug.c +new file mode 100644 +index 000000000000..5ce8fd2ebd6b +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_debug.c +@@ -0,0 +1,297 @@ ++/* ++ * Copyright (c) 2011-2014 Espressif System. ++ * ++ * esp debug interface ++ * - debugfs ++ * - debug level control ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++ ++#include ++#include "sip2_common.h" ++ ++#include "esp_debug.h" ++ ++#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ESP8089_DEBUG_FS) ++ ++static struct dentry *esp_debugfs_root = NULL; ++ ++static int esp_debugfs_open(struct inode *inode, struct file *filp) ++{ ++ filp->private_data = inode->i_private; ++ return 0; ++} ++ ++static ssize_t esp_debugfs_read(struct file *filp, char __user * buffer, ++ size_t count, loff_t * ppos) ++{ ++ if (*ppos >= 32) ++ return 0; ++ if (*ppos + count > 32) ++ count = 32 - *ppos; ++ ++ if (copy_to_user(buffer, filp->private_data + *ppos, count)) ++ return -EFAULT; ++ ++ *ppos += count; ++ ++ return count; ++} ++ ++static ssize_t esp_debugfs_write(struct file *filp, ++ const char __user * buffer, size_t count, ++ loff_t * ppos) ++{ ++ if (*ppos >= 32) ++ return 0; ++ if (*ppos + count > 32) ++ count = 32 - *ppos; ++ ++ if (copy_from_user(filp->private_data + *ppos, buffer, count)) ++ return -EFAULT; ++ ++ *ppos += count; ++ ++ return count; ++} ++ ++struct file_operations esp_debugfs_fops = { ++ .owner = THIS_MODULE, ++ .open = esp_debugfs_open, ++ .read = esp_debugfs_read, ++ .write = esp_debugfs_write, ++}; ++ ++ ++void esp_dump_var(const char *name, struct dentry *parent, ++ void *value, esp_type type) ++{ ++ umode_t mode = 0644; ++ ++ if (!esp_debugfs_root) ++ return; ++ ++ if (!parent) ++ parent = esp_debugfs_root; ++ ++ switch (type) { ++ case ESP_U8: ++ debugfs_create_u8(name, mode, parent, (u8 *) value); ++ break; ++ case ESP_U16: ++ debugfs_create_u16(name, mode, parent, (u16 *) value); ++ break; ++ case ESP_U32: ++ debugfs_create_u32(name, mode, parent, (u32 *) value); ++ break; ++ case ESP_U64: ++ debugfs_create_u64(name, mode, parent, (u64 *) value); ++ break; ++ case ESP_BOOL: ++ debugfs_create_bool(name, mode, parent, ++ (bool *) value); ++ break; ++ default: //32 ++ debugfs_create_u32(name, mode, parent, (u32 *) value); ++ } ++ ++ return; ++ ++} ++ ++void esp_dump_array(const char *name, struct dentry *parent, ++ struct debugfs_blob_wrapper *blob) ++{ ++ umode_t mode = 0644; ++ ++ if (!esp_debugfs_root) ++ return; ++ ++ if (!parent) ++ parent = esp_debugfs_root; ++ ++ debugfs_create_blob(name, mode, parent, blob); ++ ++} ++ ++void esp_dump(const char *name, struct dentry *parent, ++ void *data, int size) ++{ ++ umode_t mode = 0644; ++ ++ if (!esp_debugfs_root) ++ return; ++ ++ if (!parent) ++ parent = esp_debugfs_root; ++ ++ debugfs_create_file(name, mode, parent, data, ++ &esp_debugfs_fops); ++ ++} ++ ++struct dentry *esp_debugfs_add_sub_dir(const char *name) ++{ ++ struct dentry *sub_dir = NULL; ++ ++ sub_dir = debugfs_create_dir(name, esp_debugfs_root); ++ ++ if (!sub_dir) ++ goto Fail; ++ ++ return sub_dir; ++ ++ Fail: ++ debugfs_remove_recursive(esp_debugfs_root); ++ esp_debugfs_root = NULL; ++ esp_dbg(ESP_DBG_ERROR, ++ "%s failed, debugfs root removed; dir name: %s\n", ++ __FUNCTION__, name); ++ return NULL; ++ ++} ++ ++int esp_debugfs_init(void) ++{ ++ esp_dbg(ESP_DBG, "esp debugfs init\n"); ++ esp_debugfs_root = debugfs_create_dir("esp_debug", NULL); ++ ++ if (!esp_debugfs_root || IS_ERR_OR_NULL(esp_debugfs_root)) { ++ return -ENOENT; ++ } ++ ++ return 0; ++} ++ ++void esp_debugfs_exit(void) ++{ ++ esp_dbg(ESP_DBG, "esp debugfs exit"); ++ ++ debugfs_remove_recursive(esp_debugfs_root); ++ ++ return; ++} ++ ++#else ++ ++inline struct dentry *esp_dump_var(const char *name, struct dentry *parent, ++ void *value, esp_type type) ++{ ++ return NULL; ++} ++ ++inline struct dentry *esp_dump_array(const char *name, ++ struct dentry *parent, ++ struct debugfs_blob_wrapper *blob) ++{ ++ return NULL; ++} ++ ++inline struct dentry *esp_dump(const char *name, struct dentry *parent, ++ void *data, int size) ++{ ++ return NULL; ++} ++ ++struct dentry *esp_debugfs_add_sub_dir(const char *name) ++{ ++ return NULL; ++} ++ ++inline int esp_debugfs_init(void) ++{ ++ return -EPERM; ++} ++ ++inline void esp_debugfs_exit(void) ++{ ++ ++} ++ ++#endif ++ ++ ++void show_buf(u8 * buf, u32 len) ++{ ++// print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 16, 1, buf, len, true); ++#if 1 ++ int i = 0, j; ++ ++ printk(KERN_INFO "\n++++++++++++++++show rbuf+++++++++++++++\n"); ++ for (i = 0; i < (len / 16); i++) { ++ j = i * 16; ++ printk(KERN_INFO ++ "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x \n", ++ buf[j], buf[j + 1], buf[j + 2], buf[j + 3], ++ buf[j + 4], buf[j + 5], buf[j + 6], buf[j + 7], ++ buf[j + 8], buf[j + 9], buf[j + 10], buf[j + 11], ++ buf[j + 12], buf[j + 13], buf[j + 14], buf[j + 15]); ++ } ++ printk(KERN_INFO "\n++++++++++++++++++++++++++++++++++++++++\n"); ++#endif //0000 ++} ++ ++#ifdef HOST_RC ++static u8 get_cnt(u32 cnt_store, int idx) ++{ ++ int shift = idx << 2; ++ ++ return (u8) ((cnt_store >> shift) & 0xf); ++} ++ ++void esp_show_rcstatus(struct sip_rc_status *rcstatus) ++{ ++ int i; ++ char msg[82]; ++ char rcstr[16]; ++ u32 cnt_store = rcstatus->rc_cnt_store; ++ ++ memset(msg, 0, sizeof(msg)); ++ memset(rcstr, 0, sizeof(rcstr)); ++ ++ printk(KERN_INFO "rcstatus map 0x%08x cntStore 0x%08x\n", ++ rcstatus->rc_map, rcstatus->rc_cnt_store); ++ ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { ++ if (rcstatus->rc_map & BIT(i)) { ++ sprintf(rcstr, "rcIdx %d, cnt %d ", i, ++ get_cnt(cnt_store, i)); ++ strcat(msg, rcstr); ++ } ++ } ++ printk(KERN_INFO "%s \n", msg); ++} ++ ++void esp_show_tx_rates(struct ieee80211_tx_rate *rates) ++{ ++ int i; ++ char msg[128]; ++ char rcstr[32]; ++ ++ memset(msg, 0, sizeof(msg)); ++ memset(rcstr, 0, sizeof(rcstr)); ++ ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { ++ if (rates->idx != -1) { ++ sprintf(rcstr, "Idx %d, cnt %d, flag %02x ", ++ rates->idx, rates->count, rates->flags); ++ strcat(msg, rcstr); ++ } ++ rates++; ++ } ++ strcat(msg, "\n"); ++ printk(KERN_INFO "%s \n", msg); ++} ++#endif /* HOST_RC */ +diff --git a/drivers/net/wireless/esp8089/esp_debug.h b/drivers/net/wireless/esp8089/esp_debug.h +new file mode 100644 +index 000000000000..bab695d34bfb +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_debug.h +@@ -0,0 +1,101 @@ ++/* ++ * Copyright (c) 2011-2014 Espressif System. ++ * ++ * esp debug ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _DEBUG_H_ ++ ++#ifdef ASSERT_PANIC ++#define ESSERT(v) BUG_ON(!(v)) ++#else ++#define ESSERT(v) if(!(v)) printk("ESSERT:%s %d\n", __FILE__, __LINE__) ++#endif ++ ++ ++#include ++#include ++#include ++ ++typedef enum esp_type { ++ ESP_BOOL, ++ ESP_U8, ++ ESP_U16, ++ ESP_U32, ++ ESP_U64 ++} esp_type; ++ ++void esp_dump_var(const char *name, struct dentry *parent, ++ void *value, esp_type type); ++ ++void esp_dump_array(const char *name, struct dentry *parent, ++ struct debugfs_blob_wrapper *blob); ++ ++void esp_dump(const char *name, struct dentry *parent, ++ void *data, int size); ++ ++struct dentry *esp_debugfs_add_sub_dir(const char *name); ++ ++int esp_debugfs_init(void); ++ ++void esp_debugfs_exit(void); ++ ++enum { ++ ESP_DBG_ERROR = BIT(0), ++ ESP_DBG_TRACE = BIT(1), ++ ESP_DBG_LOG = BIT(2), ++ ESP_DBG = BIT(3), ++ ESP_SHOW = BIT(4), ++ ESP_DBG_TXAMPDU = BIT(5), ++ ESP_DBG_OP = BIT(6), ++ ESP_DBG_PS = BIT(7), ++ ESP_ATE = BIT(8), ++ ESP_DBG_ALL = 0xffffffff ++}; ++ ++extern unsigned int esp_msg_level; ++ ++#ifdef ESP_ANDROID_LOGGER ++extern bool log_off; ++#endif /* ESP_ANDROID_LOGGER */ ++ ++#ifdef ESP_ANDROID_LOGGER ++#include "esp_file.h" ++#define esp_dbg(mask, fmt, args...) do { \ ++ if (esp_msg_level & mask) \ ++ { \ ++ if (log_off) \ ++ printk(fmt, ##args); \ ++ else \ ++ logger_write(4, "esp_wifi", fmt, ##args); \ ++ } \ ++ } while (0) ++#else ++#define esp_dbg(mask, fmt, args...) do { \ ++ if (esp_msg_level & mask) \ ++ printk("esp8089: " fmt, ##args); \ ++ } while (0) ++#endif /* ESP_ANDROID_LOGGER */ ++ ++void show_buf(u8 * buf, u32 len); ++ ++#ifdef HOST_RC ++struct sip_rc_status; ++struct ieee80211_tx_rate; ++ ++void esp_show_rcstatus(struct sip_rc_status *rcstatus); ++ ++void esp_show_tx_rates(struct ieee80211_tx_rate *rates); ++#endif /* HOST_RC */ ++ ++#endif /* _DEBUG_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_ext.c b/drivers/net/wireless/esp8089/esp_ext.c +new file mode 100644 +index 000000000000..541f27a6853f +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_ext.c +@@ -0,0 +1,542 @@ ++/* ++ * Copyright (c) 2010 -2013 Espressif System. ++ * ++ * extended gpio ++ * - interface for other driver or kernel ++ * - gpio control ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#ifdef USE_EXT_GPIO ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "esp_ext.h" ++#include "esp_debug.h" ++#include "esp_sip.h" ++#include "esp_sif.h" ++ ++#ifdef EXT_GPIO_OPS ++extern void register_ext_gpio_ops(struct esp_ext_gpio_ops *ops); ++extern void unregister_ext_gpio_ops(void); ++ ++static struct esp_ext_gpio_ops ext_gpio_ops = { ++ .gpio_request = ext_gpio_request, /* gpio_request gpio_no from 0x0 to 0xf */ ++ .gpio_release = ext_gpio_release, /* gpio_release */ ++ .gpio_set_mode = ext_gpio_set_mode, /* gpio_set_mode, data is irq_func of irq_mode , default level of output_mode */ ++ .gpio_get_mode = ext_gpio_get_mode, /* gpio_get_mode, current mode */ ++ .gpio_set_state = ext_gpio_set_output_state, /* only output state, high level or low level */ ++ .gpio_get_state = ext_gpio_get_state, /* current state */ ++ .irq_ack = ext_irq_ack, /* ack interrupt */ ++}; ++ ++ ++#endif ++ ++static struct esp_pub *ext_epub = NULL; ++ ++static u16 intr_mask_reg = 0x0000; ++struct workqueue_struct *ext_irq_wkq = NULL; ++struct work_struct ext_irq_work; ++static struct mutex ext_mutex_lock; ++ ++static struct ext_gpio_info gpio_list[EXT_GPIO_MAX_NUM] = { ++ {0, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {1, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {2, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {3, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {4, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {5, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {6, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {7, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {8, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {9, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {10, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {11, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {12, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {13, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {14, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++ {15, EXT_GPIO_MODE_DISABLE, EXT_GPIO_STATE_IDLE, NULL}, ++}; ++ ++static struct pending_intr_list_info esp_pending_intr_list = { ++ .start_pos = 0, ++ .end_pos = 0, ++ .curr_num = 0, ++}; ++ ++u16 ext_gpio_get_int_mask_reg(void) ++{ ++ return intr_mask_reg; ++} ++ ++int ext_gpio_request(int gpio_no) ++{ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_ERROR, "%s esp state is not ok\n", ++ __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ return -ERANGE; ++ } ++ ++ if (gpio_list[gpio_no].gpio_mode != EXT_GPIO_MODE_DISABLE) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, ++ "%s gpio is already in used by other\n", __func__); ++ return -EPERM; ++ } else { ++ gpio_list[gpio_no].gpio_mode = EXT_GPIO_MODE_MAX; ++ mutex_unlock(&ext_mutex_lock); ++ return 0; ++ } ++} ++ ++EXPORT_SYMBOL(ext_gpio_request); ++ ++int ext_gpio_release(int gpio_no) ++{ ++ int ret; ++ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_ERROR, "%s esp state is not ok\n", ++ __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ return -ERANGE; ++ } ++ sif_lock_bus(ext_epub); ++ ret = ++ sif_config_gpio_mode(ext_epub, (u8) gpio_no, ++ EXT_GPIO_MODE_DISABLE); ++ sif_unlock_bus(ext_epub); ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, "%s gpio release error\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return ret; ++ } ++ ++ gpio_list[gpio_no].gpio_mode = EXT_GPIO_MODE_DISABLE; ++ gpio_list[gpio_no].gpio_state = EXT_GPIO_STATE_IDLE; ++ gpio_list[gpio_no].irq_handler = NULL; ++ intr_mask_reg &= ~(1 << gpio_no); ++ ++ mutex_unlock(&ext_mutex_lock); ++ ++ return 0; ++} ++ ++EXPORT_SYMBOL(ext_gpio_release); ++ ++int ext_gpio_set_mode(int gpio_no, int mode, void *data) ++{ ++ u8 gpio_mode; ++ int ret; ++ struct ext_gpio_info backup_info; ++ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_LOG, "%s esp state is not ok\n", __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ return -ERANGE; ++ } ++ ++ if (gpio_list[gpio_no].gpio_mode == EXT_GPIO_MODE_DISABLE) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, ++ "%s gpio is not in occupy, please request gpio\n", ++ __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ if (mode <= EXT_GPIO_MODE_OOB || mode >= EXT_GPIO_MODE_MAX) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, "%s gpio mode unknown\n", __func__); ++ return -EOPNOTSUPP; ++ } ++ ++ memcpy(&backup_info, &gpio_list[gpio_no], ++ sizeof(struct ext_gpio_info)); ++ ++ gpio_list[gpio_no].gpio_mode = mode; ++ gpio_mode = (u8) mode; ++ ++ switch (mode) { ++ case EXT_GPIO_MODE_INTR_POSEDGE: ++ case EXT_GPIO_MODE_INTR_NEGEDGE: ++ case EXT_GPIO_MODE_INTR_LOLEVEL: ++ case EXT_GPIO_MODE_INTR_HILEVEL: ++ if (!data) { ++ memcpy(&gpio_list[gpio_no], &backup_info, ++ sizeof(struct ext_gpio_info)); ++ esp_dbg(ESP_DBG_ERROR, "%s irq_handler is NULL\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -EINVAL; ++ } ++ gpio_list[gpio_no].irq_handler = (ext_irq_handler_t) data; ++ intr_mask_reg |= (1 << gpio_no); ++ break; ++ case EXT_GPIO_MODE_OUTPUT: ++ if (!data) { ++ memcpy(&gpio_list[gpio_no], &backup_info, ++ sizeof(struct ext_gpio_info)); ++ esp_dbg(ESP_DBG_ERROR, ++ "%s output default value is NULL\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -EINVAL; ++ } ++ *(int *) data = (*(int *) data == 0 ? 0 : 1); ++ gpio_mode = (u8) (((*(int *) data) << 4) | gpio_mode); ++ default: ++ gpio_list[gpio_no].irq_handler = NULL; ++ intr_mask_reg &= ~(1 << gpio_no); ++ break; ++ } ++ ++ sif_lock_bus(ext_epub); ++ ret = sif_config_gpio_mode(ext_epub, (u8) gpio_no, gpio_mode); ++ sif_unlock_bus(ext_epub); ++ if (ret) { ++ memcpy(&gpio_list[gpio_no], &backup_info, ++ sizeof(struct ext_gpio_info)); ++ esp_dbg(ESP_DBG_ERROR, "%s gpio set error\n", __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return ret; ++ } ++ ++ mutex_unlock(&ext_mutex_lock); ++ return 0; ++} ++ ++EXPORT_SYMBOL(ext_gpio_set_mode); ++ ++int ext_gpio_get_mode(int gpio_no) ++{ ++ int gpio_mode; ++ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_LOG, "%s esp state is not ok\n", __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -ERANGE; ++ } ++ ++ gpio_mode = gpio_list[gpio_no].gpio_mode; ++ ++ mutex_unlock(&ext_mutex_lock); ++ ++ return gpio_mode; ++} ++ ++EXPORT_SYMBOL(ext_gpio_get_mode); ++ ++ ++int ext_gpio_set_output_state(int gpio_no, int state) ++{ ++ int ret; ++ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_LOG, "%s esp state is not ok\n", __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ return -ERANGE; ++ } ++ ++ if (gpio_list[gpio_no].gpio_mode != EXT_GPIO_MODE_OUTPUT) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, ++ "%s gpio is not in output state, please request gpio or set output state\n", ++ __func__); ++ return -EOPNOTSUPP; ++ } ++ ++ if (state != EXT_GPIO_STATE_LOW && state != EXT_GPIO_STATE_HIGH) { ++ mutex_unlock(&ext_mutex_lock); ++ esp_dbg(ESP_DBG_ERROR, "%s gpio state unknown\n", ++ __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ sif_lock_bus(ext_epub); ++ ret = ++ sif_set_gpio_output(ext_epub, 1 << gpio_no, state << gpio_no); ++ sif_unlock_bus(ext_epub); ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, "%s gpio state set error\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return ret; ++ } ++ gpio_list[gpio_no].gpio_state = state; ++ ++ mutex_unlock(&ext_mutex_lock); ++ ++ return 0; ++} ++ ++EXPORT_SYMBOL(ext_gpio_set_output_state); ++ ++int ext_gpio_get_state(int gpio_no) ++{ ++ int ret; ++ u16 state; ++ u16 mask; ++ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_LOG, "%s esp state is not ok\n", __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -ERANGE; ++ } ++ ++ if (gpio_list[gpio_no].gpio_mode == EXT_GPIO_MODE_OUTPUT) { ++ state = gpio_list[gpio_no].gpio_state; ++ } else if (gpio_list[gpio_no].gpio_mode == EXT_GPIO_MODE_INPUT) { ++ sif_lock_bus(ext_epub); ++ ret = sif_get_gpio_input(ext_epub, &mask, &state); ++ sif_unlock_bus(ext_epub); ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s get gpio_input state error\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return ret; ++ } ++ } else { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s gpio_state is not input or output\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -EOPNOTSUPP; ++ } ++ mutex_unlock(&ext_mutex_lock); ++ ++ return (state & (1 << gpio_no)) ? 1 : 0; ++} ++ ++EXPORT_SYMBOL(ext_gpio_get_state); ++ ++int ext_irq_ack(int gpio_no) ++{ ++ int ret; ++ ++ if (ext_epub == NULL || ext_epub->sip == NULL || ++ atomic_read(&ext_epub->sip->state) != SIP_RUN) { ++ esp_dbg(ESP_DBG_LOG, "%s esp state is not ok\n", __func__); ++ return -ENOTRECOVERABLE; ++ } ++ ++ mutex_lock(&ext_mutex_lock); ++ if (gpio_no >= EXT_GPIO_MAX_NUM || gpio_no < 0) { ++ esp_dbg(ESP_DBG_ERROR, "%s unkown gpio num\n", __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -ERANGE; ++ } ++ ++ if (gpio_list[gpio_no].gpio_mode != EXT_GPIO_MODE_INTR_POSEDGE ++ && gpio_list[gpio_no].gpio_mode != EXT_GPIO_MODE_INTR_NEGEDGE ++ && gpio_list[gpio_no].gpio_mode != EXT_GPIO_MODE_INTR_LOLEVEL ++ && gpio_list[gpio_no].gpio_mode != ++ EXT_GPIO_MODE_INTR_HILEVEL) { ++ esp_dbg(ESP_DBG_ERROR, "%s gpio mode is not intr mode\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return -ENOTRECOVERABLE; ++ } ++ ++ sif_lock_bus(ext_epub); ++ ret = sif_set_gpio_output(ext_epub, 0x00, 1 << gpio_no); ++ sif_unlock_bus(ext_epub); ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, "%s gpio intr ack error\n", ++ __func__); ++ mutex_unlock(&ext_mutex_lock); ++ return ret; ++ } ++ ++ mutex_unlock(&ext_mutex_lock); ++ return 0; ++} ++ ++EXPORT_SYMBOL(ext_irq_ack); ++ ++void show_status(void) ++{ ++ int i = 0; ++ for (i = 0; i < MAX_PENDING_INTR_LIST; i++) ++ esp_dbg(ESP_DBG_ERROR, "status[%d] = [0x%04x]\n", i, ++ esp_pending_intr_list.pending_intr_list[i]); ++ ++ esp_dbg(ESP_DBG_ERROR, "start_pos[%d]\n", ++ esp_pending_intr_list.start_pos); ++ esp_dbg(ESP_DBG_ERROR, "end_pos[%d]\n", ++ esp_pending_intr_list.end_pos); ++ esp_dbg(ESP_DBG_ERROR, "curr_num[%d]\n", ++ esp_pending_intr_list.curr_num); ++ ++} ++void esp_tx_work(struct work_struct *work) ++{ ++ int i; ++ u16 tmp_intr_status_reg; ++ ++ esp_dbg(ESP_DBG_TRACE, "%s enter\n", __func__); ++ ++ spin_lock(&esp_pending_intr_list.spin_lock); ++ ++ tmp_intr_status_reg = ++ esp_pending_intr_list.pending_intr_list[esp_pending_intr_list. ++ start_pos]; ++ ++ esp_pending_intr_list.pending_intr_list[esp_pending_intr_list. ++ start_pos] = 0x0000; ++ esp_pending_intr_list.start_pos = ++ (esp_pending_intr_list.start_pos + 1) % MAX_PENDING_INTR_LIST; ++ esp_pending_intr_list.curr_num--; ++ ++ spin_unlock(&esp_pending_intr_list.spin_lock); ++ ++ for (i = 0; i < EXT_GPIO_MAX_NUM; i++) { ++ if (tmp_intr_status_reg & (1 << i) ++ && (gpio_list[i].irq_handler)) ++ gpio_list[i].irq_handler(); ++ } ++ ++ spin_lock(&esp_pending_intr_list.spin_lock); ++ if (esp_pending_intr_list.curr_num > 0) ++ queue_work(ext_irq_wkq, &ext_irq_work); ++ spin_unlock(&esp_pending_intr_list.spin_lock); ++} ++ ++void ext_gpio_int_process(u16 value) ++{ ++ if (value == 0x00) ++ return; ++ ++ esp_dbg(ESP_DBG_TRACE, "%s enter\n", __func__); ++ ++ /* intr cycle queue is full, wait */ ++ while (esp_pending_intr_list.curr_num >= MAX_PENDING_INTR_LIST) { ++ udelay(1); ++ } ++ ++ spin_lock(&esp_pending_intr_list.spin_lock); ++ ++ esp_pending_intr_list.pending_intr_list[esp_pending_intr_list. ++ end_pos] = value; ++ esp_pending_intr_list.end_pos = ++ (esp_pending_intr_list.end_pos + 1) % MAX_PENDING_INTR_LIST; ++ esp_pending_intr_list.curr_num++; ++ ++ queue_work(ext_irq_wkq, &ext_irq_work); ++ ++ spin_unlock(&esp_pending_intr_list.spin_lock); ++} ++ ++int ext_gpio_init(struct esp_pub *epub) ++{ ++ esp_dbg(ESP_DBG_ERROR, "%s enter\n", __func__); ++ ++ ext_irq_wkq = create_singlethread_workqueue("esp_ext_irq_wkq"); ++ if (ext_irq_wkq == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "%s create workqueue error\n", ++ __func__); ++ return -EACCES; ++ } ++ ++ INIT_WORK(&ext_irq_work, esp_tx_work); ++ mutex_init(&ext_mutex_lock); ++ ++ ext_epub = epub; ++ ++ if (ext_epub == NULL) ++ return -EINVAL; ++ ++#ifdef EXT_GPIO_OPS ++ register_ext_gpio_ops(&ext_gpio_ops); ++#endif ++ ++ return 0; ++} ++ ++void ext_gpio_deinit(void) ++{ ++ esp_dbg(ESP_DBG_ERROR, "%s enter\n", __func__); ++ ++#ifdef EXT_GPIO_OPS ++ unregister_ext_gpio_ops(); ++#endif ++ ext_epub = NULL; ++ cancel_work_sync(&ext_irq_work); ++ ++ if (ext_irq_wkq) ++ destroy_workqueue(ext_irq_wkq); ++ ++} ++ ++#endif /* USE_EXT_GPIO */ +diff --git a/drivers/net/wireless/esp8089/esp_ext.h b/drivers/net/wireless/esp8089/esp_ext.h +new file mode 100644 +index 000000000000..0eeba4d22111 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_ext.h +@@ -0,0 +1,100 @@ ++#ifdef USE_EXT_GPIO ++ ++#ifndef _ESP_EXT_H_ ++#define _ESP_EXT_H_ ++ ++#include ++#include ++#include "esp_sip.h" ++ ++#define MAX_PENDING_INTR_LIST 16 ++ ++#ifdef EXT_GPIO_OPS ++typedef struct esp_ext_gpio_ops { ++ int (*gpio_request) (int gpio_no); /* gpio_request gpio_no from 0x0 to 0xf */ ++ int (*gpio_release) (int gpio_no); /* gpio_release */ ++ int (*gpio_set_mode) (int gpio_no, int mode, void *data); /* gpio_set_mode, data is irq_func of irq_mode , default level of output_mode */ ++ int (*gpio_get_mode) (int gpio_no); /* gpio_get_mode, current mode */ ++ int (*gpio_set_state) (int gpio_no, int state); /* only output state, high level or low level */ ++ int (*gpio_get_state) (int gpio_no); /* current state */ ++ int (*irq_ack) (int gpio_no); /* ack interrupt */ ++} esp_ext_gpio_ops_t; ++#endif ++ ++typedef enum EXT_GPIO_NO { ++ EXT_GPIO_GPIO0 = 0, ++ EXT_GPIO_U0TXD, ++ EXT_GPIO_GPIO2, ++ EXT_GPIO_U0RXD, ++ EXT_GPIO_GPIO4, ++ EXT_GPIO_GPIO5, ++ EXT_GPIO_SD_CLK, ++ EXT_GPIO_SD_DATA0, ++ EXT_GPIO_SD_DATA1, ++ EXT_GPIO_SD_DATA2, ++ EXT_GPIO_SD_DATA3, ++ EXT_GPIO_SD_CMD, ++ EXT_GPIO_MTDI, ++ EXT_GPIO_MTCK, ++ EXT_GPIO_MTMS, ++ EXT_GPIO_MTDO, ++ EXT_GPIO_MAX_NUM ++} EXT_GPIO_NO_T; ++ ++typedef enum EXT_GPIO_MODE { //dir def pullup mode wake ++ EXT_GPIO_MODE_OOB = 0, //output 1 0 n/a n/a ++ EXT_GPIO_MODE_OUTPUT, //output / 0 n/a n/a ++ EXT_GPIO_MODE_DISABLE, //input n/a 0 DIS n/a ++ EXT_GPIO_MODE_INTR_POSEDGE, //input n/a 0 POS 1 ++ EXT_GPIO_MODE_INTR_NEGEDGE, //input n/a 1 NEG 1 ++ EXT_GPIO_MODE_INPUT, //input n/a 0 ANY 1 ++ EXT_GPIO_MODE_INTR_LOLEVEL, //input n/a 1 LOW 1 ++ EXT_GPIO_MODE_INTR_HILEVEL, //input n/a 0 HIGH 1 ++ EXT_GPIO_MODE_MAX, ++} EXT_GPIO_MODE_T; ++ ++typedef enum EXT_GPIO_STATE { ++ EXT_GPIO_STATE_LOW, ++ EXT_GPIO_STATE_HIGH, ++ EXT_GPIO_STATE_IDLE ++} EXT_GPIO_STATE_T; ++ ++typedef irqreturn_t(*ext_irq_handler_t) (void); ++ ++struct ext_gpio_info { ++ int gpio_no; ++ int gpio_mode; ++ int gpio_state; ++ ext_irq_handler_t irq_handler; ++}; ++ ++struct pending_intr_list_info { ++ u16 pending_intr_list[MAX_PENDING_INTR_LIST]; ++ int start_pos; ++ int end_pos; ++ int curr_num; ++ spinlock_t spin_lock; ++}; ++ ++u16 ext_gpio_get_int_mask_reg(void); ++ ++/* for extern user start */ ++int ext_gpio_request(int gpio_no); ++int ext_gpio_release(int gpio_no); ++ ++int ext_gpio_set_mode(int gpio_no, int mode, void *data); ++int ext_gpio_get_mode(int gpio_no); ++ ++int ext_gpio_set_output_state(int gpio_no, int state); ++int ext_gpio_get_state(int gpio_no); ++ ++int ext_irq_ack(int gpio_no); ++/* for extern user end */ ++ ++void ext_gpio_int_process(u16 value); ++ ++int ext_gpio_init(struct esp_pub *epub); ++void ext_gpio_deinit(void); ++#endif /* _ESP_EXT_H_ */ ++ ++#endif /* USE_EXT_GPIO */ +diff --git a/drivers/net/wireless/esp8089/esp_file.c b/drivers/net/wireless/esp8089/esp_file.c +new file mode 100644 +index 000000000000..ea702f010eec +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_file.c +@@ -0,0 +1,258 @@ ++/* ++ * Copyright (c) 2010 -2014 Espressif System. ++ * ++ * file operation in kernel space ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "esp_file.h" ++#include "esp_debug.h" ++#include "esp_sif.h" ++ ++static int mod_parm_crystal = -1; ++module_param_named(crystal, mod_parm_crystal, int, 0444); ++MODULE_PARM_DESC(crystal, "crystal frequency: 0=40MHz, 1=26MHz, 2=24MHz"); ++ ++struct esp_init_table_elem esp_init_table[MAX_ATTR_NUM] = { ++ /* ++ * Crystal type: ++ * 0: 40MHz (default) ++ * 1: 26MHz (ESP8266 ESP-12F) ++ * 2: 24MHz ++ */ ++ {"crystal_26M_en", 48, 0}, ++ /* ++ * Output crystal clock to pin: ++ * 0: None ++ * 1: GPIO1 ++ * 2: URXD0 ++ */ ++ {"test_xtal", 49, 0}, ++ /* ++ * Host SDIO mode: ++ * 0: Auto by pin strapping ++ * 1: SDIO data output on negative edges (SDIO v1.1) ++ * 2: SDIO data output on positive edges (SDIO v2.0) ++ */ ++ {"sdio_configure", 50, 2}, ++ /* ++ * WiFi/Bluetooth co-existence with BK3515A BT chip ++ * 0: None ++ * 1: GPIO0->WLAN_ACTIVE, MTMS->BT_ACTIVE, MTDI->BT_PRIORITY, ++ * U0TXD->ANT_SEL_BT, U0RXD->ANT_SEL_WIFI ++ */ ++ {"bt_configure", 51, 0}, ++ /* ++ * Antenna selection: ++ * 0: Antenna is for WiFi ++ * 1: Antenna is for Bluetooth ++ */ ++ {"bt_protocol", 52, 0}, ++ /* ++ * Dual antenna configuration mode: ++ * 0: None ++ * 1: U0RXD + XPD_DCDC ++ * 2: U0RXD + GPIO0 ++ * 3: U0RXD + U0TXD ++ */ ++ {"dual_ant_configure", 53, 0}, ++ /* ++ * Firmware debugging output pin: ++ * 0: None ++ * 1: UART TX on GPIO2 ++ * 2: UART TX on U0TXD ++ */ ++ {"test_uart_configure", 54, 2}, ++ /* ++ * Whether to share crystal clock with BT (in sleep mode): ++ * 0: no ++ * 1: always on ++ * 2: automatically on according to XPD_DCDC ++ */ ++ {"share_xtal", 55, 0}, ++ /* ++ * Allow chip to be woken up during sleep on pin: ++ * 0: None ++ * 1: XPD_DCDC ++ * 2: GPIO0 ++ * 3: Both XPD_DCDC and GPIO0 ++ */ ++ {"gpio_wake", 56, 0}, ++ {"no_auto_sleep", 57, 0}, ++ {"speed_suspend", 58, 0}, ++ {"attr11", -1, -1}, ++ {"attr12", -1, -1}, ++ {"attr13", -1, -1}, ++ {"attr14", -1, -1}, ++ {"attr15", -1, -1}, ++ //attr that is not send to target ++ /* ++ * Allow chip to be reset by GPIO pin: ++ * 0: no ++ * 1: yes ++ */ ++ {"ext_rst", -1, 0}, ++ {"wakeup_gpio", -1, 12}, ++ {"ate_test", -1, 0}, ++ {"attr19", -1, -1}, ++ {"attr20", -1, -1}, ++ {"attr21", -1, -1}, ++ {"attr22", -1, -1}, ++ {"attr23", -1, -1}, ++}; ++ ++/* ++ * Export part of the configuration related to first initiliazition to the esp8089 ++ */ ++void esp_conf_upload_first(void) ++{ ++ int i; ++ ++ for (i = 0; i < MAX_ATTR_NUM; i++) { ++ if (esp_init_table[i].value < 0) ++ continue; ++ ++ if (!strcmp(esp_init_table[i].attr, "share_xtal")) ++ sif_record_bt_config(esp_init_table[i].value); ++ else if (!strcmp(esp_init_table[i].attr, "ext_rst")) ++ sif_record_rst_config(esp_init_table[i].value); ++ else if (!strcmp(esp_init_table[i].attr, "wakeup_gpio")) ++ sif_record_wakeup_gpio_config(esp_init_table[i].value); ++ else if (!strcmp(esp_init_table[i].attr, "ate_test")) ++ sif_record_ate_config(esp_init_table[i].value); ++ } ++} ++ ++/* ++ * Export part of the configuration related to second initiliazition ++ */ ++void esp_conf_upload_second(u8 * init_data_buf, int buf_size) ++{ ++ int i; ++ ++ for (i = 0; i < MAX_FIX_ATTR_NUM; i++) { ++ if (esp_init_table[i].offset > -1 ++ && esp_init_table[i].offset < buf_size ++ && esp_init_table[i].value > -1) { ++ *(u8 *) (init_data_buf + ++ esp_init_table[i].offset) = ++ esp_init_table[i].value; ++ } else if (esp_init_table[i].offset > buf_size) { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s: offset[%d] longer than init_data_buf len[%d] Ignore\n", ++ __FUNCTION__, esp_init_table[i].offset, ++ buf_size); ++ } ++ } ++ ++} ++ ++ ++void esp_conf_init(struct device *dev) ++{ ++ ++ struct device_node *np = dev->of_node; ++ ++ if (np) { ++ ++ u32 value; ++ ++ if (!of_property_read_u32(np, "esp,crystal-26M-en", &value)) ++ esp_conf_set_attr("crystal_26M_en", value); ++ ++ if (!of_property_read_u32(np, "esp,sdio-configure", &value)) ++ esp_conf_set_attr("sdio_configure", value); ++ ++ if (of_property_read_bool(np, "esp,shared-xtal")) ++ esp_conf_set_attr("share_xtal", 1); ++ ++ if (!of_property_read_u32(np, "esp,gpio-wake", &value)) ++ esp_conf_set_attr("gpio_wake", value); ++ ++ if (!of_property_read_u32(np, "esp,wakeup-gpio", &value)) ++ esp_conf_set_attr("wakeup_gpio", value); ++ ++ if (of_property_read_bool(np, "esp,configure-dual-antenna")) ++ esp_conf_set_attr("dual_ant_configure", 1); ++ ++ if (of_property_read_bool(np, "esp,no-auto-sleep")) ++ esp_conf_set_attr("no_auto_sleep", 1); ++ ++ if (of_property_read_bool(np, "esp,test-xtal")) ++ esp_conf_set_attr("test_xtal", 1); ++ ++ if (of_property_read_bool(np, "esp,bt-configure")) ++ esp_conf_set_attr("bt_configure", 1); ++ ++ if (!of_property_read_u32(np, "esp,bt-protocol", &value)) ++ esp_conf_set_attr("bt_protocol", value); ++ ++ if (of_property_read_bool(np, "esp,test-uart-configure")) ++ esp_conf_set_attr("test_uart_configure", 1); ++ ++ if (of_property_read_bool(np, "esp,speed-suspend")) ++ esp_conf_set_attr("speed_suspend", 1); ++ ++ if (of_property_read_bool(np, "esp,ate-test")) ++ esp_conf_set_attr("ate_test", 1); ++ ++ if (!of_property_read_u32(np, "esp,ext-rst", &value)) ++ esp_conf_set_attr("ext_rst", value); ++ ++ } ++ ++ if (mod_parm_crystal >= 0 && mod_parm_crystal <= 2) ++ esp_conf_set_attr("crystal_26M_en", mod_parm_crystal); ++ ++ ++ esp_conf_show_attrs(); ++ ++} ++ ++int esp_conf_set_attr(char *name, u8 value) { ++ ++ int i; ++ ++ for (i = 0; i < MAX_ATTR_NUM; i++) { ++ ++ if (strcmp(esp_init_table[i].attr, name) == 0) { ++ esp_dbg(ESP_DBG, "set config: %s value: %d", name, value); ++ esp_init_table[i].value = value; ++ return 0; ++ } ++ ++ } ++ ++ return -1; ++ ++} ++ ++void esp_conf_show_attrs(void) ++{ ++ int i; ++ for (i = 0; i < MAX_ATTR_NUM; i++) ++ if (esp_init_table[i].offset > -1) ++ esp_dbg(ESP_SHOW, "config parm:%s (id:%d), value: %d\n", ++ esp_init_table[i].attr, ++ esp_init_table[i].offset, ++ esp_init_table[i].value); ++} +diff --git a/drivers/net/wireless/esp8089/esp_file.h b/drivers/net/wireless/esp8089/esp_file.h +new file mode 100644 +index 000000000000..5ba39c626baa +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_file.h +@@ -0,0 +1,43 @@ ++/* ++ * Copyright (c) 2010 -2014 Espressif System. ++ * ++ * file operation in kernel space ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_FILE_H_ ++#define _ESP_FILE_H_ ++ ++#include ++#include ++ ++#define E_ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) ++ ++#define CONF_ATTR_LEN 24 ++#define CONF_VAL_LEN 3 ++#define MAX_ATTR_NUM 24 ++#define MAX_FIX_ATTR_NUM 16 ++#define MAX_BUF_LEN ((CONF_ATTR_LEN + CONF_VAL_LEN + 2) * MAX_ATTR_NUM + 2) ++ ++struct esp_init_table_elem { ++ char attr[CONF_ATTR_LEN]; ++ int offset; ++ short value; ++}; ++ ++void esp_conf_init(struct device *dev); ++void esp_conf_upload_first(void); ++void esp_conf_upload_second(u8 * init_data_buf, int buf_size); ++int esp_conf_set_attr(char *name, u8 value); ++void esp_conf_show_attrs(void); ++ ++#endif /* _ESP_FILE_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_init_data.h b/drivers/net/wireless/esp8089/esp_init_data.h +new file mode 100644 +index 000000000000..16f451affd1e +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_init_data.h +@@ -0,0 +1,7 @@ ++static char esp_init_data[] = ++ { 0x5, 0x0, 4, 2, 5, 5, 5, 2, 5, 0, 4, 5, 5, 4, 5, 5, 4, -2, -3, -1, ++-16, -16, -16, -32, -32, -32, 204, 1, 0xff, 0xff, 0, 0, 0, 0, 82, 78, 74, 68, 64, 56, 0, ++0, 1, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 10, 0x0, 0x0, ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++0 }; +diff --git a/drivers/net/wireless/esp8089/esp_io.c b/drivers/net/wireless/esp8089/esp_io.c +new file mode 100644 +index 000000000000..6c5c01aad4e5 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_io.c +@@ -0,0 +1,639 @@ ++/* ++ * Copyright (c) 2009 - 2014 Espressif System. ++ * IO interface ++ * - sdio/spi common i/f driver ++ * - target sdio hal ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include "esp_sif.h" ++#include "slc_host_register.h" ++#include "esp_debug.h" ++ ++#ifdef SIF_DEBUG_DSR_DUMP_REG ++static void dump_slc_regs(struct slc_host_regs *regs); ++#endif /* SIF_DEBUG_DSR_DUMP_REG */ ++ ++int esp_common_read(struct esp_pub *epub, u8 * buf, u32 len, int sync, ++ bool noround) ++{ ++ if (sync) { ++ return sif_lldesc_read_sync(epub, buf, len); ++ } else { ++ return sif_lldesc_read_raw(epub, buf, len, noround); ++ } ++} ++ ++ ++int esp_common_write(struct esp_pub *epub, u8 * buf, u32 len, int sync) ++{ ++ if (sync) { ++ return sif_lldesc_write_sync(epub, buf, len); ++ } else { ++ return sif_lldesc_write_raw(epub, buf, len); ++ } ++} ++ ++ ++int esp_common_read_with_addr(struct esp_pub *epub, u32 addr, u8 * buf, ++ u32 len, int sync) ++{ ++ if (sync) { ++ return sif_io_sync(epub, addr, buf, len, ++ SIF_FROM_DEVICE | SIF_SYNC | ++ SIF_BYTE_BASIS | SIF_INC_ADDR); ++ } else { ++ return sif_io_raw(epub, addr, buf, len, ++ SIF_FROM_DEVICE | SIF_BYTE_BASIS | ++ SIF_INC_ADDR); ++ } ++ ++} ++ ++ ++int esp_common_write_with_addr(struct esp_pub *epub, u32 addr, u8 * buf, ++ u32 len, int sync) ++{ ++ if (sync) { ++ return sif_io_sync(epub, addr, buf, len, ++ SIF_TO_DEVICE | SIF_SYNC | ++ SIF_BYTE_BASIS | SIF_INC_ADDR); ++ } else { ++ return sif_io_raw(epub, addr, buf, len, ++ SIF_TO_DEVICE | SIF_BYTE_BASIS | ++ SIF_INC_ADDR); ++ } ++} ++ ++int esp_common_readbyte_with_addr(struct esp_pub *epub, u32 addr, u8 * buf, ++ int sync) ++{ ++ if (sync) { ++ int res; ++ sif_lock_bus(epub); ++ *buf = sdio_io_readb(epub, addr, &res); ++ sif_unlock_bus(epub); ++ return res; ++ } else { ++ int res; ++ *buf = sdio_io_readb(epub, addr, &res); ++ return res; ++ } ++ ++} ++ ++ ++ ++int esp_common_writebyte_with_addr(struct esp_pub *epub, u32 addr, u8 buf, ++ int sync) ++{ ++ if (sync) { ++ int res; ++ sif_lock_bus(epub); ++ sdio_io_writeb(epub, buf, addr, &res); ++ sif_unlock_bus(epub); ++ return res; ++ } else { ++ int res; ++ sdio_io_writeb(epub, buf, addr, &res); ++ return res; ++ } ++} ++ ++int sif_read_reg_window(struct esp_pub *epub, unsigned int reg_addr, ++ u8 * value) ++{ ++ u8 *p_tbuf = NULL; ++ int ret = 0; ++ int retry = 20; ++ ++ reg_addr >>= 2; ++ if (reg_addr > 0x1f) ++ return -1; ++ ++ p_tbuf = kzalloc(4, GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ ++ p_tbuf[0] = 0x80 | (reg_addr & 0x1f); ++ ++ ret = ++ esp_common_write_with_addr(epub, SLC_HOST_WIN_CMD, p_tbuf, 1, ++ ESP_SIF_NOSYNC); ++ ++ if (ret == 0) { ++ do { ++ if (retry < 20) ++ mdelay(10); ++ retry--; ++ ret = ++ esp_common_read_with_addr(epub, ++ SLC_HOST_STATE_W0, ++ p_tbuf, 4, ++ ESP_SIF_NOSYNC); ++ } while (retry > 0 && ret != 0); ++ } ++ ++ if (ret == 0) ++ memcpy(value, p_tbuf, 4); ++ ++ kfree(p_tbuf); ++ return ret; ++} ++ ++int sif_write_reg_window(struct esp_pub *epub, unsigned int reg_addr, ++ u8 * value) ++{ ++ u8 *p_tbuf = NULL; ++ int ret = 0; ++ ++ reg_addr >>= 2; ++ if (reg_addr > 0x1f) ++ return -1; ++ ++ p_tbuf = kzalloc(8, GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ memcpy(p_tbuf, value, 4); ++ p_tbuf[4] = 0xc0 | (reg_addr & 0x1f); ++ ++ ret = ++ esp_common_write_with_addr(epub, SLC_HOST_CONF_W5, p_tbuf, 5, ++ ESP_SIF_NOSYNC); ++ ++ kfree(p_tbuf); ++ return ret; ++} ++ ++int sif_ack_target_read_err(struct esp_pub *epub) ++{ ++ u32 value[1]; ++ int ret; ++ ++ ret = sif_read_reg_window(epub, SLC_RX_LINK, (u8 *) value); ++ if (ret) ++ return ret; ++ value[0] |= SLC_RXLINK_START; ++ ret = sif_write_reg_window(epub, SLC_RX_LINK, (u8 *) value); ++ return ret; ++} ++ ++int sif_had_io_enable(struct esp_pub *epub) ++{ ++ u32 *p_tbuf = NULL; ++ int ret; ++ ++ p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ ++ *p_tbuf = ++ SLC_TXEOF_ENA | (0x4 << SLC_FIFO_MAP_ENA_S) | SLC_TX_DUMMY_MODE ++ | SLC_HDA_MAP_128K | (0xFE << SLC_TX_PUSH_IDLE_NUM_S); ++ ret = sif_write_reg_window(epub, SLC_BRIDGE_CONF, (u8 *) p_tbuf); ++ ++ if (ret) ++ goto _err; ++ ++ *p_tbuf = 0x30; ++ ret = ++ esp_common_write_with_addr((epub), SLC_HOST_CONF_W4 + 1, ++ (u8 *) p_tbuf, 1, ESP_SIF_NOSYNC); ++ ++ if (ret) ++ goto _err; ++ //set w3 0 ++ *p_tbuf = 0x1; ++ ret = ++ esp_common_write_with_addr((epub), SLC_HOST_CONF_W3, ++ (u8 *) p_tbuf, 1, ESP_SIF_NOSYNC); ++ ++ _err: ++ kfree(p_tbuf); ++ return ret; ++} ++ ++typedef enum _SDIO_INTR_MODE { ++ SDIO_INTR_IB = 0, ++ SDIO_INTR_OOB_TOGGLE, ++ SDIO_INTR_OOB_HIGH_LEVEL, ++ SDIO_INTR_OOB_LOW_LEVEL, ++} SDIO_INTR_MODE; ++ ++#define GEN_GPIO_SEL(_gpio_num, _sel_func, _intr_mode, _offset) (((_offset)<< 9 ) |((_intr_mode) << 7)|((_sel_func) << 4)|(_gpio_num)) ++//bit[3:0] = gpio num, 2 ++//bit[6:4] = gpio sel func, 0 ++//bit[8:7] = gpio intr mode, SDIO_INTR_OOB_TOGGLE ++//bit[15:9] = register offset, 0x38 ++ ++u16 gpio_sel_sets[17] = { ++ GEN_GPIO_SEL(0, 0, SDIO_INTR_OOB_TOGGLE, 0x34), //GPIO0 ++ GEN_GPIO_SEL(1, 3, SDIO_INTR_OOB_TOGGLE, 0x18), //U0TXD ++ GEN_GPIO_SEL(2, 0, SDIO_INTR_OOB_TOGGLE, 0x38), //GPIO2 ++ GEN_GPIO_SEL(3, 3, SDIO_INTR_OOB_TOGGLE, 0x14), //U0RXD ++ GEN_GPIO_SEL(4, 0, SDIO_INTR_OOB_TOGGLE, 0x3C), //GPIO4 ++ GEN_GPIO_SEL(5, 0, SDIO_INTR_OOB_TOGGLE, 0x40), //GPIO5 ++ GEN_GPIO_SEL(6, 3, SDIO_INTR_OOB_TOGGLE, 0x1C), //SD_CLK ++ GEN_GPIO_SEL(7, 3, SDIO_INTR_OOB_TOGGLE, 0x20), //SD_DATA0 ++ GEN_GPIO_SEL(8, 3, SDIO_INTR_OOB_TOGGLE, 0x24), //SD_DATA1 ++ GEN_GPIO_SEL(9, 3, SDIO_INTR_OOB_TOGGLE, 0x28), //SD_DATA2 ++ GEN_GPIO_SEL(10, 3, SDIO_INTR_OOB_TOGGLE, 0x2C), //SD_DATA3 ++ GEN_GPIO_SEL(11, 3, SDIO_INTR_OOB_TOGGLE, 0x30), //SD_CMD ++ GEN_GPIO_SEL(12, 3, SDIO_INTR_OOB_TOGGLE, 0x04), //MTDI ++ GEN_GPIO_SEL(13, 3, SDIO_INTR_OOB_TOGGLE, 0x08), //MTCK ++ GEN_GPIO_SEL(14, 3, SDIO_INTR_OOB_TOGGLE, 0x0C), //MTMS ++ GEN_GPIO_SEL(15, 3, SDIO_INTR_OOB_TOGGLE, 0x10), //MTDO ++ //pls do not change sel before, if you want to change intr mode,change the one blow ++ //GEN_GPIO_SEL(2, 0, SDIO_INTR_OOB_TOGGLE, 0x38) ++ GEN_GPIO_SEL(2, 0, SDIO_INTR_OOB_LOW_LEVEL, 0x38) ++}; ++ ++#if defined(USE_EXT_GPIO) ++u16 gpio_forbidden = 0; ++#endif ++ ++int sif_interrupt_target(struct esp_pub *epub, u8 index) ++{ ++ u8 low_byte = BIT(index); ++ return esp_common_writebyte_with_addr(epub, SLC_HOST_CONF_W4 + 2, ++ low_byte, ESP_SIF_NOSYNC); ++ ++} ++ ++#ifdef USE_EXT_GPIO ++int sif_config_gpio_mode(struct esp_pub *epub, u8 gpio_num, u8 gpio_mode) ++{ ++ u32 *p_tbuf = NULL; ++ int err; ++ ++ if ((BIT(gpio_num) & gpio_forbidden) || gpio_num > 15) ++ return -EINVAL; ++ ++ p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ *p_tbuf = (gpio_mode << 16) | gpio_sel_sets[gpio_num]; ++ err = ++ esp_common_write_with_addr(epub, SLC_HOST_CONF_W1, ++ (u8 *) p_tbuf, sizeof(u32), ++ ESP_SIF_NOSYNC); ++ kfree(p_tbuf); ++ if (err) ++ return err; ++ ++ return sif_interrupt_target(epub, 4); ++} ++ ++int sif_set_gpio_output(struct esp_pub *epub, u16 mask, u16 value) ++{ ++ u32 *p_tbuf = NULL; ++ int err; ++ ++ mask &= ~gpio_forbidden; ++ p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ *p_tbuf = (mask << 16) | value; ++ err = ++ esp_common_write_with_addr(epub, SLC_HOST_CONF_W2, ++ (u8 *) p_tbuf, sizeof(u32), ++ ESP_SIF_NOSYNC); ++ kfree(p_tbuf); ++ if (err) ++ return err; ++ ++ return sif_interrupt_target(epub, 5); ++} ++ ++int sif_get_gpio_intr(struct esp_pub *epub, u16 intr_mask, u16 * value) ++{ ++ u32 *p_tbuf = NULL; ++ int err; ++ ++ p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ *p_tbuf = 0; ++ err = ++ esp_common_read_with_addr(epub, SLC_HOST_CONF_W3, ++ (u8 *) p_tbuf, sizeof(u32), ++ ESP_SIF_NOSYNC); ++ if (err) { ++ kfree(p_tbuf); ++ return err; ++ } ++ ++ *value = *p_tbuf & intr_mask; ++ kfree(p_tbuf); ++ if (*value == 0) ++ return 0; ++ return sif_interrupt_target(epub, 6); ++} ++ ++int sif_get_gpio_input(struct esp_pub *epub, u16 * mask, u16 * value) ++{ ++ u32 *p_tbuf = NULL; ++ int err; ++ ++ err = sif_interrupt_target(epub, 3); ++ if (err) ++ return err; ++ ++ udelay(20); ++ p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL); ++ if (p_tbuf == NULL) ++ return -ENOMEM; ++ *p_tbuf = 0; ++ err = ++ esp_common_read_with_addr(epub, SLC_HOST_CONF_W3, ++ (u8 *) p_tbuf, sizeof(u32), ++ ESP_SIF_NOSYNC); ++ if (err) { ++ kfree(p_tbuf); ++ return err; ++ } ++ ++ *mask = *p_tbuf >> 16; ++ *value = *p_tbuf & *mask; ++ kfree(p_tbuf); ++ ++ return 0; ++} ++#endif ++ ++void check_target_id(struct esp_pub *epub) ++{ ++ u32 date; ++ int err = 0; ++ int i; ++ ++ EPUB_CTRL_CHECK(epub, _err); ++ ++ sif_lock_bus(epub); ++ ++ for (i = 0; i < 4; i++) { ++ err = ++ esp_common_readbyte_with_addr(epub, SLC_HOST_DATE + i, ++ (u8 *) & date + i, ++ ESP_SIF_NOSYNC); ++ err = ++ esp_common_readbyte_with_addr(epub, SLC_HOST_ID + i, ++ (u8 *) & ++ EPUB_TO_CTRL(epub)-> ++ target_id + i, ++ ESP_SIF_NOSYNC); ++ } ++ ++ sif_unlock_bus(epub); ++ ++ esp_dbg(ESP_DBG_LOG, "\n\n \t\t SLC data 0x%08x, ID 0x%08x\n\n", ++ date, EPUB_TO_CTRL(epub)->target_id); ++ ++ switch (EPUB_TO_CTRL(epub)->target_id) { ++ case 0x100: ++ EPUB_TO_CTRL(epub)->slc_window_end_addr = 0x20000; ++ break; ++ case 0x600: ++ EPUB_TO_CTRL(epub)->slc_window_end_addr = 0x20000 - 0x800; ++ ++ do { ++ u16 gpio_sel; ++ u8 low_byte = 0; ++ u8 high_byte = 0; ++ u8 byte2 = 0; ++ u8 byte3 = 0; ++#ifdef USE_OOB_INTR ++ gpio_sel = gpio_sel_sets[16]; ++ low_byte = gpio_sel; ++ high_byte = gpio_sel >> 8; ++#ifdef USE_EXT_GPIO ++ gpio_forbidden |= BIT(gpio_sel & 0xf); ++#endif /* USE_EXT_GPIO */ ++#endif /* USE_OOB_INTR */ ++ ++ if (sif_get_bt_config() == 1 ++ && sif_get_rst_config() != 1) { ++ u8 gpio_num = sif_get_wakeup_gpio_config(); ++ gpio_sel = gpio_sel_sets[gpio_num]; ++ byte2 = gpio_sel; ++ byte3 = gpio_sel >> 8; ++#ifdef USE_EXT_GPIO ++ gpio_forbidden |= BIT(gpio_num); ++#endif ++ } ++ sif_lock_bus(epub); ++ err = ++ esp_common_writebyte_with_addr(epub, ++ SLC_HOST_CONF_W1, ++ low_byte, ++ ESP_SIF_NOSYNC); ++ err = ++ esp_common_writebyte_with_addr(epub, ++ SLC_HOST_CONF_W1 ++ + 1, high_byte, ++ ESP_SIF_NOSYNC); ++ err = ++ esp_common_writebyte_with_addr(epub, ++ SLC_HOST_CONF_W1 ++ + 2, byte2, ++ ESP_SIF_NOSYNC); ++ err = ++ esp_common_writebyte_with_addr(epub, ++ SLC_HOST_CONF_W1 ++ + 3, byte3, ++ ESP_SIF_NOSYNC); ++ sif_unlock_bus(epub); ++ } while (0); ++ break; ++ default: ++ EPUB_TO_CTRL(epub)->slc_window_end_addr = 0x20000; ++ break; ++ } ++ _err: ++ return; ++} ++ ++u32 sif_get_blksz(struct esp_pub * epub) ++{ ++ EPUB_CTRL_CHECK(epub, _err); ++ ++ return EPUB_TO_CTRL(epub)->slc_blk_sz; ++ _err: ++ return 512; ++} ++ ++u32 sif_get_target_id(struct esp_pub * epub) ++{ ++ EPUB_CTRL_CHECK(epub, _err); ++ ++ return EPUB_TO_CTRL(epub)->target_id; ++ _err: ++ return 0x600; ++} ++ ++void sif_dsr(struct sdio_func *func) ++{ ++ struct esp_sdio_ctrl *sctrl = sdio_get_drvdata(func); ++ static int dsr_cnt = 0, real_intr_cnt = 0, bogus_intr_cnt = 0; ++ struct slc_host_regs *regs = &(sctrl->slc_regs); ++ esp_dbg(ESP_DBG_TRACE, " %s enter %d \n", __func__, dsr_cnt++); ++ ++ sdio_release_host(sctrl->func); ++ ++ ++ sif_lock_bus(sctrl->epub); ++ ++ ++ do { ++ int ret = 0; ++ ++ memset(regs, 0x0, sizeof(struct slc_host_regs)); ++ ++ ret = ++ esp_common_read_with_addr(sctrl->epub, ++ REG_SLC_HOST_BASE + 8, ++ (u8 *) regs, ++ sizeof(struct slc_host_regs), ++ ESP_SIF_NOSYNC); ++ ++ if ((regs->intr_raw & SLC_HOST_RX_ST) && (ret == 0)) { ++ esp_dbg(ESP_DBG_TRACE, "%s eal intr cnt: %d", ++ __func__, ++real_intr_cnt); ++ ++ esp_dsr(sctrl->epub); ++ ++ } else { ++ sif_unlock_bus(sctrl->epub); ++ ++ esp_dbg(ESP_DBG_TRACE, "%s bogus_intr_cnt %d\n", ++ __func__, ++bogus_intr_cnt); ++ } ++ ++#ifdef SIF_DEBUG_DSR_DUMP_REG ++ dump_slc_regs(regs); ++#endif /* SIF_DEBUG_DUMP_DSR */ ++ ++ } while (0); ++ ++ sdio_claim_host(func); ++ ++ atomic_set(&sctrl->irq_handling, 0); ++} ++ ++ ++struct slc_host_regs *sif_get_regs(struct esp_pub *epub) ++{ ++ EPUB_CTRL_CHECK(epub, _err); ++ ++ return &EPUB_TO_CTRL(epub)->slc_regs; ++ _err: ++ return NULL; ++} ++ ++void sif_disable_target_interrupt(struct esp_pub *epub) ++{ ++ EPUB_FUNC_CHECK(epub, _exit); ++ sif_lock_bus(epub); ++#ifdef HOST_RESET_BUG ++ mdelay(10); ++#endif ++ memset(EPUB_TO_CTRL(epub)->dma_buffer, 0x00, sizeof(u32)); ++ esp_common_write_with_addr(epub, SLC_HOST_INT_ENA, ++ EPUB_TO_CTRL(epub)->dma_buffer, ++ sizeof(u32), ESP_SIF_NOSYNC); ++#ifdef HOST_RESET_BUG ++ mdelay(10); ++#endif ++ ++ sif_unlock_bus(epub); ++ ++ mdelay(1); ++ ++ sif_lock_bus(epub); ++ sif_interrupt_target(epub, 7); ++ sif_unlock_bus(epub); ++ _exit: ++ return; ++} ++ ++#ifdef SIF_DEBUG_DSR_DUMP_REG ++static void dump_slc_regs(struct slc_host_regs *regs) ++{ ++ esp_dbg(ESP_DBG_TRACE, "\n\n ------- %s --------------\n", ++ __func__); ++ ++ esp_dbg(ESP_DBG_TRACE, " \ ++ intr_raw 0x%08X \t \n \ ++ state_w0 0x%08X \t state_w1 0x%08X \n \ ++ config_w0 0x%08X \t config_w1 0x%08X \n \ ++ intr_status 0x%08X \t config_w2 0x%08X \n \ ++ config_w3 0x%08X \t config_w4 0x%08X \n \ ++ token_wdata 0x%08X \t intr_clear 0x%08X \n \ ++ intr_enable 0x%08X \n\n", regs->intr_raw, regs->state_w0, regs->state_w1, regs->config_w0, regs->config_w1, regs->intr_status, regs->config_w2, regs->config_w3, regs->config_w4, regs->token_wdata, regs->intr_clear, regs->intr_enable); ++} ++#endif /* SIF_DEBUG_DSR_DUMP_REG */ ++ ++static int bt_config = 0; ++void sif_record_bt_config(int value) ++{ ++ bt_config = value; ++} ++ ++int sif_get_bt_config(void) ++{ ++ return bt_config; ++} ++ ++static int rst_config = 0; ++void sif_record_rst_config(int value) ++{ ++ rst_config = value; ++} ++ ++int sif_get_rst_config(void) ++{ ++ return rst_config; ++} ++ ++static int ate_test = 0; ++void sif_record_ate_config(int value) ++{ ++ ate_test = value; ++} ++ ++int sif_get_ate_config(void) ++{ ++ return ate_test; ++} ++ ++static int retry_reset = 0; ++void sif_record_retry_config(void) ++{ ++ retry_reset = 1; ++} ++ ++int sif_get_retry_config(void) ++{ ++ return retry_reset; ++} ++ ++static int wakeup_gpio = 12; ++void sif_record_wakeup_gpio_config(int value) ++{ ++ wakeup_gpio = value; ++} ++ ++int sif_get_wakeup_gpio_config(void) ++{ ++ return wakeup_gpio; ++} +diff --git a/drivers/net/wireless/esp8089/esp_mac80211.c b/drivers/net/wireless/esp8089/esp_mac80211.c +new file mode 100644 +index 000000000000..14186365fdd4 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_mac80211.c +@@ -0,0 +1,1728 @@ ++/* ++ * Copyright (c) 2011-2014 Espressif System. ++ * ++ * MAC80211 support module ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "esp_pub.h" ++#include "esp_sip.h" ++#include "esp_ctrl.h" ++#include "esp_sif.h" ++#include "esp_debug.h" ++#include "esp_wl.h" ++#include "esp_utils.h" ++ ++#define ESP_IEEE80211_DBG esp_dbg ++ ++#define GET_NEXT_SEQ(seq) (((seq) +1) & 0x0fff) ++ ++static u8 esp_mac_addr[ETH_ALEN * 2]; ++static u8 getaddr_index(u8 * addr, struct esp_pub *epub); ++ ++static ++void ++esp_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, ++ struct sk_buff *skb) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_LOG, "%s enter\n", __func__); ++ if (!mod_support_no_txampdu() && ++ cfg80211_get_chandef_type(&epub->hw->conf.chandef) != ++ NL80211_CHAN_NO_HT) { ++ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); ++ struct ieee80211_hdr *wh = ++ (struct ieee80211_hdr *) skb->data; ++ if (ieee80211_is_data_qos(wh->frame_control)) { ++ if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { ++ u8 tidno = ++ ieee80211_get_qos_ctl(wh)[0] & ++ IEEE80211_QOS_CTL_TID_MASK; ++ struct esp_node *node = ++ esp_get_node_by_addr(epub, wh->addr1); ++ { ++ struct esp_tx_tid *tid = ++ &node->tid[tidno]; ++ //record ssn ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ tid->ssn = ++ GET_NEXT_SEQ(le16_to_cpu ++ (wh-> ++ seq_ctrl) >> 4); ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "tidno:%u,ssn:%u\n", ++ tidno, tid->ssn); ++ spin_unlock_bh(&epub-> ++ tx_ampdu_lock); ++ } ++ } else { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "tx ampdu pkt, sn:%u, %u\n", ++ le16_to_cpu(wh-> ++ seq_ctrl) >> ++ 4, skb->len); ++ } ++ } ++ } ++#ifdef GEN_ERR_CHECKSUM ++ esp_gen_err_checksum(skb); ++#endif ++ ++ sip_tx_data_pkt_enqueue(epub, skb); ++ if (epub) ++ ieee80211_queue_work(hw, &epub->tx_work); ++} ++ ++static int esp_op_start(struct ieee80211_hw *hw) ++{ ++ struct esp_pub *epub; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s\n", __func__); ++ ++ if (!hw) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, "%s no hw!\n", __func__); ++ return -EINVAL; ++ } ++ ++ epub = (struct esp_pub *) hw->priv; ++ ++ if (!epub) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, "%s no epub!\n", ++ __func__); ++ return EINVAL; ++ } ++ /*add rfkill poll function */ ++ ++ atomic_set(&epub->wl.off, 0); ++ wiphy_rfkill_start_polling(hw->wiphy); ++ return 0; ++} ++ ++static void esp_op_stop(struct ieee80211_hw *hw) ++{ ++ struct esp_pub *epub; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s\n", __func__); ++ ++ if (!hw) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, "%s no hw!\n", __func__); ++ return; ++ } ++ ++ epub = (struct esp_pub *) hw->priv; ++ ++ if (!epub) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, "%s no epub!\n", ++ __func__); ++ return; ++ } ++ ++ atomic_set(&epub->wl.off, 1); ++ ++#ifdef HOST_RESET_BUG ++ mdelay(200); ++#endif ++ ++ if (epub->wl.scan_req) { ++ hw_scan_done(epub, true); ++ epub->wl.scan_req = NULL; ++ //msleep(2); ++ } ++} ++ ++#ifdef CONFIG_PM ++static int esp_op_suspend(struct ieee80211_hw *hw, ++ struct cfg80211_wowlan *wowlan) ++{ ++ esp_dbg(ESP_DBG_OP, "%s\n", __func__); ++ ++ return 0; ++} ++ ++static int esp_op_resume(struct ieee80211_hw *hw) ++{ ++ esp_dbg(ESP_DBG_OP, "%s\n", __func__); ++ ++ return 0; ++} ++#endif //CONFIG_PM ++ ++static int esp_op_add_interface(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ struct sip_cmd_setvif svif; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter: type %d, addr %pM\n", ++ __func__, vif->type, vif->addr); ++ ++ memset(&svif, 0, sizeof(struct sip_cmd_setvif)); ++ memcpy(svif.mac, vif->addr, ETH_ALEN); ++ evif->index = svif.index = getaddr_index(vif->addr, epub); ++ evif->epub = epub; ++ epub->vif = vif; ++ svif.set = 1; ++ if ((1 << svif.index) & epub->vif_slot) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "%s interface %d already used\n", ++ __func__, svif.index); ++ return -EOPNOTSUPP; ++ } ++ epub->vif_slot |= 1 << svif.index; ++ ++ if (svif.index == ESP_PUB_MAX_VIF) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "%s only support MAX %d interface\n", ++ __func__, ESP_PUB_MAX_VIF); ++ return -EOPNOTSUPP; ++ } ++ ++ switch (vif->type) { ++ case NL80211_IFTYPE_STATION: ++ //if (svif.index == 1) ++ // vif->type = NL80211_IFTYPE_UNSPECIFIED; ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s STA \n", __func__); ++ svif.op_mode = 0; ++ svif.is_p2p = 0; ++ break; ++ case NL80211_IFTYPE_AP: ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s AP \n", __func__); ++ svif.op_mode = 1; ++ svif.is_p2p = 0; ++ break; ++ case NL80211_IFTYPE_P2P_CLIENT: ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s P2P_CLIENT \n", __func__); ++ svif.op_mode = 0; ++ svif.is_p2p = 1; ++ break; ++ case NL80211_IFTYPE_P2P_GO: ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s P2P_GO \n", __func__); ++ svif.op_mode = 1; ++ svif.is_p2p = 1; ++ break; ++ case NL80211_IFTYPE_UNSPECIFIED: ++ case NL80211_IFTYPE_ADHOC: ++ case NL80211_IFTYPE_AP_VLAN: ++ case NL80211_IFTYPE_WDS: ++ case NL80211_IFTYPE_MONITOR: ++ default: ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "%s does NOT support type %d\n", ++ __func__, vif->type); ++ return -EOPNOTSUPP; ++ } ++ ++ sip_cmd(epub, SIP_CMD_SETVIF, (u8 *) & svif, ++ sizeof(struct sip_cmd_setvif)); ++ return 0; ++} ++ ++static int esp_op_change_interface(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ enum nl80211_iftype new_type, bool p2p) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ struct sip_cmd_setvif svif; ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter,change to if:%d \n", ++ __func__, new_type); ++ ++ if (new_type == NL80211_IFTYPE_AP) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter,change to AP \n", ++ __func__); ++ } ++ ++ if (vif->type != new_type) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s type from %d to %d\n", ++ __func__, vif->type, new_type); ++ } ++ ++ memset(&svif, 0, sizeof(struct sip_cmd_setvif)); ++ memcpy(svif.mac, vif->addr, ETH_ALEN); ++ svif.index = evif->index; ++ svif.set = 2; ++ ++ switch (new_type) { ++ case NL80211_IFTYPE_STATION: ++ svif.op_mode = 0; ++ svif.is_p2p = p2p; ++ break; ++ case NL80211_IFTYPE_AP: ++ svif.op_mode = 1; ++ svif.is_p2p = p2p; ++ break; ++ case NL80211_IFTYPE_P2P_CLIENT: ++ svif.op_mode = 0; ++ svif.is_p2p = 1; ++ break; ++ case NL80211_IFTYPE_P2P_GO: ++ svif.op_mode = 1; ++ svif.is_p2p = 1; ++ break; ++ case NL80211_IFTYPE_UNSPECIFIED: ++ case NL80211_IFTYPE_ADHOC: ++ case NL80211_IFTYPE_AP_VLAN: ++ case NL80211_IFTYPE_WDS: ++ case NL80211_IFTYPE_MONITOR: ++ default: ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "%s does NOT support type %d\n", ++ __func__, vif->type); ++ return -EOPNOTSUPP; ++ } ++ sip_cmd(epub, SIP_CMD_SETVIF, (u8 *) & svif, ++ sizeof(struct sip_cmd_setvif)); ++ return 0; ++} ++ ++static void esp_op_remove_interface(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ struct sip_cmd_setvif svif; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, ++ "%s enter, vif addr %pM, beacon enable %x\n", ++ __func__, vif->addr, ++ vif->bss_conf.enable_beacon); ++ ++ memset(&svif, 0, sizeof(struct sip_cmd_setvif)); ++ svif.index = evif->index; ++ epub->vif_slot &= ~(1 << svif.index); ++ ++ if (evif->ap_up) { ++ evif->beacon_interval = 0; ++ del_timer_sync(&evif->beacon_timer); ++ evif->ap_up = false; ++ } ++ epub->vif = NULL; ++ evif->epub = NULL; ++ ++ sip_cmd(epub, SIP_CMD_SETVIF, (u8 *) & svif, ++ sizeof(struct sip_cmd_setvif)); ++ ++ /* clean up tx/rx queue */ ++ ++} ++ ++#define BEACON_TIM_SAVE_MAX 20 ++u8 beacon_tim_saved[BEACON_TIM_SAVE_MAX]; ++int beacon_tim_count; ++static void beacon_tim_init(void) ++{ ++ memset(beacon_tim_saved, 0, BEACON_TIM_SAVE_MAX); ++ beacon_tim_count = 0; ++} ++ ++static u8 beacon_tim_save(u8 this_tim) ++{ ++ u8 all_tim = 0; ++ int i; ++ beacon_tim_saved[beacon_tim_count] = this_tim; ++ if (++beacon_tim_count >= BEACON_TIM_SAVE_MAX) ++ beacon_tim_count = 0; ++ for (i = 0; i < BEACON_TIM_SAVE_MAX; i++) ++ all_tim |= beacon_tim_saved[i]; ++ return all_tim; ++} ++ ++static bool beacon_tim_alter(struct sk_buff *beacon) ++{ ++ u8 *p, *tim_end; ++ u8 tim_count; ++ int len; ++ int remain_len; ++ struct ieee80211_mgmt *mgmt; ++ ++ if (beacon == NULL) ++ return false; ++ ++ mgmt = (struct ieee80211_mgmt *) ((u8 *) beacon->data); ++ ++ remain_len = ++ beacon->len - ((u8 *) mgmt->u.beacon.variable - (u8 *) mgmt + ++ 12); ++ p = mgmt->u.beacon.variable; ++ ++ while (remain_len > 0) { ++ len = *(++p); ++ if (*p == WLAN_EID_TIM) { // tim field ++ tim_end = p + len; ++ tim_count = *(++p); ++ p += 2; ++ //multicast ++ if (tim_count == 0) ++ *p |= 0x1; ++ if ((*p & 0xfe) == 0 && tim_end >= p + 1) { // we only support 8 sta in this case ++ p++; ++ *p = beacon_tim_save(*p); ++ } ++ return tim_count == 0; ++ } ++ p += (len + 1); ++ remain_len -= (2 + len); ++ } ++ ++ return false; ++} ++ ++unsigned long init_jiffies; ++unsigned long cycle_beacon_count; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) ++static void drv_handle_beacon(struct timer_list *t) ++#else ++static void drv_handle_beacon(unsigned long data) ++#endif ++{ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) ++ struct esp_vif *evif = from_timer(evif, t, beacon_timer); ++ struct ieee80211_vif *vif = evif->epub->vif; ++#else ++ struct ieee80211_vif *vif = (struct ieee80211_vif *) data; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++#endif ++ struct sk_buff *beacon; ++ struct sk_buff *skb; ++ static int dbgcnt = 0; ++ bool tim_reach = false; ++ ++ if (evif->epub == NULL) ++ return; ++ ++ mdelay(2400 * (cycle_beacon_count % 25) % 10000 / 1000); ++ ++ beacon = ieee80211_beacon_get(evif->epub->hw, vif, 0); ++ ++ tim_reach = beacon_tim_alter(beacon); ++ ++ if (beacon && !(dbgcnt++ % 600)) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, " beacon length:%d,fc:0x%x\n", ++ beacon->len, ++ ((struct ieee80211_mgmt *) (beacon-> ++ data))-> ++ frame_control); ++ ++ } ++ ++ if (beacon) ++ sip_tx_data_pkt_enqueue(evif->epub, beacon); ++ ++ if (cycle_beacon_count++ == 100) { ++ init_jiffies = jiffies; ++ cycle_beacon_count -= 100; ++ } ++ mod_timer(&evif->beacon_timer, ++ init_jiffies + ++ msecs_to_jiffies(cycle_beacon_count * ++ vif->bss_conf.beacon_int * 1024 / ++ 1000)); ++ //FIXME:the packets must be sent at home channel ++ //send buffer mcast frames ++ if (tim_reach) { ++ skb = ieee80211_get_buffered_bc(evif->epub->hw, vif); ++ while (skb) { ++ sip_tx_data_pkt_enqueue(evif->epub, skb); ++ skb = ++ ieee80211_get_buffered_bc(evif->epub->hw, vif); ++ } ++ } ++} ++ ++static void init_beacon_timer(struct ieee80211_vif *vif) ++{ ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, " %s enter: beacon interval %x\n", ++ __func__, evif->beacon_interval); ++ ++ beacon_tim_init(); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) ++ timer_setup(&evif->beacon_timer, drv_handle_beacon, 0); ++#else ++ init_timer(&evif->beacon_timer); //TBD, not init here... ++ evif->beacon_timer.data = (unsigned long) vif; ++ evif->beacon_timer.function = drv_handle_beacon; ++#endif ++ cycle_beacon_count = 1; ++ init_jiffies = jiffies; ++ evif->beacon_timer.expires = ++ init_jiffies + ++ msecs_to_jiffies(cycle_beacon_count * ++ vif->bss_conf.beacon_int * 1024 / 1000); ++ add_timer(&evif->beacon_timer); ++} ++ ++static int esp_op_config(struct ieee80211_hw *hw, u32 changed) ++{ ++ //struct ieee80211_conf *conf = &hw->conf; ++ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter 0x%08x\n", __func__, ++ changed); ++ ++ if (changed & ++ (IEEE80211_CONF_CHANGE_CHANNEL | IEEE80211_CONF_CHANGE_IDLE)) { ++ sip_send_config(epub, &hw->conf); ++ } ++ ++ return 0; ++} ++ ++static void esp_op_bss_info_changed(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_bss_conf *info, ++ u64 changed) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ ++ // ieee80211_bss_conf(include/net/mac80211.h) is included in ieee80211_sub_if_data(net/mac80211/ieee80211_i.h) , does bssid=ieee80211_if_ap's ssid ? ++ // in 2.6.27, ieee80211_sub_if_data has ieee80211_bss_conf while in 2.6.32 ieee80211_sub_if_data don't have ieee80211_bss_conf ++ // in 2.6.27, ieee80211_bss_conf->enable_beacon don't exist, does it mean it support beacon always? ++ // ESP_IEEE80211_DBG(ESP_DBG_OP, " %s enter: vif addr %pM, changed %x, assoc %x, bssid %pM\n", __func__, vif->addr, changed, vif->cfg.assoc, info->bssid); ++ // sdata->u.sta.bssid ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, ++ " %s enter: changed %llx, assoc %x, bssid %pM\n", ++ __func__, changed, vif->cfg.assoc, info->bssid); ++ ++ if (vif->type == NL80211_IFTYPE_STATION) { ++ if ((changed & BSS_CHANGED_BSSID) || ++ ((changed & BSS_CHANGED_ASSOC) && (vif->cfg.assoc))) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ " %s STA change bssid or assoc\n", ++ __func__); ++ evif->beacon_interval = vif->cfg.aid; ++ memcpy(epub->wl.bssid, (u8 *) info->bssid, ++ ETH_ALEN); ++ sip_send_bss_info_update(epub, evif, ++ (u8 *) info->bssid, ++ vif->cfg.assoc); ++ } else if ((changed & BSS_CHANGED_ASSOC) && (!vif->cfg.assoc)) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ " %s STA change disassoc\n", ++ __func__); ++ evif->beacon_interval = 0; ++ memset(epub->wl.bssid, 0, ETH_ALEN); ++ sip_send_bss_info_update(epub, evif, ++ (u8 *) info->bssid, ++ vif->cfg.assoc); ++ } else { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "%s wrong mode of STA mode\n", ++ __func__); ++ } ++ } else if (vif->type == NL80211_IFTYPE_AP) { ++ if ((changed & BSS_CHANGED_BEACON_ENABLED) || ++ (changed & BSS_CHANGED_BEACON_INT)) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ " %s AP change enable %d, interval is %d, bssid %pM\n", ++ __func__, info->enable_beacon, ++ info->beacon_int, info->bssid); ++ if (info->enable_beacon && evif->ap_up != true) { ++ evif->beacon_interval = info->beacon_int; ++ init_beacon_timer(vif); ++ sip_send_bss_info_update(epub, evif, ++ (u8 *) info-> ++ bssid, 2); ++ evif->ap_up = true; ++ } else if (!info->enable_beacon && evif->ap_up && ++ !(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) ++ ) { ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ " %s AP disable beacon, interval is %d\n", ++ __func__, ++ info->beacon_int); ++ evif->beacon_interval = 0; ++ del_timer_sync(&evif->beacon_timer); ++ sip_send_bss_info_update(epub, evif, ++ (u8 *) info-> ++ bssid, 2); ++ evif->ap_up = false; ++ } ++ } ++ } else { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "%s op mode unspecified\n", __func__); ++ } ++} ++ ++ ++static u64 esp_op_prepare_multicast(struct ieee80211_hw *hw, ++ struct netdev_hw_addr_list *mc_list) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++ return 0; ++} ++ ++static void esp_op_configure_filter(struct ieee80211_hw *hw, ++ unsigned int changed_flags, ++ unsigned int *total_flags, ++ u64 multicast) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++ epub->rx_filter = 0; ++ ++ if (*total_flags & FIF_ALLMULTI) ++ epub->rx_filter |= FIF_ALLMULTI; ++ ++ *total_flags = epub->rx_filter; ++} ++ ++static int esp_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ struct ieee80211_key_conf *key) ++{ ++ u8 i; ++ int ret; ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ u8 ifidx = evif->index; ++ u8 *peer_addr, isvalid; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, ++ "%s enter, flags = %x keyindx = %x cmd = %x mac = %pM cipher = %x\n", ++ __func__, key->flags, key->keyidx, cmd, ++ vif->addr, key->cipher); ++ ++ key->flags = key->flags | IEEE80211_KEY_FLAG_GENERATE_IV; ++ ++ if (sta) { ++ if (memcmp(sta->addr, epub->wl.bssid, ETH_ALEN)) ++ peer_addr = sta->addr; ++ else ++ peer_addr = epub->wl.bssid; ++ } else { ++ peer_addr = epub->wl.bssid; ++ } ++ isvalid = (cmd == SET_KEY) ? 1 : 0; ++ ++ if ((key->flags & IEEE80211_KEY_FLAG_PAIRWISE) ++ || (key->cipher == WLAN_CIPHER_SUITE_WEP40 ++ || key->cipher == WLAN_CIPHER_SUITE_WEP104)) { ++ if (isvalid) { ++ for (i = 0; i < 19; i++) { ++ if (epub->hi_map[i].flag == 0) { ++ epub->hi_map[i].flag = 1; ++ key->hw_key_idx = i + 6; ++ memcpy(epub->hi_map[i].mac, ++ peer_addr, ETH_ALEN); ++ break; ++ } ++ } ++ } else { ++ u8 index = key->hw_key_idx - 6; ++ epub->hi_map[index].flag = 0; ++ memset(epub->hi_map[index].mac, 0, ETH_ALEN); ++ } ++ } else { ++ if (isvalid) { ++ for (i = 0; i < 2; i++) ++ if (epub->low_map[ifidx][i].flag == 0) { ++ epub->low_map[ifidx][i].flag = 1; ++ key->hw_key_idx = ++ i + ifidx * 2 + 2; ++ memcpy(epub->low_map[ifidx][i].mac, ++ peer_addr, ETH_ALEN); ++ break; ++ } ++ } else { ++ u8 index = key->hw_key_idx - 2 - ifidx * 2; ++ epub->low_map[ifidx][index].flag = 0; ++ memset(epub->low_map[ifidx][index].mac, 0, ++ ETH_ALEN); ++ } ++ //key->hw_key_idx = key->keyidx + ifidx * 2 + 1; ++ } ++ ++ if (key->hw_key_idx >= 6) { ++ /*send sub_scan task to target */ ++ //epub->wl.ptk = (cmd==SET_KEY) ? key : NULL; ++ if (isvalid) ++ atomic_inc(&epub->wl.ptk_cnt); ++ else ++ atomic_dec(&epub->wl.ptk_cnt); ++ if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ++ || key->cipher == WLAN_CIPHER_SUITE_WEP104) { ++ if (isvalid) ++ atomic_inc(&epub->wl.gtk_cnt); ++ else ++ atomic_dec(&epub->wl.gtk_cnt); ++ } ++ } else { ++ /*send sub_scan task to target */ ++ if (isvalid) ++ atomic_inc(&epub->wl.gtk_cnt); ++ else ++ atomic_dec(&epub->wl.gtk_cnt); ++ ++ if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ++ || key->cipher == WLAN_CIPHER_SUITE_WEP104)) { ++ if (isvalid) ++ atomic_inc(&epub->wl.ptk_cnt); ++ else ++ atomic_dec(&epub->wl.ptk_cnt); ++ //epub->wl.ptk = (cmd==SET_KEY) ? key : NULL; ++ } ++ } ++ ++ ret = sip_send_setkey(epub, ifidx, peer_addr, key, isvalid); ++ ++ if ((key->cipher == WLAN_CIPHER_SUITE_TKIP ++ || key->cipher == WLAN_CIPHER_SUITE_TKIP)) { ++ if (ret == 0) ++ atomic_set(&epub->wl.tkip_key_set, 1); ++ } ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s exit\n", __func__); ++ return ret; ++} ++ ++static void esp_op_update_tkip_key(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_key_conf *conf, ++ struct ieee80211_sta *sta, ++ u32 iv32, u16 * phase1key) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++} ++ ++void hw_scan_done(struct esp_pub *epub, bool aborted) ++{ ++ cancel_delayed_work_sync(&epub->scan_timeout_work); ++ ++ ESSERT(epub->wl.scan_req != NULL); ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) ++ { ++ struct cfg80211_scan_info info = { ++ .aborted = aborted, ++ }; ++ ++ ieee80211_scan_completed(epub->hw, &info); ++ } ++#else ++ ieee80211_scan_completed(epub->hw, aborted); ++#endif ++ if (test_and_clear_bit(ESP_WL_FLAG_STOP_TXQ, &epub->wl.flags)) { ++ sip_trigger_txq_process(epub->sip); ++ } ++} ++ ++static void hw_scan_timeout_report(struct work_struct *work) ++{ ++ struct esp_pub *epub = ++ container_of(work, struct esp_pub, scan_timeout_work.work); ++ bool aborted; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "eagle hw scan done\n"); ++ ++ if (test_and_clear_bit(ESP_WL_FLAG_STOP_TXQ, &epub->wl.flags)) { ++ sip_trigger_txq_process(epub->sip); ++ } ++ /*check if normally complete or aborted like timeout/hw error */ ++ aborted = (epub->wl.scan_req) ? true : false; ++ ++ if (aborted == true) { ++ epub->wl.scan_req = NULL; ++ } ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) ++ { ++ struct cfg80211_scan_info info = { ++ .aborted = aborted, ++ }; ++ ++ ieee80211_scan_completed(epub->hw, &info); ++ } ++#else ++ ieee80211_scan_completed(epub->hw, aborted); ++#endif ++} ++ ++static int esp_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++ return 0; ++} ++ ++static int esp_node_attach(struct ieee80211_hw *hw, u8 ifidx, ++ struct ieee80211_sta *sta) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_node *node; ++ u8 tidno; ++ struct esp_tx_tid *tid; ++ int i; ++ ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ ++ if (hweight32(epub->enodes_maps[ifidx]) < ESP_PUB_MAX_STA ++ && (i = ffz(epub->enodes_map)) < ESP_PUB_MAX_STA + 1) { ++ epub->enodes_map |= (1 << i); ++ epub->enodes_maps[ifidx] |= (1 << i); ++ node = (struct esp_node *) sta->drv_priv; ++ epub->enodes[i] = node; ++ node->sta = sta; ++ node->ifidx = ifidx; ++ node->index = i; ++ ++ for (tidno = 0, tid = &node->tid[tidno]; ++ tidno < WME_NUM_TID; tidno++) { ++ tid->ssn = 0; ++ tid->cnt = 0; ++ tid->state = ESP_TID_STATE_INIT; ++ } ++ ++ ++ } else { ++ i = -1; ++ } ++ ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return i; ++} ++ ++static int esp_node_detach(struct ieee80211_hw *hw, u8 ifidx, ++ struct ieee80211_sta *sta) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ u32 map; ++ int i; ++ struct esp_node *node = NULL; ++ ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ map = epub->enodes_maps[ifidx]; ++ while (map != 0) { ++ i = ffs(map) - 1; ++ if (epub->enodes[i]->sta == sta) { ++ epub->enodes[i]->sta = NULL; ++ node = epub->enodes[i]; ++ epub->enodes[i] = NULL; ++ epub->enodes_map &= ~(1 << i); ++ epub->enodes_maps[ifidx] &= ~(1 << i); ++ ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return i; ++ } ++ map &= ~(1 << i); ++ } ++ ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return -1; ++} ++ ++struct esp_node *esp_get_node_by_addr(struct esp_pub *epub, ++ const u8 * addr) ++{ ++ int i; ++ u32 map; ++ struct esp_node *node = NULL; ++ if (addr == NULL) ++ return NULL; ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ map = epub->enodes_map; ++ while (map != 0) { ++ i = ffs(map) - 1; ++ if (i < 0) { ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return NULL; ++ } ++ map &= ~(1 << i); ++ if (memcmp(epub->enodes[i]->sta->addr, addr, ETH_ALEN) == ++ 0) { ++ node = epub->enodes[i]; ++ break; ++ } ++ } ++ ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return node; ++} ++ ++struct esp_node *esp_get_node_by_index(struct esp_pub *epub, u8 index) ++{ ++ u32 map; ++ struct esp_node *node = NULL; ++ ++ if (epub == NULL) ++ return NULL; ++ ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ map = epub->enodes_map; ++ if (map & BIT(index)) { ++ node = epub->enodes[index]; ++ } else { ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return NULL; ++ } ++ ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return node; ++} ++ ++int esp_get_empty_rxampdu(struct esp_pub *epub, const u8 * addr, u8 tid) ++{ ++ int index = -1; ++ if (addr == NULL) ++ return index; ++ spin_lock_bh(&epub->rx_ampdu_lock); ++ if ((index = ffz(epub->rxampdu_map)) < ESP_PUB_MAX_RXAMPDU) { ++ epub->rxampdu_map |= BIT(index); ++ epub->rxampdu_node[index] = ++ esp_get_node_by_addr(epub, addr); ++ epub->rxampdu_tid[index] = tid; ++ } else { ++ index = -1; ++ } ++ spin_unlock_bh(&epub->rx_ampdu_lock); ++ return index; ++} ++ ++int esp_get_exist_rxampdu(struct esp_pub *epub, const u8 * addr, u8 tid) ++{ ++ u8 map; ++ int index = -1; ++ int i; ++ if (addr == NULL) ++ return index; ++ spin_lock_bh(&epub->rx_ampdu_lock); ++ map = epub->rxampdu_map; ++ while (map != 0) { ++ i = ffs(map) - 1; ++ if (i < 0) { ++ spin_unlock_bh(&epub->rx_ampdu_lock); ++ return index; ++ } ++ map &= ~BIT(i); ++ if (epub->rxampdu_tid[i] == tid && ++ memcmp(epub->rxampdu_node[i]->sta->addr, addr, ++ ETH_ALEN) == 0) { ++ index = i; ++ break; ++ } ++ } ++ ++ epub->rxampdu_map &= ~BIT(index); ++ spin_unlock_bh(&epub->rx_ampdu_lock); ++ return index; ++ ++} ++ ++static int esp_op_sta_add(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ int index; ++ ESP_IEEE80211_DBG(ESP_DBG_OP, ++ "%s enter, vif addr %pM, sta addr %pM\n", ++ __func__, vif->addr, sta->addr); ++ index = esp_node_attach(hw, evif->index, sta); ++ ++ if (index < 0) ++ return -1; ++ sip_send_set_sta(epub, evif->index, 1, sta, vif, (u8) index); ++ return 0; ++} ++ ++static int esp_op_sta_remove(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_vif *evif = (struct esp_vif *) vif->drv_priv; ++ int index; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, ++ "%s enter, vif addr %pM, sta addr %pM\n", ++ __func__, vif->addr, sta->addr); ++ ++ //remove a connect in target ++ index = esp_node_detach(hw, evif->index, sta); ++ sip_send_set_sta(epub, evif->index, 0, sta, vif, (u8) index); ++ ++ return 0; ++} ++ ++ ++static void esp_op_sta_notify(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ enum sta_notify_cmd cmd, ++ struct ieee80211_sta *sta) ++{ ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++ switch (cmd) { ++ case STA_NOTIFY_SLEEP: ++ break; ++ ++ case STA_NOTIFY_AWAKE: ++ break; ++ ++ default: ++ break; ++ } ++} ++ ++ ++static int esp_op_conf_tx(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ u32 link_id, u16 queue, ++ const struct ieee80211_tx_queue_params *params) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ return sip_send_wmm_params(epub, queue, params); ++} ++ ++static u64 esp_op_get_tsf(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++ return 0; ++} ++ ++static void esp_op_set_tsf(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, u64 tsf) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++} ++ ++static void esp_op_reset_tsf(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++} ++ ++static void esp_op_rfkill_poll(struct ieee80211_hw *hw) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter \n", __func__); ++ ++ wiphy_rfkill_set_hw_state(hw->wiphy, ++ test_bit(ESP_WL_FLAG_RFKILL, ++ &epub->wl. ++ flags) ? true : false); ++} ++ ++#ifdef HW_SCAN ++static int esp_op_hw_scan(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct cfg80211_scan_request *req) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ int i, ret; ++ bool scan_often = true; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s\n", __func__); ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "scan, %d\n", req->n_ssids); ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "scan, len 1:%d,ssid 1:%s\n", ++ req->ssids->ssid_len, ++ req->ssids->ssid_len == ++ 0 ? "" : (char *) req->ssids->ssid); ++ if (req->n_ssids > 1) ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "scan, len 2:%d,ssid 2:%s\n", ++ (req->ssids + 1)->ssid_len, ++ (req->ssids + 1)->ssid_len == ++ 0 ? "" : (char *) (req->ssids + ++ 1)->ssid); ++ ++ /*scan_request is keep allocate untill scan_done,record it ++ to split request into multi sdio_cmd */ ++ if (atomic_read(&epub->wl.off)) { ++ esp_dbg(ESP_DBG_ERROR, "%s scan but wl off \n", __func__); ++ return -EPERM; ++ } ++ ++ if (req->n_ssids > 1) { ++ struct cfg80211_ssid *ssid2 = req->ssids + 1; ++ if ((req->ssids->ssid_len > 0 && ssid2->ssid_len > 0) ++ || req->n_ssids > 2) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "scan ssid num: %d, ssid1:%s, ssid2:%s,not support\n", ++ req->n_ssids, ++ req->ssids->ssid_len == ++ 0 ? "" : (char *) req->ssids-> ++ ssid, ++ ssid2->ssid_len == ++ 0 ? "" : (char *) ssid2->ssid); ++ return -EINVAL; ++ } ++ } ++ ++ epub->wl.scan_req = req; ++ ++ for (i = 0; i < req->n_channels; i++) ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "eagle hw_scan freq %d\n", ++ req->channels[i]->center_freq); ++#if 0 ++ for (i = 0; i < req->n_ssids; i++) { ++ if (req->ssids->ssid_len > 0) { ++ req->ssids->ssid[req->ssids->ssid_len] = '\0'; ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "scan_ssid %d:%s\n", i, ++ req->ssids->ssid); ++ } ++ } ++#endif ++ ++ /*in connect state, suspend tx data */ ++ if (epub->sip->support_bgscan && ++ test_bit(ESP_WL_FLAG_CONNECT, &epub->wl.flags) && ++ req->n_channels > 0) { ++ ++ scan_often = epub->scan_permit_valid ++ && time_before(jiffies, epub->scan_permit); ++ epub->scan_permit_valid = true; ++ ++ if (!scan_often) { ++/* epub->scan_permit = jiffies + msecs_to_jiffies(900); ++ set_bit(ESP_WL_FLAG_STOP_TXQ, &epub->wl.flags); ++ if (atomic_read(&epub->txq_stopped) == false) { ++ atomic_set(&epub->txq_stopped, true); ++ ieee80211_stop_queues(hw); ++ } ++*/ ++ } else { ++ ESP_IEEE80211_DBG(ESP_DBG_LOG, "scan too often\n"); ++ return -EACCES; ++ } ++ } else { ++ scan_often = false; ++ } ++ ++ /*send sub_scan task to target */ ++ ret = sip_send_scan(epub); ++ ++ if (ret) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "fail to send scan_cmd\n"); ++ return ret; ++ } else { ++ if (!scan_often) { ++ epub->scan_permit = ++ jiffies + msecs_to_jiffies(900); ++ set_bit(ESP_WL_FLAG_STOP_TXQ, &epub->wl.flags); ++ if (atomic_read(&epub->txq_stopped) == false) { ++ atomic_set(&epub->txq_stopped, true); ++ ieee80211_stop_queues(hw); ++ } ++ /*force scan complete in case target fail to report in time */ ++ ieee80211_queue_delayed_work(hw, ++ &epub-> ++ scan_timeout_work, ++ req->n_channels * HZ / ++ 4); ++ } ++ } ++ ++ return 0; ++} ++ ++static int esp_op_remain_on_channel(struct ieee80211_hw *hw, ++ struct ieee80211_channel *chan, ++ enum nl80211_channel_type channel_type, ++ int duration) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, ++ "%s enter, center_freq = %d duration = %d\n", ++ __func__, chan->center_freq, duration); ++ sip_send_roc(epub, chan->center_freq, duration); ++ return 0; ++} ++ ++static int esp_op_cancel_remain_on_channel(struct ieee80211_hw *hw) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter \n", __func__); ++ epub->roc_flags = 0; // to disable roc state ++ sip_send_roc(epub, 0, 0); ++ return 0; ++} ++#endif ++ ++void esp_rocdone_process(struct ieee80211_hw *hw, ++ struct sip_evt_roc *report) ++{ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter, state = %d is_ok = %d\n", ++ __func__, report->state, report->is_ok); ++ ++ //roc process begin ++ if ((report->state == 1) && (report->is_ok == 1)) { ++ epub->roc_flags = 1; //flags in roc state, to fix channel, not change ++ ieee80211_ready_on_channel(hw); ++ } else if ((report->state == 0) && (report->is_ok == 1)) //roc process timeout ++ { ++ epub->roc_flags = 0; // to disable roc state ++ ieee80211_remain_on_channel_expired(hw); ++ } ++} ++ ++static int esp_op_set_bitrate_mask(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ const struct cfg80211_bitrate_mask ++ *mask) ++{ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter \n", __func__); ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s vif->macaddr[%pM], mask[%d]\n", ++ __func__, vif->addr, mask->control[0].legacy); ++ ++ return 0; ++} ++ ++static void esp_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++ u32 queues, bool drop) ++{ ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter \n", __func__); ++ do { ++ ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ unsigned long time = jiffies + msecs_to_jiffies(15); ++ while (atomic_read(&epub->sip->tx_data_pkt_queued)) { ++ if (!time_before(jiffies, time)) { ++ break; ++ } ++ if (sif_get_ate_config() == 0) { ++ ieee80211_queue_work(epub->hw, ++ &epub->tx_work); ++ } else { ++ queue_work(epub->esp_wkq, &epub->tx_work); ++ } ++ //sip_txq_process(epub); ++ } ++ mdelay(10); ++ ++ } while (0); ++} ++ ++static int esp_op_ampdu_action(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_ampdu_params *params) ++{ ++ int ret = -EOPNOTSUPP; ++ enum ieee80211_ampdu_mlme_action action = params->action; ++ struct ieee80211_sta *sta = params->sta; ++ u16 tid = params->tid; ++ u16 *ssn = ¶ms->ssn; ++ u8 buf_size = params->buf_size; ++ struct esp_pub *epub = (struct esp_pub *) hw->priv; ++ struct esp_node *node = (struct esp_node *) sta->drv_priv; ++ struct esp_tx_tid *tid_info = &node->tid[tid]; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_OP, "%s enter \n", __func__); ++ switch (action) { ++ case IEEE80211_AMPDU_TX_START: ++ if (mod_support_no_txampdu() || ++ cfg80211_get_chandef_type(&epub->hw->conf.chandef) == ++ NL80211_CHAN_NO_HT || !sta->deflink.ht_cap.ht_supported) ++ return ret; ++ ++ //if (vif->p2p || vif->type != NL80211_IFTYPE_STATION) ++ // return ret; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "%s TX START, addr:%pM,tid:%u,state:%d\n", ++ __func__, sta->addr, tid, ++ tid_info->state); ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ ESSERT(tid_info->state == ESP_TID_STATE_TRIGGER); ++ *ssn = tid_info->ssn; ++ tid_info->state = ESP_TID_STATE_PROGRESS; ++ ++ ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ ret = 0; ++ break; ++ case IEEE80211_AMPDU_TX_STOP_CONT: ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "%s TX STOP, addr:%pM,tid:%u,state:%d\n", ++ __func__, sta->addr, tid, ++ tid_info->state); ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ if (tid_info->state == ESP_TID_STATE_WAIT_STOP) ++ tid_info->state = ESP_TID_STATE_STOP; ++ else ++ tid_info->state = ESP_TID_STATE_INIT; ++ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ ret = ++ sip_send_ampdu_action(epub, SIP_AMPDU_TX_STOP, ++ sta->addr, tid, node->ifidx, 0); ++ break; ++ case IEEE80211_AMPDU_TX_STOP_FLUSH: ++ case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: ++ if (tid_info->state == ESP_TID_STATE_WAIT_STOP) ++ tid_info->state = ESP_TID_STATE_STOP; ++ else ++ tid_info->state = ESP_TID_STATE_INIT; ++ ret = ++ sip_send_ampdu_action(epub, SIP_AMPDU_TX_STOP, ++ sta->addr, tid, node->ifidx, 0); ++ break; ++ case IEEE80211_AMPDU_TX_OPERATIONAL: ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "%s TX OPERATION, addr:%pM,tid:%u,state:%d\n", ++ __func__, sta->addr, tid, ++ tid_info->state); ++ spin_lock_bh(&epub->tx_ampdu_lock); ++ ++ if (tid_info->state != ESP_TID_STATE_PROGRESS) { ++ if (tid_info->state == ESP_TID_STATE_INIT) { ++ printk(KERN_ERR "%s WIFI RESET, IGNORE\n", ++ __func__); ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ return -ENETRESET; ++ } else { ++ ESSERT(0); ++ } ++ } ++ ++ tid_info->state = ESP_TID_STATE_OPERATIONAL; ++ spin_unlock_bh(&epub->tx_ampdu_lock); ++ ret = ++ sip_send_ampdu_action(epub, SIP_AMPDU_TX_OPERATIONAL, ++ sta->addr, tid, node->ifidx, ++ buf_size); ++ break; ++ case IEEE80211_AMPDU_RX_START: ++ if (mod_support_no_rxampdu() || ++ cfg80211_get_chandef_type(&epub->hw->conf.chandef) == ++ NL80211_CHAN_NO_HT || !sta->deflink.ht_cap.ht_supported) ++ return ret; ++ ++ if ((vif->p2p && false) ++ || (vif->type != NL80211_IFTYPE_STATION && false) ++ ) ++ return ret; ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, ++ "%s RX START %pM tid %u %u\n", __func__, ++ sta->addr, tid, *ssn); ++ ret = ++ sip_send_ampdu_action(epub, SIP_AMPDU_RX_START, ++ sta->addr, tid, *ssn, 64); ++ break; ++ case IEEE80211_AMPDU_RX_STOP: ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s RX STOP %pM tid %u\n", ++ __func__, sta->addr, tid); ++ ret = ++ sip_send_ampdu_action(epub, SIP_AMPDU_RX_STOP, ++ sta->addr, tid, 0, 0); ++ break; ++ default: ++ break; ++ } ++ return ret; ++} ++ ++static void esp_tx_work(struct work_struct *work) ++{ ++ struct esp_pub *epub = container_of(work, struct esp_pub, tx_work); ++ ++ mutex_lock(&epub->tx_mtx); ++ sip_txq_process(epub); ++ mutex_unlock(&epub->tx_mtx); ++} ++ ++static const struct ieee80211_ops esp_mac80211_ops = { ++ .tx = esp_op_tx, ++ .start = esp_op_start, ++ .stop = esp_op_stop, ++#ifdef CONFIG_PM ++ .suspend = esp_op_suspend, ++ .resume = esp_op_resume, ++#endif ++ .add_interface = esp_op_add_interface, ++ .remove_interface = esp_op_remove_interface, ++ .config = esp_op_config, ++ ++ .bss_info_changed = esp_op_bss_info_changed, ++ .prepare_multicast = esp_op_prepare_multicast, ++ .configure_filter = esp_op_configure_filter, ++ .set_key = esp_op_set_key, ++ .update_tkip_key = esp_op_update_tkip_key, ++ //.sched_scan_start = esp_op_sched_scan_start, ++ //.sched_scan_stop = esp_op_sched_scan_stop, ++ .set_rts_threshold = esp_op_set_rts_threshold, ++ .sta_notify = esp_op_sta_notify, ++ .conf_tx = esp_op_conf_tx, ++ .change_interface = esp_op_change_interface, ++ .get_tsf = esp_op_get_tsf, ++ .set_tsf = esp_op_set_tsf, ++ .reset_tsf = esp_op_reset_tsf, ++ .rfkill_poll = esp_op_rfkill_poll, ++#ifdef HW_SCAN ++ .hw_scan = esp_op_hw_scan, ++ .remain_on_channel = esp_op_remain_on_channel, ++ .cancel_remain_on_channel = esp_op_cancel_remain_on_channel, ++#endif ++ .ampdu_action = esp_op_ampdu_action, ++ //.get_survey = esp_op_get_survey, ++ .sta_add = esp_op_sta_add, ++ .sta_remove = esp_op_sta_remove, ++#ifdef CONFIG_NL80211_TESTMODE ++ //CFG80211_TESTMODE_CMD(esp_op_tm_cmd) ++#endif ++ .set_bitrate_mask = esp_op_set_bitrate_mask, ++ .flush = esp_op_flush, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, ++}; ++ ++struct esp_pub *esp_pub_alloc_mac80211(struct device *dev) ++{ ++ struct ieee80211_hw *hw; ++ struct esp_pub *epub; ++ int ret = 0; ++ ++ hw = ieee80211_alloc_hw(sizeof(struct esp_pub), &esp_mac80211_ops); ++ ++ if (hw == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "ieee80211 can't alloc hw!\n"); ++ ret = -ENOMEM; ++ return ERR_PTR(ret); ++ } ++ hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; ++ ++ epub = hw->priv; ++ memset(epub, 0, sizeof(*epub)); ++ epub->hw = hw; ++ SET_IEEE80211_DEV(hw, dev); ++ epub->dev = dev; ++ ++ skb_queue_head_init(&epub->txq); ++ skb_queue_head_init(&epub->txdoneq); ++ skb_queue_head_init(&epub->rxq); ++ ++ spin_lock_init(&epub->tx_ampdu_lock); ++ spin_lock_init(&epub->rx_ampdu_lock); ++ spin_lock_init(&epub->tx_lock); ++ mutex_init(&epub->tx_mtx); ++ spin_lock_init(&epub->rx_lock); ++ ++ INIT_WORK(&epub->tx_work, esp_tx_work); ++ ++ //epub->esp_wkq = create_freezable_workqueue("esp_wkq"); ++ epub->esp_wkq = create_singlethread_workqueue("esp_wkq"); ++ ++ if (epub->esp_wkq == NULL) { ++ ret = -ENOMEM; ++ return ERR_PTR(ret); ++ } ++ epub->scan_permit_valid = false; ++ INIT_DELAYED_WORK(&epub->scan_timeout_work, ++ hw_scan_timeout_report); ++ ++ return epub; ++} ++ ++ ++int esp_pub_dealloc_mac80211(struct esp_pub *epub) ++{ ++ set_bit(ESP_WL_FLAG_RFKILL, &epub->wl.flags); ++ ++ destroy_workqueue(epub->esp_wkq); ++ mutex_destroy(&epub->tx_mtx); ++ ++#ifdef ESP_NO_MAC80211 ++ free_netdev(epub->net_dev); ++ wiphy_free(epub->wdev->wiphy); ++ kfree(epub->wdev); ++#else ++ if (epub->hw) { ++ ieee80211_free_hw(epub->hw); ++ } ++#endif ++ ++ return 0; ++} ++ ++#if 0 ++static int esp_reg_notifier(struct wiphy *wiphy, ++ struct regulatory_request *request) ++{ ++ struct ieee80211_supported_band *sband; ++ struct ieee80211_channel *ch; ++ int i; ++ ++ ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter %d\n", __func__, ++ request->initiator); ++ ++ //TBD ++} ++#endif ++ ++/* 2G band channels */ ++static struct ieee80211_channel esp_channels_2ghz[] = { ++ {.hw_value = 1,.center_freq = 2412,.max_power = 25}, ++ {.hw_value = 2,.center_freq = 2417,.max_power = 25}, ++ {.hw_value = 3,.center_freq = 2422,.max_power = 25}, ++ {.hw_value = 4,.center_freq = 2427,.max_power = 25}, ++ {.hw_value = 5,.center_freq = 2432,.max_power = 25}, ++ {.hw_value = 6,.center_freq = 2437,.max_power = 25}, ++ {.hw_value = 7,.center_freq = 2442,.max_power = 25}, ++ {.hw_value = 8,.center_freq = 2447,.max_power = 25}, ++ {.hw_value = 9,.center_freq = 2452,.max_power = 25}, ++ {.hw_value = 10,.center_freq = 2457,.max_power = 25}, ++ {.hw_value = 11,.center_freq = 2462,.max_power = 25}, ++ {.hw_value = 12,.center_freq = 2467,.max_power = 25}, ++ {.hw_value = 13,.center_freq = 2472,.max_power = 25}, ++ //{ .hw_value = 14, .center_freq = 2484, .max_power = 25 }, ++}; ++ ++/* 11G rate */ ++static struct ieee80211_rate esp_rates_2ghz[] = { ++ { ++ .bitrate = 10, ++ .hw_value = CONF_HW_BIT_RATE_1MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_1MBPS, ++ }, ++ { ++ .bitrate = 20, ++ .hw_value = CONF_HW_BIT_RATE_2MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_2MBPS, ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE}, ++ { ++ .bitrate = 55, ++ .hw_value = CONF_HW_BIT_RATE_5_5MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_5_5MBPS, ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE}, ++ { ++ .bitrate = 110, ++ .hw_value = CONF_HW_BIT_RATE_11MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_11MBPS, ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE}, ++ { ++ .bitrate = 60, ++ .hw_value = CONF_HW_BIT_RATE_6MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_6MBPS, ++ }, ++ { ++ .bitrate = 90, ++ .hw_value = CONF_HW_BIT_RATE_9MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_9MBPS, ++ }, ++ { ++ .bitrate = 120, ++ .hw_value = CONF_HW_BIT_RATE_12MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_12MBPS, ++ }, ++ { ++ .bitrate = 180, ++ .hw_value = CONF_HW_BIT_RATE_18MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_18MBPS, ++ }, ++ { ++ .bitrate = 240, ++ .hw_value = CONF_HW_BIT_RATE_24MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_24MBPS, ++ }, ++ { ++ .bitrate = 360, ++ .hw_value = CONF_HW_BIT_RATE_36MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_36MBPS, ++ }, ++ { ++ .bitrate = 480, ++ .hw_value = CONF_HW_BIT_RATE_48MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_48MBPS, ++ }, ++ { ++ .bitrate = 540, ++ .hw_value = CONF_HW_BIT_RATE_54MBPS, ++ .hw_value_short = CONF_HW_BIT_RATE_54MBPS, ++ }, ++}; ++ ++static void esp_pub_init_mac80211(struct esp_pub *epub) ++{ ++ struct ieee80211_hw *hw = epub->hw; ++ ++ static const u32 cipher_suites[] = { ++ WLAN_CIPHER_SUITE_WEP40, ++ WLAN_CIPHER_SUITE_WEP104, ++ WLAN_CIPHER_SUITE_TKIP, ++ WLAN_CIPHER_SUITE_CCMP, ++ }; ++ ++ hw->max_listen_interval = 10; ++ ++ ieee80211_hw_set(hw, SIGNAL_DBM); ++ ieee80211_hw_set(hw, HAS_RATE_CONTROL); ++ ieee80211_hw_set(hw, SUPPORTS_PS); ++ ieee80211_hw_set(hw, AMPDU_AGGREGATION); ++ ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); ++ //IEEE80211_HW_PS_NULLFUNC_STACK | ++ //IEEE80211_HW_CONNECTION_MONITOR | ++ //IEEE80211_HW_BEACON_FILTER | ++ //IEEE80211_HW_AMPDU_AGGREGATION | ++ //IEEE80211_HW_REPORTS_TX_ACK_STATUS; ++ hw->max_rx_aggregation_subframes = 0x40; ++ hw->max_tx_aggregation_subframes = 0x40; ++ ++ hw->wiphy->cipher_suites = cipher_suites; ++ hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); ++ hw->wiphy->max_scan_ie_len = ++ epub->sip->tx_blksz - sizeof(struct sip_hdr) - ++ sizeof(struct sip_cmd_scan); ++ ++ /* ONLY station for now, support P2P soon... */ ++ hw->wiphy->interface_modes = ++ BIT(NL80211_IFTYPE_P2P_GO) | ++ BIT(NL80211_IFTYPE_P2P_CLIENT) | ++ BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP); ++ ++ hw->wiphy->max_scan_ssids = 2; ++ //hw->wiphy->max_sched_scan_ssids = 16; ++ //hw->wiphy->max_match_sets = 16; ++ ++ hw->wiphy->max_remain_on_channel_duration = 5000; ++ ++ atomic_set(&epub->wl.off, 1); ++ ++ epub->wl.sbands[NL80211_BAND_2GHZ].band = NL80211_BAND_2GHZ; ++ epub->wl.sbands[NL80211_BAND_2GHZ].channels = esp_channels_2ghz; ++ epub->wl.sbands[NL80211_BAND_2GHZ].bitrates = esp_rates_2ghz; ++ epub->wl.sbands[NL80211_BAND_2GHZ].n_channels = ++ ARRAY_SIZE(esp_channels_2ghz); ++ epub->wl.sbands[NL80211_BAND_2GHZ].n_bitrates = ++ ARRAY_SIZE(esp_rates_2ghz); ++ /*add to support 11n */ ++ epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.ht_supported = true; ++ epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.cap = 0x116C; //IEEE80211_HT_CAP_RX_STBC; //IEEE80211_HT_CAP_SGI_20; ++ epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.ampdu_factor = ++ IEEE80211_HT_MAX_AMPDU_16K; ++ epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.ampdu_density = ++ IEEE80211_HT_MPDU_DENSITY_NONE; ++ memset(&epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.mcs, 0, ++ sizeof(epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.mcs)); ++ epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.mcs.rx_mask[0] = 0xff; ++ //epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.mcs.rx_highest = 7; ++ //epub->wl.sbands[NL80211_BAND_2GHZ].ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; ++ ++ /* BAND_5GHZ TBD */ ++ ++ hw->wiphy->bands[NL80211_BAND_2GHZ] = ++ &epub->wl.sbands[NL80211_BAND_2GHZ]; ++ /* BAND_5GHZ TBD */ ++ ++ /*no fragment */ ++ hw->wiphy->frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD; ++ ++ /* handle AC queue in f/w */ ++ hw->queues = 4; ++ hw->max_rates = 4; ++ //hw->wiphy->reg_notifier = esp_reg_notify; ++ ++ hw->vif_data_size = sizeof(struct esp_vif); ++ hw->sta_data_size = sizeof(struct esp_node); ++ ++ //hw->max_rx_aggregation_subframes = 8; ++} ++ ++int esp_register_mac80211(struct esp_pub *epub) ++{ ++ int ret = 0; ++ u8 *wlan_addr; ++ u8 *p2p_addr; ++ int idx; ++ ++ esp_pub_init_mac80211(epub); ++ ++ epub->hw->wiphy->addresses = (struct mac_address *) esp_mac_addr; ++ memcpy(&epub->hw->wiphy->addresses[0], epub->mac_addr, ETH_ALEN); ++ memcpy(&epub->hw->wiphy->addresses[1], epub->mac_addr, ETH_ALEN); ++ wlan_addr = (u8 *) & epub->hw->wiphy->addresses[0]; ++ p2p_addr = (u8 *) & epub->hw->wiphy->addresses[1]; ++ ++ for (idx = 0; idx < 64; idx++) { ++ p2p_addr[0] = wlan_addr[0] | 0x02; ++ p2p_addr[0] ^= idx << 2; ++ if (strncmp(p2p_addr, wlan_addr, 6) != 0) ++ break; ++ } ++ ++ epub->hw->wiphy->n_addresses = 2; ++ ++ ret = ieee80211_register_hw(epub->hw); ++ ++ if (ret < 0) { ++ ESP_IEEE80211_DBG(ESP_DBG_ERROR, ++ "unable to register mac80211 hw: %d\n", ++ ret); ++ return ret; ++ } else { ++#ifdef MAC80211_NO_CHANGE ++ rtnl_lock(); ++ if (epub->hw->wiphy->interface_modes & ++ (BIT(NL80211_IFTYPE_P2P_GO) | ++ BIT(NL80211_IFTYPE_P2P_CLIENT))) { ++ ret = ++ ieee80211_if_add(hw_to_local(epub->hw), ++ "p2p%d", NULL, ++ NL80211_IFTYPE_STATION, NULL); ++ if (ret) ++ wiphy_warn(epub->hw->wiphy, ++ "Failed to add default virtual iface\n"); ++ } ++ ++ rtnl_unlock(); ++#endif ++ } ++ ++ set_bit(ESP_WL_FLAG_HW_REGISTERED, &epub->wl.flags); ++ ++ return ret; ++} ++ ++static u8 getaddr_index(u8 * addr, struct esp_pub *epub) ++{ ++ int i; ++ for (i = 0; i < ESP_PUB_MAX_VIF; i++) ++ if (memcmp ++ (addr, (u8 *) & epub->hw->wiphy->addresses[i], ++ ETH_ALEN) == 0) ++ return i; ++ return ESP_PUB_MAX_VIF; ++} +diff --git a/drivers/net/wireless/esp8089/esp_mac80211.h b/drivers/net/wireless/esp8089/esp_mac80211.h +new file mode 100644 +index 000000000000..699b27dcadd1 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_mac80211.h +@@ -0,0 +1,38 @@ ++/* ++ * Copyright (c) 2011-2014 Espressif System. ++ * ++ * MAC80211 support module ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_MAC80211_H_ ++#define _ESP_MAC80211_H_ ++ ++struct esp_80211_wmm_ac_param { ++ u8 aci_aifsn; /* AIFSN, ACM, ACI */ ++ u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */ ++ u16 txop_limit; ++}; ++ ++struct esp_80211_wmm_param_element { ++ /* Element ID: 221 (0xdd); length: 24 */ ++ /* required fields for WMM version 1 */ ++ u8 oui[3]; /* 00:50:f2 */ ++ u8 oui_type; /* 2 */ ++ u8 oui_subtype; /* 1 */ ++ u8 version; /* 1 for WMM version 1.0 */ ++ u8 qos_info; /* AP/STA specif QoS info */ ++ u8 reserved; /* 0 */ ++ struct esp_80211_wmm_ac_param ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */ ++}; ++ ++ ++#endif /* _ESP_MAC80211_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_main.c b/drivers/net/wireless/esp8089/esp_main.c +new file mode 100644 +index 000000000000..404e0d7a6f54 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_main.c +@@ -0,0 +1,263 @@ ++/* ++ * Copyright (c) 2010 - 2014 Espressif System. ++ * ++ * main routine ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "esp_pub.h" ++#include "esp_sip.h" ++#include "esp_sif.h" ++#include "esp_debug.h" ++#include "esp_file.h" ++#include "esp_wl.h" ++ ++struct completion *gl_bootup_cplx = NULL; ++ ++#ifndef FPGA_DEBUG ++static int esp_download_fw(struct esp_pub *epub); ++#endif /* !FGPA_DEBUG */ ++ ++static int modparam_no_txampdu = 0; ++static int modparam_no_rxampdu = 0; ++module_param_named(no_txampdu, modparam_no_txampdu, int, 0444); ++MODULE_PARM_DESC(no_txampdu, "Disable tx ampdu."); ++module_param_named(no_rxampdu, modparam_no_rxampdu, int, 0444); ++MODULE_PARM_DESC(no_rxampdu, "Disable rx ampdu."); ++ ++static char *modparam_eagle_path = "/lib/firmware"; ++module_param_named(eagle_path, modparam_eagle_path, charp, 0444); ++MODULE_PARM_DESC(eagle_path, "eagle path"); ++ ++bool mod_support_no_txampdu() ++{ ++ return modparam_no_txampdu; ++} ++ ++bool mod_support_no_rxampdu() ++{ ++ return modparam_no_rxampdu; ++} ++ ++void mod_support_no_txampdu_set(bool value) ++{ ++ modparam_no_txampdu = value; ++} ++ ++char *mod_eagle_path_get(void) ++{ ++ if (modparam_eagle_path[0] == '\0') ++ return NULL; ++ ++ return modparam_eagle_path; ++} ++ ++int esp_pub_init_all(struct esp_pub *epub) ++{ ++ int ret = 0; ++ ++ /* completion for bootup event poll */ ++ DECLARE_COMPLETION_ONSTACK(complete); ++ atomic_set(&epub->ps.state, ESP_PM_OFF); ++ if (epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT) { ++ epub->sip = sip_attach(epub); ++ if (epub->sip == NULL) { ++ printk(KERN_ERR "%s sip alloc failed\n", __func__); ++ return -ENOMEM; ++ } ++ ++ esp_dump_var("esp_msg_level", NULL, &esp_msg_level, ++ ESP_U32); ++ ++#ifdef ESP_ANDROID_LOGGER ++ esp_dump_var("log_off", NULL, &log_off, ESP_U32); ++#endif /* ESP_ANDROID_LOGGER */ ++ } else { ++ atomic_set(&epub->sip->state, SIP_PREPARE_BOOT); ++ atomic_set(&epub->sip->tx_credits, 0); ++ } ++ ++ epub->sip->to_host_seq = 0; ++ ++#ifdef TEST_MODE ++ if (sif_get_ate_config() != 0 && sif_get_ate_config() != 1 ++ && sif_get_ate_config() != 6) { ++ esp_test_init(epub); ++ return -1; ++ } ++#endif ++ ++#ifndef FPGA_DEBUG ++ ret = esp_download_fw(epub); ++#ifdef TEST_MODE ++ if (sif_get_ate_config() == 6) { ++ sif_enable_irq(epub); ++ mdelay(500); ++ sif_disable_irq(epub); ++ mdelay(1000); ++ esp_test_init(epub); ++ return -1; ++ } ++#endif ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, "download firmware failed\n"); ++ return ret; ++ } ++ ++ esp_dbg(ESP_DBG_TRACE, "download firmware OK \n"); ++#else ++ sip_send_bootup(epub->sip); ++#endif /* FPGA_DEBUG */ ++ ++ gl_bootup_cplx = &complete; ++ epub->wait_reset = 0; ++ sif_enable_irq(epub); ++ ++ if (epub->sdio_state == ESP_SDIO_STATE_SECOND_INIT ++ || sif_get_ate_config() == 1) { ++ ret = sip_poll_bootup_event(epub->sip); ++ } else { ++ ret = sip_poll_resetting_event(epub->sip); ++ if (ret == 0) { ++ sif_lock_bus(epub); ++ sif_interrupt_target(epub, 7); ++ sif_unlock_bus(epub); ++ } ++ ++ } ++ ++ gl_bootup_cplx = NULL; ++ ++ if (sif_get_ate_config() == 1) ++ ret = -EOPNOTSUPP; ++ ++ return ret; ++} ++ ++void esp_dsr(struct esp_pub *epub) ++{ ++ sip_rx(epub); ++} ++ ++ ++struct esp_fw_hdr { ++ u8 magic; ++ u8 blocks; ++ u8 pad[2]; ++ u32 entry_addr; ++} __packed; ++ ++struct esp_fw_blk_hdr { ++ u32 load_addr; ++ u32 data_len; ++} __packed; ++ ++#define ESP_FW_NAME1 "eagle_fw_ate_config_v19.bin" ++#define ESP_FW_NAME2 "eagle_fw_first_init_v19.bin" ++#define ESP_FW_NAME3 "eagle_fw_second_init_v19.bin" ++ ++#ifndef FPGA_DEBUG ++static int esp_download_fw(struct esp_pub *epub) ++{ ++ const struct firmware *fw_entry; ++ u8 *fw_buf = NULL; ++ u32 offset = 0; ++ int ret = 0; ++ u8 blocks; ++ struct esp_fw_hdr *fhdr; ++ struct esp_fw_blk_hdr *bhdr = NULL; ++ struct sip_cmd_bootup bootcmd; ++ char *esp_fw_name; ++ ++ if (sif_get_ate_config() == 1) { ++ esp_fw_name = ESP_FW_NAME3; ++ } else { ++ esp_fw_name = ++ epub->sdio_state == ++ ESP_SDIO_STATE_FIRST_INIT ? ESP_FW_NAME1 : ++ ESP_FW_NAME2; ++ } ++ ret = request_firmware(&fw_entry, esp_fw_name, epub->dev); ++ ++ if (ret) ++ return ret; ++ ++ fw_buf = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); ++ ++ release_firmware(fw_entry); ++ ++ if (fw_buf == NULL) { ++ return -ENOMEM; ++ } ++ ++ fhdr = (struct esp_fw_hdr *) fw_buf; ++ ++ if (fhdr->magic != 0xE9) { ++ esp_dbg(ESP_DBG_ERROR, "%s wrong magic! \n", __func__); ++ goto _err; ++ } ++ ++ blocks = fhdr->blocks; ++ offset += sizeof(struct esp_fw_hdr); ++ ++ while (blocks) { ++ ++ bhdr = (struct esp_fw_blk_hdr *) (&fw_buf[offset]); ++ offset += sizeof(struct esp_fw_blk_hdr); ++ ++ ret = ++ sip_write_memory(epub->sip, bhdr->load_addr, ++ &fw_buf[offset], bhdr->data_len); ++ ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, ++ "%s Failed to write fw, err: %d\n", ++ __func__, ret); ++ goto _err; ++ } ++ ++ blocks--; ++ offset += bhdr->data_len; ++ } ++ ++ /* TODO: last byte should be the checksum and skip checksum for now */ ++ ++ bootcmd.boot_addr = fhdr->entry_addr; ++ ret = ++ sip_send_cmd(epub->sip, SIP_CMD_BOOTUP, ++ sizeof(struct sip_cmd_bootup), &bootcmd); ++ ++ if (ret) ++ goto _err; ++ ++ _err: ++ kfree(fw_buf); ++ ++ return ret; ++ ++} ++ ++MODULE_FIRMWARE(ESP_FW_NAME1); ++MODULE_FIRMWARE(ESP_FW_NAME2); ++MODULE_FIRMWARE(ESP_FW_NAME3); ++#endif /* !FPGA_DEBUG */ +diff --git a/drivers/net/wireless/esp8089/esp_path.h b/drivers/net/wireless/esp8089/esp_path.h +new file mode 100644 +index 000000000000..1ceb14bc3b15 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_path.h +@@ -0,0 +1,6 @@ ++#ifndef _ESP_PATH_H_ ++#define _ESP_PATH_H_ ++#define FWPATH "/lib/firmware" ++//module_param_string(fwpath, fwpath, sizeof(fwpath), 0644); ++ ++#endif /* _ESP_PATH_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_pub.h b/drivers/net/wireless/esp8089/esp_pub.h +new file mode 100644 +index 000000000000..0d3ad3655cf4 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_pub.h +@@ -0,0 +1,222 @@ ++/* ++ * Copyright (c) 2011-2014 Espressif System. ++ * ++ * wlan device header file ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_PUB_H_ ++#define _ESP_PUB_H_ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "sip2_common.h" ++ ++enum esp_sdio_state { ++ ESP_SDIO_STATE_FIRST_INIT, ++ ESP_SDIO_STATE_FIRST_NORMAL_EXIT, ++ ESP_SDIO_STATE_FIRST_ERROR_EXIT, ++ ESP_SDIO_STATE_SECOND_INIT, ++ ESP_SDIO_STATE_SECOND_ERROR_EXIT, ++}; ++ ++enum esp_tid_state { ++ ESP_TID_STATE_INIT, ++ ESP_TID_STATE_TRIGGER, ++ ESP_TID_STATE_PROGRESS, ++ ESP_TID_STATE_OPERATIONAL, ++ ESP_TID_STATE_WAIT_STOP, ++ ESP_TID_STATE_STOP, ++}; ++ ++struct esp_tx_tid { ++ u8 state; ++ u8 cnt; ++ u16 ssn; ++}; ++ ++#define WME_NUM_TID 16 ++struct esp_node { ++ struct esp_tx_tid tid[WME_NUM_TID]; ++ struct ieee80211_sta *sta; ++ u8 ifidx; ++ u8 index; ++}; ++ ++#define WME_AC_BE 2 ++#define WME_AC_BK 3 ++#define WME_AC_VI 1 ++#define WME_AC_VO 0 ++ ++struct llc_snap_hdr { ++ u8 dsap; ++ u8 ssap; ++ u8 cntl; ++ u8 org_code[3]; ++ __be16 eth_type; ++} __packed; ++ ++struct esp_vif { ++ struct esp_pub *epub; ++ u8 index; ++ u32 beacon_interval; ++ bool ap_up; ++ struct timer_list beacon_timer; ++}; ++ ++/* WLAN related, mostly... */ ++/*struct hw_scan_timeout { ++ struct delayed_work w; ++ struct ieee80211_hw *hw; ++};*/ ++ ++typedef struct esp_wl { ++ u8 bssid[ETH_ALEN]; ++ u8 req_bssid[ETH_ALEN]; ++ ++ //struct hw_scan_timeout *hsd; ++ struct cfg80211_scan_request *scan_req; ++ atomic_t ptk_cnt; ++ atomic_t gtk_cnt; ++ atomic_t tkip_key_set; ++ ++ /* so far only 2G band */ ++ struct ieee80211_supported_band sbands[NUM_NL80211_BANDS]; ++ ++ unsigned long flags; ++ atomic_t off; ++} esp_wl_t; ++ ++typedef struct esp_hw_idx_map { ++ u8 mac[ETH_ALEN]; ++ u8 flag; ++} esp_hw_idx_map_t; ++ ++#define ESP_WL_FLAG_RFKILL BIT(0) ++#define ESP_WL_FLAG_HW_REGISTERED BIT(1) ++#define ESP_WL_FLAG_CONNECT BIT(2) ++#define ESP_WL_FLAG_STOP_TXQ BIT(3) ++ ++#define ESP_PUB_MAX_VIF 2 ++#define ESP_PUB_MAX_STA 16 //for one interface ++#define ESP_PUB_MAX_RXAMPDU 8 //for all interfaces ++ ++enum { ++ ESP_PM_OFF = 0, ++ ESP_PM_TURNING_ON, ++ ESP_PM_ON, ++ ESP_PM_TURNING_OFF, /* Do NOT change the order */ ++}; ++ ++struct esp_ps { ++ u32 dtim_period; ++ u32 max_sleep_period; ++ unsigned long last_config_time; ++ atomic_t state; ++ bool nulldata_pm_on; ++}; ++ ++struct esp_mac_prefix { ++ u8 mac_index; ++ u8 mac_addr_prefix[3]; ++}; ++ ++struct esp_pub { ++ struct device *dev; ++#ifdef ESP_NO_MAC80211 ++ struct net_device *net_dev; ++ struct wireless_dev *wdev; ++ struct net_device_stats *net_stats; ++#else ++ struct ieee80211_hw *hw; ++ struct ieee80211_vif *vif; ++ u8 vif_slot; ++#endif /* ESP_MAC80211 */ ++ ++ void *sif; /* serial interface control block, e.g. sdio */ ++ enum esp_sdio_state sdio_state; ++ struct esp_sip *sip; ++ struct esp_wl wl; ++ struct esp_hw_idx_map hi_map[19]; ++ struct esp_hw_idx_map low_map[ESP_PUB_MAX_VIF][2]; ++ //u32 flags; //flags to represent rfkill switch,start ++ u8 roc_flags; //0: not in remain on channel state, 1: in roc state ++ ++ struct work_struct tx_work; /* attach to ieee80211 workqueue */ ++ /* latest mac80211 has multiple tx queue, but we stick with single queue now */ ++ spinlock_t rx_lock; ++ spinlock_t tx_ampdu_lock; ++ spinlock_t rx_ampdu_lock; ++ spinlock_t tx_lock; ++ struct mutex tx_mtx; ++ struct sk_buff_head txq; ++ atomic_t txq_stopped; ++ ++ struct work_struct sendup_work; /* attach to ieee80211 workqueue */ ++ struct sk_buff_head txdoneq; ++ struct sk_buff_head rxq; ++ ++ struct workqueue_struct *esp_wkq; ++ ++ //u8 bssid[ETH_ALEN]; ++ u8 mac_addr[ETH_ALEN]; ++ ++ u32 rx_filter; ++ unsigned long scan_permit; ++ bool scan_permit_valid; ++ struct delayed_work scan_timeout_work; ++ u32 enodes_map; ++ u8 rxampdu_map; ++ u32 enodes_maps[ESP_PUB_MAX_VIF]; ++ struct esp_node *enodes[ESP_PUB_MAX_STA + 1]; ++ struct esp_node *rxampdu_node[ESP_PUB_MAX_RXAMPDU]; ++ u8 rxampdu_tid[ESP_PUB_MAX_RXAMPDU]; ++ struct esp_ps ps; ++ int enable_int; ++ int wait_reset; ++}; ++ ++typedef struct esp_pub esp_pub_t; ++ ++struct esp_pub *esp_pub_alloc_mac80211(struct device *dev); ++int esp_pub_dealloc_mac80211(struct esp_pub *epub); ++int esp_register_mac80211(struct esp_pub *epub); ++ ++int esp_pub_init_all(struct esp_pub *epub); ++ ++char *mod_eagle_path_get(void); ++ ++void esp_dsr(struct esp_pub *epub); ++void hw_scan_done(struct esp_pub *epub, bool aborted); ++void esp_rocdone_process(struct ieee80211_hw *hw, ++ struct sip_evt_roc *report); ++ ++void esp_ps_config(struct esp_pub *epub, struct esp_ps *ps, bool on); ++ ++struct esp_node *esp_get_node_by_addr(struct esp_pub *epub, ++ const u8 * addr); ++struct esp_node *esp_get_node_by_index(struct esp_pub *epub, u8 index); ++int esp_get_empty_rxampdu(struct esp_pub *epub, const u8 * addr, u8 tid); ++int esp_get_exist_rxampdu(struct esp_pub *epub, const u8 * addr, u8 tid); ++ ++#ifdef TEST_MODE ++int test_init_netlink(struct esp_sip *sip); ++void test_exit_netlink(void); ++void esp_test_cmd_event(u32 cmd_type, char *reply_info); ++void esp_test_init(struct esp_pub *epub); ++#endif ++#endif /* _ESP_PUB_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_sif.h b/drivers/net/wireless/esp8089/esp_sif.h +new file mode 100644 +index 000000000000..2d49f2bc8035 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_sif.h +@@ -0,0 +1,207 @@ ++/* ++ * Copyright (c) 2011 - 2014 Espressif System. ++ * ++ * Serial I/F wrapper layer for eagle WLAN device, ++ * abstraction of buses like SDIO/SIP, and provides ++ * flow control for tx/rx layer ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_SIF_H_ ++#define _ESP_SIF_H_ ++ ++#include "esp_pub.h" ++#include ++#include ++ ++/* ++ * H/W SLC module definitions ++ */ ++ ++#define SIF_SLC_BLOCK_SIZE 512 ++ ++ ++/* S/W struct mapping to slc registers */ ++typedef struct slc_host_regs { ++ /* do NOT read token_rdata ++ * ++ u32 pf_data; ++ u32 token_rdata; ++ */ ++ u32 intr_raw; ++ u32 state_w0; ++ u32 state_w1; ++ u32 config_w0; ++ u32 config_w1; ++ u32 intr_status; ++ u32 config_w2; ++ u32 config_w3; ++ u32 config_w4; ++ u32 token_wdata; ++ u32 intr_clear; ++ u32 intr_enable; ++} sif_slc_reg_t; ++ ++ ++enum io_sync_type { ++ ESP_SIF_NOSYNC = 0, ++ ESP_SIF_SYNC, ++}; ++ ++typedef struct esp_sdio_ctrl { ++ struct sdio_func *func; ++ struct esp_pub *epub; ++ ++ ++ struct list_head free_req; ++ ++ u8 *dma_buffer; ++ ++ spinlock_t scat_lock; ++ struct list_head scat_req; ++ ++ bool off; ++ atomic_t irq_handling; ++ const struct sdio_device_id *id; ++ u32 slc_blk_sz; ++ u32 target_id; ++ u32 slc_window_end_addr; ++ ++ struct slc_host_regs slc_regs; ++ atomic_t irq_installed; ++ ++} esp_sdio_ctrl_t; ++ ++#define SIF_TO_DEVICE 0x1 ++#define SIF_FROM_DEVICE 0x2 ++ ++#define SIF_SYNC 0x00000010 ++#define SIF_ASYNC 0x00000020 ++ ++#define SIF_BYTE_BASIS 0x00000040 ++#define SIF_BLOCK_BASIS 0x00000080 ++ ++#define SIF_FIXED_ADDR 0x00000100 ++#define SIF_INC_ADDR 0x00000200 ++ ++#define EPUB_CTRL_CHECK(_epub, _go_err) do{\ ++ if (_epub == NULL) {\ ++ ESSERT(0);\ ++ goto _go_err;\ ++ }\ ++ if ((_epub)->sif == NULL) {\ ++ ESSERT(0);\ ++ goto _go_err;\ ++ }\ ++}while(0) ++ ++#define EPUB_FUNC_CHECK(_epub, _go_err) do{\ ++ if (_epub == NULL) {\ ++ ESSERT(0);\ ++ goto _go_err;\ ++ }\ ++ if ((_epub)->sif == NULL) {\ ++ ESSERT(0);\ ++ goto _go_err;\ ++ }\ ++ if (((struct esp_sdio_ctrl *)(_epub)->sif)->func == NULL) {\ ++ ESSERT(0);\ ++ goto _go_err;\ ++ }\ ++}while(0) ++ ++#define EPUB_TO_CTRL(_epub) (((struct esp_sdio_ctrl *)(_epub)->sif)) ++ ++#define EPUB_TO_FUNC(_epub) (((struct esp_sdio_ctrl *)(_epub)->sif)->func) ++ ++void sdio_io_writeb(struct esp_pub *epub, u8 value, int addr, int *res); ++u8 sdio_io_readb(struct esp_pub *epub, int addr, int *res); ++ ++ ++void sif_enable_irq(struct esp_pub *epub); ++void sif_disable_irq(struct esp_pub *epub); ++void sif_disable_target_interrupt(struct esp_pub *epub); ++ ++u32 sif_get_blksz(struct esp_pub *epub); ++u32 sif_get_target_id(struct esp_pub *epub); ++ ++void sif_dsr(struct sdio_func *func); ++int sif_io_raw(struct esp_pub *epub, u32 addr, u8 * buf, u32 len, ++ u32 flag); ++int sif_io_sync(struct esp_pub *epub, u32 addr, u8 * buf, u32 len, ++ u32 flag); ++int sif_io_async(struct esp_pub *epub, u32 addr, u8 * buf, u32 len, ++ u32 flag, void *context); ++int sif_lldesc_read_sync(struct esp_pub *epub, u8 * buf, u32 len); ++int sif_lldesc_write_sync(struct esp_pub *epub, u8 * buf, u32 len); ++int sif_lldesc_read_raw(struct esp_pub *epub, u8 * buf, u32 len, ++ bool noround); ++int sif_lldesc_write_raw(struct esp_pub *epub, u8 * buf, u32 len); ++ ++int sif_platform_get_irq_no(void); ++int sif_platform_is_irq_occur(void); ++void sif_platform_irq_clear(void); ++void sif_platform_irq_mask(int enable_mask); ++int sif_platform_irq_init(void); ++void sif_platform_irq_deinit(void); ++ ++int esp_common_read(struct esp_pub *epub, u8 * buf, u32 len, int sync, ++ bool noround); ++int esp_common_write(struct esp_pub *epub, u8 * buf, u32 len, int sync); ++int esp_common_read_with_addr(struct esp_pub *epub, u32 addr, u8 * buf, ++ u32 len, int sync); ++int esp_common_write_with_addr(struct esp_pub *epub, u32 addr, u8 * buf, ++ u32 len, int sync); ++ ++int esp_common_readbyte_with_addr(struct esp_pub *epub, u32 addr, u8 * buf, ++ int sync); ++int esp_common_writebyte_with_addr(struct esp_pub *epub, u32 addr, u8 buf, ++ int sync); ++ ++int sif_read_reg_window(struct esp_pub *epub, unsigned int reg_addr, ++ unsigned char *value); ++int sif_write_reg_window(struct esp_pub *epub, unsigned int reg_addr, ++ unsigned char *value); ++int sif_ack_target_read_err(struct esp_pub *epub); ++int sif_had_io_enable(struct esp_pub *epub); ++ ++struct slc_host_regs *sif_get_regs(struct esp_pub *epub); ++ ++void sif_lock_bus(struct esp_pub *epub); ++void sif_unlock_bus(struct esp_pub *epub); ++ ++int sif_interrupt_target(struct esp_pub *epub, u8 index); ++#ifdef USE_EXT_GPIO ++int sif_config_gpio_mode(struct esp_pub *epub, u8 gpio_num, u8 gpio_mode); ++int sif_set_gpio_output(struct esp_pub *epub, u16 mask, u16 value); ++int sif_get_gpio_intr(struct esp_pub *epub, u16 intr_mask, u16 * value); ++int sif_get_gpio_input(struct esp_pub *epub, u16 * mask, u16 * value); ++#endif ++ ++void check_target_id(struct esp_pub *epub); ++ ++void sif_record_bt_config(int value); ++int sif_get_bt_config(void); ++void sif_record_rst_config(int value); ++int sif_get_rst_config(void); ++void sif_record_ate_config(int value); ++int sif_get_ate_config(void); ++void sif_record_retry_config(void); ++int sif_get_retry_config(void); ++void sif_record_wakeup_gpio_config(int value); ++int sif_get_wakeup_gpio_config(void); ++ ++#define sif_reg_read_sync(epub, addr, buf, len) sif_io_sync((epub), (addr), (buf), (len), SIF_FROM_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR) ++ ++#define sif_reg_write_sync(epub, addr, buf, len) sif_io_sync((epub), (addr), (buf), (len), SIF_TO_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR) ++ ++#endif /* _ESP_SIF_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_sip.c b/drivers/net/wireless/esp8089/esp_sip.c +new file mode 100644 +index 000000000000..6602a1e22ab1 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_sip.c +@@ -0,0 +1,2420 @@ ++/* ++ * Copyright (c) 2009 - 2014 Espressif System. ++ * ++ * Serial Interconnctor Protocol ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "esp_mac80211.h" ++#include "esp_pub.h" ++#include "esp_sip.h" ++#include "esp_ctrl.h" ++#include "esp_sif.h" ++#include "esp_debug.h" ++#include "slc_host_register.h" ++#include "esp_wmac.h" ++#include "esp_utils.h" ++ ++#ifdef USE_EXT_GPIO ++#include "esp_ext.h" ++#endif /* USE_EXT_GPIO */ ++ ++extern struct completion *gl_bootup_cplx; ++ ++static int old_signal = -35; ++static int avg_signal = 0; ++static int signal_loop = 0; ++ ++struct esp_mac_prefix esp_mac_prefix_table[] = { ++ {0, {0x18, 0xfe, 0x34}}, ++ {1, {0xac, 0xd0, 0x74}}, ++ {255, {0x18, 0xfe, 0x34}}, ++}; ++ ++#define SIGNAL_COUNT 300 ++ ++#define TID_TO_AC(_tid) ((_tid)== 0||((_tid)==3)?WME_AC_BE:((_tid)<3)?WME_AC_BK:((_tid)<6)?WME_AC_VI:WME_AC_VO) ++ ++#ifdef SIP_DEBUG ++#define esp_sip_dbg esp_dbg ++struct sip_trace { ++ u32 tx_data; ++ u32 tx_cmd; ++ u32 rx_data; ++ u32 rx_evt; ++ u32 rx_tx_status; ++ u32 tx_out_of_credit; ++ u32 tx_one_shot_overflow; ++}; ++static struct sip_trace str; ++#define STRACE_TX_DATA_INC() (str.tx_data++) ++#define STRACE_TX_CMD_INC() (str.tx_cmd++) ++#define STRACE_RX_DATA_INC() (str.rx_data++) ++#define STRACE_RX_EVENT_INC() (str.rx_evt++) ++#define STRACE_RX_TXSTATUS_INC() (str.rx_tx_status++) ++#define STRACE_TX_OUT_OF_CREDIT_INC() (str.tx_out_of_credit++) ++#define STRACE_TX_ONE_SHOT_INC() (str.tx_one_shot_overflow++) ++#define STRACE_SHOW(sip) ++#else ++#define esp_sip_dbg(...) ++#define STRACE_TX_DATA_INC() ++#define STRACE_TX_CMD_INC() ++#define STRACE_RX_DATA_INC() ++#define STRACE_RX_EVENT_INC() ++#define STRACE_RX_TXSTATUS_INC() ++#define STRACE_TX_OUT_OF_CREDIT_INC() ++#define STRACE_TX_ONE_SHOT_INC() ++#define STRACE_SHOW(sip) ++#endif /* SIP_DEBUG */ ++ ++#define SIP_STOP_QUEUE_THRESHOLD 48 ++#define SIP_RESUME_QUEUE_THRESHOLD 12 ++ ++#define SIP_MIN_DATA_PKT_LEN (sizeof(struct esp_mac_rx_ctrl) + 24) //24 is min 80211hdr ++ ++#ifdef ESP_PREALLOC ++extern struct sk_buff *esp_get_sip_skb(int size); ++extern void esp_put_sip_skb(struct sk_buff **skb); ++ ++extern u8 *esp_get_tx_aggr_buf(void); ++extern void esp_put_tx_aggr_buf(u8 ** p); ++ ++#endif ++ ++static void sip_recalc_credit_init(struct esp_sip *sip); ++ ++static int sip_recalc_credit_claim(struct esp_sip *sip, int force); ++ ++static void sip_recalc_credit_release(struct esp_sip *sip); ++ ++static struct sip_pkt *sip_get_ctrl_buf(struct esp_sip *sip, ++ SIP_BUF_TYPE bftype); ++ ++static void sip_reclaim_ctrl_buf(struct esp_sip *sip, struct sip_pkt *pkt, ++ SIP_BUF_TYPE bftype); ++ ++static void sip_free_init_ctrl_buf(struct esp_sip *sip); ++ ++static int sip_pack_pkt(struct esp_sip *sip, struct sk_buff *skb, ++ int *pm_state); ++ ++static struct esp_mac_rx_ctrl *sip_parse_normal_mac_ctrl(struct sk_buff ++ *skb, ++ int *pkt_len_enc, ++ int *buf_len, ++ int *pulled_len); ++ ++static struct sk_buff *sip_parse_data_rx_info(struct esp_sip *sip, ++ struct sk_buff *skb, ++ int pkt_len_enc, int buf_len, ++ struct esp_mac_rx_ctrl ++ *mac_ctrl, int *pulled_len); ++ ++static inline void sip_rx_pkt_enqueue(struct esp_sip *sip, ++ struct sk_buff *skb); ++ ++static void sip_after_write_pkts(struct esp_sip *sip); ++ ++static void sip_update_tx_credits(struct esp_sip *sip, ++ u16 recycled_credits); ++ ++//static void sip_trigger_txq_process(struct esp_sip *sip); ++ ++static bool sip_rx_pkt_process(struct esp_sip *sip, struct sk_buff *skb); ++ ++static void sip_tx_status_report(struct esp_sip *sip, struct sk_buff *skb, ++ struct ieee80211_tx_info *tx_info, ++ bool success); ++ ++#ifdef FPGA_TXDATA ++int sip_send_tx_data(struct esp_sip *sip); ++#endif /* FPGA_TXDATA */ ++ ++#ifdef FPGA_LOOPBACK ++int sip_send_loopback_cmd_mblk(struct esp_sip *sip); ++#endif /* FPGA_LOOPBACK */ ++ ++static bool check_ac_tid(u8 * pkt, u8 ac, u8 tid) ++{ ++ struct ieee80211_hdr *wh = (struct ieee80211_hdr *) pkt; ++#ifdef TID_DEBUG ++ u16 real_tid = 0; ++#endif //TID_DEBUG ++ ++ if (ieee80211_is_data_qos(wh->frame_control)) { ++#ifdef TID_DEBUG ++ real_tid = ++ *ieee80211_get_qos_ctl(wh) & ++ IEEE80211_QOS_CTL_TID_MASK; ++ ++ esp_sip_dbg(ESP_SHOW, "ac:%u, tid:%u, tid in pkt:%u\n", ac, ++ tid, real_tid); ++ if (tid != real_tid) { ++ esp_sip_dbg(ESP_DBG_ERROR, ++ "111 ac:%u, tid:%u, tid in pkt:%u\n", ++ ac, tid, real_tid); ++ } ++ if (TID_TO_AC(tid) != ac) { ++ esp_sip_dbg(ESP_DBG_ERROR, ++ "222 ac:%u, tid:%u, tid in pkt:%u\n", ++ ac, tid, real_tid); ++ } ++#endif /* TID_DEBUG */ ++ } else if (ieee80211_is_mgmt(wh->frame_control)) { ++#ifdef TID_DEBUG ++ esp_sip_dbg(ESP_SHOW, "ac:%u, tid:%u\n", ac, tid); ++ if (tid != 7 || ac != WME_AC_VO) { ++ esp_sip_dbg(ESP_DBG_ERROR, "333 ac:%u, tid:%u\n", ++ ac, tid); ++ } ++#endif /* TID_DEBUG */ ++ } else { ++ if (ieee80211_is_ctl(wh->frame_control)) { ++#ifdef TID_DEBUG ++ esp_sip_dbg(ESP_SHOW, ++ "%s is ctrl pkt fc 0x%04x ac:%u, tid:%u, tid in pkt:%u\n", ++ __func__, wh->frame_control, ac, tid, ++ real_tid); ++#endif /* TID_DEBUG */ ++ } else { ++ if (tid != 0 || ac != WME_AC_BE) { ++ //show_buf(pkt, 24); ++ esp_sip_dbg(ESP_DBG_LOG, ++ "444 ac:%u, tid:%u \n", ac, ++ tid); ++ if (tid == 7 && ac == WME_AC_VO) ++ return false; ++ } ++ return true; //hack to modify non-qos null data. ++ ++ } ++ } ++ ++ return false; ++} ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) ++static void sip_recalc_credit_timeout(struct timer_list *t) ++#else ++static void sip_recalc_credit_timeout(unsigned long data) ++#endif ++{ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) ++ struct esp_sip *sip = from_timer(sip, t, credit_timer); ++#else ++ struct esp_sip *sip = (struct esp_sip *) data; ++#endif ++ ++ esp_dbg(ESP_DBG_ERROR, "rct"); ++ ++ sip_recalc_credit_claim(sip, 1); /* recalc again */ ++} ++ ++static void sip_recalc_credit_init(struct esp_sip *sip) ++{ ++ atomic_set(&sip->credit_status, RECALC_CREDIT_DISABLE); //set it disable ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) ++ timer_setup(&sip->credit_timer, sip_recalc_credit_timeout, 0); ++#else ++ init_timer(&sip->credit_timer); ++ sip->credit_timer.data = (unsigned long) sip; ++ sip->credit_timer.function = sip_recalc_credit_timeout; ++#endif ++} ++ ++static int sip_recalc_credit_claim(struct esp_sip *sip, int force) ++{ ++ int ret; ++ ++ if (atomic_read(&sip->credit_status) == RECALC_CREDIT_ENABLE ++ && force == 0) ++ return 1; ++ ++ atomic_set(&sip->credit_status, RECALC_CREDIT_ENABLE); ++ ret = sip_send_recalc_credit(sip->epub); ++ if (ret) { ++ esp_dbg(ESP_DBG_ERROR, "%s error %d", __func__, ret); ++ return ret; ++ } ++ /*setup a timer for handle the abs_credit not receive */ ++ mod_timer(&sip->credit_timer, jiffies + msecs_to_jiffies(2000)); ++ ++ esp_dbg(ESP_SHOW, "rcc"); ++ ++ return ret; ++} ++ ++static void sip_recalc_credit_release(struct esp_sip *sip) ++{ ++ esp_dbg(ESP_SHOW, "rcr"); ++ ++ if (atomic_read(&sip->credit_status) == RECALC_CREDIT_ENABLE) { ++ atomic_set(&sip->credit_status, RECALC_CREDIT_DISABLE); ++ del_timer_sync(&sip->credit_timer); ++ } else ++ esp_dbg(ESP_SHOW, "maybe bogus credit"); ++} ++ ++static void sip_update_tx_credits(struct esp_sip *sip, ++ u16 recycled_credits) ++{ ++ esp_sip_dbg(ESP_DBG_TRACE, "%s:before add, credits is %d\n", ++ __func__, atomic_read(&sip->tx_credits)); ++ ++ if (recycled_credits & 0x800) { ++ atomic_set(&sip->tx_credits, (recycled_credits & 0x7ff)); ++ sip_recalc_credit_release(sip); ++ } else ++ atomic_add(recycled_credits, &sip->tx_credits); ++ ++ esp_sip_dbg(ESP_DBG_TRACE, "%s:after add %d, credits is %d\n", ++ __func__, recycled_credits, ++ atomic_read(&sip->tx_credits)); ++} ++ ++void sip_trigger_txq_process(struct esp_sip *sip) ++{ ++ if (atomic_read(&sip->tx_credits) <= sip->credit_to_reserve + SIP_CTRL_CREDIT_RESERVE //no credits, do nothing ++ || atomic_read(&sip->credit_status) == RECALC_CREDIT_ENABLE) ++ return; ++ ++ if (sip_queue_may_resume(sip)) { ++ /* wakeup upper queue only if we have sufficient credits */ ++ esp_sip_dbg(ESP_DBG_TRACE, "%s wakeup ieee80211 txq \n", ++ __func__); ++ atomic_set(&sip->epub->txq_stopped, false); ++ ieee80211_wake_queues(sip->epub->hw); ++ } else if (atomic_read(&sip->epub->txq_stopped)) { ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s can't wake txq, credits: %d \n", __func__, ++ atomic_read(&sip->tx_credits)); ++ } ++ ++ if (!skb_queue_empty(&sip->epub->txq)) { ++ /* try to send out pkt already in sip queue once we have credits */ ++ esp_sip_dbg(ESP_DBG_TRACE, "%s resume sip txq \n", ++ __func__); ++ ++#if !defined(FPGA_TXDATA) ++ if (sif_get_ate_config() == 0) { ++ ieee80211_queue_work(sip->epub->hw, ++ &sip->epub->tx_work); ++ } else { ++ queue_work(sip->epub->esp_wkq, ++ &sip->epub->tx_work); ++ } ++#else ++ queue_work(sip->epub->esp_wkq, &sip->epub->tx_work); ++#endif ++ } ++} ++ ++static bool sip_ampdu_occupy_buf(struct esp_sip *sip, ++ struct esp_rx_ampdu_len *ampdu_len) ++{ ++ return (ampdu_len->substate == 0 ++ || esp_wmac_rxsec_error(ampdu_len->substate) ++ || (sip->dump_rpbm_err ++ && ampdu_len->substate == RX_RPBM_ERR)); ++} ++ ++static bool sip_rx_pkt_process(struct esp_sip *sip, struct sk_buff *skb) ++{ ++#define DO_NOT_COPY false ++#define DO_COPY true ++ ++ struct sip_hdr *hdr = NULL; ++ struct sk_buff *rskb = NULL; ++ int remains_len = 0; ++ int first_pkt_len = 0; ++ u8 *bufptr = NULL; ++ int ret = 0; ++ bool trigger_rxq = false; ++ ++ if (skb == NULL) { ++ esp_sip_dbg(ESP_DBG_ERROR, "%s NULL SKB!!!!!!!! \n", ++ __func__); ++ return trigger_rxq; ++ } ++ ++ hdr = (struct sip_hdr *) skb->data; ++ bufptr = skb->data; ++ ++ ++ esp_sip_dbg(ESP_DBG_TRACE, "%s Hcredits 0x%08x, realCredits %d\n", ++ __func__, hdr->h_credits, ++ hdr->h_credits & SIP_CREDITS_MASK); ++ if (hdr->h_credits & SIP_CREDITS_MASK) { ++ sip_update_tx_credits(sip, ++ hdr->h_credits & SIP_CREDITS_MASK); ++ } ++ ++ hdr->h_credits &= ~SIP_CREDITS_MASK; /* clean credits in sip_hdr, prevent over-add */ ++ ++ esp_sip_dbg(ESP_DBG_TRACE, "%s credits %d\n", __func__, ++ hdr->h_credits); ++ ++ /* ++ * first pkt's length is stored in recycled_credits first 20 bits ++ * config w3 [31:12] ++ * repair hdr->len of first pkt ++ */ ++ remains_len = hdr->len; ++ first_pkt_len = hdr->h_credits >> 12; ++ hdr->len = first_pkt_len; ++ ++ esp_dbg(ESP_DBG_TRACE, "%s first_pkt_len %d, whole pkt len %d \n", ++ __func__, first_pkt_len, remains_len); ++ if (first_pkt_len > remains_len) { ++ sip_recalc_credit_claim(sip, 0); ++ esp_dbg(ESP_DBG_ERROR, ++ "first_pkt_len %d, whole pkt len %d\n", ++ first_pkt_len, remains_len); ++ show_buf((u8 *) hdr, first_pkt_len); ++ ESSERT(0); ++ goto _exit; ++ } ++ ++ /* ++ * pkts handling, including the first pkt, should alloc new skb for each data pkt. ++ * free the original whole skb after parsing is done. ++ */ ++ while (remains_len) { ++ if (remains_len < sizeof(struct sip_hdr)) { ++ sip_recalc_credit_claim(sip, 0); ++ ESSERT(0); ++ show_buf((u8 *) hdr, 512); ++ goto _exit; ++ } ++ ++ hdr = (struct sip_hdr *) bufptr; ++ if (hdr->len <= 0) { ++ sip_recalc_credit_claim(sip, 0); ++ show_buf((u8 *) hdr, 512); ++ ESSERT(0); ++ goto _exit; ++ } ++ ++ if ((hdr->len & 3) != 0) { ++ sip_recalc_credit_claim(sip, 0); ++ show_buf((u8 *) hdr, 512); ++ ESSERT(0); ++ goto _exit; ++ } ++ if (unlikely(hdr->seq != sip->rxseq++)) { ++ sip_recalc_credit_claim(sip, 0); ++ esp_dbg(ESP_DBG_ERROR, ++ "%s seq mismatch! got %u, expect %u\n", ++ __func__, hdr->seq, sip->rxseq - 1); ++ sip->rxseq = hdr->seq + 1; ++ show_buf(bufptr, 32); ++ ESSERT(0); ++ } ++ ++ if (SIP_HDR_IS_CTRL(hdr)) { ++ STRACE_RX_EVENT_INC(); ++ esp_sip_dbg(ESP_DBG_TRACE, "seq %u \n", hdr->seq); ++ ++ ret = sip_parse_events(sip, bufptr); ++ ++ skb_pull(skb, hdr->len); ++ ++ } else if (SIP_HDR_IS_DATA(hdr)) { ++ struct esp_mac_rx_ctrl *mac_ctrl = NULL; ++ int pkt_len_enc = 0, buf_len = 0, pulled_len = 0; ++ ++ STRACE_RX_DATA_INC(); ++ esp_sip_dbg(ESP_DBG_TRACE, "seq %u \n", hdr->seq); ++ mac_ctrl = ++ sip_parse_normal_mac_ctrl(skb, &pkt_len_enc, ++ &buf_len, ++ &pulled_len); ++ rskb = ++ sip_parse_data_rx_info(sip, skb, pkt_len_enc, ++ buf_len, mac_ctrl, ++ &pulled_len); ++ ++ if (rskb == NULL) ++ goto _move_on; ++ ++ if (likely(atomic_read(&sip->epub->wl.off) == 0)) { ++#ifdef RX_CHECKSUM_TEST ++ esp_rx_checksum_test(rskb); ++#endif ++ local_bh_disable(); ++ ieee80211_rx(sip->epub->hw, rskb); ++ local_bh_enable(); ++ } else { ++ /* still need go thro parsing as skb_pull should invoke */ ++ kfree_skb(rskb); ++ } ++ } else if (SIP_HDR_IS_AMPDU(hdr)) { ++ struct esp_mac_rx_ctrl *mac_ctrl = NULL; ++ struct esp_mac_rx_ctrl new_mac_ctrl; ++ struct esp_rx_ampdu_len *ampdu_len; ++ int pkt_num; ++ int pulled_len = 0; ++ static int pkt_dropped = 0; ++ static int pkt_total = 0; ++ bool have_rxabort = false; ++ bool have_goodpkt = false; ++ static u8 frame_head[16]; ++ static u8 frame_buf_ttl = 0; ++ ++ ampdu_len = ++ (struct esp_rx_ampdu_len *) (skb->data + ++ hdr->len / ++ sip->rx_blksz * ++ sip->rx_blksz); ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s rx ampdu total len %u\n", __func__, ++ hdr->len); ++ if (skb->data != (u8 *) hdr) { ++ printk("%p %p\n", skb->data, hdr); ++ show_buf(skb->data, 512); ++ show_buf((u8 *) hdr, 512); ++ ESSERT(0); ++ goto _exit; ++ } ++ mac_ctrl = ++ sip_parse_normal_mac_ctrl(skb, NULL, NULL, ++ &pulled_len); ++ memcpy(&new_mac_ctrl, mac_ctrl, ++ sizeof(struct esp_mac_rx_ctrl)); ++ mac_ctrl = &new_mac_ctrl; ++ pkt_num = mac_ctrl->ampdu_cnt; ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s %d rx ampdu %u pkts, %d pkts dumped, first len %u\n", ++ __func__, __LINE__, ++ (unsigned ++ int) ((hdr->len % sip->rx_blksz) / ++ sizeof(struct ++ esp_rx_ampdu_len)), ++ pkt_num, ++ (unsigned int) ampdu_len->sublen); ++ ++ pkt_total += mac_ctrl->ampdu_cnt; ++ //esp_sip_dbg(ESP_DBG_ERROR, "%s ampdu dropped %d/%d\n", __func__, pkt_dropped, pkt_total); ++ while (pkt_num > 0) { ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s %d ampdu sub state %02x,\n", ++ __func__, __LINE__, ++ ampdu_len->substate); ++ ++ if (sip_ampdu_occupy_buf(sip, ampdu_len)) { //pkt is dumped ++ ++ rskb = ++ sip_parse_data_rx_info(sip, ++ skb, ++ ampdu_len-> ++ sublen - ++ FCS_LEN, ++ 0, ++ mac_ctrl, ++ &pulled_len); ++ if (!rskb) { ++ ESSERT(0); ++ goto _exit; ++ } ++ ++ if (likely ++ (atomic_read ++ (&sip->epub->wl.off) == 0) ++ && (ampdu_len->substate == 0 ++ || ampdu_len->substate == ++ RX_TKIPMIC_ERR ++ || (sip->sendup_rpbm_pkt ++ && ampdu_len-> ++ substate == ++ RX_RPBM_ERR)) ++ && (sip->rxabort_fixed ++ || !have_rxabort)) { ++ if (!have_goodpkt) { ++ have_goodpkt = ++ true; ++ memcpy(frame_head, ++ rskb->data, ++ 16); ++ frame_head[1] &= ++ ~0x80; ++ frame_buf_ttl = 3; ++ } ++#ifdef RX_CHECKSUM_TEST ++ esp_rx_checksum_test(rskb); ++#endif ++ local_bh_disable(); ++ ieee80211_rx(sip->epub->hw, ++ rskb); ++ local_bh_enable(); ++ ++ } else { ++ kfree_skb(rskb); ++ } ++ } else { ++ if (ampdu_len->substate == ++ RX_ABORT) { ++ u8 *a; ++ have_rxabort = true; ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "rx abort %d %d\n", ++ frame_buf_ttl, ++ pkt_num); ++ if (frame_buf_ttl ++ && !sip-> ++ rxabort_fixed) { ++ struct ++ esp_rx_ampdu_len ++ *next_good_ampdu_len ++ = ++ ampdu_len + 1; ++ a = frame_head; ++ esp_sip_dbg ++ (ESP_DBG_TRACE, ++ "frame:%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", ++ a[0], a[1], ++ a[2], a[3], ++ a[4], a[5], ++ a[6], a[7], ++ a[8], a[9], ++ a[10], a[11], ++ a[12], a[13], ++ a[14], a[15]); ++ while ++ (!sip_ampdu_occupy_buf ++ (sip, ++ next_good_ampdu_len)) ++ { ++ if (next_good_ampdu_len > ampdu_len + pkt_num - 1) ++ break; ++ next_good_ampdu_len++; ++ ++ } ++ if (next_good_ampdu_len <= ampdu_len + pkt_num - 1) { ++ bool b0, ++ b10, ++ b11; ++ a = skb-> ++ data; ++ esp_sip_dbg ++ (ESP_DBG_TRACE, ++ "buf:%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", ++ a[0], ++ a[1], ++ a[2], ++ a[3], ++ a[4], ++ a[5], ++ a[6], ++ a[7], ++ a[8], ++ a[9], ++ a[10], ++ a[11], ++ a[12], ++ a[13], ++ a[14], ++ a ++ [15]); ++ b0 = memcmp ++ (frame_head ++ + 4, ++ skb-> ++ data + ++ 4, ++ 12) == ++ 0; ++ b10 = ++ memcmp ++ (frame_head ++ + 10, ++ skb-> ++ data, ++ 6) == ++ 0; ++ b11 = ++ memcpy ++ (frame_head ++ + 11, ++ skb-> ++ data, ++ 5) == ++ 0; ++ esp_sip_dbg ++ (ESP_DBG_TRACE, ++ "com %d %d %d\n", ++ b0, ++ b10, ++ b11); ++ if (b0 ++ && !b10 ++ && ++ !b11) { ++ have_rxabort ++ = ++ false; ++ esp_sip_dbg ++ (ESP_DBG_TRACE, ++ "repair 0\n"); ++ } else ++ if (!b0 ++ && ++ b10 ++ && ++ !b11) ++ { ++ skb_push ++ (skb, ++ 10); ++ memcpy ++ (skb-> ++ data, ++ frame_head, ++ 10); ++ have_rxabort ++ = ++ false; ++ pulled_len ++ -= ++ 10; ++ esp_sip_dbg ++ (ESP_DBG_TRACE, ++ "repair 10\n"); ++ } else ++ if (!b0 ++ && ++ !b10 ++ && ++ b11) ++ { ++ skb_push ++ (skb, ++ 11); ++ memcpy ++ (skb-> ++ data, ++ frame_head, ++ 11); ++ have_rxabort ++ = ++ false; ++ pulled_len ++ -= ++ 11; ++ esp_sip_dbg ++ (ESP_DBG_TRACE, ++ "repair 11\n"); ++ } ++ } ++ } ++ } ++ pkt_dropped++; ++ esp_sip_dbg(ESP_DBG_LOG, ++ "%s ampdu dropped %d/%d\n", ++ __func__, pkt_dropped, ++ pkt_total); ++ } ++ pkt_num--; ++ ampdu_len++; ++ } ++ if (frame_buf_ttl) ++ frame_buf_ttl--; ++ skb_pull(skb, hdr->len - pulled_len); ++ } else { ++ esp_sip_dbg(ESP_DBG_ERROR, "%s %d unknown type\n", ++ __func__, __LINE__); ++ } ++ ++ _move_on: ++ if (hdr->len < remains_len) { ++ remains_len -= hdr->len; ++ } else { ++ break; ++ } ++ bufptr += hdr->len; ++ } ++ ++ _exit: ++#ifdef ESP_PREALLOC ++ esp_put_sip_skb(&skb); ++#else ++ kfree_skb(skb); ++#endif ++ ++ return trigger_rxq; ++ ++#undef DO_NOT_COPY ++#undef DO_COPY ++} ++ ++static void _sip_rxq_process(struct esp_sip *sip) ++{ ++ struct sk_buff *skb = NULL; ++ bool sendup = false; ++ ++ while ((skb = skb_dequeue(&sip->rxq))) { ++ if (sip_rx_pkt_process(sip, skb)) ++ sendup = true; ++ } ++ if (sendup) { ++ queue_work(sip->epub->esp_wkq, &sip->epub->sendup_work); ++ } ++ ++ /* probably tx_credit is updated, try txq */ ++ sip_trigger_txq_process(sip); ++} ++ ++static void sip_rxq_process(struct work_struct *work) ++{ ++ struct esp_sip *sip = ++ container_of(work, struct esp_sip, rx_process_work); ++ if (sip == NULL) { ++ ESSERT(0); ++ return; ++ } ++ ++ if (unlikely(atomic_read(&sip->state) == SIP_SEND_INIT)) { ++ sip_send_chip_init(sip); ++ atomic_set(&sip->state, SIP_WAIT_BOOTUP); ++ return; ++ } ++ ++ mutex_lock(&sip->rx_mtx); ++ _sip_rxq_process(sip); ++ mutex_unlock(&sip->rx_mtx); ++} ++ ++static inline void sip_rx_pkt_enqueue(struct esp_sip *sip, ++ struct sk_buff *skb) ++{ ++ skb_queue_tail(&sip->rxq, skb); ++} ++ ++static inline struct sk_buff *sip_rx_pkt_dequeue(struct esp_sip *sip) ++{ ++ return skb_dequeue(&sip->rxq); ++} ++ ++static u32 sip_rx_count = 0; ++void sip_debug_show(struct esp_sip *sip) ++{ ++ esp_sip_dbg(ESP_DBG_ERROR, "txq left %d %d\n", ++ skb_queue_len(&sip->epub->txq), ++ atomic_read(&sip->tx_data_pkt_queued)); ++ esp_sip_dbg(ESP_DBG_ERROR, "tx queues stop ? %d\n", ++ atomic_read(&sip->epub->txq_stopped)); ++ esp_sip_dbg(ESP_DBG_ERROR, "txq stop? %d\n", ++ test_bit(ESP_WL_FLAG_STOP_TXQ, &sip->epub->wl.flags)); ++ esp_sip_dbg(ESP_DBG_ERROR, "tx credit %d\n", ++ atomic_read(&sip->tx_credits)); ++ esp_sip_dbg(ESP_DBG_ERROR, "rx collect %d\n", sip_rx_count); ++ sip_rx_count = 0; ++} ++ ++int sip_rx(struct esp_pub *epub) ++{ ++ struct sip_hdr *shdr = NULL; ++ struct esp_sip *sip = epub->sip; ++ int err = 0; ++ struct sk_buff *first_skb = NULL; ++ u8 *rx_buf = NULL; ++ u32 rx_blksz; ++ struct sk_buff *rx_skb = NULL; ++ ++ u32 first_sz; ++ ++ first_sz = sif_get_regs(epub)->config_w0; ++ ++ if (likely(sif_get_ate_config() != 1)) { ++ do { ++ u8 raw_seq = sif_get_regs(epub)->intr_raw & 0xff; ++ ++ if (raw_seq != sip->to_host_seq) { ++ if (raw_seq == sip->to_host_seq + 1) { /* when last read pkt crc err, this situation may occur, but raw_seq mustn't < to_host_Seq */ ++ sip->to_host_seq = raw_seq; ++ esp_dbg(ESP_DBG_TRACE, ++ "warn: to_host_seq reg 0x%02x, seq 0x%02x", ++ raw_seq, sip->to_host_seq); ++ break; ++ } ++ esp_dbg(ESP_DBG_ERROR, ++ "err: to_host_seq reg 0x%02x, seq 0x%02x", ++ raw_seq, sip->to_host_seq); ++ goto _err; ++ } ++ } while (0); ++ } ++ esp_sip_dbg(ESP_DBG_LOG, "%s enter\n", __func__); ++ ++ ++ /* first read one block out, if we luck enough, that's it ++ * ++ * To make design as simple as possible, we allocate skb(s) ++ * separately for each sif read operation to avoid global ++ * read_buf_pointe access. It coule be optimized late. ++ */ ++ rx_blksz = sif_get_blksz(epub); ++#ifdef ESP_PREALLOC ++ first_skb = esp_get_sip_skb(roundup(first_sz, rx_blksz)); ++#else ++ first_skb = ++ __dev_alloc_skb(roundup(first_sz, rx_blksz), GFP_KERNEL); ++#endif /* ESP_PREALLOC */ ++ ++ if (first_skb == NULL) { ++ sif_unlock_bus(epub); ++ esp_sip_dbg(ESP_DBG_ERROR, "%s first no memory \n", ++ __func__); ++ goto _err; ++ } ++ ++ rx_buf = skb_put(first_skb, first_sz); ++ esp_sip_dbg(ESP_DBG_LOG, "%s rx_buf ptr %p, first_sz %d\n", ++ __func__, rx_buf, first_sz); ++ ++ ++#ifdef USE_EXT_GPIO ++ do { ++ int err2 = 0; ++ u16 value = 0; ++ u16 intr_mask = ext_gpio_get_int_mask_reg(); ++ if (!intr_mask) ++ break; ++ value = sif_get_regs(epub)->config_w3 & intr_mask; ++ if (value) { ++ err2 = sif_interrupt_target(epub, 6); ++ esp_sip_dbg(ESP_DBG, "write gpio\n"); ++ } ++ ++ if (!err2 && value) { ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s intr_mask[0x%04x] value[0x%04x]\n", ++ __func__, intr_mask, value); ++ ext_gpio_int_process(value); ++ } ++ } while (0); ++#endif ++ ++ err = ++ esp_common_read(epub, rx_buf, first_sz, ESP_SIF_NOSYNC, false); ++ sip_rx_count++; ++ if (unlikely(err)) { ++ esp_dbg(ESP_DBG_ERROR, " %s first read err %d %d\n", ++ __func__, err, sif_get_regs(epub)->config_w0); ++#ifdef ESP_PREALLOC ++ esp_put_sip_skb(&first_skb); ++#else ++ kfree_skb(first_skb); ++#endif /* ESP_PREALLOC */ ++ sif_unlock_bus(epub); ++ goto _err; ++ } ++ ++ shdr = (struct sip_hdr *) rx_buf; ++ if (SIP_HDR_IS_CTRL(shdr) && (shdr->c_evtid == SIP_EVT_SLEEP)) { ++ atomic_set(&sip->epub->ps.state, ESP_PM_ON); ++ esp_dbg(ESP_DBG_TRACE, "s\n"); ++ } ++ ++ if (likely(sif_get_ate_config() != 1)) { ++ sip->to_host_seq++; ++ } ++ ++ if ((shdr->len & 3) != 0) { ++ esp_sip_dbg(ESP_DBG_ERROR, "%s shdr->len[%d] error\n", ++ __func__, shdr->len); ++#ifdef ESP_PREALLOC ++ esp_put_sip_skb(&first_skb); ++#else ++ kfree_skb(first_skb); ++#endif /* ESP_PREALLOC */ ++ sif_unlock_bus(epub); ++ err = -EIO; ++ goto _err; ++ } ++ if (shdr->len != first_sz) { ++ esp_sip_dbg(ESP_DBG_ERROR, ++ "%s shdr->len[%d] first_size[%d] error\n", ++ __func__, shdr->len, first_sz); ++#ifdef ESP_PREALLOC ++ esp_put_sip_skb(&first_skb); ++#else ++ kfree_skb(first_skb); ++#endif /* ESP_PREALLOC */ ++ sif_unlock_bus(epub); ++ err = -EIO; ++ goto _err; ++ } else { ++ sif_unlock_bus(epub); ++ skb_trim(first_skb, shdr->len); ++ esp_dbg(ESP_DBG_TRACE, " %s first_skb only\n", __func__); ++ ++ rx_skb = first_skb; ++ } ++ ++ if (atomic_read(&sip->state) == SIP_STOP) { ++#ifdef ESP_PREALLOC ++ esp_put_sip_skb(&rx_skb); ++#else ++ kfree_skb(rx_skb); ++#endif /* ESP_PREALLOC */ ++ esp_sip_dbg(ESP_DBG_ERROR, "%s when sip stopped\n", ++ __func__); ++ return 0; ++ } ++ ++ sip_rx_pkt_enqueue(sip, rx_skb); ++ queue_work(sip->epub->esp_wkq, &sip->rx_process_work); ++ ++ _err: ++ return err; ++} ++ ++int sip_post_init(struct esp_sip *sip, struct sip_evt_bootup2 *bevt) ++{ ++ struct esp_pub *epub; ++ ++ u8 mac_id = bevt->mac_addr[0]; ++ int mac_index = 0; ++ int i = 0; ++ ++ if (sip == NULL) { ++ ESSERT(0); ++ return -EINVAL; ++ } ++ ++ epub = sip->epub; ++ ++ ++ sip->tx_aggr_write_ptr = sip->tx_aggr_buf; ++ ++ sip->tx_blksz = bevt->tx_blksz; ++ sip->rx_blksz = bevt->rx_blksz; ++ sip->credit_to_reserve = bevt->credit_to_reserve; ++ ++ sip->dump_rpbm_err = (bevt->options & SIP_DUMP_RPBM_ERR); ++ sip->rxabort_fixed = (bevt->options & SIP_RXABORT_FIXED); ++ sip->support_bgscan = (bevt->options & SIP_SUPPORT_BGSCAN); ++ ++ sip->sendup_rpbm_pkt = sip->dump_rpbm_err && false; ++ ++ /* print out MAC addr... */ ++ memcpy(epub->mac_addr, bevt->mac_addr, ETH_ALEN); ++ for (i = 0; ++ i < ++ sizeof(esp_mac_prefix_table) / sizeof(struct esp_mac_prefix); ++ i++) { ++ if (esp_mac_prefix_table[i].mac_index == mac_id) { ++ mac_index = i; ++ break; ++ } ++ } ++ ++ epub->mac_addr[0] = ++ esp_mac_prefix_table[mac_index].mac_addr_prefix[0]; ++ epub->mac_addr[1] = ++ esp_mac_prefix_table[mac_index].mac_addr_prefix[1]; ++ epub->mac_addr[2] = ++ esp_mac_prefix_table[mac_index].mac_addr_prefix[2]; ++ ++#ifdef SELF_MAC ++ epub->mac_addr[0] = 0xff; ++ epub->mac_addr[1] = 0xff; ++ epub->mac_addr[2] = 0xff; ++#endif ++ atomic_set(&sip->noise_floor, bevt->noise_floor); ++ ++ sip_recalc_credit_init(sip); ++ ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s tx_blksz %d rx_blksz %d mac addr %pM\n", __func__, ++ sip->tx_blksz, sip->rx_blksz, epub->mac_addr); ++ ++ return 0; ++} ++ ++/* write pkts in aggr buf to target memory */ ++static void sip_write_pkts(struct esp_sip *sip, int pm_state) ++{ ++ int tx_aggr_len = 0; ++ struct sip_hdr *first_shdr = NULL; ++ int err = 0; ++ ++ tx_aggr_len = sip->tx_aggr_write_ptr - sip->tx_aggr_buf; ++ if (tx_aggr_len < sizeof(struct sip_hdr)) { ++ printk("%s tx_aggr_len %d \n", __func__, tx_aggr_len); ++ ESSERT(0); ++ return; ++ } ++ if ((tx_aggr_len & 0x3) != 0) { ++ ESSERT(0); ++ return; ++ } ++ ++ first_shdr = (struct sip_hdr *) sip->tx_aggr_buf; ++ ++ if (atomic_read(&sip->tx_credits) <= SIP_CREDITS_LOW_THRESHOLD) { ++ first_shdr->fc[1] |= SIP_HDR_F_NEED_CRDT_RPT; ++ } ++ ++ /* still use lock bus instead of sif_lldesc_write_sync since we want to protect several global varibles assignments */ ++ sif_lock_bus(sip->epub); ++ ++ err = ++ esp_common_write(sip->epub, sip->tx_aggr_buf, tx_aggr_len, ++ ESP_SIF_NOSYNC); ++ ++ sip->tx_aggr_write_ptr = sip->tx_aggr_buf; ++ sip->tx_tot_len = 0; ++ ++ sif_unlock_bus(sip->epub); ++ ++ if (err) ++ esp_sip_dbg(ESP_DBG_ERROR, "func %s err!!!!!!!!!: %d\n", ++ __func__, err); ++ ++} ++ ++/* setup sip header and tx info, copy pkt into aggr buf */ ++static int sip_pack_pkt(struct esp_sip *sip, struct sk_buff *skb, ++ int *pm_state) ++{ ++ struct ieee80211_tx_info *itx_info; ++ struct sip_hdr *shdr; ++ u32 tx_len = 0, offset = 0; ++ bool is_data = true; ++ ++ itx_info = IEEE80211_SKB_CB(skb); ++ ++ if (itx_info->flags == 0xffffffff) { ++ shdr = (struct sip_hdr *) skb->data; ++ is_data = false; ++ tx_len = skb->len; ++ } else { ++ struct ieee80211_hdr *wh = ++ (struct ieee80211_hdr *) skb->data; ++ struct esp_vif *evif = ++ (struct esp_vif *) itx_info->control.vif->drv_priv; ++ u8 sta_index; ++ struct esp_node *node; ++ /* update sip header */ ++ shdr = (struct sip_hdr *) sip->tx_aggr_write_ptr; ++ ++ shdr->fc[0] = 0; ++ shdr->fc[1] = 0; ++ ++ if ((itx_info->flags & IEEE80211_TX_CTL_AMPDU) ++ && (true || esp_is_ip_pkt(skb))) ++ SIP_HDR_SET_TYPE(shdr->fc[0], SIP_DATA_AMPDU); ++ else ++ SIP_HDR_SET_TYPE(shdr->fc[0], SIP_DATA); ++ ++ if (evif->epub == NULL) { ++ sip_tx_status_report(sip, skb, itx_info, false); ++ atomic_dec(&sip->tx_data_pkt_queued); ++ return -EINVAL; ++ } ++ ++ /* make room for encrypted pkt */ ++ if (itx_info->control.hw_key) { ++ int alg = ++ esp_cipher2alg(itx_info->control.hw_key-> ++ cipher); ++ if (unlikely(alg == -1)) { ++ sip_tx_status_report(sip, skb, itx_info, ++ false); ++ atomic_dec(&sip->tx_data_pkt_queued); ++ return -1; ++ } else { ++ shdr->d_enc_flag = alg + 1; ++ } ++ ++ shdr->d_hw_kid = ++ itx_info->control.hw_key->hw_key_idx | (evif-> ++ index ++ << 7); ++ } else { ++ shdr->d_enc_flag = 0; ++ shdr->d_hw_kid = (evif->index << 7 | evif->index); ++ } ++ ++ /* update sip tx info */ ++ node = esp_get_node_by_addr(sip->epub, wh->addr1); ++ if (node != NULL) ++ sta_index = node->index; ++ else ++ sta_index = ESP_PUB_MAX_STA + 1; ++ SIP_HDR_SET_IFIDX(shdr->fc[0], ++ evif->index << 3 | sta_index); ++ shdr->d_p2p = itx_info->control.vif->p2p; ++ if (evif->index == 1) ++ shdr->d_p2p = 1; ++ shdr->d_ac = skb_get_queue_mapping(skb); ++ shdr->d_tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; ++ wh = (struct ieee80211_hdr *) skb->data; ++ if (ieee80211_is_mgmt(wh->frame_control)) { ++ /* addba/delba/bar may use different tid/ac */ ++ if (shdr->d_ac == WME_AC_VO) { ++ shdr->d_tid = 7; ++ } ++ if (ieee80211_is_beacon(wh->frame_control)) { ++ shdr->d_tid = 8; ++ shdr->d_ac = 4; ++ } ++ } ++ if (check_ac_tid(skb->data, shdr->d_ac, shdr->d_tid)) { ++ shdr->d_ac = WME_AC_BE; ++ shdr->d_tid = 0; ++ } ++ ++ ++ /* make sure data is start at 4 bytes aligned addr. */ ++ offset = roundup(sizeof(struct sip_hdr), 4); ++ ++#ifdef HOST_RC ++ esp_sip_dbg(ESP_DBG_TRACE, "%s offset0 %d \n", __func__, ++ offset); ++ memcpy(sip->tx_aggr_write_ptr + offset, ++ (void *) &itx_info->control, ++ sizeof(struct sip_tx_rc)); ++ ++ offset += roundup(sizeof(struct sip_tx_rc), 4); ++ esp_show_tx_rates(&itx_info->control.rates[0]); ++ ++#endif /* HOST_RC */ ++ ++ if (SIP_HDR_IS_AMPDU(shdr)) { ++ memset(sip->tx_aggr_write_ptr + offset, 0, ++ sizeof(struct esp_tx_ampdu_entry)); ++ offset += ++ roundup(sizeof(struct esp_tx_ampdu_entry), 4); ++ } ++ ++ tx_len = offset + skb->len; ++ shdr->len = tx_len; /* actual len */ ++ ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s offset %d skblen %d txlen %d\n", __func__, ++ offset, skb->len, tx_len); ++ ++ } ++ ++ shdr->seq = sip->txseq++; ++ //esp_sip_dbg(ESP_DBG_ERROR, "%s seq %u, %u %u\n", __func__, shdr->seq, SIP_HDR_GET_TYPE(shdr->fc[0]),shdr->c_cmdid); ++ ++ /* copy skb to aggr buf */ ++ memcpy(sip->tx_aggr_write_ptr + offset, skb->data, skb->len); ++ ++ if (is_data) { ++ spin_lock_bh(&sip->epub->tx_lock); ++ sip->txdataseq = shdr->seq; ++ spin_unlock_bh(&sip->epub->tx_lock); ++ /* fake a tx_status and report to mac80211 stack to speed up tx, may affect ++ * 1) rate control (now it's all in target, so should be OK) ++ * 2) ps mode, mac80211 want to check ACK of ps/nulldata to see if AP is awake ++ * 3) BAR, mac80211 do BAR by checking ACK ++ */ ++ /* ++ * XXX: need to adjust for 11n, e.g. report tx_status according to BA received in target ++ * ++ */ ++ sip_tx_status_report(sip, skb, itx_info, true); ++ atomic_dec(&sip->tx_data_pkt_queued); ++ ++ STRACE_TX_DATA_INC(); ++ } else { ++ /* check pm state here */ ++ ++ /* no need to hold ctrl skb */ ++ sip_free_ctrl_skbuff(sip, skb); ++ STRACE_TX_CMD_INC(); ++ } ++ ++ /* TBD: roundup here or whole aggr-buf */ ++ tx_len = roundup(tx_len, sip->tx_blksz); ++ ++ sip->tx_aggr_write_ptr += tx_len; ++ sip->tx_tot_len += tx_len; ++ ++ return 0; ++} ++ ++#ifdef HOST_RC ++static void sip_set_tx_rate_status(struct sip_rc_status *rcstatus, ++ struct ieee80211_tx_rate *irates) ++{ ++ int i; ++ u8 shift = 0; ++ u32 cnt = 0; ++ ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { ++ if (rcstatus->rc_map & BIT(i)) { ++ shift = i << 2; ++ cnt = ++ (rcstatus-> ++ rc_cnt_store >> shift) & RC_CNT_MASK; ++ irates[i].idx = i; ++ irates[i].count = (u8) cnt; ++ } else { ++ irates[i].idx = -1; ++ irates[i].count = 0; ++ } ++ } ++ ++ esp_show_rcstatus(rcstatus); ++ esp_show_tx_rates(irates); ++} ++#endif /* HOST_RC */ ++ ++static void sip_tx_status_report(struct esp_sip *sip, struct sk_buff *skb, ++ struct ieee80211_tx_info *tx_info, ++ bool success) ++{ ++ if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { ++ if (likely(success)) ++ tx_info->flags |= IEEE80211_TX_STAT_ACK; ++ else ++ tx_info->flags &= ~IEEE80211_TX_STAT_ACK; ++ ++ /* manipulate rate status... */ ++ tx_info->status.rates[0].idx = 11; ++ tx_info->status.rates[0].count = 1; ++ tx_info->status.rates[0].flags = 0; ++ tx_info->status.rates[1].idx = -1; ++ ++ } else { ++ tx_info->flags |= ++ IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_ACK; ++ tx_info->status.ampdu_len = 1; ++ tx_info->status.ampdu_ack_len = 1; ++ ++ /* manipulate rate status... */ ++ tx_info->status.rates[0].idx = 7; ++ tx_info->status.rates[0].count = 1; ++ tx_info->status.rates[0].flags = ++ IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_SHORT_GI; ++ tx_info->status.rates[1].idx = -1; ++ ++ } ++ ++ if (tx_info->flags & IEEE80211_TX_STAT_AMPDU) ++ esp_sip_dbg(ESP_DBG_TRACE, "%s ampdu status! \n", ++ __func__); ++ ++ if (!mod_support_no_txampdu() && ++ cfg80211_get_chandef_type(&sip->epub->hw->conf.chandef) != ++ NL80211_CHAN_NO_HT) { ++ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); ++ struct ieee80211_hdr *wh = ++ (struct ieee80211_hdr *) skb->data; ++ if (ieee80211_is_data_qos(wh->frame_control)) { ++ if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { ++ u8 tidno = ++ ieee80211_get_qos_ctl(wh)[0] & ++ IEEE80211_QOS_CTL_TID_MASK; ++ struct esp_node *node; ++ struct esp_tx_tid *tid; ++ struct ieee80211_sta *sta; ++ ++ node = ++ esp_get_node_by_addr(sip->epub, ++ wh->addr1); ++ if (node == NULL) ++ goto _exit; ++ if (node->sta == NULL) ++ goto _exit; ++ sta = node->sta; ++ tid = &node->tid[tidno]; ++ spin_lock_bh(&sip->epub->tx_ampdu_lock); ++ //start session ++ if (tid == NULL) { ++ spin_unlock_bh(&sip->epub-> ++ tx_ampdu_lock); ++ ESSERT(0); ++ goto _exit; ++ } ++ if ((tid->state == ESP_TID_STATE_INIT) && ++ (TID_TO_AC(tidno) != WME_AC_VO) ++ && tid->cnt >= 10) { ++ tid->state = ESP_TID_STATE_TRIGGER; ++ esp_sip_dbg(ESP_DBG_ERROR, ++ "start tx ba session,addr:%pM,tid:%u\n", ++ wh->addr1, tidno); ++ spin_unlock_bh(&sip->epub-> ++ tx_ampdu_lock); ++ ieee80211_start_tx_ba_session(sta, ++ tidno, ++ 0); ++ } else { ++ if (tid->state == ++ ESP_TID_STATE_INIT) ++ tid->cnt++; ++ else ++ tid->cnt = 0; ++ spin_unlock_bh(&sip->epub-> ++ tx_ampdu_lock); ++ } ++ } ++ } ++ } ++ _exit: ++ ieee80211_tx_status_skb(sip->epub->hw, skb); ++} ++ ++/* ++ * NB: this routine should be locked when calling ++ */ ++void sip_txq_process(struct esp_pub *epub) ++{ ++ struct sk_buff *skb; ++ struct esp_sip *sip = epub->sip; ++ u32 pkt_len = 0, tx_len = 0; ++ int blknum = 0; ++ bool queued_back = false; ++ bool out_of_credits = false; ++ struct ieee80211_tx_info *itx_info; ++ int pm_state = 0; ++ ++ while ((skb = skb_dequeue(&epub->txq))) { ++ ++ /* cmd skb->len does not include sip_hdr too */ ++ pkt_len = skb->len; ++ itx_info = IEEE80211_SKB_CB(skb); ++ if (itx_info->flags != 0xffffffff) { ++ pkt_len += roundup(sizeof(struct sip_hdr), 4); ++ if ((itx_info->flags & IEEE80211_TX_CTL_AMPDU) ++ && (true || esp_is_ip_pkt(skb))) ++ pkt_len += ++ roundup(sizeof ++ (struct esp_tx_ampdu_entry), ++ 4); ++ } ++ ++ /* current design simply requires every sip_hdr must be at the begin of mblk, that definitely ++ * need to be optimized, e.g. calulate remain length in the previous mblk, if it larger than ++ * certain threshold (e.g, whole pkt or > 50% of pkt or 2 x sizeof(struct sip_hdr), append pkt ++ * to the previous mblk. This might be done in sip_pack_pkt() ++ */ ++ pkt_len = roundup(pkt_len, sip->tx_blksz); ++ blknum = pkt_len / sip->tx_blksz; ++ esp_dbg(ESP_DBG_TRACE, ++ "%s skb_len %d pkt_len %d blknum %d\n", __func__, ++ skb->len, pkt_len, blknum); ++ ++ if (unlikely(atomic_read(&sip->credit_status) == RECALC_CREDIT_ENABLE)) { /* need recalc credit */ ++ struct sip_hdr *hdr = (struct sip_hdr *) skb->data; ++ itx_info = IEEE80211_SKB_CB(skb); ++ if (!(itx_info->flags == 0xffffffff && SIP_HDR_GET_TYPE(hdr->fc[0]) == SIP_CTRL && hdr->c_cmdid == SIP_CMD_RECALC_CREDIT && blknum <= atomic_read(&sip->tx_credits) - sip->credit_to_reserve)) { /* except cmd recalc credit */ ++ esp_dbg(ESP_DBG_ERROR, ++ "%s recalc credits!\n", __func__); ++ STRACE_TX_OUT_OF_CREDIT_INC(); ++ queued_back = true; ++ out_of_credits = true; ++ break; ++ } ++ } else { /* normal situation */ ++ if (unlikely ++ (blknum > ++ (atomic_read(&sip->tx_credits) - ++ sip->credit_to_reserve - ++ SIP_CTRL_CREDIT_RESERVE))) { ++ itx_info = IEEE80211_SKB_CB(skb); ++ if (itx_info->flags == 0xffffffff) { /* priv ctrl pkt */ ++ if (blknum > ++ atomic_read(&sip->tx_credits) - ++ sip->credit_to_reserve) { ++ esp_dbg(ESP_DBG_TRACE, ++ "%s cmd pkt out of credits!\n", ++ __func__); ++ STRACE_TX_OUT_OF_CREDIT_INC ++ (); ++ queued_back = true; ++ out_of_credits = true; ++ break; ++ } ++ } else { ++ esp_dbg(ESP_DBG_TRACE, ++ "%s out of credits!\n", ++ __func__); ++ STRACE_TX_OUT_OF_CREDIT_INC(); ++ queued_back = true; ++ out_of_credits = true; ++ break; ++ } ++ } ++ } ++ tx_len += pkt_len; ++ if (tx_len >= SIP_TX_AGGR_BUF_SIZE) { ++ /* do we need to have limitation likemax 8 pkts in a row? */ ++ esp_dbg(ESP_DBG_TRACE, ++ "%s too much pkts in one shot!\n", ++ __func__); ++ STRACE_TX_ONE_SHOT_INC(); ++ tx_len -= pkt_len; ++ queued_back = true; ++ break; ++ } ++ ++ if (sip_pack_pkt(sip, skb, &pm_state) != 0) { ++ /* wrong pkt, won't send to target */ ++ tx_len -= pkt_len; ++ continue; ++ } ++ ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s:before sub, credits is %d\n", __func__, ++ atomic_read(&sip->tx_credits)); ++ atomic_sub(blknum, &sip->tx_credits); ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s:after sub %d,credits remains %d\n", ++ __func__, blknum, ++ atomic_read(&sip->tx_credits)); ++ ++ } ++ ++ if (queued_back) { ++ skb_queue_head(&epub->txq, skb); ++ } ++ ++ if (atomic_read(&sip->state) == SIP_STOP ++#ifdef HOST_RESET_BUG ++ || atomic_read(&epub->wl.off) == 1 ++#endif ++ ) { ++ queued_back = 1; ++ tx_len = 0; ++ sip_after_write_pkts(sip); ++ } ++ ++ if (tx_len) { ++ ++ sip_write_pkts(sip, pm_state); ++ ++ sip_after_write_pkts(sip); ++ } ++ ++ if (queued_back && !out_of_credits) { ++ ++ /* skb pending, do async process again */ ++ sip_trigger_txq_process(sip); ++ } ++} ++ ++static void sip_after_write_pkts(struct esp_sip *sip) ++{ ++ ++} ++ ++#ifndef NO_WMM_DUMMY ++static struct esp_80211_wmm_param_element esp_wmm_param = { ++ .oui = {0x00, 0x50, 0xf2}, ++ .oui_type = 0x02, ++ .oui_subtype = 0x01, ++ .version = 0x01, ++ .qos_info = 0x00, ++ .reserved = 0x00, ++ .ac = { ++ { ++ .aci_aifsn = 0x03, ++ .cw = 0xa4, ++ .txop_limit = 0x0000, ++ }, ++ { ++ .aci_aifsn = 0x27, ++ .cw = 0xa4, ++ .txop_limit = 0x0000, ++ }, ++ { ++ .aci_aifsn = 0x42, ++ .cw = 0x43, ++ .txop_limit = 0x005e, ++ }, ++ { ++ .aci_aifsn = 0x62, ++ .cw = 0x32, ++ .txop_limit = 0x002f, ++ }, ++ }, ++}; ++ ++static int esp_add_wmm(struct sk_buff *skb) ++{ ++ u8 *p; ++ int flag = 0; ++ int remain_len; ++ int base_len; ++ int len; ++ struct ieee80211_mgmt *mgmt; ++ struct ieee80211_hdr *wh; ++ ++ if (!skb) ++ return -1; ++ ++ wh = (struct ieee80211_hdr *) skb->data; ++ mgmt = (struct ieee80211_mgmt *) ((u8 *) skb->data); ++ ++ if (ieee80211_is_assoc_resp(wh->frame_control)) { ++ p = mgmt->u.assoc_resp.variable; ++ base_len = ++ (u8 *) mgmt->u.assoc_resp.variable - (u8 *) mgmt; ++ } else if (ieee80211_is_reassoc_resp(wh->frame_control)) { ++ p = mgmt->u.reassoc_resp.variable; ++ base_len = ++ (u8 *) mgmt->u.reassoc_resp.variable - (u8 *) mgmt; ++ } else if (ieee80211_is_probe_resp(wh->frame_control)) { ++ p = mgmt->u.probe_resp.variable; ++ base_len = ++ (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; ++ } else if (ieee80211_is_beacon(wh->frame_control)) { ++ p = mgmt->u.beacon.variable; ++ base_len = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; ++ } else ++ return 1; ++ ++ ++ remain_len = skb->len - base_len; ++ ++ while (remain_len > 0) { ++ if (*p == 0xdd && *(p + 5) == 0x02) //wmm type ++ return 0; ++ else if (*p == 0x2d) //has ht cap ++ flag = 1; ++ ++ len = *(++p); ++ p += (len + 1); ++ remain_len -= (len + 2); ++ } ++ ++ if (remain_len < 0) { ++ esp_dbg(ESP_DBG_TRACE, ++ "%s remain_len %d, skb->len %d, base_len %d, flag %d", ++ __func__, remain_len, skb->len, base_len, flag); ++ return -2; ++ } ++ ++ if (flag == 1) { ++ skb_put(skb, 2 + sizeof(esp_wmm_param)); ++ ++ memset(p, 0xdd, sizeof(u8)); ++ memset(p + 1, sizeof(esp_wmm_param), sizeof(u8)); ++ memcpy(p + 2, &esp_wmm_param, sizeof(esp_wmm_param)); ++ ++ esp_dbg(ESP_DBG_TRACE, "esp_wmm_param"); ++ } ++ ++ return 0; ++} ++#endif /* NO_WMM_DUMMY */ ++ ++/* parse mac_rx_ctrl and return length */ ++static int sip_parse_mac_rx_info(struct esp_sip *sip, ++ struct esp_mac_rx_ctrl *mac_ctrl, ++ struct sk_buff *skb) ++{ ++ struct ieee80211_rx_status *rx_status = NULL; ++ struct ieee80211_hdr *hdr; ++ ++ rx_status = IEEE80211_SKB_RXCB(skb); ++ rx_status->freq = esp_ieee2mhz(mac_ctrl->channel); ++ ++ rx_status->signal = mac_ctrl->rssi + mac_ctrl->noise_floor; /* snr actually, need to offset noise floor e.g. -85 */ ++ ++ hdr = (struct ieee80211_hdr *) skb->data; ++ if (mac_ctrl->damatch0 == 1 && mac_ctrl->bssidmatch0 == 1 /*match bssid and da, but beacon package contain other bssid */ ++ && strncmp(hdr->addr2, sip->epub->wl.bssid, ETH_ALEN) == 0) { /* force match addr2 */ ++ if (++signal_loop >= SIGNAL_COUNT) { ++ avg_signal += rx_status->signal; ++ avg_signal /= SIGNAL_COUNT; ++ old_signal = rx_status->signal = (avg_signal + 5); ++ signal_loop = 0; ++ avg_signal = 0; ++ } else { ++ avg_signal += rx_status->signal; ++ rx_status->signal = old_signal; ++ } ++ } ++ ++ rx_status->antenna = 0; /* one antenna for now */ ++ rx_status->band = NL80211_BAND_2GHZ; ++ rx_status->flag = RX_FLAG_DECRYPTED | RX_FLAG_MMIC_STRIPPED; ++ if (mac_ctrl->sig_mode) { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ rx_status->encoding = RX_ENC_HT; ++#else ++ rx_status->flag |= RX_FLAG_HT; ++#endif ++ rx_status->rate_idx = mac_ctrl->MCS; ++ if (mac_ctrl->SGI) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) ++ rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; ++#else ++ rx_status->flag |= RX_FLAG_SHORT_GI; ++#endif ++ } else { ++ rx_status->rate_idx = esp_wmac_rate2idx(mac_ctrl->rate); ++ } ++ if (mac_ctrl->rxend_state == RX_FCS_ERR) ++ rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; ++ ++ /* Mic error frame flag */ ++ if (mac_ctrl->rxend_state == RX_TKIPMIC_ERR ++ || mac_ctrl->rxend_state == RX_CCMPMIC_ERR) { ++ if (atomic_read(&sip->epub->wl.tkip_key_set) == 1) { ++ rx_status->flag |= RX_FLAG_MMIC_ERROR; ++ atomic_set(&sip->epub->wl.tkip_key_set, 0); ++ printk("mic err\n"); ++ } else { ++ printk("mic err discard\n"); ++ } ++ } ++ //esp_dbg(ESP_DBG_LOG, "%s freq: %u; signal: %d; rate_idx %d; flag: %d \n", __func__, rx_status->freq, rx_status->signal, rx_status->rate_idx, rx_status->flag); ++ ++ do { ++ struct ieee80211_hdr *wh = ++ (struct ieee80211_hdr *) ((u8 *) skb->data); ++ ++#ifndef NO_WMM_DUMMY ++ if (ieee80211_is_mgmt(wh->frame_control)) ++ esp_add_wmm(skb); ++#endif ++ ++ /* some kernel e.g. 3.0.8 wrongly handles non-encrypted pkt like eapol */ ++ if (ieee80211_is_data(wh->frame_control)) { ++ if (!ieee80211_has_protected(wh->frame_control)) { ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s kiv_war, add iv_stripped flag \n", ++ __func__); ++ rx_status->flag |= RX_FLAG_IV_STRIPPED; ++ } else { ++ if ((atomic_read(&sip->epub->wl.ptk_cnt) == ++ 0 && !(wh->addr1[0] & 0x1)) ++ || (atomic_read(&sip->epub->wl.gtk_cnt) ++ == 0 && (wh->addr1[0] & 0x1))) { ++ esp_dbg(ESP_DBG_TRACE, ++ "%s ==kiv_war, got bogus enc pkt==\n", ++ __func__); ++ rx_status->flag |= ++ RX_FLAG_IV_STRIPPED; ++ //show_buf(skb->data, 32); ++ } ++ ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "%s kiv_war, got enc pkt \n", ++ __func__); ++ } ++ } ++ } while (0); ++ ++ return 0; ++} ++ ++static struct esp_mac_rx_ctrl *sip_parse_normal_mac_ctrl(struct sk_buff ++ *skb, ++ int *pkt_len_enc, ++ int *buf_len, ++ int *pulled_len) ++{ ++ struct esp_mac_rx_ctrl *mac_ctrl = NULL; ++ struct sip_hdr *hdr = (struct sip_hdr *) skb->data; ++ int len_in_hdr = hdr->len; ++ ++ ESSERT(skb != NULL); ++ ESSERT(skb->len > SIP_MIN_DATA_PKT_LEN); ++ ++ skb_pull(skb, sizeof(struct sip_hdr)); ++ *pulled_len += sizeof(struct sip_hdr); ++ mac_ctrl = (struct esp_mac_rx_ctrl *) skb->data; ++ if (!mac_ctrl->Aggregation) { ++ ESSERT(pkt_len_enc != NULL); ++ ESSERT(buf_len != NULL); ++ *pkt_len_enc = ++ (mac_ctrl->sig_mode ? mac_ctrl->HT_length : mac_ctrl-> ++ legacy_length) - FCS_LEN; ++ *buf_len = ++ len_in_hdr - sizeof(struct sip_hdr) - ++ sizeof(struct esp_mac_rx_ctrl); ++ } ++ skb_pull(skb, sizeof(struct esp_mac_rx_ctrl)); ++ *pulled_len += sizeof(struct esp_mac_rx_ctrl); ++ ++ return mac_ctrl; ++} ++ ++/* ++ * for one MPDU (including subframe in AMPDU) ++ * ++ */ ++static struct sk_buff *sip_parse_data_rx_info(struct esp_sip *sip, ++ struct sk_buff *skb, ++ int pkt_len_enc, int buf_len, ++ struct esp_mac_rx_ctrl ++ *mac_ctrl, int *pulled_len) ++{ ++ /* ++ * | mac_rx_ctrl | real_data_payload | ampdu_entries | ++ */ ++ //without enc ++ int pkt_len = 0; ++ struct sk_buff *rskb = NULL; ++ int ret; ++ ++ if (mac_ctrl->Aggregation) { ++ struct ieee80211_hdr *wh = ++ (struct ieee80211_hdr *) skb->data; ++ pkt_len = pkt_len_enc; ++ if (ieee80211_has_protected(wh->frame_control)) //ampdu, it is CCMP enc ++ pkt_len -= 8; ++ buf_len = roundup(pkt_len, 4); ++ } else ++ pkt_len = buf_len - 3 + ((pkt_len_enc - 1) & 0x3); ++ esp_dbg(ESP_DBG_TRACE, ++ "%s pkt_len %u, pkt_len_enc %u!, delta %d \n", __func__, ++ pkt_len, pkt_len_enc, pkt_len_enc - pkt_len); ++ do { ++#ifndef NO_WMM_DUMMY ++ rskb = ++ __dev_alloc_skb(pkt_len_enc + sizeof(esp_wmm_param) + ++ 2, GFP_ATOMIC); ++#else ++ rskb = __dev_alloc_skb(pkt_len_enc, GFP_ATOMIC); ++#endif /* NO_WMM_DUMMY */ ++ if (unlikely(rskb == NULL)) { ++ esp_sip_dbg(ESP_DBG_ERROR, "%s no mem for rskb\n", ++ __func__); ++ return NULL; ++ } ++ skb_put(rskb, pkt_len_enc); ++ } while (0); ++ ++ do { ++ memcpy(rskb->data, skb->data, pkt_len); ++ if (pkt_len_enc > pkt_len) { ++ memset(rskb->data + pkt_len, 0, ++ pkt_len_enc - pkt_len); ++ } ++ /* strip out current pkt, move to the next one */ ++ skb_pull(skb, buf_len); ++ *pulled_len += buf_len; ++ } while (0); ++ ++ ret = sip_parse_mac_rx_info(sip, mac_ctrl, rskb); ++ if (ret == -1 && !mac_ctrl->Aggregation) { ++ kfree_skb(rskb); ++ return NULL; ++ } ++ ++ esp_dbg(ESP_DBG_LOG, ++ "%s after pull headers, skb->len %d rskb->len %d \n", ++ __func__, skb->len, rskb->len); ++ ++ return rskb; ++} ++ ++struct esp_sip *sip_attach(struct esp_pub *epub) ++{ ++ struct esp_sip *sip = NULL; ++ struct sip_pkt *pkt = NULL; ++ int i; ++#ifndef ESP_PREALLOC ++ int po = 0; ++#endif ++ ++ sip = kzalloc(sizeof(struct esp_sip), GFP_KERNEL); ++ if (sip == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "no mem for sip! \n"); ++ goto _err_sip; ++ } ++#ifdef ESP_PREALLOC ++ sip->tx_aggr_buf = (u8 *) esp_get_tx_aggr_buf(); ++#else ++ po = get_order(SIP_TX_AGGR_BUF_SIZE); ++ sip->tx_aggr_buf = (u8 *) __get_free_pages(GFP_ATOMIC, po); ++#endif ++ if (sip->tx_aggr_buf == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "no mem for tx_aggr_buf! \n"); ++ goto _err_aggr; ++ } ++ ++ spin_lock_init(&sip->lock); ++ ++ INIT_LIST_HEAD(&sip->free_ctrl_txbuf); ++ INIT_LIST_HEAD(&sip->free_ctrl_rxbuf); ++ ++ for (i = 0; i < SIP_CTRL_BUF_N; i++) { ++ pkt = kzalloc(sizeof(struct sip_pkt), GFP_KERNEL); ++ ++ if (!pkt) ++ goto _err_pkt; ++ ++ pkt->buf_begin = kzalloc(SIP_CTRL_BUF_SZ, GFP_KERNEL); ++ ++ if (pkt->buf_begin == NULL) { ++ kfree(pkt); ++ pkt = NULL; ++ goto _err_pkt; ++ } ++ ++ pkt->buf_len = SIP_CTRL_BUF_SZ; ++ pkt->buf = pkt->buf_begin; ++ ++ if (i < SIP_CTRL_TXBUF_N) { ++ list_add_tail(&pkt->list, &sip->free_ctrl_txbuf); ++ } else { ++ list_add_tail(&pkt->list, &sip->free_ctrl_rxbuf); ++ } ++ } ++ ++ mutex_init(&sip->rx_mtx); ++ skb_queue_head_init(&sip->rxq); ++ INIT_WORK(&sip->rx_process_work, sip_rxq_process); ++ ++ sip->epub = epub; ++ atomic_set(&sip->noise_floor, -96); ++ ++ atomic_set(&sip->state, SIP_INIT); ++ atomic_set(&sip->tx_credits, 0); ++ ++ if (sip->rawbuf == NULL) { ++ sip->rawbuf = kzalloc(SIP_BOOT_BUF_SIZE, GFP_KERNEL); ++ if (sip->rawbuf == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "no mem for rawbuf! \n"); ++ goto _err_pkt; ++ } ++ } ++ ++ atomic_set(&sip->state, SIP_PREPARE_BOOT); ++ ++ return sip; ++ ++ _err_pkt: ++ sip_free_init_ctrl_buf(sip); ++ ++ if (sip->tx_aggr_buf) { ++#ifdef ESP_PREALLOC ++ esp_put_tx_aggr_buf(&sip->tx_aggr_buf); ++#else ++ po = get_order(SIP_TX_AGGR_BUF_SIZE); ++ free_pages((unsigned long) sip->tx_aggr_buf, po); ++ sip->tx_aggr_buf = NULL; ++#endif ++ } ++ _err_aggr: ++ if (sip) { ++ kfree(sip); ++ sip = NULL; ++ } ++ _err_sip: ++ return NULL; ++ ++} ++ ++static void sip_free_init_ctrl_buf(struct esp_sip *sip) ++{ ++ struct sip_pkt *pkt, *tpkt; ++ ++ list_for_each_entry_safe(pkt, tpkt, &sip->free_ctrl_txbuf, list) { ++ list_del(&pkt->list); ++ kfree(pkt->buf_begin); ++ kfree(pkt); ++ } ++ ++ list_for_each_entry_safe(pkt, tpkt, &sip->free_ctrl_rxbuf, list) { ++ list_del(&pkt->list); ++ kfree(pkt->buf_begin); ++ kfree(pkt); ++ } ++} ++ ++void sip_detach(struct esp_sip *sip) ++{ ++#ifndef ESP_PREALLOC ++ int po; ++#endif ++ if (sip == NULL) ++ return; ++ ++ esp_dbg(ESP_DBG_TRACE, "sip_detach: sip_free_init_ctrl_buf()"); ++ sip_free_init_ctrl_buf(sip); ++ ++ if (atomic_read(&sip->state) == SIP_RUN) { ++ ++ sif_disable_target_interrupt(sip->epub); ++ ++ atomic_set(&sip->state, SIP_STOP); ++ ++ /* disable irq here */ ++ sif_disable_irq(sip->epub); ++ cancel_work_sync(&sip->rx_process_work); ++ ++ skb_queue_purge(&sip->rxq); ++ mutex_destroy(&sip->rx_mtx); ++ cancel_work(&sip->epub->sendup_work); // Must be non-sync ++ skb_queue_purge(&sip->epub->rxq); ++ ++#ifdef ESP_NO_MAC80211 ++ unregister_netdev(sip->epub->net_dev); ++ wiphy_unregister(sip->epub->wdev->wiphy); ++#else ++ if (test_and_clear_bit ++ (ESP_WL_FLAG_HW_REGISTERED, &sip->epub->wl.flags)) { ++ ieee80211_unregister_hw(sip->epub->hw); ++ } ++#endif ++ ++ /* cancel all worker/timer */ ++ cancel_work_sync(&sip->epub->tx_work); ++ skb_queue_purge(&sip->epub->txq); ++ skb_queue_purge(&sip->epub->txdoneq); ++ ++#ifdef ESP_PREALLOC ++ esp_put_tx_aggr_buf(&sip->tx_aggr_buf); ++#else ++ po = get_order(SIP_TX_AGGR_BUF_SIZE); ++ free_pages((unsigned long) sip->tx_aggr_buf, po); ++ sip->tx_aggr_buf = NULL; ++#endif ++ ++ atomic_set(&sip->state, SIP_INIT); ++ } else if (atomic_read(&sip->state) >= SIP_BOOT ++ && atomic_read(&sip->state) <= SIP_WAIT_BOOTUP) { ++ ++ sif_disable_target_interrupt(sip->epub); ++ atomic_set(&sip->state, SIP_STOP); ++ ++ sif_disable_irq(sip->epub); ++ ++ if (sip->rawbuf) ++ kfree(sip->rawbuf); ++ ++ if (atomic_read(&sip->state) == SIP_SEND_INIT) { ++ cancel_work_sync(&sip->rx_process_work); ++ skb_queue_purge(&sip->rxq); ++ mutex_destroy(&sip->rx_mtx); ++ cancel_work_sync(&sip->epub->sendup_work); ++ skb_queue_purge(&sip->epub->rxq); ++ } ++#ifdef ESP_NO_MAC80211 ++ unregister_netdev(sip->epub->net_dev); ++ wiphy_unregister(sip->epub->wdev->wiphy); ++#else ++ if (test_and_clear_bit ++ (ESP_WL_FLAG_HW_REGISTERED, &sip->epub->wl.flags)) { ++ ieee80211_unregister_hw(sip->epub->hw); ++ } ++#endif ++ atomic_set(&sip->state, SIP_INIT); ++ } else ++ esp_dbg(ESP_DBG_ERROR, "%s wrong state %d\n", __func__, ++ atomic_read(&sip->state)); ++ ++ kfree(sip); ++} ++ ++int sip_write_memory(struct esp_sip *sip, u32 addr, u8 * buf, u16 len) ++{ ++ struct sip_cmd_write_memory *cmd; ++ struct sip_hdr *chdr; ++ u16 remains, hdrs, bufsize; ++ u32 loadaddr; ++ u8 *src; ++ int err = 0; ++ u32 *t = NULL; ++ ++ if (sip == NULL || sip->rawbuf == NULL) { ++ ESSERT(sip != NULL); ++ ESSERT(sip->rawbuf != NULL); ++ return -EINVAL; ++ } ++ ++ memset(sip->rawbuf, 0, SIP_BOOT_BUF_SIZE); ++ ++ chdr = (struct sip_hdr *) sip->rawbuf; ++ SIP_HDR_SET_TYPE(chdr->fc[0], SIP_CTRL); ++ chdr->c_cmdid = SIP_CMD_WRITE_MEMORY; ++ ++ remains = len; ++ hdrs = ++ sizeof(struct sip_hdr) + sizeof(struct sip_cmd_write_memory); ++ ++ while (remains) { ++ src = &buf[len - remains]; ++ loadaddr = addr + (len - remains); ++ ++ if (remains < (SIP_BOOT_BUF_SIZE - hdrs)) { ++ /* aligned with 4 bytes */ ++ bufsize = roundup(remains, 4); ++ memset(sip->rawbuf + hdrs, 0, bufsize); ++ remains = 0; ++ } else { ++ bufsize = SIP_BOOT_BUF_SIZE - hdrs; ++ remains -= bufsize; ++ } ++ ++ chdr->len = bufsize + hdrs; ++ chdr->seq = sip->txseq++; ++ cmd = ++ (struct sip_cmd_write_memory *) (sip->rawbuf + ++ SIP_CTRL_HDR_LEN); ++ cmd->len = bufsize; ++ cmd->addr = loadaddr; ++ memcpy(sip->rawbuf + hdrs, src, bufsize); ++ ++ t = (u32 *) sip->rawbuf; ++ esp_dbg(ESP_DBG_TRACE, ++ "%s t0: 0x%08x t1: 0x%08x t2:0x%08x loadaddr 0x%08x \n", ++ __func__, t[0], t[1], t[2], loadaddr); ++ ++ err = ++ esp_common_write(sip->epub, sip->rawbuf, chdr->len, ++ ESP_SIF_SYNC); ++ ++ if (err) { ++ esp_dbg(ESP_DBG_ERROR, "%s send buffer failed\n", ++ __func__); ++ return err; ++ } ++ // 1ms is enough, in fact on dell-d430, need not delay at all. ++ mdelay(1); ++ ++ } ++ ++ return err; ++} ++ ++int sip_send_cmd(struct esp_sip *sip, int cid, u32 cmdlen, void *cmd) ++{ ++ struct sip_hdr *chdr; ++ struct sip_pkt *pkt = NULL; ++ int ret = 0; ++ ++ pkt = sip_get_ctrl_buf(sip, SIP_TX_CTRL_BUF); ++ ++ if (pkt == NULL) ++ return -ENOMEM; ++ ++ chdr = (struct sip_hdr *) pkt->buf_begin; ++ chdr->len = SIP_CTRL_HDR_LEN + cmdlen; ++ chdr->seq = sip->txseq++; ++ chdr->c_cmdid = cid; ++ ++ ++ if (cmd) { ++ memset(pkt->buf, 0, cmdlen); ++ memcpy(pkt->buf, (u8 *) cmd, cmdlen); ++ } ++ ++ esp_dbg(ESP_DBG_TRACE, "cid %d, len %u, seq %u \n", chdr->c_cmdid, ++ chdr->len, chdr->seq); ++ ++ esp_dbg(ESP_DBG_TRACE, "c1 0x%08x c2 0x%08x\n", ++ *(u32 *) & pkt->buf[0], *(u32 *) & pkt->buf[4]); ++ ++ ret = ++ esp_common_write(sip->epub, pkt->buf_begin, chdr->len, ++ ESP_SIF_SYNC); ++ ++ if (ret) ++ esp_dbg(ESP_DBG_ERROR, "%s send cmd %d failed \n", ++ __func__, cid); ++ ++ sip_reclaim_ctrl_buf(sip, pkt, SIP_TX_CTRL_BUF); ++ ++ /* ++ * Hack here: reset tx/rx seq before target ram code is up... ++ */ ++ if (cid == SIP_CMD_BOOTUP) { ++ sip->rxseq = 0; ++ sip->txseq = 0; ++ sip->txdataseq = 0; ++ } ++ ++ return ret; ++} ++ ++struct sk_buff *sip_alloc_ctrl_skbuf(struct esp_sip *sip, u16 len, u32 cid) ++{ ++ struct sip_hdr *si = NULL; ++ struct ieee80211_tx_info *ti = NULL; ++ struct sk_buff *skb = NULL; ++ ++ ESSERT(len <= sip->tx_blksz); ++ ++ /* no need to reserve space for net stack */ ++ skb = __dev_alloc_skb(len, GFP_KERNEL); ++ ++ if (skb == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "no skb for ctrl !\n"); ++ return NULL; ++ } ++ ++ skb->len = len; ++ ++ ti = IEEE80211_SKB_CB(skb); ++ /* set tx_info flags to 0xffffffff to indicate sip_ctrl pkt */ ++ ti->flags = 0xffffffff; ++ si = (struct sip_hdr *) skb->data; ++ memset(si, 0, sizeof(struct sip_hdr)); ++ SIP_HDR_SET_TYPE(si->fc[0], SIP_CTRL); ++ si->len = len; ++ si->c_cmdid = cid; ++ ++ return skb; ++} ++ ++void sip_free_ctrl_skbuff(struct esp_sip *sip, struct sk_buff *skb) ++{ ++ memset(IEEE80211_SKB_CB(skb), 0, sizeof(struct ieee80211_tx_info)); ++ kfree_skb(skb); ++} ++ ++static struct sip_pkt *sip_get_ctrl_buf(struct esp_sip *sip, ++ SIP_BUF_TYPE bftype) ++{ ++ struct sip_pkt *pkt = NULL; ++ struct list_head *bflist; ++ struct sip_hdr *chdr; ++ ++ bflist = ++ (bftype == ++ SIP_TX_CTRL_BUF) ? &sip->free_ctrl_txbuf : &sip-> ++ free_ctrl_rxbuf; ++ ++ spin_lock_bh(&sip->lock); ++ ++ if (list_empty(bflist)) { ++ spin_unlock_bh(&sip->lock); ++ return NULL; ++ } ++ ++ pkt = list_first_entry(bflist, struct sip_pkt, list); ++ list_del(&pkt->list); ++ spin_unlock_bh(&sip->lock); ++ ++ if (bftype == SIP_TX_CTRL_BUF) { ++ chdr = (struct sip_hdr *) pkt->buf_begin; ++ SIP_HDR_SET_TYPE(chdr->fc[0], SIP_CTRL); ++ pkt->buf = pkt->buf_begin + SIP_CTRL_HDR_LEN; ++ } else { ++ pkt->buf = pkt->buf_begin; ++ } ++ ++ return pkt; ++} ++ ++static void ++sip_reclaim_ctrl_buf(struct esp_sip *sip, struct sip_pkt *pkt, ++ SIP_BUF_TYPE bftype) ++{ ++ struct list_head *bflist = NULL; ++ ++ if (bftype == SIP_TX_CTRL_BUF) ++ bflist = &sip->free_ctrl_txbuf; ++ else if (bftype == SIP_RX_CTRL_BUF) ++ bflist = &sip->free_ctrl_rxbuf; ++ else ++ return; ++ ++ pkt->buf = pkt->buf_begin; ++ ++ spin_lock_bh(&sip->lock); ++ list_add_tail(&pkt->list, bflist); ++ spin_unlock_bh(&sip->lock); ++} ++ ++int sip_poll_bootup_event(struct esp_sip *sip) ++{ ++ int ret = 0; ++ ++ esp_dbg(ESP_DBG_TRACE, "polling bootup event... \n"); ++ ++ if (gl_bootup_cplx) ++ ret = wait_for_completion_timeout(gl_bootup_cplx, 2 * HZ); ++ ++ esp_dbg(ESP_DBG_TRACE, "******time remain****** = [%d]\n", ret); ++ if (ret <= 0) { ++ esp_dbg(ESP_DBG_ERROR, "bootup event timeout\n"); ++ return -ETIMEDOUT; ++ } ++ ++ if (sif_get_ate_config() == 0) { ++ ret = esp_register_mac80211(sip->epub); ++ } ++#ifdef TEST_MODE ++ ret = test_init_netlink(sip); ++ if (ret < 0) { ++ esp_sip_dbg(ESP_DBG_TRACE, ++ "esp_sdio: failed initializing netlink\n"); ++ return ret; ++ } ++#endif ++ ++ atomic_set(&sip->state, SIP_RUN); ++ esp_dbg(ESP_DBG_TRACE, "target booted up\n"); ++ ++ return ret; ++} ++ ++int sip_poll_resetting_event(struct esp_sip *sip) ++{ ++ int ret = 0; ++ ++ esp_dbg(ESP_DBG_TRACE, "polling resetting event... \n"); ++ ++ if (gl_bootup_cplx) ++ ret = wait_for_completion_timeout(gl_bootup_cplx, 10 * HZ); ++ ++ esp_dbg(ESP_DBG_TRACE, "******time remain****** = [%d]\n", ret); ++ if (ret <= 0) { ++ esp_dbg(ESP_DBG_ERROR, "resetting event timeout\n"); ++ return -ETIMEDOUT; ++ } ++ ++ esp_dbg(ESP_DBG_TRACE, "target resetting %d %p\n", ret, ++ gl_bootup_cplx); ++ ++ return 0; ++} ++ ++ ++#ifdef FPGA_DEBUG ++ ++/* bogus bootup cmd for FPGA debugging */ ++int sip_send_bootup(struct esp_sip *sip) ++{ ++ int ret; ++ struct sip_cmd_bootup bootcmd; ++ ++ esp_dbg(ESP_DBG_LOG, "sending bootup\n"); ++ ++ bootcmd.boot_addr = 0; ++ ret = ++ sip_send_cmd(sip, SIP_CMD_BOOTUP, ++ sizeof(struct sip_cmd_bootup), &bootcmd); ++ ++ return ret; ++} ++ ++#endif /* FPGA_DEBUG */ ++ ++bool sip_queue_need_stop(struct esp_sip * sip) ++{ ++ return atomic_read(&sip->tx_data_pkt_queued) >= ++ SIP_STOP_QUEUE_THRESHOLD || (atomic_read(&sip->tx_credits) < 8 ++ && atomic_read(&sip-> ++ tx_data_pkt_queued) ++ >= ++ SIP_STOP_QUEUE_THRESHOLD / 4 * 3); ++} ++ ++bool sip_queue_may_resume(struct esp_sip * sip) ++{ ++ return atomic_read(&sip->epub->txq_stopped) ++ && !test_bit(ESP_WL_FLAG_STOP_TXQ, &sip->epub->wl.flags) ++ && ((atomic_read(&sip->tx_credits) >= 16 ++ && atomic_read(&sip->tx_data_pkt_queued) < ++ SIP_RESUME_QUEUE_THRESHOLD * 2) ++ || atomic_read(&sip->tx_data_pkt_queued) < ++ SIP_RESUME_QUEUE_THRESHOLD); ++} ++ ++int sip_cmd_enqueue(struct esp_sip *sip, struct sk_buff *skb, int prior) ++{ ++ if (!sip || !sip->epub) { ++ esp_dbg(ESP_DBG_ERROR, "func %s, sip->epub->txq is NULL\n", ++ __func__); ++ return -EINVAL; ++ } ++ ++ if (!skb) { ++ esp_dbg(ESP_DBG_ERROR, "func %s, skb is NULL\n", __func__); ++ return -EINVAL; ++ } ++ ++ if (prior == ENQUEUE_PRIOR_HEAD) ++ skb_queue_head(&sip->epub->txq, skb); ++ else ++ skb_queue_tail(&sip->epub->txq, skb); ++ ++ if (sif_get_ate_config() == 0) { ++ ieee80211_queue_work(sip->epub->hw, &sip->epub->tx_work); ++ } else { ++ queue_work(sip->epub->esp_wkq, &sip->epub->tx_work); ++ } ++ return 0; ++} ++ ++void sip_tx_data_pkt_enqueue(struct esp_pub *epub, struct sk_buff *skb) ++{ ++ if (!epub || !epub->sip) { ++ if (!epub) ++ esp_dbg(ESP_DBG_ERROR, "func %s, epub is NULL\n", ++ __func__); ++ else ++ esp_dbg(ESP_DBG_ERROR, ++ "func %s, epub->sip is NULL\n", __func__); ++ ++ return; ++ } ++ if (!skb) { ++ esp_dbg(ESP_DBG_ERROR, "func %s, skb is NULL\n", __func__); ++ return; ++ } ++ skb_queue_tail(&epub->txq, skb); ++ atomic_inc(&epub->sip->tx_data_pkt_queued); ++ if (sip_queue_need_stop(epub->sip)) { ++ if (epub->hw) { ++ ieee80211_stop_queues(epub->hw); ++ atomic_set(&epub->txq_stopped, true); ++ } ++ ++ } ++} ++ ++#ifdef FPGA_TXDATA ++int sip_send_tx_data(struct esp_sip *sip) ++{ ++ struct sk_buff *skb = NULL; ++ struct sip_cmd_bss_info_update *bsscmd; ++ ++ skb = ++ sip_alloc_ctrl_skbuf(epub->sip, ++ sizeof(struct sip_cmd_bss_info_update), ++ SIP_CMD_BSS_INFO_UPDATE); ++ if (!skb) ++ return -EINVAL; ++ ++ bsscmd = ++ (struct sip_cmd_bss_info_update *) (skb->data + ++ sizeof(struct ++ sip_tx_info)); ++ bsscmd->isassoc = (assoc == true) ? 1 : 0; ++ memcpy(bsscmd->bssid, bssid, ETH_ALEN); ++ STRACE_SHOW(epub->sip); ++ return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL); ++} ++#endif /* FPGA_TXDATA */ +diff --git a/drivers/net/wireless/esp8089/esp_sip.h b/drivers/net/wireless/esp8089/esp_sip.h +new file mode 100644 +index 000000000000..95cc42989b2c +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_sip.h +@@ -0,0 +1,171 @@ ++/* ++ * Copyright (c) 2009- 2014 Espressif System. ++ * ++ * Serial Interconnctor Protocol ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_SIP_H ++#define _ESP_SIP_H ++ ++#include "sip2_common.h" ++ ++#define SIP_CTRL_CREDIT_RESERVE 2 ++ ++#define SIP_PKT_MAX_LEN (1024*16) ++ ++/* 16KB on normal X86 system, should check before porting to orhters */ ++ ++#define SIP_TX_AGGR_BUF_SIZE (4 * PAGE_SIZE) ++#define SIP_RX_AGGR_BUF_SIZE (4 * PAGE_SIZE) ++ ++struct sk_buff; ++ ++struct sip_pkt { ++ struct list_head list; ++ ++ u8 *buf_begin; ++ u32 buf_len; ++ u8 *buf; ++}; ++ ++typedef enum RECALC_CREDIT_STATE { ++ RECALC_CREDIT_DISABLE = 0, ++ RECALC_CREDIT_ENABLE = 1, ++} RECALC_CREDIT_STATE; ++ ++typedef enum ENQUEUE_PRIOR { ++ ENQUEUE_PRIOR_TAIL = 0, ++ ENQUEUE_PRIOR_HEAD, ++} ENQUEUE_PRIOR; ++ ++typedef enum SIP_STATE { ++ SIP_INIT = 0, ++ SIP_PREPARE_BOOT, ++ SIP_BOOT, ++ SIP_SEND_INIT, ++ SIP_WAIT_BOOTUP, ++ SIP_RUN, ++ SIP_SUSPEND, ++ SIP_STOP ++} SIP_STATE; ++ ++enum sip_notifier { ++ SIP_TX_DONE = 1, ++ SIP_RX_DONE = 2, ++}; ++ ++#define SIP_CREDITS_LOW_THRESHOLD 64 //i.e. 4k ++ ++struct esp_sip { ++ struct list_head free_ctrl_txbuf; ++ struct list_head free_ctrl_rxbuf; ++ ++ u32 rxseq; /* sip pkt seq, should match target side */ ++ u32 txseq; ++ u32 txdataseq; ++ ++ u8 to_host_seq; ++ ++ atomic_t state; ++ spinlock_t lock; ++ atomic_t tx_credits; ++ ++ atomic_t tx_ask_credit_update; ++ ++ u8 *rawbuf; /* used in boot stage, free once chip is fully up */ ++ u8 *tx_aggr_buf; ++ u8 *tx_aggr_write_ptr; /* update after insertion of each pkt */ ++ u8 *tx_aggr_lastpkt_ptr; ++ ++ struct mutex rx_mtx; ++ struct sk_buff_head rxq; ++ struct work_struct rx_process_work; ++ ++ u16 tx_blksz; ++ u16 rx_blksz; ++ ++ bool dump_rpbm_err; ++ bool sendup_rpbm_pkt; ++ bool rxabort_fixed; ++ bool support_bgscan; ++ u8 credit_to_reserve; ++ ++ atomic_t credit_status; ++ struct timer_list credit_timer; ++ ++ atomic_t noise_floor; ++ ++ u32 tx_tot_len; /* total len for one transaction */ ++ u32 rx_tot_len; ++ ++ atomic_t rx_handling; ++ atomic_t tx_data_pkt_queued; ++ ++ atomic_t data_tx_stopped; ++ atomic_t tx_stopped; ++ ++ struct esp_pub *epub; ++}; ++ ++int sip_rx(struct esp_pub *epub); ++//int sip_download_fw(struct esp_sip *sip, u32 load_addr, u32 boot_addr); ++ ++ ++int sip_write_memory(struct esp_sip *, u32 addr, u8 * buf, u16 len); ++ ++void sip_credit_process(struct esp_pub *, u8 credits); ++ ++int sip_send_cmd(struct esp_sip *sip, int cid, u32 cmdlen, void *cmd); ++ ++struct esp_sip *sip_attach(struct esp_pub *); ++ ++int sip_post_init(struct esp_sip *sip, struct sip_evt_bootup2 *bevt); ++ ++void sip_detach(struct esp_sip *sip); ++ ++void sip_txq_process(struct esp_pub *epub); ++ ++struct sk_buff *sip_alloc_ctrl_skbuf(struct esp_sip *sip, u16 len, ++ u32 cid); ++ ++void sip_free_ctrl_skbuff(struct esp_sip *sip, struct sk_buff *skb); ++ ++bool sip_queue_need_stop(struct esp_sip *sip); ++bool sip_queue_may_resume(struct esp_sip *sip); ++bool sip_tx_data_need_stop(struct esp_sip *sip); ++bool sip_tx_data_may_resume(struct esp_sip *sip); ++ ++void sip_tx_data_pkt_enqueue(struct esp_pub *epub, struct sk_buff *skb); ++void sip_rx_data_pkt_enqueue(struct esp_pub *epub, struct sk_buff *skb); ++ ++int sip_cmd_enqueue(struct esp_sip *sip, struct sk_buff *skb, int prior); ++ ++int sip_poll_bootup_event(struct esp_sip *sip); ++ ++int sip_poll_resetting_event(struct esp_sip *sip); ++ ++void sip_trigger_txq_process(struct esp_sip *sip); ++ ++void sip_send_chip_init(struct esp_sip *sip); ++ ++bool mod_support_no_txampdu(void); ++ ++bool mod_support_no_rxampdu(void); ++ ++void mod_support_no_txampdu_set(bool value); ++ ++#ifdef FPGA_DEBUG ++int sip_send_bootup(struct esp_sip *sip); ++#endif /* FPGA_DEBUG */ ++void sip_debug_show(struct esp_sip *sip); ++#endif +diff --git a/drivers/net/wireless/esp8089/esp_utils.c b/drivers/net/wireless/esp8089/esp_utils.c +new file mode 100644 +index 000000000000..8b188de79b2c +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_utils.c +@@ -0,0 +1,262 @@ ++/* ++ * Copyright (c) 2009 - 2014 Espressif System. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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/types.h" ++#include "linux/kernel.h" ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include "esp_pub.h" ++#include "esp_utils.h" ++#include "esp_wmac.h" ++#include "esp_debug.h" ++ ++/* ++ * Convert IEEE channel number to MHz frequency. ++ */ ++u32 esp_ieee2mhz(u8 chan) ++{ ++ if (chan == 14) ++ return 2484; ++ ++ if (chan < 14) ++ return 2407 + chan * 5; ++ else ++ return 2512 + ((chan - 15) * 20); ++ //TODO, add 5GHz ++} ++ ++enum { ++ ESP_RATE_1_LONG = 0x0, ++ ESP_RATE_2_LONG = 0x1, ++ ESP_RATE_2_SHORT = 0x5, ++ ESP_RATE_5_SHORT = 0x6, ++ ESP_RATE_5_LONG = 0x2, ++ ESP_RATE_11_SHORT = 0x7, ++ ESP_RATE_11_LONG = 0x3, ++ ESP_RATE_6 = 0xb, ++ ESP_RATE_9 = 0xf, ++ ESP_RATE_12 = 0xa, ++ ESP_RATE_18 = 0xe, ++ ESP_RATE_24 = 0x9, ++ ESP_RATE_36 = 0xd, ++ ESP_RATE_48 = 0x8, ++ ESP_RATE_54 = 0xc, ++ /* ESP_RATE_MCS0 =0x10, ++ ESP_RATE_MCS1 =0x11, ++ ESP_RATE_MCS2 =0x12, ++ ESP_RATE_MCS3 =0x13, ++ ESP_RATE_MCS4 =0x14, ++ ESP_RATE_MCS5 =0x15, ++ ESP_RATE_MCS6 =0x16, ++ ESP_RATE_MCS7 =0x17, ++ */ ++}; ++ ++static u8 esp_rate_table[20] = { ++ ESP_RATE_1_LONG, ++ ESP_RATE_2_SHORT, ++ ESP_RATE_5_SHORT, ++ ESP_RATE_11_SHORT, ++ ESP_RATE_6, ++ ESP_RATE_9, ++ ESP_RATE_12, ++ ESP_RATE_18, ++ ESP_RATE_24, ++ ESP_RATE_36, ++ ESP_RATE_48, ++ ESP_RATE_54, ++ /* ESP_RATE_MCS0, ++ ESP_RATE_MCS1, ++ ESP_RATE_MCS2, ++ ESP_RATE_MCS3, ++ ESP_RATE_MCS4, ++ ESP_RATE_MCS5, ++ ESP_RATE_MCS6, ++ ESP_RATE_MCS7, ++ */ ++}; ++ ++s8 esp_wmac_rate2idx(u8 rate) ++{ ++ int i; ++ ++ if (rate == ESP_RATE_2_LONG) ++ return 1; ++ if (rate == ESP_RATE_5_LONG) ++ return 2; ++ if (rate == ESP_RATE_11_LONG) ++ return 3; ++ ++ for (i = 0; i < 20; i++) { ++ if (rate == esp_rate_table[i]) ++ return i; ++ } ++ ++ esp_dbg(ESP_DBG_ERROR, "%s unknown rate 0x%02x \n", __func__, ++ rate); ++ ++ return 0; ++} ++ ++bool esp_wmac_rxsec_error(u8 error) ++{ ++ return (error >= RX_SECOV_ERR && error <= RX_SECFIFO_TIMEOUT) ++ || (error >= RX_WEPICV_ERR && error <= RX_WAPIMIC_ERR); ++} ++ ++int esp_cipher2alg(int cipher) ++{ ++ if (cipher == WLAN_CIPHER_SUITE_TKIP) ++ return ALG_TKIP; ++ ++ if (cipher == WLAN_CIPHER_SUITE_CCMP) ++ return ALG_CCMP; ++ ++ if (cipher == WLAN_CIPHER_SUITE_WEP40 ++ || cipher == WLAN_CIPHER_SUITE_WEP104) ++ return ALG_WEP; ++ ++ if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) ++ return ALG_AES_CMAC; ++ ++ //printk("%s wrong cipher 0x%x!\n",__func__,cipher); ++ ++ return -1; ++} ++ ++#ifdef RX_CHECKSUM_TEST ++atomic_t g_iv_len; ++void esp_rx_checksum_test(struct sk_buff *skb) ++{ ++ static u32 ip_err = 0; ++ static u32 tcp_err = 0; ++ struct ieee80211_hdr *pwh = (struct ieee80211_hdr *) skb->data; ++ int hdrlen = ieee80211_hdrlen(pwh->frame_control); ++ ++ if (ieee80211_has_protected(pwh->frame_control)) ++ hdrlen += atomic_read(&g_iv_len); ++ ++ if (ieee80211_is_data(pwh->frame_control)) { ++ struct llc_snap_hdr *llc = ++ (struct llc_snap_hdr *) (skb->data + hdrlen); ++ if (ntohs(llc->eth_type) == ETH_P_IP) { ++ int llclen = sizeof(struct llc_snap_hdr); ++ struct iphdr *iph = ++ (struct iphdr *) (skb->data + hdrlen + llclen); ++ __sum16 csum_bak = iph->check; ++ ++ iph->check = 0; ++ iph->check = ip_fast_csum(iph, iph->ihl); ++ if (iph->check != csum_bak) { ++ esp_dbg(ESP_DBG_ERROR, ++ "total ip checksum error %d\n", ++ ++ip_err); ++ } ++ iph->check = csum_bak; ++ ++ if (iph->protocol == 0x06) { ++ struct tcphdr *tcph = ++ (struct tcphdr *) (skb->data + hdrlen + ++ llclen + ++ iph->ihl * 4); ++ int datalen = ++ skb->len - (hdrlen + llclen + ++ iph->ihl * 4); ++ csum_bak = tcph->check; ++ ++ tcph->check = 0; ++ tcph->check = ++ tcp_v4_check(datalen, iph->saddr, ++ iph->daddr, ++ csum_partial((char *) ++ tcph, ++ datalen, 0)); ++ if (tcph->check != csum_bak) { ++ esp_dbg(ESP_DBG_ERROR, ++ "total tcp checksum error %d\n", ++ ++tcp_err); ++ } ++ tcph->check = csum_bak; ++ } ++ } ++ } ++} ++ ++#endif ++ ++#ifdef GEN_ERR_CHECKSUM ++ ++void esp_gen_err_checksum(struct sk_buff *skb) ++{ ++ static u32 tx_seq = 0; ++ if ((tx_seq++ % 16) == 0) { ++ struct ieee80211_hdr *hdr = ++ (struct ieee80211_hdr *) skb->data; ++ int hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ ++ if (ieee80211_has_protected(pwh->frame_control)) ++ hdrlen += ++ IEEE80211_SKB_CB(skb)->control.hw_key->iv_len; ++ ++ struct llc_snap_hdr *llc = ++ (struct llc_snap_hdr *) (skb->data + hdrlen); ++ if (ntohs(llc->eth_type) == ETH_P_IP) { ++ int llclen = sizeof(struct llc_snap_hdr); ++ struct iphdr *iph = ++ (struct iphdr *) (skb->data + hdrlen + llclen); ++ ++ iph->check = ~iph->check; ++ ++ if (iph->protocol == 0x06) { ++ struct tcphdr *tcph = ++ (struct tcphdr *) (skb->data + hdrlen + ++ llclen + ++ iph->ihl * 4); ++ tcph->check = ~tcph->check; ++ } ++ } ++ } ++} ++#endif ++ ++bool esp_is_ip_pkt(struct sk_buff *skb) ++{ ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; ++ int hdrlen; ++ struct llc_snap_hdr *llc; ++ ++ if (!ieee80211_is_data(hdr->frame_control)) ++ return false; ++ ++ hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ if (ieee80211_has_protected(hdr->frame_control)) ++ hdrlen += IEEE80211_SKB_CB(skb)->control.hw_key->iv_len; ++#ifdef RX_CHECKSUM_TEST ++ atomic_set(&g_iv_len, ++ IEEE80211_SKB_CB(skb)->control.hw_key->iv_len); ++#endif ++ if (skb->len < hdrlen + sizeof(struct llc_snap_hdr)) ++ return false; ++ llc = (struct llc_snap_hdr *) (skb->data + hdrlen); ++ if (ntohs(llc->eth_type) != ETH_P_IP) ++ return false; ++ else ++ return true; ++} +diff --git a/drivers/net/wireless/esp8089/esp_utils.h b/drivers/net/wireless/esp8089/esp_utils.h +new file mode 100644 +index 000000000000..ed16d9ca0a65 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_utils.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2011-2012 Espressif System. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_UTILS_H_ ++#define _ESP_UTILS_H_ ++ ++#include "linux/types.h" ++#include ++ ++#ifndef BIT ++#define BIT(x) (0x1 << (x)) ++#endif ++ ++u32 esp_ieee2mhz(u8 chan); ++ ++enum ieee80211_key_alg { ++ ALG_WEP, ++ ALG_TKIP, ++ ALG_CCMP, ++ ALG_AES_CMAC ++}; ++ ++int esp_cipher2alg(int cipher); ++ ++void esp_rx_checksum_test(struct sk_buff *skb); ++void esp_gen_err_checksum(struct sk_buff *skb); ++ ++bool esp_is_ip_pkt(struct sk_buff *skb); ++ ++#endif +diff --git a/drivers/net/wireless/esp8089/esp_version.h b/drivers/net/wireless/esp8089/esp_version.h +new file mode 100644 +index 000000000000..481d98841fc2 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_version.h +@@ -0,0 +1 @@ ++#define DRIVER_VER 0xbdf5087c3debll +diff --git a/drivers/net/wireless/esp8089/esp_wl.h b/drivers/net/wireless/esp8089/esp_wl.h +new file mode 100644 +index 000000000000..e3e62a83d505 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_wl.h +@@ -0,0 +1,63 @@ ++#ifndef _ESP_WL_H_ ++#define _ESP_WL_H_ ++ ++//#define MAX_PROBED_SSID_INDEX 9 ++ ++ ++enum { ++ CONF_HW_BIT_RATE_1MBPS = BIT(0), ++ CONF_HW_BIT_RATE_2MBPS = BIT(1), ++ CONF_HW_BIT_RATE_5_5MBPS = BIT(2), ++ CONF_HW_BIT_RATE_11MBPS = BIT(3), ++ CONF_HW_BIT_RATE_6MBPS = BIT(4), ++ CONF_HW_BIT_RATE_9MBPS = BIT(5), ++ CONF_HW_BIT_RATE_12MBPS = BIT(6), ++ CONF_HW_BIT_RATE_18MBPS = BIT(7), ++ CONF_HW_BIT_RATE_22MBPS = BIT(8), ++ CONF_HW_BIT_RATE_24MBPS = BIT(9), ++ CONF_HW_BIT_RATE_36MBPS = BIT(10), ++ CONF_HW_BIT_RATE_48MBPS = BIT(11), ++ CONF_HW_BIT_RATE_54MBPS = BIT(12), ++ CONF_HW_BIT_RATE_11B_MASK = ++ (CONF_HW_BIT_RATE_1MBPS | CONF_HW_BIT_RATE_2MBPS | ++ CONF_HW_BIT_RATE_5_5MBPS | CONF_HW_BIT_RATE_11MBPS), ++}; ++ ++#if 0 ++enum { ++ CONF_HW_RATE_INDEX_1MBPS = 0, ++ CONF_HW_RATE_INDEX_2MBPS = 1, ++ CONF_HW_RATE_INDEX_5_5MBPS = 2, ++ CONF_HW_RATE_INDEX_6MBPS = 3, ++ CONF_HW_RATE_INDEX_9MBPS = 4, ++ CONF_HW_RATE_INDEX_11MBPS = 5, ++ CONF_HW_RATE_INDEX_12MBPS = 6, ++ CONF_HW_RATE_INDEX_18MBPS = 7, ++ CONF_HW_RATE_INDEX_22MBPS = 8, ++ CONF_HW_RATE_INDEX_24MBPS = 9, ++ CONF_HW_RATE_INDEX_36MBPS = 10, ++ CONF_HW_RATE_INDEX_48MBPS = 11, ++ CONF_HW_RATE_INDEX_54MBPS = 12, ++ CONF_HW_RATE_INDEX_MAX, ++}; ++ ++enum { ++ CONF_HW_RXTX_RATE_54 = 0, ++ CONF_HW_RXTX_RATE_48, ++ CONF_HW_RXTX_RATE_36, ++ CONF_HW_RXTX_RATE_24, ++ CONF_HW_RXTX_RATE_22, ++ CONF_HW_RXTX_RATE_18, ++ CONF_HW_RXTX_RATE_12, ++ CONF_HW_RXTX_RATE_11, ++ CONF_HW_RXTX_RATE_9, ++ CONF_HW_RXTX_RATE_6, ++ CONF_HW_RXTX_RATE_5_5, ++ CONF_HW_RXTX_RATE_2, ++ CONF_HW_RXTX_RATE_1, ++ CONF_HW_RXTX_RATE_MAX, ++ CONF_HW_RXTX_RATE_UNSUPPORTED = 0xff ++}; ++#endif ++ ++#endif /* _ESP_WL_H_ */ +diff --git a/drivers/net/wireless/esp8089/esp_wmac.h b/drivers/net/wireless/esp8089/esp_wmac.h +new file mode 100644 +index 000000000000..72d13cbfc0e5 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/esp_wmac.h +@@ -0,0 +1,92 @@ ++/* ++ * Copyright (c) 2011-2012 Espressif System. ++ * ++ * MAC header ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _ESP_WMAC_H_ ++#define _ESP_WMAC_H_ ++ ++struct esp_mac_rx_ctrl { ++ signed rssi:8; ++ unsigned rate:4; ++ unsigned is_group:1; ++ unsigned:1; ++ unsigned sig_mode:2; ++ unsigned legacy_length:12; ++ unsigned damatch0:1; ++ unsigned damatch1:1; ++ unsigned bssidmatch0:1; ++ unsigned bssidmatch1:1; ++ unsigned MCS:7; ++ unsigned CWB:1; ++ unsigned HT_length:16; ++ unsigned Smoothing:1; ++ unsigned Not_Sounding:1; ++ unsigned:1; ++ unsigned Aggregation:1; ++ unsigned STBC:2; ++ unsigned FEC_CODING:1; ++ unsigned SGI:1; ++ unsigned rxend_state:8; ++ unsigned ampdu_cnt:8; ++ unsigned channel:4; ++ unsigned:4; ++ signed noise_floor:8; ++}; ++ ++struct esp_rx_ampdu_len { ++ unsigned substate:8; ++ unsigned sublen:12; ++ unsigned:12; ++}; ++ ++struct esp_tx_ampdu_entry { ++ u32 sub_len:12, dili_num:7,:1, null_byte:2, data:1, enc:1, seq:8; ++}; ++ ++//rxend_state flags ++#define RX_PYH_ERR_MIN 0x42 ++#define RX_AGC_ERR_MIN 0x42 ++#define RX_AGC_ERR_MAX 0x47 ++#define RX_OFDM_ERR_MIN 0x50 ++#define RX_OFDM_ERR_MAX 0x58 ++#define RX_CCK_ERR_MIN 0x59 ++#define RX_CCK_ERR_MAX 0x5F ++#define RX_ABORT 0x80 ++#define RX_SF_ERR 0x40 ++#define RX_FCS_ERR 0x41 ++#define RX_AHBOV_ERR 0xC0 ++#define RX_BUFOV_ERR 0xC1 ++#define RX_BUFINV_ERR 0xC2 ++#define RX_AMPDUSF_ERR 0xC3 ++#define RX_AMPDUBUFOV_ERR 0xC4 ++#define RX_MACBBFIFOOV_ERR 0xC5 ++#define RX_RPBM_ERR 0xC6 ++#define RX_BTFORCE_ERR 0xC7 ++#define RX_SECOV_ERR 0xE1 ++#define RX_SECPROT_ERR0 0xE2 ++#define RX_SECPROT_ERR1 0xE3 ++#define RX_SECKEY_ERR 0xE4 ++#define RX_SECCRLEN_ERR 0xE5 ++#define RX_SECFIFO_TIMEOUT 0xE6 ++#define RX_WEPICV_ERR 0xF0 ++#define RX_TKIPICV_ERR 0xF4 ++#define RX_TKIPMIC_ERR 0xF5 ++#define RX_CCMPMIC_ERR 0xF8 ++#define RX_WAPIMIC_ERR 0xFC ++ ++s8 esp_wmac_rate2idx(u8 rate); ++bool esp_wmac_rxsec_error(u8 error); ++ ++#endif /* _ESP_WMAC_H_ */ +diff --git a/drivers/net/wireless/esp8089/firmware/LICENSE-2.0.txt b/drivers/net/wireless/esp8089/firmware/LICENSE-2.0.txt +new file mode 100644 +index 000000000000..0dd35c82a001 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/firmware/LICENSE-2.0.txt +@@ -0,0 +1,203 @@ ++The esp8089 firmware files are licensed under the Apache License, Version 2.0: ++ ++ Apache License ++ Version 2.0, January 2004 ++ http://www.apache.org/licenses/ ++ ++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION ++ ++ 1. Definitions. ++ ++ "License" shall mean the terms and conditions for use, reproduction, ++ and distribution as defined by Sections 1 through 9 of this document. ++ ++ "Licensor" shall mean the copyright owner or entity authorized by ++ the copyright owner that is granting the License. ++ ++ "Legal Entity" shall mean the union of the acting entity and all ++ other entities that control, are controlled by, or are under common ++ control with that entity. For the purposes of this definition, ++ "control" means (i) the power, direct or indirect, to cause the ++ direction or management of such entity, whether by contract or ++ otherwise, or (ii) ownership of fifty percent (50%) or more of the ++ outstanding shares, or (iii) beneficial ownership of such entity. ++ ++ "You" (or "Your") shall mean an individual or Legal Entity ++ exercising permissions granted by this License. ++ ++ "Source" form shall mean the preferred form for making modifications, ++ including but not limited to software source code, documentation ++ source, and configuration files. ++ ++ "Object" form shall mean any form resulting from mechanical ++ transformation or translation of a Source form, including but ++ not limited to compiled object code, generated documentation, ++ and conversions to other media types. ++ ++ "Work" shall mean the work of authorship, whether in Source or ++ Object form, made available under the License, as indicated by a ++ copyright notice that is included in or attached to the work ++ (an example is provided in the Appendix below). ++ ++ "Derivative Works" shall mean any work, whether in Source or Object ++ form, that is based on (or derived from) the Work and for which the ++ editorial revisions, annotations, elaborations, or other modifications ++ represent, as a whole, an original work of authorship. For the purposes ++ of this License, Derivative Works shall not include works that remain ++ separable from, or merely link (or bind by name) to the interfaces of, ++ the Work and Derivative Works thereof. ++ ++ "Contribution" shall mean any work of authorship, including ++ the original version of the Work and any modifications or additions ++ to that Work or Derivative Works thereof, that is intentionally ++ submitted to Licensor for inclusion in the Work by the copyright owner ++ or by an individual or Legal Entity authorized to submit on behalf of ++ the copyright owner. For the purposes of this definition, "submitted" ++ means any form of electronic, verbal, or written communication sent ++ to the Licensor or its representatives, including but not limited to ++ communication on electronic mailing lists, source code control systems, ++ and issue tracking systems that are managed by, or on behalf of, the ++ Licensor for the purpose of discussing and improving the Work, but ++ excluding communication that is conspicuously marked or otherwise ++ designated in writing by the copyright owner as "Not a Contribution." ++ ++ "Contributor" shall mean Licensor and any individual or Legal Entity ++ on behalf of whom a Contribution has been received by Licensor and ++ subsequently incorporated within the Work. ++ ++ 2. Grant of Copyright License. Subject to the terms and conditions of ++ this License, each Contributor hereby grants to You a perpetual, ++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable ++ copyright license to reproduce, prepare Derivative Works of, ++ publicly display, publicly perform, sublicense, and distribute the ++ Work and such Derivative Works in Source or Object form. ++ ++ 3. Grant of Patent License. Subject to the terms and conditions of ++ this License, each Contributor hereby grants to You a perpetual, ++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable ++ (except as stated in this section) patent license to make, have made, ++ use, offer to sell, sell, import, and otherwise transfer the Work, ++ where such license applies only to those patent claims licensable ++ by such Contributor that are necessarily infringed by their ++ Contribution(s) alone or by combination of their Contribution(s) ++ with the Work to which such Contribution(s) was submitted. If You ++ institute patent litigation against any entity (including a ++ cross-claim or counterclaim in a lawsuit) alleging that the Work ++ or a Contribution incorporated within the Work constitutes direct ++ or contributory patent infringement, then any patent licenses ++ granted to You under this License for that Work shall terminate ++ as of the date such litigation is filed. ++ ++ 4. Redistribution. You may reproduce and distribute copies of the ++ Work or Derivative Works thereof in any medium, with or without ++ modifications, and in Source or Object form, provided that You ++ meet the following conditions: ++ ++ (a) You must give any other recipients of the Work or ++ Derivative Works a copy of this License; and ++ ++ (b) You must cause any modified files to carry prominent notices ++ stating that You changed the files; and ++ ++ (c) You must retain, in the Source form of any Derivative Works ++ that You distribute, all copyright, patent, trademark, and ++ attribution notices from the Source form of the Work, ++ excluding those notices that do not pertain to any part of ++ the Derivative Works; and ++ ++ (d) If the Work includes a "NOTICE" text file as part of its ++ distribution, then any Derivative Works that You distribute must ++ include a readable copy of the attribution notices contained ++ within such NOTICE file, excluding those notices that do not ++ pertain to any part of the Derivative Works, in at least one ++ of the following places: within a NOTICE text file distributed ++ as part of the Derivative Works; within the Source form or ++ documentation, if provided along with the Derivative Works; or, ++ within a display generated by the Derivative Works, if and ++ wherever such third-party notices normally appear. The contents ++ of the NOTICE file are for informational purposes only and ++ do not modify the License. You may add Your own attribution ++ notices within Derivative Works that You distribute, alongside ++ or as an addendum to the NOTICE text from the Work, provided ++ that such additional attribution notices cannot be construed ++ as modifying the License. ++ ++ You may add Your own copyright statement to Your modifications and ++ may provide additional or different license terms and conditions ++ for use, reproduction, or distribution of Your modifications, or ++ for any such Derivative Works as a whole, provided Your use, ++ reproduction, and distribution of the Work otherwise complies with ++ the conditions stated in this License. ++ ++ 5. Submission of Contributions. Unless You explicitly state otherwise, ++ any Contribution intentionally submitted for inclusion in the Work ++ by You to the Licensor shall be under the terms and conditions of ++ this License, without any additional terms or conditions. ++ Notwithstanding the above, nothing herein shall supersede or modify ++ the terms of any separate license agreement you may have executed ++ with Licensor regarding such Contributions. ++ ++ 6. Trademarks. This License does not grant permission to use the trade ++ names, trademarks, service marks, or product names of the Licensor, ++ except as required for reasonable and customary use in describing the ++ origin of the Work and reproducing the content of the NOTICE file. ++ ++ 7. Disclaimer of Warranty. Unless required by applicable law or ++ agreed to in writing, Licensor provides the Work (and each ++ Contributor provides its Contributions) on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ++ implied, including, without limitation, any warranties or conditions ++ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A ++ PARTICULAR PURPOSE. You are solely responsible for determining the ++ appropriateness of using or redistributing the Work and assume any ++ risks associated with Your exercise of permissions under this License. ++ ++ 8. Limitation of Liability. In no event and under no legal theory, ++ whether in tort (including negligence), contract, or otherwise, ++ unless required by applicable law (such as deliberate and grossly ++ negligent acts) or agreed to in writing, shall any Contributor be ++ liable to You for damages, including any direct, indirect, special, ++ incidental, or consequential damages of any character arising as a ++ result of this License or out of the use or inability to use the ++ Work (including but not limited to damages for loss of goodwill, ++ work stoppage, computer failure or malfunction, or any and all ++ other commercial damages or losses), even if such Contributor ++ has been advised of the possibility of such damages. ++ ++ 9. Accepting Warranty or Additional Liability. While redistributing ++ the Work or Derivative Works thereof, You may choose to offer, ++ and charge a fee for, acceptance of support, warranty, indemnity, ++ or other liability obligations and/or rights consistent with this ++ License. However, in accepting such obligations, You may act only ++ on Your own behalf and on Your sole responsibility, not on behalf ++ of any other Contributor, and only if You agree to indemnify, ++ defend, and hold each Contributor harmless for any liability ++ incurred by, or claims asserted against, such Contributor by reason ++ of your accepting any such warranty or additional liability. ++ ++ END OF TERMS AND CONDITIONS ++ ++ APPENDIX: How to apply the Apache License to your work. ++ ++ To apply the Apache License to your work, attach the following ++ boilerplate notice, with the fields enclosed by brackets "[]" ++ replaced with your own identifying information. (Don't include ++ the brackets!) The text should be enclosed in the appropriate ++ comment syntax for the file format. We also recommend that a ++ file or class name and description of purpose be included on the ++ same "printed page" as the copyright notice for easier ++ identification within third-party archives. ++ ++ Copyright [yyyy] [name of copyright owner] ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. +diff --git a/drivers/net/wireless/esp8089/sdio_sif_esp.c b/drivers/net/wireless/esp8089/sdio_sif_esp.c +new file mode 100644 +index 000000000000..2bd2c63f5388 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/sdio_sif_esp.c +@@ -0,0 +1,824 @@ ++/* ++ * Copyright (c) 2010 -2013 Espressif System. ++ * ++ * sdio serial i/f driver ++ * - sdio device control routines ++ * - sync/async DMA/PIO read/write ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "esp_pub.h" ++#include "esp_sif.h" ++#include "esp_sip.h" ++#include "esp_debug.h" ++#include "slc_host_register.h" ++#include "esp_version.h" ++#include "esp_ctrl.h" ++#include "esp_file.h" ++#ifdef USE_EXT_GPIO ++#include "esp_ext.h" ++#endif /* USE_EXT_GPIO */ ++ ++#define MANUFACTURER_ID_EAGLE_BASE 0x1110 ++#define MANUFACTURER_ID_EAGLE_BASE_MASK 0xFF00 ++#define MANUFACTURER_CODE 0x6666 ++ ++static const struct sdio_device_id esp_sdio_devices[] = { ++ {SDIO_DEVICE ++ (MANUFACTURER_CODE, (MANUFACTURER_ID_EAGLE_BASE | 0x1))}, ++ {}, ++}; ++ ++static const struct of_device_id esp_of_match_table[] = { ++ { .compatible = "esp,esp8089", .data = NULL}, ++ { } ++}; ++ ++static int /*__init*/ esp_sdio_init(void); ++static void /*__exit*/ esp_sdio_exit(void); ++ ++ ++#define ESP_DMA_IBUFSZ 2048 ++ ++//unsigned int esp_msg_level = 0; ++unsigned int esp_msg_level = ESP_DBG_ERROR | ESP_SHOW; ++ ++struct esp_sdio_ctrl *sif_sctrl = NULL; ++ ++#ifdef ESP_ANDROID_LOGGER ++bool log_off = false; ++#endif /* ESP_ANDROID_LOGGER */ ++ ++static int esdio_power_off(struct esp_sdio_ctrl *sctrl); ++static int esdio_power_on(struct esp_sdio_ctrl *sctrl); ++ ++void sif_set_clock(struct sdio_func *func, int clk); ++ ++void sif_lock_bus(struct esp_pub *epub) ++{ ++ EPUB_FUNC_CHECK(epub, _exit); ++ ++ sdio_claim_host(EPUB_TO_FUNC(epub)); ++ _exit: ++ return; ++} ++ ++void sif_unlock_bus(struct esp_pub *epub) ++{ ++ EPUB_FUNC_CHECK(epub, _exit); ++ ++ sdio_release_host(EPUB_TO_FUNC(epub)); ++ _exit: ++ return; ++} ++ ++static inline bool bad_buf(u8 * buf) ++{ ++ return ((unsigned long) buf & 0x3) || !virt_addr_valid(buf); ++} ++ ++u8 sdio_io_readb(struct esp_pub *epub, int addr, int *res) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ struct sdio_func *func = NULL; ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ func = sctrl->func; ++ ++ if (func->num == 0) ++ return sdio_f0_readb(func, addr, res); ++ else ++ return sdio_readb(func, addr, res); ++} ++ ++void sdio_io_writeb(struct esp_pub *epub, u8 value, int addr, int *res) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ struct sdio_func *func = NULL; ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ func = sctrl->func; ++ ++ if (func->num == 0) ++ sdio_f0_writeb(func, value, addr, res); ++ else ++ sdio_writeb(func, value, addr, res); ++} ++ ++int sif_io_raw(struct esp_pub *epub, u32 addr, u8 * buf, u32 len, u32 flag) ++{ ++ int err = 0; ++ u8 *ibuf = NULL; ++ bool need_ibuf = false; ++ struct esp_sdio_ctrl *sctrl = NULL; ++ struct sdio_func *func = NULL; ++ ++ if (epub == NULL || buf == NULL) { ++ ESSERT(0); ++ err = -EINVAL; ++ goto _exit; ++ } ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ func = sctrl->func; ++ if (func == NULL) { ++ ESSERT(0); ++ err = -EINVAL; ++ goto _exit; ++ } ++ ++ if (bad_buf(buf)) { ++ esp_dbg(ESP_DBG_TRACE, "%s dst 0x%08x, len %d badbuf\n", ++ __func__, addr, len); ++ need_ibuf = true; ++ ibuf = sctrl->dma_buffer; ++ } else { ++ ibuf = buf; ++ } ++ ++ if (flag & SIF_BLOCK_BASIS) { ++ /* round up for block data transcation */ ++ } ++ ++ if (flag & SIF_TO_DEVICE) { ++ ++ if (need_ibuf) ++ memcpy(ibuf, buf, len); ++ ++ if (flag & SIF_FIXED_ADDR) ++ err = sdio_writesb(func, addr, ibuf, len); ++ else if (flag & SIF_INC_ADDR) { ++ err = sdio_memcpy_toio(func, addr, ibuf, len); ++ } ++ } else if (flag & SIF_FROM_DEVICE) { ++ ++ if (flag & SIF_FIXED_ADDR) ++ err = sdio_readsb(func, ibuf, addr, len); ++ else if (flag & SIF_INC_ADDR) { ++ err = sdio_memcpy_fromio(func, ibuf, addr, len); ++ } ++ ++ ++ if (!err && need_ibuf) ++ memcpy(buf, ibuf, len); ++ } ++ ++ _exit: ++ return err; ++} ++ ++int sif_io_sync(struct esp_pub *epub, u32 addr, u8 * buf, u32 len, ++ u32 flag) ++{ ++ int err = 0; ++ u8 *ibuf = NULL; ++ bool need_ibuf = false; ++ struct esp_sdio_ctrl *sctrl = NULL; ++ struct sdio_func *func = NULL; ++ ++ if (epub == NULL || buf == NULL) { ++ ESSERT(0); ++ err = -EINVAL; ++ goto _exit; ++ } ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ func = sctrl->func; ++ if (func == NULL) { ++ ESSERT(0); ++ err = -EINVAL; ++ goto _exit; ++ } ++ ++ if (bad_buf(buf)) { ++ esp_dbg(ESP_DBG_TRACE, "%s dst 0x%08x, len %d badbuf\n", ++ __func__, addr, len); ++ need_ibuf = true; ++ ibuf = sctrl->dma_buffer; ++ } else { ++ ibuf = buf; ++ } ++ ++ if (flag & SIF_BLOCK_BASIS) { ++ /* round up for block data transcation */ ++ } ++ ++ if (flag & SIF_TO_DEVICE) { ++ ++ esp_dbg(ESP_DBG_TRACE, "%s to addr 0x%08x, len %d \n", ++ __func__, addr, len); ++ if (need_ibuf) ++ memcpy(ibuf, buf, len); ++ ++ sdio_claim_host(func); ++ ++ if (flag & SIF_FIXED_ADDR) ++ err = sdio_writesb(func, addr, ibuf, len); ++ else if (flag & SIF_INC_ADDR) { ++ err = sdio_memcpy_toio(func, addr, ibuf, len); ++ } ++ sdio_release_host(func); ++ } else if (flag & SIF_FROM_DEVICE) { ++ ++ esp_dbg(ESP_DBG_TRACE, "%s from addr 0x%08x, len %d \n", ++ __func__, addr, len); ++ ++ sdio_claim_host(func); ++ ++ if (flag & SIF_FIXED_ADDR) ++ err = sdio_readsb(func, ibuf, addr, len); ++ else if (flag & SIF_INC_ADDR) { ++ err = sdio_memcpy_fromio(func, ibuf, addr, len); ++ } ++ ++ sdio_release_host(func); ++ ++ if (!err && need_ibuf) ++ memcpy(buf, ibuf, len); ++ } ++ ++ _exit: ++ return err; ++} ++ ++int sif_lldesc_read_sync(struct esp_pub *epub, u8 * buf, u32 len) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ u32 read_len; ++ ++ if (epub == NULL || buf == NULL) { ++ ESSERT(0); ++ return -EINVAL; ++ } ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ ++ switch (sctrl->target_id) { ++ case 0x100: ++ read_len = len; ++ break; ++ case 0x600: ++ read_len = roundup(len, sctrl->slc_blk_sz); ++ break; ++ default: ++ read_len = len; ++ break; ++ } ++ ++ return sif_io_sync((epub), ++ (sctrl->slc_window_end_addr - 2 - (len)), (buf), ++ (read_len), ++ SIF_FROM_DEVICE | SIF_BYTE_BASIS | ++ SIF_INC_ADDR); ++} ++ ++int sif_lldesc_write_sync(struct esp_pub *epub, u8 * buf, u32 len) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ u32 write_len; ++ ++ if (epub == NULL || buf == NULL) { ++ ESSERT(0); ++ return -EINVAL; ++ } ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ ++ switch (sctrl->target_id) { ++ case 0x100: ++ write_len = len; ++ break; ++ case 0x600: ++ write_len = roundup(len, sctrl->slc_blk_sz); ++ break; ++ default: ++ write_len = len; ++ break; ++ } ++ ++ return sif_io_sync((epub), (sctrl->slc_window_end_addr - (len)), ++ (buf), (write_len), ++ SIF_TO_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR); ++} ++ ++int sif_lldesc_read_raw(struct esp_pub *epub, u8 * buf, u32 len, ++ bool noround) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ u32 read_len; ++ ++ if (epub == NULL || buf == NULL) { ++ ESSERT(0); ++ return -EINVAL; ++ } ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ ++ switch (sctrl->target_id) { ++ case 0x100: ++ read_len = len; ++ break; ++ case 0x600: ++ if (!noround) ++ read_len = roundup(len, sctrl->slc_blk_sz); ++ else ++ read_len = len; ++ break; ++ default: ++ read_len = len; ++ break; ++ } ++ ++ return sif_io_raw((epub), (sctrl->slc_window_end_addr - 2 - (len)), ++ (buf), (read_len), ++ SIF_FROM_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR); ++} ++ ++int sif_lldesc_write_raw(struct esp_pub *epub, u8 * buf, u32 len) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ u32 write_len; ++ ++ if (epub == NULL || buf == NULL) { ++ ESSERT(0); ++ return -EINVAL; ++ } ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ ++ switch (sctrl->target_id) { ++ case 0x100: ++ write_len = len; ++ break; ++ case 0x600: ++ write_len = roundup(len, sctrl->slc_blk_sz); ++ break; ++ default: ++ write_len = len; ++ break; ++ } ++ return sif_io_raw((epub), (sctrl->slc_window_end_addr - (len)), ++ (buf), (write_len), ++ SIF_TO_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR); ++ ++} ++ ++static int esdio_power_on(struct esp_sdio_ctrl *sctrl) ++{ ++ int err = 0; ++ ++ if (sctrl->off == false) ++ return err; ++ ++ sdio_claim_host(sctrl->func); ++ err = sdio_enable_func(sctrl->func); ++ ++ if (err) { ++ esp_dbg(ESP_DBG_ERROR, "Unable to enable sdio func: %d\n", ++ err); ++ sdio_release_host(sctrl->func); ++ return err; ++ } ++ ++ sdio_release_host(sctrl->func); ++ ++ /* ensure device is up */ ++ msleep(5); ++ ++ sctrl->off = false; ++ ++ return err; ++} ++ ++static int esdio_power_off(struct esp_sdio_ctrl *sctrl) ++{ ++ int err; ++ ++ if (sctrl->off) ++ return 0; ++ ++ sdio_claim_host(sctrl->func); ++ err = sdio_disable_func(sctrl->func); ++ sdio_release_host(sctrl->func); ++ ++ if (err) ++ return err; ++ ++ sctrl->off = true; ++ ++ return err; ++} ++ ++void sif_enable_irq(struct esp_pub *epub) ++{ ++ int err; ++ struct esp_sdio_ctrl *sctrl = NULL; ++ ++ sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ ++ sdio_claim_host(sctrl->func); ++ ++ err = sdio_claim_irq(sctrl->func, sif_dsr); ++ ++ if (err) ++ esp_dbg(ESP_DBG_ERROR, "sif %s failed\n", __func__); ++ ++ atomic_set(&epub->sip->state, SIP_BOOT); ++ ++ atomic_set(&sctrl->irq_installed, 1); ++ ++ sdio_release_host(sctrl->func); ++} ++ ++void sif_disable_irq(struct esp_pub *epub) ++{ ++ struct esp_sdio_ctrl *sctrl = (struct esp_sdio_ctrl *) epub->sif; ++ int i = 0; ++ ++ if (atomic_read(&sctrl->irq_installed) == 0) ++ return; ++ ++ sdio_claim_host(sctrl->func); ++ ++ while (atomic_read(&sctrl->irq_handling)) { ++ sdio_release_host(sctrl->func); ++ schedule_timeout(HZ / 100); ++ sdio_claim_host(sctrl->func); ++ if (i++ >= 400) { ++ esp_dbg(ESP_DBG_ERROR, "%s force to stop irq\n", ++ __func__); ++ break; ++ } ++ } ++ ++ /* Ignore errors, we don't always use an irq. */ ++ sdio_release_irq(sctrl->func); ++ ++ atomic_set(&sctrl->irq_installed, 0); ++ ++ sdio_release_host(sctrl->func); ++ ++} ++ ++void sif_set_clock(struct sdio_func *func, int clk) ++{ ++ struct mmc_host *host = NULL; ++ struct mmc_card *card = NULL; ++ ++ card = func->card; ++ host = card->host; ++ ++ sdio_claim_host(func); ++ ++ //currently only set clock ++ host->ios.clock = clk * 1000000; ++ ++ esp_dbg(ESP_SHOW, "%s clock is %u\n", __func__, host->ios.clock); ++ if (host->ios.clock > host->f_max) { ++ host->ios.clock = host->f_max; ++ } ++ host->ops->set_ios(host, &host->ios); ++ ++ mdelay(2); ++ ++ sdio_release_host(func); ++} ++ ++static int esp_sdio_probe(struct sdio_func *func, ++ const struct sdio_device_id *id); ++static void esp_sdio_remove(struct sdio_func *func); ++ ++static int esp_sdio_probe(struct sdio_func *func, ++ const struct sdio_device_id *id) ++{ ++ int err = 0; ++ struct esp_pub *epub = NULL; ++ struct esp_sdio_ctrl *sctrl; ++ ++ esp_dbg(ESP_DBG_TRACE, ++ "sdio_func_num: 0x%X, vendor id: 0x%X, dev id: 0x%X, block size: 0x%X/0x%X\n", ++ func->num, func->vendor, func->device, func->max_blksize, ++ func->cur_blksize); ++ ++ if (sif_sctrl == NULL) { ++ ++ esp_conf_init(&func->dev); ++ ++ esp_conf_upload_first(); ++ ++ sctrl = kzalloc(sizeof(struct esp_sdio_ctrl), GFP_KERNEL); ++ ++ if (sctrl == NULL) { ++ return -ENOMEM; ++ } ++ ++ /* temp buffer reserved for un-dma-able request */ ++ sctrl->dma_buffer = kzalloc(ESP_DMA_IBUFSZ, GFP_KERNEL); ++ ++ if (sctrl->dma_buffer == NULL) { ++ err = -ENOMEM; ++ goto _err_last; ++ } ++ sif_sctrl = sctrl; ++ sctrl->slc_blk_sz = SIF_SLC_BLOCK_SIZE; ++ ++ epub = esp_pub_alloc_mac80211(&func->dev); ++ ++ if (epub == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "no mem for epub \n"); ++ err = -ENOMEM; ++ goto _err_dma; ++ } ++ epub->sif = (void *) sctrl; ++ epub->sdio_state = ESP_SDIO_STATE_FIRST_INIT; ++ sctrl->epub = epub; ++ ++#ifdef USE_EXT_GPIO ++ if (sif_get_ate_config() == 0) { ++ err = ext_gpio_init(epub); ++ if (err) { ++ esp_dbg(ESP_DBG_ERROR, ++ "ext_irq_work_init failed %d\n", ++ err); ++ goto _err_epub; ++ } ++ } ++#endif ++ ++ } else { ++ sctrl = sif_sctrl; ++ sif_sctrl = NULL; ++ epub = sctrl->epub; ++ epub->sdio_state = ESP_SDIO_STATE_SECOND_INIT; ++ SET_IEEE80211_DEV(epub->hw, &func->dev); ++ epub->dev = &func->dev; ++ } ++ ++ sctrl->func = func; ++ sdio_set_drvdata(func, sctrl); ++ ++ sctrl->id = id; ++ sctrl->off = true; ++ ++ /* give us some time to enable, in ms */ ++ func->enable_timeout = 100; ++ ++ err = esdio_power_on(sctrl); ++ esp_dbg(ESP_DBG_TRACE, " %s >> power_on err %d \n", __func__, err); ++ ++ if (err) { ++ if (epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT) ++ goto _err_ext_gpio; ++ else ++ goto _err_second_init; ++ } ++ check_target_id(epub); ++ ++ sdio_claim_host(func); ++ ++ err = sdio_set_block_size(func, sctrl->slc_blk_sz); ++ ++ if (err) { ++ esp_dbg(ESP_DBG_ERROR, ++ "Set sdio block size %d failed: %d)\n", ++ sctrl->slc_blk_sz, err); ++ sdio_release_host(func); ++ if (epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT) ++ goto _err_off; ++ else ++ goto _err_second_init; ++ } ++ ++ sdio_release_host(func); ++ ++#ifdef LOWER_CLK ++ /* fix clock for dongle */ ++ sif_set_clock(func, 23); ++#endif //LOWER_CLK ++ ++ err = esp_pub_init_all(epub); ++ ++ if (err) { ++ esp_dbg(ESP_DBG_ERROR, "esp_init_all failed: %d\n", err); ++ if (epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT) { ++ err = 0; ++ goto _err_first_init; ++ } ++ if (epub->sdio_state == ESP_SDIO_STATE_SECOND_INIT) ++ goto _err_second_init; ++ } ++ ++ esp_dbg(ESP_DBG_TRACE, " %s return %d\n", __func__, err); ++ if (epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT) { ++ esp_dbg(ESP_DBG_TRACE, "first normal exit\n"); ++ epub->sdio_state = ESP_SDIO_STATE_FIRST_NORMAL_EXIT; ++ /* Rescan the esp8089 after loading the initial firmware */ ++ sdio_claim_host(func); ++ mmc_sw_reset(func->card); ++ sdio_release_host(func); ++ msleep(10); ++ } ++ ++ return err; ++ ++ _err_off: ++ esdio_power_off(sctrl); ++ _err_ext_gpio: ++#ifdef USE_EXT_GPIO ++ if (sif_get_ate_config() == 0) ++ ext_gpio_deinit(); ++ _err_epub: ++#endif ++ esp_pub_dealloc_mac80211(epub); ++ _err_dma: ++ kfree(sctrl->dma_buffer); ++ _err_last: ++ kfree(sctrl); ++ _err_first_init: ++ if (epub && epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT) { ++ esp_dbg(ESP_DBG_ERROR, "first error exit\n"); ++ epub->sdio_state = ESP_SDIO_STATE_FIRST_ERROR_EXIT; ++ } ++ return err; ++ _err_second_init: ++ epub->sdio_state = ESP_SDIO_STATE_SECOND_ERROR_EXIT; ++ esp_sdio_remove(func); ++ return err; ++} ++ ++static void esp_sdio_remove(struct sdio_func *func) ++{ ++ struct esp_sdio_ctrl *sctrl = NULL; ++ struct esp_pub *epub = NULL; ++ ++ esp_dbg(ESP_DBG_TRACE, "%s enter\n", __func__); ++ ++ sctrl = sdio_get_drvdata(func); ++ ++ if (sctrl == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "%s no sctrl\n", __func__); ++ return; ++ } ++ ++ do { ++ epub = sctrl->epub; ++ if (epub == NULL) { ++ esp_dbg(ESP_DBG_ERROR, "%s epub null\n", __func__); ++ break; ++ } ++ if (epub->sdio_state != ESP_SDIO_STATE_FIRST_NORMAL_EXIT) { ++ if (epub->sip) { ++ sip_detach(epub->sip); ++ epub->sip = NULL; ++ esp_dbg(ESP_DBG_TRACE, ++ "%s sip detached \n", __func__); ++ } ++#ifdef USE_EXT_GPIO ++ if (sif_get_ate_config() == 0) ++ ext_gpio_deinit(); ++#endif ++ } else { ++ //sif_disable_target_interrupt(epub); ++ atomic_set(&epub->sip->state, SIP_STOP); ++ sif_disable_irq(epub); ++ } ++ ++ if (epub->sdio_state != ESP_SDIO_STATE_FIRST_NORMAL_EXIT) { ++ esp_pub_dealloc_mac80211(epub); ++ esp_dbg(ESP_DBG_TRACE, "%s dealloc mac80211 \n", ++ __func__); ++ ++ if (sctrl->dma_buffer) { ++ kfree(sctrl->dma_buffer); ++ sctrl->dma_buffer = NULL; ++ esp_dbg(ESP_DBG_TRACE, ++ "%s free dma_buffer \n", __func__); ++ } ++ ++ kfree(sctrl); ++ } ++ ++ } while (0); ++ ++ sdio_set_drvdata(func, NULL); ++ ++ /* ++ * Reset on sdio remove to leave the hardware in cold state, ++ * so a new module insertion will be possible ++ */ ++ if (epub->sdio_state == ESP_SDIO_STATE_SECOND_INIT) { ++ sdio_claim_host(func); ++ mmc_hw_reset(func->card); ++ sdio_release_host(func); ++ mdelay(10); ++ } ++ ++ esp_dbg(ESP_DBG_TRACE, "eagle sdio remove complete\n"); ++} ++ ++static int esp_sdio_suspend(struct device *dev) ++{ ++ struct sdio_func *func = dev_to_sdio_func(dev); ++ struct esp_sdio_ctrl *sctrl = sdio_get_drvdata(func); ++ struct esp_pub *epub = sctrl->epub; ++ ++ printk("%s", __func__); ++ atomic_set(&epub->ps.state, ESP_PM_ON); ++ ++ do { ++ u32 sdio_flags = 0; ++ int ret = 0; ++ sdio_flags = sdio_get_host_pm_caps(func); ++ ++ if (!(sdio_flags & MMC_PM_KEEP_POWER)) { ++ printk ++ ("%s can't keep power while host is suspended\n", ++ __func__); ++ } ++ ++ /* keep power while host suspended */ ++ ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); ++ if (ret) { ++ printk("%s error while trying to keep power\n", ++ __func__); ++ } ++ } while (0); ++ ++ ++ return 0; ++ ++} ++ ++static int esp_sdio_resume(struct device *dev) ++{ ++ esp_dbg(ESP_DBG_ERROR, "%s", __func__); ++ ++ return 0; ++} ++ ++static const struct dev_pm_ops esp_sdio_pm_ops = { ++ .suspend = esp_sdio_suspend, ++ .resume = esp_sdio_resume, ++}; ++ ++static struct sdio_driver esp_sdio_driver = { ++ .name = "eagle_sdio", ++ .id_table = esp_sdio_devices, ++ .probe = esp_sdio_probe, ++ .remove = esp_sdio_remove, ++ .drv = { ++ .pm = &esp_sdio_pm_ops, ++ .of_match_table = esp_of_match_table, ++ }, ++}; ++ ++static int /*__init*/ esp_sdio_init(void) ++{ ++ ++ esp_debugfs_init(); ++ sdio_register_driver(&esp_sdio_driver); ++ ++ msleep(1000); ++ ++ sdio_unregister_driver(&esp_sdio_driver); ++ msleep(100); ++ sdio_register_driver(&esp_sdio_driver); ++ ++ return 0; ++} ++ ++static void /*__exit*/ esp_sdio_exit(void) ++{ ++ sdio_unregister_driver(&esp_sdio_driver); ++ esp_debugfs_exit(); ++} ++ ++MODULE_DEVICE_TABLE(sdio, esp_sdio_devices); ++MODULE_DEVICE_TABLE(of, esp_of_match_table); ++MODULE_AUTHOR("Espressif System"); ++MODULE_DESCRIPTION ++ ("Driver for SDIO interconnected eagle low-power WLAN devices"); ++MODULE_LICENSE("GPL"); ++ ++module_init(esp_sdio_init); ++module_exit(esp_sdio_exit); +diff --git a/drivers/net/wireless/esp8089/sip2_common.h b/drivers/net/wireless/esp8089/sip2_common.h +new file mode 100644 +index 000000000000..d46e87589b0b +--- /dev/null ++++ b/drivers/net/wireless/esp8089/sip2_common.h +@@ -0,0 +1,475 @@ ++/* ++ * Copyright (c) 2010 - 2014 Espressif System. ++ * ++ * Common definitions of Serial Interconnctor Protocol ++ * ++ * little endian ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 _SIP2_COMMON_H ++#define _SIP2_COMMON_H ++ ++#ifdef __ets__ ++#include "utils.h" ++#endif /*__ets__*/ ++ ++/* max 16 types */ ++typedef enum { ++ SIP_CTRL = 0, ++ SIP_DATA, ++ SIP_DATA_AMPDU ++} SIP_TYPE; ++ ++typedef enum { ++ SIP_TX_CTRL_BUF = 0, /* from host */ ++ SIP_RX_CTRL_BUF, /* to host */ ++ SIP_TX_DATA_BUF, /* from host */ ++ SIP_RX_DATA_BUF /* to host */ ++} SIP_BUF_TYPE; ++ ++enum sip_cmd_id { ++ SIP_CMD_GET_VER = 0, ++ SIP_CMD_WRITE_MEMORY, //1 ROM code ++ SIP_CMD_READ_MEMORY, //2 ++ SIP_CMD_WRITE_REG, //3 ROM code ++ SIP_CMD_READ_REG, //4 ++ SIP_CMD_BOOTUP, //5 ROM code ++ SIP_CMD_COPYBACK, //6 ++ SIP_CMD_INIT, //7 ++ SIP_CMD_SCAN, //8 ++ SIP_CMD_SETKEY, //9 ++ SIP_CMD_CONFIG, //10 ++ SIP_CMD_BSS_INFO_UPDATE, //11 ++ SIP_CMD_LOOPBACK, //12 ROM code ++ //do not add cmd before this line ++ SIP_CMD_SET_WMM_PARAM, ++ SIP_CMD_AMPDU_ACTION, ++ SIP_CMD_HB_REQ, //15 ++ SIP_CMD_RESET_MAC, //16 ++ SIP_CMD_PRE_DOWN, //17 ++ SIP_CMD_SLEEP, /* for sleep testing */ ++ SIP_CMD_WAKEUP, /* for sleep testing */ ++ SIP_CMD_DEBUG, /* for general testing */ ++ SIP_CMD_GET_FW_VER, /* get fw rev. */ ++ SIP_CMD_SETVIF, ++ SIP_CMD_SETSTA, ++ SIP_CMD_PS, ++ SIP_CMD_ATE, ++ SIP_CMD_SUSPEND, ++ SIP_CMD_RECALC_CREDIT, ++ SIP_CMD_MAX, ++}; ++ ++enum { ++ SIP_EVT_TARGET_ON = 0, // ++ SIP_EVT_BOOTUP, //1 in ROM code ++ SIP_EVT_COPYBACK, //2 ++ SIP_EVT_SCAN_RESULT, //3 ++ SIP_EVT_TX_STATUS, //4 ++ SIP_EVT_CREDIT_RPT, //5, in ROM code ++ SIP_EVT_ERROR, //6 ++ SIP_EVT_LOOPBACK, //7, in ROM code ++ SIP_EVT_SNPRINTF_TO_HOST, //8 in ROM code ++ //do not add evt before this line ++ SIP_EVT_HB_ACK, //9 ++ SIP_EVT_RESET_MAC_ACK, //10 ++ SIP_EVT_WAKEUP, //11 /* for sleep testing */ ++ SIP_EVT_DEBUG, //12 /* for general testing */ ++ SIP_EVT_PRINT_TO_HOST, //13 ++ SIP_EVT_TRC_AMPDU, //14 ++ SIP_EVT_ROC, //15 ++ SIP_EVT_RESETTING, ++ SIP_EVT_ATE, ++ SIP_EVT_EP, ++ SIP_EVT_INIT_EP, ++ SIP_EVT_SLEEP, ++ SIP_EVT_TXIDLE, ++ SIP_EVT_NOISEFLOOR, ++ SIP_EVT_MAX ++}; ++ ++#define SIP_IFIDX_MASK 0xf0 ++#define SIP_IFIDX_S 4 ++#define SIP_TYPE_MASK 0x0f ++#define SIP_TYPE_S 0 ++ ++#define SIP_HDR_GET_IFIDX(fc0) (((fc0) & SIP_IFIDX_MASK) >> SIP_IFIDX_S) ++#define SIP_HDR_SET_IFIDX(fc0, ifidx) ( (fc0) = ((fc0) & ~SIP_IFIDX_MASK) | ((ifidx) << SIP_IFIDX_S & SIP_IFIDX_MASK) ) ++#define SIP_HDR_GET_TYPE(fc0) ((fc0) & SIP_TYPE_MASK ) ++/* assume type field is cleared */ ++#define SIP_HDR_SET_TYPE(fc0, type) ((fc0) = ((fc0) & ~ SIP_TYPE_MASK) | ((type) & SIP_TYPE_MASK)) ++ ++/* sip 2.0, not hybrid header so far */ ++#define SIP_HDR_IS_CTRL(hdr) (SIP_HDR_GET_TYPE((hdr)->fc[0]) == SIP_CTRL) ++#define SIP_HDR_IS_DATA(hdr) (SIP_HDR_GET_TYPE((hdr)->fc[0]) == SIP_DATA) ++#define SIP_HDR_IS_AMPDU(hdr) (SIP_HDR_GET_TYPE((hdr)->fc[0]) == SIP_DATA_AMPDU) ++ ++/* fc[1] flags, only for data pkt. Ctrl pkts use fc[1] as eventID */ ++#define SIP_HDR_SET_FLAGS(hdr, flags) ((hdr)->fc[1] |= (flags)) ++#define SIP_HDR_F_MORE_PKT 0x1 ++#define SIP_HDR_F_NEED_CRDT_RPT 0x2 ++#define SIP_HDR_F_SYNC 0x4 ++#define SIP_HDR_F_SYNC_RESET 0x8 ++#define SIP_HDR_F_PM_TURNING_ON 0x10 ++#define SIP_HDR_F_PM_TURNING_OFF 0x20 ++ ++#define SIP_HDR_NEED_CREDIT_UPDATE(hdr) ((hdr)->fc[1] & SIP_HDR_F_NEED_CRDT_RPT) ++#define SIP_HDR_IS_MORE_PKT(hdr) ((hdr)->fc[1] & SIP_HDR_F_MORE_PKT) ++#define SIP_HDR_IS_CRDT_RPT(hdr) ((hdr)->fc[1] & SIP_HDR_F_CRDT_RPT) ++#define SIP_HDR_IS_SYNC(hdr) ((hdr)->fc[1] & SIP_HDR_F_SYNC) ++#define SIP_HDR_IS_SYNC_RESET(hdr) ((hdr)->fc[1] & SIP_HDR_F_SYNC_RESET) ++#define SIP_HDR_IS_SYNC_PKT(hdr) (SIP_HDR_IS_SYNC(hdr) | SIP_HDR_IS_SYNC_RESET(hdr)) ++#define SIP_HDR_SET_SYNC(hdr) SIP_HDR_SET_FLAGS((hdr), SIP_HDR_F_SYNC) ++#define SIP_HDR_SET_SYNC_RESET(hdr) SIP_HDR_SET_FLAGS((hdr), SIP_HDR_F_SYNC_RESET) ++#define SIP_HDR_SET_MORE_PKT(hdr) SIP_HDR_SET_FLAGS((hdr), SIP_HDR_F_MORE_PKT) ++#define SIP_HDR_SET_PM_TURNING_ON(hdr) SIP_HDR_SET_FLAGS((hdr), SIP_HDR_F_PM_TURNING_ON) ++#define SIP_HDR_IS_PM_TURNING_ON(hdr) ((hdr)->fc[1] & SIP_HDR_F_PM_TURNING_ON) ++#define SIP_HDR_SET_PM_TURNING_OFF(hdr) SIP_HDR_SET_FLAGS((hdr), SIP_HDR_F_PM_TURNING_OFF) ++#define SIP_HDR_IS_PM_TURNING_OFF(hdr) ((hdr)->fc[1] & SIP_HDR_F_PM_TURNING_OFF) ++ ++/* ++ * fc[0]: first 4bit: ifidx; last 4bit: type ++ * fc[1]: flags ++ * ++ * Don't touch the header definitons ++ */ ++struct sip_hdr_min { ++ u8 fc[2]; ++ __le16 len; ++} __packed; ++ ++/* not more than 4byte long */ ++struct sip_tx_data_info { ++ u8 tid; ++ u8 ac; ++ u8 p2p:1, enc_flag:7; ++ u8 hw_kid; ++} __packed; ++ ++/* NB: this structure should be not more than 4byte !! */ ++struct sip_tx_info { ++ union { ++ u32 cmdid; ++ struct sip_tx_data_info dinfo; ++ } u; ++} __packed; ++ ++struct sip_hdr { ++ u8 fc[2]; //fc[0]: type and ifidx ; fc[1] is eventID if the first ctrl pkt in the chain. data pkt still can use fc[1] to set flag ++ __le16 len; ++ union { ++ volatile u32 recycled_credits; /* last 12bits is credits, first 20 bits is actual length of the first pkt in the chain */ ++ struct sip_tx_info tx_info; ++ } u; ++ u32 seq; ++} __packed; ++ ++#define h_credits u.recycled_credits ++#define c_evtid fc[1] ++#define c_cmdid u.tx_info.u.cmdid ++#define d_ac u.tx_info.u.dinfo.ac ++#define d_tid u.tx_info.u.dinfo.tid ++#define d_p2p u.tx_info.u.dinfo.p2p ++#define d_enc_flag u.tx_info.u.dinfo.enc_flag ++#define d_hw_kid u.tx_info.u.dinfo.hw_kid ++ ++#define SIP_CREDITS_MASK 0xfff /* last 12 bits */ ++ ++#ifdef HOST_RC ++ ++#define RC_CNT_MASK 0xf ++ ++struct sip_rc_status { ++ u32 rc_map; ++ union { ++ u32 rc_cnt1:4, rc_cnt2:4, rc_cnt3:4, rc_cnt4:4, rc_cnt5:4; ++ ++ u32 rc_cnt_store; ++ }; ++}; ++ ++/* copy from mac80211.h */ ++struct sip_tx_rc { ++ struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; ++ s8 rts_cts_rate_idx; ++}; ++#endif /* HOST_RC */ ++ ++#define SIP_HDR_MIN_LEN 4 ++#define SIP_HDR_LEN sizeof(struct sip_hdr) ++#define SIP_CTRL_HDR_LEN SIP_HDR_LEN /* same as sip_hdr in sip2 design */ ++#define SIP_BOOT_BUF_SIZE 256 ++#define SIP_CTRL_BUF_SZ 256 /* too much?? */ ++#define SIP_CTRL_BUF_N 6 ++#define SIP_CTRL_TXBUF_N 2 ++#define SIP_CTRL_RXBUF_N 4 ++ ++/* WAR for mblk */ ++#define SIP_RX_ADDR_PREFIX_MASK 0xfc000000 ++#define SIP_RX_ADDR_SHIFT 6 /* [31:5], shift 6 bits */ ++ ++struct sip_cmd_write_memory { ++ u32 addr; ++ u32 len; ++} __packed; ++ ++struct sip_cmd_read_memory { ++ u32 addr; ++ u32 len; ++} __packed; ++ ++struct sip_cmd_write_reg { ++ u32 addr; ++ u32 val; ++} __packed; ++ ++struct sip_cmd_bootup { ++ u32 boot_addr; ++} __packed; ++ ++struct sip_cmd_loopback { ++ u32 txlen; //host to target packet len, 0 means no txpacket ++ u32 rxlen; //target to host packet len, 0 means no rxpacket ++ u32 pack_id; //sequence of packet ++} __packed; ++ ++struct sip_evt_loopback { ++ u32 txlen; //host to target packet len, 0 means no txpacket ++ u32 rxlen; //target to host packet len, 0 means no rxpacket ++ u32 pack_id; //sequence of packet ++} __packed; ++ ++struct sip_cmd_copyback { ++ u32 addr; ++ u32 len; ++} __packed; ++ ++struct sip_cmd_scan { ++// u8 ssid[32]; ++ u8 ssid_len; ++// u8 hw_channel[14]; ++ u8 n_channels; ++ u8 ie_len; ++ u8 aborted; ++} __packed; // ie[] append at the end ++ ++ ++#ifndef ETH_ALEN ++#define ETH_ALEN 6 ++#endif /* ETH_ALEN */ ++ ++struct sip_cmd_setkey { ++ u8 bssid_no; ++ u8 addr[ETH_ALEN]; ++ u8 alg; ++ u8 keyidx; ++ u8 hw_key_idx; ++ u8 flags; ++ u8 keylen; ++ u8 key[32]; ++} __packed; ++ ++struct sip_cmd_config { ++ u16 center_freq; ++ u16 duration; ++} __packed; ++ ++struct sip_cmd_bss_info_update { ++ u8 bssid[ETH_ALEN]; ++ u16 isassoc; ++ u32 beacon_int; ++ u8 bssid_no; ++} __packed; ++ ++struct sip_evt_bootup { ++ u16 tx_blksz; ++ u8 mac_addr[ETH_ALEN]; ++ /* anything else ? */ ++} __packed; ++ ++struct sip_cmd_setvif { ++ u8 index; ++ u8 mac[ETH_ALEN]; ++ u8 set; ++ u8 op_mode; ++ u8 is_p2p; ++} __packed; ++ ++enum esp_ieee80211_phytype { ++ ESP_IEEE80211_T_CCK = 0, ++ ESP_IEEE80211_T_OFDM = 1, ++ ESP_IEEE80211_T_HT20_L = 2, ++ ESP_IEEE80211_T_HT20_S = 3, ++}; ++ ++struct sip_cmd_setsta { ++ u8 ifidx; ++ u8 index; ++ u8 set; ++ u8 phymode; ++ u8 mac[ETH_ALEN]; ++ u16 aid; ++ u8 ampdu_factor; ++ u8 ampdu_density; ++ u16 resv; ++} __packed; ++ ++struct sip_cmd_ps { ++ u8 dtim_period; ++ u8 max_sleep_period; ++ u8 on; ++ u8 resv; ++} __packed; ++ ++struct sip_cmd_suspend { ++ u8 suspend; ++ u8 resv[3]; ++} __packed; ++ ++#define SIP_DUMP_RPBM_ERR BIT(0) ++#define SIP_RXABORT_FIXED BIT(1) ++#define SIP_SUPPORT_BGSCAN BIT(2) ++struct sip_evt_bootup2 { ++ u16 tx_blksz; ++ u8 mac_addr[ETH_ALEN]; ++ u16 rx_blksz; ++ u8 credit_to_reserve; ++ u8 options; ++ s16 noise_floor; ++ u8 resv[2]; ++ /* anything else ? */ ++} __packed; ++ ++typedef enum { ++ TRC_TX_AMPDU_STOPPED = 1, ++ TRC_TX_AMPDU_OPERATIONAL, ++ TRC_TX_AMPDU_WAIT_STOP, ++ TRC_TX_AMPDU_WAIT_OPERATIONAL, ++ TRC_TX_AMPDU_START, ++} trc_ampdu_state_t; ++ ++struct sip_evt_trc_ampdu { ++ u8 state; ++ u8 tid; ++ u8 addr[ETH_ALEN]; ++} __packed; ++ ++struct sip_cmd_set_wmm_params { ++ u8 aci; ++ u8 aifs; ++ u8 ecw_min; ++ u8 ecw_max; ++ u16 txop_us; ++} __packed; ++ ++#define SIP_AMPDU_RX_START 0 ++#define SIP_AMPDU_RX_STOP 1 ++#define SIP_AMPDU_TX_OPERATIONAL 2 ++#define SIP_AMPDU_TX_STOP 3 ++struct sip_cmd_ampdu_action { ++ u8 action; ++ u8 index; ++ u8 tid; ++ u8 win_size; ++ u16 ssn; ++ u8 addr[ETH_ALEN]; ++} __packed; ++ ++#define SIP_TX_ST_OK 0 ++#define SIP_TX_ST_NOEB 1 ++#define SIP_TX_ST_ACKTO 2 ++#define SIP_TX_ST_ENCERR 3 ++ ++//NB: sip_tx_status must be 4 bytes aligned ++struct sip_tx_status { ++ u32 sip_seq; ++#ifdef HOST_RC ++ struct sip_rc_status rcstatus; ++#endif /* HOST_RC */ ++ u8 errno; /* success or failure code */ ++ u8 rate_index; ++ char ack_signal; ++ u8 pad; ++} __packed; ++ ++struct sip_evt_tx_report { ++ u32 pkts; ++ struct sip_tx_status status[0]; ++} __packed; ++ ++struct sip_evt_tx_mblk { ++ u32 mblk_map; ++} __packed; ++ ++struct sip_evt_scan_report { ++ u16 scan_id; ++ u16 aborted; ++} __packed; ++ ++struct sip_evt_roc { ++ u16 state; //start:1, end :0 ++ u16 is_ok; ++} __packed; ++ ++struct sip_evt_txidle { ++ u32 last_seq; ++} __packed; ++ ++struct sip_evt_noisefloor { ++ s16 noise_floor; ++ u16 pad; ++} __packed; ++/* ++ * for mblk direct memory access, no need for sip_hdr. tx: first 2k for contrl msg, ++ * rest of 14k for data. rx, same. ++ */ ++#ifdef TEST_MODE ++ ++struct sip_cmd_sleep { ++ u32 sleep_mode; ++ u32 sleep_tm_ms; ++ u32 wakeup_tm_ms; //zero: after receive bcn, then sleep, nozero: delay nozero ms to sleep ++ u32 sleep_times; //zero: always sleep, nozero: after nozero number sleep/wakeup, then end up sleep ++} __packed; ++ ++struct sip_cmd_wakeup { ++ u32 check_data; //0:copy to event ++} __packed; ++ ++struct sip_evt_wakeup { ++ u32 check_data; ++} __packed; ++ ++//general debug command ++struct sip_cmd_debug { ++ u32 cmd_type; ++ u32 para_num; ++ u32 para[10]; ++} __packed; ++ ++struct sip_evt_debug { ++ u16 len; ++ u32 results[12]; ++ u16 pad; ++} __packed; ++ ++struct sip_cmd_ate { ++ //u8 len; ++ u8 cmdstr[0]; ++} __packed; ++ ++ ++ ++#endif //ifdef TEST_MODE ++ ++#endif /* _SIP_COMMON_H_ */ +diff --git a/drivers/net/wireless/esp8089/slc_host_register.h b/drivers/net/wireless/esp8089/slc_host_register.h +new file mode 100644 +index 000000000000..2cdb2c856d15 +--- /dev/null ++++ b/drivers/net/wireless/esp8089/slc_host_register.h +@@ -0,0 +1,271 @@ ++//Generated at 2012-10-23 20:11:08 ++/* ++ * Copyright (c) 2011 Espressif System ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT 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 SLC_HOST_REGISTER_H_INCLUDED ++#define SLC_HOST_REGISTER_H_INCLUDED ++ ++/* #define REG_SLC_HOST_BASE 0x00000000 */ ++/* skip the token1, since reading it will clean the credit */ ++#define REG_SLC_HOST_BASE 0x00000000 ++#define REG_SLC_BASE 0x00000000 ++ ++ ++#define SLC_HOST_PF (REG_SLC_HOST_BASE + 0x0) ++#define SLC_HOST_TOKEN_RDATA (REG_SLC_HOST_BASE + 0x4) ++#define SLC_HOST_RX_PF_EOF 0x0000000F ++#define SLC_HOST_RX_PF_EOF_S 28 ++#define SLC_HOST_TOKEN1 0x00000FFF ++#define SLC_HOST_TOKEN1_S 16 ++#define SLC_HOST_RX_PF_VALID (BIT(15)) ++#define SLC_HOST_TOKEN0 0x00000FFF ++#define SLC_HOST_TOKEN0_S 0 ++ ++#define SLC_HOST_TOKEN0_MASK SLC_HOST_TOKEN0 ++ ++#define SLC_HOST_INT_RAW (REG_SLC_HOST_BASE + 0x8) ++#define SLC_HOST_EXT_BIT3_INT_RAW (BIT(22)) ++#define SLC_HOST_EXT_BIT2_INT_RAW (BIT(21)) ++#define SLC_HOST_EXT_BIT1_INT_RAW (BIT(20)) ++#define SLC_HOST_RXFIFO_NOT_EMPTY_INT_RAW (BIT(19)) ++#define SLC_HOST_RX_PF_VALID_INT_RAW (BIT(18)) ++#define SLC_HOST_TX_OVF_INT_RAW (BIT(17)) ++#define SLC_HOST_RX_UDF_INT_RAW (BIT(16)) ++#define SLC_HOST_TX_START_INT_RAW (BIT(15)) ++#define SLC_HOST_RX_START_INT_RAW (BIT(14)) ++#define SLC_HOST_RX_EOF_INT_RAW (BIT(13)) ++#define SLC_HOST_RX_SOF_INT_RAW (BIT(12)) ++#define SLC_HOST_TOKEN1_0TO1_INT_RAW (BIT(11)) ++#define SLC_HOST_TOKEN0_0TO1_INT_RAW (BIT(10)) ++#define SLC_HOST_TOKEN1_1TO0_INT_RAW (BIT(9)) ++#define SLC_HOST_TOKEN0_1TO0_INT_RAW (BIT(8)) ++#define SLC_HOST_TOHOST_BIT7_INT_RAW (BIT(7)) ++#define SLC_HOST_TOHOST_BIT6_INT_RAW (BIT(6)) ++#define SLC_HOST_TOHOST_BIT5_INT_RAW (BIT(5)) ++#define SLC_HOST_TOHOST_BIT4_INT_RAW (BIT(4)) ++#define SLC_HOST_TOHOST_BIT3_INT_RAW (BIT(3)) ++#define SLC_HOST_TOHOST_BIT2_INT_RAW (BIT(2)) ++#define SLC_HOST_TOHOST_BIT1_INT_RAW (BIT(1)) ++#define SLC_HOST_TOHOST_BIT0_INT_RAW (BIT(0)) ++ ++#define SLC_HOST_STATE_W0 (REG_SLC_HOST_BASE + 0xC) ++#define SLC_HOST_STATE3 0x000000FF ++#define SLC_HOST_STATE3_S 24 ++#define SLC_HOST_STATE2 0x000000FF ++#define SLC_HOST_STATE2_S 16 ++#define SLC_HOST_STATE1 0x000000FF ++#define SLC_HOST_STATE1_S 8 ++#define SLC_HOST_STATE0 0x000000FF ++#define SLC_HOST_STATE0_S 0 ++ ++#define SLC_HOST_STATE_W1 (REG_SLC_HOST_BASE + 0x10) ++#define SLC_HOST_STATE7 0x000000FF ++#define SLC_HOST_STATE7_S 24 ++#define SLC_HOST_STATE6 0x000000FF ++#define SLC_HOST_STATE6_S 16 ++#define SLC_HOST_STATE5 0x000000FF ++#define SLC_HOST_STATE5_S 8 ++#define SLC_HOST_STATE4 0x000000FF ++#define SLC_HOST_STATE4_S 0 ++ ++#define SLC_HOST_CONF_W0 (REG_SLC_HOST_BASE + 0x14) ++#define SLC_HOST_CONF3 0x000000FF ++#define SLC_HOST_CONF3_S 24 ++#define SLC_HOST_CONF2 0x000000FF ++#define SLC_HOST_CONF2_S 16 ++#define SLC_HOST_CONF1 0x000000FF ++#define SLC_HOST_CONF1_S 8 ++#define SLC_HOST_CONF0 0x000000FF ++#define SLC_HOST_CONF0_S 0 ++ ++#define SLC_HOST_CONF_W1 (REG_SLC_HOST_BASE + 0x18) ++#define SLC_HOST_CONF7 0x000000FF ++#define SLC_HOST_CONF7_S 24 ++#define SLC_HOST_CONF6 0x000000FF ++#define SLC_HOST_CONF6_S 16 ++#define SLC_HOST_CONF5 0x000000FF ++#define SLC_HOST_CONF5_S 8 ++#define SLC_HOST_CONF4 0x000000FF ++#define SLC_HOST_CONF4_S 0 ++ ++#define SLC_HOST_INT_ST (REG_SLC_HOST_BASE + 0x1C) ++#define SLC_HOST_RX_ST (BIT(23)) ++#define SLC_HOST_EXT_BIT3_INT_ST (BIT(22)) ++#define SLC_HOST_EXT_BIT2_INT_ST (BIT(21)) ++#define SLC_HOST_EXT_BIT1_INT_ST (BIT(20)) ++#define SLC_HOST_RXFIFO_NOT_EMPTY_INT_ST (BIT(19)) ++#define SLC_HOST_RX_PF_VALID_INT_ST (BIT(18)) ++#define SLC_HOST_TX_OVF_INT_ST (BIT(17)) ++#define SLC_HOST_RX_UDF_INT_ST (BIT(16)) ++#define SLC_HOST_TX_START_INT_ST (BIT(15)) ++#define SLC_HOST_RX_START_INT_ST (BIT(14)) ++#define SLC_HOST_RX_EOF_INT_ST (BIT(13)) ++#define SLC_HOST_RX_SOF_INT_ST (BIT(12)) ++#define SLC_HOST_TOKEN1_0TO1_INT_ST (BIT(11)) ++#define SLC_HOST_TOKEN0_0TO1_INT_ST (BIT(10)) ++#define SLC_HOST_TOKEN1_1TO0_INT_ST (BIT(9)) ++#define SLC_HOST_TOKEN0_1TO0_INT_ST (BIT(8)) ++#define SLC_HOST_TOHOST_BIT7_INT_ST (BIT(7)) ++#define SLC_HOST_TOHOST_BIT6_INT_ST (BIT(6)) ++#define SLC_HOST_TOHOST_BIT5_INT_ST (BIT(5)) ++#define SLC_HOST_TOHOST_BIT4_INT_ST (BIT(4)) ++#define SLC_HOST_TOHOST_BIT3_INT_ST (BIT(3)) ++#define SLC_HOST_TOHOST_BIT2_INT_ST (BIT(2)) ++#define SLC_HOST_TOHOST_BIT1_INT_ST (BIT(1)) ++#define SLC_HOST_TOHOST_BIT0_INT_ST (BIT(0)) ++ ++#define SLC_HOST_CONF_W2 (REG_SLC_HOST_BASE + 0x20) ++#define SLC_HOST_CONF11 0x000000FF ++#define SLC_HOST_CONF11_S 24 ++#define SLC_HOST_CONF10 0x000000FF ++#define SLC_HOST_CONF10_S 16 ++#define SLC_HOST_CONF9 0x000000FF ++#define SLC_HOST_CONF9_S 8 ++#define SLC_HOST_CONF8 0x000000FF ++#define SLC_HOST_CONF8_S 0 ++ ++#define SLC_HOST_CONF_W3 (REG_SLC_HOST_BASE + 0x24) ++#define SLC_HOST_CONF15 0x000000FF ++#define SLC_HOST_CONF15_S 24 ++#define SLC_HOST_CONF14 0x000000FF ++#define SLC_HOST_CONF14_S 16 ++#define SLC_HOST_CONF13 0x000000FF ++#define SLC_HOST_CONF13_S 8 ++#define SLC_HOST_CONF12 0x000000FF ++#define SLC_HOST_CONF12_S 0 ++ ++#define SLC_HOST_GEN_TXDONE_INT BIT(16) ++#define SLC_HOST_GEN_RXDONE_INT BIT(17) ++ ++#define SLC_HOST_CONF_W4 (REG_SLC_HOST_BASE + 0x28) ++#define SLC_HOST_CONF19 0x000000FF ++#define SLC_HOST_CONF19_S 24 ++#define SLC_HOST_CONF18 0x000000FF ++#define SLC_HOST_CONF18_S 16 ++#define SLC_HOST_CONF17 0x000000FF ++#define SLC_HOST_CONF17_S 8 ++#define SLC_HOST_CONF16 0x000000FF ++#define SLC_HOST_CONF16_S 0 ++ ++#define SLC_HOST_TOKEN_WDATA (REG_SLC_HOST_BASE + 0x2C) ++#define SLC_HOST_TOKEN1_WD 0x00000FFF ++#define SLC_HOST_TOKEN1_WD_S 16 ++#define SLC_HOST_TOKEN0_WD 0x00000FFF ++#define SLC_HOST_TOKEN0_WD_S 0 ++ ++#define SLC_HOST_INT_CLR (REG_SLC_HOST_BASE + 0x30) ++#define SLC_HOST_TOKEN1_WR (BIT(31)) ++#define SLC_HOST_TOKEN0_WR (BIT(30)) ++#define SLC_HOST_TOKEN1_DEC (BIT(29)) ++#define SLC_HOST_TOKEN0_DEC (BIT(28)) ++#define SLC_HOST_EXT_BIT3_INT_CLR (BIT(22)) ++#define SLC_HOST_EXT_BIT2_INT_CLR (BIT(21)) ++#define SLC_HOST_EXT_BIT1_INT_CLR (BIT(20)) ++#define SLC_HOST_EXT_BIT0_INT_CLR (BIT(19)) ++#define SLC_HOST_RX_PF_VALID_INT_CLR (BIT(18)) ++#define SLC_HOST_TX_OVF_INT_CLR (BIT(17)) ++#define SLC_HOST_RX_UDF_INT_CLR (BIT(16)) ++#define SLC_HOST_TX_START_INT_CLR (BIT(15)) ++#define SLC_HOST_RX_START_INT_CLR (BIT(14)) ++#define SLC_HOST_RX_EOF_INT_CLR (BIT(13)) ++#define SLC_HOST_RX_SOF_INT_CLR (BIT(12)) ++#define SLC_HOST_TOKEN1_0TO1_INT_CLR (BIT(11)) ++#define SLC_HOST_TOKEN0_0TO1_INT_CLR (BIT(10)) ++#define SLC_HOST_TOKEN1_1TO0_INT_CLR (BIT(9)) ++#define SLC_HOST_TOKEN0_1TO0_INT_CLR (BIT(8)) ++#define SLC_HOST_TOHOST_BIT7_INT_CLR (BIT(7)) ++#define SLC_HOST_TOHOST_BIT6_INT_CLR (BIT(6)) ++#define SLC_HOST_TOHOST_BIT5_INT_CLR (BIT(5)) ++#define SLC_HOST_TOHOST_BIT4_INT_CLR (BIT(4)) ++#define SLC_HOST_TOHOST_BIT3_INT_CLR (BIT(3)) ++#define SLC_HOST_TOHOST_BIT2_INT_CLR (BIT(2)) ++#define SLC_HOST_TOHOST_BIT1_INT_CLR (BIT(1)) ++#define SLC_HOST_TOHOST_BIT0_INT_CLR (BIT(0)) ++ ++#define SLC_HOST_INT_ENA (REG_SLC_HOST_BASE + 0x34) ++#define SLC_HOST_EXT_BIT3_INT_ENA (BIT(22)) ++#define SLC_HOST_EXT_BIT2_INT_ENA (BIT(21)) ++#define SLC_HOST_EXT_BIT1_INT_ENA (BIT(20)) ++#define SLC_HOST_EXT_BIT0_INT_ENA (BIT(19)) ++#define SLC_HOST_RX_PF_VALID_INT_ENA (BIT(18)) ++#define SLC_HOST_TX_OVF_INT_ENA (BIT(17)) ++#define SLC_HOST_RX_UDF_INT_ENA (BIT(16)) ++#define SLC_HOST_TX_START_INT_ENA (BIT(15)) ++#define SLC_HOST_RX_START_INT_ENA (BIT(14)) ++#define SLC_HOST_RX_EOF_INT_ENA (BIT(13)) ++#define SLC_HOST_RX_SOF_INT_ENA (BIT(12)) ++#define SLC_HOST_TOKEN1_0TO1_INT_ENA (BIT(11)) ++#define SLC_HOST_TOKEN0_0TO1_INT_ENA (BIT(10)) ++#define SLC_HOST_TOKEN1_1TO0_INT_ENA (BIT(9)) ++#define SLC_HOST_TOKEN0_1TO0_INT_ENA (BIT(8)) ++#define SLC_HOST_TOHOST_BIT7_INT_ENA (BIT(7)) ++#define SLC_HOST_TOHOST_BIT6_INT_ENA (BIT(6)) ++#define SLC_HOST_TOHOST_BIT5_INT_ENA (BIT(5)) ++#define SLC_HOST_TOHOST_BIT4_INT_ENA (BIT(4)) ++#define SLC_HOST_TOHOST_BIT3_INT_ENA (BIT(3)) ++#define SLC_HOST_TOHOST_BIT2_INT_ENA (BIT(2)) ++#define SLC_HOST_TOHOST_BIT1_INT_ENA (BIT(1)) ++#define SLC_HOST_TOHOST_BIT0_INT_ENA (BIT(0)) ++ ++#define SLC_HOST_CONF_W5 (REG_SLC_HOST_BASE + 0x3C) ++#define SLC_HOST_CONF23 0x000000FF ++#define SLC_HOST_CONF23_S 24 ++#define SLC_HOST_CONF22 0x000000FF ++#define SLC_HOST_CONF22_S 16 ++#define SLC_HOST_CONF21 0x000000FF ++#define SLC_HOST_CONF21_S 8 ++#define SLC_HOST_CONF20 0x000000FF ++#define SLC_HOST_CONF20_S 0 ++ ++#define SLC_HOST_WIN_CMD (REG_SLC_HOST_BASE + 0x40) ++ ++ ++#define SLC_HOST_DATE (REG_SLC_HOST_BASE + 0x78) ++#define SLC_HOST_ID (REG_SLC_HOST_BASE + 0x7C) ++ ++#define SLC_ADDR_WINDOW_CLEAR_MASK (~(0xf<<12)) ++#define SLC_FROM_HOST_ADDR_WINDOW (0x1<<12) ++#define SLC_TO_HOST_ADDR_WINDOW (0x3<<12) ++ ++#define SLC_SET_FROM_HOST_ADDR_WINDOW(v) do { \ ++ (v) &= 0xffff; \ ++ (v) &= SLC_ADDR_WINDOW_CLEAR_MASK; \ ++ (v) |= SLC_FROM_HOST_ADDR_WINDOW; \ ++} while (0); ++ ++#define SLC_SET_TO_HOST_ADDR_WINDOW(v) do { \ ++ (v) &= 0xffff; \ ++ (v) &= SLC_ADDR_WINDOW_CLEAR_MASK; \ ++ (v) |= SLC_TO_HOST_ADDR_WINDOW; \ ++} while (0); ++ ++#define SLC_INT_ENA (REG_SLC_BASE + 0xC) ++#define SLC_RX_EOF_INT_ENA BIT(17) ++#define SLC_FRHOST_BIT2_INT_ENA BIT(2) ++ ++#define SLC_RX_LINK (REG_SLC_BASE + 0x24) ++#define SLC_RXLINK_START BIT(29) ++ ++#define SLC_BRIDGE_CONF (REG_SLC_BASE + 0x44) ++#define SLC_TX_PUSH_IDLE_NUM 0xFFFF ++#define SLC_TX_PUSH_IDLE_NUM_S 16 ++#define SLC_HDA_MAP_128K BIT(13) ++#define SLC_TX_DUMMY_MODE BIT(12) ++#define SLC_FIFO_MAP_ENA 0x0000000F ++#define SLC_FIFO_MAP_ENA_S 8 ++#define SLC_TXEOF_ENA 0x0000003F ++#define SLC_TXEOF_ENA_S ++ ++ ++#endif // SLC_HOST_REGISTER_H_INCLUDED +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-ssv6051.patch b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-ssv6051.patch new file mode 100644 index 000000000000..ed72e2aa1320 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.armbian/wifi-driver-ssv6051.patch @@ -0,0 +1,49482 @@ +From 3f30a652fb3e6ead83f65312d0240d5c9ea8c340 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Wed, 2 Nov 2022 15:40:06 +0000 +Subject: [PATCH] add ssv6xxx wifi driver + +--- + drivers/net/wireless/Kconfig | 1 + + drivers/net/wireless/Makefile | 1 + + drivers/net/wireless/ssv6051/Kconfig | 11 + + drivers/net/wireless/ssv6051/Makefile | 26 + + drivers/net/wireless/ssv6051/Makefile.bak | 107 + + .../ssv6051/firmware/ssv6051-wifi.cfg | 91 + + drivers/net/wireless/ssv6051/hci/hctrl.h | 178 + + drivers/net/wireless/ssv6051/hci/ssv_hci.c | 967 + + drivers/net/wireless/ssv6051/hci/ssv_hci.h | 77 + + drivers/net/wireless/ssv6051/hwif/hwif.h | 84 + + drivers/net/wireless/ssv6051/hwif/sdio/sdio.c | 1254 ++ + .../net/wireless/ssv6051/hwif/sdio/sdio_def.h | 80 + + drivers/net/wireless/ssv6051/include/cabrio.h | 28 + + .../net/wireless/ssv6051/include/ssv6200.h | 76 + + .../wireless/ssv6051/include/ssv6200_aux.h | 18221 ++++++++++++++++ + .../wireless/ssv6051/include/ssv6200_common.h | 452 + + .../ssv6051/include/ssv6200_configuration.h | 317 + + .../wireless/ssv6051/include/ssv6200_reg.h | 9694 ++++++++ + .../ssv6051/include/ssv6200_reg_sim.h | 176 + + .../net/wireless/ssv6051/include/ssv_cfg.h | 60 + + .../ssv6051/include/ssv_firmware_version.h | 25 + + .../wireless/ssv6051/include/ssv_version.h | 12 + + .../net/wireless/ssv6051/platform-config.mak | 97 + + drivers/net/wireless/ssv6051/rules.mak | 19 + + drivers/net/wireless/ssv6051/smac/ampdu.c | 2111 ++ + drivers/net/wireless/ssv6051/smac/ampdu.h | 215 + + drivers/net/wireless/ssv6051/smac/ap.c | 598 + + drivers/net/wireless/ssv6051/smac/ap.h | 41 + + drivers/net/wireless/ssv6051/smac/dev.c | 3880 ++++ + drivers/net/wireless/ssv6051/smac/dev.h | 445 + + drivers/net/wireless/ssv6051/smac/dev_tbl.h | 141 + + drivers/net/wireless/ssv6051/smac/drv_comm.h | 61 + + drivers/net/wireless/ssv6051/smac/efuse.c | 334 + + drivers/net/wireless/ssv6051/smac/efuse.h | 40 + + drivers/net/wireless/ssv6051/smac/init.c | 1347 ++ + drivers/net/wireless/ssv6051/smac/init.h | 23 + + drivers/net/wireless/ssv6051/smac/lib.c | 33 + + drivers/net/wireless/ssv6051/smac/lib.h | 23 + + .../net/wireless/ssv6051/smac/linux_80211.h | 24 + + drivers/net/wireless/ssv6051/smac/p2p.c | 305 + + drivers/net/wireless/ssv6051/smac/p2p.h | 58 + + drivers/net/wireless/ssv6051/smac/sar.c | 208 + + drivers/net/wireless/ssv6051/smac/sar.h | 63 + + drivers/net/wireless/ssv6051/smac/sec.h | 52 + + drivers/net/wireless/ssv6051/smac/smartlink.c | 340 + + .../wireless/ssv6051/smac/ssv6xxx_debugfs.c | 223 + + .../wireless/ssv6051/smac/ssv6xxx_debugfs.h | 27 + + .../net/wireless/ssv6051/smac/ssv_cfgvendor.c | 1384 ++ + .../net/wireless/ssv6051/smac/ssv_cfgvendor.h | 247 + + drivers/net/wireless/ssv6051/smac/ssv_ht_rc.c | 546 + + drivers/net/wireless/ssv6051/smac/ssv_ht_rc.h | 31 + + drivers/net/wireless/ssv6051/smac/ssv_pm.c | 19 + + drivers/net/wireless/ssv6051/smac/ssv_pm.h | 20 + + drivers/net/wireless/ssv6051/smac/ssv_rc.c | 1716 ++ + drivers/net/wireless/ssv6051/smac/ssv_rc.h | 50 + + .../net/wireless/ssv6051/smac/ssv_rc_common.h | 175 + + .../wireless/ssv6051/ssv6051-generic-wlan.c | 76 + + .../net/wireless/ssv6051/ssvdevice/ssv_cmd.c | 1765 ++ + .../net/wireless/ssv6051/ssvdevice/ssv_cmd.h | 50 + + .../wireless/ssv6051/ssvdevice/ssvdevice.c | 256 + + 60 files changed, 48983 insertions(+) + create mode 100644 drivers/net/wireless/ssv6051/Kconfig + create mode 100644 drivers/net/wireless/ssv6051/Makefile + create mode 100644 drivers/net/wireless/ssv6051/Makefile.bak + create mode 100644 drivers/net/wireless/ssv6051/firmware/ssv6051-wifi.cfg + create mode 100644 drivers/net/wireless/ssv6051/hci/hctrl.h + create mode 100644 drivers/net/wireless/ssv6051/hci/ssv_hci.c + create mode 100644 drivers/net/wireless/ssv6051/hci/ssv_hci.h + create mode 100644 drivers/net/wireless/ssv6051/hwif/hwif.h + create mode 100644 drivers/net/wireless/ssv6051/hwif/sdio/sdio.c + create mode 100644 drivers/net/wireless/ssv6051/hwif/sdio/sdio_def.h + create mode 100644 drivers/net/wireless/ssv6051/include/cabrio.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv6200.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv6200_aux.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv6200_common.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv6200_configuration.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv6200_reg.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv6200_reg_sim.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv_cfg.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv_firmware_version.h + create mode 100644 drivers/net/wireless/ssv6051/include/ssv_version.h + create mode 100644 drivers/net/wireless/ssv6051/platform-config.mak + create mode 100644 drivers/net/wireless/ssv6051/rules.mak + create mode 100644 drivers/net/wireless/ssv6051/smac/ampdu.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ampdu.h + create mode 100644 drivers/net/wireless/ssv6051/smac/ap.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ap.h + create mode 100644 drivers/net/wireless/ssv6051/smac/dev.c + create mode 100644 drivers/net/wireless/ssv6051/smac/dev.h + create mode 100644 drivers/net/wireless/ssv6051/smac/dev_tbl.h + create mode 100644 drivers/net/wireless/ssv6051/smac/drv_comm.h + create mode 100644 drivers/net/wireless/ssv6051/smac/efuse.c + create mode 100644 drivers/net/wireless/ssv6051/smac/efuse.h + create mode 100644 drivers/net/wireless/ssv6051/smac/init.c + create mode 100644 drivers/net/wireless/ssv6051/smac/init.h + create mode 100644 drivers/net/wireless/ssv6051/smac/lib.c + create mode 100644 drivers/net/wireless/ssv6051/smac/lib.h + create mode 100644 drivers/net/wireless/ssv6051/smac/linux_80211.h + create mode 100644 drivers/net/wireless/ssv6051/smac/p2p.c + create mode 100644 drivers/net/wireless/ssv6051/smac/p2p.h + create mode 100644 drivers/net/wireless/ssv6051/smac/sar.c + create mode 100644 drivers/net/wireless/ssv6051/smac/sar.h + create mode 100644 drivers/net/wireless/ssv6051/smac/sec.h + create mode 100644 drivers/net/wireless/ssv6051/smac/smartlink.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.h + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.h + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_ht_rc.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_ht_rc.h + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_pm.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_pm.h + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_rc.c + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_rc.h + create mode 100644 drivers/net/wireless/ssv6051/smac/ssv_rc_common.h + create mode 100644 drivers/net/wireless/ssv6051/ssv6051-generic-wlan.c + create mode 100644 drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.c + create mode 100644 drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.h + create mode 100644 drivers/net/wireless/ssv6051/ssvdevice/ssvdevice.c + +diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig +index de5e37846397..aa2cac9abdd3 100644 +--- a/drivers/net/wireless/Kconfig ++++ b/drivers/net/wireless/Kconfig +@@ -18,6 +18,7 @@ menuconfig WLAN + + if WLAN + ++source "drivers/net/wireless/ssv6051/Kconfig" + source "drivers/net/wireless/admtek/Kconfig" + source "drivers/net/wireless/ath/Kconfig" + source "drivers/net/wireless/atmel/Kconfig" +diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile +index 92ffd2cef51c..8b56a42e97a6 100644 +--- a/drivers/net/wireless/Makefile ++++ b/drivers/net/wireless/Makefile +@@ -3,6 +3,7 @@ + # Makefile for the Linux Wireless network device drivers. + # + ++obj-$(CONFIG_SSV6051) += ssv6051/ + obj-$(CONFIG_WLAN_VENDOR_ADMTEK) += admtek/ + obj-$(CONFIG_WLAN_VENDOR_ATH) += ath/ + obj-$(CONFIG_WLAN_VENDOR_ATMEL) += atmel/ +diff --git a/drivers/net/wireless/ssv6051/Kconfig b/drivers/net/wireless/ssv6051/Kconfig +new file mode 100644 +index 000000000000..7706ad52ed7b +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/Kconfig +@@ -0,0 +1,11 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++config SSV6051 ++ tristate "South Silicon Valley (ssv) 6051 family WLAN support" ++ depends on MAC80211 ++ depends on (MMC = y) ++ default n ++ select FW_LOADER ++ help ++ Enable South Silicon Valley (SSV) 6051 family support. ++ ++ +diff --git a/drivers/net/wireless/ssv6051/Makefile b/drivers/net/wireless/ssv6051/Makefile +new file mode 100644 +index 000000000000..985d730f3d50 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/Makefile +@@ -0,0 +1,26 @@ ++# SPDX-License-Identifier: ISC ++ ++include $(src)/platform-config.mak ++ ++ccflags-y += \ ++ -I $(srctree)/$(src) \ ++ -I $(srctree)/$(src)/include ++ ++obj-$(CONFIG_SSV6051) += ssv6051.o ++ssv6051-objs += \ ++ ssv6051-generic-wlan.o \ ++ ssvdevice/ssvdevice.o \ ++ ssvdevice/ssv_cmd.o \ ++ hci/ssv_hci.o \ ++ smac/init.o \ ++ smac/dev.o \ ++ smac/ssv_rc.o \ ++ smac/ssv_ht_rc.o \ ++ smac/ap.o \ ++ smac/ampdu.o \ ++ smac/efuse.o \ ++ smac/ssv_pm.o \ ++ smac/sar.o \ ++ smac/ssv_cfgvendor.o \ ++ hwif/sdio/sdio.o ++ +diff --git a/drivers/net/wireless/ssv6051/Makefile.bak b/drivers/net/wireless/ssv6051/Makefile.bak +new file mode 100644 +index 000000000000..2733fa4dd3b7 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/Makefile.bak +@@ -0,0 +1,107 @@ ++KMODULE_NAME=ssv6051 ++ ++KBUILD_TOP := $(PWD) ++ ++ifeq ($(KERNELRELEASE),) ++ ++KVERS_UNAME ?= $(shell uname -r) ++KVERS_ARCH ?= $(shell arch) ++ ++KBUILD ?= $(shell readlink -f /lib/modules/$(KVERS_UNAME)/build) ++ ++ifeq (,$(KBUILD)) ++$(error kernel build tree not found - set KBUILD to configured kernel) ++endif ++ ++#KCONFIG := $(KBUILD)/config ++#ifeq (,$(wildcard $(KCONFIG))) ++#$(error No .config found in $(KBUILD), set KBUILD to configured kernel) ++#endif ++ ++ifneq (,$(wildcard $(KBUILD)/include/linux/version.h)) ++ifneq (,$(wildcard $(KBUILD)/include/generated/uapi/linux/version.h)) ++$(error Multiple copied of version.h found, clean build tree) ++endif ++endif ++ ++# Kernel Makefile doesn't always know the exact kernel version, so we ++# get it from the kernel headers instead and pass it to make. ++VERSION_H := $(KBUILD)/include/generated/utsrelease.h ++ifeq (,$(wildcard $(VERSION_H))) ++VERSION_H := $(KBUILD)/include/linux/utsrelease.h ++endif ++ifeq (,$(wildcard $(VERSION_H))) ++VERSION_H := $(KBUILD)/include/linux/version.h ++endif ++ifeq (,$(wildcard $(VERSION_H))) ++$(error Please run 'make modules_prepare' in $(KBUILD)) ++endif ++ ++KVERS := $(shell sed -ne 's/"//g;s/^\#define UTS_RELEASE //p' $(VERSION_H)) ++ ++ifeq (,$(KVERS)) ++$(error Cannot find UTS_RELEASE in $(VERSION_H), please report) ++endif ++ ++INST_DIR = /lib/modules/$(KVERS)/misc ++ ++#include $(KCONFIG) ++ ++endif ++ ++include $(KBUILD_TOP)/platform-config.mak ++ ++EXTRA_CFLAGS := -I$(KBUILD_TOP) -I$(KBUILD_TOP)/include #-Wno-error=missing-attributes ++DEF_PARSER_H = $(KBUILD_TOP)/include/ssv_conf_parser.h ++ ++OBJS := ssvdevice/ssvdevice.c \ ++ ssvdevice/ssv_cmd.c \ ++ hci/ssv_hci.c \ ++ smac/init.c \ ++ smac/dev.c \ ++ smac/ssv_rc.c \ ++ smac/ssv_ht_rc.c \ ++ smac/ap.c \ ++ smac/ampdu.c \ ++ smac/efuse.c \ ++ smac/ssv_pm.c \ ++ smac/sar.c \ ++ hwif/sdio/sdio.c \ ++ ssv6051-generic-wlan.c ++ ++ifeq ($(findstring -DCONFIG_SSV6XXX_DEBUGFS, $(ccflags-y)), -DCONFIG_SSV6XXX_DEBUGFS) ++OBJS += smac/ssv6xxx_debugfs.c ++endif ++ ++ifeq ($(findstring -DCONFIG_SSV_VENDOR_EXT_SUPPORT, $(ccflags-y)), -DCONFIG_SSV_VENDOR_EXT_SUPPORT) ++OBJS += smac/ssv_cfgvendor.c ++endif ++ ++ifeq ($(findstring -DCONFIG_SSV_SMARTLINK, $(ccflags-y)), -DCONFIG_SSV_SMARTLINK) ++OBJS += smac/smartlink.c ++endif ++ ++$(KMODULE_NAME)-y += $(ASMS:.S=.o) ++$(KMODULE_NAME)-y += $(OBJS:.c=.o) ++ ++obj-$(CONFIG_SSV6200_CORE) += $(KMODULE_NAME).o ++ ++all: modules ++ ++modules: ++ ARCH=arm $(MAKE) -C $(KBUILD) M=$(KBUILD_TOP) ++ ++clean: ++ find -type f -iname '*.o' -exec rm {} \; ++ find -type f -iname '*.o.cmd' -exec rm {} \; ++ rm -f *.o *.ko .*.cmd *.mod.c *.symvers modules.order ++ rm -rf .tmp_versions ++ ++install: modules ++ mkdir -p -m 755 $(DESTDIR)$(INST_DIR) ++ install -m 0644 $(KMODULE_NAME).ko $(DESTDIR)$(INST_DIR) ++ifndef DESTDIR ++ -/sbin/depmod -a $(KVERS) ++endif ++ ++.PHONY: all modules clean install +diff --git a/drivers/net/wireless/ssv6051/firmware/ssv6051-wifi.cfg b/drivers/net/wireless/ssv6051/firmware/ssv6051-wifi.cfg +new file mode 100644 +index 000000000000..c072960f6dea +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/firmware/ssv6051-wifi.cfg +@@ -0,0 +1,91 @@ ++############################################################ ++# ROCKCHIP RK3X28 & RK322X ++# WIFI-CONFIGURATION ++################################################## ++ ++################################################## ++# Firmware setting ++# Priority.1 insmod parameter "cfgfirmwarepath" ++# Priority.2 firmware_path ++# Priority.3 default firmware ++################################################## ++firmware_path = /vendor/etc/firmware/ ++ ++############################################################ ++# MAC address ++# ++# Priority 1. From wifi.cfg [ hw_mac & hw_mac_2 ] ++# ++# Priority 2. From e-fuse[ON/OFF switch by wifi.cfg] ++# ++# Priority 3. From insert module parameter ++# ++# Priority 4. From external file path ++# path only support some special charater "_" ":" "/" "." "-" ++# ++# Priority 5. Default[Software mode] ++# ++# 0. => 00:33:33:33:33:33 ++# 1. => Always random ++# 2. => First random and write to file[Default path mac_output_path] ++# ++############################################################ ++ignore_efuse_mac = 0 ++#mac_address_path = /xxxx/xxxx ++mac_address_mode = 2 ++mac_output_path = /data/wifimac ++ ++################################################## ++# Hardware setting ++# ++#volt regulator(DCDC-0 LDO-1) ++# ++################################################## ++xtal_clock = 24 ++volt_regulator = 1 ++ ++################################################## ++# Default channel after wifi on ++# value range: [1 ~ 14] ++################################################## ++def_chan = 6 ++################################################## ++# Hardware Capability Settings: ++################################################## ++hw_cap_ht = on ++hw_cap_gf = off ++hw_cap_2ghz = on ++hw_cap_5ghz = off ++hw_cap_security = on ++hw_cap_sgi_20 = on ++hw_cap_sgi_40 = off ++hw_cap_ap = on ++hw_cap_p2p = on ++hw_cap_ampdu_rx = on ++hw_cap_ampdu_tx = on ++use_wpa2_only = 1 ++################################################## ++# TX power level setting [0-14] ++# The larger the number the smaller the TX power ++# 0 - The maximum power ++# 1 level = -0.5db ++# ++# 6051Z .. 4 or 4 ++# 6051Q .. 2 or 5 ++# 6051P .. 0 or 0 ++# ++################################################## ++#wifi_tx_gain_level_b = 2 ++#wifi_tx_gain_level_gn = 5 ++################################################ ++# Signal strength control ++# rssi control ++#rssi_ctl = 10 ++ ++ ++################################################## ++# Import extenal configuration(UP to 64 groups) ++# example: ++# register = CE010010:91919191 ++# register = 00CC0010:00091919 ++################################################## +diff --git a/drivers/net/wireless/ssv6051/hci/hctrl.h b/drivers/net/wireless/ssv6051/hci/hctrl.h +new file mode 100644 +index 000000000000..95218c8040e7 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/hci/hctrl.h +@@ -0,0 +1,178 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _HCTRL_H_ ++#define _HCTRL_H_ ++#define MAX_FRAME_SIZE 4096 ++#define SSV6XXX_INT_RX 0x00000001 ++#define SSV6XXX_INT_TX 0x00000002 ++#define SSV6XXX_INT_SOC 0x00000004 ++#define SSV6XXX_INT_LOW_EDCA_0 0x00000008 ++#define SSV6XXX_INT_LOW_EDCA_1 0x00000010 ++#define SSV6XXX_INT_LOW_EDCA_2 0x00000020 ++#define SSV6XXX_INT_LOW_EDCA_3 0x00000040 ++#define SSV6XXX_INT_RESOURCE_LOW 0x00000080 ++#define IFDEV(_ct) ((_ct)->shi->dev) ++#define IFOPS(_ct) ((_ct)->shi->if_ops) ++#define HCI_REG_READ(_ct,_adr,_val) IFOPS(_ct)->readreg(IFDEV(_ct), _adr, _val) ++#define HCI_REG_WRITE(_ct,_adr,_val) IFOPS(_ct)->writereg(IFDEV(_ct), _adr, _val) ++#define HCI_REG_SET_BITS(_ct,_reg,_set,_clr) \ ++{ \ ++ u32 _regval; \ ++ if(HCI_REG_READ(_ct, _reg, &_regval)); \ ++ _regval &= ~(_clr); \ ++ _regval |= (_set); \ ++ if(HCI_REG_WRITE(_ct, _reg, _regval)); \ ++} ++#define IF_SEND(_ct,_bf,_len,_qid) IFOPS(_ct)->write(IFDEV(_ct), _bf, _len, _qid) ++#define IF_RECV(ct,bf,len) IFOPS(ct)->read(IFDEV(ct), bf, len) ++#define HCI_LOAD_FW(ct,_bf,open) IFOPS(ct)->load_fw(IFDEV(ct), _bf, open) ++#define HCI_IFC_RESET(ct) IFOPS(ct)->interface_reset(IFDEV(ct)) ++struct ssv6xxx_hci_ctrl { ++ struct ssv6xxx_hci_info *shi; ++ spinlock_t int_lock; ++ u32 int_status; ++ u32 int_mask; ++ struct mutex txq_mask_lock; ++ u32 txq_mask; ++ struct ssv_hw_txq hw_txq[SSV_HW_TXQ_NUM]; ++ struct mutex hci_mutex; ++ bool hci_start; ++ struct sk_buff *rx_buf; ++ u32 rx_pkt; ++ struct workqueue_struct *hci_work_queue; ++ struct work_struct hci_rx_work; ++ struct work_struct hci_tx_work; ++ u32 read_rs0_info_fail; ++ u32 read_rs1_info_fail; ++ u32 rx_work_running; ++ u32 isr_running; ++ u32 xmit_running; ++ u32 isr_summary_eable; ++ u32 isr_routine_time; ++ u32 isr_tx_time; ++ u32 isr_rx_time; ++ u32 isr_idle_time; ++ u32 isr_rx_idle_time; ++ u32 isr_miss_cnt; ++ unsigned long prev_isr_jiffes; ++ unsigned long prev_rx_isr_jiffes; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct dentry *debugfs_dir; ++ u32 isr_mib_enable; ++ u32 isr_mib_reset; ++ long long isr_total_time; ++ long long isr_tx_io_time; ++ long long isr_rx_io_time; ++ u32 isr_rx_io_count; ++ u32 isr_tx_io_count; ++ long long isr_rx_proc_time; ++#ifdef CONFIG_IRQ_DEBUG_COUNT ++ bool irq_enable; ++ u32 irq_count; ++ u32 invalid_irq_count; ++ u32 tx_irq_count; ++ u32 real_tx_irq_count; ++ u32 rx_irq_count; ++ u32 irq_rx_pkt_count; ++ u32 irq_tx_pkt_count; ++#endif ++#endif ++}; ++struct ssv6xxx_hci_txq_info { ++ u32 tx_use_page:8; ++ u32 tx_use_id:6; ++ u32 txq0_size:4; ++ u32 txq1_size:4; ++ u32 txq2_size:5; ++ u32 txq3_size:5; ++}; ++struct ssv6xxx_hci_txq_info2 { ++ u32 tx_use_page:9; ++ u32 tx_use_id:8; ++ u32 txq4_size:4; ++ u32 rsvd:11; ++}; ++struct ssv6xxx_hw_resource { ++ u32 free_tx_page; ++ u32 free_tx_id; ++ int max_tx_frame[SSV_HW_TXQ_NUM]; ++}; ++static inline void ssv6xxx_hwif_irq_request(struct ssv6xxx_hci_ctrl *hctrl, ++ irq_handler_t irq_handler) ++{ ++ if (hctrl->shi->if_ops->irq_request) ++ hctrl->shi->if_ops->irq_request(IFDEV(hctrl), irq_handler, ++ hctrl); ++} ++ ++static inline void ssv6xxx_hwif_irq_enable(struct ssv6xxx_hci_ctrl *hctrl) ++{ ++ if (hctrl->shi->if_ops->irq_enable) ++ hctrl->shi->if_ops->irq_enable(IFDEV(hctrl)); ++} ++ ++static inline void ssv6xxx_hwif_irq_disable(struct ssv6xxx_hci_ctrl *hctrl) ++{ ++ if (hctrl->shi->if_ops->irq_disable) ++ hctrl->shi->if_ops->irq_disable(IFDEV(hctrl), false); ++} ++ ++static inline int ssv6xxx_hwif_irq_getstatus(struct ssv6xxx_hci_ctrl *hctrl, ++ int *status) ++{ ++ if (hctrl->shi->if_ops->irq_getstatus) ++ return hctrl->shi->if_ops->irq_getstatus(IFDEV(hctrl), status); ++ return 0; ++} ++ ++static inline void ssv6xxx_hwif_irq_setmask(struct ssv6xxx_hci_ctrl *hctrl, ++ int mask) ++{ ++ if (hctrl->shi->if_ops->irq_setmask) ++ hctrl->shi->if_ops->irq_setmask(IFDEV(hctrl), mask); ++} ++ ++static inline void ssv6xxx_hwif_irq_trigger(struct ssv6xxx_hci_ctrl *hctrl) ++{ ++ if (hctrl->shi->if_ops->irq_trigger) ++ hctrl->shi->if_ops->irq_trigger(IFDEV(hctrl)); ++} ++ ++static inline void ssv6xxx_hwif_pmu_wakeup(struct ssv6xxx_hci_ctrl *hctrl) ++{ ++ if (hctrl->shi->if_ops->pmu_wakeup) ++ hctrl->shi->if_ops->pmu_wakeup(IFDEV(hctrl)); ++} ++ ++static inline int ssv6xxx_hwif_write_sram(struct ssv6xxx_hci_ctrl *hctrl, ++ u32 addr, u8 * data, u32 size) ++{ ++ if (hctrl->shi->if_ops->write_sram) ++ return hctrl->shi->if_ops->write_sram(IFDEV(hctrl), addr, data, ++ size); ++ return 0; ++} ++ ++#define HCI_IRQ_REQUEST(ct,hdle) ssv6xxx_hwif_irq_request(ct, hdle) ++#define HCI_IRQ_ENABLE(ct) ssv6xxx_hwif_irq_enable(ct) ++#define HCI_IRQ_DISABLE(ct) ssv6xxx_hwif_irq_disable(ct) ++#define HCI_IRQ_STATUS(ct,sts) ssv6xxx_hwif_irq_getstatus(ct, sts) ++#define HCI_IRQ_SET_MASK(ct,mk) ssv6xxx_hwif_irq_setmask(ct, mk) ++#define HCI_IRQ_TRIGGER(ct) ssv6xxx_hwif_irq_trigger(ct) ++#define HCI_PMU_WAKEUP(ct) ssv6xxx_hwif_pmu_wakeup(ct) ++#define HCI_SRAM_WRITE(_ct,_adr,_dat,_size) ssv6xxx_hwif_write_sram(_ct, _adr, _dat, _size); ++#endif +diff --git a/drivers/net/wireless/ssv6051/hci/ssv_hci.c b/drivers/net/wireless/ssv6051/hci/ssv_hci.c +new file mode 100644 +index 000000000000..9fedbeb55754 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/hci/ssv_hci.c +@@ -0,0 +1,967 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "hctrl.h" ++ ++static struct ssv6xxx_hci_ctrl *ctrl_hci = NULL; ++ ++struct sk_buff *ssv_skb_alloc(s32 len) ++{ ++ struct sk_buff *skb; ++ skb = __dev_alloc_skb(len + SSV6200_ALLOC_RSVD, GFP_KERNEL); ++ if (skb != NULL) { ++ skb_reserve(skb, SSV_SKB_info_size); ++ } ++ return skb; ++} ++ ++void ssv_skb_free(struct sk_buff *skb) ++{ ++ dev_kfree_skb_any(skb); ++} ++ ++static int ssv6xxx_hci_irq_enable(void) ++{ ++ HCI_IRQ_SET_MASK(ctrl_hci, ~(ctrl_hci->int_mask)); ++ HCI_IRQ_ENABLE(ctrl_hci); ++ return 0; ++} ++ ++static int ssv6xxx_hci_irq_disable(void) ++{ ++ HCI_IRQ_SET_MASK(ctrl_hci, 0xffffffff); ++ HCI_IRQ_DISABLE(ctrl_hci); ++ return 0; ++} ++ ++static void ssv6xxx_hci_irq_register(u32 irq_mask) ++{ ++ unsigned long flags; ++ u32 regval; ++ mutex_lock(&ctrl_hci->hci_mutex); ++ spin_lock_irqsave(&ctrl_hci->int_lock, flags); ++ ctrl_hci->int_mask |= irq_mask; ++ regval = ~ctrl_hci->int_mask; ++ spin_unlock_irqrestore(&ctrl_hci->int_lock, flags); ++ smp_mb(); ++ HCI_IRQ_SET_MASK(ctrl_hci, regval); ++ mutex_unlock(&ctrl_hci->hci_mutex); ++} ++ ++static inline u32 ssv6xxx_hci_get_int_bitno(int txqid) ++{ ++ if (txqid == SSV_HW_TXQ_NUM - 1) ++ return 1; ++ else ++ return txqid + 3; ++} ++ ++static int ssv6xxx_hci_start(void) ++{ ++ ssv6xxx_hci_irq_enable(); ++ ctrl_hci->hci_start = true; ++ HCI_IRQ_TRIGGER(ctrl_hci); ++ return 0; ++} ++ ++static int ssv6xxx_hci_stop(void) ++{ ++ ssv6xxx_hci_irq_disable(); ++ ctrl_hci->hci_start = false; ++ return 0; ++} ++ ++static int ssv6xxx_hci_read_word(u32 addr, u32 * regval) ++{ ++ int ret = HCI_REG_READ(ctrl_hci, addr, regval); ++ return ret; ++} ++ ++static int ssv6xxx_hci_write_word(u32 addr, u32 regval) ++{ ++ return HCI_REG_WRITE(ctrl_hci, addr, regval); ++} ++ ++static int ssv6xxx_hci_load_fw(u8 * firmware_name, u8 openfile) ++{ ++ return HCI_LOAD_FW(ctrl_hci, firmware_name, openfile); ++} ++ ++static int ssv6xxx_hci_write_sram(u32 addr, u8 * data, u32 size) ++{ ++ return HCI_SRAM_WRITE(ctrl_hci, addr, data, size); ++} ++ ++static int ssv6xxx_hci_pmu_wakeup(void) ++{ ++ HCI_PMU_WAKEUP(ctrl_hci); ++ return 0; ++} ++ ++static int ssv6xxx_hci_interface_reset(void) ++{ ++ HCI_IFC_RESET(ctrl_hci); ++ return 0; ++} ++ ++static int ssv6xxx_hci_send_cmd(struct sk_buff *skb) ++{ ++ int ret; ++ ret = IF_SEND(ctrl_hci, (void *)skb->data, skb->len, 0); ++ ++ if (ret < 0) ++ pr_warn("ssv6xxx_hci_send_cmd failed, ret=%d\n", ret); ++ ++ return ret; ++} ++ ++static int ssv6xxx_hci_enqueue(struct sk_buff *skb, int txqid, u32 tx_flags) ++{ ++ struct ssv_hw_txq *hw_txq; ++ unsigned long flags; ++ u32 status; ++ int qlen = 0; ++ BUG_ON(txqid >= SSV_HW_TXQ_NUM || txqid < 0); ++ if (txqid >= SSV_HW_TXQ_NUM || txqid < 0) ++ return -1; ++ hw_txq = &ctrl_hci->hw_txq[txqid]; ++ hw_txq->tx_flags = tx_flags; ++ if (tx_flags & HCI_FLAGS_ENQUEUE_HEAD) ++ skb_queue_head(&hw_txq->qhead, skb); ++ else ++ skb_queue_tail(&hw_txq->qhead, skb); ++ qlen = (int)skb_queue_len(&hw_txq->qhead); ++ if (!(tx_flags & HCI_FLAGS_NO_FLOWCTRL)) { ++ if (skb_queue_len(&hw_txq->qhead) >= hw_txq->max_qsize) { ++ ctrl_hci->shi->hci_tx_flow_ctrl_cb(ctrl_hci-> ++ shi->tx_fctrl_cb_args, ++ hw_txq->txq_no, true, ++ 2000); ++ } ++ } ++ ++ mutex_lock(&ctrl_hci->hci_mutex); ++ spin_lock_irqsave(&ctrl_hci->int_lock, flags); ++ status = ctrl_hci->int_mask; ++ ++ if ((ctrl_hci->int_mask & SSV6XXX_INT_RESOURCE_LOW) == 0) { ++ if (ctrl_hci->shi->if_ops->trigger_tx_rx == NULL) { ++ u32 regval; ++ ctrl_hci->int_mask |= SSV6XXX_INT_RESOURCE_LOW; ++ regval = ~ctrl_hci->int_mask; ++ spin_unlock_irqrestore(&ctrl_hci->int_lock, flags); ++ HCI_IRQ_SET_MASK(ctrl_hci, regval); ++ mutex_unlock(&ctrl_hci->hci_mutex); ++ } else { ++ ctrl_hci->int_status |= SSV6XXX_INT_RESOURCE_LOW; ++ smp_mb(); ++ spin_unlock_irqrestore(&ctrl_hci->int_lock, flags); ++ mutex_unlock(&ctrl_hci->hci_mutex); ++ ctrl_hci->shi->if_ops->trigger_tx_rx(ctrl_hci-> ++ shi->dev); ++ } ++ } else { ++ spin_unlock_irqrestore(&ctrl_hci->int_lock, flags); ++ mutex_unlock(&ctrl_hci->hci_mutex); ++ } ++ ++ return qlen; ++} ++ ++static bool ssv6xxx_hci_is_txq_empty(int txqid) ++{ ++ struct ssv_hw_txq *hw_txq; ++ BUG_ON(txqid >= SSV_HW_TXQ_NUM); ++ if (txqid >= SSV_HW_TXQ_NUM) ++ return false; ++ hw_txq = &ctrl_hci->hw_txq[txqid]; ++ if (skb_queue_len(&hw_txq->qhead) <= 0) ++ return true; ++ return false; ++} ++ ++static int ssv6xxx_hci_txq_flush(u32 txq_mask) ++{ ++ struct ssv_hw_txq *hw_txq; ++ struct sk_buff *skb = NULL; ++ int txqid; ++ for (txqid = 0; txqid < SSV_HW_TXQ_NUM; txqid++) { ++ if ((txq_mask & (1 << txqid)) != 0) ++ continue; ++ hw_txq = &ctrl_hci->hw_txq[txqid]; ++ while ((skb = skb_dequeue(&hw_txq->qhead))) { ++ ctrl_hci->shi->hci_tx_buf_free_cb(skb, ++ ctrl_hci-> ++ shi->tx_buf_free_args); ++ } ++ } ++ return 0; ++} ++ ++static int ssv6xxx_hci_txq_flush_by_sta(int aid) ++{ ++ return 0; ++} ++ ++static int ssv6xxx_hci_txq_pause(u32 txq_mask) ++{ ++ struct ssv_hw_txq *hw_txq; ++ int txqid; ++ mutex_lock(&ctrl_hci->txq_mask_lock); ++ ctrl_hci->txq_mask |= (txq_mask & 0x1F); ++ for (txqid = 0; txqid < SSV_HW_TXQ_NUM; txqid++) { ++ if ((ctrl_hci->txq_mask & (1 << txqid)) == 0) ++ continue; ++ hw_txq = &ctrl_hci->hw_txq[txqid]; ++ hw_txq->paused = true; ++ } ++ HCI_REG_SET_BITS(ctrl_hci, ADR_MTX_MISC_EN, ++ (ctrl_hci->txq_mask << 16), (0x1F << 16)); ++ mutex_unlock(&ctrl_hci->txq_mask_lock); ++ return 0; ++} ++ ++static int ssv6xxx_hci_txq_resume(u32 txq_mask) ++{ ++ struct ssv_hw_txq *hw_txq; ++ int txqid; ++ mutex_lock(&ctrl_hci->txq_mask_lock); ++ ctrl_hci->txq_mask &= ~(txq_mask & 0x1F); ++ for (txqid = 0; txqid < SSV_HW_TXQ_NUM; txqid++) { ++ if ((ctrl_hci->txq_mask & (1 << txqid)) != 0) ++ continue; ++ hw_txq = &ctrl_hci->hw_txq[txqid]; ++ hw_txq->paused = false; ++ } ++ HCI_REG_SET_BITS(ctrl_hci, ADR_MTX_MISC_EN, ++ (ctrl_hci->txq_mask << 16), (0x1F << 16)); ++ mutex_unlock(&ctrl_hci->txq_mask_lock); ++ return 0; ++} ++ ++static int ssv6xxx_hci_xmit(struct ssv_hw_txq *hw_txq, int max_count, ++ struct ssv6xxx_hw_resource *phw_resource) ++{ ++ struct sk_buff_head tx_cb_list; ++ struct sk_buff *skb = NULL; ++ int tx_count, ret, page_count; ++ struct ssv6200_tx_desc *tx_desc = NULL; ++ ctrl_hci->xmit_running = 1; ++ skb_queue_head_init(&tx_cb_list); ++ for (tx_count = 0; tx_count < max_count; tx_count++) { ++ if (ctrl_hci->hci_start == false) { ++ pr_debug("ssv6xxx_hci_xmit - hci_start = false\n"); ++ goto xmit_out; ++ } ++ skb = skb_dequeue(&hw_txq->qhead); ++ if (!skb) { ++ pr_debug("ssv6xxx_hci_xmit - queue empty\n"); ++ goto xmit_out; ++ } ++ page_count = (skb->len + SSV6200_ALLOC_RSVD); ++ if (page_count & HW_MMU_PAGE_MASK) ++ page_count = (page_count >> HW_MMU_PAGE_SHIFT) + 1; ++ else ++ page_count = page_count >> HW_MMU_PAGE_SHIFT; ++ if (page_count > (SSV6200_PAGE_TX_THRESHOLD / 2)) ++ pr_err("Asking page %d(%d) exceeds resource limit %d.\n", ++ page_count, skb->len, ++ (SSV6200_PAGE_TX_THRESHOLD / 2)); ++ if ((phw_resource->free_tx_page < page_count) ++ || (phw_resource->free_tx_id <= 0) ++ || (phw_resource->max_tx_frame[hw_txq->txq_no] <= 0)) { ++ skb_queue_head(&hw_txq->qhead, skb); ++ break; ++ } ++ phw_resource->free_tx_page -= page_count; ++ phw_resource->free_tx_id--; ++ phw_resource->max_tx_frame[hw_txq->txq_no]--; ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ ++ if (ctrl_hci->shi->hci_skb_update_cb != NULL ++ && tx_desc->reason != ID_TRAP_SW_TXTPUT) { ++ ctrl_hci->shi->hci_skb_update_cb(skb, ++ ctrl_hci-> ++ shi->skb_update_args); ++ } ++ ++ ret = ++ IF_SEND(ctrl_hci, (void *)skb->data, skb->len, ++ hw_txq->txq_no); ++ if (ret < 0) { ++ pr_err("ssv6xxx_hci_xmit failure\n"); ++ skb_queue_head(&hw_txq->qhead, skb); ++ break; ++ } ++ if (tx_desc->reason != ID_TRAP_SW_TXTPUT) ++ skb_queue_tail(&tx_cb_list, skb); ++ else ++ ssv_skb_free(skb); ++ hw_txq->tx_pkt++; ++ ++ if (!(hw_txq->tx_flags & HCI_FLAGS_NO_FLOWCTRL)) { ++ if (skb_queue_len(&hw_txq->qhead) < hw_txq->resum_thres) { ++ ctrl_hci->shi-> ++ hci_tx_flow_ctrl_cb ++ (ctrl_hci->shi->tx_fctrl_cb_args, ++ hw_txq->txq_no, false, 2000); ++ } ++ } ++ } ++ xmit_out: ++ if (ctrl_hci->shi->hci_tx_cb && tx_desc ++ && tx_desc->reason != ID_TRAP_SW_TXTPUT) { ++ ctrl_hci->shi->hci_tx_cb(&tx_cb_list, ++ ctrl_hci->shi->tx_cb_args); ++ } ++ ctrl_hci->xmit_running = 0; ++ return tx_count; ++} ++ ++static int ssv6xxx_hci_tx_handler(void *dev, int max_count) ++{ ++ struct ssv6xxx_hci_txq_info txq_info; ++ struct ssv6xxx_hci_txq_info2 txq_info2; ++ struct ssv6xxx_hw_resource hw_resource; ++ struct ssv_hw_txq *hw_txq = dev; ++ int ret, tx_count = 0; ++ max_count = skb_queue_len(&hw_txq->qhead); ++ if (max_count == 0) ++ return 0; ++ if (hw_txq->txq_no == 4) { ++ ret = ++ HCI_REG_READ(ctrl_hci, ADR_TX_ID_ALL_INFO2, ++ (u32 *) & txq_info2); ++ if (ret < 0) { ++ ctrl_hci->read_rs1_info_fail++; ++ return 0; ++ } ++ //BUG_ON(SSV6200_PAGE_TX_THRESHOLD < txq_info2.tx_use_page); ++ //BUG_ON(SSV6200_ID_TX_THRESHOLD < txq_info2.tx_use_id); ++ if (SSV6200_PAGE_TX_THRESHOLD < txq_info2.tx_use_page) ++ return 0; ++ if (SSV6200_ID_TX_THRESHOLD < txq_info2.tx_use_page) ++ return 0; ++ hw_resource.free_tx_page = ++ SSV6200_PAGE_TX_THRESHOLD - txq_info2.tx_use_page; ++ hw_resource.free_tx_id = ++ SSV6200_ID_TX_THRESHOLD - txq_info2.tx_use_id; ++ hw_resource.max_tx_frame[4] = ++ SSV6200_ID_MANAGER_QUEUE - txq_info2.txq4_size; ++ } else { ++ ret = ++ HCI_REG_READ(ctrl_hci, ADR_TX_ID_ALL_INFO, ++ (u32 *) & txq_info); ++ if (ret < 0) { ++ ctrl_hci->read_rs0_info_fail++; ++ return 0; ++ } ++ //BUG_ON(SSV6200_PAGE_TX_THRESHOLD < txq_info.tx_use_page); ++ //BUG_ON(SSV6200_ID_TX_THRESHOLD < txq_info.tx_use_id); ++ if (SSV6200_PAGE_TX_THRESHOLD < txq_info.tx_use_page) ++ return 0; ++ if (SSV6200_ID_TX_THRESHOLD < txq_info.tx_use_page) ++ return 0; ++ hw_resource.free_tx_page = ++ SSV6200_PAGE_TX_THRESHOLD - txq_info.tx_use_page; ++ hw_resource.free_tx_id = ++ SSV6200_ID_TX_THRESHOLD - txq_info.tx_use_id; ++ hw_resource.max_tx_frame[0] = ++ SSV6200_ID_AC_BK_OUT_QUEUE - txq_info.txq0_size; ++ hw_resource.max_tx_frame[1] = ++ SSV6200_ID_AC_BE_OUT_QUEUE - txq_info.txq1_size; ++ hw_resource.max_tx_frame[2] = ++ SSV6200_ID_AC_VI_OUT_QUEUE - txq_info.txq2_size; ++ hw_resource.max_tx_frame[3] = ++ SSV6200_ID_AC_VO_OUT_QUEUE - txq_info.txq3_size; ++ BUG_ON(hw_resource.max_tx_frame[3] < 0); ++ BUG_ON(hw_resource.max_tx_frame[2] < 0); ++ BUG_ON(hw_resource.max_tx_frame[1] < 0); ++ BUG_ON(hw_resource.max_tx_frame[0] < 0); ++ } ++ { ++ tx_count = ssv6xxx_hci_xmit(hw_txq, max_count, &hw_resource); ++ } ++ if ((ctrl_hci->shi->hci_tx_q_empty_cb != NULL) ++ && (skb_queue_len(&hw_txq->qhead) == 0)) { ++ ctrl_hci->shi->hci_tx_q_empty_cb(hw_txq->txq_no, ++ ctrl_hci-> ++ shi->tx_q_empty_args); ++ } ++ return tx_count; ++} ++ ++void ssv6xxx_hci_tx_work(struct work_struct *work) ++{ ++ ssv6xxx_hci_irq_register(SSV6XXX_INT_RESOURCE_LOW); ++} ++ ++static int _do_rx(struct ssv6xxx_hci_ctrl *hctl, u32 isr_status) ++{ ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ struct sk_buff_head rx_list; ++#endif ++ struct sk_buff *rx_mpdu; ++ int rx_cnt, ret = 0; ++ size_t dlen; ++ u32 status = isr_status; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct timespec rx_io_start_time, rx_io_end_time, rx_io_diff_time; ++ struct timespec rx_proc_start_time, rx_proc_end_time, rx_proc_diff_time; ++#endif ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ skb_queue_head_init(&rx_list); ++#endif ++ for (rx_cnt = 0; (status & SSV6XXX_INT_RX) && (rx_cnt < 32); rx_cnt++) { ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) ++ getnstimeofday(&rx_io_start_time); ++#endif ++ ret = IF_RECV(hctl, hctl->rx_buf->data, &dlen); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) ++ getnstimeofday(&rx_io_end_time); ++#endif ++ if (ret < 0 || dlen <= 0) { ++ pr_warn("%s(): IF_RECV() retruns %d (dlen=%d)\n", ++ __FUNCTION__, ret, (int)dlen); ++ if (ret != -84 || dlen > MAX_FRAME_SIZE) ++ break; ++ } ++ rx_mpdu = hctl->rx_buf; ++ hctl->rx_buf = ssv_skb_alloc(MAX_FRAME_SIZE); ++ if (hctl->rx_buf == NULL) { ++ pr_err("RX buffer allocation failure!\n"); ++ hctl->rx_buf = rx_mpdu; ++ break; ++ } ++ hctl->rx_pkt++; ++ skb_put(rx_mpdu, dlen); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) ++ getnstimeofday(&rx_proc_start_time); ++#endif ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ __skb_queue_tail(&rx_list, rx_mpdu); ++#else ++ hctl->shi->hci_rx_cb(rx_mpdu, hctl->shi->rx_cb_args); ++#endif ++ HCI_IRQ_STATUS(hctl, &status); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) { ++ getnstimeofday(&rx_proc_end_time); ++ hctl->isr_rx_io_count++; ++ rx_io_diff_time = ++ timespec_sub(rx_io_end_time, rx_io_start_time); ++ hctl->isr_rx_io_time += ++ timespec_to_ns(&rx_io_diff_time); ++ rx_proc_diff_time = ++ timespec_sub(rx_proc_end_time, rx_proc_start_time); ++ hctl->isr_rx_proc_time += ++ timespec_to_ns(&rx_proc_diff_time); ++ } ++#endif ++ } ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) ++ getnstimeofday(&rx_proc_start_time); ++#endif ++ hctl->shi->hci_rx_cb(&rx_list, hctl->shi->rx_cb_args); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) { ++ getnstimeofday(&rx_proc_end_time); ++ rx_proc_diff_time = ++ timespec_sub(rx_proc_end_time, rx_proc_start_time); ++ hctl->isr_rx_proc_time += timespec_to_ns(&rx_proc_diff_time); ++ } ++#endif ++#endif ++ return ret; ++} ++ ++static void ssv6xxx_hci_rx_work(struct work_struct *work) ++{ ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ struct sk_buff_head rx_list; ++#endif ++ struct sk_buff *rx_mpdu; ++ int rx_cnt, ret; ++ size_t dlen; ++ u32 status; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct timespec rx_io_start_time, rx_io_end_time, rx_io_diff_time; ++ struct timespec rx_proc_start_time, rx_proc_end_time, rx_proc_diff_time; ++#endif ++ ctrl_hci->rx_work_running = 1; ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ skb_queue_head_init(&rx_list); ++#endif ++ status = SSV6XXX_INT_RX; ++ for (rx_cnt = 0; (status & SSV6XXX_INT_RX) && (rx_cnt < 32); rx_cnt++) { ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) ++ getnstimeofday(&rx_io_start_time); ++#endif ++ ret = IF_RECV(ctrl_hci, ctrl_hci->rx_buf->data, &dlen); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) ++ getnstimeofday(&rx_io_end_time); ++#endif ++ if (ret < 0 || dlen <= 0) { ++ pr_warn("%s(): IF_RECV() retruns %d (dlen=%d)\n", ++ __FUNCTION__, ret, (int)dlen); ++ if (ret != -84 || dlen > MAX_FRAME_SIZE) ++ break; ++ } ++ rx_mpdu = ctrl_hci->rx_buf; ++ ctrl_hci->rx_buf = ssv_skb_alloc(MAX_FRAME_SIZE); ++ if (ctrl_hci->rx_buf == NULL) { ++ pr_err("RX buffer allocation failure!\n"); ++ ctrl_hci->rx_buf = rx_mpdu; ++ break; ++ } ++ ctrl_hci->rx_pkt++; ++ skb_put(rx_mpdu, dlen); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) ++ getnstimeofday(&rx_proc_start_time); ++#endif ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ __skb_queue_tail(&rx_list, rx_mpdu); ++#else ++ ctrl_hci->shi->hci_rx_cb(rx_mpdu, ctrl_hci->shi->rx_cb_args); ++#endif ++ HCI_IRQ_STATUS(ctrl_hci, &status); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) { ++ getnstimeofday(&rx_proc_end_time); ++ ctrl_hci->isr_rx_io_count++; ++ rx_io_diff_time = ++ timespec_sub(rx_io_end_time, rx_io_start_time); ++ ctrl_hci->isr_rx_io_time += ++ timespec_to_ns(&rx_io_diff_time); ++ rx_proc_diff_time = ++ timespec_sub(rx_proc_end_time, rx_proc_start_time); ++ ctrl_hci->isr_rx_proc_time += ++ timespec_to_ns(&rx_proc_diff_time); ++ } ++#endif ++ } ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) ++ getnstimeofday(&rx_proc_start_time); ++#endif ++ ctrl_hci->shi->hci_rx_cb(&rx_list, ctrl_hci->shi->rx_cb_args); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) { ++ getnstimeofday(&rx_proc_end_time); ++ rx_proc_diff_time = ++ timespec_sub(rx_proc_end_time, rx_proc_start_time); ++ ctrl_hci->isr_rx_proc_time += ++ timespec_to_ns(&rx_proc_diff_time); ++ } ++#endif ++#endif ++ ctrl_hci->rx_work_running = 0; ++} ++ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++static void ssv6xxx_isr_mib_reset(void) ++{ ++ ctrl_hci->isr_mib_reset = 0; ++ ctrl_hci->isr_total_time = 0; ++ ctrl_hci->isr_rx_io_time = 0; ++ ctrl_hci->isr_tx_io_time = 0; ++ ctrl_hci->isr_rx_io_count = 0; ++ ctrl_hci->isr_tx_io_count = 0; ++ ctrl_hci->isr_rx_proc_time = 0; ++} ++ ++static int hw_txq_len_open(struct inode *inode, struct file *filp) ++{ ++ filp->private_data = inode->i_private; ++ return 0; ++} ++ ++static ssize_t hw_txq_len_read(struct file *filp, char __user * buffer, ++ size_t count, loff_t * ppos) ++{ ++ ssize_t ret; ++ struct ssv6xxx_hci_ctrl *hctl = ++ (struct ssv6xxx_hci_ctrl *)filp->private_data; ++ char *summary_buf = kzalloc(1024, GFP_KERNEL); ++ char *prn_ptr = summary_buf; ++ int prt_size; ++ int buf_size = 1024; ++ int i = 0; ++ if (!summary_buf) ++ return -ENOMEM; ++ for (i = 0; i < SSV_HW_TXQ_NUM; i++) { ++ prt_size = ++ snprintf(prn_ptr, buf_size, "\n\rhw_txq%d_len: %d", i, ++ skb_queue_len(&hctl->hw_txq[i].qhead)); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ } ++ buf_size = 1024 - buf_size; ++ ret = ++ simple_read_from_buffer(buffer, count, ppos, summary_buf, buf_size); ++ kfree(summary_buf); ++ return ret; ++} ++ ++struct file_operations hw_txq_len_fops = { ++ .owner = THIS_MODULE, ++ .open = hw_txq_len_open, ++ .read = hw_txq_len_read, ++}; ++ ++bool ssv6xxx_hci_init_debugfs(struct dentry *dev_deugfs_dir) ++{ ++ ctrl_hci->debugfs_dir = debugfs_create_dir("hci", dev_deugfs_dir); ++ if (ctrl_hci->debugfs_dir == NULL) { ++ dev_err(ctrl_hci->shi->dev, ++ "Failed to create HCI debugfs directory.\n"); ++ return false; ++ } ++ debugfs_create_u32("TXQ_mask", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->txq_mask); ++ debugfs_create_u32("hci_isr_mib_enable", 00644, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_mib_enable); ++ debugfs_create_u32("hci_isr_mib_reset", 00644, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_mib_reset); ++ debugfs_create_u64("isr_total_time", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_total_time); ++ debugfs_create_u64("tx_io_time", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_tx_io_time); ++ debugfs_create_u64("rx_io_time", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_rx_io_time); ++ debugfs_create_u32("tx_io_count", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_tx_io_count); ++ debugfs_create_u32("rx_io_count", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_rx_io_count); ++ debugfs_create_u64("rx_proc_time", 00444, ctrl_hci->debugfs_dir, ++ &ctrl_hci->isr_rx_proc_time); ++ debugfs_create_file("hw_txq_len", 00444, ctrl_hci->debugfs_dir, ++ ctrl_hci, &hw_txq_len_fops); ++ return true; ++} ++ ++void ssv6xxx_hci_deinit_debugfs(void) ++{ ++ if (ctrl_hci->debugfs_dir == NULL) ++ return; ++ ctrl_hci->debugfs_dir = NULL; ++} ++#endif ++static int _isr_do_rx(struct ssv6xxx_hci_ctrl *hctl, u32 isr_status) ++{ ++ int status; ++ u32 before = jiffies; ++ ++ if (hctl->isr_summary_eable && hctl->prev_rx_isr_jiffes) { ++ if (hctl->isr_rx_idle_time) { ++ hctl->isr_rx_idle_time += ++ (jiffies - hctl->prev_rx_isr_jiffes); ++ hctl->isr_rx_idle_time = hctl->isr_rx_idle_time >> 1; ++ } else { ++ hctl->isr_rx_idle_time += ++ (jiffies - hctl->prev_rx_isr_jiffes); ++ } ++ } ++ status = _do_rx(hctl, isr_status); ++ if (hctl->isr_summary_eable) { ++ if (hctl->isr_rx_time) { ++ hctl->isr_rx_time += (jiffies - before); ++ hctl->isr_rx_time = hctl->isr_rx_time >> 1; ++ } else { ++ hctl->isr_rx_time += (jiffies - before); ++ } ++ hctl->prev_rx_isr_jiffes = jiffies; ++ } ++ return status; ++} ++ ++static int _do_tx(struct ssv6xxx_hci_ctrl *hctl, u32 status) ++{ ++ int q_num; ++ int tx_count = 0; ++ u32 to_disable_int = 1; ++ unsigned long flags; ++ struct ssv_hw_txq *hw_txq; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct timespec tx_io_start_time, tx_io_end_time, tx_io_diff_time; ++#endif ++#ifdef CONFIG_IRQ_DEBUG_COUNT ++ if ((!(status & SSV6XXX_INT_RX)) && htcl->irq_enable) ++ hctl->tx_irq_count++; ++#endif ++ if ((status & SSV6XXX_INT_RESOURCE_LOW) == 0) ++ return 0; ++ for (q_num = (SSV_HW_TXQ_NUM - 1); q_num >= 0; q_num--) { ++ u32 before = jiffies; ++ hw_txq = &hctl->hw_txq[q_num]; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) ++ getnstimeofday(&tx_io_start_time); ++#endif ++ tx_count += ssv6xxx_hci_tx_handler(hw_txq, 999); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (hctl->isr_mib_enable) { ++ getnstimeofday(&tx_io_end_time); ++ tx_io_diff_time = ++ timespec_sub(tx_io_end_time, tx_io_start_time); ++ hctl->isr_tx_io_time += ++ timespec_to_ns(&tx_io_diff_time); ++ } ++#endif ++ if (hctl->isr_summary_eable) { ++ if (hctl->isr_tx_time) { ++ hctl->isr_tx_time += (jiffies - before); ++ hctl->isr_tx_time = hctl->isr_tx_time >> 1; ++ } else { ++ hctl->isr_tx_time += (jiffies - before); ++ } ++ } ++ } ++ mutex_lock(&hctl->hci_mutex); ++ spin_lock_irqsave(&hctl->int_lock, flags); ++ for (q_num = (SSV_HW_TXQ_NUM - 1); q_num >= 0; q_num--) { ++ hw_txq = &hctl->hw_txq[q_num]; ++ if (skb_queue_len(&hw_txq->qhead) > 0) { ++ to_disable_int = 0; ++ break; ++ } ++ } ++ if (to_disable_int) { ++ u32 reg_val; ++ hctl->int_mask &= ~(SSV6XXX_INT_RESOURCE_LOW | SSV6XXX_INT_TX); ++ reg_val = ~hctl->int_mask; ++ spin_unlock_irqrestore(&hctl->int_lock, flags); ++ HCI_IRQ_SET_MASK(hctl, reg_val); ++ } else { ++ spin_unlock_irqrestore(&hctl->int_lock, flags); ++ } ++ mutex_unlock(&hctl->hci_mutex); ++ return tx_count; ++} ++ ++irqreturn_t ssv6xxx_hci_isr(int irq, void *args) ++{ ++ struct ssv6xxx_hci_ctrl *hctl = args; ++ u32 status; ++ unsigned long flags; ++ int ret = IRQ_HANDLED; ++ bool dbg_isr_miss = true; ++ if (ctrl_hci->isr_summary_eable && ctrl_hci->prev_isr_jiffes) { ++ if (ctrl_hci->isr_idle_time) { ++ ctrl_hci->isr_idle_time += ++ (jiffies - ctrl_hci->prev_isr_jiffes); ++ ctrl_hci->isr_idle_time = ctrl_hci->isr_idle_time >> 1; ++ } else { ++ ctrl_hci->isr_idle_time += ++ (jiffies - ctrl_hci->prev_isr_jiffes); ++ } ++ } ++ BUG_ON(!args); ++ do { ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct timespec start_time, end_time, diff_time; ++ if (hctl->isr_mib_reset) ++ ssv6xxx_isr_mib_reset(); ++ if (hctl->isr_mib_enable) ++ getnstimeofday(&start_time); ++#endif ++#ifdef CONFIG_IRQ_DEBUG_COUNT ++ if (ctrl_hci->irq_enable) ++ ctrl_hci->irq_count++; ++#endif ++ mutex_lock(&hctl->hci_mutex); ++ if (hctl->int_status) { ++ u32 regval; ++ spin_lock_irqsave(&hctl->int_lock, flags); ++ hctl->int_mask |= hctl->int_status; ++ hctl->int_status = 0; ++ regval = ~ctrl_hci->int_mask; ++ smp_mb(); ++ spin_unlock_irqrestore(&hctl->int_lock, flags); ++ HCI_IRQ_SET_MASK(hctl, regval); ++ } ++ ret = HCI_IRQ_STATUS(hctl, &status); ++ if ((ret < 0) || ((status & hctl->int_mask) == 0)) { ++#ifdef CONFIG_IRQ_DEBUG_COUNT ++ if (ctrl_hci->irq_enable) ++ ctrl_hci->invalid_irq_count++; ++#endif ++ mutex_unlock(&hctl->hci_mutex); ++ ret = IRQ_NONE; ++ break; ++ } ++ spin_lock_irqsave(&hctl->int_lock, flags); ++ status &= hctl->int_mask; ++ spin_unlock_irqrestore(&hctl->int_lock, flags); ++ mutex_unlock(&hctl->hci_mutex); ++ ctrl_hci->isr_running = 1; ++ if (status & SSV6XXX_INT_RX) { ++ ret = _isr_do_rx(hctl, status); ++ if (ret < 0) { ++ ret = IRQ_NONE; ++ break; ++ } ++ dbg_isr_miss = false; ++ } ++ if (_do_tx(hctl, status)) { ++ dbg_isr_miss = false; ++ } ++ ctrl_hci->isr_running = 0; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ctrl_hci->isr_mib_enable) { ++ getnstimeofday(&end_time); ++ diff_time = timespec_sub(end_time, start_time); ++ ctrl_hci->isr_total_time += timespec_to_ns(&diff_time); ++ } ++#endif ++ } while (1); ++ if (ctrl_hci->isr_summary_eable) { ++ if (dbg_isr_miss) ++ ctrl_hci->isr_miss_cnt++; ++ ctrl_hci->prev_isr_jiffes = jiffies; ++ } ++ return ret; ++} ++ ++static struct ssv6xxx_hci_ops hci_ops = { ++ .hci_start = ssv6xxx_hci_start, ++ .hci_stop = ssv6xxx_hci_stop, ++ .hci_read_word = ssv6xxx_hci_read_word, ++ .hci_write_word = ssv6xxx_hci_write_word, ++ .hci_tx = ssv6xxx_hci_enqueue, ++ .hci_tx_pause = ssv6xxx_hci_txq_pause, ++ .hci_tx_resume = ssv6xxx_hci_txq_resume, ++ .hci_txq_flush = ssv6xxx_hci_txq_flush, ++ .hci_txq_flush_by_sta = ssv6xxx_hci_txq_flush_by_sta, ++ .hci_txq_empty = ssv6xxx_hci_is_txq_empty, ++ .hci_load_fw = ssv6xxx_hci_load_fw, ++ .hci_pmu_wakeup = ssv6xxx_hci_pmu_wakeup, ++ .hci_send_cmd = ssv6xxx_hci_send_cmd, ++ .hci_write_sram = ssv6xxx_hci_write_sram, ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ .hci_init_debugfs = ssv6xxx_hci_init_debugfs, ++ .hci_deinit_debugfs = ssv6xxx_hci_deinit_debugfs, ++#endif ++ .hci_interface_reset = ssv6xxx_hci_interface_reset, ++}; ++ ++int ssv6xxx_hci_deregister(void) ++{ ++ u32 regval; ++ pr_debug("%s(): \n", __FUNCTION__); ++ if (ctrl_hci->shi == NULL) ++ return -1; ++ regval = 1; ++ ssv6xxx_hci_irq_disable(); ++ flush_workqueue(ctrl_hci->hci_work_queue); ++ destroy_workqueue(ctrl_hci->hci_work_queue); ++ ctrl_hci->shi = NULL; ++ return 0; ++} ++ ++EXPORT_SYMBOL(ssv6xxx_hci_deregister); ++int ssv6xxx_hci_register(struct ssv6xxx_hci_info *shi) ++{ ++ int i; ++ if (shi == NULL || ctrl_hci->shi) ++ return -1; ++ shi->hci_ops = &hci_ops; ++ ctrl_hci->shi = shi; ++ ctrl_hci->txq_mask = 0; ++ mutex_init(&ctrl_hci->txq_mask_lock); ++ mutex_init(&ctrl_hci->hci_mutex); ++ spin_lock_init(&ctrl_hci->int_lock); ++ ++ for (i = 0; i < SSV_HW_TXQ_NUM; i++) { ++ memset(&ctrl_hci->hw_txq[i], 0, sizeof(struct ssv_hw_txq)); ++ skb_queue_head_init(&ctrl_hci->hw_txq[i].qhead); ++ ctrl_hci->hw_txq[i].txq_no = (u32) i; ++ ctrl_hci->hw_txq[i].max_qsize = SSV_HW_TXQ_MAX_SIZE; ++ ctrl_hci->hw_txq[i].resum_thres = SSV_HW_TXQ_RESUME_THRES; ++ } ++ ctrl_hci->hci_work_queue = ++ create_singlethread_workqueue("ssv6xxx_hci_wq"); ++ INIT_WORK(&ctrl_hci->hci_rx_work, ssv6xxx_hci_rx_work); ++ INIT_WORK(&ctrl_hci->hci_tx_work, ssv6xxx_hci_tx_work); ++ ctrl_hci->int_mask = SSV6XXX_INT_RX | SSV6XXX_INT_RESOURCE_LOW; ++ ctrl_hci->int_status = 0; ++ HCI_IRQ_SET_MASK(ctrl_hci, 0xFFFFFFFF); ++ ssv6xxx_hci_irq_disable(); ++ HCI_IRQ_REQUEST(ctrl_hci, ssv6xxx_hci_isr); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ctrl_hci->debugfs_dir = NULL; ++ ctrl_hci->isr_mib_enable = false; ++ ctrl_hci->isr_mib_reset = 0; ++ ctrl_hci->isr_total_time = 0; ++ ctrl_hci->isr_rx_io_time = 0; ++ ctrl_hci->isr_tx_io_time = 0; ++ ctrl_hci->isr_rx_io_count = 0; ++ ctrl_hci->isr_tx_io_count = 0; ++ ctrl_hci->isr_rx_proc_time = 0; ++#endif ++ return 0; ++} ++ ++EXPORT_SYMBOL(ssv6xxx_hci_register); ++int ssv6xxx_hci_init(void) ++{ ++#ifdef CONFIG_SSV6200_CLI_ENABLE ++ extern struct ssv6xxx_hci_ctrl *ssv_dbg_ctrl_hci; ++#endif ++ ctrl_hci = kzalloc(sizeof(*ctrl_hci), GFP_KERNEL); ++ if (ctrl_hci == NULL) ++ return -ENOMEM; ++ memset((void *)ctrl_hci, 0, sizeof(*ctrl_hci)); ++ ctrl_hci->rx_buf = ssv_skb_alloc(MAX_FRAME_SIZE); ++ if (ctrl_hci->rx_buf == NULL) { ++ kfree(ctrl_hci); ++ return -ENOMEM; ++ } ++#ifdef CONFIG_SSV6200_CLI_ENABLE ++ ssv_dbg_ctrl_hci = ctrl_hci; ++#endif ++ return 0; ++} ++ ++void ssv6xxx_hci_exit(void) ++{ ++#ifdef CONFIG_SSV6200_CLI_ENABLE ++ extern struct ssv6xxx_hci_ctrl *ssv_dbg_ctrl_hci; ++#endif ++ kfree(ctrl_hci); ++ ctrl_hci = NULL; ++#ifdef CONFIG_SSV6200_CLI_ENABLE ++ ssv_dbg_ctrl_hci = NULL; ++#endif ++} ++ ++EXPORT_SYMBOL(ssv6xxx_hci_init); ++EXPORT_SYMBOL(ssv6xxx_hci_exit); +diff --git a/drivers/net/wireless/ssv6051/hci/ssv_hci.h b/drivers/net/wireless/ssv6051/hci/ssv_hci.h +new file mode 100644 +index 000000000000..dd166c607d5d +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/hci/ssv_hci.h +@@ -0,0 +1,77 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_HCI_H_ ++#define _SSV_HCI_H_ ++#define SSV_HW_TXQ_NUM 5 ++#define SSV_HW_TXQ_MAX_SIZE 64 ++#define SSV_HW_TXQ_RESUME_THRES ((SSV_HW_TXQ_MAX_SIZE >> 2) *3) ++#define HCI_FLAGS_ENQUEUE_HEAD 0x00000001 ++#define HCI_FLAGS_NO_FLOWCTRL 0x00000002 ++struct ssv_hw_txq { ++ u32 txq_no; ++ struct sk_buff_head qhead; ++ int max_qsize; ++ int resum_thres; ++ bool paused; ++ u32 tx_pkt; ++ u32 tx_flags; ++}; ++struct ssv6xxx_hci_ops { ++ int (*hci_start)(void); ++ int (*hci_stop)(void); ++ int (*hci_read_word)(u32 addr, u32 * regval); ++ int (*hci_write_word)(u32 addr, u32 regval); ++ int (*hci_load_fw)(u8 * firmware_name, u8 openfile); ++ int (*hci_tx)(struct sk_buff *, int, u32); ++ int (*hci_tx_pause)(u32 txq_mask); ++ int (*hci_tx_resume)(u32 txq_mask); ++ int (*hci_txq_flush)(u32 txq_mask); ++ int (*hci_txq_flush_by_sta)(int aid); ++ bool (*hci_txq_empty)(int txqid); ++ int (*hci_pmu_wakeup)(void); ++ int (*hci_send_cmd)(struct sk_buff *); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ bool (*hci_init_debugfs)(struct dentry * dev_deugfs_dir); ++ void (*hci_deinit_debugfs)(void); ++#endif ++ int (*hci_write_sram)(u32 addr, u8 * data, u32 size); ++ int (*hci_interface_reset)(void); ++}; ++struct ssv6xxx_hci_info { ++ struct device *dev; ++ struct ssv6xxx_hwif_ops *if_ops; ++ struct ssv6xxx_hci_ops *hci_ops; ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ int (*hci_rx_cb)(struct sk_buff_head *, void *); ++#else ++ int (*hci_rx_cb)(struct sk_buff *, void *); ++#endif ++ void *rx_cb_args; ++ void (*hci_tx_cb)(struct sk_buff_head *, void *); ++ void *tx_cb_args; ++ int (*hci_tx_flow_ctrl_cb)(void *, int, bool, int debug); ++ void *tx_fctrl_cb_args; ++ void (*hci_tx_buf_free_cb)(struct sk_buff *, void *); ++ void *tx_buf_free_args; ++ void (*hci_skb_update_cb)(struct sk_buff *, void *); ++ void *skb_update_args; ++ void (*hci_tx_q_empty_cb)(u32 txq_no, void *); ++ void *tx_q_empty_args; ++}; ++int ssv6xxx_hci_deregister(void); ++int ssv6xxx_hci_register(struct ssv6xxx_hci_info *); ++#endif +diff --git a/drivers/net/wireless/ssv6051/hwif/hwif.h b/drivers/net/wireless/ssv6051/hwif/hwif.h +new file mode 100644 +index 000000000000..6b5263d157d8 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/hwif/hwif.h +@@ -0,0 +1,84 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _LINUX_SSVCABRIO_PLATFORM_H ++#define _LINUX_SSVCABRIO_PLATFORM_H ++#include ++#include ++#define SSVCABRIO_PLAT_EEP_MAX_WORDS 2048 ++#define SSV_REG_WRITE(dev,reg,val) \ ++ (sh)->priv->ops->writereg((sh)->sc->dev, (reg), (val)) ++#define SSV_REG_READ(dev,reg,buf) \ ++ (sh)->priv->ops->readreg((sh)->sc->dev, (reg), (buf)) ++#if 0 ++#define SSV_REG_WRITE(sh,reg,val) \ ++ (sh)->priv->ops->writereg((sh)->sc->dev, (reg), (val)) ++#define SSV_REG_READ(sh,reg,buf) \ ++ (sh)->priv->ops->readreg((sh)->sc->dev, (reg), (buf)) ++#define SSV_REG_CONFIRM(sh,reg,val) \ ++{ \ ++ u32 regval; \ ++ SSV_REG_READ(sh, reg, ®val); \ ++ if (regval != (val)) { \ ++ printk("[0x%08x]: 0x%08x!=0x%08x\n",\ ++ (reg), (val), regval); \ ++ return -1; \ ++ } \ ++} ++#define SSV_REG_SET_BITS(sh,reg,set,clr) \ ++{ \ ++ u32 reg_val; \ ++ SSV_REG_READ(sh, reg, ®_val); \ ++ reg_val &= ~(clr); \ ++ reg_val |= (set); \ ++ SSV_REG_WRITE(sh, reg, reg_val); \ ++} ++#endif ++struct ssv6xxx_hwif_ops { ++ int __must_check (*read)(struct device *child, void *buf,size_t *size); ++ int __must_check (*write)(struct device *child, void *buf, size_t len,u8 queue_num); ++ int __must_check (*readreg)(struct device *child, u32 addr, u32 *buf); ++ int __must_check (*writereg)(struct device *child, u32 addr, u32 buf); ++ int (*trigger_tx_rx)(struct device *child); ++ int (*irq_getmask)(struct device *child, u32 *mask); ++ void (*irq_setmask)(struct device *child,int mask); ++ void (*irq_enable)(struct device *child); ++ void (*irq_disable)(struct device *child,bool iswaitirq); ++ int (*irq_getstatus)(struct device *child,int *status); ++ void (*irq_request)(struct device *child,irq_handler_t irq_handler,void *irq_dev); ++ void (*irq_trigger)(struct device *child); ++ void (*pmu_wakeup)(struct device *child); ++ int __must_check (*load_fw)(struct device *child, u8 *firmware_name, u8 openfile); ++ int (*cmd52_read)(struct device *child, u32 addr, u32 *value); ++ int (*cmd52_write)(struct device *child, u32 addr, u32 value); ++ bool (*support_scatter)(struct device *child); ++ int (*rw_scatter)(struct device *child, struct sdio_scatter_req *scat_req); ++ bool (*is_ready)(struct device *child); ++ int (*write_sram)(struct device *child, u32 addr, u8 *data, u32 size); ++ void (*interface_reset)(struct device *child); ++}; ++struct ssv6xxx_if_debug { ++ struct device *dev; ++ struct platform_device *pdev; ++}; ++struct ssv6xxx_platform_data { ++ atomic_t irq_handling; ++ bool is_enabled; ++ unsigned short vendor; ++ unsigned short device; ++ struct ssv6xxx_hwif_ops *ops; ++}; ++#endif +diff --git a/drivers/net/wireless/ssv6051/hwif/sdio/sdio.c b/drivers/net/wireless/ssv6051/hwif/sdio/sdio.c +new file mode 100644 +index 000000000000..273777cd0485 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/hwif/sdio/sdio.c +@@ -0,0 +1,1254 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "sdio_def.h" ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define LOW_SPEED_SDIO_CLOCK (25000000) ++#define HIGH_SPEED_SDIO_CLOCK (37500000) ++#define MAX_RX_FRAME_SIZE 0x900 ++#define SSV_VENDOR_ID 0x3030 ++#define SSV_CABRIO_DEVID 0x3030 ++#define ENABLE_FW_SELF_CHECK 1 ++#define FW_BLOCK_SIZE 0x8000 ++#define CHECKSUM_BLOCK_SIZE 1024 ++#define FW_CHECKSUM_INIT (0x12345678) ++#define FW_STATUS_REG ADR_TX_SEG ++#define FW_STATUS_MASK (0x00FF0000) ++ ++#define ret_if_not_ready(value) \ ++ do { \ ++ if ((wlan_data.is_enabled == false) || \ ++ (glue == NULL) || (glue->dev_ready == false)) { \ ++ pr_warn("ret_if_not_ready() called when not ready"); \ ++ return value; }\ ++ } while(0) ++ ++static int ssv6xxx_sdio_trigger_pmu(struct device *dev); ++static void ssv6xxx_sdio_reset(struct device *child); ++ ++static void ssv6xxx_high_sdio_clk(struct sdio_func *func); ++static void ssv6xxx_low_sdio_clk(struct sdio_func *func); ++extern void *ssv6xxx_ifdebug_info[]; ++extern int ssv_devicetype; ++extern void ssv6xxx_deinit_prepare(void); ++ ++static struct ssv6xxx_platform_data wlan_data; ++ ++static int ssv6xxx_sdio_status = 0; ++u32 sdio_sr_bhvr = SUSPEND_RESUME_0; ++EXPORT_SYMBOL(sdio_sr_bhvr); ++ ++u32 shutdown_flags = SSV_SYS_REBOOT; ++ ++struct ssv6xxx_sdio_glue { ++ struct device *dev; ++ struct platform_device *core; ++ struct sk_buff *dma_skb; ++#ifdef CONFIG_PM ++ struct sk_buff *cmd_skb; ++#endif ++ unsigned int ioport_data; ++ unsigned int ioport_reg; ++ irq_handler_t irq_handler; ++ void *irq_dev; ++ bool dev_ready; ++}; ++ ++static const struct sdio_device_id ssv6xxx_sdio_devices[] = { ++ {SDIO_DEVICE(SSV_VENDOR_ID, SSV_CABRIO_DEVID)}, ++ {} ++}; ++ ++MODULE_DEVICE_TABLE(sdio, ssv6xxx_sdio_devices); ++ ++static bool ssv6xxx_is_ready(struct device *child) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ ++ ret_if_not_ready(false); ++ ++ return true; ++} ++ ++static int ssv6xxx_sdio_cmd52_read(struct device *child, u32 addr, u32 * value) ++{ ++ int ret; ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ *value = sdio_readb(func, addr, &ret); ++ sdio_release_host(func); ++ ++ return ret; ++} ++ ++static int ssv6xxx_sdio_cmd52_write(struct device *child, u32 addr, u32 value) ++{ ++ int ret; ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ sdio_writeb(func, value, addr, &ret); ++ sdio_release_host(func); ++ ++ return ret; ++} ++ ++static int __must_check ++ssv6xxx_sdio_read_reg(struct device *child, u32 addr, u32 * buf) ++{ ++ int ret; ++ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ u32 data; ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ ++ sdio_claim_host(func); ++ ++ data = addr; ++ ++ sdio_writel(func, addr, glue->ioport_reg, &ret); ++ ++ if (unlikely(ret)) { ++ dev_err(child->parent, "sdio read reg write address failed (%d)\n", ret); ++ goto io_err; ++ } ++ ++ data = sdio_readl(func, glue->ioport_reg, &ret); ++ ++ if (unlikely(ret)) { ++ *buf = 0xffffffff; ++ dev_err(child->parent, "sdio read reg from I/O failed (%d)\n", ret); ++ goto io_err; ++ } ++ ++ *buf = data; ++ ++io_err: ++ sdio_release_host(func); ++ ++ return ret; ++} ++ ++#ifdef ENABLE_WAKE_IO_ISR_WHEN_HCI_ENQUEUE ++static int ssv6xxx_sdio_trigger_tx_rx(struct device *child) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ struct mmc_host *host; ++ ++ if (glue == NULL) ++ return -1; ++ ++ func = dev_to_sdio_func(glue->dev); ++ host = func->card->host; ++ mmc_signal_sdio_irq(host); ++ ++ return 0; ++ ++} ++#endif ++ ++static int __must_check ++ssv6xxx_sdio_write_reg(struct device *child, u32 addr, u32 buf) ++{ ++ int ret; ++ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ u32 data[2]; ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ ++ sdio_claim_host(func); ++ data[0] = addr; ++ data[1] = buf; ++ ++ ret = sdio_memcpy_toio(func, glue->ioport_reg, data, sizeof(data)); ++ sdio_release_host(func); ++ ++ return ret; ++} ++ ++static int ++ssv6xxx_sdio_write_sram(struct device *child, u32 addr, u8 * data, u32 size) ++{ ++ int ret = 0; ++ struct ssv6xxx_sdio_glue *glue; ++ struct sdio_func *func = NULL; ++ glue = dev_get_drvdata(child->parent); ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ ++ ret |= ssv6xxx_sdio_write_reg(child, 0xc0000860, addr); ++ if (unlikely(ret)) ++ goto out; ++ ++ sdio_writeb(func, 0x2, REG_Fn1_STATUS, &ret); ++ if (unlikely(ret)) ++ goto out; ++ ++ ret = sdio_memcpy_toio(func, glue->ioport_data, data, size); ++ if (unlikely(ret)) ++ goto out; ++ ++ sdio_writeb(func, 0, REG_Fn1_STATUS, &ret); ++ if (unlikely(ret)) ++ goto out; ++ ++out: ++ sdio_release_host(func); ++ return ret; ++ ++} ++ ++struct file *ssv6xxx_open_firmware(char *user_mainfw) ++{ ++ struct file *fp; ++ fp = filp_open(user_mainfw, O_RDONLY, 0); ++ ++ if (IS_ERR(fp)) ++ fp = NULL; ++ ++ return fp; ++} ++ ++int ssv6xxx_read_fw_block(char *buf, int len, struct file *fp) ++{ ++ ++ int read; ++ loff_t pos; ++ ++ pos = fp->f_pos; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) ++ read = kernel_read(fp, (void *)buf, len, &pos); ++#else ++ read = kernel_read(fp, pos, buf, len); ++#endif ++ ++ if (read > 0) ++ fp->f_pos += read; ++ ++ return read; ++ ++} ++ ++void ssv6xxx_close_firmware(struct file *fp) ++{ ++ if (fp) ++ filp_close(fp, NULL); ++} ++ ++static int ++ssv6xxx_sdio_upload_firmware(struct device *child, const u8 *firmware, u32 firmware_length) ++{ ++ int ret; ++ u32 clk_en; ++ u32 word_count, i; ++ u32 block_size; ++ u8 *buffer; ++ u32 sram_ptr = 0; ++ u32 block_count = 0; ++ u32 firmware_ptr = 0; ++ ++ u32 checksum = FW_CHECKSUM_INIT; ++ u32 fw_checksum, fw_blkcnt; ++ ++ struct ssv6xxx_sdio_glue *glue; ++ ++ glue = dev_get_drvdata(child->parent); ++ ++ if ((wlan_data.is_enabled == false) && ++ (glue == NULL) && ++ (glue->dev_ready == false)) ++ goto out; ++ ++ buffer = (u8 *)kzalloc(FW_BLOCK_SIZE, GFP_KERNEL); ++ if (buffer == NULL) { ++ dev_err(child, "Failed to allocate buffer for firmware.\n"); ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ dev_dbg(child, "preparing registers and clock for firmware upload\n"); ++ ++ ret = ssv6xxx_sdio_write_reg(child, ADR_BRG_SW_RST, 0x0); ++ if (unlikely(ret)) ++ goto out; ++ ++ ret = ssv6xxx_sdio_write_reg(child, ADR_BOOT, 0x01); ++ if (unlikely(ret)) ++ goto out; ++ ++ ret = ssv6xxx_sdio_read_reg(child, ADR_PLATFORM_CLOCK_ENABLE, &clk_en); ++ if (unlikely(ret)) ++ goto out; ++ ++ ret = ssv6xxx_sdio_write_reg(child, ADR_PLATFORM_CLOCK_ENABLE, clk_en | (1 << 2)); ++ if (unlikely(ret)) ++ goto out; ++ ++ dev_dbg(child, "begin writing firmware\n"); ++ ++ while (firmware_length > 0) { ++ ++ memset(buffer, 0xA5, FW_BLOCK_SIZE); ++ ++ block_size = firmware_length; ++ if (block_size > FW_BLOCK_SIZE) ++ block_size = FW_BLOCK_SIZE; ++ ++ memcpy(buffer, &firmware[firmware_ptr], block_size); ++ ++ firmware_ptr += block_size; ++ firmware_length -= block_size; ++ ++ /* ++ * Uploading to chip sram and checksumming happens in chunks of CHECKSUM_BLOCK_SIZE, ++ * so we round the block size accordingly and use that valueù ++ */ ++ block_size = DIV_ROUND_UP(block_size, CHECKSUM_BLOCK_SIZE) * CHECKSUM_BLOCK_SIZE; ++ ret = ssv6xxx_sdio_write_sram(child, sram_ptr, (u8 *)buffer, block_size); ++ ++ if (ret) { ++ dev_err(child, "firmware upload failed\n"); ++ goto out; ++ } ++ ++ sram_ptr += block_size; ++ ++ word_count = block_size / sizeof(u32); ++ for (i = 0; i < word_count; i++) ++ checksum += ((u32 *)buffer)[i]; ++ ++ } ++ ++ checksum = ((checksum >> 24) + ++ (checksum >> 16) + ++ (checksum >> 8) + ++ checksum) & 0x0FF; ++ checksum <<= 16; ++ ++ block_count = DIV_ROUND_UP(sram_ptr, CHECKSUM_BLOCK_SIZE); ++ ret = ssv6xxx_sdio_write_reg(child, FW_STATUS_REG, (block_count << 16)); ++ if (unlikely(ret)) ++ goto out; ++ ++ ret = ssv6xxx_sdio_read_reg(child, FW_STATUS_REG, &fw_blkcnt); ++ if (unlikely(ret)) ++ goto out; ++ ++ ret = ssv6xxx_sdio_write_reg(child, ADR_BRG_SW_RST, 0x1); ++ if (unlikely(ret)) ++ goto out; ++ ++ dev_info(child, "firmware upload complete (wrote %d blocks, verified %d blocks)\n", block_count, fw_blkcnt >> 16); ++ ++ msleep(50); ++ ++ ret = ssv6xxx_sdio_read_reg(child, FW_STATUS_REG, &fw_checksum); ++ fw_checksum = fw_checksum & FW_STATUS_MASK; ++ ++ if (fw_checksum == checksum) { ++ dev_dbg(child, "firmware check ok, checksum=0x%x\n", checksum); ++ ret = ssv6xxx_sdio_write_reg(child, FW_STATUS_REG, (~checksum & FW_STATUS_MASK)); ++ if (unlikely(ret)) ++ dev_warn(child, "could not clear checksum condition"); ++ } else { ++ dev_err(child, "firmware checksum mismatch, local=0x%x, sram=0x%x\n", checksum, fw_checksum); ++ } ++ ++ msleep(50); ++ ++ ret = 0; ++ ++ out: ++ ++ if (buffer) ++ kfree(buffer); ++ ++ return ret; ++ ++} ++ ++static int ++ssv6xxx_sdio_load_firmware(struct device *child, u8 *firmware_name, u8 openfile) ++{ ++ ++ int ret; ++ const struct firmware *firmware = NULL; ++ struct sdio_func *func; ++ struct ssv6xxx_sdio_glue *glue; ++ ++ glue = dev_get_drvdata(child->parent); ++ ++ ret = request_firmware(&firmware, firmware_name, glue->dev); ++ ++ if (ret) { ++ dev_err(child, "could not find firmware file %s, err=%d\n", firmware_name, ret); ++ goto out; ++ } ++ ++ ret = ssv6xxx_sdio_upload_firmware(child, firmware->data, firmware->size); ++ ++ if (ret) { ++ dev_err(child, "could not upload firmware to device, err=%d\n", ret); ++ goto out; ++ } ++ ++ if (glue != NULL) { ++ func = dev_to_sdio_func(glue->dev); ++ ssv6xxx_high_sdio_clk(func); ++ } ++ ++out: ++ if (firmware != NULL) ++ release_firmware(firmware); ++ ++ return ret; ++ ++} ++ ++static int ssv6xxx_sdio_irq_getstatus(struct device *child, int *status) ++{ ++ int ret = (-1); ++ struct ssv6xxx_sdio_glue *glue; ++ struct sdio_func *func; ++ glue = dev_get_drvdata(child->parent); ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ *status = sdio_readb(func, REG_INT_STATUS, &ret); ++ sdio_release_host(func); ++ ++ return ret; ++ ++} ++ ++static int __must_check ++ssv6xxx_sdio_read(struct device *child, void *buf, size_t *size) ++{ ++ ++ int ret; ++ u32 data_size; ++ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ ++ data_size = sdio_readb(func, REG_CARD_PKT_LEN_0, &ret); ++ ++ if (unlikely(ret)) { ++ dev_err(child->parent, "sdio read high byte len failed, ret=%d\n", ret); ++ goto out; ++ } ++ ++ data_size = data_size | (sdio_readb(func, REG_CARD_PKT_LEN_1, &ret) << 0x8); ++ ++ if (unlikely(ret)) { ++ dev_err(child->parent, "sdio read low len failed ret[%d]\n", ret); ++ goto out; ++ } ++ ++ ret = sdio_memcpy_fromio(func, buf, glue->ioport_data, sdio_align_size(func, data_size)); ++ ++ if (unlikely(ret)) { ++ dev_err(child->parent, "sdio read failed size ret[%d]\n", ret); ++ goto out; ++ } ++ ++ *size = data_size; ++ ++out: ++ ++ sdio_release_host(func); ++ ++ return ret; ++} ++ ++static int __must_check ++ssv6xxx_sdio_write(struct device *child, void *buf, size_t len, u8 queue_num) ++{ ++ int ret; ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ void *ptr; ++ ++ ret_if_not_ready(-1); ++ ++#ifdef CONFIG_ARM64 ++ if (((u64) buf) & 3) { ++#else ++ if (((u32) buf) & 3) { ++#endif ++ memcpy(glue->dma_skb->data, buf, len); ++ ptr = glue->dma_skb->data; ++ } else ++ ptr = buf; ++ ++ func = dev_to_sdio_func(glue->dev); ++ ++ sdio_claim_host(func); ++ ++ len = sdio_align_size(func, len); ++ ret = sdio_memcpy_toio(func, glue->ioport_data, ptr, len); ++ ++ if (unlikely(ret)) ++ dev_err(glue->dev, "sdio write failed, ret=%d\n", ret); ++ ++ sdio_release_host(func); ++ ++ return ret; ++ ++} ++ ++static void ssv6xxx_sdio_irq_handler(struct sdio_func *func) ++{ ++ int status; ++ struct ssv6xxx_sdio_glue *glue = sdio_get_drvdata(func); ++ struct ssv6xxx_platform_data *pwlan_data = &wlan_data; ++ ++ ret_if_not_ready(); ++ ++ if (glue->irq_handler == NULL) ++ return; ++ ++ atomic_set(&pwlan_data->irq_handling, 1); ++ sdio_release_host(func); ++ if (glue->irq_handler != NULL) ++ status = glue->irq_handler(0, glue->irq_dev); ++ sdio_claim_host(func); ++ atomic_set(&pwlan_data->irq_handling, 0); ++ ++} ++ ++static void ssv6xxx_sdio_irq_setmask(struct device *child, int mask) ++{ ++ int err_ret; ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ ret_if_not_ready(); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ sdio_writeb(func, mask, REG_INT_MASK, &err_ret); ++ sdio_release_host(func); ++ ++} ++ ++static void ssv6xxx_sdio_irq_trigger(struct device *child) ++{ ++ int err_ret; ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ ret_if_not_ready(); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ sdio_writeb(func, 0x2, REG_INT_TRIGGER, &err_ret); ++ sdio_release_host(func); ++ ++} ++ ++static int ssv6xxx_sdio_irq_getmask(struct device *child, u32 * mask) ++{ ++ u8 imask = 0; ++ int ret = (-1); ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ ret_if_not_ready(-1); ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ imask = sdio_readb(func, REG_INT_MASK, &ret); ++ *mask = imask; ++ sdio_release_host(func); ++ ++ return ret; ++ ++} ++ ++static void ssv6xxx_sdio_irq_enable(struct device *child) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ int ret; ++ struct ssv6xxx_platform_data *pwlan_data = &wlan_data; ++ if ((pwlan_data->is_enabled == false) ++ || (glue == NULL) || (glue->dev_ready == false)) ++ return; ++ ++ func = dev_to_sdio_func(glue->dev); ++ sdio_claim_host(func); ++ ret = sdio_claim_irq(func, ssv6xxx_sdio_irq_handler); ++ if (ret) ++ dev_err(child->parent, "Failed to claim sdio irq: %d\n", ++ ret); ++ sdio_release_host(func); ++ ++ dev_dbg(child, "ssv6xxx_sdio_irq_enable\n"); ++ ++} ++ ++static void ssv6xxx_sdio_irq_disable(struct device *child, bool iswaitirq) ++{ ++ struct ssv6xxx_sdio_glue *glue = NULL; ++ struct sdio_func *func; ++ struct ssv6xxx_platform_data *pwlan_data = &wlan_data; ++ int ret; ++ ++ dev_dbg(child, "ssv6xxx_sdio_irq_disable\n"); ++ ++ if ((wlan_data.is_enabled == false) || (child->parent == NULL)) ++ return; ++ ++ glue = dev_get_drvdata(child->parent); ++ ++ ++ if ((glue == NULL) || (glue->dev_ready == false) ++ || (glue->dev == NULL)) ++ return; ++ ++ func = dev_to_sdio_func(glue->dev); ++ ++ if (func == NULL) { ++ dev_dbg(child, "sdio func == NULL\n"); ++ return; ++ } ++ ++ sdio_claim_host(func); ++ while (atomic_read(&pwlan_data->irq_handling)) { ++ sdio_release_host(func); ++ schedule_timeout(HZ / 10); ++ sdio_claim_host(func); ++ } ++ ret = sdio_release_irq(func); ++ ++ if (ret) ++ dev_err(child->parent, ++ "Failed to release sdio irq: %d\n", ret); ++ ++ sdio_release_host(func); ++ ++} ++ ++static void ++ssv6xxx_sdio_irq_request(struct device *child, irq_handler_t irq_handler, ++ void *irq_dev) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ bool isIrqEn = false; ++ ++ ret_if_not_ready(); ++ ++ func = dev_to_sdio_func(glue->dev); ++ glue->irq_handler = irq_handler; ++ glue->irq_dev = irq_dev; ++ if (isIrqEn) { ++ ssv6xxx_sdio_irq_enable(child); ++ } ++ ++} ++ ++static void ++ssv6xxx_sdio_read_parameter(struct sdio_func *func, ++ struct ssv6xxx_sdio_glue *glue) ++{ ++ int err_ret; ++ sdio_claim_host(func); ++ glue->ioport_data = 0; ++ glue->ioport_data = ++ glue->ioport_data | (sdio_readb(func, REG_DATA_IO_PORT_0, &err_ret) ++ << (8 * 0)); ++ glue->ioport_data = ++ glue->ioport_data | (sdio_readb(func, REG_DATA_IO_PORT_1, &err_ret) ++ << (8 * 1)); ++ glue->ioport_data = ++ glue->ioport_data | (sdio_readb(func, REG_DATA_IO_PORT_2, &err_ret) ++ << (8 * 2)); ++ glue->ioport_reg = 0; ++ glue->ioport_reg = ++ glue->ioport_reg | (sdio_readb(func, REG_REG_IO_PORT_0, &err_ret) << ++ (8 * 0)); ++ glue->ioport_reg = ++ glue->ioport_reg | (sdio_readb(func, REG_REG_IO_PORT_1, &err_ret) << ++ (8 * 1)); ++ glue->ioport_reg = ++ glue->ioport_reg | (sdio_readb(func, REG_REG_IO_PORT_2, &err_ret) << ++ (8 * 2)); ++ dev_dbg(&func->dev, "ioport_data=0x%x ioport_reg=0x%x\n", ++ glue->ioport_data, glue->ioport_reg); ++ err_ret = sdio_set_block_size(func, CONFIG_PLATFORM_SDIO_BLOCK_SIZE); ++ if (err_ret != 0) { ++ dev_warn(&func->dev, "SDIO setting SDIO_DEF_BLOCK_SIZE fail!!\n"); ++ } ++ sdio_writeb(func, CONFIG_PLATFORM_SDIO_OUTPUT_TIMING, ++ REG_OUTPUT_TIMING_REG, &err_ret); ++ sdio_writeb(func, 0x00, REG_Fn1_STATUS, &err_ret); ++ sdio_release_host(func); ++} ++ ++static void ssv6xxx_do_sdio_wakeup(struct sdio_func *func) ++{ ++ int err_ret; ++ if (func != NULL) { ++ sdio_claim_host(func); ++ sdio_writeb(func, 0x01, REG_PMU_WAKEUP, &err_ret); ++ mdelay(10); ++ sdio_writeb(func, 0x00, REG_PMU_WAKEUP, &err_ret); ++ sdio_release_host(func); ++ } ++} ++ ++static void ssv6xxx_sdio_pmu_wakeup(struct device *child) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ if (glue != NULL) { ++ func = dev_to_sdio_func(glue->dev); ++ ssv6xxx_do_sdio_wakeup(func); ++ } ++} ++ ++static bool ssv6xxx_sdio_support_scatter(struct device *child) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ ++ if (!glue) { ++ dev_err(child->parent, "ssv6xxx_sdio_enable_scatter glue == NULL!!!\n"); ++ return false; ++ } ++ ++ func = dev_to_sdio_func(glue->dev); ++ ++ if (func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) { ++ dev_err(child->parent, ++ "host controller only supports scatter of :%d entries, driver need: %d\n", ++ func->card->host->max_segs, ++ MAX_SCATTER_ENTRIES_PER_REQ); ++ return false; ++ } ++ ++ return true; ++ ++} ++ ++static void ++ssv6xxx_sdio_setup_scat_data(struct sdio_scatter_req *scat_req, ++ struct mmc_data *data) ++{ ++ struct scatterlist *sg; ++ int i; ++ data->blksz = SDIO_DEF_BLOCK_SIZE; ++ data->blocks = scat_req->len / SDIO_DEF_BLOCK_SIZE; ++ pr_debug ++ ("scatter: (%s) (block len: %d, block count: %d) , (tot:%d,sg:%d)\n", ++ (scat_req->req & SDIO_WRITE) ? "WR" : "RD", data->blksz, ++ data->blocks, scat_req->len, scat_req->scat_entries); ++ data->flags = ++ (scat_req->req & SDIO_WRITE) ? MMC_DATA_WRITE : MMC_DATA_READ; ++ sg = scat_req->sgentries; ++ sg_init_table(sg, scat_req->scat_entries); ++ for (i = 0; i < scat_req->scat_entries; i++, sg++) { ++ pr_debug("%d: addr:0x%p, len:%d\n", ++ i, scat_req->scat_list[i].buf, ++ scat_req->scat_list[i].len); ++ sg_set_buf(sg, scat_req->scat_list[i].buf, ++ scat_req->scat_list[i].len); ++ } ++ data->sg = scat_req->sgentries; ++ data->sg_len = scat_req->scat_entries; ++} ++ ++static inline void ++ssv6xxx_sdio_set_cmd53_arg(u32 * arg, u8 rw, u8 func, ++ u8 mode, u8 opcode, u32 addr, u16 blksz) ++{ ++ *arg = (((rw & 1) << 31) | ++ ((func & 0x7) << 28) | ++ ((mode & 1) << 27) | ++ ((opcode & 1) << 26) | ((addr & 0x1FFFF) << 9) | (blksz & ++ 0x1FF)); ++} ++ ++static int ++ssv6xxx_sdio_rw_scatter(struct device *child, struct sdio_scatter_req *scat_req) ++{ ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func; ++ struct mmc_request mmc_req; ++ struct mmc_command cmd; ++ struct mmc_data data; ++ u8 opcode, rw; ++ int status = 1; ++ ++ if (!glue) { ++ dev_err(child->parent, "ssv6xxx_sdio_enable_scatter glue == NULL!!!\n"); ++ return 1; ++ } ++ ++ func = dev_to_sdio_func(glue->dev); ++ memset(&mmc_req, 0, sizeof(struct mmc_request)); ++ memset(&cmd, 0, sizeof(struct mmc_command)); ++ memset(&data, 0, sizeof(struct mmc_data)); ++ ssv6xxx_sdio_setup_scat_data(scat_req, &data); ++ opcode = 0; ++ rw = (scat_req->req & SDIO_WRITE) ? CMD53_ARG_WRITE : ++ CMD53_ARG_READ; ++ ssv6xxx_sdio_set_cmd53_arg(&cmd.arg, rw, func->num, ++ CMD53_ARG_BLOCK_BASIS, opcode, ++ glue->ioport_data, data.blocks); ++ cmd.opcode = SD_IO_RW_EXTENDED; ++ cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC; ++ mmc_req.cmd = &cmd; ++ mmc_req.data = &data; ++ mmc_set_data_timeout(&data, func->card); ++ mmc_wait_for_req(func->card->host, &mmc_req); ++ ++ status = cmd.error ? cmd.error : data.error; ++ ++ if (cmd.error) ++ return cmd.error; ++ ++ if (data.error) ++ return data.error; ++ ++ return status; ++ ++} ++ ++static void ssv6xxx_set_sdio_clk(struct sdio_func *func, u32 sdio_hz) ++{ ++ struct mmc_host *host; ++ host = func->card->host; ++ if (sdio_hz < host->f_min) ++ sdio_hz = host->f_min; ++ else if (sdio_hz > host->f_max) ++ sdio_hz = host->f_max; ++ dev_dbg(&func->dev, "%s:set sdio clk %dHz\n", __FUNCTION__, sdio_hz); ++ sdio_claim_host(func); ++ host->ios.clock = sdio_hz; ++ host->ops->set_ios(host, &host->ios); ++ mdelay(20); ++ sdio_release_host(func); ++} ++ ++static void ssv6xxx_low_sdio_clk(struct sdio_func *func) ++{ ++ ssv6xxx_set_sdio_clk(func, LOW_SPEED_SDIO_CLOCK); ++} ++ ++static void ssv6xxx_high_sdio_clk(struct sdio_func *func) ++{ ++#ifndef SDIO_USE_SLOW_CLOCK ++ ssv6xxx_set_sdio_clk(func, HIGH_SPEED_SDIO_CLOCK); ++#endif ++} ++ ++static struct ssv6xxx_hwif_ops sdio_ops = { ++ .read = ssv6xxx_sdio_read, ++ .write = ssv6xxx_sdio_write, ++ .readreg = ssv6xxx_sdio_read_reg, ++ .writereg = ssv6xxx_sdio_write_reg, ++#ifdef ENABLE_WAKE_IO_ISR_WHEN_HCI_ENQUEUE ++ .trigger_tx_rx = ssv6xxx_sdio_trigger_tx_rx, ++#endif ++ .irq_getmask = ssv6xxx_sdio_irq_getmask, ++ .irq_setmask = ssv6xxx_sdio_irq_setmask, ++ .irq_enable = ssv6xxx_sdio_irq_enable, ++ .irq_disable = ssv6xxx_sdio_irq_disable, ++ .irq_getstatus = ssv6xxx_sdio_irq_getstatus, ++ .irq_request = ssv6xxx_sdio_irq_request, ++ .irq_trigger = ssv6xxx_sdio_irq_trigger, ++ .pmu_wakeup = ssv6xxx_sdio_pmu_wakeup, ++ .load_fw = ssv6xxx_sdio_load_firmware, ++ .cmd52_read = ssv6xxx_sdio_cmd52_read, ++ .cmd52_write = ssv6xxx_sdio_cmd52_write, ++ .support_scatter = ssv6xxx_sdio_support_scatter, ++ .rw_scatter = ssv6xxx_sdio_rw_scatter, ++ .is_ready = ssv6xxx_is_ready, ++ .write_sram = ssv6xxx_sdio_write_sram, ++ .interface_reset = ssv6xxx_sdio_reset, ++}; ++ ++static int ++ssv6xxx_sdio_power_on(struct ssv6xxx_platform_data *pdata, ++ struct sdio_func *func) ++{ ++ int ret = 0; ++ if (pdata->is_enabled == true) ++ return 0; ++ ++ dev_dbg(&func->dev, "ssv6xxx_sdio_power_on\n"); ++ ++ sdio_claim_host(func); ++ ret = sdio_enable_func(func); ++ sdio_release_host(func); ++ ++ if (ret) { ++ dev_err(&func->dev, "Unable to enable sdio func: %d)\n", ret); ++ return ret; ++ } ++ ++ msleep(10); ++ pdata->is_enabled = true; ++ ++ return ret; ++} ++ ++static int ++ssv6xxx_sdio_power_off(struct ssv6xxx_platform_data *pdata, ++ struct sdio_func *func) ++{ ++ int ret; ++ if (pdata->is_enabled == false) ++ return 0; ++ dev_dbg(&func->dev, "ssv6xxx_sdio_power_off\n"); ++ sdio_claim_host(func); ++ ret = sdio_disable_func(func); ++ sdio_release_host(func); ++ if (ret) ++ return ret; ++ pdata->is_enabled = false; ++ return ret; ++} ++ ++int ssv6xxx_get_dev_status(void) ++{ ++ return ssv6xxx_sdio_status; ++} ++ ++EXPORT_SYMBOL(ssv6xxx_get_dev_status); ++ ++static int ++ssv6xxx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) ++{ ++ struct ssv6xxx_platform_data *pwlan_data = &wlan_data; ++ struct ssv6xxx_sdio_glue *glue; ++ int ret; ++ const char *chip_family = "ssv6200"; ++ ++ if (ssv_devicetype != 0) { ++ dev_info(&func->dev, "Not using SSV6200 normal SDIO driver.\n"); ++ return -ENODEV; ++ } ++ ++ if (func->num != 0x01) ++ return -ENODEV; ++ ++ glue = kzalloc(sizeof(*glue), GFP_KERNEL); ++ ++ if (!glue) { ++ dev_err(&func->dev, "can't allocate glue\n"); ++ return -ENOMEM; ++ } ++ ++ ssv6xxx_sdio_status = 1; ++ ssv6xxx_low_sdio_clk(func); ++ ++ glue->dma_skb = __dev_alloc_skb(SDIO_DMA_BUFFER_LEN, GFP_KERNEL); ++ ++#ifdef CONFIG_PM ++ glue->cmd_skb = __dev_alloc_skb(SDIO_COMMAND_BUFFER_LEN, GFP_KERNEL); ++#endif ++ memset(pwlan_data, 0, sizeof(struct ssv6xxx_platform_data)); ++ atomic_set(&pwlan_data->irq_handling, 0); ++ glue->dev = &func->dev; ++ func->card->quirks |= MMC_QUIRK_LENIENT_FN0; ++ func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; ++ glue->dev_ready = true; ++ pwlan_data->vendor = func->vendor; ++ pwlan_data->device = func->device; ++ dev_info(glue->dev, "device id: %x:%x\n", pwlan_data->vendor, ++ pwlan_data->device); ++ pwlan_data->ops = &sdio_ops; ++ sdio_set_drvdata(func, glue); ++#ifdef CONFIG_PM ++ ssv6xxx_do_sdio_wakeup(func); ++#endif ++ ssv6xxx_sdio_power_on(pwlan_data, func); ++ ssv6xxx_sdio_read_parameter(func, glue); ++ glue->core = platform_device_alloc(chip_family, -1); ++ ++ if (!glue->core) { ++ dev_err(glue->dev, "can't allocate platform_device"); ++ ret = -ENOMEM; ++ goto out_free_glue; ++ } ++ ++ glue->core->dev.parent = &func->dev; ++ ++ ret = platform_device_add_data(glue->core, pwlan_data, ++ sizeof(*pwlan_data)); ++ ++ if (ret) { ++ dev_err(glue->dev, "can't add platform data\n"); ++ goto out_dev_put; ++ } ++ ++ ret = platform_device_add(glue->core); ++ ++ if (ret) { ++ dev_err(glue->dev, "can't add platform device\n"); ++ goto out_dev_put; ++ } ++ ++ ssv6xxx_sdio_irq_setmask(&glue->core->dev, 0xff); ++ ++ ssv6xxx_ifdebug_info[0] = (void *)&glue->core->dev; ++ ssv6xxx_ifdebug_info[1] = (void *)glue->core; ++ ssv6xxx_ifdebug_info[2] = (void *)&sdio_ops; ++ return 0; ++ ++ out_dev_put: ++ platform_device_put(glue->core); ++ out_free_glue: ++ kfree(glue); ++ ++ return ret; ++ ++} ++ ++static void ssv6xxx_sdio_remove(struct sdio_func *func) ++{ ++ struct ssv6xxx_sdio_glue *glue = sdio_get_drvdata(func); ++ struct ssv6xxx_platform_data *pwlan_data = &wlan_data; ++ ++ dev_dbg(&func->dev, "ssv6xxx_sdio_remove enter\n"); ++ ++ ssv6xxx_sdio_status = 0; ++ ++ if (glue) { ++ dev_dbg(&func->dev, "ssv6xxx_sdio_remove - ssv6xxx_sdio_irq_disable\n"); ++ ssv6xxx_sdio_irq_disable(&glue->core->dev, false); ++ glue->dev_ready = false; ++ ssv6xxx_low_sdio_clk(func); ++ ++ if (glue->dma_skb != NULL) ++ dev_kfree_skb(glue->dma_skb); ++ ++ dev_dbg(&func->dev, "ssv6xxx_sdio_remove - disable mask\n"); ++ ssv6xxx_sdio_irq_setmask(&glue->core->dev, 0xff); ++#ifdef CONFIG_PM ++ ssv6xxx_sdio_trigger_pmu(glue->dev); ++ if (glue->cmd_skb != NULL) ++ dev_kfree_skb(glue->cmd_skb); ++#endif ++ ssv6xxx_sdio_power_off(pwlan_data, func); ++ dev_dbg(&func->dev, "platform_device_del \n"); ++ platform_device_del(glue->core); ++ dev_dbg(&func->dev, "platform_device_put \n"); ++ platform_device_put(glue->core); ++ kfree(glue); ++ } ++ ++ sdio_set_drvdata(func, NULL); ++ dev_dbg(&func->dev, "ssv6xxx_sdio_remove leave\n"); ++ ++} ++ ++static int ssv6xxx_sdio_trigger_pmu(struct device *dev) ++{ ++ ++ int ret = 0; ++ ++#ifdef CONFIG_PM ++ struct sdio_func *func = dev_to_sdio_func(dev); ++ struct ssv6xxx_sdio_glue *glue = sdio_get_drvdata(func); ++ struct cfg_host_cmd *host_cmd; ++ int writesize; ++ void *tempPointer; ++ ++ if (ssv6xxx_sdio_write_reg ++ (dev, ADR_RX_FLOW_MNG, M_ENG_MACRX | (M_ENG_TRASH_CAN << 4))) ; ++ if (ssv6xxx_sdio_write_reg ++ (dev, ADR_RX_FLOW_DATA, M_ENG_MACRX | (M_ENG_TRASH_CAN << 4))) ; ++ if (ssv6xxx_sdio_write_reg ++ (dev, ADR_RX_FLOW_CTRL, M_ENG_MACRX | (M_ENG_TRASH_CAN << 4))) ; ++ ++ host_cmd = (struct cfg_host_cmd *)glue->cmd_skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->RSVD0 = 0; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_PS; ++ host_cmd->len = sizeof(struct cfg_host_cmd); ++ ++ host_cmd->dummy = 0; ++ ++ { ++ tempPointer = glue->cmd_skb->data; ++ sdio_claim_host(func); ++ writesize = sdio_align_size(func, sizeof(struct cfg_host_cmd)); ++ do { ++ ret = ++ sdio_memcpy_toio(func, glue->ioport_data, ++ tempPointer, writesize); ++ if (ret == -EILSEQ || ret == -ETIMEDOUT) { ++ ret = -1; ++ break; ++ } else { ++ if (ret) ++ dev_err(glue->dev, ++ "Unexpected return value ret=[%d]\n", ++ ret); ++ } ++ } ++ while (ret == -EILSEQ || ret == -ETIMEDOUT); ++ sdio_release_host(func); ++ if (ret) ++ dev_err(glue->dev, "sdio write failed (%d)\n", ret); ++ } ++ ++#endif ++ ++ return ret; ++ ++} ++ ++static void ssv6xxx_sdio_reset(struct device *child) ++{ ++ ++#ifdef CONFIG_PM ++ struct ssv6xxx_sdio_glue *glue = dev_get_drvdata(child->parent); ++ struct sdio_func *func = dev_to_sdio_func(glue->dev); ++ dev_dbg(child, "%s\n", __FUNCTION__); ++ if (glue == NULL || glue->dev == NULL || func == NULL) ++ return; ++ ssv6xxx_sdio_trigger_pmu(glue->dev); ++ ssv6xxx_do_sdio_wakeup(func); ++#endif ++ ++ return; ++ ++} ++ ++#ifdef CONFIG_PM ++static int ssv6xxx_sdio_suspend(struct device *dev) ++{ ++ struct sdio_func *func = dev_to_sdio_func(dev); ++ mmc_pm_flag_t flags = sdio_get_host_pm_caps(func); ++ { ++ int ret = 0; ++ dev_info(dev, "%s: suspend: PM flags = 0x%x\n", ++ sdio_func_id(func), flags); ++ ssv6xxx_low_sdio_clk(func); ++ ret = ssv6xxx_sdio_trigger_pmu(dev); ++ if (ret) ++ dev_warn(dev, "ssv6xxx_sdio_trigger_pmu fail!!\n"); ++ if (!(flags & MMC_PM_KEEP_POWER)) { ++ dev_err(dev, ++ "%s: cannot remain alive while host is suspended\n", ++ sdio_func_id(func)); ++ } ++ ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); ++ if (ret) ++ return ret; ++ mdelay(10); ++ return ret; ++ } ++} ++ ++static int ssv6xxx_sdio_resume(struct device *dev) ++{ ++ struct sdio_func *func = dev_to_sdio_func(dev); ++ { ++ dev_dbg(dev, "ssv6xxx_sdio_resume\n"); ++ { ++ ssv6xxx_do_sdio_wakeup(func); ++ mdelay(10); ++ ssv6xxx_high_sdio_clk(func); ++ mdelay(10); ++ } ++ } ++ return 0; ++} ++ ++static const struct dev_pm_ops ssv6xxx_sdio_pm_ops = { ++ .suspend = ssv6xxx_sdio_suspend, ++ .resume = ssv6xxx_sdio_resume, ++}; ++#endif ++ ++struct sdio_driver ssv6xxx_sdio_driver = { ++ .name = "ssv6051", ++ .id_table = ssv6xxx_sdio_devices, ++ .probe = ssv6xxx_sdio_probe, ++ .remove = ssv6xxx_sdio_remove, ++#ifdef CONFIG_PM ++ .drv = { ++ .pm = &ssv6xxx_sdio_pm_ops, ++ }, ++#endif ++}; ++ ++EXPORT_SYMBOL(ssv6xxx_sdio_driver); ++ ++int ssv6xxx_sdio_init(void) ++{ ++ return sdio_register_driver(&ssv6xxx_sdio_driver); ++} ++ ++void ssv6xxx_sdio_exit(void) ++{ ++ pr_info("ssv6xxx_sdio_exit\n"); ++ sdio_unregister_driver(&ssv6xxx_sdio_driver); ++} ++ ++EXPORT_SYMBOL(ssv6xxx_sdio_init); ++EXPORT_SYMBOL(ssv6xxx_sdio_exit); +diff --git a/drivers/net/wireless/ssv6051/hwif/sdio/sdio_def.h b/drivers/net/wireless/ssv6051/hwif/sdio/sdio_def.h +new file mode 100644 +index 000000000000..57aefd3bf9fa +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/hwif/sdio/sdio_def.h +@@ -0,0 +1,80 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SDIO_DEF_H_ ++#define _SDIO_DEF_H_ ++#include ++#define BASE_SDIO 0 ++#define REG_DATA_IO_PORT_0 (BASE_SDIO + 0x00) ++#define REG_DATA_IO_PORT_1 (BASE_SDIO + 0x01) ++#define REG_DATA_IO_PORT_2 (BASE_SDIO + 0x02) ++#define REG_INT_MASK (BASE_SDIO + 0x04) ++#define REG_INT_STATUS (BASE_SDIO + 0x08) ++#define REG_INT_TRIGGER (BASE_SDIO + 0x09) ++#define REG_Fn1_STATUS (BASE_SDIO + 0x0c) ++#define REG_CARD_PKT_LEN_0 (BASE_SDIO + 0x10) ++#define REG_CARD_PKT_LEN_1 (BASE_SDIO + 0x11) ++#define REG_CARD_FW_DL_STATUS (BASE_SDIO + 0x12) ++#define REG_CARD_SELF_TEST (BASE_SDIO + 0x13) ++#define REG_CARD_RCA_0 (BASE_SDIO + 0x20) ++#define REG_CARD_RCA_1 (BASE_SDIO + 0x21) ++#define REG_SDIO_FIFO_WR_THLD_0 (BASE_SDIO + 0x24) ++#define REG_SDIO_FIFO_WR_THLD_1 (BASE_SDIO + 0x25) ++#define REG_OUTPUT_TIMING_REG (BASE_SDIO + 0x55) ++#define REG_PMU_WAKEUP (BASE_SDIO + 0x67) ++#define REG_REG_IO_PORT_0 (BASE_SDIO + 0x70) ++#define REG_REG_IO_PORT_1 (BASE_SDIO + 0x71) ++#define REG_REG_IO_PORT_2 (BASE_SDIO + 0x72) ++#define REG_SDIO_TX_ALLOC_SIZE (BASE_SDIO + 0x98) ++#define REG_SDIO_TX_ALLOC_SHIFT (BASE_SDIO + 0x99) ++#define REG_SDIO_TX_ALLOC_STATE (BASE_SDIO + 0x9a) ++#define REG_SDIO_TX_INFORM_0 (BASE_SDIO + 0x9c) ++#define REG_SDIO_TX_INFORM_1 (BASE_SDIO + 0x9d) ++#define REG_SDIO_TX_INFORM_2 (BASE_SDIO + 0x9e) ++#define SDIO_DEF_BLOCK_SIZE 0x80 ++#if (SDIO_DEF_BLOCK_SIZE % 8) ++#error Wrong SDIO_DEF_BLOCK_SIZE value!! Should be the multiple of 8 bytes!!!!!!!!!!!!!!!!!!!!!! ++#endif ++#define SDIO_DEF_OUTPUT_TIMING 0 ++#define SDIO_DEF_BLOCK_MODE_THRD 128 ++#if (SDIO_DEF_BLOCK_MODE_THRD % 8) ++#error Wrong SDIO_DEF_BLOCK_MODE_THRD value!! Should be the multiple of 8 bytes!!!!!!!!!!!!!!!!!!!!!! ++#endif ++#define SDIO_DEF_FORCE_BLOCK_MODE 0 ++#define MAX_SCATTER_ENTRIES_PER_REQ 8 ++struct sdio_scatter_item { ++ u8 *buf; ++ int len; ++}; ++struct sdio_scatter_req { ++ u32 req; ++ u32 len; ++ int scat_entries; ++ struct sdio_scatter_item scat_list[MAX_SCATTER_ENTRIES_PER_REQ]; ++ struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ]; ++}; ++#define SDIO_READ 0x00000001 ++#define SDIO_WRITE 0x00000002 ++#define CMD53_ARG_READ 0 ++#define CMD53_ARG_WRITE 1 ++#define CMD53_ARG_BLOCK_BASIS 1 ++#define CMD53_ARG_FIXED_ADDRESS 0 ++#define CMD53_ARG_INCR_ADDRESS 1 ++#define SDIO_DMA_BUFFER_LEN 2048 ++#ifdef CONFIG_PM ++#define SDIO_COMMAND_BUFFER_LEN 256 ++#endif ++#endif +diff --git a/drivers/net/wireless/ssv6051/include/cabrio.h b/drivers/net/wireless/ssv6051/include/cabrio.h +new file mode 100644 +index 000000000000..0b1327865c6b +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/cabrio.h +@@ -0,0 +1,28 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef CABRIO_H ++#define CABRIO_H ++#define SSV_VENDOR_ID 0x3030 ++#define SSV_CABRIO_DEVID 0x3030 ++#define SSV_SUBVENDOR_ID_NOG 0x0e11 ++#define SSV_SUBVENDOR_ID_NEW_A 0x7065 ++#define SSV_CABRIO_MAGIC 0x19641014 ++#define SSV_AMPDU_LIMIT_MAX (64 * 1024 - 1) ++#define SSV_DEFAULT_NOISE_FLOOR -95 ++#define SSVCABRIO_RSSI_BAD -128 ++#define SSVCABRIO_NUM_CHANNELS 38 ++#endif +diff --git a/drivers/net/wireless/ssv6051/include/ssv6200.h b/drivers/net/wireless/ssv6051/include/ssv6200.h +new file mode 100644 +index 000000000000..22eaceaf285d +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv6200.h +@@ -0,0 +1,76 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV6200_H_ ++#define _SSV6200_H_ ++#include ++#include ++#include ++#ifdef ECLIPSE ++#include ++#endif ++#include ++#include ++#include ++#include ++#include "ssv6200_common.h" ++#define SSV6200_TOTAL_ID 128 ++#ifndef HUW_DRV ++#define SSV6200_ID_TX_THRESHOLD 19 ++#define SSV6200_ID_RX_THRESHOLD 60 ++#define SSV6200_PAGE_TX_THRESHOLD 115 ++#define SSV6200_PAGE_RX_THRESHOLD 115 ++#define SSV6XXX_AMPDU_DIVIDER (2) ++#define SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER (SSV6200_PAGE_TX_THRESHOLD - (SSV6200_PAGE_TX_THRESHOLD/SSV6XXX_AMPDU_DIVIDER)) ++#define SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER 2 ++#else ++#undef SSV6200_ID_TX_THRESHOLD ++#undef SSV6200_ID_RX_THRESHOLD ++#undef SSV6200_PAGE_TX_THRESHOLD ++#undef SSV6200_PAGE_RX_THRESHOLD ++#undef SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER ++#undef SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER ++#define SSV6200_ID_TX_THRESHOLD 31 ++#define SSV6200_ID_RX_THRESHOLD 31 ++#define SSV6200_PAGE_TX_THRESHOLD 61 ++#define SSV6200_PAGE_RX_THRESHOLD 61 ++#define SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER 45 ++#define SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER 2 ++#endif ++#define SSV6200_ID_NUMBER (128) ++#define PACKET_ADDR_2_ID(addr) ((addr >> 16) & 0x7F) ++#define SSV6200_ID_AC_RESERVED 1 ++#define SSV6200_ID_AC_BK_OUT_QUEUE 8 ++#define SSV6200_ID_AC_BE_OUT_QUEUE 15 ++#define SSV6200_ID_AC_VI_OUT_QUEUE 16 ++#define SSV6200_ID_AC_VO_OUT_QUEUE 16 ++#define SSV6200_ID_MANAGER_QUEUE 8 ++#define HW_MMU_PAGE_SHIFT 0x8 ++#define HW_MMU_PAGE_MASK 0xff ++#define SSV6200_BT_PRI_SMP_TIME 0 ++#define SSV6200_BT_STA_SMP_TIME (SSV6200_BT_PRI_SMP_TIME+0) ++#define SSV6200_WLAN_REMAIN_TIME 0 ++#define BT_2WIRE_EN_MSK 0x00000400 ++struct txResourceControl { ++ u32 txUsePage:8; ++ u32 txUseID:6; ++ u32 edca0:4; ++ u32 edca1:4; ++ u32 edca2:5; ++ u32 edca3:5; ++}; ++#include ++#endif +diff --git a/drivers/net/wireless/ssv6051/include/ssv6200_aux.h b/drivers/net/wireless/ssv6051/include/ssv6200_aux.h +new file mode 100644 +index 000000000000..03ec3f07d330 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv6200_aux.h +@@ -0,0 +1,18221 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#define MCU_ENABLE_MSK 0x00000001 ++#define MCU_ENABLE_I_MSK 0xfffffffe ++#define MCU_ENABLE_SFT 0 ++#define MCU_ENABLE_HI 0 ++#define MCU_ENABLE_SZ 1 ++#define MAC_SW_RST_MSK 0x00000002 ++#define MAC_SW_RST_I_MSK 0xfffffffd ++#define MAC_SW_RST_SFT 1 ++#define MAC_SW_RST_HI 1 ++#define MAC_SW_RST_SZ 1 ++#define MCU_SW_RST_MSK 0x00000004 ++#define MCU_SW_RST_I_MSK 0xfffffffb ++#define MCU_SW_RST_SFT 2 ++#define MCU_SW_RST_HI 2 ++#define MCU_SW_RST_SZ 1 ++#define SDIO_SW_RST_MSK 0x00000008 ++#define SDIO_SW_RST_I_MSK 0xfffffff7 ++#define SDIO_SW_RST_SFT 3 ++#define SDIO_SW_RST_HI 3 ++#define SDIO_SW_RST_SZ 1 ++#define SPI_SLV_SW_RST_MSK 0x00000010 ++#define SPI_SLV_SW_RST_I_MSK 0xffffffef ++#define SPI_SLV_SW_RST_SFT 4 ++#define SPI_SLV_SW_RST_HI 4 ++#define SPI_SLV_SW_RST_SZ 1 ++#define UART_SW_RST_MSK 0x00000020 ++#define UART_SW_RST_I_MSK 0xffffffdf ++#define UART_SW_RST_SFT 5 ++#define UART_SW_RST_HI 5 ++#define UART_SW_RST_SZ 1 ++#define DMA_SW_RST_MSK 0x00000040 ++#define DMA_SW_RST_I_MSK 0xffffffbf ++#define DMA_SW_RST_SFT 6 ++#define DMA_SW_RST_HI 6 ++#define DMA_SW_RST_SZ 1 ++#define WDT_SW_RST_MSK 0x00000080 ++#define WDT_SW_RST_I_MSK 0xffffff7f ++#define WDT_SW_RST_SFT 7 ++#define WDT_SW_RST_HI 7 ++#define WDT_SW_RST_SZ 1 ++#define I2C_SLV_SW_RST_MSK 0x00000100 ++#define I2C_SLV_SW_RST_I_MSK 0xfffffeff ++#define I2C_SLV_SW_RST_SFT 8 ++#define I2C_SLV_SW_RST_HI 8 ++#define I2C_SLV_SW_RST_SZ 1 ++#define INT_CTL_SW_RST_MSK 0x00000200 ++#define INT_CTL_SW_RST_I_MSK 0xfffffdff ++#define INT_CTL_SW_RST_SFT 9 ++#define INT_CTL_SW_RST_HI 9 ++#define INT_CTL_SW_RST_SZ 1 ++#define BTCX_SW_RST_MSK 0x00000400 ++#define BTCX_SW_RST_I_MSK 0xfffffbff ++#define BTCX_SW_RST_SFT 10 ++#define BTCX_SW_RST_HI 10 ++#define BTCX_SW_RST_SZ 1 ++#define GPIO_SW_RST_MSK 0x00000800 ++#define GPIO_SW_RST_I_MSK 0xfffff7ff ++#define GPIO_SW_RST_SFT 11 ++#define GPIO_SW_RST_HI 11 ++#define GPIO_SW_RST_SZ 1 ++#define US0TMR_SW_RST_MSK 0x00001000 ++#define US0TMR_SW_RST_I_MSK 0xffffefff ++#define US0TMR_SW_RST_SFT 12 ++#define US0TMR_SW_RST_HI 12 ++#define US0TMR_SW_RST_SZ 1 ++#define US1TMR_SW_RST_MSK 0x00002000 ++#define US1TMR_SW_RST_I_MSK 0xffffdfff ++#define US1TMR_SW_RST_SFT 13 ++#define US1TMR_SW_RST_HI 13 ++#define US1TMR_SW_RST_SZ 1 ++#define US2TMR_SW_RST_MSK 0x00004000 ++#define US2TMR_SW_RST_I_MSK 0xffffbfff ++#define US2TMR_SW_RST_SFT 14 ++#define US2TMR_SW_RST_HI 14 ++#define US2TMR_SW_RST_SZ 1 ++#define US3TMR_SW_RST_MSK 0x00008000 ++#define US3TMR_SW_RST_I_MSK 0xffff7fff ++#define US3TMR_SW_RST_SFT 15 ++#define US3TMR_SW_RST_HI 15 ++#define US3TMR_SW_RST_SZ 1 ++#define MS0TMR_SW_RST_MSK 0x00010000 ++#define MS0TMR_SW_RST_I_MSK 0xfffeffff ++#define MS0TMR_SW_RST_SFT 16 ++#define MS0TMR_SW_RST_HI 16 ++#define MS0TMR_SW_RST_SZ 1 ++#define MS1TMR_SW_RST_MSK 0x00020000 ++#define MS1TMR_SW_RST_I_MSK 0xfffdffff ++#define MS1TMR_SW_RST_SFT 17 ++#define MS1TMR_SW_RST_HI 17 ++#define MS1TMR_SW_RST_SZ 1 ++#define MS2TMR_SW_RST_MSK 0x00040000 ++#define MS2TMR_SW_RST_I_MSK 0xfffbffff ++#define MS2TMR_SW_RST_SFT 18 ++#define MS2TMR_SW_RST_HI 18 ++#define MS2TMR_SW_RST_SZ 1 ++#define MS3TMR_SW_RST_MSK 0x00080000 ++#define MS3TMR_SW_RST_I_MSK 0xfff7ffff ++#define MS3TMR_SW_RST_SFT 19 ++#define MS3TMR_SW_RST_HI 19 ++#define MS3TMR_SW_RST_SZ 1 ++#define RF_BB_SW_RST_MSK 0x00100000 ++#define RF_BB_SW_RST_I_MSK 0xffefffff ++#define RF_BB_SW_RST_SFT 20 ++#define RF_BB_SW_RST_HI 20 ++#define RF_BB_SW_RST_SZ 1 ++#define SYS_ALL_RST_MSK 0x00200000 ++#define SYS_ALL_RST_I_MSK 0xffdfffff ++#define SYS_ALL_RST_SFT 21 ++#define SYS_ALL_RST_HI 21 ++#define SYS_ALL_RST_SZ 1 ++#define DAT_UART_SW_RST_MSK 0x00400000 ++#define DAT_UART_SW_RST_I_MSK 0xffbfffff ++#define DAT_UART_SW_RST_SFT 22 ++#define DAT_UART_SW_RST_HI 22 ++#define DAT_UART_SW_RST_SZ 1 ++#define I2C_MST_SW_RST_MSK 0x00800000 ++#define I2C_MST_SW_RST_I_MSK 0xff7fffff ++#define I2C_MST_SW_RST_SFT 23 ++#define I2C_MST_SW_RST_HI 23 ++#define I2C_MST_SW_RST_SZ 1 ++#define RG_REBOOT_MSK 0x00000001 ++#define RG_REBOOT_I_MSK 0xfffffffe ++#define RG_REBOOT_SFT 0 ++#define RG_REBOOT_HI 0 ++#define RG_REBOOT_SZ 1 ++#define TRAP_IMG_FLS_MSK 0x00010000 ++#define TRAP_IMG_FLS_I_MSK 0xfffeffff ++#define TRAP_IMG_FLS_SFT 16 ++#define TRAP_IMG_FLS_HI 16 ++#define TRAP_IMG_FLS_SZ 1 ++#define TRAP_REBOOT_MSK 0x00020000 ++#define TRAP_REBOOT_I_MSK 0xfffdffff ++#define TRAP_REBOOT_SFT 17 ++#define TRAP_REBOOT_HI 17 ++#define TRAP_REBOOT_SZ 1 ++#define TRAP_BOOT_FLS_MSK 0x00040000 ++#define TRAP_BOOT_FLS_I_MSK 0xfffbffff ++#define TRAP_BOOT_FLS_SFT 18 ++#define TRAP_BOOT_FLS_HI 18 ++#define TRAP_BOOT_FLS_SZ 1 ++#define CHIP_ID_31_0_MSK 0xffffffff ++#define CHIP_ID_31_0_I_MSK 0x00000000 ++#define CHIP_ID_31_0_SFT 0 ++#define CHIP_ID_31_0_HI 31 ++#define CHIP_ID_31_0_SZ 32 ++#define CHIP_ID_63_32_MSK 0xffffffff ++#define CHIP_ID_63_32_I_MSK 0x00000000 ++#define CHIP_ID_63_32_SFT 0 ++#define CHIP_ID_63_32_HI 31 ++#define CHIP_ID_63_32_SZ 32 ++#define CHIP_ID_95_64_MSK 0xffffffff ++#define CHIP_ID_95_64_I_MSK 0x00000000 ++#define CHIP_ID_95_64_SFT 0 ++#define CHIP_ID_95_64_HI 31 ++#define CHIP_ID_95_64_SZ 32 ++#define CHIP_ID_127_96_MSK 0xffffffff ++#define CHIP_ID_127_96_I_MSK 0x00000000 ++#define CHIP_ID_127_96_SFT 0 ++#define CHIP_ID_127_96_HI 31 ++#define CHIP_ID_127_96_SZ 32 ++#define CK_SEL_1_0_MSK 0x00000003 ++#define CK_SEL_1_0_I_MSK 0xfffffffc ++#define CK_SEL_1_0_SFT 0 ++#define CK_SEL_1_0_HI 1 ++#define CK_SEL_1_0_SZ 2 ++#define CK_SEL_2_MSK 0x00000004 ++#define CK_SEL_2_I_MSK 0xfffffffb ++#define CK_SEL_2_SFT 2 ++#define CK_SEL_2_HI 2 ++#define CK_SEL_2_SZ 1 ++#define SYS_CLK_EN_MSK 0x00000001 ++#define SYS_CLK_EN_I_MSK 0xfffffffe ++#define SYS_CLK_EN_SFT 0 ++#define SYS_CLK_EN_HI 0 ++#define SYS_CLK_EN_SZ 1 ++#define MAC_CLK_EN_MSK 0x00000002 ++#define MAC_CLK_EN_I_MSK 0xfffffffd ++#define MAC_CLK_EN_SFT 1 ++#define MAC_CLK_EN_HI 1 ++#define MAC_CLK_EN_SZ 1 ++#define MCU_CLK_EN_MSK 0x00000004 ++#define MCU_CLK_EN_I_MSK 0xfffffffb ++#define MCU_CLK_EN_SFT 2 ++#define MCU_CLK_EN_HI 2 ++#define MCU_CLK_EN_SZ 1 ++#define SDIO_CLK_EN_MSK 0x00000008 ++#define SDIO_CLK_EN_I_MSK 0xfffffff7 ++#define SDIO_CLK_EN_SFT 3 ++#define SDIO_CLK_EN_HI 3 ++#define SDIO_CLK_EN_SZ 1 ++#define SPI_SLV_CLK_EN_MSK 0x00000010 ++#define SPI_SLV_CLK_EN_I_MSK 0xffffffef ++#define SPI_SLV_CLK_EN_SFT 4 ++#define SPI_SLV_CLK_EN_HI 4 ++#define SPI_SLV_CLK_EN_SZ 1 ++#define UART_CLK_EN_MSK 0x00000020 ++#define UART_CLK_EN_I_MSK 0xffffffdf ++#define UART_CLK_EN_SFT 5 ++#define UART_CLK_EN_HI 5 ++#define UART_CLK_EN_SZ 1 ++#define DMA_CLK_EN_MSK 0x00000040 ++#define DMA_CLK_EN_I_MSK 0xffffffbf ++#define DMA_CLK_EN_SFT 6 ++#define DMA_CLK_EN_HI 6 ++#define DMA_CLK_EN_SZ 1 ++#define WDT_CLK_EN_MSK 0x00000080 ++#define WDT_CLK_EN_I_MSK 0xffffff7f ++#define WDT_CLK_EN_SFT 7 ++#define WDT_CLK_EN_HI 7 ++#define WDT_CLK_EN_SZ 1 ++#define I2C_SLV_CLK_EN_MSK 0x00000100 ++#define I2C_SLV_CLK_EN_I_MSK 0xfffffeff ++#define I2C_SLV_CLK_EN_SFT 8 ++#define I2C_SLV_CLK_EN_HI 8 ++#define I2C_SLV_CLK_EN_SZ 1 ++#define INT_CTL_CLK_EN_MSK 0x00000200 ++#define INT_CTL_CLK_EN_I_MSK 0xfffffdff ++#define INT_CTL_CLK_EN_SFT 9 ++#define INT_CTL_CLK_EN_HI 9 ++#define INT_CTL_CLK_EN_SZ 1 ++#define BTCX_CLK_EN_MSK 0x00000400 ++#define BTCX_CLK_EN_I_MSK 0xfffffbff ++#define BTCX_CLK_EN_SFT 10 ++#define BTCX_CLK_EN_HI 10 ++#define BTCX_CLK_EN_SZ 1 ++#define GPIO_CLK_EN_MSK 0x00000800 ++#define GPIO_CLK_EN_I_MSK 0xfffff7ff ++#define GPIO_CLK_EN_SFT 11 ++#define GPIO_CLK_EN_HI 11 ++#define GPIO_CLK_EN_SZ 1 ++#define US0TMR_CLK_EN_MSK 0x00001000 ++#define US0TMR_CLK_EN_I_MSK 0xffffefff ++#define US0TMR_CLK_EN_SFT 12 ++#define US0TMR_CLK_EN_HI 12 ++#define US0TMR_CLK_EN_SZ 1 ++#define US1TMR_CLK_EN_MSK 0x00002000 ++#define US1TMR_CLK_EN_I_MSK 0xffffdfff ++#define US1TMR_CLK_EN_SFT 13 ++#define US1TMR_CLK_EN_HI 13 ++#define US1TMR_CLK_EN_SZ 1 ++#define US2TMR_CLK_EN_MSK 0x00004000 ++#define US2TMR_CLK_EN_I_MSK 0xffffbfff ++#define US2TMR_CLK_EN_SFT 14 ++#define US2TMR_CLK_EN_HI 14 ++#define US2TMR_CLK_EN_SZ 1 ++#define US3TMR_CLK_EN_MSK 0x00008000 ++#define US3TMR_CLK_EN_I_MSK 0xffff7fff ++#define US3TMR_CLK_EN_SFT 15 ++#define US3TMR_CLK_EN_HI 15 ++#define US3TMR_CLK_EN_SZ 1 ++#define MS0TMR_CLK_EN_MSK 0x00010000 ++#define MS0TMR_CLK_EN_I_MSK 0xfffeffff ++#define MS0TMR_CLK_EN_SFT 16 ++#define MS0TMR_CLK_EN_HI 16 ++#define MS0TMR_CLK_EN_SZ 1 ++#define MS1TMR_CLK_EN_MSK 0x00020000 ++#define MS1TMR_CLK_EN_I_MSK 0xfffdffff ++#define MS1TMR_CLK_EN_SFT 17 ++#define MS1TMR_CLK_EN_HI 17 ++#define MS1TMR_CLK_EN_SZ 1 ++#define MS2TMR_CLK_EN_MSK 0x00040000 ++#define MS2TMR_CLK_EN_I_MSK 0xfffbffff ++#define MS2TMR_CLK_EN_SFT 18 ++#define MS2TMR_CLK_EN_HI 18 ++#define MS2TMR_CLK_EN_SZ 1 ++#define MS3TMR_CLK_EN_MSK 0x00080000 ++#define MS3TMR_CLK_EN_I_MSK 0xfff7ffff ++#define MS3TMR_CLK_EN_SFT 19 ++#define MS3TMR_CLK_EN_HI 19 ++#define MS3TMR_CLK_EN_SZ 1 ++#define BIST_CLK_EN_MSK 0x00100000 ++#define BIST_CLK_EN_I_MSK 0xffefffff ++#define BIST_CLK_EN_SFT 20 ++#define BIST_CLK_EN_HI 20 ++#define BIST_CLK_EN_SZ 1 ++#define I2C_MST_CLK_EN_MSK 0x00800000 ++#define I2C_MST_CLK_EN_I_MSK 0xff7fffff ++#define I2C_MST_CLK_EN_SFT 23 ++#define I2C_MST_CLK_EN_HI 23 ++#define I2C_MST_CLK_EN_SZ 1 ++#define BTCX_CSR_CLK_EN_MSK 0x00000400 ++#define BTCX_CSR_CLK_EN_I_MSK 0xfffffbff ++#define BTCX_CSR_CLK_EN_SFT 10 ++#define BTCX_CSR_CLK_EN_HI 10 ++#define BTCX_CSR_CLK_EN_SZ 1 ++#define MCU_DBG_SEL_MSK 0x0000003f ++#define MCU_DBG_SEL_I_MSK 0xffffffc0 ++#define MCU_DBG_SEL_SFT 0 ++#define MCU_DBG_SEL_HI 5 ++#define MCU_DBG_SEL_SZ 6 ++#define MCU_STOP_NOGRANT_MSK 0x00000100 ++#define MCU_STOP_NOGRANT_I_MSK 0xfffffeff ++#define MCU_STOP_NOGRANT_SFT 8 ++#define MCU_STOP_NOGRANT_HI 8 ++#define MCU_STOP_NOGRANT_SZ 1 ++#define MCU_STOP_ANYTIME_MSK 0x00000200 ++#define MCU_STOP_ANYTIME_I_MSK 0xfffffdff ++#define MCU_STOP_ANYTIME_SFT 9 ++#define MCU_STOP_ANYTIME_HI 9 ++#define MCU_STOP_ANYTIME_SZ 1 ++#define MCU_DBG_DATA_MSK 0xffffffff ++#define MCU_DBG_DATA_I_MSK 0x00000000 ++#define MCU_DBG_DATA_SFT 0 ++#define MCU_DBG_DATA_HI 31 ++#define MCU_DBG_DATA_SZ 32 ++#define AHB_SW_RST_MSK 0x00000001 ++#define AHB_SW_RST_I_MSK 0xfffffffe ++#define AHB_SW_RST_SFT 0 ++#define AHB_SW_RST_HI 0 ++#define AHB_SW_RST_SZ 1 ++#define AHB_ERR_RST_MSK 0x00000002 ++#define AHB_ERR_RST_I_MSK 0xfffffffd ++#define AHB_ERR_RST_SFT 1 ++#define AHB_ERR_RST_HI 1 ++#define AHB_ERR_RST_SZ 1 ++#define REG_AHB_DEBUG_MX_MSK 0x00000030 ++#define REG_AHB_DEBUG_MX_I_MSK 0xffffffcf ++#define REG_AHB_DEBUG_MX_SFT 4 ++#define REG_AHB_DEBUG_MX_HI 5 ++#define REG_AHB_DEBUG_MX_SZ 2 ++#define REG_PKT_W_NBRT_MSK 0x00000100 ++#define REG_PKT_W_NBRT_I_MSK 0xfffffeff ++#define REG_PKT_W_NBRT_SFT 8 ++#define REG_PKT_W_NBRT_HI 8 ++#define REG_PKT_W_NBRT_SZ 1 ++#define REG_PKT_R_NBRT_MSK 0x00000200 ++#define REG_PKT_R_NBRT_I_MSK 0xfffffdff ++#define REG_PKT_R_NBRT_SFT 9 ++#define REG_PKT_R_NBRT_HI 9 ++#define REG_PKT_R_NBRT_SZ 1 ++#define IQ_SRAM_SEL_0_MSK 0x00001000 ++#define IQ_SRAM_SEL_0_I_MSK 0xffffefff ++#define IQ_SRAM_SEL_0_SFT 12 ++#define IQ_SRAM_SEL_0_HI 12 ++#define IQ_SRAM_SEL_0_SZ 1 ++#define IQ_SRAM_SEL_1_MSK 0x00002000 ++#define IQ_SRAM_SEL_1_I_MSK 0xffffdfff ++#define IQ_SRAM_SEL_1_SFT 13 ++#define IQ_SRAM_SEL_1_HI 13 ++#define IQ_SRAM_SEL_1_SZ 1 ++#define IQ_SRAM_SEL_2_MSK 0x00004000 ++#define IQ_SRAM_SEL_2_I_MSK 0xffffbfff ++#define IQ_SRAM_SEL_2_SFT 14 ++#define IQ_SRAM_SEL_2_HI 14 ++#define IQ_SRAM_SEL_2_SZ 1 ++#define AHB_STATUS_MSK 0xffff0000 ++#define AHB_STATUS_I_MSK 0x0000ffff ++#define AHB_STATUS_SFT 16 ++#define AHB_STATUS_HI 31 ++#define AHB_STATUS_SZ 16 ++#define PARALLEL_DR_MSK 0x00000001 ++#define PARALLEL_DR_I_MSK 0xfffffffe ++#define PARALLEL_DR_SFT 0 ++#define PARALLEL_DR_HI 0 ++#define PARALLEL_DR_SZ 1 ++#define MBRUN_MSK 0x00000010 ++#define MBRUN_I_MSK 0xffffffef ++#define MBRUN_SFT 4 ++#define MBRUN_HI 4 ++#define MBRUN_SZ 1 ++#define SHIFT_DR_MSK 0x00000100 ++#define SHIFT_DR_I_MSK 0xfffffeff ++#define SHIFT_DR_SFT 8 ++#define SHIFT_DR_HI 8 ++#define SHIFT_DR_SZ 1 ++#define MODE_REG_SI_MSK 0x00000200 ++#define MODE_REG_SI_I_MSK 0xfffffdff ++#define MODE_REG_SI_SFT 9 ++#define MODE_REG_SI_HI 9 ++#define MODE_REG_SI_SZ 1 ++#define SIMULATION_MODE_MSK 0x00000400 ++#define SIMULATION_MODE_I_MSK 0xfffffbff ++#define SIMULATION_MODE_SFT 10 ++#define SIMULATION_MODE_HI 10 ++#define SIMULATION_MODE_SZ 1 ++#define DBIST_MODE_MSK 0x00000800 ++#define DBIST_MODE_I_MSK 0xfffff7ff ++#define DBIST_MODE_SFT 11 ++#define DBIST_MODE_HI 11 ++#define DBIST_MODE_SZ 1 ++#define MODE_REG_IN_MSK 0x001fffff ++#define MODE_REG_IN_I_MSK 0xffe00000 ++#define MODE_REG_IN_SFT 0 ++#define MODE_REG_IN_HI 20 ++#define MODE_REG_IN_SZ 21 ++#define MODE_REG_OUT_MCU_MSK 0x001fffff ++#define MODE_REG_OUT_MCU_I_MSK 0xffe00000 ++#define MODE_REG_OUT_MCU_SFT 0 ++#define MODE_REG_OUT_MCU_HI 20 ++#define MODE_REG_OUT_MCU_SZ 21 ++#define MODE_REG_SO_MCU_MSK 0x80000000 ++#define MODE_REG_SO_MCU_I_MSK 0x7fffffff ++#define MODE_REG_SO_MCU_SFT 31 ++#define MODE_REG_SO_MCU_HI 31 ++#define MODE_REG_SO_MCU_SZ 1 ++#define MONITOR_BUS_MCU_31_0_MSK 0xffffffff ++#define MONITOR_BUS_MCU_31_0_I_MSK 0x00000000 ++#define MONITOR_BUS_MCU_31_0_SFT 0 ++#define MONITOR_BUS_MCU_31_0_HI 31 ++#define MONITOR_BUS_MCU_31_0_SZ 32 ++#define MONITOR_BUS_MCU_33_32_MSK 0x00000003 ++#define MONITOR_BUS_MCU_33_32_I_MSK 0xfffffffc ++#define MONITOR_BUS_MCU_33_32_SFT 0 ++#define MONITOR_BUS_MCU_33_32_HI 1 ++#define MONITOR_BUS_MCU_33_32_SZ 2 ++#define TB_ADR_SEL_MSK 0x0000ffff ++#define TB_ADR_SEL_I_MSK 0xffff0000 ++#define TB_ADR_SEL_SFT 0 ++#define TB_ADR_SEL_HI 15 ++#define TB_ADR_SEL_SZ 16 ++#define TB_CS_MSK 0x80000000 ++#define TB_CS_I_MSK 0x7fffffff ++#define TB_CS_SFT 31 ++#define TB_CS_HI 31 ++#define TB_CS_SZ 1 ++#define TB_RDATA_MSK 0xffffffff ++#define TB_RDATA_I_MSK 0x00000000 ++#define TB_RDATA_SFT 0 ++#define TB_RDATA_HI 31 ++#define TB_RDATA_SZ 32 ++#define UART_W2B_EN_MSK 0x00000001 ++#define UART_W2B_EN_I_MSK 0xfffffffe ++#define UART_W2B_EN_SFT 0 ++#define UART_W2B_EN_HI 0 ++#define UART_W2B_EN_SZ 1 ++#define DATA_UART_W2B_EN_MSK 0x00000010 ++#define DATA_UART_W2B_EN_I_MSK 0xffffffef ++#define DATA_UART_W2B_EN_SFT 4 ++#define DATA_UART_W2B_EN_HI 4 ++#define DATA_UART_W2B_EN_SZ 1 ++#define AHB_ILL_ADDR_MSK 0xffffffff ++#define AHB_ILL_ADDR_I_MSK 0x00000000 ++#define AHB_ILL_ADDR_SFT 0 ++#define AHB_ILL_ADDR_HI 31 ++#define AHB_ILL_ADDR_SZ 32 ++#define AHB_FEN_ADDR_MSK 0xffffffff ++#define AHB_FEN_ADDR_I_MSK 0x00000000 ++#define AHB_FEN_ADDR_SFT 0 ++#define AHB_FEN_ADDR_HI 31 ++#define AHB_FEN_ADDR_SZ 32 ++#define ILL_ADDR_CLR_MSK 0x00000001 ++#define ILL_ADDR_CLR_I_MSK 0xfffffffe ++#define ILL_ADDR_CLR_SFT 0 ++#define ILL_ADDR_CLR_HI 0 ++#define ILL_ADDR_CLR_SZ 1 ++#define FENCE_HIT_CLR_MSK 0x00000002 ++#define FENCE_HIT_CLR_I_MSK 0xfffffffd ++#define FENCE_HIT_CLR_SFT 1 ++#define FENCE_HIT_CLR_HI 1 ++#define FENCE_HIT_CLR_SZ 1 ++#define ILL_ADDR_INT_MSK 0x00000010 ++#define ILL_ADDR_INT_I_MSK 0xffffffef ++#define ILL_ADDR_INT_SFT 4 ++#define ILL_ADDR_INT_HI 4 ++#define ILL_ADDR_INT_SZ 1 ++#define FENCE_HIT_INT_MSK 0x00000020 ++#define FENCE_HIT_INT_I_MSK 0xffffffdf ++#define FENCE_HIT_INT_SFT 5 ++#define FENCE_HIT_INT_HI 5 ++#define FENCE_HIT_INT_SZ 1 ++#define PWM_INI_VALUE_P_A_MSK 0x000000ff ++#define PWM_INI_VALUE_P_A_I_MSK 0xffffff00 ++#define PWM_INI_VALUE_P_A_SFT 0 ++#define PWM_INI_VALUE_P_A_HI 7 ++#define PWM_INI_VALUE_P_A_SZ 8 ++#define PWM_INI_VALUE_N_A_MSK 0x0000ff00 ++#define PWM_INI_VALUE_N_A_I_MSK 0xffff00ff ++#define PWM_INI_VALUE_N_A_SFT 8 ++#define PWM_INI_VALUE_N_A_HI 15 ++#define PWM_INI_VALUE_N_A_SZ 8 ++#define PWM_POST_SCALER_A_MSK 0x000f0000 ++#define PWM_POST_SCALER_A_I_MSK 0xfff0ffff ++#define PWM_POST_SCALER_A_SFT 16 ++#define PWM_POST_SCALER_A_HI 19 ++#define PWM_POST_SCALER_A_SZ 4 ++#define PWM_ALWAYSON_A_MSK 0x20000000 ++#define PWM_ALWAYSON_A_I_MSK 0xdfffffff ++#define PWM_ALWAYSON_A_SFT 29 ++#define PWM_ALWAYSON_A_HI 29 ++#define PWM_ALWAYSON_A_SZ 1 ++#define PWM_INVERT_A_MSK 0x40000000 ++#define PWM_INVERT_A_I_MSK 0xbfffffff ++#define PWM_INVERT_A_SFT 30 ++#define PWM_INVERT_A_HI 30 ++#define PWM_INVERT_A_SZ 1 ++#define PWM_ENABLE_A_MSK 0x80000000 ++#define PWM_ENABLE_A_I_MSK 0x7fffffff ++#define PWM_ENABLE_A_SFT 31 ++#define PWM_ENABLE_A_HI 31 ++#define PWM_ENABLE_A_SZ 1 ++#define PWM_INI_VALUE_P_B_MSK 0x000000ff ++#define PWM_INI_VALUE_P_B_I_MSK 0xffffff00 ++#define PWM_INI_VALUE_P_B_SFT 0 ++#define PWM_INI_VALUE_P_B_HI 7 ++#define PWM_INI_VALUE_P_B_SZ 8 ++#define PWM_INI_VALUE_N_B_MSK 0x0000ff00 ++#define PWM_INI_VALUE_N_B_I_MSK 0xffff00ff ++#define PWM_INI_VALUE_N_B_SFT 8 ++#define PWM_INI_VALUE_N_B_HI 15 ++#define PWM_INI_VALUE_N_B_SZ 8 ++#define PWM_POST_SCALER_B_MSK 0x000f0000 ++#define PWM_POST_SCALER_B_I_MSK 0xfff0ffff ++#define PWM_POST_SCALER_B_SFT 16 ++#define PWM_POST_SCALER_B_HI 19 ++#define PWM_POST_SCALER_B_SZ 4 ++#define PWM_ALWAYSON_B_MSK 0x20000000 ++#define PWM_ALWAYSON_B_I_MSK 0xdfffffff ++#define PWM_ALWAYSON_B_SFT 29 ++#define PWM_ALWAYSON_B_HI 29 ++#define PWM_ALWAYSON_B_SZ 1 ++#define PWM_INVERT_B_MSK 0x40000000 ++#define PWM_INVERT_B_I_MSK 0xbfffffff ++#define PWM_INVERT_B_SFT 30 ++#define PWM_INVERT_B_HI 30 ++#define PWM_INVERT_B_SZ 1 ++#define PWM_ENABLE_B_MSK 0x80000000 ++#define PWM_ENABLE_B_I_MSK 0x7fffffff ++#define PWM_ENABLE_B_SFT 31 ++#define PWM_ENABLE_B_HI 31 ++#define PWM_ENABLE_B_SZ 1 ++#define HBUSREQ_LOCK_MSK 0x00001fff ++#define HBUSREQ_LOCK_I_MSK 0xffffe000 ++#define HBUSREQ_LOCK_SFT 0 ++#define HBUSREQ_LOCK_HI 12 ++#define HBUSREQ_LOCK_SZ 13 ++#define HBURST_LOCK_MSK 0x00001fff ++#define HBURST_LOCK_I_MSK 0xffffe000 ++#define HBURST_LOCK_SFT 0 ++#define HBURST_LOCK_HI 12 ++#define HBURST_LOCK_SZ 13 ++#define PRESCALER_USTIMER_MSK 0x000001ff ++#define PRESCALER_USTIMER_I_MSK 0xfffffe00 ++#define PRESCALER_USTIMER_SFT 0 ++#define PRESCALER_USTIMER_HI 8 ++#define PRESCALER_USTIMER_SZ 9 ++#define MODE_REG_IN_MMU_MSK 0x0000ffff ++#define MODE_REG_IN_MMU_I_MSK 0xffff0000 ++#define MODE_REG_IN_MMU_SFT 0 ++#define MODE_REG_IN_MMU_HI 15 ++#define MODE_REG_IN_MMU_SZ 16 ++#define MODE_REG_OUT_MMU_MSK 0x0000ffff ++#define MODE_REG_OUT_MMU_I_MSK 0xffff0000 ++#define MODE_REG_OUT_MMU_SFT 0 ++#define MODE_REG_OUT_MMU_HI 15 ++#define MODE_REG_OUT_MMU_SZ 16 ++#define MODE_REG_SO_MMU_MSK 0x80000000 ++#define MODE_REG_SO_MMU_I_MSK 0x7fffffff ++#define MODE_REG_SO_MMU_SFT 31 ++#define MODE_REG_SO_MMU_HI 31 ++#define MODE_REG_SO_MMU_SZ 1 ++#define MONITOR_BUS_MMU_MSK 0x0007ffff ++#define MONITOR_BUS_MMU_I_MSK 0xfff80000 ++#define MONITOR_BUS_MMU_SFT 0 ++#define MONITOR_BUS_MMU_HI 18 ++#define MONITOR_BUS_MMU_SZ 19 ++#define TEST_MODE0_MSK 0x00000001 ++#define TEST_MODE0_I_MSK 0xfffffffe ++#define TEST_MODE0_SFT 0 ++#define TEST_MODE0_HI 0 ++#define TEST_MODE0_SZ 1 ++#define TEST_MODE1_MSK 0x00000002 ++#define TEST_MODE1_I_MSK 0xfffffffd ++#define TEST_MODE1_SFT 1 ++#define TEST_MODE1_HI 1 ++#define TEST_MODE1_SZ 1 ++#define TEST_MODE2_MSK 0x00000004 ++#define TEST_MODE2_I_MSK 0xfffffffb ++#define TEST_MODE2_SFT 2 ++#define TEST_MODE2_HI 2 ++#define TEST_MODE2_SZ 1 ++#define TEST_MODE3_MSK 0x00000008 ++#define TEST_MODE3_I_MSK 0xfffffff7 ++#define TEST_MODE3_SFT 3 ++#define TEST_MODE3_HI 3 ++#define TEST_MODE3_SZ 1 ++#define TEST_MODE4_MSK 0x00000010 ++#define TEST_MODE4_I_MSK 0xffffffef ++#define TEST_MODE4_SFT 4 ++#define TEST_MODE4_HI 4 ++#define TEST_MODE4_SZ 1 ++#define TEST_MODE_ALL_MSK 0x00000020 ++#define TEST_MODE_ALL_I_MSK 0xffffffdf ++#define TEST_MODE_ALL_SFT 5 ++#define TEST_MODE_ALL_HI 5 ++#define TEST_MODE_ALL_SZ 1 ++#define WDT_INIT_MSK 0x00000001 ++#define WDT_INIT_I_MSK 0xfffffffe ++#define WDT_INIT_SFT 0 ++#define WDT_INIT_HI 0 ++#define WDT_INIT_SZ 1 ++#define SD_HOST_INIT_MSK 0x00000002 ++#define SD_HOST_INIT_I_MSK 0xfffffffd ++#define SD_HOST_INIT_SFT 1 ++#define SD_HOST_INIT_HI 1 ++#define SD_HOST_INIT_SZ 1 ++#define ALLOW_SD_RESET_MSK 0x00000001 ++#define ALLOW_SD_RESET_I_MSK 0xfffffffe ++#define ALLOW_SD_RESET_SFT 0 ++#define ALLOW_SD_RESET_HI 0 ++#define ALLOW_SD_RESET_SZ 1 ++#define UART_NRTS_MSK 0x00000001 ++#define UART_NRTS_I_MSK 0xfffffffe ++#define UART_NRTS_SFT 0 ++#define UART_NRTS_HI 0 ++#define UART_NRTS_SZ 1 ++#define UART_NCTS_MSK 0x00000002 ++#define UART_NCTS_I_MSK 0xfffffffd ++#define UART_NCTS_SFT 1 ++#define UART_NCTS_HI 1 ++#define UART_NCTS_SZ 1 ++#define TU0_TM_INIT_VALUE_MSK 0x0000ffff ++#define TU0_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TU0_TM_INIT_VALUE_SFT 0 ++#define TU0_TM_INIT_VALUE_HI 15 ++#define TU0_TM_INIT_VALUE_SZ 16 ++#define TU0_TM_MODE_MSK 0x00010000 ++#define TU0_TM_MODE_I_MSK 0xfffeffff ++#define TU0_TM_MODE_SFT 16 ++#define TU0_TM_MODE_HI 16 ++#define TU0_TM_MODE_SZ 1 ++#define TU0_TM_INT_STS_DONE_MSK 0x00020000 ++#define TU0_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TU0_TM_INT_STS_DONE_SFT 17 ++#define TU0_TM_INT_STS_DONE_HI 17 ++#define TU0_TM_INT_STS_DONE_SZ 1 ++#define TU0_TM_INT_MASK_MSK 0x00040000 ++#define TU0_TM_INT_MASK_I_MSK 0xfffbffff ++#define TU0_TM_INT_MASK_SFT 18 ++#define TU0_TM_INT_MASK_HI 18 ++#define TU0_TM_INT_MASK_SZ 1 ++#define TU0_TM_CUR_VALUE_MSK 0x0000ffff ++#define TU0_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TU0_TM_CUR_VALUE_SFT 0 ++#define TU0_TM_CUR_VALUE_HI 15 ++#define TU0_TM_CUR_VALUE_SZ 16 ++#define TU1_TM_INIT_VALUE_MSK 0x0000ffff ++#define TU1_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TU1_TM_INIT_VALUE_SFT 0 ++#define TU1_TM_INIT_VALUE_HI 15 ++#define TU1_TM_INIT_VALUE_SZ 16 ++#define TU1_TM_MODE_MSK 0x00010000 ++#define TU1_TM_MODE_I_MSK 0xfffeffff ++#define TU1_TM_MODE_SFT 16 ++#define TU1_TM_MODE_HI 16 ++#define TU1_TM_MODE_SZ 1 ++#define TU1_TM_INT_STS_DONE_MSK 0x00020000 ++#define TU1_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TU1_TM_INT_STS_DONE_SFT 17 ++#define TU1_TM_INT_STS_DONE_HI 17 ++#define TU1_TM_INT_STS_DONE_SZ 1 ++#define TU1_TM_INT_MASK_MSK 0x00040000 ++#define TU1_TM_INT_MASK_I_MSK 0xfffbffff ++#define TU1_TM_INT_MASK_SFT 18 ++#define TU1_TM_INT_MASK_HI 18 ++#define TU1_TM_INT_MASK_SZ 1 ++#define TU1_TM_CUR_VALUE_MSK 0x0000ffff ++#define TU1_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TU1_TM_CUR_VALUE_SFT 0 ++#define TU1_TM_CUR_VALUE_HI 15 ++#define TU1_TM_CUR_VALUE_SZ 16 ++#define TU2_TM_INIT_VALUE_MSK 0x0000ffff ++#define TU2_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TU2_TM_INIT_VALUE_SFT 0 ++#define TU2_TM_INIT_VALUE_HI 15 ++#define TU2_TM_INIT_VALUE_SZ 16 ++#define TU2_TM_MODE_MSK 0x00010000 ++#define TU2_TM_MODE_I_MSK 0xfffeffff ++#define TU2_TM_MODE_SFT 16 ++#define TU2_TM_MODE_HI 16 ++#define TU2_TM_MODE_SZ 1 ++#define TU2_TM_INT_STS_DONE_MSK 0x00020000 ++#define TU2_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TU2_TM_INT_STS_DONE_SFT 17 ++#define TU2_TM_INT_STS_DONE_HI 17 ++#define TU2_TM_INT_STS_DONE_SZ 1 ++#define TU2_TM_INT_MASK_MSK 0x00040000 ++#define TU2_TM_INT_MASK_I_MSK 0xfffbffff ++#define TU2_TM_INT_MASK_SFT 18 ++#define TU2_TM_INT_MASK_HI 18 ++#define TU2_TM_INT_MASK_SZ 1 ++#define TU2_TM_CUR_VALUE_MSK 0x0000ffff ++#define TU2_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TU2_TM_CUR_VALUE_SFT 0 ++#define TU2_TM_CUR_VALUE_HI 15 ++#define TU2_TM_CUR_VALUE_SZ 16 ++#define TU3_TM_INIT_VALUE_MSK 0x0000ffff ++#define TU3_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TU3_TM_INIT_VALUE_SFT 0 ++#define TU3_TM_INIT_VALUE_HI 15 ++#define TU3_TM_INIT_VALUE_SZ 16 ++#define TU3_TM_MODE_MSK 0x00010000 ++#define TU3_TM_MODE_I_MSK 0xfffeffff ++#define TU3_TM_MODE_SFT 16 ++#define TU3_TM_MODE_HI 16 ++#define TU3_TM_MODE_SZ 1 ++#define TU3_TM_INT_STS_DONE_MSK 0x00020000 ++#define TU3_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TU3_TM_INT_STS_DONE_SFT 17 ++#define TU3_TM_INT_STS_DONE_HI 17 ++#define TU3_TM_INT_STS_DONE_SZ 1 ++#define TU3_TM_INT_MASK_MSK 0x00040000 ++#define TU3_TM_INT_MASK_I_MSK 0xfffbffff ++#define TU3_TM_INT_MASK_SFT 18 ++#define TU3_TM_INT_MASK_HI 18 ++#define TU3_TM_INT_MASK_SZ 1 ++#define TU3_TM_CUR_VALUE_MSK 0x0000ffff ++#define TU3_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TU3_TM_CUR_VALUE_SFT 0 ++#define TU3_TM_CUR_VALUE_HI 15 ++#define TU3_TM_CUR_VALUE_SZ 16 ++#define TM0_TM_INIT_VALUE_MSK 0x0000ffff ++#define TM0_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TM0_TM_INIT_VALUE_SFT 0 ++#define TM0_TM_INIT_VALUE_HI 15 ++#define TM0_TM_INIT_VALUE_SZ 16 ++#define TM0_TM_MODE_MSK 0x00010000 ++#define TM0_TM_MODE_I_MSK 0xfffeffff ++#define TM0_TM_MODE_SFT 16 ++#define TM0_TM_MODE_HI 16 ++#define TM0_TM_MODE_SZ 1 ++#define TM0_TM_INT_STS_DONE_MSK 0x00020000 ++#define TM0_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TM0_TM_INT_STS_DONE_SFT 17 ++#define TM0_TM_INT_STS_DONE_HI 17 ++#define TM0_TM_INT_STS_DONE_SZ 1 ++#define TM0_TM_INT_MASK_MSK 0x00040000 ++#define TM0_TM_INT_MASK_I_MSK 0xfffbffff ++#define TM0_TM_INT_MASK_SFT 18 ++#define TM0_TM_INT_MASK_HI 18 ++#define TM0_TM_INT_MASK_SZ 1 ++#define TM0_TM_CUR_VALUE_MSK 0x0000ffff ++#define TM0_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TM0_TM_CUR_VALUE_SFT 0 ++#define TM0_TM_CUR_VALUE_HI 15 ++#define TM0_TM_CUR_VALUE_SZ 16 ++#define TM1_TM_INIT_VALUE_MSK 0x0000ffff ++#define TM1_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TM1_TM_INIT_VALUE_SFT 0 ++#define TM1_TM_INIT_VALUE_HI 15 ++#define TM1_TM_INIT_VALUE_SZ 16 ++#define TM1_TM_MODE_MSK 0x00010000 ++#define TM1_TM_MODE_I_MSK 0xfffeffff ++#define TM1_TM_MODE_SFT 16 ++#define TM1_TM_MODE_HI 16 ++#define TM1_TM_MODE_SZ 1 ++#define TM1_TM_INT_STS_DONE_MSK 0x00020000 ++#define TM1_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TM1_TM_INT_STS_DONE_SFT 17 ++#define TM1_TM_INT_STS_DONE_HI 17 ++#define TM1_TM_INT_STS_DONE_SZ 1 ++#define TM1_TM_INT_MASK_MSK 0x00040000 ++#define TM1_TM_INT_MASK_I_MSK 0xfffbffff ++#define TM1_TM_INT_MASK_SFT 18 ++#define TM1_TM_INT_MASK_HI 18 ++#define TM1_TM_INT_MASK_SZ 1 ++#define TM1_TM_CUR_VALUE_MSK 0x0000ffff ++#define TM1_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TM1_TM_CUR_VALUE_SFT 0 ++#define TM1_TM_CUR_VALUE_HI 15 ++#define TM1_TM_CUR_VALUE_SZ 16 ++#define TM2_TM_INIT_VALUE_MSK 0x0000ffff ++#define TM2_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TM2_TM_INIT_VALUE_SFT 0 ++#define TM2_TM_INIT_VALUE_HI 15 ++#define TM2_TM_INIT_VALUE_SZ 16 ++#define TM2_TM_MODE_MSK 0x00010000 ++#define TM2_TM_MODE_I_MSK 0xfffeffff ++#define TM2_TM_MODE_SFT 16 ++#define TM2_TM_MODE_HI 16 ++#define TM2_TM_MODE_SZ 1 ++#define TM2_TM_INT_STS_DONE_MSK 0x00020000 ++#define TM2_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TM2_TM_INT_STS_DONE_SFT 17 ++#define TM2_TM_INT_STS_DONE_HI 17 ++#define TM2_TM_INT_STS_DONE_SZ 1 ++#define TM2_TM_INT_MASK_MSK 0x00040000 ++#define TM2_TM_INT_MASK_I_MSK 0xfffbffff ++#define TM2_TM_INT_MASK_SFT 18 ++#define TM2_TM_INT_MASK_HI 18 ++#define TM2_TM_INT_MASK_SZ 1 ++#define TM2_TM_CUR_VALUE_MSK 0x0000ffff ++#define TM2_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TM2_TM_CUR_VALUE_SFT 0 ++#define TM2_TM_CUR_VALUE_HI 15 ++#define TM2_TM_CUR_VALUE_SZ 16 ++#define TM3_TM_INIT_VALUE_MSK 0x0000ffff ++#define TM3_TM_INIT_VALUE_I_MSK 0xffff0000 ++#define TM3_TM_INIT_VALUE_SFT 0 ++#define TM3_TM_INIT_VALUE_HI 15 ++#define TM3_TM_INIT_VALUE_SZ 16 ++#define TM3_TM_MODE_MSK 0x00010000 ++#define TM3_TM_MODE_I_MSK 0xfffeffff ++#define TM3_TM_MODE_SFT 16 ++#define TM3_TM_MODE_HI 16 ++#define TM3_TM_MODE_SZ 1 ++#define TM3_TM_INT_STS_DONE_MSK 0x00020000 ++#define TM3_TM_INT_STS_DONE_I_MSK 0xfffdffff ++#define TM3_TM_INT_STS_DONE_SFT 17 ++#define TM3_TM_INT_STS_DONE_HI 17 ++#define TM3_TM_INT_STS_DONE_SZ 1 ++#define TM3_TM_INT_MASK_MSK 0x00040000 ++#define TM3_TM_INT_MASK_I_MSK 0xfffbffff ++#define TM3_TM_INT_MASK_SFT 18 ++#define TM3_TM_INT_MASK_HI 18 ++#define TM3_TM_INT_MASK_SZ 1 ++#define TM3_TM_CUR_VALUE_MSK 0x0000ffff ++#define TM3_TM_CUR_VALUE_I_MSK 0xffff0000 ++#define TM3_TM_CUR_VALUE_SFT 0 ++#define TM3_TM_CUR_VALUE_HI 15 ++#define TM3_TM_CUR_VALUE_SZ 16 ++#define MCU_WDT_TIME_CNT_MSK 0x0000ffff ++#define MCU_WDT_TIME_CNT_I_MSK 0xffff0000 ++#define MCU_WDT_TIME_CNT_SFT 0 ++#define MCU_WDT_TIME_CNT_HI 15 ++#define MCU_WDT_TIME_CNT_SZ 16 ++#define MCU_WDT_STATUS_MSK 0x00020000 ++#define MCU_WDT_STATUS_I_MSK 0xfffdffff ++#define MCU_WDT_STATUS_SFT 17 ++#define MCU_WDT_STATUS_HI 17 ++#define MCU_WDT_STATUS_SZ 1 ++#define MCU_WDOG_ENA_MSK 0x80000000 ++#define MCU_WDOG_ENA_I_MSK 0x7fffffff ++#define MCU_WDOG_ENA_SFT 31 ++#define MCU_WDOG_ENA_HI 31 ++#define MCU_WDOG_ENA_SZ 1 ++#define SYS_WDT_TIME_CNT_MSK 0x0000ffff ++#define SYS_WDT_TIME_CNT_I_MSK 0xffff0000 ++#define SYS_WDT_TIME_CNT_SFT 0 ++#define SYS_WDT_TIME_CNT_HI 15 ++#define SYS_WDT_TIME_CNT_SZ 16 ++#define SYS_WDT_STATUS_MSK 0x00020000 ++#define SYS_WDT_STATUS_I_MSK 0xfffdffff ++#define SYS_WDT_STATUS_SFT 17 ++#define SYS_WDT_STATUS_HI 17 ++#define SYS_WDT_STATUS_SZ 1 ++#define SYS_WDOG_ENA_MSK 0x80000000 ++#define SYS_WDOG_ENA_I_MSK 0x7fffffff ++#define SYS_WDOG_ENA_SFT 31 ++#define SYS_WDOG_ENA_HI 31 ++#define SYS_WDOG_ENA_SZ 1 ++#define XLNA_EN_O_OE_MSK 0x00000001 ++#define XLNA_EN_O_OE_I_MSK 0xfffffffe ++#define XLNA_EN_O_OE_SFT 0 ++#define XLNA_EN_O_OE_HI 0 ++#define XLNA_EN_O_OE_SZ 1 ++#define XLNA_EN_O_PE_MSK 0x00000002 ++#define XLNA_EN_O_PE_I_MSK 0xfffffffd ++#define XLNA_EN_O_PE_SFT 1 ++#define XLNA_EN_O_PE_HI 1 ++#define XLNA_EN_O_PE_SZ 1 ++#define PAD6_IE_MSK 0x00000008 ++#define PAD6_IE_I_MSK 0xfffffff7 ++#define PAD6_IE_SFT 3 ++#define PAD6_IE_HI 3 ++#define PAD6_IE_SZ 1 ++#define PAD6_SEL_I_MSK 0x00000030 ++#define PAD6_SEL_I_I_MSK 0xffffffcf ++#define PAD6_SEL_I_SFT 4 ++#define PAD6_SEL_I_HI 5 ++#define PAD6_SEL_I_SZ 2 ++#define PAD6_OD_MSK 0x00000100 ++#define PAD6_OD_I_MSK 0xfffffeff ++#define PAD6_OD_SFT 8 ++#define PAD6_OD_HI 8 ++#define PAD6_OD_SZ 1 ++#define PAD6_SEL_O_MSK 0x00001000 ++#define PAD6_SEL_O_I_MSK 0xffffefff ++#define PAD6_SEL_O_SFT 12 ++#define PAD6_SEL_O_HI 12 ++#define PAD6_SEL_O_SZ 1 ++#define XLNA_EN_O_C_MSK 0x10000000 ++#define XLNA_EN_O_C_I_MSK 0xefffffff ++#define XLNA_EN_O_C_SFT 28 ++#define XLNA_EN_O_C_HI 28 ++#define XLNA_EN_O_C_SZ 1 ++#define WIFI_TX_SW_O_OE_MSK 0x00000001 ++#define WIFI_TX_SW_O_OE_I_MSK 0xfffffffe ++#define WIFI_TX_SW_O_OE_SFT 0 ++#define WIFI_TX_SW_O_OE_HI 0 ++#define WIFI_TX_SW_O_OE_SZ 1 ++#define WIFI_TX_SW_O_PE_MSK 0x00000002 ++#define WIFI_TX_SW_O_PE_I_MSK 0xfffffffd ++#define WIFI_TX_SW_O_PE_SFT 1 ++#define WIFI_TX_SW_O_PE_HI 1 ++#define WIFI_TX_SW_O_PE_SZ 1 ++#define PAD7_IE_MSK 0x00000008 ++#define PAD7_IE_I_MSK 0xfffffff7 ++#define PAD7_IE_SFT 3 ++#define PAD7_IE_HI 3 ++#define PAD7_IE_SZ 1 ++#define PAD7_SEL_I_MSK 0x00000030 ++#define PAD7_SEL_I_I_MSK 0xffffffcf ++#define PAD7_SEL_I_SFT 4 ++#define PAD7_SEL_I_HI 5 ++#define PAD7_SEL_I_SZ 2 ++#define PAD7_OD_MSK 0x00000100 ++#define PAD7_OD_I_MSK 0xfffffeff ++#define PAD7_OD_SFT 8 ++#define PAD7_OD_HI 8 ++#define PAD7_OD_SZ 1 ++#define PAD7_SEL_O_MSK 0x00001000 ++#define PAD7_SEL_O_I_MSK 0xffffefff ++#define PAD7_SEL_O_SFT 12 ++#define PAD7_SEL_O_HI 12 ++#define PAD7_SEL_O_SZ 1 ++#define WIFI_TX_SW_O_C_MSK 0x10000000 ++#define WIFI_TX_SW_O_C_I_MSK 0xefffffff ++#define WIFI_TX_SW_O_C_SFT 28 ++#define WIFI_TX_SW_O_C_HI 28 ++#define WIFI_TX_SW_O_C_SZ 1 ++#define WIFI_RX_SW_O_OE_MSK 0x00000001 ++#define WIFI_RX_SW_O_OE_I_MSK 0xfffffffe ++#define WIFI_RX_SW_O_OE_SFT 0 ++#define WIFI_RX_SW_O_OE_HI 0 ++#define WIFI_RX_SW_O_OE_SZ 1 ++#define WIFI_RX_SW_O_PE_MSK 0x00000002 ++#define WIFI_RX_SW_O_PE_I_MSK 0xfffffffd ++#define WIFI_RX_SW_O_PE_SFT 1 ++#define WIFI_RX_SW_O_PE_HI 1 ++#define WIFI_RX_SW_O_PE_SZ 1 ++#define PAD8_IE_MSK 0x00000008 ++#define PAD8_IE_I_MSK 0xfffffff7 ++#define PAD8_IE_SFT 3 ++#define PAD8_IE_HI 3 ++#define PAD8_IE_SZ 1 ++#define PAD8_SEL_I_MSK 0x00000030 ++#define PAD8_SEL_I_I_MSK 0xffffffcf ++#define PAD8_SEL_I_SFT 4 ++#define PAD8_SEL_I_HI 5 ++#define PAD8_SEL_I_SZ 2 ++#define PAD8_OD_MSK 0x00000100 ++#define PAD8_OD_I_MSK 0xfffffeff ++#define PAD8_OD_SFT 8 ++#define PAD8_OD_HI 8 ++#define PAD8_OD_SZ 1 ++#define WIFI_RX_SW_O_C_MSK 0x10000000 ++#define WIFI_RX_SW_O_C_I_MSK 0xefffffff ++#define WIFI_RX_SW_O_C_SFT 28 ++#define WIFI_RX_SW_O_C_HI 28 ++#define WIFI_RX_SW_O_C_SZ 1 ++#define BT_SW_O_OE_MSK 0x00000001 ++#define BT_SW_O_OE_I_MSK 0xfffffffe ++#define BT_SW_O_OE_SFT 0 ++#define BT_SW_O_OE_HI 0 ++#define BT_SW_O_OE_SZ 1 ++#define BT_SW_O_PE_MSK 0x00000002 ++#define BT_SW_O_PE_I_MSK 0xfffffffd ++#define BT_SW_O_PE_SFT 1 ++#define BT_SW_O_PE_HI 1 ++#define BT_SW_O_PE_SZ 1 ++#define PAD9_IE_MSK 0x00000008 ++#define PAD9_IE_I_MSK 0xfffffff7 ++#define PAD9_IE_SFT 3 ++#define PAD9_IE_HI 3 ++#define PAD9_IE_SZ 1 ++#define PAD9_SEL_I_MSK 0x00000030 ++#define PAD9_SEL_I_I_MSK 0xffffffcf ++#define PAD9_SEL_I_SFT 4 ++#define PAD9_SEL_I_HI 5 ++#define PAD9_SEL_I_SZ 2 ++#define PAD9_OD_MSK 0x00000100 ++#define PAD9_OD_I_MSK 0xfffffeff ++#define PAD9_OD_SFT 8 ++#define PAD9_OD_HI 8 ++#define PAD9_OD_SZ 1 ++#define PAD9_SEL_O_MSK 0x00001000 ++#define PAD9_SEL_O_I_MSK 0xffffefff ++#define PAD9_SEL_O_SFT 12 ++#define PAD9_SEL_O_HI 12 ++#define PAD9_SEL_O_SZ 1 ++#define BT_SW_O_C_MSK 0x10000000 ++#define BT_SW_O_C_I_MSK 0xefffffff ++#define BT_SW_O_C_SFT 28 ++#define BT_SW_O_C_HI 28 ++#define BT_SW_O_C_SZ 1 ++#define XPA_EN_O_OE_MSK 0x00000001 ++#define XPA_EN_O_OE_I_MSK 0xfffffffe ++#define XPA_EN_O_OE_SFT 0 ++#define XPA_EN_O_OE_HI 0 ++#define XPA_EN_O_OE_SZ 1 ++#define XPA_EN_O_PE_MSK 0x00000002 ++#define XPA_EN_O_PE_I_MSK 0xfffffffd ++#define XPA_EN_O_PE_SFT 1 ++#define XPA_EN_O_PE_HI 1 ++#define XPA_EN_O_PE_SZ 1 ++#define PAD11_IE_MSK 0x00000008 ++#define PAD11_IE_I_MSK 0xfffffff7 ++#define PAD11_IE_SFT 3 ++#define PAD11_IE_HI 3 ++#define PAD11_IE_SZ 1 ++#define PAD11_SEL_I_MSK 0x00000030 ++#define PAD11_SEL_I_I_MSK 0xffffffcf ++#define PAD11_SEL_I_SFT 4 ++#define PAD11_SEL_I_HI 5 ++#define PAD11_SEL_I_SZ 2 ++#define PAD11_OD_MSK 0x00000100 ++#define PAD11_OD_I_MSK 0xfffffeff ++#define PAD11_OD_SFT 8 ++#define PAD11_OD_HI 8 ++#define PAD11_OD_SZ 1 ++#define PAD11_SEL_O_MSK 0x00001000 ++#define PAD11_SEL_O_I_MSK 0xffffefff ++#define PAD11_SEL_O_SFT 12 ++#define PAD11_SEL_O_HI 12 ++#define PAD11_SEL_O_SZ 1 ++#define XPA_EN_O_C_MSK 0x10000000 ++#define XPA_EN_O_C_I_MSK 0xefffffff ++#define XPA_EN_O_C_SFT 28 ++#define XPA_EN_O_C_HI 28 ++#define XPA_EN_O_C_SZ 1 ++#define PAD15_OE_MSK 0x00000001 ++#define PAD15_OE_I_MSK 0xfffffffe ++#define PAD15_OE_SFT 0 ++#define PAD15_OE_HI 0 ++#define PAD15_OE_SZ 1 ++#define PAD15_PE_MSK 0x00000002 ++#define PAD15_PE_I_MSK 0xfffffffd ++#define PAD15_PE_SFT 1 ++#define PAD15_PE_HI 1 ++#define PAD15_PE_SZ 1 ++#define PAD15_DS_MSK 0x00000004 ++#define PAD15_DS_I_MSK 0xfffffffb ++#define PAD15_DS_SFT 2 ++#define PAD15_DS_HI 2 ++#define PAD15_DS_SZ 1 ++#define PAD15_IE_MSK 0x00000008 ++#define PAD15_IE_I_MSK 0xfffffff7 ++#define PAD15_IE_SFT 3 ++#define PAD15_IE_HI 3 ++#define PAD15_IE_SZ 1 ++#define PAD15_SEL_I_MSK 0x00000030 ++#define PAD15_SEL_I_I_MSK 0xffffffcf ++#define PAD15_SEL_I_SFT 4 ++#define PAD15_SEL_I_HI 5 ++#define PAD15_SEL_I_SZ 2 ++#define PAD15_OD_MSK 0x00000100 ++#define PAD15_OD_I_MSK 0xfffffeff ++#define PAD15_OD_SFT 8 ++#define PAD15_OD_HI 8 ++#define PAD15_OD_SZ 1 ++#define PAD15_SEL_O_MSK 0x00001000 ++#define PAD15_SEL_O_I_MSK 0xffffefff ++#define PAD15_SEL_O_SFT 12 ++#define PAD15_SEL_O_HI 12 ++#define PAD15_SEL_O_SZ 1 ++#define TEST_1_ID_MSK 0x10000000 ++#define TEST_1_ID_I_MSK 0xefffffff ++#define TEST_1_ID_SFT 28 ++#define TEST_1_ID_HI 28 ++#define TEST_1_ID_SZ 1 ++#define PAD16_OE_MSK 0x00000001 ++#define PAD16_OE_I_MSK 0xfffffffe ++#define PAD16_OE_SFT 0 ++#define PAD16_OE_HI 0 ++#define PAD16_OE_SZ 1 ++#define PAD16_PE_MSK 0x00000002 ++#define PAD16_PE_I_MSK 0xfffffffd ++#define PAD16_PE_SFT 1 ++#define PAD16_PE_HI 1 ++#define PAD16_PE_SZ 1 ++#define PAD16_DS_MSK 0x00000004 ++#define PAD16_DS_I_MSK 0xfffffffb ++#define PAD16_DS_SFT 2 ++#define PAD16_DS_HI 2 ++#define PAD16_DS_SZ 1 ++#define PAD16_IE_MSK 0x00000008 ++#define PAD16_IE_I_MSK 0xfffffff7 ++#define PAD16_IE_SFT 3 ++#define PAD16_IE_HI 3 ++#define PAD16_IE_SZ 1 ++#define PAD16_SEL_I_MSK 0x00000030 ++#define PAD16_SEL_I_I_MSK 0xffffffcf ++#define PAD16_SEL_I_SFT 4 ++#define PAD16_SEL_I_HI 5 ++#define PAD16_SEL_I_SZ 2 ++#define PAD16_OD_MSK 0x00000100 ++#define PAD16_OD_I_MSK 0xfffffeff ++#define PAD16_OD_SFT 8 ++#define PAD16_OD_HI 8 ++#define PAD16_OD_SZ 1 ++#define PAD16_SEL_O_MSK 0x00001000 ++#define PAD16_SEL_O_I_MSK 0xffffefff ++#define PAD16_SEL_O_SFT 12 ++#define PAD16_SEL_O_HI 12 ++#define PAD16_SEL_O_SZ 1 ++#define TEST_2_ID_MSK 0x10000000 ++#define TEST_2_ID_I_MSK 0xefffffff ++#define TEST_2_ID_SFT 28 ++#define TEST_2_ID_HI 28 ++#define TEST_2_ID_SZ 1 ++#define PAD17_OE_MSK 0x00000001 ++#define PAD17_OE_I_MSK 0xfffffffe ++#define PAD17_OE_SFT 0 ++#define PAD17_OE_HI 0 ++#define PAD17_OE_SZ 1 ++#define PAD17_PE_MSK 0x00000002 ++#define PAD17_PE_I_MSK 0xfffffffd ++#define PAD17_PE_SFT 1 ++#define PAD17_PE_HI 1 ++#define PAD17_PE_SZ 1 ++#define PAD17_DS_MSK 0x00000004 ++#define PAD17_DS_I_MSK 0xfffffffb ++#define PAD17_DS_SFT 2 ++#define PAD17_DS_HI 2 ++#define PAD17_DS_SZ 1 ++#define PAD17_IE_MSK 0x00000008 ++#define PAD17_IE_I_MSK 0xfffffff7 ++#define PAD17_IE_SFT 3 ++#define PAD17_IE_HI 3 ++#define PAD17_IE_SZ 1 ++#define PAD17_SEL_I_MSK 0x00000030 ++#define PAD17_SEL_I_I_MSK 0xffffffcf ++#define PAD17_SEL_I_SFT 4 ++#define PAD17_SEL_I_HI 5 ++#define PAD17_SEL_I_SZ 2 ++#define PAD17_OD_MSK 0x00000100 ++#define PAD17_OD_I_MSK 0xfffffeff ++#define PAD17_OD_SFT 8 ++#define PAD17_OD_HI 8 ++#define PAD17_OD_SZ 1 ++#define PAD17_SEL_O_MSK 0x00001000 ++#define PAD17_SEL_O_I_MSK 0xffffefff ++#define PAD17_SEL_O_SFT 12 ++#define PAD17_SEL_O_HI 12 ++#define PAD17_SEL_O_SZ 1 ++#define TEST_3_ID_MSK 0x10000000 ++#define TEST_3_ID_I_MSK 0xefffffff ++#define TEST_3_ID_SFT 28 ++#define TEST_3_ID_HI 28 ++#define TEST_3_ID_SZ 1 ++#define PAD18_OE_MSK 0x00000001 ++#define PAD18_OE_I_MSK 0xfffffffe ++#define PAD18_OE_SFT 0 ++#define PAD18_OE_HI 0 ++#define PAD18_OE_SZ 1 ++#define PAD18_PE_MSK 0x00000002 ++#define PAD18_PE_I_MSK 0xfffffffd ++#define PAD18_PE_SFT 1 ++#define PAD18_PE_HI 1 ++#define PAD18_PE_SZ 1 ++#define PAD18_DS_MSK 0x00000004 ++#define PAD18_DS_I_MSK 0xfffffffb ++#define PAD18_DS_SFT 2 ++#define PAD18_DS_HI 2 ++#define PAD18_DS_SZ 1 ++#define PAD18_IE_MSK 0x00000008 ++#define PAD18_IE_I_MSK 0xfffffff7 ++#define PAD18_IE_SFT 3 ++#define PAD18_IE_HI 3 ++#define PAD18_IE_SZ 1 ++#define PAD18_SEL_I_MSK 0x00000030 ++#define PAD18_SEL_I_I_MSK 0xffffffcf ++#define PAD18_SEL_I_SFT 4 ++#define PAD18_SEL_I_HI 5 ++#define PAD18_SEL_I_SZ 2 ++#define PAD18_OD_MSK 0x00000100 ++#define PAD18_OD_I_MSK 0xfffffeff ++#define PAD18_OD_SFT 8 ++#define PAD18_OD_HI 8 ++#define PAD18_OD_SZ 1 ++#define PAD18_SEL_O_MSK 0x00003000 ++#define PAD18_SEL_O_I_MSK 0xffffcfff ++#define PAD18_SEL_O_SFT 12 ++#define PAD18_SEL_O_HI 13 ++#define PAD18_SEL_O_SZ 2 ++#define TEST_4_ID_MSK 0x10000000 ++#define TEST_4_ID_I_MSK 0xefffffff ++#define TEST_4_ID_SFT 28 ++#define TEST_4_ID_HI 28 ++#define TEST_4_ID_SZ 1 ++#define PAD19_OE_MSK 0x00000001 ++#define PAD19_OE_I_MSK 0xfffffffe ++#define PAD19_OE_SFT 0 ++#define PAD19_OE_HI 0 ++#define PAD19_OE_SZ 1 ++#define PAD19_PE_MSK 0x00000002 ++#define PAD19_PE_I_MSK 0xfffffffd ++#define PAD19_PE_SFT 1 ++#define PAD19_PE_HI 1 ++#define PAD19_PE_SZ 1 ++#define PAD19_DS_MSK 0x00000004 ++#define PAD19_DS_I_MSK 0xfffffffb ++#define PAD19_DS_SFT 2 ++#define PAD19_DS_HI 2 ++#define PAD19_DS_SZ 1 ++#define PAD19_IE_MSK 0x00000008 ++#define PAD19_IE_I_MSK 0xfffffff7 ++#define PAD19_IE_SFT 3 ++#define PAD19_IE_HI 3 ++#define PAD19_IE_SZ 1 ++#define PAD19_SEL_I_MSK 0x00000030 ++#define PAD19_SEL_I_I_MSK 0xffffffcf ++#define PAD19_SEL_I_SFT 4 ++#define PAD19_SEL_I_HI 5 ++#define PAD19_SEL_I_SZ 2 ++#define PAD19_OD_MSK 0x00000100 ++#define PAD19_OD_I_MSK 0xfffffeff ++#define PAD19_OD_SFT 8 ++#define PAD19_OD_HI 8 ++#define PAD19_OD_SZ 1 ++#define PAD19_SEL_O_MSK 0x00007000 ++#define PAD19_SEL_O_I_MSK 0xffff8fff ++#define PAD19_SEL_O_SFT 12 ++#define PAD19_SEL_O_HI 14 ++#define PAD19_SEL_O_SZ 3 ++#define SHORT_TO_20_ID_MSK 0x10000000 ++#define SHORT_TO_20_ID_I_MSK 0xefffffff ++#define SHORT_TO_20_ID_SFT 28 ++#define SHORT_TO_20_ID_HI 28 ++#define SHORT_TO_20_ID_SZ 1 ++#define PAD20_OE_MSK 0x00000001 ++#define PAD20_OE_I_MSK 0xfffffffe ++#define PAD20_OE_SFT 0 ++#define PAD20_OE_HI 0 ++#define PAD20_OE_SZ 1 ++#define PAD20_PE_MSK 0x00000002 ++#define PAD20_PE_I_MSK 0xfffffffd ++#define PAD20_PE_SFT 1 ++#define PAD20_PE_HI 1 ++#define PAD20_PE_SZ 1 ++#define PAD20_DS_MSK 0x00000004 ++#define PAD20_DS_I_MSK 0xfffffffb ++#define PAD20_DS_SFT 2 ++#define PAD20_DS_HI 2 ++#define PAD20_DS_SZ 1 ++#define PAD20_IE_MSK 0x00000008 ++#define PAD20_IE_I_MSK 0xfffffff7 ++#define PAD20_IE_SFT 3 ++#define PAD20_IE_HI 3 ++#define PAD20_IE_SZ 1 ++#define PAD20_SEL_I_MSK 0x000000f0 ++#define PAD20_SEL_I_I_MSK 0xffffff0f ++#define PAD20_SEL_I_SFT 4 ++#define PAD20_SEL_I_HI 7 ++#define PAD20_SEL_I_SZ 4 ++#define PAD20_OD_MSK 0x00000100 ++#define PAD20_OD_I_MSK 0xfffffeff ++#define PAD20_OD_SFT 8 ++#define PAD20_OD_HI 8 ++#define PAD20_OD_SZ 1 ++#define PAD20_SEL_O_MSK 0x00003000 ++#define PAD20_SEL_O_I_MSK 0xffffcfff ++#define PAD20_SEL_O_SFT 12 ++#define PAD20_SEL_O_HI 13 ++#define PAD20_SEL_O_SZ 2 ++#define STRAP0_MSK 0x08000000 ++#define STRAP0_I_MSK 0xf7ffffff ++#define STRAP0_SFT 27 ++#define STRAP0_HI 27 ++#define STRAP0_SZ 1 ++#define GPIO_TEST_1_ID_MSK 0x10000000 ++#define GPIO_TEST_1_ID_I_MSK 0xefffffff ++#define GPIO_TEST_1_ID_SFT 28 ++#define GPIO_TEST_1_ID_HI 28 ++#define GPIO_TEST_1_ID_SZ 1 ++#define PAD21_OE_MSK 0x00000001 ++#define PAD21_OE_I_MSK 0xfffffffe ++#define PAD21_OE_SFT 0 ++#define PAD21_OE_HI 0 ++#define PAD21_OE_SZ 1 ++#define PAD21_PE_MSK 0x00000002 ++#define PAD21_PE_I_MSK 0xfffffffd ++#define PAD21_PE_SFT 1 ++#define PAD21_PE_HI 1 ++#define PAD21_PE_SZ 1 ++#define PAD21_DS_MSK 0x00000004 ++#define PAD21_DS_I_MSK 0xfffffffb ++#define PAD21_DS_SFT 2 ++#define PAD21_DS_HI 2 ++#define PAD21_DS_SZ 1 ++#define PAD21_IE_MSK 0x00000008 ++#define PAD21_IE_I_MSK 0xfffffff7 ++#define PAD21_IE_SFT 3 ++#define PAD21_IE_HI 3 ++#define PAD21_IE_SZ 1 ++#define PAD21_SEL_I_MSK 0x00000070 ++#define PAD21_SEL_I_I_MSK 0xffffff8f ++#define PAD21_SEL_I_SFT 4 ++#define PAD21_SEL_I_HI 6 ++#define PAD21_SEL_I_SZ 3 ++#define PAD21_OD_MSK 0x00000100 ++#define PAD21_OD_I_MSK 0xfffffeff ++#define PAD21_OD_SFT 8 ++#define PAD21_OD_HI 8 ++#define PAD21_OD_SZ 1 ++#define PAD21_SEL_O_MSK 0x00003000 ++#define PAD21_SEL_O_I_MSK 0xffffcfff ++#define PAD21_SEL_O_SFT 12 ++#define PAD21_SEL_O_HI 13 ++#define PAD21_SEL_O_SZ 2 ++#define STRAP3_MSK 0x08000000 ++#define STRAP3_I_MSK 0xf7ffffff ++#define STRAP3_SFT 27 ++#define STRAP3_HI 27 ++#define STRAP3_SZ 1 ++#define GPIO_TEST_2_ID_MSK 0x10000000 ++#define GPIO_TEST_2_ID_I_MSK 0xefffffff ++#define GPIO_TEST_2_ID_SFT 28 ++#define GPIO_TEST_2_ID_HI 28 ++#define GPIO_TEST_2_ID_SZ 1 ++#define PAD22_OE_MSK 0x00000001 ++#define PAD22_OE_I_MSK 0xfffffffe ++#define PAD22_OE_SFT 0 ++#define PAD22_OE_HI 0 ++#define PAD22_OE_SZ 1 ++#define PAD22_PE_MSK 0x00000002 ++#define PAD22_PE_I_MSK 0xfffffffd ++#define PAD22_PE_SFT 1 ++#define PAD22_PE_HI 1 ++#define PAD22_PE_SZ 1 ++#define PAD22_DS_MSK 0x00000004 ++#define PAD22_DS_I_MSK 0xfffffffb ++#define PAD22_DS_SFT 2 ++#define PAD22_DS_HI 2 ++#define PAD22_DS_SZ 1 ++#define PAD22_IE_MSK 0x00000008 ++#define PAD22_IE_I_MSK 0xfffffff7 ++#define PAD22_IE_SFT 3 ++#define PAD22_IE_HI 3 ++#define PAD22_IE_SZ 1 ++#define PAD22_SEL_I_MSK 0x00000070 ++#define PAD22_SEL_I_I_MSK 0xffffff8f ++#define PAD22_SEL_I_SFT 4 ++#define PAD22_SEL_I_HI 6 ++#define PAD22_SEL_I_SZ 3 ++#define PAD22_OD_MSK 0x00000100 ++#define PAD22_OD_I_MSK 0xfffffeff ++#define PAD22_OD_SFT 8 ++#define PAD22_OD_HI 8 ++#define PAD22_OD_SZ 1 ++#define PAD22_SEL_O_MSK 0x00007000 ++#define PAD22_SEL_O_I_MSK 0xffff8fff ++#define PAD22_SEL_O_SFT 12 ++#define PAD22_SEL_O_HI 14 ++#define PAD22_SEL_O_SZ 3 ++#define PAD22_SEL_OE_MSK 0x00100000 ++#define PAD22_SEL_OE_I_MSK 0xffefffff ++#define PAD22_SEL_OE_SFT 20 ++#define PAD22_SEL_OE_HI 20 ++#define PAD22_SEL_OE_SZ 1 ++#define GPIO_TEST_3_ID_MSK 0x10000000 ++#define GPIO_TEST_3_ID_I_MSK 0xefffffff ++#define GPIO_TEST_3_ID_SFT 28 ++#define GPIO_TEST_3_ID_HI 28 ++#define GPIO_TEST_3_ID_SZ 1 ++#define PAD24_OE_MSK 0x00000001 ++#define PAD24_OE_I_MSK 0xfffffffe ++#define PAD24_OE_SFT 0 ++#define PAD24_OE_HI 0 ++#define PAD24_OE_SZ 1 ++#define PAD24_PE_MSK 0x00000002 ++#define PAD24_PE_I_MSK 0xfffffffd ++#define PAD24_PE_SFT 1 ++#define PAD24_PE_HI 1 ++#define PAD24_PE_SZ 1 ++#define PAD24_DS_MSK 0x00000004 ++#define PAD24_DS_I_MSK 0xfffffffb ++#define PAD24_DS_SFT 2 ++#define PAD24_DS_HI 2 ++#define PAD24_DS_SZ 1 ++#define PAD24_IE_MSK 0x00000008 ++#define PAD24_IE_I_MSK 0xfffffff7 ++#define PAD24_IE_SFT 3 ++#define PAD24_IE_HI 3 ++#define PAD24_IE_SZ 1 ++#define PAD24_SEL_I_MSK 0x00000030 ++#define PAD24_SEL_I_I_MSK 0xffffffcf ++#define PAD24_SEL_I_SFT 4 ++#define PAD24_SEL_I_HI 5 ++#define PAD24_SEL_I_SZ 2 ++#define PAD24_OD_MSK 0x00000100 ++#define PAD24_OD_I_MSK 0xfffffeff ++#define PAD24_OD_SFT 8 ++#define PAD24_OD_HI 8 ++#define PAD24_OD_SZ 1 ++#define PAD24_SEL_O_MSK 0x00007000 ++#define PAD24_SEL_O_I_MSK 0xffff8fff ++#define PAD24_SEL_O_SFT 12 ++#define PAD24_SEL_O_HI 14 ++#define PAD24_SEL_O_SZ 3 ++#define GPIO_TEST_4_ID_MSK 0x10000000 ++#define GPIO_TEST_4_ID_I_MSK 0xefffffff ++#define GPIO_TEST_4_ID_SFT 28 ++#define GPIO_TEST_4_ID_HI 28 ++#define GPIO_TEST_4_ID_SZ 1 ++#define PAD25_OE_MSK 0x00000001 ++#define PAD25_OE_I_MSK 0xfffffffe ++#define PAD25_OE_SFT 0 ++#define PAD25_OE_HI 0 ++#define PAD25_OE_SZ 1 ++#define PAD25_PE_MSK 0x00000002 ++#define PAD25_PE_I_MSK 0xfffffffd ++#define PAD25_PE_SFT 1 ++#define PAD25_PE_HI 1 ++#define PAD25_PE_SZ 1 ++#define PAD25_DS_MSK 0x00000004 ++#define PAD25_DS_I_MSK 0xfffffffb ++#define PAD25_DS_SFT 2 ++#define PAD25_DS_HI 2 ++#define PAD25_DS_SZ 1 ++#define PAD25_IE_MSK 0x00000008 ++#define PAD25_IE_I_MSK 0xfffffff7 ++#define PAD25_IE_SFT 3 ++#define PAD25_IE_HI 3 ++#define PAD25_IE_SZ 1 ++#define PAD25_SEL_I_MSK 0x00000070 ++#define PAD25_SEL_I_I_MSK 0xffffff8f ++#define PAD25_SEL_I_SFT 4 ++#define PAD25_SEL_I_HI 6 ++#define PAD25_SEL_I_SZ 3 ++#define PAD25_OD_MSK 0x00000100 ++#define PAD25_OD_I_MSK 0xfffffeff ++#define PAD25_OD_SFT 8 ++#define PAD25_OD_HI 8 ++#define PAD25_OD_SZ 1 ++#define PAD25_SEL_O_MSK 0x00007000 ++#define PAD25_SEL_O_I_MSK 0xffff8fff ++#define PAD25_SEL_O_SFT 12 ++#define PAD25_SEL_O_HI 14 ++#define PAD25_SEL_O_SZ 3 ++#define PAD25_SEL_OE_MSK 0x00100000 ++#define PAD25_SEL_OE_I_MSK 0xffefffff ++#define PAD25_SEL_OE_SFT 20 ++#define PAD25_SEL_OE_HI 20 ++#define PAD25_SEL_OE_SZ 1 ++#define STRAP1_MSK 0x08000000 ++#define STRAP1_I_MSK 0xf7ffffff ++#define STRAP1_SFT 27 ++#define STRAP1_HI 27 ++#define STRAP1_SZ 1 ++#define GPIO_1_ID_MSK 0x10000000 ++#define GPIO_1_ID_I_MSK 0xefffffff ++#define GPIO_1_ID_SFT 28 ++#define GPIO_1_ID_HI 28 ++#define GPIO_1_ID_SZ 1 ++#define PAD27_OE_MSK 0x00000001 ++#define PAD27_OE_I_MSK 0xfffffffe ++#define PAD27_OE_SFT 0 ++#define PAD27_OE_HI 0 ++#define PAD27_OE_SZ 1 ++#define PAD27_PE_MSK 0x00000002 ++#define PAD27_PE_I_MSK 0xfffffffd ++#define PAD27_PE_SFT 1 ++#define PAD27_PE_HI 1 ++#define PAD27_PE_SZ 1 ++#define PAD27_DS_MSK 0x00000004 ++#define PAD27_DS_I_MSK 0xfffffffb ++#define PAD27_DS_SFT 2 ++#define PAD27_DS_HI 2 ++#define PAD27_DS_SZ 1 ++#define PAD27_IE_MSK 0x00000008 ++#define PAD27_IE_I_MSK 0xfffffff7 ++#define PAD27_IE_SFT 3 ++#define PAD27_IE_HI 3 ++#define PAD27_IE_SZ 1 ++#define PAD27_SEL_I_MSK 0x00000070 ++#define PAD27_SEL_I_I_MSK 0xffffff8f ++#define PAD27_SEL_I_SFT 4 ++#define PAD27_SEL_I_HI 6 ++#define PAD27_SEL_I_SZ 3 ++#define PAD27_OD_MSK 0x00000100 ++#define PAD27_OD_I_MSK 0xfffffeff ++#define PAD27_OD_SFT 8 ++#define PAD27_OD_HI 8 ++#define PAD27_OD_SZ 1 ++#define PAD27_SEL_O_MSK 0x00007000 ++#define PAD27_SEL_O_I_MSK 0xffff8fff ++#define PAD27_SEL_O_SFT 12 ++#define PAD27_SEL_O_HI 14 ++#define PAD27_SEL_O_SZ 3 ++#define GPIO_2_ID_MSK 0x10000000 ++#define GPIO_2_ID_I_MSK 0xefffffff ++#define GPIO_2_ID_SFT 28 ++#define GPIO_2_ID_HI 28 ++#define GPIO_2_ID_SZ 1 ++#define PAD28_OE_MSK 0x00000001 ++#define PAD28_OE_I_MSK 0xfffffffe ++#define PAD28_OE_SFT 0 ++#define PAD28_OE_HI 0 ++#define PAD28_OE_SZ 1 ++#define PAD28_PE_MSK 0x00000002 ++#define PAD28_PE_I_MSK 0xfffffffd ++#define PAD28_PE_SFT 1 ++#define PAD28_PE_HI 1 ++#define PAD28_PE_SZ 1 ++#define PAD28_DS_MSK 0x00000004 ++#define PAD28_DS_I_MSK 0xfffffffb ++#define PAD28_DS_SFT 2 ++#define PAD28_DS_HI 2 ++#define PAD28_DS_SZ 1 ++#define PAD28_IE_MSK 0x00000008 ++#define PAD28_IE_I_MSK 0xfffffff7 ++#define PAD28_IE_SFT 3 ++#define PAD28_IE_HI 3 ++#define PAD28_IE_SZ 1 ++#define PAD28_SEL_I_MSK 0x00000070 ++#define PAD28_SEL_I_I_MSK 0xffffff8f ++#define PAD28_SEL_I_SFT 4 ++#define PAD28_SEL_I_HI 6 ++#define PAD28_SEL_I_SZ 3 ++#define PAD28_OD_MSK 0x00000100 ++#define PAD28_OD_I_MSK 0xfffffeff ++#define PAD28_OD_SFT 8 ++#define PAD28_OD_HI 8 ++#define PAD28_OD_SZ 1 ++#define PAD28_SEL_O_MSK 0x0000f000 ++#define PAD28_SEL_O_I_MSK 0xffff0fff ++#define PAD28_SEL_O_SFT 12 ++#define PAD28_SEL_O_HI 15 ++#define PAD28_SEL_O_SZ 4 ++#define PAD28_SEL_OE_MSK 0x00100000 ++#define PAD28_SEL_OE_I_MSK 0xffefffff ++#define PAD28_SEL_OE_SFT 20 ++#define PAD28_SEL_OE_HI 20 ++#define PAD28_SEL_OE_SZ 1 ++#define GPIO_3_ID_MSK 0x10000000 ++#define GPIO_3_ID_I_MSK 0xefffffff ++#define GPIO_3_ID_SFT 28 ++#define GPIO_3_ID_HI 28 ++#define GPIO_3_ID_SZ 1 ++#define PAD29_OE_MSK 0x00000001 ++#define PAD29_OE_I_MSK 0xfffffffe ++#define PAD29_OE_SFT 0 ++#define PAD29_OE_HI 0 ++#define PAD29_OE_SZ 1 ++#define PAD29_PE_MSK 0x00000002 ++#define PAD29_PE_I_MSK 0xfffffffd ++#define PAD29_PE_SFT 1 ++#define PAD29_PE_HI 1 ++#define PAD29_PE_SZ 1 ++#define PAD29_DS_MSK 0x00000004 ++#define PAD29_DS_I_MSK 0xfffffffb ++#define PAD29_DS_SFT 2 ++#define PAD29_DS_HI 2 ++#define PAD29_DS_SZ 1 ++#define PAD29_IE_MSK 0x00000008 ++#define PAD29_IE_I_MSK 0xfffffff7 ++#define PAD29_IE_SFT 3 ++#define PAD29_IE_HI 3 ++#define PAD29_IE_SZ 1 ++#define PAD29_SEL_I_MSK 0x00000070 ++#define PAD29_SEL_I_I_MSK 0xffffff8f ++#define PAD29_SEL_I_SFT 4 ++#define PAD29_SEL_I_HI 6 ++#define PAD29_SEL_I_SZ 3 ++#define PAD29_OD_MSK 0x00000100 ++#define PAD29_OD_I_MSK 0xfffffeff ++#define PAD29_OD_SFT 8 ++#define PAD29_OD_HI 8 ++#define PAD29_OD_SZ 1 ++#define PAD29_SEL_O_MSK 0x00007000 ++#define PAD29_SEL_O_I_MSK 0xffff8fff ++#define PAD29_SEL_O_SFT 12 ++#define PAD29_SEL_O_HI 14 ++#define PAD29_SEL_O_SZ 3 ++#define GPIO_TEST_5_ID_MSK 0x10000000 ++#define GPIO_TEST_5_ID_I_MSK 0xefffffff ++#define GPIO_TEST_5_ID_SFT 28 ++#define GPIO_TEST_5_ID_HI 28 ++#define GPIO_TEST_5_ID_SZ 1 ++#define PAD30_OE_MSK 0x00000001 ++#define PAD30_OE_I_MSK 0xfffffffe ++#define PAD30_OE_SFT 0 ++#define PAD30_OE_HI 0 ++#define PAD30_OE_SZ 1 ++#define PAD30_PE_MSK 0x00000002 ++#define PAD30_PE_I_MSK 0xfffffffd ++#define PAD30_PE_SFT 1 ++#define PAD30_PE_HI 1 ++#define PAD30_PE_SZ 1 ++#define PAD30_DS_MSK 0x00000004 ++#define PAD30_DS_I_MSK 0xfffffffb ++#define PAD30_DS_SFT 2 ++#define PAD30_DS_HI 2 ++#define PAD30_DS_SZ 1 ++#define PAD30_IE_MSK 0x00000008 ++#define PAD30_IE_I_MSK 0xfffffff7 ++#define PAD30_IE_SFT 3 ++#define PAD30_IE_HI 3 ++#define PAD30_IE_SZ 1 ++#define PAD30_SEL_I_MSK 0x00000030 ++#define PAD30_SEL_I_I_MSK 0xffffffcf ++#define PAD30_SEL_I_SFT 4 ++#define PAD30_SEL_I_HI 5 ++#define PAD30_SEL_I_SZ 2 ++#define PAD30_OD_MSK 0x00000100 ++#define PAD30_OD_I_MSK 0xfffffeff ++#define PAD30_OD_SFT 8 ++#define PAD30_OD_HI 8 ++#define PAD30_OD_SZ 1 ++#define PAD30_SEL_O_MSK 0x00003000 ++#define PAD30_SEL_O_I_MSK 0xffffcfff ++#define PAD30_SEL_O_SFT 12 ++#define PAD30_SEL_O_HI 13 ++#define PAD30_SEL_O_SZ 2 ++#define TEST_6_ID_MSK 0x10000000 ++#define TEST_6_ID_I_MSK 0xefffffff ++#define TEST_6_ID_SFT 28 ++#define TEST_6_ID_HI 28 ++#define TEST_6_ID_SZ 1 ++#define PAD31_OE_MSK 0x00000001 ++#define PAD31_OE_I_MSK 0xfffffffe ++#define PAD31_OE_SFT 0 ++#define PAD31_OE_HI 0 ++#define PAD31_OE_SZ 1 ++#define PAD31_PE_MSK 0x00000002 ++#define PAD31_PE_I_MSK 0xfffffffd ++#define PAD31_PE_SFT 1 ++#define PAD31_PE_HI 1 ++#define PAD31_PE_SZ 1 ++#define PAD31_DS_MSK 0x00000004 ++#define PAD31_DS_I_MSK 0xfffffffb ++#define PAD31_DS_SFT 2 ++#define PAD31_DS_HI 2 ++#define PAD31_DS_SZ 1 ++#define PAD31_IE_MSK 0x00000008 ++#define PAD31_IE_I_MSK 0xfffffff7 ++#define PAD31_IE_SFT 3 ++#define PAD31_IE_HI 3 ++#define PAD31_IE_SZ 1 ++#define PAD31_SEL_I_MSK 0x00000030 ++#define PAD31_SEL_I_I_MSK 0xffffffcf ++#define PAD31_SEL_I_SFT 4 ++#define PAD31_SEL_I_HI 5 ++#define PAD31_SEL_I_SZ 2 ++#define PAD31_OD_MSK 0x00000100 ++#define PAD31_OD_I_MSK 0xfffffeff ++#define PAD31_OD_SFT 8 ++#define PAD31_OD_HI 8 ++#define PAD31_OD_SZ 1 ++#define PAD31_SEL_O_MSK 0x00003000 ++#define PAD31_SEL_O_I_MSK 0xffffcfff ++#define PAD31_SEL_O_SFT 12 ++#define PAD31_SEL_O_HI 13 ++#define PAD31_SEL_O_SZ 2 ++#define TEST_7_ID_MSK 0x10000000 ++#define TEST_7_ID_I_MSK 0xefffffff ++#define TEST_7_ID_SFT 28 ++#define TEST_7_ID_HI 28 ++#define TEST_7_ID_SZ 1 ++#define PAD32_OE_MSK 0x00000001 ++#define PAD32_OE_I_MSK 0xfffffffe ++#define PAD32_OE_SFT 0 ++#define PAD32_OE_HI 0 ++#define PAD32_OE_SZ 1 ++#define PAD32_PE_MSK 0x00000002 ++#define PAD32_PE_I_MSK 0xfffffffd ++#define PAD32_PE_SFT 1 ++#define PAD32_PE_HI 1 ++#define PAD32_PE_SZ 1 ++#define PAD32_DS_MSK 0x00000004 ++#define PAD32_DS_I_MSK 0xfffffffb ++#define PAD32_DS_SFT 2 ++#define PAD32_DS_HI 2 ++#define PAD32_DS_SZ 1 ++#define PAD32_IE_MSK 0x00000008 ++#define PAD32_IE_I_MSK 0xfffffff7 ++#define PAD32_IE_SFT 3 ++#define PAD32_IE_HI 3 ++#define PAD32_IE_SZ 1 ++#define PAD32_SEL_I_MSK 0x00000030 ++#define PAD32_SEL_I_I_MSK 0xffffffcf ++#define PAD32_SEL_I_SFT 4 ++#define PAD32_SEL_I_HI 5 ++#define PAD32_SEL_I_SZ 2 ++#define PAD32_OD_MSK 0x00000100 ++#define PAD32_OD_I_MSK 0xfffffeff ++#define PAD32_OD_SFT 8 ++#define PAD32_OD_HI 8 ++#define PAD32_OD_SZ 1 ++#define PAD32_SEL_O_MSK 0x00003000 ++#define PAD32_SEL_O_I_MSK 0xffffcfff ++#define PAD32_SEL_O_SFT 12 ++#define PAD32_SEL_O_HI 13 ++#define PAD32_SEL_O_SZ 2 ++#define TEST_8_ID_MSK 0x10000000 ++#define TEST_8_ID_I_MSK 0xefffffff ++#define TEST_8_ID_SFT 28 ++#define TEST_8_ID_HI 28 ++#define TEST_8_ID_SZ 1 ++#define PAD33_OE_MSK 0x00000001 ++#define PAD33_OE_I_MSK 0xfffffffe ++#define PAD33_OE_SFT 0 ++#define PAD33_OE_HI 0 ++#define PAD33_OE_SZ 1 ++#define PAD33_PE_MSK 0x00000002 ++#define PAD33_PE_I_MSK 0xfffffffd ++#define PAD33_PE_SFT 1 ++#define PAD33_PE_HI 1 ++#define PAD33_PE_SZ 1 ++#define PAD33_DS_MSK 0x00000004 ++#define PAD33_DS_I_MSK 0xfffffffb ++#define PAD33_DS_SFT 2 ++#define PAD33_DS_HI 2 ++#define PAD33_DS_SZ 1 ++#define PAD33_IE_MSK 0x00000008 ++#define PAD33_IE_I_MSK 0xfffffff7 ++#define PAD33_IE_SFT 3 ++#define PAD33_IE_HI 3 ++#define PAD33_IE_SZ 1 ++#define PAD33_SEL_I_MSK 0x00000030 ++#define PAD33_SEL_I_I_MSK 0xffffffcf ++#define PAD33_SEL_I_SFT 4 ++#define PAD33_SEL_I_HI 5 ++#define PAD33_SEL_I_SZ 2 ++#define PAD33_OD_MSK 0x00000100 ++#define PAD33_OD_I_MSK 0xfffffeff ++#define PAD33_OD_SFT 8 ++#define PAD33_OD_HI 8 ++#define PAD33_OD_SZ 1 ++#define PAD33_SEL_O_MSK 0x00003000 ++#define PAD33_SEL_O_I_MSK 0xffffcfff ++#define PAD33_SEL_O_SFT 12 ++#define PAD33_SEL_O_HI 13 ++#define PAD33_SEL_O_SZ 2 ++#define TEST_9_ID_MSK 0x10000000 ++#define TEST_9_ID_I_MSK 0xefffffff ++#define TEST_9_ID_SFT 28 ++#define TEST_9_ID_HI 28 ++#define TEST_9_ID_SZ 1 ++#define PAD34_OE_MSK 0x00000001 ++#define PAD34_OE_I_MSK 0xfffffffe ++#define PAD34_OE_SFT 0 ++#define PAD34_OE_HI 0 ++#define PAD34_OE_SZ 1 ++#define PAD34_PE_MSK 0x00000002 ++#define PAD34_PE_I_MSK 0xfffffffd ++#define PAD34_PE_SFT 1 ++#define PAD34_PE_HI 1 ++#define PAD34_PE_SZ 1 ++#define PAD34_DS_MSK 0x00000004 ++#define PAD34_DS_I_MSK 0xfffffffb ++#define PAD34_DS_SFT 2 ++#define PAD34_DS_HI 2 ++#define PAD34_DS_SZ 1 ++#define PAD34_IE_MSK 0x00000008 ++#define PAD34_IE_I_MSK 0xfffffff7 ++#define PAD34_IE_SFT 3 ++#define PAD34_IE_HI 3 ++#define PAD34_IE_SZ 1 ++#define PAD34_SEL_I_MSK 0x00000030 ++#define PAD34_SEL_I_I_MSK 0xffffffcf ++#define PAD34_SEL_I_SFT 4 ++#define PAD34_SEL_I_HI 5 ++#define PAD34_SEL_I_SZ 2 ++#define PAD34_OD_MSK 0x00000100 ++#define PAD34_OD_I_MSK 0xfffffeff ++#define PAD34_OD_SFT 8 ++#define PAD34_OD_HI 8 ++#define PAD34_OD_SZ 1 ++#define PAD34_SEL_O_MSK 0x00003000 ++#define PAD34_SEL_O_I_MSK 0xffffcfff ++#define PAD34_SEL_O_SFT 12 ++#define PAD34_SEL_O_HI 13 ++#define PAD34_SEL_O_SZ 2 ++#define TEST_10_ID_MSK 0x10000000 ++#define TEST_10_ID_I_MSK 0xefffffff ++#define TEST_10_ID_SFT 28 ++#define TEST_10_ID_HI 28 ++#define TEST_10_ID_SZ 1 ++#define PAD42_OE_MSK 0x00000001 ++#define PAD42_OE_I_MSK 0xfffffffe ++#define PAD42_OE_SFT 0 ++#define PAD42_OE_HI 0 ++#define PAD42_OE_SZ 1 ++#define PAD42_PE_MSK 0x00000002 ++#define PAD42_PE_I_MSK 0xfffffffd ++#define PAD42_PE_SFT 1 ++#define PAD42_PE_HI 1 ++#define PAD42_PE_SZ 1 ++#define PAD42_DS_MSK 0x00000004 ++#define PAD42_DS_I_MSK 0xfffffffb ++#define PAD42_DS_SFT 2 ++#define PAD42_DS_HI 2 ++#define PAD42_DS_SZ 1 ++#define PAD42_IE_MSK 0x00000008 ++#define PAD42_IE_I_MSK 0xfffffff7 ++#define PAD42_IE_SFT 3 ++#define PAD42_IE_HI 3 ++#define PAD42_IE_SZ 1 ++#define PAD42_SEL_I_MSK 0x00000030 ++#define PAD42_SEL_I_I_MSK 0xffffffcf ++#define PAD42_SEL_I_SFT 4 ++#define PAD42_SEL_I_HI 5 ++#define PAD42_SEL_I_SZ 2 ++#define PAD42_OD_MSK 0x00000100 ++#define PAD42_OD_I_MSK 0xfffffeff ++#define PAD42_OD_SFT 8 ++#define PAD42_OD_HI 8 ++#define PAD42_OD_SZ 1 ++#define PAD42_SEL_O_MSK 0x00001000 ++#define PAD42_SEL_O_I_MSK 0xffffefff ++#define PAD42_SEL_O_SFT 12 ++#define PAD42_SEL_O_HI 12 ++#define PAD42_SEL_O_SZ 1 ++#define TEST_11_ID_MSK 0x10000000 ++#define TEST_11_ID_I_MSK 0xefffffff ++#define TEST_11_ID_SFT 28 ++#define TEST_11_ID_HI 28 ++#define TEST_11_ID_SZ 1 ++#define PAD43_OE_MSK 0x00000001 ++#define PAD43_OE_I_MSK 0xfffffffe ++#define PAD43_OE_SFT 0 ++#define PAD43_OE_HI 0 ++#define PAD43_OE_SZ 1 ++#define PAD43_PE_MSK 0x00000002 ++#define PAD43_PE_I_MSK 0xfffffffd ++#define PAD43_PE_SFT 1 ++#define PAD43_PE_HI 1 ++#define PAD43_PE_SZ 1 ++#define PAD43_DS_MSK 0x00000004 ++#define PAD43_DS_I_MSK 0xfffffffb ++#define PAD43_DS_SFT 2 ++#define PAD43_DS_HI 2 ++#define PAD43_DS_SZ 1 ++#define PAD43_IE_MSK 0x00000008 ++#define PAD43_IE_I_MSK 0xfffffff7 ++#define PAD43_IE_SFT 3 ++#define PAD43_IE_HI 3 ++#define PAD43_IE_SZ 1 ++#define PAD43_SEL_I_MSK 0x00000030 ++#define PAD43_SEL_I_I_MSK 0xffffffcf ++#define PAD43_SEL_I_SFT 4 ++#define PAD43_SEL_I_HI 5 ++#define PAD43_SEL_I_SZ 2 ++#define PAD43_OD_MSK 0x00000100 ++#define PAD43_OD_I_MSK 0xfffffeff ++#define PAD43_OD_SFT 8 ++#define PAD43_OD_HI 8 ++#define PAD43_OD_SZ 1 ++#define PAD43_SEL_O_MSK 0x00001000 ++#define PAD43_SEL_O_I_MSK 0xffffefff ++#define PAD43_SEL_O_SFT 12 ++#define PAD43_SEL_O_HI 12 ++#define PAD43_SEL_O_SZ 1 ++#define TEST_12_ID_MSK 0x10000000 ++#define TEST_12_ID_I_MSK 0xefffffff ++#define TEST_12_ID_SFT 28 ++#define TEST_12_ID_HI 28 ++#define TEST_12_ID_SZ 1 ++#define PAD44_OE_MSK 0x00000001 ++#define PAD44_OE_I_MSK 0xfffffffe ++#define PAD44_OE_SFT 0 ++#define PAD44_OE_HI 0 ++#define PAD44_OE_SZ 1 ++#define PAD44_PE_MSK 0x00000002 ++#define PAD44_PE_I_MSK 0xfffffffd ++#define PAD44_PE_SFT 1 ++#define PAD44_PE_HI 1 ++#define PAD44_PE_SZ 1 ++#define PAD44_DS_MSK 0x00000004 ++#define PAD44_DS_I_MSK 0xfffffffb ++#define PAD44_DS_SFT 2 ++#define PAD44_DS_HI 2 ++#define PAD44_DS_SZ 1 ++#define PAD44_IE_MSK 0x00000008 ++#define PAD44_IE_I_MSK 0xfffffff7 ++#define PAD44_IE_SFT 3 ++#define PAD44_IE_HI 3 ++#define PAD44_IE_SZ 1 ++#define PAD44_SEL_I_MSK 0x00000030 ++#define PAD44_SEL_I_I_MSK 0xffffffcf ++#define PAD44_SEL_I_SFT 4 ++#define PAD44_SEL_I_HI 5 ++#define PAD44_SEL_I_SZ 2 ++#define PAD44_OD_MSK 0x00000100 ++#define PAD44_OD_I_MSK 0xfffffeff ++#define PAD44_OD_SFT 8 ++#define PAD44_OD_HI 8 ++#define PAD44_OD_SZ 1 ++#define PAD44_SEL_O_MSK 0x00003000 ++#define PAD44_SEL_O_I_MSK 0xffffcfff ++#define PAD44_SEL_O_SFT 12 ++#define PAD44_SEL_O_HI 13 ++#define PAD44_SEL_O_SZ 2 ++#define TEST_13_ID_MSK 0x10000000 ++#define TEST_13_ID_I_MSK 0xefffffff ++#define TEST_13_ID_SFT 28 ++#define TEST_13_ID_HI 28 ++#define TEST_13_ID_SZ 1 ++#define PAD45_OE_MSK 0x00000001 ++#define PAD45_OE_I_MSK 0xfffffffe ++#define PAD45_OE_SFT 0 ++#define PAD45_OE_HI 0 ++#define PAD45_OE_SZ 1 ++#define PAD45_PE_MSK 0x00000002 ++#define PAD45_PE_I_MSK 0xfffffffd ++#define PAD45_PE_SFT 1 ++#define PAD45_PE_HI 1 ++#define PAD45_PE_SZ 1 ++#define PAD45_DS_MSK 0x00000004 ++#define PAD45_DS_I_MSK 0xfffffffb ++#define PAD45_DS_SFT 2 ++#define PAD45_DS_HI 2 ++#define PAD45_DS_SZ 1 ++#define PAD45_IE_MSK 0x00000008 ++#define PAD45_IE_I_MSK 0xfffffff7 ++#define PAD45_IE_SFT 3 ++#define PAD45_IE_HI 3 ++#define PAD45_IE_SZ 1 ++#define PAD45_SEL_I_MSK 0x00000030 ++#define PAD45_SEL_I_I_MSK 0xffffffcf ++#define PAD45_SEL_I_SFT 4 ++#define PAD45_SEL_I_HI 5 ++#define PAD45_SEL_I_SZ 2 ++#define PAD45_OD_MSK 0x00000100 ++#define PAD45_OD_I_MSK 0xfffffeff ++#define PAD45_OD_SFT 8 ++#define PAD45_OD_HI 8 ++#define PAD45_OD_SZ 1 ++#define PAD45_SEL_O_MSK 0x00003000 ++#define PAD45_SEL_O_I_MSK 0xffffcfff ++#define PAD45_SEL_O_SFT 12 ++#define PAD45_SEL_O_HI 13 ++#define PAD45_SEL_O_SZ 2 ++#define TEST_14_ID_MSK 0x10000000 ++#define TEST_14_ID_I_MSK 0xefffffff ++#define TEST_14_ID_SFT 28 ++#define TEST_14_ID_HI 28 ++#define TEST_14_ID_SZ 1 ++#define PAD46_OE_MSK 0x00000001 ++#define PAD46_OE_I_MSK 0xfffffffe ++#define PAD46_OE_SFT 0 ++#define PAD46_OE_HI 0 ++#define PAD46_OE_SZ 1 ++#define PAD46_PE_MSK 0x00000002 ++#define PAD46_PE_I_MSK 0xfffffffd ++#define PAD46_PE_SFT 1 ++#define PAD46_PE_HI 1 ++#define PAD46_PE_SZ 1 ++#define PAD46_DS_MSK 0x00000004 ++#define PAD46_DS_I_MSK 0xfffffffb ++#define PAD46_DS_SFT 2 ++#define PAD46_DS_HI 2 ++#define PAD46_DS_SZ 1 ++#define PAD46_IE_MSK 0x00000008 ++#define PAD46_IE_I_MSK 0xfffffff7 ++#define PAD46_IE_SFT 3 ++#define PAD46_IE_HI 3 ++#define PAD46_IE_SZ 1 ++#define PAD46_SEL_I_MSK 0x00000030 ++#define PAD46_SEL_I_I_MSK 0xffffffcf ++#define PAD46_SEL_I_SFT 4 ++#define PAD46_SEL_I_HI 5 ++#define PAD46_SEL_I_SZ 2 ++#define PAD46_OD_MSK 0x00000100 ++#define PAD46_OD_I_MSK 0xfffffeff ++#define PAD46_OD_SFT 8 ++#define PAD46_OD_HI 8 ++#define PAD46_OD_SZ 1 ++#define PAD46_SEL_O_MSK 0x00003000 ++#define PAD46_SEL_O_I_MSK 0xffffcfff ++#define PAD46_SEL_O_SFT 12 ++#define PAD46_SEL_O_HI 13 ++#define PAD46_SEL_O_SZ 2 ++#define TEST_15_ID_MSK 0x10000000 ++#define TEST_15_ID_I_MSK 0xefffffff ++#define TEST_15_ID_SFT 28 ++#define TEST_15_ID_HI 28 ++#define TEST_15_ID_SZ 1 ++#define PAD47_OE_MSK 0x00000001 ++#define PAD47_OE_I_MSK 0xfffffffe ++#define PAD47_OE_SFT 0 ++#define PAD47_OE_HI 0 ++#define PAD47_OE_SZ 1 ++#define PAD47_PE_MSK 0x00000002 ++#define PAD47_PE_I_MSK 0xfffffffd ++#define PAD47_PE_SFT 1 ++#define PAD47_PE_HI 1 ++#define PAD47_PE_SZ 1 ++#define PAD47_DS_MSK 0x00000004 ++#define PAD47_DS_I_MSK 0xfffffffb ++#define PAD47_DS_SFT 2 ++#define PAD47_DS_HI 2 ++#define PAD47_DS_SZ 1 ++#define PAD47_SEL_I_MSK 0x00000030 ++#define PAD47_SEL_I_I_MSK 0xffffffcf ++#define PAD47_SEL_I_SFT 4 ++#define PAD47_SEL_I_HI 5 ++#define PAD47_SEL_I_SZ 2 ++#define PAD47_OD_MSK 0x00000100 ++#define PAD47_OD_I_MSK 0xfffffeff ++#define PAD47_OD_SFT 8 ++#define PAD47_OD_HI 8 ++#define PAD47_OD_SZ 1 ++#define PAD47_SEL_O_MSK 0x00003000 ++#define PAD47_SEL_O_I_MSK 0xffffcfff ++#define PAD47_SEL_O_SFT 12 ++#define PAD47_SEL_O_HI 13 ++#define PAD47_SEL_O_SZ 2 ++#define PAD47_SEL_OE_MSK 0x00100000 ++#define PAD47_SEL_OE_I_MSK 0xffefffff ++#define PAD47_SEL_OE_SFT 20 ++#define PAD47_SEL_OE_HI 20 ++#define PAD47_SEL_OE_SZ 1 ++#define GPIO_9_ID_MSK 0x10000000 ++#define GPIO_9_ID_I_MSK 0xefffffff ++#define GPIO_9_ID_SFT 28 ++#define GPIO_9_ID_HI 28 ++#define GPIO_9_ID_SZ 1 ++#define PAD48_OE_MSK 0x00000001 ++#define PAD48_OE_I_MSK 0xfffffffe ++#define PAD48_OE_SFT 0 ++#define PAD48_OE_HI 0 ++#define PAD48_OE_SZ 1 ++#define PAD48_PE_MSK 0x00000002 ++#define PAD48_PE_I_MSK 0xfffffffd ++#define PAD48_PE_SFT 1 ++#define PAD48_PE_HI 1 ++#define PAD48_PE_SZ 1 ++#define PAD48_DS_MSK 0x00000004 ++#define PAD48_DS_I_MSK 0xfffffffb ++#define PAD48_DS_SFT 2 ++#define PAD48_DS_HI 2 ++#define PAD48_DS_SZ 1 ++#define PAD48_IE_MSK 0x00000008 ++#define PAD48_IE_I_MSK 0xfffffff7 ++#define PAD48_IE_SFT 3 ++#define PAD48_IE_HI 3 ++#define PAD48_IE_SZ 1 ++#define PAD48_SEL_I_MSK 0x00000070 ++#define PAD48_SEL_I_I_MSK 0xffffff8f ++#define PAD48_SEL_I_SFT 4 ++#define PAD48_SEL_I_HI 6 ++#define PAD48_SEL_I_SZ 3 ++#define PAD48_OD_MSK 0x00000100 ++#define PAD48_OD_I_MSK 0xfffffeff ++#define PAD48_OD_SFT 8 ++#define PAD48_OD_HI 8 ++#define PAD48_OD_SZ 1 ++#define PAD48_PE_SEL_MSK 0x00000800 ++#define PAD48_PE_SEL_I_MSK 0xfffff7ff ++#define PAD48_PE_SEL_SFT 11 ++#define PAD48_PE_SEL_HI 11 ++#define PAD48_PE_SEL_SZ 1 ++#define PAD48_SEL_O_MSK 0x00003000 ++#define PAD48_SEL_O_I_MSK 0xffffcfff ++#define PAD48_SEL_O_SFT 12 ++#define PAD48_SEL_O_HI 13 ++#define PAD48_SEL_O_SZ 2 ++#define PAD48_SEL_OE_MSK 0x00100000 ++#define PAD48_SEL_OE_I_MSK 0xffefffff ++#define PAD48_SEL_OE_SFT 20 ++#define PAD48_SEL_OE_HI 20 ++#define PAD48_SEL_OE_SZ 1 ++#define GPIO_10_ID_MSK 0x10000000 ++#define GPIO_10_ID_I_MSK 0xefffffff ++#define GPIO_10_ID_SFT 28 ++#define GPIO_10_ID_HI 28 ++#define GPIO_10_ID_SZ 1 ++#define PAD49_OE_MSK 0x00000001 ++#define PAD49_OE_I_MSK 0xfffffffe ++#define PAD49_OE_SFT 0 ++#define PAD49_OE_HI 0 ++#define PAD49_OE_SZ 1 ++#define PAD49_PE_MSK 0x00000002 ++#define PAD49_PE_I_MSK 0xfffffffd ++#define PAD49_PE_SFT 1 ++#define PAD49_PE_HI 1 ++#define PAD49_PE_SZ 1 ++#define PAD49_DS_MSK 0x00000004 ++#define PAD49_DS_I_MSK 0xfffffffb ++#define PAD49_DS_SFT 2 ++#define PAD49_DS_HI 2 ++#define PAD49_DS_SZ 1 ++#define PAD49_IE_MSK 0x00000008 ++#define PAD49_IE_I_MSK 0xfffffff7 ++#define PAD49_IE_SFT 3 ++#define PAD49_IE_HI 3 ++#define PAD49_IE_SZ 1 ++#define PAD49_SEL_I_MSK 0x00000070 ++#define PAD49_SEL_I_I_MSK 0xffffff8f ++#define PAD49_SEL_I_SFT 4 ++#define PAD49_SEL_I_HI 6 ++#define PAD49_SEL_I_SZ 3 ++#define PAD49_OD_MSK 0x00000100 ++#define PAD49_OD_I_MSK 0xfffffeff ++#define PAD49_OD_SFT 8 ++#define PAD49_OD_HI 8 ++#define PAD49_OD_SZ 1 ++#define PAD49_SEL_O_MSK 0x00003000 ++#define PAD49_SEL_O_I_MSK 0xffffcfff ++#define PAD49_SEL_O_SFT 12 ++#define PAD49_SEL_O_HI 13 ++#define PAD49_SEL_O_SZ 2 ++#define PAD49_SEL_OE_MSK 0x00100000 ++#define PAD49_SEL_OE_I_MSK 0xffefffff ++#define PAD49_SEL_OE_SFT 20 ++#define PAD49_SEL_OE_HI 20 ++#define PAD49_SEL_OE_SZ 1 ++#define GPIO_11_ID_MSK 0x10000000 ++#define GPIO_11_ID_I_MSK 0xefffffff ++#define GPIO_11_ID_SFT 28 ++#define GPIO_11_ID_HI 28 ++#define GPIO_11_ID_SZ 1 ++#define PAD50_OE_MSK 0x00000001 ++#define PAD50_OE_I_MSK 0xfffffffe ++#define PAD50_OE_SFT 0 ++#define PAD50_OE_HI 0 ++#define PAD50_OE_SZ 1 ++#define PAD50_PE_MSK 0x00000002 ++#define PAD50_PE_I_MSK 0xfffffffd ++#define PAD50_PE_SFT 1 ++#define PAD50_PE_HI 1 ++#define PAD50_PE_SZ 1 ++#define PAD50_DS_MSK 0x00000004 ++#define PAD50_DS_I_MSK 0xfffffffb ++#define PAD50_DS_SFT 2 ++#define PAD50_DS_HI 2 ++#define PAD50_DS_SZ 1 ++#define PAD50_IE_MSK 0x00000008 ++#define PAD50_IE_I_MSK 0xfffffff7 ++#define PAD50_IE_SFT 3 ++#define PAD50_IE_HI 3 ++#define PAD50_IE_SZ 1 ++#define PAD50_SEL_I_MSK 0x00000070 ++#define PAD50_SEL_I_I_MSK 0xffffff8f ++#define PAD50_SEL_I_SFT 4 ++#define PAD50_SEL_I_HI 6 ++#define PAD50_SEL_I_SZ 3 ++#define PAD50_OD_MSK 0x00000100 ++#define PAD50_OD_I_MSK 0xfffffeff ++#define PAD50_OD_SFT 8 ++#define PAD50_OD_HI 8 ++#define PAD50_OD_SZ 1 ++#define PAD50_SEL_O_MSK 0x00003000 ++#define PAD50_SEL_O_I_MSK 0xffffcfff ++#define PAD50_SEL_O_SFT 12 ++#define PAD50_SEL_O_HI 13 ++#define PAD50_SEL_O_SZ 2 ++#define PAD50_SEL_OE_MSK 0x00100000 ++#define PAD50_SEL_OE_I_MSK 0xffefffff ++#define PAD50_SEL_OE_SFT 20 ++#define PAD50_SEL_OE_HI 20 ++#define PAD50_SEL_OE_SZ 1 ++#define GPIO_12_ID_MSK 0x10000000 ++#define GPIO_12_ID_I_MSK 0xefffffff ++#define GPIO_12_ID_SFT 28 ++#define GPIO_12_ID_HI 28 ++#define GPIO_12_ID_SZ 1 ++#define PAD51_OE_MSK 0x00000001 ++#define PAD51_OE_I_MSK 0xfffffffe ++#define PAD51_OE_SFT 0 ++#define PAD51_OE_HI 0 ++#define PAD51_OE_SZ 1 ++#define PAD51_PE_MSK 0x00000002 ++#define PAD51_PE_I_MSK 0xfffffffd ++#define PAD51_PE_SFT 1 ++#define PAD51_PE_HI 1 ++#define PAD51_PE_SZ 1 ++#define PAD51_DS_MSK 0x00000004 ++#define PAD51_DS_I_MSK 0xfffffffb ++#define PAD51_DS_SFT 2 ++#define PAD51_DS_HI 2 ++#define PAD51_DS_SZ 1 ++#define PAD51_IE_MSK 0x00000008 ++#define PAD51_IE_I_MSK 0xfffffff7 ++#define PAD51_IE_SFT 3 ++#define PAD51_IE_HI 3 ++#define PAD51_IE_SZ 1 ++#define PAD51_SEL_I_MSK 0x00000030 ++#define PAD51_SEL_I_I_MSK 0xffffffcf ++#define PAD51_SEL_I_SFT 4 ++#define PAD51_SEL_I_HI 5 ++#define PAD51_SEL_I_SZ 2 ++#define PAD51_OD_MSK 0x00000100 ++#define PAD51_OD_I_MSK 0xfffffeff ++#define PAD51_OD_SFT 8 ++#define PAD51_OD_HI 8 ++#define PAD51_OD_SZ 1 ++#define PAD51_SEL_O_MSK 0x00001000 ++#define PAD51_SEL_O_I_MSK 0xffffefff ++#define PAD51_SEL_O_SFT 12 ++#define PAD51_SEL_O_HI 12 ++#define PAD51_SEL_O_SZ 1 ++#define PAD51_SEL_OE_MSK 0x00100000 ++#define PAD51_SEL_OE_I_MSK 0xffefffff ++#define PAD51_SEL_OE_SFT 20 ++#define PAD51_SEL_OE_HI 20 ++#define PAD51_SEL_OE_SZ 1 ++#define GPIO_13_ID_MSK 0x10000000 ++#define GPIO_13_ID_I_MSK 0xefffffff ++#define GPIO_13_ID_SFT 28 ++#define GPIO_13_ID_HI 28 ++#define GPIO_13_ID_SZ 1 ++#define PAD52_OE_MSK 0x00000001 ++#define PAD52_OE_I_MSK 0xfffffffe ++#define PAD52_OE_SFT 0 ++#define PAD52_OE_HI 0 ++#define PAD52_OE_SZ 1 ++#define PAD52_PE_MSK 0x00000002 ++#define PAD52_PE_I_MSK 0xfffffffd ++#define PAD52_PE_SFT 1 ++#define PAD52_PE_HI 1 ++#define PAD52_PE_SZ 1 ++#define PAD52_DS_MSK 0x00000004 ++#define PAD52_DS_I_MSK 0xfffffffb ++#define PAD52_DS_SFT 2 ++#define PAD52_DS_HI 2 ++#define PAD52_DS_SZ 1 ++#define PAD52_SEL_I_MSK 0x00000030 ++#define PAD52_SEL_I_I_MSK 0xffffffcf ++#define PAD52_SEL_I_SFT 4 ++#define PAD52_SEL_I_HI 5 ++#define PAD52_SEL_I_SZ 2 ++#define PAD52_OD_MSK 0x00000100 ++#define PAD52_OD_I_MSK 0xfffffeff ++#define PAD52_OD_SFT 8 ++#define PAD52_OD_HI 8 ++#define PAD52_OD_SZ 1 ++#define PAD52_SEL_O_MSK 0x00001000 ++#define PAD52_SEL_O_I_MSK 0xffffefff ++#define PAD52_SEL_O_SFT 12 ++#define PAD52_SEL_O_HI 12 ++#define PAD52_SEL_O_SZ 1 ++#define PAD52_SEL_OE_MSK 0x00100000 ++#define PAD52_SEL_OE_I_MSK 0xffefffff ++#define PAD52_SEL_OE_SFT 20 ++#define PAD52_SEL_OE_HI 20 ++#define PAD52_SEL_OE_SZ 1 ++#define GPIO_14_ID_MSK 0x10000000 ++#define GPIO_14_ID_I_MSK 0xefffffff ++#define GPIO_14_ID_SFT 28 ++#define GPIO_14_ID_HI 28 ++#define GPIO_14_ID_SZ 1 ++#define PAD53_OE_MSK 0x00000001 ++#define PAD53_OE_I_MSK 0xfffffffe ++#define PAD53_OE_SFT 0 ++#define PAD53_OE_HI 0 ++#define PAD53_OE_SZ 1 ++#define PAD53_PE_MSK 0x00000002 ++#define PAD53_PE_I_MSK 0xfffffffd ++#define PAD53_PE_SFT 1 ++#define PAD53_PE_HI 1 ++#define PAD53_PE_SZ 1 ++#define PAD53_DS_MSK 0x00000004 ++#define PAD53_DS_I_MSK 0xfffffffb ++#define PAD53_DS_SFT 2 ++#define PAD53_DS_HI 2 ++#define PAD53_DS_SZ 1 ++#define PAD53_IE_MSK 0x00000008 ++#define PAD53_IE_I_MSK 0xfffffff7 ++#define PAD53_IE_SFT 3 ++#define PAD53_IE_HI 3 ++#define PAD53_IE_SZ 1 ++#define PAD53_SEL_I_MSK 0x00000030 ++#define PAD53_SEL_I_I_MSK 0xffffffcf ++#define PAD53_SEL_I_SFT 4 ++#define PAD53_SEL_I_HI 5 ++#define PAD53_SEL_I_SZ 2 ++#define PAD53_OD_MSK 0x00000100 ++#define PAD53_OD_I_MSK 0xfffffeff ++#define PAD53_OD_SFT 8 ++#define PAD53_OD_HI 8 ++#define PAD53_OD_SZ 1 ++#define PAD53_SEL_O_MSK 0x00001000 ++#define PAD53_SEL_O_I_MSK 0xffffefff ++#define PAD53_SEL_O_SFT 12 ++#define PAD53_SEL_O_HI 12 ++#define PAD53_SEL_O_SZ 1 ++#define JTAG_TMS_ID_MSK 0x10000000 ++#define JTAG_TMS_ID_I_MSK 0xefffffff ++#define JTAG_TMS_ID_SFT 28 ++#define JTAG_TMS_ID_HI 28 ++#define JTAG_TMS_ID_SZ 1 ++#define PAD54_OE_MSK 0x00000001 ++#define PAD54_OE_I_MSK 0xfffffffe ++#define PAD54_OE_SFT 0 ++#define PAD54_OE_HI 0 ++#define PAD54_OE_SZ 1 ++#define PAD54_PE_MSK 0x00000002 ++#define PAD54_PE_I_MSK 0xfffffffd ++#define PAD54_PE_SFT 1 ++#define PAD54_PE_HI 1 ++#define PAD54_PE_SZ 1 ++#define PAD54_DS_MSK 0x00000004 ++#define PAD54_DS_I_MSK 0xfffffffb ++#define PAD54_DS_SFT 2 ++#define PAD54_DS_HI 2 ++#define PAD54_DS_SZ 1 ++#define PAD54_OD_MSK 0x00000100 ++#define PAD54_OD_I_MSK 0xfffffeff ++#define PAD54_OD_SFT 8 ++#define PAD54_OD_HI 8 ++#define PAD54_OD_SZ 1 ++#define PAD54_SEL_O_MSK 0x00003000 ++#define PAD54_SEL_O_I_MSK 0xffffcfff ++#define PAD54_SEL_O_SFT 12 ++#define PAD54_SEL_O_HI 13 ++#define PAD54_SEL_O_SZ 2 ++#define JTAG_TCK_ID_MSK 0x10000000 ++#define JTAG_TCK_ID_I_MSK 0xefffffff ++#define JTAG_TCK_ID_SFT 28 ++#define JTAG_TCK_ID_HI 28 ++#define JTAG_TCK_ID_SZ 1 ++#define PAD56_PE_MSK 0x00000002 ++#define PAD56_PE_I_MSK 0xfffffffd ++#define PAD56_PE_SFT 1 ++#define PAD56_PE_HI 1 ++#define PAD56_PE_SZ 1 ++#define PAD56_DS_MSK 0x00000004 ++#define PAD56_DS_I_MSK 0xfffffffb ++#define PAD56_DS_SFT 2 ++#define PAD56_DS_HI 2 ++#define PAD56_DS_SZ 1 ++#define PAD56_SEL_I_MSK 0x00000010 ++#define PAD56_SEL_I_I_MSK 0xffffffef ++#define PAD56_SEL_I_SFT 4 ++#define PAD56_SEL_I_HI 4 ++#define PAD56_SEL_I_SZ 1 ++#define PAD56_OD_MSK 0x00000100 ++#define PAD56_OD_I_MSK 0xfffffeff ++#define PAD56_OD_SFT 8 ++#define PAD56_OD_HI 8 ++#define PAD56_OD_SZ 1 ++#define JTAG_TDI_ID_MSK 0x10000000 ++#define JTAG_TDI_ID_I_MSK 0xefffffff ++#define JTAG_TDI_ID_SFT 28 ++#define JTAG_TDI_ID_HI 28 ++#define JTAG_TDI_ID_SZ 1 ++#define PAD57_OE_MSK 0x00000001 ++#define PAD57_OE_I_MSK 0xfffffffe ++#define PAD57_OE_SFT 0 ++#define PAD57_OE_HI 0 ++#define PAD57_OE_SZ 1 ++#define PAD57_PE_MSK 0x00000002 ++#define PAD57_PE_I_MSK 0xfffffffd ++#define PAD57_PE_SFT 1 ++#define PAD57_PE_HI 1 ++#define PAD57_PE_SZ 1 ++#define PAD57_DS_MSK 0x00000004 ++#define PAD57_DS_I_MSK 0xfffffffb ++#define PAD57_DS_SFT 2 ++#define PAD57_DS_HI 2 ++#define PAD57_DS_SZ 1 ++#define PAD57_IE_MSK 0x00000008 ++#define PAD57_IE_I_MSK 0xfffffff7 ++#define PAD57_IE_SFT 3 ++#define PAD57_IE_HI 3 ++#define PAD57_IE_SZ 1 ++#define PAD57_SEL_I_MSK 0x00000030 ++#define PAD57_SEL_I_I_MSK 0xffffffcf ++#define PAD57_SEL_I_SFT 4 ++#define PAD57_SEL_I_HI 5 ++#define PAD57_SEL_I_SZ 2 ++#define PAD57_OD_MSK 0x00000100 ++#define PAD57_OD_I_MSK 0xfffffeff ++#define PAD57_OD_SFT 8 ++#define PAD57_OD_HI 8 ++#define PAD57_OD_SZ 1 ++#define PAD57_SEL_O_MSK 0x00003000 ++#define PAD57_SEL_O_I_MSK 0xffffcfff ++#define PAD57_SEL_O_SFT 12 ++#define PAD57_SEL_O_HI 13 ++#define PAD57_SEL_O_SZ 2 ++#define PAD57_SEL_OE_MSK 0x00100000 ++#define PAD57_SEL_OE_I_MSK 0xffefffff ++#define PAD57_SEL_OE_SFT 20 ++#define PAD57_SEL_OE_HI 20 ++#define PAD57_SEL_OE_SZ 1 ++#define JTAG_TDO_ID_MSK 0x10000000 ++#define JTAG_TDO_ID_I_MSK 0xefffffff ++#define JTAG_TDO_ID_SFT 28 ++#define JTAG_TDO_ID_HI 28 ++#define JTAG_TDO_ID_SZ 1 ++#define PAD58_OE_MSK 0x00000001 ++#define PAD58_OE_I_MSK 0xfffffffe ++#define PAD58_OE_SFT 0 ++#define PAD58_OE_HI 0 ++#define PAD58_OE_SZ 1 ++#define PAD58_PE_MSK 0x00000002 ++#define PAD58_PE_I_MSK 0xfffffffd ++#define PAD58_PE_SFT 1 ++#define PAD58_PE_HI 1 ++#define PAD58_PE_SZ 1 ++#define PAD58_DS_MSK 0x00000004 ++#define PAD58_DS_I_MSK 0xfffffffb ++#define PAD58_DS_SFT 2 ++#define PAD58_DS_HI 2 ++#define PAD58_DS_SZ 1 ++#define PAD58_IE_MSK 0x00000008 ++#define PAD58_IE_I_MSK 0xfffffff7 ++#define PAD58_IE_SFT 3 ++#define PAD58_IE_HI 3 ++#define PAD58_IE_SZ 1 ++#define PAD58_SEL_I_MSK 0x00000030 ++#define PAD58_SEL_I_I_MSK 0xffffffcf ++#define PAD58_SEL_I_SFT 4 ++#define PAD58_SEL_I_HI 5 ++#define PAD58_SEL_I_SZ 2 ++#define PAD58_OD_MSK 0x00000100 ++#define PAD58_OD_I_MSK 0xfffffeff ++#define PAD58_OD_SFT 8 ++#define PAD58_OD_HI 8 ++#define PAD58_OD_SZ 1 ++#define PAD58_SEL_O_MSK 0x00001000 ++#define PAD58_SEL_O_I_MSK 0xffffefff ++#define PAD58_SEL_O_SFT 12 ++#define PAD58_SEL_O_HI 12 ++#define PAD58_SEL_O_SZ 1 ++#define TEST_16_ID_MSK 0x10000000 ++#define TEST_16_ID_I_MSK 0xefffffff ++#define TEST_16_ID_SFT 28 ++#define TEST_16_ID_HI 28 ++#define TEST_16_ID_SZ 1 ++#define PAD59_OE_MSK 0x00000001 ++#define PAD59_OE_I_MSK 0xfffffffe ++#define PAD59_OE_SFT 0 ++#define PAD59_OE_HI 0 ++#define PAD59_OE_SZ 1 ++#define PAD59_PE_MSK 0x00000002 ++#define PAD59_PE_I_MSK 0xfffffffd ++#define PAD59_PE_SFT 1 ++#define PAD59_PE_HI 1 ++#define PAD59_PE_SZ 1 ++#define PAD59_DS_MSK 0x00000004 ++#define PAD59_DS_I_MSK 0xfffffffb ++#define PAD59_DS_SFT 2 ++#define PAD59_DS_HI 2 ++#define PAD59_DS_SZ 1 ++#define PAD59_IE_MSK 0x00000008 ++#define PAD59_IE_I_MSK 0xfffffff7 ++#define PAD59_IE_SFT 3 ++#define PAD59_IE_HI 3 ++#define PAD59_IE_SZ 1 ++#define PAD59_SEL_I_MSK 0x00000030 ++#define PAD59_SEL_I_I_MSK 0xffffffcf ++#define PAD59_SEL_I_SFT 4 ++#define PAD59_SEL_I_HI 5 ++#define PAD59_SEL_I_SZ 2 ++#define PAD59_OD_MSK 0x00000100 ++#define PAD59_OD_I_MSK 0xfffffeff ++#define PAD59_OD_SFT 8 ++#define PAD59_OD_HI 8 ++#define PAD59_OD_SZ 1 ++#define PAD59_SEL_O_MSK 0x00001000 ++#define PAD59_SEL_O_I_MSK 0xffffefff ++#define PAD59_SEL_O_SFT 12 ++#define PAD59_SEL_O_HI 12 ++#define PAD59_SEL_O_SZ 1 ++#define TEST_17_ID_MSK 0x10000000 ++#define TEST_17_ID_I_MSK 0xefffffff ++#define TEST_17_ID_SFT 28 ++#define TEST_17_ID_HI 28 ++#define TEST_17_ID_SZ 1 ++#define PAD60_OE_MSK 0x00000001 ++#define PAD60_OE_I_MSK 0xfffffffe ++#define PAD60_OE_SFT 0 ++#define PAD60_OE_HI 0 ++#define PAD60_OE_SZ 1 ++#define PAD60_PE_MSK 0x00000002 ++#define PAD60_PE_I_MSK 0xfffffffd ++#define PAD60_PE_SFT 1 ++#define PAD60_PE_HI 1 ++#define PAD60_PE_SZ 1 ++#define PAD60_DS_MSK 0x00000004 ++#define PAD60_DS_I_MSK 0xfffffffb ++#define PAD60_DS_SFT 2 ++#define PAD60_DS_HI 2 ++#define PAD60_DS_SZ 1 ++#define PAD60_IE_MSK 0x00000008 ++#define PAD60_IE_I_MSK 0xfffffff7 ++#define PAD60_IE_SFT 3 ++#define PAD60_IE_HI 3 ++#define PAD60_IE_SZ 1 ++#define PAD60_SEL_I_MSK 0x00000030 ++#define PAD60_SEL_I_I_MSK 0xffffffcf ++#define PAD60_SEL_I_SFT 4 ++#define PAD60_SEL_I_HI 5 ++#define PAD60_SEL_I_SZ 2 ++#define PAD60_OD_MSK 0x00000100 ++#define PAD60_OD_I_MSK 0xfffffeff ++#define PAD60_OD_SFT 8 ++#define PAD60_OD_HI 8 ++#define PAD60_OD_SZ 1 ++#define PAD60_SEL_O_MSK 0x00001000 ++#define PAD60_SEL_O_I_MSK 0xffffefff ++#define PAD60_SEL_O_SFT 12 ++#define PAD60_SEL_O_HI 12 ++#define PAD60_SEL_O_SZ 1 ++#define TEST_18_ID_MSK 0x10000000 ++#define TEST_18_ID_I_MSK 0xefffffff ++#define TEST_18_ID_SFT 28 ++#define TEST_18_ID_HI 28 ++#define TEST_18_ID_SZ 1 ++#define PAD61_OE_MSK 0x00000001 ++#define PAD61_OE_I_MSK 0xfffffffe ++#define PAD61_OE_SFT 0 ++#define PAD61_OE_HI 0 ++#define PAD61_OE_SZ 1 ++#define PAD61_PE_MSK 0x00000002 ++#define PAD61_PE_I_MSK 0xfffffffd ++#define PAD61_PE_SFT 1 ++#define PAD61_PE_HI 1 ++#define PAD61_PE_SZ 1 ++#define PAD61_DS_MSK 0x00000004 ++#define PAD61_DS_I_MSK 0xfffffffb ++#define PAD61_DS_SFT 2 ++#define PAD61_DS_HI 2 ++#define PAD61_DS_SZ 1 ++#define PAD61_IE_MSK 0x00000008 ++#define PAD61_IE_I_MSK 0xfffffff7 ++#define PAD61_IE_SFT 3 ++#define PAD61_IE_HI 3 ++#define PAD61_IE_SZ 1 ++#define PAD61_SEL_I_MSK 0x00000010 ++#define PAD61_SEL_I_I_MSK 0xffffffef ++#define PAD61_SEL_I_SFT 4 ++#define PAD61_SEL_I_HI 4 ++#define PAD61_SEL_I_SZ 1 ++#define PAD61_OD_MSK 0x00000100 ++#define PAD61_OD_I_MSK 0xfffffeff ++#define PAD61_OD_SFT 8 ++#define PAD61_OD_HI 8 ++#define PAD61_OD_SZ 1 ++#define PAD61_SEL_O_MSK 0x00003000 ++#define PAD61_SEL_O_I_MSK 0xffffcfff ++#define PAD61_SEL_O_SFT 12 ++#define PAD61_SEL_O_HI 13 ++#define PAD61_SEL_O_SZ 2 ++#define TEST_19_ID_MSK 0x10000000 ++#define TEST_19_ID_I_MSK 0xefffffff ++#define TEST_19_ID_SFT 28 ++#define TEST_19_ID_HI 28 ++#define TEST_19_ID_SZ 1 ++#define PAD62_OE_MSK 0x00000001 ++#define PAD62_OE_I_MSK 0xfffffffe ++#define PAD62_OE_SFT 0 ++#define PAD62_OE_HI 0 ++#define PAD62_OE_SZ 1 ++#define PAD62_PE_MSK 0x00000002 ++#define PAD62_PE_I_MSK 0xfffffffd ++#define PAD62_PE_SFT 1 ++#define PAD62_PE_HI 1 ++#define PAD62_PE_SZ 1 ++#define PAD62_DS_MSK 0x00000004 ++#define PAD62_DS_I_MSK 0xfffffffb ++#define PAD62_DS_SFT 2 ++#define PAD62_DS_HI 2 ++#define PAD62_DS_SZ 1 ++#define PAD62_IE_MSK 0x00000008 ++#define PAD62_IE_I_MSK 0xfffffff7 ++#define PAD62_IE_SFT 3 ++#define PAD62_IE_HI 3 ++#define PAD62_IE_SZ 1 ++#define PAD62_SEL_I_MSK 0x00000010 ++#define PAD62_SEL_I_I_MSK 0xffffffef ++#define PAD62_SEL_I_SFT 4 ++#define PAD62_SEL_I_HI 4 ++#define PAD62_SEL_I_SZ 1 ++#define PAD62_OD_MSK 0x00000100 ++#define PAD62_OD_I_MSK 0xfffffeff ++#define PAD62_OD_SFT 8 ++#define PAD62_OD_HI 8 ++#define PAD62_OD_SZ 1 ++#define PAD62_SEL_O_MSK 0x00001000 ++#define PAD62_SEL_O_I_MSK 0xffffefff ++#define PAD62_SEL_O_SFT 12 ++#define PAD62_SEL_O_HI 12 ++#define PAD62_SEL_O_SZ 1 ++#define TEST_20_ID_MSK 0x10000000 ++#define TEST_20_ID_I_MSK 0xefffffff ++#define TEST_20_ID_SFT 28 ++#define TEST_20_ID_HI 28 ++#define TEST_20_ID_SZ 1 ++#define PAD64_OE_MSK 0x00000001 ++#define PAD64_OE_I_MSK 0xfffffffe ++#define PAD64_OE_SFT 0 ++#define PAD64_OE_HI 0 ++#define PAD64_OE_SZ 1 ++#define PAD64_PE_MSK 0x00000002 ++#define PAD64_PE_I_MSK 0xfffffffd ++#define PAD64_PE_SFT 1 ++#define PAD64_PE_HI 1 ++#define PAD64_PE_SZ 1 ++#define PAD64_DS_MSK 0x00000004 ++#define PAD64_DS_I_MSK 0xfffffffb ++#define PAD64_DS_SFT 2 ++#define PAD64_DS_HI 2 ++#define PAD64_DS_SZ 1 ++#define PAD64_IE_MSK 0x00000008 ++#define PAD64_IE_I_MSK 0xfffffff7 ++#define PAD64_IE_SFT 3 ++#define PAD64_IE_HI 3 ++#define PAD64_IE_SZ 1 ++#define PAD64_SEL_I_MSK 0x00000070 ++#define PAD64_SEL_I_I_MSK 0xffffff8f ++#define PAD64_SEL_I_SFT 4 ++#define PAD64_SEL_I_HI 6 ++#define PAD64_SEL_I_SZ 3 ++#define PAD64_OD_MSK 0x00000100 ++#define PAD64_OD_I_MSK 0xfffffeff ++#define PAD64_OD_SFT 8 ++#define PAD64_OD_HI 8 ++#define PAD64_OD_SZ 1 ++#define PAD64_SEL_O_MSK 0x00003000 ++#define PAD64_SEL_O_I_MSK 0xffffcfff ++#define PAD64_SEL_O_SFT 12 ++#define PAD64_SEL_O_HI 13 ++#define PAD64_SEL_O_SZ 2 ++#define PAD64_SEL_OE_MSK 0x00100000 ++#define PAD64_SEL_OE_I_MSK 0xffefffff ++#define PAD64_SEL_OE_SFT 20 ++#define PAD64_SEL_OE_HI 20 ++#define PAD64_SEL_OE_SZ 1 ++#define GPIO_15_IP_ID_MSK 0x10000000 ++#define GPIO_15_IP_ID_I_MSK 0xefffffff ++#define GPIO_15_IP_ID_SFT 28 ++#define GPIO_15_IP_ID_HI 28 ++#define GPIO_15_IP_ID_SZ 1 ++#define PAD65_OE_MSK 0x00000001 ++#define PAD65_OE_I_MSK 0xfffffffe ++#define PAD65_OE_SFT 0 ++#define PAD65_OE_HI 0 ++#define PAD65_OE_SZ 1 ++#define PAD65_PE_MSK 0x00000002 ++#define PAD65_PE_I_MSK 0xfffffffd ++#define PAD65_PE_SFT 1 ++#define PAD65_PE_HI 1 ++#define PAD65_PE_SZ 1 ++#define PAD65_DS_MSK 0x00000004 ++#define PAD65_DS_I_MSK 0xfffffffb ++#define PAD65_DS_SFT 2 ++#define PAD65_DS_HI 2 ++#define PAD65_DS_SZ 1 ++#define PAD65_IE_MSK 0x00000008 ++#define PAD65_IE_I_MSK 0xfffffff7 ++#define PAD65_IE_SFT 3 ++#define PAD65_IE_HI 3 ++#define PAD65_IE_SZ 1 ++#define PAD65_SEL_I_MSK 0x00000070 ++#define PAD65_SEL_I_I_MSK 0xffffff8f ++#define PAD65_SEL_I_SFT 4 ++#define PAD65_SEL_I_HI 6 ++#define PAD65_SEL_I_SZ 3 ++#define PAD65_OD_MSK 0x00000100 ++#define PAD65_OD_I_MSK 0xfffffeff ++#define PAD65_OD_SFT 8 ++#define PAD65_OD_HI 8 ++#define PAD65_OD_SZ 1 ++#define PAD65_SEL_O_MSK 0x00001000 ++#define PAD65_SEL_O_I_MSK 0xffffefff ++#define PAD65_SEL_O_SFT 12 ++#define PAD65_SEL_O_HI 12 ++#define PAD65_SEL_O_SZ 1 ++#define GPIO_TEST_7_IN_ID_MSK 0x10000000 ++#define GPIO_TEST_7_IN_ID_I_MSK 0xefffffff ++#define GPIO_TEST_7_IN_ID_SFT 28 ++#define GPIO_TEST_7_IN_ID_HI 28 ++#define GPIO_TEST_7_IN_ID_SZ 1 ++#define PAD66_OE_MSK 0x00000001 ++#define PAD66_OE_I_MSK 0xfffffffe ++#define PAD66_OE_SFT 0 ++#define PAD66_OE_HI 0 ++#define PAD66_OE_SZ 1 ++#define PAD66_PE_MSK 0x00000002 ++#define PAD66_PE_I_MSK 0xfffffffd ++#define PAD66_PE_SFT 1 ++#define PAD66_PE_HI 1 ++#define PAD66_PE_SZ 1 ++#define PAD66_DS_MSK 0x00000004 ++#define PAD66_DS_I_MSK 0xfffffffb ++#define PAD66_DS_SFT 2 ++#define PAD66_DS_HI 2 ++#define PAD66_DS_SZ 1 ++#define PAD66_IE_MSK 0x00000008 ++#define PAD66_IE_I_MSK 0xfffffff7 ++#define PAD66_IE_SFT 3 ++#define PAD66_IE_HI 3 ++#define PAD66_IE_SZ 1 ++#define PAD66_SEL_I_MSK 0x00000030 ++#define PAD66_SEL_I_I_MSK 0xffffffcf ++#define PAD66_SEL_I_SFT 4 ++#define PAD66_SEL_I_HI 5 ++#define PAD66_SEL_I_SZ 2 ++#define PAD66_OD_MSK 0x00000100 ++#define PAD66_OD_I_MSK 0xfffffeff ++#define PAD66_OD_SFT 8 ++#define PAD66_OD_HI 8 ++#define PAD66_OD_SZ 1 ++#define PAD66_SEL_O_MSK 0x00003000 ++#define PAD66_SEL_O_I_MSK 0xffffcfff ++#define PAD66_SEL_O_SFT 12 ++#define PAD66_SEL_O_HI 13 ++#define PAD66_SEL_O_SZ 2 ++#define GPIO_17_QP_ID_MSK 0x10000000 ++#define GPIO_17_QP_ID_I_MSK 0xefffffff ++#define GPIO_17_QP_ID_SFT 28 ++#define GPIO_17_QP_ID_HI 28 ++#define GPIO_17_QP_ID_SZ 1 ++#define PAD68_OE_MSK 0x00000001 ++#define PAD68_OE_I_MSK 0xfffffffe ++#define PAD68_OE_SFT 0 ++#define PAD68_OE_HI 0 ++#define PAD68_OE_SZ 1 ++#define PAD68_PE_MSK 0x00000002 ++#define PAD68_PE_I_MSK 0xfffffffd ++#define PAD68_PE_SFT 1 ++#define PAD68_PE_HI 1 ++#define PAD68_PE_SZ 1 ++#define PAD68_DS_MSK 0x00000004 ++#define PAD68_DS_I_MSK 0xfffffffb ++#define PAD68_DS_SFT 2 ++#define PAD68_DS_HI 2 ++#define PAD68_DS_SZ 1 ++#define PAD68_IE_MSK 0x00000008 ++#define PAD68_IE_I_MSK 0xfffffff7 ++#define PAD68_IE_SFT 3 ++#define PAD68_IE_HI 3 ++#define PAD68_IE_SZ 1 ++#define PAD68_OD_MSK 0x00000100 ++#define PAD68_OD_I_MSK 0xfffffeff ++#define PAD68_OD_SFT 8 ++#define PAD68_OD_HI 8 ++#define PAD68_OD_SZ 1 ++#define PAD68_SEL_O_MSK 0x00001000 ++#define PAD68_SEL_O_I_MSK 0xffffefff ++#define PAD68_SEL_O_SFT 12 ++#define PAD68_SEL_O_HI 12 ++#define PAD68_SEL_O_SZ 1 ++#define GPIO_19_ID_MSK 0x10000000 ++#define GPIO_19_ID_I_MSK 0xefffffff ++#define GPIO_19_ID_SFT 28 ++#define GPIO_19_ID_HI 28 ++#define GPIO_19_ID_SZ 1 ++#define PAD67_OE_MSK 0x00000001 ++#define PAD67_OE_I_MSK 0xfffffffe ++#define PAD67_OE_SFT 0 ++#define PAD67_OE_HI 0 ++#define PAD67_OE_SZ 1 ++#define PAD67_PE_MSK 0x00000002 ++#define PAD67_PE_I_MSK 0xfffffffd ++#define PAD67_PE_SFT 1 ++#define PAD67_PE_HI 1 ++#define PAD67_PE_SZ 1 ++#define PAD67_DS_MSK 0x00000004 ++#define PAD67_DS_I_MSK 0xfffffffb ++#define PAD67_DS_SFT 2 ++#define PAD67_DS_HI 2 ++#define PAD67_DS_SZ 1 ++#define PAD67_IE_MSK 0x00000008 ++#define PAD67_IE_I_MSK 0xfffffff7 ++#define PAD67_IE_SFT 3 ++#define PAD67_IE_HI 3 ++#define PAD67_IE_SZ 1 ++#define PAD67_SEL_I_MSK 0x00000070 ++#define PAD67_SEL_I_I_MSK 0xffffff8f ++#define PAD67_SEL_I_SFT 4 ++#define PAD67_SEL_I_HI 6 ++#define PAD67_SEL_I_SZ 3 ++#define PAD67_OD_MSK 0x00000100 ++#define PAD67_OD_I_MSK 0xfffffeff ++#define PAD67_OD_SFT 8 ++#define PAD67_OD_HI 8 ++#define PAD67_OD_SZ 1 ++#define PAD67_SEL_O_MSK 0x00003000 ++#define PAD67_SEL_O_I_MSK 0xffffcfff ++#define PAD67_SEL_O_SFT 12 ++#define PAD67_SEL_O_HI 13 ++#define PAD67_SEL_O_SZ 2 ++#define GPIO_TEST_8_QN_ID_MSK 0x10000000 ++#define GPIO_TEST_8_QN_ID_I_MSK 0xefffffff ++#define GPIO_TEST_8_QN_ID_SFT 28 ++#define GPIO_TEST_8_QN_ID_HI 28 ++#define GPIO_TEST_8_QN_ID_SZ 1 ++#define PAD69_OE_MSK 0x00000001 ++#define PAD69_OE_I_MSK 0xfffffffe ++#define PAD69_OE_SFT 0 ++#define PAD69_OE_HI 0 ++#define PAD69_OE_SZ 1 ++#define PAD69_PE_MSK 0x00000002 ++#define PAD69_PE_I_MSK 0xfffffffd ++#define PAD69_PE_SFT 1 ++#define PAD69_PE_HI 1 ++#define PAD69_PE_SZ 1 ++#define PAD69_DS_MSK 0x00000004 ++#define PAD69_DS_I_MSK 0xfffffffb ++#define PAD69_DS_SFT 2 ++#define PAD69_DS_HI 2 ++#define PAD69_DS_SZ 1 ++#define PAD69_IE_MSK 0x00000008 ++#define PAD69_IE_I_MSK 0xfffffff7 ++#define PAD69_IE_SFT 3 ++#define PAD69_IE_HI 3 ++#define PAD69_IE_SZ 1 ++#define PAD69_SEL_I_MSK 0x00000030 ++#define PAD69_SEL_I_I_MSK 0xffffffcf ++#define PAD69_SEL_I_SFT 4 ++#define PAD69_SEL_I_HI 5 ++#define PAD69_SEL_I_SZ 2 ++#define PAD69_OD_MSK 0x00000100 ++#define PAD69_OD_I_MSK 0xfffffeff ++#define PAD69_OD_SFT 8 ++#define PAD69_OD_HI 8 ++#define PAD69_OD_SZ 1 ++#define PAD69_SEL_O_MSK 0x00001000 ++#define PAD69_SEL_O_I_MSK 0xffffefff ++#define PAD69_SEL_O_SFT 12 ++#define PAD69_SEL_O_HI 12 ++#define PAD69_SEL_O_SZ 1 ++#define STRAP2_MSK 0x08000000 ++#define STRAP2_I_MSK 0xf7ffffff ++#define STRAP2_SFT 27 ++#define STRAP2_HI 27 ++#define STRAP2_SZ 1 ++#define GPIO_20_ID_MSK 0x10000000 ++#define GPIO_20_ID_I_MSK 0xefffffff ++#define GPIO_20_ID_SFT 28 ++#define GPIO_20_ID_HI 28 ++#define GPIO_20_ID_SZ 1 ++#define PAD70_OE_MSK 0x00000001 ++#define PAD70_OE_I_MSK 0xfffffffe ++#define PAD70_OE_SFT 0 ++#define PAD70_OE_HI 0 ++#define PAD70_OE_SZ 1 ++#define PAD70_PE_MSK 0x00000002 ++#define PAD70_PE_I_MSK 0xfffffffd ++#define PAD70_PE_SFT 1 ++#define PAD70_PE_HI 1 ++#define PAD70_PE_SZ 1 ++#define PAD70_DS_MSK 0x00000004 ++#define PAD70_DS_I_MSK 0xfffffffb ++#define PAD70_DS_SFT 2 ++#define PAD70_DS_HI 2 ++#define PAD70_DS_SZ 1 ++#define PAD70_IE_MSK 0x00000008 ++#define PAD70_IE_I_MSK 0xfffffff7 ++#define PAD70_IE_SFT 3 ++#define PAD70_IE_HI 3 ++#define PAD70_IE_SZ 1 ++#define PAD70_SEL_I_MSK 0x00000030 ++#define PAD70_SEL_I_I_MSK 0xffffffcf ++#define PAD70_SEL_I_SFT 4 ++#define PAD70_SEL_I_HI 5 ++#define PAD70_SEL_I_SZ 2 ++#define PAD70_OD_MSK 0x00000100 ++#define PAD70_OD_I_MSK 0xfffffeff ++#define PAD70_OD_SFT 8 ++#define PAD70_OD_HI 8 ++#define PAD70_OD_SZ 1 ++#define PAD70_SEL_O_MSK 0x00007000 ++#define PAD70_SEL_O_I_MSK 0xffff8fff ++#define PAD70_SEL_O_SFT 12 ++#define PAD70_SEL_O_HI 14 ++#define PAD70_SEL_O_SZ 3 ++#define GPIO_21_ID_MSK 0x10000000 ++#define GPIO_21_ID_I_MSK 0xefffffff ++#define GPIO_21_ID_SFT 28 ++#define GPIO_21_ID_HI 28 ++#define GPIO_21_ID_SZ 1 ++#define PAD231_OE_MSK 0x00000001 ++#define PAD231_OE_I_MSK 0xfffffffe ++#define PAD231_OE_SFT 0 ++#define PAD231_OE_HI 0 ++#define PAD231_OE_SZ 1 ++#define PAD231_PE_MSK 0x00000002 ++#define PAD231_PE_I_MSK 0xfffffffd ++#define PAD231_PE_SFT 1 ++#define PAD231_PE_HI 1 ++#define PAD231_PE_SZ 1 ++#define PAD231_DS_MSK 0x00000004 ++#define PAD231_DS_I_MSK 0xfffffffb ++#define PAD231_DS_SFT 2 ++#define PAD231_DS_HI 2 ++#define PAD231_DS_SZ 1 ++#define PAD231_IE_MSK 0x00000008 ++#define PAD231_IE_I_MSK 0xfffffff7 ++#define PAD231_IE_SFT 3 ++#define PAD231_IE_HI 3 ++#define PAD231_IE_SZ 1 ++#define PAD231_OD_MSK 0x00000100 ++#define PAD231_OD_I_MSK 0xfffffeff ++#define PAD231_OD_SFT 8 ++#define PAD231_OD_HI 8 ++#define PAD231_OD_SZ 1 ++#define PIN_40_OR_56_ID_MSK 0x10000000 ++#define PIN_40_OR_56_ID_I_MSK 0xefffffff ++#define PIN_40_OR_56_ID_SFT 28 ++#define PIN_40_OR_56_ID_HI 28 ++#define PIN_40_OR_56_ID_SZ 1 ++#define MP_PHY2RX_DATA__0_SEL_MSK 0x00000001 ++#define MP_PHY2RX_DATA__0_SEL_I_MSK 0xfffffffe ++#define MP_PHY2RX_DATA__0_SEL_SFT 0 ++#define MP_PHY2RX_DATA__0_SEL_HI 0 ++#define MP_PHY2RX_DATA__0_SEL_SZ 1 ++#define MP_PHY2RX_DATA__1_SEL_MSK 0x00000002 ++#define MP_PHY2RX_DATA__1_SEL_I_MSK 0xfffffffd ++#define MP_PHY2RX_DATA__1_SEL_SFT 1 ++#define MP_PHY2RX_DATA__1_SEL_HI 1 ++#define MP_PHY2RX_DATA__1_SEL_SZ 1 ++#define MP_TX_FF_RPTR__1_SEL_MSK 0x00000004 ++#define MP_TX_FF_RPTR__1_SEL_I_MSK 0xfffffffb ++#define MP_TX_FF_RPTR__1_SEL_SFT 2 ++#define MP_TX_FF_RPTR__1_SEL_HI 2 ++#define MP_TX_FF_RPTR__1_SEL_SZ 1 ++#define MP_RX_FF_WPTR__2_SEL_MSK 0x00000008 ++#define MP_RX_FF_WPTR__2_SEL_I_MSK 0xfffffff7 ++#define MP_RX_FF_WPTR__2_SEL_SFT 3 ++#define MP_RX_FF_WPTR__2_SEL_HI 3 ++#define MP_RX_FF_WPTR__2_SEL_SZ 1 ++#define MP_RX_FF_WPTR__1_SEL_MSK 0x00000010 ++#define MP_RX_FF_WPTR__1_SEL_I_MSK 0xffffffef ++#define MP_RX_FF_WPTR__1_SEL_SFT 4 ++#define MP_RX_FF_WPTR__1_SEL_HI 4 ++#define MP_RX_FF_WPTR__1_SEL_SZ 1 ++#define MP_RX_FF_WPTR__0_SEL_MSK 0x00000020 ++#define MP_RX_FF_WPTR__0_SEL_I_MSK 0xffffffdf ++#define MP_RX_FF_WPTR__0_SEL_SFT 5 ++#define MP_RX_FF_WPTR__0_SEL_HI 5 ++#define MP_RX_FF_WPTR__0_SEL_SZ 1 ++#define MP_PHY2RX_DATA__2_SEL_MSK 0x00000040 ++#define MP_PHY2RX_DATA__2_SEL_I_MSK 0xffffffbf ++#define MP_PHY2RX_DATA__2_SEL_SFT 6 ++#define MP_PHY2RX_DATA__2_SEL_HI 6 ++#define MP_PHY2RX_DATA__2_SEL_SZ 1 ++#define MP_PHY2RX_DATA__4_SEL_MSK 0x00000080 ++#define MP_PHY2RX_DATA__4_SEL_I_MSK 0xffffff7f ++#define MP_PHY2RX_DATA__4_SEL_SFT 7 ++#define MP_PHY2RX_DATA__4_SEL_HI 7 ++#define MP_PHY2RX_DATA__4_SEL_SZ 1 ++#define I2CM_SDA_ID_SEL_MSK 0x00000300 ++#define I2CM_SDA_ID_SEL_I_MSK 0xfffffcff ++#define I2CM_SDA_ID_SEL_SFT 8 ++#define I2CM_SDA_ID_SEL_HI 9 ++#define I2CM_SDA_ID_SEL_SZ 2 ++#define CRYSTAL_OUT_REQ_SEL_MSK 0x00000400 ++#define CRYSTAL_OUT_REQ_SEL_I_MSK 0xfffffbff ++#define CRYSTAL_OUT_REQ_SEL_SFT 10 ++#define CRYSTAL_OUT_REQ_SEL_HI 10 ++#define CRYSTAL_OUT_REQ_SEL_SZ 1 ++#define MP_PHY2RX_DATA__5_SEL_MSK 0x00000800 ++#define MP_PHY2RX_DATA__5_SEL_I_MSK 0xfffff7ff ++#define MP_PHY2RX_DATA__5_SEL_SFT 11 ++#define MP_PHY2RX_DATA__5_SEL_HI 11 ++#define MP_PHY2RX_DATA__5_SEL_SZ 1 ++#define MP_PHY2RX_DATA__3_SEL_MSK 0x00001000 ++#define MP_PHY2RX_DATA__3_SEL_I_MSK 0xffffefff ++#define MP_PHY2RX_DATA__3_SEL_SFT 12 ++#define MP_PHY2RX_DATA__3_SEL_HI 12 ++#define MP_PHY2RX_DATA__3_SEL_SZ 1 ++#define UART_RXD_SEL_MSK 0x00006000 ++#define UART_RXD_SEL_I_MSK 0xffff9fff ++#define UART_RXD_SEL_SFT 13 ++#define UART_RXD_SEL_HI 14 ++#define UART_RXD_SEL_SZ 2 ++#define MP_PHY2RX_DATA__6_SEL_MSK 0x00008000 ++#define MP_PHY2RX_DATA__6_SEL_I_MSK 0xffff7fff ++#define MP_PHY2RX_DATA__6_SEL_SFT 15 ++#define MP_PHY2RX_DATA__6_SEL_HI 15 ++#define MP_PHY2RX_DATA__6_SEL_SZ 1 ++#define DAT_UART_NCTS_SEL_MSK 0x00010000 ++#define DAT_UART_NCTS_SEL_I_MSK 0xfffeffff ++#define DAT_UART_NCTS_SEL_SFT 16 ++#define DAT_UART_NCTS_SEL_HI 16 ++#define DAT_UART_NCTS_SEL_SZ 1 ++#define GPIO_LOG_STOP_SEL_MSK 0x000e0000 ++#define GPIO_LOG_STOP_SEL_I_MSK 0xfff1ffff ++#define GPIO_LOG_STOP_SEL_SFT 17 ++#define GPIO_LOG_STOP_SEL_HI 19 ++#define GPIO_LOG_STOP_SEL_SZ 3 ++#define MP_TX_FF_RPTR__0_SEL_MSK 0x00100000 ++#define MP_TX_FF_RPTR__0_SEL_I_MSK 0xffefffff ++#define MP_TX_FF_RPTR__0_SEL_SFT 20 ++#define MP_TX_FF_RPTR__0_SEL_HI 20 ++#define MP_TX_FF_RPTR__0_SEL_SZ 1 ++#define MP_PHY_RX_WRST_N_SEL_MSK 0x00200000 ++#define MP_PHY_RX_WRST_N_SEL_I_MSK 0xffdfffff ++#define MP_PHY_RX_WRST_N_SEL_SFT 21 ++#define MP_PHY_RX_WRST_N_SEL_HI 21 ++#define MP_PHY_RX_WRST_N_SEL_SZ 1 ++#define EXT_32K_SEL_MSK 0x00c00000 ++#define EXT_32K_SEL_I_MSK 0xff3fffff ++#define EXT_32K_SEL_SFT 22 ++#define EXT_32K_SEL_HI 23 ++#define EXT_32K_SEL_SZ 2 ++#define MP_PHY2RX_DATA__7_SEL_MSK 0x01000000 ++#define MP_PHY2RX_DATA__7_SEL_I_MSK 0xfeffffff ++#define MP_PHY2RX_DATA__7_SEL_SFT 24 ++#define MP_PHY2RX_DATA__7_SEL_HI 24 ++#define MP_PHY2RX_DATA__7_SEL_SZ 1 ++#define MP_TX_FF_RPTR__2_SEL_MSK 0x02000000 ++#define MP_TX_FF_RPTR__2_SEL_I_MSK 0xfdffffff ++#define MP_TX_FF_RPTR__2_SEL_SFT 25 ++#define MP_TX_FF_RPTR__2_SEL_HI 25 ++#define MP_TX_FF_RPTR__2_SEL_SZ 1 ++#define PMUINT_WAKE_SEL_MSK 0x1c000000 ++#define PMUINT_WAKE_SEL_I_MSK 0xe3ffffff ++#define PMUINT_WAKE_SEL_SFT 26 ++#define PMUINT_WAKE_SEL_HI 28 ++#define PMUINT_WAKE_SEL_SZ 3 ++#define I2CM_SCL_ID_SEL_MSK 0x20000000 ++#define I2CM_SCL_ID_SEL_I_MSK 0xdfffffff ++#define I2CM_SCL_ID_SEL_SFT 29 ++#define I2CM_SCL_ID_SEL_HI 29 ++#define I2CM_SCL_ID_SEL_SZ 1 ++#define MP_MRX_RX_EN_SEL_MSK 0x40000000 ++#define MP_MRX_RX_EN_SEL_I_MSK 0xbfffffff ++#define MP_MRX_RX_EN_SEL_SFT 30 ++#define MP_MRX_RX_EN_SEL_HI 30 ++#define MP_MRX_RX_EN_SEL_SZ 1 ++#define DAT_UART_RXD_SEL_0_MSK 0x80000000 ++#define DAT_UART_RXD_SEL_0_I_MSK 0x7fffffff ++#define DAT_UART_RXD_SEL_0_SFT 31 ++#define DAT_UART_RXD_SEL_0_HI 31 ++#define DAT_UART_RXD_SEL_0_SZ 1 ++#define DAT_UART_RXD_SEL_1_MSK 0x00000001 ++#define DAT_UART_RXD_SEL_1_I_MSK 0xfffffffe ++#define DAT_UART_RXD_SEL_1_SFT 0 ++#define DAT_UART_RXD_SEL_1_HI 0 ++#define DAT_UART_RXD_SEL_1_SZ 1 ++#define SPI_DI_SEL_MSK 0x00000002 ++#define SPI_DI_SEL_I_MSK 0xfffffffd ++#define SPI_DI_SEL_SFT 1 ++#define SPI_DI_SEL_HI 1 ++#define SPI_DI_SEL_SZ 1 ++#define IO_PORT_REG_MSK 0x0001ffff ++#define IO_PORT_REG_I_MSK 0xfffe0000 ++#define IO_PORT_REG_SFT 0 ++#define IO_PORT_REG_HI 16 ++#define IO_PORT_REG_SZ 17 ++#define MASK_RX_INT_MSK 0x00000001 ++#define MASK_RX_INT_I_MSK 0xfffffffe ++#define MASK_RX_INT_SFT 0 ++#define MASK_RX_INT_HI 0 ++#define MASK_RX_INT_SZ 1 ++#define MASK_TX_INT_MSK 0x00000002 ++#define MASK_TX_INT_I_MSK 0xfffffffd ++#define MASK_TX_INT_SFT 1 ++#define MASK_TX_INT_HI 1 ++#define MASK_TX_INT_SZ 1 ++#define MASK_SOC_SYSTEM_INT_MSK 0x00000004 ++#define MASK_SOC_SYSTEM_INT_I_MSK 0xfffffffb ++#define MASK_SOC_SYSTEM_INT_SFT 2 ++#define MASK_SOC_SYSTEM_INT_HI 2 ++#define MASK_SOC_SYSTEM_INT_SZ 1 ++#define EDCA0_LOW_THR_INT_MASK_MSK 0x00000008 ++#define EDCA0_LOW_THR_INT_MASK_I_MSK 0xfffffff7 ++#define EDCA0_LOW_THR_INT_MASK_SFT 3 ++#define EDCA0_LOW_THR_INT_MASK_HI 3 ++#define EDCA0_LOW_THR_INT_MASK_SZ 1 ++#define EDCA1_LOW_THR_INT_MASK_MSK 0x00000010 ++#define EDCA1_LOW_THR_INT_MASK_I_MSK 0xffffffef ++#define EDCA1_LOW_THR_INT_MASK_SFT 4 ++#define EDCA1_LOW_THR_INT_MASK_HI 4 ++#define EDCA1_LOW_THR_INT_MASK_SZ 1 ++#define EDCA2_LOW_THR_INT_MASK_MSK 0x00000020 ++#define EDCA2_LOW_THR_INT_MASK_I_MSK 0xffffffdf ++#define EDCA2_LOW_THR_INT_MASK_SFT 5 ++#define EDCA2_LOW_THR_INT_MASK_HI 5 ++#define EDCA2_LOW_THR_INT_MASK_SZ 1 ++#define EDCA3_LOW_THR_INT_MASK_MSK 0x00000040 ++#define EDCA3_LOW_THR_INT_MASK_I_MSK 0xffffffbf ++#define EDCA3_LOW_THR_INT_MASK_SFT 6 ++#define EDCA3_LOW_THR_INT_MASK_HI 6 ++#define EDCA3_LOW_THR_INT_MASK_SZ 1 ++#define TX_LIMIT_INT_MASK_MSK 0x00000080 ++#define TX_LIMIT_INT_MASK_I_MSK 0xffffff7f ++#define TX_LIMIT_INT_MASK_SFT 7 ++#define TX_LIMIT_INT_MASK_HI 7 ++#define TX_LIMIT_INT_MASK_SZ 1 ++#define RX_INT_MSK 0x00000001 ++#define RX_INT_I_MSK 0xfffffffe ++#define RX_INT_SFT 0 ++#define RX_INT_HI 0 ++#define RX_INT_SZ 1 ++#define TX_COMPLETE_INT_MSK 0x00000002 ++#define TX_COMPLETE_INT_I_MSK 0xfffffffd ++#define TX_COMPLETE_INT_SFT 1 ++#define TX_COMPLETE_INT_HI 1 ++#define TX_COMPLETE_INT_SZ 1 ++#define SOC_SYSTEM_INT_STATUS_MSK 0x00000004 ++#define SOC_SYSTEM_INT_STATUS_I_MSK 0xfffffffb ++#define SOC_SYSTEM_INT_STATUS_SFT 2 ++#define SOC_SYSTEM_INT_STATUS_HI 2 ++#define SOC_SYSTEM_INT_STATUS_SZ 1 ++#define EDCA0_LOW_THR_INT_STS_MSK 0x00000008 ++#define EDCA0_LOW_THR_INT_STS_I_MSK 0xfffffff7 ++#define EDCA0_LOW_THR_INT_STS_SFT 3 ++#define EDCA0_LOW_THR_INT_STS_HI 3 ++#define EDCA0_LOW_THR_INT_STS_SZ 1 ++#define EDCA1_LOW_THR_INT_STS_MSK 0x00000010 ++#define EDCA1_LOW_THR_INT_STS_I_MSK 0xffffffef ++#define EDCA1_LOW_THR_INT_STS_SFT 4 ++#define EDCA1_LOW_THR_INT_STS_HI 4 ++#define EDCA1_LOW_THR_INT_STS_SZ 1 ++#define EDCA2_LOW_THR_INT_STS_MSK 0x00000020 ++#define EDCA2_LOW_THR_INT_STS_I_MSK 0xffffffdf ++#define EDCA2_LOW_THR_INT_STS_SFT 5 ++#define EDCA2_LOW_THR_INT_STS_HI 5 ++#define EDCA2_LOW_THR_INT_STS_SZ 1 ++#define EDCA3_LOW_THR_INT_STS_MSK 0x00000040 ++#define EDCA3_LOW_THR_INT_STS_I_MSK 0xffffffbf ++#define EDCA3_LOW_THR_INT_STS_SFT 6 ++#define EDCA3_LOW_THR_INT_STS_HI 6 ++#define EDCA3_LOW_THR_INT_STS_SZ 1 ++#define TX_LIMIT_INT_STS_MSK 0x00000080 ++#define TX_LIMIT_INT_STS_I_MSK 0xffffff7f ++#define TX_LIMIT_INT_STS_SFT 7 ++#define TX_LIMIT_INT_STS_HI 7 ++#define TX_LIMIT_INT_STS_SZ 1 ++#define HOST_TRIGGERED_RX_INT_MSK 0x00000100 ++#define HOST_TRIGGERED_RX_INT_I_MSK 0xfffffeff ++#define HOST_TRIGGERED_RX_INT_SFT 8 ++#define HOST_TRIGGERED_RX_INT_HI 8 ++#define HOST_TRIGGERED_RX_INT_SZ 1 ++#define HOST_TRIGGERED_TX_INT_MSK 0x00000200 ++#define HOST_TRIGGERED_TX_INT_I_MSK 0xfffffdff ++#define HOST_TRIGGERED_TX_INT_SFT 9 ++#define HOST_TRIGGERED_TX_INT_HI 9 ++#define HOST_TRIGGERED_TX_INT_SZ 1 ++#define SOC_TRIGGER_RX_INT_MSK 0x00000400 ++#define SOC_TRIGGER_RX_INT_I_MSK 0xfffffbff ++#define SOC_TRIGGER_RX_INT_SFT 10 ++#define SOC_TRIGGER_RX_INT_HI 10 ++#define SOC_TRIGGER_RX_INT_SZ 1 ++#define SOC_TRIGGER_TX_INT_MSK 0x00000800 ++#define SOC_TRIGGER_TX_INT_I_MSK 0xfffff7ff ++#define SOC_TRIGGER_TX_INT_SFT 11 ++#define SOC_TRIGGER_TX_INT_HI 11 ++#define SOC_TRIGGER_TX_INT_SZ 1 ++#define RDY_FOR_TX_RX_MSK 0x00000001 ++#define RDY_FOR_TX_RX_I_MSK 0xfffffffe ++#define RDY_FOR_TX_RX_SFT 0 ++#define RDY_FOR_TX_RX_HI 0 ++#define RDY_FOR_TX_RX_SZ 1 ++#define RDY_FOR_FW_DOWNLOAD_MSK 0x00000002 ++#define RDY_FOR_FW_DOWNLOAD_I_MSK 0xfffffffd ++#define RDY_FOR_FW_DOWNLOAD_SFT 1 ++#define RDY_FOR_FW_DOWNLOAD_HI 1 ++#define RDY_FOR_FW_DOWNLOAD_SZ 1 ++#define ILLEGAL_CMD_RESP_OPTION_MSK 0x00000004 ++#define ILLEGAL_CMD_RESP_OPTION_I_MSK 0xfffffffb ++#define ILLEGAL_CMD_RESP_OPTION_SFT 2 ++#define ILLEGAL_CMD_RESP_OPTION_HI 2 ++#define ILLEGAL_CMD_RESP_OPTION_SZ 1 ++#define SDIO_TRX_DATA_SEQUENCE_MSK 0x00000008 ++#define SDIO_TRX_DATA_SEQUENCE_I_MSK 0xfffffff7 ++#define SDIO_TRX_DATA_SEQUENCE_SFT 3 ++#define SDIO_TRX_DATA_SEQUENCE_HI 3 ++#define SDIO_TRX_DATA_SEQUENCE_SZ 1 ++#define GPIO_INT_TRIGGER_OPTION_MSK 0x00000010 ++#define GPIO_INT_TRIGGER_OPTION_I_MSK 0xffffffef ++#define GPIO_INT_TRIGGER_OPTION_SFT 4 ++#define GPIO_INT_TRIGGER_OPTION_HI 4 ++#define GPIO_INT_TRIGGER_OPTION_SZ 1 ++#define TRIGGER_FUNCTION_SETTING_MSK 0x00000060 ++#define TRIGGER_FUNCTION_SETTING_I_MSK 0xffffff9f ++#define TRIGGER_FUNCTION_SETTING_SFT 5 ++#define TRIGGER_FUNCTION_SETTING_HI 6 ++#define TRIGGER_FUNCTION_SETTING_SZ 2 ++#define CMD52_ABORT_RESPONSE_MSK 0x00000080 ++#define CMD52_ABORT_RESPONSE_I_MSK 0xffffff7f ++#define CMD52_ABORT_RESPONSE_SFT 7 ++#define CMD52_ABORT_RESPONSE_HI 7 ++#define CMD52_ABORT_RESPONSE_SZ 1 ++#define RX_PACKET_LENGTH_MSK 0x0000ffff ++#define RX_PACKET_LENGTH_I_MSK 0xffff0000 ++#define RX_PACKET_LENGTH_SFT 0 ++#define RX_PACKET_LENGTH_HI 15 ++#define RX_PACKET_LENGTH_SZ 16 ++#define CARD_FW_DL_STATUS_MSK 0x00ff0000 ++#define CARD_FW_DL_STATUS_I_MSK 0xff00ffff ++#define CARD_FW_DL_STATUS_SFT 16 ++#define CARD_FW_DL_STATUS_HI 23 ++#define CARD_FW_DL_STATUS_SZ 8 ++#define TX_RX_LOOP_BACK_TEST_MSK 0x01000000 ++#define TX_RX_LOOP_BACK_TEST_I_MSK 0xfeffffff ++#define TX_RX_LOOP_BACK_TEST_SFT 24 ++#define TX_RX_LOOP_BACK_TEST_HI 24 ++#define TX_RX_LOOP_BACK_TEST_SZ 1 ++#define SDIO_LOOP_BACK_TEST_MSK 0x02000000 ++#define SDIO_LOOP_BACK_TEST_I_MSK 0xfdffffff ++#define SDIO_LOOP_BACK_TEST_SFT 25 ++#define SDIO_LOOP_BACK_TEST_HI 25 ++#define SDIO_LOOP_BACK_TEST_SZ 1 ++#define CMD52_ABORT_ACTIVE_MSK 0x10000000 ++#define CMD52_ABORT_ACTIVE_I_MSK 0xefffffff ++#define CMD52_ABORT_ACTIVE_SFT 28 ++#define CMD52_ABORT_ACTIVE_HI 28 ++#define CMD52_ABORT_ACTIVE_SZ 1 ++#define CMD52_RESET_ACTIVE_MSK 0x20000000 ++#define CMD52_RESET_ACTIVE_I_MSK 0xdfffffff ++#define CMD52_RESET_ACTIVE_SFT 29 ++#define CMD52_RESET_ACTIVE_HI 29 ++#define CMD52_RESET_ACTIVE_SZ 1 ++#define SDIO_PARTIAL_RESET_ACTIVE_MSK 0x40000000 ++#define SDIO_PARTIAL_RESET_ACTIVE_I_MSK 0xbfffffff ++#define SDIO_PARTIAL_RESET_ACTIVE_SFT 30 ++#define SDIO_PARTIAL_RESET_ACTIVE_HI 30 ++#define SDIO_PARTIAL_RESET_ACTIVE_SZ 1 ++#define SDIO_ALL_RESE_ACTIVE_MSK 0x80000000 ++#define SDIO_ALL_RESE_ACTIVE_I_MSK 0x7fffffff ++#define SDIO_ALL_RESE_ACTIVE_SFT 31 ++#define SDIO_ALL_RESE_ACTIVE_HI 31 ++#define SDIO_ALL_RESE_ACTIVE_SZ 1 ++#define RX_PACKET_LENGTH2_MSK 0x0000ffff ++#define RX_PACKET_LENGTH2_I_MSK 0xffff0000 ++#define RX_PACKET_LENGTH2_SFT 0 ++#define RX_PACKET_LENGTH2_HI 15 ++#define RX_PACKET_LENGTH2_SZ 16 ++#define RX_INT1_MSK 0x00010000 ++#define RX_INT1_I_MSK 0xfffeffff ++#define RX_INT1_SFT 16 ++#define RX_INT1_HI 16 ++#define RX_INT1_SZ 1 ++#define TX_DONE_MSK 0x00020000 ++#define TX_DONE_I_MSK 0xfffdffff ++#define TX_DONE_SFT 17 ++#define TX_DONE_HI 17 ++#define TX_DONE_SZ 1 ++#define HCI_TRX_FINISH_MSK 0x00040000 ++#define HCI_TRX_FINISH_I_MSK 0xfffbffff ++#define HCI_TRX_FINISH_SFT 18 ++#define HCI_TRX_FINISH_HI 18 ++#define HCI_TRX_FINISH_SZ 1 ++#define ALLOCATE_STATUS_MSK 0x00080000 ++#define ALLOCATE_STATUS_I_MSK 0xfff7ffff ++#define ALLOCATE_STATUS_SFT 19 ++#define ALLOCATE_STATUS_HI 19 ++#define ALLOCATE_STATUS_SZ 1 ++#define HCI_INPUT_FF_CNT_MSK 0x00f00000 ++#define HCI_INPUT_FF_CNT_I_MSK 0xff0fffff ++#define HCI_INPUT_FF_CNT_SFT 20 ++#define HCI_INPUT_FF_CNT_HI 23 ++#define HCI_INPUT_FF_CNT_SZ 4 ++#define HCI_OUTPUT_FF_CNT_MSK 0x1f000000 ++#define HCI_OUTPUT_FF_CNT_I_MSK 0xe0ffffff ++#define HCI_OUTPUT_FF_CNT_SFT 24 ++#define HCI_OUTPUT_FF_CNT_HI 28 ++#define HCI_OUTPUT_FF_CNT_SZ 5 ++#define AHB_HANG4_MSK 0x20000000 ++#define AHB_HANG4_I_MSK 0xdfffffff ++#define AHB_HANG4_SFT 29 ++#define AHB_HANG4_HI 29 ++#define AHB_HANG4_SZ 1 ++#define HCI_IN_QUE_EMPTY_MSK 0x40000000 ++#define HCI_IN_QUE_EMPTY_I_MSK 0xbfffffff ++#define HCI_IN_QUE_EMPTY_SFT 30 ++#define HCI_IN_QUE_EMPTY_HI 30 ++#define HCI_IN_QUE_EMPTY_SZ 1 ++#define SYSTEM_INT_MSK 0x80000000 ++#define SYSTEM_INT_I_MSK 0x7fffffff ++#define SYSTEM_INT_SFT 31 ++#define SYSTEM_INT_HI 31 ++#define SYSTEM_INT_SZ 1 ++#define CARD_RCA_REG_MSK 0x0000ffff ++#define CARD_RCA_REG_I_MSK 0xffff0000 ++#define CARD_RCA_REG_SFT 0 ++#define CARD_RCA_REG_HI 15 ++#define CARD_RCA_REG_SZ 16 ++#define SDIO_FIFO_WR_THLD_REG_MSK 0x000001ff ++#define SDIO_FIFO_WR_THLD_REG_I_MSK 0xfffffe00 ++#define SDIO_FIFO_WR_THLD_REG_SFT 0 ++#define SDIO_FIFO_WR_THLD_REG_HI 8 ++#define SDIO_FIFO_WR_THLD_REG_SZ 9 ++#define SDIO_FIFO_WR_LIMIT_REG_MSK 0x000001ff ++#define SDIO_FIFO_WR_LIMIT_REG_I_MSK 0xfffffe00 ++#define SDIO_FIFO_WR_LIMIT_REG_SFT 0 ++#define SDIO_FIFO_WR_LIMIT_REG_HI 8 ++#define SDIO_FIFO_WR_LIMIT_REG_SZ 9 ++#define SDIO_TX_DATA_BATCH_SIZE_REG_MSK 0x000001ff ++#define SDIO_TX_DATA_BATCH_SIZE_REG_I_MSK 0xfffffe00 ++#define SDIO_TX_DATA_BATCH_SIZE_REG_SFT 0 ++#define SDIO_TX_DATA_BATCH_SIZE_REG_HI 8 ++#define SDIO_TX_DATA_BATCH_SIZE_REG_SZ 9 ++#define SDIO_THLD_FOR_CMD53RD_REG_MSK 0x000001ff ++#define SDIO_THLD_FOR_CMD53RD_REG_I_MSK 0xfffffe00 ++#define SDIO_THLD_FOR_CMD53RD_REG_SFT 0 ++#define SDIO_THLD_FOR_CMD53RD_REG_HI 8 ++#define SDIO_THLD_FOR_CMD53RD_REG_SZ 9 ++#define SDIO_RX_DATA_BATCH_SIZE_REG_MSK 0x000001ff ++#define SDIO_RX_DATA_BATCH_SIZE_REG_I_MSK 0xfffffe00 ++#define SDIO_RX_DATA_BATCH_SIZE_REG_SFT 0 ++#define SDIO_RX_DATA_BATCH_SIZE_REG_HI 8 ++#define SDIO_RX_DATA_BATCH_SIZE_REG_SZ 9 ++#define START_BYTE_VALUE_MSK 0x000000ff ++#define START_BYTE_VALUE_I_MSK 0xffffff00 ++#define START_BYTE_VALUE_SFT 0 ++#define START_BYTE_VALUE_HI 7 ++#define START_BYTE_VALUE_SZ 8 ++#define END_BYTE_VALUE_MSK 0x0000ff00 ++#define END_BYTE_VALUE_I_MSK 0xffff00ff ++#define END_BYTE_VALUE_SFT 8 ++#define END_BYTE_VALUE_HI 15 ++#define END_BYTE_VALUE_SZ 8 ++#define SDIO_BYTE_MODE_BATCH_SIZE_REG_MSK 0x000000ff ++#define SDIO_BYTE_MODE_BATCH_SIZE_REG_I_MSK 0xffffff00 ++#define SDIO_BYTE_MODE_BATCH_SIZE_REG_SFT 0 ++#define SDIO_BYTE_MODE_BATCH_SIZE_REG_HI 7 ++#define SDIO_BYTE_MODE_BATCH_SIZE_REG_SZ 8 ++#define SDIO_LAST_CMD_INDEX_REG_MSK 0x0000003f ++#define SDIO_LAST_CMD_INDEX_REG_I_MSK 0xffffffc0 ++#define SDIO_LAST_CMD_INDEX_REG_SFT 0 ++#define SDIO_LAST_CMD_INDEX_REG_HI 5 ++#define SDIO_LAST_CMD_INDEX_REG_SZ 6 ++#define SDIO_LAST_CMD_CRC_REG_MSK 0x00007f00 ++#define SDIO_LAST_CMD_CRC_REG_I_MSK 0xffff80ff ++#define SDIO_LAST_CMD_CRC_REG_SFT 8 ++#define SDIO_LAST_CMD_CRC_REG_HI 14 ++#define SDIO_LAST_CMD_CRC_REG_SZ 7 ++#define SDIO_LAST_CMD_ARG_REG_MSK 0xffffffff ++#define SDIO_LAST_CMD_ARG_REG_I_MSK 0x00000000 ++#define SDIO_LAST_CMD_ARG_REG_SFT 0 ++#define SDIO_LAST_CMD_ARG_REG_HI 31 ++#define SDIO_LAST_CMD_ARG_REG_SZ 32 ++#define SDIO_BUS_STATE_REG_MSK 0x0000001f ++#define SDIO_BUS_STATE_REG_I_MSK 0xffffffe0 ++#define SDIO_BUS_STATE_REG_SFT 0 ++#define SDIO_BUS_STATE_REG_HI 4 ++#define SDIO_BUS_STATE_REG_SZ 5 ++#define SDIO_BUSY_LONG_CNT_MSK 0xffff0000 ++#define SDIO_BUSY_LONG_CNT_I_MSK 0x0000ffff ++#define SDIO_BUSY_LONG_CNT_SFT 16 ++#define SDIO_BUSY_LONG_CNT_HI 31 ++#define SDIO_BUSY_LONG_CNT_SZ 16 ++#define SDIO_CARD_STATUS_REG_MSK 0xffffffff ++#define SDIO_CARD_STATUS_REG_I_MSK 0x00000000 ++#define SDIO_CARD_STATUS_REG_SFT 0 ++#define SDIO_CARD_STATUS_REG_HI 31 ++#define SDIO_CARD_STATUS_REG_SZ 32 ++#define R5_RESPONSE_FLAG_MSK 0x000000ff ++#define R5_RESPONSE_FLAG_I_MSK 0xffffff00 ++#define R5_RESPONSE_FLAG_SFT 0 ++#define R5_RESPONSE_FLAG_HI 7 ++#define R5_RESPONSE_FLAG_SZ 8 ++#define RESP_OUT_EDGE_MSK 0x00000100 ++#define RESP_OUT_EDGE_I_MSK 0xfffffeff ++#define RESP_OUT_EDGE_SFT 8 ++#define RESP_OUT_EDGE_HI 8 ++#define RESP_OUT_EDGE_SZ 1 ++#define DAT_OUT_EDGE_MSK 0x00000200 ++#define DAT_OUT_EDGE_I_MSK 0xfffffdff ++#define DAT_OUT_EDGE_SFT 9 ++#define DAT_OUT_EDGE_HI 9 ++#define DAT_OUT_EDGE_SZ 1 ++#define MCU_TO_SDIO_INFO_MASK_MSK 0x00010000 ++#define MCU_TO_SDIO_INFO_MASK_I_MSK 0xfffeffff ++#define MCU_TO_SDIO_INFO_MASK_SFT 16 ++#define MCU_TO_SDIO_INFO_MASK_HI 16 ++#define MCU_TO_SDIO_INFO_MASK_SZ 1 ++#define INT_THROUGH_PIN_MSK 0x00020000 ++#define INT_THROUGH_PIN_I_MSK 0xfffdffff ++#define INT_THROUGH_PIN_SFT 17 ++#define INT_THROUGH_PIN_HI 17 ++#define INT_THROUGH_PIN_SZ 1 ++#define WRITE_DATA_MSK 0x000000ff ++#define WRITE_DATA_I_MSK 0xffffff00 ++#define WRITE_DATA_SFT 0 ++#define WRITE_DATA_HI 7 ++#define WRITE_DATA_SZ 8 ++#define WRITE_ADDRESS_MSK 0x0000ff00 ++#define WRITE_ADDRESS_I_MSK 0xffff00ff ++#define WRITE_ADDRESS_SFT 8 ++#define WRITE_ADDRESS_HI 15 ++#define WRITE_ADDRESS_SZ 8 ++#define READ_DATA_MSK 0x00ff0000 ++#define READ_DATA_I_MSK 0xff00ffff ++#define READ_DATA_SFT 16 ++#define READ_DATA_HI 23 ++#define READ_DATA_SZ 8 ++#define READ_ADDRESS_MSK 0xff000000 ++#define READ_ADDRESS_I_MSK 0x00ffffff ++#define READ_ADDRESS_SFT 24 ++#define READ_ADDRESS_HI 31 ++#define READ_ADDRESS_SZ 8 ++#define FN1_DMA_START_ADDR_REG_MSK 0xffffffff ++#define FN1_DMA_START_ADDR_REG_I_MSK 0x00000000 ++#define FN1_DMA_START_ADDR_REG_SFT 0 ++#define FN1_DMA_START_ADDR_REG_HI 31 ++#define FN1_DMA_START_ADDR_REG_SZ 32 ++#define SDIO_TO_MCU_INFO_MSK 0x000000ff ++#define SDIO_TO_MCU_INFO_I_MSK 0xffffff00 ++#define SDIO_TO_MCU_INFO_SFT 0 ++#define SDIO_TO_MCU_INFO_HI 7 ++#define SDIO_TO_MCU_INFO_SZ 8 ++#define SDIO_PARTIAL_RESET_MSK 0x00000100 ++#define SDIO_PARTIAL_RESET_I_MSK 0xfffffeff ++#define SDIO_PARTIAL_RESET_SFT 8 ++#define SDIO_PARTIAL_RESET_HI 8 ++#define SDIO_PARTIAL_RESET_SZ 1 ++#define SDIO_ALL_RESET_MSK 0x00000200 ++#define SDIO_ALL_RESET_I_MSK 0xfffffdff ++#define SDIO_ALL_RESET_SFT 9 ++#define SDIO_ALL_RESET_HI 9 ++#define SDIO_ALL_RESET_SZ 1 ++#define PERI_MAC_ALL_RESET_MSK 0x00000400 ++#define PERI_MAC_ALL_RESET_I_MSK 0xfffffbff ++#define PERI_MAC_ALL_RESET_SFT 10 ++#define PERI_MAC_ALL_RESET_HI 10 ++#define PERI_MAC_ALL_RESET_SZ 1 ++#define MAC_ALL_RESET_MSK 0x00000800 ++#define MAC_ALL_RESET_I_MSK 0xfffff7ff ++#define MAC_ALL_RESET_SFT 11 ++#define MAC_ALL_RESET_HI 11 ++#define MAC_ALL_RESET_SZ 1 ++#define AHB_BRIDGE_RESET_MSK 0x00001000 ++#define AHB_BRIDGE_RESET_I_MSK 0xffffefff ++#define AHB_BRIDGE_RESET_SFT 12 ++#define AHB_BRIDGE_RESET_HI 12 ++#define AHB_BRIDGE_RESET_SZ 1 ++#define IO_REG_PORT_REG_MSK 0x0001ffff ++#define IO_REG_PORT_REG_I_MSK 0xfffe0000 ++#define IO_REG_PORT_REG_SFT 0 ++#define IO_REG_PORT_REG_HI 16 ++#define IO_REG_PORT_REG_SZ 17 ++#define SDIO_FIFO_EMPTY_CNT_MSK 0x0000ffff ++#define SDIO_FIFO_EMPTY_CNT_I_MSK 0xffff0000 ++#define SDIO_FIFO_EMPTY_CNT_SFT 0 ++#define SDIO_FIFO_EMPTY_CNT_HI 15 ++#define SDIO_FIFO_EMPTY_CNT_SZ 16 ++#define SDIO_FIFO_FULL_CNT_MSK 0xffff0000 ++#define SDIO_FIFO_FULL_CNT_I_MSK 0x0000ffff ++#define SDIO_FIFO_FULL_CNT_SFT 16 ++#define SDIO_FIFO_FULL_CNT_HI 31 ++#define SDIO_FIFO_FULL_CNT_SZ 16 ++#define SDIO_CRC7_ERROR_CNT_MSK 0x0000ffff ++#define SDIO_CRC7_ERROR_CNT_I_MSK 0xffff0000 ++#define SDIO_CRC7_ERROR_CNT_SFT 0 ++#define SDIO_CRC7_ERROR_CNT_HI 15 ++#define SDIO_CRC7_ERROR_CNT_SZ 16 ++#define SDIO_CRC16_ERROR_CNT_MSK 0xffff0000 ++#define SDIO_CRC16_ERROR_CNT_I_MSK 0x0000ffff ++#define SDIO_CRC16_ERROR_CNT_SFT 16 ++#define SDIO_CRC16_ERROR_CNT_HI 31 ++#define SDIO_CRC16_ERROR_CNT_SZ 16 ++#define SDIO_RD_BLOCK_CNT_MSK 0x000001ff ++#define SDIO_RD_BLOCK_CNT_I_MSK 0xfffffe00 ++#define SDIO_RD_BLOCK_CNT_SFT 0 ++#define SDIO_RD_BLOCK_CNT_HI 8 ++#define SDIO_RD_BLOCK_CNT_SZ 9 ++#define SDIO_WR_BLOCK_CNT_MSK 0x01ff0000 ++#define SDIO_WR_BLOCK_CNT_I_MSK 0xfe00ffff ++#define SDIO_WR_BLOCK_CNT_SFT 16 ++#define SDIO_WR_BLOCK_CNT_HI 24 ++#define SDIO_WR_BLOCK_CNT_SZ 9 ++#define CMD52_RD_ABORT_CNT_MSK 0x000f0000 ++#define CMD52_RD_ABORT_CNT_I_MSK 0xfff0ffff ++#define CMD52_RD_ABORT_CNT_SFT 16 ++#define CMD52_RD_ABORT_CNT_HI 19 ++#define CMD52_RD_ABORT_CNT_SZ 4 ++#define CMD52_WR_ABORT_CNT_MSK 0x00f00000 ++#define CMD52_WR_ABORT_CNT_I_MSK 0xff0fffff ++#define CMD52_WR_ABORT_CNT_SFT 20 ++#define CMD52_WR_ABORT_CNT_HI 23 ++#define CMD52_WR_ABORT_CNT_SZ 4 ++#define SDIO_FIFO_WR_PTR_REG_MSK 0x000000ff ++#define SDIO_FIFO_WR_PTR_REG_I_MSK 0xffffff00 ++#define SDIO_FIFO_WR_PTR_REG_SFT 0 ++#define SDIO_FIFO_WR_PTR_REG_HI 7 ++#define SDIO_FIFO_WR_PTR_REG_SZ 8 ++#define SDIO_FIFO_RD_PTR_REG_MSK 0x0000ff00 ++#define SDIO_FIFO_RD_PTR_REG_I_MSK 0xffff00ff ++#define SDIO_FIFO_RD_PTR_REG_SFT 8 ++#define SDIO_FIFO_RD_PTR_REG_HI 15 ++#define SDIO_FIFO_RD_PTR_REG_SZ 8 ++#define SDIO_READ_DATA_CTRL_MSK 0x00010000 ++#define SDIO_READ_DATA_CTRL_I_MSK 0xfffeffff ++#define SDIO_READ_DATA_CTRL_SFT 16 ++#define SDIO_READ_DATA_CTRL_HI 16 ++#define SDIO_READ_DATA_CTRL_SZ 1 ++#define TX_SIZE_BEFORE_SHIFT_MSK 0x000000ff ++#define TX_SIZE_BEFORE_SHIFT_I_MSK 0xffffff00 ++#define TX_SIZE_BEFORE_SHIFT_SFT 0 ++#define TX_SIZE_BEFORE_SHIFT_HI 7 ++#define TX_SIZE_BEFORE_SHIFT_SZ 8 ++#define TX_SIZE_SHIFT_BITS_MSK 0x00000700 ++#define TX_SIZE_SHIFT_BITS_I_MSK 0xfffff8ff ++#define TX_SIZE_SHIFT_BITS_SFT 8 ++#define TX_SIZE_SHIFT_BITS_HI 10 ++#define TX_SIZE_SHIFT_BITS_SZ 3 ++#define SDIO_TX_ALLOC_STATE_MSK 0x00001000 ++#define SDIO_TX_ALLOC_STATE_I_MSK 0xffffefff ++#define SDIO_TX_ALLOC_STATE_SFT 12 ++#define SDIO_TX_ALLOC_STATE_HI 12 ++#define SDIO_TX_ALLOC_STATE_SZ 1 ++#define ALLOCATE_STATUS2_MSK 0x00010000 ++#define ALLOCATE_STATUS2_I_MSK 0xfffeffff ++#define ALLOCATE_STATUS2_SFT 16 ++#define ALLOCATE_STATUS2_HI 16 ++#define ALLOCATE_STATUS2_SZ 1 ++#define NO_ALLOCATE_SEND_ERROR_MSK 0x00020000 ++#define NO_ALLOCATE_SEND_ERROR_I_MSK 0xfffdffff ++#define NO_ALLOCATE_SEND_ERROR_SFT 17 ++#define NO_ALLOCATE_SEND_ERROR_HI 17 ++#define NO_ALLOCATE_SEND_ERROR_SZ 1 ++#define DOUBLE_ALLOCATE_ERROR_MSK 0x00040000 ++#define DOUBLE_ALLOCATE_ERROR_I_MSK 0xfffbffff ++#define DOUBLE_ALLOCATE_ERROR_SFT 18 ++#define DOUBLE_ALLOCATE_ERROR_HI 18 ++#define DOUBLE_ALLOCATE_ERROR_SZ 1 ++#define TX_DONE_STATUS_MSK 0x00080000 ++#define TX_DONE_STATUS_I_MSK 0xfff7ffff ++#define TX_DONE_STATUS_SFT 19 ++#define TX_DONE_STATUS_HI 19 ++#define TX_DONE_STATUS_SZ 1 ++#define AHB_HANG2_MSK 0x00100000 ++#define AHB_HANG2_I_MSK 0xffefffff ++#define AHB_HANG2_SFT 20 ++#define AHB_HANG2_HI 20 ++#define AHB_HANG2_SZ 1 ++#define HCI_TRX_FINISH2_MSK 0x00200000 ++#define HCI_TRX_FINISH2_I_MSK 0xffdfffff ++#define HCI_TRX_FINISH2_SFT 21 ++#define HCI_TRX_FINISH2_HI 21 ++#define HCI_TRX_FINISH2_SZ 1 ++#define INTR_RX_MSK 0x00400000 ++#define INTR_RX_I_MSK 0xffbfffff ++#define INTR_RX_SFT 22 ++#define INTR_RX_HI 22 ++#define INTR_RX_SZ 1 ++#define HCI_INPUT_QUEUE_FULL_MSK 0x00800000 ++#define HCI_INPUT_QUEUE_FULL_I_MSK 0xff7fffff ++#define HCI_INPUT_QUEUE_FULL_SFT 23 ++#define HCI_INPUT_QUEUE_FULL_HI 23 ++#define HCI_INPUT_QUEUE_FULL_SZ 1 ++#define ALLOCATESTATUS_MSK 0x00000001 ++#define ALLOCATESTATUS_I_MSK 0xfffffffe ++#define ALLOCATESTATUS_SFT 0 ++#define ALLOCATESTATUS_HI 0 ++#define ALLOCATESTATUS_SZ 1 ++#define HCI_TRX_FINISH3_MSK 0x00000002 ++#define HCI_TRX_FINISH3_I_MSK 0xfffffffd ++#define HCI_TRX_FINISH3_SFT 1 ++#define HCI_TRX_FINISH3_HI 1 ++#define HCI_TRX_FINISH3_SZ 1 ++#define HCI_IN_QUE_EMPTY2_MSK 0x00000004 ++#define HCI_IN_QUE_EMPTY2_I_MSK 0xfffffffb ++#define HCI_IN_QUE_EMPTY2_SFT 2 ++#define HCI_IN_QUE_EMPTY2_HI 2 ++#define HCI_IN_QUE_EMPTY2_SZ 1 ++#define MTX_MNG_UPTHOLD_INT_MSK 0x00000008 ++#define MTX_MNG_UPTHOLD_INT_I_MSK 0xfffffff7 ++#define MTX_MNG_UPTHOLD_INT_SFT 3 ++#define MTX_MNG_UPTHOLD_INT_HI 3 ++#define MTX_MNG_UPTHOLD_INT_SZ 1 ++#define EDCA0_UPTHOLD_INT_MSK 0x00000010 ++#define EDCA0_UPTHOLD_INT_I_MSK 0xffffffef ++#define EDCA0_UPTHOLD_INT_SFT 4 ++#define EDCA0_UPTHOLD_INT_HI 4 ++#define EDCA0_UPTHOLD_INT_SZ 1 ++#define EDCA1_UPTHOLD_INT_MSK 0x00000020 ++#define EDCA1_UPTHOLD_INT_I_MSK 0xffffffdf ++#define EDCA1_UPTHOLD_INT_SFT 5 ++#define EDCA1_UPTHOLD_INT_HI 5 ++#define EDCA1_UPTHOLD_INT_SZ 1 ++#define EDCA2_UPTHOLD_INT_MSK 0x00000040 ++#define EDCA2_UPTHOLD_INT_I_MSK 0xffffffbf ++#define EDCA2_UPTHOLD_INT_SFT 6 ++#define EDCA2_UPTHOLD_INT_HI 6 ++#define EDCA2_UPTHOLD_INT_SZ 1 ++#define EDCA3_UPTHOLD_INT_MSK 0x00000080 ++#define EDCA3_UPTHOLD_INT_I_MSK 0xffffff7f ++#define EDCA3_UPTHOLD_INT_SFT 7 ++#define EDCA3_UPTHOLD_INT_HI 7 ++#define EDCA3_UPTHOLD_INT_SZ 1 ++#define TX_PAGE_REMAIN2_MSK 0x0000ff00 ++#define TX_PAGE_REMAIN2_I_MSK 0xffff00ff ++#define TX_PAGE_REMAIN2_SFT 8 ++#define TX_PAGE_REMAIN2_HI 15 ++#define TX_PAGE_REMAIN2_SZ 8 ++#define TX_ID_REMAIN3_MSK 0x007f0000 ++#define TX_ID_REMAIN3_I_MSK 0xff80ffff ++#define TX_ID_REMAIN3_SFT 16 ++#define TX_ID_REMAIN3_HI 22 ++#define TX_ID_REMAIN3_SZ 7 ++#define HCI_OUTPUT_FF_CNT_0_MSK 0x00800000 ++#define HCI_OUTPUT_FF_CNT_0_I_MSK 0xff7fffff ++#define HCI_OUTPUT_FF_CNT_0_SFT 23 ++#define HCI_OUTPUT_FF_CNT_0_HI 23 ++#define HCI_OUTPUT_FF_CNT_0_SZ 1 ++#define HCI_OUTPUT_FF_CNT2_MSK 0x0f000000 ++#define HCI_OUTPUT_FF_CNT2_I_MSK 0xf0ffffff ++#define HCI_OUTPUT_FF_CNT2_SFT 24 ++#define HCI_OUTPUT_FF_CNT2_HI 27 ++#define HCI_OUTPUT_FF_CNT2_SZ 4 ++#define HCI_INPUT_FF_CNT2_MSK 0xf0000000 ++#define HCI_INPUT_FF_CNT2_I_MSK 0x0fffffff ++#define HCI_INPUT_FF_CNT2_SFT 28 ++#define HCI_INPUT_FF_CNT2_HI 31 ++#define HCI_INPUT_FF_CNT2_SZ 4 ++#define F1_BLOCK_SIZE_0_REG_MSK 0x00000fff ++#define F1_BLOCK_SIZE_0_REG_I_MSK 0xfffff000 ++#define F1_BLOCK_SIZE_0_REG_SFT 0 ++#define F1_BLOCK_SIZE_0_REG_HI 11 ++#define F1_BLOCK_SIZE_0_REG_SZ 12 ++#define START_BYTE_VALUE2_MSK 0x000000ff ++#define START_BYTE_VALUE2_I_MSK 0xffffff00 ++#define START_BYTE_VALUE2_SFT 0 ++#define START_BYTE_VALUE2_HI 7 ++#define START_BYTE_VALUE2_SZ 8 ++#define COMMAND_COUNTER_MSK 0x0000ff00 ++#define COMMAND_COUNTER_I_MSK 0xffff00ff ++#define COMMAND_COUNTER_SFT 8 ++#define COMMAND_COUNTER_HI 15 ++#define COMMAND_COUNTER_SZ 8 ++#define CMD_LOG_PART1_MSK 0xffff0000 ++#define CMD_LOG_PART1_I_MSK 0x0000ffff ++#define CMD_LOG_PART1_SFT 16 ++#define CMD_LOG_PART1_HI 31 ++#define CMD_LOG_PART1_SZ 16 ++#define CMD_LOG_PART2_MSK 0x00ffffff ++#define CMD_LOG_PART2_I_MSK 0xff000000 ++#define CMD_LOG_PART2_SFT 0 ++#define CMD_LOG_PART2_HI 23 ++#define CMD_LOG_PART2_SZ 24 ++#define END_BYTE_VALUE2_MSK 0xff000000 ++#define END_BYTE_VALUE2_I_MSK 0x00ffffff ++#define END_BYTE_VALUE2_SFT 24 ++#define END_BYTE_VALUE2_HI 31 ++#define END_BYTE_VALUE2_SZ 8 ++#define RX_PACKET_LENGTH3_MSK 0x0000ffff ++#define RX_PACKET_LENGTH3_I_MSK 0xffff0000 ++#define RX_PACKET_LENGTH3_SFT 0 ++#define RX_PACKET_LENGTH3_HI 15 ++#define RX_PACKET_LENGTH3_SZ 16 ++#define RX_INT3_MSK 0x00010000 ++#define RX_INT3_I_MSK 0xfffeffff ++#define RX_INT3_SFT 16 ++#define RX_INT3_HI 16 ++#define RX_INT3_SZ 1 ++#define TX_ID_REMAIN2_MSK 0x00fe0000 ++#define TX_ID_REMAIN2_I_MSK 0xff01ffff ++#define TX_ID_REMAIN2_SFT 17 ++#define TX_ID_REMAIN2_HI 23 ++#define TX_ID_REMAIN2_SZ 7 ++#define TX_PAGE_REMAIN3_MSK 0xff000000 ++#define TX_PAGE_REMAIN3_I_MSK 0x00ffffff ++#define TX_PAGE_REMAIN3_SFT 24 ++#define TX_PAGE_REMAIN3_HI 31 ++#define TX_PAGE_REMAIN3_SZ 8 ++#define CCCR_00H_REG_MSK 0x000000ff ++#define CCCR_00H_REG_I_MSK 0xffffff00 ++#define CCCR_00H_REG_SFT 0 ++#define CCCR_00H_REG_HI 7 ++#define CCCR_00H_REG_SZ 8 ++#define CCCR_02H_REG_MSK 0x00ff0000 ++#define CCCR_02H_REG_I_MSK 0xff00ffff ++#define CCCR_02H_REG_SFT 16 ++#define CCCR_02H_REG_HI 23 ++#define CCCR_02H_REG_SZ 8 ++#define CCCR_03H_REG_MSK 0xff000000 ++#define CCCR_03H_REG_I_MSK 0x00ffffff ++#define CCCR_03H_REG_SFT 24 ++#define CCCR_03H_REG_HI 31 ++#define CCCR_03H_REG_SZ 8 ++#define CCCR_04H_REG_MSK 0x000000ff ++#define CCCR_04H_REG_I_MSK 0xffffff00 ++#define CCCR_04H_REG_SFT 0 ++#define CCCR_04H_REG_HI 7 ++#define CCCR_04H_REG_SZ 8 ++#define CCCR_05H_REG_MSK 0x0000ff00 ++#define CCCR_05H_REG_I_MSK 0xffff00ff ++#define CCCR_05H_REG_SFT 8 ++#define CCCR_05H_REG_HI 15 ++#define CCCR_05H_REG_SZ 8 ++#define CCCR_06H_REG_MSK 0x000f0000 ++#define CCCR_06H_REG_I_MSK 0xfff0ffff ++#define CCCR_06H_REG_SFT 16 ++#define CCCR_06H_REG_HI 19 ++#define CCCR_06H_REG_SZ 4 ++#define CCCR_07H_REG_MSK 0xff000000 ++#define CCCR_07H_REG_I_MSK 0x00ffffff ++#define CCCR_07H_REG_SFT 24 ++#define CCCR_07H_REG_HI 31 ++#define CCCR_07H_REG_SZ 8 ++#define SUPPORT_DIRECT_COMMAND_SDIO_MSK 0x00000001 ++#define SUPPORT_DIRECT_COMMAND_SDIO_I_MSK 0xfffffffe ++#define SUPPORT_DIRECT_COMMAND_SDIO_SFT 0 ++#define SUPPORT_DIRECT_COMMAND_SDIO_HI 0 ++#define SUPPORT_DIRECT_COMMAND_SDIO_SZ 1 ++#define SUPPORT_MULTIPLE_BLOCK_TRANSFER_MSK 0x00000002 ++#define SUPPORT_MULTIPLE_BLOCK_TRANSFER_I_MSK 0xfffffffd ++#define SUPPORT_MULTIPLE_BLOCK_TRANSFER_SFT 1 ++#define SUPPORT_MULTIPLE_BLOCK_TRANSFER_HI 1 ++#define SUPPORT_MULTIPLE_BLOCK_TRANSFER_SZ 1 ++#define SUPPORT_READ_WAIT_MSK 0x00000004 ++#define SUPPORT_READ_WAIT_I_MSK 0xfffffffb ++#define SUPPORT_READ_WAIT_SFT 2 ++#define SUPPORT_READ_WAIT_HI 2 ++#define SUPPORT_READ_WAIT_SZ 1 ++#define SUPPORT_BUS_CONTROL_MSK 0x00000008 ++#define SUPPORT_BUS_CONTROL_I_MSK 0xfffffff7 ++#define SUPPORT_BUS_CONTROL_SFT 3 ++#define SUPPORT_BUS_CONTROL_HI 3 ++#define SUPPORT_BUS_CONTROL_SZ 1 ++#define SUPPORT_BLOCK_GAP_INTERRUPT_MSK 0x00000010 ++#define SUPPORT_BLOCK_GAP_INTERRUPT_I_MSK 0xffffffef ++#define SUPPORT_BLOCK_GAP_INTERRUPT_SFT 4 ++#define SUPPORT_BLOCK_GAP_INTERRUPT_HI 4 ++#define SUPPORT_BLOCK_GAP_INTERRUPT_SZ 1 ++#define ENABLE_BLOCK_GAP_INTERRUPT_MSK 0x00000020 ++#define ENABLE_BLOCK_GAP_INTERRUPT_I_MSK 0xffffffdf ++#define ENABLE_BLOCK_GAP_INTERRUPT_SFT 5 ++#define ENABLE_BLOCK_GAP_INTERRUPT_HI 5 ++#define ENABLE_BLOCK_GAP_INTERRUPT_SZ 1 ++#define LOW_SPEED_CARD_MSK 0x00000040 ++#define LOW_SPEED_CARD_I_MSK 0xffffffbf ++#define LOW_SPEED_CARD_SFT 6 ++#define LOW_SPEED_CARD_HI 6 ++#define LOW_SPEED_CARD_SZ 1 ++#define LOW_SPEED_CARD_4BIT_MSK 0x00000080 ++#define LOW_SPEED_CARD_4BIT_I_MSK 0xffffff7f ++#define LOW_SPEED_CARD_4BIT_SFT 7 ++#define LOW_SPEED_CARD_4BIT_HI 7 ++#define LOW_SPEED_CARD_4BIT_SZ 1 ++#define COMMON_CIS_PONTER_MSK 0x01ffff00 ++#define COMMON_CIS_PONTER_I_MSK 0xfe0000ff ++#define COMMON_CIS_PONTER_SFT 8 ++#define COMMON_CIS_PONTER_HI 24 ++#define COMMON_CIS_PONTER_SZ 17 ++#define SUPPORT_HIGH_SPEED_MSK 0x01000000 ++#define SUPPORT_HIGH_SPEED_I_MSK 0xfeffffff ++#define SUPPORT_HIGH_SPEED_SFT 24 ++#define SUPPORT_HIGH_SPEED_HI 24 ++#define SUPPORT_HIGH_SPEED_SZ 1 ++#define BSS_MSK 0x0e000000 ++#define BSS_I_MSK 0xf1ffffff ++#define BSS_SFT 25 ++#define BSS_HI 27 ++#define BSS_SZ 3 ++#define FBR_100H_REG_MSK 0x0000000f ++#define FBR_100H_REG_I_MSK 0xfffffff0 ++#define FBR_100H_REG_SFT 0 ++#define FBR_100H_REG_HI 3 ++#define FBR_100H_REG_SZ 4 ++#define CSASUPPORT_MSK 0x00000040 ++#define CSASUPPORT_I_MSK 0xffffffbf ++#define CSASUPPORT_SFT 6 ++#define CSASUPPORT_HI 6 ++#define CSASUPPORT_SZ 1 ++#define ENABLECSA_MSK 0x00000080 ++#define ENABLECSA_I_MSK 0xffffff7f ++#define ENABLECSA_SFT 7 ++#define ENABLECSA_HI 7 ++#define ENABLECSA_SZ 1 ++#define FBR_101H_REG_MSK 0x0000ff00 ++#define FBR_101H_REG_I_MSK 0xffff00ff ++#define FBR_101H_REG_SFT 8 ++#define FBR_101H_REG_HI 15 ++#define FBR_101H_REG_SZ 8 ++#define FBR_109H_REG_MSK 0x01ffff00 ++#define FBR_109H_REG_I_MSK 0xfe0000ff ++#define FBR_109H_REG_SFT 8 ++#define FBR_109H_REG_HI 24 ++#define FBR_109H_REG_SZ 17 ++#define F0_CIS_CONTENT_REG_31_0_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_31_0_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_31_0_SFT 0 ++#define F0_CIS_CONTENT_REG_31_0_HI 31 ++#define F0_CIS_CONTENT_REG_31_0_SZ 32 ++#define F0_CIS_CONTENT_REG_63_32_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_63_32_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_63_32_SFT 0 ++#define F0_CIS_CONTENT_REG_63_32_HI 31 ++#define F0_CIS_CONTENT_REG_63_32_SZ 32 ++#define F0_CIS_CONTENT_REG_95_64_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_95_64_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_95_64_SFT 0 ++#define F0_CIS_CONTENT_REG_95_64_HI 31 ++#define F0_CIS_CONTENT_REG_95_64_SZ 32 ++#define F0_CIS_CONTENT_REG_127_96_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_127_96_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_127_96_SFT 0 ++#define F0_CIS_CONTENT_REG_127_96_HI 31 ++#define F0_CIS_CONTENT_REG_127_96_SZ 32 ++#define F0_CIS_CONTENT_REG_159_128_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_159_128_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_159_128_SFT 0 ++#define F0_CIS_CONTENT_REG_159_128_HI 31 ++#define F0_CIS_CONTENT_REG_159_128_SZ 32 ++#define F0_CIS_CONTENT_REG_191_160_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_191_160_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_191_160_SFT 0 ++#define F0_CIS_CONTENT_REG_191_160_HI 31 ++#define F0_CIS_CONTENT_REG_191_160_SZ 32 ++#define F0_CIS_CONTENT_REG_223_192_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_223_192_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_223_192_SFT 0 ++#define F0_CIS_CONTENT_REG_223_192_HI 31 ++#define F0_CIS_CONTENT_REG_223_192_SZ 32 ++#define F0_CIS_CONTENT_REG_255_224_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_255_224_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_255_224_SFT 0 ++#define F0_CIS_CONTENT_REG_255_224_HI 31 ++#define F0_CIS_CONTENT_REG_255_224_SZ 32 ++#define F0_CIS_CONTENT_REG_287_256_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_287_256_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_287_256_SFT 0 ++#define F0_CIS_CONTENT_REG_287_256_HI 31 ++#define F0_CIS_CONTENT_REG_287_256_SZ 32 ++#define F0_CIS_CONTENT_REG_319_288_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_319_288_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_319_288_SFT 0 ++#define F0_CIS_CONTENT_REG_319_288_HI 31 ++#define F0_CIS_CONTENT_REG_319_288_SZ 32 ++#define F0_CIS_CONTENT_REG_351_320_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_351_320_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_351_320_SFT 0 ++#define F0_CIS_CONTENT_REG_351_320_HI 31 ++#define F0_CIS_CONTENT_REG_351_320_SZ 32 ++#define F0_CIS_CONTENT_REG_383_352_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_383_352_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_383_352_SFT 0 ++#define F0_CIS_CONTENT_REG_383_352_HI 31 ++#define F0_CIS_CONTENT_REG_383_352_SZ 32 ++#define F0_CIS_CONTENT_REG_415_384_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_415_384_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_415_384_SFT 0 ++#define F0_CIS_CONTENT_REG_415_384_HI 31 ++#define F0_CIS_CONTENT_REG_415_384_SZ 32 ++#define F0_CIS_CONTENT_REG_447_416_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_447_416_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_447_416_SFT 0 ++#define F0_CIS_CONTENT_REG_447_416_HI 31 ++#define F0_CIS_CONTENT_REG_447_416_SZ 32 ++#define F0_CIS_CONTENT_REG_479_448_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_479_448_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_479_448_SFT 0 ++#define F0_CIS_CONTENT_REG_479_448_HI 31 ++#define F0_CIS_CONTENT_REG_479_448_SZ 32 ++#define F0_CIS_CONTENT_REG_511_480_MSK 0xffffffff ++#define F0_CIS_CONTENT_REG_511_480_I_MSK 0x00000000 ++#define F0_CIS_CONTENT_REG_511_480_SFT 0 ++#define F0_CIS_CONTENT_REG_511_480_HI 31 ++#define F0_CIS_CONTENT_REG_511_480_SZ 32 ++#define F1_CIS_CONTENT_REG_31_0_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_31_0_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_31_0_SFT 0 ++#define F1_CIS_CONTENT_REG_31_0_HI 31 ++#define F1_CIS_CONTENT_REG_31_0_SZ 32 ++#define F1_CIS_CONTENT_REG_63_32_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_63_32_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_63_32_SFT 0 ++#define F1_CIS_CONTENT_REG_63_32_HI 31 ++#define F1_CIS_CONTENT_REG_63_32_SZ 32 ++#define F1_CIS_CONTENT_REG_95_64_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_95_64_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_95_64_SFT 0 ++#define F1_CIS_CONTENT_REG_95_64_HI 31 ++#define F1_CIS_CONTENT_REG_95_64_SZ 32 ++#define F1_CIS_CONTENT_REG_127_96_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_127_96_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_127_96_SFT 0 ++#define F1_CIS_CONTENT_REG_127_96_HI 31 ++#define F1_CIS_CONTENT_REG_127_96_SZ 32 ++#define F1_CIS_CONTENT_REG_159_128_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_159_128_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_159_128_SFT 0 ++#define F1_CIS_CONTENT_REG_159_128_HI 31 ++#define F1_CIS_CONTENT_REG_159_128_SZ 32 ++#define F1_CIS_CONTENT_REG_191_160_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_191_160_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_191_160_SFT 0 ++#define F1_CIS_CONTENT_REG_191_160_HI 31 ++#define F1_CIS_CONTENT_REG_191_160_SZ 32 ++#define F1_CIS_CONTENT_REG_223_192_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_223_192_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_223_192_SFT 0 ++#define F1_CIS_CONTENT_REG_223_192_HI 31 ++#define F1_CIS_CONTENT_REG_223_192_SZ 32 ++#define F1_CIS_CONTENT_REG_255_224_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_255_224_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_255_224_SFT 0 ++#define F1_CIS_CONTENT_REG_255_224_HI 31 ++#define F1_CIS_CONTENT_REG_255_224_SZ 32 ++#define F1_CIS_CONTENT_REG_287_256_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_287_256_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_287_256_SFT 0 ++#define F1_CIS_CONTENT_REG_287_256_HI 31 ++#define F1_CIS_CONTENT_REG_287_256_SZ 32 ++#define F1_CIS_CONTENT_REG_319_288_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_319_288_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_319_288_SFT 0 ++#define F1_CIS_CONTENT_REG_319_288_HI 31 ++#define F1_CIS_CONTENT_REG_319_288_SZ 32 ++#define F1_CIS_CONTENT_REG_351_320_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_351_320_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_351_320_SFT 0 ++#define F1_CIS_CONTENT_REG_351_320_HI 31 ++#define F1_CIS_CONTENT_REG_351_320_SZ 32 ++#define F1_CIS_CONTENT_REG_383_352_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_383_352_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_383_352_SFT 0 ++#define F1_CIS_CONTENT_REG_383_352_HI 31 ++#define F1_CIS_CONTENT_REG_383_352_SZ 32 ++#define F1_CIS_CONTENT_REG_415_384_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_415_384_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_415_384_SFT 0 ++#define F1_CIS_CONTENT_REG_415_384_HI 31 ++#define F1_CIS_CONTENT_REG_415_384_SZ 32 ++#define F1_CIS_CONTENT_REG_447_416_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_447_416_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_447_416_SFT 0 ++#define F1_CIS_CONTENT_REG_447_416_HI 31 ++#define F1_CIS_CONTENT_REG_447_416_SZ 32 ++#define F1_CIS_CONTENT_REG_479_448_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_479_448_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_479_448_SFT 0 ++#define F1_CIS_CONTENT_REG_479_448_HI 31 ++#define F1_CIS_CONTENT_REG_479_448_SZ 32 ++#define F1_CIS_CONTENT_REG_511_480_MSK 0xffffffff ++#define F1_CIS_CONTENT_REG_511_480_I_MSK 0x00000000 ++#define F1_CIS_CONTENT_REG_511_480_SFT 0 ++#define F1_CIS_CONTENT_REG_511_480_HI 31 ++#define F1_CIS_CONTENT_REG_511_480_SZ 32 ++#define SPI_MODE_MSK 0xffffffff ++#define SPI_MODE_I_MSK 0x00000000 ++#define SPI_MODE_SFT 0 ++#define SPI_MODE_HI 31 ++#define SPI_MODE_SZ 32 ++#define RX_QUOTA_MSK 0x0000ffff ++#define RX_QUOTA_I_MSK 0xffff0000 ++#define RX_QUOTA_SFT 0 ++#define RX_QUOTA_HI 15 ++#define RX_QUOTA_SZ 16 ++#define CONDI_NUM_MSK 0x000000ff ++#define CONDI_NUM_I_MSK 0xffffff00 ++#define CONDI_NUM_SFT 0 ++#define CONDI_NUM_HI 7 ++#define CONDI_NUM_SZ 8 ++#define HOST_PATH_MSK 0x00000001 ++#define HOST_PATH_I_MSK 0xfffffffe ++#define HOST_PATH_SFT 0 ++#define HOST_PATH_HI 0 ++#define HOST_PATH_SZ 1 ++#define TX_SEG_MSK 0xffffffff ++#define TX_SEG_I_MSK 0x00000000 ++#define TX_SEG_SFT 0 ++#define TX_SEG_HI 31 ++#define TX_SEG_SZ 32 ++#define BRST_MODE_MSK 0x00000001 ++#define BRST_MODE_I_MSK 0xfffffffe ++#define BRST_MODE_SFT 0 ++#define BRST_MODE_HI 0 ++#define BRST_MODE_SZ 1 ++#define CLK_WIDTH_MSK 0x0000ffff ++#define CLK_WIDTH_I_MSK 0xffff0000 ++#define CLK_WIDTH_SFT 0 ++#define CLK_WIDTH_HI 15 ++#define CLK_WIDTH_SZ 16 ++#define CSN_INTER_MSK 0xffff0000 ++#define CSN_INTER_I_MSK 0x0000ffff ++#define CSN_INTER_SFT 16 ++#define CSN_INTER_HI 31 ++#define CSN_INTER_SZ 16 ++#define BACK_DLY_MSK 0x0000ffff ++#define BACK_DLY_I_MSK 0xffff0000 ++#define BACK_DLY_SFT 0 ++#define BACK_DLY_HI 15 ++#define BACK_DLY_SZ 16 ++#define FRONT_DLY_MSK 0xffff0000 ++#define FRONT_DLY_I_MSK 0x0000ffff ++#define FRONT_DLY_SFT 16 ++#define FRONT_DLY_HI 31 ++#define FRONT_DLY_SZ 16 ++#define RX_FIFO_FAIL_MSK 0x00000002 ++#define RX_FIFO_FAIL_I_MSK 0xfffffffd ++#define RX_FIFO_FAIL_SFT 1 ++#define RX_FIFO_FAIL_HI 1 ++#define RX_FIFO_FAIL_SZ 1 ++#define RX_HOST_FAIL_MSK 0x00000004 ++#define RX_HOST_FAIL_I_MSK 0xfffffffb ++#define RX_HOST_FAIL_SFT 2 ++#define RX_HOST_FAIL_HI 2 ++#define RX_HOST_FAIL_SZ 1 ++#define TX_FIFO_FAIL_MSK 0x00000008 ++#define TX_FIFO_FAIL_I_MSK 0xfffffff7 ++#define TX_FIFO_FAIL_SFT 3 ++#define TX_FIFO_FAIL_HI 3 ++#define TX_FIFO_FAIL_SZ 1 ++#define TX_HOST_FAIL_MSK 0x00000010 ++#define TX_HOST_FAIL_I_MSK 0xffffffef ++#define TX_HOST_FAIL_SFT 4 ++#define TX_HOST_FAIL_HI 4 ++#define TX_HOST_FAIL_SZ 1 ++#define SPI_DOUBLE_ALLOC_MSK 0x00000020 ++#define SPI_DOUBLE_ALLOC_I_MSK 0xffffffdf ++#define SPI_DOUBLE_ALLOC_SFT 5 ++#define SPI_DOUBLE_ALLOC_HI 5 ++#define SPI_DOUBLE_ALLOC_SZ 1 ++#define SPI_TX_NO_ALLOC_MSK 0x00000040 ++#define SPI_TX_NO_ALLOC_I_MSK 0xffffffbf ++#define SPI_TX_NO_ALLOC_SFT 6 ++#define SPI_TX_NO_ALLOC_HI 6 ++#define SPI_TX_NO_ALLOC_SZ 1 ++#define RDATA_RDY_MSK 0x00000080 ++#define RDATA_RDY_I_MSK 0xffffff7f ++#define RDATA_RDY_SFT 7 ++#define RDATA_RDY_HI 7 ++#define RDATA_RDY_SZ 1 ++#define SPI_ALLOC_STATUS_MSK 0x00000100 ++#define SPI_ALLOC_STATUS_I_MSK 0xfffffeff ++#define SPI_ALLOC_STATUS_SFT 8 ++#define SPI_ALLOC_STATUS_HI 8 ++#define SPI_ALLOC_STATUS_SZ 1 ++#define SPI_DBG_WR_FIFO_FULL_MSK 0x00000200 ++#define SPI_DBG_WR_FIFO_FULL_I_MSK 0xfffffdff ++#define SPI_DBG_WR_FIFO_FULL_SFT 9 ++#define SPI_DBG_WR_FIFO_FULL_HI 9 ++#define SPI_DBG_WR_FIFO_FULL_SZ 1 ++#define RX_LEN_MSK 0xffff0000 ++#define RX_LEN_I_MSK 0x0000ffff ++#define RX_LEN_SFT 16 ++#define RX_LEN_HI 31 ++#define RX_LEN_SZ 16 ++#define SPI_TX_ALLOC_SIZE_SHIFT_BITS_MSK 0x00000007 ++#define SPI_TX_ALLOC_SIZE_SHIFT_BITS_I_MSK 0xfffffff8 ++#define SPI_TX_ALLOC_SIZE_SHIFT_BITS_SFT 0 ++#define SPI_TX_ALLOC_SIZE_SHIFT_BITS_HI 2 ++#define SPI_TX_ALLOC_SIZE_SHIFT_BITS_SZ 3 ++#define SPI_HOST_TX_ALLOC_PKBUF_MSK 0x00000100 ++#define SPI_HOST_TX_ALLOC_PKBUF_I_MSK 0xfffffeff ++#define SPI_HOST_TX_ALLOC_PKBUF_SFT 8 ++#define SPI_HOST_TX_ALLOC_PKBUF_HI 8 ++#define SPI_HOST_TX_ALLOC_PKBUF_SZ 1 ++#define SPI_TX_ALLOC_SIZE_MSK 0x000000ff ++#define SPI_TX_ALLOC_SIZE_I_MSK 0xffffff00 ++#define SPI_TX_ALLOC_SIZE_SFT 0 ++#define SPI_TX_ALLOC_SIZE_HI 7 ++#define SPI_TX_ALLOC_SIZE_SZ 8 ++#define RD_DAT_CNT_MSK 0x0000ffff ++#define RD_DAT_CNT_I_MSK 0xffff0000 ++#define RD_DAT_CNT_SFT 0 ++#define RD_DAT_CNT_HI 15 ++#define RD_DAT_CNT_SZ 16 ++#define RD_STS_CNT_MSK 0xffff0000 ++#define RD_STS_CNT_I_MSK 0x0000ffff ++#define RD_STS_CNT_SFT 16 ++#define RD_STS_CNT_HI 31 ++#define RD_STS_CNT_SZ 16 ++#define JUDGE_CNT_MSK 0x0000ffff ++#define JUDGE_CNT_I_MSK 0xffff0000 ++#define JUDGE_CNT_SFT 0 ++#define JUDGE_CNT_HI 15 ++#define JUDGE_CNT_SZ 16 ++#define RD_STS_CNT_CLR_MSK 0x00010000 ++#define RD_STS_CNT_CLR_I_MSK 0xfffeffff ++#define RD_STS_CNT_CLR_SFT 16 ++#define RD_STS_CNT_CLR_HI 16 ++#define RD_STS_CNT_CLR_SZ 1 ++#define RD_DAT_CNT_CLR_MSK 0x00020000 ++#define RD_DAT_CNT_CLR_I_MSK 0xfffdffff ++#define RD_DAT_CNT_CLR_SFT 17 ++#define RD_DAT_CNT_CLR_HI 17 ++#define RD_DAT_CNT_CLR_SZ 1 ++#define JUDGE_CNT_CLR_MSK 0x00040000 ++#define JUDGE_CNT_CLR_I_MSK 0xfffbffff ++#define JUDGE_CNT_CLR_SFT 18 ++#define JUDGE_CNT_CLR_HI 18 ++#define JUDGE_CNT_CLR_SZ 1 ++#define TX_DONE_CNT_MSK 0x0000ffff ++#define TX_DONE_CNT_I_MSK 0xffff0000 ++#define TX_DONE_CNT_SFT 0 ++#define TX_DONE_CNT_HI 15 ++#define TX_DONE_CNT_SZ 16 ++#define TX_DISCARD_CNT_MSK 0xffff0000 ++#define TX_DISCARD_CNT_I_MSK 0x0000ffff ++#define TX_DISCARD_CNT_SFT 16 ++#define TX_DISCARD_CNT_HI 31 ++#define TX_DISCARD_CNT_SZ 16 ++#define TX_SET_CNT_MSK 0x0000ffff ++#define TX_SET_CNT_I_MSK 0xffff0000 ++#define TX_SET_CNT_SFT 0 ++#define TX_SET_CNT_HI 15 ++#define TX_SET_CNT_SZ 16 ++#define TX_DISCARD_CNT_CLR_MSK 0x00010000 ++#define TX_DISCARD_CNT_CLR_I_MSK 0xfffeffff ++#define TX_DISCARD_CNT_CLR_SFT 16 ++#define TX_DISCARD_CNT_CLR_HI 16 ++#define TX_DISCARD_CNT_CLR_SZ 1 ++#define TX_DONE_CNT_CLR_MSK 0x00020000 ++#define TX_DONE_CNT_CLR_I_MSK 0xfffdffff ++#define TX_DONE_CNT_CLR_SFT 17 ++#define TX_DONE_CNT_CLR_HI 17 ++#define TX_DONE_CNT_CLR_SZ 1 ++#define TX_SET_CNT_CLR_MSK 0x00040000 ++#define TX_SET_CNT_CLR_I_MSK 0xfffbffff ++#define TX_SET_CNT_CLR_SFT 18 ++#define TX_SET_CNT_CLR_HI 18 ++#define TX_SET_CNT_CLR_SZ 1 ++#define DAT_MODE_OFF_MSK 0x00080000 ++#define DAT_MODE_OFF_I_MSK 0xfff7ffff ++#define DAT_MODE_OFF_SFT 19 ++#define DAT_MODE_OFF_HI 19 ++#define DAT_MODE_OFF_SZ 1 ++#define TX_FIFO_RESIDUE_MSK 0x00700000 ++#define TX_FIFO_RESIDUE_I_MSK 0xff8fffff ++#define TX_FIFO_RESIDUE_SFT 20 ++#define TX_FIFO_RESIDUE_HI 22 ++#define TX_FIFO_RESIDUE_SZ 3 ++#define RX_FIFO_RESIDUE_MSK 0x07000000 ++#define RX_FIFO_RESIDUE_I_MSK 0xf8ffffff ++#define RX_FIFO_RESIDUE_SFT 24 ++#define RX_FIFO_RESIDUE_HI 26 ++#define RX_FIFO_RESIDUE_SZ 3 ++#define RX_RDY_MSK 0x00000001 ++#define RX_RDY_I_MSK 0xfffffffe ++#define RX_RDY_SFT 0 ++#define RX_RDY_HI 0 ++#define RX_RDY_SZ 1 ++#define SDIO_SYS_INT_MSK 0x00000004 ++#define SDIO_SYS_INT_I_MSK 0xfffffffb ++#define SDIO_SYS_INT_SFT 2 ++#define SDIO_SYS_INT_HI 2 ++#define SDIO_SYS_INT_SZ 1 ++#define EDCA0_LOWTHOLD_INT_MSK 0x00000008 ++#define EDCA0_LOWTHOLD_INT_I_MSK 0xfffffff7 ++#define EDCA0_LOWTHOLD_INT_SFT 3 ++#define EDCA0_LOWTHOLD_INT_HI 3 ++#define EDCA0_LOWTHOLD_INT_SZ 1 ++#define EDCA1_LOWTHOLD_INT_MSK 0x00000010 ++#define EDCA1_LOWTHOLD_INT_I_MSK 0xffffffef ++#define EDCA1_LOWTHOLD_INT_SFT 4 ++#define EDCA1_LOWTHOLD_INT_HI 4 ++#define EDCA1_LOWTHOLD_INT_SZ 1 ++#define EDCA2_LOWTHOLD_INT_MSK 0x00000020 ++#define EDCA2_LOWTHOLD_INT_I_MSK 0xffffffdf ++#define EDCA2_LOWTHOLD_INT_SFT 5 ++#define EDCA2_LOWTHOLD_INT_HI 5 ++#define EDCA2_LOWTHOLD_INT_SZ 1 ++#define EDCA3_LOWTHOLD_INT_MSK 0x00000040 ++#define EDCA3_LOWTHOLD_INT_I_MSK 0xffffffbf ++#define EDCA3_LOWTHOLD_INT_SFT 6 ++#define EDCA3_LOWTHOLD_INT_HI 6 ++#define EDCA3_LOWTHOLD_INT_SZ 1 ++#define TX_LIMIT_INT_IN_MSK 0x00000080 ++#define TX_LIMIT_INT_IN_I_MSK 0xffffff7f ++#define TX_LIMIT_INT_IN_SFT 7 ++#define TX_LIMIT_INT_IN_HI 7 ++#define TX_LIMIT_INT_IN_SZ 1 ++#define SPI_FN1_MSK 0x00007f00 ++#define SPI_FN1_I_MSK 0xffff80ff ++#define SPI_FN1_SFT 8 ++#define SPI_FN1_HI 14 ++#define SPI_FN1_SZ 7 ++#define SPI_CLK_EN_INT_MSK 0x00008000 ++#define SPI_CLK_EN_INT_I_MSK 0xffff7fff ++#define SPI_CLK_EN_INT_SFT 15 ++#define SPI_CLK_EN_INT_HI 15 ++#define SPI_CLK_EN_INT_SZ 1 ++#define SPI_HOST_MASK_MSK 0x00ff0000 ++#define SPI_HOST_MASK_I_MSK 0xff00ffff ++#define SPI_HOST_MASK_SFT 16 ++#define SPI_HOST_MASK_HI 23 ++#define SPI_HOST_MASK_SZ 8 ++#define I2CM_INT_WDONE_MSK 0x00000001 ++#define I2CM_INT_WDONE_I_MSK 0xfffffffe ++#define I2CM_INT_WDONE_SFT 0 ++#define I2CM_INT_WDONE_HI 0 ++#define I2CM_INT_WDONE_SZ 1 ++#define I2CM_INT_RDONE_MSK 0x00000002 ++#define I2CM_INT_RDONE_I_MSK 0xfffffffd ++#define I2CM_INT_RDONE_SFT 1 ++#define I2CM_INT_RDONE_HI 1 ++#define I2CM_INT_RDONE_SZ 1 ++#define I2CM_IDLE_MSK 0x00000004 ++#define I2CM_IDLE_I_MSK 0xfffffffb ++#define I2CM_IDLE_SFT 2 ++#define I2CM_IDLE_HI 2 ++#define I2CM_IDLE_SZ 1 ++#define I2CM_INT_MISMATCH_MSK 0x00000008 ++#define I2CM_INT_MISMATCH_I_MSK 0xfffffff7 ++#define I2CM_INT_MISMATCH_SFT 3 ++#define I2CM_INT_MISMATCH_HI 3 ++#define I2CM_INT_MISMATCH_SZ 1 ++#define I2CM_PSCL_MSK 0x00003ff0 ++#define I2CM_PSCL_I_MSK 0xffffc00f ++#define I2CM_PSCL_SFT 4 ++#define I2CM_PSCL_HI 13 ++#define I2CM_PSCL_SZ 10 ++#define I2CM_MANUAL_MODE_MSK 0x00010000 ++#define I2CM_MANUAL_MODE_I_MSK 0xfffeffff ++#define I2CM_MANUAL_MODE_SFT 16 ++#define I2CM_MANUAL_MODE_HI 16 ++#define I2CM_MANUAL_MODE_SZ 1 ++#define I2CM_INT_WDATA_NEED_MSK 0x00020000 ++#define I2CM_INT_WDATA_NEED_I_MSK 0xfffdffff ++#define I2CM_INT_WDATA_NEED_SFT 17 ++#define I2CM_INT_WDATA_NEED_HI 17 ++#define I2CM_INT_WDATA_NEED_SZ 1 ++#define I2CM_INT_RDATA_NEED_MSK 0x00040000 ++#define I2CM_INT_RDATA_NEED_I_MSK 0xfffbffff ++#define I2CM_INT_RDATA_NEED_SFT 18 ++#define I2CM_INT_RDATA_NEED_HI 18 ++#define I2CM_INT_RDATA_NEED_SZ 1 ++#define I2CM_DEV_A_MSK 0x000003ff ++#define I2CM_DEV_A_I_MSK 0xfffffc00 ++#define I2CM_DEV_A_SFT 0 ++#define I2CM_DEV_A_HI 9 ++#define I2CM_DEV_A_SZ 10 ++#define I2CM_DEV_A10B_MSK 0x00004000 ++#define I2CM_DEV_A10B_I_MSK 0xffffbfff ++#define I2CM_DEV_A10B_SFT 14 ++#define I2CM_DEV_A10B_HI 14 ++#define I2CM_DEV_A10B_SZ 1 ++#define I2CM_RX_MSK 0x00008000 ++#define I2CM_RX_I_MSK 0xffff7fff ++#define I2CM_RX_SFT 15 ++#define I2CM_RX_HI 15 ++#define I2CM_RX_SZ 1 ++#define I2CM_LEN_MSK 0x0000ffff ++#define I2CM_LEN_I_MSK 0xffff0000 ++#define I2CM_LEN_SFT 0 ++#define I2CM_LEN_HI 15 ++#define I2CM_LEN_SZ 16 ++#define I2CM_T_LEFT_MSK 0x00070000 ++#define I2CM_T_LEFT_I_MSK 0xfff8ffff ++#define I2CM_T_LEFT_SFT 16 ++#define I2CM_T_LEFT_HI 18 ++#define I2CM_T_LEFT_SZ 3 ++#define I2CM_R_GET_MSK 0x07000000 ++#define I2CM_R_GET_I_MSK 0xf8ffffff ++#define I2CM_R_GET_SFT 24 ++#define I2CM_R_GET_HI 26 ++#define I2CM_R_GET_SZ 3 ++#define I2CM_WDAT_MSK 0xffffffff ++#define I2CM_WDAT_I_MSK 0x00000000 ++#define I2CM_WDAT_SFT 0 ++#define I2CM_WDAT_HI 31 ++#define I2CM_WDAT_SZ 32 ++#define I2CM_RDAT_MSK 0xffffffff ++#define I2CM_RDAT_I_MSK 0x00000000 ++#define I2CM_RDAT_SFT 0 ++#define I2CM_RDAT_HI 31 ++#define I2CM_RDAT_SZ 32 ++#define I2CM_SR_LEN_MSK 0x0000ffff ++#define I2CM_SR_LEN_I_MSK 0xffff0000 ++#define I2CM_SR_LEN_SFT 0 ++#define I2CM_SR_LEN_HI 15 ++#define I2CM_SR_LEN_SZ 16 ++#define I2CM_SR_RX_MSK 0x00010000 ++#define I2CM_SR_RX_I_MSK 0xfffeffff ++#define I2CM_SR_RX_SFT 16 ++#define I2CM_SR_RX_HI 16 ++#define I2CM_SR_RX_SZ 1 ++#define I2CM_REPEAT_START_MSK 0x00020000 ++#define I2CM_REPEAT_START_I_MSK 0xfffdffff ++#define I2CM_REPEAT_START_SFT 17 ++#define I2CM_REPEAT_START_HI 17 ++#define I2CM_REPEAT_START_SZ 1 ++#define UART_DATA_MSK 0x000000ff ++#define UART_DATA_I_MSK 0xffffff00 ++#define UART_DATA_SFT 0 ++#define UART_DATA_HI 7 ++#define UART_DATA_SZ 8 ++#define DATA_RDY_IE_MSK 0x00000001 ++#define DATA_RDY_IE_I_MSK 0xfffffffe ++#define DATA_RDY_IE_SFT 0 ++#define DATA_RDY_IE_HI 0 ++#define DATA_RDY_IE_SZ 1 ++#define THR_EMPTY_IE_MSK 0x00000002 ++#define THR_EMPTY_IE_I_MSK 0xfffffffd ++#define THR_EMPTY_IE_SFT 1 ++#define THR_EMPTY_IE_HI 1 ++#define THR_EMPTY_IE_SZ 1 ++#define RX_LINESTS_IE_MSK 0x00000004 ++#define RX_LINESTS_IE_I_MSK 0xfffffffb ++#define RX_LINESTS_IE_SFT 2 ++#define RX_LINESTS_IE_HI 2 ++#define RX_LINESTS_IE_SZ 1 ++#define MDM_STS_IE_MSK 0x00000008 ++#define MDM_STS_IE_I_MSK 0xfffffff7 ++#define MDM_STS_IE_SFT 3 ++#define MDM_STS_IE_HI 3 ++#define MDM_STS_IE_SZ 1 ++#define DMA_RXEND_IE_MSK 0x00000040 ++#define DMA_RXEND_IE_I_MSK 0xffffffbf ++#define DMA_RXEND_IE_SFT 6 ++#define DMA_RXEND_IE_HI 6 ++#define DMA_RXEND_IE_SZ 1 ++#define DMA_TXEND_IE_MSK 0x00000080 ++#define DMA_TXEND_IE_I_MSK 0xffffff7f ++#define DMA_TXEND_IE_SFT 7 ++#define DMA_TXEND_IE_HI 7 ++#define DMA_TXEND_IE_SZ 1 ++#define FIFO_EN_MSK 0x00000001 ++#define FIFO_EN_I_MSK 0xfffffffe ++#define FIFO_EN_SFT 0 ++#define FIFO_EN_HI 0 ++#define FIFO_EN_SZ 1 ++#define RXFIFO_RST_MSK 0x00000002 ++#define RXFIFO_RST_I_MSK 0xfffffffd ++#define RXFIFO_RST_SFT 1 ++#define RXFIFO_RST_HI 1 ++#define RXFIFO_RST_SZ 1 ++#define TXFIFO_RST_MSK 0x00000004 ++#define TXFIFO_RST_I_MSK 0xfffffffb ++#define TXFIFO_RST_SFT 2 ++#define TXFIFO_RST_HI 2 ++#define TXFIFO_RST_SZ 1 ++#define DMA_MODE_MSK 0x00000008 ++#define DMA_MODE_I_MSK 0xfffffff7 ++#define DMA_MODE_SFT 3 ++#define DMA_MODE_HI 3 ++#define DMA_MODE_SZ 1 ++#define EN_AUTO_RTS_MSK 0x00000010 ++#define EN_AUTO_RTS_I_MSK 0xffffffef ++#define EN_AUTO_RTS_SFT 4 ++#define EN_AUTO_RTS_HI 4 ++#define EN_AUTO_RTS_SZ 1 ++#define EN_AUTO_CTS_MSK 0x00000020 ++#define EN_AUTO_CTS_I_MSK 0xffffffdf ++#define EN_AUTO_CTS_SFT 5 ++#define EN_AUTO_CTS_HI 5 ++#define EN_AUTO_CTS_SZ 1 ++#define RXFIFO_TRGLVL_MSK 0x000000c0 ++#define RXFIFO_TRGLVL_I_MSK 0xffffff3f ++#define RXFIFO_TRGLVL_SFT 6 ++#define RXFIFO_TRGLVL_HI 7 ++#define RXFIFO_TRGLVL_SZ 2 ++#define WORD_LEN_MSK 0x00000003 ++#define WORD_LEN_I_MSK 0xfffffffc ++#define WORD_LEN_SFT 0 ++#define WORD_LEN_HI 1 ++#define WORD_LEN_SZ 2 ++#define STOP_BIT_MSK 0x00000004 ++#define STOP_BIT_I_MSK 0xfffffffb ++#define STOP_BIT_SFT 2 ++#define STOP_BIT_HI 2 ++#define STOP_BIT_SZ 1 ++#define PARITY_EN_MSK 0x00000008 ++#define PARITY_EN_I_MSK 0xfffffff7 ++#define PARITY_EN_SFT 3 ++#define PARITY_EN_HI 3 ++#define PARITY_EN_SZ 1 ++#define EVEN_PARITY_MSK 0x00000010 ++#define EVEN_PARITY_I_MSK 0xffffffef ++#define EVEN_PARITY_SFT 4 ++#define EVEN_PARITY_HI 4 ++#define EVEN_PARITY_SZ 1 ++#define FORCE_PARITY_MSK 0x00000020 ++#define FORCE_PARITY_I_MSK 0xffffffdf ++#define FORCE_PARITY_SFT 5 ++#define FORCE_PARITY_HI 5 ++#define FORCE_PARITY_SZ 1 ++#define SET_BREAK_MSK 0x00000040 ++#define SET_BREAK_I_MSK 0xffffffbf ++#define SET_BREAK_SFT 6 ++#define SET_BREAK_HI 6 ++#define SET_BREAK_SZ 1 ++#define DLAB_MSK 0x00000080 ++#define DLAB_I_MSK 0xffffff7f ++#define DLAB_SFT 7 ++#define DLAB_HI 7 ++#define DLAB_SZ 1 ++#define DTR_MSK 0x00000001 ++#define DTR_I_MSK 0xfffffffe ++#define DTR_SFT 0 ++#define DTR_HI 0 ++#define DTR_SZ 1 ++#define RTS_MSK 0x00000002 ++#define RTS_I_MSK 0xfffffffd ++#define RTS_SFT 1 ++#define RTS_HI 1 ++#define RTS_SZ 1 ++#define OUT_1_MSK 0x00000004 ++#define OUT_1_I_MSK 0xfffffffb ++#define OUT_1_SFT 2 ++#define OUT_1_HI 2 ++#define OUT_1_SZ 1 ++#define OUT_2_MSK 0x00000008 ++#define OUT_2_I_MSK 0xfffffff7 ++#define OUT_2_SFT 3 ++#define OUT_2_HI 3 ++#define OUT_2_SZ 1 ++#define LOOP_BACK_MSK 0x00000010 ++#define LOOP_BACK_I_MSK 0xffffffef ++#define LOOP_BACK_SFT 4 ++#define LOOP_BACK_HI 4 ++#define LOOP_BACK_SZ 1 ++#define DATA_RDY_MSK 0x00000001 ++#define DATA_RDY_I_MSK 0xfffffffe ++#define DATA_RDY_SFT 0 ++#define DATA_RDY_HI 0 ++#define DATA_RDY_SZ 1 ++#define OVERRUN_ERR_MSK 0x00000002 ++#define OVERRUN_ERR_I_MSK 0xfffffffd ++#define OVERRUN_ERR_SFT 1 ++#define OVERRUN_ERR_HI 1 ++#define OVERRUN_ERR_SZ 1 ++#define PARITY_ERR_MSK 0x00000004 ++#define PARITY_ERR_I_MSK 0xfffffffb ++#define PARITY_ERR_SFT 2 ++#define PARITY_ERR_HI 2 ++#define PARITY_ERR_SZ 1 ++#define FRAMING_ERR_MSK 0x00000008 ++#define FRAMING_ERR_I_MSK 0xfffffff7 ++#define FRAMING_ERR_SFT 3 ++#define FRAMING_ERR_HI 3 ++#define FRAMING_ERR_SZ 1 ++#define BREAK_INT_MSK 0x00000010 ++#define BREAK_INT_I_MSK 0xffffffef ++#define BREAK_INT_SFT 4 ++#define BREAK_INT_HI 4 ++#define BREAK_INT_SZ 1 ++#define THR_EMPTY_MSK 0x00000020 ++#define THR_EMPTY_I_MSK 0xffffffdf ++#define THR_EMPTY_SFT 5 ++#define THR_EMPTY_HI 5 ++#define THR_EMPTY_SZ 1 ++#define TX_EMPTY_MSK 0x00000040 ++#define TX_EMPTY_I_MSK 0xffffffbf ++#define TX_EMPTY_SFT 6 ++#define TX_EMPTY_HI 6 ++#define TX_EMPTY_SZ 1 ++#define FIFODATA_ERR_MSK 0x00000080 ++#define FIFODATA_ERR_I_MSK 0xffffff7f ++#define FIFODATA_ERR_SFT 7 ++#define FIFODATA_ERR_HI 7 ++#define FIFODATA_ERR_SZ 1 ++#define DELTA_CTS_MSK 0x00000001 ++#define DELTA_CTS_I_MSK 0xfffffffe ++#define DELTA_CTS_SFT 0 ++#define DELTA_CTS_HI 0 ++#define DELTA_CTS_SZ 1 ++#define DELTA_DSR_MSK 0x00000002 ++#define DELTA_DSR_I_MSK 0xfffffffd ++#define DELTA_DSR_SFT 1 ++#define DELTA_DSR_HI 1 ++#define DELTA_DSR_SZ 1 ++#define TRAILEDGE_RI_MSK 0x00000004 ++#define TRAILEDGE_RI_I_MSK 0xfffffffb ++#define TRAILEDGE_RI_SFT 2 ++#define TRAILEDGE_RI_HI 2 ++#define TRAILEDGE_RI_SZ 1 ++#define DELTA_CD_MSK 0x00000008 ++#define DELTA_CD_I_MSK 0xfffffff7 ++#define DELTA_CD_SFT 3 ++#define DELTA_CD_HI 3 ++#define DELTA_CD_SZ 1 ++#define CTS_MSK 0x00000010 ++#define CTS_I_MSK 0xffffffef ++#define CTS_SFT 4 ++#define CTS_HI 4 ++#define CTS_SZ 1 ++#define DSR_MSK 0x00000020 ++#define DSR_I_MSK 0xffffffdf ++#define DSR_SFT 5 ++#define DSR_HI 5 ++#define DSR_SZ 1 ++#define RI_MSK 0x00000040 ++#define RI_I_MSK 0xffffffbf ++#define RI_SFT 6 ++#define RI_HI 6 ++#define RI_SZ 1 ++#define CD_MSK 0x00000080 ++#define CD_I_MSK 0xffffff7f ++#define CD_SFT 7 ++#define CD_HI 7 ++#define CD_SZ 1 ++#define BRDC_DIV_MSK 0x0000ffff ++#define BRDC_DIV_I_MSK 0xffff0000 ++#define BRDC_DIV_SFT 0 ++#define BRDC_DIV_HI 15 ++#define BRDC_DIV_SZ 16 ++#define RTHR_L_MSK 0x0000000f ++#define RTHR_L_I_MSK 0xfffffff0 ++#define RTHR_L_SFT 0 ++#define RTHR_L_HI 3 ++#define RTHR_L_SZ 4 ++#define RTHR_H_MSK 0x000000f0 ++#define RTHR_H_I_MSK 0xffffff0f ++#define RTHR_H_SFT 4 ++#define RTHR_H_HI 7 ++#define RTHR_H_SZ 4 ++#define INT_IDCODE_MSK 0x0000000f ++#define INT_IDCODE_I_MSK 0xfffffff0 ++#define INT_IDCODE_SFT 0 ++#define INT_IDCODE_HI 3 ++#define INT_IDCODE_SZ 4 ++#define FIFOS_ENABLED_MSK 0x000000c0 ++#define FIFOS_ENABLED_I_MSK 0xffffff3f ++#define FIFOS_ENABLED_SFT 6 ++#define FIFOS_ENABLED_HI 7 ++#define FIFOS_ENABLED_SZ 2 ++#define DAT_UART_DATA_MSK 0x000000ff ++#define DAT_UART_DATA_I_MSK 0xffffff00 ++#define DAT_UART_DATA_SFT 0 ++#define DAT_UART_DATA_HI 7 ++#define DAT_UART_DATA_SZ 8 ++#define DAT_DATA_RDY_IE_MSK 0x00000001 ++#define DAT_DATA_RDY_IE_I_MSK 0xfffffffe ++#define DAT_DATA_RDY_IE_SFT 0 ++#define DAT_DATA_RDY_IE_HI 0 ++#define DAT_DATA_RDY_IE_SZ 1 ++#define DAT_THR_EMPTY_IE_MSK 0x00000002 ++#define DAT_THR_EMPTY_IE_I_MSK 0xfffffffd ++#define DAT_THR_EMPTY_IE_SFT 1 ++#define DAT_THR_EMPTY_IE_HI 1 ++#define DAT_THR_EMPTY_IE_SZ 1 ++#define DAT_RX_LINESTS_IE_MSK 0x00000004 ++#define DAT_RX_LINESTS_IE_I_MSK 0xfffffffb ++#define DAT_RX_LINESTS_IE_SFT 2 ++#define DAT_RX_LINESTS_IE_HI 2 ++#define DAT_RX_LINESTS_IE_SZ 1 ++#define DAT_MDM_STS_IE_MSK 0x00000008 ++#define DAT_MDM_STS_IE_I_MSK 0xfffffff7 ++#define DAT_MDM_STS_IE_SFT 3 ++#define DAT_MDM_STS_IE_HI 3 ++#define DAT_MDM_STS_IE_SZ 1 ++#define DAT_DMA_RXEND_IE_MSK 0x00000040 ++#define DAT_DMA_RXEND_IE_I_MSK 0xffffffbf ++#define DAT_DMA_RXEND_IE_SFT 6 ++#define DAT_DMA_RXEND_IE_HI 6 ++#define DAT_DMA_RXEND_IE_SZ 1 ++#define DAT_DMA_TXEND_IE_MSK 0x00000080 ++#define DAT_DMA_TXEND_IE_I_MSK 0xffffff7f ++#define DAT_DMA_TXEND_IE_SFT 7 ++#define DAT_DMA_TXEND_IE_HI 7 ++#define DAT_DMA_TXEND_IE_SZ 1 ++#define DAT_FIFO_EN_MSK 0x00000001 ++#define DAT_FIFO_EN_I_MSK 0xfffffffe ++#define DAT_FIFO_EN_SFT 0 ++#define DAT_FIFO_EN_HI 0 ++#define DAT_FIFO_EN_SZ 1 ++#define DAT_RXFIFO_RST_MSK 0x00000002 ++#define DAT_RXFIFO_RST_I_MSK 0xfffffffd ++#define DAT_RXFIFO_RST_SFT 1 ++#define DAT_RXFIFO_RST_HI 1 ++#define DAT_RXFIFO_RST_SZ 1 ++#define DAT_TXFIFO_RST_MSK 0x00000004 ++#define DAT_TXFIFO_RST_I_MSK 0xfffffffb ++#define DAT_TXFIFO_RST_SFT 2 ++#define DAT_TXFIFO_RST_HI 2 ++#define DAT_TXFIFO_RST_SZ 1 ++#define DAT_DMA_MODE_MSK 0x00000008 ++#define DAT_DMA_MODE_I_MSK 0xfffffff7 ++#define DAT_DMA_MODE_SFT 3 ++#define DAT_DMA_MODE_HI 3 ++#define DAT_DMA_MODE_SZ 1 ++#define DAT_EN_AUTO_RTS_MSK 0x00000010 ++#define DAT_EN_AUTO_RTS_I_MSK 0xffffffef ++#define DAT_EN_AUTO_RTS_SFT 4 ++#define DAT_EN_AUTO_RTS_HI 4 ++#define DAT_EN_AUTO_RTS_SZ 1 ++#define DAT_EN_AUTO_CTS_MSK 0x00000020 ++#define DAT_EN_AUTO_CTS_I_MSK 0xffffffdf ++#define DAT_EN_AUTO_CTS_SFT 5 ++#define DAT_EN_AUTO_CTS_HI 5 ++#define DAT_EN_AUTO_CTS_SZ 1 ++#define DAT_RXFIFO_TRGLVL_MSK 0x000000c0 ++#define DAT_RXFIFO_TRGLVL_I_MSK 0xffffff3f ++#define DAT_RXFIFO_TRGLVL_SFT 6 ++#define DAT_RXFIFO_TRGLVL_HI 7 ++#define DAT_RXFIFO_TRGLVL_SZ 2 ++#define DAT_WORD_LEN_MSK 0x00000003 ++#define DAT_WORD_LEN_I_MSK 0xfffffffc ++#define DAT_WORD_LEN_SFT 0 ++#define DAT_WORD_LEN_HI 1 ++#define DAT_WORD_LEN_SZ 2 ++#define DAT_STOP_BIT_MSK 0x00000004 ++#define DAT_STOP_BIT_I_MSK 0xfffffffb ++#define DAT_STOP_BIT_SFT 2 ++#define DAT_STOP_BIT_HI 2 ++#define DAT_STOP_BIT_SZ 1 ++#define DAT_PARITY_EN_MSK 0x00000008 ++#define DAT_PARITY_EN_I_MSK 0xfffffff7 ++#define DAT_PARITY_EN_SFT 3 ++#define DAT_PARITY_EN_HI 3 ++#define DAT_PARITY_EN_SZ 1 ++#define DAT_EVEN_PARITY_MSK 0x00000010 ++#define DAT_EVEN_PARITY_I_MSK 0xffffffef ++#define DAT_EVEN_PARITY_SFT 4 ++#define DAT_EVEN_PARITY_HI 4 ++#define DAT_EVEN_PARITY_SZ 1 ++#define DAT_FORCE_PARITY_MSK 0x00000020 ++#define DAT_FORCE_PARITY_I_MSK 0xffffffdf ++#define DAT_FORCE_PARITY_SFT 5 ++#define DAT_FORCE_PARITY_HI 5 ++#define DAT_FORCE_PARITY_SZ 1 ++#define DAT_SET_BREAK_MSK 0x00000040 ++#define DAT_SET_BREAK_I_MSK 0xffffffbf ++#define DAT_SET_BREAK_SFT 6 ++#define DAT_SET_BREAK_HI 6 ++#define DAT_SET_BREAK_SZ 1 ++#define DAT_DLAB_MSK 0x00000080 ++#define DAT_DLAB_I_MSK 0xffffff7f ++#define DAT_DLAB_SFT 7 ++#define DAT_DLAB_HI 7 ++#define DAT_DLAB_SZ 1 ++#define DAT_DTR_MSK 0x00000001 ++#define DAT_DTR_I_MSK 0xfffffffe ++#define DAT_DTR_SFT 0 ++#define DAT_DTR_HI 0 ++#define DAT_DTR_SZ 1 ++#define DAT_RTS_MSK 0x00000002 ++#define DAT_RTS_I_MSK 0xfffffffd ++#define DAT_RTS_SFT 1 ++#define DAT_RTS_HI 1 ++#define DAT_RTS_SZ 1 ++#define DAT_OUT_1_MSK 0x00000004 ++#define DAT_OUT_1_I_MSK 0xfffffffb ++#define DAT_OUT_1_SFT 2 ++#define DAT_OUT_1_HI 2 ++#define DAT_OUT_1_SZ 1 ++#define DAT_OUT_2_MSK 0x00000008 ++#define DAT_OUT_2_I_MSK 0xfffffff7 ++#define DAT_OUT_2_SFT 3 ++#define DAT_OUT_2_HI 3 ++#define DAT_OUT_2_SZ 1 ++#define DAT_LOOP_BACK_MSK 0x00000010 ++#define DAT_LOOP_BACK_I_MSK 0xffffffef ++#define DAT_LOOP_BACK_SFT 4 ++#define DAT_LOOP_BACK_HI 4 ++#define DAT_LOOP_BACK_SZ 1 ++#define DAT_DATA_RDY_MSK 0x00000001 ++#define DAT_DATA_RDY_I_MSK 0xfffffffe ++#define DAT_DATA_RDY_SFT 0 ++#define DAT_DATA_RDY_HI 0 ++#define DAT_DATA_RDY_SZ 1 ++#define DAT_OVERRUN_ERR_MSK 0x00000002 ++#define DAT_OVERRUN_ERR_I_MSK 0xfffffffd ++#define DAT_OVERRUN_ERR_SFT 1 ++#define DAT_OVERRUN_ERR_HI 1 ++#define DAT_OVERRUN_ERR_SZ 1 ++#define DAT_PARITY_ERR_MSK 0x00000004 ++#define DAT_PARITY_ERR_I_MSK 0xfffffffb ++#define DAT_PARITY_ERR_SFT 2 ++#define DAT_PARITY_ERR_HI 2 ++#define DAT_PARITY_ERR_SZ 1 ++#define DAT_FRAMING_ERR_MSK 0x00000008 ++#define DAT_FRAMING_ERR_I_MSK 0xfffffff7 ++#define DAT_FRAMING_ERR_SFT 3 ++#define DAT_FRAMING_ERR_HI 3 ++#define DAT_FRAMING_ERR_SZ 1 ++#define DAT_BREAK_INT_MSK 0x00000010 ++#define DAT_BREAK_INT_I_MSK 0xffffffef ++#define DAT_BREAK_INT_SFT 4 ++#define DAT_BREAK_INT_HI 4 ++#define DAT_BREAK_INT_SZ 1 ++#define DAT_THR_EMPTY_MSK 0x00000020 ++#define DAT_THR_EMPTY_I_MSK 0xffffffdf ++#define DAT_THR_EMPTY_SFT 5 ++#define DAT_THR_EMPTY_HI 5 ++#define DAT_THR_EMPTY_SZ 1 ++#define DAT_TX_EMPTY_MSK 0x00000040 ++#define DAT_TX_EMPTY_I_MSK 0xffffffbf ++#define DAT_TX_EMPTY_SFT 6 ++#define DAT_TX_EMPTY_HI 6 ++#define DAT_TX_EMPTY_SZ 1 ++#define DAT_FIFODATA_ERR_MSK 0x00000080 ++#define DAT_FIFODATA_ERR_I_MSK 0xffffff7f ++#define DAT_FIFODATA_ERR_SFT 7 ++#define DAT_FIFODATA_ERR_HI 7 ++#define DAT_FIFODATA_ERR_SZ 1 ++#define DAT_DELTA_CTS_MSK 0x00000001 ++#define DAT_DELTA_CTS_I_MSK 0xfffffffe ++#define DAT_DELTA_CTS_SFT 0 ++#define DAT_DELTA_CTS_HI 0 ++#define DAT_DELTA_CTS_SZ 1 ++#define DAT_DELTA_DSR_MSK 0x00000002 ++#define DAT_DELTA_DSR_I_MSK 0xfffffffd ++#define DAT_DELTA_DSR_SFT 1 ++#define DAT_DELTA_DSR_HI 1 ++#define DAT_DELTA_DSR_SZ 1 ++#define DAT_TRAILEDGE_RI_MSK 0x00000004 ++#define DAT_TRAILEDGE_RI_I_MSK 0xfffffffb ++#define DAT_TRAILEDGE_RI_SFT 2 ++#define DAT_TRAILEDGE_RI_HI 2 ++#define DAT_TRAILEDGE_RI_SZ 1 ++#define DAT_DELTA_CD_MSK 0x00000008 ++#define DAT_DELTA_CD_I_MSK 0xfffffff7 ++#define DAT_DELTA_CD_SFT 3 ++#define DAT_DELTA_CD_HI 3 ++#define DAT_DELTA_CD_SZ 1 ++#define DAT_CTS_MSK 0x00000010 ++#define DAT_CTS_I_MSK 0xffffffef ++#define DAT_CTS_SFT 4 ++#define DAT_CTS_HI 4 ++#define DAT_CTS_SZ 1 ++#define DAT_DSR_MSK 0x00000020 ++#define DAT_DSR_I_MSK 0xffffffdf ++#define DAT_DSR_SFT 5 ++#define DAT_DSR_HI 5 ++#define DAT_DSR_SZ 1 ++#define DAT_RI_MSK 0x00000040 ++#define DAT_RI_I_MSK 0xffffffbf ++#define DAT_RI_SFT 6 ++#define DAT_RI_HI 6 ++#define DAT_RI_SZ 1 ++#define DAT_CD_MSK 0x00000080 ++#define DAT_CD_I_MSK 0xffffff7f ++#define DAT_CD_SFT 7 ++#define DAT_CD_HI 7 ++#define DAT_CD_SZ 1 ++#define DAT_BRDC_DIV_MSK 0x0000ffff ++#define DAT_BRDC_DIV_I_MSK 0xffff0000 ++#define DAT_BRDC_DIV_SFT 0 ++#define DAT_BRDC_DIV_HI 15 ++#define DAT_BRDC_DIV_SZ 16 ++#define DAT_RTHR_L_MSK 0x0000000f ++#define DAT_RTHR_L_I_MSK 0xfffffff0 ++#define DAT_RTHR_L_SFT 0 ++#define DAT_RTHR_L_HI 3 ++#define DAT_RTHR_L_SZ 4 ++#define DAT_RTHR_H_MSK 0x000000f0 ++#define DAT_RTHR_H_I_MSK 0xffffff0f ++#define DAT_RTHR_H_SFT 4 ++#define DAT_RTHR_H_HI 7 ++#define DAT_RTHR_H_SZ 4 ++#define DAT_INT_IDCODE_MSK 0x0000000f ++#define DAT_INT_IDCODE_I_MSK 0xfffffff0 ++#define DAT_INT_IDCODE_SFT 0 ++#define DAT_INT_IDCODE_HI 3 ++#define DAT_INT_IDCODE_SZ 4 ++#define DAT_FIFOS_ENABLED_MSK 0x000000c0 ++#define DAT_FIFOS_ENABLED_I_MSK 0xffffff3f ++#define DAT_FIFOS_ENABLED_SFT 6 ++#define DAT_FIFOS_ENABLED_HI 7 ++#define DAT_FIFOS_ENABLED_SZ 2 ++#define MASK_TOP_MSK 0xffffffff ++#define MASK_TOP_I_MSK 0x00000000 ++#define MASK_TOP_SFT 0 ++#define MASK_TOP_HI 31 ++#define MASK_TOP_SZ 32 ++#define INT_MODE_MSK 0xffffffff ++#define INT_MODE_I_MSK 0x00000000 ++#define INT_MODE_SFT 0 ++#define INT_MODE_HI 31 ++#define INT_MODE_SZ 32 ++#define IRQ_PHY_0_MSK 0x00000001 ++#define IRQ_PHY_0_I_MSK 0xfffffffe ++#define IRQ_PHY_0_SFT 0 ++#define IRQ_PHY_0_HI 0 ++#define IRQ_PHY_0_SZ 1 ++#define IRQ_PHY_1_MSK 0x00000002 ++#define IRQ_PHY_1_I_MSK 0xfffffffd ++#define IRQ_PHY_1_SFT 1 ++#define IRQ_PHY_1_HI 1 ++#define IRQ_PHY_1_SZ 1 ++#define IRQ_SDIO_MSK 0x00000004 ++#define IRQ_SDIO_I_MSK 0xfffffffb ++#define IRQ_SDIO_SFT 2 ++#define IRQ_SDIO_HI 2 ++#define IRQ_SDIO_SZ 1 ++#define IRQ_BEACON_DONE_MSK 0x00000008 ++#define IRQ_BEACON_DONE_I_MSK 0xfffffff7 ++#define IRQ_BEACON_DONE_SFT 3 ++#define IRQ_BEACON_DONE_HI 3 ++#define IRQ_BEACON_DONE_SZ 1 ++#define IRQ_BEACON_MSK 0x00000010 ++#define IRQ_BEACON_I_MSK 0xffffffef ++#define IRQ_BEACON_SFT 4 ++#define IRQ_BEACON_HI 4 ++#define IRQ_BEACON_SZ 1 ++#define IRQ_PRE_BEACON_MSK 0x00000020 ++#define IRQ_PRE_BEACON_I_MSK 0xffffffdf ++#define IRQ_PRE_BEACON_SFT 5 ++#define IRQ_PRE_BEACON_HI 5 ++#define IRQ_PRE_BEACON_SZ 1 ++#define IRQ_EDCA0_TX_DONE_MSK 0x00000040 ++#define IRQ_EDCA0_TX_DONE_I_MSK 0xffffffbf ++#define IRQ_EDCA0_TX_DONE_SFT 6 ++#define IRQ_EDCA0_TX_DONE_HI 6 ++#define IRQ_EDCA0_TX_DONE_SZ 1 ++#define IRQ_EDCA1_TX_DONE_MSK 0x00000080 ++#define IRQ_EDCA1_TX_DONE_I_MSK 0xffffff7f ++#define IRQ_EDCA1_TX_DONE_SFT 7 ++#define IRQ_EDCA1_TX_DONE_HI 7 ++#define IRQ_EDCA1_TX_DONE_SZ 1 ++#define IRQ_EDCA2_TX_DONE_MSK 0x00000100 ++#define IRQ_EDCA2_TX_DONE_I_MSK 0xfffffeff ++#define IRQ_EDCA2_TX_DONE_SFT 8 ++#define IRQ_EDCA2_TX_DONE_HI 8 ++#define IRQ_EDCA2_TX_DONE_SZ 1 ++#define IRQ_EDCA3_TX_DONE_MSK 0x00000200 ++#define IRQ_EDCA3_TX_DONE_I_MSK 0xfffffdff ++#define IRQ_EDCA3_TX_DONE_SFT 9 ++#define IRQ_EDCA3_TX_DONE_HI 9 ++#define IRQ_EDCA3_TX_DONE_SZ 1 ++#define IRQ_EDCA4_TX_DONE_MSK 0x00000400 ++#define IRQ_EDCA4_TX_DONE_I_MSK 0xfffffbff ++#define IRQ_EDCA4_TX_DONE_SFT 10 ++#define IRQ_EDCA4_TX_DONE_HI 10 ++#define IRQ_EDCA4_TX_DONE_SZ 1 ++#define IRQ_BEACON_DTIM_MSK 0x00001000 ++#define IRQ_BEACON_DTIM_I_MSK 0xffffefff ++#define IRQ_BEACON_DTIM_SFT 12 ++#define IRQ_BEACON_DTIM_HI 12 ++#define IRQ_BEACON_DTIM_SZ 1 ++#define IRQ_EDCA0_LOWTHOLD_INT_MSK 0x00002000 ++#define IRQ_EDCA0_LOWTHOLD_INT_I_MSK 0xffffdfff ++#define IRQ_EDCA0_LOWTHOLD_INT_SFT 13 ++#define IRQ_EDCA0_LOWTHOLD_INT_HI 13 ++#define IRQ_EDCA0_LOWTHOLD_INT_SZ 1 ++#define IRQ_EDCA1_LOWTHOLD_INT_MSK 0x00004000 ++#define IRQ_EDCA1_LOWTHOLD_INT_I_MSK 0xffffbfff ++#define IRQ_EDCA1_LOWTHOLD_INT_SFT 14 ++#define IRQ_EDCA1_LOWTHOLD_INT_HI 14 ++#define IRQ_EDCA1_LOWTHOLD_INT_SZ 1 ++#define IRQ_EDCA2_LOWTHOLD_INT_MSK 0x00008000 ++#define IRQ_EDCA2_LOWTHOLD_INT_I_MSK 0xffff7fff ++#define IRQ_EDCA2_LOWTHOLD_INT_SFT 15 ++#define IRQ_EDCA2_LOWTHOLD_INT_HI 15 ++#define IRQ_EDCA2_LOWTHOLD_INT_SZ 1 ++#define IRQ_EDCA3_LOWTHOLD_INT_MSK 0x00010000 ++#define IRQ_EDCA3_LOWTHOLD_INT_I_MSK 0xfffeffff ++#define IRQ_EDCA3_LOWTHOLD_INT_SFT 16 ++#define IRQ_EDCA3_LOWTHOLD_INT_HI 16 ++#define IRQ_EDCA3_LOWTHOLD_INT_SZ 1 ++#define IRQ_FENCE_HIT_INT_MSK 0x00020000 ++#define IRQ_FENCE_HIT_INT_I_MSK 0xfffdffff ++#define IRQ_FENCE_HIT_INT_SFT 17 ++#define IRQ_FENCE_HIT_INT_HI 17 ++#define IRQ_FENCE_HIT_INT_SZ 1 ++#define IRQ_ILL_ADDR_INT_MSK 0x00040000 ++#define IRQ_ILL_ADDR_INT_I_MSK 0xfffbffff ++#define IRQ_ILL_ADDR_INT_SFT 18 ++#define IRQ_ILL_ADDR_INT_HI 18 ++#define IRQ_ILL_ADDR_INT_SZ 1 ++#define IRQ_MBOX_MSK 0x00080000 ++#define IRQ_MBOX_I_MSK 0xfff7ffff ++#define IRQ_MBOX_SFT 19 ++#define IRQ_MBOX_HI 19 ++#define IRQ_MBOX_SZ 1 ++#define IRQ_US_TIMER0_MSK 0x00100000 ++#define IRQ_US_TIMER0_I_MSK 0xffefffff ++#define IRQ_US_TIMER0_SFT 20 ++#define IRQ_US_TIMER0_HI 20 ++#define IRQ_US_TIMER0_SZ 1 ++#define IRQ_US_TIMER1_MSK 0x00200000 ++#define IRQ_US_TIMER1_I_MSK 0xffdfffff ++#define IRQ_US_TIMER1_SFT 21 ++#define IRQ_US_TIMER1_HI 21 ++#define IRQ_US_TIMER1_SZ 1 ++#define IRQ_US_TIMER2_MSK 0x00400000 ++#define IRQ_US_TIMER2_I_MSK 0xffbfffff ++#define IRQ_US_TIMER2_SFT 22 ++#define IRQ_US_TIMER2_HI 22 ++#define IRQ_US_TIMER2_SZ 1 ++#define IRQ_US_TIMER3_MSK 0x00800000 ++#define IRQ_US_TIMER3_I_MSK 0xff7fffff ++#define IRQ_US_TIMER3_SFT 23 ++#define IRQ_US_TIMER3_HI 23 ++#define IRQ_US_TIMER3_SZ 1 ++#define IRQ_MS_TIMER0_MSK 0x01000000 ++#define IRQ_MS_TIMER0_I_MSK 0xfeffffff ++#define IRQ_MS_TIMER0_SFT 24 ++#define IRQ_MS_TIMER0_HI 24 ++#define IRQ_MS_TIMER0_SZ 1 ++#define IRQ_MS_TIMER1_MSK 0x02000000 ++#define IRQ_MS_TIMER1_I_MSK 0xfdffffff ++#define IRQ_MS_TIMER1_SFT 25 ++#define IRQ_MS_TIMER1_HI 25 ++#define IRQ_MS_TIMER1_SZ 1 ++#define IRQ_MS_TIMER2_MSK 0x04000000 ++#define IRQ_MS_TIMER2_I_MSK 0xfbffffff ++#define IRQ_MS_TIMER2_SFT 26 ++#define IRQ_MS_TIMER2_HI 26 ++#define IRQ_MS_TIMER2_SZ 1 ++#define IRQ_MS_TIMER3_MSK 0x08000000 ++#define IRQ_MS_TIMER3_I_MSK 0xf7ffffff ++#define IRQ_MS_TIMER3_SFT 27 ++#define IRQ_MS_TIMER3_HI 27 ++#define IRQ_MS_TIMER3_SZ 1 ++#define IRQ_TX_LIMIT_INT_MSK 0x10000000 ++#define IRQ_TX_LIMIT_INT_I_MSK 0xefffffff ++#define IRQ_TX_LIMIT_INT_SFT 28 ++#define IRQ_TX_LIMIT_INT_HI 28 ++#define IRQ_TX_LIMIT_INT_SZ 1 ++#define IRQ_DMA0_MSK 0x20000000 ++#define IRQ_DMA0_I_MSK 0xdfffffff ++#define IRQ_DMA0_SFT 29 ++#define IRQ_DMA0_HI 29 ++#define IRQ_DMA0_SZ 1 ++#define IRQ_CO_DMA_MSK 0x40000000 ++#define IRQ_CO_DMA_I_MSK 0xbfffffff ++#define IRQ_CO_DMA_SFT 30 ++#define IRQ_CO_DMA_HI 30 ++#define IRQ_CO_DMA_SZ 1 ++#define IRQ_PERI_GROUP_MSK 0x80000000 ++#define IRQ_PERI_GROUP_I_MSK 0x7fffffff ++#define IRQ_PERI_GROUP_SFT 31 ++#define IRQ_PERI_GROUP_HI 31 ++#define IRQ_PERI_GROUP_SZ 1 ++#define FIQ_STATUS_MSK 0xffffffff ++#define FIQ_STATUS_I_MSK 0x00000000 ++#define FIQ_STATUS_SFT 0 ++#define FIQ_STATUS_HI 31 ++#define FIQ_STATUS_SZ 32 ++#define IRQ_RAW_MSK 0xffffffff ++#define IRQ_RAW_I_MSK 0x00000000 ++#define IRQ_RAW_SFT 0 ++#define IRQ_RAW_HI 31 ++#define IRQ_RAW_SZ 32 ++#define FIQ_RAW_MSK 0xffffffff ++#define FIQ_RAW_I_MSK 0x00000000 ++#define FIQ_RAW_SFT 0 ++#define FIQ_RAW_HI 31 ++#define FIQ_RAW_SZ 32 ++#define INT_PERI_MASK_MSK 0xffffffff ++#define INT_PERI_MASK_I_MSK 0x00000000 ++#define INT_PERI_MASK_SFT 0 ++#define INT_PERI_MASK_HI 31 ++#define INT_PERI_MASK_SZ 32 ++#define PERI_RTC_MSK 0x00000001 ++#define PERI_RTC_I_MSK 0xfffffffe ++#define PERI_RTC_SFT 0 ++#define PERI_RTC_HI 0 ++#define PERI_RTC_SZ 1 ++#define IRQ_UART0_TX_MSK 0x00000002 ++#define IRQ_UART0_TX_I_MSK 0xfffffffd ++#define IRQ_UART0_TX_SFT 1 ++#define IRQ_UART0_TX_HI 1 ++#define IRQ_UART0_TX_SZ 1 ++#define IRQ_UART0_RX_MSK 0x00000004 ++#define IRQ_UART0_RX_I_MSK 0xfffffffb ++#define IRQ_UART0_RX_SFT 2 ++#define IRQ_UART0_RX_HI 2 ++#define IRQ_UART0_RX_SZ 1 ++#define PERI_GPI_2_MSK 0x00000008 ++#define PERI_GPI_2_I_MSK 0xfffffff7 ++#define PERI_GPI_2_SFT 3 ++#define PERI_GPI_2_HI 3 ++#define PERI_GPI_2_SZ 1 ++#define IRQ_SPI_IPC_MSK 0x00000010 ++#define IRQ_SPI_IPC_I_MSK 0xffffffef ++#define IRQ_SPI_IPC_SFT 4 ++#define IRQ_SPI_IPC_HI 4 ++#define IRQ_SPI_IPC_SZ 1 ++#define PERI_GPI_1_0_MSK 0x00000060 ++#define PERI_GPI_1_0_I_MSK 0xffffff9f ++#define PERI_GPI_1_0_SFT 5 ++#define PERI_GPI_1_0_HI 6 ++#define PERI_GPI_1_0_SZ 2 ++#define SCRT_INT_1_MSK 0x00000080 ++#define SCRT_INT_1_I_MSK 0xffffff7f ++#define SCRT_INT_1_SFT 7 ++#define SCRT_INT_1_HI 7 ++#define SCRT_INT_1_SZ 1 ++#define MMU_ALC_ERR_MSK 0x00000100 ++#define MMU_ALC_ERR_I_MSK 0xfffffeff ++#define MMU_ALC_ERR_SFT 8 ++#define MMU_ALC_ERR_HI 8 ++#define MMU_ALC_ERR_SZ 1 ++#define MMU_RLS_ERR_MSK 0x00000200 ++#define MMU_RLS_ERR_I_MSK 0xfffffdff ++#define MMU_RLS_ERR_SFT 9 ++#define MMU_RLS_ERR_HI 9 ++#define MMU_RLS_ERR_SZ 1 ++#define ID_MNG_INT_1_MSK 0x00000400 ++#define ID_MNG_INT_1_I_MSK 0xfffffbff ++#define ID_MNG_INT_1_SFT 10 ++#define ID_MNG_INT_1_HI 10 ++#define ID_MNG_INT_1_SZ 1 ++#define MBOX_INT_1_MSK 0x00000800 ++#define MBOX_INT_1_I_MSK 0xfffff7ff ++#define MBOX_INT_1_SFT 11 ++#define MBOX_INT_1_HI 11 ++#define MBOX_INT_1_SZ 1 ++#define MBOX_INT_2_MSK 0x00001000 ++#define MBOX_INT_2_I_MSK 0xffffefff ++#define MBOX_INT_2_SFT 12 ++#define MBOX_INT_2_HI 12 ++#define MBOX_INT_2_SZ 1 ++#define MBOX_INT_3_MSK 0x00002000 ++#define MBOX_INT_3_I_MSK 0xffffdfff ++#define MBOX_INT_3_SFT 13 ++#define MBOX_INT_3_HI 13 ++#define MBOX_INT_3_SZ 1 ++#define HCI_INT_1_MSK 0x00004000 ++#define HCI_INT_1_I_MSK 0xffffbfff ++#define HCI_INT_1_SFT 14 ++#define HCI_INT_1_HI 14 ++#define HCI_INT_1_SZ 1 ++#define UART_RX_TIMEOUT_MSK 0x00008000 ++#define UART_RX_TIMEOUT_I_MSK 0xffff7fff ++#define UART_RX_TIMEOUT_SFT 15 ++#define UART_RX_TIMEOUT_HI 15 ++#define UART_RX_TIMEOUT_SZ 1 ++#define UART_MULTI_IRQ_MSK 0x00010000 ++#define UART_MULTI_IRQ_I_MSK 0xfffeffff ++#define UART_MULTI_IRQ_SFT 16 ++#define UART_MULTI_IRQ_HI 16 ++#define UART_MULTI_IRQ_SZ 1 ++#define ID_MNG_INT_2_MSK 0x00020000 ++#define ID_MNG_INT_2_I_MSK 0xfffdffff ++#define ID_MNG_INT_2_SFT 17 ++#define ID_MNG_INT_2_HI 17 ++#define ID_MNG_INT_2_SZ 1 ++#define DMN_NOHIT_INT_MSK 0x00040000 ++#define DMN_NOHIT_INT_I_MSK 0xfffbffff ++#define DMN_NOHIT_INT_SFT 18 ++#define DMN_NOHIT_INT_HI 18 ++#define DMN_NOHIT_INT_SZ 1 ++#define ID_THOLD_RX_MSK 0x00080000 ++#define ID_THOLD_RX_I_MSK 0xfff7ffff ++#define ID_THOLD_RX_SFT 19 ++#define ID_THOLD_RX_HI 19 ++#define ID_THOLD_RX_SZ 1 ++#define ID_THOLD_TX_MSK 0x00100000 ++#define ID_THOLD_TX_I_MSK 0xffefffff ++#define ID_THOLD_TX_SFT 20 ++#define ID_THOLD_TX_HI 20 ++#define ID_THOLD_TX_SZ 1 ++#define ID_DOUBLE_RLS_MSK 0x00200000 ++#define ID_DOUBLE_RLS_I_MSK 0xffdfffff ++#define ID_DOUBLE_RLS_SFT 21 ++#define ID_DOUBLE_RLS_HI 21 ++#define ID_DOUBLE_RLS_SZ 1 ++#define RX_ID_LEN_THOLD_MSK 0x00400000 ++#define RX_ID_LEN_THOLD_I_MSK 0xffbfffff ++#define RX_ID_LEN_THOLD_SFT 22 ++#define RX_ID_LEN_THOLD_HI 22 ++#define RX_ID_LEN_THOLD_SZ 1 ++#define TX_ID_LEN_THOLD_MSK 0x00800000 ++#define TX_ID_LEN_THOLD_I_MSK 0xff7fffff ++#define TX_ID_LEN_THOLD_SFT 23 ++#define TX_ID_LEN_THOLD_HI 23 ++#define TX_ID_LEN_THOLD_SZ 1 ++#define ALL_ID_LEN_THOLD_MSK 0x01000000 ++#define ALL_ID_LEN_THOLD_I_MSK 0xfeffffff ++#define ALL_ID_LEN_THOLD_SFT 24 ++#define ALL_ID_LEN_THOLD_HI 24 ++#define ALL_ID_LEN_THOLD_SZ 1 ++#define DMN_MCU_INT_MSK 0x02000000 ++#define DMN_MCU_INT_I_MSK 0xfdffffff ++#define DMN_MCU_INT_SFT 25 ++#define DMN_MCU_INT_HI 25 ++#define DMN_MCU_INT_SZ 1 ++#define IRQ_DAT_UART_TX_MSK 0x04000000 ++#define IRQ_DAT_UART_TX_I_MSK 0xfbffffff ++#define IRQ_DAT_UART_TX_SFT 26 ++#define IRQ_DAT_UART_TX_HI 26 ++#define IRQ_DAT_UART_TX_SZ 1 ++#define IRQ_DAT_UART_RX_MSK 0x08000000 ++#define IRQ_DAT_UART_RX_I_MSK 0xf7ffffff ++#define IRQ_DAT_UART_RX_SFT 27 ++#define IRQ_DAT_UART_RX_HI 27 ++#define IRQ_DAT_UART_RX_SZ 1 ++#define DAT_UART_RX_TIMEOUT_MSK 0x10000000 ++#define DAT_UART_RX_TIMEOUT_I_MSK 0xefffffff ++#define DAT_UART_RX_TIMEOUT_SFT 28 ++#define DAT_UART_RX_TIMEOUT_HI 28 ++#define DAT_UART_RX_TIMEOUT_SZ 1 ++#define DAT_UART_MULTI_IRQ_MSK 0x20000000 ++#define DAT_UART_MULTI_IRQ_I_MSK 0xdfffffff ++#define DAT_UART_MULTI_IRQ_SFT 29 ++#define DAT_UART_MULTI_IRQ_HI 29 ++#define DAT_UART_MULTI_IRQ_SZ 1 ++#define ALR_ABT_NOCHG_INT_IRQ_MSK 0x40000000 ++#define ALR_ABT_NOCHG_INT_IRQ_I_MSK 0xbfffffff ++#define ALR_ABT_NOCHG_INT_IRQ_SFT 30 ++#define ALR_ABT_NOCHG_INT_IRQ_HI 30 ++#define ALR_ABT_NOCHG_INT_IRQ_SZ 1 ++#define TBLNEQ_MNGPKT_INT_IRQ_MSK 0x80000000 ++#define TBLNEQ_MNGPKT_INT_IRQ_I_MSK 0x7fffffff ++#define TBLNEQ_MNGPKT_INT_IRQ_SFT 31 ++#define TBLNEQ_MNGPKT_INT_IRQ_HI 31 ++#define TBLNEQ_MNGPKT_INT_IRQ_SZ 1 ++#define INTR_PERI_RAW_MSK 0xffffffff ++#define INTR_PERI_RAW_I_MSK 0x00000000 ++#define INTR_PERI_RAW_SFT 0 ++#define INTR_PERI_RAW_HI 31 ++#define INTR_PERI_RAW_SZ 32 ++#define INTR_GPI00_CFG_MSK 0x00000003 ++#define INTR_GPI00_CFG_I_MSK 0xfffffffc ++#define INTR_GPI00_CFG_SFT 0 ++#define INTR_GPI00_CFG_HI 1 ++#define INTR_GPI00_CFG_SZ 2 ++#define INTR_GPI01_CFG_MSK 0x0000000c ++#define INTR_GPI01_CFG_I_MSK 0xfffffff3 ++#define INTR_GPI01_CFG_SFT 2 ++#define INTR_GPI01_CFG_HI 3 ++#define INTR_GPI01_CFG_SZ 2 ++#define SYS_RST_INT_MSK 0x00000001 ++#define SYS_RST_INT_I_MSK 0xfffffffe ++#define SYS_RST_INT_SFT 0 ++#define SYS_RST_INT_HI 0 ++#define SYS_RST_INT_SZ 1 ++#define SPI_IPC_ADDR_MSK 0xffffffff ++#define SPI_IPC_ADDR_I_MSK 0x00000000 ++#define SPI_IPC_ADDR_SFT 0 ++#define SPI_IPC_ADDR_HI 31 ++#define SPI_IPC_ADDR_SZ 32 ++#define SD_MASK_TOP_MSK 0xffffffff ++#define SD_MASK_TOP_I_MSK 0x00000000 ++#define SD_MASK_TOP_SFT 0 ++#define SD_MASK_TOP_HI 31 ++#define SD_MASK_TOP_SZ 32 ++#define IRQ_PHY_0_SD_MSK 0x00000001 ++#define IRQ_PHY_0_SD_I_MSK 0xfffffffe ++#define IRQ_PHY_0_SD_SFT 0 ++#define IRQ_PHY_0_SD_HI 0 ++#define IRQ_PHY_0_SD_SZ 1 ++#define IRQ_PHY_1_SD_MSK 0x00000002 ++#define IRQ_PHY_1_SD_I_MSK 0xfffffffd ++#define IRQ_PHY_1_SD_SFT 1 ++#define IRQ_PHY_1_SD_HI 1 ++#define IRQ_PHY_1_SD_SZ 1 ++#define IRQ_SDIO_SD_MSK 0x00000004 ++#define IRQ_SDIO_SD_I_MSK 0xfffffffb ++#define IRQ_SDIO_SD_SFT 2 ++#define IRQ_SDIO_SD_HI 2 ++#define IRQ_SDIO_SD_SZ 1 ++#define IRQ_BEACON_DONE_SD_MSK 0x00000008 ++#define IRQ_BEACON_DONE_SD_I_MSK 0xfffffff7 ++#define IRQ_BEACON_DONE_SD_SFT 3 ++#define IRQ_BEACON_DONE_SD_HI 3 ++#define IRQ_BEACON_DONE_SD_SZ 1 ++#define IRQ_BEACON_SD_MSK 0x00000010 ++#define IRQ_BEACON_SD_I_MSK 0xffffffef ++#define IRQ_BEACON_SD_SFT 4 ++#define IRQ_BEACON_SD_HI 4 ++#define IRQ_BEACON_SD_SZ 1 ++#define IRQ_PRE_BEACON_SD_MSK 0x00000020 ++#define IRQ_PRE_BEACON_SD_I_MSK 0xffffffdf ++#define IRQ_PRE_BEACON_SD_SFT 5 ++#define IRQ_PRE_BEACON_SD_HI 5 ++#define IRQ_PRE_BEACON_SD_SZ 1 ++#define IRQ_EDCA0_TX_DONE_SD_MSK 0x00000040 ++#define IRQ_EDCA0_TX_DONE_SD_I_MSK 0xffffffbf ++#define IRQ_EDCA0_TX_DONE_SD_SFT 6 ++#define IRQ_EDCA0_TX_DONE_SD_HI 6 ++#define IRQ_EDCA0_TX_DONE_SD_SZ 1 ++#define IRQ_EDCA1_TX_DONE_SD_MSK 0x00000080 ++#define IRQ_EDCA1_TX_DONE_SD_I_MSK 0xffffff7f ++#define IRQ_EDCA1_TX_DONE_SD_SFT 7 ++#define IRQ_EDCA1_TX_DONE_SD_HI 7 ++#define IRQ_EDCA1_TX_DONE_SD_SZ 1 ++#define IRQ_EDCA2_TX_DONE_SD_MSK 0x00000100 ++#define IRQ_EDCA2_TX_DONE_SD_I_MSK 0xfffffeff ++#define IRQ_EDCA2_TX_DONE_SD_SFT 8 ++#define IRQ_EDCA2_TX_DONE_SD_HI 8 ++#define IRQ_EDCA2_TX_DONE_SD_SZ 1 ++#define IRQ_EDCA3_TX_DONE_SD_MSK 0x00000200 ++#define IRQ_EDCA3_TX_DONE_SD_I_MSK 0xfffffdff ++#define IRQ_EDCA3_TX_DONE_SD_SFT 9 ++#define IRQ_EDCA3_TX_DONE_SD_HI 9 ++#define IRQ_EDCA3_TX_DONE_SD_SZ 1 ++#define IRQ_EDCA4_TX_DONE_SD_MSK 0x00000400 ++#define IRQ_EDCA4_TX_DONE_SD_I_MSK 0xfffffbff ++#define IRQ_EDCA4_TX_DONE_SD_SFT 10 ++#define IRQ_EDCA4_TX_DONE_SD_HI 10 ++#define IRQ_EDCA4_TX_DONE_SD_SZ 1 ++#define IRQ_BEACON_DTIM_SD_MSK 0x00001000 ++#define IRQ_BEACON_DTIM_SD_I_MSK 0xffffefff ++#define IRQ_BEACON_DTIM_SD_SFT 12 ++#define IRQ_BEACON_DTIM_SD_HI 12 ++#define IRQ_BEACON_DTIM_SD_SZ 1 ++#define IRQ_EDCA0_LOWTHOLD_INT_SD_MSK 0x00002000 ++#define IRQ_EDCA0_LOWTHOLD_INT_SD_I_MSK 0xffffdfff ++#define IRQ_EDCA0_LOWTHOLD_INT_SD_SFT 13 ++#define IRQ_EDCA0_LOWTHOLD_INT_SD_HI 13 ++#define IRQ_EDCA0_LOWTHOLD_INT_SD_SZ 1 ++#define IRQ_EDCA1_LOWTHOLD_INT_SD_MSK 0x00004000 ++#define IRQ_EDCA1_LOWTHOLD_INT_SD_I_MSK 0xffffbfff ++#define IRQ_EDCA1_LOWTHOLD_INT_SD_SFT 14 ++#define IRQ_EDCA1_LOWTHOLD_INT_SD_HI 14 ++#define IRQ_EDCA1_LOWTHOLD_INT_SD_SZ 1 ++#define IRQ_EDCA2_LOWTHOLD_INT_SD_MSK 0x00008000 ++#define IRQ_EDCA2_LOWTHOLD_INT_SD_I_MSK 0xffff7fff ++#define IRQ_EDCA2_LOWTHOLD_INT_SD_SFT 15 ++#define IRQ_EDCA2_LOWTHOLD_INT_SD_HI 15 ++#define IRQ_EDCA2_LOWTHOLD_INT_SD_SZ 1 ++#define IRQ_EDCA3_LOWTHOLD_INT_SD_MSK 0x00010000 ++#define IRQ_EDCA3_LOWTHOLD_INT_SD_I_MSK 0xfffeffff ++#define IRQ_EDCA3_LOWTHOLD_INT_SD_SFT 16 ++#define IRQ_EDCA3_LOWTHOLD_INT_SD_HI 16 ++#define IRQ_EDCA3_LOWTHOLD_INT_SD_SZ 1 ++#define IRQ_FENCE_HIT_INT_SD_MSK 0x00020000 ++#define IRQ_FENCE_HIT_INT_SD_I_MSK 0xfffdffff ++#define IRQ_FENCE_HIT_INT_SD_SFT 17 ++#define IRQ_FENCE_HIT_INT_SD_HI 17 ++#define IRQ_FENCE_HIT_INT_SD_SZ 1 ++#define IRQ_ILL_ADDR_INT_SD_MSK 0x00040000 ++#define IRQ_ILL_ADDR_INT_SD_I_MSK 0xfffbffff ++#define IRQ_ILL_ADDR_INT_SD_SFT 18 ++#define IRQ_ILL_ADDR_INT_SD_HI 18 ++#define IRQ_ILL_ADDR_INT_SD_SZ 1 ++#define IRQ_MBOX_SD_MSK 0x00080000 ++#define IRQ_MBOX_SD_I_MSK 0xfff7ffff ++#define IRQ_MBOX_SD_SFT 19 ++#define IRQ_MBOX_SD_HI 19 ++#define IRQ_MBOX_SD_SZ 1 ++#define IRQ_US_TIMER0_SD_MSK 0x00100000 ++#define IRQ_US_TIMER0_SD_I_MSK 0xffefffff ++#define IRQ_US_TIMER0_SD_SFT 20 ++#define IRQ_US_TIMER0_SD_HI 20 ++#define IRQ_US_TIMER0_SD_SZ 1 ++#define IRQ_US_TIMER1_SD_MSK 0x00200000 ++#define IRQ_US_TIMER1_SD_I_MSK 0xffdfffff ++#define IRQ_US_TIMER1_SD_SFT 21 ++#define IRQ_US_TIMER1_SD_HI 21 ++#define IRQ_US_TIMER1_SD_SZ 1 ++#define IRQ_US_TIMER2_SD_MSK 0x00400000 ++#define IRQ_US_TIMER2_SD_I_MSK 0xffbfffff ++#define IRQ_US_TIMER2_SD_SFT 22 ++#define IRQ_US_TIMER2_SD_HI 22 ++#define IRQ_US_TIMER2_SD_SZ 1 ++#define IRQ_US_TIMER3_SD_MSK 0x00800000 ++#define IRQ_US_TIMER3_SD_I_MSK 0xff7fffff ++#define IRQ_US_TIMER3_SD_SFT 23 ++#define IRQ_US_TIMER3_SD_HI 23 ++#define IRQ_US_TIMER3_SD_SZ 1 ++#define IRQ_MS_TIMER0_SD_MSK 0x01000000 ++#define IRQ_MS_TIMER0_SD_I_MSK 0xfeffffff ++#define IRQ_MS_TIMER0_SD_SFT 24 ++#define IRQ_MS_TIMER0_SD_HI 24 ++#define IRQ_MS_TIMER0_SD_SZ 1 ++#define IRQ_MS_TIMER1_SD_MSK 0x02000000 ++#define IRQ_MS_TIMER1_SD_I_MSK 0xfdffffff ++#define IRQ_MS_TIMER1_SD_SFT 25 ++#define IRQ_MS_TIMER1_SD_HI 25 ++#define IRQ_MS_TIMER1_SD_SZ 1 ++#define IRQ_MS_TIMER2_SD_MSK 0x04000000 ++#define IRQ_MS_TIMER2_SD_I_MSK 0xfbffffff ++#define IRQ_MS_TIMER2_SD_SFT 26 ++#define IRQ_MS_TIMER2_SD_HI 26 ++#define IRQ_MS_TIMER2_SD_SZ 1 ++#define IRQ_MS_TIMER3_SD_MSK 0x08000000 ++#define IRQ_MS_TIMER3_SD_I_MSK 0xf7ffffff ++#define IRQ_MS_TIMER3_SD_SFT 27 ++#define IRQ_MS_TIMER3_SD_HI 27 ++#define IRQ_MS_TIMER3_SD_SZ 1 ++#define IRQ_TX_LIMIT_INT_SD_MSK 0x10000000 ++#define IRQ_TX_LIMIT_INT_SD_I_MSK 0xefffffff ++#define IRQ_TX_LIMIT_INT_SD_SFT 28 ++#define IRQ_TX_LIMIT_INT_SD_HI 28 ++#define IRQ_TX_LIMIT_INT_SD_SZ 1 ++#define IRQ_DMA0_SD_MSK 0x20000000 ++#define IRQ_DMA0_SD_I_MSK 0xdfffffff ++#define IRQ_DMA0_SD_SFT 29 ++#define IRQ_DMA0_SD_HI 29 ++#define IRQ_DMA0_SD_SZ 1 ++#define IRQ_CO_DMA_SD_MSK 0x40000000 ++#define IRQ_CO_DMA_SD_I_MSK 0xbfffffff ++#define IRQ_CO_DMA_SD_SFT 30 ++#define IRQ_CO_DMA_SD_HI 30 ++#define IRQ_CO_DMA_SD_SZ 1 ++#define IRQ_PERI_GROUP_SD_MSK 0x80000000 ++#define IRQ_PERI_GROUP_SD_I_MSK 0x7fffffff ++#define IRQ_PERI_GROUP_SD_SFT 31 ++#define IRQ_PERI_GROUP_SD_HI 31 ++#define IRQ_PERI_GROUP_SD_SZ 1 ++#define INT_PERI_MASK_SD_MSK 0xffffffff ++#define INT_PERI_MASK_SD_I_MSK 0x00000000 ++#define INT_PERI_MASK_SD_SFT 0 ++#define INT_PERI_MASK_SD_HI 31 ++#define INT_PERI_MASK_SD_SZ 32 ++#define PERI_RTC_SD_MSK 0x00000001 ++#define PERI_RTC_SD_I_MSK 0xfffffffe ++#define PERI_RTC_SD_SFT 0 ++#define PERI_RTC_SD_HI 0 ++#define PERI_RTC_SD_SZ 1 ++#define IRQ_UART0_TX_SD_MSK 0x00000002 ++#define IRQ_UART0_TX_SD_I_MSK 0xfffffffd ++#define IRQ_UART0_TX_SD_SFT 1 ++#define IRQ_UART0_TX_SD_HI 1 ++#define IRQ_UART0_TX_SD_SZ 1 ++#define IRQ_UART0_RX_SD_MSK 0x00000004 ++#define IRQ_UART0_RX_SD_I_MSK 0xfffffffb ++#define IRQ_UART0_RX_SD_SFT 2 ++#define IRQ_UART0_RX_SD_HI 2 ++#define IRQ_UART0_RX_SD_SZ 1 ++#define PERI_GPI_SD_2_MSK 0x00000008 ++#define PERI_GPI_SD_2_I_MSK 0xfffffff7 ++#define PERI_GPI_SD_2_SFT 3 ++#define PERI_GPI_SD_2_HI 3 ++#define PERI_GPI_SD_2_SZ 1 ++#define IRQ_SPI_IPC_SD_MSK 0x00000010 ++#define IRQ_SPI_IPC_SD_I_MSK 0xffffffef ++#define IRQ_SPI_IPC_SD_SFT 4 ++#define IRQ_SPI_IPC_SD_HI 4 ++#define IRQ_SPI_IPC_SD_SZ 1 ++#define PERI_GPI_SD_1_0_MSK 0x00000060 ++#define PERI_GPI_SD_1_0_I_MSK 0xffffff9f ++#define PERI_GPI_SD_1_0_SFT 5 ++#define PERI_GPI_SD_1_0_HI 6 ++#define PERI_GPI_SD_1_0_SZ 2 ++#define SCRT_INT_1_SD_MSK 0x00000080 ++#define SCRT_INT_1_SD_I_MSK 0xffffff7f ++#define SCRT_INT_1_SD_SFT 7 ++#define SCRT_INT_1_SD_HI 7 ++#define SCRT_INT_1_SD_SZ 1 ++#define MMU_ALC_ERR_SD_MSK 0x00000100 ++#define MMU_ALC_ERR_SD_I_MSK 0xfffffeff ++#define MMU_ALC_ERR_SD_SFT 8 ++#define MMU_ALC_ERR_SD_HI 8 ++#define MMU_ALC_ERR_SD_SZ 1 ++#define MMU_RLS_ERR_SD_MSK 0x00000200 ++#define MMU_RLS_ERR_SD_I_MSK 0xfffffdff ++#define MMU_RLS_ERR_SD_SFT 9 ++#define MMU_RLS_ERR_SD_HI 9 ++#define MMU_RLS_ERR_SD_SZ 1 ++#define ID_MNG_INT_1_SD_MSK 0x00000400 ++#define ID_MNG_INT_1_SD_I_MSK 0xfffffbff ++#define ID_MNG_INT_1_SD_SFT 10 ++#define ID_MNG_INT_1_SD_HI 10 ++#define ID_MNG_INT_1_SD_SZ 1 ++#define MBOX_INT_1_SD_MSK 0x00000800 ++#define MBOX_INT_1_SD_I_MSK 0xfffff7ff ++#define MBOX_INT_1_SD_SFT 11 ++#define MBOX_INT_1_SD_HI 11 ++#define MBOX_INT_1_SD_SZ 1 ++#define MBOX_INT_2_SD_MSK 0x00001000 ++#define MBOX_INT_2_SD_I_MSK 0xffffefff ++#define MBOX_INT_2_SD_SFT 12 ++#define MBOX_INT_2_SD_HI 12 ++#define MBOX_INT_2_SD_SZ 1 ++#define MBOX_INT_3_SD_MSK 0x00002000 ++#define MBOX_INT_3_SD_I_MSK 0xffffdfff ++#define MBOX_INT_3_SD_SFT 13 ++#define MBOX_INT_3_SD_HI 13 ++#define MBOX_INT_3_SD_SZ 1 ++#define HCI_INT_1_SD_MSK 0x00004000 ++#define HCI_INT_1_SD_I_MSK 0xffffbfff ++#define HCI_INT_1_SD_SFT 14 ++#define HCI_INT_1_SD_HI 14 ++#define HCI_INT_1_SD_SZ 1 ++#define UART_RX_TIMEOUT_SD_MSK 0x00008000 ++#define UART_RX_TIMEOUT_SD_I_MSK 0xffff7fff ++#define UART_RX_TIMEOUT_SD_SFT 15 ++#define UART_RX_TIMEOUT_SD_HI 15 ++#define UART_RX_TIMEOUT_SD_SZ 1 ++#define UART_MULTI_IRQ_SD_MSK 0x00010000 ++#define UART_MULTI_IRQ_SD_I_MSK 0xfffeffff ++#define UART_MULTI_IRQ_SD_SFT 16 ++#define UART_MULTI_IRQ_SD_HI 16 ++#define UART_MULTI_IRQ_SD_SZ 1 ++#define ID_MNG_INT_2_SD_MSK 0x00020000 ++#define ID_MNG_INT_2_SD_I_MSK 0xfffdffff ++#define ID_MNG_INT_2_SD_SFT 17 ++#define ID_MNG_INT_2_SD_HI 17 ++#define ID_MNG_INT_2_SD_SZ 1 ++#define DMN_NOHIT_INT_SD_MSK 0x00040000 ++#define DMN_NOHIT_INT_SD_I_MSK 0xfffbffff ++#define DMN_NOHIT_INT_SD_SFT 18 ++#define DMN_NOHIT_INT_SD_HI 18 ++#define DMN_NOHIT_INT_SD_SZ 1 ++#define ID_THOLD_RX_SD_MSK 0x00080000 ++#define ID_THOLD_RX_SD_I_MSK 0xfff7ffff ++#define ID_THOLD_RX_SD_SFT 19 ++#define ID_THOLD_RX_SD_HI 19 ++#define ID_THOLD_RX_SD_SZ 1 ++#define ID_THOLD_TX_SD_MSK 0x00100000 ++#define ID_THOLD_TX_SD_I_MSK 0xffefffff ++#define ID_THOLD_TX_SD_SFT 20 ++#define ID_THOLD_TX_SD_HI 20 ++#define ID_THOLD_TX_SD_SZ 1 ++#define ID_DOUBLE_RLS_SD_MSK 0x00200000 ++#define ID_DOUBLE_RLS_SD_I_MSK 0xffdfffff ++#define ID_DOUBLE_RLS_SD_SFT 21 ++#define ID_DOUBLE_RLS_SD_HI 21 ++#define ID_DOUBLE_RLS_SD_SZ 1 ++#define RX_ID_LEN_THOLD_SD_MSK 0x00400000 ++#define RX_ID_LEN_THOLD_SD_I_MSK 0xffbfffff ++#define RX_ID_LEN_THOLD_SD_SFT 22 ++#define RX_ID_LEN_THOLD_SD_HI 22 ++#define RX_ID_LEN_THOLD_SD_SZ 1 ++#define TX_ID_LEN_THOLD_SD_MSK 0x00800000 ++#define TX_ID_LEN_THOLD_SD_I_MSK 0xff7fffff ++#define TX_ID_LEN_THOLD_SD_SFT 23 ++#define TX_ID_LEN_THOLD_SD_HI 23 ++#define TX_ID_LEN_THOLD_SD_SZ 1 ++#define ALL_ID_LEN_THOLD_SD_MSK 0x01000000 ++#define ALL_ID_LEN_THOLD_SD_I_MSK 0xfeffffff ++#define ALL_ID_LEN_THOLD_SD_SFT 24 ++#define ALL_ID_LEN_THOLD_SD_HI 24 ++#define ALL_ID_LEN_THOLD_SD_SZ 1 ++#define DMN_MCU_INT_SD_MSK 0x02000000 ++#define DMN_MCU_INT_SD_I_MSK 0xfdffffff ++#define DMN_MCU_INT_SD_SFT 25 ++#define DMN_MCU_INT_SD_HI 25 ++#define DMN_MCU_INT_SD_SZ 1 ++#define IRQ_DAT_UART_TX_SD_MSK 0x04000000 ++#define IRQ_DAT_UART_TX_SD_I_MSK 0xfbffffff ++#define IRQ_DAT_UART_TX_SD_SFT 26 ++#define IRQ_DAT_UART_TX_SD_HI 26 ++#define IRQ_DAT_UART_TX_SD_SZ 1 ++#define IRQ_DAT_UART_RX_SD_MSK 0x08000000 ++#define IRQ_DAT_UART_RX_SD_I_MSK 0xf7ffffff ++#define IRQ_DAT_UART_RX_SD_SFT 27 ++#define IRQ_DAT_UART_RX_SD_HI 27 ++#define IRQ_DAT_UART_RX_SD_SZ 1 ++#define DAT_UART_RX_TIMEOUT_SD_MSK 0x10000000 ++#define DAT_UART_RX_TIMEOUT_SD_I_MSK 0xefffffff ++#define DAT_UART_RX_TIMEOUT_SD_SFT 28 ++#define DAT_UART_RX_TIMEOUT_SD_HI 28 ++#define DAT_UART_RX_TIMEOUT_SD_SZ 1 ++#define DAT_UART_MULTI_IRQ_SD_MSK 0x20000000 ++#define DAT_UART_MULTI_IRQ_SD_I_MSK 0xdfffffff ++#define DAT_UART_MULTI_IRQ_SD_SFT 29 ++#define DAT_UART_MULTI_IRQ_SD_HI 29 ++#define DAT_UART_MULTI_IRQ_SD_SZ 1 ++#define ALR_ABT_NOCHG_INT_IRQ_SD_MSK 0x40000000 ++#define ALR_ABT_NOCHG_INT_IRQ_SD_I_MSK 0xbfffffff ++#define ALR_ABT_NOCHG_INT_IRQ_SD_SFT 30 ++#define ALR_ABT_NOCHG_INT_IRQ_SD_HI 30 ++#define ALR_ABT_NOCHG_INT_IRQ_SD_SZ 1 ++#define TBLNEQ_MNGPKT_INT_IRQ_SD_MSK 0x80000000 ++#define TBLNEQ_MNGPKT_INT_IRQ_SD_I_MSK 0x7fffffff ++#define TBLNEQ_MNGPKT_INT_IRQ_SD_SFT 31 ++#define TBLNEQ_MNGPKT_INT_IRQ_SD_HI 31 ++#define TBLNEQ_MNGPKT_INT_IRQ_SD_SZ 1 ++#define DBG_SPI_MODE_MSK 0xffffffff ++#define DBG_SPI_MODE_I_MSK 0x00000000 ++#define DBG_SPI_MODE_SFT 0 ++#define DBG_SPI_MODE_HI 31 ++#define DBG_SPI_MODE_SZ 32 ++#define DBG_RX_QUOTA_MSK 0x0000ffff ++#define DBG_RX_QUOTA_I_MSK 0xffff0000 ++#define DBG_RX_QUOTA_SFT 0 ++#define DBG_RX_QUOTA_HI 15 ++#define DBG_RX_QUOTA_SZ 16 ++#define DBG_CONDI_NUM_MSK 0x000000ff ++#define DBG_CONDI_NUM_I_MSK 0xffffff00 ++#define DBG_CONDI_NUM_SFT 0 ++#define DBG_CONDI_NUM_HI 7 ++#define DBG_CONDI_NUM_SZ 8 ++#define DBG_HOST_PATH_MSK 0x00000001 ++#define DBG_HOST_PATH_I_MSK 0xfffffffe ++#define DBG_HOST_PATH_SFT 0 ++#define DBG_HOST_PATH_HI 0 ++#define DBG_HOST_PATH_SZ 1 ++#define DBG_TX_SEG_MSK 0xffffffff ++#define DBG_TX_SEG_I_MSK 0x00000000 ++#define DBG_TX_SEG_SFT 0 ++#define DBG_TX_SEG_HI 31 ++#define DBG_TX_SEG_SZ 32 ++#define DBG_BRST_MODE_MSK 0x00000001 ++#define DBG_BRST_MODE_I_MSK 0xfffffffe ++#define DBG_BRST_MODE_SFT 0 ++#define DBG_BRST_MODE_HI 0 ++#define DBG_BRST_MODE_SZ 1 ++#define DBG_CLK_WIDTH_MSK 0x0000ffff ++#define DBG_CLK_WIDTH_I_MSK 0xffff0000 ++#define DBG_CLK_WIDTH_SFT 0 ++#define DBG_CLK_WIDTH_HI 15 ++#define DBG_CLK_WIDTH_SZ 16 ++#define DBG_CSN_INTER_MSK 0xffff0000 ++#define DBG_CSN_INTER_I_MSK 0x0000ffff ++#define DBG_CSN_INTER_SFT 16 ++#define DBG_CSN_INTER_HI 31 ++#define DBG_CSN_INTER_SZ 16 ++#define DBG_BACK_DLY_MSK 0x0000ffff ++#define DBG_BACK_DLY_I_MSK 0xffff0000 ++#define DBG_BACK_DLY_SFT 0 ++#define DBG_BACK_DLY_HI 15 ++#define DBG_BACK_DLY_SZ 16 ++#define DBG_FRONT_DLY_MSK 0xffff0000 ++#define DBG_FRONT_DLY_I_MSK 0x0000ffff ++#define DBG_FRONT_DLY_SFT 16 ++#define DBG_FRONT_DLY_HI 31 ++#define DBG_FRONT_DLY_SZ 16 ++#define DBG_RX_FIFO_FAIL_MSK 0x00000002 ++#define DBG_RX_FIFO_FAIL_I_MSK 0xfffffffd ++#define DBG_RX_FIFO_FAIL_SFT 1 ++#define DBG_RX_FIFO_FAIL_HI 1 ++#define DBG_RX_FIFO_FAIL_SZ 1 ++#define DBG_RX_HOST_FAIL_MSK 0x00000004 ++#define DBG_RX_HOST_FAIL_I_MSK 0xfffffffb ++#define DBG_RX_HOST_FAIL_SFT 2 ++#define DBG_RX_HOST_FAIL_HI 2 ++#define DBG_RX_HOST_FAIL_SZ 1 ++#define DBG_TX_FIFO_FAIL_MSK 0x00000008 ++#define DBG_TX_FIFO_FAIL_I_MSK 0xfffffff7 ++#define DBG_TX_FIFO_FAIL_SFT 3 ++#define DBG_TX_FIFO_FAIL_HI 3 ++#define DBG_TX_FIFO_FAIL_SZ 1 ++#define DBG_TX_HOST_FAIL_MSK 0x00000010 ++#define DBG_TX_HOST_FAIL_I_MSK 0xffffffef ++#define DBG_TX_HOST_FAIL_SFT 4 ++#define DBG_TX_HOST_FAIL_HI 4 ++#define DBG_TX_HOST_FAIL_SZ 1 ++#define DBG_SPI_DOUBLE_ALLOC_MSK 0x00000020 ++#define DBG_SPI_DOUBLE_ALLOC_I_MSK 0xffffffdf ++#define DBG_SPI_DOUBLE_ALLOC_SFT 5 ++#define DBG_SPI_DOUBLE_ALLOC_HI 5 ++#define DBG_SPI_DOUBLE_ALLOC_SZ 1 ++#define DBG_SPI_TX_NO_ALLOC_MSK 0x00000040 ++#define DBG_SPI_TX_NO_ALLOC_I_MSK 0xffffffbf ++#define DBG_SPI_TX_NO_ALLOC_SFT 6 ++#define DBG_SPI_TX_NO_ALLOC_HI 6 ++#define DBG_SPI_TX_NO_ALLOC_SZ 1 ++#define DBG_RDATA_RDY_MSK 0x00000080 ++#define DBG_RDATA_RDY_I_MSK 0xffffff7f ++#define DBG_RDATA_RDY_SFT 7 ++#define DBG_RDATA_RDY_HI 7 ++#define DBG_RDATA_RDY_SZ 1 ++#define DBG_SPI_ALLOC_STATUS_MSK 0x00000100 ++#define DBG_SPI_ALLOC_STATUS_I_MSK 0xfffffeff ++#define DBG_SPI_ALLOC_STATUS_SFT 8 ++#define DBG_SPI_ALLOC_STATUS_HI 8 ++#define DBG_SPI_ALLOC_STATUS_SZ 1 ++#define DBG_SPI_DBG_WR_FIFO_FULL_MSK 0x00000200 ++#define DBG_SPI_DBG_WR_FIFO_FULL_I_MSK 0xfffffdff ++#define DBG_SPI_DBG_WR_FIFO_FULL_SFT 9 ++#define DBG_SPI_DBG_WR_FIFO_FULL_HI 9 ++#define DBG_SPI_DBG_WR_FIFO_FULL_SZ 1 ++#define DBG_RX_LEN_MSK 0xffff0000 ++#define DBG_RX_LEN_I_MSK 0x0000ffff ++#define DBG_RX_LEN_SFT 16 ++#define DBG_RX_LEN_HI 31 ++#define DBG_RX_LEN_SZ 16 ++#define DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS_MSK 0x00000007 ++#define DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS_I_MSK 0xfffffff8 ++#define DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS_SFT 0 ++#define DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS_HI 2 ++#define DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS_SZ 3 ++#define DBG_SPI_HOST_TX_ALLOC_PKBUF_MSK 0x00000100 ++#define DBG_SPI_HOST_TX_ALLOC_PKBUF_I_MSK 0xfffffeff ++#define DBG_SPI_HOST_TX_ALLOC_PKBUF_SFT 8 ++#define DBG_SPI_HOST_TX_ALLOC_PKBUF_HI 8 ++#define DBG_SPI_HOST_TX_ALLOC_PKBUF_SZ 1 ++#define DBG_SPI_TX_ALLOC_SIZE_MSK 0x000000ff ++#define DBG_SPI_TX_ALLOC_SIZE_I_MSK 0xffffff00 ++#define DBG_SPI_TX_ALLOC_SIZE_SFT 0 ++#define DBG_SPI_TX_ALLOC_SIZE_HI 7 ++#define DBG_SPI_TX_ALLOC_SIZE_SZ 8 ++#define DBG_RD_DAT_CNT_MSK 0x0000ffff ++#define DBG_RD_DAT_CNT_I_MSK 0xffff0000 ++#define DBG_RD_DAT_CNT_SFT 0 ++#define DBG_RD_DAT_CNT_HI 15 ++#define DBG_RD_DAT_CNT_SZ 16 ++#define DBG_RD_STS_CNT_MSK 0xffff0000 ++#define DBG_RD_STS_CNT_I_MSK 0x0000ffff ++#define DBG_RD_STS_CNT_SFT 16 ++#define DBG_RD_STS_CNT_HI 31 ++#define DBG_RD_STS_CNT_SZ 16 ++#define DBG_JUDGE_CNT_MSK 0x0000ffff ++#define DBG_JUDGE_CNT_I_MSK 0xffff0000 ++#define DBG_JUDGE_CNT_SFT 0 ++#define DBG_JUDGE_CNT_HI 15 ++#define DBG_JUDGE_CNT_SZ 16 ++#define DBG_RD_STS_CNT_CLR_MSK 0x00010000 ++#define DBG_RD_STS_CNT_CLR_I_MSK 0xfffeffff ++#define DBG_RD_STS_CNT_CLR_SFT 16 ++#define DBG_RD_STS_CNT_CLR_HI 16 ++#define DBG_RD_STS_CNT_CLR_SZ 1 ++#define DBG_RD_DAT_CNT_CLR_MSK 0x00020000 ++#define DBG_RD_DAT_CNT_CLR_I_MSK 0xfffdffff ++#define DBG_RD_DAT_CNT_CLR_SFT 17 ++#define DBG_RD_DAT_CNT_CLR_HI 17 ++#define DBG_RD_DAT_CNT_CLR_SZ 1 ++#define DBG_JUDGE_CNT_CLR_MSK 0x00040000 ++#define DBG_JUDGE_CNT_CLR_I_MSK 0xfffbffff ++#define DBG_JUDGE_CNT_CLR_SFT 18 ++#define DBG_JUDGE_CNT_CLR_HI 18 ++#define DBG_JUDGE_CNT_CLR_SZ 1 ++#define DBG_TX_DONE_CNT_MSK 0x0000ffff ++#define DBG_TX_DONE_CNT_I_MSK 0xffff0000 ++#define DBG_TX_DONE_CNT_SFT 0 ++#define DBG_TX_DONE_CNT_HI 15 ++#define DBG_TX_DONE_CNT_SZ 16 ++#define DBG_TX_DISCARD_CNT_MSK 0xffff0000 ++#define DBG_TX_DISCARD_CNT_I_MSK 0x0000ffff ++#define DBG_TX_DISCARD_CNT_SFT 16 ++#define DBG_TX_DISCARD_CNT_HI 31 ++#define DBG_TX_DISCARD_CNT_SZ 16 ++#define DBG_TX_SET_CNT_MSK 0x0000ffff ++#define DBG_TX_SET_CNT_I_MSK 0xffff0000 ++#define DBG_TX_SET_CNT_SFT 0 ++#define DBG_TX_SET_CNT_HI 15 ++#define DBG_TX_SET_CNT_SZ 16 ++#define DBG_TX_DISCARD_CNT_CLR_MSK 0x00010000 ++#define DBG_TX_DISCARD_CNT_CLR_I_MSK 0xfffeffff ++#define DBG_TX_DISCARD_CNT_CLR_SFT 16 ++#define DBG_TX_DISCARD_CNT_CLR_HI 16 ++#define DBG_TX_DISCARD_CNT_CLR_SZ 1 ++#define DBG_TX_DONE_CNT_CLR_MSK 0x00020000 ++#define DBG_TX_DONE_CNT_CLR_I_MSK 0xfffdffff ++#define DBG_TX_DONE_CNT_CLR_SFT 17 ++#define DBG_TX_DONE_CNT_CLR_HI 17 ++#define DBG_TX_DONE_CNT_CLR_SZ 1 ++#define DBG_TX_SET_CNT_CLR_MSK 0x00040000 ++#define DBG_TX_SET_CNT_CLR_I_MSK 0xfffbffff ++#define DBG_TX_SET_CNT_CLR_SFT 18 ++#define DBG_TX_SET_CNT_CLR_HI 18 ++#define DBG_TX_SET_CNT_CLR_SZ 1 ++#define DBG_DAT_MODE_OFF_MSK 0x00080000 ++#define DBG_DAT_MODE_OFF_I_MSK 0xfff7ffff ++#define DBG_DAT_MODE_OFF_SFT 19 ++#define DBG_DAT_MODE_OFF_HI 19 ++#define DBG_DAT_MODE_OFF_SZ 1 ++#define DBG_TX_FIFO_RESIDUE_MSK 0x00700000 ++#define DBG_TX_FIFO_RESIDUE_I_MSK 0xff8fffff ++#define DBG_TX_FIFO_RESIDUE_SFT 20 ++#define DBG_TX_FIFO_RESIDUE_HI 22 ++#define DBG_TX_FIFO_RESIDUE_SZ 3 ++#define DBG_RX_FIFO_RESIDUE_MSK 0x07000000 ++#define DBG_RX_FIFO_RESIDUE_I_MSK 0xf8ffffff ++#define DBG_RX_FIFO_RESIDUE_SFT 24 ++#define DBG_RX_FIFO_RESIDUE_HI 26 ++#define DBG_RX_FIFO_RESIDUE_SZ 3 ++#define DBG_RX_RDY_MSK 0x00000001 ++#define DBG_RX_RDY_I_MSK 0xfffffffe ++#define DBG_RX_RDY_SFT 0 ++#define DBG_RX_RDY_HI 0 ++#define DBG_RX_RDY_SZ 1 ++#define DBG_SDIO_SYS_INT_MSK 0x00000004 ++#define DBG_SDIO_SYS_INT_I_MSK 0xfffffffb ++#define DBG_SDIO_SYS_INT_SFT 2 ++#define DBG_SDIO_SYS_INT_HI 2 ++#define DBG_SDIO_SYS_INT_SZ 1 ++#define DBG_EDCA0_LOWTHOLD_INT_MSK 0x00000008 ++#define DBG_EDCA0_LOWTHOLD_INT_I_MSK 0xfffffff7 ++#define DBG_EDCA0_LOWTHOLD_INT_SFT 3 ++#define DBG_EDCA0_LOWTHOLD_INT_HI 3 ++#define DBG_EDCA0_LOWTHOLD_INT_SZ 1 ++#define DBG_EDCA1_LOWTHOLD_INT_MSK 0x00000010 ++#define DBG_EDCA1_LOWTHOLD_INT_I_MSK 0xffffffef ++#define DBG_EDCA1_LOWTHOLD_INT_SFT 4 ++#define DBG_EDCA1_LOWTHOLD_INT_HI 4 ++#define DBG_EDCA1_LOWTHOLD_INT_SZ 1 ++#define DBG_EDCA2_LOWTHOLD_INT_MSK 0x00000020 ++#define DBG_EDCA2_LOWTHOLD_INT_I_MSK 0xffffffdf ++#define DBG_EDCA2_LOWTHOLD_INT_SFT 5 ++#define DBG_EDCA2_LOWTHOLD_INT_HI 5 ++#define DBG_EDCA2_LOWTHOLD_INT_SZ 1 ++#define DBG_EDCA3_LOWTHOLD_INT_MSK 0x00000040 ++#define DBG_EDCA3_LOWTHOLD_INT_I_MSK 0xffffffbf ++#define DBG_EDCA3_LOWTHOLD_INT_SFT 6 ++#define DBG_EDCA3_LOWTHOLD_INT_HI 6 ++#define DBG_EDCA3_LOWTHOLD_INT_SZ 1 ++#define DBG_TX_LIMIT_INT_IN_MSK 0x00000080 ++#define DBG_TX_LIMIT_INT_IN_I_MSK 0xffffff7f ++#define DBG_TX_LIMIT_INT_IN_SFT 7 ++#define DBG_TX_LIMIT_INT_IN_HI 7 ++#define DBG_TX_LIMIT_INT_IN_SZ 1 ++#define DBG_SPI_FN1_MSK 0x00007f00 ++#define DBG_SPI_FN1_I_MSK 0xffff80ff ++#define DBG_SPI_FN1_SFT 8 ++#define DBG_SPI_FN1_HI 14 ++#define DBG_SPI_FN1_SZ 7 ++#define DBG_SPI_CLK_EN_INT_MSK 0x00008000 ++#define DBG_SPI_CLK_EN_INT_I_MSK 0xffff7fff ++#define DBG_SPI_CLK_EN_INT_SFT 15 ++#define DBG_SPI_CLK_EN_INT_HI 15 ++#define DBG_SPI_CLK_EN_INT_SZ 1 ++#define DBG_SPI_HOST_MASK_MSK 0x00ff0000 ++#define DBG_SPI_HOST_MASK_I_MSK 0xff00ffff ++#define DBG_SPI_HOST_MASK_SFT 16 ++#define DBG_SPI_HOST_MASK_HI 23 ++#define DBG_SPI_HOST_MASK_SZ 8 ++#define BOOT_ADDR_MSK 0x00ffffff ++#define BOOT_ADDR_I_MSK 0xff000000 ++#define BOOT_ADDR_SFT 0 ++#define BOOT_ADDR_HI 23 ++#define BOOT_ADDR_SZ 24 ++#define CHECK_SUM_FAIL_MSK 0x80000000 ++#define CHECK_SUM_FAIL_I_MSK 0x7fffffff ++#define CHECK_SUM_FAIL_SFT 31 ++#define CHECK_SUM_FAIL_HI 31 ++#define CHECK_SUM_FAIL_SZ 1 ++#define VERIFY_DATA_MSK 0xffffffff ++#define VERIFY_DATA_I_MSK 0x00000000 ++#define VERIFY_DATA_SFT 0 ++#define VERIFY_DATA_HI 31 ++#define VERIFY_DATA_SZ 32 ++#define FLASH_ADDR_MSK 0x00ffffff ++#define FLASH_ADDR_I_MSK 0xff000000 ++#define FLASH_ADDR_SFT 0 ++#define FLASH_ADDR_HI 23 ++#define FLASH_ADDR_SZ 24 ++#define FLASH_CMD_CLR_MSK 0x10000000 ++#define FLASH_CMD_CLR_I_MSK 0xefffffff ++#define FLASH_CMD_CLR_SFT 28 ++#define FLASH_CMD_CLR_HI 28 ++#define FLASH_CMD_CLR_SZ 1 ++#define FLASH_DMA_CLR_MSK 0x20000000 ++#define FLASH_DMA_CLR_I_MSK 0xdfffffff ++#define FLASH_DMA_CLR_SFT 29 ++#define FLASH_DMA_CLR_HI 29 ++#define FLASH_DMA_CLR_SZ 1 ++#define DMA_EN_MSK 0x40000000 ++#define DMA_EN_I_MSK 0xbfffffff ++#define DMA_EN_SFT 30 ++#define DMA_EN_HI 30 ++#define DMA_EN_SZ 1 ++#define DMA_BUSY_MSK 0x80000000 ++#define DMA_BUSY_I_MSK 0x7fffffff ++#define DMA_BUSY_SFT 31 ++#define DMA_BUSY_HI 31 ++#define DMA_BUSY_SZ 1 ++#define SRAM_ADDR_MSK 0xffffffff ++#define SRAM_ADDR_I_MSK 0x00000000 ++#define SRAM_ADDR_SFT 0 ++#define SRAM_ADDR_HI 31 ++#define SRAM_ADDR_SZ 32 ++#define FLASH_DMA_LEN_MSK 0xffffffff ++#define FLASH_DMA_LEN_I_MSK 0x00000000 ++#define FLASH_DMA_LEN_SFT 0 ++#define FLASH_DMA_LEN_HI 31 ++#define FLASH_DMA_LEN_SZ 32 ++#define FLASH_FRONT_DLY_MSK 0x0000ffff ++#define FLASH_FRONT_DLY_I_MSK 0xffff0000 ++#define FLASH_FRONT_DLY_SFT 0 ++#define FLASH_FRONT_DLY_HI 15 ++#define FLASH_FRONT_DLY_SZ 16 ++#define FLASH_BACK_DLY_MSK 0xffff0000 ++#define FLASH_BACK_DLY_I_MSK 0x0000ffff ++#define FLASH_BACK_DLY_SFT 16 ++#define FLASH_BACK_DLY_HI 31 ++#define FLASH_BACK_DLY_SZ 16 ++#define FLASH_CLK_WIDTH_MSK 0x0000ffff ++#define FLASH_CLK_WIDTH_I_MSK 0xffff0000 ++#define FLASH_CLK_WIDTH_SFT 0 ++#define FLASH_CLK_WIDTH_HI 15 ++#define FLASH_CLK_WIDTH_SZ 16 ++#define SPI_BUSY_MSK 0x00010000 ++#define SPI_BUSY_I_MSK 0xfffeffff ++#define SPI_BUSY_SFT 16 ++#define SPI_BUSY_HI 16 ++#define SPI_BUSY_SZ 1 ++#define FLS_REMAP_MSK 0x00020000 ++#define FLS_REMAP_I_MSK 0xfffdffff ++#define FLS_REMAP_SFT 17 ++#define FLS_REMAP_HI 17 ++#define FLS_REMAP_SZ 1 ++#define PBUS_SWP_MSK 0x00040000 ++#define PBUS_SWP_I_MSK 0xfffbffff ++#define PBUS_SWP_SFT 18 ++#define PBUS_SWP_HI 18 ++#define PBUS_SWP_SZ 1 ++#define BIT_MODE1_MSK 0x00080000 ++#define BIT_MODE1_I_MSK 0xfff7ffff ++#define BIT_MODE1_SFT 19 ++#define BIT_MODE1_HI 19 ++#define BIT_MODE1_SZ 1 ++#define BIT_MODE2_MSK 0x00100000 ++#define BIT_MODE2_I_MSK 0xffefffff ++#define BIT_MODE2_SFT 20 ++#define BIT_MODE2_HI 20 ++#define BIT_MODE2_SZ 1 ++#define BIT_MODE4_MSK 0x00200000 ++#define BIT_MODE4_I_MSK 0xffdfffff ++#define BIT_MODE4_SFT 21 ++#define BIT_MODE4_HI 21 ++#define BIT_MODE4_SZ 1 ++#define BOOT_CHECK_SUM_MSK 0xffffffff ++#define BOOT_CHECK_SUM_I_MSK 0x00000000 ++#define BOOT_CHECK_SUM_SFT 0 ++#define BOOT_CHECK_SUM_HI 31 ++#define BOOT_CHECK_SUM_SZ 32 ++#define CHECK_SUM_TAG_MSK 0xffffffff ++#define CHECK_SUM_TAG_I_MSK 0x00000000 ++#define CHECK_SUM_TAG_SFT 0 ++#define CHECK_SUM_TAG_HI 31 ++#define CHECK_SUM_TAG_SZ 32 ++#define CMD_LEN_MSK 0x0000ffff ++#define CMD_LEN_I_MSK 0xffff0000 ++#define CMD_LEN_SFT 0 ++#define CMD_LEN_HI 15 ++#define CMD_LEN_SZ 16 ++#define CMD_ADDR_MSK 0xffffffff ++#define CMD_ADDR_I_MSK 0x00000000 ++#define CMD_ADDR_SFT 0 ++#define CMD_ADDR_HI 31 ++#define CMD_ADDR_SZ 32 ++#define DMA_ADR_SRC_MSK 0xffffffff ++#define DMA_ADR_SRC_I_MSK 0x00000000 ++#define DMA_ADR_SRC_SFT 0 ++#define DMA_ADR_SRC_HI 31 ++#define DMA_ADR_SRC_SZ 32 ++#define DMA_ADR_DST_MSK 0xffffffff ++#define DMA_ADR_DST_I_MSK 0x00000000 ++#define DMA_ADR_DST_SFT 0 ++#define DMA_ADR_DST_HI 31 ++#define DMA_ADR_DST_SZ 32 ++#define DMA_SRC_SIZE_MSK 0x00000007 ++#define DMA_SRC_SIZE_I_MSK 0xfffffff8 ++#define DMA_SRC_SIZE_SFT 0 ++#define DMA_SRC_SIZE_HI 2 ++#define DMA_SRC_SIZE_SZ 3 ++#define DMA_SRC_INC_MSK 0x00000008 ++#define DMA_SRC_INC_I_MSK 0xfffffff7 ++#define DMA_SRC_INC_SFT 3 ++#define DMA_SRC_INC_HI 3 ++#define DMA_SRC_INC_SZ 1 ++#define DMA_DST_SIZE_MSK 0x00000070 ++#define DMA_DST_SIZE_I_MSK 0xffffff8f ++#define DMA_DST_SIZE_SFT 4 ++#define DMA_DST_SIZE_HI 6 ++#define DMA_DST_SIZE_SZ 3 ++#define DMA_DST_INC_MSK 0x00000080 ++#define DMA_DST_INC_I_MSK 0xffffff7f ++#define DMA_DST_INC_SFT 7 ++#define DMA_DST_INC_HI 7 ++#define DMA_DST_INC_SZ 1 ++#define DMA_FAST_FILL_MSK 0x00000100 ++#define DMA_FAST_FILL_I_MSK 0xfffffeff ++#define DMA_FAST_FILL_SFT 8 ++#define DMA_FAST_FILL_HI 8 ++#define DMA_FAST_FILL_SZ 1 ++#define DMA_SDIO_KICK_MSK 0x00001000 ++#define DMA_SDIO_KICK_I_MSK 0xffffefff ++#define DMA_SDIO_KICK_SFT 12 ++#define DMA_SDIO_KICK_HI 12 ++#define DMA_SDIO_KICK_SZ 1 ++#define DMA_BADR_EN_MSK 0x00002000 ++#define DMA_BADR_EN_I_MSK 0xffffdfff ++#define DMA_BADR_EN_SFT 13 ++#define DMA_BADR_EN_HI 13 ++#define DMA_BADR_EN_SZ 1 ++#define DMA_LEN_MSK 0xffff0000 ++#define DMA_LEN_I_MSK 0x0000ffff ++#define DMA_LEN_SFT 16 ++#define DMA_LEN_HI 31 ++#define DMA_LEN_SZ 16 ++#define DMA_INT_MASK_MSK 0x00000001 ++#define DMA_INT_MASK_I_MSK 0xfffffffe ++#define DMA_INT_MASK_SFT 0 ++#define DMA_INT_MASK_HI 0 ++#define DMA_INT_MASK_SZ 1 ++#define DMA_STS_MSK 0x00000100 ++#define DMA_STS_I_MSK 0xfffffeff ++#define DMA_STS_SFT 8 ++#define DMA_STS_HI 8 ++#define DMA_STS_SZ 1 ++#define DMA_FINISH_MSK 0x80000000 ++#define DMA_FINISH_I_MSK 0x7fffffff ++#define DMA_FINISH_SFT 31 ++#define DMA_FINISH_HI 31 ++#define DMA_FINISH_SZ 1 ++#define DMA_CONST_MSK 0xffffffff ++#define DMA_CONST_I_MSK 0x00000000 ++#define DMA_CONST_SFT 0 ++#define DMA_CONST_HI 31 ++#define DMA_CONST_SZ 32 ++#define SLEEP_WAKE_CNT_MSK 0x00ffffff ++#define SLEEP_WAKE_CNT_I_MSK 0xff000000 ++#define SLEEP_WAKE_CNT_SFT 0 ++#define SLEEP_WAKE_CNT_HI 23 ++#define SLEEP_WAKE_CNT_SZ 24 ++#define RG_DLDO_LEVEL_MSK 0x07000000 ++#define RG_DLDO_LEVEL_I_MSK 0xf8ffffff ++#define RG_DLDO_LEVEL_SFT 24 ++#define RG_DLDO_LEVEL_HI 26 ++#define RG_DLDO_LEVEL_SZ 3 ++#define RG_DLDO_BOOST_IQ_MSK 0x08000000 ++#define RG_DLDO_BOOST_IQ_I_MSK 0xf7ffffff ++#define RG_DLDO_BOOST_IQ_SFT 27 ++#define RG_DLDO_BOOST_IQ_HI 27 ++#define RG_DLDO_BOOST_IQ_SZ 1 ++#define RG_BUCK_LEVEL_MSK 0x70000000 ++#define RG_BUCK_LEVEL_I_MSK 0x8fffffff ++#define RG_BUCK_LEVEL_SFT 28 ++#define RG_BUCK_LEVEL_HI 30 ++#define RG_BUCK_LEVEL_SZ 3 ++#define RG_BUCK_VREF_SEL_MSK 0x80000000 ++#define RG_BUCK_VREF_SEL_I_MSK 0x7fffffff ++#define RG_BUCK_VREF_SEL_SFT 31 ++#define RG_BUCK_VREF_SEL_HI 31 ++#define RG_BUCK_VREF_SEL_SZ 1 ++#define RG_RTC_OSC_RES_SW_MANUAL_MSK 0x000003ff ++#define RG_RTC_OSC_RES_SW_MANUAL_I_MSK 0xfffffc00 ++#define RG_RTC_OSC_RES_SW_MANUAL_SFT 0 ++#define RG_RTC_OSC_RES_SW_MANUAL_HI 9 ++#define RG_RTC_OSC_RES_SW_MANUAL_SZ 10 ++#define RG_RTC_OSC_RES_SW_MSK 0x03ff0000 ++#define RG_RTC_OSC_RES_SW_I_MSK 0xfc00ffff ++#define RG_RTC_OSC_RES_SW_SFT 16 ++#define RG_RTC_OSC_RES_SW_HI 25 ++#define RG_RTC_OSC_RES_SW_SZ 10 ++#define RTC_OSC_CAL_RES_RDY_MSK 0x80000000 ++#define RTC_OSC_CAL_RES_RDY_I_MSK 0x7fffffff ++#define RTC_OSC_CAL_RES_RDY_SFT 31 ++#define RTC_OSC_CAL_RES_RDY_HI 31 ++#define RTC_OSC_CAL_RES_RDY_SZ 1 ++#define RG_DCDC_MODE_MSK 0x00000001 ++#define RG_DCDC_MODE_I_MSK 0xfffffffe ++#define RG_DCDC_MODE_SFT 0 ++#define RG_DCDC_MODE_HI 0 ++#define RG_DCDC_MODE_SZ 1 ++#define RG_BUCK_EN_PSM_MSK 0x00000010 ++#define RG_BUCK_EN_PSM_I_MSK 0xffffffef ++#define RG_BUCK_EN_PSM_SFT 4 ++#define RG_BUCK_EN_PSM_HI 4 ++#define RG_BUCK_EN_PSM_SZ 1 ++#define RG_BUCK_PSM_VTH_MSK 0x00000100 ++#define RG_BUCK_PSM_VTH_I_MSK 0xfffffeff ++#define RG_BUCK_PSM_VTH_SFT 8 ++#define RG_BUCK_PSM_VTH_HI 8 ++#define RG_BUCK_PSM_VTH_SZ 1 ++#define RG_RTC_OSC_RES_SW_MANUAL_EN_MSK 0x00001000 ++#define RG_RTC_OSC_RES_SW_MANUAL_EN_I_MSK 0xffffefff ++#define RG_RTC_OSC_RES_SW_MANUAL_EN_SFT 12 ++#define RG_RTC_OSC_RES_SW_MANUAL_EN_HI 12 ++#define RG_RTC_OSC_RES_SW_MANUAL_EN_SZ 1 ++#define RG_RTC_RDY_DEGLITCH_TIMER_MSK 0x00006000 ++#define RG_RTC_RDY_DEGLITCH_TIMER_I_MSK 0xffff9fff ++#define RG_RTC_RDY_DEGLITCH_TIMER_SFT 13 ++#define RG_RTC_RDY_DEGLITCH_TIMER_HI 14 ++#define RG_RTC_RDY_DEGLITCH_TIMER_SZ 2 ++#define RTC_CAL_ENA_MSK 0x00010000 ++#define RTC_CAL_ENA_I_MSK 0xfffeffff ++#define RTC_CAL_ENA_SFT 16 ++#define RTC_CAL_ENA_HI 16 ++#define RTC_CAL_ENA_SZ 1 ++#define PMU_WAKE_TRIG_EVENT_MSK 0x00000003 ++#define PMU_WAKE_TRIG_EVENT_I_MSK 0xfffffffc ++#define PMU_WAKE_TRIG_EVENT_SFT 0 ++#define PMU_WAKE_TRIG_EVENT_HI 1 ++#define PMU_WAKE_TRIG_EVENT_SZ 2 ++#define DIGI_TOP_POR_MASK_MSK 0x00000010 ++#define DIGI_TOP_POR_MASK_I_MSK 0xffffffef ++#define DIGI_TOP_POR_MASK_SFT 4 ++#define DIGI_TOP_POR_MASK_HI 4 ++#define DIGI_TOP_POR_MASK_SZ 1 ++#define PMU_ENTER_SLEEP_MODE_MSK 0x00000100 ++#define PMU_ENTER_SLEEP_MODE_I_MSK 0xfffffeff ++#define PMU_ENTER_SLEEP_MODE_SFT 8 ++#define PMU_ENTER_SLEEP_MODE_HI 8 ++#define PMU_ENTER_SLEEP_MODE_SZ 1 ++#define RG_RTC_DUMMIES_MSK 0xffff0000 ++#define RG_RTC_DUMMIES_I_MSK 0x0000ffff ++#define RG_RTC_DUMMIES_SFT 16 ++#define RG_RTC_DUMMIES_HI 31 ++#define RG_RTC_DUMMIES_SZ 16 ++#define RTC_EN_MSK 0x00000001 ++#define RTC_EN_I_MSK 0xfffffffe ++#define RTC_EN_SFT 0 ++#define RTC_EN_HI 0 ++#define RTC_EN_SZ 1 ++#define RTC_SRC_MSK 0x00000002 ++#define RTC_SRC_I_MSK 0xfffffffd ++#define RTC_SRC_SFT 1 ++#define RTC_SRC_HI 1 ++#define RTC_SRC_SZ 1 ++#define RTC_TICK_CNT_MSK 0x7fff0000 ++#define RTC_TICK_CNT_I_MSK 0x8000ffff ++#define RTC_TICK_CNT_SFT 16 ++#define RTC_TICK_CNT_HI 30 ++#define RTC_TICK_CNT_SZ 15 ++#define RTC_INT_SEC_MASK_MSK 0x00000001 ++#define RTC_INT_SEC_MASK_I_MSK 0xfffffffe ++#define RTC_INT_SEC_MASK_SFT 0 ++#define RTC_INT_SEC_MASK_HI 0 ++#define RTC_INT_SEC_MASK_SZ 1 ++#define RTC_INT_ALARM_MASK_MSK 0x00000002 ++#define RTC_INT_ALARM_MASK_I_MSK 0xfffffffd ++#define RTC_INT_ALARM_MASK_SFT 1 ++#define RTC_INT_ALARM_MASK_HI 1 ++#define RTC_INT_ALARM_MASK_SZ 1 ++#define RTC_INT_SEC_MSK 0x00010000 ++#define RTC_INT_SEC_I_MSK 0xfffeffff ++#define RTC_INT_SEC_SFT 16 ++#define RTC_INT_SEC_HI 16 ++#define RTC_INT_SEC_SZ 1 ++#define RTC_INT_ALARM_MSK 0x00020000 ++#define RTC_INT_ALARM_I_MSK 0xfffdffff ++#define RTC_INT_ALARM_SFT 17 ++#define RTC_INT_ALARM_HI 17 ++#define RTC_INT_ALARM_SZ 1 ++#define RTC_SEC_START_CNT_MSK 0xffffffff ++#define RTC_SEC_START_CNT_I_MSK 0x00000000 ++#define RTC_SEC_START_CNT_SFT 0 ++#define RTC_SEC_START_CNT_HI 31 ++#define RTC_SEC_START_CNT_SZ 32 ++#define RTC_SEC_CNT_MSK 0xffffffff ++#define RTC_SEC_CNT_I_MSK 0x00000000 ++#define RTC_SEC_CNT_SFT 0 ++#define RTC_SEC_CNT_HI 31 ++#define RTC_SEC_CNT_SZ 32 ++#define RTC_SEC_ALARM_VALUE_MSK 0xffffffff ++#define RTC_SEC_ALARM_VALUE_I_MSK 0x00000000 ++#define RTC_SEC_ALARM_VALUE_SFT 0 ++#define RTC_SEC_ALARM_VALUE_HI 31 ++#define RTC_SEC_ALARM_VALUE_SZ 32 ++#define D2_DMA_ADR_SRC_MSK 0xffffffff ++#define D2_DMA_ADR_SRC_I_MSK 0x00000000 ++#define D2_DMA_ADR_SRC_SFT 0 ++#define D2_DMA_ADR_SRC_HI 31 ++#define D2_DMA_ADR_SRC_SZ 32 ++#define D2_DMA_ADR_DST_MSK 0xffffffff ++#define D2_DMA_ADR_DST_I_MSK 0x00000000 ++#define D2_DMA_ADR_DST_SFT 0 ++#define D2_DMA_ADR_DST_HI 31 ++#define D2_DMA_ADR_DST_SZ 32 ++#define D2_DMA_SRC_SIZE_MSK 0x00000007 ++#define D2_DMA_SRC_SIZE_I_MSK 0xfffffff8 ++#define D2_DMA_SRC_SIZE_SFT 0 ++#define D2_DMA_SRC_SIZE_HI 2 ++#define D2_DMA_SRC_SIZE_SZ 3 ++#define D2_DMA_SRC_INC_MSK 0x00000008 ++#define D2_DMA_SRC_INC_I_MSK 0xfffffff7 ++#define D2_DMA_SRC_INC_SFT 3 ++#define D2_DMA_SRC_INC_HI 3 ++#define D2_DMA_SRC_INC_SZ 1 ++#define D2_DMA_DST_SIZE_MSK 0x00000070 ++#define D2_DMA_DST_SIZE_I_MSK 0xffffff8f ++#define D2_DMA_DST_SIZE_SFT 4 ++#define D2_DMA_DST_SIZE_HI 6 ++#define D2_DMA_DST_SIZE_SZ 3 ++#define D2_DMA_DST_INC_MSK 0x00000080 ++#define D2_DMA_DST_INC_I_MSK 0xffffff7f ++#define D2_DMA_DST_INC_SFT 7 ++#define D2_DMA_DST_INC_HI 7 ++#define D2_DMA_DST_INC_SZ 1 ++#define D2_DMA_FAST_FILL_MSK 0x00000100 ++#define D2_DMA_FAST_FILL_I_MSK 0xfffffeff ++#define D2_DMA_FAST_FILL_SFT 8 ++#define D2_DMA_FAST_FILL_HI 8 ++#define D2_DMA_FAST_FILL_SZ 1 ++#define D2_DMA_SDIO_KICK_MSK 0x00001000 ++#define D2_DMA_SDIO_KICK_I_MSK 0xffffefff ++#define D2_DMA_SDIO_KICK_SFT 12 ++#define D2_DMA_SDIO_KICK_HI 12 ++#define D2_DMA_SDIO_KICK_SZ 1 ++#define D2_DMA_BADR_EN_MSK 0x00002000 ++#define D2_DMA_BADR_EN_I_MSK 0xffffdfff ++#define D2_DMA_BADR_EN_SFT 13 ++#define D2_DMA_BADR_EN_HI 13 ++#define D2_DMA_BADR_EN_SZ 1 ++#define D2_DMA_LEN_MSK 0xffff0000 ++#define D2_DMA_LEN_I_MSK 0x0000ffff ++#define D2_DMA_LEN_SFT 16 ++#define D2_DMA_LEN_HI 31 ++#define D2_DMA_LEN_SZ 16 ++#define D2_DMA_INT_MASK_MSK 0x00000001 ++#define D2_DMA_INT_MASK_I_MSK 0xfffffffe ++#define D2_DMA_INT_MASK_SFT 0 ++#define D2_DMA_INT_MASK_HI 0 ++#define D2_DMA_INT_MASK_SZ 1 ++#define D2_DMA_STS_MSK 0x00000100 ++#define D2_DMA_STS_I_MSK 0xfffffeff ++#define D2_DMA_STS_SFT 8 ++#define D2_DMA_STS_HI 8 ++#define D2_DMA_STS_SZ 1 ++#define D2_DMA_FINISH_MSK 0x80000000 ++#define D2_DMA_FINISH_I_MSK 0x7fffffff ++#define D2_DMA_FINISH_SFT 31 ++#define D2_DMA_FINISH_HI 31 ++#define D2_DMA_FINISH_SZ 1 ++#define D2_DMA_CONST_MSK 0xffffffff ++#define D2_DMA_CONST_I_MSK 0x00000000 ++#define D2_DMA_CONST_SFT 0 ++#define D2_DMA_CONST_HI 31 ++#define D2_DMA_CONST_SZ 32 ++#define TRAP_UNKNOWN_TYPE_MSK 0x00000001 ++#define TRAP_UNKNOWN_TYPE_I_MSK 0xfffffffe ++#define TRAP_UNKNOWN_TYPE_SFT 0 ++#define TRAP_UNKNOWN_TYPE_HI 0 ++#define TRAP_UNKNOWN_TYPE_SZ 1 ++#define TX_ON_DEMAND_ENA_MSK 0x00000002 ++#define TX_ON_DEMAND_ENA_I_MSK 0xfffffffd ++#define TX_ON_DEMAND_ENA_SFT 1 ++#define TX_ON_DEMAND_ENA_HI 1 ++#define TX_ON_DEMAND_ENA_SZ 1 ++#define RX_2_HOST_MSK 0x00000004 ++#define RX_2_HOST_I_MSK 0xfffffffb ++#define RX_2_HOST_SFT 2 ++#define RX_2_HOST_HI 2 ++#define RX_2_HOST_SZ 1 ++#define AUTO_SEQNO_MSK 0x00000008 ++#define AUTO_SEQNO_I_MSK 0xfffffff7 ++#define AUTO_SEQNO_SFT 3 ++#define AUTO_SEQNO_HI 3 ++#define AUTO_SEQNO_SZ 1 ++#define BYPASSS_TX_PARSER_ENCAP_MSK 0x00000010 ++#define BYPASSS_TX_PARSER_ENCAP_I_MSK 0xffffffef ++#define BYPASSS_TX_PARSER_ENCAP_SFT 4 ++#define BYPASSS_TX_PARSER_ENCAP_HI 4 ++#define BYPASSS_TX_PARSER_ENCAP_SZ 1 ++#define HDR_STRIP_MSK 0x00000020 ++#define HDR_STRIP_I_MSK 0xffffffdf ++#define HDR_STRIP_SFT 5 ++#define HDR_STRIP_HI 5 ++#define HDR_STRIP_SZ 1 ++#define ERP_PROTECT_MSK 0x000000c0 ++#define ERP_PROTECT_I_MSK 0xffffff3f ++#define ERP_PROTECT_SFT 6 ++#define ERP_PROTECT_HI 7 ++#define ERP_PROTECT_SZ 2 ++#define PRO_VER_MSK 0x00000300 ++#define PRO_VER_I_MSK 0xfffffcff ++#define PRO_VER_SFT 8 ++#define PRO_VER_HI 9 ++#define PRO_VER_SZ 2 ++#define TXQ_ID0_MSK 0x00007000 ++#define TXQ_ID0_I_MSK 0xffff8fff ++#define TXQ_ID0_SFT 12 ++#define TXQ_ID0_HI 14 ++#define TXQ_ID0_SZ 3 ++#define TXQ_ID1_MSK 0x00070000 ++#define TXQ_ID1_I_MSK 0xfff8ffff ++#define TXQ_ID1_SFT 16 ++#define TXQ_ID1_HI 18 ++#define TXQ_ID1_SZ 3 ++#define TX_ETHER_TRAP_EN_MSK 0x00100000 ++#define TX_ETHER_TRAP_EN_I_MSK 0xffefffff ++#define TX_ETHER_TRAP_EN_SFT 20 ++#define TX_ETHER_TRAP_EN_HI 20 ++#define TX_ETHER_TRAP_EN_SZ 1 ++#define RX_ETHER_TRAP_EN_MSK 0x00200000 ++#define RX_ETHER_TRAP_EN_I_MSK 0xffdfffff ++#define RX_ETHER_TRAP_EN_SFT 21 ++#define RX_ETHER_TRAP_EN_HI 21 ++#define RX_ETHER_TRAP_EN_SZ 1 ++#define RX_NULL_TRAP_EN_MSK 0x00400000 ++#define RX_NULL_TRAP_EN_I_MSK 0xffbfffff ++#define RX_NULL_TRAP_EN_SFT 22 ++#define RX_NULL_TRAP_EN_HI 22 ++#define RX_NULL_TRAP_EN_SZ 1 ++#define RX_GET_TX_QUEUE_EN_MSK 0x02000000 ++#define RX_GET_TX_QUEUE_EN_I_MSK 0xfdffffff ++#define RX_GET_TX_QUEUE_EN_SFT 25 ++#define RX_GET_TX_QUEUE_EN_HI 25 ++#define RX_GET_TX_QUEUE_EN_SZ 1 ++#define HCI_INQ_SEL_MSK 0x04000000 ++#define HCI_INQ_SEL_I_MSK 0xfbffffff ++#define HCI_INQ_SEL_SFT 26 ++#define HCI_INQ_SEL_HI 26 ++#define HCI_INQ_SEL_SZ 1 ++#define TRX_DEBUG_CNT_ENA_MSK 0x10000000 ++#define TRX_DEBUG_CNT_ENA_I_MSK 0xefffffff ++#define TRX_DEBUG_CNT_ENA_SFT 28 ++#define TRX_DEBUG_CNT_ENA_HI 28 ++#define TRX_DEBUG_CNT_ENA_SZ 1 ++#define WAKE_SOON_WITH_SCK_MSK 0x00000001 ++#define WAKE_SOON_WITH_SCK_I_MSK 0xfffffffe ++#define WAKE_SOON_WITH_SCK_SFT 0 ++#define WAKE_SOON_WITH_SCK_HI 0 ++#define WAKE_SOON_WITH_SCK_SZ 1 ++#define TX_FLOW_CTRL_MSK 0x0000ffff ++#define TX_FLOW_CTRL_I_MSK 0xffff0000 ++#define TX_FLOW_CTRL_SFT 0 ++#define TX_FLOW_CTRL_HI 15 ++#define TX_FLOW_CTRL_SZ 16 ++#define TX_FLOW_MGMT_MSK 0xffff0000 ++#define TX_FLOW_MGMT_I_MSK 0x0000ffff ++#define TX_FLOW_MGMT_SFT 16 ++#define TX_FLOW_MGMT_HI 31 ++#define TX_FLOW_MGMT_SZ 16 ++#define TX_FLOW_DATA_MSK 0xffffffff ++#define TX_FLOW_DATA_I_MSK 0x00000000 ++#define TX_FLOW_DATA_SFT 0 ++#define TX_FLOW_DATA_HI 31 ++#define TX_FLOW_DATA_SZ 32 ++#define DOT11RTSTHRESHOLD_MSK 0xffff0000 ++#define DOT11RTSTHRESHOLD_I_MSK 0x0000ffff ++#define DOT11RTSTHRESHOLD_SFT 16 ++#define DOT11RTSTHRESHOLD_HI 31 ++#define DOT11RTSTHRESHOLD_SZ 16 ++#define TXF_ID_MSK 0x0000003f ++#define TXF_ID_I_MSK 0xffffffc0 ++#define TXF_ID_SFT 0 ++#define TXF_ID_HI 5 ++#define TXF_ID_SZ 6 ++#define SEQ_CTRL_MSK 0x0000ffff ++#define SEQ_CTRL_I_MSK 0xffff0000 ++#define SEQ_CTRL_SFT 0 ++#define SEQ_CTRL_HI 15 ++#define SEQ_CTRL_SZ 16 ++#define TX_PBOFFSET_MSK 0x000000ff ++#define TX_PBOFFSET_I_MSK 0xffffff00 ++#define TX_PBOFFSET_SFT 0 ++#define TX_PBOFFSET_HI 7 ++#define TX_PBOFFSET_SZ 8 ++#define TX_INFO_SIZE_MSK 0x0000ff00 ++#define TX_INFO_SIZE_I_MSK 0xffff00ff ++#define TX_INFO_SIZE_SFT 8 ++#define TX_INFO_SIZE_HI 15 ++#define TX_INFO_SIZE_SZ 8 ++#define RX_INFO_SIZE_MSK 0x00ff0000 ++#define RX_INFO_SIZE_I_MSK 0xff00ffff ++#define RX_INFO_SIZE_SFT 16 ++#define RX_INFO_SIZE_HI 23 ++#define RX_INFO_SIZE_SZ 8 ++#define RX_LAST_PHY_SIZE_MSK 0xff000000 ++#define RX_LAST_PHY_SIZE_I_MSK 0x00ffffff ++#define RX_LAST_PHY_SIZE_SFT 24 ++#define RX_LAST_PHY_SIZE_HI 31 ++#define RX_LAST_PHY_SIZE_SZ 8 ++#define TX_INFO_CLEAR_SIZE_MSK 0x0000003f ++#define TX_INFO_CLEAR_SIZE_I_MSK 0xffffffc0 ++#define TX_INFO_CLEAR_SIZE_SFT 0 ++#define TX_INFO_CLEAR_SIZE_HI 5 ++#define TX_INFO_CLEAR_SIZE_SZ 6 ++#define TX_INFO_CLEAR_ENABLE_MSK 0x00000100 ++#define TX_INFO_CLEAR_ENABLE_I_MSK 0xfffffeff ++#define TX_INFO_CLEAR_ENABLE_SFT 8 ++#define TX_INFO_CLEAR_ENABLE_HI 8 ++#define TX_INFO_CLEAR_ENABLE_SZ 1 ++#define TXTRAP_ETHTYPE1_MSK 0x0000ffff ++#define TXTRAP_ETHTYPE1_I_MSK 0xffff0000 ++#define TXTRAP_ETHTYPE1_SFT 0 ++#define TXTRAP_ETHTYPE1_HI 15 ++#define TXTRAP_ETHTYPE1_SZ 16 ++#define TXTRAP_ETHTYPE0_MSK 0xffff0000 ++#define TXTRAP_ETHTYPE0_I_MSK 0x0000ffff ++#define TXTRAP_ETHTYPE0_SFT 16 ++#define TXTRAP_ETHTYPE0_HI 31 ++#define TXTRAP_ETHTYPE0_SZ 16 ++#define RXTRAP_ETHTYPE1_MSK 0x0000ffff ++#define RXTRAP_ETHTYPE1_I_MSK 0xffff0000 ++#define RXTRAP_ETHTYPE1_SFT 0 ++#define RXTRAP_ETHTYPE1_HI 15 ++#define RXTRAP_ETHTYPE1_SZ 16 ++#define RXTRAP_ETHTYPE0_MSK 0xffff0000 ++#define RXTRAP_ETHTYPE0_I_MSK 0x0000ffff ++#define RXTRAP_ETHTYPE0_SFT 16 ++#define RXTRAP_ETHTYPE0_HI 31 ++#define RXTRAP_ETHTYPE0_SZ 16 ++#define TX_PKT_COUNTER_MSK 0xffffffff ++#define TX_PKT_COUNTER_I_MSK 0x00000000 ++#define TX_PKT_COUNTER_SFT 0 ++#define TX_PKT_COUNTER_HI 31 ++#define TX_PKT_COUNTER_SZ 32 ++#define RX_PKT_COUNTER_MSK 0xffffffff ++#define RX_PKT_COUNTER_I_MSK 0x00000000 ++#define RX_PKT_COUNTER_SFT 0 ++#define RX_PKT_COUNTER_HI 31 ++#define RX_PKT_COUNTER_SZ 32 ++#define HOST_CMD_COUNTER_MSK 0x000000ff ++#define HOST_CMD_COUNTER_I_MSK 0xffffff00 ++#define HOST_CMD_COUNTER_SFT 0 ++#define HOST_CMD_COUNTER_HI 7 ++#define HOST_CMD_COUNTER_SZ 8 ++#define HOST_EVENT_COUNTER_MSK 0x000000ff ++#define HOST_EVENT_COUNTER_I_MSK 0xffffff00 ++#define HOST_EVENT_COUNTER_SFT 0 ++#define HOST_EVENT_COUNTER_HI 7 ++#define HOST_EVENT_COUNTER_SZ 8 ++#define TX_PKT_DROP_COUNTER_MSK 0x000000ff ++#define TX_PKT_DROP_COUNTER_I_MSK 0xffffff00 ++#define TX_PKT_DROP_COUNTER_SFT 0 ++#define TX_PKT_DROP_COUNTER_HI 7 ++#define TX_PKT_DROP_COUNTER_SZ 8 ++#define RX_PKT_DROP_COUNTER_MSK 0x000000ff ++#define RX_PKT_DROP_COUNTER_I_MSK 0xffffff00 ++#define RX_PKT_DROP_COUNTER_SFT 0 ++#define RX_PKT_DROP_COUNTER_HI 7 ++#define RX_PKT_DROP_COUNTER_SZ 8 ++#define TX_PKT_TRAP_COUNTER_MSK 0x000000ff ++#define TX_PKT_TRAP_COUNTER_I_MSK 0xffffff00 ++#define TX_PKT_TRAP_COUNTER_SFT 0 ++#define TX_PKT_TRAP_COUNTER_HI 7 ++#define TX_PKT_TRAP_COUNTER_SZ 8 ++#define RX_PKT_TRAP_COUNTER_MSK 0x000000ff ++#define RX_PKT_TRAP_COUNTER_I_MSK 0xffffff00 ++#define RX_PKT_TRAP_COUNTER_SFT 0 ++#define RX_PKT_TRAP_COUNTER_HI 7 ++#define RX_PKT_TRAP_COUNTER_SZ 8 ++#define HOST_TX_FAIL_COUNTER_MSK 0x000000ff ++#define HOST_TX_FAIL_COUNTER_I_MSK 0xffffff00 ++#define HOST_TX_FAIL_COUNTER_SFT 0 ++#define HOST_TX_FAIL_COUNTER_HI 7 ++#define HOST_TX_FAIL_COUNTER_SZ 8 ++#define HOST_RX_FAIL_COUNTER_MSK 0x000000ff ++#define HOST_RX_FAIL_COUNTER_I_MSK 0xffffff00 ++#define HOST_RX_FAIL_COUNTER_SFT 0 ++#define HOST_RX_FAIL_COUNTER_HI 7 ++#define HOST_RX_FAIL_COUNTER_SZ 8 ++#define HCI_STATE_MONITOR_MSK 0xffffffff ++#define HCI_STATE_MONITOR_I_MSK 0x00000000 ++#define HCI_STATE_MONITOR_SFT 0 ++#define HCI_STATE_MONITOR_HI 31 ++#define HCI_STATE_MONITOR_SZ 32 ++#define HCI_ST_TIMEOUT_MONITOR_MSK 0xffffffff ++#define HCI_ST_TIMEOUT_MONITOR_I_MSK 0x00000000 ++#define HCI_ST_TIMEOUT_MONITOR_SFT 0 ++#define HCI_ST_TIMEOUT_MONITOR_HI 31 ++#define HCI_ST_TIMEOUT_MONITOR_SZ 32 ++#define TX_ON_DEMAND_LENGTH_MSK 0xffffffff ++#define TX_ON_DEMAND_LENGTH_I_MSK 0x00000000 ++#define TX_ON_DEMAND_LENGTH_SFT 0 ++#define TX_ON_DEMAND_LENGTH_HI 31 ++#define TX_ON_DEMAND_LENGTH_SZ 32 ++#define HCI_MONITOR_REG1_MSK 0xffffffff ++#define HCI_MONITOR_REG1_I_MSK 0x00000000 ++#define HCI_MONITOR_REG1_SFT 0 ++#define HCI_MONITOR_REG1_HI 31 ++#define HCI_MONITOR_REG1_SZ 32 ++#define HCI_MONITOR_REG2_MSK 0xffffffff ++#define HCI_MONITOR_REG2_I_MSK 0x00000000 ++#define HCI_MONITOR_REG2_SFT 0 ++#define HCI_MONITOR_REG2_HI 31 ++#define HCI_MONITOR_REG2_SZ 32 ++#define HCI_TX_ALLOC_TIME_31_0_MSK 0xffffffff ++#define HCI_TX_ALLOC_TIME_31_0_I_MSK 0x00000000 ++#define HCI_TX_ALLOC_TIME_31_0_SFT 0 ++#define HCI_TX_ALLOC_TIME_31_0_HI 31 ++#define HCI_TX_ALLOC_TIME_31_0_SZ 32 ++#define HCI_TX_ALLOC_TIME_47_32_MSK 0x0000ffff ++#define HCI_TX_ALLOC_TIME_47_32_I_MSK 0xffff0000 ++#define HCI_TX_ALLOC_TIME_47_32_SFT 0 ++#define HCI_TX_ALLOC_TIME_47_32_HI 15 ++#define HCI_TX_ALLOC_TIME_47_32_SZ 16 ++#define HCI_MB_MAX_CNT_MSK 0x00ff0000 ++#define HCI_MB_MAX_CNT_I_MSK 0xff00ffff ++#define HCI_MB_MAX_CNT_SFT 16 ++#define HCI_MB_MAX_CNT_HI 23 ++#define HCI_MB_MAX_CNT_SZ 8 ++#define HCI_TX_ALLOC_CNT_31_0_MSK 0xffffffff ++#define HCI_TX_ALLOC_CNT_31_0_I_MSK 0x00000000 ++#define HCI_TX_ALLOC_CNT_31_0_SFT 0 ++#define HCI_TX_ALLOC_CNT_31_0_HI 31 ++#define HCI_TX_ALLOC_CNT_31_0_SZ 32 ++#define HCI_TX_ALLOC_CNT_47_32_MSK 0x0000ffff ++#define HCI_TX_ALLOC_CNT_47_32_I_MSK 0xffff0000 ++#define HCI_TX_ALLOC_CNT_47_32_SFT 0 ++#define HCI_TX_ALLOC_CNT_47_32_HI 15 ++#define HCI_TX_ALLOC_CNT_47_32_SZ 16 ++#define HCI_PROC_CNT_MSK 0x00ff0000 ++#define HCI_PROC_CNT_I_MSK 0xff00ffff ++#define HCI_PROC_CNT_SFT 16 ++#define HCI_PROC_CNT_HI 23 ++#define HCI_PROC_CNT_SZ 8 ++#define SDIO_TRANS_CNT_MSK 0xff000000 ++#define SDIO_TRANS_CNT_I_MSK 0x00ffffff ++#define SDIO_TRANS_CNT_SFT 24 ++#define SDIO_TRANS_CNT_HI 31 ++#define SDIO_TRANS_CNT_SZ 8 ++#define SDIO_TX_INVALID_CNT_31_0_MSK 0xffffffff ++#define SDIO_TX_INVALID_CNT_31_0_I_MSK 0x00000000 ++#define SDIO_TX_INVALID_CNT_31_0_SFT 0 ++#define SDIO_TX_INVALID_CNT_31_0_HI 31 ++#define SDIO_TX_INVALID_CNT_31_0_SZ 32 ++#define SDIO_TX_INVALID_CNT_47_32_MSK 0x0000ffff ++#define SDIO_TX_INVALID_CNT_47_32_I_MSK 0xffff0000 ++#define SDIO_TX_INVALID_CNT_47_32_SFT 0 ++#define SDIO_TX_INVALID_CNT_47_32_HI 15 ++#define SDIO_TX_INVALID_CNT_47_32_SZ 16 ++#define CS_START_ADDR_MSK 0x0000ffff ++#define CS_START_ADDR_I_MSK 0xffff0000 ++#define CS_START_ADDR_SFT 0 ++#define CS_START_ADDR_HI 15 ++#define CS_START_ADDR_SZ 16 ++#define CS_PKT_ID_MSK 0x007f0000 ++#define CS_PKT_ID_I_MSK 0xff80ffff ++#define CS_PKT_ID_SFT 16 ++#define CS_PKT_ID_HI 22 ++#define CS_PKT_ID_SZ 7 ++#define ADD_LEN_MSK 0x0000ffff ++#define ADD_LEN_I_MSK 0xffff0000 ++#define ADD_LEN_SFT 0 ++#define ADD_LEN_HI 15 ++#define ADD_LEN_SZ 16 ++#define CS_ADDER_EN_MSK 0x00000001 ++#define CS_ADDER_EN_I_MSK 0xfffffffe ++#define CS_ADDER_EN_SFT 0 ++#define CS_ADDER_EN_HI 0 ++#define CS_ADDER_EN_SZ 1 ++#define PSEUDO_MSK 0x00000002 ++#define PSEUDO_I_MSK 0xfffffffd ++#define PSEUDO_SFT 1 ++#define PSEUDO_HI 1 ++#define PSEUDO_SZ 1 ++#define CALCULATE_MSK 0xffffffff ++#define CALCULATE_I_MSK 0x00000000 ++#define CALCULATE_SFT 0 ++#define CALCULATE_HI 31 ++#define CALCULATE_SZ 32 ++#define L4_LEN_MSK 0x0000ffff ++#define L4_LEN_I_MSK 0xffff0000 ++#define L4_LEN_SFT 0 ++#define L4_LEN_HI 15 ++#define L4_LEN_SZ 16 ++#define L4_PROTOL_MSK 0x00ff0000 ++#define L4_PROTOL_I_MSK 0xff00ffff ++#define L4_PROTOL_SFT 16 ++#define L4_PROTOL_HI 23 ++#define L4_PROTOL_SZ 8 ++#define CHECK_SUM_MSK 0x0000ffff ++#define CHECK_SUM_I_MSK 0xffff0000 ++#define CHECK_SUM_SFT 0 ++#define CHECK_SUM_HI 15 ++#define CHECK_SUM_SZ 16 ++#define RAND_EN_MSK 0x00000001 ++#define RAND_EN_I_MSK 0xfffffffe ++#define RAND_EN_SFT 0 ++#define RAND_EN_HI 0 ++#define RAND_EN_SZ 1 ++#define RAND_NUM_MSK 0xffffffff ++#define RAND_NUM_I_MSK 0x00000000 ++#define RAND_NUM_SFT 0 ++#define RAND_NUM_HI 31 ++#define RAND_NUM_SZ 32 ++#define MUL_OP1_MSK 0xffffffff ++#define MUL_OP1_I_MSK 0x00000000 ++#define MUL_OP1_SFT 0 ++#define MUL_OP1_HI 31 ++#define MUL_OP1_SZ 32 ++#define MUL_OP2_MSK 0xffffffff ++#define MUL_OP2_I_MSK 0x00000000 ++#define MUL_OP2_SFT 0 ++#define MUL_OP2_HI 31 ++#define MUL_OP2_SZ 32 ++#define MUL_ANS0_MSK 0xffffffff ++#define MUL_ANS0_I_MSK 0x00000000 ++#define MUL_ANS0_SFT 0 ++#define MUL_ANS0_HI 31 ++#define MUL_ANS0_SZ 32 ++#define MUL_ANS1_MSK 0xffffffff ++#define MUL_ANS1_I_MSK 0x00000000 ++#define MUL_ANS1_SFT 0 ++#define MUL_ANS1_HI 31 ++#define MUL_ANS1_SZ 32 ++#define RD_ADDR_MSK 0x0000ffff ++#define RD_ADDR_I_MSK 0xffff0000 ++#define RD_ADDR_SFT 0 ++#define RD_ADDR_HI 15 ++#define RD_ADDR_SZ 16 ++#define RD_ID_MSK 0x007f0000 ++#define RD_ID_I_MSK 0xff80ffff ++#define RD_ID_SFT 16 ++#define RD_ID_HI 22 ++#define RD_ID_SZ 7 ++#define WR_ADDR_MSK 0x0000ffff ++#define WR_ADDR_I_MSK 0xffff0000 ++#define WR_ADDR_SFT 0 ++#define WR_ADDR_HI 15 ++#define WR_ADDR_SZ 16 ++#define WR_ID_MSK 0x007f0000 ++#define WR_ID_I_MSK 0xff80ffff ++#define WR_ID_SFT 16 ++#define WR_ID_HI 22 ++#define WR_ID_SZ 7 ++#define LEN_MSK 0x0000ffff ++#define LEN_I_MSK 0xffff0000 ++#define LEN_SFT 0 ++#define LEN_HI 15 ++#define LEN_SZ 16 ++#define CLR_MSK 0x00000001 ++#define CLR_I_MSK 0xfffffffe ++#define CLR_SFT 0 ++#define CLR_HI 0 ++#define CLR_SZ 1 ++#define PHY_MODE_MSK 0x00000003 ++#define PHY_MODE_I_MSK 0xfffffffc ++#define PHY_MODE_SFT 0 ++#define PHY_MODE_HI 1 ++#define PHY_MODE_SZ 2 ++#define SHRT_PREAM_MSK 0x00000004 ++#define SHRT_PREAM_I_MSK 0xfffffffb ++#define SHRT_PREAM_SFT 2 ++#define SHRT_PREAM_HI 2 ++#define SHRT_PREAM_SZ 1 ++#define SHRT_GI_MSK 0x00000008 ++#define SHRT_GI_I_MSK 0xfffffff7 ++#define SHRT_GI_SFT 3 ++#define SHRT_GI_HI 3 ++#define SHRT_GI_SZ 1 ++#define DATA_RATE_MSK 0x000007f0 ++#define DATA_RATE_I_MSK 0xfffff80f ++#define DATA_RATE_SFT 4 ++#define DATA_RATE_HI 10 ++#define DATA_RATE_SZ 7 ++#define MCS_MSK 0x00007000 ++#define MCS_I_MSK 0xffff8fff ++#define MCS_SFT 12 ++#define MCS_HI 14 ++#define MCS_SZ 3 ++#define FRAME_LEN_MSK 0xffff0000 ++#define FRAME_LEN_I_MSK 0x0000ffff ++#define FRAME_LEN_SFT 16 ++#define FRAME_LEN_HI 31 ++#define FRAME_LEN_SZ 16 ++#define DURATION_MSK 0x0000ffff ++#define DURATION_I_MSK 0xffff0000 ++#define DURATION_SFT 0 ++#define DURATION_HI 15 ++#define DURATION_SZ 16 ++#define SHA_DST_ADDR_MSK 0xffffffff ++#define SHA_DST_ADDR_I_MSK 0x00000000 ++#define SHA_DST_ADDR_SFT 0 ++#define SHA_DST_ADDR_HI 31 ++#define SHA_DST_ADDR_SZ 32 ++#define SHA_SRC_ADDR_MSK 0xffffffff ++#define SHA_SRC_ADDR_I_MSK 0x00000000 ++#define SHA_SRC_ADDR_SFT 0 ++#define SHA_SRC_ADDR_HI 31 ++#define SHA_SRC_ADDR_SZ 32 ++#define SHA_BUSY_MSK 0x00000001 ++#define SHA_BUSY_I_MSK 0xfffffffe ++#define SHA_BUSY_SFT 0 ++#define SHA_BUSY_HI 0 ++#define SHA_BUSY_SZ 1 ++#define SHA_ENDIAN_MSK 0x00000002 ++#define SHA_ENDIAN_I_MSK 0xfffffffd ++#define SHA_ENDIAN_SFT 1 ++#define SHA_ENDIAN_HI 1 ++#define SHA_ENDIAN_SZ 1 ++#define EFS_CLKFREQ_MSK 0x00000fff ++#define EFS_CLKFREQ_I_MSK 0xfffff000 ++#define EFS_CLKFREQ_SFT 0 ++#define EFS_CLKFREQ_HI 11 ++#define EFS_CLKFREQ_SZ 12 ++#define LOW_ACTIVE_MSK 0x00010000 ++#define LOW_ACTIVE_I_MSK 0xfffeffff ++#define LOW_ACTIVE_SFT 16 ++#define LOW_ACTIVE_HI 16 ++#define LOW_ACTIVE_SZ 1 ++#define EFS_CLKFREQ_RD_MSK 0x0ff00000 ++#define EFS_CLKFREQ_RD_I_MSK 0xf00fffff ++#define EFS_CLKFREQ_RD_SFT 20 ++#define EFS_CLKFREQ_RD_HI 27 ++#define EFS_CLKFREQ_RD_SZ 8 ++#define EFS_PRE_RD_MSK 0xf0000000 ++#define EFS_PRE_RD_I_MSK 0x0fffffff ++#define EFS_PRE_RD_SFT 28 ++#define EFS_PRE_RD_HI 31 ++#define EFS_PRE_RD_SZ 4 ++#define EFS_LDO_ON_MSK 0x0000ffff ++#define EFS_LDO_ON_I_MSK 0xffff0000 ++#define EFS_LDO_ON_SFT 0 ++#define EFS_LDO_ON_HI 15 ++#define EFS_LDO_ON_SZ 16 ++#define EFS_LDO_OFF_MSK 0xffff0000 ++#define EFS_LDO_OFF_I_MSK 0x0000ffff ++#define EFS_LDO_OFF_SFT 16 ++#define EFS_LDO_OFF_HI 31 ++#define EFS_LDO_OFF_SZ 16 ++#define EFS_RDATA_0_MSK 0xffffffff ++#define EFS_RDATA_0_I_MSK 0x00000000 ++#define EFS_RDATA_0_SFT 0 ++#define EFS_RDATA_0_HI 31 ++#define EFS_RDATA_0_SZ 32 ++#define EFS_WDATA_0_MSK 0xffffffff ++#define EFS_WDATA_0_I_MSK 0x00000000 ++#define EFS_WDATA_0_SFT 0 ++#define EFS_WDATA_0_HI 31 ++#define EFS_WDATA_0_SZ 32 ++#define EFS_RDATA_1_MSK 0xffffffff ++#define EFS_RDATA_1_I_MSK 0x00000000 ++#define EFS_RDATA_1_SFT 0 ++#define EFS_RDATA_1_HI 31 ++#define EFS_RDATA_1_SZ 32 ++#define EFS_WDATA_1_MSK 0xffffffff ++#define EFS_WDATA_1_I_MSK 0x00000000 ++#define EFS_WDATA_1_SFT 0 ++#define EFS_WDATA_1_HI 31 ++#define EFS_WDATA_1_SZ 32 ++#define EFS_RDATA_2_MSK 0xffffffff ++#define EFS_RDATA_2_I_MSK 0x00000000 ++#define EFS_RDATA_2_SFT 0 ++#define EFS_RDATA_2_HI 31 ++#define EFS_RDATA_2_SZ 32 ++#define EFS_WDATA_2_MSK 0xffffffff ++#define EFS_WDATA_2_I_MSK 0x00000000 ++#define EFS_WDATA_2_SFT 0 ++#define EFS_WDATA_2_HI 31 ++#define EFS_WDATA_2_SZ 32 ++#define EFS_RDATA_3_MSK 0xffffffff ++#define EFS_RDATA_3_I_MSK 0x00000000 ++#define EFS_RDATA_3_SFT 0 ++#define EFS_RDATA_3_HI 31 ++#define EFS_RDATA_3_SZ 32 ++#define EFS_WDATA_3_MSK 0xffffffff ++#define EFS_WDATA_3_I_MSK 0x00000000 ++#define EFS_WDATA_3_SFT 0 ++#define EFS_WDATA_3_HI 31 ++#define EFS_WDATA_3_SZ 32 ++#define EFS_RDATA_4_MSK 0xffffffff ++#define EFS_RDATA_4_I_MSK 0x00000000 ++#define EFS_RDATA_4_SFT 0 ++#define EFS_RDATA_4_HI 31 ++#define EFS_RDATA_4_SZ 32 ++#define EFS_WDATA_4_MSK 0xffffffff ++#define EFS_WDATA_4_I_MSK 0x00000000 ++#define EFS_WDATA_4_SFT 0 ++#define EFS_WDATA_4_HI 31 ++#define EFS_WDATA_4_SZ 32 ++#define EFS_RDATA_5_MSK 0xffffffff ++#define EFS_RDATA_5_I_MSK 0x00000000 ++#define EFS_RDATA_5_SFT 0 ++#define EFS_RDATA_5_HI 31 ++#define EFS_RDATA_5_SZ 32 ++#define EFS_WDATA_5_MSK 0xffffffff ++#define EFS_WDATA_5_I_MSK 0x00000000 ++#define EFS_WDATA_5_SFT 0 ++#define EFS_WDATA_5_HI 31 ++#define EFS_WDATA_5_SZ 32 ++#define EFS_RDATA_6_MSK 0xffffffff ++#define EFS_RDATA_6_I_MSK 0x00000000 ++#define EFS_RDATA_6_SFT 0 ++#define EFS_RDATA_6_HI 31 ++#define EFS_RDATA_6_SZ 32 ++#define EFS_WDATA_6_MSK 0xffffffff ++#define EFS_WDATA_6_I_MSK 0x00000000 ++#define EFS_WDATA_6_SFT 0 ++#define EFS_WDATA_6_HI 31 ++#define EFS_WDATA_6_SZ 32 ++#define EFS_RDATA_7_MSK 0xffffffff ++#define EFS_RDATA_7_I_MSK 0x00000000 ++#define EFS_RDATA_7_SFT 0 ++#define EFS_RDATA_7_HI 31 ++#define EFS_RDATA_7_SZ 32 ++#define EFS_WDATA_7_MSK 0xffffffff ++#define EFS_WDATA_7_I_MSK 0x00000000 ++#define EFS_WDATA_7_SFT 0 ++#define EFS_WDATA_7_HI 31 ++#define EFS_WDATA_7_SZ 32 ++#define EFS_SPI_RD0_EN_MSK 0x00000001 ++#define EFS_SPI_RD0_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD0_EN_SFT 0 ++#define EFS_SPI_RD0_EN_HI 0 ++#define EFS_SPI_RD0_EN_SZ 1 ++#define EFS_SPI_RD1_EN_MSK 0x00000001 ++#define EFS_SPI_RD1_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD1_EN_SFT 0 ++#define EFS_SPI_RD1_EN_HI 0 ++#define EFS_SPI_RD1_EN_SZ 1 ++#define EFS_SPI_RD2_EN_MSK 0x00000001 ++#define EFS_SPI_RD2_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD2_EN_SFT 0 ++#define EFS_SPI_RD2_EN_HI 0 ++#define EFS_SPI_RD2_EN_SZ 1 ++#define EFS_SPI_RD3_EN_MSK 0x00000001 ++#define EFS_SPI_RD3_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD3_EN_SFT 0 ++#define EFS_SPI_RD3_EN_HI 0 ++#define EFS_SPI_RD3_EN_SZ 1 ++#define EFS_SPI_RD4_EN_MSK 0x00000001 ++#define EFS_SPI_RD4_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD4_EN_SFT 0 ++#define EFS_SPI_RD4_EN_HI 0 ++#define EFS_SPI_RD4_EN_SZ 1 ++#define EFS_SPI_RD5_EN_MSK 0x00000001 ++#define EFS_SPI_RD5_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD5_EN_SFT 0 ++#define EFS_SPI_RD5_EN_HI 0 ++#define EFS_SPI_RD5_EN_SZ 1 ++#define EFS_SPI_RD6_EN_MSK 0x00000001 ++#define EFS_SPI_RD6_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD6_EN_SFT 0 ++#define EFS_SPI_RD6_EN_HI 0 ++#define EFS_SPI_RD6_EN_SZ 1 ++#define EFS_SPI_RD7_EN_MSK 0x00000001 ++#define EFS_SPI_RD7_EN_I_MSK 0xfffffffe ++#define EFS_SPI_RD7_EN_SFT 0 ++#define EFS_SPI_RD7_EN_HI 0 ++#define EFS_SPI_RD7_EN_SZ 1 ++#define EFS_SPI_RBUSY_MSK 0x00000001 ++#define EFS_SPI_RBUSY_I_MSK 0xfffffffe ++#define EFS_SPI_RBUSY_SFT 0 ++#define EFS_SPI_RBUSY_HI 0 ++#define EFS_SPI_RBUSY_SZ 1 ++#define EFS_SPI_RDATA_0_MSK 0xffffffff ++#define EFS_SPI_RDATA_0_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_0_SFT 0 ++#define EFS_SPI_RDATA_0_HI 31 ++#define EFS_SPI_RDATA_0_SZ 32 ++#define EFS_SPI_RDATA_1_MSK 0xffffffff ++#define EFS_SPI_RDATA_1_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_1_SFT 0 ++#define EFS_SPI_RDATA_1_HI 31 ++#define EFS_SPI_RDATA_1_SZ 32 ++#define EFS_SPI_RDATA_2_MSK 0xffffffff ++#define EFS_SPI_RDATA_2_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_2_SFT 0 ++#define EFS_SPI_RDATA_2_HI 31 ++#define EFS_SPI_RDATA_2_SZ 32 ++#define EFS_SPI_RDATA_3_MSK 0xffffffff ++#define EFS_SPI_RDATA_3_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_3_SFT 0 ++#define EFS_SPI_RDATA_3_HI 31 ++#define EFS_SPI_RDATA_3_SZ 32 ++#define EFS_SPI_RDATA_4_MSK 0xffffffff ++#define EFS_SPI_RDATA_4_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_4_SFT 0 ++#define EFS_SPI_RDATA_4_HI 31 ++#define EFS_SPI_RDATA_4_SZ 32 ++#define EFS_SPI_RDATA_5_MSK 0xffffffff ++#define EFS_SPI_RDATA_5_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_5_SFT 0 ++#define EFS_SPI_RDATA_5_HI 31 ++#define EFS_SPI_RDATA_5_SZ 32 ++#define EFS_SPI_RDATA_6_MSK 0xffffffff ++#define EFS_SPI_RDATA_6_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_6_SFT 0 ++#define EFS_SPI_RDATA_6_HI 31 ++#define EFS_SPI_RDATA_6_SZ 32 ++#define EFS_SPI_RDATA_7_MSK 0xffffffff ++#define EFS_SPI_RDATA_7_I_MSK 0x00000000 ++#define EFS_SPI_RDATA_7_SFT 0 ++#define EFS_SPI_RDATA_7_HI 31 ++#define EFS_SPI_RDATA_7_SZ 32 ++#define GET_RK_MSK 0x00000001 ++#define GET_RK_I_MSK 0xfffffffe ++#define GET_RK_SFT 0 ++#define GET_RK_HI 0 ++#define GET_RK_SZ 1 ++#define FORCE_GET_RK_MSK 0x00000002 ++#define FORCE_GET_RK_I_MSK 0xfffffffd ++#define FORCE_GET_RK_SFT 1 ++#define FORCE_GET_RK_HI 1 ++#define FORCE_GET_RK_SZ 1 ++#define SMS4_DESCRY_EN_MSK 0x00000010 ++#define SMS4_DESCRY_EN_I_MSK 0xffffffef ++#define SMS4_DESCRY_EN_SFT 4 ++#define SMS4_DESCRY_EN_HI 4 ++#define SMS4_DESCRY_EN_SZ 1 ++#define DEC_DOUT_MSB_MSK 0x00000001 ++#define DEC_DOUT_MSB_I_MSK 0xfffffffe ++#define DEC_DOUT_MSB_SFT 0 ++#define DEC_DOUT_MSB_HI 0 ++#define DEC_DOUT_MSB_SZ 1 ++#define DEC_DIN_MSB_MSK 0x00000002 ++#define DEC_DIN_MSB_I_MSK 0xfffffffd ++#define DEC_DIN_MSB_SFT 1 ++#define DEC_DIN_MSB_HI 1 ++#define DEC_DIN_MSB_SZ 1 ++#define ENC_DOUT_MSB_MSK 0x00000004 ++#define ENC_DOUT_MSB_I_MSK 0xfffffffb ++#define ENC_DOUT_MSB_SFT 2 ++#define ENC_DOUT_MSB_HI 2 ++#define ENC_DOUT_MSB_SZ 1 ++#define ENC_DIN_MSB_MSK 0x00000008 ++#define ENC_DIN_MSB_I_MSK 0xfffffff7 ++#define ENC_DIN_MSB_SFT 3 ++#define ENC_DIN_MSB_HI 3 ++#define ENC_DIN_MSB_SZ 1 ++#define KEY_DIN_MSB_MSK 0x00000010 ++#define KEY_DIN_MSB_I_MSK 0xffffffef ++#define KEY_DIN_MSB_SFT 4 ++#define KEY_DIN_MSB_HI 4 ++#define KEY_DIN_MSB_SZ 1 ++#define SMS4_CBC_EN_MSK 0x00000001 ++#define SMS4_CBC_EN_I_MSK 0xfffffffe ++#define SMS4_CBC_EN_SFT 0 ++#define SMS4_CBC_EN_HI 0 ++#define SMS4_CBC_EN_SZ 1 ++#define SMS4_CFB_EN_MSK 0x00000002 ++#define SMS4_CFB_EN_I_MSK 0xfffffffd ++#define SMS4_CFB_EN_SFT 1 ++#define SMS4_CFB_EN_HI 1 ++#define SMS4_CFB_EN_SZ 1 ++#define SMS4_OFB_EN_MSK 0x00000004 ++#define SMS4_OFB_EN_I_MSK 0xfffffffb ++#define SMS4_OFB_EN_SFT 2 ++#define SMS4_OFB_EN_HI 2 ++#define SMS4_OFB_EN_SZ 1 ++#define SMS4_START_TRIG_MSK 0x00000001 ++#define SMS4_START_TRIG_I_MSK 0xfffffffe ++#define SMS4_START_TRIG_SFT 0 ++#define SMS4_START_TRIG_HI 0 ++#define SMS4_START_TRIG_SZ 1 ++#define SMS4_BUSY_MSK 0x00000001 ++#define SMS4_BUSY_I_MSK 0xfffffffe ++#define SMS4_BUSY_SFT 0 ++#define SMS4_BUSY_HI 0 ++#define SMS4_BUSY_SZ 1 ++#define SMS4_DONE_MSK 0x00000001 ++#define SMS4_DONE_I_MSK 0xfffffffe ++#define SMS4_DONE_SFT 0 ++#define SMS4_DONE_HI 0 ++#define SMS4_DONE_SZ 1 ++#define SMS4_DATAIN_0_MSK 0xffffffff ++#define SMS4_DATAIN_0_I_MSK 0x00000000 ++#define SMS4_DATAIN_0_SFT 0 ++#define SMS4_DATAIN_0_HI 31 ++#define SMS4_DATAIN_0_SZ 32 ++#define SMS4_DATAIN_1_MSK 0xffffffff ++#define SMS4_DATAIN_1_I_MSK 0x00000000 ++#define SMS4_DATAIN_1_SFT 0 ++#define SMS4_DATAIN_1_HI 31 ++#define SMS4_DATAIN_1_SZ 32 ++#define SMS4_DATAIN_2_MSK 0xffffffff ++#define SMS4_DATAIN_2_I_MSK 0x00000000 ++#define SMS4_DATAIN_2_SFT 0 ++#define SMS4_DATAIN_2_HI 31 ++#define SMS4_DATAIN_2_SZ 32 ++#define SMS4_DATAIN_3_MSK 0xffffffff ++#define SMS4_DATAIN_3_I_MSK 0x00000000 ++#define SMS4_DATAIN_3_SFT 0 ++#define SMS4_DATAIN_3_HI 31 ++#define SMS4_DATAIN_3_SZ 32 ++#define SMS4_DATAOUT_0_MSK 0xffffffff ++#define SMS4_DATAOUT_0_I_MSK 0x00000000 ++#define SMS4_DATAOUT_0_SFT 0 ++#define SMS4_DATAOUT_0_HI 31 ++#define SMS4_DATAOUT_0_SZ 32 ++#define SMS4_DATAOUT_1_MSK 0xffffffff ++#define SMS4_DATAOUT_1_I_MSK 0x00000000 ++#define SMS4_DATAOUT_1_SFT 0 ++#define SMS4_DATAOUT_1_HI 31 ++#define SMS4_DATAOUT_1_SZ 32 ++#define SMS4_DATAOUT_2_MSK 0xffffffff ++#define SMS4_DATAOUT_2_I_MSK 0x00000000 ++#define SMS4_DATAOUT_2_SFT 0 ++#define SMS4_DATAOUT_2_HI 31 ++#define SMS4_DATAOUT_2_SZ 32 ++#define SMS4_DATAOUT_3_MSK 0xffffffff ++#define SMS4_DATAOUT_3_I_MSK 0x00000000 ++#define SMS4_DATAOUT_3_SFT 0 ++#define SMS4_DATAOUT_3_HI 31 ++#define SMS4_DATAOUT_3_SZ 32 ++#define SMS4_KEY_0_MSK 0xffffffff ++#define SMS4_KEY_0_I_MSK 0x00000000 ++#define SMS4_KEY_0_SFT 0 ++#define SMS4_KEY_0_HI 31 ++#define SMS4_KEY_0_SZ 32 ++#define SMS4_KEY_1_MSK 0xffffffff ++#define SMS4_KEY_1_I_MSK 0x00000000 ++#define SMS4_KEY_1_SFT 0 ++#define SMS4_KEY_1_HI 31 ++#define SMS4_KEY_1_SZ 32 ++#define SMS4_KEY_2_MSK 0xffffffff ++#define SMS4_KEY_2_I_MSK 0x00000000 ++#define SMS4_KEY_2_SFT 0 ++#define SMS4_KEY_2_HI 31 ++#define SMS4_KEY_2_SZ 32 ++#define SMS4_KEY_3_MSK 0xffffffff ++#define SMS4_KEY_3_I_MSK 0x00000000 ++#define SMS4_KEY_3_SFT 0 ++#define SMS4_KEY_3_HI 31 ++#define SMS4_KEY_3_SZ 32 ++#define SMS4_MODE_IV0_MSK 0xffffffff ++#define SMS4_MODE_IV0_I_MSK 0x00000000 ++#define SMS4_MODE_IV0_SFT 0 ++#define SMS4_MODE_IV0_HI 31 ++#define SMS4_MODE_IV0_SZ 32 ++#define SMS4_MODE_IV1_MSK 0xffffffff ++#define SMS4_MODE_IV1_I_MSK 0x00000000 ++#define SMS4_MODE_IV1_SFT 0 ++#define SMS4_MODE_IV1_HI 31 ++#define SMS4_MODE_IV1_SZ 32 ++#define SMS4_MODE_IV2_MSK 0xffffffff ++#define SMS4_MODE_IV2_I_MSK 0x00000000 ++#define SMS4_MODE_IV2_SFT 0 ++#define SMS4_MODE_IV2_HI 31 ++#define SMS4_MODE_IV2_SZ 32 ++#define SMS4_MODE_IV3_MSK 0xffffffff ++#define SMS4_MODE_IV3_I_MSK 0x00000000 ++#define SMS4_MODE_IV3_SFT 0 ++#define SMS4_MODE_IV3_HI 31 ++#define SMS4_MODE_IV3_SZ 32 ++#define SMS4_OFB_ENC0_MSK 0xffffffff ++#define SMS4_OFB_ENC0_I_MSK 0x00000000 ++#define SMS4_OFB_ENC0_SFT 0 ++#define SMS4_OFB_ENC0_HI 31 ++#define SMS4_OFB_ENC0_SZ 32 ++#define SMS4_OFB_ENC1_MSK 0xffffffff ++#define SMS4_OFB_ENC1_I_MSK 0x00000000 ++#define SMS4_OFB_ENC1_SFT 0 ++#define SMS4_OFB_ENC1_HI 31 ++#define SMS4_OFB_ENC1_SZ 32 ++#define SMS4_OFB_ENC2_MSK 0xffffffff ++#define SMS4_OFB_ENC2_I_MSK 0x00000000 ++#define SMS4_OFB_ENC2_SFT 0 ++#define SMS4_OFB_ENC2_HI 31 ++#define SMS4_OFB_ENC2_SZ 32 ++#define SMS4_OFB_ENC3_MSK 0xffffffff ++#define SMS4_OFB_ENC3_I_MSK 0x00000000 ++#define SMS4_OFB_ENC3_SFT 0 ++#define SMS4_OFB_ENC3_HI 31 ++#define SMS4_OFB_ENC3_SZ 32 ++#define MRX_MCAST_TB0_31_0_MSK 0xffffffff ++#define MRX_MCAST_TB0_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_TB0_31_0_SFT 0 ++#define MRX_MCAST_TB0_31_0_HI 31 ++#define MRX_MCAST_TB0_31_0_SZ 32 ++#define MRX_MCAST_TB0_47_32_MSK 0x0000ffff ++#define MRX_MCAST_TB0_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_TB0_47_32_SFT 0 ++#define MRX_MCAST_TB0_47_32_HI 15 ++#define MRX_MCAST_TB0_47_32_SZ 16 ++#define MRX_MCAST_MASK0_31_0_MSK 0xffffffff ++#define MRX_MCAST_MASK0_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_MASK0_31_0_SFT 0 ++#define MRX_MCAST_MASK0_31_0_HI 31 ++#define MRX_MCAST_MASK0_31_0_SZ 32 ++#define MRX_MCAST_MASK0_47_32_MSK 0x0000ffff ++#define MRX_MCAST_MASK0_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_MASK0_47_32_SFT 0 ++#define MRX_MCAST_MASK0_47_32_HI 15 ++#define MRX_MCAST_MASK0_47_32_SZ 16 ++#define MRX_MCAST_CTRL_0_MSK 0x00000003 ++#define MRX_MCAST_CTRL_0_I_MSK 0xfffffffc ++#define MRX_MCAST_CTRL_0_SFT 0 ++#define MRX_MCAST_CTRL_0_HI 1 ++#define MRX_MCAST_CTRL_0_SZ 2 ++#define MRX_MCAST_TB1_31_0_MSK 0xffffffff ++#define MRX_MCAST_TB1_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_TB1_31_0_SFT 0 ++#define MRX_MCAST_TB1_31_0_HI 31 ++#define MRX_MCAST_TB1_31_0_SZ 32 ++#define MRX_MCAST_TB1_47_32_MSK 0x0000ffff ++#define MRX_MCAST_TB1_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_TB1_47_32_SFT 0 ++#define MRX_MCAST_TB1_47_32_HI 15 ++#define MRX_MCAST_TB1_47_32_SZ 16 ++#define MRX_MCAST_MASK1_31_0_MSK 0xffffffff ++#define MRX_MCAST_MASK1_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_MASK1_31_0_SFT 0 ++#define MRX_MCAST_MASK1_31_0_HI 31 ++#define MRX_MCAST_MASK1_31_0_SZ 32 ++#define MRX_MCAST_MASK1_47_32_MSK 0x0000ffff ++#define MRX_MCAST_MASK1_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_MASK1_47_32_SFT 0 ++#define MRX_MCAST_MASK1_47_32_HI 15 ++#define MRX_MCAST_MASK1_47_32_SZ 16 ++#define MRX_MCAST_CTRL_1_MSK 0x00000003 ++#define MRX_MCAST_CTRL_1_I_MSK 0xfffffffc ++#define MRX_MCAST_CTRL_1_SFT 0 ++#define MRX_MCAST_CTRL_1_HI 1 ++#define MRX_MCAST_CTRL_1_SZ 2 ++#define MRX_MCAST_TB2_31_0_MSK 0xffffffff ++#define MRX_MCAST_TB2_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_TB2_31_0_SFT 0 ++#define MRX_MCAST_TB2_31_0_HI 31 ++#define MRX_MCAST_TB2_31_0_SZ 32 ++#define MRX_MCAST_TB2_47_32_MSK 0x0000ffff ++#define MRX_MCAST_TB2_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_TB2_47_32_SFT 0 ++#define MRX_MCAST_TB2_47_32_HI 15 ++#define MRX_MCAST_TB2_47_32_SZ 16 ++#define MRX_MCAST_MASK2_31_0_MSK 0xffffffff ++#define MRX_MCAST_MASK2_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_MASK2_31_0_SFT 0 ++#define MRX_MCAST_MASK2_31_0_HI 31 ++#define MRX_MCAST_MASK2_31_0_SZ 32 ++#define MRX_MCAST_MASK2_47_32_MSK 0x0000ffff ++#define MRX_MCAST_MASK2_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_MASK2_47_32_SFT 0 ++#define MRX_MCAST_MASK2_47_32_HI 15 ++#define MRX_MCAST_MASK2_47_32_SZ 16 ++#define MRX_MCAST_CTRL_2_MSK 0x00000003 ++#define MRX_MCAST_CTRL_2_I_MSK 0xfffffffc ++#define MRX_MCAST_CTRL_2_SFT 0 ++#define MRX_MCAST_CTRL_2_HI 1 ++#define MRX_MCAST_CTRL_2_SZ 2 ++#define MRX_MCAST_TB3_31_0_MSK 0xffffffff ++#define MRX_MCAST_TB3_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_TB3_31_0_SFT 0 ++#define MRX_MCAST_TB3_31_0_HI 31 ++#define MRX_MCAST_TB3_31_0_SZ 32 ++#define MRX_MCAST_TB3_47_32_MSK 0x0000ffff ++#define MRX_MCAST_TB3_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_TB3_47_32_SFT 0 ++#define MRX_MCAST_TB3_47_32_HI 15 ++#define MRX_MCAST_TB3_47_32_SZ 16 ++#define MRX_MCAST_MASK3_31_0_MSK 0xffffffff ++#define MRX_MCAST_MASK3_31_0_I_MSK 0x00000000 ++#define MRX_MCAST_MASK3_31_0_SFT 0 ++#define MRX_MCAST_MASK3_31_0_HI 31 ++#define MRX_MCAST_MASK3_31_0_SZ 32 ++#define MRX_MCAST_MASK3_47_32_MSK 0x0000ffff ++#define MRX_MCAST_MASK3_47_32_I_MSK 0xffff0000 ++#define MRX_MCAST_MASK3_47_32_SFT 0 ++#define MRX_MCAST_MASK3_47_32_HI 15 ++#define MRX_MCAST_MASK3_47_32_SZ 16 ++#define MRX_MCAST_CTRL_3_MSK 0x00000003 ++#define MRX_MCAST_CTRL_3_I_MSK 0xfffffffc ++#define MRX_MCAST_CTRL_3_SFT 0 ++#define MRX_MCAST_CTRL_3_HI 1 ++#define MRX_MCAST_CTRL_3_SZ 2 ++#define MRX_PHY_INFO_MSK 0xffffffff ++#define MRX_PHY_INFO_I_MSK 0x00000000 ++#define MRX_PHY_INFO_SFT 0 ++#define MRX_PHY_INFO_HI 31 ++#define MRX_PHY_INFO_SZ 32 ++#define DBG_BA_TYPE_MSK 0x0000003f ++#define DBG_BA_TYPE_I_MSK 0xffffffc0 ++#define DBG_BA_TYPE_SFT 0 ++#define DBG_BA_TYPE_HI 5 ++#define DBG_BA_TYPE_SZ 6 ++#define DBG_BA_SEQ_MSK 0x000fff00 ++#define DBG_BA_SEQ_I_MSK 0xfff000ff ++#define DBG_BA_SEQ_SFT 8 ++#define DBG_BA_SEQ_HI 19 ++#define DBG_BA_SEQ_SZ 12 ++#define MRX_FLT_TB0_MSK 0x00007fff ++#define MRX_FLT_TB0_I_MSK 0xffff8000 ++#define MRX_FLT_TB0_SFT 0 ++#define MRX_FLT_TB0_HI 14 ++#define MRX_FLT_TB0_SZ 15 ++#define MRX_FLT_TB1_MSK 0x00007fff ++#define MRX_FLT_TB1_I_MSK 0xffff8000 ++#define MRX_FLT_TB1_SFT 0 ++#define MRX_FLT_TB1_HI 14 ++#define MRX_FLT_TB1_SZ 15 ++#define MRX_FLT_TB2_MSK 0x00007fff ++#define MRX_FLT_TB2_I_MSK 0xffff8000 ++#define MRX_FLT_TB2_SFT 0 ++#define MRX_FLT_TB2_HI 14 ++#define MRX_FLT_TB2_SZ 15 ++#define MRX_FLT_TB3_MSK 0x00007fff ++#define MRX_FLT_TB3_I_MSK 0xffff8000 ++#define MRX_FLT_TB3_SFT 0 ++#define MRX_FLT_TB3_HI 14 ++#define MRX_FLT_TB3_SZ 15 ++#define MRX_FLT_TB4_MSK 0x00007fff ++#define MRX_FLT_TB4_I_MSK 0xffff8000 ++#define MRX_FLT_TB4_SFT 0 ++#define MRX_FLT_TB4_HI 14 ++#define MRX_FLT_TB4_SZ 15 ++#define MRX_FLT_TB5_MSK 0x00007fff ++#define MRX_FLT_TB5_I_MSK 0xffff8000 ++#define MRX_FLT_TB5_SFT 0 ++#define MRX_FLT_TB5_HI 14 ++#define MRX_FLT_TB5_SZ 15 ++#define MRX_FLT_TB6_MSK 0x00007fff ++#define MRX_FLT_TB6_I_MSK 0xffff8000 ++#define MRX_FLT_TB6_SFT 0 ++#define MRX_FLT_TB6_HI 14 ++#define MRX_FLT_TB6_SZ 15 ++#define MRX_FLT_TB7_MSK 0x00007fff ++#define MRX_FLT_TB7_I_MSK 0xffff8000 ++#define MRX_FLT_TB7_SFT 0 ++#define MRX_FLT_TB7_HI 14 ++#define MRX_FLT_TB7_SZ 15 ++#define MRX_FLT_TB8_MSK 0x00007fff ++#define MRX_FLT_TB8_I_MSK 0xffff8000 ++#define MRX_FLT_TB8_SFT 0 ++#define MRX_FLT_TB8_HI 14 ++#define MRX_FLT_TB8_SZ 15 ++#define MRX_FLT_TB9_MSK 0x00007fff ++#define MRX_FLT_TB9_I_MSK 0xffff8000 ++#define MRX_FLT_TB9_SFT 0 ++#define MRX_FLT_TB9_HI 14 ++#define MRX_FLT_TB9_SZ 15 ++#define MRX_FLT_TB10_MSK 0x00007fff ++#define MRX_FLT_TB10_I_MSK 0xffff8000 ++#define MRX_FLT_TB10_SFT 0 ++#define MRX_FLT_TB10_HI 14 ++#define MRX_FLT_TB10_SZ 15 ++#define MRX_FLT_TB11_MSK 0x00007fff ++#define MRX_FLT_TB11_I_MSK 0xffff8000 ++#define MRX_FLT_TB11_SFT 0 ++#define MRX_FLT_TB11_HI 14 ++#define MRX_FLT_TB11_SZ 15 ++#define MRX_FLT_TB12_MSK 0x00007fff ++#define MRX_FLT_TB12_I_MSK 0xffff8000 ++#define MRX_FLT_TB12_SFT 0 ++#define MRX_FLT_TB12_HI 14 ++#define MRX_FLT_TB12_SZ 15 ++#define MRX_FLT_TB13_MSK 0x00007fff ++#define MRX_FLT_TB13_I_MSK 0xffff8000 ++#define MRX_FLT_TB13_SFT 0 ++#define MRX_FLT_TB13_HI 14 ++#define MRX_FLT_TB13_SZ 15 ++#define MRX_FLT_TB14_MSK 0x00007fff ++#define MRX_FLT_TB14_I_MSK 0xffff8000 ++#define MRX_FLT_TB14_SFT 0 ++#define MRX_FLT_TB14_HI 14 ++#define MRX_FLT_TB14_SZ 15 ++#define MRX_FLT_TB15_MSK 0x00007fff ++#define MRX_FLT_TB15_I_MSK 0xffff8000 ++#define MRX_FLT_TB15_SFT 0 ++#define MRX_FLT_TB15_HI 14 ++#define MRX_FLT_TB15_SZ 15 ++#define MRX_FLT_EN0_MSK 0x0000ffff ++#define MRX_FLT_EN0_I_MSK 0xffff0000 ++#define MRX_FLT_EN0_SFT 0 ++#define MRX_FLT_EN0_HI 15 ++#define MRX_FLT_EN0_SZ 16 ++#define MRX_FLT_EN1_MSK 0x0000ffff ++#define MRX_FLT_EN1_I_MSK 0xffff0000 ++#define MRX_FLT_EN1_SFT 0 ++#define MRX_FLT_EN1_HI 15 ++#define MRX_FLT_EN1_SZ 16 ++#define MRX_FLT_EN2_MSK 0x0000ffff ++#define MRX_FLT_EN2_I_MSK 0xffff0000 ++#define MRX_FLT_EN2_SFT 0 ++#define MRX_FLT_EN2_HI 15 ++#define MRX_FLT_EN2_SZ 16 ++#define MRX_FLT_EN3_MSK 0x0000ffff ++#define MRX_FLT_EN3_I_MSK 0xffff0000 ++#define MRX_FLT_EN3_SFT 0 ++#define MRX_FLT_EN3_HI 15 ++#define MRX_FLT_EN3_SZ 16 ++#define MRX_FLT_EN4_MSK 0x0000ffff ++#define MRX_FLT_EN4_I_MSK 0xffff0000 ++#define MRX_FLT_EN4_SFT 0 ++#define MRX_FLT_EN4_HI 15 ++#define MRX_FLT_EN4_SZ 16 ++#define MRX_FLT_EN5_MSK 0x0000ffff ++#define MRX_FLT_EN5_I_MSK 0xffff0000 ++#define MRX_FLT_EN5_SFT 0 ++#define MRX_FLT_EN5_HI 15 ++#define MRX_FLT_EN5_SZ 16 ++#define MRX_FLT_EN6_MSK 0x0000ffff ++#define MRX_FLT_EN6_I_MSK 0xffff0000 ++#define MRX_FLT_EN6_SFT 0 ++#define MRX_FLT_EN6_HI 15 ++#define MRX_FLT_EN6_SZ 16 ++#define MRX_FLT_EN7_MSK 0x0000ffff ++#define MRX_FLT_EN7_I_MSK 0xffff0000 ++#define MRX_FLT_EN7_SFT 0 ++#define MRX_FLT_EN7_HI 15 ++#define MRX_FLT_EN7_SZ 16 ++#define MRX_FLT_EN8_MSK 0x0000ffff ++#define MRX_FLT_EN8_I_MSK 0xffff0000 ++#define MRX_FLT_EN8_SFT 0 ++#define MRX_FLT_EN8_HI 15 ++#define MRX_FLT_EN8_SZ 16 ++#define MRX_LEN_FLT_MSK 0x0000ffff ++#define MRX_LEN_FLT_I_MSK 0xffff0000 ++#define MRX_LEN_FLT_SFT 0 ++#define MRX_LEN_FLT_HI 15 ++#define MRX_LEN_FLT_SZ 16 ++#define RX_FLOW_DATA_MSK 0xffffffff ++#define RX_FLOW_DATA_I_MSK 0x00000000 ++#define RX_FLOW_DATA_SFT 0 ++#define RX_FLOW_DATA_HI 31 ++#define RX_FLOW_DATA_SZ 32 ++#define RX_FLOW_MNG_MSK 0x0000ffff ++#define RX_FLOW_MNG_I_MSK 0xffff0000 ++#define RX_FLOW_MNG_SFT 0 ++#define RX_FLOW_MNG_HI 15 ++#define RX_FLOW_MNG_SZ 16 ++#define RX_FLOW_CTRL_MSK 0x0000ffff ++#define RX_FLOW_CTRL_I_MSK 0xffff0000 ++#define RX_FLOW_CTRL_SFT 0 ++#define RX_FLOW_CTRL_HI 15 ++#define RX_FLOW_CTRL_SZ 16 ++#define MRX_STP_EN_MSK 0x00000001 ++#define MRX_STP_EN_I_MSK 0xfffffffe ++#define MRX_STP_EN_SFT 0 ++#define MRX_STP_EN_HI 0 ++#define MRX_STP_EN_SZ 1 ++#define MRX_STP_OFST_MSK 0x0000ff00 ++#define MRX_STP_OFST_I_MSK 0xffff00ff ++#define MRX_STP_OFST_SFT 8 ++#define MRX_STP_OFST_HI 15 ++#define MRX_STP_OFST_SZ 8 ++#define DBG_FF_FULL_MSK 0x0000ffff ++#define DBG_FF_FULL_I_MSK 0xffff0000 ++#define DBG_FF_FULL_SFT 0 ++#define DBG_FF_FULL_HI 15 ++#define DBG_FF_FULL_SZ 16 ++#define DBG_FF_FULL_CLR_MSK 0x80000000 ++#define DBG_FF_FULL_CLR_I_MSK 0x7fffffff ++#define DBG_FF_FULL_CLR_SFT 31 ++#define DBG_FF_FULL_CLR_HI 31 ++#define DBG_FF_FULL_CLR_SZ 1 ++#define DBG_WFF_FULL_MSK 0x0000ffff ++#define DBG_WFF_FULL_I_MSK 0xffff0000 ++#define DBG_WFF_FULL_SFT 0 ++#define DBG_WFF_FULL_HI 15 ++#define DBG_WFF_FULL_SZ 16 ++#define DBG_WFF_FULL_CLR_MSK 0x80000000 ++#define DBG_WFF_FULL_CLR_I_MSK 0x7fffffff ++#define DBG_WFF_FULL_CLR_SFT 31 ++#define DBG_WFF_FULL_CLR_HI 31 ++#define DBG_WFF_FULL_CLR_SZ 1 ++#define DBG_MB_FULL_MSK 0x0000ffff ++#define DBG_MB_FULL_I_MSK 0xffff0000 ++#define DBG_MB_FULL_SFT 0 ++#define DBG_MB_FULL_HI 15 ++#define DBG_MB_FULL_SZ 16 ++#define DBG_MB_FULL_CLR_MSK 0x80000000 ++#define DBG_MB_FULL_CLR_I_MSK 0x7fffffff ++#define DBG_MB_FULL_CLR_SFT 31 ++#define DBG_MB_FULL_CLR_HI 31 ++#define DBG_MB_FULL_CLR_SZ 1 ++#define BA_CTRL_MSK 0x00000003 ++#define BA_CTRL_I_MSK 0xfffffffc ++#define BA_CTRL_SFT 0 ++#define BA_CTRL_HI 1 ++#define BA_CTRL_SZ 2 ++#define BA_DBG_EN_MSK 0x00000004 ++#define BA_DBG_EN_I_MSK 0xfffffffb ++#define BA_DBG_EN_SFT 2 ++#define BA_DBG_EN_HI 2 ++#define BA_DBG_EN_SZ 1 ++#define BA_AGRE_EN_MSK 0x00000008 ++#define BA_AGRE_EN_I_MSK 0xfffffff7 ++#define BA_AGRE_EN_SFT 3 ++#define BA_AGRE_EN_HI 3 ++#define BA_AGRE_EN_SZ 1 ++#define BA_TA_31_0_MSK 0xffffffff ++#define BA_TA_31_0_I_MSK 0x00000000 ++#define BA_TA_31_0_SFT 0 ++#define BA_TA_31_0_HI 31 ++#define BA_TA_31_0_SZ 32 ++#define BA_TA_47_32_MSK 0x0000ffff ++#define BA_TA_47_32_I_MSK 0xffff0000 ++#define BA_TA_47_32_SFT 0 ++#define BA_TA_47_32_HI 15 ++#define BA_TA_47_32_SZ 16 ++#define BA_TID_MSK 0x0000000f ++#define BA_TID_I_MSK 0xfffffff0 ++#define BA_TID_SFT 0 ++#define BA_TID_HI 3 ++#define BA_TID_SZ 4 ++#define BA_ST_SEQ_MSK 0x00000fff ++#define BA_ST_SEQ_I_MSK 0xfffff000 ++#define BA_ST_SEQ_SFT 0 ++#define BA_ST_SEQ_HI 11 ++#define BA_ST_SEQ_SZ 12 ++#define BA_SB0_MSK 0xffffffff ++#define BA_SB0_I_MSK 0x00000000 ++#define BA_SB0_SFT 0 ++#define BA_SB0_HI 31 ++#define BA_SB0_SZ 32 ++#define BA_SB1_MSK 0xffffffff ++#define BA_SB1_I_MSK 0x00000000 ++#define BA_SB1_SFT 0 ++#define BA_SB1_HI 31 ++#define BA_SB1_SZ 32 ++#define MRX_WD_MSK 0x0001ffff ++#define MRX_WD_I_MSK 0xfffe0000 ++#define MRX_WD_SFT 0 ++#define MRX_WD_HI 16 ++#define MRX_WD_SZ 17 ++#define ACK_GEN_EN_MSK 0x00000001 ++#define ACK_GEN_EN_I_MSK 0xfffffffe ++#define ACK_GEN_EN_SFT 0 ++#define ACK_GEN_EN_HI 0 ++#define ACK_GEN_EN_SZ 1 ++#define BA_GEN_EN_MSK 0x00000002 ++#define BA_GEN_EN_I_MSK 0xfffffffd ++#define BA_GEN_EN_SFT 1 ++#define BA_GEN_EN_HI 1 ++#define BA_GEN_EN_SZ 1 ++#define ACK_GEN_DUR_MSK 0x0000ffff ++#define ACK_GEN_DUR_I_MSK 0xffff0000 ++#define ACK_GEN_DUR_SFT 0 ++#define ACK_GEN_DUR_HI 15 ++#define ACK_GEN_DUR_SZ 16 ++#define ACK_GEN_INFO_MSK 0x003f0000 ++#define ACK_GEN_INFO_I_MSK 0xffc0ffff ++#define ACK_GEN_INFO_SFT 16 ++#define ACK_GEN_INFO_HI 21 ++#define ACK_GEN_INFO_SZ 6 ++#define ACK_GEN_RA_31_0_MSK 0xffffffff ++#define ACK_GEN_RA_31_0_I_MSK 0x00000000 ++#define ACK_GEN_RA_31_0_SFT 0 ++#define ACK_GEN_RA_31_0_HI 31 ++#define ACK_GEN_RA_31_0_SZ 32 ++#define ACK_GEN_RA_47_32_MSK 0x0000ffff ++#define ACK_GEN_RA_47_32_I_MSK 0xffff0000 ++#define ACK_GEN_RA_47_32_SFT 0 ++#define ACK_GEN_RA_47_32_HI 15 ++#define ACK_GEN_RA_47_32_SZ 16 ++#define MIB_LEN_FAIL_MSK 0x0000ffff ++#define MIB_LEN_FAIL_I_MSK 0xffff0000 ++#define MIB_LEN_FAIL_SFT 0 ++#define MIB_LEN_FAIL_HI 15 ++#define MIB_LEN_FAIL_SZ 16 ++#define TRAP_HW_ID_MSK 0x0000000f ++#define TRAP_HW_ID_I_MSK 0xfffffff0 ++#define TRAP_HW_ID_SFT 0 ++#define TRAP_HW_ID_HI 3 ++#define TRAP_HW_ID_SZ 4 ++#define ID_IN_USE_MSK 0x000000ff ++#define ID_IN_USE_I_MSK 0xffffff00 ++#define ID_IN_USE_SFT 0 ++#define ID_IN_USE_HI 7 ++#define ID_IN_USE_SZ 8 ++#define MRX_ERR_MSK 0xffffffff ++#define MRX_ERR_I_MSK 0x00000000 ++#define MRX_ERR_SFT 0 ++#define MRX_ERR_HI 31 ++#define MRX_ERR_SZ 32 ++#define W0_T0_SEQ_MSK 0x0000ffff ++#define W0_T0_SEQ_I_MSK 0xffff0000 ++#define W0_T0_SEQ_SFT 0 ++#define W0_T0_SEQ_HI 15 ++#define W0_T0_SEQ_SZ 16 ++#define W0_T1_SEQ_MSK 0x0000ffff ++#define W0_T1_SEQ_I_MSK 0xffff0000 ++#define W0_T1_SEQ_SFT 0 ++#define W0_T1_SEQ_HI 15 ++#define W0_T1_SEQ_SZ 16 ++#define W0_T2_SEQ_MSK 0x0000ffff ++#define W0_T2_SEQ_I_MSK 0xffff0000 ++#define W0_T2_SEQ_SFT 0 ++#define W0_T2_SEQ_HI 15 ++#define W0_T2_SEQ_SZ 16 ++#define W0_T3_SEQ_MSK 0x0000ffff ++#define W0_T3_SEQ_I_MSK 0xffff0000 ++#define W0_T3_SEQ_SFT 0 ++#define W0_T3_SEQ_HI 15 ++#define W0_T3_SEQ_SZ 16 ++#define W0_T4_SEQ_MSK 0x0000ffff ++#define W0_T4_SEQ_I_MSK 0xffff0000 ++#define W0_T4_SEQ_SFT 0 ++#define W0_T4_SEQ_HI 15 ++#define W0_T4_SEQ_SZ 16 ++#define W0_T5_SEQ_MSK 0x0000ffff ++#define W0_T5_SEQ_I_MSK 0xffff0000 ++#define W0_T5_SEQ_SFT 0 ++#define W0_T5_SEQ_HI 15 ++#define W0_T5_SEQ_SZ 16 ++#define W0_T6_SEQ_MSK 0x0000ffff ++#define W0_T6_SEQ_I_MSK 0xffff0000 ++#define W0_T6_SEQ_SFT 0 ++#define W0_T6_SEQ_HI 15 ++#define W0_T6_SEQ_SZ 16 ++#define W0_T7_SEQ_MSK 0x0000ffff ++#define W0_T7_SEQ_I_MSK 0xffff0000 ++#define W0_T7_SEQ_SFT 0 ++#define W0_T7_SEQ_HI 15 ++#define W0_T7_SEQ_SZ 16 ++#define W1_T0_SEQ_MSK 0x0000ffff ++#define W1_T0_SEQ_I_MSK 0xffff0000 ++#define W1_T0_SEQ_SFT 0 ++#define W1_T0_SEQ_HI 15 ++#define W1_T0_SEQ_SZ 16 ++#define W1_T1_SEQ_MSK 0x0000ffff ++#define W1_T1_SEQ_I_MSK 0xffff0000 ++#define W1_T1_SEQ_SFT 0 ++#define W1_T1_SEQ_HI 15 ++#define W1_T1_SEQ_SZ 16 ++#define W1_T2_SEQ_MSK 0x0000ffff ++#define W1_T2_SEQ_I_MSK 0xffff0000 ++#define W1_T2_SEQ_SFT 0 ++#define W1_T2_SEQ_HI 15 ++#define W1_T2_SEQ_SZ 16 ++#define W1_T3_SEQ_MSK 0x0000ffff ++#define W1_T3_SEQ_I_MSK 0xffff0000 ++#define W1_T3_SEQ_SFT 0 ++#define W1_T3_SEQ_HI 15 ++#define W1_T3_SEQ_SZ 16 ++#define W1_T4_SEQ_MSK 0x0000ffff ++#define W1_T4_SEQ_I_MSK 0xffff0000 ++#define W1_T4_SEQ_SFT 0 ++#define W1_T4_SEQ_HI 15 ++#define W1_T4_SEQ_SZ 16 ++#define W1_T5_SEQ_MSK 0x0000ffff ++#define W1_T5_SEQ_I_MSK 0xffff0000 ++#define W1_T5_SEQ_SFT 0 ++#define W1_T5_SEQ_HI 15 ++#define W1_T5_SEQ_SZ 16 ++#define W1_T6_SEQ_MSK 0x0000ffff ++#define W1_T6_SEQ_I_MSK 0xffff0000 ++#define W1_T6_SEQ_SFT 0 ++#define W1_T6_SEQ_HI 15 ++#define W1_T6_SEQ_SZ 16 ++#define W1_T7_SEQ_MSK 0x0000ffff ++#define W1_T7_SEQ_I_MSK 0xffff0000 ++#define W1_T7_SEQ_SFT 0 ++#define W1_T7_SEQ_HI 15 ++#define W1_T7_SEQ_SZ 16 ++#define ADDR1A_SEL_MSK 0x00000003 ++#define ADDR1A_SEL_I_MSK 0xfffffffc ++#define ADDR1A_SEL_SFT 0 ++#define ADDR1A_SEL_HI 1 ++#define ADDR1A_SEL_SZ 2 ++#define ADDR2A_SEL_MSK 0x0000000c ++#define ADDR2A_SEL_I_MSK 0xfffffff3 ++#define ADDR2A_SEL_SFT 2 ++#define ADDR2A_SEL_HI 3 ++#define ADDR2A_SEL_SZ 2 ++#define ADDR3A_SEL_MSK 0x00000030 ++#define ADDR3A_SEL_I_MSK 0xffffffcf ++#define ADDR3A_SEL_SFT 4 ++#define ADDR3A_SEL_HI 5 ++#define ADDR3A_SEL_SZ 2 ++#define ADDR1B_SEL_MSK 0x000000c0 ++#define ADDR1B_SEL_I_MSK 0xffffff3f ++#define ADDR1B_SEL_SFT 6 ++#define ADDR1B_SEL_HI 7 ++#define ADDR1B_SEL_SZ 2 ++#define ADDR2B_SEL_MSK 0x00000300 ++#define ADDR2B_SEL_I_MSK 0xfffffcff ++#define ADDR2B_SEL_SFT 8 ++#define ADDR2B_SEL_HI 9 ++#define ADDR2B_SEL_SZ 2 ++#define ADDR3B_SEL_MSK 0x00000c00 ++#define ADDR3B_SEL_I_MSK 0xfffff3ff ++#define ADDR3B_SEL_SFT 10 ++#define ADDR3B_SEL_HI 11 ++#define ADDR3B_SEL_SZ 2 ++#define ADDR3C_SEL_MSK 0x00003000 ++#define ADDR3C_SEL_I_MSK 0xffffcfff ++#define ADDR3C_SEL_SFT 12 ++#define ADDR3C_SEL_HI 13 ++#define ADDR3C_SEL_SZ 2 ++#define FRM_CTRL_MSK 0x0000003f ++#define FRM_CTRL_I_MSK 0xffffffc0 ++#define FRM_CTRL_SFT 0 ++#define FRM_CTRL_HI 5 ++#define FRM_CTRL_SZ 6 ++#define CSR_PHY_INFO_MSK 0x00007fff ++#define CSR_PHY_INFO_I_MSK 0xffff8000 ++#define CSR_PHY_INFO_SFT 0 ++#define CSR_PHY_INFO_HI 14 ++#define CSR_PHY_INFO_SZ 15 ++#define AMPDU_SIG_MSK 0x000000ff ++#define AMPDU_SIG_I_MSK 0xffffff00 ++#define AMPDU_SIG_SFT 0 ++#define AMPDU_SIG_HI 7 ++#define AMPDU_SIG_SZ 8 ++#define MIB_AMPDU_MSK 0xffffffff ++#define MIB_AMPDU_I_MSK 0x00000000 ++#define MIB_AMPDU_SFT 0 ++#define MIB_AMPDU_HI 31 ++#define MIB_AMPDU_SZ 32 ++#define LEN_FLT_MSK 0x0000ffff ++#define LEN_FLT_I_MSK 0xffff0000 ++#define LEN_FLT_SFT 0 ++#define LEN_FLT_HI 15 ++#define LEN_FLT_SZ 16 ++#define MIB_DELIMITER_MSK 0x0000ffff ++#define MIB_DELIMITER_I_MSK 0xffff0000 ++#define MIB_DELIMITER_SFT 0 ++#define MIB_DELIMITER_HI 15 ++#define MIB_DELIMITER_SZ 16 ++#define MTX_INT_Q0_Q_EMPTY_MSK 0x00010000 ++#define MTX_INT_Q0_Q_EMPTY_I_MSK 0xfffeffff ++#define MTX_INT_Q0_Q_EMPTY_SFT 16 ++#define MTX_INT_Q0_Q_EMPTY_HI 16 ++#define MTX_INT_Q0_Q_EMPTY_SZ 1 ++#define MTX_INT_Q0_TXOP_RUNOUT_MSK 0x00020000 ++#define MTX_INT_Q0_TXOP_RUNOUT_I_MSK 0xfffdffff ++#define MTX_INT_Q0_TXOP_RUNOUT_SFT 17 ++#define MTX_INT_Q0_TXOP_RUNOUT_HI 17 ++#define MTX_INT_Q0_TXOP_RUNOUT_SZ 1 ++#define MTX_INT_Q1_Q_EMPTY_MSK 0x00040000 ++#define MTX_INT_Q1_Q_EMPTY_I_MSK 0xfffbffff ++#define MTX_INT_Q1_Q_EMPTY_SFT 18 ++#define MTX_INT_Q1_Q_EMPTY_HI 18 ++#define MTX_INT_Q1_Q_EMPTY_SZ 1 ++#define MTX_INT_Q1_TXOP_RUNOUT_MSK 0x00080000 ++#define MTX_INT_Q1_TXOP_RUNOUT_I_MSK 0xfff7ffff ++#define MTX_INT_Q1_TXOP_RUNOUT_SFT 19 ++#define MTX_INT_Q1_TXOP_RUNOUT_HI 19 ++#define MTX_INT_Q1_TXOP_RUNOUT_SZ 1 ++#define MTX_INT_Q2_Q_EMPTY_MSK 0x00100000 ++#define MTX_INT_Q2_Q_EMPTY_I_MSK 0xffefffff ++#define MTX_INT_Q2_Q_EMPTY_SFT 20 ++#define MTX_INT_Q2_Q_EMPTY_HI 20 ++#define MTX_INT_Q2_Q_EMPTY_SZ 1 ++#define MTX_INT_Q2_TXOP_RUNOUT_MSK 0x00200000 ++#define MTX_INT_Q2_TXOP_RUNOUT_I_MSK 0xffdfffff ++#define MTX_INT_Q2_TXOP_RUNOUT_SFT 21 ++#define MTX_INT_Q2_TXOP_RUNOUT_HI 21 ++#define MTX_INT_Q2_TXOP_RUNOUT_SZ 1 ++#define MTX_INT_Q3_Q_EMPTY_MSK 0x00400000 ++#define MTX_INT_Q3_Q_EMPTY_I_MSK 0xffbfffff ++#define MTX_INT_Q3_Q_EMPTY_SFT 22 ++#define MTX_INT_Q3_Q_EMPTY_HI 22 ++#define MTX_INT_Q3_Q_EMPTY_SZ 1 ++#define MTX_INT_Q3_TXOP_RUNOUT_MSK 0x00800000 ++#define MTX_INT_Q3_TXOP_RUNOUT_I_MSK 0xff7fffff ++#define MTX_INT_Q3_TXOP_RUNOUT_SFT 23 ++#define MTX_INT_Q3_TXOP_RUNOUT_HI 23 ++#define MTX_INT_Q3_TXOP_RUNOUT_SZ 1 ++#define MTX_INT_Q4_Q_EMPTY_MSK 0x01000000 ++#define MTX_INT_Q4_Q_EMPTY_I_MSK 0xfeffffff ++#define MTX_INT_Q4_Q_EMPTY_SFT 24 ++#define MTX_INT_Q4_Q_EMPTY_HI 24 ++#define MTX_INT_Q4_Q_EMPTY_SZ 1 ++#define MTX_INT_Q4_TXOP_RUNOUT_MSK 0x02000000 ++#define MTX_INT_Q4_TXOP_RUNOUT_I_MSK 0xfdffffff ++#define MTX_INT_Q4_TXOP_RUNOUT_SFT 25 ++#define MTX_INT_Q4_TXOP_RUNOUT_HI 25 ++#define MTX_INT_Q4_TXOP_RUNOUT_SZ 1 ++#define MTX_EN_INT_Q0_Q_EMPTY_MSK 0x00010000 ++#define MTX_EN_INT_Q0_Q_EMPTY_I_MSK 0xfffeffff ++#define MTX_EN_INT_Q0_Q_EMPTY_SFT 16 ++#define MTX_EN_INT_Q0_Q_EMPTY_HI 16 ++#define MTX_EN_INT_Q0_Q_EMPTY_SZ 1 ++#define MTX_EN_INT_Q0_TXOP_RUNOUT_MSK 0x00020000 ++#define MTX_EN_INT_Q0_TXOP_RUNOUT_I_MSK 0xfffdffff ++#define MTX_EN_INT_Q0_TXOP_RUNOUT_SFT 17 ++#define MTX_EN_INT_Q0_TXOP_RUNOUT_HI 17 ++#define MTX_EN_INT_Q0_TXOP_RUNOUT_SZ 1 ++#define MTX_EN_INT_Q1_Q_EMPTY_MSK 0x00040000 ++#define MTX_EN_INT_Q1_Q_EMPTY_I_MSK 0xfffbffff ++#define MTX_EN_INT_Q1_Q_EMPTY_SFT 18 ++#define MTX_EN_INT_Q1_Q_EMPTY_HI 18 ++#define MTX_EN_INT_Q1_Q_EMPTY_SZ 1 ++#define MTX_EN_INT_Q1_TXOP_RUNOUT_MSK 0x00080000 ++#define MTX_EN_INT_Q1_TXOP_RUNOUT_I_MSK 0xfff7ffff ++#define MTX_EN_INT_Q1_TXOP_RUNOUT_SFT 19 ++#define MTX_EN_INT_Q1_TXOP_RUNOUT_HI 19 ++#define MTX_EN_INT_Q1_TXOP_RUNOUT_SZ 1 ++#define MTX_EN_INT_Q2_Q_EMPTY_MSK 0x00100000 ++#define MTX_EN_INT_Q2_Q_EMPTY_I_MSK 0xffefffff ++#define MTX_EN_INT_Q2_Q_EMPTY_SFT 20 ++#define MTX_EN_INT_Q2_Q_EMPTY_HI 20 ++#define MTX_EN_INT_Q2_Q_EMPTY_SZ 1 ++#define MTX_EN_INT_Q2_TXOP_RUNOUT_MSK 0x00200000 ++#define MTX_EN_INT_Q2_TXOP_RUNOUT_I_MSK 0xffdfffff ++#define MTX_EN_INT_Q2_TXOP_RUNOUT_SFT 21 ++#define MTX_EN_INT_Q2_TXOP_RUNOUT_HI 21 ++#define MTX_EN_INT_Q2_TXOP_RUNOUT_SZ 1 ++#define MTX_EN_INT_Q3_Q_EMPTY_MSK 0x00400000 ++#define MTX_EN_INT_Q3_Q_EMPTY_I_MSK 0xffbfffff ++#define MTX_EN_INT_Q3_Q_EMPTY_SFT 22 ++#define MTX_EN_INT_Q3_Q_EMPTY_HI 22 ++#define MTX_EN_INT_Q3_Q_EMPTY_SZ 1 ++#define MTX_EN_INT_Q3_TXOP_RUNOUT_MSK 0x00800000 ++#define MTX_EN_INT_Q3_TXOP_RUNOUT_I_MSK 0xff7fffff ++#define MTX_EN_INT_Q3_TXOP_RUNOUT_SFT 23 ++#define MTX_EN_INT_Q3_TXOP_RUNOUT_HI 23 ++#define MTX_EN_INT_Q3_TXOP_RUNOUT_SZ 1 ++#define MTX_EN_INT_Q4_Q_EMPTY_MSK 0x01000000 ++#define MTX_EN_INT_Q4_Q_EMPTY_I_MSK 0xfeffffff ++#define MTX_EN_INT_Q4_Q_EMPTY_SFT 24 ++#define MTX_EN_INT_Q4_Q_EMPTY_HI 24 ++#define MTX_EN_INT_Q4_Q_EMPTY_SZ 1 ++#define MTX_EN_INT_Q4_TXOP_RUNOUT_MSK 0x02000000 ++#define MTX_EN_INT_Q4_TXOP_RUNOUT_I_MSK 0xfdffffff ++#define MTX_EN_INT_Q4_TXOP_RUNOUT_SFT 25 ++#define MTX_EN_INT_Q4_TXOP_RUNOUT_HI 25 ++#define MTX_EN_INT_Q4_TXOP_RUNOUT_SZ 1 ++#define MTX_MTX2PHY_SLOW_MSK 0x00000001 ++#define MTX_MTX2PHY_SLOW_I_MSK 0xfffffffe ++#define MTX_MTX2PHY_SLOW_SFT 0 ++#define MTX_MTX2PHY_SLOW_HI 0 ++#define MTX_MTX2PHY_SLOW_SZ 1 ++#define MTX_M2M_SLOW_PRD_MSK 0x0000000e ++#define MTX_M2M_SLOW_PRD_I_MSK 0xfffffff1 ++#define MTX_M2M_SLOW_PRD_SFT 1 ++#define MTX_M2M_SLOW_PRD_HI 3 ++#define MTX_M2M_SLOW_PRD_SZ 3 ++#define MTX_AMPDU_CRC_AUTO_MSK 0x00000020 ++#define MTX_AMPDU_CRC_AUTO_I_MSK 0xffffffdf ++#define MTX_AMPDU_CRC_AUTO_SFT 5 ++#define MTX_AMPDU_CRC_AUTO_HI 5 ++#define MTX_AMPDU_CRC_AUTO_SZ 1 ++#define MTX_FAST_RSP_MODE_MSK 0x00000040 ++#define MTX_FAST_RSP_MODE_I_MSK 0xffffffbf ++#define MTX_FAST_RSP_MODE_SFT 6 ++#define MTX_FAST_RSP_MODE_HI 6 ++#define MTX_FAST_RSP_MODE_SZ 1 ++#define MTX_RAW_DATA_MODE_MSK 0x00000080 ++#define MTX_RAW_DATA_MODE_I_MSK 0xffffff7f ++#define MTX_RAW_DATA_MODE_SFT 7 ++#define MTX_RAW_DATA_MODE_HI 7 ++#define MTX_RAW_DATA_MODE_SZ 1 ++#define MTX_ACK_DUR0_MSK 0x00000100 ++#define MTX_ACK_DUR0_I_MSK 0xfffffeff ++#define MTX_ACK_DUR0_SFT 8 ++#define MTX_ACK_DUR0_HI 8 ++#define MTX_ACK_DUR0_SZ 1 ++#define MTX_TSF_AUTO_BCN_MSK 0x00000400 ++#define MTX_TSF_AUTO_BCN_I_MSK 0xfffffbff ++#define MTX_TSF_AUTO_BCN_SFT 10 ++#define MTX_TSF_AUTO_BCN_HI 10 ++#define MTX_TSF_AUTO_BCN_SZ 1 ++#define MTX_TSF_AUTO_MISC_MSK 0x00000800 ++#define MTX_TSF_AUTO_MISC_I_MSK 0xfffff7ff ++#define MTX_TSF_AUTO_MISC_SFT 11 ++#define MTX_TSF_AUTO_MISC_HI 11 ++#define MTX_TSF_AUTO_MISC_SZ 1 ++#define MTX_FORCE_CS_IDLE_MSK 0x00001000 ++#define MTX_FORCE_CS_IDLE_I_MSK 0xffffefff ++#define MTX_FORCE_CS_IDLE_SFT 12 ++#define MTX_FORCE_CS_IDLE_HI 12 ++#define MTX_FORCE_CS_IDLE_SZ 1 ++#define MTX_FORCE_BKF_RXEN0_MSK 0x00002000 ++#define MTX_FORCE_BKF_RXEN0_I_MSK 0xffffdfff ++#define MTX_FORCE_BKF_RXEN0_SFT 13 ++#define MTX_FORCE_BKF_RXEN0_HI 13 ++#define MTX_FORCE_BKF_RXEN0_SZ 1 ++#define MTX_FORCE_DMA_RXEN0_MSK 0x00004000 ++#define MTX_FORCE_DMA_RXEN0_I_MSK 0xffffbfff ++#define MTX_FORCE_DMA_RXEN0_SFT 14 ++#define MTX_FORCE_DMA_RXEN0_HI 14 ++#define MTX_FORCE_DMA_RXEN0_SZ 1 ++#define MTX_FORCE_RXEN0_MSK 0x00008000 ++#define MTX_FORCE_RXEN0_I_MSK 0xffff7fff ++#define MTX_FORCE_RXEN0_SFT 15 ++#define MTX_FORCE_RXEN0_HI 15 ++#define MTX_FORCE_RXEN0_SZ 1 ++#define MTX_HALT_Q_MB_MSK 0x003f0000 ++#define MTX_HALT_Q_MB_I_MSK 0xffc0ffff ++#define MTX_HALT_Q_MB_SFT 16 ++#define MTX_HALT_Q_MB_HI 21 ++#define MTX_HALT_Q_MB_SZ 6 ++#define MTX_CTS_SET_DIF_MSK 0x00400000 ++#define MTX_CTS_SET_DIF_I_MSK 0xffbfffff ++#define MTX_CTS_SET_DIF_SFT 22 ++#define MTX_CTS_SET_DIF_HI 22 ++#define MTX_CTS_SET_DIF_SZ 1 ++#define MTX_AMPDU_SET_DIF_MSK 0x00800000 ++#define MTX_AMPDU_SET_DIF_I_MSK 0xff7fffff ++#define MTX_AMPDU_SET_DIF_SFT 23 ++#define MTX_AMPDU_SET_DIF_HI 23 ++#define MTX_AMPDU_SET_DIF_SZ 1 ++#define MTX_EDCCA_TOUT_MSK 0x000003ff ++#define MTX_EDCCA_TOUT_I_MSK 0xfffffc00 ++#define MTX_EDCCA_TOUT_SFT 0 ++#define MTX_EDCCA_TOUT_HI 9 ++#define MTX_EDCCA_TOUT_SZ 10 ++#define MTX_INT_BCN_MSK 0x00000002 ++#define MTX_INT_BCN_I_MSK 0xfffffffd ++#define MTX_INT_BCN_SFT 1 ++#define MTX_INT_BCN_HI 1 ++#define MTX_INT_BCN_SZ 1 ++#define MTX_INT_DTIM_MSK 0x00000008 ++#define MTX_INT_DTIM_I_MSK 0xfffffff7 ++#define MTX_INT_DTIM_SFT 3 ++#define MTX_INT_DTIM_HI 3 ++#define MTX_INT_DTIM_SZ 1 ++#define MTX_EN_INT_BCN_MSK 0x00000002 ++#define MTX_EN_INT_BCN_I_MSK 0xfffffffd ++#define MTX_EN_INT_BCN_SFT 1 ++#define MTX_EN_INT_BCN_HI 1 ++#define MTX_EN_INT_BCN_SZ 1 ++#define MTX_EN_INT_DTIM_MSK 0x00000008 ++#define MTX_EN_INT_DTIM_I_MSK 0xfffffff7 ++#define MTX_EN_INT_DTIM_SFT 3 ++#define MTX_EN_INT_DTIM_HI 3 ++#define MTX_EN_INT_DTIM_SZ 1 ++#define MTX_BCN_TIMER_EN_MSK 0x00000001 ++#define MTX_BCN_TIMER_EN_I_MSK 0xfffffffe ++#define MTX_BCN_TIMER_EN_SFT 0 ++#define MTX_BCN_TIMER_EN_HI 0 ++#define MTX_BCN_TIMER_EN_SZ 1 ++#define MTX_TIME_STAMP_AUTO_FILL_MSK 0x00000002 ++#define MTX_TIME_STAMP_AUTO_FILL_I_MSK 0xfffffffd ++#define MTX_TIME_STAMP_AUTO_FILL_SFT 1 ++#define MTX_TIME_STAMP_AUTO_FILL_HI 1 ++#define MTX_TIME_STAMP_AUTO_FILL_SZ 1 ++#define MTX_TSF_TIMER_EN_MSK 0x00000020 ++#define MTX_TSF_TIMER_EN_I_MSK 0xffffffdf ++#define MTX_TSF_TIMER_EN_SFT 5 ++#define MTX_TSF_TIMER_EN_HI 5 ++#define MTX_TSF_TIMER_EN_SZ 1 ++#define MTX_HALT_MNG_UNTIL_DTIM_MSK 0x00000040 ++#define MTX_HALT_MNG_UNTIL_DTIM_I_MSK 0xffffffbf ++#define MTX_HALT_MNG_UNTIL_DTIM_SFT 6 ++#define MTX_HALT_MNG_UNTIL_DTIM_HI 6 ++#define MTX_HALT_MNG_UNTIL_DTIM_SZ 1 ++#define MTX_INT_DTIM_NUM_MSK 0x0000ff00 ++#define MTX_INT_DTIM_NUM_I_MSK 0xffff00ff ++#define MTX_INT_DTIM_NUM_SFT 8 ++#define MTX_INT_DTIM_NUM_HI 15 ++#define MTX_INT_DTIM_NUM_SZ 8 ++#define MTX_AUTO_FLUSH_Q4_MSK 0x00010000 ++#define MTX_AUTO_FLUSH_Q4_I_MSK 0xfffeffff ++#define MTX_AUTO_FLUSH_Q4_SFT 16 ++#define MTX_AUTO_FLUSH_Q4_HI 16 ++#define MTX_AUTO_FLUSH_Q4_SZ 1 ++#define MTX_BCN_PKTID_CH_LOCK_MSK 0x00000001 ++#define MTX_BCN_PKTID_CH_LOCK_I_MSK 0xfffffffe ++#define MTX_BCN_PKTID_CH_LOCK_SFT 0 ++#define MTX_BCN_PKTID_CH_LOCK_HI 0 ++#define MTX_BCN_PKTID_CH_LOCK_SZ 1 ++#define MTX_BCN_CFG_VLD_MSK 0x00000006 ++#define MTX_BCN_CFG_VLD_I_MSK 0xfffffff9 ++#define MTX_BCN_CFG_VLD_SFT 1 ++#define MTX_BCN_CFG_VLD_HI 2 ++#define MTX_BCN_CFG_VLD_SZ 2 ++#define MTX_AUTO_BCN_ONGOING_MSK 0x00000008 ++#define MTX_AUTO_BCN_ONGOING_I_MSK 0xfffffff7 ++#define MTX_AUTO_BCN_ONGOING_SFT 3 ++#define MTX_AUTO_BCN_ONGOING_HI 3 ++#define MTX_AUTO_BCN_ONGOING_SZ 1 ++#define MTX_BCN_TIMER_MSK 0xffff0000 ++#define MTX_BCN_TIMER_I_MSK 0x0000ffff ++#define MTX_BCN_TIMER_SFT 16 ++#define MTX_BCN_TIMER_HI 31 ++#define MTX_BCN_TIMER_SZ 16 ++#define MTX_BCN_PERIOD_MSK 0x0000ffff ++#define MTX_BCN_PERIOD_I_MSK 0xffff0000 ++#define MTX_BCN_PERIOD_SFT 0 ++#define MTX_BCN_PERIOD_HI 15 ++#define MTX_BCN_PERIOD_SZ 16 ++#define MTX_DTIM_NUM_MSK 0xff000000 ++#define MTX_DTIM_NUM_I_MSK 0x00ffffff ++#define MTX_DTIM_NUM_SFT 24 ++#define MTX_DTIM_NUM_HI 31 ++#define MTX_DTIM_NUM_SZ 8 ++#define MTX_BCN_TSF_L_MSK 0xffffffff ++#define MTX_BCN_TSF_L_I_MSK 0x00000000 ++#define MTX_BCN_TSF_L_SFT 0 ++#define MTX_BCN_TSF_L_HI 31 ++#define MTX_BCN_TSF_L_SZ 32 ++#define MTX_BCN_TSF_U_MSK 0xffffffff ++#define MTX_BCN_TSF_U_I_MSK 0x00000000 ++#define MTX_BCN_TSF_U_SFT 0 ++#define MTX_BCN_TSF_U_HI 31 ++#define MTX_BCN_TSF_U_SZ 32 ++#define MTX_BCN_PKT_ID0_MSK 0x0000007f ++#define MTX_BCN_PKT_ID0_I_MSK 0xffffff80 ++#define MTX_BCN_PKT_ID0_SFT 0 ++#define MTX_BCN_PKT_ID0_HI 6 ++#define MTX_BCN_PKT_ID0_SZ 7 ++#define MTX_DTIM_OFST0_MSK 0x03ff0000 ++#define MTX_DTIM_OFST0_I_MSK 0xfc00ffff ++#define MTX_DTIM_OFST0_SFT 16 ++#define MTX_DTIM_OFST0_HI 25 ++#define MTX_DTIM_OFST0_SZ 10 ++#define MTX_BCN_PKT_ID1_MSK 0x0000007f ++#define MTX_BCN_PKT_ID1_I_MSK 0xffffff80 ++#define MTX_BCN_PKT_ID1_SFT 0 ++#define MTX_BCN_PKT_ID1_HI 6 ++#define MTX_BCN_PKT_ID1_SZ 7 ++#define MTX_DTIM_OFST1_MSK 0x03ff0000 ++#define MTX_DTIM_OFST1_I_MSK 0xfc00ffff ++#define MTX_DTIM_OFST1_SFT 16 ++#define MTX_DTIM_OFST1_HI 25 ++#define MTX_DTIM_OFST1_SZ 10 ++#define MTX_CCA_MSK 0x00000001 ++#define MTX_CCA_I_MSK 0xfffffffe ++#define MTX_CCA_SFT 0 ++#define MTX_CCA_HI 0 ++#define MTX_CCA_SZ 1 ++#define MRX_CCA_MSK 0x00000002 ++#define MRX_CCA_I_MSK 0xfffffffd ++#define MRX_CCA_SFT 1 ++#define MRX_CCA_HI 1 ++#define MRX_CCA_SZ 1 ++#define MTX_DMA_FSM_MSK 0x0000001c ++#define MTX_DMA_FSM_I_MSK 0xffffffe3 ++#define MTX_DMA_FSM_SFT 2 ++#define MTX_DMA_FSM_HI 4 ++#define MTX_DMA_FSM_SZ 3 ++#define CH_ST_FSM_MSK 0x000000e0 ++#define CH_ST_FSM_I_MSK 0xffffff1f ++#define CH_ST_FSM_SFT 5 ++#define CH_ST_FSM_HI 7 ++#define CH_ST_FSM_SZ 3 ++#define MTX_GNT_LOCK_MSK 0x00000100 ++#define MTX_GNT_LOCK_I_MSK 0xfffffeff ++#define MTX_GNT_LOCK_SFT 8 ++#define MTX_GNT_LOCK_HI 8 ++#define MTX_GNT_LOCK_SZ 1 ++#define MTX_DMA_REQ_MSK 0x00000200 ++#define MTX_DMA_REQ_I_MSK 0xfffffdff ++#define MTX_DMA_REQ_SFT 9 ++#define MTX_DMA_REQ_HI 9 ++#define MTX_DMA_REQ_SZ 1 ++#define MTX_Q_REQ_MSK 0x00000400 ++#define MTX_Q_REQ_I_MSK 0xfffffbff ++#define MTX_Q_REQ_SFT 10 ++#define MTX_Q_REQ_HI 10 ++#define MTX_Q_REQ_SZ 1 ++#define MTX_TX_EN_MSK 0x00000800 ++#define MTX_TX_EN_I_MSK 0xfffff7ff ++#define MTX_TX_EN_SFT 11 ++#define MTX_TX_EN_HI 11 ++#define MTX_TX_EN_SZ 1 ++#define MRX_RX_EN_MSK 0x00001000 ++#define MRX_RX_EN_I_MSK 0xffffefff ++#define MRX_RX_EN_SFT 12 ++#define MRX_RX_EN_HI 12 ++#define MRX_RX_EN_SZ 1 ++#define DBG_PRTC_PRD_MSK 0x00002000 ++#define DBG_PRTC_PRD_I_MSK 0xffffdfff ++#define DBG_PRTC_PRD_SFT 13 ++#define DBG_PRTC_PRD_HI 13 ++#define DBG_PRTC_PRD_SZ 1 ++#define DBG_DMA_RDY_MSK 0x00004000 ++#define DBG_DMA_RDY_I_MSK 0xffffbfff ++#define DBG_DMA_RDY_SFT 14 ++#define DBG_DMA_RDY_HI 14 ++#define DBG_DMA_RDY_SZ 1 ++#define DBG_WAIT_RSP_MSK 0x00008000 ++#define DBG_WAIT_RSP_I_MSK 0xffff7fff ++#define DBG_WAIT_RSP_SFT 15 ++#define DBG_WAIT_RSP_HI 15 ++#define DBG_WAIT_RSP_SZ 1 ++#define DBG_CFRM_BUSY_MSK 0x00010000 ++#define DBG_CFRM_BUSY_I_MSK 0xfffeffff ++#define DBG_CFRM_BUSY_SFT 16 ++#define DBG_CFRM_BUSY_HI 16 ++#define DBG_CFRM_BUSY_SZ 1 ++#define DBG_RST_MSK 0x00000001 ++#define DBG_RST_I_MSK 0xfffffffe ++#define DBG_RST_SFT 0 ++#define DBG_RST_HI 0 ++#define DBG_RST_SZ 1 ++#define DBG_MODE_MSK 0x00000002 ++#define DBG_MODE_I_MSK 0xfffffffd ++#define DBG_MODE_SFT 1 ++#define DBG_MODE_HI 1 ++#define DBG_MODE_SZ 1 ++#define MB_REQ_DUR_MSK 0x0000ffff ++#define MB_REQ_DUR_I_MSK 0xffff0000 ++#define MB_REQ_DUR_SFT 0 ++#define MB_REQ_DUR_HI 15 ++#define MB_REQ_DUR_SZ 16 ++#define RX_EN_DUR_MSK 0xffff0000 ++#define RX_EN_DUR_I_MSK 0x0000ffff ++#define RX_EN_DUR_SFT 16 ++#define RX_EN_DUR_HI 31 ++#define RX_EN_DUR_SZ 16 ++#define RX_CS_DUR_MSK 0x0000ffff ++#define RX_CS_DUR_I_MSK 0xffff0000 ++#define RX_CS_DUR_SFT 0 ++#define RX_CS_DUR_HI 15 ++#define RX_CS_DUR_SZ 16 ++#define TX_CCA_DUR_MSK 0xffff0000 ++#define TX_CCA_DUR_I_MSK 0x0000ffff ++#define TX_CCA_DUR_SFT 16 ++#define TX_CCA_DUR_HI 31 ++#define TX_CCA_DUR_SZ 16 ++#define Q_REQ_DUR_MSK 0x0000ffff ++#define Q_REQ_DUR_I_MSK 0xffff0000 ++#define Q_REQ_DUR_SFT 0 ++#define Q_REQ_DUR_HI 15 ++#define Q_REQ_DUR_SZ 16 ++#define CH_STA0_DUR_MSK 0xffff0000 ++#define CH_STA0_DUR_I_MSK 0x0000ffff ++#define CH_STA0_DUR_SFT 16 ++#define CH_STA0_DUR_HI 31 ++#define CH_STA0_DUR_SZ 16 ++#define MTX_DUR_RSP_TOUT_B_MSK 0x000000ff ++#define MTX_DUR_RSP_TOUT_B_I_MSK 0xffffff00 ++#define MTX_DUR_RSP_TOUT_B_SFT 0 ++#define MTX_DUR_RSP_TOUT_B_HI 7 ++#define MTX_DUR_RSP_TOUT_B_SZ 8 ++#define MTX_DUR_RSP_TOUT_G_MSK 0x0000ff00 ++#define MTX_DUR_RSP_TOUT_G_I_MSK 0xffff00ff ++#define MTX_DUR_RSP_TOUT_G_SFT 8 ++#define MTX_DUR_RSP_TOUT_G_HI 15 ++#define MTX_DUR_RSP_TOUT_G_SZ 8 ++#define MTX_DUR_RSP_SIFS_MSK 0x000000ff ++#define MTX_DUR_RSP_SIFS_I_MSK 0xffffff00 ++#define MTX_DUR_RSP_SIFS_SFT 0 ++#define MTX_DUR_RSP_SIFS_HI 7 ++#define MTX_DUR_RSP_SIFS_SZ 8 ++#define MTX_DUR_BURST_SIFS_MSK 0x0000ff00 ++#define MTX_DUR_BURST_SIFS_I_MSK 0xffff00ff ++#define MTX_DUR_BURST_SIFS_SFT 8 ++#define MTX_DUR_BURST_SIFS_HI 15 ++#define MTX_DUR_BURST_SIFS_SZ 8 ++#define MTX_DUR_SLOT_MSK 0x003f0000 ++#define MTX_DUR_SLOT_I_MSK 0xffc0ffff ++#define MTX_DUR_SLOT_SFT 16 ++#define MTX_DUR_SLOT_HI 21 ++#define MTX_DUR_SLOT_SZ 6 ++#define MTX_DUR_RSP_EIFS_MSK 0xffc00000 ++#define MTX_DUR_RSP_EIFS_I_MSK 0x003fffff ++#define MTX_DUR_RSP_EIFS_SFT 22 ++#define MTX_DUR_RSP_EIFS_HI 31 ++#define MTX_DUR_RSP_EIFS_SZ 10 ++#define MTX_DUR_RSP_SIFS_G_MSK 0x000000ff ++#define MTX_DUR_RSP_SIFS_G_I_MSK 0xffffff00 ++#define MTX_DUR_RSP_SIFS_G_SFT 0 ++#define MTX_DUR_RSP_SIFS_G_HI 7 ++#define MTX_DUR_RSP_SIFS_G_SZ 8 ++#define MTX_DUR_BURST_SIFS_G_MSK 0x0000ff00 ++#define MTX_DUR_BURST_SIFS_G_I_MSK 0xffff00ff ++#define MTX_DUR_BURST_SIFS_G_SFT 8 ++#define MTX_DUR_BURST_SIFS_G_HI 15 ++#define MTX_DUR_BURST_SIFS_G_SZ 8 ++#define MTX_DUR_SLOT_G_MSK 0x003f0000 ++#define MTX_DUR_SLOT_G_I_MSK 0xffc0ffff ++#define MTX_DUR_SLOT_G_SFT 16 ++#define MTX_DUR_SLOT_G_HI 21 ++#define MTX_DUR_SLOT_G_SZ 6 ++#define MTX_DUR_RSP_EIFS_G_MSK 0xffc00000 ++#define MTX_DUR_RSP_EIFS_G_I_MSK 0x003fffff ++#define MTX_DUR_RSP_EIFS_G_SFT 22 ++#define MTX_DUR_RSP_EIFS_G_HI 31 ++#define MTX_DUR_RSP_EIFS_G_SZ 10 ++#define CH_STA1_DUR_MSK 0x0000ffff ++#define CH_STA1_DUR_I_MSK 0xffff0000 ++#define CH_STA1_DUR_SFT 0 ++#define CH_STA1_DUR_HI 15 ++#define CH_STA1_DUR_SZ 16 ++#define CH_STA2_DUR_MSK 0xffff0000 ++#define CH_STA2_DUR_I_MSK 0x0000ffff ++#define CH_STA2_DUR_SFT 16 ++#define CH_STA2_DUR_HI 31 ++#define CH_STA2_DUR_SZ 16 ++#define MTX_NAV_MSK 0x0000ffff ++#define MTX_NAV_I_MSK 0xffff0000 ++#define MTX_NAV_SFT 0 ++#define MTX_NAV_HI 15 ++#define MTX_NAV_SZ 16 ++#define MTX_MIB_CNT0_MSK 0x3fffffff ++#define MTX_MIB_CNT0_I_MSK 0xc0000000 ++#define MTX_MIB_CNT0_SFT 0 ++#define MTX_MIB_CNT0_HI 29 ++#define MTX_MIB_CNT0_SZ 30 ++#define MTX_MIB_EN0_MSK 0x40000000 ++#define MTX_MIB_EN0_I_MSK 0xbfffffff ++#define MTX_MIB_EN0_SFT 30 ++#define MTX_MIB_EN0_HI 30 ++#define MTX_MIB_EN0_SZ 1 ++#define MTX_MIB_CNT1_MSK 0x3fffffff ++#define MTX_MIB_CNT1_I_MSK 0xc0000000 ++#define MTX_MIB_CNT1_SFT 0 ++#define MTX_MIB_CNT1_HI 29 ++#define MTX_MIB_CNT1_SZ 30 ++#define MTX_MIB_EN1_MSK 0x40000000 ++#define MTX_MIB_EN1_I_MSK 0xbfffffff ++#define MTX_MIB_EN1_SFT 30 ++#define MTX_MIB_EN1_HI 30 ++#define MTX_MIB_EN1_SZ 1 ++#define CH_STA3_DUR_MSK 0x0000ffff ++#define CH_STA3_DUR_I_MSK 0xffff0000 ++#define CH_STA3_DUR_SFT 0 ++#define CH_STA3_DUR_HI 15 ++#define CH_STA3_DUR_SZ 16 ++#define CH_STA4_DUR_MSK 0xffff0000 ++#define CH_STA4_DUR_I_MSK 0x0000ffff ++#define CH_STA4_DUR_SFT 16 ++#define CH_STA4_DUR_HI 31 ++#define CH_STA4_DUR_SZ 16 ++#define TXQ0_MTX_Q_PRE_LD_MSK 0x00000002 ++#define TXQ0_MTX_Q_PRE_LD_I_MSK 0xfffffffd ++#define TXQ0_MTX_Q_PRE_LD_SFT 1 ++#define TXQ0_MTX_Q_PRE_LD_HI 1 ++#define TXQ0_MTX_Q_PRE_LD_SZ 1 ++#define TXQ0_MTX_Q_BKF_CNT_FIXED_MSK 0x00000004 ++#define TXQ0_MTX_Q_BKF_CNT_FIXED_I_MSK 0xfffffffb ++#define TXQ0_MTX_Q_BKF_CNT_FIXED_SFT 2 ++#define TXQ0_MTX_Q_BKF_CNT_FIXED_HI 2 ++#define TXQ0_MTX_Q_BKF_CNT_FIXED_SZ 1 ++#define TXQ0_MTX_Q_TXOP_SUB_FRM_TIME_MSK 0x00000008 ++#define TXQ0_MTX_Q_TXOP_SUB_FRM_TIME_I_MSK 0xfffffff7 ++#define TXQ0_MTX_Q_TXOP_SUB_FRM_TIME_SFT 3 ++#define TXQ0_MTX_Q_TXOP_SUB_FRM_TIME_HI 3 ++#define TXQ0_MTX_Q_TXOP_SUB_FRM_TIME_SZ 1 ++#define TXQ0_MTX_Q_MB_NO_RLS_MSK 0x00000010 ++#define TXQ0_MTX_Q_MB_NO_RLS_I_MSK 0xffffffef ++#define TXQ0_MTX_Q_MB_NO_RLS_SFT 4 ++#define TXQ0_MTX_Q_MB_NO_RLS_HI 4 ++#define TXQ0_MTX_Q_MB_NO_RLS_SZ 1 ++#define TXQ0_MTX_Q_TXOP_FRC_BUR_MSK 0x00000020 ++#define TXQ0_MTX_Q_TXOP_FRC_BUR_I_MSK 0xffffffdf ++#define TXQ0_MTX_Q_TXOP_FRC_BUR_SFT 5 ++#define TXQ0_MTX_Q_TXOP_FRC_BUR_HI 5 ++#define TXQ0_MTX_Q_TXOP_FRC_BUR_SZ 1 ++#define TXQ0_MTX_Q_RND_MODE_MSK 0x000000c0 ++#define TXQ0_MTX_Q_RND_MODE_I_MSK 0xffffff3f ++#define TXQ0_MTX_Q_RND_MODE_SFT 6 ++#define TXQ0_MTX_Q_RND_MODE_HI 7 ++#define TXQ0_MTX_Q_RND_MODE_SZ 2 ++#define TXQ0_MTX_Q_AIFSN_MSK 0x0000000f ++#define TXQ0_MTX_Q_AIFSN_I_MSK 0xfffffff0 ++#define TXQ0_MTX_Q_AIFSN_SFT 0 ++#define TXQ0_MTX_Q_AIFSN_HI 3 ++#define TXQ0_MTX_Q_AIFSN_SZ 4 ++#define TXQ0_MTX_Q_ECWMIN_MSK 0x00000f00 ++#define TXQ0_MTX_Q_ECWMIN_I_MSK 0xfffff0ff ++#define TXQ0_MTX_Q_ECWMIN_SFT 8 ++#define TXQ0_MTX_Q_ECWMIN_HI 11 ++#define TXQ0_MTX_Q_ECWMIN_SZ 4 ++#define TXQ0_MTX_Q_ECWMAX_MSK 0x0000f000 ++#define TXQ0_MTX_Q_ECWMAX_I_MSK 0xffff0fff ++#define TXQ0_MTX_Q_ECWMAX_SFT 12 ++#define TXQ0_MTX_Q_ECWMAX_HI 15 ++#define TXQ0_MTX_Q_ECWMAX_SZ 4 ++#define TXQ0_MTX_Q_TXOP_LIMIT_MSK 0xffff0000 ++#define TXQ0_MTX_Q_TXOP_LIMIT_I_MSK 0x0000ffff ++#define TXQ0_MTX_Q_TXOP_LIMIT_SFT 16 ++#define TXQ0_MTX_Q_TXOP_LIMIT_HI 31 ++#define TXQ0_MTX_Q_TXOP_LIMIT_SZ 16 ++#define TXQ0_MTX_Q_BKF_CNT_MSK 0x0000ffff ++#define TXQ0_MTX_Q_BKF_CNT_I_MSK 0xffff0000 ++#define TXQ0_MTX_Q_BKF_CNT_SFT 0 ++#define TXQ0_MTX_Q_BKF_CNT_HI 15 ++#define TXQ0_MTX_Q_BKF_CNT_SZ 16 ++#define TXQ0_MTX_Q_SRC_LIMIT_MSK 0x000000ff ++#define TXQ0_MTX_Q_SRC_LIMIT_I_MSK 0xffffff00 ++#define TXQ0_MTX_Q_SRC_LIMIT_SFT 0 ++#define TXQ0_MTX_Q_SRC_LIMIT_HI 7 ++#define TXQ0_MTX_Q_SRC_LIMIT_SZ 8 ++#define TXQ0_MTX_Q_LRC_LIMIT_MSK 0x0000ff00 ++#define TXQ0_MTX_Q_LRC_LIMIT_I_MSK 0xffff00ff ++#define TXQ0_MTX_Q_LRC_LIMIT_SFT 8 ++#define TXQ0_MTX_Q_LRC_LIMIT_HI 15 ++#define TXQ0_MTX_Q_LRC_LIMIT_SZ 8 ++#define TXQ0_MTX_Q_ID_MAP_L_MSK 0xffffffff ++#define TXQ0_MTX_Q_ID_MAP_L_I_MSK 0x00000000 ++#define TXQ0_MTX_Q_ID_MAP_L_SFT 0 ++#define TXQ0_MTX_Q_ID_MAP_L_HI 31 ++#define TXQ0_MTX_Q_ID_MAP_L_SZ 32 ++#define TXQ0_MTX_Q_TXOP_CH_THD_MSK 0x0000ffff ++#define TXQ0_MTX_Q_TXOP_CH_THD_I_MSK 0xffff0000 ++#define TXQ0_MTX_Q_TXOP_CH_THD_SFT 0 ++#define TXQ0_MTX_Q_TXOP_CH_THD_HI 15 ++#define TXQ0_MTX_Q_TXOP_CH_THD_SZ 16 ++#define TXQ0_MTX_Q_TXOP_OV_THD_MSK 0x0000ffff ++#define TXQ0_MTX_Q_TXOP_OV_THD_I_MSK 0xffff0000 ++#define TXQ0_MTX_Q_TXOP_OV_THD_SFT 0 ++#define TXQ0_MTX_Q_TXOP_OV_THD_HI 15 ++#define TXQ0_MTX_Q_TXOP_OV_THD_SZ 16 ++#define TXQ1_MTX_Q_PRE_LD_MSK 0x00000002 ++#define TXQ1_MTX_Q_PRE_LD_I_MSK 0xfffffffd ++#define TXQ1_MTX_Q_PRE_LD_SFT 1 ++#define TXQ1_MTX_Q_PRE_LD_HI 1 ++#define TXQ1_MTX_Q_PRE_LD_SZ 1 ++#define TXQ1_MTX_Q_BKF_CNT_FIXED_MSK 0x00000004 ++#define TXQ1_MTX_Q_BKF_CNT_FIXED_I_MSK 0xfffffffb ++#define TXQ1_MTX_Q_BKF_CNT_FIXED_SFT 2 ++#define TXQ1_MTX_Q_BKF_CNT_FIXED_HI 2 ++#define TXQ1_MTX_Q_BKF_CNT_FIXED_SZ 1 ++#define TXQ1_MTX_Q_TXOP_SUB_FRM_TIME_MSK 0x00000008 ++#define TXQ1_MTX_Q_TXOP_SUB_FRM_TIME_I_MSK 0xfffffff7 ++#define TXQ1_MTX_Q_TXOP_SUB_FRM_TIME_SFT 3 ++#define TXQ1_MTX_Q_TXOP_SUB_FRM_TIME_HI 3 ++#define TXQ1_MTX_Q_TXOP_SUB_FRM_TIME_SZ 1 ++#define TXQ1_MTX_Q_MB_NO_RLS_MSK 0x00000010 ++#define TXQ1_MTX_Q_MB_NO_RLS_I_MSK 0xffffffef ++#define TXQ1_MTX_Q_MB_NO_RLS_SFT 4 ++#define TXQ1_MTX_Q_MB_NO_RLS_HI 4 ++#define TXQ1_MTX_Q_MB_NO_RLS_SZ 1 ++#define TXQ1_MTX_Q_TXOP_FRC_BUR_MSK 0x00000020 ++#define TXQ1_MTX_Q_TXOP_FRC_BUR_I_MSK 0xffffffdf ++#define TXQ1_MTX_Q_TXOP_FRC_BUR_SFT 5 ++#define TXQ1_MTX_Q_TXOP_FRC_BUR_HI 5 ++#define TXQ1_MTX_Q_TXOP_FRC_BUR_SZ 1 ++#define TXQ1_MTX_Q_RND_MODE_MSK 0x000000c0 ++#define TXQ1_MTX_Q_RND_MODE_I_MSK 0xffffff3f ++#define TXQ1_MTX_Q_RND_MODE_SFT 6 ++#define TXQ1_MTX_Q_RND_MODE_HI 7 ++#define TXQ1_MTX_Q_RND_MODE_SZ 2 ++#define TXQ1_MTX_Q_AIFSN_MSK 0x0000000f ++#define TXQ1_MTX_Q_AIFSN_I_MSK 0xfffffff0 ++#define TXQ1_MTX_Q_AIFSN_SFT 0 ++#define TXQ1_MTX_Q_AIFSN_HI 3 ++#define TXQ1_MTX_Q_AIFSN_SZ 4 ++#define TXQ1_MTX_Q_ECWMIN_MSK 0x00000f00 ++#define TXQ1_MTX_Q_ECWMIN_I_MSK 0xfffff0ff ++#define TXQ1_MTX_Q_ECWMIN_SFT 8 ++#define TXQ1_MTX_Q_ECWMIN_HI 11 ++#define TXQ1_MTX_Q_ECWMIN_SZ 4 ++#define TXQ1_MTX_Q_ECWMAX_MSK 0x0000f000 ++#define TXQ1_MTX_Q_ECWMAX_I_MSK 0xffff0fff ++#define TXQ1_MTX_Q_ECWMAX_SFT 12 ++#define TXQ1_MTX_Q_ECWMAX_HI 15 ++#define TXQ1_MTX_Q_ECWMAX_SZ 4 ++#define TXQ1_MTX_Q_TXOP_LIMIT_MSK 0xffff0000 ++#define TXQ1_MTX_Q_TXOP_LIMIT_I_MSK 0x0000ffff ++#define TXQ1_MTX_Q_TXOP_LIMIT_SFT 16 ++#define TXQ1_MTX_Q_TXOP_LIMIT_HI 31 ++#define TXQ1_MTX_Q_TXOP_LIMIT_SZ 16 ++#define TXQ1_MTX_Q_BKF_CNT_MSK 0x0000ffff ++#define TXQ1_MTX_Q_BKF_CNT_I_MSK 0xffff0000 ++#define TXQ1_MTX_Q_BKF_CNT_SFT 0 ++#define TXQ1_MTX_Q_BKF_CNT_HI 15 ++#define TXQ1_MTX_Q_BKF_CNT_SZ 16 ++#define TXQ1_MTX_Q_SRC_LIMIT_MSK 0x000000ff ++#define TXQ1_MTX_Q_SRC_LIMIT_I_MSK 0xffffff00 ++#define TXQ1_MTX_Q_SRC_LIMIT_SFT 0 ++#define TXQ1_MTX_Q_SRC_LIMIT_HI 7 ++#define TXQ1_MTX_Q_SRC_LIMIT_SZ 8 ++#define TXQ1_MTX_Q_LRC_LIMIT_MSK 0x0000ff00 ++#define TXQ1_MTX_Q_LRC_LIMIT_I_MSK 0xffff00ff ++#define TXQ1_MTX_Q_LRC_LIMIT_SFT 8 ++#define TXQ1_MTX_Q_LRC_LIMIT_HI 15 ++#define TXQ1_MTX_Q_LRC_LIMIT_SZ 8 ++#define TXQ1_MTX_Q_ID_MAP_L_MSK 0xffffffff ++#define TXQ1_MTX_Q_ID_MAP_L_I_MSK 0x00000000 ++#define TXQ1_MTX_Q_ID_MAP_L_SFT 0 ++#define TXQ1_MTX_Q_ID_MAP_L_HI 31 ++#define TXQ1_MTX_Q_ID_MAP_L_SZ 32 ++#define TXQ1_MTX_Q_TXOP_CH_THD_MSK 0x0000ffff ++#define TXQ1_MTX_Q_TXOP_CH_THD_I_MSK 0xffff0000 ++#define TXQ1_MTX_Q_TXOP_CH_THD_SFT 0 ++#define TXQ1_MTX_Q_TXOP_CH_THD_HI 15 ++#define TXQ1_MTX_Q_TXOP_CH_THD_SZ 16 ++#define TXQ1_MTX_Q_TXOP_OV_THD_MSK 0x0000ffff ++#define TXQ1_MTX_Q_TXOP_OV_THD_I_MSK 0xffff0000 ++#define TXQ1_MTX_Q_TXOP_OV_THD_SFT 0 ++#define TXQ1_MTX_Q_TXOP_OV_THD_HI 15 ++#define TXQ1_MTX_Q_TXOP_OV_THD_SZ 16 ++#define TXQ2_MTX_Q_PRE_LD_MSK 0x00000002 ++#define TXQ2_MTX_Q_PRE_LD_I_MSK 0xfffffffd ++#define TXQ2_MTX_Q_PRE_LD_SFT 1 ++#define TXQ2_MTX_Q_PRE_LD_HI 1 ++#define TXQ2_MTX_Q_PRE_LD_SZ 1 ++#define TXQ2_MTX_Q_BKF_CNT_FIXED_MSK 0x00000004 ++#define TXQ2_MTX_Q_BKF_CNT_FIXED_I_MSK 0xfffffffb ++#define TXQ2_MTX_Q_BKF_CNT_FIXED_SFT 2 ++#define TXQ2_MTX_Q_BKF_CNT_FIXED_HI 2 ++#define TXQ2_MTX_Q_BKF_CNT_FIXED_SZ 1 ++#define TXQ2_MTX_Q_TXOP_SUB_FRM_TIME_MSK 0x00000008 ++#define TXQ2_MTX_Q_TXOP_SUB_FRM_TIME_I_MSK 0xfffffff7 ++#define TXQ2_MTX_Q_TXOP_SUB_FRM_TIME_SFT 3 ++#define TXQ2_MTX_Q_TXOP_SUB_FRM_TIME_HI 3 ++#define TXQ2_MTX_Q_TXOP_SUB_FRM_TIME_SZ 1 ++#define TXQ2_MTX_Q_MB_NO_RLS_MSK 0x00000010 ++#define TXQ2_MTX_Q_MB_NO_RLS_I_MSK 0xffffffef ++#define TXQ2_MTX_Q_MB_NO_RLS_SFT 4 ++#define TXQ2_MTX_Q_MB_NO_RLS_HI 4 ++#define TXQ2_MTX_Q_MB_NO_RLS_SZ 1 ++#define TXQ2_MTX_Q_TXOP_FRC_BUR_MSK 0x00000020 ++#define TXQ2_MTX_Q_TXOP_FRC_BUR_I_MSK 0xffffffdf ++#define TXQ2_MTX_Q_TXOP_FRC_BUR_SFT 5 ++#define TXQ2_MTX_Q_TXOP_FRC_BUR_HI 5 ++#define TXQ2_MTX_Q_TXOP_FRC_BUR_SZ 1 ++#define TXQ2_MTX_Q_RND_MODE_MSK 0x000000c0 ++#define TXQ2_MTX_Q_RND_MODE_I_MSK 0xffffff3f ++#define TXQ2_MTX_Q_RND_MODE_SFT 6 ++#define TXQ2_MTX_Q_RND_MODE_HI 7 ++#define TXQ2_MTX_Q_RND_MODE_SZ 2 ++#define TXQ2_MTX_Q_AIFSN_MSK 0x0000000f ++#define TXQ2_MTX_Q_AIFSN_I_MSK 0xfffffff0 ++#define TXQ2_MTX_Q_AIFSN_SFT 0 ++#define TXQ2_MTX_Q_AIFSN_HI 3 ++#define TXQ2_MTX_Q_AIFSN_SZ 4 ++#define TXQ2_MTX_Q_ECWMIN_MSK 0x00000f00 ++#define TXQ2_MTX_Q_ECWMIN_I_MSK 0xfffff0ff ++#define TXQ2_MTX_Q_ECWMIN_SFT 8 ++#define TXQ2_MTX_Q_ECWMIN_HI 11 ++#define TXQ2_MTX_Q_ECWMIN_SZ 4 ++#define TXQ2_MTX_Q_ECWMAX_MSK 0x0000f000 ++#define TXQ2_MTX_Q_ECWMAX_I_MSK 0xffff0fff ++#define TXQ2_MTX_Q_ECWMAX_SFT 12 ++#define TXQ2_MTX_Q_ECWMAX_HI 15 ++#define TXQ2_MTX_Q_ECWMAX_SZ 4 ++#define TXQ2_MTX_Q_TXOP_LIMIT_MSK 0xffff0000 ++#define TXQ2_MTX_Q_TXOP_LIMIT_I_MSK 0x0000ffff ++#define TXQ2_MTX_Q_TXOP_LIMIT_SFT 16 ++#define TXQ2_MTX_Q_TXOP_LIMIT_HI 31 ++#define TXQ2_MTX_Q_TXOP_LIMIT_SZ 16 ++#define TXQ2_MTX_Q_BKF_CNT_MSK 0x0000ffff ++#define TXQ2_MTX_Q_BKF_CNT_I_MSK 0xffff0000 ++#define TXQ2_MTX_Q_BKF_CNT_SFT 0 ++#define TXQ2_MTX_Q_BKF_CNT_HI 15 ++#define TXQ2_MTX_Q_BKF_CNT_SZ 16 ++#define TXQ2_MTX_Q_SRC_LIMIT_MSK 0x000000ff ++#define TXQ2_MTX_Q_SRC_LIMIT_I_MSK 0xffffff00 ++#define TXQ2_MTX_Q_SRC_LIMIT_SFT 0 ++#define TXQ2_MTX_Q_SRC_LIMIT_HI 7 ++#define TXQ2_MTX_Q_SRC_LIMIT_SZ 8 ++#define TXQ2_MTX_Q_LRC_LIMIT_MSK 0x0000ff00 ++#define TXQ2_MTX_Q_LRC_LIMIT_I_MSK 0xffff00ff ++#define TXQ2_MTX_Q_LRC_LIMIT_SFT 8 ++#define TXQ2_MTX_Q_LRC_LIMIT_HI 15 ++#define TXQ2_MTX_Q_LRC_LIMIT_SZ 8 ++#define TXQ2_MTX_Q_ID_MAP_L_MSK 0xffffffff ++#define TXQ2_MTX_Q_ID_MAP_L_I_MSK 0x00000000 ++#define TXQ2_MTX_Q_ID_MAP_L_SFT 0 ++#define TXQ2_MTX_Q_ID_MAP_L_HI 31 ++#define TXQ2_MTX_Q_ID_MAP_L_SZ 32 ++#define TXQ2_MTX_Q_TXOP_CH_THD_MSK 0x0000ffff ++#define TXQ2_MTX_Q_TXOP_CH_THD_I_MSK 0xffff0000 ++#define TXQ2_MTX_Q_TXOP_CH_THD_SFT 0 ++#define TXQ2_MTX_Q_TXOP_CH_THD_HI 15 ++#define TXQ2_MTX_Q_TXOP_CH_THD_SZ 16 ++#define TXQ2_MTX_Q_TXOP_OV_THD_MSK 0x0000ffff ++#define TXQ2_MTX_Q_TXOP_OV_THD_I_MSK 0xffff0000 ++#define TXQ2_MTX_Q_TXOP_OV_THD_SFT 0 ++#define TXQ2_MTX_Q_TXOP_OV_THD_HI 15 ++#define TXQ2_MTX_Q_TXOP_OV_THD_SZ 16 ++#define TXQ3_MTX_Q_PRE_LD_MSK 0x00000002 ++#define TXQ3_MTX_Q_PRE_LD_I_MSK 0xfffffffd ++#define TXQ3_MTX_Q_PRE_LD_SFT 1 ++#define TXQ3_MTX_Q_PRE_LD_HI 1 ++#define TXQ3_MTX_Q_PRE_LD_SZ 1 ++#define TXQ3_MTX_Q_BKF_CNT_FIXED_MSK 0x00000004 ++#define TXQ3_MTX_Q_BKF_CNT_FIXED_I_MSK 0xfffffffb ++#define TXQ3_MTX_Q_BKF_CNT_FIXED_SFT 2 ++#define TXQ3_MTX_Q_BKF_CNT_FIXED_HI 2 ++#define TXQ3_MTX_Q_BKF_CNT_FIXED_SZ 1 ++#define TXQ3_MTX_Q_TXOP_SUB_FRM_TIME_MSK 0x00000008 ++#define TXQ3_MTX_Q_TXOP_SUB_FRM_TIME_I_MSK 0xfffffff7 ++#define TXQ3_MTX_Q_TXOP_SUB_FRM_TIME_SFT 3 ++#define TXQ3_MTX_Q_TXOP_SUB_FRM_TIME_HI 3 ++#define TXQ3_MTX_Q_TXOP_SUB_FRM_TIME_SZ 1 ++#define TXQ3_MTX_Q_MB_NO_RLS_MSK 0x00000010 ++#define TXQ3_MTX_Q_MB_NO_RLS_I_MSK 0xffffffef ++#define TXQ3_MTX_Q_MB_NO_RLS_SFT 4 ++#define TXQ3_MTX_Q_MB_NO_RLS_HI 4 ++#define TXQ3_MTX_Q_MB_NO_RLS_SZ 1 ++#define TXQ3_MTX_Q_TXOP_FRC_BUR_MSK 0x00000020 ++#define TXQ3_MTX_Q_TXOP_FRC_BUR_I_MSK 0xffffffdf ++#define TXQ3_MTX_Q_TXOP_FRC_BUR_SFT 5 ++#define TXQ3_MTX_Q_TXOP_FRC_BUR_HI 5 ++#define TXQ3_MTX_Q_TXOP_FRC_BUR_SZ 1 ++#define TXQ3_MTX_Q_RND_MODE_MSK 0x000000c0 ++#define TXQ3_MTX_Q_RND_MODE_I_MSK 0xffffff3f ++#define TXQ3_MTX_Q_RND_MODE_SFT 6 ++#define TXQ3_MTX_Q_RND_MODE_HI 7 ++#define TXQ3_MTX_Q_RND_MODE_SZ 2 ++#define TXQ3_MTX_Q_AIFSN_MSK 0x0000000f ++#define TXQ3_MTX_Q_AIFSN_I_MSK 0xfffffff0 ++#define TXQ3_MTX_Q_AIFSN_SFT 0 ++#define TXQ3_MTX_Q_AIFSN_HI 3 ++#define TXQ3_MTX_Q_AIFSN_SZ 4 ++#define TXQ3_MTX_Q_ECWMIN_MSK 0x00000f00 ++#define TXQ3_MTX_Q_ECWMIN_I_MSK 0xfffff0ff ++#define TXQ3_MTX_Q_ECWMIN_SFT 8 ++#define TXQ3_MTX_Q_ECWMIN_HI 11 ++#define TXQ3_MTX_Q_ECWMIN_SZ 4 ++#define TXQ3_MTX_Q_ECWMAX_MSK 0x0000f000 ++#define TXQ3_MTX_Q_ECWMAX_I_MSK 0xffff0fff ++#define TXQ3_MTX_Q_ECWMAX_SFT 12 ++#define TXQ3_MTX_Q_ECWMAX_HI 15 ++#define TXQ3_MTX_Q_ECWMAX_SZ 4 ++#define TXQ3_MTX_Q_TXOP_LIMIT_MSK 0xffff0000 ++#define TXQ3_MTX_Q_TXOP_LIMIT_I_MSK 0x0000ffff ++#define TXQ3_MTX_Q_TXOP_LIMIT_SFT 16 ++#define TXQ3_MTX_Q_TXOP_LIMIT_HI 31 ++#define TXQ3_MTX_Q_TXOP_LIMIT_SZ 16 ++#define TXQ3_MTX_Q_BKF_CNT_MSK 0x0000ffff ++#define TXQ3_MTX_Q_BKF_CNT_I_MSK 0xffff0000 ++#define TXQ3_MTX_Q_BKF_CNT_SFT 0 ++#define TXQ3_MTX_Q_BKF_CNT_HI 15 ++#define TXQ3_MTX_Q_BKF_CNT_SZ 16 ++#define TXQ3_MTX_Q_SRC_LIMIT_MSK 0x000000ff ++#define TXQ3_MTX_Q_SRC_LIMIT_I_MSK 0xffffff00 ++#define TXQ3_MTX_Q_SRC_LIMIT_SFT 0 ++#define TXQ3_MTX_Q_SRC_LIMIT_HI 7 ++#define TXQ3_MTX_Q_SRC_LIMIT_SZ 8 ++#define TXQ3_MTX_Q_LRC_LIMIT_MSK 0x0000ff00 ++#define TXQ3_MTX_Q_LRC_LIMIT_I_MSK 0xffff00ff ++#define TXQ3_MTX_Q_LRC_LIMIT_SFT 8 ++#define TXQ3_MTX_Q_LRC_LIMIT_HI 15 ++#define TXQ3_MTX_Q_LRC_LIMIT_SZ 8 ++#define TXQ3_MTX_Q_ID_MAP_L_MSK 0xffffffff ++#define TXQ3_MTX_Q_ID_MAP_L_I_MSK 0x00000000 ++#define TXQ3_MTX_Q_ID_MAP_L_SFT 0 ++#define TXQ3_MTX_Q_ID_MAP_L_HI 31 ++#define TXQ3_MTX_Q_ID_MAP_L_SZ 32 ++#define TXQ3_MTX_Q_TXOP_CH_THD_MSK 0x0000ffff ++#define TXQ3_MTX_Q_TXOP_CH_THD_I_MSK 0xffff0000 ++#define TXQ3_MTX_Q_TXOP_CH_THD_SFT 0 ++#define TXQ3_MTX_Q_TXOP_CH_THD_HI 15 ++#define TXQ3_MTX_Q_TXOP_CH_THD_SZ 16 ++#define TXQ3_MTX_Q_TXOP_OV_THD_MSK 0x0000ffff ++#define TXQ3_MTX_Q_TXOP_OV_THD_I_MSK 0xffff0000 ++#define TXQ3_MTX_Q_TXOP_OV_THD_SFT 0 ++#define TXQ3_MTX_Q_TXOP_OV_THD_HI 15 ++#define TXQ3_MTX_Q_TXOP_OV_THD_SZ 16 ++#define TXQ4_MTX_Q_PRE_LD_MSK 0x00000002 ++#define TXQ4_MTX_Q_PRE_LD_I_MSK 0xfffffffd ++#define TXQ4_MTX_Q_PRE_LD_SFT 1 ++#define TXQ4_MTX_Q_PRE_LD_HI 1 ++#define TXQ4_MTX_Q_PRE_LD_SZ 1 ++#define TXQ4_MTX_Q_BKF_CNT_FIXED_MSK 0x00000004 ++#define TXQ4_MTX_Q_BKF_CNT_FIXED_I_MSK 0xfffffffb ++#define TXQ4_MTX_Q_BKF_CNT_FIXED_SFT 2 ++#define TXQ4_MTX_Q_BKF_CNT_FIXED_HI 2 ++#define TXQ4_MTX_Q_BKF_CNT_FIXED_SZ 1 ++#define TXQ4_MTX_Q_TXOP_SUB_FRM_TIME_MSK 0x00000008 ++#define TXQ4_MTX_Q_TXOP_SUB_FRM_TIME_I_MSK 0xfffffff7 ++#define TXQ4_MTX_Q_TXOP_SUB_FRM_TIME_SFT 3 ++#define TXQ4_MTX_Q_TXOP_SUB_FRM_TIME_HI 3 ++#define TXQ4_MTX_Q_TXOP_SUB_FRM_TIME_SZ 1 ++#define TXQ4_MTX_Q_MB_NO_RLS_MSK 0x00000010 ++#define TXQ4_MTX_Q_MB_NO_RLS_I_MSK 0xffffffef ++#define TXQ4_MTX_Q_MB_NO_RLS_SFT 4 ++#define TXQ4_MTX_Q_MB_NO_RLS_HI 4 ++#define TXQ4_MTX_Q_MB_NO_RLS_SZ 1 ++#define TXQ4_MTX_Q_TXOP_FRC_BUR_MSK 0x00000020 ++#define TXQ4_MTX_Q_TXOP_FRC_BUR_I_MSK 0xffffffdf ++#define TXQ4_MTX_Q_TXOP_FRC_BUR_SFT 5 ++#define TXQ4_MTX_Q_TXOP_FRC_BUR_HI 5 ++#define TXQ4_MTX_Q_TXOP_FRC_BUR_SZ 1 ++#define TXQ4_MTX_Q_RND_MODE_MSK 0x000000c0 ++#define TXQ4_MTX_Q_RND_MODE_I_MSK 0xffffff3f ++#define TXQ4_MTX_Q_RND_MODE_SFT 6 ++#define TXQ4_MTX_Q_RND_MODE_HI 7 ++#define TXQ4_MTX_Q_RND_MODE_SZ 2 ++#define TXQ4_MTX_Q_AIFSN_MSK 0x0000000f ++#define TXQ4_MTX_Q_AIFSN_I_MSK 0xfffffff0 ++#define TXQ4_MTX_Q_AIFSN_SFT 0 ++#define TXQ4_MTX_Q_AIFSN_HI 3 ++#define TXQ4_MTX_Q_AIFSN_SZ 4 ++#define TXQ4_MTX_Q_ECWMIN_MSK 0x00000f00 ++#define TXQ4_MTX_Q_ECWMIN_I_MSK 0xfffff0ff ++#define TXQ4_MTX_Q_ECWMIN_SFT 8 ++#define TXQ4_MTX_Q_ECWMIN_HI 11 ++#define TXQ4_MTX_Q_ECWMIN_SZ 4 ++#define TXQ4_MTX_Q_ECWMAX_MSK 0x0000f000 ++#define TXQ4_MTX_Q_ECWMAX_I_MSK 0xffff0fff ++#define TXQ4_MTX_Q_ECWMAX_SFT 12 ++#define TXQ4_MTX_Q_ECWMAX_HI 15 ++#define TXQ4_MTX_Q_ECWMAX_SZ 4 ++#define TXQ4_MTX_Q_TXOP_LIMIT_MSK 0xffff0000 ++#define TXQ4_MTX_Q_TXOP_LIMIT_I_MSK 0x0000ffff ++#define TXQ4_MTX_Q_TXOP_LIMIT_SFT 16 ++#define TXQ4_MTX_Q_TXOP_LIMIT_HI 31 ++#define TXQ4_MTX_Q_TXOP_LIMIT_SZ 16 ++#define TXQ4_MTX_Q_BKF_CNT_MSK 0x0000ffff ++#define TXQ4_MTX_Q_BKF_CNT_I_MSK 0xffff0000 ++#define TXQ4_MTX_Q_BKF_CNT_SFT 0 ++#define TXQ4_MTX_Q_BKF_CNT_HI 15 ++#define TXQ4_MTX_Q_BKF_CNT_SZ 16 ++#define TXQ4_MTX_Q_SRC_LIMIT_MSK 0x000000ff ++#define TXQ4_MTX_Q_SRC_LIMIT_I_MSK 0xffffff00 ++#define TXQ4_MTX_Q_SRC_LIMIT_SFT 0 ++#define TXQ4_MTX_Q_SRC_LIMIT_HI 7 ++#define TXQ4_MTX_Q_SRC_LIMIT_SZ 8 ++#define TXQ4_MTX_Q_LRC_LIMIT_MSK 0x0000ff00 ++#define TXQ4_MTX_Q_LRC_LIMIT_I_MSK 0xffff00ff ++#define TXQ4_MTX_Q_LRC_LIMIT_SFT 8 ++#define TXQ4_MTX_Q_LRC_LIMIT_HI 15 ++#define TXQ4_MTX_Q_LRC_LIMIT_SZ 8 ++#define TXQ4_MTX_Q_ID_MAP_L_MSK 0xffffffff ++#define TXQ4_MTX_Q_ID_MAP_L_I_MSK 0x00000000 ++#define TXQ4_MTX_Q_ID_MAP_L_SFT 0 ++#define TXQ4_MTX_Q_ID_MAP_L_HI 31 ++#define TXQ4_MTX_Q_ID_MAP_L_SZ 32 ++#define TXQ4_MTX_Q_TXOP_CH_THD_MSK 0x0000ffff ++#define TXQ4_MTX_Q_TXOP_CH_THD_I_MSK 0xffff0000 ++#define TXQ4_MTX_Q_TXOP_CH_THD_SFT 0 ++#define TXQ4_MTX_Q_TXOP_CH_THD_HI 15 ++#define TXQ4_MTX_Q_TXOP_CH_THD_SZ 16 ++#define TXQ4_MTX_Q_TXOP_OV_THD_MSK 0x0000ffff ++#define TXQ4_MTX_Q_TXOP_OV_THD_I_MSK 0xffff0000 ++#define TXQ4_MTX_Q_TXOP_OV_THD_SFT 0 ++#define TXQ4_MTX_Q_TXOP_OV_THD_HI 15 ++#define TXQ4_MTX_Q_TXOP_OV_THD_SZ 16 ++#define VALID0_MSK 0x00000001 ++#define VALID0_I_MSK 0xfffffffe ++#define VALID0_SFT 0 ++#define VALID0_HI 0 ++#define VALID0_SZ 1 ++#define PEER_QOS_EN0_MSK 0x00000002 ++#define PEER_QOS_EN0_I_MSK 0xfffffffd ++#define PEER_QOS_EN0_SFT 1 ++#define PEER_QOS_EN0_HI 1 ++#define PEER_QOS_EN0_SZ 1 ++#define PEER_OP_MODE0_MSK 0x0000000c ++#define PEER_OP_MODE0_I_MSK 0xfffffff3 ++#define PEER_OP_MODE0_SFT 2 ++#define PEER_OP_MODE0_HI 3 ++#define PEER_OP_MODE0_SZ 2 ++#define PEER_HT_MODE0_MSK 0x00000030 ++#define PEER_HT_MODE0_I_MSK 0xffffffcf ++#define PEER_HT_MODE0_SFT 4 ++#define PEER_HT_MODE0_HI 5 ++#define PEER_HT_MODE0_SZ 2 ++#define PEER_MAC0_31_0_MSK 0xffffffff ++#define PEER_MAC0_31_0_I_MSK 0x00000000 ++#define PEER_MAC0_31_0_SFT 0 ++#define PEER_MAC0_31_0_HI 31 ++#define PEER_MAC0_31_0_SZ 32 ++#define PEER_MAC0_47_32_MSK 0x0000ffff ++#define PEER_MAC0_47_32_I_MSK 0xffff0000 ++#define PEER_MAC0_47_32_SFT 0 ++#define PEER_MAC0_47_32_HI 15 ++#define PEER_MAC0_47_32_SZ 16 ++#define TX_ACK_POLICY_0_0_MSK 0x00000003 ++#define TX_ACK_POLICY_0_0_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_0_SFT 0 ++#define TX_ACK_POLICY_0_0_HI 1 ++#define TX_ACK_POLICY_0_0_SZ 2 ++#define TX_SEQ_CTRL_0_0_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_0_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_0_SFT 0 ++#define TX_SEQ_CTRL_0_0_HI 11 ++#define TX_SEQ_CTRL_0_0_SZ 12 ++#define TX_ACK_POLICY_0_1_MSK 0x00000003 ++#define TX_ACK_POLICY_0_1_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_1_SFT 0 ++#define TX_ACK_POLICY_0_1_HI 1 ++#define TX_ACK_POLICY_0_1_SZ 2 ++#define TX_SEQ_CTRL_0_1_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_1_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_1_SFT 0 ++#define TX_SEQ_CTRL_0_1_HI 11 ++#define TX_SEQ_CTRL_0_1_SZ 12 ++#define TX_ACK_POLICY_0_2_MSK 0x00000003 ++#define TX_ACK_POLICY_0_2_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_2_SFT 0 ++#define TX_ACK_POLICY_0_2_HI 1 ++#define TX_ACK_POLICY_0_2_SZ 2 ++#define TX_SEQ_CTRL_0_2_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_2_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_2_SFT 0 ++#define TX_SEQ_CTRL_0_2_HI 11 ++#define TX_SEQ_CTRL_0_2_SZ 12 ++#define TX_ACK_POLICY_0_3_MSK 0x00000003 ++#define TX_ACK_POLICY_0_3_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_3_SFT 0 ++#define TX_ACK_POLICY_0_3_HI 1 ++#define TX_ACK_POLICY_0_3_SZ 2 ++#define TX_SEQ_CTRL_0_3_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_3_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_3_SFT 0 ++#define TX_SEQ_CTRL_0_3_HI 11 ++#define TX_SEQ_CTRL_0_3_SZ 12 ++#define TX_ACK_POLICY_0_4_MSK 0x00000003 ++#define TX_ACK_POLICY_0_4_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_4_SFT 0 ++#define TX_ACK_POLICY_0_4_HI 1 ++#define TX_ACK_POLICY_0_4_SZ 2 ++#define TX_SEQ_CTRL_0_4_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_4_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_4_SFT 0 ++#define TX_SEQ_CTRL_0_4_HI 11 ++#define TX_SEQ_CTRL_0_4_SZ 12 ++#define TX_ACK_POLICY_0_5_MSK 0x00000003 ++#define TX_ACK_POLICY_0_5_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_5_SFT 0 ++#define TX_ACK_POLICY_0_5_HI 1 ++#define TX_ACK_POLICY_0_5_SZ 2 ++#define TX_SEQ_CTRL_0_5_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_5_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_5_SFT 0 ++#define TX_SEQ_CTRL_0_5_HI 11 ++#define TX_SEQ_CTRL_0_5_SZ 12 ++#define TX_ACK_POLICY_0_6_MSK 0x00000003 ++#define TX_ACK_POLICY_0_6_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_6_SFT 0 ++#define TX_ACK_POLICY_0_6_HI 1 ++#define TX_ACK_POLICY_0_6_SZ 2 ++#define TX_SEQ_CTRL_0_6_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_6_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_6_SFT 0 ++#define TX_SEQ_CTRL_0_6_HI 11 ++#define TX_SEQ_CTRL_0_6_SZ 12 ++#define TX_ACK_POLICY_0_7_MSK 0x00000003 ++#define TX_ACK_POLICY_0_7_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_0_7_SFT 0 ++#define TX_ACK_POLICY_0_7_HI 1 ++#define TX_ACK_POLICY_0_7_SZ 2 ++#define TX_SEQ_CTRL_0_7_MSK 0x00000fff ++#define TX_SEQ_CTRL_0_7_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_0_7_SFT 0 ++#define TX_SEQ_CTRL_0_7_HI 11 ++#define TX_SEQ_CTRL_0_7_SZ 12 ++#define VALID1_MSK 0x00000001 ++#define VALID1_I_MSK 0xfffffffe ++#define VALID1_SFT 0 ++#define VALID1_HI 0 ++#define VALID1_SZ 1 ++#define PEER_QOS_EN1_MSK 0x00000002 ++#define PEER_QOS_EN1_I_MSK 0xfffffffd ++#define PEER_QOS_EN1_SFT 1 ++#define PEER_QOS_EN1_HI 1 ++#define PEER_QOS_EN1_SZ 1 ++#define PEER_OP_MODE1_MSK 0x0000000c ++#define PEER_OP_MODE1_I_MSK 0xfffffff3 ++#define PEER_OP_MODE1_SFT 2 ++#define PEER_OP_MODE1_HI 3 ++#define PEER_OP_MODE1_SZ 2 ++#define PEER_HT_MODE1_MSK 0x00000030 ++#define PEER_HT_MODE1_I_MSK 0xffffffcf ++#define PEER_HT_MODE1_SFT 4 ++#define PEER_HT_MODE1_HI 5 ++#define PEER_HT_MODE1_SZ 2 ++#define PEER_MAC1_31_0_MSK 0xffffffff ++#define PEER_MAC1_31_0_I_MSK 0x00000000 ++#define PEER_MAC1_31_0_SFT 0 ++#define PEER_MAC1_31_0_HI 31 ++#define PEER_MAC1_31_0_SZ 32 ++#define PEER_MAC1_47_32_MSK 0x0000ffff ++#define PEER_MAC1_47_32_I_MSK 0xffff0000 ++#define PEER_MAC1_47_32_SFT 0 ++#define PEER_MAC1_47_32_HI 15 ++#define PEER_MAC1_47_32_SZ 16 ++#define TX_ACK_POLICY_1_0_MSK 0x00000003 ++#define TX_ACK_POLICY_1_0_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_0_SFT 0 ++#define TX_ACK_POLICY_1_0_HI 1 ++#define TX_ACK_POLICY_1_0_SZ 2 ++#define TX_SEQ_CTRL_1_0_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_0_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_0_SFT 0 ++#define TX_SEQ_CTRL_1_0_HI 11 ++#define TX_SEQ_CTRL_1_0_SZ 12 ++#define TX_ACK_POLICY_1_1_MSK 0x00000003 ++#define TX_ACK_POLICY_1_1_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_1_SFT 0 ++#define TX_ACK_POLICY_1_1_HI 1 ++#define TX_ACK_POLICY_1_1_SZ 2 ++#define TX_SEQ_CTRL_1_1_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_1_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_1_SFT 0 ++#define TX_SEQ_CTRL_1_1_HI 11 ++#define TX_SEQ_CTRL_1_1_SZ 12 ++#define TX_ACK_POLICY_1_2_MSK 0x00000003 ++#define TX_ACK_POLICY_1_2_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_2_SFT 0 ++#define TX_ACK_POLICY_1_2_HI 1 ++#define TX_ACK_POLICY_1_2_SZ 2 ++#define TX_SEQ_CTRL_1_2_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_2_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_2_SFT 0 ++#define TX_SEQ_CTRL_1_2_HI 11 ++#define TX_SEQ_CTRL_1_2_SZ 12 ++#define TX_ACK_POLICY_1_3_MSK 0x00000003 ++#define TX_ACK_POLICY_1_3_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_3_SFT 0 ++#define TX_ACK_POLICY_1_3_HI 1 ++#define TX_ACK_POLICY_1_3_SZ 2 ++#define TX_SEQ_CTRL_1_3_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_3_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_3_SFT 0 ++#define TX_SEQ_CTRL_1_3_HI 11 ++#define TX_SEQ_CTRL_1_3_SZ 12 ++#define TX_ACK_POLICY_1_4_MSK 0x00000003 ++#define TX_ACK_POLICY_1_4_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_4_SFT 0 ++#define TX_ACK_POLICY_1_4_HI 1 ++#define TX_ACK_POLICY_1_4_SZ 2 ++#define TX_SEQ_CTRL_1_4_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_4_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_4_SFT 0 ++#define TX_SEQ_CTRL_1_4_HI 11 ++#define TX_SEQ_CTRL_1_4_SZ 12 ++#define TX_ACK_POLICY_1_5_MSK 0x00000003 ++#define TX_ACK_POLICY_1_5_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_5_SFT 0 ++#define TX_ACK_POLICY_1_5_HI 1 ++#define TX_ACK_POLICY_1_5_SZ 2 ++#define TX_SEQ_CTRL_1_5_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_5_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_5_SFT 0 ++#define TX_SEQ_CTRL_1_5_HI 11 ++#define TX_SEQ_CTRL_1_5_SZ 12 ++#define TX_ACK_POLICY_1_6_MSK 0x00000003 ++#define TX_ACK_POLICY_1_6_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_6_SFT 0 ++#define TX_ACK_POLICY_1_6_HI 1 ++#define TX_ACK_POLICY_1_6_SZ 2 ++#define TX_SEQ_CTRL_1_6_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_6_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_6_SFT 0 ++#define TX_SEQ_CTRL_1_6_HI 11 ++#define TX_SEQ_CTRL_1_6_SZ 12 ++#define TX_ACK_POLICY_1_7_MSK 0x00000003 ++#define TX_ACK_POLICY_1_7_I_MSK 0xfffffffc ++#define TX_ACK_POLICY_1_7_SFT 0 ++#define TX_ACK_POLICY_1_7_HI 1 ++#define TX_ACK_POLICY_1_7_SZ 2 ++#define TX_SEQ_CTRL_1_7_MSK 0x00000fff ++#define TX_SEQ_CTRL_1_7_I_MSK 0xfffff000 ++#define TX_SEQ_CTRL_1_7_SFT 0 ++#define TX_SEQ_CTRL_1_7_HI 11 ++#define TX_SEQ_CTRL_1_7_SZ 12 ++#define INFO0_MSK 0xffffffff ++#define INFO0_I_MSK 0x00000000 ++#define INFO0_SFT 0 ++#define INFO0_HI 31 ++#define INFO0_SZ 32 ++#define INFO1_MSK 0xffffffff ++#define INFO1_I_MSK 0x00000000 ++#define INFO1_SFT 0 ++#define INFO1_HI 31 ++#define INFO1_SZ 32 ++#define INFO2_MSK 0xffffffff ++#define INFO2_I_MSK 0x00000000 ++#define INFO2_SFT 0 ++#define INFO2_HI 31 ++#define INFO2_SZ 32 ++#define INFO3_MSK 0xffffffff ++#define INFO3_I_MSK 0x00000000 ++#define INFO3_SFT 0 ++#define INFO3_HI 31 ++#define INFO3_SZ 32 ++#define INFO4_MSK 0xffffffff ++#define INFO4_I_MSK 0x00000000 ++#define INFO4_SFT 0 ++#define INFO4_HI 31 ++#define INFO4_SZ 32 ++#define INFO5_MSK 0xffffffff ++#define INFO5_I_MSK 0x00000000 ++#define INFO5_SFT 0 ++#define INFO5_HI 31 ++#define INFO5_SZ 32 ++#define INFO6_MSK 0xffffffff ++#define INFO6_I_MSK 0x00000000 ++#define INFO6_SFT 0 ++#define INFO6_HI 31 ++#define INFO6_SZ 32 ++#define INFO7_MSK 0xffffffff ++#define INFO7_I_MSK 0x00000000 ++#define INFO7_SFT 0 ++#define INFO7_HI 31 ++#define INFO7_SZ 32 ++#define INFO8_MSK 0xffffffff ++#define INFO8_I_MSK 0x00000000 ++#define INFO8_SFT 0 ++#define INFO8_HI 31 ++#define INFO8_SZ 32 ++#define INFO9_MSK 0xffffffff ++#define INFO9_I_MSK 0x00000000 ++#define INFO9_SFT 0 ++#define INFO9_HI 31 ++#define INFO9_SZ 32 ++#define INFO10_MSK 0xffffffff ++#define INFO10_I_MSK 0x00000000 ++#define INFO10_SFT 0 ++#define INFO10_HI 31 ++#define INFO10_SZ 32 ++#define INFO11_MSK 0xffffffff ++#define INFO11_I_MSK 0x00000000 ++#define INFO11_SFT 0 ++#define INFO11_HI 31 ++#define INFO11_SZ 32 ++#define INFO12_MSK 0xffffffff ++#define INFO12_I_MSK 0x00000000 ++#define INFO12_SFT 0 ++#define INFO12_HI 31 ++#define INFO12_SZ 32 ++#define INFO13_MSK 0xffffffff ++#define INFO13_I_MSK 0x00000000 ++#define INFO13_SFT 0 ++#define INFO13_HI 31 ++#define INFO13_SZ 32 ++#define INFO14_MSK 0xffffffff ++#define INFO14_I_MSK 0x00000000 ++#define INFO14_SFT 0 ++#define INFO14_HI 31 ++#define INFO14_SZ 32 ++#define INFO15_MSK 0xffffffff ++#define INFO15_I_MSK 0x00000000 ++#define INFO15_SFT 0 ++#define INFO15_HI 31 ++#define INFO15_SZ 32 ++#define INFO16_MSK 0xffffffff ++#define INFO16_I_MSK 0x00000000 ++#define INFO16_SFT 0 ++#define INFO16_HI 31 ++#define INFO16_SZ 32 ++#define INFO17_MSK 0xffffffff ++#define INFO17_I_MSK 0x00000000 ++#define INFO17_SFT 0 ++#define INFO17_HI 31 ++#define INFO17_SZ 32 ++#define INFO18_MSK 0xffffffff ++#define INFO18_I_MSK 0x00000000 ++#define INFO18_SFT 0 ++#define INFO18_HI 31 ++#define INFO18_SZ 32 ++#define INFO19_MSK 0xffffffff ++#define INFO19_I_MSK 0x00000000 ++#define INFO19_SFT 0 ++#define INFO19_HI 31 ++#define INFO19_SZ 32 ++#define INFO20_MSK 0xffffffff ++#define INFO20_I_MSK 0x00000000 ++#define INFO20_SFT 0 ++#define INFO20_HI 31 ++#define INFO20_SZ 32 ++#define INFO21_MSK 0xffffffff ++#define INFO21_I_MSK 0x00000000 ++#define INFO21_SFT 0 ++#define INFO21_HI 31 ++#define INFO21_SZ 32 ++#define INFO22_MSK 0xffffffff ++#define INFO22_I_MSK 0x00000000 ++#define INFO22_SFT 0 ++#define INFO22_HI 31 ++#define INFO22_SZ 32 ++#define INFO23_MSK 0xffffffff ++#define INFO23_I_MSK 0x00000000 ++#define INFO23_SFT 0 ++#define INFO23_HI 31 ++#define INFO23_SZ 32 ++#define INFO24_MSK 0xffffffff ++#define INFO24_I_MSK 0x00000000 ++#define INFO24_SFT 0 ++#define INFO24_HI 31 ++#define INFO24_SZ 32 ++#define INFO25_MSK 0xffffffff ++#define INFO25_I_MSK 0x00000000 ++#define INFO25_SFT 0 ++#define INFO25_HI 31 ++#define INFO25_SZ 32 ++#define INFO26_MSK 0xffffffff ++#define INFO26_I_MSK 0x00000000 ++#define INFO26_SFT 0 ++#define INFO26_HI 31 ++#define INFO26_SZ 32 ++#define INFO27_MSK 0xffffffff ++#define INFO27_I_MSK 0x00000000 ++#define INFO27_SFT 0 ++#define INFO27_HI 31 ++#define INFO27_SZ 32 ++#define INFO28_MSK 0xffffffff ++#define INFO28_I_MSK 0x00000000 ++#define INFO28_SFT 0 ++#define INFO28_HI 31 ++#define INFO28_SZ 32 ++#define INFO29_MSK 0xffffffff ++#define INFO29_I_MSK 0x00000000 ++#define INFO29_SFT 0 ++#define INFO29_HI 31 ++#define INFO29_SZ 32 ++#define INFO30_MSK 0xffffffff ++#define INFO30_I_MSK 0x00000000 ++#define INFO30_SFT 0 ++#define INFO30_HI 31 ++#define INFO30_SZ 32 ++#define INFO31_MSK 0xffffffff ++#define INFO31_I_MSK 0x00000000 ++#define INFO31_SFT 0 ++#define INFO31_HI 31 ++#define INFO31_SZ 32 ++#define INFO32_MSK 0xffffffff ++#define INFO32_I_MSK 0x00000000 ++#define INFO32_SFT 0 ++#define INFO32_HI 31 ++#define INFO32_SZ 32 ++#define INFO33_MSK 0xffffffff ++#define INFO33_I_MSK 0x00000000 ++#define INFO33_SFT 0 ++#define INFO33_HI 31 ++#define INFO33_SZ 32 ++#define INFO34_MSK 0xffffffff ++#define INFO34_I_MSK 0x00000000 ++#define INFO34_SFT 0 ++#define INFO34_HI 31 ++#define INFO34_SZ 32 ++#define INFO35_MSK 0xffffffff ++#define INFO35_I_MSK 0x00000000 ++#define INFO35_SFT 0 ++#define INFO35_HI 31 ++#define INFO35_SZ 32 ++#define INFO36_MSK 0xffffffff ++#define INFO36_I_MSK 0x00000000 ++#define INFO36_SFT 0 ++#define INFO36_HI 31 ++#define INFO36_SZ 32 ++#define INFO37_MSK 0xffffffff ++#define INFO37_I_MSK 0x00000000 ++#define INFO37_SFT 0 ++#define INFO37_HI 31 ++#define INFO37_SZ 32 ++#define INFO38_MSK 0xffffffff ++#define INFO38_I_MSK 0x00000000 ++#define INFO38_SFT 0 ++#define INFO38_HI 31 ++#define INFO38_SZ 32 ++#define INFO_MASK_MSK 0xffffffff ++#define INFO_MASK_I_MSK 0x00000000 ++#define INFO_MASK_SFT 0 ++#define INFO_MASK_HI 31 ++#define INFO_MASK_SZ 32 ++#define INFO_DEF_RATE_MSK 0x0000003f ++#define INFO_DEF_RATE_I_MSK 0xffffffc0 ++#define INFO_DEF_RATE_SFT 0 ++#define INFO_DEF_RATE_HI 5 ++#define INFO_DEF_RATE_SZ 6 ++#define INFO_MRX_OFFSET_MSK 0x000f0000 ++#define INFO_MRX_OFFSET_I_MSK 0xfff0ffff ++#define INFO_MRX_OFFSET_SFT 16 ++#define INFO_MRX_OFFSET_HI 19 ++#define INFO_MRX_OFFSET_SZ 4 ++#define BCAST_RATEUNKNOW_MSK 0x3f000000 ++#define BCAST_RATEUNKNOW_I_MSK 0xc0ffffff ++#define BCAST_RATEUNKNOW_SFT 24 ++#define BCAST_RATEUNKNOW_HI 29 ++#define BCAST_RATEUNKNOW_SZ 6 ++#define INFO_IDX_TBL_ADDR_MSK 0xffffffff ++#define INFO_IDX_TBL_ADDR_I_MSK 0x00000000 ++#define INFO_IDX_TBL_ADDR_SFT 0 ++#define INFO_IDX_TBL_ADDR_HI 31 ++#define INFO_IDX_TBL_ADDR_SZ 32 ++#define INFO_LEN_TBL_ADDR_MSK 0xffffffff ++#define INFO_LEN_TBL_ADDR_I_MSK 0x00000000 ++#define INFO_LEN_TBL_ADDR_SFT 0 ++#define INFO_LEN_TBL_ADDR_HI 31 ++#define INFO_LEN_TBL_ADDR_SZ 32 ++#define IC_TAG_31_0_MSK 0xffffffff ++#define IC_TAG_31_0_I_MSK 0x00000000 ++#define IC_TAG_31_0_SFT 0 ++#define IC_TAG_31_0_HI 31 ++#define IC_TAG_31_0_SZ 32 ++#define IC_TAG_63_32_MSK 0xffffffff ++#define IC_TAG_63_32_I_MSK 0x00000000 ++#define IC_TAG_63_32_SFT 0 ++#define IC_TAG_63_32_HI 31 ++#define IC_TAG_63_32_SZ 32 ++#define CH1_PRI_MSK 0x00000003 ++#define CH1_PRI_I_MSK 0xfffffffc ++#define CH1_PRI_SFT 0 ++#define CH1_PRI_HI 1 ++#define CH1_PRI_SZ 2 ++#define CH2_PRI_MSK 0x00000300 ++#define CH2_PRI_I_MSK 0xfffffcff ++#define CH2_PRI_SFT 8 ++#define CH2_PRI_HI 9 ++#define CH2_PRI_SZ 2 ++#define CH3_PRI_MSK 0x00030000 ++#define CH3_PRI_I_MSK 0xfffcffff ++#define CH3_PRI_SFT 16 ++#define CH3_PRI_HI 17 ++#define CH3_PRI_SZ 2 ++#define RG_MAC_LPBK_MSK 0x00000001 ++#define RG_MAC_LPBK_I_MSK 0xfffffffe ++#define RG_MAC_LPBK_SFT 0 ++#define RG_MAC_LPBK_HI 0 ++#define RG_MAC_LPBK_SZ 1 ++#define RG_MAC_M2M_MSK 0x00000002 ++#define RG_MAC_M2M_I_MSK 0xfffffffd ++#define RG_MAC_M2M_SFT 1 ++#define RG_MAC_M2M_HI 1 ++#define RG_MAC_M2M_SZ 1 ++#define RG_PHY_LPBK_MSK 0x00000004 ++#define RG_PHY_LPBK_I_MSK 0xfffffffb ++#define RG_PHY_LPBK_SFT 2 ++#define RG_PHY_LPBK_HI 2 ++#define RG_PHY_LPBK_SZ 1 ++#define RG_LPBK_RX_EN_MSK 0x00000008 ++#define RG_LPBK_RX_EN_I_MSK 0xfffffff7 ++#define RG_LPBK_RX_EN_SFT 3 ++#define RG_LPBK_RX_EN_HI 3 ++#define RG_LPBK_RX_EN_SZ 1 ++#define EXT_MAC_MODE_MSK 0x00000010 ++#define EXT_MAC_MODE_I_MSK 0xffffffef ++#define EXT_MAC_MODE_SFT 4 ++#define EXT_MAC_MODE_HI 4 ++#define EXT_MAC_MODE_SZ 1 ++#define EXT_PHY_MODE_MSK 0x00000020 ++#define EXT_PHY_MODE_I_MSK 0xffffffdf ++#define EXT_PHY_MODE_SFT 5 ++#define EXT_PHY_MODE_HI 5 ++#define EXT_PHY_MODE_SZ 1 ++#define ASIC_TAG_MSK 0xff000000 ++#define ASIC_TAG_I_MSK 0x00ffffff ++#define ASIC_TAG_SFT 24 ++#define ASIC_TAG_HI 31 ++#define ASIC_TAG_SZ 8 ++#define HCI_SW_RST_MSK 0x00000001 ++#define HCI_SW_RST_I_MSK 0xfffffffe ++#define HCI_SW_RST_SFT 0 ++#define HCI_SW_RST_HI 0 ++#define HCI_SW_RST_SZ 1 ++#define CO_PROC_SW_RST_MSK 0x00000002 ++#define CO_PROC_SW_RST_I_MSK 0xfffffffd ++#define CO_PROC_SW_RST_SFT 1 ++#define CO_PROC_SW_RST_HI 1 ++#define CO_PROC_SW_RST_SZ 1 ++#define MTX_MISC_SW_RST_MSK 0x00000008 ++#define MTX_MISC_SW_RST_I_MSK 0xfffffff7 ++#define MTX_MISC_SW_RST_SFT 3 ++#define MTX_MISC_SW_RST_HI 3 ++#define MTX_MISC_SW_RST_SZ 1 ++#define MTX_QUE_SW_RST_MSK 0x00000010 ++#define MTX_QUE_SW_RST_I_MSK 0xffffffef ++#define MTX_QUE_SW_RST_SFT 4 ++#define MTX_QUE_SW_RST_HI 4 ++#define MTX_QUE_SW_RST_SZ 1 ++#define MTX_CHST_SW_RST_MSK 0x00000020 ++#define MTX_CHST_SW_RST_I_MSK 0xffffffdf ++#define MTX_CHST_SW_RST_SFT 5 ++#define MTX_CHST_SW_RST_HI 5 ++#define MTX_CHST_SW_RST_SZ 1 ++#define MTX_BCN_SW_RST_MSK 0x00000040 ++#define MTX_BCN_SW_RST_I_MSK 0xffffffbf ++#define MTX_BCN_SW_RST_SFT 6 ++#define MTX_BCN_SW_RST_HI 6 ++#define MTX_BCN_SW_RST_SZ 1 ++#define MRX_SW_RST_MSK 0x00000080 ++#define MRX_SW_RST_I_MSK 0xffffff7f ++#define MRX_SW_RST_SFT 7 ++#define MRX_SW_RST_HI 7 ++#define MRX_SW_RST_SZ 1 ++#define AMPDU_SW_RST_MSK 0x00000100 ++#define AMPDU_SW_RST_I_MSK 0xfffffeff ++#define AMPDU_SW_RST_SFT 8 ++#define AMPDU_SW_RST_HI 8 ++#define AMPDU_SW_RST_SZ 1 ++#define MMU_SW_RST_MSK 0x00000200 ++#define MMU_SW_RST_I_MSK 0xfffffdff ++#define MMU_SW_RST_SFT 9 ++#define MMU_SW_RST_HI 9 ++#define MMU_SW_RST_SZ 1 ++#define ID_MNG_SW_RST_MSK 0x00000800 ++#define ID_MNG_SW_RST_I_MSK 0xfffff7ff ++#define ID_MNG_SW_RST_SFT 11 ++#define ID_MNG_SW_RST_HI 11 ++#define ID_MNG_SW_RST_SZ 1 ++#define MBOX_SW_RST_MSK 0x00001000 ++#define MBOX_SW_RST_I_MSK 0xffffefff ++#define MBOX_SW_RST_SFT 12 ++#define MBOX_SW_RST_HI 12 ++#define MBOX_SW_RST_SZ 1 ++#define SCRT_SW_RST_MSK 0x00002000 ++#define SCRT_SW_RST_I_MSK 0xffffdfff ++#define SCRT_SW_RST_SFT 13 ++#define SCRT_SW_RST_HI 13 ++#define SCRT_SW_RST_SZ 1 ++#define MIC_SW_RST_MSK 0x00004000 ++#define MIC_SW_RST_I_MSK 0xffffbfff ++#define MIC_SW_RST_SFT 14 ++#define MIC_SW_RST_HI 14 ++#define MIC_SW_RST_SZ 1 ++#define CO_PROC_ENG_RST_MSK 0x00000002 ++#define CO_PROC_ENG_RST_I_MSK 0xfffffffd ++#define CO_PROC_ENG_RST_SFT 1 ++#define CO_PROC_ENG_RST_HI 1 ++#define CO_PROC_ENG_RST_SZ 1 ++#define MTX_MISC_ENG_RST_MSK 0x00000008 ++#define MTX_MISC_ENG_RST_I_MSK 0xfffffff7 ++#define MTX_MISC_ENG_RST_SFT 3 ++#define MTX_MISC_ENG_RST_HI 3 ++#define MTX_MISC_ENG_RST_SZ 1 ++#define MTX_QUE_ENG_RST_MSK 0x00000010 ++#define MTX_QUE_ENG_RST_I_MSK 0xffffffef ++#define MTX_QUE_ENG_RST_SFT 4 ++#define MTX_QUE_ENG_RST_HI 4 ++#define MTX_QUE_ENG_RST_SZ 1 ++#define MTX_CHST_ENG_RST_MSK 0x00000020 ++#define MTX_CHST_ENG_RST_I_MSK 0xffffffdf ++#define MTX_CHST_ENG_RST_SFT 5 ++#define MTX_CHST_ENG_RST_HI 5 ++#define MTX_CHST_ENG_RST_SZ 1 ++#define MTX_BCN_ENG_RST_MSK 0x00000040 ++#define MTX_BCN_ENG_RST_I_MSK 0xffffffbf ++#define MTX_BCN_ENG_RST_SFT 6 ++#define MTX_BCN_ENG_RST_HI 6 ++#define MTX_BCN_ENG_RST_SZ 1 ++#define MRX_ENG_RST_MSK 0x00000080 ++#define MRX_ENG_RST_I_MSK 0xffffff7f ++#define MRX_ENG_RST_SFT 7 ++#define MRX_ENG_RST_HI 7 ++#define MRX_ENG_RST_SZ 1 ++#define AMPDU_ENG_RST_MSK 0x00000100 ++#define AMPDU_ENG_RST_I_MSK 0xfffffeff ++#define AMPDU_ENG_RST_SFT 8 ++#define AMPDU_ENG_RST_HI 8 ++#define AMPDU_ENG_RST_SZ 1 ++#define ID_MNG_ENG_RST_MSK 0x00004000 ++#define ID_MNG_ENG_RST_I_MSK 0xffffbfff ++#define ID_MNG_ENG_RST_SFT 14 ++#define ID_MNG_ENG_RST_HI 14 ++#define ID_MNG_ENG_RST_SZ 1 ++#define MBOX_ENG_RST_MSK 0x00008000 ++#define MBOX_ENG_RST_I_MSK 0xffff7fff ++#define MBOX_ENG_RST_SFT 15 ++#define MBOX_ENG_RST_HI 15 ++#define MBOX_ENG_RST_SZ 1 ++#define SCRT_ENG_RST_MSK 0x00010000 ++#define SCRT_ENG_RST_I_MSK 0xfffeffff ++#define SCRT_ENG_RST_SFT 16 ++#define SCRT_ENG_RST_HI 16 ++#define SCRT_ENG_RST_SZ 1 ++#define MIC_ENG_RST_MSK 0x00020000 ++#define MIC_ENG_RST_I_MSK 0xfffdffff ++#define MIC_ENG_RST_SFT 17 ++#define MIC_ENG_RST_HI 17 ++#define MIC_ENG_RST_SZ 1 ++#define CO_PROC_CSR_RST_MSK 0x00000002 ++#define CO_PROC_CSR_RST_I_MSK 0xfffffffd ++#define CO_PROC_CSR_RST_SFT 1 ++#define CO_PROC_CSR_RST_HI 1 ++#define CO_PROC_CSR_RST_SZ 1 ++#define MTX_MISC_CSR_RST_MSK 0x00000008 ++#define MTX_MISC_CSR_RST_I_MSK 0xfffffff7 ++#define MTX_MISC_CSR_RST_SFT 3 ++#define MTX_MISC_CSR_RST_HI 3 ++#define MTX_MISC_CSR_RST_SZ 1 ++#define MTX_QUE0_CSR_RST_MSK 0x00000010 ++#define MTX_QUE0_CSR_RST_I_MSK 0xffffffef ++#define MTX_QUE0_CSR_RST_SFT 4 ++#define MTX_QUE0_CSR_RST_HI 4 ++#define MTX_QUE0_CSR_RST_SZ 1 ++#define MTX_QUE1_CSR_RST_MSK 0x00000020 ++#define MTX_QUE1_CSR_RST_I_MSK 0xffffffdf ++#define MTX_QUE1_CSR_RST_SFT 5 ++#define MTX_QUE1_CSR_RST_HI 5 ++#define MTX_QUE1_CSR_RST_SZ 1 ++#define MTX_QUE2_CSR_RST_MSK 0x00000040 ++#define MTX_QUE2_CSR_RST_I_MSK 0xffffffbf ++#define MTX_QUE2_CSR_RST_SFT 6 ++#define MTX_QUE2_CSR_RST_HI 6 ++#define MTX_QUE2_CSR_RST_SZ 1 ++#define MTX_QUE3_CSR_RST_MSK 0x00000080 ++#define MTX_QUE3_CSR_RST_I_MSK 0xffffff7f ++#define MTX_QUE3_CSR_RST_SFT 7 ++#define MTX_QUE3_CSR_RST_HI 7 ++#define MTX_QUE3_CSR_RST_SZ 1 ++#define MTX_QUE4_CSR_RST_MSK 0x00000100 ++#define MTX_QUE4_CSR_RST_I_MSK 0xfffffeff ++#define MTX_QUE4_CSR_RST_SFT 8 ++#define MTX_QUE4_CSR_RST_HI 8 ++#define MTX_QUE4_CSR_RST_SZ 1 ++#define MTX_QUE5_CSR_RST_MSK 0x00000200 ++#define MTX_QUE5_CSR_RST_I_MSK 0xfffffdff ++#define MTX_QUE5_CSR_RST_SFT 9 ++#define MTX_QUE5_CSR_RST_HI 9 ++#define MTX_QUE5_CSR_RST_SZ 1 ++#define MRX_CSR_RST_MSK 0x00000400 ++#define MRX_CSR_RST_I_MSK 0xfffffbff ++#define MRX_CSR_RST_SFT 10 ++#define MRX_CSR_RST_HI 10 ++#define MRX_CSR_RST_SZ 1 ++#define AMPDU_CSR_RST_MSK 0x00000800 ++#define AMPDU_CSR_RST_I_MSK 0xfffff7ff ++#define AMPDU_CSR_RST_SFT 11 ++#define AMPDU_CSR_RST_HI 11 ++#define AMPDU_CSR_RST_SZ 1 ++#define SCRT_CSR_RST_MSK 0x00002000 ++#define SCRT_CSR_RST_I_MSK 0xffffdfff ++#define SCRT_CSR_RST_SFT 13 ++#define SCRT_CSR_RST_HI 13 ++#define SCRT_CSR_RST_SZ 1 ++#define ID_MNG_CSR_RST_MSK 0x00004000 ++#define ID_MNG_CSR_RST_I_MSK 0xffffbfff ++#define ID_MNG_CSR_RST_SFT 14 ++#define ID_MNG_CSR_RST_HI 14 ++#define ID_MNG_CSR_RST_SZ 1 ++#define MBOX_CSR_RST_MSK 0x00008000 ++#define MBOX_CSR_RST_I_MSK 0xffff7fff ++#define MBOX_CSR_RST_SFT 15 ++#define MBOX_CSR_RST_HI 15 ++#define MBOX_CSR_RST_SZ 1 ++#define HCI_CLK_EN_MSK 0x00000001 ++#define HCI_CLK_EN_I_MSK 0xfffffffe ++#define HCI_CLK_EN_SFT 0 ++#define HCI_CLK_EN_HI 0 ++#define HCI_CLK_EN_SZ 1 ++#define CO_PROC_CLK_EN_MSK 0x00000002 ++#define CO_PROC_CLK_EN_I_MSK 0xfffffffd ++#define CO_PROC_CLK_EN_SFT 1 ++#define CO_PROC_CLK_EN_HI 1 ++#define CO_PROC_CLK_EN_SZ 1 ++#define MTX_MISC_CLK_EN_MSK 0x00000008 ++#define MTX_MISC_CLK_EN_I_MSK 0xfffffff7 ++#define MTX_MISC_CLK_EN_SFT 3 ++#define MTX_MISC_CLK_EN_HI 3 ++#define MTX_MISC_CLK_EN_SZ 1 ++#define MTX_QUE_CLK_EN_MSK 0x00000010 ++#define MTX_QUE_CLK_EN_I_MSK 0xffffffef ++#define MTX_QUE_CLK_EN_SFT 4 ++#define MTX_QUE_CLK_EN_HI 4 ++#define MTX_QUE_CLK_EN_SZ 1 ++#define MRX_CLK_EN_MSK 0x00000020 ++#define MRX_CLK_EN_I_MSK 0xffffffdf ++#define MRX_CLK_EN_SFT 5 ++#define MRX_CLK_EN_HI 5 ++#define MRX_CLK_EN_SZ 1 ++#define AMPDU_CLK_EN_MSK 0x00000040 ++#define AMPDU_CLK_EN_I_MSK 0xffffffbf ++#define AMPDU_CLK_EN_SFT 6 ++#define AMPDU_CLK_EN_HI 6 ++#define AMPDU_CLK_EN_SZ 1 ++#define MMU_CLK_EN_MSK 0x00000080 ++#define MMU_CLK_EN_I_MSK 0xffffff7f ++#define MMU_CLK_EN_SFT 7 ++#define MMU_CLK_EN_HI 7 ++#define MMU_CLK_EN_SZ 1 ++#define ID_MNG_CLK_EN_MSK 0x00000200 ++#define ID_MNG_CLK_EN_I_MSK 0xfffffdff ++#define ID_MNG_CLK_EN_SFT 9 ++#define ID_MNG_CLK_EN_HI 9 ++#define ID_MNG_CLK_EN_SZ 1 ++#define MBOX_CLK_EN_MSK 0x00000400 ++#define MBOX_CLK_EN_I_MSK 0xfffffbff ++#define MBOX_CLK_EN_SFT 10 ++#define MBOX_CLK_EN_HI 10 ++#define MBOX_CLK_EN_SZ 1 ++#define SCRT_CLK_EN_MSK 0x00000800 ++#define SCRT_CLK_EN_I_MSK 0xfffff7ff ++#define SCRT_CLK_EN_SFT 11 ++#define SCRT_CLK_EN_HI 11 ++#define SCRT_CLK_EN_SZ 1 ++#define MIC_CLK_EN_MSK 0x00001000 ++#define MIC_CLK_EN_I_MSK 0xffffefff ++#define MIC_CLK_EN_SFT 12 ++#define MIC_CLK_EN_HI 12 ++#define MIC_CLK_EN_SZ 1 ++#define MIB_CLK_EN_MSK 0x00002000 ++#define MIB_CLK_EN_I_MSK 0xffffdfff ++#define MIB_CLK_EN_SFT 13 ++#define MIB_CLK_EN_HI 13 ++#define MIB_CLK_EN_SZ 1 ++#define HCI_ENG_CLK_EN_MSK 0x00000001 ++#define HCI_ENG_CLK_EN_I_MSK 0xfffffffe ++#define HCI_ENG_CLK_EN_SFT 0 ++#define HCI_ENG_CLK_EN_HI 0 ++#define HCI_ENG_CLK_EN_SZ 1 ++#define CO_PROC_ENG_CLK_EN_MSK 0x00000002 ++#define CO_PROC_ENG_CLK_EN_I_MSK 0xfffffffd ++#define CO_PROC_ENG_CLK_EN_SFT 1 ++#define CO_PROC_ENG_CLK_EN_HI 1 ++#define CO_PROC_ENG_CLK_EN_SZ 1 ++#define MTX_MISC_ENG_CLK_EN_MSK 0x00000008 ++#define MTX_MISC_ENG_CLK_EN_I_MSK 0xfffffff7 ++#define MTX_MISC_ENG_CLK_EN_SFT 3 ++#define MTX_MISC_ENG_CLK_EN_HI 3 ++#define MTX_MISC_ENG_CLK_EN_SZ 1 ++#define MTX_QUE_ENG_CLK_EN_MSK 0x00000010 ++#define MTX_QUE_ENG_CLK_EN_I_MSK 0xffffffef ++#define MTX_QUE_ENG_CLK_EN_SFT 4 ++#define MTX_QUE_ENG_CLK_EN_HI 4 ++#define MTX_QUE_ENG_CLK_EN_SZ 1 ++#define MRX_ENG_CLK_EN_MSK 0x00000020 ++#define MRX_ENG_CLK_EN_I_MSK 0xffffffdf ++#define MRX_ENG_CLK_EN_SFT 5 ++#define MRX_ENG_CLK_EN_HI 5 ++#define MRX_ENG_CLK_EN_SZ 1 ++#define AMPDU_ENG_CLK_EN_MSK 0x00000040 ++#define AMPDU_ENG_CLK_EN_I_MSK 0xffffffbf ++#define AMPDU_ENG_CLK_EN_SFT 6 ++#define AMPDU_ENG_CLK_EN_HI 6 ++#define AMPDU_ENG_CLK_EN_SZ 1 ++#define ID_MNG_ENG_CLK_EN_MSK 0x00001000 ++#define ID_MNG_ENG_CLK_EN_I_MSK 0xffffefff ++#define ID_MNG_ENG_CLK_EN_SFT 12 ++#define ID_MNG_ENG_CLK_EN_HI 12 ++#define ID_MNG_ENG_CLK_EN_SZ 1 ++#define MBOX_ENG_CLK_EN_MSK 0x00002000 ++#define MBOX_ENG_CLK_EN_I_MSK 0xffffdfff ++#define MBOX_ENG_CLK_EN_SFT 13 ++#define MBOX_ENG_CLK_EN_HI 13 ++#define MBOX_ENG_CLK_EN_SZ 1 ++#define SCRT_ENG_CLK_EN_MSK 0x00004000 ++#define SCRT_ENG_CLK_EN_I_MSK 0xffffbfff ++#define SCRT_ENG_CLK_EN_SFT 14 ++#define SCRT_ENG_CLK_EN_HI 14 ++#define SCRT_ENG_CLK_EN_SZ 1 ++#define MIC_ENG_CLK_EN_MSK 0x00008000 ++#define MIC_ENG_CLK_EN_I_MSK 0xffff7fff ++#define MIC_ENG_CLK_EN_SFT 15 ++#define MIC_ENG_CLK_EN_HI 15 ++#define MIC_ENG_CLK_EN_SZ 1 ++#define CO_PROC_CSR_CLK_EN_MSK 0x00000002 ++#define CO_PROC_CSR_CLK_EN_I_MSK 0xfffffffd ++#define CO_PROC_CSR_CLK_EN_SFT 1 ++#define CO_PROC_CSR_CLK_EN_HI 1 ++#define CO_PROC_CSR_CLK_EN_SZ 1 ++#define MRX_CSR_CLK_EN_MSK 0x00000400 ++#define MRX_CSR_CLK_EN_I_MSK 0xfffffbff ++#define MRX_CSR_CLK_EN_SFT 10 ++#define MRX_CSR_CLK_EN_HI 10 ++#define MRX_CSR_CLK_EN_SZ 1 ++#define AMPDU_CSR_CLK_EN_MSK 0x00000800 ++#define AMPDU_CSR_CLK_EN_I_MSK 0xfffff7ff ++#define AMPDU_CSR_CLK_EN_SFT 11 ++#define AMPDU_CSR_CLK_EN_HI 11 ++#define AMPDU_CSR_CLK_EN_SZ 1 ++#define SCRT_CSR_CLK_EN_MSK 0x00002000 ++#define SCRT_CSR_CLK_EN_I_MSK 0xffffdfff ++#define SCRT_CSR_CLK_EN_SFT 13 ++#define SCRT_CSR_CLK_EN_HI 13 ++#define SCRT_CSR_CLK_EN_SZ 1 ++#define ID_MNG_CSR_CLK_EN_MSK 0x00004000 ++#define ID_MNG_CSR_CLK_EN_I_MSK 0xffffbfff ++#define ID_MNG_CSR_CLK_EN_SFT 14 ++#define ID_MNG_CSR_CLK_EN_HI 14 ++#define ID_MNG_CSR_CLK_EN_SZ 1 ++#define MBOX_CSR_CLK_EN_MSK 0x00008000 ++#define MBOX_CSR_CLK_EN_I_MSK 0xffff7fff ++#define MBOX_CSR_CLK_EN_SFT 15 ++#define MBOX_CSR_CLK_EN_HI 15 ++#define MBOX_CSR_CLK_EN_SZ 1 ++#define OP_MODE_MSK 0x00000003 ++#define OP_MODE_I_MSK 0xfffffffc ++#define OP_MODE_SFT 0 ++#define OP_MODE_HI 1 ++#define OP_MODE_SZ 2 ++#define HT_MODE_MSK 0x0000000c ++#define HT_MODE_I_MSK 0xfffffff3 ++#define HT_MODE_SFT 2 ++#define HT_MODE_HI 3 ++#define HT_MODE_SZ 2 ++#define QOS_EN_MSK 0x00000010 ++#define QOS_EN_I_MSK 0xffffffef ++#define QOS_EN_SFT 4 ++#define QOS_EN_HI 4 ++#define QOS_EN_SZ 1 ++#define PB_OFFSET_MSK 0x0000ff00 ++#define PB_OFFSET_I_MSK 0xffff00ff ++#define PB_OFFSET_SFT 8 ++#define PB_OFFSET_HI 15 ++#define PB_OFFSET_SZ 8 ++#define SNIFFER_MODE_MSK 0x00010000 ++#define SNIFFER_MODE_I_MSK 0xfffeffff ++#define SNIFFER_MODE_SFT 16 ++#define SNIFFER_MODE_HI 16 ++#define SNIFFER_MODE_SZ 1 ++#define DUP_FLT_MSK 0x00020000 ++#define DUP_FLT_I_MSK 0xfffdffff ++#define DUP_FLT_SFT 17 ++#define DUP_FLT_HI 17 ++#define DUP_FLT_SZ 1 ++#define TX_PKT_RSVD_MSK 0x001c0000 ++#define TX_PKT_RSVD_I_MSK 0xffe3ffff ++#define TX_PKT_RSVD_SFT 18 ++#define TX_PKT_RSVD_HI 20 ++#define TX_PKT_RSVD_SZ 3 ++#define AMPDU_SNIFFER_MSK 0x00200000 ++#define AMPDU_SNIFFER_I_MSK 0xffdfffff ++#define AMPDU_SNIFFER_SFT 21 ++#define AMPDU_SNIFFER_HI 21 ++#define AMPDU_SNIFFER_SZ 1 ++#define REASON_TRAP0_MSK 0xffffffff ++#define REASON_TRAP0_I_MSK 0x00000000 ++#define REASON_TRAP0_SFT 0 ++#define REASON_TRAP0_HI 31 ++#define REASON_TRAP0_SZ 32 ++#define REASON_TRAP1_MSK 0xffffffff ++#define REASON_TRAP1_I_MSK 0x00000000 ++#define REASON_TRAP1_SFT 0 ++#define REASON_TRAP1_HI 31 ++#define REASON_TRAP1_SZ 32 ++#define BSSID_31_0_MSK 0xffffffff ++#define BSSID_31_0_I_MSK 0x00000000 ++#define BSSID_31_0_SFT 0 ++#define BSSID_31_0_HI 31 ++#define BSSID_31_0_SZ 32 ++#define BSSID_47_32_MSK 0x0000ffff ++#define BSSID_47_32_I_MSK 0xffff0000 ++#define BSSID_47_32_SFT 0 ++#define BSSID_47_32_HI 15 ++#define BSSID_47_32_SZ 16 ++#define SCRT_STATE_MSK 0x0000000f ++#define SCRT_STATE_I_MSK 0xfffffff0 ++#define SCRT_STATE_SFT 0 ++#define SCRT_STATE_HI 3 ++#define SCRT_STATE_SZ 4 ++#define STA_MAC_31_0_MSK 0xffffffff ++#define STA_MAC_31_0_I_MSK 0x00000000 ++#define STA_MAC_31_0_SFT 0 ++#define STA_MAC_31_0_HI 31 ++#define STA_MAC_31_0_SZ 32 ++#define STA_MAC_47_32_MSK 0x0000ffff ++#define STA_MAC_47_32_I_MSK 0xffff0000 ++#define STA_MAC_47_32_SFT 0 ++#define STA_MAC_47_32_HI 15 ++#define STA_MAC_47_32_SZ 16 ++#define PAIR_SCRT_MSK 0x00000007 ++#define PAIR_SCRT_I_MSK 0xfffffff8 ++#define PAIR_SCRT_SFT 0 ++#define PAIR_SCRT_HI 2 ++#define PAIR_SCRT_SZ 3 ++#define GRP_SCRT_MSK 0x00000038 ++#define GRP_SCRT_I_MSK 0xffffffc7 ++#define GRP_SCRT_SFT 3 ++#define GRP_SCRT_HI 5 ++#define GRP_SCRT_SZ 3 ++#define SCRT_PKT_ID_MSK 0x00001fc0 ++#define SCRT_PKT_ID_I_MSK 0xffffe03f ++#define SCRT_PKT_ID_SFT 6 ++#define SCRT_PKT_ID_HI 12 ++#define SCRT_PKT_ID_SZ 7 ++#define SCRT_RPLY_IGNORE_MSK 0x00010000 ++#define SCRT_RPLY_IGNORE_I_MSK 0xfffeffff ++#define SCRT_RPLY_IGNORE_SFT 16 ++#define SCRT_RPLY_IGNORE_HI 16 ++#define SCRT_RPLY_IGNORE_SZ 1 ++#define COEXIST_EN_MSK 0x00000001 ++#define COEXIST_EN_I_MSK 0xfffffffe ++#define COEXIST_EN_SFT 0 ++#define COEXIST_EN_HI 0 ++#define COEXIST_EN_SZ 1 ++#define WIRE_MODE_MSK 0x0000000e ++#define WIRE_MODE_I_MSK 0xfffffff1 ++#define WIRE_MODE_SFT 1 ++#define WIRE_MODE_HI 3 ++#define WIRE_MODE_SZ 3 ++#define WL_RX_PRI_MSK 0x00000010 ++#define WL_RX_PRI_I_MSK 0xffffffef ++#define WL_RX_PRI_SFT 4 ++#define WL_RX_PRI_HI 4 ++#define WL_RX_PRI_SZ 1 ++#define WL_TX_PRI_MSK 0x00000020 ++#define WL_TX_PRI_I_MSK 0xffffffdf ++#define WL_TX_PRI_SFT 5 ++#define WL_TX_PRI_HI 5 ++#define WL_TX_PRI_SZ 1 ++#define GURAN_USE_EN_MSK 0x00000100 ++#define GURAN_USE_EN_I_MSK 0xfffffeff ++#define GURAN_USE_EN_SFT 8 ++#define GURAN_USE_EN_HI 8 ++#define GURAN_USE_EN_SZ 1 ++#define GURAN_USE_CTRL_MSK 0x00000200 ++#define GURAN_USE_CTRL_I_MSK 0xfffffdff ++#define GURAN_USE_CTRL_SFT 9 ++#define GURAN_USE_CTRL_HI 9 ++#define GURAN_USE_CTRL_SZ 1 ++#define BEACON_TIMEOUT_EN_MSK 0x00000400 ++#define BEACON_TIMEOUT_EN_I_MSK 0xfffffbff ++#define BEACON_TIMEOUT_EN_SFT 10 ++#define BEACON_TIMEOUT_EN_HI 10 ++#define BEACON_TIMEOUT_EN_SZ 1 ++#define WLAN_ACT_POL_MSK 0x00000800 ++#define WLAN_ACT_POL_I_MSK 0xfffff7ff ++#define WLAN_ACT_POL_SFT 11 ++#define WLAN_ACT_POL_HI 11 ++#define WLAN_ACT_POL_SZ 1 ++#define DUAL_ANT_EN_MSK 0x00001000 ++#define DUAL_ANT_EN_I_MSK 0xffffefff ++#define DUAL_ANT_EN_SFT 12 ++#define DUAL_ANT_EN_HI 12 ++#define DUAL_ANT_EN_SZ 1 ++#define TRSW_PHY_POL_MSK 0x00010000 ++#define TRSW_PHY_POL_I_MSK 0xfffeffff ++#define TRSW_PHY_POL_SFT 16 ++#define TRSW_PHY_POL_HI 16 ++#define TRSW_PHY_POL_SZ 1 ++#define WIFI_TX_SW_POL_MSK 0x00020000 ++#define WIFI_TX_SW_POL_I_MSK 0xfffdffff ++#define WIFI_TX_SW_POL_SFT 17 ++#define WIFI_TX_SW_POL_HI 17 ++#define WIFI_TX_SW_POL_SZ 1 ++#define WIFI_RX_SW_POL_MSK 0x00040000 ++#define WIFI_RX_SW_POL_I_MSK 0xfffbffff ++#define WIFI_RX_SW_POL_SFT 18 ++#define WIFI_RX_SW_POL_HI 18 ++#define WIFI_RX_SW_POL_SZ 1 ++#define BT_SW_POL_MSK 0x00080000 ++#define BT_SW_POL_I_MSK 0xfff7ffff ++#define BT_SW_POL_SFT 19 ++#define BT_SW_POL_HI 19 ++#define BT_SW_POL_SZ 1 ++#define BT_PRI_SMP_TIME_MSK 0x000000ff ++#define BT_PRI_SMP_TIME_I_MSK 0xffffff00 ++#define BT_PRI_SMP_TIME_SFT 0 ++#define BT_PRI_SMP_TIME_HI 7 ++#define BT_PRI_SMP_TIME_SZ 8 ++#define BT_STA_SMP_TIME_MSK 0x0000ff00 ++#define BT_STA_SMP_TIME_I_MSK 0xffff00ff ++#define BT_STA_SMP_TIME_SFT 8 ++#define BT_STA_SMP_TIME_HI 15 ++#define BT_STA_SMP_TIME_SZ 8 ++#define BEACON_TIMEOUT_MSK 0x00ff0000 ++#define BEACON_TIMEOUT_I_MSK 0xff00ffff ++#define BEACON_TIMEOUT_SFT 16 ++#define BEACON_TIMEOUT_HI 23 ++#define BEACON_TIMEOUT_SZ 8 ++#define WLAN_REMAIN_TIME_MSK 0xff000000 ++#define WLAN_REMAIN_TIME_I_MSK 0x00ffffff ++#define WLAN_REMAIN_TIME_SFT 24 ++#define WLAN_REMAIN_TIME_HI 31 ++#define WLAN_REMAIN_TIME_SZ 8 ++#define SW_MANUAL_EN_MSK 0x00000001 ++#define SW_MANUAL_EN_I_MSK 0xfffffffe ++#define SW_MANUAL_EN_SFT 0 ++#define SW_MANUAL_EN_HI 0 ++#define SW_MANUAL_EN_SZ 1 ++#define SW_WL_TX_MSK 0x00000002 ++#define SW_WL_TX_I_MSK 0xfffffffd ++#define SW_WL_TX_SFT 1 ++#define SW_WL_TX_HI 1 ++#define SW_WL_TX_SZ 1 ++#define SW_WL_RX_MSK 0x00000004 ++#define SW_WL_RX_I_MSK 0xfffffffb ++#define SW_WL_RX_SFT 2 ++#define SW_WL_RX_HI 2 ++#define SW_WL_RX_SZ 1 ++#define SW_BT_TRX_MSK 0x00000008 ++#define SW_BT_TRX_I_MSK 0xfffffff7 ++#define SW_BT_TRX_SFT 3 ++#define SW_BT_TRX_HI 3 ++#define SW_BT_TRX_SZ 1 ++#define BT_TXBAR_MANUAL_EN_MSK 0x00000010 ++#define BT_TXBAR_MANUAL_EN_I_MSK 0xffffffef ++#define BT_TXBAR_MANUAL_EN_SFT 4 ++#define BT_TXBAR_MANUAL_EN_HI 4 ++#define BT_TXBAR_MANUAL_EN_SZ 1 ++#define BT_TXBAR_SET_MSK 0x00000020 ++#define BT_TXBAR_SET_I_MSK 0xffffffdf ++#define BT_TXBAR_SET_SFT 5 ++#define BT_TXBAR_SET_HI 5 ++#define BT_TXBAR_SET_SZ 1 ++#define BT_BUSY_MANUAL_EN_MSK 0x00000100 ++#define BT_BUSY_MANUAL_EN_I_MSK 0xfffffeff ++#define BT_BUSY_MANUAL_EN_SFT 8 ++#define BT_BUSY_MANUAL_EN_HI 8 ++#define BT_BUSY_MANUAL_EN_SZ 1 ++#define BT_BUSY_SET_MSK 0x00000200 ++#define BT_BUSY_SET_I_MSK 0xfffffdff ++#define BT_BUSY_SET_SFT 9 ++#define BT_BUSY_SET_HI 9 ++#define BT_BUSY_SET_SZ 1 ++#define G0_PKT_CLS_MIB_EN_MSK 0x00000004 ++#define G0_PKT_CLS_MIB_EN_I_MSK 0xfffffffb ++#define G0_PKT_CLS_MIB_EN_SFT 2 ++#define G0_PKT_CLS_MIB_EN_HI 2 ++#define G0_PKT_CLS_MIB_EN_SZ 1 ++#define G0_PKT_CLS_ONGOING_MSK 0x00000008 ++#define G0_PKT_CLS_ONGOING_I_MSK 0xfffffff7 ++#define G0_PKT_CLS_ONGOING_SFT 3 ++#define G0_PKT_CLS_ONGOING_HI 3 ++#define G0_PKT_CLS_ONGOING_SZ 1 ++#define G1_PKT_CLS_MIB_EN_MSK 0x00000010 ++#define G1_PKT_CLS_MIB_EN_I_MSK 0xffffffef ++#define G1_PKT_CLS_MIB_EN_SFT 4 ++#define G1_PKT_CLS_MIB_EN_HI 4 ++#define G1_PKT_CLS_MIB_EN_SZ 1 ++#define G1_PKT_CLS_ONGOING_MSK 0x00000020 ++#define G1_PKT_CLS_ONGOING_I_MSK 0xffffffdf ++#define G1_PKT_CLS_ONGOING_SFT 5 ++#define G1_PKT_CLS_ONGOING_HI 5 ++#define G1_PKT_CLS_ONGOING_SZ 1 ++#define Q0_PKT_CLS_MIB_EN_MSK 0x00000040 ++#define Q0_PKT_CLS_MIB_EN_I_MSK 0xffffffbf ++#define Q0_PKT_CLS_MIB_EN_SFT 6 ++#define Q0_PKT_CLS_MIB_EN_HI 6 ++#define Q0_PKT_CLS_MIB_EN_SZ 1 ++#define Q0_PKT_CLS_ONGOING_MSK 0x00000080 ++#define Q0_PKT_CLS_ONGOING_I_MSK 0xffffff7f ++#define Q0_PKT_CLS_ONGOING_SFT 7 ++#define Q0_PKT_CLS_ONGOING_HI 7 ++#define Q0_PKT_CLS_ONGOING_SZ 1 ++#define Q1_PKT_CLS_MIB_EN_MSK 0x00000100 ++#define Q1_PKT_CLS_MIB_EN_I_MSK 0xfffffeff ++#define Q1_PKT_CLS_MIB_EN_SFT 8 ++#define Q1_PKT_CLS_MIB_EN_HI 8 ++#define Q1_PKT_CLS_MIB_EN_SZ 1 ++#define Q1_PKT_CLS_ONGOING_MSK 0x00000200 ++#define Q1_PKT_CLS_ONGOING_I_MSK 0xfffffdff ++#define Q1_PKT_CLS_ONGOING_SFT 9 ++#define Q1_PKT_CLS_ONGOING_HI 9 ++#define Q1_PKT_CLS_ONGOING_SZ 1 ++#define Q2_PKT_CLS_MIB_EN_MSK 0x00000400 ++#define Q2_PKT_CLS_MIB_EN_I_MSK 0xfffffbff ++#define Q2_PKT_CLS_MIB_EN_SFT 10 ++#define Q2_PKT_CLS_MIB_EN_HI 10 ++#define Q2_PKT_CLS_MIB_EN_SZ 1 ++#define Q2_PKT_CLS_ONGOING_MSK 0x00000800 ++#define Q2_PKT_CLS_ONGOING_I_MSK 0xfffff7ff ++#define Q2_PKT_CLS_ONGOING_SFT 11 ++#define Q2_PKT_CLS_ONGOING_HI 11 ++#define Q2_PKT_CLS_ONGOING_SZ 1 ++#define Q3_PKT_CLS_MIB_EN_MSK 0x00001000 ++#define Q3_PKT_CLS_MIB_EN_I_MSK 0xffffefff ++#define Q3_PKT_CLS_MIB_EN_SFT 12 ++#define Q3_PKT_CLS_MIB_EN_HI 12 ++#define Q3_PKT_CLS_MIB_EN_SZ 1 ++#define Q3_PKT_CLS_ONGOING_MSK 0x00002000 ++#define Q3_PKT_CLS_ONGOING_I_MSK 0xffffdfff ++#define Q3_PKT_CLS_ONGOING_SFT 13 ++#define Q3_PKT_CLS_ONGOING_HI 13 ++#define Q3_PKT_CLS_ONGOING_SZ 1 ++#define SCRT_PKT_CLS_MIB_EN_MSK 0x00004000 ++#define SCRT_PKT_CLS_MIB_EN_I_MSK 0xffffbfff ++#define SCRT_PKT_CLS_MIB_EN_SFT 14 ++#define SCRT_PKT_CLS_MIB_EN_HI 14 ++#define SCRT_PKT_CLS_MIB_EN_SZ 1 ++#define SCRT_PKT_CLS_ONGOING_MSK 0x00008000 ++#define SCRT_PKT_CLS_ONGOING_I_MSK 0xffff7fff ++#define SCRT_PKT_CLS_ONGOING_SFT 15 ++#define SCRT_PKT_CLS_ONGOING_HI 15 ++#define SCRT_PKT_CLS_ONGOING_SZ 1 ++#define MISC_PKT_CLS_MIB_EN_MSK 0x00010000 ++#define MISC_PKT_CLS_MIB_EN_I_MSK 0xfffeffff ++#define MISC_PKT_CLS_MIB_EN_SFT 16 ++#define MISC_PKT_CLS_MIB_EN_HI 16 ++#define MISC_PKT_CLS_MIB_EN_SZ 1 ++#define MISC_PKT_CLS_ONGOING_MSK 0x00020000 ++#define MISC_PKT_CLS_ONGOING_I_MSK 0xfffdffff ++#define MISC_PKT_CLS_ONGOING_SFT 17 ++#define MISC_PKT_CLS_ONGOING_HI 17 ++#define MISC_PKT_CLS_ONGOING_SZ 1 ++#define MTX_WSID0_SUCC_MSK 0x0000ffff ++#define MTX_WSID0_SUCC_I_MSK 0xffff0000 ++#define MTX_WSID0_SUCC_SFT 0 ++#define MTX_WSID0_SUCC_HI 15 ++#define MTX_WSID0_SUCC_SZ 16 ++#define MTX_WSID0_FRM_MSK 0x0000ffff ++#define MTX_WSID0_FRM_I_MSK 0xffff0000 ++#define MTX_WSID0_FRM_SFT 0 ++#define MTX_WSID0_FRM_HI 15 ++#define MTX_WSID0_FRM_SZ 16 ++#define MTX_WSID0_RETRY_MSK 0x0000ffff ++#define MTX_WSID0_RETRY_I_MSK 0xffff0000 ++#define MTX_WSID0_RETRY_SFT 0 ++#define MTX_WSID0_RETRY_HI 15 ++#define MTX_WSID0_RETRY_SZ 16 ++#define MTX_WSID0_TOTAL_MSK 0x0000ffff ++#define MTX_WSID0_TOTAL_I_MSK 0xffff0000 ++#define MTX_WSID0_TOTAL_SFT 0 ++#define MTX_WSID0_TOTAL_HI 15 ++#define MTX_WSID0_TOTAL_SZ 16 ++#define MTX_GRP_MSK 0x000fffff ++#define MTX_GRP_I_MSK 0xfff00000 ++#define MTX_GRP_SFT 0 ++#define MTX_GRP_HI 19 ++#define MTX_GRP_SZ 20 ++#define MTX_FAIL_MSK 0x0000ffff ++#define MTX_FAIL_I_MSK 0xffff0000 ++#define MTX_FAIL_SFT 0 ++#define MTX_FAIL_HI 15 ++#define MTX_FAIL_SZ 16 ++#define MTX_RETRY_MSK 0x000fffff ++#define MTX_RETRY_I_MSK 0xfff00000 ++#define MTX_RETRY_SFT 0 ++#define MTX_RETRY_HI 19 ++#define MTX_RETRY_SZ 20 ++#define MTX_MULTI_RETRY_MSK 0x000fffff ++#define MTX_MULTI_RETRY_I_MSK 0xfff00000 ++#define MTX_MULTI_RETRY_SFT 0 ++#define MTX_MULTI_RETRY_HI 19 ++#define MTX_MULTI_RETRY_SZ 20 ++#define MTX_RTS_SUCC_MSK 0x0000ffff ++#define MTX_RTS_SUCC_I_MSK 0xffff0000 ++#define MTX_RTS_SUCC_SFT 0 ++#define MTX_RTS_SUCC_HI 15 ++#define MTX_RTS_SUCC_SZ 16 ++#define MTX_RTS_FAIL_MSK 0x0000ffff ++#define MTX_RTS_FAIL_I_MSK 0xffff0000 ++#define MTX_RTS_FAIL_SFT 0 ++#define MTX_RTS_FAIL_HI 15 ++#define MTX_RTS_FAIL_SZ 16 ++#define MTX_ACK_FAIL_MSK 0x0000ffff ++#define MTX_ACK_FAIL_I_MSK 0xffff0000 ++#define MTX_ACK_FAIL_SFT 0 ++#define MTX_ACK_FAIL_HI 15 ++#define MTX_ACK_FAIL_SZ 16 ++#define MTX_FRM_MSK 0x000fffff ++#define MTX_FRM_I_MSK 0xfff00000 ++#define MTX_FRM_SFT 0 ++#define MTX_FRM_HI 19 ++#define MTX_FRM_SZ 20 ++#define MTX_ACK_TX_MSK 0x0000ffff ++#define MTX_ACK_TX_I_MSK 0xffff0000 ++#define MTX_ACK_TX_SFT 0 ++#define MTX_ACK_TX_HI 15 ++#define MTX_ACK_TX_SZ 16 ++#define MTX_CTS_TX_MSK 0x0000ffff ++#define MTX_CTS_TX_I_MSK 0xffff0000 ++#define MTX_CTS_TX_SFT 0 ++#define MTX_CTS_TX_HI 15 ++#define MTX_CTS_TX_SZ 16 ++#define MRX_DUP_MSK 0x0000ffff ++#define MRX_DUP_I_MSK 0xffff0000 ++#define MRX_DUP_SFT 0 ++#define MRX_DUP_HI 15 ++#define MRX_DUP_SZ 16 ++#define MRX_FRG_MSK 0x000fffff ++#define MRX_FRG_I_MSK 0xfff00000 ++#define MRX_FRG_SFT 0 ++#define MRX_FRG_HI 19 ++#define MRX_FRG_SZ 20 ++#define MRX_GRP_MSK 0x000fffff ++#define MRX_GRP_I_MSK 0xfff00000 ++#define MRX_GRP_SFT 0 ++#define MRX_GRP_HI 19 ++#define MRX_GRP_SZ 20 ++#define MRX_FCS_ERR_MSK 0x0000ffff ++#define MRX_FCS_ERR_I_MSK 0xffff0000 ++#define MRX_FCS_ERR_SFT 0 ++#define MRX_FCS_ERR_HI 15 ++#define MRX_FCS_ERR_SZ 16 ++#define MRX_FCS_SUC_MSK 0x0000ffff ++#define MRX_FCS_SUC_I_MSK 0xffff0000 ++#define MRX_FCS_SUC_SFT 0 ++#define MRX_FCS_SUC_HI 15 ++#define MRX_FCS_SUC_SZ 16 ++#define MRX_MISS_MSK 0x0000ffff ++#define MRX_MISS_I_MSK 0xffff0000 ++#define MRX_MISS_SFT 0 ++#define MRX_MISS_HI 15 ++#define MRX_MISS_SZ 16 ++#define MRX_ALC_FAIL_MSK 0x0000ffff ++#define MRX_ALC_FAIL_I_MSK 0xffff0000 ++#define MRX_ALC_FAIL_SFT 0 ++#define MRX_ALC_FAIL_HI 15 ++#define MRX_ALC_FAIL_SZ 16 ++#define MRX_DAT_NTF_MSK 0x0000ffff ++#define MRX_DAT_NTF_I_MSK 0xffff0000 ++#define MRX_DAT_NTF_SFT 0 ++#define MRX_DAT_NTF_HI 15 ++#define MRX_DAT_NTF_SZ 16 ++#define MRX_RTS_NTF_MSK 0x0000ffff ++#define MRX_RTS_NTF_I_MSK 0xffff0000 ++#define MRX_RTS_NTF_SFT 0 ++#define MRX_RTS_NTF_HI 15 ++#define MRX_RTS_NTF_SZ 16 ++#define MRX_CTS_NTF_MSK 0x0000ffff ++#define MRX_CTS_NTF_I_MSK 0xffff0000 ++#define MRX_CTS_NTF_SFT 0 ++#define MRX_CTS_NTF_HI 15 ++#define MRX_CTS_NTF_SZ 16 ++#define MRX_ACK_NTF_MSK 0x0000ffff ++#define MRX_ACK_NTF_I_MSK 0xffff0000 ++#define MRX_ACK_NTF_SFT 0 ++#define MRX_ACK_NTF_HI 15 ++#define MRX_ACK_NTF_SZ 16 ++#define MRX_BA_NTF_MSK 0x0000ffff ++#define MRX_BA_NTF_I_MSK 0xffff0000 ++#define MRX_BA_NTF_SFT 0 ++#define MRX_BA_NTF_HI 15 ++#define MRX_BA_NTF_SZ 16 ++#define MRX_DATA_NTF_MSK 0x0000ffff ++#define MRX_DATA_NTF_I_MSK 0xffff0000 ++#define MRX_DATA_NTF_SFT 0 ++#define MRX_DATA_NTF_HI 15 ++#define MRX_DATA_NTF_SZ 16 ++#define MRX_MNG_NTF_MSK 0x0000ffff ++#define MRX_MNG_NTF_I_MSK 0xffff0000 ++#define MRX_MNG_NTF_SFT 0 ++#define MRX_MNG_NTF_HI 15 ++#define MRX_MNG_NTF_SZ 16 ++#define MRX_DAT_CRC_NTF_MSK 0x0000ffff ++#define MRX_DAT_CRC_NTF_I_MSK 0xffff0000 ++#define MRX_DAT_CRC_NTF_SFT 0 ++#define MRX_DAT_CRC_NTF_HI 15 ++#define MRX_DAT_CRC_NTF_SZ 16 ++#define MRX_BAR_NTF_MSK 0x0000ffff ++#define MRX_BAR_NTF_I_MSK 0xffff0000 ++#define MRX_BAR_NTF_SFT 0 ++#define MRX_BAR_NTF_HI 15 ++#define MRX_BAR_NTF_SZ 16 ++#define MRX_MB_MISS_MSK 0x0000ffff ++#define MRX_MB_MISS_I_MSK 0xffff0000 ++#define MRX_MB_MISS_SFT 0 ++#define MRX_MB_MISS_HI 15 ++#define MRX_MB_MISS_SZ 16 ++#define MRX_NIDLE_MISS_MSK 0x0000ffff ++#define MRX_NIDLE_MISS_I_MSK 0xffff0000 ++#define MRX_NIDLE_MISS_SFT 0 ++#define MRX_NIDLE_MISS_HI 15 ++#define MRX_NIDLE_MISS_SZ 16 ++#define MRX_CSR_NTF_MSK 0x0000ffff ++#define MRX_CSR_NTF_I_MSK 0xffff0000 ++#define MRX_CSR_NTF_SFT 0 ++#define MRX_CSR_NTF_HI 15 ++#define MRX_CSR_NTF_SZ 16 ++#define DBG_Q0_SUCC_MSK 0x0000ffff ++#define DBG_Q0_SUCC_I_MSK 0xffff0000 ++#define DBG_Q0_SUCC_SFT 0 ++#define DBG_Q0_SUCC_HI 15 ++#define DBG_Q0_SUCC_SZ 16 ++#define DBG_Q0_FAIL_MSK 0x0000ffff ++#define DBG_Q0_FAIL_I_MSK 0xffff0000 ++#define DBG_Q0_FAIL_SFT 0 ++#define DBG_Q0_FAIL_HI 15 ++#define DBG_Q0_FAIL_SZ 16 ++#define DBG_Q0_ACK_SUCC_MSK 0x0000ffff ++#define DBG_Q0_ACK_SUCC_I_MSK 0xffff0000 ++#define DBG_Q0_ACK_SUCC_SFT 0 ++#define DBG_Q0_ACK_SUCC_HI 15 ++#define DBG_Q0_ACK_SUCC_SZ 16 ++#define DBG_Q0_ACK_FAIL_MSK 0x0000ffff ++#define DBG_Q0_ACK_FAIL_I_MSK 0xffff0000 ++#define DBG_Q0_ACK_FAIL_SFT 0 ++#define DBG_Q0_ACK_FAIL_HI 15 ++#define DBG_Q0_ACK_FAIL_SZ 16 ++#define DBG_Q1_SUCC_MSK 0x0000ffff ++#define DBG_Q1_SUCC_I_MSK 0xffff0000 ++#define DBG_Q1_SUCC_SFT 0 ++#define DBG_Q1_SUCC_HI 15 ++#define DBG_Q1_SUCC_SZ 16 ++#define DBG_Q1_FAIL_MSK 0x0000ffff ++#define DBG_Q1_FAIL_I_MSK 0xffff0000 ++#define DBG_Q1_FAIL_SFT 0 ++#define DBG_Q1_FAIL_HI 15 ++#define DBG_Q1_FAIL_SZ 16 ++#define DBG_Q1_ACK_SUCC_MSK 0x0000ffff ++#define DBG_Q1_ACK_SUCC_I_MSK 0xffff0000 ++#define DBG_Q1_ACK_SUCC_SFT 0 ++#define DBG_Q1_ACK_SUCC_HI 15 ++#define DBG_Q1_ACK_SUCC_SZ 16 ++#define DBG_Q1_ACK_FAIL_MSK 0x0000ffff ++#define DBG_Q1_ACK_FAIL_I_MSK 0xffff0000 ++#define DBG_Q1_ACK_FAIL_SFT 0 ++#define DBG_Q1_ACK_FAIL_HI 15 ++#define DBG_Q1_ACK_FAIL_SZ 16 ++#define DBG_Q2_SUCC_MSK 0x0000ffff ++#define DBG_Q2_SUCC_I_MSK 0xffff0000 ++#define DBG_Q2_SUCC_SFT 0 ++#define DBG_Q2_SUCC_HI 15 ++#define DBG_Q2_SUCC_SZ 16 ++#define DBG_Q2_FAIL_MSK 0x0000ffff ++#define DBG_Q2_FAIL_I_MSK 0xffff0000 ++#define DBG_Q2_FAIL_SFT 0 ++#define DBG_Q2_FAIL_HI 15 ++#define DBG_Q2_FAIL_SZ 16 ++#define DBG_Q2_ACK_SUCC_MSK 0x0000ffff ++#define DBG_Q2_ACK_SUCC_I_MSK 0xffff0000 ++#define DBG_Q2_ACK_SUCC_SFT 0 ++#define DBG_Q2_ACK_SUCC_HI 15 ++#define DBG_Q2_ACK_SUCC_SZ 16 ++#define DBG_Q2_ACK_FAIL_MSK 0x0000ffff ++#define DBG_Q2_ACK_FAIL_I_MSK 0xffff0000 ++#define DBG_Q2_ACK_FAIL_SFT 0 ++#define DBG_Q2_ACK_FAIL_HI 15 ++#define DBG_Q2_ACK_FAIL_SZ 16 ++#define DBG_Q3_SUCC_MSK 0x0000ffff ++#define DBG_Q3_SUCC_I_MSK 0xffff0000 ++#define DBG_Q3_SUCC_SFT 0 ++#define DBG_Q3_SUCC_HI 15 ++#define DBG_Q3_SUCC_SZ 16 ++#define DBG_Q3_FAIL_MSK 0x0000ffff ++#define DBG_Q3_FAIL_I_MSK 0xffff0000 ++#define DBG_Q3_FAIL_SFT 0 ++#define DBG_Q3_FAIL_HI 15 ++#define DBG_Q3_FAIL_SZ 16 ++#define DBG_Q3_ACK_SUCC_MSK 0x0000ffff ++#define DBG_Q3_ACK_SUCC_I_MSK 0xffff0000 ++#define DBG_Q3_ACK_SUCC_SFT 0 ++#define DBG_Q3_ACK_SUCC_HI 15 ++#define DBG_Q3_ACK_SUCC_SZ 16 ++#define DBG_Q3_ACK_FAIL_MSK 0x0000ffff ++#define DBG_Q3_ACK_FAIL_I_MSK 0xffff0000 ++#define DBG_Q3_ACK_FAIL_SFT 0 ++#define DBG_Q3_ACK_FAIL_HI 15 ++#define DBG_Q3_ACK_FAIL_SZ 16 ++#define SCRT_TKIP_CERR_MSK 0x000fffff ++#define SCRT_TKIP_CERR_I_MSK 0xfff00000 ++#define SCRT_TKIP_CERR_SFT 0 ++#define SCRT_TKIP_CERR_HI 19 ++#define SCRT_TKIP_CERR_SZ 20 ++#define SCRT_TKIP_MIC_ERR_MSK 0x000fffff ++#define SCRT_TKIP_MIC_ERR_I_MSK 0xfff00000 ++#define SCRT_TKIP_MIC_ERR_SFT 0 ++#define SCRT_TKIP_MIC_ERR_HI 19 ++#define SCRT_TKIP_MIC_ERR_SZ 20 ++#define SCRT_TKIP_RPLY_MSK 0x000fffff ++#define SCRT_TKIP_RPLY_I_MSK 0xfff00000 ++#define SCRT_TKIP_RPLY_SFT 0 ++#define SCRT_TKIP_RPLY_HI 19 ++#define SCRT_TKIP_RPLY_SZ 20 ++#define SCRT_CCMP_RPLY_MSK 0x000fffff ++#define SCRT_CCMP_RPLY_I_MSK 0xfff00000 ++#define SCRT_CCMP_RPLY_SFT 0 ++#define SCRT_CCMP_RPLY_HI 19 ++#define SCRT_CCMP_RPLY_SZ 20 ++#define SCRT_CCMP_CERR_MSK 0x000fffff ++#define SCRT_CCMP_CERR_I_MSK 0xfff00000 ++#define SCRT_CCMP_CERR_SFT 0 ++#define SCRT_CCMP_CERR_HI 19 ++#define SCRT_CCMP_CERR_SZ 20 ++#define DBG_LEN_CRC_FAIL_MSK 0x0000ffff ++#define DBG_LEN_CRC_FAIL_I_MSK 0xffff0000 ++#define DBG_LEN_CRC_FAIL_SFT 0 ++#define DBG_LEN_CRC_FAIL_HI 15 ++#define DBG_LEN_CRC_FAIL_SZ 16 ++#define DBG_LEN_ALC_FAIL_MSK 0x0000ffff ++#define DBG_LEN_ALC_FAIL_I_MSK 0xffff0000 ++#define DBG_LEN_ALC_FAIL_SFT 0 ++#define DBG_LEN_ALC_FAIL_HI 15 ++#define DBG_LEN_ALC_FAIL_SZ 16 ++#define DBG_AMPDU_PASS_MSK 0x0000ffff ++#define DBG_AMPDU_PASS_I_MSK 0xffff0000 ++#define DBG_AMPDU_PASS_SFT 0 ++#define DBG_AMPDU_PASS_HI 15 ++#define DBG_AMPDU_PASS_SZ 16 ++#define DBG_AMPDU_FAIL_MSK 0x0000ffff ++#define DBG_AMPDU_FAIL_I_MSK 0xffff0000 ++#define DBG_AMPDU_FAIL_SFT 0 ++#define DBG_AMPDU_FAIL_HI 15 ++#define DBG_AMPDU_FAIL_SZ 16 ++#define RXID_ALC_CNT_FAIL_MSK 0x0000ffff ++#define RXID_ALC_CNT_FAIL_I_MSK 0xffff0000 ++#define RXID_ALC_CNT_FAIL_SFT 0 ++#define RXID_ALC_CNT_FAIL_HI 15 ++#define RXID_ALC_CNT_FAIL_SZ 16 ++#define RXID_ALC_LEN_FAIL_MSK 0x0000ffff ++#define RXID_ALC_LEN_FAIL_I_MSK 0xffff0000 ++#define RXID_ALC_LEN_FAIL_SFT 0 ++#define RXID_ALC_LEN_FAIL_HI 15 ++#define RXID_ALC_LEN_FAIL_SZ 16 ++#define CBR_RG_EN_MANUAL_MSK 0x00000001 ++#define CBR_RG_EN_MANUAL_I_MSK 0xfffffffe ++#define CBR_RG_EN_MANUAL_SFT 0 ++#define CBR_RG_EN_MANUAL_HI 0 ++#define CBR_RG_EN_MANUAL_SZ 1 ++#define CBR_RG_TX_EN_MSK 0x00000002 ++#define CBR_RG_TX_EN_I_MSK 0xfffffffd ++#define CBR_RG_TX_EN_SFT 1 ++#define CBR_RG_TX_EN_HI 1 ++#define CBR_RG_TX_EN_SZ 1 ++#define CBR_RG_TX_PA_EN_MSK 0x00000004 ++#define CBR_RG_TX_PA_EN_I_MSK 0xfffffffb ++#define CBR_RG_TX_PA_EN_SFT 2 ++#define CBR_RG_TX_PA_EN_HI 2 ++#define CBR_RG_TX_PA_EN_SZ 1 ++#define CBR_RG_TX_DAC_EN_MSK 0x00000008 ++#define CBR_RG_TX_DAC_EN_I_MSK 0xfffffff7 ++#define CBR_RG_TX_DAC_EN_SFT 3 ++#define CBR_RG_TX_DAC_EN_HI 3 ++#define CBR_RG_TX_DAC_EN_SZ 1 ++#define CBR_RG_RX_AGC_MSK 0x00000010 ++#define CBR_RG_RX_AGC_I_MSK 0xffffffef ++#define CBR_RG_RX_AGC_SFT 4 ++#define CBR_RG_RX_AGC_HI 4 ++#define CBR_RG_RX_AGC_SZ 1 ++#define CBR_RG_RX_GAIN_MANUAL_MSK 0x00000020 ++#define CBR_RG_RX_GAIN_MANUAL_I_MSK 0xffffffdf ++#define CBR_RG_RX_GAIN_MANUAL_SFT 5 ++#define CBR_RG_RX_GAIN_MANUAL_HI 5 ++#define CBR_RG_RX_GAIN_MANUAL_SZ 1 ++#define CBR_RG_RFG_MSK 0x000000c0 ++#define CBR_RG_RFG_I_MSK 0xffffff3f ++#define CBR_RG_RFG_SFT 6 ++#define CBR_RG_RFG_HI 7 ++#define CBR_RG_RFG_SZ 2 ++#define CBR_RG_PGAG_MSK 0x00000f00 ++#define CBR_RG_PGAG_I_MSK 0xfffff0ff ++#define CBR_RG_PGAG_SFT 8 ++#define CBR_RG_PGAG_HI 11 ++#define CBR_RG_PGAG_SZ 4 ++#define CBR_RG_MODE_MSK 0x00003000 ++#define CBR_RG_MODE_I_MSK 0xffffcfff ++#define CBR_RG_MODE_SFT 12 ++#define CBR_RG_MODE_HI 13 ++#define CBR_RG_MODE_SZ 2 ++#define CBR_RG_EN_TX_TRSW_MSK 0x00004000 ++#define CBR_RG_EN_TX_TRSW_I_MSK 0xffffbfff ++#define CBR_RG_EN_TX_TRSW_SFT 14 ++#define CBR_RG_EN_TX_TRSW_HI 14 ++#define CBR_RG_EN_TX_TRSW_SZ 1 ++#define CBR_RG_EN_SX_MSK 0x00008000 ++#define CBR_RG_EN_SX_I_MSK 0xffff7fff ++#define CBR_RG_EN_SX_SFT 15 ++#define CBR_RG_EN_SX_HI 15 ++#define CBR_RG_EN_SX_SZ 1 ++#define CBR_RG_EN_RX_LNA_MSK 0x00010000 ++#define CBR_RG_EN_RX_LNA_I_MSK 0xfffeffff ++#define CBR_RG_EN_RX_LNA_SFT 16 ++#define CBR_RG_EN_RX_LNA_HI 16 ++#define CBR_RG_EN_RX_LNA_SZ 1 ++#define CBR_RG_EN_RX_MIXER_MSK 0x00020000 ++#define CBR_RG_EN_RX_MIXER_I_MSK 0xfffdffff ++#define CBR_RG_EN_RX_MIXER_SFT 17 ++#define CBR_RG_EN_RX_MIXER_HI 17 ++#define CBR_RG_EN_RX_MIXER_SZ 1 ++#define CBR_RG_EN_RX_DIV2_MSK 0x00040000 ++#define CBR_RG_EN_RX_DIV2_I_MSK 0xfffbffff ++#define CBR_RG_EN_RX_DIV2_SFT 18 ++#define CBR_RG_EN_RX_DIV2_HI 18 ++#define CBR_RG_EN_RX_DIV2_SZ 1 ++#define CBR_RG_EN_RX_LOBUF_MSK 0x00080000 ++#define CBR_RG_EN_RX_LOBUF_I_MSK 0xfff7ffff ++#define CBR_RG_EN_RX_LOBUF_SFT 19 ++#define CBR_RG_EN_RX_LOBUF_HI 19 ++#define CBR_RG_EN_RX_LOBUF_SZ 1 ++#define CBR_RG_EN_RX_TZ_MSK 0x00100000 ++#define CBR_RG_EN_RX_TZ_I_MSK 0xffefffff ++#define CBR_RG_EN_RX_TZ_SFT 20 ++#define CBR_RG_EN_RX_TZ_HI 20 ++#define CBR_RG_EN_RX_TZ_SZ 1 ++#define CBR_RG_EN_RX_FILTER_MSK 0x00200000 ++#define CBR_RG_EN_RX_FILTER_I_MSK 0xffdfffff ++#define CBR_RG_EN_RX_FILTER_SFT 21 ++#define CBR_RG_EN_RX_FILTER_HI 21 ++#define CBR_RG_EN_RX_FILTER_SZ 1 ++#define CBR_RG_EN_RX_HPF_MSK 0x00400000 ++#define CBR_RG_EN_RX_HPF_I_MSK 0xffbfffff ++#define CBR_RG_EN_RX_HPF_SFT 22 ++#define CBR_RG_EN_RX_HPF_HI 22 ++#define CBR_RG_EN_RX_HPF_SZ 1 ++#define CBR_RG_EN_RX_RSSI_MSK 0x00800000 ++#define CBR_RG_EN_RX_RSSI_I_MSK 0xff7fffff ++#define CBR_RG_EN_RX_RSSI_SFT 23 ++#define CBR_RG_EN_RX_RSSI_HI 23 ++#define CBR_RG_EN_RX_RSSI_SZ 1 ++#define CBR_RG_EN_ADC_MSK 0x01000000 ++#define CBR_RG_EN_ADC_I_MSK 0xfeffffff ++#define CBR_RG_EN_ADC_SFT 24 ++#define CBR_RG_EN_ADC_HI 24 ++#define CBR_RG_EN_ADC_SZ 1 ++#define CBR_RG_EN_TX_MOD_MSK 0x02000000 ++#define CBR_RG_EN_TX_MOD_I_MSK 0xfdffffff ++#define CBR_RG_EN_TX_MOD_SFT 25 ++#define CBR_RG_EN_TX_MOD_HI 25 ++#define CBR_RG_EN_TX_MOD_SZ 1 ++#define CBR_RG_EN_TX_DIV2_MSK 0x04000000 ++#define CBR_RG_EN_TX_DIV2_I_MSK 0xfbffffff ++#define CBR_RG_EN_TX_DIV2_SFT 26 ++#define CBR_RG_EN_TX_DIV2_HI 26 ++#define CBR_RG_EN_TX_DIV2_SZ 1 ++#define CBR_RG_EN_TX_DIV2_BUF_MSK 0x08000000 ++#define CBR_RG_EN_TX_DIV2_BUF_I_MSK 0xf7ffffff ++#define CBR_RG_EN_TX_DIV2_BUF_SFT 27 ++#define CBR_RG_EN_TX_DIV2_BUF_HI 27 ++#define CBR_RG_EN_TX_DIV2_BUF_SZ 1 ++#define CBR_RG_EN_TX_LOBF_MSK 0x10000000 ++#define CBR_RG_EN_TX_LOBF_I_MSK 0xefffffff ++#define CBR_RG_EN_TX_LOBF_SFT 28 ++#define CBR_RG_EN_TX_LOBF_HI 28 ++#define CBR_RG_EN_TX_LOBF_SZ 1 ++#define CBR_RG_EN_RX_LOBF_MSK 0x20000000 ++#define CBR_RG_EN_RX_LOBF_I_MSK 0xdfffffff ++#define CBR_RG_EN_RX_LOBF_SFT 29 ++#define CBR_RG_EN_RX_LOBF_HI 29 ++#define CBR_RG_EN_RX_LOBF_SZ 1 ++#define CBR_RG_SEL_DPLL_CLK_MSK 0x40000000 ++#define CBR_RG_SEL_DPLL_CLK_I_MSK 0xbfffffff ++#define CBR_RG_SEL_DPLL_CLK_SFT 30 ++#define CBR_RG_SEL_DPLL_CLK_HI 30 ++#define CBR_RG_SEL_DPLL_CLK_SZ 1 ++#define CBR_RG_EN_TX_DPD_MSK 0x00000001 ++#define CBR_RG_EN_TX_DPD_I_MSK 0xfffffffe ++#define CBR_RG_EN_TX_DPD_SFT 0 ++#define CBR_RG_EN_TX_DPD_HI 0 ++#define CBR_RG_EN_TX_DPD_SZ 1 ++#define CBR_RG_EN_TX_TSSI_MSK 0x00000002 ++#define CBR_RG_EN_TX_TSSI_I_MSK 0xfffffffd ++#define CBR_RG_EN_TX_TSSI_SFT 1 ++#define CBR_RG_EN_TX_TSSI_HI 1 ++#define CBR_RG_EN_TX_TSSI_SZ 1 ++#define CBR_RG_EN_RX_IQCAL_MSK 0x00000004 ++#define CBR_RG_EN_RX_IQCAL_I_MSK 0xfffffffb ++#define CBR_RG_EN_RX_IQCAL_SFT 2 ++#define CBR_RG_EN_RX_IQCAL_HI 2 ++#define CBR_RG_EN_RX_IQCAL_SZ 1 ++#define CBR_RG_EN_TX_DAC_CAL_MSK 0x00000008 ++#define CBR_RG_EN_TX_DAC_CAL_I_MSK 0xfffffff7 ++#define CBR_RG_EN_TX_DAC_CAL_SFT 3 ++#define CBR_RG_EN_TX_DAC_CAL_HI 3 ++#define CBR_RG_EN_TX_DAC_CAL_SZ 1 ++#define CBR_RG_EN_TX_SELF_MIXER_MSK 0x00000010 ++#define CBR_RG_EN_TX_SELF_MIXER_I_MSK 0xffffffef ++#define CBR_RG_EN_TX_SELF_MIXER_SFT 4 ++#define CBR_RG_EN_TX_SELF_MIXER_HI 4 ++#define CBR_RG_EN_TX_SELF_MIXER_SZ 1 ++#define CBR_RG_EN_TX_DAC_OUT_MSK 0x00000020 ++#define CBR_RG_EN_TX_DAC_OUT_I_MSK 0xffffffdf ++#define CBR_RG_EN_TX_DAC_OUT_SFT 5 ++#define CBR_RG_EN_TX_DAC_OUT_HI 5 ++#define CBR_RG_EN_TX_DAC_OUT_SZ 1 ++#define CBR_RG_EN_LDO_RX_FE_MSK 0x00000040 ++#define CBR_RG_EN_LDO_RX_FE_I_MSK 0xffffffbf ++#define CBR_RG_EN_LDO_RX_FE_SFT 6 ++#define CBR_RG_EN_LDO_RX_FE_HI 6 ++#define CBR_RG_EN_LDO_RX_FE_SZ 1 ++#define CBR_RG_EN_LDO_ABB_MSK 0x00000080 ++#define CBR_RG_EN_LDO_ABB_I_MSK 0xffffff7f ++#define CBR_RG_EN_LDO_ABB_SFT 7 ++#define CBR_RG_EN_LDO_ABB_HI 7 ++#define CBR_RG_EN_LDO_ABB_SZ 1 ++#define CBR_RG_EN_LDO_AFE_MSK 0x00000100 ++#define CBR_RG_EN_LDO_AFE_I_MSK 0xfffffeff ++#define CBR_RG_EN_LDO_AFE_SFT 8 ++#define CBR_RG_EN_LDO_AFE_HI 8 ++#define CBR_RG_EN_LDO_AFE_SZ 1 ++#define CBR_RG_EN_SX_CHPLDO_MSK 0x00000200 ++#define CBR_RG_EN_SX_CHPLDO_I_MSK 0xfffffdff ++#define CBR_RG_EN_SX_CHPLDO_SFT 9 ++#define CBR_RG_EN_SX_CHPLDO_HI 9 ++#define CBR_RG_EN_SX_CHPLDO_SZ 1 ++#define CBR_RG_EN_SX_LOBFLDO_MSK 0x00000400 ++#define CBR_RG_EN_SX_LOBFLDO_I_MSK 0xfffffbff ++#define CBR_RG_EN_SX_LOBFLDO_SFT 10 ++#define CBR_RG_EN_SX_LOBFLDO_HI 10 ++#define CBR_RG_EN_SX_LOBFLDO_SZ 1 ++#define CBR_RG_EN_IREF_RX_MSK 0x00000800 ++#define CBR_RG_EN_IREF_RX_I_MSK 0xfffff7ff ++#define CBR_RG_EN_IREF_RX_SFT 11 ++#define CBR_RG_EN_IREF_RX_HI 11 ++#define CBR_RG_EN_IREF_RX_SZ 1 ++#define CBR_RG_DCDC_MODE_MSK 0x00001000 ++#define CBR_RG_DCDC_MODE_I_MSK 0xffffefff ++#define CBR_RG_DCDC_MODE_SFT 12 ++#define CBR_RG_DCDC_MODE_HI 12 ++#define CBR_RG_DCDC_MODE_SZ 1 ++#define CBR_RG_LDO_LEVEL_RX_FE_MSK 0x00000007 ++#define CBR_RG_LDO_LEVEL_RX_FE_I_MSK 0xfffffff8 ++#define CBR_RG_LDO_LEVEL_RX_FE_SFT 0 ++#define CBR_RG_LDO_LEVEL_RX_FE_HI 2 ++#define CBR_RG_LDO_LEVEL_RX_FE_SZ 3 ++#define CBR_RG_LDO_LEVEL_ABB_MSK 0x00000038 ++#define CBR_RG_LDO_LEVEL_ABB_I_MSK 0xffffffc7 ++#define CBR_RG_LDO_LEVEL_ABB_SFT 3 ++#define CBR_RG_LDO_LEVEL_ABB_HI 5 ++#define CBR_RG_LDO_LEVEL_ABB_SZ 3 ++#define CBR_RG_LDO_LEVEL_AFE_MSK 0x000001c0 ++#define CBR_RG_LDO_LEVEL_AFE_I_MSK 0xfffffe3f ++#define CBR_RG_LDO_LEVEL_AFE_SFT 6 ++#define CBR_RG_LDO_LEVEL_AFE_HI 8 ++#define CBR_RG_LDO_LEVEL_AFE_SZ 3 ++#define CBR_RG_SX_LDO_CHP_LEVEL_MSK 0x00000e00 ++#define CBR_RG_SX_LDO_CHP_LEVEL_I_MSK 0xfffff1ff ++#define CBR_RG_SX_LDO_CHP_LEVEL_SFT 9 ++#define CBR_RG_SX_LDO_CHP_LEVEL_HI 11 ++#define CBR_RG_SX_LDO_CHP_LEVEL_SZ 3 ++#define CBR_RG_SX_LDO_LOBF_LEVEL_MSK 0x00007000 ++#define CBR_RG_SX_LDO_LOBF_LEVEL_I_MSK 0xffff8fff ++#define CBR_RG_SX_LDO_LOBF_LEVEL_SFT 12 ++#define CBR_RG_SX_LDO_LOBF_LEVEL_HI 14 ++#define CBR_RG_SX_LDO_LOBF_LEVEL_SZ 3 ++#define CBR_RG_SX_LDO_XOSC_LEVEL_MSK 0x00038000 ++#define CBR_RG_SX_LDO_XOSC_LEVEL_I_MSK 0xfffc7fff ++#define CBR_RG_SX_LDO_XOSC_LEVEL_SFT 15 ++#define CBR_RG_SX_LDO_XOSC_LEVEL_HI 17 ++#define CBR_RG_SX_LDO_XOSC_LEVEL_SZ 3 ++#define CBR_RG_DP_LDO_LEVEL_MSK 0x001c0000 ++#define CBR_RG_DP_LDO_LEVEL_I_MSK 0xffe3ffff ++#define CBR_RG_DP_LDO_LEVEL_SFT 18 ++#define CBR_RG_DP_LDO_LEVEL_HI 20 ++#define CBR_RG_DP_LDO_LEVEL_SZ 3 ++#define CBR_RG_SX_LDO_VCO_LEVEL_MSK 0x00e00000 ++#define CBR_RG_SX_LDO_VCO_LEVEL_I_MSK 0xff1fffff ++#define CBR_RG_SX_LDO_VCO_LEVEL_SFT 21 ++#define CBR_RG_SX_LDO_VCO_LEVEL_HI 23 ++#define CBR_RG_SX_LDO_VCO_LEVEL_SZ 3 ++#define CBR_RG_TX_LDO_TX_LEVEL_MSK 0x07000000 ++#define CBR_RG_TX_LDO_TX_LEVEL_I_MSK 0xf8ffffff ++#define CBR_RG_TX_LDO_TX_LEVEL_SFT 24 ++#define CBR_RG_TX_LDO_TX_LEVEL_HI 26 ++#define CBR_RG_TX_LDO_TX_LEVEL_SZ 3 ++#define CBR_RG_BUCK_LEVEL_MSK 0x38000000 ++#define CBR_RG_BUCK_LEVEL_I_MSK 0xc7ffffff ++#define CBR_RG_BUCK_LEVEL_SFT 27 ++#define CBR_RG_BUCK_LEVEL_HI 29 ++#define CBR_RG_BUCK_LEVEL_SZ 3 ++#define CBR_RG_EN_RX_PADSW_MSK 0x00000001 ++#define CBR_RG_EN_RX_PADSW_I_MSK 0xfffffffe ++#define CBR_RG_EN_RX_PADSW_SFT 0 ++#define CBR_RG_EN_RX_PADSW_HI 0 ++#define CBR_RG_EN_RX_PADSW_SZ 1 ++#define CBR_RG_EN_RX_TESTNODE_MSK 0x00000002 ++#define CBR_RG_EN_RX_TESTNODE_I_MSK 0xfffffffd ++#define CBR_RG_EN_RX_TESTNODE_SFT 1 ++#define CBR_RG_EN_RX_TESTNODE_HI 1 ++#define CBR_RG_EN_RX_TESTNODE_SZ 1 ++#define CBR_RG_RX_ABBCFIX_MSK 0x00000004 ++#define CBR_RG_RX_ABBCFIX_I_MSK 0xfffffffb ++#define CBR_RG_RX_ABBCFIX_SFT 2 ++#define CBR_RG_RX_ABBCFIX_HI 2 ++#define CBR_RG_RX_ABBCFIX_SZ 1 ++#define CBR_RG_RX_ABBCTUNE_MSK 0x000001f8 ++#define CBR_RG_RX_ABBCTUNE_I_MSK 0xfffffe07 ++#define CBR_RG_RX_ABBCTUNE_SFT 3 ++#define CBR_RG_RX_ABBCTUNE_HI 8 ++#define CBR_RG_RX_ABBCTUNE_SZ 6 ++#define CBR_RG_RX_ABBOUT_TRI_STATE_MSK 0x00000200 ++#define CBR_RG_RX_ABBOUT_TRI_STATE_I_MSK 0xfffffdff ++#define CBR_RG_RX_ABBOUT_TRI_STATE_SFT 9 ++#define CBR_RG_RX_ABBOUT_TRI_STATE_HI 9 ++#define CBR_RG_RX_ABBOUT_TRI_STATE_SZ 1 ++#define CBR_RG_RX_ABB_N_MODE_MSK 0x00000400 ++#define CBR_RG_RX_ABB_N_MODE_I_MSK 0xfffffbff ++#define CBR_RG_RX_ABB_N_MODE_SFT 10 ++#define CBR_RG_RX_ABB_N_MODE_HI 10 ++#define CBR_RG_RX_ABB_N_MODE_SZ 1 ++#define CBR_RG_RX_EN_LOOPA_MSK 0x00000800 ++#define CBR_RG_RX_EN_LOOPA_I_MSK 0xfffff7ff ++#define CBR_RG_RX_EN_LOOPA_SFT 11 ++#define CBR_RG_RX_EN_LOOPA_HI 11 ++#define CBR_RG_RX_EN_LOOPA_SZ 1 ++#define CBR_RG_RX_FILTERI1ST_MSK 0x00003000 ++#define CBR_RG_RX_FILTERI1ST_I_MSK 0xffffcfff ++#define CBR_RG_RX_FILTERI1ST_SFT 12 ++#define CBR_RG_RX_FILTERI1ST_HI 13 ++#define CBR_RG_RX_FILTERI1ST_SZ 2 ++#define CBR_RG_RX_FILTERI2ND_MSK 0x0000c000 ++#define CBR_RG_RX_FILTERI2ND_I_MSK 0xffff3fff ++#define CBR_RG_RX_FILTERI2ND_SFT 14 ++#define CBR_RG_RX_FILTERI2ND_HI 15 ++#define CBR_RG_RX_FILTERI2ND_SZ 2 ++#define CBR_RG_RX_FILTERI3RD_MSK 0x00030000 ++#define CBR_RG_RX_FILTERI3RD_I_MSK 0xfffcffff ++#define CBR_RG_RX_FILTERI3RD_SFT 16 ++#define CBR_RG_RX_FILTERI3RD_HI 17 ++#define CBR_RG_RX_FILTERI3RD_SZ 2 ++#define CBR_RG_RX_FILTERI_COURSE_MSK 0x000c0000 ++#define CBR_RG_RX_FILTERI_COURSE_I_MSK 0xfff3ffff ++#define CBR_RG_RX_FILTERI_COURSE_SFT 18 ++#define CBR_RG_RX_FILTERI_COURSE_HI 19 ++#define CBR_RG_RX_FILTERI_COURSE_SZ 2 ++#define CBR_RG_RX_FILTERVCM_MSK 0x00300000 ++#define CBR_RG_RX_FILTERVCM_I_MSK 0xffcfffff ++#define CBR_RG_RX_FILTERVCM_SFT 20 ++#define CBR_RG_RX_FILTERVCM_HI 21 ++#define CBR_RG_RX_FILTERVCM_SZ 2 ++#define CBR_RG_RX_HPF3M_MSK 0x00400000 ++#define CBR_RG_RX_HPF3M_I_MSK 0xffbfffff ++#define CBR_RG_RX_HPF3M_SFT 22 ++#define CBR_RG_RX_HPF3M_HI 22 ++#define CBR_RG_RX_HPF3M_SZ 1 ++#define CBR_RG_RX_HPF300K_MSK 0x00800000 ++#define CBR_RG_RX_HPF300K_I_MSK 0xff7fffff ++#define CBR_RG_RX_HPF300K_SFT 23 ++#define CBR_RG_RX_HPF300K_HI 23 ++#define CBR_RG_RX_HPF300K_SZ 1 ++#define CBR_RG_RX_HPFI_MSK 0x03000000 ++#define CBR_RG_RX_HPFI_I_MSK 0xfcffffff ++#define CBR_RG_RX_HPFI_SFT 24 ++#define CBR_RG_RX_HPFI_HI 25 ++#define CBR_RG_RX_HPFI_SZ 2 ++#define CBR_RG_RX_HPF_FINALCORNER_MSK 0x0c000000 ++#define CBR_RG_RX_HPF_FINALCORNER_I_MSK 0xf3ffffff ++#define CBR_RG_RX_HPF_FINALCORNER_SFT 26 ++#define CBR_RG_RX_HPF_FINALCORNER_HI 27 ++#define CBR_RG_RX_HPF_FINALCORNER_SZ 2 ++#define CBR_RG_RX_HPF_SETTLE1_C_MSK 0x30000000 ++#define CBR_RG_RX_HPF_SETTLE1_C_I_MSK 0xcfffffff ++#define CBR_RG_RX_HPF_SETTLE1_C_SFT 28 ++#define CBR_RG_RX_HPF_SETTLE1_C_HI 29 ++#define CBR_RG_RX_HPF_SETTLE1_C_SZ 2 ++#define CBR_RG_RX_HPF_SETTLE1_R_MSK 0x00000003 ++#define CBR_RG_RX_HPF_SETTLE1_R_I_MSK 0xfffffffc ++#define CBR_RG_RX_HPF_SETTLE1_R_SFT 0 ++#define CBR_RG_RX_HPF_SETTLE1_R_HI 1 ++#define CBR_RG_RX_HPF_SETTLE1_R_SZ 2 ++#define CBR_RG_RX_HPF_SETTLE2_C_MSK 0x0000000c ++#define CBR_RG_RX_HPF_SETTLE2_C_I_MSK 0xfffffff3 ++#define CBR_RG_RX_HPF_SETTLE2_C_SFT 2 ++#define CBR_RG_RX_HPF_SETTLE2_C_HI 3 ++#define CBR_RG_RX_HPF_SETTLE2_C_SZ 2 ++#define CBR_RG_RX_HPF_SETTLE2_R_MSK 0x00000030 ++#define CBR_RG_RX_HPF_SETTLE2_R_I_MSK 0xffffffcf ++#define CBR_RG_RX_HPF_SETTLE2_R_SFT 4 ++#define CBR_RG_RX_HPF_SETTLE2_R_HI 5 ++#define CBR_RG_RX_HPF_SETTLE2_R_SZ 2 ++#define CBR_RG_RX_HPF_VCMCON2_MSK 0x000000c0 ++#define CBR_RG_RX_HPF_VCMCON2_I_MSK 0xffffff3f ++#define CBR_RG_RX_HPF_VCMCON2_SFT 6 ++#define CBR_RG_RX_HPF_VCMCON2_HI 7 ++#define CBR_RG_RX_HPF_VCMCON2_SZ 2 ++#define CBR_RG_RX_HPF_VCMCON_MSK 0x00000300 ++#define CBR_RG_RX_HPF_VCMCON_I_MSK 0xfffffcff ++#define CBR_RG_RX_HPF_VCMCON_SFT 8 ++#define CBR_RG_RX_HPF_VCMCON_HI 9 ++#define CBR_RG_RX_HPF_VCMCON_SZ 2 ++#define CBR_RG_RX_OUTVCM_MSK 0x00000c00 ++#define CBR_RG_RX_OUTVCM_I_MSK 0xfffff3ff ++#define CBR_RG_RX_OUTVCM_SFT 10 ++#define CBR_RG_RX_OUTVCM_HI 11 ++#define CBR_RG_RX_OUTVCM_SZ 2 ++#define CBR_RG_RX_TZI_MSK 0x00003000 ++#define CBR_RG_RX_TZI_I_MSK 0xffffcfff ++#define CBR_RG_RX_TZI_SFT 12 ++#define CBR_RG_RX_TZI_HI 13 ++#define CBR_RG_RX_TZI_SZ 2 ++#define CBR_RG_RX_TZ_OUT_TRISTATE_MSK 0x00004000 ++#define CBR_RG_RX_TZ_OUT_TRISTATE_I_MSK 0xffffbfff ++#define CBR_RG_RX_TZ_OUT_TRISTATE_SFT 14 ++#define CBR_RG_RX_TZ_OUT_TRISTATE_HI 14 ++#define CBR_RG_RX_TZ_OUT_TRISTATE_SZ 1 ++#define CBR_RG_RX_TZ_VCM_MSK 0x00018000 ++#define CBR_RG_RX_TZ_VCM_I_MSK 0xfffe7fff ++#define CBR_RG_RX_TZ_VCM_SFT 15 ++#define CBR_RG_RX_TZ_VCM_HI 16 ++#define CBR_RG_RX_TZ_VCM_SZ 2 ++#define CBR_RG_EN_RX_RSSI_TESTNODE_MSK 0x000e0000 ++#define CBR_RG_EN_RX_RSSI_TESTNODE_I_MSK 0xfff1ffff ++#define CBR_RG_EN_RX_RSSI_TESTNODE_SFT 17 ++#define CBR_RG_EN_RX_RSSI_TESTNODE_HI 19 ++#define CBR_RG_EN_RX_RSSI_TESTNODE_SZ 3 ++#define CBR_RG_RX_ADCRSSI_CLKSEL_MSK 0x00100000 ++#define CBR_RG_RX_ADCRSSI_CLKSEL_I_MSK 0xffefffff ++#define CBR_RG_RX_ADCRSSI_CLKSEL_SFT 20 ++#define CBR_RG_RX_ADCRSSI_CLKSEL_HI 20 ++#define CBR_RG_RX_ADCRSSI_CLKSEL_SZ 1 ++#define CBR_RG_RX_ADCRSSI_VCM_MSK 0x00600000 ++#define CBR_RG_RX_ADCRSSI_VCM_I_MSK 0xff9fffff ++#define CBR_RG_RX_ADCRSSI_VCM_SFT 21 ++#define CBR_RG_RX_ADCRSSI_VCM_HI 22 ++#define CBR_RG_RX_ADCRSSI_VCM_SZ 2 ++#define CBR_RG_RX_REC_LPFCORNER_MSK 0x01800000 ++#define CBR_RG_RX_REC_LPFCORNER_I_MSK 0xfe7fffff ++#define CBR_RG_RX_REC_LPFCORNER_SFT 23 ++#define CBR_RG_RX_REC_LPFCORNER_HI 24 ++#define CBR_RG_RX_REC_LPFCORNER_SZ 2 ++#define CBR_RG_RSSI_CLOCK_GATING_MSK 0x02000000 ++#define CBR_RG_RSSI_CLOCK_GATING_I_MSK 0xfdffffff ++#define CBR_RG_RSSI_CLOCK_GATING_SFT 25 ++#define CBR_RG_RSSI_CLOCK_GATING_HI 25 ++#define CBR_RG_RSSI_CLOCK_GATING_SZ 1 ++#define CBR_RG_TXPGA_CAPSW_MSK 0x00000003 ++#define CBR_RG_TXPGA_CAPSW_I_MSK 0xfffffffc ++#define CBR_RG_TXPGA_CAPSW_SFT 0 ++#define CBR_RG_TXPGA_CAPSW_HI 1 ++#define CBR_RG_TXPGA_CAPSW_SZ 2 ++#define CBR_RG_TXPGA_MAIN_MSK 0x000000fc ++#define CBR_RG_TXPGA_MAIN_I_MSK 0xffffff03 ++#define CBR_RG_TXPGA_MAIN_SFT 2 ++#define CBR_RG_TXPGA_MAIN_HI 7 ++#define CBR_RG_TXPGA_MAIN_SZ 6 ++#define CBR_RG_TXPGA_STEER_MSK 0x00003f00 ++#define CBR_RG_TXPGA_STEER_I_MSK 0xffffc0ff ++#define CBR_RG_TXPGA_STEER_SFT 8 ++#define CBR_RG_TXPGA_STEER_HI 13 ++#define CBR_RG_TXPGA_STEER_SZ 6 ++#define CBR_RG_TXMOD_GMCELL_MSK 0x0000c000 ++#define CBR_RG_TXMOD_GMCELL_I_MSK 0xffff3fff ++#define CBR_RG_TXMOD_GMCELL_SFT 14 ++#define CBR_RG_TXMOD_GMCELL_HI 15 ++#define CBR_RG_TXMOD_GMCELL_SZ 2 ++#define CBR_RG_TXLPF_GMCELL_MSK 0x00030000 ++#define CBR_RG_TXLPF_GMCELL_I_MSK 0xfffcffff ++#define CBR_RG_TXLPF_GMCELL_SFT 16 ++#define CBR_RG_TXLPF_GMCELL_HI 17 ++#define CBR_RG_TXLPF_GMCELL_SZ 2 ++#define CBR_RG_PACELL_EN_MSK 0x001c0000 ++#define CBR_RG_PACELL_EN_I_MSK 0xffe3ffff ++#define CBR_RG_PACELL_EN_SFT 18 ++#define CBR_RG_PACELL_EN_HI 20 ++#define CBR_RG_PACELL_EN_SZ 3 ++#define CBR_RG_PABIAS_CTRL_MSK 0x01e00000 ++#define CBR_RG_PABIAS_CTRL_I_MSK 0xfe1fffff ++#define CBR_RG_PABIAS_CTRL_SFT 21 ++#define CBR_RG_PABIAS_CTRL_HI 24 ++#define CBR_RG_PABIAS_CTRL_SZ 4 ++#define CBR_RG_PABIAS_AB_MSK 0x02000000 ++#define CBR_RG_PABIAS_AB_I_MSK 0xfdffffff ++#define CBR_RG_PABIAS_AB_SFT 25 ++#define CBR_RG_PABIAS_AB_HI 25 ++#define CBR_RG_PABIAS_AB_SZ 1 ++#define CBR_RG_TX_DIV_VSET_MSK 0x0c000000 ++#define CBR_RG_TX_DIV_VSET_I_MSK 0xf3ffffff ++#define CBR_RG_TX_DIV_VSET_SFT 26 ++#define CBR_RG_TX_DIV_VSET_HI 27 ++#define CBR_RG_TX_DIV_VSET_SZ 2 ++#define CBR_RG_TX_LOBUF_VSET_MSK 0x30000000 ++#define CBR_RG_TX_LOBUF_VSET_I_MSK 0xcfffffff ++#define CBR_RG_TX_LOBUF_VSET_SFT 28 ++#define CBR_RG_TX_LOBUF_VSET_HI 29 ++#define CBR_RG_TX_LOBUF_VSET_SZ 2 ++#define CBR_RG_RX_SQDC_MSK 0x00000007 ++#define CBR_RG_RX_SQDC_I_MSK 0xfffffff8 ++#define CBR_RG_RX_SQDC_SFT 0 ++#define CBR_RG_RX_SQDC_HI 2 ++#define CBR_RG_RX_SQDC_SZ 3 ++#define CBR_RG_RX_DIV2_CORE_MSK 0x00000018 ++#define CBR_RG_RX_DIV2_CORE_I_MSK 0xffffffe7 ++#define CBR_RG_RX_DIV2_CORE_SFT 3 ++#define CBR_RG_RX_DIV2_CORE_HI 4 ++#define CBR_RG_RX_DIV2_CORE_SZ 2 ++#define CBR_RG_RX_LOBUF_MSK 0x00000060 ++#define CBR_RG_RX_LOBUF_I_MSK 0xffffff9f ++#define CBR_RG_RX_LOBUF_SFT 5 ++#define CBR_RG_RX_LOBUF_HI 6 ++#define CBR_RG_RX_LOBUF_SZ 2 ++#define CBR_RG_TX_DPDGM_BIAS_MSK 0x00000780 ++#define CBR_RG_TX_DPDGM_BIAS_I_MSK 0xfffff87f ++#define CBR_RG_TX_DPDGM_BIAS_SFT 7 ++#define CBR_RG_TX_DPDGM_BIAS_HI 10 ++#define CBR_RG_TX_DPDGM_BIAS_SZ 4 ++#define CBR_RG_TX_DPD_DIV_MSK 0x00007800 ++#define CBR_RG_TX_DPD_DIV_I_MSK 0xffff87ff ++#define CBR_RG_TX_DPD_DIV_SFT 11 ++#define CBR_RG_TX_DPD_DIV_HI 14 ++#define CBR_RG_TX_DPD_DIV_SZ 4 ++#define CBR_RG_TX_TSSI_BIAS_MSK 0x00038000 ++#define CBR_RG_TX_TSSI_BIAS_I_MSK 0xfffc7fff ++#define CBR_RG_TX_TSSI_BIAS_SFT 15 ++#define CBR_RG_TX_TSSI_BIAS_HI 17 ++#define CBR_RG_TX_TSSI_BIAS_SZ 3 ++#define CBR_RG_TX_TSSI_DIV_MSK 0x001c0000 ++#define CBR_RG_TX_TSSI_DIV_I_MSK 0xffe3ffff ++#define CBR_RG_TX_TSSI_DIV_SFT 18 ++#define CBR_RG_TX_TSSI_DIV_HI 20 ++#define CBR_RG_TX_TSSI_DIV_SZ 3 ++#define CBR_RG_TX_TSSI_TESTMODE_MSK 0x00200000 ++#define CBR_RG_TX_TSSI_TESTMODE_I_MSK 0xffdfffff ++#define CBR_RG_TX_TSSI_TESTMODE_SFT 21 ++#define CBR_RG_TX_TSSI_TESTMODE_HI 21 ++#define CBR_RG_TX_TSSI_TESTMODE_SZ 1 ++#define CBR_RG_TX_TSSI_TEST_MSK 0x00c00000 ++#define CBR_RG_TX_TSSI_TEST_I_MSK 0xff3fffff ++#define CBR_RG_TX_TSSI_TEST_SFT 22 ++#define CBR_RG_TX_TSSI_TEST_HI 23 ++#define CBR_RG_TX_TSSI_TEST_SZ 2 ++#define CBR_RG_RX_HG_LNA_GC_MSK 0x00000003 ++#define CBR_RG_RX_HG_LNA_GC_I_MSK 0xfffffffc ++#define CBR_RG_RX_HG_LNA_GC_SFT 0 ++#define CBR_RG_RX_HG_LNA_GC_HI 1 ++#define CBR_RG_RX_HG_LNA_GC_SZ 2 ++#define CBR_RG_RX_HG_LNAHGN_BIAS_MSK 0x0000003c ++#define CBR_RG_RX_HG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define CBR_RG_RX_HG_LNAHGN_BIAS_SFT 2 ++#define CBR_RG_RX_HG_LNAHGN_BIAS_HI 5 ++#define CBR_RG_RX_HG_LNAHGN_BIAS_SZ 4 ++#define CBR_RG_RX_HG_LNAHGP_BIAS_MSK 0x000003c0 ++#define CBR_RG_RX_HG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define CBR_RG_RX_HG_LNAHGP_BIAS_SFT 6 ++#define CBR_RG_RX_HG_LNAHGP_BIAS_HI 9 ++#define CBR_RG_RX_HG_LNAHGP_BIAS_SZ 4 ++#define CBR_RG_RX_HG_LNALG_BIAS_MSK 0x00003c00 ++#define CBR_RG_RX_HG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define CBR_RG_RX_HG_LNALG_BIAS_SFT 10 ++#define CBR_RG_RX_HG_LNALG_BIAS_HI 13 ++#define CBR_RG_RX_HG_LNALG_BIAS_SZ 4 ++#define CBR_RG_RX_HG_TZ_GC_MSK 0x0000c000 ++#define CBR_RG_RX_HG_TZ_GC_I_MSK 0xffff3fff ++#define CBR_RG_RX_HG_TZ_GC_SFT 14 ++#define CBR_RG_RX_HG_TZ_GC_HI 15 ++#define CBR_RG_RX_HG_TZ_GC_SZ 2 ++#define CBR_RG_RX_HG_TZ_CAP_MSK 0x00070000 ++#define CBR_RG_RX_HG_TZ_CAP_I_MSK 0xfff8ffff ++#define CBR_RG_RX_HG_TZ_CAP_SFT 16 ++#define CBR_RG_RX_HG_TZ_CAP_HI 18 ++#define CBR_RG_RX_HG_TZ_CAP_SZ 3 ++#define CBR_RG_RX_MG_LNA_GC_MSK 0x00000003 ++#define CBR_RG_RX_MG_LNA_GC_I_MSK 0xfffffffc ++#define CBR_RG_RX_MG_LNA_GC_SFT 0 ++#define CBR_RG_RX_MG_LNA_GC_HI 1 ++#define CBR_RG_RX_MG_LNA_GC_SZ 2 ++#define CBR_RG_RX_MG_LNAHGN_BIAS_MSK 0x0000003c ++#define CBR_RG_RX_MG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define CBR_RG_RX_MG_LNAHGN_BIAS_SFT 2 ++#define CBR_RG_RX_MG_LNAHGN_BIAS_HI 5 ++#define CBR_RG_RX_MG_LNAHGN_BIAS_SZ 4 ++#define CBR_RG_RX_MG_LNAHGP_BIAS_MSK 0x000003c0 ++#define CBR_RG_RX_MG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define CBR_RG_RX_MG_LNAHGP_BIAS_SFT 6 ++#define CBR_RG_RX_MG_LNAHGP_BIAS_HI 9 ++#define CBR_RG_RX_MG_LNAHGP_BIAS_SZ 4 ++#define CBR_RG_RX_MG_LNALG_BIAS_MSK 0x00003c00 ++#define CBR_RG_RX_MG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define CBR_RG_RX_MG_LNALG_BIAS_SFT 10 ++#define CBR_RG_RX_MG_LNALG_BIAS_HI 13 ++#define CBR_RG_RX_MG_LNALG_BIAS_SZ 4 ++#define CBR_RG_RX_MG_TZ_GC_MSK 0x0000c000 ++#define CBR_RG_RX_MG_TZ_GC_I_MSK 0xffff3fff ++#define CBR_RG_RX_MG_TZ_GC_SFT 14 ++#define CBR_RG_RX_MG_TZ_GC_HI 15 ++#define CBR_RG_RX_MG_TZ_GC_SZ 2 ++#define CBR_RG_RX_MG_TZ_CAP_MSK 0x00070000 ++#define CBR_RG_RX_MG_TZ_CAP_I_MSK 0xfff8ffff ++#define CBR_RG_RX_MG_TZ_CAP_SFT 16 ++#define CBR_RG_RX_MG_TZ_CAP_HI 18 ++#define CBR_RG_RX_MG_TZ_CAP_SZ 3 ++#define CBR_RG_RX_LG_LNA_GC_MSK 0x00000003 ++#define CBR_RG_RX_LG_LNA_GC_I_MSK 0xfffffffc ++#define CBR_RG_RX_LG_LNA_GC_SFT 0 ++#define CBR_RG_RX_LG_LNA_GC_HI 1 ++#define CBR_RG_RX_LG_LNA_GC_SZ 2 ++#define CBR_RG_RX_LG_LNAHGN_BIAS_MSK 0x0000003c ++#define CBR_RG_RX_LG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define CBR_RG_RX_LG_LNAHGN_BIAS_SFT 2 ++#define CBR_RG_RX_LG_LNAHGN_BIAS_HI 5 ++#define CBR_RG_RX_LG_LNAHGN_BIAS_SZ 4 ++#define CBR_RG_RX_LG_LNAHGP_BIAS_MSK 0x000003c0 ++#define CBR_RG_RX_LG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define CBR_RG_RX_LG_LNAHGP_BIAS_SFT 6 ++#define CBR_RG_RX_LG_LNAHGP_BIAS_HI 9 ++#define CBR_RG_RX_LG_LNAHGP_BIAS_SZ 4 ++#define CBR_RG_RX_LG_LNALG_BIAS_MSK 0x00003c00 ++#define CBR_RG_RX_LG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define CBR_RG_RX_LG_LNALG_BIAS_SFT 10 ++#define CBR_RG_RX_LG_LNALG_BIAS_HI 13 ++#define CBR_RG_RX_LG_LNALG_BIAS_SZ 4 ++#define CBR_RG_RX_LG_TZ_GC_MSK 0x0000c000 ++#define CBR_RG_RX_LG_TZ_GC_I_MSK 0xffff3fff ++#define CBR_RG_RX_LG_TZ_GC_SFT 14 ++#define CBR_RG_RX_LG_TZ_GC_HI 15 ++#define CBR_RG_RX_LG_TZ_GC_SZ 2 ++#define CBR_RG_RX_LG_TZ_CAP_MSK 0x00070000 ++#define CBR_RG_RX_LG_TZ_CAP_I_MSK 0xfff8ffff ++#define CBR_RG_RX_LG_TZ_CAP_SFT 16 ++#define CBR_RG_RX_LG_TZ_CAP_HI 18 ++#define CBR_RG_RX_LG_TZ_CAP_SZ 3 ++#define CBR_RG_RX_ULG_LNA_GC_MSK 0x00000003 ++#define CBR_RG_RX_ULG_LNA_GC_I_MSK 0xfffffffc ++#define CBR_RG_RX_ULG_LNA_GC_SFT 0 ++#define CBR_RG_RX_ULG_LNA_GC_HI 1 ++#define CBR_RG_RX_ULG_LNA_GC_SZ 2 ++#define CBR_RG_RX_ULG_LNAHGN_BIAS_MSK 0x0000003c ++#define CBR_RG_RX_ULG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define CBR_RG_RX_ULG_LNAHGN_BIAS_SFT 2 ++#define CBR_RG_RX_ULG_LNAHGN_BIAS_HI 5 ++#define CBR_RG_RX_ULG_LNAHGN_BIAS_SZ 4 ++#define CBR_RG_RX_ULG_LNAHGP_BIAS_MSK 0x000003c0 ++#define CBR_RG_RX_ULG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define CBR_RG_RX_ULG_LNAHGP_BIAS_SFT 6 ++#define CBR_RG_RX_ULG_LNAHGP_BIAS_HI 9 ++#define CBR_RG_RX_ULG_LNAHGP_BIAS_SZ 4 ++#define CBR_RG_RX_ULG_LNALG_BIAS_MSK 0x00003c00 ++#define CBR_RG_RX_ULG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define CBR_RG_RX_ULG_LNALG_BIAS_SFT 10 ++#define CBR_RG_RX_ULG_LNALG_BIAS_HI 13 ++#define CBR_RG_RX_ULG_LNALG_BIAS_SZ 4 ++#define CBR_RG_RX_ULG_TZ_GC_MSK 0x0000c000 ++#define CBR_RG_RX_ULG_TZ_GC_I_MSK 0xffff3fff ++#define CBR_RG_RX_ULG_TZ_GC_SFT 14 ++#define CBR_RG_RX_ULG_TZ_GC_HI 15 ++#define CBR_RG_RX_ULG_TZ_GC_SZ 2 ++#define CBR_RG_RX_ULG_TZ_CAP_MSK 0x00070000 ++#define CBR_RG_RX_ULG_TZ_CAP_I_MSK 0xfff8ffff ++#define CBR_RG_RX_ULG_TZ_CAP_SFT 16 ++#define CBR_RG_RX_ULG_TZ_CAP_HI 18 ++#define CBR_RG_RX_ULG_TZ_CAP_SZ 3 ++#define CBR_RG_HPF1_FAST_SET_X_MSK 0x00000001 ++#define CBR_RG_HPF1_FAST_SET_X_I_MSK 0xfffffffe ++#define CBR_RG_HPF1_FAST_SET_X_SFT 0 ++#define CBR_RG_HPF1_FAST_SET_X_HI 0 ++#define CBR_RG_HPF1_FAST_SET_X_SZ 1 ++#define CBR_RG_HPF1_FAST_SET_Y_MSK 0x00000002 ++#define CBR_RG_HPF1_FAST_SET_Y_I_MSK 0xfffffffd ++#define CBR_RG_HPF1_FAST_SET_Y_SFT 1 ++#define CBR_RG_HPF1_FAST_SET_Y_HI 1 ++#define CBR_RG_HPF1_FAST_SET_Y_SZ 1 ++#define CBR_RG_HPF1_FAST_SET_Z_MSK 0x00000004 ++#define CBR_RG_HPF1_FAST_SET_Z_I_MSK 0xfffffffb ++#define CBR_RG_HPF1_FAST_SET_Z_SFT 2 ++#define CBR_RG_HPF1_FAST_SET_Z_HI 2 ++#define CBR_RG_HPF1_FAST_SET_Z_SZ 1 ++#define CBR_RG_HPF_T1A_MSK 0x00000018 ++#define CBR_RG_HPF_T1A_I_MSK 0xffffffe7 ++#define CBR_RG_HPF_T1A_SFT 3 ++#define CBR_RG_HPF_T1A_HI 4 ++#define CBR_RG_HPF_T1A_SZ 2 ++#define CBR_RG_HPF_T1B_MSK 0x00000060 ++#define CBR_RG_HPF_T1B_I_MSK 0xffffff9f ++#define CBR_RG_HPF_T1B_SFT 5 ++#define CBR_RG_HPF_T1B_HI 6 ++#define CBR_RG_HPF_T1B_SZ 2 ++#define CBR_RG_HPF_T1C_MSK 0x00000180 ++#define CBR_RG_HPF_T1C_I_MSK 0xfffffe7f ++#define CBR_RG_HPF_T1C_SFT 7 ++#define CBR_RG_HPF_T1C_HI 8 ++#define CBR_RG_HPF_T1C_SZ 2 ++#define CBR_RG_RX_LNA_TRI_SEL_MSK 0x00000600 ++#define CBR_RG_RX_LNA_TRI_SEL_I_MSK 0xfffff9ff ++#define CBR_RG_RX_LNA_TRI_SEL_SFT 9 ++#define CBR_RG_RX_LNA_TRI_SEL_HI 10 ++#define CBR_RG_RX_LNA_TRI_SEL_SZ 2 ++#define CBR_RG_RX_LNA_SETTLE_MSK 0x00001800 ++#define CBR_RG_RX_LNA_SETTLE_I_MSK 0xffffe7ff ++#define CBR_RG_RX_LNA_SETTLE_SFT 11 ++#define CBR_RG_RX_LNA_SETTLE_HI 12 ++#define CBR_RG_RX_LNA_SETTLE_SZ 2 ++#define CBR_RG_ADC_CLKSEL_MSK 0x00000001 ++#define CBR_RG_ADC_CLKSEL_I_MSK 0xfffffffe ++#define CBR_RG_ADC_CLKSEL_SFT 0 ++#define CBR_RG_ADC_CLKSEL_HI 0 ++#define CBR_RG_ADC_CLKSEL_SZ 1 ++#define CBR_RG_ADC_DIBIAS_MSK 0x00000006 ++#define CBR_RG_ADC_DIBIAS_I_MSK 0xfffffff9 ++#define CBR_RG_ADC_DIBIAS_SFT 1 ++#define CBR_RG_ADC_DIBIAS_HI 2 ++#define CBR_RG_ADC_DIBIAS_SZ 2 ++#define CBR_RG_ADC_DIVR_MSK 0x00000008 ++#define CBR_RG_ADC_DIVR_I_MSK 0xfffffff7 ++#define CBR_RG_ADC_DIVR_SFT 3 ++#define CBR_RG_ADC_DIVR_HI 3 ++#define CBR_RG_ADC_DIVR_SZ 1 ++#define CBR_RG_ADC_DVCMI_MSK 0x00000030 ++#define CBR_RG_ADC_DVCMI_I_MSK 0xffffffcf ++#define CBR_RG_ADC_DVCMI_SFT 4 ++#define CBR_RG_ADC_DVCMI_HI 5 ++#define CBR_RG_ADC_DVCMI_SZ 2 ++#define CBR_RG_ADC_SAMSEL_MSK 0x000003c0 ++#define CBR_RG_ADC_SAMSEL_I_MSK 0xfffffc3f ++#define CBR_RG_ADC_SAMSEL_SFT 6 ++#define CBR_RG_ADC_SAMSEL_HI 9 ++#define CBR_RG_ADC_SAMSEL_SZ 4 ++#define CBR_RG_ADC_STNBY_MSK 0x00000400 ++#define CBR_RG_ADC_STNBY_I_MSK 0xfffffbff ++#define CBR_RG_ADC_STNBY_SFT 10 ++#define CBR_RG_ADC_STNBY_HI 10 ++#define CBR_RG_ADC_STNBY_SZ 1 ++#define CBR_RG_ADC_TESTMODE_MSK 0x00000800 ++#define CBR_RG_ADC_TESTMODE_I_MSK 0xfffff7ff ++#define CBR_RG_ADC_TESTMODE_SFT 11 ++#define CBR_RG_ADC_TESTMODE_HI 11 ++#define CBR_RG_ADC_TESTMODE_SZ 1 ++#define CBR_RG_ADC_TSEL_MSK 0x0000f000 ++#define CBR_RG_ADC_TSEL_I_MSK 0xffff0fff ++#define CBR_RG_ADC_TSEL_SFT 12 ++#define CBR_RG_ADC_TSEL_HI 15 ++#define CBR_RG_ADC_TSEL_SZ 4 ++#define CBR_RG_ADC_VRSEL_MSK 0x00030000 ++#define CBR_RG_ADC_VRSEL_I_MSK 0xfffcffff ++#define CBR_RG_ADC_VRSEL_SFT 16 ++#define CBR_RG_ADC_VRSEL_HI 17 ++#define CBR_RG_ADC_VRSEL_SZ 2 ++#define CBR_RG_DICMP_MSK 0x000c0000 ++#define CBR_RG_DICMP_I_MSK 0xfff3ffff ++#define CBR_RG_DICMP_SFT 18 ++#define CBR_RG_DICMP_HI 19 ++#define CBR_RG_DICMP_SZ 2 ++#define CBR_RG_DIOP_MSK 0x00300000 ++#define CBR_RG_DIOP_I_MSK 0xffcfffff ++#define CBR_RG_DIOP_SFT 20 ++#define CBR_RG_DIOP_HI 21 ++#define CBR_RG_DIOP_SZ 2 ++#define CBR_RG_DACI1ST_MSK 0x00000003 ++#define CBR_RG_DACI1ST_I_MSK 0xfffffffc ++#define CBR_RG_DACI1ST_SFT 0 ++#define CBR_RG_DACI1ST_HI 1 ++#define CBR_RG_DACI1ST_SZ 2 ++#define CBR_RG_TX_DACLPF_ICOURSE_MSK 0x0000000c ++#define CBR_RG_TX_DACLPF_ICOURSE_I_MSK 0xfffffff3 ++#define CBR_RG_TX_DACLPF_ICOURSE_SFT 2 ++#define CBR_RG_TX_DACLPF_ICOURSE_HI 3 ++#define CBR_RG_TX_DACLPF_ICOURSE_SZ 2 ++#define CBR_RG_TX_DACLPF_IFINE_MSK 0x00000030 ++#define CBR_RG_TX_DACLPF_IFINE_I_MSK 0xffffffcf ++#define CBR_RG_TX_DACLPF_IFINE_SFT 4 ++#define CBR_RG_TX_DACLPF_IFINE_HI 5 ++#define CBR_RG_TX_DACLPF_IFINE_SZ 2 ++#define CBR_RG_TX_DACLPF_VCM_MSK 0x000000c0 ++#define CBR_RG_TX_DACLPF_VCM_I_MSK 0xffffff3f ++#define CBR_RG_TX_DACLPF_VCM_SFT 6 ++#define CBR_RG_TX_DACLPF_VCM_HI 7 ++#define CBR_RG_TX_DACLPF_VCM_SZ 2 ++#define CBR_RG_TX_DAC_CKEDGE_SEL_MSK 0x00000100 ++#define CBR_RG_TX_DAC_CKEDGE_SEL_I_MSK 0xfffffeff ++#define CBR_RG_TX_DAC_CKEDGE_SEL_SFT 8 ++#define CBR_RG_TX_DAC_CKEDGE_SEL_HI 8 ++#define CBR_RG_TX_DAC_CKEDGE_SEL_SZ 1 ++#define CBR_RG_TX_DAC_IBIAS_MSK 0x00000600 ++#define CBR_RG_TX_DAC_IBIAS_I_MSK 0xfffff9ff ++#define CBR_RG_TX_DAC_IBIAS_SFT 9 ++#define CBR_RG_TX_DAC_IBIAS_HI 10 ++#define CBR_RG_TX_DAC_IBIAS_SZ 2 ++#define CBR_RG_TX_DAC_OS_MSK 0x00003800 ++#define CBR_RG_TX_DAC_OS_I_MSK 0xffffc7ff ++#define CBR_RG_TX_DAC_OS_SFT 11 ++#define CBR_RG_TX_DAC_OS_HI 13 ++#define CBR_RG_TX_DAC_OS_SZ 3 ++#define CBR_RG_TX_DAC_RCAL_MSK 0x0000c000 ++#define CBR_RG_TX_DAC_RCAL_I_MSK 0xffff3fff ++#define CBR_RG_TX_DAC_RCAL_SFT 14 ++#define CBR_RG_TX_DAC_RCAL_HI 15 ++#define CBR_RG_TX_DAC_RCAL_SZ 2 ++#define CBR_RG_TX_DAC_TSEL_MSK 0x000f0000 ++#define CBR_RG_TX_DAC_TSEL_I_MSK 0xfff0ffff ++#define CBR_RG_TX_DAC_TSEL_SFT 16 ++#define CBR_RG_TX_DAC_TSEL_HI 19 ++#define CBR_RG_TX_DAC_TSEL_SZ 4 ++#define CBR_RG_TX_EN_VOLTAGE_IN_MSK 0x00100000 ++#define CBR_RG_TX_EN_VOLTAGE_IN_I_MSK 0xffefffff ++#define CBR_RG_TX_EN_VOLTAGE_IN_SFT 20 ++#define CBR_RG_TX_EN_VOLTAGE_IN_HI 20 ++#define CBR_RG_TX_EN_VOLTAGE_IN_SZ 1 ++#define CBR_RG_TXLPF_BYPASS_MSK 0x00200000 ++#define CBR_RG_TXLPF_BYPASS_I_MSK 0xffdfffff ++#define CBR_RG_TXLPF_BYPASS_SFT 21 ++#define CBR_RG_TXLPF_BYPASS_HI 21 ++#define CBR_RG_TXLPF_BYPASS_SZ 1 ++#define CBR_RG_TXLPF_BOOSTI_MSK 0x00400000 ++#define CBR_RG_TXLPF_BOOSTI_I_MSK 0xffbfffff ++#define CBR_RG_TXLPF_BOOSTI_SFT 22 ++#define CBR_RG_TXLPF_BOOSTI_HI 22 ++#define CBR_RG_TXLPF_BOOSTI_SZ 1 ++#define CBR_RG_EN_SX_R3_MSK 0x00000001 ++#define CBR_RG_EN_SX_R3_I_MSK 0xfffffffe ++#define CBR_RG_EN_SX_R3_SFT 0 ++#define CBR_RG_EN_SX_R3_HI 0 ++#define CBR_RG_EN_SX_R3_SZ 1 ++#define CBR_RG_EN_SX_CH_MSK 0x00000002 ++#define CBR_RG_EN_SX_CH_I_MSK 0xfffffffd ++#define CBR_RG_EN_SX_CH_SFT 1 ++#define CBR_RG_EN_SX_CH_HI 1 ++#define CBR_RG_EN_SX_CH_SZ 1 ++#define CBR_RG_EN_SX_CHP_MSK 0x00000004 ++#define CBR_RG_EN_SX_CHP_I_MSK 0xfffffffb ++#define CBR_RG_EN_SX_CHP_SFT 2 ++#define CBR_RG_EN_SX_CHP_HI 2 ++#define CBR_RG_EN_SX_CHP_SZ 1 ++#define CBR_RG_EN_SX_DIVCK_MSK 0x00000008 ++#define CBR_RG_EN_SX_DIVCK_I_MSK 0xfffffff7 ++#define CBR_RG_EN_SX_DIVCK_SFT 3 ++#define CBR_RG_EN_SX_DIVCK_HI 3 ++#define CBR_RG_EN_SX_DIVCK_SZ 1 ++#define CBR_RG_EN_SX_VCOBF_MSK 0x00000010 ++#define CBR_RG_EN_SX_VCOBF_I_MSK 0xffffffef ++#define CBR_RG_EN_SX_VCOBF_SFT 4 ++#define CBR_RG_EN_SX_VCOBF_HI 4 ++#define CBR_RG_EN_SX_VCOBF_SZ 1 ++#define CBR_RG_EN_SX_VCO_MSK 0x00000020 ++#define CBR_RG_EN_SX_VCO_I_MSK 0xffffffdf ++#define CBR_RG_EN_SX_VCO_SFT 5 ++#define CBR_RG_EN_SX_VCO_HI 5 ++#define CBR_RG_EN_SX_VCO_SZ 1 ++#define CBR_RG_EN_SX_MOD_MSK 0x00000040 ++#define CBR_RG_EN_SX_MOD_I_MSK 0xffffffbf ++#define CBR_RG_EN_SX_MOD_SFT 6 ++#define CBR_RG_EN_SX_MOD_HI 6 ++#define CBR_RG_EN_SX_MOD_SZ 1 ++#define CBR_RG_EN_SX_LCK_MSK 0x00000080 ++#define CBR_RG_EN_SX_LCK_I_MSK 0xffffff7f ++#define CBR_RG_EN_SX_LCK_SFT 7 ++#define CBR_RG_EN_SX_LCK_HI 7 ++#define CBR_RG_EN_SX_LCK_SZ 1 ++#define CBR_RG_EN_SX_DITHER_MSK 0x00000100 ++#define CBR_RG_EN_SX_DITHER_I_MSK 0xfffffeff ++#define CBR_RG_EN_SX_DITHER_SFT 8 ++#define CBR_RG_EN_SX_DITHER_HI 8 ++#define CBR_RG_EN_SX_DITHER_SZ 1 ++#define CBR_RG_EN_SX_DELCAL_MSK 0x00000200 ++#define CBR_RG_EN_SX_DELCAL_I_MSK 0xfffffdff ++#define CBR_RG_EN_SX_DELCAL_SFT 9 ++#define CBR_RG_EN_SX_DELCAL_HI 9 ++#define CBR_RG_EN_SX_DELCAL_SZ 1 ++#define CBR_RG_EN_SX_PC_BYPASS_MSK 0x00000400 ++#define CBR_RG_EN_SX_PC_BYPASS_I_MSK 0xfffffbff ++#define CBR_RG_EN_SX_PC_BYPASS_SFT 10 ++#define CBR_RG_EN_SX_PC_BYPASS_HI 10 ++#define CBR_RG_EN_SX_PC_BYPASS_SZ 1 ++#define CBR_RG_EN_SX_VT_MON_MSK 0x00000800 ++#define CBR_RG_EN_SX_VT_MON_I_MSK 0xfffff7ff ++#define CBR_RG_EN_SX_VT_MON_SFT 11 ++#define CBR_RG_EN_SX_VT_MON_HI 11 ++#define CBR_RG_EN_SX_VT_MON_SZ 1 ++#define CBR_RG_EN_SX_VT_MON_DG_MSK 0x00001000 ++#define CBR_RG_EN_SX_VT_MON_DG_I_MSK 0xffffefff ++#define CBR_RG_EN_SX_VT_MON_DG_SFT 12 ++#define CBR_RG_EN_SX_VT_MON_DG_HI 12 ++#define CBR_RG_EN_SX_VT_MON_DG_SZ 1 ++#define CBR_RG_EN_SX_DIV_MSK 0x00002000 ++#define CBR_RG_EN_SX_DIV_I_MSK 0xffffdfff ++#define CBR_RG_EN_SX_DIV_SFT 13 ++#define CBR_RG_EN_SX_DIV_HI 13 ++#define CBR_RG_EN_SX_DIV_SZ 1 ++#define CBR_RG_EN_SX_LPF_MSK 0x00004000 ++#define CBR_RG_EN_SX_LPF_I_MSK 0xffffbfff ++#define CBR_RG_EN_SX_LPF_SFT 14 ++#define CBR_RG_EN_SX_LPF_HI 14 ++#define CBR_RG_EN_SX_LPF_SZ 1 ++#define CBR_RG_SX_RFCTRL_F_MSK 0x00ffffff ++#define CBR_RG_SX_RFCTRL_F_I_MSK 0xff000000 ++#define CBR_RG_SX_RFCTRL_F_SFT 0 ++#define CBR_RG_SX_RFCTRL_F_HI 23 ++#define CBR_RG_SX_RFCTRL_F_SZ 24 ++#define CBR_RG_SX_SEL_CP_MSK 0x0f000000 ++#define CBR_RG_SX_SEL_CP_I_MSK 0xf0ffffff ++#define CBR_RG_SX_SEL_CP_SFT 24 ++#define CBR_RG_SX_SEL_CP_HI 27 ++#define CBR_RG_SX_SEL_CP_SZ 4 ++#define CBR_RG_SX_SEL_CS_MSK 0xf0000000 ++#define CBR_RG_SX_SEL_CS_I_MSK 0x0fffffff ++#define CBR_RG_SX_SEL_CS_SFT 28 ++#define CBR_RG_SX_SEL_CS_HI 31 ++#define CBR_RG_SX_SEL_CS_SZ 4 ++#define CBR_RG_SX_RFCTRL_CH_MSK 0x000007ff ++#define CBR_RG_SX_RFCTRL_CH_I_MSK 0xfffff800 ++#define CBR_RG_SX_RFCTRL_CH_SFT 0 ++#define CBR_RG_SX_RFCTRL_CH_HI 10 ++#define CBR_RG_SX_RFCTRL_CH_SZ 11 ++#define CBR_RG_SX_SEL_C3_MSK 0x00007800 ++#define CBR_RG_SX_SEL_C3_I_MSK 0xffff87ff ++#define CBR_RG_SX_SEL_C3_SFT 11 ++#define CBR_RG_SX_SEL_C3_HI 14 ++#define CBR_RG_SX_SEL_C3_SZ 4 ++#define CBR_RG_SX_SEL_RS_MSK 0x000f8000 ++#define CBR_RG_SX_SEL_RS_I_MSK 0xfff07fff ++#define CBR_RG_SX_SEL_RS_SFT 15 ++#define CBR_RG_SX_SEL_RS_HI 19 ++#define CBR_RG_SX_SEL_RS_SZ 5 ++#define CBR_RG_SX_SEL_R3_MSK 0x01f00000 ++#define CBR_RG_SX_SEL_R3_I_MSK 0xfe0fffff ++#define CBR_RG_SX_SEL_R3_SFT 20 ++#define CBR_RG_SX_SEL_R3_HI 24 ++#define CBR_RG_SX_SEL_R3_SZ 5 ++#define CBR_RG_SX_SEL_ICHP_MSK 0x0000001f ++#define CBR_RG_SX_SEL_ICHP_I_MSK 0xffffffe0 ++#define CBR_RG_SX_SEL_ICHP_SFT 0 ++#define CBR_RG_SX_SEL_ICHP_HI 4 ++#define CBR_RG_SX_SEL_ICHP_SZ 5 ++#define CBR_RG_SX_SEL_PCHP_MSK 0x000003e0 ++#define CBR_RG_SX_SEL_PCHP_I_MSK 0xfffffc1f ++#define CBR_RG_SX_SEL_PCHP_SFT 5 ++#define CBR_RG_SX_SEL_PCHP_HI 9 ++#define CBR_RG_SX_SEL_PCHP_SZ 5 ++#define CBR_RG_SX_SEL_CHP_REGOP_MSK 0x00003c00 ++#define CBR_RG_SX_SEL_CHP_REGOP_I_MSK 0xffffc3ff ++#define CBR_RG_SX_SEL_CHP_REGOP_SFT 10 ++#define CBR_RG_SX_SEL_CHP_REGOP_HI 13 ++#define CBR_RG_SX_SEL_CHP_REGOP_SZ 4 ++#define CBR_RG_SX_SEL_CHP_UNIOP_MSK 0x0003c000 ++#define CBR_RG_SX_SEL_CHP_UNIOP_I_MSK 0xfffc3fff ++#define CBR_RG_SX_SEL_CHP_UNIOP_SFT 14 ++#define CBR_RG_SX_SEL_CHP_UNIOP_HI 17 ++#define CBR_RG_SX_SEL_CHP_UNIOP_SZ 4 ++#define CBR_RG_SX_CHP_IOST_POL_MSK 0x00040000 ++#define CBR_RG_SX_CHP_IOST_POL_I_MSK 0xfffbffff ++#define CBR_RG_SX_CHP_IOST_POL_SFT 18 ++#define CBR_RG_SX_CHP_IOST_POL_HI 18 ++#define CBR_RG_SX_CHP_IOST_POL_SZ 1 ++#define CBR_RG_SX_CHP_IOST_MSK 0x00380000 ++#define CBR_RG_SX_CHP_IOST_I_MSK 0xffc7ffff ++#define CBR_RG_SX_CHP_IOST_SFT 19 ++#define CBR_RG_SX_CHP_IOST_HI 21 ++#define CBR_RG_SX_CHP_IOST_SZ 3 ++#define CBR_RG_SX_PFDSEL_MSK 0x00400000 ++#define CBR_RG_SX_PFDSEL_I_MSK 0xffbfffff ++#define CBR_RG_SX_PFDSEL_SFT 22 ++#define CBR_RG_SX_PFDSEL_HI 22 ++#define CBR_RG_SX_PFDSEL_SZ 1 ++#define CBR_RG_SX_PFD_SET_MSK 0x00800000 ++#define CBR_RG_SX_PFD_SET_I_MSK 0xff7fffff ++#define CBR_RG_SX_PFD_SET_SFT 23 ++#define CBR_RG_SX_PFD_SET_HI 23 ++#define CBR_RG_SX_PFD_SET_SZ 1 ++#define CBR_RG_SX_PFD_SET1_MSK 0x01000000 ++#define CBR_RG_SX_PFD_SET1_I_MSK 0xfeffffff ++#define CBR_RG_SX_PFD_SET1_SFT 24 ++#define CBR_RG_SX_PFD_SET1_HI 24 ++#define CBR_RG_SX_PFD_SET1_SZ 1 ++#define CBR_RG_SX_PFD_SET2_MSK 0x02000000 ++#define CBR_RG_SX_PFD_SET2_I_MSK 0xfdffffff ++#define CBR_RG_SX_PFD_SET2_SFT 25 ++#define CBR_RG_SX_PFD_SET2_HI 25 ++#define CBR_RG_SX_PFD_SET2_SZ 1 ++#define CBR_RG_SX_VBNCAS_SEL_MSK 0x04000000 ++#define CBR_RG_SX_VBNCAS_SEL_I_MSK 0xfbffffff ++#define CBR_RG_SX_VBNCAS_SEL_SFT 26 ++#define CBR_RG_SX_VBNCAS_SEL_HI 26 ++#define CBR_RG_SX_VBNCAS_SEL_SZ 1 ++#define CBR_RG_SX_PFD_RST_H_MSK 0x08000000 ++#define CBR_RG_SX_PFD_RST_H_I_MSK 0xf7ffffff ++#define CBR_RG_SX_PFD_RST_H_SFT 27 ++#define CBR_RG_SX_PFD_RST_H_HI 27 ++#define CBR_RG_SX_PFD_RST_H_SZ 1 ++#define CBR_RG_SX_PFD_TRUP_MSK 0x10000000 ++#define CBR_RG_SX_PFD_TRUP_I_MSK 0xefffffff ++#define CBR_RG_SX_PFD_TRUP_SFT 28 ++#define CBR_RG_SX_PFD_TRUP_HI 28 ++#define CBR_RG_SX_PFD_TRUP_SZ 1 ++#define CBR_RG_SX_PFD_TRDN_MSK 0x20000000 ++#define CBR_RG_SX_PFD_TRDN_I_MSK 0xdfffffff ++#define CBR_RG_SX_PFD_TRDN_SFT 29 ++#define CBR_RG_SX_PFD_TRDN_HI 29 ++#define CBR_RG_SX_PFD_TRDN_SZ 1 ++#define CBR_RG_SX_PFD_TRSEL_MSK 0x40000000 ++#define CBR_RG_SX_PFD_TRSEL_I_MSK 0xbfffffff ++#define CBR_RG_SX_PFD_TRSEL_SFT 30 ++#define CBR_RG_SX_PFD_TRSEL_HI 30 ++#define CBR_RG_SX_PFD_TRSEL_SZ 1 ++#define CBR_RG_SX_VCOBA_R_MSK 0x00000007 ++#define CBR_RG_SX_VCOBA_R_I_MSK 0xfffffff8 ++#define CBR_RG_SX_VCOBA_R_SFT 0 ++#define CBR_RG_SX_VCOBA_R_HI 2 ++#define CBR_RG_SX_VCOBA_R_SZ 3 ++#define CBR_RG_SX_VCORSEL_MSK 0x000000f8 ++#define CBR_RG_SX_VCORSEL_I_MSK 0xffffff07 ++#define CBR_RG_SX_VCORSEL_SFT 3 ++#define CBR_RG_SX_VCORSEL_HI 7 ++#define CBR_RG_SX_VCORSEL_SZ 5 ++#define CBR_RG_SX_VCOCUSEL_MSK 0x00000f00 ++#define CBR_RG_SX_VCOCUSEL_I_MSK 0xfffff0ff ++#define CBR_RG_SX_VCOCUSEL_SFT 8 ++#define CBR_RG_SX_VCOCUSEL_HI 11 ++#define CBR_RG_SX_VCOCUSEL_SZ 4 ++#define CBR_RG_SX_RXBFSEL_MSK 0x0000f000 ++#define CBR_RG_SX_RXBFSEL_I_MSK 0xffff0fff ++#define CBR_RG_SX_RXBFSEL_SFT 12 ++#define CBR_RG_SX_RXBFSEL_HI 15 ++#define CBR_RG_SX_RXBFSEL_SZ 4 ++#define CBR_RG_SX_TXBFSEL_MSK 0x000f0000 ++#define CBR_RG_SX_TXBFSEL_I_MSK 0xfff0ffff ++#define CBR_RG_SX_TXBFSEL_SFT 16 ++#define CBR_RG_SX_TXBFSEL_HI 19 ++#define CBR_RG_SX_TXBFSEL_SZ 4 ++#define CBR_RG_SX_VCOBFSEL_MSK 0x00f00000 ++#define CBR_RG_SX_VCOBFSEL_I_MSK 0xff0fffff ++#define CBR_RG_SX_VCOBFSEL_SFT 20 ++#define CBR_RG_SX_VCOBFSEL_HI 23 ++#define CBR_RG_SX_VCOBFSEL_SZ 4 ++#define CBR_RG_SX_DIVBFSEL_MSK 0x0f000000 ++#define CBR_RG_SX_DIVBFSEL_I_MSK 0xf0ffffff ++#define CBR_RG_SX_DIVBFSEL_SFT 24 ++#define CBR_RG_SX_DIVBFSEL_HI 27 ++#define CBR_RG_SX_DIVBFSEL_SZ 4 ++#define CBR_RG_SX_GNDR_SEL_MSK 0xf0000000 ++#define CBR_RG_SX_GNDR_SEL_I_MSK 0x0fffffff ++#define CBR_RG_SX_GNDR_SEL_SFT 28 ++#define CBR_RG_SX_GNDR_SEL_HI 31 ++#define CBR_RG_SX_GNDR_SEL_SZ 4 ++#define CBR_RG_SX_DITHER_WEIGHT_MSK 0x00000003 ++#define CBR_RG_SX_DITHER_WEIGHT_I_MSK 0xfffffffc ++#define CBR_RG_SX_DITHER_WEIGHT_SFT 0 ++#define CBR_RG_SX_DITHER_WEIGHT_HI 1 ++#define CBR_RG_SX_DITHER_WEIGHT_SZ 2 ++#define CBR_RG_SX_MOD_ERRCMP_MSK 0x0000000c ++#define CBR_RG_SX_MOD_ERRCMP_I_MSK 0xfffffff3 ++#define CBR_RG_SX_MOD_ERRCMP_SFT 2 ++#define CBR_RG_SX_MOD_ERRCMP_HI 3 ++#define CBR_RG_SX_MOD_ERRCMP_SZ 2 ++#define CBR_RG_SX_MOD_ORDER_MSK 0x00000030 ++#define CBR_RG_SX_MOD_ORDER_I_MSK 0xffffffcf ++#define CBR_RG_SX_MOD_ORDER_SFT 4 ++#define CBR_RG_SX_MOD_ORDER_HI 5 ++#define CBR_RG_SX_MOD_ORDER_SZ 2 ++#define CBR_RG_SX_SDM_D1_MSK 0x00000040 ++#define CBR_RG_SX_SDM_D1_I_MSK 0xffffffbf ++#define CBR_RG_SX_SDM_D1_SFT 6 ++#define CBR_RG_SX_SDM_D1_HI 6 ++#define CBR_RG_SX_SDM_D1_SZ 1 ++#define CBR_RG_SX_SDM_D2_MSK 0x00000080 ++#define CBR_RG_SX_SDM_D2_I_MSK 0xffffff7f ++#define CBR_RG_SX_SDM_D2_SFT 7 ++#define CBR_RG_SX_SDM_D2_HI 7 ++#define CBR_RG_SX_SDM_D2_SZ 1 ++#define CBR_RG_SDM_PASS_MSK 0x00000100 ++#define CBR_RG_SDM_PASS_I_MSK 0xfffffeff ++#define CBR_RG_SDM_PASS_SFT 8 ++#define CBR_RG_SDM_PASS_HI 8 ++#define CBR_RG_SDM_PASS_SZ 1 ++#define CBR_RG_SX_RST_H_DIV_MSK 0x00000200 ++#define CBR_RG_SX_RST_H_DIV_I_MSK 0xfffffdff ++#define CBR_RG_SX_RST_H_DIV_SFT 9 ++#define CBR_RG_SX_RST_H_DIV_HI 9 ++#define CBR_RG_SX_RST_H_DIV_SZ 1 ++#define CBR_RG_SX_SDM_EDGE_MSK 0x00000400 ++#define CBR_RG_SX_SDM_EDGE_I_MSK 0xfffffbff ++#define CBR_RG_SX_SDM_EDGE_SFT 10 ++#define CBR_RG_SX_SDM_EDGE_HI 10 ++#define CBR_RG_SX_SDM_EDGE_SZ 1 ++#define CBR_RG_SX_XO_GM_MSK 0x00001800 ++#define CBR_RG_SX_XO_GM_I_MSK 0xffffe7ff ++#define CBR_RG_SX_XO_GM_SFT 11 ++#define CBR_RG_SX_XO_GM_HI 12 ++#define CBR_RG_SX_XO_GM_SZ 2 ++#define CBR_RG_SX_REFBYTWO_MSK 0x00002000 ++#define CBR_RG_SX_REFBYTWO_I_MSK 0xffffdfff ++#define CBR_RG_SX_REFBYTWO_SFT 13 ++#define CBR_RG_SX_REFBYTWO_HI 13 ++#define CBR_RG_SX_REFBYTWO_SZ 1 ++#define CBR_RG_SX_XO_SWCAP_MSK 0x0003c000 ++#define CBR_RG_SX_XO_SWCAP_I_MSK 0xfffc3fff ++#define CBR_RG_SX_XO_SWCAP_SFT 14 ++#define CBR_RG_SX_XO_SWCAP_HI 17 ++#define CBR_RG_SX_XO_SWCAP_SZ 4 ++#define CBR_RG_SX_SDMLUT_INV_MSK 0x00040000 ++#define CBR_RG_SX_SDMLUT_INV_I_MSK 0xfffbffff ++#define CBR_RG_SX_SDMLUT_INV_SFT 18 ++#define CBR_RG_SX_SDMLUT_INV_HI 18 ++#define CBR_RG_SX_SDMLUT_INV_SZ 1 ++#define CBR_RG_SX_LCKEN_MSK 0x00080000 ++#define CBR_RG_SX_LCKEN_I_MSK 0xfff7ffff ++#define CBR_RG_SX_LCKEN_SFT 19 ++#define CBR_RG_SX_LCKEN_HI 19 ++#define CBR_RG_SX_LCKEN_SZ 1 ++#define CBR_RG_SX_PREVDD_MSK 0x00f00000 ++#define CBR_RG_SX_PREVDD_I_MSK 0xff0fffff ++#define CBR_RG_SX_PREVDD_SFT 20 ++#define CBR_RG_SX_PREVDD_HI 23 ++#define CBR_RG_SX_PREVDD_SZ 4 ++#define CBR_RG_SX_PSCONTERVDD_MSK 0x0f000000 ++#define CBR_RG_SX_PSCONTERVDD_I_MSK 0xf0ffffff ++#define CBR_RG_SX_PSCONTERVDD_SFT 24 ++#define CBR_RG_SX_PSCONTERVDD_HI 27 ++#define CBR_RG_SX_PSCONTERVDD_SZ 4 ++#define CBR_RG_SX_MOD_ERR_DELAY_MSK 0x30000000 ++#define CBR_RG_SX_MOD_ERR_DELAY_I_MSK 0xcfffffff ++#define CBR_RG_SX_MOD_ERR_DELAY_SFT 28 ++#define CBR_RG_SX_MOD_ERR_DELAY_HI 29 ++#define CBR_RG_SX_MOD_ERR_DELAY_SZ 2 ++#define CBR_RG_SX_MODDB_MSK 0x40000000 ++#define CBR_RG_SX_MODDB_I_MSK 0xbfffffff ++#define CBR_RG_SX_MODDB_SFT 30 ++#define CBR_RG_SX_MODDB_HI 30 ++#define CBR_RG_SX_MODDB_SZ 1 ++#define CBR_RG_SX_CV_CURVE_SEL_MSK 0x00000003 ++#define CBR_RG_SX_CV_CURVE_SEL_I_MSK 0xfffffffc ++#define CBR_RG_SX_CV_CURVE_SEL_SFT 0 ++#define CBR_RG_SX_CV_CURVE_SEL_HI 1 ++#define CBR_RG_SX_CV_CURVE_SEL_SZ 2 ++#define CBR_RG_SX_SEL_DELAY_MSK 0x0000007c ++#define CBR_RG_SX_SEL_DELAY_I_MSK 0xffffff83 ++#define CBR_RG_SX_SEL_DELAY_SFT 2 ++#define CBR_RG_SX_SEL_DELAY_HI 6 ++#define CBR_RG_SX_SEL_DELAY_SZ 5 ++#define CBR_RG_SX_REF_CYCLE_MSK 0x00000780 ++#define CBR_RG_SX_REF_CYCLE_I_MSK 0xfffff87f ++#define CBR_RG_SX_REF_CYCLE_SFT 7 ++#define CBR_RG_SX_REF_CYCLE_HI 10 ++#define CBR_RG_SX_REF_CYCLE_SZ 4 ++#define CBR_RG_SX_VCOBY16_MSK 0x00000800 ++#define CBR_RG_SX_VCOBY16_I_MSK 0xfffff7ff ++#define CBR_RG_SX_VCOBY16_SFT 11 ++#define CBR_RG_SX_VCOBY16_HI 11 ++#define CBR_RG_SX_VCOBY16_SZ 1 ++#define CBR_RG_SX_VCOBY32_MSK 0x00001000 ++#define CBR_RG_SX_VCOBY32_I_MSK 0xffffefff ++#define CBR_RG_SX_VCOBY32_SFT 12 ++#define CBR_RG_SX_VCOBY32_HI 12 ++#define CBR_RG_SX_VCOBY32_SZ 1 ++#define CBR_RG_SX_PH_MSK 0x00002000 ++#define CBR_RG_SX_PH_I_MSK 0xffffdfff ++#define CBR_RG_SX_PH_SFT 13 ++#define CBR_RG_SX_PH_HI 13 ++#define CBR_RG_SX_PH_SZ 1 ++#define CBR_RG_SX_PL_MSK 0x00004000 ++#define CBR_RG_SX_PL_I_MSK 0xffffbfff ++#define CBR_RG_SX_PL_SFT 14 ++#define CBR_RG_SX_PL_HI 14 ++#define CBR_RG_SX_PL_SZ 1 ++#define CBR_RG_SX_VT_MON_MODE_MSK 0x00000001 ++#define CBR_RG_SX_VT_MON_MODE_I_MSK 0xfffffffe ++#define CBR_RG_SX_VT_MON_MODE_SFT 0 ++#define CBR_RG_SX_VT_MON_MODE_HI 0 ++#define CBR_RG_SX_VT_MON_MODE_SZ 1 ++#define CBR_RG_SX_VT_TH_HI_MSK 0x00000006 ++#define CBR_RG_SX_VT_TH_HI_I_MSK 0xfffffff9 ++#define CBR_RG_SX_VT_TH_HI_SFT 1 ++#define CBR_RG_SX_VT_TH_HI_HI 2 ++#define CBR_RG_SX_VT_TH_HI_SZ 2 ++#define CBR_RG_SX_VT_TH_LO_MSK 0x00000018 ++#define CBR_RG_SX_VT_TH_LO_I_MSK 0xffffffe7 ++#define CBR_RG_SX_VT_TH_LO_SFT 3 ++#define CBR_RG_SX_VT_TH_LO_HI 4 ++#define CBR_RG_SX_VT_TH_LO_SZ 2 ++#define CBR_RG_SX_VT_SET_MSK 0x00000020 ++#define CBR_RG_SX_VT_SET_I_MSK 0xffffffdf ++#define CBR_RG_SX_VT_SET_SFT 5 ++#define CBR_RG_SX_VT_SET_HI 5 ++#define CBR_RG_SX_VT_SET_SZ 1 ++#define CBR_RG_SX_VT_MON_TMR_MSK 0x00007fc0 ++#define CBR_RG_SX_VT_MON_TMR_I_MSK 0xffff803f ++#define CBR_RG_SX_VT_MON_TMR_SFT 6 ++#define CBR_RG_SX_VT_MON_TMR_HI 14 ++#define CBR_RG_SX_VT_MON_TMR_SZ 9 ++#define CBR_RG_IDEAL_CYCLE_MSK 0x0fff8000 ++#define CBR_RG_IDEAL_CYCLE_I_MSK 0xf0007fff ++#define CBR_RG_IDEAL_CYCLE_SFT 15 ++#define CBR_RG_IDEAL_CYCLE_HI 27 ++#define CBR_RG_IDEAL_CYCLE_SZ 13 ++#define CBR_RG_EN_DP_VT_MON_MSK 0x00000001 ++#define CBR_RG_EN_DP_VT_MON_I_MSK 0xfffffffe ++#define CBR_RG_EN_DP_VT_MON_SFT 0 ++#define CBR_RG_EN_DP_VT_MON_HI 0 ++#define CBR_RG_EN_DP_VT_MON_SZ 1 ++#define CBR_RG_DP_VT_TH_HI_MSK 0x00000006 ++#define CBR_RG_DP_VT_TH_HI_I_MSK 0xfffffff9 ++#define CBR_RG_DP_VT_TH_HI_SFT 1 ++#define CBR_RG_DP_VT_TH_HI_HI 2 ++#define CBR_RG_DP_VT_TH_HI_SZ 2 ++#define CBR_RG_DP_VT_TH_LO_MSK 0x00000018 ++#define CBR_RG_DP_VT_TH_LO_I_MSK 0xffffffe7 ++#define CBR_RG_DP_VT_TH_LO_SFT 3 ++#define CBR_RG_DP_VT_TH_LO_HI 4 ++#define CBR_RG_DP_VT_TH_LO_SZ 2 ++#define CBR_RG_DP_VT_MON_TMR_MSK 0x00003fe0 ++#define CBR_RG_DP_VT_MON_TMR_I_MSK 0xffffc01f ++#define CBR_RG_DP_VT_MON_TMR_SFT 5 ++#define CBR_RG_DP_VT_MON_TMR_HI 13 ++#define CBR_RG_DP_VT_MON_TMR_SZ 9 ++#define CBR_RG_DP_CK320BY2_MSK 0x00004000 ++#define CBR_RG_DP_CK320BY2_I_MSK 0xffffbfff ++#define CBR_RG_DP_CK320BY2_SFT 14 ++#define CBR_RG_DP_CK320BY2_HI 14 ++#define CBR_RG_DP_CK320BY2_SZ 1 ++#define CBR_RG_SX_DELCTRL_MSK 0x001f8000 ++#define CBR_RG_SX_DELCTRL_I_MSK 0xffe07fff ++#define CBR_RG_SX_DELCTRL_SFT 15 ++#define CBR_RG_SX_DELCTRL_HI 20 ++#define CBR_RG_SX_DELCTRL_SZ 6 ++#define CBR_RG_DP_OD_TEST_MSK 0x00200000 ++#define CBR_RG_DP_OD_TEST_I_MSK 0xffdfffff ++#define CBR_RG_DP_OD_TEST_SFT 21 ++#define CBR_RG_DP_OD_TEST_HI 21 ++#define CBR_RG_DP_OD_TEST_SZ 1 ++#define CBR_RG_DP_BBPLL_BP_MSK 0x00000001 ++#define CBR_RG_DP_BBPLL_BP_I_MSK 0xfffffffe ++#define CBR_RG_DP_BBPLL_BP_SFT 0 ++#define CBR_RG_DP_BBPLL_BP_HI 0 ++#define CBR_RG_DP_BBPLL_BP_SZ 1 ++#define CBR_RG_DP_BBPLL_ICP_MSK 0x00000006 ++#define CBR_RG_DP_BBPLL_ICP_I_MSK 0xfffffff9 ++#define CBR_RG_DP_BBPLL_ICP_SFT 1 ++#define CBR_RG_DP_BBPLL_ICP_HI 2 ++#define CBR_RG_DP_BBPLL_ICP_SZ 2 ++#define CBR_RG_DP_BBPLL_IDUAL_MSK 0x00000018 ++#define CBR_RG_DP_BBPLL_IDUAL_I_MSK 0xffffffe7 ++#define CBR_RG_DP_BBPLL_IDUAL_SFT 3 ++#define CBR_RG_DP_BBPLL_IDUAL_HI 4 ++#define CBR_RG_DP_BBPLL_IDUAL_SZ 2 ++#define CBR_RG_DP_BBPLL_OD_TEST_MSK 0x000001e0 ++#define CBR_RG_DP_BBPLL_OD_TEST_I_MSK 0xfffffe1f ++#define CBR_RG_DP_BBPLL_OD_TEST_SFT 5 ++#define CBR_RG_DP_BBPLL_OD_TEST_HI 8 ++#define CBR_RG_DP_BBPLL_OD_TEST_SZ 4 ++#define CBR_RG_DP_BBPLL_PD_MSK 0x00000200 ++#define CBR_RG_DP_BBPLL_PD_I_MSK 0xfffffdff ++#define CBR_RG_DP_BBPLL_PD_SFT 9 ++#define CBR_RG_DP_BBPLL_PD_HI 9 ++#define CBR_RG_DP_BBPLL_PD_SZ 1 ++#define CBR_RG_DP_BBPLL_TESTSEL_MSK 0x00001c00 ++#define CBR_RG_DP_BBPLL_TESTSEL_I_MSK 0xffffe3ff ++#define CBR_RG_DP_BBPLL_TESTSEL_SFT 10 ++#define CBR_RG_DP_BBPLL_TESTSEL_HI 12 ++#define CBR_RG_DP_BBPLL_TESTSEL_SZ 3 ++#define CBR_RG_DP_BBPLL_PFD_DLY_MSK 0x00006000 ++#define CBR_RG_DP_BBPLL_PFD_DLY_I_MSK 0xffff9fff ++#define CBR_RG_DP_BBPLL_PFD_DLY_SFT 13 ++#define CBR_RG_DP_BBPLL_PFD_DLY_HI 14 ++#define CBR_RG_DP_BBPLL_PFD_DLY_SZ 2 ++#define CBR_RG_DP_RP_MSK 0x00038000 ++#define CBR_RG_DP_RP_I_MSK 0xfffc7fff ++#define CBR_RG_DP_RP_SFT 15 ++#define CBR_RG_DP_RP_HI 17 ++#define CBR_RG_DP_RP_SZ 3 ++#define CBR_RG_DP_RHP_MSK 0x000c0000 ++#define CBR_RG_DP_RHP_I_MSK 0xfff3ffff ++#define CBR_RG_DP_RHP_SFT 18 ++#define CBR_RG_DP_RHP_HI 19 ++#define CBR_RG_DP_RHP_SZ 2 ++#define CBR_RG_DP_DR3_MSK 0x00700000 ++#define CBR_RG_DP_DR3_I_MSK 0xff8fffff ++#define CBR_RG_DP_DR3_SFT 20 ++#define CBR_RG_DP_DR3_HI 22 ++#define CBR_RG_DP_DR3_SZ 3 ++#define CBR_RG_DP_DCP_MSK 0x07800000 ++#define CBR_RG_DP_DCP_I_MSK 0xf87fffff ++#define CBR_RG_DP_DCP_SFT 23 ++#define CBR_RG_DP_DCP_HI 26 ++#define CBR_RG_DP_DCP_SZ 4 ++#define CBR_RG_DP_DCS_MSK 0x78000000 ++#define CBR_RG_DP_DCS_I_MSK 0x87ffffff ++#define CBR_RG_DP_DCS_SFT 27 ++#define CBR_RG_DP_DCS_HI 30 ++#define CBR_RG_DP_DCS_SZ 4 ++#define CBR_RG_DP_FBDIV_MSK 0x00000fff ++#define CBR_RG_DP_FBDIV_I_MSK 0xfffff000 ++#define CBR_RG_DP_FBDIV_SFT 0 ++#define CBR_RG_DP_FBDIV_HI 11 ++#define CBR_RG_DP_FBDIV_SZ 12 ++#define CBR_RG_DP_FODIV_MSK 0x003ff000 ++#define CBR_RG_DP_FODIV_I_MSK 0xffc00fff ++#define CBR_RG_DP_FODIV_SFT 12 ++#define CBR_RG_DP_FODIV_HI 21 ++#define CBR_RG_DP_FODIV_SZ 10 ++#define CBR_RG_DP_REFDIV_MSK 0xffc00000 ++#define CBR_RG_DP_REFDIV_I_MSK 0x003fffff ++#define CBR_RG_DP_REFDIV_SFT 22 ++#define CBR_RG_DP_REFDIV_HI 31 ++#define CBR_RG_DP_REFDIV_SZ 10 ++#define CBR_RG_IDACAI_PGAG15_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG15_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG15_SFT 0 ++#define CBR_RG_IDACAI_PGAG15_HI 5 ++#define CBR_RG_IDACAI_PGAG15_SZ 6 ++#define CBR_RG_IDACAQ_PGAG15_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG15_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG15_SFT 6 ++#define CBR_RG_IDACAQ_PGAG15_HI 11 ++#define CBR_RG_IDACAQ_PGAG15_SZ 6 ++#define CBR_RG_IDACAI_PGAG14_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG14_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG14_SFT 12 ++#define CBR_RG_IDACAI_PGAG14_HI 17 ++#define CBR_RG_IDACAI_PGAG14_SZ 6 ++#define CBR_RG_IDACAQ_PGAG14_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG14_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG14_SFT 18 ++#define CBR_RG_IDACAQ_PGAG14_HI 23 ++#define CBR_RG_IDACAQ_PGAG14_SZ 6 ++#define CBR_RG_IDACAI_PGAG13_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG13_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG13_SFT 0 ++#define CBR_RG_IDACAI_PGAG13_HI 5 ++#define CBR_RG_IDACAI_PGAG13_SZ 6 ++#define CBR_RG_IDACAQ_PGAG13_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG13_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG13_SFT 6 ++#define CBR_RG_IDACAQ_PGAG13_HI 11 ++#define CBR_RG_IDACAQ_PGAG13_SZ 6 ++#define CBR_RG_IDACAI_PGAG12_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG12_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG12_SFT 12 ++#define CBR_RG_IDACAI_PGAG12_HI 17 ++#define CBR_RG_IDACAI_PGAG12_SZ 6 ++#define CBR_RG_IDACAQ_PGAG12_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG12_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG12_SFT 18 ++#define CBR_RG_IDACAQ_PGAG12_HI 23 ++#define CBR_RG_IDACAQ_PGAG12_SZ 6 ++#define CBR_RG_IDACAI_PGAG11_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG11_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG11_SFT 0 ++#define CBR_RG_IDACAI_PGAG11_HI 5 ++#define CBR_RG_IDACAI_PGAG11_SZ 6 ++#define CBR_RG_IDACAQ_PGAG11_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG11_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG11_SFT 6 ++#define CBR_RG_IDACAQ_PGAG11_HI 11 ++#define CBR_RG_IDACAQ_PGAG11_SZ 6 ++#define CBR_RG_IDACAI_PGAG10_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG10_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG10_SFT 12 ++#define CBR_RG_IDACAI_PGAG10_HI 17 ++#define CBR_RG_IDACAI_PGAG10_SZ 6 ++#define CBR_RG_IDACAQ_PGAG10_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG10_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG10_SFT 18 ++#define CBR_RG_IDACAQ_PGAG10_HI 23 ++#define CBR_RG_IDACAQ_PGAG10_SZ 6 ++#define CBR_RG_IDACAI_PGAG9_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG9_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG9_SFT 0 ++#define CBR_RG_IDACAI_PGAG9_HI 5 ++#define CBR_RG_IDACAI_PGAG9_SZ 6 ++#define CBR_RG_IDACAQ_PGAG9_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG9_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG9_SFT 6 ++#define CBR_RG_IDACAQ_PGAG9_HI 11 ++#define CBR_RG_IDACAQ_PGAG9_SZ 6 ++#define CBR_RG_IDACAI_PGAG8_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG8_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG8_SFT 12 ++#define CBR_RG_IDACAI_PGAG8_HI 17 ++#define CBR_RG_IDACAI_PGAG8_SZ 6 ++#define CBR_RG_IDACAQ_PGAG8_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG8_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG8_SFT 18 ++#define CBR_RG_IDACAQ_PGAG8_HI 23 ++#define CBR_RG_IDACAQ_PGAG8_SZ 6 ++#define CBR_RG_IDACAI_PGAG7_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG7_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG7_SFT 0 ++#define CBR_RG_IDACAI_PGAG7_HI 5 ++#define CBR_RG_IDACAI_PGAG7_SZ 6 ++#define CBR_RG_IDACAQ_PGAG7_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG7_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG7_SFT 6 ++#define CBR_RG_IDACAQ_PGAG7_HI 11 ++#define CBR_RG_IDACAQ_PGAG7_SZ 6 ++#define CBR_RG_IDACAI_PGAG6_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG6_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG6_SFT 12 ++#define CBR_RG_IDACAI_PGAG6_HI 17 ++#define CBR_RG_IDACAI_PGAG6_SZ 6 ++#define CBR_RG_IDACAQ_PGAG6_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG6_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG6_SFT 18 ++#define CBR_RG_IDACAQ_PGAG6_HI 23 ++#define CBR_RG_IDACAQ_PGAG6_SZ 6 ++#define CBR_RG_IDACAI_PGAG5_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG5_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG5_SFT 0 ++#define CBR_RG_IDACAI_PGAG5_HI 5 ++#define CBR_RG_IDACAI_PGAG5_SZ 6 ++#define CBR_RG_IDACAQ_PGAG5_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG5_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG5_SFT 6 ++#define CBR_RG_IDACAQ_PGAG5_HI 11 ++#define CBR_RG_IDACAQ_PGAG5_SZ 6 ++#define CBR_RG_IDACAI_PGAG4_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG4_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG4_SFT 12 ++#define CBR_RG_IDACAI_PGAG4_HI 17 ++#define CBR_RG_IDACAI_PGAG4_SZ 6 ++#define CBR_RG_IDACAQ_PGAG4_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG4_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG4_SFT 18 ++#define CBR_RG_IDACAQ_PGAG4_HI 23 ++#define CBR_RG_IDACAQ_PGAG4_SZ 6 ++#define CBR_RG_IDACAI_PGAG3_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG3_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG3_SFT 0 ++#define CBR_RG_IDACAI_PGAG3_HI 5 ++#define CBR_RG_IDACAI_PGAG3_SZ 6 ++#define CBR_RG_IDACAQ_PGAG3_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG3_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG3_SFT 6 ++#define CBR_RG_IDACAQ_PGAG3_HI 11 ++#define CBR_RG_IDACAQ_PGAG3_SZ 6 ++#define CBR_RG_IDACAI_PGAG2_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG2_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG2_SFT 12 ++#define CBR_RG_IDACAI_PGAG2_HI 17 ++#define CBR_RG_IDACAI_PGAG2_SZ 6 ++#define CBR_RG_IDACAQ_PGAG2_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG2_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG2_SFT 18 ++#define CBR_RG_IDACAQ_PGAG2_HI 23 ++#define CBR_RG_IDACAQ_PGAG2_SZ 6 ++#define CBR_RG_IDACAI_PGAG1_MSK 0x0000003f ++#define CBR_RG_IDACAI_PGAG1_I_MSK 0xffffffc0 ++#define CBR_RG_IDACAI_PGAG1_SFT 0 ++#define CBR_RG_IDACAI_PGAG1_HI 5 ++#define CBR_RG_IDACAI_PGAG1_SZ 6 ++#define CBR_RG_IDACAQ_PGAG1_MSK 0x00000fc0 ++#define CBR_RG_IDACAQ_PGAG1_I_MSK 0xfffff03f ++#define CBR_RG_IDACAQ_PGAG1_SFT 6 ++#define CBR_RG_IDACAQ_PGAG1_HI 11 ++#define CBR_RG_IDACAQ_PGAG1_SZ 6 ++#define CBR_RG_IDACAI_PGAG0_MSK 0x0003f000 ++#define CBR_RG_IDACAI_PGAG0_I_MSK 0xfffc0fff ++#define CBR_RG_IDACAI_PGAG0_SFT 12 ++#define CBR_RG_IDACAI_PGAG0_HI 17 ++#define CBR_RG_IDACAI_PGAG0_SZ 6 ++#define CBR_RG_IDACAQ_PGAG0_MSK 0x00fc0000 ++#define CBR_RG_IDACAQ_PGAG0_I_MSK 0xff03ffff ++#define CBR_RG_IDACAQ_PGAG0_SFT 18 ++#define CBR_RG_IDACAQ_PGAG0_HI 23 ++#define CBR_RG_IDACAQ_PGAG0_SZ 6 ++#define CBR_RG_EN_RCAL_MSK 0x00000001 ++#define CBR_RG_EN_RCAL_I_MSK 0xfffffffe ++#define CBR_RG_EN_RCAL_SFT 0 ++#define CBR_RG_EN_RCAL_HI 0 ++#define CBR_RG_EN_RCAL_SZ 1 ++#define CBR_RG_RCAL_SPD_MSK 0x00000002 ++#define CBR_RG_RCAL_SPD_I_MSK 0xfffffffd ++#define CBR_RG_RCAL_SPD_SFT 1 ++#define CBR_RG_RCAL_SPD_HI 1 ++#define CBR_RG_RCAL_SPD_SZ 1 ++#define CBR_RG_RCAL_TMR_MSK 0x000001fc ++#define CBR_RG_RCAL_TMR_I_MSK 0xfffffe03 ++#define CBR_RG_RCAL_TMR_SFT 2 ++#define CBR_RG_RCAL_TMR_HI 8 ++#define CBR_RG_RCAL_TMR_SZ 7 ++#define CBR_RG_RCAL_CODE_CWR_MSK 0x00000200 ++#define CBR_RG_RCAL_CODE_CWR_I_MSK 0xfffffdff ++#define CBR_RG_RCAL_CODE_CWR_SFT 9 ++#define CBR_RG_RCAL_CODE_CWR_HI 9 ++#define CBR_RG_RCAL_CODE_CWR_SZ 1 ++#define CBR_RG_RCAL_CODE_CWD_MSK 0x00007c00 ++#define CBR_RG_RCAL_CODE_CWD_I_MSK 0xffff83ff ++#define CBR_RG_RCAL_CODE_CWD_SFT 10 ++#define CBR_RG_RCAL_CODE_CWD_HI 14 ++#define CBR_RG_RCAL_CODE_CWD_SZ 5 ++#define CBR_RG_SX_SUB_SEL_CWR_MSK 0x00000001 ++#define CBR_RG_SX_SUB_SEL_CWR_I_MSK 0xfffffffe ++#define CBR_RG_SX_SUB_SEL_CWR_SFT 0 ++#define CBR_RG_SX_SUB_SEL_CWR_HI 0 ++#define CBR_RG_SX_SUB_SEL_CWR_SZ 1 ++#define CBR_RG_SX_SUB_SEL_CWD_MSK 0x000000fe ++#define CBR_RG_SX_SUB_SEL_CWD_I_MSK 0xffffff01 ++#define CBR_RG_SX_SUB_SEL_CWD_SFT 1 ++#define CBR_RG_SX_SUB_SEL_CWD_HI 7 ++#define CBR_RG_SX_SUB_SEL_CWD_SZ 7 ++#define CBR_RG_DP_BBPLL_BS_CWR_MSK 0x00000100 ++#define CBR_RG_DP_BBPLL_BS_CWR_I_MSK 0xfffffeff ++#define CBR_RG_DP_BBPLL_BS_CWR_SFT 8 ++#define CBR_RG_DP_BBPLL_BS_CWR_HI 8 ++#define CBR_RG_DP_BBPLL_BS_CWR_SZ 1 ++#define CBR_RG_DP_BBPLL_BS_CWD_MSK 0x00007e00 ++#define CBR_RG_DP_BBPLL_BS_CWD_I_MSK 0xffff81ff ++#define CBR_RG_DP_BBPLL_BS_CWD_SFT 9 ++#define CBR_RG_DP_BBPLL_BS_CWD_HI 14 ++#define CBR_RG_DP_BBPLL_BS_CWD_SZ 6 ++#define CBR_RCAL_RDY_MSK 0x00000001 ++#define CBR_RCAL_RDY_I_MSK 0xfffffffe ++#define CBR_RCAL_RDY_SFT 0 ++#define CBR_RCAL_RDY_HI 0 ++#define CBR_RCAL_RDY_SZ 1 ++#define CBR_DA_LCK_RDY_MSK 0x00000002 ++#define CBR_DA_LCK_RDY_I_MSK 0xfffffffd ++#define CBR_DA_LCK_RDY_SFT 1 ++#define CBR_DA_LCK_RDY_HI 1 ++#define CBR_DA_LCK_RDY_SZ 1 ++#define CBR_VT_MON_RDY_MSK 0x00000004 ++#define CBR_VT_MON_RDY_I_MSK 0xfffffffb ++#define CBR_VT_MON_RDY_SFT 2 ++#define CBR_VT_MON_RDY_HI 2 ++#define CBR_VT_MON_RDY_SZ 1 ++#define CBR_DP_VT_MON_RDY_MSK 0x00000008 ++#define CBR_DP_VT_MON_RDY_I_MSK 0xfffffff7 ++#define CBR_DP_VT_MON_RDY_SFT 3 ++#define CBR_DP_VT_MON_RDY_HI 3 ++#define CBR_DP_VT_MON_RDY_SZ 1 ++#define CBR_CH_RDY_MSK 0x00000010 ++#define CBR_CH_RDY_I_MSK 0xffffffef ++#define CBR_CH_RDY_SFT 4 ++#define CBR_CH_RDY_HI 4 ++#define CBR_CH_RDY_SZ 1 ++#define CBR_DA_R_CODE_LUT_MSK 0x000007c0 ++#define CBR_DA_R_CODE_LUT_I_MSK 0xfffff83f ++#define CBR_DA_R_CODE_LUT_SFT 6 ++#define CBR_DA_R_CODE_LUT_HI 10 ++#define CBR_DA_R_CODE_LUT_SZ 5 ++#define CBR_AD_SX_VT_MON_Q_MSK 0x00001800 ++#define CBR_AD_SX_VT_MON_Q_I_MSK 0xffffe7ff ++#define CBR_AD_SX_VT_MON_Q_SFT 11 ++#define CBR_AD_SX_VT_MON_Q_HI 12 ++#define CBR_AD_SX_VT_MON_Q_SZ 2 ++#define CBR_AD_DP_VT_MON_Q_MSK 0x00006000 ++#define CBR_AD_DP_VT_MON_Q_I_MSK 0xffff9fff ++#define CBR_AD_DP_VT_MON_Q_SFT 13 ++#define CBR_AD_DP_VT_MON_Q_HI 14 ++#define CBR_AD_DP_VT_MON_Q_SZ 2 ++#define CBR_DA_R_CAL_CODE_MSK 0x0000001f ++#define CBR_DA_R_CAL_CODE_I_MSK 0xffffffe0 ++#define CBR_DA_R_CAL_CODE_SFT 0 ++#define CBR_DA_R_CAL_CODE_HI 4 ++#define CBR_DA_R_CAL_CODE_SZ 5 ++#define CBR_DA_SX_SUB_SEL_MSK 0x00000fe0 ++#define CBR_DA_SX_SUB_SEL_I_MSK 0xfffff01f ++#define CBR_DA_SX_SUB_SEL_SFT 5 ++#define CBR_DA_SX_SUB_SEL_HI 11 ++#define CBR_DA_SX_SUB_SEL_SZ 7 ++#define CBR_DA_DP_BBPLL_BS_MSK 0x0003f000 ++#define CBR_DA_DP_BBPLL_BS_I_MSK 0xfffc0fff ++#define CBR_DA_DP_BBPLL_BS_SFT 12 ++#define CBR_DA_DP_BBPLL_BS_HI 17 ++#define CBR_DA_DP_BBPLL_BS_SZ 6 ++#define CBR_TX_EN_MSK 0x00000001 ++#define CBR_TX_EN_I_MSK 0xfffffffe ++#define CBR_TX_EN_SFT 0 ++#define CBR_TX_EN_HI 0 ++#define CBR_TX_EN_SZ 1 ++#define CBR_TX_CNT_RST_MSK 0x00000002 ++#define CBR_TX_CNT_RST_I_MSK 0xfffffffd ++#define CBR_TX_CNT_RST_SFT 1 ++#define CBR_TX_CNT_RST_HI 1 ++#define CBR_TX_CNT_RST_SZ 1 ++#define CBR_IFS_TIME_MSK 0x000000fc ++#define CBR_IFS_TIME_I_MSK 0xffffff03 ++#define CBR_IFS_TIME_SFT 2 ++#define CBR_IFS_TIME_HI 7 ++#define CBR_IFS_TIME_SZ 6 ++#define CBR_LENGTH_TARGET_MSK 0x000fff00 ++#define CBR_LENGTH_TARGET_I_MSK 0xfff000ff ++#define CBR_LENGTH_TARGET_SFT 8 ++#define CBR_LENGTH_TARGET_HI 19 ++#define CBR_LENGTH_TARGET_SZ 12 ++#define CBR_TX_CNT_TARGET_MSK 0xff000000 ++#define CBR_TX_CNT_TARGET_I_MSK 0x00ffffff ++#define CBR_TX_CNT_TARGET_SFT 24 ++#define CBR_TX_CNT_TARGET_HI 31 ++#define CBR_TX_CNT_TARGET_SZ 8 ++#define CBR_TC_CNT_TARGET_MSK 0x00ffffff ++#define CBR_TC_CNT_TARGET_I_MSK 0xff000000 ++#define CBR_TC_CNT_TARGET_SFT 0 ++#define CBR_TC_CNT_TARGET_HI 23 ++#define CBR_TC_CNT_TARGET_SZ 24 ++#define CBR_PLCP_PSDU_DATA_MEM_MSK 0x000000ff ++#define CBR_PLCP_PSDU_DATA_MEM_I_MSK 0xffffff00 ++#define CBR_PLCP_PSDU_DATA_MEM_SFT 0 ++#define CBR_PLCP_PSDU_DATA_MEM_HI 7 ++#define CBR_PLCP_PSDU_DATA_MEM_SZ 8 ++#define CBR_PLCP_PSDU_PREAMBLE_SHORT_MSK 0x00000100 ++#define CBR_PLCP_PSDU_PREAMBLE_SHORT_I_MSK 0xfffffeff ++#define CBR_PLCP_PSDU_PREAMBLE_SHORT_SFT 8 ++#define CBR_PLCP_PSDU_PREAMBLE_SHORT_HI 8 ++#define CBR_PLCP_PSDU_PREAMBLE_SHORT_SZ 1 ++#define CBR_PLCP_BYTE_LENGTH_MSK 0x001ffe00 ++#define CBR_PLCP_BYTE_LENGTH_I_MSK 0xffe001ff ++#define CBR_PLCP_BYTE_LENGTH_SFT 9 ++#define CBR_PLCP_BYTE_LENGTH_HI 20 ++#define CBR_PLCP_BYTE_LENGTH_SZ 12 ++#define CBR_PLCP_PSDU_RATE_MSK 0x00600000 ++#define CBR_PLCP_PSDU_RATE_I_MSK 0xff9fffff ++#define CBR_PLCP_PSDU_RATE_SFT 21 ++#define CBR_PLCP_PSDU_RATE_HI 22 ++#define CBR_PLCP_PSDU_RATE_SZ 2 ++#define CBR_TAIL_TIME_MSK 0x1f800000 ++#define CBR_TAIL_TIME_I_MSK 0xe07fffff ++#define CBR_TAIL_TIME_SFT 23 ++#define CBR_TAIL_TIME_HI 28 ++#define CBR_TAIL_TIME_SZ 6 ++#define CBR_RG_O_PAD_PD_MSK 0x00000001 ++#define CBR_RG_O_PAD_PD_I_MSK 0xfffffffe ++#define CBR_RG_O_PAD_PD_SFT 0 ++#define CBR_RG_O_PAD_PD_HI 0 ++#define CBR_RG_O_PAD_PD_SZ 1 ++#define CBR_RG_I_PAD_PD_MSK 0x00000002 ++#define CBR_RG_I_PAD_PD_I_MSK 0xfffffffd ++#define CBR_RG_I_PAD_PD_SFT 1 ++#define CBR_RG_I_PAD_PD_HI 1 ++#define CBR_RG_I_PAD_PD_SZ 1 ++#define CBR_SEL_ADCKP_INV_MSK 0x00000004 ++#define CBR_SEL_ADCKP_INV_I_MSK 0xfffffffb ++#define CBR_SEL_ADCKP_INV_SFT 2 ++#define CBR_SEL_ADCKP_INV_HI 2 ++#define CBR_SEL_ADCKP_INV_SZ 1 ++#define CBR_RG_PAD_DS_MSK 0x00000008 ++#define CBR_RG_PAD_DS_I_MSK 0xfffffff7 ++#define CBR_RG_PAD_DS_SFT 3 ++#define CBR_RG_PAD_DS_HI 3 ++#define CBR_RG_PAD_DS_SZ 1 ++#define CBR_SEL_ADCKP_MUX_MSK 0x00000010 ++#define CBR_SEL_ADCKP_MUX_I_MSK 0xffffffef ++#define CBR_SEL_ADCKP_MUX_SFT 4 ++#define CBR_SEL_ADCKP_MUX_HI 4 ++#define CBR_SEL_ADCKP_MUX_SZ 1 ++#define CBR_RG_PAD_DS_CLK_MSK 0x00000020 ++#define CBR_RG_PAD_DS_CLK_I_MSK 0xffffffdf ++#define CBR_RG_PAD_DS_CLK_SFT 5 ++#define CBR_RG_PAD_DS_CLK_HI 5 ++#define CBR_RG_PAD_DS_CLK_SZ 1 ++#define CBR_INTP_SEL_MSK 0x00000200 ++#define CBR_INTP_SEL_I_MSK 0xfffffdff ++#define CBR_INTP_SEL_SFT 9 ++#define CBR_INTP_SEL_HI 9 ++#define CBR_INTP_SEL_SZ 1 ++#define CBR_IQ_SWP_MSK 0x00000400 ++#define CBR_IQ_SWP_I_MSK 0xfffffbff ++#define CBR_IQ_SWP_SFT 10 ++#define CBR_IQ_SWP_HI 10 ++#define CBR_IQ_SWP_SZ 1 ++#define CBR_RG_EN_EXT_DA_MSK 0x00000800 ++#define CBR_RG_EN_EXT_DA_I_MSK 0xfffff7ff ++#define CBR_RG_EN_EXT_DA_SFT 11 ++#define CBR_RG_EN_EXT_DA_HI 11 ++#define CBR_RG_EN_EXT_DA_SZ 1 ++#define CBR_RG_DIS_DA_OFFSET_MSK 0x00001000 ++#define CBR_RG_DIS_DA_OFFSET_I_MSK 0xffffefff ++#define CBR_RG_DIS_DA_OFFSET_SFT 12 ++#define CBR_RG_DIS_DA_OFFSET_HI 12 ++#define CBR_RG_DIS_DA_OFFSET_SZ 1 ++#define CBR_DBG_SEL_MSK 0x000f0000 ++#define CBR_DBG_SEL_I_MSK 0xfff0ffff ++#define CBR_DBG_SEL_SFT 16 ++#define CBR_DBG_SEL_HI 19 ++#define CBR_DBG_SEL_SZ 4 ++#define CBR_DBG_EN_MSK 0x00100000 ++#define CBR_DBG_EN_I_MSK 0xffefffff ++#define CBR_DBG_EN_SFT 20 ++#define CBR_DBG_EN_HI 20 ++#define CBR_DBG_EN_SZ 1 ++#define CBR_RG_PKT_GEN_TX_CNT_MSK 0xffffffff ++#define CBR_RG_PKT_GEN_TX_CNT_I_MSK 0x00000000 ++#define CBR_RG_PKT_GEN_TX_CNT_SFT 0 ++#define CBR_RG_PKT_GEN_TX_CNT_HI 31 ++#define CBR_RG_PKT_GEN_TX_CNT_SZ 32 ++#define CBR_TP_SEL_MSK 0x0000001f ++#define CBR_TP_SEL_I_MSK 0xffffffe0 ++#define CBR_TP_SEL_SFT 0 ++#define CBR_TP_SEL_HI 4 ++#define CBR_TP_SEL_SZ 5 ++#define CBR_IDEAL_IQ_EN_MSK 0x00000020 ++#define CBR_IDEAL_IQ_EN_I_MSK 0xffffffdf ++#define CBR_IDEAL_IQ_EN_SFT 5 ++#define CBR_IDEAL_IQ_EN_HI 5 ++#define CBR_IDEAL_IQ_EN_SZ 1 ++#define CBR_DATA_OUT_SEL_MSK 0x000001c0 ++#define CBR_DATA_OUT_SEL_I_MSK 0xfffffe3f ++#define CBR_DATA_OUT_SEL_SFT 6 ++#define CBR_DATA_OUT_SEL_HI 8 ++#define CBR_DATA_OUT_SEL_SZ 3 ++#define CBR_TWO_TONE_EN_MSK 0x00000200 ++#define CBR_TWO_TONE_EN_I_MSK 0xfffffdff ++#define CBR_TWO_TONE_EN_SFT 9 ++#define CBR_TWO_TONE_EN_HI 9 ++#define CBR_TWO_TONE_EN_SZ 1 ++#define CBR_FREQ_SEL_MSK 0x00ff0000 ++#define CBR_FREQ_SEL_I_MSK 0xff00ffff ++#define CBR_FREQ_SEL_SFT 16 ++#define CBR_FREQ_SEL_HI 23 ++#define CBR_FREQ_SEL_SZ 8 ++#define CBR_IQ_SCALE_MSK 0xff000000 ++#define CBR_IQ_SCALE_I_MSK 0x00ffffff ++#define CBR_IQ_SCALE_SFT 24 ++#define CBR_IQ_SCALE_HI 31 ++#define CBR_IQ_SCALE_SZ 8 ++#define CPU_QUE_POP_MSK 0x00000001 ++#define CPU_QUE_POP_I_MSK 0xfffffffe ++#define CPU_QUE_POP_SFT 0 ++#define CPU_QUE_POP_HI 0 ++#define CPU_QUE_POP_SZ 1 ++#define CPU_INT_MSK 0x00000004 ++#define CPU_INT_I_MSK 0xfffffffb ++#define CPU_INT_SFT 2 ++#define CPU_INT_HI 2 ++#define CPU_INT_SZ 1 ++#define CPU_ID_TB0_MSK 0xffffffff ++#define CPU_ID_TB0_I_MSK 0x00000000 ++#define CPU_ID_TB0_SFT 0 ++#define CPU_ID_TB0_HI 31 ++#define CPU_ID_TB0_SZ 32 ++#define CPU_ID_TB1_MSK 0xffffffff ++#define CPU_ID_TB1_I_MSK 0x00000000 ++#define CPU_ID_TB1_SFT 0 ++#define CPU_ID_TB1_HI 31 ++#define CPU_ID_TB1_SZ 32 ++#define HW_PKTID_MSK 0x000007ff ++#define HW_PKTID_I_MSK 0xfffff800 ++#define HW_PKTID_SFT 0 ++#define HW_PKTID_HI 10 ++#define HW_PKTID_SZ 11 ++#define CH0_INT_ADDR_MSK 0xffffffff ++#define CH0_INT_ADDR_I_MSK 0x00000000 ++#define CH0_INT_ADDR_SFT 0 ++#define CH0_INT_ADDR_HI 31 ++#define CH0_INT_ADDR_SZ 32 ++#define PRI_HW_PKTID_MSK 0x000007ff ++#define PRI_HW_PKTID_I_MSK 0xfffff800 ++#define PRI_HW_PKTID_SFT 0 ++#define PRI_HW_PKTID_HI 10 ++#define PRI_HW_PKTID_SZ 11 ++#define CH0_FULL_MSK 0x00000001 ++#define CH0_FULL_I_MSK 0xfffffffe ++#define CH0_FULL_SFT 0 ++#define CH0_FULL_HI 0 ++#define CH0_FULL_SZ 1 ++#define FF0_EMPTY_MSK 0x00000002 ++#define FF0_EMPTY_I_MSK 0xfffffffd ++#define FF0_EMPTY_SFT 1 ++#define FF0_EMPTY_HI 1 ++#define FF0_EMPTY_SZ 1 ++#define RLS_BUSY_MSK 0x00000200 ++#define RLS_BUSY_I_MSK 0xfffffdff ++#define RLS_BUSY_SFT 9 ++#define RLS_BUSY_HI 9 ++#define RLS_BUSY_SZ 1 ++#define RLS_COUNT_CLR_MSK 0x00000400 ++#define RLS_COUNT_CLR_I_MSK 0xfffffbff ++#define RLS_COUNT_CLR_SFT 10 ++#define RLS_COUNT_CLR_HI 10 ++#define RLS_COUNT_CLR_SZ 1 ++#define RTN_COUNT_CLR_MSK 0x00000800 ++#define RTN_COUNT_CLR_I_MSK 0xfffff7ff ++#define RTN_COUNT_CLR_SFT 11 ++#define RTN_COUNT_CLR_HI 11 ++#define RTN_COUNT_CLR_SZ 1 ++#define RLS_COUNT_MSK 0x00ff0000 ++#define RLS_COUNT_I_MSK 0xff00ffff ++#define RLS_COUNT_SFT 16 ++#define RLS_COUNT_HI 23 ++#define RLS_COUNT_SZ 8 ++#define RTN_COUNT_MSK 0xff000000 ++#define RTN_COUNT_I_MSK 0x00ffffff ++#define RTN_COUNT_SFT 24 ++#define RTN_COUNT_HI 31 ++#define RTN_COUNT_SZ 8 ++#define FF0_CNT_MSK 0x0000001f ++#define FF0_CNT_I_MSK 0xffffffe0 ++#define FF0_CNT_SFT 0 ++#define FF0_CNT_HI 4 ++#define FF0_CNT_SZ 5 ++#define FF1_CNT_MSK 0x000001e0 ++#define FF1_CNT_I_MSK 0xfffffe1f ++#define FF1_CNT_SFT 5 ++#define FF1_CNT_HI 8 ++#define FF1_CNT_SZ 4 ++#define FF3_CNT_MSK 0x00003800 ++#define FF3_CNT_I_MSK 0xffffc7ff ++#define FF3_CNT_SFT 11 ++#define FF3_CNT_HI 13 ++#define FF3_CNT_SZ 3 ++#define FF5_CNT_MSK 0x000e0000 ++#define FF5_CNT_I_MSK 0xfff1ffff ++#define FF5_CNT_SFT 17 ++#define FF5_CNT_HI 19 ++#define FF5_CNT_SZ 3 ++#define FF6_CNT_MSK 0x00700000 ++#define FF6_CNT_I_MSK 0xff8fffff ++#define FF6_CNT_SFT 20 ++#define FF6_CNT_HI 22 ++#define FF6_CNT_SZ 3 ++#define FF7_CNT_MSK 0x03800000 ++#define FF7_CNT_I_MSK 0xfc7fffff ++#define FF7_CNT_SFT 23 ++#define FF7_CNT_HI 25 ++#define FF7_CNT_SZ 3 ++#define FF8_CNT_MSK 0x1c000000 ++#define FF8_CNT_I_MSK 0xe3ffffff ++#define FF8_CNT_SFT 26 ++#define FF8_CNT_HI 28 ++#define FF8_CNT_SZ 3 ++#define FF9_CNT_MSK 0xe0000000 ++#define FF9_CNT_I_MSK 0x1fffffff ++#define FF9_CNT_SFT 29 ++#define FF9_CNT_HI 31 ++#define FF9_CNT_SZ 3 ++#define FF10_CNT_MSK 0x00000007 ++#define FF10_CNT_I_MSK 0xfffffff8 ++#define FF10_CNT_SFT 0 ++#define FF10_CNT_HI 2 ++#define FF10_CNT_SZ 3 ++#define FF11_CNT_MSK 0x00000038 ++#define FF11_CNT_I_MSK 0xffffffc7 ++#define FF11_CNT_SFT 3 ++#define FF11_CNT_HI 5 ++#define FF11_CNT_SZ 3 ++#define FF12_CNT_MSK 0x000001c0 ++#define FF12_CNT_I_MSK 0xfffffe3f ++#define FF12_CNT_SFT 6 ++#define FF12_CNT_HI 8 ++#define FF12_CNT_SZ 3 ++#define FF13_CNT_MSK 0x00000600 ++#define FF13_CNT_I_MSK 0xfffff9ff ++#define FF13_CNT_SFT 9 ++#define FF13_CNT_HI 10 ++#define FF13_CNT_SZ 2 ++#define FF14_CNT_MSK 0x00001800 ++#define FF14_CNT_I_MSK 0xffffe7ff ++#define FF14_CNT_SFT 11 ++#define FF14_CNT_HI 12 ++#define FF14_CNT_SZ 2 ++#define FF15_CNT_MSK 0x00006000 ++#define FF15_CNT_I_MSK 0xffff9fff ++#define FF15_CNT_SFT 13 ++#define FF15_CNT_HI 14 ++#define FF15_CNT_SZ 2 ++#define FF4_CNT_MSK 0x000f8000 ++#define FF4_CNT_I_MSK 0xfff07fff ++#define FF4_CNT_SFT 15 ++#define FF4_CNT_HI 19 ++#define FF4_CNT_SZ 5 ++#define FF2_CNT_MSK 0x00700000 ++#define FF2_CNT_I_MSK 0xff8fffff ++#define FF2_CNT_SFT 20 ++#define FF2_CNT_HI 22 ++#define FF2_CNT_SZ 3 ++#define CH1_FULL_MSK 0x00000002 ++#define CH1_FULL_I_MSK 0xfffffffd ++#define CH1_FULL_SFT 1 ++#define CH1_FULL_HI 1 ++#define CH1_FULL_SZ 1 ++#define CH2_FULL_MSK 0x00000004 ++#define CH2_FULL_I_MSK 0xfffffffb ++#define CH2_FULL_SFT 2 ++#define CH2_FULL_HI 2 ++#define CH2_FULL_SZ 1 ++#define CH3_FULL_MSK 0x00000008 ++#define CH3_FULL_I_MSK 0xfffffff7 ++#define CH3_FULL_SFT 3 ++#define CH3_FULL_HI 3 ++#define CH3_FULL_SZ 1 ++#define CH4_FULL_MSK 0x00000010 ++#define CH4_FULL_I_MSK 0xffffffef ++#define CH4_FULL_SFT 4 ++#define CH4_FULL_HI 4 ++#define CH4_FULL_SZ 1 ++#define CH5_FULL_MSK 0x00000020 ++#define CH5_FULL_I_MSK 0xffffffdf ++#define CH5_FULL_SFT 5 ++#define CH5_FULL_HI 5 ++#define CH5_FULL_SZ 1 ++#define CH6_FULL_MSK 0x00000040 ++#define CH6_FULL_I_MSK 0xffffffbf ++#define CH6_FULL_SFT 6 ++#define CH6_FULL_HI 6 ++#define CH6_FULL_SZ 1 ++#define CH7_FULL_MSK 0x00000080 ++#define CH7_FULL_I_MSK 0xffffff7f ++#define CH7_FULL_SFT 7 ++#define CH7_FULL_HI 7 ++#define CH7_FULL_SZ 1 ++#define CH8_FULL_MSK 0x00000100 ++#define CH8_FULL_I_MSK 0xfffffeff ++#define CH8_FULL_SFT 8 ++#define CH8_FULL_HI 8 ++#define CH8_FULL_SZ 1 ++#define CH9_FULL_MSK 0x00000200 ++#define CH9_FULL_I_MSK 0xfffffdff ++#define CH9_FULL_SFT 9 ++#define CH9_FULL_HI 9 ++#define CH9_FULL_SZ 1 ++#define CH10_FULL_MSK 0x00000400 ++#define CH10_FULL_I_MSK 0xfffffbff ++#define CH10_FULL_SFT 10 ++#define CH10_FULL_HI 10 ++#define CH10_FULL_SZ 1 ++#define CH11_FULL_MSK 0x00000800 ++#define CH11_FULL_I_MSK 0xfffff7ff ++#define CH11_FULL_SFT 11 ++#define CH11_FULL_HI 11 ++#define CH11_FULL_SZ 1 ++#define CH12_FULL_MSK 0x00001000 ++#define CH12_FULL_I_MSK 0xffffefff ++#define CH12_FULL_SFT 12 ++#define CH12_FULL_HI 12 ++#define CH12_FULL_SZ 1 ++#define CH13_FULL_MSK 0x00002000 ++#define CH13_FULL_I_MSK 0xffffdfff ++#define CH13_FULL_SFT 13 ++#define CH13_FULL_HI 13 ++#define CH13_FULL_SZ 1 ++#define CH14_FULL_MSK 0x00004000 ++#define CH14_FULL_I_MSK 0xffffbfff ++#define CH14_FULL_SFT 14 ++#define CH14_FULL_HI 14 ++#define CH14_FULL_SZ 1 ++#define CH15_FULL_MSK 0x00008000 ++#define CH15_FULL_I_MSK 0xffff7fff ++#define CH15_FULL_SFT 15 ++#define CH15_FULL_HI 15 ++#define CH15_FULL_SZ 1 ++#define HALT_CH0_MSK 0x00000001 ++#define HALT_CH0_I_MSK 0xfffffffe ++#define HALT_CH0_SFT 0 ++#define HALT_CH0_HI 0 ++#define HALT_CH0_SZ 1 ++#define HALT_CH1_MSK 0x00000002 ++#define HALT_CH1_I_MSK 0xfffffffd ++#define HALT_CH1_SFT 1 ++#define HALT_CH1_HI 1 ++#define HALT_CH1_SZ 1 ++#define HALT_CH2_MSK 0x00000004 ++#define HALT_CH2_I_MSK 0xfffffffb ++#define HALT_CH2_SFT 2 ++#define HALT_CH2_HI 2 ++#define HALT_CH2_SZ 1 ++#define HALT_CH3_MSK 0x00000008 ++#define HALT_CH3_I_MSK 0xfffffff7 ++#define HALT_CH3_SFT 3 ++#define HALT_CH3_HI 3 ++#define HALT_CH3_SZ 1 ++#define HALT_CH4_MSK 0x00000010 ++#define HALT_CH4_I_MSK 0xffffffef ++#define HALT_CH4_SFT 4 ++#define HALT_CH4_HI 4 ++#define HALT_CH4_SZ 1 ++#define HALT_CH5_MSK 0x00000020 ++#define HALT_CH5_I_MSK 0xffffffdf ++#define HALT_CH5_SFT 5 ++#define HALT_CH5_HI 5 ++#define HALT_CH5_SZ 1 ++#define HALT_CH6_MSK 0x00000040 ++#define HALT_CH6_I_MSK 0xffffffbf ++#define HALT_CH6_SFT 6 ++#define HALT_CH6_HI 6 ++#define HALT_CH6_SZ 1 ++#define HALT_CH7_MSK 0x00000080 ++#define HALT_CH7_I_MSK 0xffffff7f ++#define HALT_CH7_SFT 7 ++#define HALT_CH7_HI 7 ++#define HALT_CH7_SZ 1 ++#define HALT_CH8_MSK 0x00000100 ++#define HALT_CH8_I_MSK 0xfffffeff ++#define HALT_CH8_SFT 8 ++#define HALT_CH8_HI 8 ++#define HALT_CH8_SZ 1 ++#define HALT_CH9_MSK 0x00000200 ++#define HALT_CH9_I_MSK 0xfffffdff ++#define HALT_CH9_SFT 9 ++#define HALT_CH9_HI 9 ++#define HALT_CH9_SZ 1 ++#define HALT_CH10_MSK 0x00000400 ++#define HALT_CH10_I_MSK 0xfffffbff ++#define HALT_CH10_SFT 10 ++#define HALT_CH10_HI 10 ++#define HALT_CH10_SZ 1 ++#define HALT_CH11_MSK 0x00000800 ++#define HALT_CH11_I_MSK 0xfffff7ff ++#define HALT_CH11_SFT 11 ++#define HALT_CH11_HI 11 ++#define HALT_CH11_SZ 1 ++#define HALT_CH12_MSK 0x00001000 ++#define HALT_CH12_I_MSK 0xffffefff ++#define HALT_CH12_SFT 12 ++#define HALT_CH12_HI 12 ++#define HALT_CH12_SZ 1 ++#define HALT_CH13_MSK 0x00002000 ++#define HALT_CH13_I_MSK 0xffffdfff ++#define HALT_CH13_SFT 13 ++#define HALT_CH13_HI 13 ++#define HALT_CH13_SZ 1 ++#define HALT_CH14_MSK 0x00004000 ++#define HALT_CH14_I_MSK 0xffffbfff ++#define HALT_CH14_SFT 14 ++#define HALT_CH14_HI 14 ++#define HALT_CH14_SZ 1 ++#define HALT_CH15_MSK 0x00008000 ++#define HALT_CH15_I_MSK 0xffff7fff ++#define HALT_CH15_SFT 15 ++#define HALT_CH15_HI 15 ++#define HALT_CH15_SZ 1 ++#define STOP_MBOX_MSK 0x00010000 ++#define STOP_MBOX_I_MSK 0xfffeffff ++#define STOP_MBOX_SFT 16 ++#define STOP_MBOX_HI 16 ++#define STOP_MBOX_SZ 1 ++#define MB_ERR_AUTO_HALT_EN_MSK 0x00100000 ++#define MB_ERR_AUTO_HALT_EN_I_MSK 0xffefffff ++#define MB_ERR_AUTO_HALT_EN_SFT 20 ++#define MB_ERR_AUTO_HALT_EN_HI 20 ++#define MB_ERR_AUTO_HALT_EN_SZ 1 ++#define MB_EXCEPT_CLR_MSK 0x00200000 ++#define MB_EXCEPT_CLR_I_MSK 0xffdfffff ++#define MB_EXCEPT_CLR_SFT 21 ++#define MB_EXCEPT_CLR_HI 21 ++#define MB_EXCEPT_CLR_SZ 1 ++#define MB_EXCEPT_CASE_MSK 0xff000000 ++#define MB_EXCEPT_CASE_I_MSK 0x00ffffff ++#define MB_EXCEPT_CASE_SFT 24 ++#define MB_EXCEPT_CASE_HI 31 ++#define MB_EXCEPT_CASE_SZ 8 ++#define MB_DBG_TIME_STEP_MSK 0x0000ffff ++#define MB_DBG_TIME_STEP_I_MSK 0xffff0000 ++#define MB_DBG_TIME_STEP_SFT 0 ++#define MB_DBG_TIME_STEP_HI 15 ++#define MB_DBG_TIME_STEP_SZ 16 ++#define DBG_TYPE_MSK 0x00030000 ++#define DBG_TYPE_I_MSK 0xfffcffff ++#define DBG_TYPE_SFT 16 ++#define DBG_TYPE_HI 17 ++#define DBG_TYPE_SZ 2 ++#define MB_DBG_CLR_MSK 0x00040000 ++#define MB_DBG_CLR_I_MSK 0xfffbffff ++#define MB_DBG_CLR_SFT 18 ++#define MB_DBG_CLR_HI 18 ++#define MB_DBG_CLR_SZ 1 ++#define DBG_ALC_LOG_EN_MSK 0x00080000 ++#define DBG_ALC_LOG_EN_I_MSK 0xfff7ffff ++#define DBG_ALC_LOG_EN_SFT 19 ++#define DBG_ALC_LOG_EN_HI 19 ++#define DBG_ALC_LOG_EN_SZ 1 ++#define MB_DBG_COUNTER_EN_MSK 0x01000000 ++#define MB_DBG_COUNTER_EN_I_MSK 0xfeffffff ++#define MB_DBG_COUNTER_EN_SFT 24 ++#define MB_DBG_COUNTER_EN_HI 24 ++#define MB_DBG_COUNTER_EN_SZ 1 ++#define MB_DBG_EN_MSK 0x80000000 ++#define MB_DBG_EN_I_MSK 0x7fffffff ++#define MB_DBG_EN_SFT 31 ++#define MB_DBG_EN_HI 31 ++#define MB_DBG_EN_SZ 1 ++#define MB_DBG_RECORD_CNT_MSK 0x0000ffff ++#define MB_DBG_RECORD_CNT_I_MSK 0xffff0000 ++#define MB_DBG_RECORD_CNT_SFT 0 ++#define MB_DBG_RECORD_CNT_HI 15 ++#define MB_DBG_RECORD_CNT_SZ 16 ++#define MB_DBG_LENGTH_MSK 0xffff0000 ++#define MB_DBG_LENGTH_I_MSK 0x0000ffff ++#define MB_DBG_LENGTH_SFT 16 ++#define MB_DBG_LENGTH_HI 31 ++#define MB_DBG_LENGTH_SZ 16 ++#define MB_DBG_CFG_ADDR_MSK 0xffffffff ++#define MB_DBG_CFG_ADDR_I_MSK 0x00000000 ++#define MB_DBG_CFG_ADDR_SFT 0 ++#define MB_DBG_CFG_ADDR_HI 31 ++#define MB_DBG_CFG_ADDR_SZ 32 ++#define DBG_HWID0_WR_EN_MSK 0x00000001 ++#define DBG_HWID0_WR_EN_I_MSK 0xfffffffe ++#define DBG_HWID0_WR_EN_SFT 0 ++#define DBG_HWID0_WR_EN_HI 0 ++#define DBG_HWID0_WR_EN_SZ 1 ++#define DBG_HWID1_WR_EN_MSK 0x00000002 ++#define DBG_HWID1_WR_EN_I_MSK 0xfffffffd ++#define DBG_HWID1_WR_EN_SFT 1 ++#define DBG_HWID1_WR_EN_HI 1 ++#define DBG_HWID1_WR_EN_SZ 1 ++#define DBG_HWID2_WR_EN_MSK 0x00000004 ++#define DBG_HWID2_WR_EN_I_MSK 0xfffffffb ++#define DBG_HWID2_WR_EN_SFT 2 ++#define DBG_HWID2_WR_EN_HI 2 ++#define DBG_HWID2_WR_EN_SZ 1 ++#define DBG_HWID3_WR_EN_MSK 0x00000008 ++#define DBG_HWID3_WR_EN_I_MSK 0xfffffff7 ++#define DBG_HWID3_WR_EN_SFT 3 ++#define DBG_HWID3_WR_EN_HI 3 ++#define DBG_HWID3_WR_EN_SZ 1 ++#define DBG_HWID4_WR_EN_MSK 0x00000010 ++#define DBG_HWID4_WR_EN_I_MSK 0xffffffef ++#define DBG_HWID4_WR_EN_SFT 4 ++#define DBG_HWID4_WR_EN_HI 4 ++#define DBG_HWID4_WR_EN_SZ 1 ++#define DBG_HWID5_WR_EN_MSK 0x00000020 ++#define DBG_HWID5_WR_EN_I_MSK 0xffffffdf ++#define DBG_HWID5_WR_EN_SFT 5 ++#define DBG_HWID5_WR_EN_HI 5 ++#define DBG_HWID5_WR_EN_SZ 1 ++#define DBG_HWID6_WR_EN_MSK 0x00000040 ++#define DBG_HWID6_WR_EN_I_MSK 0xffffffbf ++#define DBG_HWID6_WR_EN_SFT 6 ++#define DBG_HWID6_WR_EN_HI 6 ++#define DBG_HWID6_WR_EN_SZ 1 ++#define DBG_HWID7_WR_EN_MSK 0x00000080 ++#define DBG_HWID7_WR_EN_I_MSK 0xffffff7f ++#define DBG_HWID7_WR_EN_SFT 7 ++#define DBG_HWID7_WR_EN_HI 7 ++#define DBG_HWID7_WR_EN_SZ 1 ++#define DBG_HWID8_WR_EN_MSK 0x00000100 ++#define DBG_HWID8_WR_EN_I_MSK 0xfffffeff ++#define DBG_HWID8_WR_EN_SFT 8 ++#define DBG_HWID8_WR_EN_HI 8 ++#define DBG_HWID8_WR_EN_SZ 1 ++#define DBG_HWID9_WR_EN_MSK 0x00000200 ++#define DBG_HWID9_WR_EN_I_MSK 0xfffffdff ++#define DBG_HWID9_WR_EN_SFT 9 ++#define DBG_HWID9_WR_EN_HI 9 ++#define DBG_HWID9_WR_EN_SZ 1 ++#define DBG_HWID10_WR_EN_MSK 0x00000400 ++#define DBG_HWID10_WR_EN_I_MSK 0xfffffbff ++#define DBG_HWID10_WR_EN_SFT 10 ++#define DBG_HWID10_WR_EN_HI 10 ++#define DBG_HWID10_WR_EN_SZ 1 ++#define DBG_HWID11_WR_EN_MSK 0x00000800 ++#define DBG_HWID11_WR_EN_I_MSK 0xfffff7ff ++#define DBG_HWID11_WR_EN_SFT 11 ++#define DBG_HWID11_WR_EN_HI 11 ++#define DBG_HWID11_WR_EN_SZ 1 ++#define DBG_HWID12_WR_EN_MSK 0x00001000 ++#define DBG_HWID12_WR_EN_I_MSK 0xffffefff ++#define DBG_HWID12_WR_EN_SFT 12 ++#define DBG_HWID12_WR_EN_HI 12 ++#define DBG_HWID12_WR_EN_SZ 1 ++#define DBG_HWID13_WR_EN_MSK 0x00002000 ++#define DBG_HWID13_WR_EN_I_MSK 0xffffdfff ++#define DBG_HWID13_WR_EN_SFT 13 ++#define DBG_HWID13_WR_EN_HI 13 ++#define DBG_HWID13_WR_EN_SZ 1 ++#define DBG_HWID14_WR_EN_MSK 0x00004000 ++#define DBG_HWID14_WR_EN_I_MSK 0xffffbfff ++#define DBG_HWID14_WR_EN_SFT 14 ++#define DBG_HWID14_WR_EN_HI 14 ++#define DBG_HWID14_WR_EN_SZ 1 ++#define DBG_HWID15_WR_EN_MSK 0x00008000 ++#define DBG_HWID15_WR_EN_I_MSK 0xffff7fff ++#define DBG_HWID15_WR_EN_SFT 15 ++#define DBG_HWID15_WR_EN_HI 15 ++#define DBG_HWID15_WR_EN_SZ 1 ++#define DBG_HWID0_RD_EN_MSK 0x00010000 ++#define DBG_HWID0_RD_EN_I_MSK 0xfffeffff ++#define DBG_HWID0_RD_EN_SFT 16 ++#define DBG_HWID0_RD_EN_HI 16 ++#define DBG_HWID0_RD_EN_SZ 1 ++#define DBG_HWID1_RD_EN_MSK 0x00020000 ++#define DBG_HWID1_RD_EN_I_MSK 0xfffdffff ++#define DBG_HWID1_RD_EN_SFT 17 ++#define DBG_HWID1_RD_EN_HI 17 ++#define DBG_HWID1_RD_EN_SZ 1 ++#define DBG_HWID2_RD_EN_MSK 0x00040000 ++#define DBG_HWID2_RD_EN_I_MSK 0xfffbffff ++#define DBG_HWID2_RD_EN_SFT 18 ++#define DBG_HWID2_RD_EN_HI 18 ++#define DBG_HWID2_RD_EN_SZ 1 ++#define DBG_HWID3_RD_EN_MSK 0x00080000 ++#define DBG_HWID3_RD_EN_I_MSK 0xfff7ffff ++#define DBG_HWID3_RD_EN_SFT 19 ++#define DBG_HWID3_RD_EN_HI 19 ++#define DBG_HWID3_RD_EN_SZ 1 ++#define DBG_HWID4_RD_EN_MSK 0x00100000 ++#define DBG_HWID4_RD_EN_I_MSK 0xffefffff ++#define DBG_HWID4_RD_EN_SFT 20 ++#define DBG_HWID4_RD_EN_HI 20 ++#define DBG_HWID4_RD_EN_SZ 1 ++#define DBG_HWID5_RD_EN_MSK 0x00200000 ++#define DBG_HWID5_RD_EN_I_MSK 0xffdfffff ++#define DBG_HWID5_RD_EN_SFT 21 ++#define DBG_HWID5_RD_EN_HI 21 ++#define DBG_HWID5_RD_EN_SZ 1 ++#define DBG_HWID6_RD_EN_MSK 0x00400000 ++#define DBG_HWID6_RD_EN_I_MSK 0xffbfffff ++#define DBG_HWID6_RD_EN_SFT 22 ++#define DBG_HWID6_RD_EN_HI 22 ++#define DBG_HWID6_RD_EN_SZ 1 ++#define DBG_HWID7_RD_EN_MSK 0x00800000 ++#define DBG_HWID7_RD_EN_I_MSK 0xff7fffff ++#define DBG_HWID7_RD_EN_SFT 23 ++#define DBG_HWID7_RD_EN_HI 23 ++#define DBG_HWID7_RD_EN_SZ 1 ++#define DBG_HWID8_RD_EN_MSK 0x01000000 ++#define DBG_HWID8_RD_EN_I_MSK 0xfeffffff ++#define DBG_HWID8_RD_EN_SFT 24 ++#define DBG_HWID8_RD_EN_HI 24 ++#define DBG_HWID8_RD_EN_SZ 1 ++#define DBG_HWID9_RD_EN_MSK 0x02000000 ++#define DBG_HWID9_RD_EN_I_MSK 0xfdffffff ++#define DBG_HWID9_RD_EN_SFT 25 ++#define DBG_HWID9_RD_EN_HI 25 ++#define DBG_HWID9_RD_EN_SZ 1 ++#define DBG_HWID10_RD_EN_MSK 0x04000000 ++#define DBG_HWID10_RD_EN_I_MSK 0xfbffffff ++#define DBG_HWID10_RD_EN_SFT 26 ++#define DBG_HWID10_RD_EN_HI 26 ++#define DBG_HWID10_RD_EN_SZ 1 ++#define DBG_HWID11_RD_EN_MSK 0x08000000 ++#define DBG_HWID11_RD_EN_I_MSK 0xf7ffffff ++#define DBG_HWID11_RD_EN_SFT 27 ++#define DBG_HWID11_RD_EN_HI 27 ++#define DBG_HWID11_RD_EN_SZ 1 ++#define DBG_HWID12_RD_EN_MSK 0x10000000 ++#define DBG_HWID12_RD_EN_I_MSK 0xefffffff ++#define DBG_HWID12_RD_EN_SFT 28 ++#define DBG_HWID12_RD_EN_HI 28 ++#define DBG_HWID12_RD_EN_SZ 1 ++#define DBG_HWID13_RD_EN_MSK 0x20000000 ++#define DBG_HWID13_RD_EN_I_MSK 0xdfffffff ++#define DBG_HWID13_RD_EN_SFT 29 ++#define DBG_HWID13_RD_EN_HI 29 ++#define DBG_HWID13_RD_EN_SZ 1 ++#define DBG_HWID14_RD_EN_MSK 0x40000000 ++#define DBG_HWID14_RD_EN_I_MSK 0xbfffffff ++#define DBG_HWID14_RD_EN_SFT 30 ++#define DBG_HWID14_RD_EN_HI 30 ++#define DBG_HWID14_RD_EN_SZ 1 ++#define DBG_HWID15_RD_EN_MSK 0x80000000 ++#define DBG_HWID15_RD_EN_I_MSK 0x7fffffff ++#define DBG_HWID15_RD_EN_SFT 31 ++#define DBG_HWID15_RD_EN_HI 31 ++#define DBG_HWID15_RD_EN_SZ 1 ++#define MB_OUT_QUEUE_EN_MSK 0x00000002 ++#define MB_OUT_QUEUE_EN_I_MSK 0xfffffffd ++#define MB_OUT_QUEUE_EN_SFT 1 ++#define MB_OUT_QUEUE_EN_HI 1 ++#define MB_OUT_QUEUE_EN_SZ 1 ++#define CH0_QUEUE_FLUSH_MSK 0x00000001 ++#define CH0_QUEUE_FLUSH_I_MSK 0xfffffffe ++#define CH0_QUEUE_FLUSH_SFT 0 ++#define CH0_QUEUE_FLUSH_HI 0 ++#define CH0_QUEUE_FLUSH_SZ 1 ++#define CH1_QUEUE_FLUSH_MSK 0x00000002 ++#define CH1_QUEUE_FLUSH_I_MSK 0xfffffffd ++#define CH1_QUEUE_FLUSH_SFT 1 ++#define CH1_QUEUE_FLUSH_HI 1 ++#define CH1_QUEUE_FLUSH_SZ 1 ++#define CH2_QUEUE_FLUSH_MSK 0x00000004 ++#define CH2_QUEUE_FLUSH_I_MSK 0xfffffffb ++#define CH2_QUEUE_FLUSH_SFT 2 ++#define CH2_QUEUE_FLUSH_HI 2 ++#define CH2_QUEUE_FLUSH_SZ 1 ++#define CH3_QUEUE_FLUSH_MSK 0x00000008 ++#define CH3_QUEUE_FLUSH_I_MSK 0xfffffff7 ++#define CH3_QUEUE_FLUSH_SFT 3 ++#define CH3_QUEUE_FLUSH_HI 3 ++#define CH3_QUEUE_FLUSH_SZ 1 ++#define CH4_QUEUE_FLUSH_MSK 0x00000010 ++#define CH4_QUEUE_FLUSH_I_MSK 0xffffffef ++#define CH4_QUEUE_FLUSH_SFT 4 ++#define CH4_QUEUE_FLUSH_HI 4 ++#define CH4_QUEUE_FLUSH_SZ 1 ++#define CH5_QUEUE_FLUSH_MSK 0x00000020 ++#define CH5_QUEUE_FLUSH_I_MSK 0xffffffdf ++#define CH5_QUEUE_FLUSH_SFT 5 ++#define CH5_QUEUE_FLUSH_HI 5 ++#define CH5_QUEUE_FLUSH_SZ 1 ++#define CH6_QUEUE_FLUSH_MSK 0x00000040 ++#define CH6_QUEUE_FLUSH_I_MSK 0xffffffbf ++#define CH6_QUEUE_FLUSH_SFT 6 ++#define CH6_QUEUE_FLUSH_HI 6 ++#define CH6_QUEUE_FLUSH_SZ 1 ++#define CH7_QUEUE_FLUSH_MSK 0x00000080 ++#define CH7_QUEUE_FLUSH_I_MSK 0xffffff7f ++#define CH7_QUEUE_FLUSH_SFT 7 ++#define CH7_QUEUE_FLUSH_HI 7 ++#define CH7_QUEUE_FLUSH_SZ 1 ++#define CH8_QUEUE_FLUSH_MSK 0x00000100 ++#define CH8_QUEUE_FLUSH_I_MSK 0xfffffeff ++#define CH8_QUEUE_FLUSH_SFT 8 ++#define CH8_QUEUE_FLUSH_HI 8 ++#define CH8_QUEUE_FLUSH_SZ 1 ++#define CH9_QUEUE_FLUSH_MSK 0x00000200 ++#define CH9_QUEUE_FLUSH_I_MSK 0xfffffdff ++#define CH9_QUEUE_FLUSH_SFT 9 ++#define CH9_QUEUE_FLUSH_HI 9 ++#define CH9_QUEUE_FLUSH_SZ 1 ++#define CH10_QUEUE_FLUSH_MSK 0x00000400 ++#define CH10_QUEUE_FLUSH_I_MSK 0xfffffbff ++#define CH10_QUEUE_FLUSH_SFT 10 ++#define CH10_QUEUE_FLUSH_HI 10 ++#define CH10_QUEUE_FLUSH_SZ 1 ++#define CH11_QUEUE_FLUSH_MSK 0x00000800 ++#define CH11_QUEUE_FLUSH_I_MSK 0xfffff7ff ++#define CH11_QUEUE_FLUSH_SFT 11 ++#define CH11_QUEUE_FLUSH_HI 11 ++#define CH11_QUEUE_FLUSH_SZ 1 ++#define CH12_QUEUE_FLUSH_MSK 0x00001000 ++#define CH12_QUEUE_FLUSH_I_MSK 0xffffefff ++#define CH12_QUEUE_FLUSH_SFT 12 ++#define CH12_QUEUE_FLUSH_HI 12 ++#define CH12_QUEUE_FLUSH_SZ 1 ++#define CH13_QUEUE_FLUSH_MSK 0x00002000 ++#define CH13_QUEUE_FLUSH_I_MSK 0xffffdfff ++#define CH13_QUEUE_FLUSH_SFT 13 ++#define CH13_QUEUE_FLUSH_HI 13 ++#define CH13_QUEUE_FLUSH_SZ 1 ++#define CH14_QUEUE_FLUSH_MSK 0x00004000 ++#define CH14_QUEUE_FLUSH_I_MSK 0xffffbfff ++#define CH14_QUEUE_FLUSH_SFT 14 ++#define CH14_QUEUE_FLUSH_HI 14 ++#define CH14_QUEUE_FLUSH_SZ 1 ++#define CH15_QUEUE_FLUSH_MSK 0x00008000 ++#define CH15_QUEUE_FLUSH_I_MSK 0xffff7fff ++#define CH15_QUEUE_FLUSH_SFT 15 ++#define CH15_QUEUE_FLUSH_HI 15 ++#define CH15_QUEUE_FLUSH_SZ 1 ++#define FFO0_CNT_MSK 0x0000001f ++#define FFO0_CNT_I_MSK 0xffffffe0 ++#define FFO0_CNT_SFT 0 ++#define FFO0_CNT_HI 4 ++#define FFO0_CNT_SZ 5 ++#define FFO1_CNT_MSK 0x000003e0 ++#define FFO1_CNT_I_MSK 0xfffffc1f ++#define FFO1_CNT_SFT 5 ++#define FFO1_CNT_HI 9 ++#define FFO1_CNT_SZ 5 ++#define FFO2_CNT_MSK 0x00000c00 ++#define FFO2_CNT_I_MSK 0xfffff3ff ++#define FFO2_CNT_SFT 10 ++#define FFO2_CNT_HI 11 ++#define FFO2_CNT_SZ 2 ++#define FFO3_CNT_MSK 0x000f8000 ++#define FFO3_CNT_I_MSK 0xfff07fff ++#define FFO3_CNT_SFT 15 ++#define FFO3_CNT_HI 19 ++#define FFO3_CNT_SZ 5 ++#define FFO4_CNT_MSK 0x00300000 ++#define FFO4_CNT_I_MSK 0xffcfffff ++#define FFO4_CNT_SFT 20 ++#define FFO4_CNT_HI 21 ++#define FFO4_CNT_SZ 2 ++#define FFO5_CNT_MSK 0x0e000000 ++#define FFO5_CNT_I_MSK 0xf1ffffff ++#define FFO5_CNT_SFT 25 ++#define FFO5_CNT_HI 27 ++#define FFO5_CNT_SZ 3 ++#define FFO6_CNT_MSK 0x0000000f ++#define FFO6_CNT_I_MSK 0xfffffff0 ++#define FFO6_CNT_SFT 0 ++#define FFO6_CNT_HI 3 ++#define FFO6_CNT_SZ 4 ++#define FFO7_CNT_MSK 0x000003e0 ++#define FFO7_CNT_I_MSK 0xfffffc1f ++#define FFO7_CNT_SFT 5 ++#define FFO7_CNT_HI 9 ++#define FFO7_CNT_SZ 5 ++#define FFO8_CNT_MSK 0x00007c00 ++#define FFO8_CNT_I_MSK 0xffff83ff ++#define FFO8_CNT_SFT 10 ++#define FFO8_CNT_HI 14 ++#define FFO8_CNT_SZ 5 ++#define FFO9_CNT_MSK 0x000f8000 ++#define FFO9_CNT_I_MSK 0xfff07fff ++#define FFO9_CNT_SFT 15 ++#define FFO9_CNT_HI 19 ++#define FFO9_CNT_SZ 5 ++#define FFO10_CNT_MSK 0x00f00000 ++#define FFO10_CNT_I_MSK 0xff0fffff ++#define FFO10_CNT_SFT 20 ++#define FFO10_CNT_HI 23 ++#define FFO10_CNT_SZ 4 ++#define FFO11_CNT_MSK 0x3e000000 ++#define FFO11_CNT_I_MSK 0xc1ffffff ++#define FFO11_CNT_SFT 25 ++#define FFO11_CNT_HI 29 ++#define FFO11_CNT_SZ 5 ++#define FFO12_CNT_MSK 0x00000007 ++#define FFO12_CNT_I_MSK 0xfffffff8 ++#define FFO12_CNT_SFT 0 ++#define FFO12_CNT_HI 2 ++#define FFO12_CNT_SZ 3 ++#define FFO13_CNT_MSK 0x00000060 ++#define FFO13_CNT_I_MSK 0xffffff9f ++#define FFO13_CNT_SFT 5 ++#define FFO13_CNT_HI 6 ++#define FFO13_CNT_SZ 2 ++#define FFO14_CNT_MSK 0x00000c00 ++#define FFO14_CNT_I_MSK 0xfffff3ff ++#define FFO14_CNT_SFT 10 ++#define FFO14_CNT_HI 11 ++#define FFO14_CNT_SZ 2 ++#define FFO15_CNT_MSK 0x001f8000 ++#define FFO15_CNT_I_MSK 0xffe07fff ++#define FFO15_CNT_SFT 15 ++#define FFO15_CNT_HI 20 ++#define FFO15_CNT_SZ 6 ++#define CH0_FFO_FULL_MSK 0x00000001 ++#define CH0_FFO_FULL_I_MSK 0xfffffffe ++#define CH0_FFO_FULL_SFT 0 ++#define CH0_FFO_FULL_HI 0 ++#define CH0_FFO_FULL_SZ 1 ++#define CH1_FFO_FULL_MSK 0x00000002 ++#define CH1_FFO_FULL_I_MSK 0xfffffffd ++#define CH1_FFO_FULL_SFT 1 ++#define CH1_FFO_FULL_HI 1 ++#define CH1_FFO_FULL_SZ 1 ++#define CH2_FFO_FULL_MSK 0x00000004 ++#define CH2_FFO_FULL_I_MSK 0xfffffffb ++#define CH2_FFO_FULL_SFT 2 ++#define CH2_FFO_FULL_HI 2 ++#define CH2_FFO_FULL_SZ 1 ++#define CH3_FFO_FULL_MSK 0x00000008 ++#define CH3_FFO_FULL_I_MSK 0xfffffff7 ++#define CH3_FFO_FULL_SFT 3 ++#define CH3_FFO_FULL_HI 3 ++#define CH3_FFO_FULL_SZ 1 ++#define CH4_FFO_FULL_MSK 0x00000010 ++#define CH4_FFO_FULL_I_MSK 0xffffffef ++#define CH4_FFO_FULL_SFT 4 ++#define CH4_FFO_FULL_HI 4 ++#define CH4_FFO_FULL_SZ 1 ++#define CH5_FFO_FULL_MSK 0x00000020 ++#define CH5_FFO_FULL_I_MSK 0xffffffdf ++#define CH5_FFO_FULL_SFT 5 ++#define CH5_FFO_FULL_HI 5 ++#define CH5_FFO_FULL_SZ 1 ++#define CH6_FFO_FULL_MSK 0x00000040 ++#define CH6_FFO_FULL_I_MSK 0xffffffbf ++#define CH6_FFO_FULL_SFT 6 ++#define CH6_FFO_FULL_HI 6 ++#define CH6_FFO_FULL_SZ 1 ++#define CH7_FFO_FULL_MSK 0x00000080 ++#define CH7_FFO_FULL_I_MSK 0xffffff7f ++#define CH7_FFO_FULL_SFT 7 ++#define CH7_FFO_FULL_HI 7 ++#define CH7_FFO_FULL_SZ 1 ++#define CH8_FFO_FULL_MSK 0x00000100 ++#define CH8_FFO_FULL_I_MSK 0xfffffeff ++#define CH8_FFO_FULL_SFT 8 ++#define CH8_FFO_FULL_HI 8 ++#define CH8_FFO_FULL_SZ 1 ++#define CH9_FFO_FULL_MSK 0x00000200 ++#define CH9_FFO_FULL_I_MSK 0xfffffdff ++#define CH9_FFO_FULL_SFT 9 ++#define CH9_FFO_FULL_HI 9 ++#define CH9_FFO_FULL_SZ 1 ++#define CH10_FFO_FULL_MSK 0x00000400 ++#define CH10_FFO_FULL_I_MSK 0xfffffbff ++#define CH10_FFO_FULL_SFT 10 ++#define CH10_FFO_FULL_HI 10 ++#define CH10_FFO_FULL_SZ 1 ++#define CH11_FFO_FULL_MSK 0x00000800 ++#define CH11_FFO_FULL_I_MSK 0xfffff7ff ++#define CH11_FFO_FULL_SFT 11 ++#define CH11_FFO_FULL_HI 11 ++#define CH11_FFO_FULL_SZ 1 ++#define CH12_FFO_FULL_MSK 0x00001000 ++#define CH12_FFO_FULL_I_MSK 0xffffefff ++#define CH12_FFO_FULL_SFT 12 ++#define CH12_FFO_FULL_HI 12 ++#define CH12_FFO_FULL_SZ 1 ++#define CH13_FFO_FULL_MSK 0x00002000 ++#define CH13_FFO_FULL_I_MSK 0xffffdfff ++#define CH13_FFO_FULL_SFT 13 ++#define CH13_FFO_FULL_HI 13 ++#define CH13_FFO_FULL_SZ 1 ++#define CH14_FFO_FULL_MSK 0x00004000 ++#define CH14_FFO_FULL_I_MSK 0xffffbfff ++#define CH14_FFO_FULL_SFT 14 ++#define CH14_FFO_FULL_HI 14 ++#define CH14_FFO_FULL_SZ 1 ++#define CH15_FFO_FULL_MSK 0x00008000 ++#define CH15_FFO_FULL_I_MSK 0xffff7fff ++#define CH15_FFO_FULL_SFT 15 ++#define CH15_FFO_FULL_HI 15 ++#define CH15_FFO_FULL_SZ 1 ++#define CH0_LOWTHOLD_INT_MSK 0x00000001 ++#define CH0_LOWTHOLD_INT_I_MSK 0xfffffffe ++#define CH0_LOWTHOLD_INT_SFT 0 ++#define CH0_LOWTHOLD_INT_HI 0 ++#define CH0_LOWTHOLD_INT_SZ 1 ++#define CH1_LOWTHOLD_INT_MSK 0x00000002 ++#define CH1_LOWTHOLD_INT_I_MSK 0xfffffffd ++#define CH1_LOWTHOLD_INT_SFT 1 ++#define CH1_LOWTHOLD_INT_HI 1 ++#define CH1_LOWTHOLD_INT_SZ 1 ++#define CH2_LOWTHOLD_INT_MSK 0x00000004 ++#define CH2_LOWTHOLD_INT_I_MSK 0xfffffffb ++#define CH2_LOWTHOLD_INT_SFT 2 ++#define CH2_LOWTHOLD_INT_HI 2 ++#define CH2_LOWTHOLD_INT_SZ 1 ++#define CH3_LOWTHOLD_INT_MSK 0x00000008 ++#define CH3_LOWTHOLD_INT_I_MSK 0xfffffff7 ++#define CH3_LOWTHOLD_INT_SFT 3 ++#define CH3_LOWTHOLD_INT_HI 3 ++#define CH3_LOWTHOLD_INT_SZ 1 ++#define CH4_LOWTHOLD_INT_MSK 0x00000010 ++#define CH4_LOWTHOLD_INT_I_MSK 0xffffffef ++#define CH4_LOWTHOLD_INT_SFT 4 ++#define CH4_LOWTHOLD_INT_HI 4 ++#define CH4_LOWTHOLD_INT_SZ 1 ++#define CH5_LOWTHOLD_INT_MSK 0x00000020 ++#define CH5_LOWTHOLD_INT_I_MSK 0xffffffdf ++#define CH5_LOWTHOLD_INT_SFT 5 ++#define CH5_LOWTHOLD_INT_HI 5 ++#define CH5_LOWTHOLD_INT_SZ 1 ++#define CH6_LOWTHOLD_INT_MSK 0x00000040 ++#define CH6_LOWTHOLD_INT_I_MSK 0xffffffbf ++#define CH6_LOWTHOLD_INT_SFT 6 ++#define CH6_LOWTHOLD_INT_HI 6 ++#define CH6_LOWTHOLD_INT_SZ 1 ++#define CH7_LOWTHOLD_INT_MSK 0x00000080 ++#define CH7_LOWTHOLD_INT_I_MSK 0xffffff7f ++#define CH7_LOWTHOLD_INT_SFT 7 ++#define CH7_LOWTHOLD_INT_HI 7 ++#define CH7_LOWTHOLD_INT_SZ 1 ++#define CH8_LOWTHOLD_INT_MSK 0x00000100 ++#define CH8_LOWTHOLD_INT_I_MSK 0xfffffeff ++#define CH8_LOWTHOLD_INT_SFT 8 ++#define CH8_LOWTHOLD_INT_HI 8 ++#define CH8_LOWTHOLD_INT_SZ 1 ++#define CH9_LOWTHOLD_INT_MSK 0x00000200 ++#define CH9_LOWTHOLD_INT_I_MSK 0xfffffdff ++#define CH9_LOWTHOLD_INT_SFT 9 ++#define CH9_LOWTHOLD_INT_HI 9 ++#define CH9_LOWTHOLD_INT_SZ 1 ++#define CH10_LOWTHOLD_INT_MSK 0x00000400 ++#define CH10_LOWTHOLD_INT_I_MSK 0xfffffbff ++#define CH10_LOWTHOLD_INT_SFT 10 ++#define CH10_LOWTHOLD_INT_HI 10 ++#define CH10_LOWTHOLD_INT_SZ 1 ++#define CH11_LOWTHOLD_INT_MSK 0x00000800 ++#define CH11_LOWTHOLD_INT_I_MSK 0xfffff7ff ++#define CH11_LOWTHOLD_INT_SFT 11 ++#define CH11_LOWTHOLD_INT_HI 11 ++#define CH11_LOWTHOLD_INT_SZ 1 ++#define CH12_LOWTHOLD_INT_MSK 0x00001000 ++#define CH12_LOWTHOLD_INT_I_MSK 0xffffefff ++#define CH12_LOWTHOLD_INT_SFT 12 ++#define CH12_LOWTHOLD_INT_HI 12 ++#define CH12_LOWTHOLD_INT_SZ 1 ++#define CH13_LOWTHOLD_INT_MSK 0x00002000 ++#define CH13_LOWTHOLD_INT_I_MSK 0xffffdfff ++#define CH13_LOWTHOLD_INT_SFT 13 ++#define CH13_LOWTHOLD_INT_HI 13 ++#define CH13_LOWTHOLD_INT_SZ 1 ++#define CH14_LOWTHOLD_INT_MSK 0x00004000 ++#define CH14_LOWTHOLD_INT_I_MSK 0xffffbfff ++#define CH14_LOWTHOLD_INT_SFT 14 ++#define CH14_LOWTHOLD_INT_HI 14 ++#define CH14_LOWTHOLD_INT_SZ 1 ++#define CH15_LOWTHOLD_INT_MSK 0x00008000 ++#define CH15_LOWTHOLD_INT_I_MSK 0xffff7fff ++#define CH15_LOWTHOLD_INT_SFT 15 ++#define CH15_LOWTHOLD_INT_HI 15 ++#define CH15_LOWTHOLD_INT_SZ 1 ++#define MB_LOW_THOLD_EN_MSK 0x80000000 ++#define MB_LOW_THOLD_EN_I_MSK 0x7fffffff ++#define MB_LOW_THOLD_EN_SFT 31 ++#define MB_LOW_THOLD_EN_HI 31 ++#define MB_LOW_THOLD_EN_SZ 1 ++#define CH0_LOWTHOLD_MSK 0x0000001f ++#define CH0_LOWTHOLD_I_MSK 0xffffffe0 ++#define CH0_LOWTHOLD_SFT 0 ++#define CH0_LOWTHOLD_HI 4 ++#define CH0_LOWTHOLD_SZ 5 ++#define CH1_LOWTHOLD_MSK 0x00001f00 ++#define CH1_LOWTHOLD_I_MSK 0xffffe0ff ++#define CH1_LOWTHOLD_SFT 8 ++#define CH1_LOWTHOLD_HI 12 ++#define CH1_LOWTHOLD_SZ 5 ++#define CH2_LOWTHOLD_MSK 0x001f0000 ++#define CH2_LOWTHOLD_I_MSK 0xffe0ffff ++#define CH2_LOWTHOLD_SFT 16 ++#define CH2_LOWTHOLD_HI 20 ++#define CH2_LOWTHOLD_SZ 5 ++#define CH3_LOWTHOLD_MSK 0x1f000000 ++#define CH3_LOWTHOLD_I_MSK 0xe0ffffff ++#define CH3_LOWTHOLD_SFT 24 ++#define CH3_LOWTHOLD_HI 28 ++#define CH3_LOWTHOLD_SZ 5 ++#define CH4_LOWTHOLD_MSK 0x0000001f ++#define CH4_LOWTHOLD_I_MSK 0xffffffe0 ++#define CH4_LOWTHOLD_SFT 0 ++#define CH4_LOWTHOLD_HI 4 ++#define CH4_LOWTHOLD_SZ 5 ++#define CH5_LOWTHOLD_MSK 0x00001f00 ++#define CH5_LOWTHOLD_I_MSK 0xffffe0ff ++#define CH5_LOWTHOLD_SFT 8 ++#define CH5_LOWTHOLD_HI 12 ++#define CH5_LOWTHOLD_SZ 5 ++#define CH6_LOWTHOLD_MSK 0x001f0000 ++#define CH6_LOWTHOLD_I_MSK 0xffe0ffff ++#define CH6_LOWTHOLD_SFT 16 ++#define CH6_LOWTHOLD_HI 20 ++#define CH6_LOWTHOLD_SZ 5 ++#define CH7_LOWTHOLD_MSK 0x1f000000 ++#define CH7_LOWTHOLD_I_MSK 0xe0ffffff ++#define CH7_LOWTHOLD_SFT 24 ++#define CH7_LOWTHOLD_HI 28 ++#define CH7_LOWTHOLD_SZ 5 ++#define CH8_LOWTHOLD_MSK 0x0000001f ++#define CH8_LOWTHOLD_I_MSK 0xffffffe0 ++#define CH8_LOWTHOLD_SFT 0 ++#define CH8_LOWTHOLD_HI 4 ++#define CH8_LOWTHOLD_SZ 5 ++#define CH9_LOWTHOLD_MSK 0x00001f00 ++#define CH9_LOWTHOLD_I_MSK 0xffffe0ff ++#define CH9_LOWTHOLD_SFT 8 ++#define CH9_LOWTHOLD_HI 12 ++#define CH9_LOWTHOLD_SZ 5 ++#define CH10_LOWTHOLD_MSK 0x001f0000 ++#define CH10_LOWTHOLD_I_MSK 0xffe0ffff ++#define CH10_LOWTHOLD_SFT 16 ++#define CH10_LOWTHOLD_HI 20 ++#define CH10_LOWTHOLD_SZ 5 ++#define CH11_LOWTHOLD_MSK 0x1f000000 ++#define CH11_LOWTHOLD_I_MSK 0xe0ffffff ++#define CH11_LOWTHOLD_SFT 24 ++#define CH11_LOWTHOLD_HI 28 ++#define CH11_LOWTHOLD_SZ 5 ++#define CH12_LOWTHOLD_MSK 0x0000001f ++#define CH12_LOWTHOLD_I_MSK 0xffffffe0 ++#define CH12_LOWTHOLD_SFT 0 ++#define CH12_LOWTHOLD_HI 4 ++#define CH12_LOWTHOLD_SZ 5 ++#define CH13_LOWTHOLD_MSK 0x00001f00 ++#define CH13_LOWTHOLD_I_MSK 0xffffe0ff ++#define CH13_LOWTHOLD_SFT 8 ++#define CH13_LOWTHOLD_HI 12 ++#define CH13_LOWTHOLD_SZ 5 ++#define CH14_LOWTHOLD_MSK 0x001f0000 ++#define CH14_LOWTHOLD_I_MSK 0xffe0ffff ++#define CH14_LOWTHOLD_SFT 16 ++#define CH14_LOWTHOLD_HI 20 ++#define CH14_LOWTHOLD_SZ 5 ++#define CH15_LOWTHOLD_MSK 0x1f000000 ++#define CH15_LOWTHOLD_I_MSK 0xe0ffffff ++#define CH15_LOWTHOLD_SFT 24 ++#define CH15_LOWTHOLD_HI 28 ++#define CH15_LOWTHOLD_SZ 5 ++#define TRASH_TIMEOUT_EN_MSK 0x00000001 ++#define TRASH_TIMEOUT_EN_I_MSK 0xfffffffe ++#define TRASH_TIMEOUT_EN_SFT 0 ++#define TRASH_TIMEOUT_EN_HI 0 ++#define TRASH_TIMEOUT_EN_SZ 1 ++#define TRASH_CAN_INT_MSK 0x00000002 ++#define TRASH_CAN_INT_I_MSK 0xfffffffd ++#define TRASH_CAN_INT_SFT 1 ++#define TRASH_CAN_INT_HI 1 ++#define TRASH_CAN_INT_SZ 1 ++#define TRASH_INT_ID_MSK 0x000007f0 ++#define TRASH_INT_ID_I_MSK 0xfffff80f ++#define TRASH_INT_ID_SFT 4 ++#define TRASH_INT_ID_HI 10 ++#define TRASH_INT_ID_SZ 7 ++#define TRASH_TIMEOUT_MSK 0x03ff0000 ++#define TRASH_TIMEOUT_I_MSK 0xfc00ffff ++#define TRASH_TIMEOUT_SFT 16 ++#define TRASH_TIMEOUT_HI 25 ++#define TRASH_TIMEOUT_SZ 10 ++#define CH0_WRFF_FLUSH_MSK 0x00000001 ++#define CH0_WRFF_FLUSH_I_MSK 0xfffffffe ++#define CH0_WRFF_FLUSH_SFT 0 ++#define CH0_WRFF_FLUSH_HI 0 ++#define CH0_WRFF_FLUSH_SZ 1 ++#define CH1_WRFF_FLUSH_MSK 0x00000002 ++#define CH1_WRFF_FLUSH_I_MSK 0xfffffffd ++#define CH1_WRFF_FLUSH_SFT 1 ++#define CH1_WRFF_FLUSH_HI 1 ++#define CH1_WRFF_FLUSH_SZ 1 ++#define CH2_WRFF_FLUSH_MSK 0x00000004 ++#define CH2_WRFF_FLUSH_I_MSK 0xfffffffb ++#define CH2_WRFF_FLUSH_SFT 2 ++#define CH2_WRFF_FLUSH_HI 2 ++#define CH2_WRFF_FLUSH_SZ 1 ++#define CH3_WRFF_FLUSH_MSK 0x00000008 ++#define CH3_WRFF_FLUSH_I_MSK 0xfffffff7 ++#define CH3_WRFF_FLUSH_SFT 3 ++#define CH3_WRFF_FLUSH_HI 3 ++#define CH3_WRFF_FLUSH_SZ 1 ++#define CH4_WRFF_FLUSH_MSK 0x00000010 ++#define CH4_WRFF_FLUSH_I_MSK 0xffffffef ++#define CH4_WRFF_FLUSH_SFT 4 ++#define CH4_WRFF_FLUSH_HI 4 ++#define CH4_WRFF_FLUSH_SZ 1 ++#define CH5_WRFF_FLUSH_MSK 0x00000020 ++#define CH5_WRFF_FLUSH_I_MSK 0xffffffdf ++#define CH5_WRFF_FLUSH_SFT 5 ++#define CH5_WRFF_FLUSH_HI 5 ++#define CH5_WRFF_FLUSH_SZ 1 ++#define CH6_WRFF_FLUSH_MSK 0x00000040 ++#define CH6_WRFF_FLUSH_I_MSK 0xffffffbf ++#define CH6_WRFF_FLUSH_SFT 6 ++#define CH6_WRFF_FLUSH_HI 6 ++#define CH6_WRFF_FLUSH_SZ 1 ++#define CH7_WRFF_FLUSH_MSK 0x00000080 ++#define CH7_WRFF_FLUSH_I_MSK 0xffffff7f ++#define CH7_WRFF_FLUSH_SFT 7 ++#define CH7_WRFF_FLUSH_HI 7 ++#define CH7_WRFF_FLUSH_SZ 1 ++#define CH8_WRFF_FLUSH_MSK 0x00000100 ++#define CH8_WRFF_FLUSH_I_MSK 0xfffffeff ++#define CH8_WRFF_FLUSH_SFT 8 ++#define CH8_WRFF_FLUSH_HI 8 ++#define CH8_WRFF_FLUSH_SZ 1 ++#define CH9_WRFF_FLUSH_MSK 0x00000200 ++#define CH9_WRFF_FLUSH_I_MSK 0xfffffdff ++#define CH9_WRFF_FLUSH_SFT 9 ++#define CH9_WRFF_FLUSH_HI 9 ++#define CH9_WRFF_FLUSH_SZ 1 ++#define CH10_WRFF_FLUSH_MSK 0x00000400 ++#define CH10_WRFF_FLUSH_I_MSK 0xfffffbff ++#define CH10_WRFF_FLUSH_SFT 10 ++#define CH10_WRFF_FLUSH_HI 10 ++#define CH10_WRFF_FLUSH_SZ 1 ++#define CH11_WRFF_FLUSH_MSK 0x00000800 ++#define CH11_WRFF_FLUSH_I_MSK 0xfffff7ff ++#define CH11_WRFF_FLUSH_SFT 11 ++#define CH11_WRFF_FLUSH_HI 11 ++#define CH11_WRFF_FLUSH_SZ 1 ++#define CH12_WRFF_FLUSH_MSK 0x00001000 ++#define CH12_WRFF_FLUSH_I_MSK 0xffffefff ++#define CH12_WRFF_FLUSH_SFT 12 ++#define CH12_WRFF_FLUSH_HI 12 ++#define CH12_WRFF_FLUSH_SZ 1 ++#define CH13_WRFF_FLUSH_MSK 0x00002000 ++#define CH13_WRFF_FLUSH_I_MSK 0xffffdfff ++#define CH13_WRFF_FLUSH_SFT 13 ++#define CH13_WRFF_FLUSH_HI 13 ++#define CH13_WRFF_FLUSH_SZ 1 ++#define CH14_WRFF_FLUSH_MSK 0x00004000 ++#define CH14_WRFF_FLUSH_I_MSK 0xffffbfff ++#define CH14_WRFF_FLUSH_SFT 14 ++#define CH14_WRFF_FLUSH_HI 14 ++#define CH14_WRFF_FLUSH_SZ 1 ++#define CPU_ID_TB2_MSK 0xffffffff ++#define CPU_ID_TB2_I_MSK 0x00000000 ++#define CPU_ID_TB2_SFT 0 ++#define CPU_ID_TB2_HI 31 ++#define CPU_ID_TB2_SZ 32 ++#define CPU_ID_TB3_MSK 0xffffffff ++#define CPU_ID_TB3_I_MSK 0x00000000 ++#define CPU_ID_TB3_SFT 0 ++#define CPU_ID_TB3_HI 31 ++#define CPU_ID_TB3_SZ 32 ++#define IQ_LOG_EN_MSK 0x00000001 ++#define IQ_LOG_EN_I_MSK 0xfffffffe ++#define IQ_LOG_EN_SFT 0 ++#define IQ_LOG_EN_HI 0 ++#define IQ_LOG_EN_SZ 1 ++#define IQ_LOG_STOP_MODE_MSK 0x00000001 ++#define IQ_LOG_STOP_MODE_I_MSK 0xfffffffe ++#define IQ_LOG_STOP_MODE_SFT 0 ++#define IQ_LOG_STOP_MODE_HI 0 ++#define IQ_LOG_STOP_MODE_SZ 1 ++#define GPIO_STOP_EN_MSK 0x00000010 ++#define GPIO_STOP_EN_I_MSK 0xffffffef ++#define GPIO_STOP_EN_SFT 4 ++#define GPIO_STOP_EN_HI 4 ++#define GPIO_STOP_EN_SZ 1 ++#define GPIO_STOP_POL_MSK 0x00000020 ++#define GPIO_STOP_POL_I_MSK 0xffffffdf ++#define GPIO_STOP_POL_SFT 5 ++#define GPIO_STOP_POL_HI 5 ++#define GPIO_STOP_POL_SZ 1 ++#define IQ_LOG_TIMER_MSK 0xffff0000 ++#define IQ_LOG_TIMER_I_MSK 0x0000ffff ++#define IQ_LOG_TIMER_SFT 16 ++#define IQ_LOG_TIMER_HI 31 ++#define IQ_LOG_TIMER_SZ 16 ++#define IQ_LOG_LEN_MSK 0x0000ffff ++#define IQ_LOG_LEN_I_MSK 0xffff0000 ++#define IQ_LOG_LEN_SFT 0 ++#define IQ_LOG_LEN_HI 15 ++#define IQ_LOG_LEN_SZ 16 ++#define IQ_LOG_TAIL_ADR_MSK 0x0000ffff ++#define IQ_LOG_TAIL_ADR_I_MSK 0xffff0000 ++#define IQ_LOG_TAIL_ADR_SFT 0 ++#define IQ_LOG_TAIL_ADR_HI 15 ++#define IQ_LOG_TAIL_ADR_SZ 16 ++#define ALC_LENG_MSK 0x0003ffff ++#define ALC_LENG_I_MSK 0xfffc0000 ++#define ALC_LENG_SFT 0 ++#define ALC_LENG_HI 17 ++#define ALC_LENG_SZ 18 ++#define CH0_DYN_PRI_MSK 0x00300000 ++#define CH0_DYN_PRI_I_MSK 0xffcfffff ++#define CH0_DYN_PRI_SFT 20 ++#define CH0_DYN_PRI_HI 21 ++#define CH0_DYN_PRI_SZ 2 ++#define MCU_PKTID_MSK 0xffffffff ++#define MCU_PKTID_I_MSK 0x00000000 ++#define MCU_PKTID_SFT 0 ++#define MCU_PKTID_HI 31 ++#define MCU_PKTID_SZ 32 ++#define CH0_STA_PRI_MSK 0x00000003 ++#define CH0_STA_PRI_I_MSK 0xfffffffc ++#define CH0_STA_PRI_SFT 0 ++#define CH0_STA_PRI_HI 1 ++#define CH0_STA_PRI_SZ 2 ++#define CH1_STA_PRI_MSK 0x00000030 ++#define CH1_STA_PRI_I_MSK 0xffffffcf ++#define CH1_STA_PRI_SFT 4 ++#define CH1_STA_PRI_HI 5 ++#define CH1_STA_PRI_SZ 2 ++#define CH2_STA_PRI_MSK 0x00000300 ++#define CH2_STA_PRI_I_MSK 0xfffffcff ++#define CH2_STA_PRI_SFT 8 ++#define CH2_STA_PRI_HI 9 ++#define CH2_STA_PRI_SZ 2 ++#define CH3_STA_PRI_MSK 0x00003000 ++#define CH3_STA_PRI_I_MSK 0xffffcfff ++#define CH3_STA_PRI_SFT 12 ++#define CH3_STA_PRI_HI 13 ++#define CH3_STA_PRI_SZ 2 ++#define ID_TB0_MSK 0xffffffff ++#define ID_TB0_I_MSK 0x00000000 ++#define ID_TB0_SFT 0 ++#define ID_TB0_HI 31 ++#define ID_TB0_SZ 32 ++#define ID_TB1_MSK 0xffffffff ++#define ID_TB1_I_MSK 0x00000000 ++#define ID_TB1_SFT 0 ++#define ID_TB1_HI 31 ++#define ID_TB1_SZ 32 ++#define ID_MNG_HALT_MSK 0x00000010 ++#define ID_MNG_HALT_I_MSK 0xffffffef ++#define ID_MNG_HALT_SFT 4 ++#define ID_MNG_HALT_HI 4 ++#define ID_MNG_HALT_SZ 1 ++#define ID_MNG_ERR_HALT_EN_MSK 0x00000020 ++#define ID_MNG_ERR_HALT_EN_I_MSK 0xffffffdf ++#define ID_MNG_ERR_HALT_EN_SFT 5 ++#define ID_MNG_ERR_HALT_EN_HI 5 ++#define ID_MNG_ERR_HALT_EN_SZ 1 ++#define ID_EXCEPT_FLG_CLR_MSK 0x00000040 ++#define ID_EXCEPT_FLG_CLR_I_MSK 0xffffffbf ++#define ID_EXCEPT_FLG_CLR_SFT 6 ++#define ID_EXCEPT_FLG_CLR_HI 6 ++#define ID_EXCEPT_FLG_CLR_SZ 1 ++#define ID_EXCEPT_FLG_MSK 0x00000080 ++#define ID_EXCEPT_FLG_I_MSK 0xffffff7f ++#define ID_EXCEPT_FLG_SFT 7 ++#define ID_EXCEPT_FLG_HI 7 ++#define ID_EXCEPT_FLG_SZ 1 ++#define ID_FULL_MSK 0x00000001 ++#define ID_FULL_I_MSK 0xfffffffe ++#define ID_FULL_SFT 0 ++#define ID_FULL_HI 0 ++#define ID_FULL_SZ 1 ++#define ID_MNG_BUSY_MSK 0x00000002 ++#define ID_MNG_BUSY_I_MSK 0xfffffffd ++#define ID_MNG_BUSY_SFT 1 ++#define ID_MNG_BUSY_HI 1 ++#define ID_MNG_BUSY_SZ 1 ++#define REQ_LOCK_MSK 0x00000004 ++#define REQ_LOCK_I_MSK 0xfffffffb ++#define REQ_LOCK_SFT 2 ++#define REQ_LOCK_HI 2 ++#define REQ_LOCK_SZ 1 ++#define CH0_REQ_LOCK_MSK 0x00000010 ++#define CH0_REQ_LOCK_I_MSK 0xffffffef ++#define CH0_REQ_LOCK_SFT 4 ++#define CH0_REQ_LOCK_HI 4 ++#define CH0_REQ_LOCK_SZ 1 ++#define CH1_REQ_LOCK_MSK 0x00000020 ++#define CH1_REQ_LOCK_I_MSK 0xffffffdf ++#define CH1_REQ_LOCK_SFT 5 ++#define CH1_REQ_LOCK_HI 5 ++#define CH1_REQ_LOCK_SZ 1 ++#define CH2_REQ_LOCK_MSK 0x00000040 ++#define CH2_REQ_LOCK_I_MSK 0xffffffbf ++#define CH2_REQ_LOCK_SFT 6 ++#define CH2_REQ_LOCK_HI 6 ++#define CH2_REQ_LOCK_SZ 1 ++#define CH3_REQ_LOCK_MSK 0x00000080 ++#define CH3_REQ_LOCK_I_MSK 0xffffff7f ++#define CH3_REQ_LOCK_SFT 7 ++#define CH3_REQ_LOCK_HI 7 ++#define CH3_REQ_LOCK_SZ 1 ++#define REQ_LOCK_INT_EN_MSK 0x00000100 ++#define REQ_LOCK_INT_EN_I_MSK 0xfffffeff ++#define REQ_LOCK_INT_EN_SFT 8 ++#define REQ_LOCK_INT_EN_HI 8 ++#define REQ_LOCK_INT_EN_SZ 1 ++#define REQ_LOCK_INT_MSK 0x00000200 ++#define REQ_LOCK_INT_I_MSK 0xfffffdff ++#define REQ_LOCK_INT_SFT 9 ++#define REQ_LOCK_INT_HI 9 ++#define REQ_LOCK_INT_SZ 1 ++#define MCU_ALC_READY_MSK 0x00000001 ++#define MCU_ALC_READY_I_MSK 0xfffffffe ++#define MCU_ALC_READY_SFT 0 ++#define MCU_ALC_READY_HI 0 ++#define MCU_ALC_READY_SZ 1 ++#define ALC_FAIL_MSK 0x00000002 ++#define ALC_FAIL_I_MSK 0xfffffffd ++#define ALC_FAIL_SFT 1 ++#define ALC_FAIL_HI 1 ++#define ALC_FAIL_SZ 1 ++#define ALC_BUSY_MSK 0x00000004 ++#define ALC_BUSY_I_MSK 0xfffffffb ++#define ALC_BUSY_SFT 2 ++#define ALC_BUSY_HI 2 ++#define ALC_BUSY_SZ 1 ++#define CH0_NVLD_MSK 0x00000010 ++#define CH0_NVLD_I_MSK 0xffffffef ++#define CH0_NVLD_SFT 4 ++#define CH0_NVLD_HI 4 ++#define CH0_NVLD_SZ 1 ++#define CH1_NVLD_MSK 0x00000020 ++#define CH1_NVLD_I_MSK 0xffffffdf ++#define CH1_NVLD_SFT 5 ++#define CH1_NVLD_HI 5 ++#define CH1_NVLD_SZ 1 ++#define CH2_NVLD_MSK 0x00000040 ++#define CH2_NVLD_I_MSK 0xffffffbf ++#define CH2_NVLD_SFT 6 ++#define CH2_NVLD_HI 6 ++#define CH2_NVLD_SZ 1 ++#define CH3_NVLD_MSK 0x00000080 ++#define CH3_NVLD_I_MSK 0xffffff7f ++#define CH3_NVLD_SFT 7 ++#define CH3_NVLD_HI 7 ++#define CH3_NVLD_SZ 1 ++#define ALC_INT_ID_MSK 0x00007f00 ++#define ALC_INT_ID_I_MSK 0xffff80ff ++#define ALC_INT_ID_SFT 8 ++#define ALC_INT_ID_HI 14 ++#define ALC_INT_ID_SZ 7 ++#define ALC_TIMEOUT_MSK 0x03ff0000 ++#define ALC_TIMEOUT_I_MSK 0xfc00ffff ++#define ALC_TIMEOUT_SFT 16 ++#define ALC_TIMEOUT_HI 25 ++#define ALC_TIMEOUT_SZ 10 ++#define ALC_TIMEOUT_INT_EN_MSK 0x40000000 ++#define ALC_TIMEOUT_INT_EN_I_MSK 0xbfffffff ++#define ALC_TIMEOUT_INT_EN_SFT 30 ++#define ALC_TIMEOUT_INT_EN_HI 30 ++#define ALC_TIMEOUT_INT_EN_SZ 1 ++#define ALC_TIMEOUT_INT_MSK 0x80000000 ++#define ALC_TIMEOUT_INT_I_MSK 0x7fffffff ++#define ALC_TIMEOUT_INT_SFT 31 ++#define ALC_TIMEOUT_INT_HI 31 ++#define ALC_TIMEOUT_INT_SZ 1 ++#define TX_ID_COUNT_MSK 0x000000ff ++#define TX_ID_COUNT_I_MSK 0xffffff00 ++#define TX_ID_COUNT_SFT 0 ++#define TX_ID_COUNT_HI 7 ++#define TX_ID_COUNT_SZ 8 ++#define RX_ID_COUNT_MSK 0x0000ff00 ++#define RX_ID_COUNT_I_MSK 0xffff00ff ++#define RX_ID_COUNT_SFT 8 ++#define RX_ID_COUNT_HI 15 ++#define RX_ID_COUNT_SZ 8 ++#define TX_ID_THOLD_MSK 0x000000ff ++#define TX_ID_THOLD_I_MSK 0xffffff00 ++#define TX_ID_THOLD_SFT 0 ++#define TX_ID_THOLD_HI 7 ++#define TX_ID_THOLD_SZ 8 ++#define RX_ID_THOLD_MSK 0x0000ff00 ++#define RX_ID_THOLD_I_MSK 0xffff00ff ++#define RX_ID_THOLD_SFT 8 ++#define RX_ID_THOLD_HI 15 ++#define RX_ID_THOLD_SZ 8 ++#define ID_THOLD_RX_INT_MSK 0x00010000 ++#define ID_THOLD_RX_INT_I_MSK 0xfffeffff ++#define ID_THOLD_RX_INT_SFT 16 ++#define ID_THOLD_RX_INT_HI 16 ++#define ID_THOLD_RX_INT_SZ 1 ++#define RX_INT_CH_MSK 0x000e0000 ++#define RX_INT_CH_I_MSK 0xfff1ffff ++#define RX_INT_CH_SFT 17 ++#define RX_INT_CH_HI 19 ++#define RX_INT_CH_SZ 3 ++#define ID_THOLD_TX_INT_MSK 0x00100000 ++#define ID_THOLD_TX_INT_I_MSK 0xffefffff ++#define ID_THOLD_TX_INT_SFT 20 ++#define ID_THOLD_TX_INT_HI 20 ++#define ID_THOLD_TX_INT_SZ 1 ++#define TX_INT_CH_MSK 0x00e00000 ++#define TX_INT_CH_I_MSK 0xff1fffff ++#define TX_INT_CH_SFT 21 ++#define TX_INT_CH_HI 23 ++#define TX_INT_CH_SZ 3 ++#define ID_THOLD_INT_EN_MSK 0x01000000 ++#define ID_THOLD_INT_EN_I_MSK 0xfeffffff ++#define ID_THOLD_INT_EN_SFT 24 ++#define ID_THOLD_INT_EN_HI 24 ++#define ID_THOLD_INT_EN_SZ 1 ++#define TX_ID_TB0_MSK 0xffffffff ++#define TX_ID_TB0_I_MSK 0x00000000 ++#define TX_ID_TB0_SFT 0 ++#define TX_ID_TB0_HI 31 ++#define TX_ID_TB0_SZ 32 ++#define TX_ID_TB1_MSK 0xffffffff ++#define TX_ID_TB1_I_MSK 0x00000000 ++#define TX_ID_TB1_SFT 0 ++#define TX_ID_TB1_HI 31 ++#define TX_ID_TB1_SZ 32 ++#define RX_ID_TB0_MSK 0xffffffff ++#define RX_ID_TB0_I_MSK 0x00000000 ++#define RX_ID_TB0_SFT 0 ++#define RX_ID_TB0_HI 31 ++#define RX_ID_TB0_SZ 32 ++#define RX_ID_TB1_MSK 0xffffffff ++#define RX_ID_TB1_I_MSK 0x00000000 ++#define RX_ID_TB1_SFT 0 ++#define RX_ID_TB1_HI 31 ++#define RX_ID_TB1_SZ 32 ++#define DOUBLE_RLS_INT_EN_MSK 0x00000001 ++#define DOUBLE_RLS_INT_EN_I_MSK 0xfffffffe ++#define DOUBLE_RLS_INT_EN_SFT 0 ++#define DOUBLE_RLS_INT_EN_HI 0 ++#define DOUBLE_RLS_INT_EN_SZ 1 ++#define ID_DOUBLE_RLS_INT_MSK 0x00000002 ++#define ID_DOUBLE_RLS_INT_I_MSK 0xfffffffd ++#define ID_DOUBLE_RLS_INT_SFT 1 ++#define ID_DOUBLE_RLS_INT_HI 1 ++#define ID_DOUBLE_RLS_INT_SZ 1 ++#define DOUBLE_RLS_ID_MSK 0x00007f00 ++#define DOUBLE_RLS_ID_I_MSK 0xffff80ff ++#define DOUBLE_RLS_ID_SFT 8 ++#define DOUBLE_RLS_ID_HI 14 ++#define DOUBLE_RLS_ID_SZ 7 ++#define ID_LEN_THOLD_INT_EN_MSK 0x00000001 ++#define ID_LEN_THOLD_INT_EN_I_MSK 0xfffffffe ++#define ID_LEN_THOLD_INT_EN_SFT 0 ++#define ID_LEN_THOLD_INT_EN_HI 0 ++#define ID_LEN_THOLD_INT_EN_SZ 1 ++#define ALL_ID_LEN_THOLD_INT_MSK 0x00000002 ++#define ALL_ID_LEN_THOLD_INT_I_MSK 0xfffffffd ++#define ALL_ID_LEN_THOLD_INT_SFT 1 ++#define ALL_ID_LEN_THOLD_INT_HI 1 ++#define ALL_ID_LEN_THOLD_INT_SZ 1 ++#define TX_ID_LEN_THOLD_INT_MSK 0x00000004 ++#define TX_ID_LEN_THOLD_INT_I_MSK 0xfffffffb ++#define TX_ID_LEN_THOLD_INT_SFT 2 ++#define TX_ID_LEN_THOLD_INT_HI 2 ++#define TX_ID_LEN_THOLD_INT_SZ 1 ++#define RX_ID_LEN_THOLD_INT_MSK 0x00000008 ++#define RX_ID_LEN_THOLD_INT_I_MSK 0xfffffff7 ++#define RX_ID_LEN_THOLD_INT_SFT 3 ++#define RX_ID_LEN_THOLD_INT_HI 3 ++#define RX_ID_LEN_THOLD_INT_SZ 1 ++#define ID_TX_LEN_THOLD_MSK 0x00001ff0 ++#define ID_TX_LEN_THOLD_I_MSK 0xffffe00f ++#define ID_TX_LEN_THOLD_SFT 4 ++#define ID_TX_LEN_THOLD_HI 12 ++#define ID_TX_LEN_THOLD_SZ 9 ++#define ID_RX_LEN_THOLD_MSK 0x003fe000 ++#define ID_RX_LEN_THOLD_I_MSK 0xffc01fff ++#define ID_RX_LEN_THOLD_SFT 13 ++#define ID_RX_LEN_THOLD_HI 21 ++#define ID_RX_LEN_THOLD_SZ 9 ++#define ID_LEN_THOLD_MSK 0x7fc00000 ++#define ID_LEN_THOLD_I_MSK 0x803fffff ++#define ID_LEN_THOLD_SFT 22 ++#define ID_LEN_THOLD_HI 30 ++#define ID_LEN_THOLD_SZ 9 ++#define ALL_ID_ALC_LEN_MSK 0x000001ff ++#define ALL_ID_ALC_LEN_I_MSK 0xfffffe00 ++#define ALL_ID_ALC_LEN_SFT 0 ++#define ALL_ID_ALC_LEN_HI 8 ++#define ALL_ID_ALC_LEN_SZ 9 ++#define TX_ID_ALC_LEN_MSK 0x0003fe00 ++#define TX_ID_ALC_LEN_I_MSK 0xfffc01ff ++#define TX_ID_ALC_LEN_SFT 9 ++#define TX_ID_ALC_LEN_HI 17 ++#define TX_ID_ALC_LEN_SZ 9 ++#define RX_ID_ALC_LEN_MSK 0x07fc0000 ++#define RX_ID_ALC_LEN_I_MSK 0xf803ffff ++#define RX_ID_ALC_LEN_SFT 18 ++#define RX_ID_ALC_LEN_HI 26 ++#define RX_ID_ALC_LEN_SZ 9 ++#define CH_ARB_EN_MSK 0x00000001 ++#define CH_ARB_EN_I_MSK 0xfffffffe ++#define CH_ARB_EN_SFT 0 ++#define CH_ARB_EN_HI 0 ++#define CH_ARB_EN_SZ 1 ++#define CH_PRI1_MSK 0x00000030 ++#define CH_PRI1_I_MSK 0xffffffcf ++#define CH_PRI1_SFT 4 ++#define CH_PRI1_HI 5 ++#define CH_PRI1_SZ 2 ++#define CH_PRI2_MSK 0x00000300 ++#define CH_PRI2_I_MSK 0xfffffcff ++#define CH_PRI2_SFT 8 ++#define CH_PRI2_HI 9 ++#define CH_PRI2_SZ 2 ++#define CH_PRI3_MSK 0x00003000 ++#define CH_PRI3_I_MSK 0xffffcfff ++#define CH_PRI3_SFT 12 ++#define CH_PRI3_HI 13 ++#define CH_PRI3_SZ 2 ++#define CH_PRI4_MSK 0x00030000 ++#define CH_PRI4_I_MSK 0xfffcffff ++#define CH_PRI4_SFT 16 ++#define CH_PRI4_HI 17 ++#define CH_PRI4_SZ 2 ++#define TX_ID_REMAIN_MSK 0x0000007f ++#define TX_ID_REMAIN_I_MSK 0xffffff80 ++#define TX_ID_REMAIN_SFT 0 ++#define TX_ID_REMAIN_HI 6 ++#define TX_ID_REMAIN_SZ 7 ++#define TX_PAGE_REMAIN_MSK 0x0001ff00 ++#define TX_PAGE_REMAIN_I_MSK 0xfffe00ff ++#define TX_PAGE_REMAIN_SFT 8 ++#define TX_PAGE_REMAIN_HI 16 ++#define TX_PAGE_REMAIN_SZ 9 ++#define ID_PAGE_MAX_SIZE_MSK 0x000001ff ++#define ID_PAGE_MAX_SIZE_I_MSK 0xfffffe00 ++#define ID_PAGE_MAX_SIZE_SFT 0 ++#define ID_PAGE_MAX_SIZE_HI 8 ++#define ID_PAGE_MAX_SIZE_SZ 9 ++#define TX_PAGE_LIMIT_MSK 0x000001ff ++#define TX_PAGE_LIMIT_I_MSK 0xfffffe00 ++#define TX_PAGE_LIMIT_SFT 0 ++#define TX_PAGE_LIMIT_HI 8 ++#define TX_PAGE_LIMIT_SZ 9 ++#define TX_COUNT_LIMIT_MSK 0x00ff0000 ++#define TX_COUNT_LIMIT_I_MSK 0xff00ffff ++#define TX_COUNT_LIMIT_SFT 16 ++#define TX_COUNT_LIMIT_HI 23 ++#define TX_COUNT_LIMIT_SZ 8 ++#define TX_LIMIT_INT_MSK 0x40000000 ++#define TX_LIMIT_INT_I_MSK 0xbfffffff ++#define TX_LIMIT_INT_SFT 30 ++#define TX_LIMIT_INT_HI 30 ++#define TX_LIMIT_INT_SZ 1 ++#define TX_LIMIT_INT_EN_MSK 0x80000000 ++#define TX_LIMIT_INT_EN_I_MSK 0x7fffffff ++#define TX_LIMIT_INT_EN_SFT 31 ++#define TX_LIMIT_INT_EN_HI 31 ++#define TX_LIMIT_INT_EN_SZ 1 ++#define TX_PAGE_USE_7_0_MSK 0x000000ff ++#define TX_PAGE_USE_7_0_I_MSK 0xffffff00 ++#define TX_PAGE_USE_7_0_SFT 0 ++#define TX_PAGE_USE_7_0_HI 7 ++#define TX_PAGE_USE_7_0_SZ 8 ++#define TX_ID_USE_5_0_MSK 0x00003f00 ++#define TX_ID_USE_5_0_I_MSK 0xffffc0ff ++#define TX_ID_USE_5_0_SFT 8 ++#define TX_ID_USE_5_0_HI 13 ++#define TX_ID_USE_5_0_SZ 6 ++#define EDCA0_FFO_CNT_MSK 0x0003c000 ++#define EDCA0_FFO_CNT_I_MSK 0xfffc3fff ++#define EDCA0_FFO_CNT_SFT 14 ++#define EDCA0_FFO_CNT_HI 17 ++#define EDCA0_FFO_CNT_SZ 4 ++#define EDCA1_FFO_CNT_3_0_MSK 0x003c0000 ++#define EDCA1_FFO_CNT_3_0_I_MSK 0xffc3ffff ++#define EDCA1_FFO_CNT_3_0_SFT 18 ++#define EDCA1_FFO_CNT_3_0_HI 21 ++#define EDCA1_FFO_CNT_3_0_SZ 4 ++#define EDCA2_FFO_CNT_MSK 0x07c00000 ++#define EDCA2_FFO_CNT_I_MSK 0xf83fffff ++#define EDCA2_FFO_CNT_SFT 22 ++#define EDCA2_FFO_CNT_HI 26 ++#define EDCA2_FFO_CNT_SZ 5 ++#define EDCA3_FFO_CNT_MSK 0xf8000000 ++#define EDCA3_FFO_CNT_I_MSK 0x07ffffff ++#define EDCA3_FFO_CNT_SFT 27 ++#define EDCA3_FFO_CNT_HI 31 ++#define EDCA3_FFO_CNT_SZ 5 ++#define ID_TB2_MSK 0xffffffff ++#define ID_TB2_I_MSK 0x00000000 ++#define ID_TB2_SFT 0 ++#define ID_TB2_HI 31 ++#define ID_TB2_SZ 32 ++#define ID_TB3_MSK 0xffffffff ++#define ID_TB3_I_MSK 0x00000000 ++#define ID_TB3_SFT 0 ++#define ID_TB3_HI 31 ++#define ID_TB3_SZ 32 ++#define TX_ID_TB2_MSK 0xffffffff ++#define TX_ID_TB2_I_MSK 0x00000000 ++#define TX_ID_TB2_SFT 0 ++#define TX_ID_TB2_HI 31 ++#define TX_ID_TB2_SZ 32 ++#define TX_ID_TB3_MSK 0xffffffff ++#define TX_ID_TB3_I_MSK 0x00000000 ++#define TX_ID_TB3_SFT 0 ++#define TX_ID_TB3_HI 31 ++#define TX_ID_TB3_SZ 32 ++#define RX_ID_TB2_MSK 0xffffffff ++#define RX_ID_TB2_I_MSK 0x00000000 ++#define RX_ID_TB2_SFT 0 ++#define RX_ID_TB2_HI 31 ++#define RX_ID_TB2_SZ 32 ++#define RX_ID_TB3_MSK 0xffffffff ++#define RX_ID_TB3_I_MSK 0x00000000 ++#define RX_ID_TB3_SFT 0 ++#define RX_ID_TB3_HI 31 ++#define RX_ID_TB3_SZ 32 ++#define TX_PAGE_USE2_MSK 0x000001ff ++#define TX_PAGE_USE2_I_MSK 0xfffffe00 ++#define TX_PAGE_USE2_SFT 0 ++#define TX_PAGE_USE2_HI 8 ++#define TX_PAGE_USE2_SZ 9 ++#define TX_ID_USE2_MSK 0x0001fe00 ++#define TX_ID_USE2_I_MSK 0xfffe01ff ++#define TX_ID_USE2_SFT 9 ++#define TX_ID_USE2_HI 16 ++#define TX_ID_USE2_SZ 8 ++#define EDCA4_FFO_CNT_MSK 0x001e0000 ++#define EDCA4_FFO_CNT_I_MSK 0xffe1ffff ++#define EDCA4_FFO_CNT_SFT 17 ++#define EDCA4_FFO_CNT_HI 20 ++#define EDCA4_FFO_CNT_SZ 4 ++#define TX_PAGE_USE3_MSK 0x000001ff ++#define TX_PAGE_USE3_I_MSK 0xfffffe00 ++#define TX_PAGE_USE3_SFT 0 ++#define TX_PAGE_USE3_HI 8 ++#define TX_PAGE_USE3_SZ 9 ++#define TX_ID_USE3_MSK 0x0001fe00 ++#define TX_ID_USE3_I_MSK 0xfffe01ff ++#define TX_ID_USE3_SFT 9 ++#define TX_ID_USE3_HI 16 ++#define TX_ID_USE3_SZ 8 ++#define EDCA1_FFO_CNT2_MSK 0x03e00000 ++#define EDCA1_FFO_CNT2_I_MSK 0xfc1fffff ++#define EDCA1_FFO_CNT2_SFT 21 ++#define EDCA1_FFO_CNT2_HI 25 ++#define EDCA1_FFO_CNT2_SZ 5 ++#define EDCA4_FFO_CNT2_MSK 0x3c000000 ++#define EDCA4_FFO_CNT2_I_MSK 0xc3ffffff ++#define EDCA4_FFO_CNT2_SFT 26 ++#define EDCA4_FFO_CNT2_HI 29 ++#define EDCA4_FFO_CNT2_SZ 4 ++#define TX_PAGE_USE4_MSK 0x000001ff ++#define TX_PAGE_USE4_I_MSK 0xfffffe00 ++#define TX_PAGE_USE4_SFT 0 ++#define TX_PAGE_USE4_HI 8 ++#define TX_PAGE_USE4_SZ 9 ++#define TX_ID_USE4_MSK 0x0001fe00 ++#define TX_ID_USE4_I_MSK 0xfffe01ff ++#define TX_ID_USE4_SFT 9 ++#define TX_ID_USE4_HI 16 ++#define TX_ID_USE4_SZ 8 ++#define EDCA2_FFO_CNT2_MSK 0x003e0000 ++#define EDCA2_FFO_CNT2_I_MSK 0xffc1ffff ++#define EDCA2_FFO_CNT2_SFT 17 ++#define EDCA2_FFO_CNT2_HI 21 ++#define EDCA2_FFO_CNT2_SZ 5 ++#define EDCA3_FFO_CNT2_MSK 0x07c00000 ++#define EDCA3_FFO_CNT2_I_MSK 0xf83fffff ++#define EDCA3_FFO_CNT2_SFT 22 ++#define EDCA3_FFO_CNT2_HI 26 ++#define EDCA3_FFO_CNT2_SZ 5 ++#define TX_ID_IFO_LEN_MSK 0x000001ff ++#define TX_ID_IFO_LEN_I_MSK 0xfffffe00 ++#define TX_ID_IFO_LEN_SFT 0 ++#define TX_ID_IFO_LEN_HI 8 ++#define TX_ID_IFO_LEN_SZ 9 ++#define RX_ID_IFO_LEN_MSK 0x01ff0000 ++#define RX_ID_IFO_LEN_I_MSK 0xfe00ffff ++#define RX_ID_IFO_LEN_SFT 16 ++#define RX_ID_IFO_LEN_HI 24 ++#define RX_ID_IFO_LEN_SZ 9 ++#define MAX_ALL_ALC_ID_CNT_MSK 0x000000ff ++#define MAX_ALL_ALC_ID_CNT_I_MSK 0xffffff00 ++#define MAX_ALL_ALC_ID_CNT_SFT 0 ++#define MAX_ALL_ALC_ID_CNT_HI 7 ++#define MAX_ALL_ALC_ID_CNT_SZ 8 ++#define MAX_TX_ALC_ID_CNT_MSK 0x0000ff00 ++#define MAX_TX_ALC_ID_CNT_I_MSK 0xffff00ff ++#define MAX_TX_ALC_ID_CNT_SFT 8 ++#define MAX_TX_ALC_ID_CNT_HI 15 ++#define MAX_TX_ALC_ID_CNT_SZ 8 ++#define MAX_RX_ALC_ID_CNT_MSK 0x00ff0000 ++#define MAX_RX_ALC_ID_CNT_I_MSK 0xff00ffff ++#define MAX_RX_ALC_ID_CNT_SFT 16 ++#define MAX_RX_ALC_ID_CNT_HI 23 ++#define MAX_RX_ALC_ID_CNT_SZ 8 ++#define MAX_ALL_ID_ALC_LEN_MSK 0x000001ff ++#define MAX_ALL_ID_ALC_LEN_I_MSK 0xfffffe00 ++#define MAX_ALL_ID_ALC_LEN_SFT 0 ++#define MAX_ALL_ID_ALC_LEN_HI 8 ++#define MAX_ALL_ID_ALC_LEN_SZ 9 ++#define MAX_TX_ID_ALC_LEN_MSK 0x0003fe00 ++#define MAX_TX_ID_ALC_LEN_I_MSK 0xfffc01ff ++#define MAX_TX_ID_ALC_LEN_SFT 9 ++#define MAX_TX_ID_ALC_LEN_HI 17 ++#define MAX_TX_ID_ALC_LEN_SZ 9 ++#define MAX_RX_ID_ALC_LEN_MSK 0x07fc0000 ++#define MAX_RX_ID_ALC_LEN_I_MSK 0xf803ffff ++#define MAX_RX_ID_ALC_LEN_SFT 18 ++#define MAX_RX_ID_ALC_LEN_HI 26 ++#define MAX_RX_ID_ALC_LEN_SZ 9 ++#define RG_PMDLBK_MSK 0x00000001 ++#define RG_PMDLBK_I_MSK 0xfffffffe ++#define RG_PMDLBK_SFT 0 ++#define RG_PMDLBK_HI 0 ++#define RG_PMDLBK_SZ 1 ++#define RG_RDYACK_SEL_MSK 0x00000006 ++#define RG_RDYACK_SEL_I_MSK 0xfffffff9 ++#define RG_RDYACK_SEL_SFT 1 ++#define RG_RDYACK_SEL_HI 2 ++#define RG_RDYACK_SEL_SZ 2 ++#define RG_ADEDGE_SEL_MSK 0x00000008 ++#define RG_ADEDGE_SEL_I_MSK 0xfffffff7 ++#define RG_ADEDGE_SEL_SFT 3 ++#define RG_ADEDGE_SEL_HI 3 ++#define RG_ADEDGE_SEL_SZ 1 ++#define RG_SIGN_SWAP_MSK 0x00000010 ++#define RG_SIGN_SWAP_I_MSK 0xffffffef ++#define RG_SIGN_SWAP_SFT 4 ++#define RG_SIGN_SWAP_HI 4 ++#define RG_SIGN_SWAP_SZ 1 ++#define RG_IQ_SWAP_MSK 0x00000020 ++#define RG_IQ_SWAP_I_MSK 0xffffffdf ++#define RG_IQ_SWAP_SFT 5 ++#define RG_IQ_SWAP_HI 5 ++#define RG_IQ_SWAP_SZ 1 ++#define RG_Q_INV_MSK 0x00000040 ++#define RG_Q_INV_I_MSK 0xffffffbf ++#define RG_Q_INV_SFT 6 ++#define RG_Q_INV_HI 6 ++#define RG_Q_INV_SZ 1 ++#define RG_I_INV_MSK 0x00000080 ++#define RG_I_INV_I_MSK 0xffffff7f ++#define RG_I_INV_SFT 7 ++#define RG_I_INV_HI 7 ++#define RG_I_INV_SZ 1 ++#define RG_BYPASS_ACI_MSK 0x00000100 ++#define RG_BYPASS_ACI_I_MSK 0xfffffeff ++#define RG_BYPASS_ACI_SFT 8 ++#define RG_BYPASS_ACI_HI 8 ++#define RG_BYPASS_ACI_SZ 1 ++#define RG_LBK_ANA_PATH_MSK 0x00000200 ++#define RG_LBK_ANA_PATH_I_MSK 0xfffffdff ++#define RG_LBK_ANA_PATH_SFT 9 ++#define RG_LBK_ANA_PATH_HI 9 ++#define RG_LBK_ANA_PATH_SZ 1 ++#define RG_SPECTRUM_LEAKY_FACTOR_MSK 0x00000c00 ++#define RG_SPECTRUM_LEAKY_FACTOR_I_MSK 0xfffff3ff ++#define RG_SPECTRUM_LEAKY_FACTOR_SFT 10 ++#define RG_SPECTRUM_LEAKY_FACTOR_HI 11 ++#define RG_SPECTRUM_LEAKY_FACTOR_SZ 2 ++#define RG_SPECTRUM_BW_MSK 0x00003000 ++#define RG_SPECTRUM_BW_I_MSK 0xffffcfff ++#define RG_SPECTRUM_BW_SFT 12 ++#define RG_SPECTRUM_BW_HI 13 ++#define RG_SPECTRUM_BW_SZ 2 ++#define RG_SPECTRUM_FREQ_MANUAL_MSK 0x00004000 ++#define RG_SPECTRUM_FREQ_MANUAL_I_MSK 0xffffbfff ++#define RG_SPECTRUM_FREQ_MANUAL_SFT 14 ++#define RG_SPECTRUM_FREQ_MANUAL_HI 14 ++#define RG_SPECTRUM_FREQ_MANUAL_SZ 1 ++#define RG_SPECTRUM_EN_MSK 0x00008000 ++#define RG_SPECTRUM_EN_I_MSK 0xffff7fff ++#define RG_SPECTRUM_EN_SFT 15 ++#define RG_SPECTRUM_EN_HI 15 ++#define RG_SPECTRUM_EN_SZ 1 ++#define RG_TXPWRLVL_SET_MSK 0x00ff0000 ++#define RG_TXPWRLVL_SET_I_MSK 0xff00ffff ++#define RG_TXPWRLVL_SET_SFT 16 ++#define RG_TXPWRLVL_SET_HI 23 ++#define RG_TXPWRLVL_SET_SZ 8 ++#define RG_TXPWRLVL_SEL_MSK 0x01000000 ++#define RG_TXPWRLVL_SEL_I_MSK 0xfeffffff ++#define RG_TXPWRLVL_SEL_SFT 24 ++#define RG_TXPWRLVL_SEL_HI 24 ++#define RG_TXPWRLVL_SEL_SZ 1 ++#define RG_RF_BB_CLK_SEL_MSK 0x80000000 ++#define RG_RF_BB_CLK_SEL_I_MSK 0x7fffffff ++#define RG_RF_BB_CLK_SEL_SFT 31 ++#define RG_RF_BB_CLK_SEL_HI 31 ++#define RG_RF_BB_CLK_SEL_SZ 1 ++#define RG_PHY_MD_EN_MSK 0x00000001 ++#define RG_PHY_MD_EN_I_MSK 0xfffffffe ++#define RG_PHY_MD_EN_SFT 0 ++#define RG_PHY_MD_EN_HI 0 ++#define RG_PHY_MD_EN_SZ 1 ++#define RG_PHYRX_MD_EN_MSK 0x00000002 ++#define RG_PHYRX_MD_EN_I_MSK 0xfffffffd ++#define RG_PHYRX_MD_EN_SFT 1 ++#define RG_PHYRX_MD_EN_HI 1 ++#define RG_PHYRX_MD_EN_SZ 1 ++#define RG_PHYTX_MD_EN_MSK 0x00000004 ++#define RG_PHYTX_MD_EN_I_MSK 0xfffffffb ++#define RG_PHYTX_MD_EN_SFT 2 ++#define RG_PHYTX_MD_EN_HI 2 ++#define RG_PHYTX_MD_EN_SZ 1 ++#define RG_PHY11GN_MD_EN_MSK 0x00000008 ++#define RG_PHY11GN_MD_EN_I_MSK 0xfffffff7 ++#define RG_PHY11GN_MD_EN_SFT 3 ++#define RG_PHY11GN_MD_EN_HI 3 ++#define RG_PHY11GN_MD_EN_SZ 1 ++#define RG_PHY11B_MD_EN_MSK 0x00000010 ++#define RG_PHY11B_MD_EN_I_MSK 0xffffffef ++#define RG_PHY11B_MD_EN_SFT 4 ++#define RG_PHY11B_MD_EN_HI 4 ++#define RG_PHY11B_MD_EN_SZ 1 ++#define RG_PHYRXFIFO_MD_EN_MSK 0x00000020 ++#define RG_PHYRXFIFO_MD_EN_I_MSK 0xffffffdf ++#define RG_PHYRXFIFO_MD_EN_SFT 5 ++#define RG_PHYRXFIFO_MD_EN_HI 5 ++#define RG_PHYRXFIFO_MD_EN_SZ 1 ++#define RG_PHYTXFIFO_MD_EN_MSK 0x00000040 ++#define RG_PHYTXFIFO_MD_EN_I_MSK 0xffffffbf ++#define RG_PHYTXFIFO_MD_EN_SFT 6 ++#define RG_PHYTXFIFO_MD_EN_HI 6 ++#define RG_PHYTXFIFO_MD_EN_SZ 1 ++#define RG_PHY11BGN_MD_EN_MSK 0x00000100 ++#define RG_PHY11BGN_MD_EN_I_MSK 0xfffffeff ++#define RG_PHY11BGN_MD_EN_SFT 8 ++#define RG_PHY11BGN_MD_EN_HI 8 ++#define RG_PHY11BGN_MD_EN_SZ 1 ++#define RG_FORCE_11GN_EN_MSK 0x00001000 ++#define RG_FORCE_11GN_EN_I_MSK 0xffffefff ++#define RG_FORCE_11GN_EN_SFT 12 ++#define RG_FORCE_11GN_EN_HI 12 ++#define RG_FORCE_11GN_EN_SZ 1 ++#define RG_FORCE_11B_EN_MSK 0x00002000 ++#define RG_FORCE_11B_EN_I_MSK 0xffffdfff ++#define RG_FORCE_11B_EN_SFT 13 ++#define RG_FORCE_11B_EN_HI 13 ++#define RG_FORCE_11B_EN_SZ 1 ++#define RG_FFT_MEM_CLK_EN_RX_MSK 0x00004000 ++#define RG_FFT_MEM_CLK_EN_RX_I_MSK 0xffffbfff ++#define RG_FFT_MEM_CLK_EN_RX_SFT 14 ++#define RG_FFT_MEM_CLK_EN_RX_HI 14 ++#define RG_FFT_MEM_CLK_EN_RX_SZ 1 ++#define RG_FFT_MEM_CLK_EN_TX_MSK 0x00008000 ++#define RG_FFT_MEM_CLK_EN_TX_I_MSK 0xffff7fff ++#define RG_FFT_MEM_CLK_EN_TX_SFT 15 ++#define RG_FFT_MEM_CLK_EN_TX_HI 15 ++#define RG_FFT_MEM_CLK_EN_TX_SZ 1 ++#define RG_PHY_IQ_TRIG_SEL_MSK 0x000f0000 ++#define RG_PHY_IQ_TRIG_SEL_I_MSK 0xfff0ffff ++#define RG_PHY_IQ_TRIG_SEL_SFT 16 ++#define RG_PHY_IQ_TRIG_SEL_HI 19 ++#define RG_PHY_IQ_TRIG_SEL_SZ 4 ++#define RG_SPECTRUM_FREQ_MSK 0x3ff00000 ++#define RG_SPECTRUM_FREQ_I_MSK 0xc00fffff ++#define RG_SPECTRUM_FREQ_SFT 20 ++#define RG_SPECTRUM_FREQ_HI 29 ++#define RG_SPECTRUM_FREQ_SZ 10 ++#define SVN_VERSION_MSK 0xffffffff ++#define SVN_VERSION_I_MSK 0x00000000 ++#define SVN_VERSION_SFT 0 ++#define SVN_VERSION_HI 31 ++#define SVN_VERSION_SZ 32 ++#define RG_LENGTH_MSK 0x0000ffff ++#define RG_LENGTH_I_MSK 0xffff0000 ++#define RG_LENGTH_SFT 0 ++#define RG_LENGTH_HI 15 ++#define RG_LENGTH_SZ 16 ++#define RG_PKT_MODE_MSK 0x00070000 ++#define RG_PKT_MODE_I_MSK 0xfff8ffff ++#define RG_PKT_MODE_SFT 16 ++#define RG_PKT_MODE_HI 18 ++#define RG_PKT_MODE_SZ 3 ++#define RG_CH_BW_MSK 0x00380000 ++#define RG_CH_BW_I_MSK 0xffc7ffff ++#define RG_CH_BW_SFT 19 ++#define RG_CH_BW_HI 21 ++#define RG_CH_BW_SZ 3 ++#define RG_PRM_MSK 0x00400000 ++#define RG_PRM_I_MSK 0xffbfffff ++#define RG_PRM_SFT 22 ++#define RG_PRM_HI 22 ++#define RG_PRM_SZ 1 ++#define RG_SHORTGI_MSK 0x00800000 ++#define RG_SHORTGI_I_MSK 0xff7fffff ++#define RG_SHORTGI_SFT 23 ++#define RG_SHORTGI_HI 23 ++#define RG_SHORTGI_SZ 1 ++#define RG_RATE_MSK 0x7f000000 ++#define RG_RATE_I_MSK 0x80ffffff ++#define RG_RATE_SFT 24 ++#define RG_RATE_HI 30 ++#define RG_RATE_SZ 7 ++#define RG_L_LENGTH_MSK 0x00000fff ++#define RG_L_LENGTH_I_MSK 0xfffff000 ++#define RG_L_LENGTH_SFT 0 ++#define RG_L_LENGTH_HI 11 ++#define RG_L_LENGTH_SZ 12 ++#define RG_L_RATE_MSK 0x00007000 ++#define RG_L_RATE_I_MSK 0xffff8fff ++#define RG_L_RATE_SFT 12 ++#define RG_L_RATE_HI 14 ++#define RG_L_RATE_SZ 3 ++#define RG_SERVICE_MSK 0xffff0000 ++#define RG_SERVICE_I_MSK 0x0000ffff ++#define RG_SERVICE_SFT 16 ++#define RG_SERVICE_HI 31 ++#define RG_SERVICE_SZ 16 ++#define RG_SMOOTHING_MSK 0x00000001 ++#define RG_SMOOTHING_I_MSK 0xfffffffe ++#define RG_SMOOTHING_SFT 0 ++#define RG_SMOOTHING_HI 0 ++#define RG_SMOOTHING_SZ 1 ++#define RG_NO_SOUND_MSK 0x00000002 ++#define RG_NO_SOUND_I_MSK 0xfffffffd ++#define RG_NO_SOUND_SFT 1 ++#define RG_NO_SOUND_HI 1 ++#define RG_NO_SOUND_SZ 1 ++#define RG_AGGREGATE_MSK 0x00000004 ++#define RG_AGGREGATE_I_MSK 0xfffffffb ++#define RG_AGGREGATE_SFT 2 ++#define RG_AGGREGATE_HI 2 ++#define RG_AGGREGATE_SZ 1 ++#define RG_STBC_MSK 0x00000018 ++#define RG_STBC_I_MSK 0xffffffe7 ++#define RG_STBC_SFT 3 ++#define RG_STBC_HI 4 ++#define RG_STBC_SZ 2 ++#define RG_FEC_MSK 0x00000020 ++#define RG_FEC_I_MSK 0xffffffdf ++#define RG_FEC_SFT 5 ++#define RG_FEC_HI 5 ++#define RG_FEC_SZ 1 ++#define RG_N_ESS_MSK 0x000000c0 ++#define RG_N_ESS_I_MSK 0xffffff3f ++#define RG_N_ESS_SFT 6 ++#define RG_N_ESS_HI 7 ++#define RG_N_ESS_SZ 2 ++#define RG_TXPWRLVL_MSK 0x0000ff00 ++#define RG_TXPWRLVL_I_MSK 0xffff00ff ++#define RG_TXPWRLVL_SFT 8 ++#define RG_TXPWRLVL_HI 15 ++#define RG_TXPWRLVL_SZ 8 ++#define RG_TX_START_MSK 0x00000001 ++#define RG_TX_START_I_MSK 0xfffffffe ++#define RG_TX_START_SFT 0 ++#define RG_TX_START_HI 0 ++#define RG_TX_START_SZ 1 ++#define RG_IFS_TIME_MSK 0x000000fc ++#define RG_IFS_TIME_I_MSK 0xffffff03 ++#define RG_IFS_TIME_SFT 2 ++#define RG_IFS_TIME_HI 7 ++#define RG_IFS_TIME_SZ 6 ++#define RG_CONTINUOUS_DATA_MSK 0x00000100 ++#define RG_CONTINUOUS_DATA_I_MSK 0xfffffeff ++#define RG_CONTINUOUS_DATA_SFT 8 ++#define RG_CONTINUOUS_DATA_HI 8 ++#define RG_CONTINUOUS_DATA_SZ 1 ++#define RG_DATA_SEL_MSK 0x00000600 ++#define RG_DATA_SEL_I_MSK 0xfffff9ff ++#define RG_DATA_SEL_SFT 9 ++#define RG_DATA_SEL_HI 10 ++#define RG_DATA_SEL_SZ 2 ++#define RG_TX_D_MSK 0x00ff0000 ++#define RG_TX_D_I_MSK 0xff00ffff ++#define RG_TX_D_SFT 16 ++#define RG_TX_D_HI 23 ++#define RG_TX_D_SZ 8 ++#define RG_TX_CNT_TARGET_MSK 0xffffffff ++#define RG_TX_CNT_TARGET_I_MSK 0x00000000 ++#define RG_TX_CNT_TARGET_SFT 0 ++#define RG_TX_CNT_TARGET_HI 31 ++#define RG_TX_CNT_TARGET_SZ 32 ++#define RG_FFT_IFFT_MODE_MSK 0x000000c0 ++#define RG_FFT_IFFT_MODE_I_MSK 0xffffff3f ++#define RG_FFT_IFFT_MODE_SFT 6 ++#define RG_FFT_IFFT_MODE_HI 7 ++#define RG_FFT_IFFT_MODE_SZ 2 ++#define RG_DAC_DBG_MODE_MSK 0x00000100 ++#define RG_DAC_DBG_MODE_I_MSK 0xfffffeff ++#define RG_DAC_DBG_MODE_SFT 8 ++#define RG_DAC_DBG_MODE_HI 8 ++#define RG_DAC_DBG_MODE_SZ 1 ++#define RG_DAC_SGN_SWAP_MSK 0x00000200 ++#define RG_DAC_SGN_SWAP_I_MSK 0xfffffdff ++#define RG_DAC_SGN_SWAP_SFT 9 ++#define RG_DAC_SGN_SWAP_HI 9 ++#define RG_DAC_SGN_SWAP_SZ 1 ++#define RG_TXD_SEL_MSK 0x00000c00 ++#define RG_TXD_SEL_I_MSK 0xfffff3ff ++#define RG_TXD_SEL_SFT 10 ++#define RG_TXD_SEL_HI 11 ++#define RG_TXD_SEL_SZ 2 ++#define RG_UP8X_MSK 0x00ff0000 ++#define RG_UP8X_I_MSK 0xff00ffff ++#define RG_UP8X_SFT 16 ++#define RG_UP8X_HI 23 ++#define RG_UP8X_SZ 8 ++#define RG_IQ_DC_BYP_MSK 0x01000000 ++#define RG_IQ_DC_BYP_I_MSK 0xfeffffff ++#define RG_IQ_DC_BYP_SFT 24 ++#define RG_IQ_DC_BYP_HI 24 ++#define RG_IQ_DC_BYP_SZ 1 ++#define RG_IQ_DC_LEAKY_FACTOR_MSK 0x30000000 ++#define RG_IQ_DC_LEAKY_FACTOR_I_MSK 0xcfffffff ++#define RG_IQ_DC_LEAKY_FACTOR_SFT 28 ++#define RG_IQ_DC_LEAKY_FACTOR_HI 29 ++#define RG_IQ_DC_LEAKY_FACTOR_SZ 2 ++#define RG_DAC_DCEN_MSK 0x00000001 ++#define RG_DAC_DCEN_I_MSK 0xfffffffe ++#define RG_DAC_DCEN_SFT 0 ++#define RG_DAC_DCEN_HI 0 ++#define RG_DAC_DCEN_SZ 1 ++#define RG_DAC_DCQ_MSK 0x00003ff0 ++#define RG_DAC_DCQ_I_MSK 0xffffc00f ++#define RG_DAC_DCQ_SFT 4 ++#define RG_DAC_DCQ_HI 13 ++#define RG_DAC_DCQ_SZ 10 ++#define RG_DAC_DCI_MSK 0x03ff0000 ++#define RG_DAC_DCI_I_MSK 0xfc00ffff ++#define RG_DAC_DCI_SFT 16 ++#define RG_DAC_DCI_HI 25 ++#define RG_DAC_DCI_SZ 10 ++#define RG_PGA_REFDB_SAT_MSK 0x0000007f ++#define RG_PGA_REFDB_SAT_I_MSK 0xffffff80 ++#define RG_PGA_REFDB_SAT_SFT 0 ++#define RG_PGA_REFDB_SAT_HI 6 ++#define RG_PGA_REFDB_SAT_SZ 7 ++#define RG_PGA_REFDB_TOP_MSK 0x00007f00 ++#define RG_PGA_REFDB_TOP_I_MSK 0xffff80ff ++#define RG_PGA_REFDB_TOP_SFT 8 ++#define RG_PGA_REFDB_TOP_HI 14 ++#define RG_PGA_REFDB_TOP_SZ 7 ++#define RG_PGA_REF_UND_MSK 0x03ff0000 ++#define RG_PGA_REF_UND_I_MSK 0xfc00ffff ++#define RG_PGA_REF_UND_SFT 16 ++#define RG_PGA_REF_UND_HI 25 ++#define RG_PGA_REF_UND_SZ 10 ++#define RG_RF_REF_SAT_MSK 0xf0000000 ++#define RG_RF_REF_SAT_I_MSK 0x0fffffff ++#define RG_RF_REF_SAT_SFT 28 ++#define RG_RF_REF_SAT_HI 31 ++#define RG_RF_REF_SAT_SZ 4 ++#define RG_PGAGC_SET_MSK 0x0000000f ++#define RG_PGAGC_SET_I_MSK 0xfffffff0 ++#define RG_PGAGC_SET_SFT 0 ++#define RG_PGAGC_SET_HI 3 ++#define RG_PGAGC_SET_SZ 4 ++#define RG_PGAGC_OW_MSK 0x00000010 ++#define RG_PGAGC_OW_I_MSK 0xffffffef ++#define RG_PGAGC_OW_SFT 4 ++#define RG_PGAGC_OW_HI 4 ++#define RG_PGAGC_OW_SZ 1 ++#define RG_RFGC_SET_MSK 0x00000060 ++#define RG_RFGC_SET_I_MSK 0xffffff9f ++#define RG_RFGC_SET_SFT 5 ++#define RG_RFGC_SET_HI 6 ++#define RG_RFGC_SET_SZ 2 ++#define RG_RFGC_OW_MSK 0x00000080 ++#define RG_RFGC_OW_I_MSK 0xffffff7f ++#define RG_RFGC_OW_SFT 7 ++#define RG_RFGC_OW_HI 7 ++#define RG_RFGC_OW_SZ 1 ++#define RG_WAIT_T_RXAGC_MSK 0x00003f00 ++#define RG_WAIT_T_RXAGC_I_MSK 0xffffc0ff ++#define RG_WAIT_T_RXAGC_SFT 8 ++#define RG_WAIT_T_RXAGC_HI 13 ++#define RG_WAIT_T_RXAGC_SZ 6 ++#define RG_RXAGC_SET_MSK 0x00004000 ++#define RG_RXAGC_SET_I_MSK 0xffffbfff ++#define RG_RXAGC_SET_SFT 14 ++#define RG_RXAGC_SET_HI 14 ++#define RG_RXAGC_SET_SZ 1 ++#define RG_RXAGC_OW_MSK 0x00008000 ++#define RG_RXAGC_OW_I_MSK 0xffff7fff ++#define RG_RXAGC_OW_SFT 15 ++#define RG_RXAGC_OW_HI 15 ++#define RG_RXAGC_OW_SZ 1 ++#define RG_WAIT_T_FINAL_MSK 0x003f0000 ++#define RG_WAIT_T_FINAL_I_MSK 0xffc0ffff ++#define RG_WAIT_T_FINAL_SFT 16 ++#define RG_WAIT_T_FINAL_HI 21 ++#define RG_WAIT_T_FINAL_SZ 6 ++#define RG_WAIT_T_MSK 0x3f000000 ++#define RG_WAIT_T_I_MSK 0xc0ffffff ++#define RG_WAIT_T_SFT 24 ++#define RG_WAIT_T_HI 29 ++#define RG_WAIT_T_SZ 6 ++#define RG_ULG_PGA_SAT_PGA_GAIN_MSK 0x0000000f ++#define RG_ULG_PGA_SAT_PGA_GAIN_I_MSK 0xfffffff0 ++#define RG_ULG_PGA_SAT_PGA_GAIN_SFT 0 ++#define RG_ULG_PGA_SAT_PGA_GAIN_HI 3 ++#define RG_ULG_PGA_SAT_PGA_GAIN_SZ 4 ++#define RG_LG_PGA_UND_PGA_GAIN_MSK 0x000000f0 ++#define RG_LG_PGA_UND_PGA_GAIN_I_MSK 0xffffff0f ++#define RG_LG_PGA_UND_PGA_GAIN_SFT 4 ++#define RG_LG_PGA_UND_PGA_GAIN_HI 7 ++#define RG_LG_PGA_UND_PGA_GAIN_SZ 4 ++#define RG_LG_PGA_SAT_PGA_GAIN_MSK 0x00000f00 ++#define RG_LG_PGA_SAT_PGA_GAIN_I_MSK 0xfffff0ff ++#define RG_LG_PGA_SAT_PGA_GAIN_SFT 8 ++#define RG_LG_PGA_SAT_PGA_GAIN_HI 11 ++#define RG_LG_PGA_SAT_PGA_GAIN_SZ 4 ++#define RG_LG_RF_SAT_PGA_GAIN_MSK 0x0000f000 ++#define RG_LG_RF_SAT_PGA_GAIN_I_MSK 0xffff0fff ++#define RG_LG_RF_SAT_PGA_GAIN_SFT 12 ++#define RG_LG_RF_SAT_PGA_GAIN_HI 15 ++#define RG_LG_RF_SAT_PGA_GAIN_SZ 4 ++#define RG_MG_RF_SAT_PGANOREF_PGA_GAIN_MSK 0x000f0000 ++#define RG_MG_RF_SAT_PGANOREF_PGA_GAIN_I_MSK 0xfff0ffff ++#define RG_MG_RF_SAT_PGANOREF_PGA_GAIN_SFT 16 ++#define RG_MG_RF_SAT_PGANOREF_PGA_GAIN_HI 19 ++#define RG_MG_RF_SAT_PGANOREF_PGA_GAIN_SZ 4 ++#define RG_HG_PGA_SAT2_PGA_GAIN_MSK 0x00f00000 ++#define RG_HG_PGA_SAT2_PGA_GAIN_I_MSK 0xff0fffff ++#define RG_HG_PGA_SAT2_PGA_GAIN_SFT 20 ++#define RG_HG_PGA_SAT2_PGA_GAIN_HI 23 ++#define RG_HG_PGA_SAT2_PGA_GAIN_SZ 4 ++#define RG_HG_PGA_SAT1_PGA_GAIN_MSK 0x0f000000 ++#define RG_HG_PGA_SAT1_PGA_GAIN_I_MSK 0xf0ffffff ++#define RG_HG_PGA_SAT1_PGA_GAIN_SFT 24 ++#define RG_HG_PGA_SAT1_PGA_GAIN_HI 27 ++#define RG_HG_PGA_SAT1_PGA_GAIN_SZ 4 ++#define RG_HG_RF_SAT_PGA_GAIN_MSK 0xf0000000 ++#define RG_HG_RF_SAT_PGA_GAIN_I_MSK 0x0fffffff ++#define RG_HG_RF_SAT_PGA_GAIN_SFT 28 ++#define RG_HG_RF_SAT_PGA_GAIN_HI 31 ++#define RG_HG_RF_SAT_PGA_GAIN_SZ 4 ++#define RG_MG_PGA_JB_TH_MSK 0x0000000f ++#define RG_MG_PGA_JB_TH_I_MSK 0xfffffff0 ++#define RG_MG_PGA_JB_TH_SFT 0 ++#define RG_MG_PGA_JB_TH_HI 3 ++#define RG_MG_PGA_JB_TH_SZ 4 ++#define RG_MA_PGA_LOW_TH_CNT_LMT_MSK 0x001f0000 ++#define RG_MA_PGA_LOW_TH_CNT_LMT_I_MSK 0xffe0ffff ++#define RG_MA_PGA_LOW_TH_CNT_LMT_SFT 16 ++#define RG_MA_PGA_LOW_TH_CNT_LMT_HI 20 ++#define RG_MA_PGA_LOW_TH_CNT_LMT_SZ 5 ++#define RG_WR_RFGC_INIT_SET_MSK 0x00600000 ++#define RG_WR_RFGC_INIT_SET_I_MSK 0xff9fffff ++#define RG_WR_RFGC_INIT_SET_SFT 21 ++#define RG_WR_RFGC_INIT_SET_HI 22 ++#define RG_WR_RFGC_INIT_SET_SZ 2 ++#define RG_WR_RFGC_INIT_EN_MSK 0x00800000 ++#define RG_WR_RFGC_INIT_EN_I_MSK 0xff7fffff ++#define RG_WR_RFGC_INIT_EN_SFT 23 ++#define RG_WR_RFGC_INIT_EN_HI 23 ++#define RG_WR_RFGC_INIT_EN_SZ 1 ++#define RG_MA_PGA_HIGH_TH_CNT_LMT_MSK 0x1f000000 ++#define RG_MA_PGA_HIGH_TH_CNT_LMT_I_MSK 0xe0ffffff ++#define RG_MA_PGA_HIGH_TH_CNT_LMT_SFT 24 ++#define RG_MA_PGA_HIGH_TH_CNT_LMT_HI 28 ++#define RG_MA_PGA_HIGH_TH_CNT_LMT_SZ 5 ++#define RG_AGC_THRESHOLD_MSK 0x00003fff ++#define RG_AGC_THRESHOLD_I_MSK 0xffffc000 ++#define RG_AGC_THRESHOLD_SFT 0 ++#define RG_AGC_THRESHOLD_HI 13 ++#define RG_AGC_THRESHOLD_SZ 14 ++#define RG_ACI_POINT_CNT_LMT_11B_MSK 0x007f0000 ++#define RG_ACI_POINT_CNT_LMT_11B_I_MSK 0xff80ffff ++#define RG_ACI_POINT_CNT_LMT_11B_SFT 16 ++#define RG_ACI_POINT_CNT_LMT_11B_HI 22 ++#define RG_ACI_POINT_CNT_LMT_11B_SZ 7 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11B_MSK 0x03000000 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11B_I_MSK 0xfcffffff ++#define RG_ACI_DAGC_LEAKY_FACTOR_11B_SFT 24 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11B_HI 25 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11B_SZ 2 ++#define RG_WR_ACI_GAIN_INI_SEL_11B_MSK 0x000000ff ++#define RG_WR_ACI_GAIN_INI_SEL_11B_I_MSK 0xffffff00 ++#define RG_WR_ACI_GAIN_INI_SEL_11B_SFT 0 ++#define RG_WR_ACI_GAIN_INI_SEL_11B_HI 7 ++#define RG_WR_ACI_GAIN_INI_SEL_11B_SZ 8 ++#define RG_WR_ACI_GAIN_SEL_11B_MSK 0x0000ff00 ++#define RG_WR_ACI_GAIN_SEL_11B_I_MSK 0xffff00ff ++#define RG_WR_ACI_GAIN_SEL_11B_SFT 8 ++#define RG_WR_ACI_GAIN_SEL_11B_HI 15 ++#define RG_WR_ACI_GAIN_SEL_11B_SZ 8 ++#define RG_ACI_DAGC_SET_VALUE_11B_MSK 0x007f0000 ++#define RG_ACI_DAGC_SET_VALUE_11B_I_MSK 0xff80ffff ++#define RG_ACI_DAGC_SET_VALUE_11B_SFT 16 ++#define RG_ACI_DAGC_SET_VALUE_11B_HI 22 ++#define RG_ACI_DAGC_SET_VALUE_11B_SZ 7 ++#define RG_WR_ACI_GAIN_OW_11B_MSK 0x80000000 ++#define RG_WR_ACI_GAIN_OW_11B_I_MSK 0x7fffffff ++#define RG_WR_ACI_GAIN_OW_11B_SFT 31 ++#define RG_WR_ACI_GAIN_OW_11B_HI 31 ++#define RG_WR_ACI_GAIN_OW_11B_SZ 1 ++#define RG_ACI_POINT_CNT_LMT_11GN_MSK 0x000000ff ++#define RG_ACI_POINT_CNT_LMT_11GN_I_MSK 0xffffff00 ++#define RG_ACI_POINT_CNT_LMT_11GN_SFT 0 ++#define RG_ACI_POINT_CNT_LMT_11GN_HI 7 ++#define RG_ACI_POINT_CNT_LMT_11GN_SZ 8 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11GN_MSK 0x00000300 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11GN_I_MSK 0xfffffcff ++#define RG_ACI_DAGC_LEAKY_FACTOR_11GN_SFT 8 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11GN_HI 9 ++#define RG_ACI_DAGC_LEAKY_FACTOR_11GN_SZ 2 ++#define RG_ACI_DAGC_DONE_CNT_LMT_11GN_MSK 0xff000000 ++#define RG_ACI_DAGC_DONE_CNT_LMT_11GN_I_MSK 0x00ffffff ++#define RG_ACI_DAGC_DONE_CNT_LMT_11GN_SFT 24 ++#define RG_ACI_DAGC_DONE_CNT_LMT_11GN_HI 31 ++#define RG_ACI_DAGC_DONE_CNT_LMT_11GN_SZ 8 ++#define RG_ACI_DAGC_SET_VALUE_11GN_MSK 0x0000007f ++#define RG_ACI_DAGC_SET_VALUE_11GN_I_MSK 0xffffff80 ++#define RG_ACI_DAGC_SET_VALUE_11GN_SFT 0 ++#define RG_ACI_DAGC_SET_VALUE_11GN_HI 6 ++#define RG_ACI_DAGC_SET_VALUE_11GN_SZ 7 ++#define RG_ACI_GAIN_INI_VAL_11GN_MSK 0x0000ff00 ++#define RG_ACI_GAIN_INI_VAL_11GN_I_MSK 0xffff00ff ++#define RG_ACI_GAIN_INI_VAL_11GN_SFT 8 ++#define RG_ACI_GAIN_INI_VAL_11GN_HI 15 ++#define RG_ACI_GAIN_INI_VAL_11GN_SZ 8 ++#define RG_ACI_GAIN_OW_VAL_11GN_MSK 0x00ff0000 ++#define RG_ACI_GAIN_OW_VAL_11GN_I_MSK 0xff00ffff ++#define RG_ACI_GAIN_OW_VAL_11GN_SFT 16 ++#define RG_ACI_GAIN_OW_VAL_11GN_HI 23 ++#define RG_ACI_GAIN_OW_VAL_11GN_SZ 8 ++#define RG_ACI_GAIN_OW_11GN_MSK 0x80000000 ++#define RG_ACI_GAIN_OW_11GN_I_MSK 0x7fffffff ++#define RG_ACI_GAIN_OW_11GN_SFT 31 ++#define RG_ACI_GAIN_OW_11GN_HI 31 ++#define RG_ACI_GAIN_OW_11GN_SZ 1 ++#define RO_CCA_PWR_MA_11GN_MSK 0x0000007f ++#define RO_CCA_PWR_MA_11GN_I_MSK 0xffffff80 ++#define RO_CCA_PWR_MA_11GN_SFT 0 ++#define RO_CCA_PWR_MA_11GN_HI 6 ++#define RO_CCA_PWR_MA_11GN_SZ 7 ++#define RO_ED_STATE_MSK 0x00008000 ++#define RO_ED_STATE_I_MSK 0xffff7fff ++#define RO_ED_STATE_SFT 15 ++#define RO_ED_STATE_HI 15 ++#define RO_ED_STATE_SZ 1 ++#define RO_CCA_PWR_MA_11B_MSK 0x007f0000 ++#define RO_CCA_PWR_MA_11B_I_MSK 0xff80ffff ++#define RO_CCA_PWR_MA_11B_SFT 16 ++#define RO_CCA_PWR_MA_11B_HI 22 ++#define RO_CCA_PWR_MA_11B_SZ 7 ++#define RO_PGA_PWR_FF1_MSK 0x00003fff ++#define RO_PGA_PWR_FF1_I_MSK 0xffffc000 ++#define RO_PGA_PWR_FF1_SFT 0 ++#define RO_PGA_PWR_FF1_HI 13 ++#define RO_PGA_PWR_FF1_SZ 14 ++#define RO_RF_PWR_FF1_MSK 0x000f0000 ++#define RO_RF_PWR_FF1_I_MSK 0xfff0ffff ++#define RO_RF_PWR_FF1_SFT 16 ++#define RO_RF_PWR_FF1_HI 19 ++#define RO_RF_PWR_FF1_SZ 4 ++#define RO_PGAGC_FF1_MSK 0x0f000000 ++#define RO_PGAGC_FF1_I_MSK 0xf0ffffff ++#define RO_PGAGC_FF1_SFT 24 ++#define RO_PGAGC_FF1_HI 27 ++#define RO_PGAGC_FF1_SZ 4 ++#define RO_RFGC_FF1_MSK 0x30000000 ++#define RO_RFGC_FF1_I_MSK 0xcfffffff ++#define RO_RFGC_FF1_SFT 28 ++#define RO_RFGC_FF1_HI 29 ++#define RO_RFGC_FF1_SZ 2 ++#define RO_PGA_PWR_FF2_MSK 0x00003fff ++#define RO_PGA_PWR_FF2_I_MSK 0xffffc000 ++#define RO_PGA_PWR_FF2_SFT 0 ++#define RO_PGA_PWR_FF2_HI 13 ++#define RO_PGA_PWR_FF2_SZ 14 ++#define RO_RF_PWR_FF2_MSK 0x000f0000 ++#define RO_RF_PWR_FF2_I_MSK 0xfff0ffff ++#define RO_RF_PWR_FF2_SFT 16 ++#define RO_RF_PWR_FF2_HI 19 ++#define RO_RF_PWR_FF2_SZ 4 ++#define RO_PGAGC_FF2_MSK 0x0f000000 ++#define RO_PGAGC_FF2_I_MSK 0xf0ffffff ++#define RO_PGAGC_FF2_SFT 24 ++#define RO_PGAGC_FF2_HI 27 ++#define RO_PGAGC_FF2_SZ 4 ++#define RO_RFGC_FF2_MSK 0x30000000 ++#define RO_RFGC_FF2_I_MSK 0xcfffffff ++#define RO_RFGC_FF2_SFT 28 ++#define RO_RFGC_FF2_HI 29 ++#define RO_RFGC_FF2_SZ 2 ++#define RO_PGA_PWR_FF3_MSK 0x00003fff ++#define RO_PGA_PWR_FF3_I_MSK 0xffffc000 ++#define RO_PGA_PWR_FF3_SFT 0 ++#define RO_PGA_PWR_FF3_HI 13 ++#define RO_PGA_PWR_FF3_SZ 14 ++#define RO_RF_PWR_FF3_MSK 0x000f0000 ++#define RO_RF_PWR_FF3_I_MSK 0xfff0ffff ++#define RO_RF_PWR_FF3_SFT 16 ++#define RO_RF_PWR_FF3_HI 19 ++#define RO_RF_PWR_FF3_SZ 4 ++#define RO_PGAGC_FF3_MSK 0x0f000000 ++#define RO_PGAGC_FF3_I_MSK 0xf0ffffff ++#define RO_PGAGC_FF3_SFT 24 ++#define RO_PGAGC_FF3_HI 27 ++#define RO_PGAGC_FF3_SZ 4 ++#define RO_RFGC_FF3_MSK 0x30000000 ++#define RO_RFGC_FF3_I_MSK 0xcfffffff ++#define RO_RFGC_FF3_SFT 28 ++#define RO_RFGC_FF3_HI 29 ++#define RO_RFGC_FF3_SZ 2 ++#define RG_TX_DES_RATE_MSK 0x0000001f ++#define RG_TX_DES_RATE_I_MSK 0xffffffe0 ++#define RG_TX_DES_RATE_SFT 0 ++#define RG_TX_DES_RATE_HI 4 ++#define RG_TX_DES_RATE_SZ 5 ++#define RG_TX_DES_MODE_MSK 0x00001f00 ++#define RG_TX_DES_MODE_I_MSK 0xffffe0ff ++#define RG_TX_DES_MODE_SFT 8 ++#define RG_TX_DES_MODE_HI 12 ++#define RG_TX_DES_MODE_SZ 5 ++#define RG_TX_DES_LEN_LO_MSK 0x001f0000 ++#define RG_TX_DES_LEN_LO_I_MSK 0xffe0ffff ++#define RG_TX_DES_LEN_LO_SFT 16 ++#define RG_TX_DES_LEN_LO_HI 20 ++#define RG_TX_DES_LEN_LO_SZ 5 ++#define RG_TX_DES_LEN_UP_MSK 0x1f000000 ++#define RG_TX_DES_LEN_UP_I_MSK 0xe0ffffff ++#define RG_TX_DES_LEN_UP_SFT 24 ++#define RG_TX_DES_LEN_UP_HI 28 ++#define RG_TX_DES_LEN_UP_SZ 5 ++#define RG_TX_DES_SRVC_UP_MSK 0x0000001f ++#define RG_TX_DES_SRVC_UP_I_MSK 0xffffffe0 ++#define RG_TX_DES_SRVC_UP_SFT 0 ++#define RG_TX_DES_SRVC_UP_HI 4 ++#define RG_TX_DES_SRVC_UP_SZ 5 ++#define RG_TX_DES_L_LEN_LO_MSK 0x00001f00 ++#define RG_TX_DES_L_LEN_LO_I_MSK 0xffffe0ff ++#define RG_TX_DES_L_LEN_LO_SFT 8 ++#define RG_TX_DES_L_LEN_LO_HI 12 ++#define RG_TX_DES_L_LEN_LO_SZ 5 ++#define RG_TX_DES_L_LEN_UP_MSK 0x001f0000 ++#define RG_TX_DES_L_LEN_UP_I_MSK 0xffe0ffff ++#define RG_TX_DES_L_LEN_UP_SFT 16 ++#define RG_TX_DES_L_LEN_UP_HI 20 ++#define RG_TX_DES_L_LEN_UP_SZ 5 ++#define RG_TX_DES_TYPE_MSK 0x1f000000 ++#define RG_TX_DES_TYPE_I_MSK 0xe0ffffff ++#define RG_TX_DES_TYPE_SFT 24 ++#define RG_TX_DES_TYPE_HI 28 ++#define RG_TX_DES_TYPE_SZ 5 ++#define RG_TX_DES_L_LEN_UP_COMB_MSK 0x00000001 ++#define RG_TX_DES_L_LEN_UP_COMB_I_MSK 0xfffffffe ++#define RG_TX_DES_L_LEN_UP_COMB_SFT 0 ++#define RG_TX_DES_L_LEN_UP_COMB_HI 0 ++#define RG_TX_DES_L_LEN_UP_COMB_SZ 1 ++#define RG_TX_DES_TYPE_COMB_MSK 0x00000010 ++#define RG_TX_DES_TYPE_COMB_I_MSK 0xffffffef ++#define RG_TX_DES_TYPE_COMB_SFT 4 ++#define RG_TX_DES_TYPE_COMB_HI 4 ++#define RG_TX_DES_TYPE_COMB_SZ 1 ++#define RG_TX_DES_RATE_COMB_MSK 0x00000100 ++#define RG_TX_DES_RATE_COMB_I_MSK 0xfffffeff ++#define RG_TX_DES_RATE_COMB_SFT 8 ++#define RG_TX_DES_RATE_COMB_HI 8 ++#define RG_TX_DES_RATE_COMB_SZ 1 ++#define RG_TX_DES_MODE_COMB_MSK 0x00001000 ++#define RG_TX_DES_MODE_COMB_I_MSK 0xffffefff ++#define RG_TX_DES_MODE_COMB_SFT 12 ++#define RG_TX_DES_MODE_COMB_HI 12 ++#define RG_TX_DES_MODE_COMB_SZ 1 ++#define RG_TX_DES_PWRLVL_MSK 0x001f0000 ++#define RG_TX_DES_PWRLVL_I_MSK 0xffe0ffff ++#define RG_TX_DES_PWRLVL_SFT 16 ++#define RG_TX_DES_PWRLVL_HI 20 ++#define RG_TX_DES_PWRLVL_SZ 5 ++#define RG_TX_DES_SRVC_LO_MSK 0x1f000000 ++#define RG_TX_DES_SRVC_LO_I_MSK 0xe0ffffff ++#define RG_TX_DES_SRVC_LO_SFT 24 ++#define RG_TX_DES_SRVC_LO_HI 28 ++#define RG_TX_DES_SRVC_LO_SZ 5 ++#define RG_RX_DES_RATE_MSK 0x0000003f ++#define RG_RX_DES_RATE_I_MSK 0xffffffc0 ++#define RG_RX_DES_RATE_SFT 0 ++#define RG_RX_DES_RATE_HI 5 ++#define RG_RX_DES_RATE_SZ 6 ++#define RG_RX_DES_MODE_MSK 0x00003f00 ++#define RG_RX_DES_MODE_I_MSK 0xffffc0ff ++#define RG_RX_DES_MODE_SFT 8 ++#define RG_RX_DES_MODE_HI 13 ++#define RG_RX_DES_MODE_SZ 6 ++#define RG_RX_DES_LEN_LO_MSK 0x003f0000 ++#define RG_RX_DES_LEN_LO_I_MSK 0xffc0ffff ++#define RG_RX_DES_LEN_LO_SFT 16 ++#define RG_RX_DES_LEN_LO_HI 21 ++#define RG_RX_DES_LEN_LO_SZ 6 ++#define RG_RX_DES_LEN_UP_MSK 0x3f000000 ++#define RG_RX_DES_LEN_UP_I_MSK 0xc0ffffff ++#define RG_RX_DES_LEN_UP_SFT 24 ++#define RG_RX_DES_LEN_UP_HI 29 ++#define RG_RX_DES_LEN_UP_SZ 6 ++#define RG_RX_DES_SRVC_UP_MSK 0x0000003f ++#define RG_RX_DES_SRVC_UP_I_MSK 0xffffffc0 ++#define RG_RX_DES_SRVC_UP_SFT 0 ++#define RG_RX_DES_SRVC_UP_HI 5 ++#define RG_RX_DES_SRVC_UP_SZ 6 ++#define RG_RX_DES_L_LEN_LO_MSK 0x00003f00 ++#define RG_RX_DES_L_LEN_LO_I_MSK 0xffffc0ff ++#define RG_RX_DES_L_LEN_LO_SFT 8 ++#define RG_RX_DES_L_LEN_LO_HI 13 ++#define RG_RX_DES_L_LEN_LO_SZ 6 ++#define RG_RX_DES_L_LEN_UP_MSK 0x003f0000 ++#define RG_RX_DES_L_LEN_UP_I_MSK 0xffc0ffff ++#define RG_RX_DES_L_LEN_UP_SFT 16 ++#define RG_RX_DES_L_LEN_UP_HI 21 ++#define RG_RX_DES_L_LEN_UP_SZ 6 ++#define RG_RX_DES_TYPE_MSK 0x3f000000 ++#define RG_RX_DES_TYPE_I_MSK 0xc0ffffff ++#define RG_RX_DES_TYPE_SFT 24 ++#define RG_RX_DES_TYPE_HI 29 ++#define RG_RX_DES_TYPE_SZ 6 ++#define RG_RX_DES_L_LEN_UP_COMB_MSK 0x00000001 ++#define RG_RX_DES_L_LEN_UP_COMB_I_MSK 0xfffffffe ++#define RG_RX_DES_L_LEN_UP_COMB_SFT 0 ++#define RG_RX_DES_L_LEN_UP_COMB_HI 0 ++#define RG_RX_DES_L_LEN_UP_COMB_SZ 1 ++#define RG_RX_DES_TYPE_COMB_MSK 0x00000010 ++#define RG_RX_DES_TYPE_COMB_I_MSK 0xffffffef ++#define RG_RX_DES_TYPE_COMB_SFT 4 ++#define RG_RX_DES_TYPE_COMB_HI 4 ++#define RG_RX_DES_TYPE_COMB_SZ 1 ++#define RG_RX_DES_RATE_COMB_MSK 0x00000100 ++#define RG_RX_DES_RATE_COMB_I_MSK 0xfffffeff ++#define RG_RX_DES_RATE_COMB_SFT 8 ++#define RG_RX_DES_RATE_COMB_HI 8 ++#define RG_RX_DES_RATE_COMB_SZ 1 ++#define RG_RX_DES_MODE_COMB_MSK 0x00001000 ++#define RG_RX_DES_MODE_COMB_I_MSK 0xffffefff ++#define RG_RX_DES_MODE_COMB_SFT 12 ++#define RG_RX_DES_MODE_COMB_HI 12 ++#define RG_RX_DES_MODE_COMB_SZ 1 ++#define RG_RX_DES_SNR_MSK 0x000f0000 ++#define RG_RX_DES_SNR_I_MSK 0xfff0ffff ++#define RG_RX_DES_SNR_SFT 16 ++#define RG_RX_DES_SNR_HI 19 ++#define RG_RX_DES_SNR_SZ 4 ++#define RG_RX_DES_RCPI_MSK 0x00f00000 ++#define RG_RX_DES_RCPI_I_MSK 0xff0fffff ++#define RG_RX_DES_RCPI_SFT 20 ++#define RG_RX_DES_RCPI_HI 23 ++#define RG_RX_DES_RCPI_SZ 4 ++#define RG_RX_DES_SRVC_LO_MSK 0x3f000000 ++#define RG_RX_DES_SRVC_LO_I_MSK 0xc0ffffff ++#define RG_RX_DES_SRVC_LO_SFT 24 ++#define RG_RX_DES_SRVC_LO_HI 29 ++#define RG_RX_DES_SRVC_LO_SZ 6 ++#define RO_TX_DES_EXCP_RATE_CNT_MSK 0x000000ff ++#define RO_TX_DES_EXCP_RATE_CNT_I_MSK 0xffffff00 ++#define RO_TX_DES_EXCP_RATE_CNT_SFT 0 ++#define RO_TX_DES_EXCP_RATE_CNT_HI 7 ++#define RO_TX_DES_EXCP_RATE_CNT_SZ 8 ++#define RO_TX_DES_EXCP_CH_BW_CNT_MSK 0x0000ff00 ++#define RO_TX_DES_EXCP_CH_BW_CNT_I_MSK 0xffff00ff ++#define RO_TX_DES_EXCP_CH_BW_CNT_SFT 8 ++#define RO_TX_DES_EXCP_CH_BW_CNT_HI 15 ++#define RO_TX_DES_EXCP_CH_BW_CNT_SZ 8 ++#define RO_TX_DES_EXCP_MODE_CNT_MSK 0x00ff0000 ++#define RO_TX_DES_EXCP_MODE_CNT_I_MSK 0xff00ffff ++#define RO_TX_DES_EXCP_MODE_CNT_SFT 16 ++#define RO_TX_DES_EXCP_MODE_CNT_HI 23 ++#define RO_TX_DES_EXCP_MODE_CNT_SZ 8 ++#define RG_TX_DES_EXCP_RATE_DEFAULT_MSK 0x07000000 ++#define RG_TX_DES_EXCP_RATE_DEFAULT_I_MSK 0xf8ffffff ++#define RG_TX_DES_EXCP_RATE_DEFAULT_SFT 24 ++#define RG_TX_DES_EXCP_RATE_DEFAULT_HI 26 ++#define RG_TX_DES_EXCP_RATE_DEFAULT_SZ 3 ++#define RG_TX_DES_EXCP_MODE_DEFAULT_MSK 0x70000000 ++#define RG_TX_DES_EXCP_MODE_DEFAULT_I_MSK 0x8fffffff ++#define RG_TX_DES_EXCP_MODE_DEFAULT_SFT 28 ++#define RG_TX_DES_EXCP_MODE_DEFAULT_HI 30 ++#define RG_TX_DES_EXCP_MODE_DEFAULT_SZ 3 ++#define RG_TX_DES_EXCP_CLR_MSK 0x80000000 ++#define RG_TX_DES_EXCP_CLR_I_MSK 0x7fffffff ++#define RG_TX_DES_EXCP_CLR_SFT 31 ++#define RG_TX_DES_EXCP_CLR_HI 31 ++#define RG_TX_DES_EXCP_CLR_SZ 1 ++#define RG_TX_DES_ACK_WIDTH_MSK 0x00000001 ++#define RG_TX_DES_ACK_WIDTH_I_MSK 0xfffffffe ++#define RG_TX_DES_ACK_WIDTH_SFT 0 ++#define RG_TX_DES_ACK_WIDTH_HI 0 ++#define RG_TX_DES_ACK_WIDTH_SZ 1 ++#define RG_TX_DES_ACK_PRD_MSK 0x0000000e ++#define RG_TX_DES_ACK_PRD_I_MSK 0xfffffff1 ++#define RG_TX_DES_ACK_PRD_SFT 1 ++#define RG_TX_DES_ACK_PRD_HI 3 ++#define RG_TX_DES_ACK_PRD_SZ 3 ++#define RG_RX_DES_SNR_GN_MSK 0x003f0000 ++#define RG_RX_DES_SNR_GN_I_MSK 0xffc0ffff ++#define RG_RX_DES_SNR_GN_SFT 16 ++#define RG_RX_DES_SNR_GN_HI 21 ++#define RG_RX_DES_SNR_GN_SZ 6 ++#define RG_RX_DES_RCPI_GN_MSK 0x3f000000 ++#define RG_RX_DES_RCPI_GN_I_MSK 0xc0ffffff ++#define RG_RX_DES_RCPI_GN_SFT 24 ++#define RG_RX_DES_RCPI_GN_HI 29 ++#define RG_RX_DES_RCPI_GN_SZ 6 ++#define RG_TST_TBUS_SEL_MSK 0x0000000f ++#define RG_TST_TBUS_SEL_I_MSK 0xfffffff0 ++#define RG_TST_TBUS_SEL_SFT 0 ++#define RG_TST_TBUS_SEL_HI 3 ++#define RG_TST_TBUS_SEL_SZ 4 ++#define RG_RSSI_OFFSET_MSK 0x00ff0000 ++#define RG_RSSI_OFFSET_I_MSK 0xff00ffff ++#define RG_RSSI_OFFSET_SFT 16 ++#define RG_RSSI_OFFSET_HI 23 ++#define RG_RSSI_OFFSET_SZ 8 ++#define RG_RSSI_INV_MSK 0x01000000 ++#define RG_RSSI_INV_I_MSK 0xfeffffff ++#define RG_RSSI_INV_SFT 24 ++#define RG_RSSI_INV_HI 24 ++#define RG_RSSI_INV_SZ 1 ++#define RG_TST_ADC_ON_MSK 0x40000000 ++#define RG_TST_ADC_ON_I_MSK 0xbfffffff ++#define RG_TST_ADC_ON_SFT 30 ++#define RG_TST_ADC_ON_HI 30 ++#define RG_TST_ADC_ON_SZ 1 ++#define RG_TST_EXT_GAIN_MSK 0x80000000 ++#define RG_TST_EXT_GAIN_I_MSK 0x7fffffff ++#define RG_TST_EXT_GAIN_SFT 31 ++#define RG_TST_EXT_GAIN_HI 31 ++#define RG_TST_EXT_GAIN_SZ 1 ++#define RG_DAC_Q_SET_MSK 0x000003ff ++#define RG_DAC_Q_SET_I_MSK 0xfffffc00 ++#define RG_DAC_Q_SET_SFT 0 ++#define RG_DAC_Q_SET_HI 9 ++#define RG_DAC_Q_SET_SZ 10 ++#define RG_DAC_I_SET_MSK 0x003ff000 ++#define RG_DAC_I_SET_I_MSK 0xffc00fff ++#define RG_DAC_I_SET_SFT 12 ++#define RG_DAC_I_SET_HI 21 ++#define RG_DAC_I_SET_SZ 10 ++#define RG_DAC_EN_MAN_MSK 0x10000000 ++#define RG_DAC_EN_MAN_I_MSK 0xefffffff ++#define RG_DAC_EN_MAN_SFT 28 ++#define RG_DAC_EN_MAN_HI 28 ++#define RG_DAC_EN_MAN_SZ 1 ++#define RG_IQC_FFT_EN_MSK 0x20000000 ++#define RG_IQC_FFT_EN_I_MSK 0xdfffffff ++#define RG_IQC_FFT_EN_SFT 29 ++#define RG_IQC_FFT_EN_HI 29 ++#define RG_IQC_FFT_EN_SZ 1 ++#define RG_DAC_MAN_Q_EN_MSK 0x40000000 ++#define RG_DAC_MAN_Q_EN_I_MSK 0xbfffffff ++#define RG_DAC_MAN_Q_EN_SFT 30 ++#define RG_DAC_MAN_Q_EN_HI 30 ++#define RG_DAC_MAN_Q_EN_SZ 1 ++#define RG_DAC_MAN_I_EN_MSK 0x80000000 ++#define RG_DAC_MAN_I_EN_I_MSK 0x7fffffff ++#define RG_DAC_MAN_I_EN_SFT 31 ++#define RG_DAC_MAN_I_EN_HI 31 ++#define RG_DAC_MAN_I_EN_SZ 1 ++#define RO_MRX_EN_CNT_MSK 0x0000ffff ++#define RO_MRX_EN_CNT_I_MSK 0xffff0000 ++#define RO_MRX_EN_CNT_SFT 0 ++#define RO_MRX_EN_CNT_HI 15 ++#define RO_MRX_EN_CNT_SZ 16 ++#define RG_MRX_EN_CNT_RST_N_MSK 0x80000000 ++#define RG_MRX_EN_CNT_RST_N_I_MSK 0x7fffffff ++#define RG_MRX_EN_CNT_RST_N_SFT 31 ++#define RG_MRX_EN_CNT_RST_N_HI 31 ++#define RG_MRX_EN_CNT_RST_N_SZ 1 ++#define RG_PA_RISE_TIME_MSK 0x000000ff ++#define RG_PA_RISE_TIME_I_MSK 0xffffff00 ++#define RG_PA_RISE_TIME_SFT 0 ++#define RG_PA_RISE_TIME_HI 7 ++#define RG_PA_RISE_TIME_SZ 8 ++#define RG_RFTX_RISE_TIME_MSK 0x0000ff00 ++#define RG_RFTX_RISE_TIME_I_MSK 0xffff00ff ++#define RG_RFTX_RISE_TIME_SFT 8 ++#define RG_RFTX_RISE_TIME_HI 15 ++#define RG_RFTX_RISE_TIME_SZ 8 ++#define RG_DAC_RISE_TIME_MSK 0x00ff0000 ++#define RG_DAC_RISE_TIME_I_MSK 0xff00ffff ++#define RG_DAC_RISE_TIME_SFT 16 ++#define RG_DAC_RISE_TIME_HI 23 ++#define RG_DAC_RISE_TIME_SZ 8 ++#define RG_SW_RISE_TIME_MSK 0xff000000 ++#define RG_SW_RISE_TIME_I_MSK 0x00ffffff ++#define RG_SW_RISE_TIME_SFT 24 ++#define RG_SW_RISE_TIME_HI 31 ++#define RG_SW_RISE_TIME_SZ 8 ++#define RG_PA_FALL_TIME_MSK 0x000000ff ++#define RG_PA_FALL_TIME_I_MSK 0xffffff00 ++#define RG_PA_FALL_TIME_SFT 0 ++#define RG_PA_FALL_TIME_HI 7 ++#define RG_PA_FALL_TIME_SZ 8 ++#define RG_RFTX_FALL_TIME_MSK 0x0000ff00 ++#define RG_RFTX_FALL_TIME_I_MSK 0xffff00ff ++#define RG_RFTX_FALL_TIME_SFT 8 ++#define RG_RFTX_FALL_TIME_HI 15 ++#define RG_RFTX_FALL_TIME_SZ 8 ++#define RG_DAC_FALL_TIME_MSK 0x00ff0000 ++#define RG_DAC_FALL_TIME_I_MSK 0xff00ffff ++#define RG_DAC_FALL_TIME_SFT 16 ++#define RG_DAC_FALL_TIME_HI 23 ++#define RG_DAC_FALL_TIME_SZ 8 ++#define RG_SW_FALL_TIME_MSK 0xff000000 ++#define RG_SW_FALL_TIME_I_MSK 0x00ffffff ++#define RG_SW_FALL_TIME_SFT 24 ++#define RG_SW_FALL_TIME_HI 31 ++#define RG_SW_FALL_TIME_SZ 8 ++#define RG_ANT_SW_0_MSK 0x00000007 ++#define RG_ANT_SW_0_I_MSK 0xfffffff8 ++#define RG_ANT_SW_0_SFT 0 ++#define RG_ANT_SW_0_HI 2 ++#define RG_ANT_SW_0_SZ 3 ++#define RG_ANT_SW_1_MSK 0x00000038 ++#define RG_ANT_SW_1_I_MSK 0xffffffc7 ++#define RG_ANT_SW_1_SFT 3 ++#define RG_ANT_SW_1_HI 5 ++#define RG_ANT_SW_1_SZ 3 ++#define RG_MTX_LEN_LOWER_TH_0_MSK 0x00001fff ++#define RG_MTX_LEN_LOWER_TH_0_I_MSK 0xffffe000 ++#define RG_MTX_LEN_LOWER_TH_0_SFT 0 ++#define RG_MTX_LEN_LOWER_TH_0_HI 12 ++#define RG_MTX_LEN_LOWER_TH_0_SZ 13 ++#define RG_MTX_LEN_UPPER_TH_0_MSK 0x1fff0000 ++#define RG_MTX_LEN_UPPER_TH_0_I_MSK 0xe000ffff ++#define RG_MTX_LEN_UPPER_TH_0_SFT 16 ++#define RG_MTX_LEN_UPPER_TH_0_HI 28 ++#define RG_MTX_LEN_UPPER_TH_0_SZ 13 ++#define RG_MTX_LEN_CNT_EN_0_MSK 0x80000000 ++#define RG_MTX_LEN_CNT_EN_0_I_MSK 0x7fffffff ++#define RG_MTX_LEN_CNT_EN_0_SFT 31 ++#define RG_MTX_LEN_CNT_EN_0_HI 31 ++#define RG_MTX_LEN_CNT_EN_0_SZ 1 ++#define RG_MTX_LEN_LOWER_TH_1_MSK 0x00001fff ++#define RG_MTX_LEN_LOWER_TH_1_I_MSK 0xffffe000 ++#define RG_MTX_LEN_LOWER_TH_1_SFT 0 ++#define RG_MTX_LEN_LOWER_TH_1_HI 12 ++#define RG_MTX_LEN_LOWER_TH_1_SZ 13 ++#define RG_MTX_LEN_UPPER_TH_1_MSK 0x1fff0000 ++#define RG_MTX_LEN_UPPER_TH_1_I_MSK 0xe000ffff ++#define RG_MTX_LEN_UPPER_TH_1_SFT 16 ++#define RG_MTX_LEN_UPPER_TH_1_HI 28 ++#define RG_MTX_LEN_UPPER_TH_1_SZ 13 ++#define RG_MTX_LEN_CNT_EN_1_MSK 0x80000000 ++#define RG_MTX_LEN_CNT_EN_1_I_MSK 0x7fffffff ++#define RG_MTX_LEN_CNT_EN_1_SFT 31 ++#define RG_MTX_LEN_CNT_EN_1_HI 31 ++#define RG_MTX_LEN_CNT_EN_1_SZ 1 ++#define RG_MRX_LEN_LOWER_TH_0_MSK 0x00001fff ++#define RG_MRX_LEN_LOWER_TH_0_I_MSK 0xffffe000 ++#define RG_MRX_LEN_LOWER_TH_0_SFT 0 ++#define RG_MRX_LEN_LOWER_TH_0_HI 12 ++#define RG_MRX_LEN_LOWER_TH_0_SZ 13 ++#define RG_MRX_LEN_UPPER_TH_0_MSK 0x1fff0000 ++#define RG_MRX_LEN_UPPER_TH_0_I_MSK 0xe000ffff ++#define RG_MRX_LEN_UPPER_TH_0_SFT 16 ++#define RG_MRX_LEN_UPPER_TH_0_HI 28 ++#define RG_MRX_LEN_UPPER_TH_0_SZ 13 ++#define RG_MRX_LEN_CNT_EN_0_MSK 0x80000000 ++#define RG_MRX_LEN_CNT_EN_0_I_MSK 0x7fffffff ++#define RG_MRX_LEN_CNT_EN_0_SFT 31 ++#define RG_MRX_LEN_CNT_EN_0_HI 31 ++#define RG_MRX_LEN_CNT_EN_0_SZ 1 ++#define RG_MRX_LEN_LOWER_TH_1_MSK 0x00001fff ++#define RG_MRX_LEN_LOWER_TH_1_I_MSK 0xffffe000 ++#define RG_MRX_LEN_LOWER_TH_1_SFT 0 ++#define RG_MRX_LEN_LOWER_TH_1_HI 12 ++#define RG_MRX_LEN_LOWER_TH_1_SZ 13 ++#define RG_MRX_LEN_UPPER_TH_1_MSK 0x1fff0000 ++#define RG_MRX_LEN_UPPER_TH_1_I_MSK 0xe000ffff ++#define RG_MRX_LEN_UPPER_TH_1_SFT 16 ++#define RG_MRX_LEN_UPPER_TH_1_HI 28 ++#define RG_MRX_LEN_UPPER_TH_1_SZ 13 ++#define RG_MRX_LEN_CNT_EN_1_MSK 0x80000000 ++#define RG_MRX_LEN_CNT_EN_1_I_MSK 0x7fffffff ++#define RG_MRX_LEN_CNT_EN_1_SFT 31 ++#define RG_MRX_LEN_CNT_EN_1_HI 31 ++#define RG_MRX_LEN_CNT_EN_1_SZ 1 ++#define RO_MTX_LEN_CNT_1_MSK 0x0000ffff ++#define RO_MTX_LEN_CNT_1_I_MSK 0xffff0000 ++#define RO_MTX_LEN_CNT_1_SFT 0 ++#define RO_MTX_LEN_CNT_1_HI 15 ++#define RO_MTX_LEN_CNT_1_SZ 16 ++#define RO_MTX_LEN_CNT_0_MSK 0xffff0000 ++#define RO_MTX_LEN_CNT_0_I_MSK 0x0000ffff ++#define RO_MTX_LEN_CNT_0_SFT 16 ++#define RO_MTX_LEN_CNT_0_HI 31 ++#define RO_MTX_LEN_CNT_0_SZ 16 ++#define RO_MRX_LEN_CNT_1_MSK 0x0000ffff ++#define RO_MRX_LEN_CNT_1_I_MSK 0xffff0000 ++#define RO_MRX_LEN_CNT_1_SFT 0 ++#define RO_MRX_LEN_CNT_1_HI 15 ++#define RO_MRX_LEN_CNT_1_SZ 16 ++#define RO_MRX_LEN_CNT_0_MSK 0xffff0000 ++#define RO_MRX_LEN_CNT_0_I_MSK 0x0000ffff ++#define RO_MRX_LEN_CNT_0_SFT 16 ++#define RO_MRX_LEN_CNT_0_HI 31 ++#define RO_MRX_LEN_CNT_0_SZ 16 ++#define RG_MODE_REG_IN_16_MSK 0x0000ffff ++#define RG_MODE_REG_IN_16_I_MSK 0xffff0000 ++#define RG_MODE_REG_IN_16_SFT 0 ++#define RG_MODE_REG_IN_16_HI 15 ++#define RG_MODE_REG_IN_16_SZ 16 ++#define RG_PARALLEL_DR_16_MSK 0x00100000 ++#define RG_PARALLEL_DR_16_I_MSK 0xffefffff ++#define RG_PARALLEL_DR_16_SFT 20 ++#define RG_PARALLEL_DR_16_HI 20 ++#define RG_PARALLEL_DR_16_SZ 1 ++#define RG_MBRUN_16_MSK 0x01000000 ++#define RG_MBRUN_16_I_MSK 0xfeffffff ++#define RG_MBRUN_16_SFT 24 ++#define RG_MBRUN_16_HI 24 ++#define RG_MBRUN_16_SZ 1 ++#define RG_SHIFT_DR_16_MSK 0x10000000 ++#define RG_SHIFT_DR_16_I_MSK 0xefffffff ++#define RG_SHIFT_DR_16_SFT 28 ++#define RG_SHIFT_DR_16_HI 28 ++#define RG_SHIFT_DR_16_SZ 1 ++#define RG_MODE_REG_SI_16_MSK 0x20000000 ++#define RG_MODE_REG_SI_16_I_MSK 0xdfffffff ++#define RG_MODE_REG_SI_16_SFT 29 ++#define RG_MODE_REG_SI_16_HI 29 ++#define RG_MODE_REG_SI_16_SZ 1 ++#define RG_SIMULATION_MODE_16_MSK 0x40000000 ++#define RG_SIMULATION_MODE_16_I_MSK 0xbfffffff ++#define RG_SIMULATION_MODE_16_SFT 30 ++#define RG_SIMULATION_MODE_16_HI 30 ++#define RG_SIMULATION_MODE_16_SZ 1 ++#define RG_DBIST_MODE_16_MSK 0x80000000 ++#define RG_DBIST_MODE_16_I_MSK 0x7fffffff ++#define RG_DBIST_MODE_16_SFT 31 ++#define RG_DBIST_MODE_16_HI 31 ++#define RG_DBIST_MODE_16_SZ 1 ++#define RO_MODE_REG_OUT_16_MSK 0x0000ffff ++#define RO_MODE_REG_OUT_16_I_MSK 0xffff0000 ++#define RO_MODE_REG_OUT_16_SFT 0 ++#define RO_MODE_REG_OUT_16_HI 15 ++#define RO_MODE_REG_OUT_16_SZ 16 ++#define RO_MODE_REG_SO_16_MSK 0x01000000 ++#define RO_MODE_REG_SO_16_I_MSK 0xfeffffff ++#define RO_MODE_REG_SO_16_SFT 24 ++#define RO_MODE_REG_SO_16_HI 24 ++#define RO_MODE_REG_SO_16_SZ 1 ++#define RO_MONITOR_BUS_16_MSK 0x0007ffff ++#define RO_MONITOR_BUS_16_I_MSK 0xfff80000 ++#define RO_MONITOR_BUS_16_SFT 0 ++#define RO_MONITOR_BUS_16_HI 18 ++#define RO_MONITOR_BUS_16_SZ 19 ++#define RG_MRX_TYPE_1_MSK 0x000000ff ++#define RG_MRX_TYPE_1_I_MSK 0xffffff00 ++#define RG_MRX_TYPE_1_SFT 0 ++#define RG_MRX_TYPE_1_HI 7 ++#define RG_MRX_TYPE_1_SZ 8 ++#define RG_MRX_TYPE_0_MSK 0x0000ff00 ++#define RG_MRX_TYPE_0_I_MSK 0xffff00ff ++#define RG_MRX_TYPE_0_SFT 8 ++#define RG_MRX_TYPE_0_HI 15 ++#define RG_MRX_TYPE_0_SZ 8 ++#define RG_MTX_TYPE_1_MSK 0x00ff0000 ++#define RG_MTX_TYPE_1_I_MSK 0xff00ffff ++#define RG_MTX_TYPE_1_SFT 16 ++#define RG_MTX_TYPE_1_HI 23 ++#define RG_MTX_TYPE_1_SZ 8 ++#define RG_MTX_TYPE_0_MSK 0xff000000 ++#define RG_MTX_TYPE_0_I_MSK 0x00ffffff ++#define RG_MTX_TYPE_0_SFT 24 ++#define RG_MTX_TYPE_0_HI 31 ++#define RG_MTX_TYPE_0_SZ 8 ++#define RO_MTX_TYPE_CNT_1_MSK 0x0000ffff ++#define RO_MTX_TYPE_CNT_1_I_MSK 0xffff0000 ++#define RO_MTX_TYPE_CNT_1_SFT 0 ++#define RO_MTX_TYPE_CNT_1_HI 15 ++#define RO_MTX_TYPE_CNT_1_SZ 16 ++#define RO_MTX_TYPE_CNT_0_MSK 0xffff0000 ++#define RO_MTX_TYPE_CNT_0_I_MSK 0x0000ffff ++#define RO_MTX_TYPE_CNT_0_SFT 16 ++#define RO_MTX_TYPE_CNT_0_HI 31 ++#define RO_MTX_TYPE_CNT_0_SZ 16 ++#define RO_MRX_TYPE_CNT_1_MSK 0x0000ffff ++#define RO_MRX_TYPE_CNT_1_I_MSK 0xffff0000 ++#define RO_MRX_TYPE_CNT_1_SFT 0 ++#define RO_MRX_TYPE_CNT_1_HI 15 ++#define RO_MRX_TYPE_CNT_1_SZ 16 ++#define RO_MRX_TYPE_CNT_0_MSK 0xffff0000 ++#define RO_MRX_TYPE_CNT_0_I_MSK 0x0000ffff ++#define RO_MRX_TYPE_CNT_0_SFT 16 ++#define RO_MRX_TYPE_CNT_0_HI 31 ++#define RO_MRX_TYPE_CNT_0_SZ 16 ++#define RG_HB_COEF0_MSK 0x00000fff ++#define RG_HB_COEF0_I_MSK 0xfffff000 ++#define RG_HB_COEF0_SFT 0 ++#define RG_HB_COEF0_HI 11 ++#define RG_HB_COEF0_SZ 12 ++#define RG_HB_COEF1_MSK 0x0fff0000 ++#define RG_HB_COEF1_I_MSK 0xf000ffff ++#define RG_HB_COEF1_SFT 16 ++#define RG_HB_COEF1_HI 27 ++#define RG_HB_COEF1_SZ 12 ++#define RG_HB_COEF2_MSK 0x00000fff ++#define RG_HB_COEF2_I_MSK 0xfffff000 ++#define RG_HB_COEF2_SFT 0 ++#define RG_HB_COEF2_HI 11 ++#define RG_HB_COEF2_SZ 12 ++#define RG_HB_COEF3_MSK 0x0fff0000 ++#define RG_HB_COEF3_I_MSK 0xf000ffff ++#define RG_HB_COEF3_SFT 16 ++#define RG_HB_COEF3_HI 27 ++#define RG_HB_COEF3_SZ 12 ++#define RG_HB_COEF4_MSK 0x00000fff ++#define RG_HB_COEF4_I_MSK 0xfffff000 ++#define RG_HB_COEF4_SFT 0 ++#define RG_HB_COEF4_HI 11 ++#define RG_HB_COEF4_SZ 12 ++#define RO_TBUS_O_MSK 0x000fffff ++#define RO_TBUS_O_I_MSK 0xfff00000 ++#define RO_TBUS_O_SFT 0 ++#define RO_TBUS_O_HI 19 ++#define RO_TBUS_O_SZ 20 ++#define RG_LPF4_00_MSK 0x00001fff ++#define RG_LPF4_00_I_MSK 0xffffe000 ++#define RG_LPF4_00_SFT 0 ++#define RG_LPF4_00_HI 12 ++#define RG_LPF4_00_SZ 13 ++#define RG_LPF4_01_MSK 0x00001fff ++#define RG_LPF4_01_I_MSK 0xffffe000 ++#define RG_LPF4_01_SFT 0 ++#define RG_LPF4_01_HI 12 ++#define RG_LPF4_01_SZ 13 ++#define RG_LPF4_02_MSK 0x00001fff ++#define RG_LPF4_02_I_MSK 0xffffe000 ++#define RG_LPF4_02_SFT 0 ++#define RG_LPF4_02_HI 12 ++#define RG_LPF4_02_SZ 13 ++#define RG_LPF4_03_MSK 0x00001fff ++#define RG_LPF4_03_I_MSK 0xffffe000 ++#define RG_LPF4_03_SFT 0 ++#define RG_LPF4_03_HI 12 ++#define RG_LPF4_03_SZ 13 ++#define RG_LPF4_04_MSK 0x00001fff ++#define RG_LPF4_04_I_MSK 0xffffe000 ++#define RG_LPF4_04_SFT 0 ++#define RG_LPF4_04_HI 12 ++#define RG_LPF4_04_SZ 13 ++#define RG_LPF4_05_MSK 0x00001fff ++#define RG_LPF4_05_I_MSK 0xffffe000 ++#define RG_LPF4_05_SFT 0 ++#define RG_LPF4_05_HI 12 ++#define RG_LPF4_05_SZ 13 ++#define RG_LPF4_06_MSK 0x00001fff ++#define RG_LPF4_06_I_MSK 0xffffe000 ++#define RG_LPF4_06_SFT 0 ++#define RG_LPF4_06_HI 12 ++#define RG_LPF4_06_SZ 13 ++#define RG_LPF4_07_MSK 0x00001fff ++#define RG_LPF4_07_I_MSK 0xffffe000 ++#define RG_LPF4_07_SFT 0 ++#define RG_LPF4_07_HI 12 ++#define RG_LPF4_07_SZ 13 ++#define RG_LPF4_08_MSK 0x00001fff ++#define RG_LPF4_08_I_MSK 0xffffe000 ++#define RG_LPF4_08_SFT 0 ++#define RG_LPF4_08_HI 12 ++#define RG_LPF4_08_SZ 13 ++#define RG_LPF4_09_MSK 0x00001fff ++#define RG_LPF4_09_I_MSK 0xffffe000 ++#define RG_LPF4_09_SFT 0 ++#define RG_LPF4_09_HI 12 ++#define RG_LPF4_09_SZ 13 ++#define RG_LPF4_10_MSK 0x00001fff ++#define RG_LPF4_10_I_MSK 0xffffe000 ++#define RG_LPF4_10_SFT 0 ++#define RG_LPF4_10_HI 12 ++#define RG_LPF4_10_SZ 13 ++#define RG_LPF4_11_MSK 0x00001fff ++#define RG_LPF4_11_I_MSK 0xffffe000 ++#define RG_LPF4_11_SFT 0 ++#define RG_LPF4_11_HI 12 ++#define RG_LPF4_11_SZ 13 ++#define RG_LPF4_12_MSK 0x00001fff ++#define RG_LPF4_12_I_MSK 0xffffe000 ++#define RG_LPF4_12_SFT 0 ++#define RG_LPF4_12_HI 12 ++#define RG_LPF4_12_SZ 13 ++#define RG_LPF4_13_MSK 0x00001fff ++#define RG_LPF4_13_I_MSK 0xffffe000 ++#define RG_LPF4_13_SFT 0 ++#define RG_LPF4_13_HI 12 ++#define RG_LPF4_13_SZ 13 ++#define RG_LPF4_14_MSK 0x00001fff ++#define RG_LPF4_14_I_MSK 0xffffe000 ++#define RG_LPF4_14_SFT 0 ++#define RG_LPF4_14_HI 12 ++#define RG_LPF4_14_SZ 13 ++#define RG_LPF4_15_MSK 0x00001fff ++#define RG_LPF4_15_I_MSK 0xffffe000 ++#define RG_LPF4_15_SFT 0 ++#define RG_LPF4_15_HI 12 ++#define RG_LPF4_15_SZ 13 ++#define RG_LPF4_16_MSK 0x00001fff ++#define RG_LPF4_16_I_MSK 0xffffe000 ++#define RG_LPF4_16_SFT 0 ++#define RG_LPF4_16_HI 12 ++#define RG_LPF4_16_SZ 13 ++#define RG_LPF4_17_MSK 0x00001fff ++#define RG_LPF4_17_I_MSK 0xffffe000 ++#define RG_LPF4_17_SFT 0 ++#define RG_LPF4_17_HI 12 ++#define RG_LPF4_17_SZ 13 ++#define RG_LPF4_18_MSK 0x00001fff ++#define RG_LPF4_18_I_MSK 0xffffe000 ++#define RG_LPF4_18_SFT 0 ++#define RG_LPF4_18_HI 12 ++#define RG_LPF4_18_SZ 13 ++#define RG_LPF4_19_MSK 0x00001fff ++#define RG_LPF4_19_I_MSK 0xffffe000 ++#define RG_LPF4_19_SFT 0 ++#define RG_LPF4_19_HI 12 ++#define RG_LPF4_19_SZ 13 ++#define RG_LPF4_20_MSK 0x00001fff ++#define RG_LPF4_20_I_MSK 0xffffe000 ++#define RG_LPF4_20_SFT 0 ++#define RG_LPF4_20_HI 12 ++#define RG_LPF4_20_SZ 13 ++#define RG_LPF4_21_MSK 0x00001fff ++#define RG_LPF4_21_I_MSK 0xffffe000 ++#define RG_LPF4_21_SFT 0 ++#define RG_LPF4_21_HI 12 ++#define RG_LPF4_21_SZ 13 ++#define RG_LPF4_22_MSK 0x00001fff ++#define RG_LPF4_22_I_MSK 0xffffe000 ++#define RG_LPF4_22_SFT 0 ++#define RG_LPF4_22_HI 12 ++#define RG_LPF4_22_SZ 13 ++#define RG_LPF4_23_MSK 0x00001fff ++#define RG_LPF4_23_I_MSK 0xffffe000 ++#define RG_LPF4_23_SFT 0 ++#define RG_LPF4_23_HI 12 ++#define RG_LPF4_23_SZ 13 ++#define RG_LPF4_24_MSK 0x00001fff ++#define RG_LPF4_24_I_MSK 0xffffe000 ++#define RG_LPF4_24_SFT 0 ++#define RG_LPF4_24_HI 12 ++#define RG_LPF4_24_SZ 13 ++#define RG_LPF4_25_MSK 0x00001fff ++#define RG_LPF4_25_I_MSK 0xffffe000 ++#define RG_LPF4_25_SFT 0 ++#define RG_LPF4_25_HI 12 ++#define RG_LPF4_25_SZ 13 ++#define RG_LPF4_26_MSK 0x00001fff ++#define RG_LPF4_26_I_MSK 0xffffe000 ++#define RG_LPF4_26_SFT 0 ++#define RG_LPF4_26_HI 12 ++#define RG_LPF4_26_SZ 13 ++#define RG_LPF4_27_MSK 0x00001fff ++#define RG_LPF4_27_I_MSK 0xffffe000 ++#define RG_LPF4_27_SFT 0 ++#define RG_LPF4_27_HI 12 ++#define RG_LPF4_27_SZ 13 ++#define RG_LPF4_28_MSK 0x00001fff ++#define RG_LPF4_28_I_MSK 0xffffe000 ++#define RG_LPF4_28_SFT 0 ++#define RG_LPF4_28_HI 12 ++#define RG_LPF4_28_SZ 13 ++#define RG_LPF4_29_MSK 0x00001fff ++#define RG_LPF4_29_I_MSK 0xffffe000 ++#define RG_LPF4_29_SFT 0 ++#define RG_LPF4_29_HI 12 ++#define RG_LPF4_29_SZ 13 ++#define RG_LPF4_30_MSK 0x00001fff ++#define RG_LPF4_30_I_MSK 0xffffe000 ++#define RG_LPF4_30_SFT 0 ++#define RG_LPF4_30_HI 12 ++#define RG_LPF4_30_SZ 13 ++#define RG_LPF4_31_MSK 0x00001fff ++#define RG_LPF4_31_I_MSK 0xffffe000 ++#define RG_LPF4_31_SFT 0 ++#define RG_LPF4_31_HI 12 ++#define RG_LPF4_31_SZ 13 ++#define RG_LPF4_32_MSK 0x00001fff ++#define RG_LPF4_32_I_MSK 0xffffe000 ++#define RG_LPF4_32_SFT 0 ++#define RG_LPF4_32_HI 12 ++#define RG_LPF4_32_SZ 13 ++#define RG_LPF4_33_MSK 0x00001fff ++#define RG_LPF4_33_I_MSK 0xffffe000 ++#define RG_LPF4_33_SFT 0 ++#define RG_LPF4_33_HI 12 ++#define RG_LPF4_33_SZ 13 ++#define RG_LPF4_34_MSK 0x00001fff ++#define RG_LPF4_34_I_MSK 0xffffe000 ++#define RG_LPF4_34_SFT 0 ++#define RG_LPF4_34_HI 12 ++#define RG_LPF4_34_SZ 13 ++#define RG_LPF4_35_MSK 0x00001fff ++#define RG_LPF4_35_I_MSK 0xffffe000 ++#define RG_LPF4_35_SFT 0 ++#define RG_LPF4_35_HI 12 ++#define RG_LPF4_35_SZ 13 ++#define RG_LPF4_36_MSK 0x00001fff ++#define RG_LPF4_36_I_MSK 0xffffe000 ++#define RG_LPF4_36_SFT 0 ++#define RG_LPF4_36_HI 12 ++#define RG_LPF4_36_SZ 13 ++#define RG_LPF4_37_MSK 0x00001fff ++#define RG_LPF4_37_I_MSK 0xffffe000 ++#define RG_LPF4_37_SFT 0 ++#define RG_LPF4_37_HI 12 ++#define RG_LPF4_37_SZ 13 ++#define RG_LPF4_38_MSK 0x00001fff ++#define RG_LPF4_38_I_MSK 0xffffe000 ++#define RG_LPF4_38_SFT 0 ++#define RG_LPF4_38_HI 12 ++#define RG_LPF4_38_SZ 13 ++#define RG_LPF4_39_MSK 0x00001fff ++#define RG_LPF4_39_I_MSK 0xffffe000 ++#define RG_LPF4_39_SFT 0 ++#define RG_LPF4_39_HI 12 ++#define RG_LPF4_39_SZ 13 ++#define RG_LPF4_40_MSK 0x00001fff ++#define RG_LPF4_40_I_MSK 0xffffe000 ++#define RG_LPF4_40_SFT 0 ++#define RG_LPF4_40_HI 12 ++#define RG_LPF4_40_SZ 13 ++#define RG_BP_SMB_MSK 0x00002000 ++#define RG_BP_SMB_I_MSK 0xffffdfff ++#define RG_BP_SMB_SFT 13 ++#define RG_BP_SMB_HI 13 ++#define RG_BP_SMB_SZ 1 ++#define RG_EN_SRVC_MSK 0x00004000 ++#define RG_EN_SRVC_I_MSK 0xffffbfff ++#define RG_EN_SRVC_SFT 14 ++#define RG_EN_SRVC_HI 14 ++#define RG_EN_SRVC_SZ 1 ++#define RG_DES_SPD_MSK 0x00030000 ++#define RG_DES_SPD_I_MSK 0xfffcffff ++#define RG_DES_SPD_SFT 16 ++#define RG_DES_SPD_HI 17 ++#define RG_DES_SPD_SZ 2 ++#define RG_BB_11B_RISE_TIME_MSK 0x000000ff ++#define RG_BB_11B_RISE_TIME_I_MSK 0xffffff00 ++#define RG_BB_11B_RISE_TIME_SFT 0 ++#define RG_BB_11B_RISE_TIME_HI 7 ++#define RG_BB_11B_RISE_TIME_SZ 8 ++#define RG_BB_11B_FALL_TIME_MSK 0x0000ff00 ++#define RG_BB_11B_FALL_TIME_I_MSK 0xffff00ff ++#define RG_BB_11B_FALL_TIME_SFT 8 ++#define RG_BB_11B_FALL_TIME_HI 15 ++#define RG_BB_11B_FALL_TIME_SZ 8 ++#define RG_WR_TX_EN_CNT_RST_N_MSK 0x00000001 ++#define RG_WR_TX_EN_CNT_RST_N_I_MSK 0xfffffffe ++#define RG_WR_TX_EN_CNT_RST_N_SFT 0 ++#define RG_WR_TX_EN_CNT_RST_N_HI 0 ++#define RG_WR_TX_EN_CNT_RST_N_SZ 1 ++#define RO_TX_EN_CNT_MSK 0x0000ffff ++#define RO_TX_EN_CNT_I_MSK 0xffff0000 ++#define RO_TX_EN_CNT_SFT 0 ++#define RO_TX_EN_CNT_HI 15 ++#define RO_TX_EN_CNT_SZ 16 ++#define RO_TX_CNT_MSK 0xffffffff ++#define RO_TX_CNT_I_MSK 0x00000000 ++#define RO_TX_CNT_SFT 0 ++#define RO_TX_CNT_HI 31 ++#define RO_TX_CNT_SZ 32 ++#define RG_POS_DES_11B_L_EXT_MSK 0x0000000f ++#define RG_POS_DES_11B_L_EXT_I_MSK 0xfffffff0 ++#define RG_POS_DES_11B_L_EXT_SFT 0 ++#define RG_POS_DES_11B_L_EXT_HI 3 ++#define RG_POS_DES_11B_L_EXT_SZ 4 ++#define RG_PRE_DES_11B_DLY_MSK 0x000000f0 ++#define RG_PRE_DES_11B_DLY_I_MSK 0xffffff0f ++#define RG_PRE_DES_11B_DLY_SFT 4 ++#define RG_PRE_DES_11B_DLY_HI 7 ++#define RG_PRE_DES_11B_DLY_SZ 4 ++#define RG_CNT_CCA_LMT_MSK 0x000f0000 ++#define RG_CNT_CCA_LMT_I_MSK 0xfff0ffff ++#define RG_CNT_CCA_LMT_SFT 16 ++#define RG_CNT_CCA_LMT_HI 19 ++#define RG_CNT_CCA_LMT_SZ 4 ++#define RG_BYPASS_DESCRAMBLER_MSK 0x20000000 ++#define RG_BYPASS_DESCRAMBLER_I_MSK 0xdfffffff ++#define RG_BYPASS_DESCRAMBLER_SFT 29 ++#define RG_BYPASS_DESCRAMBLER_HI 29 ++#define RG_BYPASS_DESCRAMBLER_SZ 1 ++#define RG_BYPASS_AGC_MSK 0x80000000 ++#define RG_BYPASS_AGC_I_MSK 0x7fffffff ++#define RG_BYPASS_AGC_SFT 31 ++#define RG_BYPASS_AGC_HI 31 ++#define RG_BYPASS_AGC_SZ 1 ++#define RG_CCA_BIT_CNT_LMT_RX_MSK 0x000000f0 ++#define RG_CCA_BIT_CNT_LMT_RX_I_MSK 0xffffff0f ++#define RG_CCA_BIT_CNT_LMT_RX_SFT 4 ++#define RG_CCA_BIT_CNT_LMT_RX_HI 7 ++#define RG_CCA_BIT_CNT_LMT_RX_SZ 4 ++#define RG_CCA_SCALE_BF_MSK 0x007f0000 ++#define RG_CCA_SCALE_BF_I_MSK 0xff80ffff ++#define RG_CCA_SCALE_BF_SFT 16 ++#define RG_CCA_SCALE_BF_HI 22 ++#define RG_CCA_SCALE_BF_SZ 7 ++#define RG_PEAK_IDX_CNT_SEL_MSK 0x30000000 ++#define RG_PEAK_IDX_CNT_SEL_I_MSK 0xcfffffff ++#define RG_PEAK_IDX_CNT_SEL_SFT 28 ++#define RG_PEAK_IDX_CNT_SEL_HI 29 ++#define RG_PEAK_IDX_CNT_SEL_SZ 2 ++#define RG_TR_KI_T2_MSK 0x00000007 ++#define RG_TR_KI_T2_I_MSK 0xfffffff8 ++#define RG_TR_KI_T2_SFT 0 ++#define RG_TR_KI_T2_HI 2 ++#define RG_TR_KI_T2_SZ 3 ++#define RG_TR_KP_T2_MSK 0x00000070 ++#define RG_TR_KP_T2_I_MSK 0xffffff8f ++#define RG_TR_KP_T2_SFT 4 ++#define RG_TR_KP_T2_HI 6 ++#define RG_TR_KP_T2_SZ 3 ++#define RG_TR_KI_T1_MSK 0x00000700 ++#define RG_TR_KI_T1_I_MSK 0xfffff8ff ++#define RG_TR_KI_T1_SFT 8 ++#define RG_TR_KI_T1_HI 10 ++#define RG_TR_KI_T1_SZ 3 ++#define RG_TR_KP_T1_MSK 0x00007000 ++#define RG_TR_KP_T1_I_MSK 0xffff8fff ++#define RG_TR_KP_T1_SFT 12 ++#define RG_TR_KP_T1_HI 14 ++#define RG_TR_KP_T1_SZ 3 ++#define RG_CR_KI_T1_MSK 0x00070000 ++#define RG_CR_KI_T1_I_MSK 0xfff8ffff ++#define RG_CR_KI_T1_SFT 16 ++#define RG_CR_KI_T1_HI 18 ++#define RG_CR_KI_T1_SZ 3 ++#define RG_CR_KP_T1_MSK 0x00700000 ++#define RG_CR_KP_T1_I_MSK 0xff8fffff ++#define RG_CR_KP_T1_SFT 20 ++#define RG_CR_KP_T1_HI 22 ++#define RG_CR_KP_T1_SZ 3 ++#define RG_CHIP_CNT_SLICER_MSK 0x0000001f ++#define RG_CHIP_CNT_SLICER_I_MSK 0xffffffe0 ++#define RG_CHIP_CNT_SLICER_SFT 0 ++#define RG_CHIP_CNT_SLICER_HI 4 ++#define RG_CHIP_CNT_SLICER_SZ 5 ++#define RG_CE_T4_CNT_LMT_MSK 0x0000ff00 ++#define RG_CE_T4_CNT_LMT_I_MSK 0xffff00ff ++#define RG_CE_T4_CNT_LMT_SFT 8 ++#define RG_CE_T4_CNT_LMT_HI 15 ++#define RG_CE_T4_CNT_LMT_SZ 8 ++#define RG_CE_T3_CNT_LMT_MSK 0x00ff0000 ++#define RG_CE_T3_CNT_LMT_I_MSK 0xff00ffff ++#define RG_CE_T3_CNT_LMT_SFT 16 ++#define RG_CE_T3_CNT_LMT_HI 23 ++#define RG_CE_T3_CNT_LMT_SZ 8 ++#define RG_CE_T2_CNT_LMT_MSK 0xff000000 ++#define RG_CE_T2_CNT_LMT_I_MSK 0x00ffffff ++#define RG_CE_T2_CNT_LMT_SFT 24 ++#define RG_CE_T2_CNT_LMT_HI 31 ++#define RG_CE_T2_CNT_LMT_SZ 8 ++#define RG_CE_MU_T1_MSK 0x00000007 ++#define RG_CE_MU_T1_I_MSK 0xfffffff8 ++#define RG_CE_MU_T1_SFT 0 ++#define RG_CE_MU_T1_HI 2 ++#define RG_CE_MU_T1_SZ 3 ++#define RG_CE_DLY_SEL_MSK 0x003f0000 ++#define RG_CE_DLY_SEL_I_MSK 0xffc0ffff ++#define RG_CE_DLY_SEL_SFT 16 ++#define RG_CE_DLY_SEL_HI 21 ++#define RG_CE_DLY_SEL_SZ 6 ++#define RG_CE_MU_T8_MSK 0x00000007 ++#define RG_CE_MU_T8_I_MSK 0xfffffff8 ++#define RG_CE_MU_T8_SFT 0 ++#define RG_CE_MU_T8_HI 2 ++#define RG_CE_MU_T8_SZ 3 ++#define RG_CE_MU_T7_MSK 0x00000070 ++#define RG_CE_MU_T7_I_MSK 0xffffff8f ++#define RG_CE_MU_T7_SFT 4 ++#define RG_CE_MU_T7_HI 6 ++#define RG_CE_MU_T7_SZ 3 ++#define RG_CE_MU_T6_MSK 0x00000700 ++#define RG_CE_MU_T6_I_MSK 0xfffff8ff ++#define RG_CE_MU_T6_SFT 8 ++#define RG_CE_MU_T6_HI 10 ++#define RG_CE_MU_T6_SZ 3 ++#define RG_CE_MU_T5_MSK 0x00007000 ++#define RG_CE_MU_T5_I_MSK 0xffff8fff ++#define RG_CE_MU_T5_SFT 12 ++#define RG_CE_MU_T5_HI 14 ++#define RG_CE_MU_T5_SZ 3 ++#define RG_CE_MU_T4_MSK 0x00070000 ++#define RG_CE_MU_T4_I_MSK 0xfff8ffff ++#define RG_CE_MU_T4_SFT 16 ++#define RG_CE_MU_T4_HI 18 ++#define RG_CE_MU_T4_SZ 3 ++#define RG_CE_MU_T3_MSK 0x00700000 ++#define RG_CE_MU_T3_I_MSK 0xff8fffff ++#define RG_CE_MU_T3_SFT 20 ++#define RG_CE_MU_T3_HI 22 ++#define RG_CE_MU_T3_SZ 3 ++#define RG_CE_MU_T2_MSK 0x07000000 ++#define RG_CE_MU_T2_I_MSK 0xf8ffffff ++#define RG_CE_MU_T2_SFT 24 ++#define RG_CE_MU_T2_HI 26 ++#define RG_CE_MU_T2_SZ 3 ++#define RG_EQ_MU_FB_T2_MSK 0x0000000f ++#define RG_EQ_MU_FB_T2_I_MSK 0xfffffff0 ++#define RG_EQ_MU_FB_T2_SFT 0 ++#define RG_EQ_MU_FB_T2_HI 3 ++#define RG_EQ_MU_FB_T2_SZ 4 ++#define RG_EQ_MU_FF_T2_MSK 0x000000f0 ++#define RG_EQ_MU_FF_T2_I_MSK 0xffffff0f ++#define RG_EQ_MU_FF_T2_SFT 4 ++#define RG_EQ_MU_FF_T2_HI 7 ++#define RG_EQ_MU_FF_T2_SZ 4 ++#define RG_EQ_MU_FB_T1_MSK 0x000f0000 ++#define RG_EQ_MU_FB_T1_I_MSK 0xfff0ffff ++#define RG_EQ_MU_FB_T1_SFT 16 ++#define RG_EQ_MU_FB_T1_HI 19 ++#define RG_EQ_MU_FB_T1_SZ 4 ++#define RG_EQ_MU_FF_T1_MSK 0x00f00000 ++#define RG_EQ_MU_FF_T1_I_MSK 0xff0fffff ++#define RG_EQ_MU_FF_T1_SFT 20 ++#define RG_EQ_MU_FF_T1_HI 23 ++#define RG_EQ_MU_FF_T1_SZ 4 ++#define RG_EQ_MU_FB_T4_MSK 0x0000000f ++#define RG_EQ_MU_FB_T4_I_MSK 0xfffffff0 ++#define RG_EQ_MU_FB_T4_SFT 0 ++#define RG_EQ_MU_FB_T4_HI 3 ++#define RG_EQ_MU_FB_T4_SZ 4 ++#define RG_EQ_MU_FF_T4_MSK 0x000000f0 ++#define RG_EQ_MU_FF_T4_I_MSK 0xffffff0f ++#define RG_EQ_MU_FF_T4_SFT 4 ++#define RG_EQ_MU_FF_T4_HI 7 ++#define RG_EQ_MU_FF_T4_SZ 4 ++#define RG_EQ_MU_FB_T3_MSK 0x000f0000 ++#define RG_EQ_MU_FB_T3_I_MSK 0xfff0ffff ++#define RG_EQ_MU_FB_T3_SFT 16 ++#define RG_EQ_MU_FB_T3_HI 19 ++#define RG_EQ_MU_FB_T3_SZ 4 ++#define RG_EQ_MU_FF_T3_MSK 0x00f00000 ++#define RG_EQ_MU_FF_T3_I_MSK 0xff0fffff ++#define RG_EQ_MU_FF_T3_SFT 20 ++#define RG_EQ_MU_FF_T3_HI 23 ++#define RG_EQ_MU_FF_T3_SZ 4 ++#define RG_EQ_KI_T2_MSK 0x00000700 ++#define RG_EQ_KI_T2_I_MSK 0xfffff8ff ++#define RG_EQ_KI_T2_SFT 8 ++#define RG_EQ_KI_T2_HI 10 ++#define RG_EQ_KI_T2_SZ 3 ++#define RG_EQ_KP_T2_MSK 0x00007000 ++#define RG_EQ_KP_T2_I_MSK 0xffff8fff ++#define RG_EQ_KP_T2_SFT 12 ++#define RG_EQ_KP_T2_HI 14 ++#define RG_EQ_KP_T2_SZ 3 ++#define RG_EQ_KI_T1_MSK 0x00070000 ++#define RG_EQ_KI_T1_I_MSK 0xfff8ffff ++#define RG_EQ_KI_T1_SFT 16 ++#define RG_EQ_KI_T1_HI 18 ++#define RG_EQ_KI_T1_SZ 3 ++#define RG_EQ_KP_T1_MSK 0x00700000 ++#define RG_EQ_KP_T1_I_MSK 0xff8fffff ++#define RG_EQ_KP_T1_SFT 20 ++#define RG_EQ_KP_T1_HI 22 ++#define RG_EQ_KP_T1_SZ 3 ++#define RG_TR_LPF_RATE_MSK 0x003fffff ++#define RG_TR_LPF_RATE_I_MSK 0xffc00000 ++#define RG_TR_LPF_RATE_SFT 0 ++#define RG_TR_LPF_RATE_HI 21 ++#define RG_TR_LPF_RATE_SZ 22 ++#define RG_CE_BIT_CNT_LMT_MSK 0x0000007f ++#define RG_CE_BIT_CNT_LMT_I_MSK 0xffffff80 ++#define RG_CE_BIT_CNT_LMT_SFT 0 ++#define RG_CE_BIT_CNT_LMT_HI 6 ++#define RG_CE_BIT_CNT_LMT_SZ 7 ++#define RG_CE_CH_MAIN_SET_MSK 0x00000080 ++#define RG_CE_CH_MAIN_SET_I_MSK 0xffffff7f ++#define RG_CE_CH_MAIN_SET_SFT 7 ++#define RG_CE_CH_MAIN_SET_HI 7 ++#define RG_CE_CH_MAIN_SET_SZ 1 ++#define RG_TC_BIT_CNT_LMT_MSK 0x00007f00 ++#define RG_TC_BIT_CNT_LMT_I_MSK 0xffff80ff ++#define RG_TC_BIT_CNT_LMT_SFT 8 ++#define RG_TC_BIT_CNT_LMT_HI 14 ++#define RG_TC_BIT_CNT_LMT_SZ 7 ++#define RG_CR_BIT_CNT_LMT_MSK 0x007f0000 ++#define RG_CR_BIT_CNT_LMT_I_MSK 0xff80ffff ++#define RG_CR_BIT_CNT_LMT_SFT 16 ++#define RG_CR_BIT_CNT_LMT_HI 22 ++#define RG_CR_BIT_CNT_LMT_SZ 7 ++#define RG_TR_BIT_CNT_LMT_MSK 0x7f000000 ++#define RG_TR_BIT_CNT_LMT_I_MSK 0x80ffffff ++#define RG_TR_BIT_CNT_LMT_SFT 24 ++#define RG_TR_BIT_CNT_LMT_HI 30 ++#define RG_TR_BIT_CNT_LMT_SZ 7 ++#define RG_EQ_MAIN_TAP_MAN_MSK 0x00000001 ++#define RG_EQ_MAIN_TAP_MAN_I_MSK 0xfffffffe ++#define RG_EQ_MAIN_TAP_MAN_SFT 0 ++#define RG_EQ_MAIN_TAP_MAN_HI 0 ++#define RG_EQ_MAIN_TAP_MAN_SZ 1 ++#define RG_EQ_MAIN_TAP_COEF_MSK 0x07ff0000 ++#define RG_EQ_MAIN_TAP_COEF_I_MSK 0xf800ffff ++#define RG_EQ_MAIN_TAP_COEF_SFT 16 ++#define RG_EQ_MAIN_TAP_COEF_HI 26 ++#define RG_EQ_MAIN_TAP_COEF_SZ 11 ++#define RG_PWRON_DLY_TH_11B_MSK 0x000000ff ++#define RG_PWRON_DLY_TH_11B_I_MSK 0xffffff00 ++#define RG_PWRON_DLY_TH_11B_SFT 0 ++#define RG_PWRON_DLY_TH_11B_HI 7 ++#define RG_PWRON_DLY_TH_11B_SZ 8 ++#define RG_SFD_BIT_CNT_LMT_MSK 0x00ff0000 ++#define RG_SFD_BIT_CNT_LMT_I_MSK 0xff00ffff ++#define RG_SFD_BIT_CNT_LMT_SFT 16 ++#define RG_SFD_BIT_CNT_LMT_HI 23 ++#define RG_SFD_BIT_CNT_LMT_SZ 8 ++#define RG_CCA_PWR_TH_RX_MSK 0x00007fff ++#define RG_CCA_PWR_TH_RX_I_MSK 0xffff8000 ++#define RG_CCA_PWR_TH_RX_SFT 0 ++#define RG_CCA_PWR_TH_RX_HI 14 ++#define RG_CCA_PWR_TH_RX_SZ 15 ++#define RG_CCA_PWR_CNT_TH_MSK 0x001f0000 ++#define RG_CCA_PWR_CNT_TH_I_MSK 0xffe0ffff ++#define RG_CCA_PWR_CNT_TH_SFT 16 ++#define RG_CCA_PWR_CNT_TH_HI 20 ++#define RG_CCA_PWR_CNT_TH_SZ 5 ++#define B_FREQ_OS_MSK 0x000007ff ++#define B_FREQ_OS_I_MSK 0xfffff800 ++#define B_FREQ_OS_SFT 0 ++#define B_FREQ_OS_HI 10 ++#define B_FREQ_OS_SZ 11 ++#define B_SNR_MSK 0x0000007f ++#define B_SNR_I_MSK 0xffffff80 ++#define B_SNR_SFT 0 ++#define B_SNR_HI 6 ++#define B_SNR_SZ 7 ++#define B_RCPI_MSK 0x007f0000 ++#define B_RCPI_I_MSK 0xff80ffff ++#define B_RCPI_SFT 16 ++#define B_RCPI_HI 22 ++#define B_RCPI_SZ 7 ++#define CRC_CNT_MSK 0x0000ffff ++#define CRC_CNT_I_MSK 0xffff0000 ++#define CRC_CNT_SFT 0 ++#define CRC_CNT_HI 15 ++#define CRC_CNT_SZ 16 ++#define SFD_CNT_MSK 0xffff0000 ++#define SFD_CNT_I_MSK 0x0000ffff ++#define SFD_CNT_SFT 16 ++#define SFD_CNT_HI 31 ++#define SFD_CNT_SZ 16 ++#define B_PACKET_ERR_CNT_MSK 0x0000ffff ++#define B_PACKET_ERR_CNT_I_MSK 0xffff0000 ++#define B_PACKET_ERR_CNT_SFT 0 ++#define B_PACKET_ERR_CNT_HI 15 ++#define B_PACKET_ERR_CNT_SZ 16 ++#define PACKET_ERR_MSK 0x00010000 ++#define PACKET_ERR_I_MSK 0xfffeffff ++#define PACKET_ERR_SFT 16 ++#define PACKET_ERR_HI 16 ++#define PACKET_ERR_SZ 1 ++#define B_PACKET_CNT_MSK 0x0000ffff ++#define B_PACKET_CNT_I_MSK 0xffff0000 ++#define B_PACKET_CNT_SFT 0 ++#define B_PACKET_CNT_HI 15 ++#define B_PACKET_CNT_SZ 16 ++#define B_CCA_CNT_MSK 0xffff0000 ++#define B_CCA_CNT_I_MSK 0x0000ffff ++#define B_CCA_CNT_SFT 16 ++#define B_CCA_CNT_HI 31 ++#define B_CCA_CNT_SZ 16 ++#define B_LENGTH_FIELD_MSK 0x0000ffff ++#define B_LENGTH_FIELD_I_MSK 0xffff0000 ++#define B_LENGTH_FIELD_SFT 0 ++#define B_LENGTH_FIELD_HI 15 ++#define B_LENGTH_FIELD_SZ 16 ++#define SFD_FIELD_MSK 0xffff0000 ++#define SFD_FIELD_I_MSK 0x0000ffff ++#define SFD_FIELD_SFT 16 ++#define SFD_FIELD_HI 31 ++#define SFD_FIELD_SZ 16 ++#define SIGNAL_FIELD_MSK 0x000000ff ++#define SIGNAL_FIELD_I_MSK 0xffffff00 ++#define SIGNAL_FIELD_SFT 0 ++#define SIGNAL_FIELD_HI 7 ++#define SIGNAL_FIELD_SZ 8 ++#define B_SERVICE_FIELD_MSK 0x0000ff00 ++#define B_SERVICE_FIELD_I_MSK 0xffff00ff ++#define B_SERVICE_FIELD_SFT 8 ++#define B_SERVICE_FIELD_HI 15 ++#define B_SERVICE_FIELD_SZ 8 ++#define CRC_CORRECT_MSK 0x00010000 ++#define CRC_CORRECT_I_MSK 0xfffeffff ++#define CRC_CORRECT_SFT 16 ++#define CRC_CORRECT_HI 16 ++#define CRC_CORRECT_SZ 1 ++#define DEBUG_SEL_MSK 0x0000000f ++#define DEBUG_SEL_I_MSK 0xfffffff0 ++#define DEBUG_SEL_SFT 0 ++#define DEBUG_SEL_HI 3 ++#define DEBUG_SEL_SZ 4 ++#define RG_PACKET_STAT_EN_11B_MSK 0x00100000 ++#define RG_PACKET_STAT_EN_11B_I_MSK 0xffefffff ++#define RG_PACKET_STAT_EN_11B_SFT 20 ++#define RG_PACKET_STAT_EN_11B_HI 20 ++#define RG_PACKET_STAT_EN_11B_SZ 1 ++#define RG_BIT_REVERSE_MSK 0x00200000 ++#define RG_BIT_REVERSE_I_MSK 0xffdfffff ++#define RG_BIT_REVERSE_SFT 21 ++#define RG_BIT_REVERSE_HI 21 ++#define RG_BIT_REVERSE_SZ 1 ++#define RX_PHY_11B_SOFT_RST_N_MSK 0x00000001 ++#define RX_PHY_11B_SOFT_RST_N_I_MSK 0xfffffffe ++#define RX_PHY_11B_SOFT_RST_N_SFT 0 ++#define RX_PHY_11B_SOFT_RST_N_HI 0 ++#define RX_PHY_11B_SOFT_RST_N_SZ 1 ++#define RG_CE_BYPASS_TAP_MSK 0x000000f0 ++#define RG_CE_BYPASS_TAP_I_MSK 0xffffff0f ++#define RG_CE_BYPASS_TAP_SFT 4 ++#define RG_CE_BYPASS_TAP_HI 7 ++#define RG_CE_BYPASS_TAP_SZ 4 ++#define RG_EQ_BYPASS_FBW_TAP_MSK 0x00000f00 ++#define RG_EQ_BYPASS_FBW_TAP_I_MSK 0xfffff0ff ++#define RG_EQ_BYPASS_FBW_TAP_SFT 8 ++#define RG_EQ_BYPASS_FBW_TAP_HI 11 ++#define RG_EQ_BYPASS_FBW_TAP_SZ 4 ++#define RG_BB_11GN_RISE_TIME_MSK 0x000000ff ++#define RG_BB_11GN_RISE_TIME_I_MSK 0xffffff00 ++#define RG_BB_11GN_RISE_TIME_SFT 0 ++#define RG_BB_11GN_RISE_TIME_HI 7 ++#define RG_BB_11GN_RISE_TIME_SZ 8 ++#define RG_BB_11GN_FALL_TIME_MSK 0x0000ff00 ++#define RG_BB_11GN_FALL_TIME_I_MSK 0xffff00ff ++#define RG_BB_11GN_FALL_TIME_SFT 8 ++#define RG_BB_11GN_FALL_TIME_HI 15 ++#define RG_BB_11GN_FALL_TIME_SZ 8 ++#define RG_HTCARR52_FFT_SCALE_MSK 0x000003ff ++#define RG_HTCARR52_FFT_SCALE_I_MSK 0xfffffc00 ++#define RG_HTCARR52_FFT_SCALE_SFT 0 ++#define RG_HTCARR52_FFT_SCALE_HI 9 ++#define RG_HTCARR52_FFT_SCALE_SZ 10 ++#define RG_HTCARR56_FFT_SCALE_MSK 0x003ff000 ++#define RG_HTCARR56_FFT_SCALE_I_MSK 0xffc00fff ++#define RG_HTCARR56_FFT_SCALE_SFT 12 ++#define RG_HTCARR56_FFT_SCALE_HI 21 ++#define RG_HTCARR56_FFT_SCALE_SZ 10 ++#define RG_PACKET_STAT_EN_MSK 0x00800000 ++#define RG_PACKET_STAT_EN_I_MSK 0xff7fffff ++#define RG_PACKET_STAT_EN_SFT 23 ++#define RG_PACKET_STAT_EN_HI 23 ++#define RG_PACKET_STAT_EN_SZ 1 ++#define RG_SMB_DEF_MSK 0x7f000000 ++#define RG_SMB_DEF_I_MSK 0x80ffffff ++#define RG_SMB_DEF_SFT 24 ++#define RG_SMB_DEF_HI 30 ++#define RG_SMB_DEF_SZ 7 ++#define RG_CONTINUOUS_DATA_11GN_MSK 0x80000000 ++#define RG_CONTINUOUS_DATA_11GN_I_MSK 0x7fffffff ++#define RG_CONTINUOUS_DATA_11GN_SFT 31 ++#define RG_CONTINUOUS_DATA_11GN_HI 31 ++#define RG_CONTINUOUS_DATA_11GN_SZ 1 ++#define RO_TX_CNT_R_MSK 0xffffffff ++#define RO_TX_CNT_R_I_MSK 0x00000000 ++#define RO_TX_CNT_R_SFT 0 ++#define RO_TX_CNT_R_HI 31 ++#define RO_TX_CNT_R_SZ 32 ++#define RO_PACKET_ERR_CNT_MSK 0x0000ffff ++#define RO_PACKET_ERR_CNT_I_MSK 0xffff0000 ++#define RO_PACKET_ERR_CNT_SFT 0 ++#define RO_PACKET_ERR_CNT_HI 15 ++#define RO_PACKET_ERR_CNT_SZ 16 ++#define RG_POS_DES_11GN_L_EXT_MSK 0x0000000f ++#define RG_POS_DES_11GN_L_EXT_I_MSK 0xfffffff0 ++#define RG_POS_DES_11GN_L_EXT_SFT 0 ++#define RG_POS_DES_11GN_L_EXT_HI 3 ++#define RG_POS_DES_11GN_L_EXT_SZ 4 ++#define RG_PRE_DES_11GN_DLY_MSK 0x000000f0 ++#define RG_PRE_DES_11GN_DLY_I_MSK 0xffffff0f ++#define RG_PRE_DES_11GN_DLY_SFT 4 ++#define RG_PRE_DES_11GN_DLY_HI 7 ++#define RG_PRE_DES_11GN_DLY_SZ 4 ++#define RG_TR_LPF_KI_G_T1_MSK 0x0000000f ++#define RG_TR_LPF_KI_G_T1_I_MSK 0xfffffff0 ++#define RG_TR_LPF_KI_G_T1_SFT 0 ++#define RG_TR_LPF_KI_G_T1_HI 3 ++#define RG_TR_LPF_KI_G_T1_SZ 4 ++#define RG_TR_LPF_KP_G_T1_MSK 0x000000f0 ++#define RG_TR_LPF_KP_G_T1_I_MSK 0xffffff0f ++#define RG_TR_LPF_KP_G_T1_SFT 4 ++#define RG_TR_LPF_KP_G_T1_HI 7 ++#define RG_TR_LPF_KP_G_T1_SZ 4 ++#define RG_TR_CNT_T1_MSK 0x0000ff00 ++#define RG_TR_CNT_T1_I_MSK 0xffff00ff ++#define RG_TR_CNT_T1_SFT 8 ++#define RG_TR_CNT_T1_HI 15 ++#define RG_TR_CNT_T1_SZ 8 ++#define RG_TR_LPF_KI_G_T0_MSK 0x000f0000 ++#define RG_TR_LPF_KI_G_T0_I_MSK 0xfff0ffff ++#define RG_TR_LPF_KI_G_T0_SFT 16 ++#define RG_TR_LPF_KI_G_T0_HI 19 ++#define RG_TR_LPF_KI_G_T0_SZ 4 ++#define RG_TR_LPF_KP_G_T0_MSK 0x00f00000 ++#define RG_TR_LPF_KP_G_T0_I_MSK 0xff0fffff ++#define RG_TR_LPF_KP_G_T0_SFT 20 ++#define RG_TR_LPF_KP_G_T0_HI 23 ++#define RG_TR_LPF_KP_G_T0_SZ 4 ++#define RG_TR_CNT_T0_MSK 0xff000000 ++#define RG_TR_CNT_T0_I_MSK 0x00ffffff ++#define RG_TR_CNT_T0_SFT 24 ++#define RG_TR_CNT_T0_HI 31 ++#define RG_TR_CNT_T0_SZ 8 ++#define RG_TR_LPF_KI_G_T2_MSK 0x0000000f ++#define RG_TR_LPF_KI_G_T2_I_MSK 0xfffffff0 ++#define RG_TR_LPF_KI_G_T2_SFT 0 ++#define RG_TR_LPF_KI_G_T2_HI 3 ++#define RG_TR_LPF_KI_G_T2_SZ 4 ++#define RG_TR_LPF_KP_G_T2_MSK 0x000000f0 ++#define RG_TR_LPF_KP_G_T2_I_MSK 0xffffff0f ++#define RG_TR_LPF_KP_G_T2_SFT 4 ++#define RG_TR_LPF_KP_G_T2_HI 7 ++#define RG_TR_LPF_KP_G_T2_SZ 4 ++#define RG_TR_CNT_T2_MSK 0x0000ff00 ++#define RG_TR_CNT_T2_I_MSK 0xffff00ff ++#define RG_TR_CNT_T2_SFT 8 ++#define RG_TR_CNT_T2_HI 15 ++#define RG_TR_CNT_T2_SZ 8 ++#define RG_TR_LPF_KI_G_MSK 0x0000000f ++#define RG_TR_LPF_KI_G_I_MSK 0xfffffff0 ++#define RG_TR_LPF_KI_G_SFT 0 ++#define RG_TR_LPF_KI_G_HI 3 ++#define RG_TR_LPF_KI_G_SZ 4 ++#define RG_TR_LPF_KP_G_MSK 0x000000f0 ++#define RG_TR_LPF_KP_G_I_MSK 0xffffff0f ++#define RG_TR_LPF_KP_G_SFT 4 ++#define RG_TR_LPF_KP_G_HI 7 ++#define RG_TR_LPF_KP_G_SZ 4 ++#define RG_TR_LPF_RATE_G_MSK 0x3fffff00 ++#define RG_TR_LPF_RATE_G_I_MSK 0xc00000ff ++#define RG_TR_LPF_RATE_G_SFT 8 ++#define RG_TR_LPF_RATE_G_HI 29 ++#define RG_TR_LPF_RATE_G_SZ 22 ++#define RG_CR_LPF_KI_G_MSK 0x00000007 ++#define RG_CR_LPF_KI_G_I_MSK 0xfffffff8 ++#define RG_CR_LPF_KI_G_SFT 0 ++#define RG_CR_LPF_KI_G_HI 2 ++#define RG_CR_LPF_KI_G_SZ 3 ++#define RG_SYM_BOUND_CNT_MSK 0x00007f00 ++#define RG_SYM_BOUND_CNT_I_MSK 0xffff80ff ++#define RG_SYM_BOUND_CNT_SFT 8 ++#define RG_SYM_BOUND_CNT_HI 14 ++#define RG_SYM_BOUND_CNT_SZ 7 ++#define RG_XSCOR32_RATIO_MSK 0x007f0000 ++#define RG_XSCOR32_RATIO_I_MSK 0xff80ffff ++#define RG_XSCOR32_RATIO_SFT 16 ++#define RG_XSCOR32_RATIO_HI 22 ++#define RG_XSCOR32_RATIO_SZ 7 ++#define RG_ATCOR64_CNT_LMT_MSK 0x7f000000 ++#define RG_ATCOR64_CNT_LMT_I_MSK 0x80ffffff ++#define RG_ATCOR64_CNT_LMT_SFT 24 ++#define RG_ATCOR64_CNT_LMT_HI 30 ++#define RG_ATCOR64_CNT_LMT_SZ 7 ++#define RG_ATCOR16_CNT_LMT2_MSK 0x00007f00 ++#define RG_ATCOR16_CNT_LMT2_I_MSK 0xffff80ff ++#define RG_ATCOR16_CNT_LMT2_SFT 8 ++#define RG_ATCOR16_CNT_LMT2_HI 14 ++#define RG_ATCOR16_CNT_LMT2_SZ 7 ++#define RG_ATCOR16_CNT_LMT1_MSK 0x007f0000 ++#define RG_ATCOR16_CNT_LMT1_I_MSK 0xff80ffff ++#define RG_ATCOR16_CNT_LMT1_SFT 16 ++#define RG_ATCOR16_CNT_LMT1_HI 22 ++#define RG_ATCOR16_CNT_LMT1_SZ 7 ++#define RG_ATCOR16_RATIO_SB_MSK 0x7f000000 ++#define RG_ATCOR16_RATIO_SB_I_MSK 0x80ffffff ++#define RG_ATCOR16_RATIO_SB_SFT 24 ++#define RG_ATCOR16_RATIO_SB_HI 30 ++#define RG_ATCOR16_RATIO_SB_SZ 7 ++#define RG_XSCOR64_CNT_LMT2_MSK 0x007f0000 ++#define RG_XSCOR64_CNT_LMT2_I_MSK 0xff80ffff ++#define RG_XSCOR64_CNT_LMT2_SFT 16 ++#define RG_XSCOR64_CNT_LMT2_HI 22 ++#define RG_XSCOR64_CNT_LMT2_SZ 7 ++#define RG_XSCOR64_CNT_LMT1_MSK 0x7f000000 ++#define RG_XSCOR64_CNT_LMT1_I_MSK 0x80ffffff ++#define RG_XSCOR64_CNT_LMT1_SFT 24 ++#define RG_XSCOR64_CNT_LMT1_HI 30 ++#define RG_XSCOR64_CNT_LMT1_SZ 7 ++#define RG_RX_FFT_SCALE_MSK 0x000003ff ++#define RG_RX_FFT_SCALE_I_MSK 0xfffffc00 ++#define RG_RX_FFT_SCALE_SFT 0 ++#define RG_RX_FFT_SCALE_HI 9 ++#define RG_RX_FFT_SCALE_SZ 10 ++#define RG_VITERBI_AB_SWAP_MSK 0x00010000 ++#define RG_VITERBI_AB_SWAP_I_MSK 0xfffeffff ++#define RG_VITERBI_AB_SWAP_SFT 16 ++#define RG_VITERBI_AB_SWAP_HI 16 ++#define RG_VITERBI_AB_SWAP_SZ 1 ++#define RG_ATCOR16_CNT_TH_MSK 0x0f000000 ++#define RG_ATCOR16_CNT_TH_I_MSK 0xf0ffffff ++#define RG_ATCOR16_CNT_TH_SFT 24 ++#define RG_ATCOR16_CNT_TH_HI 27 ++#define RG_ATCOR16_CNT_TH_SZ 4 ++#define RG_NORMSQUARE_LOW_SNR_7_MSK 0x000000ff ++#define RG_NORMSQUARE_LOW_SNR_7_I_MSK 0xffffff00 ++#define RG_NORMSQUARE_LOW_SNR_7_SFT 0 ++#define RG_NORMSQUARE_LOW_SNR_7_HI 7 ++#define RG_NORMSQUARE_LOW_SNR_7_SZ 8 ++#define RG_NORMSQUARE_LOW_SNR_6_MSK 0x0000ff00 ++#define RG_NORMSQUARE_LOW_SNR_6_I_MSK 0xffff00ff ++#define RG_NORMSQUARE_LOW_SNR_6_SFT 8 ++#define RG_NORMSQUARE_LOW_SNR_6_HI 15 ++#define RG_NORMSQUARE_LOW_SNR_6_SZ 8 ++#define RG_NORMSQUARE_LOW_SNR_5_MSK 0x00ff0000 ++#define RG_NORMSQUARE_LOW_SNR_5_I_MSK 0xff00ffff ++#define RG_NORMSQUARE_LOW_SNR_5_SFT 16 ++#define RG_NORMSQUARE_LOW_SNR_5_HI 23 ++#define RG_NORMSQUARE_LOW_SNR_5_SZ 8 ++#define RG_NORMSQUARE_LOW_SNR_4_MSK 0xff000000 ++#define RG_NORMSQUARE_LOW_SNR_4_I_MSK 0x00ffffff ++#define RG_NORMSQUARE_LOW_SNR_4_SFT 24 ++#define RG_NORMSQUARE_LOW_SNR_4_HI 31 ++#define RG_NORMSQUARE_LOW_SNR_4_SZ 8 ++#define RG_NORMSQUARE_LOW_SNR_8_MSK 0xff000000 ++#define RG_NORMSQUARE_LOW_SNR_8_I_MSK 0x00ffffff ++#define RG_NORMSQUARE_LOW_SNR_8_SFT 24 ++#define RG_NORMSQUARE_LOW_SNR_8_HI 31 ++#define RG_NORMSQUARE_LOW_SNR_8_SZ 8 ++#define RG_NORMSQUARE_SNR_3_MSK 0x000000ff ++#define RG_NORMSQUARE_SNR_3_I_MSK 0xffffff00 ++#define RG_NORMSQUARE_SNR_3_SFT 0 ++#define RG_NORMSQUARE_SNR_3_HI 7 ++#define RG_NORMSQUARE_SNR_3_SZ 8 ++#define RG_NORMSQUARE_SNR_2_MSK 0x0000ff00 ++#define RG_NORMSQUARE_SNR_2_I_MSK 0xffff00ff ++#define RG_NORMSQUARE_SNR_2_SFT 8 ++#define RG_NORMSQUARE_SNR_2_HI 15 ++#define RG_NORMSQUARE_SNR_2_SZ 8 ++#define RG_NORMSQUARE_SNR_1_MSK 0x00ff0000 ++#define RG_NORMSQUARE_SNR_1_I_MSK 0xff00ffff ++#define RG_NORMSQUARE_SNR_1_SFT 16 ++#define RG_NORMSQUARE_SNR_1_HI 23 ++#define RG_NORMSQUARE_SNR_1_SZ 8 ++#define RG_NORMSQUARE_SNR_0_MSK 0xff000000 ++#define RG_NORMSQUARE_SNR_0_I_MSK 0x00ffffff ++#define RG_NORMSQUARE_SNR_0_SFT 24 ++#define RG_NORMSQUARE_SNR_0_HI 31 ++#define RG_NORMSQUARE_SNR_0_SZ 8 ++#define RG_NORMSQUARE_SNR_7_MSK 0x000000ff ++#define RG_NORMSQUARE_SNR_7_I_MSK 0xffffff00 ++#define RG_NORMSQUARE_SNR_7_SFT 0 ++#define RG_NORMSQUARE_SNR_7_HI 7 ++#define RG_NORMSQUARE_SNR_7_SZ 8 ++#define RG_NORMSQUARE_SNR_6_MSK 0x0000ff00 ++#define RG_NORMSQUARE_SNR_6_I_MSK 0xffff00ff ++#define RG_NORMSQUARE_SNR_6_SFT 8 ++#define RG_NORMSQUARE_SNR_6_HI 15 ++#define RG_NORMSQUARE_SNR_6_SZ 8 ++#define RG_NORMSQUARE_SNR_5_MSK 0x00ff0000 ++#define RG_NORMSQUARE_SNR_5_I_MSK 0xff00ffff ++#define RG_NORMSQUARE_SNR_5_SFT 16 ++#define RG_NORMSQUARE_SNR_5_HI 23 ++#define RG_NORMSQUARE_SNR_5_SZ 8 ++#define RG_NORMSQUARE_SNR_4_MSK 0xff000000 ++#define RG_NORMSQUARE_SNR_4_I_MSK 0x00ffffff ++#define RG_NORMSQUARE_SNR_4_SFT 24 ++#define RG_NORMSQUARE_SNR_4_HI 31 ++#define RG_NORMSQUARE_SNR_4_SZ 8 ++#define RG_NORMSQUARE_SNR_8_MSK 0xff000000 ++#define RG_NORMSQUARE_SNR_8_I_MSK 0x00ffffff ++#define RG_NORMSQUARE_SNR_8_SFT 24 ++#define RG_NORMSQUARE_SNR_8_HI 31 ++#define RG_NORMSQUARE_SNR_8_SZ 8 ++#define RG_SNR_TH_64QAM_MSK 0x0000007f ++#define RG_SNR_TH_64QAM_I_MSK 0xffffff80 ++#define RG_SNR_TH_64QAM_SFT 0 ++#define RG_SNR_TH_64QAM_HI 6 ++#define RG_SNR_TH_64QAM_SZ 7 ++#define RG_SNR_TH_16QAM_MSK 0x00007f00 ++#define RG_SNR_TH_16QAM_I_MSK 0xffff80ff ++#define RG_SNR_TH_16QAM_SFT 8 ++#define RG_SNR_TH_16QAM_HI 14 ++#define RG_SNR_TH_16QAM_SZ 7 ++#define RG_ATCOR16_CNT_PLUS_LMT2_MSK 0x0000007f ++#define RG_ATCOR16_CNT_PLUS_LMT2_I_MSK 0xffffff80 ++#define RG_ATCOR16_CNT_PLUS_LMT2_SFT 0 ++#define RG_ATCOR16_CNT_PLUS_LMT2_HI 6 ++#define RG_ATCOR16_CNT_PLUS_LMT2_SZ 7 ++#define RG_ATCOR16_CNT_PLUS_LMT1_MSK 0x00007f00 ++#define RG_ATCOR16_CNT_PLUS_LMT1_I_MSK 0xffff80ff ++#define RG_ATCOR16_CNT_PLUS_LMT1_SFT 8 ++#define RG_ATCOR16_CNT_PLUS_LMT1_HI 14 ++#define RG_ATCOR16_CNT_PLUS_LMT1_SZ 7 ++#define RG_SYM_BOUND_METHOD_MSK 0x00030000 ++#define RG_SYM_BOUND_METHOD_I_MSK 0xfffcffff ++#define RG_SYM_BOUND_METHOD_SFT 16 ++#define RG_SYM_BOUND_METHOD_HI 17 ++#define RG_SYM_BOUND_METHOD_SZ 2 ++#define RG_PWRON_DLY_TH_11GN_MSK 0x000000ff ++#define RG_PWRON_DLY_TH_11GN_I_MSK 0xffffff00 ++#define RG_PWRON_DLY_TH_11GN_SFT 0 ++#define RG_PWRON_DLY_TH_11GN_HI 7 ++#define RG_PWRON_DLY_TH_11GN_SZ 8 ++#define RG_SB_START_CNT_MSK 0x00007f00 ++#define RG_SB_START_CNT_I_MSK 0xffff80ff ++#define RG_SB_START_CNT_SFT 8 ++#define RG_SB_START_CNT_HI 14 ++#define RG_SB_START_CNT_SZ 7 ++#define RG_POW16_CNT_TH_MSK 0x000000f0 ++#define RG_POW16_CNT_TH_I_MSK 0xffffff0f ++#define RG_POW16_CNT_TH_SFT 4 ++#define RG_POW16_CNT_TH_HI 7 ++#define RG_POW16_CNT_TH_SZ 4 ++#define RG_POW16_SHORT_CNT_LMT_MSK 0x00000700 ++#define RG_POW16_SHORT_CNT_LMT_I_MSK 0xfffff8ff ++#define RG_POW16_SHORT_CNT_LMT_SFT 8 ++#define RG_POW16_SHORT_CNT_LMT_HI 10 ++#define RG_POW16_SHORT_CNT_LMT_SZ 3 ++#define RG_POW16_TH_L_MSK 0x7f000000 ++#define RG_POW16_TH_L_I_MSK 0x80ffffff ++#define RG_POW16_TH_L_SFT 24 ++#define RG_POW16_TH_L_HI 30 ++#define RG_POW16_TH_L_SZ 7 ++#define RG_XSCOR16_SHORT_CNT_LMT_MSK 0x00000007 ++#define RG_XSCOR16_SHORT_CNT_LMT_I_MSK 0xfffffff8 ++#define RG_XSCOR16_SHORT_CNT_LMT_SFT 0 ++#define RG_XSCOR16_SHORT_CNT_LMT_HI 2 ++#define RG_XSCOR16_SHORT_CNT_LMT_SZ 3 ++#define RG_XSCOR16_RATIO_MSK 0x00007f00 ++#define RG_XSCOR16_RATIO_I_MSK 0xffff80ff ++#define RG_XSCOR16_RATIO_SFT 8 ++#define RG_XSCOR16_RATIO_HI 14 ++#define RG_XSCOR16_RATIO_SZ 7 ++#define RG_ATCOR16_SHORT_CNT_LMT_MSK 0x00070000 ++#define RG_ATCOR16_SHORT_CNT_LMT_I_MSK 0xfff8ffff ++#define RG_ATCOR16_SHORT_CNT_LMT_SFT 16 ++#define RG_ATCOR16_SHORT_CNT_LMT_HI 18 ++#define RG_ATCOR16_SHORT_CNT_LMT_SZ 3 ++#define RG_ATCOR16_RATIO_CCD_MSK 0x7f000000 ++#define RG_ATCOR16_RATIO_CCD_I_MSK 0x80ffffff ++#define RG_ATCOR16_RATIO_CCD_SFT 24 ++#define RG_ATCOR16_RATIO_CCD_HI 30 ++#define RG_ATCOR16_RATIO_CCD_SZ 7 ++#define RG_ATCOR64_ACC_LMT_MSK 0x0000007f ++#define RG_ATCOR64_ACC_LMT_I_MSK 0xffffff80 ++#define RG_ATCOR64_ACC_LMT_SFT 0 ++#define RG_ATCOR64_ACC_LMT_HI 6 ++#define RG_ATCOR64_ACC_LMT_SZ 7 ++#define RG_ATCOR16_SHORT_CNT_LMT2_MSK 0x00070000 ++#define RG_ATCOR16_SHORT_CNT_LMT2_I_MSK 0xfff8ffff ++#define RG_ATCOR16_SHORT_CNT_LMT2_SFT 16 ++#define RG_ATCOR16_SHORT_CNT_LMT2_HI 18 ++#define RG_ATCOR16_SHORT_CNT_LMT2_SZ 3 ++#define RG_VITERBI_TB_BITS_MSK 0xff000000 ++#define RG_VITERBI_TB_BITS_I_MSK 0x00ffffff ++#define RG_VITERBI_TB_BITS_SFT 24 ++#define RG_VITERBI_TB_BITS_HI 31 ++#define RG_VITERBI_TB_BITS_SZ 8 ++#define RG_CR_CNT_UPDATE_MSK 0x000000ff ++#define RG_CR_CNT_UPDATE_I_MSK 0xffffff00 ++#define RG_CR_CNT_UPDATE_SFT 0 ++#define RG_CR_CNT_UPDATE_HI 7 ++#define RG_CR_CNT_UPDATE_SZ 8 ++#define RG_TR_CNT_UPDATE_MSK 0x00ff0000 ++#define RG_TR_CNT_UPDATE_I_MSK 0xff00ffff ++#define RG_TR_CNT_UPDATE_SFT 16 ++#define RG_TR_CNT_UPDATE_HI 23 ++#define RG_TR_CNT_UPDATE_SZ 8 ++#define RG_BYPASS_CPE_MA_MSK 0x00000010 ++#define RG_BYPASS_CPE_MA_I_MSK 0xffffffef ++#define RG_BYPASS_CPE_MA_SFT 4 ++#define RG_BYPASS_CPE_MA_HI 4 ++#define RG_BYPASS_CPE_MA_SZ 1 ++#define RG_PILOT_BNDRY_SHIFT_MSK 0x00000700 ++#define RG_PILOT_BNDRY_SHIFT_I_MSK 0xfffff8ff ++#define RG_PILOT_BNDRY_SHIFT_SFT 8 ++#define RG_PILOT_BNDRY_SHIFT_HI 10 ++#define RG_PILOT_BNDRY_SHIFT_SZ 3 ++#define RG_EQ_SHORT_GI_SHIFT_MSK 0x00007000 ++#define RG_EQ_SHORT_GI_SHIFT_I_MSK 0xffff8fff ++#define RG_EQ_SHORT_GI_SHIFT_SFT 12 ++#define RG_EQ_SHORT_GI_SHIFT_HI 14 ++#define RG_EQ_SHORT_GI_SHIFT_SZ 3 ++#define RG_FFT_WDW_SHORT_SHIFT_MSK 0x00070000 ++#define RG_FFT_WDW_SHORT_SHIFT_I_MSK 0xfff8ffff ++#define RG_FFT_WDW_SHORT_SHIFT_SFT 16 ++#define RG_FFT_WDW_SHORT_SHIFT_HI 18 ++#define RG_FFT_WDW_SHORT_SHIFT_SZ 3 ++#define RG_CHSMTH_COEF_MSK 0x00030000 ++#define RG_CHSMTH_COEF_I_MSK 0xfffcffff ++#define RG_CHSMTH_COEF_SFT 16 ++#define RG_CHSMTH_COEF_HI 17 ++#define RG_CHSMTH_COEF_SZ 2 ++#define RG_CHSMTH_EN_MSK 0x00040000 ++#define RG_CHSMTH_EN_I_MSK 0xfffbffff ++#define RG_CHSMTH_EN_SFT 18 ++#define RG_CHSMTH_EN_HI 18 ++#define RG_CHSMTH_EN_SZ 1 ++#define RG_CHEST_DD_FACTOR_MSK 0x07000000 ++#define RG_CHEST_DD_FACTOR_I_MSK 0xf8ffffff ++#define RG_CHEST_DD_FACTOR_SFT 24 ++#define RG_CHEST_DD_FACTOR_HI 26 ++#define RG_CHEST_DD_FACTOR_SZ 3 ++#define RG_CH_UPDATE_MSK 0x80000000 ++#define RG_CH_UPDATE_I_MSK 0x7fffffff ++#define RG_CH_UPDATE_SFT 31 ++#define RG_CH_UPDATE_HI 31 ++#define RG_CH_UPDATE_SZ 1 ++#define RG_FMT_DET_MM_TH_MSK 0x000000ff ++#define RG_FMT_DET_MM_TH_I_MSK 0xffffff00 ++#define RG_FMT_DET_MM_TH_SFT 0 ++#define RG_FMT_DET_MM_TH_HI 7 ++#define RG_FMT_DET_MM_TH_SZ 8 ++#define RG_FMT_DET_GF_TH_MSK 0x0000ff00 ++#define RG_FMT_DET_GF_TH_I_MSK 0xffff00ff ++#define RG_FMT_DET_GF_TH_SFT 8 ++#define RG_FMT_DET_GF_TH_HI 15 ++#define RG_FMT_DET_GF_TH_SZ 8 ++#define RG_DO_NOT_CHECK_L_RATE_MSK 0x02000000 ++#define RG_DO_NOT_CHECK_L_RATE_I_MSK 0xfdffffff ++#define RG_DO_NOT_CHECK_L_RATE_SFT 25 ++#define RG_DO_NOT_CHECK_L_RATE_HI 25 ++#define RG_DO_NOT_CHECK_L_RATE_SZ 1 ++#define RG_FMT_DET_LENGTH_TH_MSK 0x0000ffff ++#define RG_FMT_DET_LENGTH_TH_I_MSK 0xffff0000 ++#define RG_FMT_DET_LENGTH_TH_SFT 0 ++#define RG_FMT_DET_LENGTH_TH_HI 15 ++#define RG_FMT_DET_LENGTH_TH_SZ 16 ++#define RG_L_LENGTH_MAX_MSK 0xffff0000 ++#define RG_L_LENGTH_MAX_I_MSK 0x0000ffff ++#define RG_L_LENGTH_MAX_SFT 16 ++#define RG_L_LENGTH_MAX_HI 31 ++#define RG_L_LENGTH_MAX_SZ 16 ++#define RG_TX_TIME_EXT_MSK 0x000000ff ++#define RG_TX_TIME_EXT_I_MSK 0xffffff00 ++#define RG_TX_TIME_EXT_SFT 0 ++#define RG_TX_TIME_EXT_HI 7 ++#define RG_TX_TIME_EXT_SZ 8 ++#define RG_MAC_DES_SPACE_MSK 0x00f00000 ++#define RG_MAC_DES_SPACE_I_MSK 0xff0fffff ++#define RG_MAC_DES_SPACE_SFT 20 ++#define RG_MAC_DES_SPACE_HI 23 ++#define RG_MAC_DES_SPACE_SZ 4 ++#define RG_TR_LPF_STBC_GF_KI_G_MSK 0x0000000f ++#define RG_TR_LPF_STBC_GF_KI_G_I_MSK 0xfffffff0 ++#define RG_TR_LPF_STBC_GF_KI_G_SFT 0 ++#define RG_TR_LPF_STBC_GF_KI_G_HI 3 ++#define RG_TR_LPF_STBC_GF_KI_G_SZ 4 ++#define RG_TR_LPF_STBC_GF_KP_G_MSK 0x000000f0 ++#define RG_TR_LPF_STBC_GF_KP_G_I_MSK 0xffffff0f ++#define RG_TR_LPF_STBC_GF_KP_G_SFT 4 ++#define RG_TR_LPF_STBC_GF_KP_G_HI 7 ++#define RG_TR_LPF_STBC_GF_KP_G_SZ 4 ++#define RG_TR_LPF_STBC_MF_KI_G_MSK 0x00000f00 ++#define RG_TR_LPF_STBC_MF_KI_G_I_MSK 0xfffff0ff ++#define RG_TR_LPF_STBC_MF_KI_G_SFT 8 ++#define RG_TR_LPF_STBC_MF_KI_G_HI 11 ++#define RG_TR_LPF_STBC_MF_KI_G_SZ 4 ++#define RG_TR_LPF_STBC_MF_KP_G_MSK 0x0000f000 ++#define RG_TR_LPF_STBC_MF_KP_G_I_MSK 0xffff0fff ++#define RG_TR_LPF_STBC_MF_KP_G_SFT 12 ++#define RG_TR_LPF_STBC_MF_KP_G_HI 15 ++#define RG_TR_LPF_STBC_MF_KP_G_SZ 4 ++#define RG_MODE_REG_IN_80_MSK 0x0001ffff ++#define RG_MODE_REG_IN_80_I_MSK 0xfffe0000 ++#define RG_MODE_REG_IN_80_SFT 0 ++#define RG_MODE_REG_IN_80_HI 16 ++#define RG_MODE_REG_IN_80_SZ 17 ++#define RG_PARALLEL_DR_80_MSK 0x00100000 ++#define RG_PARALLEL_DR_80_I_MSK 0xffefffff ++#define RG_PARALLEL_DR_80_SFT 20 ++#define RG_PARALLEL_DR_80_HI 20 ++#define RG_PARALLEL_DR_80_SZ 1 ++#define RG_MBRUN_80_MSK 0x01000000 ++#define RG_MBRUN_80_I_MSK 0xfeffffff ++#define RG_MBRUN_80_SFT 24 ++#define RG_MBRUN_80_HI 24 ++#define RG_MBRUN_80_SZ 1 ++#define RG_SHIFT_DR_80_MSK 0x10000000 ++#define RG_SHIFT_DR_80_I_MSK 0xefffffff ++#define RG_SHIFT_DR_80_SFT 28 ++#define RG_SHIFT_DR_80_HI 28 ++#define RG_SHIFT_DR_80_SZ 1 ++#define RG_MODE_REG_SI_80_MSK 0x20000000 ++#define RG_MODE_REG_SI_80_I_MSK 0xdfffffff ++#define RG_MODE_REG_SI_80_SFT 29 ++#define RG_MODE_REG_SI_80_HI 29 ++#define RG_MODE_REG_SI_80_SZ 1 ++#define RG_SIMULATION_MODE_80_MSK 0x40000000 ++#define RG_SIMULATION_MODE_80_I_MSK 0xbfffffff ++#define RG_SIMULATION_MODE_80_SFT 30 ++#define RG_SIMULATION_MODE_80_HI 30 ++#define RG_SIMULATION_MODE_80_SZ 1 ++#define RG_DBIST_MODE_80_MSK 0x80000000 ++#define RG_DBIST_MODE_80_I_MSK 0x7fffffff ++#define RG_DBIST_MODE_80_SFT 31 ++#define RG_DBIST_MODE_80_HI 31 ++#define RG_DBIST_MODE_80_SZ 1 ++#define RG_MODE_REG_IN_64_MSK 0x0000ffff ++#define RG_MODE_REG_IN_64_I_MSK 0xffff0000 ++#define RG_MODE_REG_IN_64_SFT 0 ++#define RG_MODE_REG_IN_64_HI 15 ++#define RG_MODE_REG_IN_64_SZ 16 ++#define RG_PARALLEL_DR_64_MSK 0x00100000 ++#define RG_PARALLEL_DR_64_I_MSK 0xffefffff ++#define RG_PARALLEL_DR_64_SFT 20 ++#define RG_PARALLEL_DR_64_HI 20 ++#define RG_PARALLEL_DR_64_SZ 1 ++#define RG_MBRUN_64_MSK 0x01000000 ++#define RG_MBRUN_64_I_MSK 0xfeffffff ++#define RG_MBRUN_64_SFT 24 ++#define RG_MBRUN_64_HI 24 ++#define RG_MBRUN_64_SZ 1 ++#define RG_SHIFT_DR_64_MSK 0x10000000 ++#define RG_SHIFT_DR_64_I_MSK 0xefffffff ++#define RG_SHIFT_DR_64_SFT 28 ++#define RG_SHIFT_DR_64_HI 28 ++#define RG_SHIFT_DR_64_SZ 1 ++#define RG_MODE_REG_SI_64_MSK 0x20000000 ++#define RG_MODE_REG_SI_64_I_MSK 0xdfffffff ++#define RG_MODE_REG_SI_64_SFT 29 ++#define RG_MODE_REG_SI_64_HI 29 ++#define RG_MODE_REG_SI_64_SZ 1 ++#define RG_SIMULATION_MODE_64_MSK 0x40000000 ++#define RG_SIMULATION_MODE_64_I_MSK 0xbfffffff ++#define RG_SIMULATION_MODE_64_SFT 30 ++#define RG_SIMULATION_MODE_64_HI 30 ++#define RG_SIMULATION_MODE_64_SZ 1 ++#define RG_DBIST_MODE_64_MSK 0x80000000 ++#define RG_DBIST_MODE_64_I_MSK 0x7fffffff ++#define RG_DBIST_MODE_64_SFT 31 ++#define RG_DBIST_MODE_64_HI 31 ++#define RG_DBIST_MODE_64_SZ 1 ++#define RO_MODE_REG_OUT_80_MSK 0x0001ffff ++#define RO_MODE_REG_OUT_80_I_MSK 0xfffe0000 ++#define RO_MODE_REG_OUT_80_SFT 0 ++#define RO_MODE_REG_OUT_80_HI 16 ++#define RO_MODE_REG_OUT_80_SZ 17 ++#define RO_MODE_REG_SO_80_MSK 0x01000000 ++#define RO_MODE_REG_SO_80_I_MSK 0xfeffffff ++#define RO_MODE_REG_SO_80_SFT 24 ++#define RO_MODE_REG_SO_80_HI 24 ++#define RO_MODE_REG_SO_80_SZ 1 ++#define RO_MONITOR_BUS_80_MSK 0x003fffff ++#define RO_MONITOR_BUS_80_I_MSK 0xffc00000 ++#define RO_MONITOR_BUS_80_SFT 0 ++#define RO_MONITOR_BUS_80_HI 21 ++#define RO_MONITOR_BUS_80_SZ 22 ++#define RO_MODE_REG_OUT_64_MSK 0x0000ffff ++#define RO_MODE_REG_OUT_64_I_MSK 0xffff0000 ++#define RO_MODE_REG_OUT_64_SFT 0 ++#define RO_MODE_REG_OUT_64_HI 15 ++#define RO_MODE_REG_OUT_64_SZ 16 ++#define RO_MODE_REG_SO_64_MSK 0x01000000 ++#define RO_MODE_REG_SO_64_I_MSK 0xfeffffff ++#define RO_MODE_REG_SO_64_SFT 24 ++#define RO_MODE_REG_SO_64_HI 24 ++#define RO_MODE_REG_SO_64_SZ 1 ++#define RO_MONITOR_BUS_64_MSK 0x0007ffff ++#define RO_MONITOR_BUS_64_I_MSK 0xfff80000 ++#define RO_MONITOR_BUS_64_SFT 0 ++#define RO_MONITOR_BUS_64_HI 18 ++#define RO_MONITOR_BUS_64_SZ 19 ++#define RO_SPECTRUM_DATA_MSK 0xffffffff ++#define RO_SPECTRUM_DATA_I_MSK 0x00000000 ++#define RO_SPECTRUM_DATA_SFT 0 ++#define RO_SPECTRUM_DATA_HI 31 ++#define RO_SPECTRUM_DATA_SZ 32 ++#define GN_SNR_MSK 0x0000007f ++#define GN_SNR_I_MSK 0xffffff80 ++#define GN_SNR_SFT 0 ++#define GN_SNR_HI 6 ++#define GN_SNR_SZ 7 ++#define GN_NOISE_PWR_MSK 0x00007f00 ++#define GN_NOISE_PWR_I_MSK 0xffff80ff ++#define GN_NOISE_PWR_SFT 8 ++#define GN_NOISE_PWR_HI 14 ++#define GN_NOISE_PWR_SZ 7 ++#define GN_RCPI_MSK 0x007f0000 ++#define GN_RCPI_I_MSK 0xff80ffff ++#define GN_RCPI_SFT 16 ++#define GN_RCPI_HI 22 ++#define GN_RCPI_SZ 7 ++#define GN_SIGNAL_PWR_MSK 0x7f000000 ++#define GN_SIGNAL_PWR_I_MSK 0x80ffffff ++#define GN_SIGNAL_PWR_SFT 24 ++#define GN_SIGNAL_PWR_HI 30 ++#define GN_SIGNAL_PWR_SZ 7 ++#define RO_FREQ_OS_LTS_MSK 0x00007fff ++#define RO_FREQ_OS_LTS_I_MSK 0xffff8000 ++#define RO_FREQ_OS_LTS_SFT 0 ++#define RO_FREQ_OS_LTS_HI 14 ++#define RO_FREQ_OS_LTS_SZ 15 ++#define CSTATE_MSK 0x000f0000 ++#define CSTATE_I_MSK 0xfff0ffff ++#define CSTATE_SFT 16 ++#define CSTATE_HI 19 ++#define CSTATE_SZ 4 ++#define SIGNAL_FIELD0_MSK 0x00ffffff ++#define SIGNAL_FIELD0_I_MSK 0xff000000 ++#define SIGNAL_FIELD0_SFT 0 ++#define SIGNAL_FIELD0_HI 23 ++#define SIGNAL_FIELD0_SZ 24 ++#define SIGNAL_FIELD1_MSK 0x00ffffff ++#define SIGNAL_FIELD1_I_MSK 0xff000000 ++#define SIGNAL_FIELD1_SFT 0 ++#define SIGNAL_FIELD1_HI 23 ++#define SIGNAL_FIELD1_SZ 24 ++#define GN_PACKET_ERR_CNT_MSK 0x0000ffff ++#define GN_PACKET_ERR_CNT_I_MSK 0xffff0000 ++#define GN_PACKET_ERR_CNT_SFT 0 ++#define GN_PACKET_ERR_CNT_HI 15 ++#define GN_PACKET_ERR_CNT_SZ 16 ++#define GN_PACKET_CNT_MSK 0x0000ffff ++#define GN_PACKET_CNT_I_MSK 0xffff0000 ++#define GN_PACKET_CNT_SFT 0 ++#define GN_PACKET_CNT_HI 15 ++#define GN_PACKET_CNT_SZ 16 ++#define GN_CCA_CNT_MSK 0xffff0000 ++#define GN_CCA_CNT_I_MSK 0x0000ffff ++#define GN_CCA_CNT_SFT 16 ++#define GN_CCA_CNT_HI 31 ++#define GN_CCA_CNT_SZ 16 ++#define GN_LENGTH_FIELD_MSK 0x0000ffff ++#define GN_LENGTH_FIELD_I_MSK 0xffff0000 ++#define GN_LENGTH_FIELD_SFT 0 ++#define GN_LENGTH_FIELD_HI 15 ++#define GN_LENGTH_FIELD_SZ 16 ++#define GN_SERVICE_FIELD_MSK 0xffff0000 ++#define GN_SERVICE_FIELD_I_MSK 0x0000ffff ++#define GN_SERVICE_FIELD_SFT 16 ++#define GN_SERVICE_FIELD_HI 31 ++#define GN_SERVICE_FIELD_SZ 16 ++#define RO_HT_MCS_40M_MSK 0x0000007f ++#define RO_HT_MCS_40M_I_MSK 0xffffff80 ++#define RO_HT_MCS_40M_SFT 0 ++#define RO_HT_MCS_40M_HI 6 ++#define RO_HT_MCS_40M_SZ 7 ++#define RO_L_RATE_40M_MSK 0x00003f00 ++#define RO_L_RATE_40M_I_MSK 0xffffc0ff ++#define RO_L_RATE_40M_SFT 8 ++#define RO_L_RATE_40M_HI 13 ++#define RO_L_RATE_40M_SZ 6 ++#define RG_DAGC_CNT_TH_MSK 0x00000003 ++#define RG_DAGC_CNT_TH_I_MSK 0xfffffffc ++#define RG_DAGC_CNT_TH_SFT 0 ++#define RG_DAGC_CNT_TH_HI 1 ++#define RG_DAGC_CNT_TH_SZ 2 ++#define RG_PACKET_STAT_EN_11GN_MSK 0x00100000 ++#define RG_PACKET_STAT_EN_11GN_I_MSK 0xffefffff ++#define RG_PACKET_STAT_EN_11GN_SFT 20 ++#define RG_PACKET_STAT_EN_11GN_HI 20 ++#define RG_PACKET_STAT_EN_11GN_SZ 1 ++#define RX_PHY_11GN_SOFT_RST_N_MSK 0x00000001 ++#define RX_PHY_11GN_SOFT_RST_N_I_MSK 0xfffffffe ++#define RX_PHY_11GN_SOFT_RST_N_SFT 0 ++#define RX_PHY_11GN_SOFT_RST_N_HI 0 ++#define RX_PHY_11GN_SOFT_RST_N_SZ 1 ++#define RG_RIFS_EN_MSK 0x00000002 ++#define RG_RIFS_EN_I_MSK 0xfffffffd ++#define RG_RIFS_EN_SFT 1 ++#define RG_RIFS_EN_HI 1 ++#define RG_RIFS_EN_SZ 1 ++#define RG_STBC_EN_MSK 0x00000004 ++#define RG_STBC_EN_I_MSK 0xfffffffb ++#define RG_STBC_EN_SFT 2 ++#define RG_STBC_EN_HI 2 ++#define RG_STBC_EN_SZ 1 ++#define RG_COR_SEL_MSK 0x00000008 ++#define RG_COR_SEL_I_MSK 0xfffffff7 ++#define RG_COR_SEL_SFT 3 ++#define RG_COR_SEL_HI 3 ++#define RG_COR_SEL_SZ 1 ++#define RG_INI_PHASE_MSK 0x00000030 ++#define RG_INI_PHASE_I_MSK 0xffffffcf ++#define RG_INI_PHASE_SFT 4 ++#define RG_INI_PHASE_HI 5 ++#define RG_INI_PHASE_SZ 2 ++#define RG_HT_LTF_SEL_EQ_MSK 0x00000040 ++#define RG_HT_LTF_SEL_EQ_I_MSK 0xffffffbf ++#define RG_HT_LTF_SEL_EQ_SFT 6 ++#define RG_HT_LTF_SEL_EQ_HI 6 ++#define RG_HT_LTF_SEL_EQ_SZ 1 ++#define RG_HT_LTF_SEL_PILOT_MSK 0x00000080 ++#define RG_HT_LTF_SEL_PILOT_I_MSK 0xffffff7f ++#define RG_HT_LTF_SEL_PILOT_SFT 7 ++#define RG_HT_LTF_SEL_PILOT_HI 7 ++#define RG_HT_LTF_SEL_PILOT_SZ 1 ++#define RG_CCA_PWR_SEL_MSK 0x00000200 ++#define RG_CCA_PWR_SEL_I_MSK 0xfffffdff ++#define RG_CCA_PWR_SEL_SFT 9 ++#define RG_CCA_PWR_SEL_HI 9 ++#define RG_CCA_PWR_SEL_SZ 1 ++#define RG_CCA_XSCOR_PWR_SEL_MSK 0x00000400 ++#define RG_CCA_XSCOR_PWR_SEL_I_MSK 0xfffffbff ++#define RG_CCA_XSCOR_PWR_SEL_SFT 10 ++#define RG_CCA_XSCOR_PWR_SEL_HI 10 ++#define RG_CCA_XSCOR_PWR_SEL_SZ 1 ++#define RG_CCA_XSCOR_AVGPWR_SEL_MSK 0x00000800 ++#define RG_CCA_XSCOR_AVGPWR_SEL_I_MSK 0xfffff7ff ++#define RG_CCA_XSCOR_AVGPWR_SEL_SFT 11 ++#define RG_CCA_XSCOR_AVGPWR_SEL_HI 11 ++#define RG_CCA_XSCOR_AVGPWR_SEL_SZ 1 ++#define RG_DEBUG_SEL_MSK 0x0000f000 ++#define RG_DEBUG_SEL_I_MSK 0xffff0fff ++#define RG_DEBUG_SEL_SFT 12 ++#define RG_DEBUG_SEL_HI 15 ++#define RG_DEBUG_SEL_SZ 4 ++#define RG_POST_CLK_EN_MSK 0x00010000 ++#define RG_POST_CLK_EN_I_MSK 0xfffeffff ++#define RG_POST_CLK_EN_SFT 16 ++#define RG_POST_CLK_EN_HI 16 ++#define RG_POST_CLK_EN_SZ 1 ++#define IQCAL_RF_TX_EN_MSK 0x00000001 ++#define IQCAL_RF_TX_EN_I_MSK 0xfffffffe ++#define IQCAL_RF_TX_EN_SFT 0 ++#define IQCAL_RF_TX_EN_HI 0 ++#define IQCAL_RF_TX_EN_SZ 1 ++#define IQCAL_RF_TX_PA_EN_MSK 0x00000002 ++#define IQCAL_RF_TX_PA_EN_I_MSK 0xfffffffd ++#define IQCAL_RF_TX_PA_EN_SFT 1 ++#define IQCAL_RF_TX_PA_EN_HI 1 ++#define IQCAL_RF_TX_PA_EN_SZ 1 ++#define IQCAL_RF_TX_DAC_EN_MSK 0x00000004 ++#define IQCAL_RF_TX_DAC_EN_I_MSK 0xfffffffb ++#define IQCAL_RF_TX_DAC_EN_SFT 2 ++#define IQCAL_RF_TX_DAC_EN_HI 2 ++#define IQCAL_RF_TX_DAC_EN_SZ 1 ++#define IQCAL_RF_RX_AGC_MSK 0x00000008 ++#define IQCAL_RF_RX_AGC_I_MSK 0xfffffff7 ++#define IQCAL_RF_RX_AGC_SFT 3 ++#define IQCAL_RF_RX_AGC_HI 3 ++#define IQCAL_RF_RX_AGC_SZ 1 ++#define IQCAL_RF_PGAG_MSK 0x00000f00 ++#define IQCAL_RF_PGAG_I_MSK 0xfffff0ff ++#define IQCAL_RF_PGAG_SFT 8 ++#define IQCAL_RF_PGAG_HI 11 ++#define IQCAL_RF_PGAG_SZ 4 ++#define IQCAL_RF_RFG_MSK 0x00003000 ++#define IQCAL_RF_RFG_I_MSK 0xffffcfff ++#define IQCAL_RF_RFG_SFT 12 ++#define IQCAL_RF_RFG_HI 13 ++#define IQCAL_RF_RFG_SZ 2 ++#define RG_TONEGEN_FREQ_MSK 0x007f0000 ++#define RG_TONEGEN_FREQ_I_MSK 0xff80ffff ++#define RG_TONEGEN_FREQ_SFT 16 ++#define RG_TONEGEN_FREQ_HI 22 ++#define RG_TONEGEN_FREQ_SZ 7 ++#define RG_TONEGEN_EN_MSK 0x00800000 ++#define RG_TONEGEN_EN_I_MSK 0xff7fffff ++#define RG_TONEGEN_EN_SFT 23 ++#define RG_TONEGEN_EN_HI 23 ++#define RG_TONEGEN_EN_SZ 1 ++#define RG_TONEGEN_INIT_PH_MSK 0x7f000000 ++#define RG_TONEGEN_INIT_PH_I_MSK 0x80ffffff ++#define RG_TONEGEN_INIT_PH_SFT 24 ++#define RG_TONEGEN_INIT_PH_HI 30 ++#define RG_TONEGEN_INIT_PH_SZ 7 ++#define RG_TONEGEN2_FREQ_MSK 0x0000007f ++#define RG_TONEGEN2_FREQ_I_MSK 0xffffff80 ++#define RG_TONEGEN2_FREQ_SFT 0 ++#define RG_TONEGEN2_FREQ_HI 6 ++#define RG_TONEGEN2_FREQ_SZ 7 ++#define RG_TONEGEN2_EN_MSK 0x00000080 ++#define RG_TONEGEN2_EN_I_MSK 0xffffff7f ++#define RG_TONEGEN2_EN_SFT 7 ++#define RG_TONEGEN2_EN_HI 7 ++#define RG_TONEGEN2_EN_SZ 1 ++#define RG_TONEGEN2_SCALE_MSK 0x0000ff00 ++#define RG_TONEGEN2_SCALE_I_MSK 0xffff00ff ++#define RG_TONEGEN2_SCALE_SFT 8 ++#define RG_TONEGEN2_SCALE_HI 15 ++#define RG_TONEGEN2_SCALE_SZ 8 ++#define RG_TXIQ_CLP_THD_I_MSK 0x000003ff ++#define RG_TXIQ_CLP_THD_I_I_MSK 0xfffffc00 ++#define RG_TXIQ_CLP_THD_I_SFT 0 ++#define RG_TXIQ_CLP_THD_I_HI 9 ++#define RG_TXIQ_CLP_THD_I_SZ 10 ++#define RG_TXIQ_CLP_THD_Q_MSK 0x03ff0000 ++#define RG_TXIQ_CLP_THD_Q_I_MSK 0xfc00ffff ++#define RG_TXIQ_CLP_THD_Q_SFT 16 ++#define RG_TXIQ_CLP_THD_Q_HI 25 ++#define RG_TXIQ_CLP_THD_Q_SZ 10 ++#define RG_TX_I_SCALE_MSK 0x000000ff ++#define RG_TX_I_SCALE_I_MSK 0xffffff00 ++#define RG_TX_I_SCALE_SFT 0 ++#define RG_TX_I_SCALE_HI 7 ++#define RG_TX_I_SCALE_SZ 8 ++#define RG_TX_Q_SCALE_MSK 0x0000ff00 ++#define RG_TX_Q_SCALE_I_MSK 0xffff00ff ++#define RG_TX_Q_SCALE_SFT 8 ++#define RG_TX_Q_SCALE_HI 15 ++#define RG_TX_Q_SCALE_SZ 8 ++#define RG_TX_IQ_SWP_MSK 0x00010000 ++#define RG_TX_IQ_SWP_I_MSK 0xfffeffff ++#define RG_TX_IQ_SWP_SFT 16 ++#define RG_TX_IQ_SWP_HI 16 ++#define RG_TX_IQ_SWP_SZ 1 ++#define RG_TX_SGN_OUT_MSK 0x00020000 ++#define RG_TX_SGN_OUT_I_MSK 0xfffdffff ++#define RG_TX_SGN_OUT_SFT 17 ++#define RG_TX_SGN_OUT_HI 17 ++#define RG_TX_SGN_OUT_SZ 1 ++#define RG_TXIQ_EMU_IDX_MSK 0x003c0000 ++#define RG_TXIQ_EMU_IDX_I_MSK 0xffc3ffff ++#define RG_TXIQ_EMU_IDX_SFT 18 ++#define RG_TXIQ_EMU_IDX_HI 21 ++#define RG_TXIQ_EMU_IDX_SZ 4 ++#define RG_TX_IQ_SRC_MSK 0x03000000 ++#define RG_TX_IQ_SRC_I_MSK 0xfcffffff ++#define RG_TX_IQ_SRC_SFT 24 ++#define RG_TX_IQ_SRC_HI 25 ++#define RG_TX_IQ_SRC_SZ 2 ++#define RG_TX_I_DC_MSK 0x000003ff ++#define RG_TX_I_DC_I_MSK 0xfffffc00 ++#define RG_TX_I_DC_SFT 0 ++#define RG_TX_I_DC_HI 9 ++#define RG_TX_I_DC_SZ 10 ++#define RG_TX_Q_DC_MSK 0x03ff0000 ++#define RG_TX_Q_DC_I_MSK 0xfc00ffff ++#define RG_TX_Q_DC_SFT 16 ++#define RG_TX_Q_DC_HI 25 ++#define RG_TX_Q_DC_SZ 10 ++#define RG_TX_IQ_THETA_MSK 0x0000001f ++#define RG_TX_IQ_THETA_I_MSK 0xffffffe0 ++#define RG_TX_IQ_THETA_SFT 0 ++#define RG_TX_IQ_THETA_HI 4 ++#define RG_TX_IQ_THETA_SZ 5 ++#define RG_TX_IQ_ALPHA_MSK 0x00001f00 ++#define RG_TX_IQ_ALPHA_I_MSK 0xffffe0ff ++#define RG_TX_IQ_ALPHA_SFT 8 ++#define RG_TX_IQ_ALPHA_HI 12 ++#define RG_TX_IQ_ALPHA_SZ 5 ++#define RG_TXIQ_NOSHRINK_MSK 0x00002000 ++#define RG_TXIQ_NOSHRINK_I_MSK 0xffffdfff ++#define RG_TXIQ_NOSHRINK_SFT 13 ++#define RG_TXIQ_NOSHRINK_HI 13 ++#define RG_TXIQ_NOSHRINK_SZ 1 ++#define RG_TX_I_OFFSET_MSK 0x00ff0000 ++#define RG_TX_I_OFFSET_I_MSK 0xff00ffff ++#define RG_TX_I_OFFSET_SFT 16 ++#define RG_TX_I_OFFSET_HI 23 ++#define RG_TX_I_OFFSET_SZ 8 ++#define RG_TX_Q_OFFSET_MSK 0xff000000 ++#define RG_TX_Q_OFFSET_I_MSK 0x00ffffff ++#define RG_TX_Q_OFFSET_SFT 24 ++#define RG_TX_Q_OFFSET_HI 31 ++#define RG_TX_Q_OFFSET_SZ 8 ++#define RG_RX_IQ_THETA_MSK 0x0000001f ++#define RG_RX_IQ_THETA_I_MSK 0xffffffe0 ++#define RG_RX_IQ_THETA_SFT 0 ++#define RG_RX_IQ_THETA_HI 4 ++#define RG_RX_IQ_THETA_SZ 5 ++#define RG_RX_IQ_ALPHA_MSK 0x00001f00 ++#define RG_RX_IQ_ALPHA_I_MSK 0xffffe0ff ++#define RG_RX_IQ_ALPHA_SFT 8 ++#define RG_RX_IQ_ALPHA_HI 12 ++#define RG_RX_IQ_ALPHA_SZ 5 ++#define RG_RXIQ_NOSHRINK_MSK 0x00002000 ++#define RG_RXIQ_NOSHRINK_I_MSK 0xffffdfff ++#define RG_RXIQ_NOSHRINK_SFT 13 ++#define RG_RXIQ_NOSHRINK_HI 13 ++#define RG_RXIQ_NOSHRINK_SZ 1 ++#define RG_MA_DPTH_MSK 0x0000000f ++#define RG_MA_DPTH_I_MSK 0xfffffff0 ++#define RG_MA_DPTH_SFT 0 ++#define RG_MA_DPTH_HI 3 ++#define RG_MA_DPTH_SZ 4 ++#define RG_INTG_PH_MSK 0x000003f0 ++#define RG_INTG_PH_I_MSK 0xfffffc0f ++#define RG_INTG_PH_SFT 4 ++#define RG_INTG_PH_HI 9 ++#define RG_INTG_PH_SZ 6 ++#define RG_INTG_PRD_MSK 0x00001c00 ++#define RG_INTG_PRD_I_MSK 0xffffe3ff ++#define RG_INTG_PRD_SFT 10 ++#define RG_INTG_PRD_HI 12 ++#define RG_INTG_PRD_SZ 3 ++#define RG_INTG_MU_MSK 0x00006000 ++#define RG_INTG_MU_I_MSK 0xffff9fff ++#define RG_INTG_MU_SFT 13 ++#define RG_INTG_MU_HI 14 ++#define RG_INTG_MU_SZ 2 ++#define RG_IQCAL_SPRM_SELQ_MSK 0x00010000 ++#define RG_IQCAL_SPRM_SELQ_I_MSK 0xfffeffff ++#define RG_IQCAL_SPRM_SELQ_SFT 16 ++#define RG_IQCAL_SPRM_SELQ_HI 16 ++#define RG_IQCAL_SPRM_SELQ_SZ 1 ++#define RG_IQCAL_SPRM_EN_MSK 0x00020000 ++#define RG_IQCAL_SPRM_EN_I_MSK 0xfffdffff ++#define RG_IQCAL_SPRM_EN_SFT 17 ++#define RG_IQCAL_SPRM_EN_HI 17 ++#define RG_IQCAL_SPRM_EN_SZ 1 ++#define RG_IQCAL_SPRM_FREQ_MSK 0x00fc0000 ++#define RG_IQCAL_SPRM_FREQ_I_MSK 0xff03ffff ++#define RG_IQCAL_SPRM_FREQ_SFT 18 ++#define RG_IQCAL_SPRM_FREQ_HI 23 ++#define RG_IQCAL_SPRM_FREQ_SZ 6 ++#define RG_IQCAL_IQCOL_EN_MSK 0x01000000 ++#define RG_IQCAL_IQCOL_EN_I_MSK 0xfeffffff ++#define RG_IQCAL_IQCOL_EN_SFT 24 ++#define RG_IQCAL_IQCOL_EN_HI 24 ++#define RG_IQCAL_IQCOL_EN_SZ 1 ++#define RG_IQCAL_ALPHA_ESTM_EN_MSK 0x02000000 ++#define RG_IQCAL_ALPHA_ESTM_EN_I_MSK 0xfdffffff ++#define RG_IQCAL_ALPHA_ESTM_EN_SFT 25 ++#define RG_IQCAL_ALPHA_ESTM_EN_HI 25 ++#define RG_IQCAL_ALPHA_ESTM_EN_SZ 1 ++#define RG_IQCAL_DC_EN_MSK 0x04000000 ++#define RG_IQCAL_DC_EN_I_MSK 0xfbffffff ++#define RG_IQCAL_DC_EN_SFT 26 ++#define RG_IQCAL_DC_EN_HI 26 ++#define RG_IQCAL_DC_EN_SZ 1 ++#define RG_PHEST_STBY_MSK 0x08000000 ++#define RG_PHEST_STBY_I_MSK 0xf7ffffff ++#define RG_PHEST_STBY_SFT 27 ++#define RG_PHEST_STBY_HI 27 ++#define RG_PHEST_STBY_SZ 1 ++#define RG_PHEST_EN_MSK 0x10000000 ++#define RG_PHEST_EN_I_MSK 0xefffffff ++#define RG_PHEST_EN_SFT 28 ++#define RG_PHEST_EN_HI 28 ++#define RG_PHEST_EN_SZ 1 ++#define RG_GP_DIV_EN_MSK 0x20000000 ++#define RG_GP_DIV_EN_I_MSK 0xdfffffff ++#define RG_GP_DIV_EN_SFT 29 ++#define RG_GP_DIV_EN_HI 29 ++#define RG_GP_DIV_EN_SZ 1 ++#define RG_DPD_GAIN_EST_EN_MSK 0x40000000 ++#define RG_DPD_GAIN_EST_EN_I_MSK 0xbfffffff ++#define RG_DPD_GAIN_EST_EN_SFT 30 ++#define RG_DPD_GAIN_EST_EN_HI 30 ++#define RG_DPD_GAIN_EST_EN_SZ 1 ++#define RG_IQCAL_MULT_OP0_MSK 0x000003ff ++#define RG_IQCAL_MULT_OP0_I_MSK 0xfffffc00 ++#define RG_IQCAL_MULT_OP0_SFT 0 ++#define RG_IQCAL_MULT_OP0_HI 9 ++#define RG_IQCAL_MULT_OP0_SZ 10 ++#define RG_IQCAL_MULT_OP1_MSK 0x03ff0000 ++#define RG_IQCAL_MULT_OP1_I_MSK 0xfc00ffff ++#define RG_IQCAL_MULT_OP1_SFT 16 ++#define RG_IQCAL_MULT_OP1_HI 25 ++#define RG_IQCAL_MULT_OP1_SZ 10 ++#define RO_IQCAL_O_MSK 0x000fffff ++#define RO_IQCAL_O_I_MSK 0xfff00000 ++#define RO_IQCAL_O_SFT 0 ++#define RO_IQCAL_O_HI 19 ++#define RO_IQCAL_O_SZ 20 ++#define RO_IQCAL_SPRM_RDY_MSK 0x00100000 ++#define RO_IQCAL_SPRM_RDY_I_MSK 0xffefffff ++#define RO_IQCAL_SPRM_RDY_SFT 20 ++#define RO_IQCAL_SPRM_RDY_HI 20 ++#define RO_IQCAL_SPRM_RDY_SZ 1 ++#define RO_IQCAL_IQCOL_RDY_MSK 0x00200000 ++#define RO_IQCAL_IQCOL_RDY_I_MSK 0xffdfffff ++#define RO_IQCAL_IQCOL_RDY_SFT 21 ++#define RO_IQCAL_IQCOL_RDY_HI 21 ++#define RO_IQCAL_IQCOL_RDY_SZ 1 ++#define RO_IQCAL_ALPHA_ESTM_RDY_MSK 0x00400000 ++#define RO_IQCAL_ALPHA_ESTM_RDY_I_MSK 0xffbfffff ++#define RO_IQCAL_ALPHA_ESTM_RDY_SFT 22 ++#define RO_IQCAL_ALPHA_ESTM_RDY_HI 22 ++#define RO_IQCAL_ALPHA_ESTM_RDY_SZ 1 ++#define RO_IQCAL_DC_RDY_MSK 0x00800000 ++#define RO_IQCAL_DC_RDY_I_MSK 0xff7fffff ++#define RO_IQCAL_DC_RDY_SFT 23 ++#define RO_IQCAL_DC_RDY_HI 23 ++#define RO_IQCAL_DC_RDY_SZ 1 ++#define RO_IQCAL_MULT_RDY_MSK 0x01000000 ++#define RO_IQCAL_MULT_RDY_I_MSK 0xfeffffff ++#define RO_IQCAL_MULT_RDY_SFT 24 ++#define RO_IQCAL_MULT_RDY_HI 24 ++#define RO_IQCAL_MULT_RDY_SZ 1 ++#define RO_FFT_ENRG_RDY_MSK 0x02000000 ++#define RO_FFT_ENRG_RDY_I_MSK 0xfdffffff ++#define RO_FFT_ENRG_RDY_SFT 25 ++#define RO_FFT_ENRG_RDY_HI 25 ++#define RO_FFT_ENRG_RDY_SZ 1 ++#define RO_PHEST_RDY_MSK 0x04000000 ++#define RO_PHEST_RDY_I_MSK 0xfbffffff ++#define RO_PHEST_RDY_SFT 26 ++#define RO_PHEST_RDY_HI 26 ++#define RO_PHEST_RDY_SZ 1 ++#define RO_GP_DIV_RDY_MSK 0x08000000 ++#define RO_GP_DIV_RDY_I_MSK 0xf7ffffff ++#define RO_GP_DIV_RDY_SFT 27 ++#define RO_GP_DIV_RDY_HI 27 ++#define RO_GP_DIV_RDY_SZ 1 ++#define RO_GAIN_EST_RDY_MSK 0x10000000 ++#define RO_GAIN_EST_RDY_I_MSK 0xefffffff ++#define RO_GAIN_EST_RDY_SFT 28 ++#define RO_GAIN_EST_RDY_HI 28 ++#define RO_GAIN_EST_RDY_SZ 1 ++#define RO_AMP_O_MSK 0x000001ff ++#define RO_AMP_O_I_MSK 0xfffffe00 ++#define RO_AMP_O_SFT 0 ++#define RO_AMP_O_HI 8 ++#define RO_AMP_O_SZ 9 ++#define RG_RX_I_SCALE_MSK 0x000000ff ++#define RG_RX_I_SCALE_I_MSK 0xffffff00 ++#define RG_RX_I_SCALE_SFT 0 ++#define RG_RX_I_SCALE_HI 7 ++#define RG_RX_I_SCALE_SZ 8 ++#define RG_RX_Q_SCALE_MSK 0x0000ff00 ++#define RG_RX_Q_SCALE_I_MSK 0xffff00ff ++#define RG_RX_Q_SCALE_SFT 8 ++#define RG_RX_Q_SCALE_HI 15 ++#define RG_RX_Q_SCALE_SZ 8 ++#define RG_RX_I_OFFSET_MSK 0x00ff0000 ++#define RG_RX_I_OFFSET_I_MSK 0xff00ffff ++#define RG_RX_I_OFFSET_SFT 16 ++#define RG_RX_I_OFFSET_HI 23 ++#define RG_RX_I_OFFSET_SZ 8 ++#define RG_RX_Q_OFFSET_MSK 0xff000000 ++#define RG_RX_Q_OFFSET_I_MSK 0x00ffffff ++#define RG_RX_Q_OFFSET_SFT 24 ++#define RG_RX_Q_OFFSET_HI 31 ++#define RG_RX_Q_OFFSET_SZ 8 ++#define RG_RX_IQ_SWP_MSK 0x00000001 ++#define RG_RX_IQ_SWP_I_MSK 0xfffffffe ++#define RG_RX_IQ_SWP_SFT 0 ++#define RG_RX_IQ_SWP_HI 0 ++#define RG_RX_IQ_SWP_SZ 1 ++#define RG_RX_SGN_IN_MSK 0x00000002 ++#define RG_RX_SGN_IN_I_MSK 0xfffffffd ++#define RG_RX_SGN_IN_SFT 1 ++#define RG_RX_SGN_IN_HI 1 ++#define RG_RX_SGN_IN_SZ 1 ++#define RG_RX_IQ_SRC_MSK 0x0000000c ++#define RG_RX_IQ_SRC_I_MSK 0xfffffff3 ++#define RG_RX_IQ_SRC_SFT 2 ++#define RG_RX_IQ_SRC_HI 3 ++#define RG_RX_IQ_SRC_SZ 2 ++#define RG_ACI_GAIN_MSK 0x00000ff0 ++#define RG_ACI_GAIN_I_MSK 0xfffff00f ++#define RG_ACI_GAIN_SFT 4 ++#define RG_ACI_GAIN_HI 11 ++#define RG_ACI_GAIN_SZ 8 ++#define RG_FFT_EN_MSK 0x00001000 ++#define RG_FFT_EN_I_MSK 0xffffefff ++#define RG_FFT_EN_SFT 12 ++#define RG_FFT_EN_HI 12 ++#define RG_FFT_EN_SZ 1 ++#define RG_FFT_MOD_MSK 0x00002000 ++#define RG_FFT_MOD_I_MSK 0xffffdfff ++#define RG_FFT_MOD_SFT 13 ++#define RG_FFT_MOD_HI 13 ++#define RG_FFT_MOD_SZ 1 ++#define RG_FFT_SCALE_MSK 0x00ffc000 ++#define RG_FFT_SCALE_I_MSK 0xff003fff ++#define RG_FFT_SCALE_SFT 14 ++#define RG_FFT_SCALE_HI 23 ++#define RG_FFT_SCALE_SZ 10 ++#define RG_FFT_ENRG_FREQ_MSK 0x3f000000 ++#define RG_FFT_ENRG_FREQ_I_MSK 0xc0ffffff ++#define RG_FFT_ENRG_FREQ_SFT 24 ++#define RG_FFT_ENRG_FREQ_HI 29 ++#define RG_FFT_ENRG_FREQ_SZ 6 ++#define RG_FPGA_80M_PH_UP_MSK 0x40000000 ++#define RG_FPGA_80M_PH_UP_I_MSK 0xbfffffff ++#define RG_FPGA_80M_PH_UP_SFT 30 ++#define RG_FPGA_80M_PH_UP_HI 30 ++#define RG_FPGA_80M_PH_UP_SZ 1 ++#define RG_FPGA_80M_PH_STP_MSK 0x80000000 ++#define RG_FPGA_80M_PH_STP_I_MSK 0x7fffffff ++#define RG_FPGA_80M_PH_STP_SFT 31 ++#define RG_FPGA_80M_PH_STP_HI 31 ++#define RG_FPGA_80M_PH_STP_SZ 1 ++#define RG_ADC2LA_SEL_MSK 0x00000001 ++#define RG_ADC2LA_SEL_I_MSK 0xfffffffe ++#define RG_ADC2LA_SEL_SFT 0 ++#define RG_ADC2LA_SEL_HI 0 ++#define RG_ADC2LA_SEL_SZ 1 ++#define RG_ADC2LA_CLKPH_MSK 0x00000002 ++#define RG_ADC2LA_CLKPH_I_MSK 0xfffffffd ++#define RG_ADC2LA_CLKPH_SFT 1 ++#define RG_ADC2LA_CLKPH_HI 1 ++#define RG_ADC2LA_CLKPH_SZ 1 ++#define RG_RXIQ_EMU_IDX_MSK 0x0000000f ++#define RG_RXIQ_EMU_IDX_I_MSK 0xfffffff0 ++#define RG_RXIQ_EMU_IDX_SFT 0 ++#define RG_RXIQ_EMU_IDX_HI 3 ++#define RG_RXIQ_EMU_IDX_SZ 4 ++#define RG_IQCAL_BP_ACI_MSK 0x00000010 ++#define RG_IQCAL_BP_ACI_I_MSK 0xffffffef ++#define RG_IQCAL_BP_ACI_SFT 4 ++#define RG_IQCAL_BP_ACI_HI 4 ++#define RG_IQCAL_BP_ACI_SZ 1 ++#define RG_DPD_AM_EN_MSK 0x00000001 ++#define RG_DPD_AM_EN_I_MSK 0xfffffffe ++#define RG_DPD_AM_EN_SFT 0 ++#define RG_DPD_AM_EN_HI 0 ++#define RG_DPD_AM_EN_SZ 1 ++#define RG_DPD_PM_EN_MSK 0x00000002 ++#define RG_DPD_PM_EN_I_MSK 0xfffffffd ++#define RG_DPD_PM_EN_SFT 1 ++#define RG_DPD_PM_EN_HI 1 ++#define RG_DPD_PM_EN_SZ 1 ++#define RG_DPD_PM_AMSEL_MSK 0x00000004 ++#define RG_DPD_PM_AMSEL_I_MSK 0xfffffffb ++#define RG_DPD_PM_AMSEL_SFT 2 ++#define RG_DPD_PM_AMSEL_HI 2 ++#define RG_DPD_PM_AMSEL_SZ 1 ++#define RG_DPD_020_GAIN_MSK 0x000003ff ++#define RG_DPD_020_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_020_GAIN_SFT 0 ++#define RG_DPD_020_GAIN_HI 9 ++#define RG_DPD_020_GAIN_SZ 10 ++#define RG_DPD_040_GAIN_MSK 0x03ff0000 ++#define RG_DPD_040_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_040_GAIN_SFT 16 ++#define RG_DPD_040_GAIN_HI 25 ++#define RG_DPD_040_GAIN_SZ 10 ++#define RG_DPD_060_GAIN_MSK 0x000003ff ++#define RG_DPD_060_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_060_GAIN_SFT 0 ++#define RG_DPD_060_GAIN_HI 9 ++#define RG_DPD_060_GAIN_SZ 10 ++#define RG_DPD_080_GAIN_MSK 0x03ff0000 ++#define RG_DPD_080_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_080_GAIN_SFT 16 ++#define RG_DPD_080_GAIN_HI 25 ++#define RG_DPD_080_GAIN_SZ 10 ++#define RG_DPD_0A0_GAIN_MSK 0x000003ff ++#define RG_DPD_0A0_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_0A0_GAIN_SFT 0 ++#define RG_DPD_0A0_GAIN_HI 9 ++#define RG_DPD_0A0_GAIN_SZ 10 ++#define RG_DPD_0C0_GAIN_MSK 0x03ff0000 ++#define RG_DPD_0C0_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_0C0_GAIN_SFT 16 ++#define RG_DPD_0C0_GAIN_HI 25 ++#define RG_DPD_0C0_GAIN_SZ 10 ++#define RG_DPD_0D0_GAIN_MSK 0x000003ff ++#define RG_DPD_0D0_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_0D0_GAIN_SFT 0 ++#define RG_DPD_0D0_GAIN_HI 9 ++#define RG_DPD_0D0_GAIN_SZ 10 ++#define RG_DPD_0E0_GAIN_MSK 0x03ff0000 ++#define RG_DPD_0E0_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_0E0_GAIN_SFT 16 ++#define RG_DPD_0E0_GAIN_HI 25 ++#define RG_DPD_0E0_GAIN_SZ 10 ++#define RG_DPD_0F0_GAIN_MSK 0x000003ff ++#define RG_DPD_0F0_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_0F0_GAIN_SFT 0 ++#define RG_DPD_0F0_GAIN_HI 9 ++#define RG_DPD_0F0_GAIN_SZ 10 ++#define RG_DPD_100_GAIN_MSK 0x03ff0000 ++#define RG_DPD_100_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_100_GAIN_SFT 16 ++#define RG_DPD_100_GAIN_HI 25 ++#define RG_DPD_100_GAIN_SZ 10 ++#define RG_DPD_110_GAIN_MSK 0x000003ff ++#define RG_DPD_110_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_110_GAIN_SFT 0 ++#define RG_DPD_110_GAIN_HI 9 ++#define RG_DPD_110_GAIN_SZ 10 ++#define RG_DPD_120_GAIN_MSK 0x03ff0000 ++#define RG_DPD_120_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_120_GAIN_SFT 16 ++#define RG_DPD_120_GAIN_HI 25 ++#define RG_DPD_120_GAIN_SZ 10 ++#define RG_DPD_130_GAIN_MSK 0x000003ff ++#define RG_DPD_130_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_130_GAIN_SFT 0 ++#define RG_DPD_130_GAIN_HI 9 ++#define RG_DPD_130_GAIN_SZ 10 ++#define RG_DPD_140_GAIN_MSK 0x03ff0000 ++#define RG_DPD_140_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_140_GAIN_SFT 16 ++#define RG_DPD_140_GAIN_HI 25 ++#define RG_DPD_140_GAIN_SZ 10 ++#define RG_DPD_150_GAIN_MSK 0x000003ff ++#define RG_DPD_150_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_150_GAIN_SFT 0 ++#define RG_DPD_150_GAIN_HI 9 ++#define RG_DPD_150_GAIN_SZ 10 ++#define RG_DPD_160_GAIN_MSK 0x03ff0000 ++#define RG_DPD_160_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_160_GAIN_SFT 16 ++#define RG_DPD_160_GAIN_HI 25 ++#define RG_DPD_160_GAIN_SZ 10 ++#define RG_DPD_170_GAIN_MSK 0x000003ff ++#define RG_DPD_170_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_170_GAIN_SFT 0 ++#define RG_DPD_170_GAIN_HI 9 ++#define RG_DPD_170_GAIN_SZ 10 ++#define RG_DPD_180_GAIN_MSK 0x03ff0000 ++#define RG_DPD_180_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_180_GAIN_SFT 16 ++#define RG_DPD_180_GAIN_HI 25 ++#define RG_DPD_180_GAIN_SZ 10 ++#define RG_DPD_190_GAIN_MSK 0x000003ff ++#define RG_DPD_190_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_190_GAIN_SFT 0 ++#define RG_DPD_190_GAIN_HI 9 ++#define RG_DPD_190_GAIN_SZ 10 ++#define RG_DPD_1A0_GAIN_MSK 0x03ff0000 ++#define RG_DPD_1A0_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_1A0_GAIN_SFT 16 ++#define RG_DPD_1A0_GAIN_HI 25 ++#define RG_DPD_1A0_GAIN_SZ 10 ++#define RG_DPD_1B0_GAIN_MSK 0x000003ff ++#define RG_DPD_1B0_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_1B0_GAIN_SFT 0 ++#define RG_DPD_1B0_GAIN_HI 9 ++#define RG_DPD_1B0_GAIN_SZ 10 ++#define RG_DPD_1C0_GAIN_MSK 0x03ff0000 ++#define RG_DPD_1C0_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_1C0_GAIN_SFT 16 ++#define RG_DPD_1C0_GAIN_HI 25 ++#define RG_DPD_1C0_GAIN_SZ 10 ++#define RG_DPD_1D0_GAIN_MSK 0x000003ff ++#define RG_DPD_1D0_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_1D0_GAIN_SFT 0 ++#define RG_DPD_1D0_GAIN_HI 9 ++#define RG_DPD_1D0_GAIN_SZ 10 ++#define RG_DPD_1E0_GAIN_MSK 0x03ff0000 ++#define RG_DPD_1E0_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_1E0_GAIN_SFT 16 ++#define RG_DPD_1E0_GAIN_HI 25 ++#define RG_DPD_1E0_GAIN_SZ 10 ++#define RG_DPD_1F0_GAIN_MSK 0x000003ff ++#define RG_DPD_1F0_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_1F0_GAIN_SFT 0 ++#define RG_DPD_1F0_GAIN_HI 9 ++#define RG_DPD_1F0_GAIN_SZ 10 ++#define RG_DPD_200_GAIN_MSK 0x03ff0000 ++#define RG_DPD_200_GAIN_I_MSK 0xfc00ffff ++#define RG_DPD_200_GAIN_SFT 16 ++#define RG_DPD_200_GAIN_HI 25 ++#define RG_DPD_200_GAIN_SZ 10 ++#define RG_DPD_020_PH_MSK 0x00001fff ++#define RG_DPD_020_PH_I_MSK 0xffffe000 ++#define RG_DPD_020_PH_SFT 0 ++#define RG_DPD_020_PH_HI 12 ++#define RG_DPD_020_PH_SZ 13 ++#define RG_DPD_040_PH_MSK 0x1fff0000 ++#define RG_DPD_040_PH_I_MSK 0xe000ffff ++#define RG_DPD_040_PH_SFT 16 ++#define RG_DPD_040_PH_HI 28 ++#define RG_DPD_040_PH_SZ 13 ++#define RG_DPD_060_PH_MSK 0x00001fff ++#define RG_DPD_060_PH_I_MSK 0xffffe000 ++#define RG_DPD_060_PH_SFT 0 ++#define RG_DPD_060_PH_HI 12 ++#define RG_DPD_060_PH_SZ 13 ++#define RG_DPD_080_PH_MSK 0x1fff0000 ++#define RG_DPD_080_PH_I_MSK 0xe000ffff ++#define RG_DPD_080_PH_SFT 16 ++#define RG_DPD_080_PH_HI 28 ++#define RG_DPD_080_PH_SZ 13 ++#define RG_DPD_0A0_PH_MSK 0x00001fff ++#define RG_DPD_0A0_PH_I_MSK 0xffffe000 ++#define RG_DPD_0A0_PH_SFT 0 ++#define RG_DPD_0A0_PH_HI 12 ++#define RG_DPD_0A0_PH_SZ 13 ++#define RG_DPD_0C0_PH_MSK 0x1fff0000 ++#define RG_DPD_0C0_PH_I_MSK 0xe000ffff ++#define RG_DPD_0C0_PH_SFT 16 ++#define RG_DPD_0C0_PH_HI 28 ++#define RG_DPD_0C0_PH_SZ 13 ++#define RG_DPD_0D0_PH_MSK 0x00001fff ++#define RG_DPD_0D0_PH_I_MSK 0xffffe000 ++#define RG_DPD_0D0_PH_SFT 0 ++#define RG_DPD_0D0_PH_HI 12 ++#define RG_DPD_0D0_PH_SZ 13 ++#define RG_DPD_0E0_PH_MSK 0x1fff0000 ++#define RG_DPD_0E0_PH_I_MSK 0xe000ffff ++#define RG_DPD_0E0_PH_SFT 16 ++#define RG_DPD_0E0_PH_HI 28 ++#define RG_DPD_0E0_PH_SZ 13 ++#define RG_DPD_0F0_PH_MSK 0x00001fff ++#define RG_DPD_0F0_PH_I_MSK 0xffffe000 ++#define RG_DPD_0F0_PH_SFT 0 ++#define RG_DPD_0F0_PH_HI 12 ++#define RG_DPD_0F0_PH_SZ 13 ++#define RG_DPD_100_PH_MSK 0x1fff0000 ++#define RG_DPD_100_PH_I_MSK 0xe000ffff ++#define RG_DPD_100_PH_SFT 16 ++#define RG_DPD_100_PH_HI 28 ++#define RG_DPD_100_PH_SZ 13 ++#define RG_DPD_110_PH_MSK 0x00001fff ++#define RG_DPD_110_PH_I_MSK 0xffffe000 ++#define RG_DPD_110_PH_SFT 0 ++#define RG_DPD_110_PH_HI 12 ++#define RG_DPD_110_PH_SZ 13 ++#define RG_DPD_120_PH_MSK 0x1fff0000 ++#define RG_DPD_120_PH_I_MSK 0xe000ffff ++#define RG_DPD_120_PH_SFT 16 ++#define RG_DPD_120_PH_HI 28 ++#define RG_DPD_120_PH_SZ 13 ++#define RG_DPD_130_PH_MSK 0x00001fff ++#define RG_DPD_130_PH_I_MSK 0xffffe000 ++#define RG_DPD_130_PH_SFT 0 ++#define RG_DPD_130_PH_HI 12 ++#define RG_DPD_130_PH_SZ 13 ++#define RG_DPD_140_PH_MSK 0x1fff0000 ++#define RG_DPD_140_PH_I_MSK 0xe000ffff ++#define RG_DPD_140_PH_SFT 16 ++#define RG_DPD_140_PH_HI 28 ++#define RG_DPD_140_PH_SZ 13 ++#define RG_DPD_150_PH_MSK 0x00001fff ++#define RG_DPD_150_PH_I_MSK 0xffffe000 ++#define RG_DPD_150_PH_SFT 0 ++#define RG_DPD_150_PH_HI 12 ++#define RG_DPD_150_PH_SZ 13 ++#define RG_DPD_160_PH_MSK 0x1fff0000 ++#define RG_DPD_160_PH_I_MSK 0xe000ffff ++#define RG_DPD_160_PH_SFT 16 ++#define RG_DPD_160_PH_HI 28 ++#define RG_DPD_160_PH_SZ 13 ++#define RG_DPD_170_PH_MSK 0x00001fff ++#define RG_DPD_170_PH_I_MSK 0xffffe000 ++#define RG_DPD_170_PH_SFT 0 ++#define RG_DPD_170_PH_HI 12 ++#define RG_DPD_170_PH_SZ 13 ++#define RG_DPD_180_PH_MSK 0x1fff0000 ++#define RG_DPD_180_PH_I_MSK 0xe000ffff ++#define RG_DPD_180_PH_SFT 16 ++#define RG_DPD_180_PH_HI 28 ++#define RG_DPD_180_PH_SZ 13 ++#define RG_DPD_190_PH_MSK 0x00001fff ++#define RG_DPD_190_PH_I_MSK 0xffffe000 ++#define RG_DPD_190_PH_SFT 0 ++#define RG_DPD_190_PH_HI 12 ++#define RG_DPD_190_PH_SZ 13 ++#define RG_DPD_1A0_PH_MSK 0x1fff0000 ++#define RG_DPD_1A0_PH_I_MSK 0xe000ffff ++#define RG_DPD_1A0_PH_SFT 16 ++#define RG_DPD_1A0_PH_HI 28 ++#define RG_DPD_1A0_PH_SZ 13 ++#define RG_DPD_1B0_PH_MSK 0x00001fff ++#define RG_DPD_1B0_PH_I_MSK 0xffffe000 ++#define RG_DPD_1B0_PH_SFT 0 ++#define RG_DPD_1B0_PH_HI 12 ++#define RG_DPD_1B0_PH_SZ 13 ++#define RG_DPD_1C0_PH_MSK 0x1fff0000 ++#define RG_DPD_1C0_PH_I_MSK 0xe000ffff ++#define RG_DPD_1C0_PH_SFT 16 ++#define RG_DPD_1C0_PH_HI 28 ++#define RG_DPD_1C0_PH_SZ 13 ++#define RG_DPD_1D0_PH_MSK 0x00001fff ++#define RG_DPD_1D0_PH_I_MSK 0xffffe000 ++#define RG_DPD_1D0_PH_SFT 0 ++#define RG_DPD_1D0_PH_HI 12 ++#define RG_DPD_1D0_PH_SZ 13 ++#define RG_DPD_1E0_PH_MSK 0x1fff0000 ++#define RG_DPD_1E0_PH_I_MSK 0xe000ffff ++#define RG_DPD_1E0_PH_SFT 16 ++#define RG_DPD_1E0_PH_HI 28 ++#define RG_DPD_1E0_PH_SZ 13 ++#define RG_DPD_1F0_PH_MSK 0x00001fff ++#define RG_DPD_1F0_PH_I_MSK 0xffffe000 ++#define RG_DPD_1F0_PH_SFT 0 ++#define RG_DPD_1F0_PH_HI 12 ++#define RG_DPD_1F0_PH_SZ 13 ++#define RG_DPD_200_PH_MSK 0x1fff0000 ++#define RG_DPD_200_PH_I_MSK 0xe000ffff ++#define RG_DPD_200_PH_SFT 16 ++#define RG_DPD_200_PH_HI 28 ++#define RG_DPD_200_PH_SZ 13 ++#define RG_DPD_GAIN_EST_Y0_MSK 0x000001ff ++#define RG_DPD_GAIN_EST_Y0_I_MSK 0xfffffe00 ++#define RG_DPD_GAIN_EST_Y0_SFT 0 ++#define RG_DPD_GAIN_EST_Y0_HI 8 ++#define RG_DPD_GAIN_EST_Y0_SZ 9 ++#define RG_DPD_GAIN_EST_Y1_MSK 0x01ff0000 ++#define RG_DPD_GAIN_EST_Y1_I_MSK 0xfe00ffff ++#define RG_DPD_GAIN_EST_Y1_SFT 16 ++#define RG_DPD_GAIN_EST_Y1_HI 24 ++#define RG_DPD_GAIN_EST_Y1_SZ 9 ++#define RG_DPD_LOOP_GAIN_MSK 0x000003ff ++#define RG_DPD_LOOP_GAIN_I_MSK 0xfffffc00 ++#define RG_DPD_LOOP_GAIN_SFT 0 ++#define RG_DPD_LOOP_GAIN_HI 9 ++#define RG_DPD_LOOP_GAIN_SZ 10 ++#define RG_DPD_GAIN_EST_X0_MSK 0x000001ff ++#define RG_DPD_GAIN_EST_X0_I_MSK 0xfffffe00 ++#define RG_DPD_GAIN_EST_X0_SFT 0 ++#define RG_DPD_GAIN_EST_X0_HI 8 ++#define RG_DPD_GAIN_EST_X0_SZ 9 ++#define RO_DPD_GAIN_MSK 0x03ff0000 ++#define RO_DPD_GAIN_I_MSK 0xfc00ffff ++#define RO_DPD_GAIN_SFT 16 ++#define RO_DPD_GAIN_HI 25 ++#define RO_DPD_GAIN_SZ 10 ++#define TX_SCALE_11B_MSK 0x000000ff ++#define TX_SCALE_11B_I_MSK 0xffffff00 ++#define TX_SCALE_11B_SFT 0 ++#define TX_SCALE_11B_HI 7 ++#define TX_SCALE_11B_SZ 8 ++#define TX_SCALE_11B_P0D5_MSK 0x0000ff00 ++#define TX_SCALE_11B_P0D5_I_MSK 0xffff00ff ++#define TX_SCALE_11B_P0D5_SFT 8 ++#define TX_SCALE_11B_P0D5_HI 15 ++#define TX_SCALE_11B_P0D5_SZ 8 ++#define TX_SCALE_11G_MSK 0x00ff0000 ++#define TX_SCALE_11G_I_MSK 0xff00ffff ++#define TX_SCALE_11G_SFT 16 ++#define TX_SCALE_11G_HI 23 ++#define TX_SCALE_11G_SZ 8 ++#define TX_SCALE_11G_P0D5_MSK 0xff000000 ++#define TX_SCALE_11G_P0D5_I_MSK 0x00ffffff ++#define TX_SCALE_11G_P0D5_SFT 24 ++#define TX_SCALE_11G_P0D5_HI 31 ++#define TX_SCALE_11G_P0D5_SZ 8 ++#define RG_EN_MANUAL_MSK 0x00000001 ++#define RG_EN_MANUAL_I_MSK 0xfffffffe ++#define RG_EN_MANUAL_SFT 0 ++#define RG_EN_MANUAL_HI 0 ++#define RG_EN_MANUAL_SZ 1 ++#define RG_TX_EN_MSK 0x00000002 ++#define RG_TX_EN_I_MSK 0xfffffffd ++#define RG_TX_EN_SFT 1 ++#define RG_TX_EN_HI 1 ++#define RG_TX_EN_SZ 1 ++#define RG_TX_PA_EN_MSK 0x00000004 ++#define RG_TX_PA_EN_I_MSK 0xfffffffb ++#define RG_TX_PA_EN_SFT 2 ++#define RG_TX_PA_EN_HI 2 ++#define RG_TX_PA_EN_SZ 1 ++#define RG_TX_DAC_EN_MSK 0x00000008 ++#define RG_TX_DAC_EN_I_MSK 0xfffffff7 ++#define RG_TX_DAC_EN_SFT 3 ++#define RG_TX_DAC_EN_HI 3 ++#define RG_TX_DAC_EN_SZ 1 ++#define RG_RX_AGC_MSK 0x00000010 ++#define RG_RX_AGC_I_MSK 0xffffffef ++#define RG_RX_AGC_SFT 4 ++#define RG_RX_AGC_HI 4 ++#define RG_RX_AGC_SZ 1 ++#define RG_RX_GAIN_MANUAL_MSK 0x00000020 ++#define RG_RX_GAIN_MANUAL_I_MSK 0xffffffdf ++#define RG_RX_GAIN_MANUAL_SFT 5 ++#define RG_RX_GAIN_MANUAL_HI 5 ++#define RG_RX_GAIN_MANUAL_SZ 1 ++#define RG_RFG_MSK 0x000000c0 ++#define RG_RFG_I_MSK 0xffffff3f ++#define RG_RFG_SFT 6 ++#define RG_RFG_HI 7 ++#define RG_RFG_SZ 2 ++#define RG_PGAG_MSK 0x00000f00 ++#define RG_PGAG_I_MSK 0xfffff0ff ++#define RG_PGAG_SFT 8 ++#define RG_PGAG_HI 11 ++#define RG_PGAG_SZ 4 ++#define RG_MODE_MSK 0x00003000 ++#define RG_MODE_I_MSK 0xffffcfff ++#define RG_MODE_SFT 12 ++#define RG_MODE_HI 13 ++#define RG_MODE_SZ 2 ++#define RG_EN_TX_TRSW_MSK 0x00004000 ++#define RG_EN_TX_TRSW_I_MSK 0xffffbfff ++#define RG_EN_TX_TRSW_SFT 14 ++#define RG_EN_TX_TRSW_HI 14 ++#define RG_EN_TX_TRSW_SZ 1 ++#define RG_EN_SX_MSK 0x00008000 ++#define RG_EN_SX_I_MSK 0xffff7fff ++#define RG_EN_SX_SFT 15 ++#define RG_EN_SX_HI 15 ++#define RG_EN_SX_SZ 1 ++#define RG_EN_RX_LNA_MSK 0x00010000 ++#define RG_EN_RX_LNA_I_MSK 0xfffeffff ++#define RG_EN_RX_LNA_SFT 16 ++#define RG_EN_RX_LNA_HI 16 ++#define RG_EN_RX_LNA_SZ 1 ++#define RG_EN_RX_MIXER_MSK 0x00020000 ++#define RG_EN_RX_MIXER_I_MSK 0xfffdffff ++#define RG_EN_RX_MIXER_SFT 17 ++#define RG_EN_RX_MIXER_HI 17 ++#define RG_EN_RX_MIXER_SZ 1 ++#define RG_EN_RX_DIV2_MSK 0x00040000 ++#define RG_EN_RX_DIV2_I_MSK 0xfffbffff ++#define RG_EN_RX_DIV2_SFT 18 ++#define RG_EN_RX_DIV2_HI 18 ++#define RG_EN_RX_DIV2_SZ 1 ++#define RG_EN_RX_LOBUF_MSK 0x00080000 ++#define RG_EN_RX_LOBUF_I_MSK 0xfff7ffff ++#define RG_EN_RX_LOBUF_SFT 19 ++#define RG_EN_RX_LOBUF_HI 19 ++#define RG_EN_RX_LOBUF_SZ 1 ++#define RG_EN_RX_TZ_MSK 0x00100000 ++#define RG_EN_RX_TZ_I_MSK 0xffefffff ++#define RG_EN_RX_TZ_SFT 20 ++#define RG_EN_RX_TZ_HI 20 ++#define RG_EN_RX_TZ_SZ 1 ++#define RG_EN_RX_FILTER_MSK 0x00200000 ++#define RG_EN_RX_FILTER_I_MSK 0xffdfffff ++#define RG_EN_RX_FILTER_SFT 21 ++#define RG_EN_RX_FILTER_HI 21 ++#define RG_EN_RX_FILTER_SZ 1 ++#define RG_EN_RX_HPF_MSK 0x00400000 ++#define RG_EN_RX_HPF_I_MSK 0xffbfffff ++#define RG_EN_RX_HPF_SFT 22 ++#define RG_EN_RX_HPF_HI 22 ++#define RG_EN_RX_HPF_SZ 1 ++#define RG_EN_RX_RSSI_MSK 0x00800000 ++#define RG_EN_RX_RSSI_I_MSK 0xff7fffff ++#define RG_EN_RX_RSSI_SFT 23 ++#define RG_EN_RX_RSSI_HI 23 ++#define RG_EN_RX_RSSI_SZ 1 ++#define RG_EN_ADC_MSK 0x01000000 ++#define RG_EN_ADC_I_MSK 0xfeffffff ++#define RG_EN_ADC_SFT 24 ++#define RG_EN_ADC_HI 24 ++#define RG_EN_ADC_SZ 1 ++#define RG_EN_TX_MOD_MSK 0x02000000 ++#define RG_EN_TX_MOD_I_MSK 0xfdffffff ++#define RG_EN_TX_MOD_SFT 25 ++#define RG_EN_TX_MOD_HI 25 ++#define RG_EN_TX_MOD_SZ 1 ++#define RG_EN_TX_DIV2_MSK 0x04000000 ++#define RG_EN_TX_DIV2_I_MSK 0xfbffffff ++#define RG_EN_TX_DIV2_SFT 26 ++#define RG_EN_TX_DIV2_HI 26 ++#define RG_EN_TX_DIV2_SZ 1 ++#define RG_EN_TX_DIV2_BUF_MSK 0x08000000 ++#define RG_EN_TX_DIV2_BUF_I_MSK 0xf7ffffff ++#define RG_EN_TX_DIV2_BUF_SFT 27 ++#define RG_EN_TX_DIV2_BUF_HI 27 ++#define RG_EN_TX_DIV2_BUF_SZ 1 ++#define RG_EN_TX_LOBF_MSK 0x10000000 ++#define RG_EN_TX_LOBF_I_MSK 0xefffffff ++#define RG_EN_TX_LOBF_SFT 28 ++#define RG_EN_TX_LOBF_HI 28 ++#define RG_EN_TX_LOBF_SZ 1 ++#define RG_EN_RX_LOBF_MSK 0x20000000 ++#define RG_EN_RX_LOBF_I_MSK 0xdfffffff ++#define RG_EN_RX_LOBF_SFT 29 ++#define RG_EN_RX_LOBF_HI 29 ++#define RG_EN_RX_LOBF_SZ 1 ++#define RG_SEL_DPLL_CLK_MSK 0x40000000 ++#define RG_SEL_DPLL_CLK_I_MSK 0xbfffffff ++#define RG_SEL_DPLL_CLK_SFT 30 ++#define RG_SEL_DPLL_CLK_HI 30 ++#define RG_SEL_DPLL_CLK_SZ 1 ++#define RG_EN_CLK_960MBY13_UART_MSK 0x80000000 ++#define RG_EN_CLK_960MBY13_UART_I_MSK 0x7fffffff ++#define RG_EN_CLK_960MBY13_UART_SFT 31 ++#define RG_EN_CLK_960MBY13_UART_HI 31 ++#define RG_EN_CLK_960MBY13_UART_SZ 1 ++#define RG_EN_TX_DPD_MSK 0x00000001 ++#define RG_EN_TX_DPD_I_MSK 0xfffffffe ++#define RG_EN_TX_DPD_SFT 0 ++#define RG_EN_TX_DPD_HI 0 ++#define RG_EN_TX_DPD_SZ 1 ++#define RG_EN_TX_TSSI_MSK 0x00000002 ++#define RG_EN_TX_TSSI_I_MSK 0xfffffffd ++#define RG_EN_TX_TSSI_SFT 1 ++#define RG_EN_TX_TSSI_HI 1 ++#define RG_EN_TX_TSSI_SZ 1 ++#define RG_EN_RX_IQCAL_MSK 0x00000004 ++#define RG_EN_RX_IQCAL_I_MSK 0xfffffffb ++#define RG_EN_RX_IQCAL_SFT 2 ++#define RG_EN_RX_IQCAL_HI 2 ++#define RG_EN_RX_IQCAL_SZ 1 ++#define RG_EN_TX_DAC_CAL_MSK 0x00000008 ++#define RG_EN_TX_DAC_CAL_I_MSK 0xfffffff7 ++#define RG_EN_TX_DAC_CAL_SFT 3 ++#define RG_EN_TX_DAC_CAL_HI 3 ++#define RG_EN_TX_DAC_CAL_SZ 1 ++#define RG_EN_TX_SELF_MIXER_MSK 0x00000010 ++#define RG_EN_TX_SELF_MIXER_I_MSK 0xffffffef ++#define RG_EN_TX_SELF_MIXER_SFT 4 ++#define RG_EN_TX_SELF_MIXER_HI 4 ++#define RG_EN_TX_SELF_MIXER_SZ 1 ++#define RG_EN_TX_DAC_OUT_MSK 0x00000020 ++#define RG_EN_TX_DAC_OUT_I_MSK 0xffffffdf ++#define RG_EN_TX_DAC_OUT_SFT 5 ++#define RG_EN_TX_DAC_OUT_HI 5 ++#define RG_EN_TX_DAC_OUT_SZ 1 ++#define RG_EN_LDO_RX_FE_MSK 0x00000040 ++#define RG_EN_LDO_RX_FE_I_MSK 0xffffffbf ++#define RG_EN_LDO_RX_FE_SFT 6 ++#define RG_EN_LDO_RX_FE_HI 6 ++#define RG_EN_LDO_RX_FE_SZ 1 ++#define RG_EN_LDO_ABB_MSK 0x00000080 ++#define RG_EN_LDO_ABB_I_MSK 0xffffff7f ++#define RG_EN_LDO_ABB_SFT 7 ++#define RG_EN_LDO_ABB_HI 7 ++#define RG_EN_LDO_ABB_SZ 1 ++#define RG_EN_LDO_AFE_MSK 0x00000100 ++#define RG_EN_LDO_AFE_I_MSK 0xfffffeff ++#define RG_EN_LDO_AFE_SFT 8 ++#define RG_EN_LDO_AFE_HI 8 ++#define RG_EN_LDO_AFE_SZ 1 ++#define RG_EN_SX_CHPLDO_MSK 0x00000200 ++#define RG_EN_SX_CHPLDO_I_MSK 0xfffffdff ++#define RG_EN_SX_CHPLDO_SFT 9 ++#define RG_EN_SX_CHPLDO_HI 9 ++#define RG_EN_SX_CHPLDO_SZ 1 ++#define RG_EN_SX_LOBFLDO_MSK 0x00000400 ++#define RG_EN_SX_LOBFLDO_I_MSK 0xfffffbff ++#define RG_EN_SX_LOBFLDO_SFT 10 ++#define RG_EN_SX_LOBFLDO_HI 10 ++#define RG_EN_SX_LOBFLDO_SZ 1 ++#define RG_EN_IREF_RX_MSK 0x00000800 ++#define RG_EN_IREF_RX_I_MSK 0xfffff7ff ++#define RG_EN_IREF_RX_SFT 11 ++#define RG_EN_IREF_RX_HI 11 ++#define RG_EN_IREF_RX_SZ 1 ++#define RG_EN_TX_DAC_VOUT_MSK 0x00002000 ++#define RG_EN_TX_DAC_VOUT_I_MSK 0xffffdfff ++#define RG_EN_TX_DAC_VOUT_SFT 13 ++#define RG_EN_TX_DAC_VOUT_HI 13 ++#define RG_EN_TX_DAC_VOUT_SZ 1 ++#define RG_EN_SX_LCK_BIN_MSK 0x00004000 ++#define RG_EN_SX_LCK_BIN_I_MSK 0xffffbfff ++#define RG_EN_SX_LCK_BIN_SFT 14 ++#define RG_EN_SX_LCK_BIN_HI 14 ++#define RG_EN_SX_LCK_BIN_SZ 1 ++#define RG_RTC_CAL_MODE_MSK 0x00010000 ++#define RG_RTC_CAL_MODE_I_MSK 0xfffeffff ++#define RG_RTC_CAL_MODE_SFT 16 ++#define RG_RTC_CAL_MODE_HI 16 ++#define RG_RTC_CAL_MODE_SZ 1 ++#define RG_EN_IQPAD_IOSW_MSK 0x00020000 ++#define RG_EN_IQPAD_IOSW_I_MSK 0xfffdffff ++#define RG_EN_IQPAD_IOSW_SFT 17 ++#define RG_EN_IQPAD_IOSW_HI 17 ++#define RG_EN_IQPAD_IOSW_SZ 1 ++#define RG_EN_TESTPAD_IOSW_MSK 0x00040000 ++#define RG_EN_TESTPAD_IOSW_I_MSK 0xfffbffff ++#define RG_EN_TESTPAD_IOSW_SFT 18 ++#define RG_EN_TESTPAD_IOSW_HI 18 ++#define RG_EN_TESTPAD_IOSW_SZ 1 ++#define RG_EN_TRXBF_BYPASS_MSK 0x00080000 ++#define RG_EN_TRXBF_BYPASS_I_MSK 0xfff7ffff ++#define RG_EN_TRXBF_BYPASS_SFT 19 ++#define RG_EN_TRXBF_BYPASS_HI 19 ++#define RG_EN_TRXBF_BYPASS_SZ 1 ++#define RG_LDO_LEVEL_RX_FE_MSK 0x00000007 ++#define RG_LDO_LEVEL_RX_FE_I_MSK 0xfffffff8 ++#define RG_LDO_LEVEL_RX_FE_SFT 0 ++#define RG_LDO_LEVEL_RX_FE_HI 2 ++#define RG_LDO_LEVEL_RX_FE_SZ 3 ++#define RG_LDO_LEVEL_ABB_MSK 0x00000038 ++#define RG_LDO_LEVEL_ABB_I_MSK 0xffffffc7 ++#define RG_LDO_LEVEL_ABB_SFT 3 ++#define RG_LDO_LEVEL_ABB_HI 5 ++#define RG_LDO_LEVEL_ABB_SZ 3 ++#define RG_LDO_LEVEL_AFE_MSK 0x000001c0 ++#define RG_LDO_LEVEL_AFE_I_MSK 0xfffffe3f ++#define RG_LDO_LEVEL_AFE_SFT 6 ++#define RG_LDO_LEVEL_AFE_HI 8 ++#define RG_LDO_LEVEL_AFE_SZ 3 ++#define RG_SX_LDO_CHP_LEVEL_MSK 0x00000e00 ++#define RG_SX_LDO_CHP_LEVEL_I_MSK 0xfffff1ff ++#define RG_SX_LDO_CHP_LEVEL_SFT 9 ++#define RG_SX_LDO_CHP_LEVEL_HI 11 ++#define RG_SX_LDO_CHP_LEVEL_SZ 3 ++#define RG_SX_LDO_LOBF_LEVEL_MSK 0x00007000 ++#define RG_SX_LDO_LOBF_LEVEL_I_MSK 0xffff8fff ++#define RG_SX_LDO_LOBF_LEVEL_SFT 12 ++#define RG_SX_LDO_LOBF_LEVEL_HI 14 ++#define RG_SX_LDO_LOBF_LEVEL_SZ 3 ++#define RG_SX_LDO_XOSC_LEVEL_MSK 0x00038000 ++#define RG_SX_LDO_XOSC_LEVEL_I_MSK 0xfffc7fff ++#define RG_SX_LDO_XOSC_LEVEL_SFT 15 ++#define RG_SX_LDO_XOSC_LEVEL_HI 17 ++#define RG_SX_LDO_XOSC_LEVEL_SZ 3 ++#define RG_DP_LDO_LEVEL_MSK 0x001c0000 ++#define RG_DP_LDO_LEVEL_I_MSK 0xffe3ffff ++#define RG_DP_LDO_LEVEL_SFT 18 ++#define RG_DP_LDO_LEVEL_HI 20 ++#define RG_DP_LDO_LEVEL_SZ 3 ++#define RG_SX_LDO_VCO_LEVEL_MSK 0x00e00000 ++#define RG_SX_LDO_VCO_LEVEL_I_MSK 0xff1fffff ++#define RG_SX_LDO_VCO_LEVEL_SFT 21 ++#define RG_SX_LDO_VCO_LEVEL_HI 23 ++#define RG_SX_LDO_VCO_LEVEL_SZ 3 ++#define RG_TX_LDO_TX_LEVEL_MSK 0x07000000 ++#define RG_TX_LDO_TX_LEVEL_I_MSK 0xf8ffffff ++#define RG_TX_LDO_TX_LEVEL_SFT 24 ++#define RG_TX_LDO_TX_LEVEL_HI 26 ++#define RG_TX_LDO_TX_LEVEL_SZ 3 ++#define RG_EN_RX_PADSW_MSK 0x00000001 ++#define RG_EN_RX_PADSW_I_MSK 0xfffffffe ++#define RG_EN_RX_PADSW_SFT 0 ++#define RG_EN_RX_PADSW_HI 0 ++#define RG_EN_RX_PADSW_SZ 1 ++#define RG_EN_RX_TESTNODE_MSK 0x00000002 ++#define RG_EN_RX_TESTNODE_I_MSK 0xfffffffd ++#define RG_EN_RX_TESTNODE_SFT 1 ++#define RG_EN_RX_TESTNODE_HI 1 ++#define RG_EN_RX_TESTNODE_SZ 1 ++#define RG_RX_ABBCFIX_MSK 0x00000004 ++#define RG_RX_ABBCFIX_I_MSK 0xfffffffb ++#define RG_RX_ABBCFIX_SFT 2 ++#define RG_RX_ABBCFIX_HI 2 ++#define RG_RX_ABBCFIX_SZ 1 ++#define RG_RX_ABBCTUNE_MSK 0x000001f8 ++#define RG_RX_ABBCTUNE_I_MSK 0xfffffe07 ++#define RG_RX_ABBCTUNE_SFT 3 ++#define RG_RX_ABBCTUNE_HI 8 ++#define RG_RX_ABBCTUNE_SZ 6 ++#define RG_RX_ABBOUT_TRI_STATE_MSK 0x00000200 ++#define RG_RX_ABBOUT_TRI_STATE_I_MSK 0xfffffdff ++#define RG_RX_ABBOUT_TRI_STATE_SFT 9 ++#define RG_RX_ABBOUT_TRI_STATE_HI 9 ++#define RG_RX_ABBOUT_TRI_STATE_SZ 1 ++#define RG_RX_ABB_N_MODE_MSK 0x00000400 ++#define RG_RX_ABB_N_MODE_I_MSK 0xfffffbff ++#define RG_RX_ABB_N_MODE_SFT 10 ++#define RG_RX_ABB_N_MODE_HI 10 ++#define RG_RX_ABB_N_MODE_SZ 1 ++#define RG_RX_EN_LOOPA_MSK 0x00000800 ++#define RG_RX_EN_LOOPA_I_MSK 0xfffff7ff ++#define RG_RX_EN_LOOPA_SFT 11 ++#define RG_RX_EN_LOOPA_HI 11 ++#define RG_RX_EN_LOOPA_SZ 1 ++#define RG_RX_FILTERI1ST_MSK 0x00003000 ++#define RG_RX_FILTERI1ST_I_MSK 0xffffcfff ++#define RG_RX_FILTERI1ST_SFT 12 ++#define RG_RX_FILTERI1ST_HI 13 ++#define RG_RX_FILTERI1ST_SZ 2 ++#define RG_RX_FILTERI2ND_MSK 0x0000c000 ++#define RG_RX_FILTERI2ND_I_MSK 0xffff3fff ++#define RG_RX_FILTERI2ND_SFT 14 ++#define RG_RX_FILTERI2ND_HI 15 ++#define RG_RX_FILTERI2ND_SZ 2 ++#define RG_RX_FILTERI3RD_MSK 0x00030000 ++#define RG_RX_FILTERI3RD_I_MSK 0xfffcffff ++#define RG_RX_FILTERI3RD_SFT 16 ++#define RG_RX_FILTERI3RD_HI 17 ++#define RG_RX_FILTERI3RD_SZ 2 ++#define RG_RX_FILTERI_COURSE_MSK 0x000c0000 ++#define RG_RX_FILTERI_COURSE_I_MSK 0xfff3ffff ++#define RG_RX_FILTERI_COURSE_SFT 18 ++#define RG_RX_FILTERI_COURSE_HI 19 ++#define RG_RX_FILTERI_COURSE_SZ 2 ++#define RG_RX_FILTERVCM_MSK 0x00300000 ++#define RG_RX_FILTERVCM_I_MSK 0xffcfffff ++#define RG_RX_FILTERVCM_SFT 20 ++#define RG_RX_FILTERVCM_HI 21 ++#define RG_RX_FILTERVCM_SZ 2 ++#define RG_RX_HPF3M_MSK 0x00400000 ++#define RG_RX_HPF3M_I_MSK 0xffbfffff ++#define RG_RX_HPF3M_SFT 22 ++#define RG_RX_HPF3M_HI 22 ++#define RG_RX_HPF3M_SZ 1 ++#define RG_RX_HPF300K_MSK 0x00800000 ++#define RG_RX_HPF300K_I_MSK 0xff7fffff ++#define RG_RX_HPF300K_SFT 23 ++#define RG_RX_HPF300K_HI 23 ++#define RG_RX_HPF300K_SZ 1 ++#define RG_RX_HPFI_MSK 0x03000000 ++#define RG_RX_HPFI_I_MSK 0xfcffffff ++#define RG_RX_HPFI_SFT 24 ++#define RG_RX_HPFI_HI 25 ++#define RG_RX_HPFI_SZ 2 ++#define RG_RX_HPF_FINALCORNER_MSK 0x0c000000 ++#define RG_RX_HPF_FINALCORNER_I_MSK 0xf3ffffff ++#define RG_RX_HPF_FINALCORNER_SFT 26 ++#define RG_RX_HPF_FINALCORNER_HI 27 ++#define RG_RX_HPF_FINALCORNER_SZ 2 ++#define RG_RX_HPF_SETTLE1_C_MSK 0x30000000 ++#define RG_RX_HPF_SETTLE1_C_I_MSK 0xcfffffff ++#define RG_RX_HPF_SETTLE1_C_SFT 28 ++#define RG_RX_HPF_SETTLE1_C_HI 29 ++#define RG_RX_HPF_SETTLE1_C_SZ 2 ++#define RG_RX_HPF_SETTLE1_R_MSK 0x00000003 ++#define RG_RX_HPF_SETTLE1_R_I_MSK 0xfffffffc ++#define RG_RX_HPF_SETTLE1_R_SFT 0 ++#define RG_RX_HPF_SETTLE1_R_HI 1 ++#define RG_RX_HPF_SETTLE1_R_SZ 2 ++#define RG_RX_HPF_SETTLE2_C_MSK 0x0000000c ++#define RG_RX_HPF_SETTLE2_C_I_MSK 0xfffffff3 ++#define RG_RX_HPF_SETTLE2_C_SFT 2 ++#define RG_RX_HPF_SETTLE2_C_HI 3 ++#define RG_RX_HPF_SETTLE2_C_SZ 2 ++#define RG_RX_HPF_SETTLE2_R_MSK 0x00000030 ++#define RG_RX_HPF_SETTLE2_R_I_MSK 0xffffffcf ++#define RG_RX_HPF_SETTLE2_R_SFT 4 ++#define RG_RX_HPF_SETTLE2_R_HI 5 ++#define RG_RX_HPF_SETTLE2_R_SZ 2 ++#define RG_RX_HPF_VCMCON2_MSK 0x000000c0 ++#define RG_RX_HPF_VCMCON2_I_MSK 0xffffff3f ++#define RG_RX_HPF_VCMCON2_SFT 6 ++#define RG_RX_HPF_VCMCON2_HI 7 ++#define RG_RX_HPF_VCMCON2_SZ 2 ++#define RG_RX_HPF_VCMCON_MSK 0x00000300 ++#define RG_RX_HPF_VCMCON_I_MSK 0xfffffcff ++#define RG_RX_HPF_VCMCON_SFT 8 ++#define RG_RX_HPF_VCMCON_HI 9 ++#define RG_RX_HPF_VCMCON_SZ 2 ++#define RG_RX_OUTVCM_MSK 0x00000c00 ++#define RG_RX_OUTVCM_I_MSK 0xfffff3ff ++#define RG_RX_OUTVCM_SFT 10 ++#define RG_RX_OUTVCM_HI 11 ++#define RG_RX_OUTVCM_SZ 2 ++#define RG_RX_TZI_MSK 0x00003000 ++#define RG_RX_TZI_I_MSK 0xffffcfff ++#define RG_RX_TZI_SFT 12 ++#define RG_RX_TZI_HI 13 ++#define RG_RX_TZI_SZ 2 ++#define RG_RX_TZ_OUT_TRISTATE_MSK 0x00004000 ++#define RG_RX_TZ_OUT_TRISTATE_I_MSK 0xffffbfff ++#define RG_RX_TZ_OUT_TRISTATE_SFT 14 ++#define RG_RX_TZ_OUT_TRISTATE_HI 14 ++#define RG_RX_TZ_OUT_TRISTATE_SZ 1 ++#define RG_RX_TZ_VCM_MSK 0x00018000 ++#define RG_RX_TZ_VCM_I_MSK 0xfffe7fff ++#define RG_RX_TZ_VCM_SFT 15 ++#define RG_RX_TZ_VCM_HI 16 ++#define RG_RX_TZ_VCM_SZ 2 ++#define RG_EN_RX_RSSI_TESTNODE_MSK 0x000e0000 ++#define RG_EN_RX_RSSI_TESTNODE_I_MSK 0xfff1ffff ++#define RG_EN_RX_RSSI_TESTNODE_SFT 17 ++#define RG_EN_RX_RSSI_TESTNODE_HI 19 ++#define RG_EN_RX_RSSI_TESTNODE_SZ 3 ++#define RG_RX_ADCRSSI_CLKSEL_MSK 0x00100000 ++#define RG_RX_ADCRSSI_CLKSEL_I_MSK 0xffefffff ++#define RG_RX_ADCRSSI_CLKSEL_SFT 20 ++#define RG_RX_ADCRSSI_CLKSEL_HI 20 ++#define RG_RX_ADCRSSI_CLKSEL_SZ 1 ++#define RG_RX_ADCRSSI_VCM_MSK 0x00600000 ++#define RG_RX_ADCRSSI_VCM_I_MSK 0xff9fffff ++#define RG_RX_ADCRSSI_VCM_SFT 21 ++#define RG_RX_ADCRSSI_VCM_HI 22 ++#define RG_RX_ADCRSSI_VCM_SZ 2 ++#define RG_RX_REC_LPFCORNER_MSK 0x01800000 ++#define RG_RX_REC_LPFCORNER_I_MSK 0xfe7fffff ++#define RG_RX_REC_LPFCORNER_SFT 23 ++#define RG_RX_REC_LPFCORNER_HI 24 ++#define RG_RX_REC_LPFCORNER_SZ 2 ++#define RG_RSSI_CLOCK_GATING_MSK 0x02000000 ++#define RG_RSSI_CLOCK_GATING_I_MSK 0xfdffffff ++#define RG_RSSI_CLOCK_GATING_SFT 25 ++#define RG_RSSI_CLOCK_GATING_HI 25 ++#define RG_RSSI_CLOCK_GATING_SZ 1 ++#define RG_TXPGA_CAPSW_MSK 0x00000003 ++#define RG_TXPGA_CAPSW_I_MSK 0xfffffffc ++#define RG_TXPGA_CAPSW_SFT 0 ++#define RG_TXPGA_CAPSW_HI 1 ++#define RG_TXPGA_CAPSW_SZ 2 ++#define RG_TXPGA_MAIN_MSK 0x000000fc ++#define RG_TXPGA_MAIN_I_MSK 0xffffff03 ++#define RG_TXPGA_MAIN_SFT 2 ++#define RG_TXPGA_MAIN_HI 7 ++#define RG_TXPGA_MAIN_SZ 6 ++#define RG_TXPGA_STEER_MSK 0x00003f00 ++#define RG_TXPGA_STEER_I_MSK 0xffffc0ff ++#define RG_TXPGA_STEER_SFT 8 ++#define RG_TXPGA_STEER_HI 13 ++#define RG_TXPGA_STEER_SZ 6 ++#define RG_TXMOD_GMCELL_MSK 0x0000c000 ++#define RG_TXMOD_GMCELL_I_MSK 0xffff3fff ++#define RG_TXMOD_GMCELL_SFT 14 ++#define RG_TXMOD_GMCELL_HI 15 ++#define RG_TXMOD_GMCELL_SZ 2 ++#define RG_TXLPF_GMCELL_MSK 0x00030000 ++#define RG_TXLPF_GMCELL_I_MSK 0xfffcffff ++#define RG_TXLPF_GMCELL_SFT 16 ++#define RG_TXLPF_GMCELL_HI 17 ++#define RG_TXLPF_GMCELL_SZ 2 ++#define RG_PACELL_EN_MSK 0x001c0000 ++#define RG_PACELL_EN_I_MSK 0xffe3ffff ++#define RG_PACELL_EN_SFT 18 ++#define RG_PACELL_EN_HI 20 ++#define RG_PACELL_EN_SZ 3 ++#define RG_PABIAS_CTRL_MSK 0x01e00000 ++#define RG_PABIAS_CTRL_I_MSK 0xfe1fffff ++#define RG_PABIAS_CTRL_SFT 21 ++#define RG_PABIAS_CTRL_HI 24 ++#define RG_PABIAS_CTRL_SZ 4 ++#define RG_TX_DIV_VSET_MSK 0x0c000000 ++#define RG_TX_DIV_VSET_I_MSK 0xf3ffffff ++#define RG_TX_DIV_VSET_SFT 26 ++#define RG_TX_DIV_VSET_HI 27 ++#define RG_TX_DIV_VSET_SZ 2 ++#define RG_TX_LOBUF_VSET_MSK 0x30000000 ++#define RG_TX_LOBUF_VSET_I_MSK 0xcfffffff ++#define RG_TX_LOBUF_VSET_SFT 28 ++#define RG_TX_LOBUF_VSET_HI 29 ++#define RG_TX_LOBUF_VSET_SZ 2 ++#define RG_RX_SQDC_MSK 0x00000007 ++#define RG_RX_SQDC_I_MSK 0xfffffff8 ++#define RG_RX_SQDC_SFT 0 ++#define RG_RX_SQDC_HI 2 ++#define RG_RX_SQDC_SZ 3 ++#define RG_RX_DIV2_CORE_MSK 0x00000018 ++#define RG_RX_DIV2_CORE_I_MSK 0xffffffe7 ++#define RG_RX_DIV2_CORE_SFT 3 ++#define RG_RX_DIV2_CORE_HI 4 ++#define RG_RX_DIV2_CORE_SZ 2 ++#define RG_RX_LOBUF_MSK 0x00000060 ++#define RG_RX_LOBUF_I_MSK 0xffffff9f ++#define RG_RX_LOBUF_SFT 5 ++#define RG_RX_LOBUF_HI 6 ++#define RG_RX_LOBUF_SZ 2 ++#define RG_TX_DPDGM_BIAS_MSK 0x00000780 ++#define RG_TX_DPDGM_BIAS_I_MSK 0xfffff87f ++#define RG_TX_DPDGM_BIAS_SFT 7 ++#define RG_TX_DPDGM_BIAS_HI 10 ++#define RG_TX_DPDGM_BIAS_SZ 4 ++#define RG_TX_DPD_DIV_MSK 0x00007800 ++#define RG_TX_DPD_DIV_I_MSK 0xffff87ff ++#define RG_TX_DPD_DIV_SFT 11 ++#define RG_TX_DPD_DIV_HI 14 ++#define RG_TX_DPD_DIV_SZ 4 ++#define RG_TX_TSSI_BIAS_MSK 0x00038000 ++#define RG_TX_TSSI_BIAS_I_MSK 0xfffc7fff ++#define RG_TX_TSSI_BIAS_SFT 15 ++#define RG_TX_TSSI_BIAS_HI 17 ++#define RG_TX_TSSI_BIAS_SZ 3 ++#define RG_TX_TSSI_DIV_MSK 0x001c0000 ++#define RG_TX_TSSI_DIV_I_MSK 0xffe3ffff ++#define RG_TX_TSSI_DIV_SFT 18 ++#define RG_TX_TSSI_DIV_HI 20 ++#define RG_TX_TSSI_DIV_SZ 3 ++#define RG_TX_TSSI_TESTMODE_MSK 0x00200000 ++#define RG_TX_TSSI_TESTMODE_I_MSK 0xffdfffff ++#define RG_TX_TSSI_TESTMODE_SFT 21 ++#define RG_TX_TSSI_TESTMODE_HI 21 ++#define RG_TX_TSSI_TESTMODE_SZ 1 ++#define RG_TX_TSSI_TEST_MSK 0x00c00000 ++#define RG_TX_TSSI_TEST_I_MSK 0xff3fffff ++#define RG_TX_TSSI_TEST_SFT 22 ++#define RG_TX_TSSI_TEST_HI 23 ++#define RG_TX_TSSI_TEST_SZ 2 ++#define RG_PACASCODE_CTRL_MSK 0x07000000 ++#define RG_PACASCODE_CTRL_I_MSK 0xf8ffffff ++#define RG_PACASCODE_CTRL_SFT 24 ++#define RG_PACASCODE_CTRL_HI 26 ++#define RG_PACASCODE_CTRL_SZ 3 ++#define RG_RX_HG_LNA_GC_MSK 0x00000003 ++#define RG_RX_HG_LNA_GC_I_MSK 0xfffffffc ++#define RG_RX_HG_LNA_GC_SFT 0 ++#define RG_RX_HG_LNA_GC_HI 1 ++#define RG_RX_HG_LNA_GC_SZ 2 ++#define RG_RX_HG_LNAHGN_BIAS_MSK 0x0000003c ++#define RG_RX_HG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define RG_RX_HG_LNAHGN_BIAS_SFT 2 ++#define RG_RX_HG_LNAHGN_BIAS_HI 5 ++#define RG_RX_HG_LNAHGN_BIAS_SZ 4 ++#define RG_RX_HG_LNAHGP_BIAS_MSK 0x000003c0 ++#define RG_RX_HG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define RG_RX_HG_LNAHGP_BIAS_SFT 6 ++#define RG_RX_HG_LNAHGP_BIAS_HI 9 ++#define RG_RX_HG_LNAHGP_BIAS_SZ 4 ++#define RG_RX_HG_LNALG_BIAS_MSK 0x00003c00 ++#define RG_RX_HG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define RG_RX_HG_LNALG_BIAS_SFT 10 ++#define RG_RX_HG_LNALG_BIAS_HI 13 ++#define RG_RX_HG_LNALG_BIAS_SZ 4 ++#define RG_RX_HG_TZ_GC_MSK 0x0000c000 ++#define RG_RX_HG_TZ_GC_I_MSK 0xffff3fff ++#define RG_RX_HG_TZ_GC_SFT 14 ++#define RG_RX_HG_TZ_GC_HI 15 ++#define RG_RX_HG_TZ_GC_SZ 2 ++#define RG_RX_HG_TZ_CAP_MSK 0x00070000 ++#define RG_RX_HG_TZ_CAP_I_MSK 0xfff8ffff ++#define RG_RX_HG_TZ_CAP_SFT 16 ++#define RG_RX_HG_TZ_CAP_HI 18 ++#define RG_RX_HG_TZ_CAP_SZ 3 ++#define RG_RX_MG_LNA_GC_MSK 0x00000003 ++#define RG_RX_MG_LNA_GC_I_MSK 0xfffffffc ++#define RG_RX_MG_LNA_GC_SFT 0 ++#define RG_RX_MG_LNA_GC_HI 1 ++#define RG_RX_MG_LNA_GC_SZ 2 ++#define RG_RX_MG_LNAHGN_BIAS_MSK 0x0000003c ++#define RG_RX_MG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define RG_RX_MG_LNAHGN_BIAS_SFT 2 ++#define RG_RX_MG_LNAHGN_BIAS_HI 5 ++#define RG_RX_MG_LNAHGN_BIAS_SZ 4 ++#define RG_RX_MG_LNAHGP_BIAS_MSK 0x000003c0 ++#define RG_RX_MG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define RG_RX_MG_LNAHGP_BIAS_SFT 6 ++#define RG_RX_MG_LNAHGP_BIAS_HI 9 ++#define RG_RX_MG_LNAHGP_BIAS_SZ 4 ++#define RG_RX_MG_LNALG_BIAS_MSK 0x00003c00 ++#define RG_RX_MG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define RG_RX_MG_LNALG_BIAS_SFT 10 ++#define RG_RX_MG_LNALG_BIAS_HI 13 ++#define RG_RX_MG_LNALG_BIAS_SZ 4 ++#define RG_RX_MG_TZ_GC_MSK 0x0000c000 ++#define RG_RX_MG_TZ_GC_I_MSK 0xffff3fff ++#define RG_RX_MG_TZ_GC_SFT 14 ++#define RG_RX_MG_TZ_GC_HI 15 ++#define RG_RX_MG_TZ_GC_SZ 2 ++#define RG_RX_MG_TZ_CAP_MSK 0x00070000 ++#define RG_RX_MG_TZ_CAP_I_MSK 0xfff8ffff ++#define RG_RX_MG_TZ_CAP_SFT 16 ++#define RG_RX_MG_TZ_CAP_HI 18 ++#define RG_RX_MG_TZ_CAP_SZ 3 ++#define RG_RX_LG_LNA_GC_MSK 0x00000003 ++#define RG_RX_LG_LNA_GC_I_MSK 0xfffffffc ++#define RG_RX_LG_LNA_GC_SFT 0 ++#define RG_RX_LG_LNA_GC_HI 1 ++#define RG_RX_LG_LNA_GC_SZ 2 ++#define RG_RX_LG_LNAHGN_BIAS_MSK 0x0000003c ++#define RG_RX_LG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define RG_RX_LG_LNAHGN_BIAS_SFT 2 ++#define RG_RX_LG_LNAHGN_BIAS_HI 5 ++#define RG_RX_LG_LNAHGN_BIAS_SZ 4 ++#define RG_RX_LG_LNAHGP_BIAS_MSK 0x000003c0 ++#define RG_RX_LG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define RG_RX_LG_LNAHGP_BIAS_SFT 6 ++#define RG_RX_LG_LNAHGP_BIAS_HI 9 ++#define RG_RX_LG_LNAHGP_BIAS_SZ 4 ++#define RG_RX_LG_LNALG_BIAS_MSK 0x00003c00 ++#define RG_RX_LG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define RG_RX_LG_LNALG_BIAS_SFT 10 ++#define RG_RX_LG_LNALG_BIAS_HI 13 ++#define RG_RX_LG_LNALG_BIAS_SZ 4 ++#define RG_RX_LG_TZ_GC_MSK 0x0000c000 ++#define RG_RX_LG_TZ_GC_I_MSK 0xffff3fff ++#define RG_RX_LG_TZ_GC_SFT 14 ++#define RG_RX_LG_TZ_GC_HI 15 ++#define RG_RX_LG_TZ_GC_SZ 2 ++#define RG_RX_LG_TZ_CAP_MSK 0x00070000 ++#define RG_RX_LG_TZ_CAP_I_MSK 0xfff8ffff ++#define RG_RX_LG_TZ_CAP_SFT 16 ++#define RG_RX_LG_TZ_CAP_HI 18 ++#define RG_RX_LG_TZ_CAP_SZ 3 ++#define RG_RX_ULG_LNA_GC_MSK 0x00000003 ++#define RG_RX_ULG_LNA_GC_I_MSK 0xfffffffc ++#define RG_RX_ULG_LNA_GC_SFT 0 ++#define RG_RX_ULG_LNA_GC_HI 1 ++#define RG_RX_ULG_LNA_GC_SZ 2 ++#define RG_RX_ULG_LNAHGN_BIAS_MSK 0x0000003c ++#define RG_RX_ULG_LNAHGN_BIAS_I_MSK 0xffffffc3 ++#define RG_RX_ULG_LNAHGN_BIAS_SFT 2 ++#define RG_RX_ULG_LNAHGN_BIAS_HI 5 ++#define RG_RX_ULG_LNAHGN_BIAS_SZ 4 ++#define RG_RX_ULG_LNAHGP_BIAS_MSK 0x000003c0 ++#define RG_RX_ULG_LNAHGP_BIAS_I_MSK 0xfffffc3f ++#define RG_RX_ULG_LNAHGP_BIAS_SFT 6 ++#define RG_RX_ULG_LNAHGP_BIAS_HI 9 ++#define RG_RX_ULG_LNAHGP_BIAS_SZ 4 ++#define RG_RX_ULG_LNALG_BIAS_MSK 0x00003c00 ++#define RG_RX_ULG_LNALG_BIAS_I_MSK 0xffffc3ff ++#define RG_RX_ULG_LNALG_BIAS_SFT 10 ++#define RG_RX_ULG_LNALG_BIAS_HI 13 ++#define RG_RX_ULG_LNALG_BIAS_SZ 4 ++#define RG_RX_ULG_TZ_GC_MSK 0x0000c000 ++#define RG_RX_ULG_TZ_GC_I_MSK 0xffff3fff ++#define RG_RX_ULG_TZ_GC_SFT 14 ++#define RG_RX_ULG_TZ_GC_HI 15 ++#define RG_RX_ULG_TZ_GC_SZ 2 ++#define RG_RX_ULG_TZ_CAP_MSK 0x00070000 ++#define RG_RX_ULG_TZ_CAP_I_MSK 0xfff8ffff ++#define RG_RX_ULG_TZ_CAP_SFT 16 ++#define RG_RX_ULG_TZ_CAP_HI 18 ++#define RG_RX_ULG_TZ_CAP_SZ 3 ++#define RG_HPF1_FAST_SET_X_MSK 0x00000001 ++#define RG_HPF1_FAST_SET_X_I_MSK 0xfffffffe ++#define RG_HPF1_FAST_SET_X_SFT 0 ++#define RG_HPF1_FAST_SET_X_HI 0 ++#define RG_HPF1_FAST_SET_X_SZ 1 ++#define RG_HPF1_FAST_SET_Y_MSK 0x00000002 ++#define RG_HPF1_FAST_SET_Y_I_MSK 0xfffffffd ++#define RG_HPF1_FAST_SET_Y_SFT 1 ++#define RG_HPF1_FAST_SET_Y_HI 1 ++#define RG_HPF1_FAST_SET_Y_SZ 1 ++#define RG_HPF1_FAST_SET_Z_MSK 0x00000004 ++#define RG_HPF1_FAST_SET_Z_I_MSK 0xfffffffb ++#define RG_HPF1_FAST_SET_Z_SFT 2 ++#define RG_HPF1_FAST_SET_Z_HI 2 ++#define RG_HPF1_FAST_SET_Z_SZ 1 ++#define RG_HPF_T1A_MSK 0x00000018 ++#define RG_HPF_T1A_I_MSK 0xffffffe7 ++#define RG_HPF_T1A_SFT 3 ++#define RG_HPF_T1A_HI 4 ++#define RG_HPF_T1A_SZ 2 ++#define RG_HPF_T1B_MSK 0x00000060 ++#define RG_HPF_T1B_I_MSK 0xffffff9f ++#define RG_HPF_T1B_SFT 5 ++#define RG_HPF_T1B_HI 6 ++#define RG_HPF_T1B_SZ 2 ++#define RG_HPF_T1C_MSK 0x00000180 ++#define RG_HPF_T1C_I_MSK 0xfffffe7f ++#define RG_HPF_T1C_SFT 7 ++#define RG_HPF_T1C_HI 8 ++#define RG_HPF_T1C_SZ 2 ++#define RG_RX_LNA_TRI_SEL_MSK 0x00000600 ++#define RG_RX_LNA_TRI_SEL_I_MSK 0xfffff9ff ++#define RG_RX_LNA_TRI_SEL_SFT 9 ++#define RG_RX_LNA_TRI_SEL_HI 10 ++#define RG_RX_LNA_TRI_SEL_SZ 2 ++#define RG_RX_LNA_SETTLE_MSK 0x00001800 ++#define RG_RX_LNA_SETTLE_I_MSK 0xffffe7ff ++#define RG_RX_LNA_SETTLE_SFT 11 ++#define RG_RX_LNA_SETTLE_HI 12 ++#define RG_RX_LNA_SETTLE_SZ 2 ++#define RG_TXGAIN_PHYCTRL_MSK 0x00002000 ++#define RG_TXGAIN_PHYCTRL_I_MSK 0xffffdfff ++#define RG_TXGAIN_PHYCTRL_SFT 13 ++#define RG_TXGAIN_PHYCTRL_HI 13 ++#define RG_TXGAIN_PHYCTRL_SZ 1 ++#define RG_TX_GAIN_MSK 0x003fc000 ++#define RG_TX_GAIN_I_MSK 0xffc03fff ++#define RG_TX_GAIN_SFT 14 ++#define RG_TX_GAIN_HI 21 ++#define RG_TX_GAIN_SZ 8 ++#define RG_TXGAIN_MANUAL_MSK 0x00400000 ++#define RG_TXGAIN_MANUAL_I_MSK 0xffbfffff ++#define RG_TXGAIN_MANUAL_SFT 22 ++#define RG_TXGAIN_MANUAL_HI 22 ++#define RG_TXGAIN_MANUAL_SZ 1 ++#define RG_TX_GAIN_OFFSET_MSK 0x07800000 ++#define RG_TX_GAIN_OFFSET_I_MSK 0xf87fffff ++#define RG_TX_GAIN_OFFSET_SFT 23 ++#define RG_TX_GAIN_OFFSET_HI 26 ++#define RG_TX_GAIN_OFFSET_SZ 4 ++#define RG_ADC_CLKSEL_MSK 0x00000001 ++#define RG_ADC_CLKSEL_I_MSK 0xfffffffe ++#define RG_ADC_CLKSEL_SFT 0 ++#define RG_ADC_CLKSEL_HI 0 ++#define RG_ADC_CLKSEL_SZ 1 ++#define RG_ADC_DIBIAS_MSK 0x00000006 ++#define RG_ADC_DIBIAS_I_MSK 0xfffffff9 ++#define RG_ADC_DIBIAS_SFT 1 ++#define RG_ADC_DIBIAS_HI 2 ++#define RG_ADC_DIBIAS_SZ 2 ++#define RG_ADC_DIVR_MSK 0x00000008 ++#define RG_ADC_DIVR_I_MSK 0xfffffff7 ++#define RG_ADC_DIVR_SFT 3 ++#define RG_ADC_DIVR_HI 3 ++#define RG_ADC_DIVR_SZ 1 ++#define RG_ADC_DVCMI_MSK 0x00000030 ++#define RG_ADC_DVCMI_I_MSK 0xffffffcf ++#define RG_ADC_DVCMI_SFT 4 ++#define RG_ADC_DVCMI_HI 5 ++#define RG_ADC_DVCMI_SZ 2 ++#define RG_ADC_SAMSEL_MSK 0x000003c0 ++#define RG_ADC_SAMSEL_I_MSK 0xfffffc3f ++#define RG_ADC_SAMSEL_SFT 6 ++#define RG_ADC_SAMSEL_HI 9 ++#define RG_ADC_SAMSEL_SZ 4 ++#define RG_ADC_STNBY_MSK 0x00000400 ++#define RG_ADC_STNBY_I_MSK 0xfffffbff ++#define RG_ADC_STNBY_SFT 10 ++#define RG_ADC_STNBY_HI 10 ++#define RG_ADC_STNBY_SZ 1 ++#define RG_ADC_TESTMODE_MSK 0x00000800 ++#define RG_ADC_TESTMODE_I_MSK 0xfffff7ff ++#define RG_ADC_TESTMODE_SFT 11 ++#define RG_ADC_TESTMODE_HI 11 ++#define RG_ADC_TESTMODE_SZ 1 ++#define RG_ADC_TSEL_MSK 0x0000f000 ++#define RG_ADC_TSEL_I_MSK 0xffff0fff ++#define RG_ADC_TSEL_SFT 12 ++#define RG_ADC_TSEL_HI 15 ++#define RG_ADC_TSEL_SZ 4 ++#define RG_ADC_VRSEL_MSK 0x00030000 ++#define RG_ADC_VRSEL_I_MSK 0xfffcffff ++#define RG_ADC_VRSEL_SFT 16 ++#define RG_ADC_VRSEL_HI 17 ++#define RG_ADC_VRSEL_SZ 2 ++#define RG_DICMP_MSK 0x000c0000 ++#define RG_DICMP_I_MSK 0xfff3ffff ++#define RG_DICMP_SFT 18 ++#define RG_DICMP_HI 19 ++#define RG_DICMP_SZ 2 ++#define RG_DIOP_MSK 0x00300000 ++#define RG_DIOP_I_MSK 0xffcfffff ++#define RG_DIOP_SFT 20 ++#define RG_DIOP_HI 21 ++#define RG_DIOP_SZ 2 ++#define RG_SARADC_VRSEL_MSK 0x00c00000 ++#define RG_SARADC_VRSEL_I_MSK 0xff3fffff ++#define RG_SARADC_VRSEL_SFT 22 ++#define RG_SARADC_VRSEL_HI 23 ++#define RG_SARADC_VRSEL_SZ 2 ++#define RG_EN_SAR_TEST_MSK 0x03000000 ++#define RG_EN_SAR_TEST_I_MSK 0xfcffffff ++#define RG_EN_SAR_TEST_SFT 24 ++#define RG_EN_SAR_TEST_HI 25 ++#define RG_EN_SAR_TEST_SZ 2 ++#define RG_SARADC_THERMAL_MSK 0x04000000 ++#define RG_SARADC_THERMAL_I_MSK 0xfbffffff ++#define RG_SARADC_THERMAL_SFT 26 ++#define RG_SARADC_THERMAL_HI 26 ++#define RG_SARADC_THERMAL_SZ 1 ++#define RG_SARADC_TSSI_MSK 0x08000000 ++#define RG_SARADC_TSSI_I_MSK 0xf7ffffff ++#define RG_SARADC_TSSI_SFT 27 ++#define RG_SARADC_TSSI_HI 27 ++#define RG_SARADC_TSSI_SZ 1 ++#define RG_CLK_SAR_SEL_MSK 0x30000000 ++#define RG_CLK_SAR_SEL_I_MSK 0xcfffffff ++#define RG_CLK_SAR_SEL_SFT 28 ++#define RG_CLK_SAR_SEL_HI 29 ++#define RG_CLK_SAR_SEL_SZ 2 ++#define RG_EN_SARADC_MSK 0x40000000 ++#define RG_EN_SARADC_I_MSK 0xbfffffff ++#define RG_EN_SARADC_SFT 30 ++#define RG_EN_SARADC_HI 30 ++#define RG_EN_SARADC_SZ 1 ++#define RG_DACI1ST_MSK 0x00000003 ++#define RG_DACI1ST_I_MSK 0xfffffffc ++#define RG_DACI1ST_SFT 0 ++#define RG_DACI1ST_HI 1 ++#define RG_DACI1ST_SZ 2 ++#define RG_TX_DACLPF_ICOURSE_MSK 0x0000000c ++#define RG_TX_DACLPF_ICOURSE_I_MSK 0xfffffff3 ++#define RG_TX_DACLPF_ICOURSE_SFT 2 ++#define RG_TX_DACLPF_ICOURSE_HI 3 ++#define RG_TX_DACLPF_ICOURSE_SZ 2 ++#define RG_TX_DACLPF_IFINE_MSK 0x00000030 ++#define RG_TX_DACLPF_IFINE_I_MSK 0xffffffcf ++#define RG_TX_DACLPF_IFINE_SFT 4 ++#define RG_TX_DACLPF_IFINE_HI 5 ++#define RG_TX_DACLPF_IFINE_SZ 2 ++#define RG_TX_DACLPF_VCM_MSK 0x000000c0 ++#define RG_TX_DACLPF_VCM_I_MSK 0xffffff3f ++#define RG_TX_DACLPF_VCM_SFT 6 ++#define RG_TX_DACLPF_VCM_HI 7 ++#define RG_TX_DACLPF_VCM_SZ 2 ++#define RG_TX_DAC_CKEDGE_SEL_MSK 0x00000100 ++#define RG_TX_DAC_CKEDGE_SEL_I_MSK 0xfffffeff ++#define RG_TX_DAC_CKEDGE_SEL_SFT 8 ++#define RG_TX_DAC_CKEDGE_SEL_HI 8 ++#define RG_TX_DAC_CKEDGE_SEL_SZ 1 ++#define RG_TX_DAC_IBIAS_MSK 0x00000600 ++#define RG_TX_DAC_IBIAS_I_MSK 0xfffff9ff ++#define RG_TX_DAC_IBIAS_SFT 9 ++#define RG_TX_DAC_IBIAS_HI 10 ++#define RG_TX_DAC_IBIAS_SZ 2 ++#define RG_TX_DAC_OS_MSK 0x00003800 ++#define RG_TX_DAC_OS_I_MSK 0xffffc7ff ++#define RG_TX_DAC_OS_SFT 11 ++#define RG_TX_DAC_OS_HI 13 ++#define RG_TX_DAC_OS_SZ 3 ++#define RG_TX_DAC_RCAL_MSK 0x0000c000 ++#define RG_TX_DAC_RCAL_I_MSK 0xffff3fff ++#define RG_TX_DAC_RCAL_SFT 14 ++#define RG_TX_DAC_RCAL_HI 15 ++#define RG_TX_DAC_RCAL_SZ 2 ++#define RG_TX_DAC_TSEL_MSK 0x000f0000 ++#define RG_TX_DAC_TSEL_I_MSK 0xfff0ffff ++#define RG_TX_DAC_TSEL_SFT 16 ++#define RG_TX_DAC_TSEL_HI 19 ++#define RG_TX_DAC_TSEL_SZ 4 ++#define RG_TX_EN_VOLTAGE_IN_MSK 0x00100000 ++#define RG_TX_EN_VOLTAGE_IN_I_MSK 0xffefffff ++#define RG_TX_EN_VOLTAGE_IN_SFT 20 ++#define RG_TX_EN_VOLTAGE_IN_HI 20 ++#define RG_TX_EN_VOLTAGE_IN_SZ 1 ++#define RG_TXLPF_BYPASS_MSK 0x00200000 ++#define RG_TXLPF_BYPASS_I_MSK 0xffdfffff ++#define RG_TXLPF_BYPASS_SFT 21 ++#define RG_TXLPF_BYPASS_HI 21 ++#define RG_TXLPF_BYPASS_SZ 1 ++#define RG_TXLPF_BOOSTI_MSK 0x00400000 ++#define RG_TXLPF_BOOSTI_I_MSK 0xffbfffff ++#define RG_TXLPF_BOOSTI_SFT 22 ++#define RG_TXLPF_BOOSTI_HI 22 ++#define RG_TXLPF_BOOSTI_SZ 1 ++#define RG_TX_DAC_IOFFSET_MSK 0x07800000 ++#define RG_TX_DAC_IOFFSET_I_MSK 0xf87fffff ++#define RG_TX_DAC_IOFFSET_SFT 23 ++#define RG_TX_DAC_IOFFSET_HI 26 ++#define RG_TX_DAC_IOFFSET_SZ 4 ++#define RG_TX_DAC_QOFFSET_MSK 0x78000000 ++#define RG_TX_DAC_QOFFSET_I_MSK 0x87ffffff ++#define RG_TX_DAC_QOFFSET_SFT 27 ++#define RG_TX_DAC_QOFFSET_HI 30 ++#define RG_TX_DAC_QOFFSET_SZ 4 ++#define RG_EN_SX_R3_MSK 0x00000001 ++#define RG_EN_SX_R3_I_MSK 0xfffffffe ++#define RG_EN_SX_R3_SFT 0 ++#define RG_EN_SX_R3_HI 0 ++#define RG_EN_SX_R3_SZ 1 ++#define RG_EN_SX_CH_MSK 0x00000002 ++#define RG_EN_SX_CH_I_MSK 0xfffffffd ++#define RG_EN_SX_CH_SFT 1 ++#define RG_EN_SX_CH_HI 1 ++#define RG_EN_SX_CH_SZ 1 ++#define RG_EN_SX_CHP_MSK 0x00000004 ++#define RG_EN_SX_CHP_I_MSK 0xfffffffb ++#define RG_EN_SX_CHP_SFT 2 ++#define RG_EN_SX_CHP_HI 2 ++#define RG_EN_SX_CHP_SZ 1 ++#define RG_EN_SX_DIVCK_MSK 0x00000008 ++#define RG_EN_SX_DIVCK_I_MSK 0xfffffff7 ++#define RG_EN_SX_DIVCK_SFT 3 ++#define RG_EN_SX_DIVCK_HI 3 ++#define RG_EN_SX_DIVCK_SZ 1 ++#define RG_EN_SX_VCOBF_MSK 0x00000010 ++#define RG_EN_SX_VCOBF_I_MSK 0xffffffef ++#define RG_EN_SX_VCOBF_SFT 4 ++#define RG_EN_SX_VCOBF_HI 4 ++#define RG_EN_SX_VCOBF_SZ 1 ++#define RG_EN_SX_VCO_MSK 0x00000020 ++#define RG_EN_SX_VCO_I_MSK 0xffffffdf ++#define RG_EN_SX_VCO_SFT 5 ++#define RG_EN_SX_VCO_HI 5 ++#define RG_EN_SX_VCO_SZ 1 ++#define RG_EN_SX_MOD_MSK 0x00000040 ++#define RG_EN_SX_MOD_I_MSK 0xffffffbf ++#define RG_EN_SX_MOD_SFT 6 ++#define RG_EN_SX_MOD_HI 6 ++#define RG_EN_SX_MOD_SZ 1 ++#define RG_EN_SX_DITHER_MSK 0x00000100 ++#define RG_EN_SX_DITHER_I_MSK 0xfffffeff ++#define RG_EN_SX_DITHER_SFT 8 ++#define RG_EN_SX_DITHER_HI 8 ++#define RG_EN_SX_DITHER_SZ 1 ++#define RG_EN_SX_VT_MON_MSK 0x00000800 ++#define RG_EN_SX_VT_MON_I_MSK 0xfffff7ff ++#define RG_EN_SX_VT_MON_SFT 11 ++#define RG_EN_SX_VT_MON_HI 11 ++#define RG_EN_SX_VT_MON_SZ 1 ++#define RG_EN_SX_VT_MON_DG_MSK 0x00001000 ++#define RG_EN_SX_VT_MON_DG_I_MSK 0xffffefff ++#define RG_EN_SX_VT_MON_DG_SFT 12 ++#define RG_EN_SX_VT_MON_DG_HI 12 ++#define RG_EN_SX_VT_MON_DG_SZ 1 ++#define RG_EN_SX_DIV_MSK 0x00002000 ++#define RG_EN_SX_DIV_I_MSK 0xffffdfff ++#define RG_EN_SX_DIV_SFT 13 ++#define RG_EN_SX_DIV_HI 13 ++#define RG_EN_SX_DIV_SZ 1 ++#define RG_EN_SX_LPF_MSK 0x00004000 ++#define RG_EN_SX_LPF_I_MSK 0xffffbfff ++#define RG_EN_SX_LPF_SFT 14 ++#define RG_EN_SX_LPF_HI 14 ++#define RG_EN_SX_LPF_SZ 1 ++#define RG_EN_DPL_MOD_MSK 0x00008000 ++#define RG_EN_DPL_MOD_I_MSK 0xffff7fff ++#define RG_EN_DPL_MOD_SFT 15 ++#define RG_EN_DPL_MOD_HI 15 ++#define RG_EN_DPL_MOD_SZ 1 ++#define RG_DPL_MOD_ORDER_MSK 0x00030000 ++#define RG_DPL_MOD_ORDER_I_MSK 0xfffcffff ++#define RG_DPL_MOD_ORDER_SFT 16 ++#define RG_DPL_MOD_ORDER_HI 17 ++#define RG_DPL_MOD_ORDER_SZ 2 ++#define RG_SX_RFCTRL_F_MSK 0x00ffffff ++#define RG_SX_RFCTRL_F_I_MSK 0xff000000 ++#define RG_SX_RFCTRL_F_SFT 0 ++#define RG_SX_RFCTRL_F_HI 23 ++#define RG_SX_RFCTRL_F_SZ 24 ++#define RG_SX_SEL_CP_MSK 0x0f000000 ++#define RG_SX_SEL_CP_I_MSK 0xf0ffffff ++#define RG_SX_SEL_CP_SFT 24 ++#define RG_SX_SEL_CP_HI 27 ++#define RG_SX_SEL_CP_SZ 4 ++#define RG_SX_SEL_CS_MSK 0xf0000000 ++#define RG_SX_SEL_CS_I_MSK 0x0fffffff ++#define RG_SX_SEL_CS_SFT 28 ++#define RG_SX_SEL_CS_HI 31 ++#define RG_SX_SEL_CS_SZ 4 ++#define RG_SX_RFCTRL_CH_MSK 0x000007ff ++#define RG_SX_RFCTRL_CH_I_MSK 0xfffff800 ++#define RG_SX_RFCTRL_CH_SFT 0 ++#define RG_SX_RFCTRL_CH_HI 10 ++#define RG_SX_RFCTRL_CH_SZ 11 ++#define RG_SX_SEL_C3_MSK 0x00007800 ++#define RG_SX_SEL_C3_I_MSK 0xffff87ff ++#define RG_SX_SEL_C3_SFT 11 ++#define RG_SX_SEL_C3_HI 14 ++#define RG_SX_SEL_C3_SZ 4 ++#define RG_SX_SEL_RS_MSK 0x000f8000 ++#define RG_SX_SEL_RS_I_MSK 0xfff07fff ++#define RG_SX_SEL_RS_SFT 15 ++#define RG_SX_SEL_RS_HI 19 ++#define RG_SX_SEL_RS_SZ 5 ++#define RG_SX_SEL_R3_MSK 0x01f00000 ++#define RG_SX_SEL_R3_I_MSK 0xfe0fffff ++#define RG_SX_SEL_R3_SFT 20 ++#define RG_SX_SEL_R3_HI 24 ++#define RG_SX_SEL_R3_SZ 5 ++#define RG_SX_SEL_ICHP_MSK 0x0000001f ++#define RG_SX_SEL_ICHP_I_MSK 0xffffffe0 ++#define RG_SX_SEL_ICHP_SFT 0 ++#define RG_SX_SEL_ICHP_HI 4 ++#define RG_SX_SEL_ICHP_SZ 5 ++#define RG_SX_SEL_PCHP_MSK 0x000003e0 ++#define RG_SX_SEL_PCHP_I_MSK 0xfffffc1f ++#define RG_SX_SEL_PCHP_SFT 5 ++#define RG_SX_SEL_PCHP_HI 9 ++#define RG_SX_SEL_PCHP_SZ 5 ++#define RG_SX_SEL_CHP_REGOP_MSK 0x00003c00 ++#define RG_SX_SEL_CHP_REGOP_I_MSK 0xffffc3ff ++#define RG_SX_SEL_CHP_REGOP_SFT 10 ++#define RG_SX_SEL_CHP_REGOP_HI 13 ++#define RG_SX_SEL_CHP_REGOP_SZ 4 ++#define RG_SX_SEL_CHP_UNIOP_MSK 0x0003c000 ++#define RG_SX_SEL_CHP_UNIOP_I_MSK 0xfffc3fff ++#define RG_SX_SEL_CHP_UNIOP_SFT 14 ++#define RG_SX_SEL_CHP_UNIOP_HI 17 ++#define RG_SX_SEL_CHP_UNIOP_SZ 4 ++#define RG_SX_CHP_IOST_POL_MSK 0x00040000 ++#define RG_SX_CHP_IOST_POL_I_MSK 0xfffbffff ++#define RG_SX_CHP_IOST_POL_SFT 18 ++#define RG_SX_CHP_IOST_POL_HI 18 ++#define RG_SX_CHP_IOST_POL_SZ 1 ++#define RG_SX_CHP_IOST_MSK 0x00380000 ++#define RG_SX_CHP_IOST_I_MSK 0xffc7ffff ++#define RG_SX_CHP_IOST_SFT 19 ++#define RG_SX_CHP_IOST_HI 21 ++#define RG_SX_CHP_IOST_SZ 3 ++#define RG_SX_PFDSEL_MSK 0x00400000 ++#define RG_SX_PFDSEL_I_MSK 0xffbfffff ++#define RG_SX_PFDSEL_SFT 22 ++#define RG_SX_PFDSEL_HI 22 ++#define RG_SX_PFDSEL_SZ 1 ++#define RG_SX_PFD_SET_MSK 0x00800000 ++#define RG_SX_PFD_SET_I_MSK 0xff7fffff ++#define RG_SX_PFD_SET_SFT 23 ++#define RG_SX_PFD_SET_HI 23 ++#define RG_SX_PFD_SET_SZ 1 ++#define RG_SX_PFD_SET1_MSK 0x01000000 ++#define RG_SX_PFD_SET1_I_MSK 0xfeffffff ++#define RG_SX_PFD_SET1_SFT 24 ++#define RG_SX_PFD_SET1_HI 24 ++#define RG_SX_PFD_SET1_SZ 1 ++#define RG_SX_PFD_SET2_MSK 0x02000000 ++#define RG_SX_PFD_SET2_I_MSK 0xfdffffff ++#define RG_SX_PFD_SET2_SFT 25 ++#define RG_SX_PFD_SET2_HI 25 ++#define RG_SX_PFD_SET2_SZ 1 ++#define RG_SX_VBNCAS_SEL_MSK 0x04000000 ++#define RG_SX_VBNCAS_SEL_I_MSK 0xfbffffff ++#define RG_SX_VBNCAS_SEL_SFT 26 ++#define RG_SX_VBNCAS_SEL_HI 26 ++#define RG_SX_VBNCAS_SEL_SZ 1 ++#define RG_SX_PFD_RST_H_MSK 0x08000000 ++#define RG_SX_PFD_RST_H_I_MSK 0xf7ffffff ++#define RG_SX_PFD_RST_H_SFT 27 ++#define RG_SX_PFD_RST_H_HI 27 ++#define RG_SX_PFD_RST_H_SZ 1 ++#define RG_SX_PFD_TRUP_MSK 0x10000000 ++#define RG_SX_PFD_TRUP_I_MSK 0xefffffff ++#define RG_SX_PFD_TRUP_SFT 28 ++#define RG_SX_PFD_TRUP_HI 28 ++#define RG_SX_PFD_TRUP_SZ 1 ++#define RG_SX_PFD_TRDN_MSK 0x20000000 ++#define RG_SX_PFD_TRDN_I_MSK 0xdfffffff ++#define RG_SX_PFD_TRDN_SFT 29 ++#define RG_SX_PFD_TRDN_HI 29 ++#define RG_SX_PFD_TRDN_SZ 1 ++#define RG_SX_PFD_TRSEL_MSK 0x40000000 ++#define RG_SX_PFD_TRSEL_I_MSK 0xbfffffff ++#define RG_SX_PFD_TRSEL_SFT 30 ++#define RG_SX_PFD_TRSEL_HI 30 ++#define RG_SX_PFD_TRSEL_SZ 1 ++#define RG_SX_VCOBA_R_MSK 0x00000007 ++#define RG_SX_VCOBA_R_I_MSK 0xfffffff8 ++#define RG_SX_VCOBA_R_SFT 0 ++#define RG_SX_VCOBA_R_HI 2 ++#define RG_SX_VCOBA_R_SZ 3 ++#define RG_SX_VCORSEL_MSK 0x000000f8 ++#define RG_SX_VCORSEL_I_MSK 0xffffff07 ++#define RG_SX_VCORSEL_SFT 3 ++#define RG_SX_VCORSEL_HI 7 ++#define RG_SX_VCORSEL_SZ 5 ++#define RG_SX_VCOCUSEL_MSK 0x00000f00 ++#define RG_SX_VCOCUSEL_I_MSK 0xfffff0ff ++#define RG_SX_VCOCUSEL_SFT 8 ++#define RG_SX_VCOCUSEL_HI 11 ++#define RG_SX_VCOCUSEL_SZ 4 ++#define RG_SX_RXBFSEL_MSK 0x0000f000 ++#define RG_SX_RXBFSEL_I_MSK 0xffff0fff ++#define RG_SX_RXBFSEL_SFT 12 ++#define RG_SX_RXBFSEL_HI 15 ++#define RG_SX_RXBFSEL_SZ 4 ++#define RG_SX_TXBFSEL_MSK 0x000f0000 ++#define RG_SX_TXBFSEL_I_MSK 0xfff0ffff ++#define RG_SX_TXBFSEL_SFT 16 ++#define RG_SX_TXBFSEL_HI 19 ++#define RG_SX_TXBFSEL_SZ 4 ++#define RG_SX_VCOBFSEL_MSK 0x00f00000 ++#define RG_SX_VCOBFSEL_I_MSK 0xff0fffff ++#define RG_SX_VCOBFSEL_SFT 20 ++#define RG_SX_VCOBFSEL_HI 23 ++#define RG_SX_VCOBFSEL_SZ 4 ++#define RG_SX_DIVBFSEL_MSK 0x0f000000 ++#define RG_SX_DIVBFSEL_I_MSK 0xf0ffffff ++#define RG_SX_DIVBFSEL_SFT 24 ++#define RG_SX_DIVBFSEL_HI 27 ++#define RG_SX_DIVBFSEL_SZ 4 ++#define RG_SX_GNDR_SEL_MSK 0xf0000000 ++#define RG_SX_GNDR_SEL_I_MSK 0x0fffffff ++#define RG_SX_GNDR_SEL_SFT 28 ++#define RG_SX_GNDR_SEL_HI 31 ++#define RG_SX_GNDR_SEL_SZ 4 ++#define RG_SX_DITHER_WEIGHT_MSK 0x00000003 ++#define RG_SX_DITHER_WEIGHT_I_MSK 0xfffffffc ++#define RG_SX_DITHER_WEIGHT_SFT 0 ++#define RG_SX_DITHER_WEIGHT_HI 1 ++#define RG_SX_DITHER_WEIGHT_SZ 2 ++#define RG_SX_MOD_ORDER_MSK 0x00000030 ++#define RG_SX_MOD_ORDER_I_MSK 0xffffffcf ++#define RG_SX_MOD_ORDER_SFT 4 ++#define RG_SX_MOD_ORDER_HI 5 ++#define RG_SX_MOD_ORDER_SZ 2 ++#define RG_SX_RST_H_DIV_MSK 0x00000200 ++#define RG_SX_RST_H_DIV_I_MSK 0xfffffdff ++#define RG_SX_RST_H_DIV_SFT 9 ++#define RG_SX_RST_H_DIV_HI 9 ++#define RG_SX_RST_H_DIV_SZ 1 ++#define RG_SX_SDM_EDGE_MSK 0x00000400 ++#define RG_SX_SDM_EDGE_I_MSK 0xfffffbff ++#define RG_SX_SDM_EDGE_SFT 10 ++#define RG_SX_SDM_EDGE_HI 10 ++#define RG_SX_SDM_EDGE_SZ 1 ++#define RG_SX_XO_GM_MSK 0x00001800 ++#define RG_SX_XO_GM_I_MSK 0xffffe7ff ++#define RG_SX_XO_GM_SFT 11 ++#define RG_SX_XO_GM_HI 12 ++#define RG_SX_XO_GM_SZ 2 ++#define RG_SX_REFBYTWO_MSK 0x00002000 ++#define RG_SX_REFBYTWO_I_MSK 0xffffdfff ++#define RG_SX_REFBYTWO_SFT 13 ++#define RG_SX_REFBYTWO_HI 13 ++#define RG_SX_REFBYTWO_SZ 1 ++#define RG_SX_LCKEN_MSK 0x00080000 ++#define RG_SX_LCKEN_I_MSK 0xfff7ffff ++#define RG_SX_LCKEN_SFT 19 ++#define RG_SX_LCKEN_HI 19 ++#define RG_SX_LCKEN_SZ 1 ++#define RG_SX_PREVDD_MSK 0x00f00000 ++#define RG_SX_PREVDD_I_MSK 0xff0fffff ++#define RG_SX_PREVDD_SFT 20 ++#define RG_SX_PREVDD_HI 23 ++#define RG_SX_PREVDD_SZ 4 ++#define RG_SX_PSCONTERVDD_MSK 0x0f000000 ++#define RG_SX_PSCONTERVDD_I_MSK 0xf0ffffff ++#define RG_SX_PSCONTERVDD_SFT 24 ++#define RG_SX_PSCONTERVDD_HI 27 ++#define RG_SX_PSCONTERVDD_SZ 4 ++#define RG_SX_PH_MSK 0x00002000 ++#define RG_SX_PH_I_MSK 0xffffdfff ++#define RG_SX_PH_SFT 13 ++#define RG_SX_PH_HI 13 ++#define RG_SX_PH_SZ 1 ++#define RG_SX_PL_MSK 0x00004000 ++#define RG_SX_PL_I_MSK 0xffffbfff ++#define RG_SX_PL_SFT 14 ++#define RG_SX_PL_HI 14 ++#define RG_SX_PL_SZ 1 ++#define RG_XOSC_CBANK_XO_MSK 0x00078000 ++#define RG_XOSC_CBANK_XO_I_MSK 0xfff87fff ++#define RG_XOSC_CBANK_XO_SFT 15 ++#define RG_XOSC_CBANK_XO_HI 18 ++#define RG_XOSC_CBANK_XO_SZ 4 ++#define RG_XOSC_CBANK_XI_MSK 0x00780000 ++#define RG_XOSC_CBANK_XI_I_MSK 0xff87ffff ++#define RG_XOSC_CBANK_XI_SFT 19 ++#define RG_XOSC_CBANK_XI_HI 22 ++#define RG_XOSC_CBANK_XI_SZ 4 ++#define RG_SX_VT_MON_MODE_MSK 0x00000001 ++#define RG_SX_VT_MON_MODE_I_MSK 0xfffffffe ++#define RG_SX_VT_MON_MODE_SFT 0 ++#define RG_SX_VT_MON_MODE_HI 0 ++#define RG_SX_VT_MON_MODE_SZ 1 ++#define RG_SX_VT_TH_HI_MSK 0x00000006 ++#define RG_SX_VT_TH_HI_I_MSK 0xfffffff9 ++#define RG_SX_VT_TH_HI_SFT 1 ++#define RG_SX_VT_TH_HI_HI 2 ++#define RG_SX_VT_TH_HI_SZ 2 ++#define RG_SX_VT_TH_LO_MSK 0x00000018 ++#define RG_SX_VT_TH_LO_I_MSK 0xffffffe7 ++#define RG_SX_VT_TH_LO_SFT 3 ++#define RG_SX_VT_TH_LO_HI 4 ++#define RG_SX_VT_TH_LO_SZ 2 ++#define RG_SX_VT_SET_MSK 0x00000020 ++#define RG_SX_VT_SET_I_MSK 0xffffffdf ++#define RG_SX_VT_SET_SFT 5 ++#define RG_SX_VT_SET_HI 5 ++#define RG_SX_VT_SET_SZ 1 ++#define RG_SX_VT_MON_TMR_MSK 0x00007fc0 ++#define RG_SX_VT_MON_TMR_I_MSK 0xffff803f ++#define RG_SX_VT_MON_TMR_SFT 6 ++#define RG_SX_VT_MON_TMR_HI 14 ++#define RG_SX_VT_MON_TMR_SZ 9 ++#define RG_EN_DP_VT_MON_MSK 0x00000001 ++#define RG_EN_DP_VT_MON_I_MSK 0xfffffffe ++#define RG_EN_DP_VT_MON_SFT 0 ++#define RG_EN_DP_VT_MON_HI 0 ++#define RG_EN_DP_VT_MON_SZ 1 ++#define RG_DP_VT_TH_HI_MSK 0x00000006 ++#define RG_DP_VT_TH_HI_I_MSK 0xfffffff9 ++#define RG_DP_VT_TH_HI_SFT 1 ++#define RG_DP_VT_TH_HI_HI 2 ++#define RG_DP_VT_TH_HI_SZ 2 ++#define RG_DP_VT_TH_LO_MSK 0x00000018 ++#define RG_DP_VT_TH_LO_I_MSK 0xffffffe7 ++#define RG_DP_VT_TH_LO_SFT 3 ++#define RG_DP_VT_TH_LO_HI 4 ++#define RG_DP_VT_TH_LO_SZ 2 ++#define RG_DP_CK320BY2_MSK 0x00004000 ++#define RG_DP_CK320BY2_I_MSK 0xffffbfff ++#define RG_DP_CK320BY2_SFT 14 ++#define RG_DP_CK320BY2_HI 14 ++#define RG_DP_CK320BY2_SZ 1 ++#define RG_DP_OD_TEST_MSK 0x00200000 ++#define RG_DP_OD_TEST_I_MSK 0xffdfffff ++#define RG_DP_OD_TEST_SFT 21 ++#define RG_DP_OD_TEST_HI 21 ++#define RG_DP_OD_TEST_SZ 1 ++#define RG_DP_BBPLL_BP_MSK 0x00000001 ++#define RG_DP_BBPLL_BP_I_MSK 0xfffffffe ++#define RG_DP_BBPLL_BP_SFT 0 ++#define RG_DP_BBPLL_BP_HI 0 ++#define RG_DP_BBPLL_BP_SZ 1 ++#define RG_DP_BBPLL_ICP_MSK 0x00000006 ++#define RG_DP_BBPLL_ICP_I_MSK 0xfffffff9 ++#define RG_DP_BBPLL_ICP_SFT 1 ++#define RG_DP_BBPLL_ICP_HI 2 ++#define RG_DP_BBPLL_ICP_SZ 2 ++#define RG_DP_BBPLL_IDUAL_MSK 0x00000018 ++#define RG_DP_BBPLL_IDUAL_I_MSK 0xffffffe7 ++#define RG_DP_BBPLL_IDUAL_SFT 3 ++#define RG_DP_BBPLL_IDUAL_HI 4 ++#define RG_DP_BBPLL_IDUAL_SZ 2 ++#define RG_DP_BBPLL_OD_TEST_MSK 0x000001e0 ++#define RG_DP_BBPLL_OD_TEST_I_MSK 0xfffffe1f ++#define RG_DP_BBPLL_OD_TEST_SFT 5 ++#define RG_DP_BBPLL_OD_TEST_HI 8 ++#define RG_DP_BBPLL_OD_TEST_SZ 4 ++#define RG_DP_BBPLL_PD_MSK 0x00000200 ++#define RG_DP_BBPLL_PD_I_MSK 0xfffffdff ++#define RG_DP_BBPLL_PD_SFT 9 ++#define RG_DP_BBPLL_PD_HI 9 ++#define RG_DP_BBPLL_PD_SZ 1 ++#define RG_DP_BBPLL_TESTSEL_MSK 0x00001c00 ++#define RG_DP_BBPLL_TESTSEL_I_MSK 0xffffe3ff ++#define RG_DP_BBPLL_TESTSEL_SFT 10 ++#define RG_DP_BBPLL_TESTSEL_HI 12 ++#define RG_DP_BBPLL_TESTSEL_SZ 3 ++#define RG_DP_BBPLL_PFD_DLY_MSK 0x00006000 ++#define RG_DP_BBPLL_PFD_DLY_I_MSK 0xffff9fff ++#define RG_DP_BBPLL_PFD_DLY_SFT 13 ++#define RG_DP_BBPLL_PFD_DLY_HI 14 ++#define RG_DP_BBPLL_PFD_DLY_SZ 2 ++#define RG_DP_RP_MSK 0x00038000 ++#define RG_DP_RP_I_MSK 0xfffc7fff ++#define RG_DP_RP_SFT 15 ++#define RG_DP_RP_HI 17 ++#define RG_DP_RP_SZ 3 ++#define RG_DP_RHP_MSK 0x000c0000 ++#define RG_DP_RHP_I_MSK 0xfff3ffff ++#define RG_DP_RHP_SFT 18 ++#define RG_DP_RHP_HI 19 ++#define RG_DP_RHP_SZ 2 ++#define RG_DP_BBPLL_SDM_EDGE_MSK 0x80000000 ++#define RG_DP_BBPLL_SDM_EDGE_I_MSK 0x7fffffff ++#define RG_DP_BBPLL_SDM_EDGE_SFT 31 ++#define RG_DP_BBPLL_SDM_EDGE_HI 31 ++#define RG_DP_BBPLL_SDM_EDGE_SZ 1 ++#define RG_DP_FODIV_MSK 0x0007f000 ++#define RG_DP_FODIV_I_MSK 0xfff80fff ++#define RG_DP_FODIV_SFT 12 ++#define RG_DP_FODIV_HI 18 ++#define RG_DP_FODIV_SZ 7 ++#define RG_DP_REFDIV_MSK 0x1fc00000 ++#define RG_DP_REFDIV_I_MSK 0xe03fffff ++#define RG_DP_REFDIV_SFT 22 ++#define RG_DP_REFDIV_HI 28 ++#define RG_DP_REFDIV_SZ 7 ++#define RG_IDACAI_PGAG15_MSK 0x0000003f ++#define RG_IDACAI_PGAG15_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG15_SFT 0 ++#define RG_IDACAI_PGAG15_HI 5 ++#define RG_IDACAI_PGAG15_SZ 6 ++#define RG_IDACAQ_PGAG15_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG15_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG15_SFT 6 ++#define RG_IDACAQ_PGAG15_HI 11 ++#define RG_IDACAQ_PGAG15_SZ 6 ++#define RG_IDACAI_PGAG14_MSK 0x0003f000 ++#define RG_IDACAI_PGAG14_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG14_SFT 12 ++#define RG_IDACAI_PGAG14_HI 17 ++#define RG_IDACAI_PGAG14_SZ 6 ++#define RG_IDACAQ_PGAG14_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG14_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG14_SFT 18 ++#define RG_IDACAQ_PGAG14_HI 23 ++#define RG_IDACAQ_PGAG14_SZ 6 ++#define RG_DP_BBPLL_BS_MSK 0x3f000000 ++#define RG_DP_BBPLL_BS_I_MSK 0xc0ffffff ++#define RG_DP_BBPLL_BS_SFT 24 ++#define RG_DP_BBPLL_BS_HI 29 ++#define RG_DP_BBPLL_BS_SZ 6 ++#define RG_IDACAI_PGAG13_MSK 0x0000003f ++#define RG_IDACAI_PGAG13_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG13_SFT 0 ++#define RG_IDACAI_PGAG13_HI 5 ++#define RG_IDACAI_PGAG13_SZ 6 ++#define RG_IDACAQ_PGAG13_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG13_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG13_SFT 6 ++#define RG_IDACAQ_PGAG13_HI 11 ++#define RG_IDACAQ_PGAG13_SZ 6 ++#define RG_IDACAI_PGAG12_MSK 0x0003f000 ++#define RG_IDACAI_PGAG12_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG12_SFT 12 ++#define RG_IDACAI_PGAG12_HI 17 ++#define RG_IDACAI_PGAG12_SZ 6 ++#define RG_IDACAQ_PGAG12_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG12_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG12_SFT 18 ++#define RG_IDACAQ_PGAG12_HI 23 ++#define RG_IDACAQ_PGAG12_SZ 6 ++#define RG_IDACAI_PGAG11_MSK 0x0000003f ++#define RG_IDACAI_PGAG11_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG11_SFT 0 ++#define RG_IDACAI_PGAG11_HI 5 ++#define RG_IDACAI_PGAG11_SZ 6 ++#define RG_IDACAQ_PGAG11_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG11_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG11_SFT 6 ++#define RG_IDACAQ_PGAG11_HI 11 ++#define RG_IDACAQ_PGAG11_SZ 6 ++#define RG_IDACAI_PGAG10_MSK 0x0003f000 ++#define RG_IDACAI_PGAG10_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG10_SFT 12 ++#define RG_IDACAI_PGAG10_HI 17 ++#define RG_IDACAI_PGAG10_SZ 6 ++#define RG_IDACAQ_PGAG10_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG10_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG10_SFT 18 ++#define RG_IDACAQ_PGAG10_HI 23 ++#define RG_IDACAQ_PGAG10_SZ 6 ++#define RG_IDACAI_PGAG9_MSK 0x0000003f ++#define RG_IDACAI_PGAG9_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG9_SFT 0 ++#define RG_IDACAI_PGAG9_HI 5 ++#define RG_IDACAI_PGAG9_SZ 6 ++#define RG_IDACAQ_PGAG9_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG9_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG9_SFT 6 ++#define RG_IDACAQ_PGAG9_HI 11 ++#define RG_IDACAQ_PGAG9_SZ 6 ++#define RG_IDACAI_PGAG8_MSK 0x0003f000 ++#define RG_IDACAI_PGAG8_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG8_SFT 12 ++#define RG_IDACAI_PGAG8_HI 17 ++#define RG_IDACAI_PGAG8_SZ 6 ++#define RG_IDACAQ_PGAG8_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG8_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG8_SFT 18 ++#define RG_IDACAQ_PGAG8_HI 23 ++#define RG_IDACAQ_PGAG8_SZ 6 ++#define RG_IDACAI_PGAG7_MSK 0x0000003f ++#define RG_IDACAI_PGAG7_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG7_SFT 0 ++#define RG_IDACAI_PGAG7_HI 5 ++#define RG_IDACAI_PGAG7_SZ 6 ++#define RG_IDACAQ_PGAG7_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG7_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG7_SFT 6 ++#define RG_IDACAQ_PGAG7_HI 11 ++#define RG_IDACAQ_PGAG7_SZ 6 ++#define RG_IDACAI_PGAG6_MSK 0x0003f000 ++#define RG_IDACAI_PGAG6_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG6_SFT 12 ++#define RG_IDACAI_PGAG6_HI 17 ++#define RG_IDACAI_PGAG6_SZ 6 ++#define RG_IDACAQ_PGAG6_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG6_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG6_SFT 18 ++#define RG_IDACAQ_PGAG6_HI 23 ++#define RG_IDACAQ_PGAG6_SZ 6 ++#define RG_IDACAI_PGAG5_MSK 0x0000003f ++#define RG_IDACAI_PGAG5_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG5_SFT 0 ++#define RG_IDACAI_PGAG5_HI 5 ++#define RG_IDACAI_PGAG5_SZ 6 ++#define RG_IDACAQ_PGAG5_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG5_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG5_SFT 6 ++#define RG_IDACAQ_PGAG5_HI 11 ++#define RG_IDACAQ_PGAG5_SZ 6 ++#define RG_IDACAI_PGAG4_MSK 0x0003f000 ++#define RG_IDACAI_PGAG4_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG4_SFT 12 ++#define RG_IDACAI_PGAG4_HI 17 ++#define RG_IDACAI_PGAG4_SZ 6 ++#define RG_IDACAQ_PGAG4_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG4_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG4_SFT 18 ++#define RG_IDACAQ_PGAG4_HI 23 ++#define RG_IDACAQ_PGAG4_SZ 6 ++#define RG_IDACAI_PGAG3_MSK 0x0000003f ++#define RG_IDACAI_PGAG3_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG3_SFT 0 ++#define RG_IDACAI_PGAG3_HI 5 ++#define RG_IDACAI_PGAG3_SZ 6 ++#define RG_IDACAQ_PGAG3_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG3_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG3_SFT 6 ++#define RG_IDACAQ_PGAG3_HI 11 ++#define RG_IDACAQ_PGAG3_SZ 6 ++#define RG_IDACAI_PGAG2_MSK 0x0003f000 ++#define RG_IDACAI_PGAG2_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG2_SFT 12 ++#define RG_IDACAI_PGAG2_HI 17 ++#define RG_IDACAI_PGAG2_SZ 6 ++#define RG_IDACAQ_PGAG2_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG2_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG2_SFT 18 ++#define RG_IDACAQ_PGAG2_HI 23 ++#define RG_IDACAQ_PGAG2_SZ 6 ++#define RG_IDACAI_PGAG1_MSK 0x0000003f ++#define RG_IDACAI_PGAG1_I_MSK 0xffffffc0 ++#define RG_IDACAI_PGAG1_SFT 0 ++#define RG_IDACAI_PGAG1_HI 5 ++#define RG_IDACAI_PGAG1_SZ 6 ++#define RG_IDACAQ_PGAG1_MSK 0x00000fc0 ++#define RG_IDACAQ_PGAG1_I_MSK 0xfffff03f ++#define RG_IDACAQ_PGAG1_SFT 6 ++#define RG_IDACAQ_PGAG1_HI 11 ++#define RG_IDACAQ_PGAG1_SZ 6 ++#define RG_IDACAI_PGAG0_MSK 0x0003f000 ++#define RG_IDACAI_PGAG0_I_MSK 0xfffc0fff ++#define RG_IDACAI_PGAG0_SFT 12 ++#define RG_IDACAI_PGAG0_HI 17 ++#define RG_IDACAI_PGAG0_SZ 6 ++#define RG_IDACAQ_PGAG0_MSK 0x00fc0000 ++#define RG_IDACAQ_PGAG0_I_MSK 0xff03ffff ++#define RG_IDACAQ_PGAG0_SFT 18 ++#define RG_IDACAQ_PGAG0_HI 23 ++#define RG_IDACAQ_PGAG0_SZ 6 ++#define RG_EN_RCAL_MSK 0x00000001 ++#define RG_EN_RCAL_I_MSK 0xfffffffe ++#define RG_EN_RCAL_SFT 0 ++#define RG_EN_RCAL_HI 0 ++#define RG_EN_RCAL_SZ 1 ++#define RG_RCAL_SPD_MSK 0x00000002 ++#define RG_RCAL_SPD_I_MSK 0xfffffffd ++#define RG_RCAL_SPD_SFT 1 ++#define RG_RCAL_SPD_HI 1 ++#define RG_RCAL_SPD_SZ 1 ++#define RG_RCAL_TMR_MSK 0x000001fc ++#define RG_RCAL_TMR_I_MSK 0xfffffe03 ++#define RG_RCAL_TMR_SFT 2 ++#define RG_RCAL_TMR_HI 8 ++#define RG_RCAL_TMR_SZ 7 ++#define RG_RCAL_CODE_CWR_MSK 0x00000200 ++#define RG_RCAL_CODE_CWR_I_MSK 0xfffffdff ++#define RG_RCAL_CODE_CWR_SFT 9 ++#define RG_RCAL_CODE_CWR_HI 9 ++#define RG_RCAL_CODE_CWR_SZ 1 ++#define RG_RCAL_CODE_CWD_MSK 0x00007c00 ++#define RG_RCAL_CODE_CWD_I_MSK 0xffff83ff ++#define RG_RCAL_CODE_CWD_SFT 10 ++#define RG_RCAL_CODE_CWD_HI 14 ++#define RG_RCAL_CODE_CWD_SZ 5 ++#define RG_SX_SUB_SEL_CWR_MSK 0x00000001 ++#define RG_SX_SUB_SEL_CWR_I_MSK 0xfffffffe ++#define RG_SX_SUB_SEL_CWR_SFT 0 ++#define RG_SX_SUB_SEL_CWR_HI 0 ++#define RG_SX_SUB_SEL_CWR_SZ 1 ++#define RG_SX_SUB_SEL_CWD_MSK 0x000000fe ++#define RG_SX_SUB_SEL_CWD_I_MSK 0xffffff01 ++#define RG_SX_SUB_SEL_CWD_SFT 1 ++#define RG_SX_SUB_SEL_CWD_HI 7 ++#define RG_SX_SUB_SEL_CWD_SZ 7 ++#define RG_SX_LCK_BIN_OFFSET_MSK 0x00078000 ++#define RG_SX_LCK_BIN_OFFSET_I_MSK 0xfff87fff ++#define RG_SX_LCK_BIN_OFFSET_SFT 15 ++#define RG_SX_LCK_BIN_OFFSET_HI 18 ++#define RG_SX_LCK_BIN_OFFSET_SZ 4 ++#define RG_SX_LCK_BIN_PRECISION_MSK 0x00080000 ++#define RG_SX_LCK_BIN_PRECISION_I_MSK 0xfff7ffff ++#define RG_SX_LCK_BIN_PRECISION_SFT 19 ++#define RG_SX_LCK_BIN_PRECISION_HI 19 ++#define RG_SX_LCK_BIN_PRECISION_SZ 1 ++#define RG_SX_LOCK_EN_N_MSK 0x00100000 ++#define RG_SX_LOCK_EN_N_I_MSK 0xffefffff ++#define RG_SX_LOCK_EN_N_SFT 20 ++#define RG_SX_LOCK_EN_N_HI 20 ++#define RG_SX_LOCK_EN_N_SZ 1 ++#define RG_SX_LOCK_MANUAL_MSK 0x00200000 ++#define RG_SX_LOCK_MANUAL_I_MSK 0xffdfffff ++#define RG_SX_LOCK_MANUAL_SFT 21 ++#define RG_SX_LOCK_MANUAL_HI 21 ++#define RG_SX_LOCK_MANUAL_SZ 1 ++#define RG_SX_SUB_MANUAL_MSK 0x00400000 ++#define RG_SX_SUB_MANUAL_I_MSK 0xffbfffff ++#define RG_SX_SUB_MANUAL_SFT 22 ++#define RG_SX_SUB_MANUAL_HI 22 ++#define RG_SX_SUB_MANUAL_SZ 1 ++#define RG_SX_SUB_SEL_MSK 0x3f800000 ++#define RG_SX_SUB_SEL_I_MSK 0xc07fffff ++#define RG_SX_SUB_SEL_SFT 23 ++#define RG_SX_SUB_SEL_HI 29 ++#define RG_SX_SUB_SEL_SZ 7 ++#define RG_SX_MUX_SEL_VTH_BINL_MSK 0x40000000 ++#define RG_SX_MUX_SEL_VTH_BINL_I_MSK 0xbfffffff ++#define RG_SX_MUX_SEL_VTH_BINL_SFT 30 ++#define RG_SX_MUX_SEL_VTH_BINL_HI 30 ++#define RG_SX_MUX_SEL_VTH_BINL_SZ 1 ++#define RG_TRX_DUMMMY_MSK 0xffffffff ++#define RG_TRX_DUMMMY_I_MSK 0x00000000 ++#define RG_TRX_DUMMMY_SFT 0 ++#define RG_TRX_DUMMMY_HI 31 ++#define RG_TRX_DUMMMY_SZ 32 ++#define RG_SX_DUMMMY_MSK 0xffffffff ++#define RG_SX_DUMMMY_I_MSK 0x00000000 ++#define RG_SX_DUMMMY_SFT 0 ++#define RG_SX_DUMMMY_HI 31 ++#define RG_SX_DUMMMY_SZ 32 ++#define RCAL_RDY_MSK 0x00000001 ++#define RCAL_RDY_I_MSK 0xfffffffe ++#define RCAL_RDY_SFT 0 ++#define RCAL_RDY_HI 0 ++#define RCAL_RDY_SZ 1 ++#define LCK_BIN_RDY_MSK 0x00000002 ++#define LCK_BIN_RDY_I_MSK 0xfffffffd ++#define LCK_BIN_RDY_SFT 1 ++#define LCK_BIN_RDY_HI 1 ++#define LCK_BIN_RDY_SZ 1 ++#define VT_MON_RDY_MSK 0x00000004 ++#define VT_MON_RDY_I_MSK 0xfffffffb ++#define VT_MON_RDY_SFT 2 ++#define VT_MON_RDY_HI 2 ++#define VT_MON_RDY_SZ 1 ++#define DA_R_CODE_LUT_MSK 0x000007c0 ++#define DA_R_CODE_LUT_I_MSK 0xfffff83f ++#define DA_R_CODE_LUT_SFT 6 ++#define DA_R_CODE_LUT_HI 10 ++#define DA_R_CODE_LUT_SZ 5 ++#define AD_SX_VT_MON_Q_MSK 0x00001800 ++#define AD_SX_VT_MON_Q_I_MSK 0xffffe7ff ++#define AD_SX_VT_MON_Q_SFT 11 ++#define AD_SX_VT_MON_Q_HI 12 ++#define AD_SX_VT_MON_Q_SZ 2 ++#define AD_DP_VT_MON_Q_MSK 0x00006000 ++#define AD_DP_VT_MON_Q_I_MSK 0xffff9fff ++#define AD_DP_VT_MON_Q_SFT 13 ++#define AD_DP_VT_MON_Q_HI 14 ++#define AD_DP_VT_MON_Q_SZ 2 ++#define RTC_CAL_RDY_MSK 0x00008000 ++#define RTC_CAL_RDY_I_MSK 0xffff7fff ++#define RTC_CAL_RDY_SFT 15 ++#define RTC_CAL_RDY_HI 15 ++#define RTC_CAL_RDY_SZ 1 ++#define RG_SARADC_BIT_MSK 0x003f0000 ++#define RG_SARADC_BIT_I_MSK 0xffc0ffff ++#define RG_SARADC_BIT_SFT 16 ++#define RG_SARADC_BIT_HI 21 ++#define RG_SARADC_BIT_SZ 6 ++#define SAR_ADC_FSM_RDY_MSK 0x00400000 ++#define SAR_ADC_FSM_RDY_I_MSK 0xffbfffff ++#define SAR_ADC_FSM_RDY_SFT 22 ++#define SAR_ADC_FSM_RDY_HI 22 ++#define SAR_ADC_FSM_RDY_SZ 1 ++#define AD_CIRCUIT_VERSION_MSK 0x07800000 ++#define AD_CIRCUIT_VERSION_I_MSK 0xf87fffff ++#define AD_CIRCUIT_VERSION_SFT 23 ++#define AD_CIRCUIT_VERSION_HI 26 ++#define AD_CIRCUIT_VERSION_SZ 4 ++#define DA_R_CAL_CODE_MSK 0x0000001f ++#define DA_R_CAL_CODE_I_MSK 0xffffffe0 ++#define DA_R_CAL_CODE_SFT 0 ++#define DA_R_CAL_CODE_HI 4 ++#define DA_R_CAL_CODE_SZ 5 ++#define DA_SX_SUB_SEL_MSK 0x00000fe0 ++#define DA_SX_SUB_SEL_I_MSK 0xfffff01f ++#define DA_SX_SUB_SEL_SFT 5 ++#define DA_SX_SUB_SEL_HI 11 ++#define DA_SX_SUB_SEL_SZ 7 ++#define RG_DPL_RFCTRL_CH_MSK 0x000007ff ++#define RG_DPL_RFCTRL_CH_I_MSK 0xfffff800 ++#define RG_DPL_RFCTRL_CH_SFT 0 ++#define RG_DPL_RFCTRL_CH_HI 10 ++#define RG_DPL_RFCTRL_CH_SZ 11 ++#define RG_RSSIADC_RO_BIT_MSK 0x00007800 ++#define RG_RSSIADC_RO_BIT_I_MSK 0xffff87ff ++#define RG_RSSIADC_RO_BIT_SFT 11 ++#define RG_RSSIADC_RO_BIT_HI 14 ++#define RG_RSSIADC_RO_BIT_SZ 4 ++#define RG_RX_ADC_I_RO_BIT_MSK 0x007f8000 ++#define RG_RX_ADC_I_RO_BIT_I_MSK 0xff807fff ++#define RG_RX_ADC_I_RO_BIT_SFT 15 ++#define RG_RX_ADC_I_RO_BIT_HI 22 ++#define RG_RX_ADC_I_RO_BIT_SZ 8 ++#define RG_RX_ADC_Q_RO_BIT_MSK 0x7f800000 ++#define RG_RX_ADC_Q_RO_BIT_I_MSK 0x807fffff ++#define RG_RX_ADC_Q_RO_BIT_SFT 23 ++#define RG_RX_ADC_Q_RO_BIT_HI 30 ++#define RG_RX_ADC_Q_RO_BIT_SZ 8 ++#define RG_DPL_RFCTRL_F_MSK 0x00ffffff ++#define RG_DPL_RFCTRL_F_I_MSK 0xff000000 ++#define RG_DPL_RFCTRL_F_SFT 0 ++#define RG_DPL_RFCTRL_F_HI 23 ++#define RG_DPL_RFCTRL_F_SZ 24 ++#define RG_SX_TARGET_CNT_MSK 0x00001fff ++#define RG_SX_TARGET_CNT_I_MSK 0xffffe000 ++#define RG_SX_TARGET_CNT_SFT 0 ++#define RG_SX_TARGET_CNT_HI 12 ++#define RG_SX_TARGET_CNT_SZ 13 ++#define RG_RTC_OFFSET_MSK 0x000000ff ++#define RG_RTC_OFFSET_I_MSK 0xffffff00 ++#define RG_RTC_OFFSET_SFT 0 ++#define RG_RTC_OFFSET_HI 7 ++#define RG_RTC_OFFSET_SZ 8 ++#define RG_RTC_CAL_TARGET_COUNT_MSK 0x000fff00 ++#define RG_RTC_CAL_TARGET_COUNT_I_MSK 0xfff000ff ++#define RG_RTC_CAL_TARGET_COUNT_SFT 8 ++#define RG_RTC_CAL_TARGET_COUNT_HI 19 ++#define RG_RTC_CAL_TARGET_COUNT_SZ 12 ++#define RG_RF_D_REG_MSK 0x0000ffff ++#define RG_RF_D_REG_I_MSK 0xffff0000 ++#define RG_RF_D_REG_SFT 0 ++#define RG_RF_D_REG_HI 15 ++#define RG_RF_D_REG_SZ 16 ++#define DIRECT_MODE_MSK 0x00000001 ++#define DIRECT_MODE_I_MSK 0xfffffffe ++#define DIRECT_MODE_SFT 0 ++#define DIRECT_MODE_HI 0 ++#define DIRECT_MODE_SZ 1 ++#define TAG_INTERLEAVE_MD_MSK 0x00000002 ++#define TAG_INTERLEAVE_MD_I_MSK 0xfffffffd ++#define TAG_INTERLEAVE_MD_SFT 1 ++#define TAG_INTERLEAVE_MD_HI 1 ++#define TAG_INTERLEAVE_MD_SZ 1 ++#define DIS_DEMAND_MSK 0x00000004 ++#define DIS_DEMAND_I_MSK 0xfffffffb ++#define DIS_DEMAND_SFT 2 ++#define DIS_DEMAND_HI 2 ++#define DIS_DEMAND_SZ 1 ++#define SAME_ID_ALLOC_MD_MSK 0x00000008 ++#define SAME_ID_ALLOC_MD_I_MSK 0xfffffff7 ++#define SAME_ID_ALLOC_MD_SFT 3 ++#define SAME_ID_ALLOC_MD_HI 3 ++#define SAME_ID_ALLOC_MD_SZ 1 ++#define HS_ACCESS_MD_MSK 0x00000010 ++#define HS_ACCESS_MD_I_MSK 0xffffffef ++#define HS_ACCESS_MD_SFT 4 ++#define HS_ACCESS_MD_HI 4 ++#define HS_ACCESS_MD_SZ 1 ++#define SRAM_ACCESS_MD_MSK 0x00000020 ++#define SRAM_ACCESS_MD_I_MSK 0xffffffdf ++#define SRAM_ACCESS_MD_SFT 5 ++#define SRAM_ACCESS_MD_HI 5 ++#define SRAM_ACCESS_MD_SZ 1 ++#define NOHIT_RPASS_MD_MSK 0x00000040 ++#define NOHIT_RPASS_MD_I_MSK 0xffffffbf ++#define NOHIT_RPASS_MD_SFT 6 ++#define NOHIT_RPASS_MD_HI 6 ++#define NOHIT_RPASS_MD_SZ 1 ++#define DMN_FLAG_CLR_MSK 0x00000080 ++#define DMN_FLAG_CLR_I_MSK 0xffffff7f ++#define DMN_FLAG_CLR_SFT 7 ++#define DMN_FLAG_CLR_HI 7 ++#define DMN_FLAG_CLR_SZ 1 ++#define ERR_SW_RST_N_MSK 0x00000100 ++#define ERR_SW_RST_N_I_MSK 0xfffffeff ++#define ERR_SW_RST_N_SFT 8 ++#define ERR_SW_RST_N_HI 8 ++#define ERR_SW_RST_N_SZ 1 ++#define ALR_SW_RST_N_MSK 0x00000200 ++#define ALR_SW_RST_N_I_MSK 0xfffffdff ++#define ALR_SW_RST_N_SFT 9 ++#define ALR_SW_RST_N_HI 9 ++#define ALR_SW_RST_N_SZ 1 ++#define MCH_SW_RST_N_MSK 0x00000400 ++#define MCH_SW_RST_N_I_MSK 0xfffffbff ++#define MCH_SW_RST_N_SFT 10 ++#define MCH_SW_RST_N_HI 10 ++#define MCH_SW_RST_N_SZ 1 ++#define TAG_SW_RST_N_MSK 0x00000800 ++#define TAG_SW_RST_N_I_MSK 0xfffff7ff ++#define TAG_SW_RST_N_SFT 11 ++#define TAG_SW_RST_N_HI 11 ++#define TAG_SW_RST_N_SZ 1 ++#define ABT_SW_RST_N_MSK 0x00001000 ++#define ABT_SW_RST_N_I_MSK 0xffffefff ++#define ABT_SW_RST_N_SFT 12 ++#define ABT_SW_RST_N_HI 12 ++#define ABT_SW_RST_N_SZ 1 ++#define MMU_VER_MSK 0x0000e000 ++#define MMU_VER_I_MSK 0xffff1fff ++#define MMU_VER_SFT 13 ++#define MMU_VER_HI 15 ++#define MMU_VER_SZ 3 ++#define MMU_SHARE_MCU_MSK 0x00ff0000 ++#define MMU_SHARE_MCU_I_MSK 0xff00ffff ++#define MMU_SHARE_MCU_SFT 16 ++#define MMU_SHARE_MCU_HI 23 ++#define MMU_SHARE_MCU_SZ 8 ++#define HS_WR_MSK 0x00000001 ++#define HS_WR_I_MSK 0xfffffffe ++#define HS_WR_SFT 0 ++#define HS_WR_HI 0 ++#define HS_WR_SZ 1 ++#define HS_FLAG_MSK 0x00000010 ++#define HS_FLAG_I_MSK 0xffffffef ++#define HS_FLAG_SFT 4 ++#define HS_FLAG_HI 4 ++#define HS_FLAG_SZ 1 ++#define HS_ID_MSK 0x00007f00 ++#define HS_ID_I_MSK 0xffff80ff ++#define HS_ID_SFT 8 ++#define HS_ID_HI 14 ++#define HS_ID_SZ 7 ++#define HS_CHANNEL_MSK 0x000f0000 ++#define HS_CHANNEL_I_MSK 0xfff0ffff ++#define HS_CHANNEL_SFT 16 ++#define HS_CHANNEL_HI 19 ++#define HS_CHANNEL_SZ 4 ++#define HS_PAGE_MSK 0x00f00000 ++#define HS_PAGE_I_MSK 0xff0fffff ++#define HS_PAGE_SFT 20 ++#define HS_PAGE_HI 23 ++#define HS_PAGE_SZ 4 ++#define HS_DATA_MSK 0xff000000 ++#define HS_DATA_I_MSK 0x00ffffff ++#define HS_DATA_SFT 24 ++#define HS_DATA_HI 31 ++#define HS_DATA_SZ 8 ++#define CPU_POR0_MSK 0x0000000f ++#define CPU_POR0_I_MSK 0xfffffff0 ++#define CPU_POR0_SFT 0 ++#define CPU_POR0_HI 3 ++#define CPU_POR0_SZ 4 ++#define CPU_POR1_MSK 0x000000f0 ++#define CPU_POR1_I_MSK 0xffffff0f ++#define CPU_POR1_SFT 4 ++#define CPU_POR1_HI 7 ++#define CPU_POR1_SZ 4 ++#define CPU_POR2_MSK 0x00000f00 ++#define CPU_POR2_I_MSK 0xfffff0ff ++#define CPU_POR2_SFT 8 ++#define CPU_POR2_HI 11 ++#define CPU_POR2_SZ 4 ++#define CPU_POR3_MSK 0x0000f000 ++#define CPU_POR3_I_MSK 0xffff0fff ++#define CPU_POR3_SFT 12 ++#define CPU_POR3_HI 15 ++#define CPU_POR3_SZ 4 ++#define CPU_POR4_MSK 0x000f0000 ++#define CPU_POR4_I_MSK 0xfff0ffff ++#define CPU_POR4_SFT 16 ++#define CPU_POR4_HI 19 ++#define CPU_POR4_SZ 4 ++#define CPU_POR5_MSK 0x00f00000 ++#define CPU_POR5_I_MSK 0xff0fffff ++#define CPU_POR5_SFT 20 ++#define CPU_POR5_HI 23 ++#define CPU_POR5_SZ 4 ++#define CPU_POR6_MSK 0x0f000000 ++#define CPU_POR6_I_MSK 0xf0ffffff ++#define CPU_POR6_SFT 24 ++#define CPU_POR6_HI 27 ++#define CPU_POR6_SZ 4 ++#define CPU_POR7_MSK 0xf0000000 ++#define CPU_POR7_I_MSK 0x0fffffff ++#define CPU_POR7_SFT 28 ++#define CPU_POR7_HI 31 ++#define CPU_POR7_SZ 4 ++#define CPU_POR8_MSK 0x0000000f ++#define CPU_POR8_I_MSK 0xfffffff0 ++#define CPU_POR8_SFT 0 ++#define CPU_POR8_HI 3 ++#define CPU_POR8_SZ 4 ++#define CPU_POR9_MSK 0x000000f0 ++#define CPU_POR9_I_MSK 0xffffff0f ++#define CPU_POR9_SFT 4 ++#define CPU_POR9_HI 7 ++#define CPU_POR9_SZ 4 ++#define CPU_PORA_MSK 0x00000f00 ++#define CPU_PORA_I_MSK 0xfffff0ff ++#define CPU_PORA_SFT 8 ++#define CPU_PORA_HI 11 ++#define CPU_PORA_SZ 4 ++#define CPU_PORB_MSK 0x0000f000 ++#define CPU_PORB_I_MSK 0xffff0fff ++#define CPU_PORB_SFT 12 ++#define CPU_PORB_HI 15 ++#define CPU_PORB_SZ 4 ++#define CPU_PORC_MSK 0x000f0000 ++#define CPU_PORC_I_MSK 0xfff0ffff ++#define CPU_PORC_SFT 16 ++#define CPU_PORC_HI 19 ++#define CPU_PORC_SZ 4 ++#define CPU_PORD_MSK 0x00f00000 ++#define CPU_PORD_I_MSK 0xff0fffff ++#define CPU_PORD_SFT 20 ++#define CPU_PORD_HI 23 ++#define CPU_PORD_SZ 4 ++#define CPU_PORE_MSK 0x0f000000 ++#define CPU_PORE_I_MSK 0xf0ffffff ++#define CPU_PORE_SFT 24 ++#define CPU_PORE_HI 27 ++#define CPU_PORE_SZ 4 ++#define CPU_PORF_MSK 0xf0000000 ++#define CPU_PORF_I_MSK 0x0fffffff ++#define CPU_PORF_SFT 28 ++#define CPU_PORF_HI 31 ++#define CPU_PORF_SZ 4 ++#define ACC_WR_LEN_MSK 0x0000003f ++#define ACC_WR_LEN_I_MSK 0xffffffc0 ++#define ACC_WR_LEN_SFT 0 ++#define ACC_WR_LEN_HI 5 ++#define ACC_WR_LEN_SZ 6 ++#define ACC_RD_LEN_MSK 0x00003f00 ++#define ACC_RD_LEN_I_MSK 0xffffc0ff ++#define ACC_RD_LEN_SFT 8 ++#define ACC_RD_LEN_HI 13 ++#define ACC_RD_LEN_SZ 6 ++#define REQ_NACK_CLR_MSK 0x00008000 ++#define REQ_NACK_CLR_I_MSK 0xffff7fff ++#define REQ_NACK_CLR_SFT 15 ++#define REQ_NACK_CLR_HI 15 ++#define REQ_NACK_CLR_SZ 1 ++#define NACK_FLAG_BUS_MSK 0xffff0000 ++#define NACK_FLAG_BUS_I_MSK 0x0000ffff ++#define NACK_FLAG_BUS_SFT 16 ++#define NACK_FLAG_BUS_HI 31 ++#define NACK_FLAG_BUS_SZ 16 ++#define DMN_R_PASS_MSK 0x0000ffff ++#define DMN_R_PASS_I_MSK 0xffff0000 ++#define DMN_R_PASS_SFT 0 ++#define DMN_R_PASS_HI 15 ++#define DMN_R_PASS_SZ 16 ++#define PARA_ALC_RLS_MSK 0x00010000 ++#define PARA_ALC_RLS_I_MSK 0xfffeffff ++#define PARA_ALC_RLS_SFT 16 ++#define PARA_ALC_RLS_HI 16 ++#define PARA_ALC_RLS_SZ 1 ++#define REQ_PORNS_CHGEN_MSK 0x01000000 ++#define REQ_PORNS_CHGEN_I_MSK 0xfeffffff ++#define REQ_PORNS_CHGEN_SFT 24 ++#define REQ_PORNS_CHGEN_HI 24 ++#define REQ_PORNS_CHGEN_SZ 1 ++#define ALC_ABT_ID_MSK 0x0000007f ++#define ALC_ABT_ID_I_MSK 0xffffff80 ++#define ALC_ABT_ID_SFT 0 ++#define ALC_ABT_ID_HI 6 ++#define ALC_ABT_ID_SZ 7 ++#define ALC_ABT_INT_MSK 0x00008000 ++#define ALC_ABT_INT_I_MSK 0xffff7fff ++#define ALC_ABT_INT_SFT 15 ++#define ALC_ABT_INT_HI 15 ++#define ALC_ABT_INT_SZ 1 ++#define RLS_ABT_ID_MSK 0x007f0000 ++#define RLS_ABT_ID_I_MSK 0xff80ffff ++#define RLS_ABT_ID_SFT 16 ++#define RLS_ABT_ID_HI 22 ++#define RLS_ABT_ID_SZ 7 ++#define RLS_ABT_INT_MSK 0x80000000 ++#define RLS_ABT_INT_I_MSK 0x7fffffff ++#define RLS_ABT_INT_SFT 31 ++#define RLS_ABT_INT_HI 31 ++#define RLS_ABT_INT_SZ 1 ++#define DEBUG_CTL_MSK 0x000000ff ++#define DEBUG_CTL_I_MSK 0xffffff00 ++#define DEBUG_CTL_SFT 0 ++#define DEBUG_CTL_HI 7 ++#define DEBUG_CTL_SZ 8 ++#define DEBUG_H16_MSK 0x00000100 ++#define DEBUG_H16_I_MSK 0xfffffeff ++#define DEBUG_H16_SFT 8 ++#define DEBUG_H16_HI 8 ++#define DEBUG_H16_SZ 1 ++#define DEBUG_OUT_MSK 0xffffffff ++#define DEBUG_OUT_I_MSK 0x00000000 ++#define DEBUG_OUT_SFT 0 ++#define DEBUG_OUT_HI 31 ++#define DEBUG_OUT_SZ 32 ++#define ALC_ERR_MSK 0x00000001 ++#define ALC_ERR_I_MSK 0xfffffffe ++#define ALC_ERR_SFT 0 ++#define ALC_ERR_HI 0 ++#define ALC_ERR_SZ 1 ++#define RLS_ERR_MSK 0x00000002 ++#define RLS_ERR_I_MSK 0xfffffffd ++#define RLS_ERR_SFT 1 ++#define RLS_ERR_HI 1 ++#define RLS_ERR_SZ 1 ++#define AL_STATE_MSK 0x00000700 ++#define AL_STATE_I_MSK 0xfffff8ff ++#define AL_STATE_SFT 8 ++#define AL_STATE_HI 10 ++#define AL_STATE_SZ 3 ++#define RL_STATE_MSK 0x00007000 ++#define RL_STATE_I_MSK 0xffff8fff ++#define RL_STATE_SFT 12 ++#define RL_STATE_HI 14 ++#define RL_STATE_SZ 3 ++#define ALC_ERR_ID_MSK 0x007f0000 ++#define ALC_ERR_ID_I_MSK 0xff80ffff ++#define ALC_ERR_ID_SFT 16 ++#define ALC_ERR_ID_HI 22 ++#define ALC_ERR_ID_SZ 7 ++#define RLS_ERR_ID_MSK 0x7f000000 ++#define RLS_ERR_ID_I_MSK 0x80ffffff ++#define RLS_ERR_ID_SFT 24 ++#define RLS_ERR_ID_HI 30 ++#define RLS_ERR_ID_SZ 7 ++#define DMN_NOHIT_FLAG_MSK 0x00000001 ++#define DMN_NOHIT_FLAG_I_MSK 0xfffffffe ++#define DMN_NOHIT_FLAG_SFT 0 ++#define DMN_NOHIT_FLAG_HI 0 ++#define DMN_NOHIT_FLAG_SZ 1 ++#define DMN_FLAG_MSK 0x00000002 ++#define DMN_FLAG_I_MSK 0xfffffffd ++#define DMN_FLAG_SFT 1 ++#define DMN_FLAG_HI 1 ++#define DMN_FLAG_SZ 1 ++#define DMN_WR_MSK 0x00000008 ++#define DMN_WR_I_MSK 0xfffffff7 ++#define DMN_WR_SFT 3 ++#define DMN_WR_HI 3 ++#define DMN_WR_SZ 1 ++#define DMN_PORT_MSK 0x000000f0 ++#define DMN_PORT_I_MSK 0xffffff0f ++#define DMN_PORT_SFT 4 ++#define DMN_PORT_HI 7 ++#define DMN_PORT_SZ 4 ++#define DMN_NHIT_ID_MSK 0x00007f00 ++#define DMN_NHIT_ID_I_MSK 0xffff80ff ++#define DMN_NHIT_ID_SFT 8 ++#define DMN_NHIT_ID_HI 14 ++#define DMN_NHIT_ID_SZ 7 ++#define DMN_NHIT_ADDR_MSK 0xffff0000 ++#define DMN_NHIT_ADDR_I_MSK 0x0000ffff ++#define DMN_NHIT_ADDR_SFT 16 ++#define DMN_NHIT_ADDR_HI 31 ++#define DMN_NHIT_ADDR_SZ 16 ++#define TX_MOUNT_MSK 0x000000ff ++#define TX_MOUNT_I_MSK 0xffffff00 ++#define TX_MOUNT_SFT 0 ++#define TX_MOUNT_HI 7 ++#define TX_MOUNT_SZ 8 ++#define RX_MOUNT_MSK 0x0000ff00 ++#define RX_MOUNT_I_MSK 0xffff00ff ++#define RX_MOUNT_SFT 8 ++#define RX_MOUNT_HI 15 ++#define RX_MOUNT_SZ 8 ++#define AVA_TAG_MSK 0x01ff0000 ++#define AVA_TAG_I_MSK 0xfe00ffff ++#define AVA_TAG_SFT 16 ++#define AVA_TAG_HI 24 ++#define AVA_TAG_SZ 9 ++#define PKTBUF_FULL_MSK 0x80000000 ++#define PKTBUF_FULL_I_MSK 0x7fffffff ++#define PKTBUF_FULL_SFT 31 ++#define PKTBUF_FULL_HI 31 ++#define PKTBUF_FULL_SZ 1 ++#define DMN_NOHIT_MCU_MSK 0x00000001 ++#define DMN_NOHIT_MCU_I_MSK 0xfffffffe ++#define DMN_NOHIT_MCU_SFT 0 ++#define DMN_NOHIT_MCU_HI 0 ++#define DMN_NOHIT_MCU_SZ 1 ++#define DMN_MCU_FLAG_MSK 0x00000002 ++#define DMN_MCU_FLAG_I_MSK 0xfffffffd ++#define DMN_MCU_FLAG_SFT 1 ++#define DMN_MCU_FLAG_HI 1 ++#define DMN_MCU_FLAG_SZ 1 ++#define DMN_MCU_WR_MSK 0x00000008 ++#define DMN_MCU_WR_I_MSK 0xfffffff7 ++#define DMN_MCU_WR_SFT 3 ++#define DMN_MCU_WR_HI 3 ++#define DMN_MCU_WR_SZ 1 ++#define DMN_MCU_PORT_MSK 0x000000f0 ++#define DMN_MCU_PORT_I_MSK 0xffffff0f ++#define DMN_MCU_PORT_SFT 4 ++#define DMN_MCU_PORT_HI 7 ++#define DMN_MCU_PORT_SZ 4 ++#define DMN_MCU_ID_MSK 0x00007f00 ++#define DMN_MCU_ID_I_MSK 0xffff80ff ++#define DMN_MCU_ID_SFT 8 ++#define DMN_MCU_ID_HI 14 ++#define DMN_MCU_ID_SZ 7 ++#define DMN_MCU_ADDR_MSK 0xffff0000 ++#define DMN_MCU_ADDR_I_MSK 0x0000ffff ++#define DMN_MCU_ADDR_SFT 16 ++#define DMN_MCU_ADDR_HI 31 ++#define DMN_MCU_ADDR_SZ 16 ++#define MB_IDTBL_31_0_MSK 0xffffffff ++#define MB_IDTBL_31_0_I_MSK 0x00000000 ++#define MB_IDTBL_31_0_SFT 0 ++#define MB_IDTBL_31_0_HI 31 ++#define MB_IDTBL_31_0_SZ 32 ++#define MB_IDTBL_63_32_MSK 0xffffffff ++#define MB_IDTBL_63_32_I_MSK 0x00000000 ++#define MB_IDTBL_63_32_SFT 0 ++#define MB_IDTBL_63_32_HI 31 ++#define MB_IDTBL_63_32_SZ 32 ++#define MB_IDTBL_95_64_MSK 0xffffffff ++#define MB_IDTBL_95_64_I_MSK 0x00000000 ++#define MB_IDTBL_95_64_SFT 0 ++#define MB_IDTBL_95_64_HI 31 ++#define MB_IDTBL_95_64_SZ 32 ++#define MB_IDTBL_127_96_MSK 0xffffffff ++#define MB_IDTBL_127_96_I_MSK 0x00000000 ++#define MB_IDTBL_127_96_SFT 0 ++#define MB_IDTBL_127_96_HI 31 ++#define MB_IDTBL_127_96_SZ 32 ++#define PKT_IDTBL_31_0_MSK 0xffffffff ++#define PKT_IDTBL_31_0_I_MSK 0x00000000 ++#define PKT_IDTBL_31_0_SFT 0 ++#define PKT_IDTBL_31_0_HI 31 ++#define PKT_IDTBL_31_0_SZ 32 ++#define PKT_IDTBL_63_32_MSK 0xffffffff ++#define PKT_IDTBL_63_32_I_MSK 0x00000000 ++#define PKT_IDTBL_63_32_SFT 0 ++#define PKT_IDTBL_63_32_HI 31 ++#define PKT_IDTBL_63_32_SZ 32 ++#define PKT_IDTBL_95_64_MSK 0xffffffff ++#define PKT_IDTBL_95_64_I_MSK 0x00000000 ++#define PKT_IDTBL_95_64_SFT 0 ++#define PKT_IDTBL_95_64_HI 31 ++#define PKT_IDTBL_95_64_SZ 32 ++#define PKT_IDTBL_127_96_MSK 0xffffffff ++#define PKT_IDTBL_127_96_I_MSK 0x00000000 ++#define PKT_IDTBL_127_96_SFT 0 ++#define PKT_IDTBL_127_96_HI 31 ++#define PKT_IDTBL_127_96_SZ 32 ++#define DMN_IDTBL_31_0_MSK 0xffffffff ++#define DMN_IDTBL_31_0_I_MSK 0x00000000 ++#define DMN_IDTBL_31_0_SFT 0 ++#define DMN_IDTBL_31_0_HI 31 ++#define DMN_IDTBL_31_0_SZ 32 ++#define DMN_IDTBL_63_32_MSK 0xffffffff ++#define DMN_IDTBL_63_32_I_MSK 0x00000000 ++#define DMN_IDTBL_63_32_SFT 0 ++#define DMN_IDTBL_63_32_HI 31 ++#define DMN_IDTBL_63_32_SZ 32 ++#define DMN_IDTBL_95_64_MSK 0xffffffff ++#define DMN_IDTBL_95_64_I_MSK 0x00000000 ++#define DMN_IDTBL_95_64_SFT 0 ++#define DMN_IDTBL_95_64_HI 31 ++#define DMN_IDTBL_95_64_SZ 32 ++#define DMN_IDTBL_127_96_MSK 0xffffffff ++#define DMN_IDTBL_127_96_I_MSK 0x00000000 ++#define DMN_IDTBL_127_96_SFT 0 ++#define DMN_IDTBL_127_96_HI 31 ++#define DMN_IDTBL_127_96_SZ 32 ++#define NEQ_MB_ID_31_0_MSK 0xffffffff ++#define NEQ_MB_ID_31_0_I_MSK 0x00000000 ++#define NEQ_MB_ID_31_0_SFT 0 ++#define NEQ_MB_ID_31_0_HI 31 ++#define NEQ_MB_ID_31_0_SZ 32 ++#define NEQ_MB_ID_63_32_MSK 0xffffffff ++#define NEQ_MB_ID_63_32_I_MSK 0x00000000 ++#define NEQ_MB_ID_63_32_SFT 0 ++#define NEQ_MB_ID_63_32_HI 31 ++#define NEQ_MB_ID_63_32_SZ 32 ++#define NEQ_MB_ID_95_64_MSK 0xffffffff ++#define NEQ_MB_ID_95_64_I_MSK 0x00000000 ++#define NEQ_MB_ID_95_64_SFT 0 ++#define NEQ_MB_ID_95_64_HI 31 ++#define NEQ_MB_ID_95_64_SZ 32 ++#define NEQ_MB_ID_127_96_MSK 0xffffffff ++#define NEQ_MB_ID_127_96_I_MSK 0x00000000 ++#define NEQ_MB_ID_127_96_SFT 0 ++#define NEQ_MB_ID_127_96_HI 31 ++#define NEQ_MB_ID_127_96_SZ 32 ++#define NEQ_PKT_ID_31_0_MSK 0xffffffff ++#define NEQ_PKT_ID_31_0_I_MSK 0x00000000 ++#define NEQ_PKT_ID_31_0_SFT 0 ++#define NEQ_PKT_ID_31_0_HI 31 ++#define NEQ_PKT_ID_31_0_SZ 32 ++#define NEQ_PKT_ID_63_32_MSK 0xffffffff ++#define NEQ_PKT_ID_63_32_I_MSK 0x00000000 ++#define NEQ_PKT_ID_63_32_SFT 0 ++#define NEQ_PKT_ID_63_32_HI 31 ++#define NEQ_PKT_ID_63_32_SZ 32 ++#define NEQ_PKT_ID_95_64_MSK 0xffffffff ++#define NEQ_PKT_ID_95_64_I_MSK 0x00000000 ++#define NEQ_PKT_ID_95_64_SFT 0 ++#define NEQ_PKT_ID_95_64_HI 31 ++#define NEQ_PKT_ID_95_64_SZ 32 ++#define NEQ_PKT_ID_127_96_MSK 0xffffffff ++#define NEQ_PKT_ID_127_96_I_MSK 0x00000000 ++#define NEQ_PKT_ID_127_96_SFT 0 ++#define NEQ_PKT_ID_127_96_HI 31 ++#define NEQ_PKT_ID_127_96_SZ 32 ++#define ALC_NOCHG_ID_MSK 0x0000007f ++#define ALC_NOCHG_ID_I_MSK 0xffffff80 ++#define ALC_NOCHG_ID_SFT 0 ++#define ALC_NOCHG_ID_HI 6 ++#define ALC_NOCHG_ID_SZ 7 ++#define ALC_NOCHG_INT_MSK 0x00008000 ++#define ALC_NOCHG_INT_I_MSK 0xffff7fff ++#define ALC_NOCHG_INT_SFT 15 ++#define ALC_NOCHG_INT_HI 15 ++#define ALC_NOCHG_INT_SZ 1 ++#define NEQ_PKT_FLAG_MSK 0x00010000 ++#define NEQ_PKT_FLAG_I_MSK 0xfffeffff ++#define NEQ_PKT_FLAG_SFT 16 ++#define NEQ_PKT_FLAG_HI 16 ++#define NEQ_PKT_FLAG_SZ 1 ++#define NEQ_MB_FLAG_MSK 0x01000000 ++#define NEQ_MB_FLAG_I_MSK 0xfeffffff ++#define NEQ_MB_FLAG_SFT 24 ++#define NEQ_MB_FLAG_HI 24 ++#define NEQ_MB_FLAG_SZ 1 ++#define SRAM_TAG_0_MSK 0x0000ffff ++#define SRAM_TAG_0_I_MSK 0xffff0000 ++#define SRAM_TAG_0_SFT 0 ++#define SRAM_TAG_0_HI 15 ++#define SRAM_TAG_0_SZ 16 ++#define SRAM_TAG_1_MSK 0xffff0000 ++#define SRAM_TAG_1_I_MSK 0x0000ffff ++#define SRAM_TAG_1_SFT 16 ++#define SRAM_TAG_1_HI 31 ++#define SRAM_TAG_1_SZ 16 ++#define SRAM_TAG_2_MSK 0x0000ffff ++#define SRAM_TAG_2_I_MSK 0xffff0000 ++#define SRAM_TAG_2_SFT 0 ++#define SRAM_TAG_2_HI 15 ++#define SRAM_TAG_2_SZ 16 ++#define SRAM_TAG_3_MSK 0xffff0000 ++#define SRAM_TAG_3_I_MSK 0x0000ffff ++#define SRAM_TAG_3_SFT 16 ++#define SRAM_TAG_3_HI 31 ++#define SRAM_TAG_3_SZ 16 ++#define SRAM_TAG_4_MSK 0x0000ffff ++#define SRAM_TAG_4_I_MSK 0xffff0000 ++#define SRAM_TAG_4_SFT 0 ++#define SRAM_TAG_4_HI 15 ++#define SRAM_TAG_4_SZ 16 ++#define SRAM_TAG_5_MSK 0xffff0000 ++#define SRAM_TAG_5_I_MSK 0x0000ffff ++#define SRAM_TAG_5_SFT 16 ++#define SRAM_TAG_5_HI 31 ++#define SRAM_TAG_5_SZ 16 ++#define SRAM_TAG_6_MSK 0x0000ffff ++#define SRAM_TAG_6_I_MSK 0xffff0000 ++#define SRAM_TAG_6_SFT 0 ++#define SRAM_TAG_6_HI 15 ++#define SRAM_TAG_6_SZ 16 ++#define SRAM_TAG_7_MSK 0xffff0000 ++#define SRAM_TAG_7_I_MSK 0x0000ffff ++#define SRAM_TAG_7_SFT 16 ++#define SRAM_TAG_7_HI 31 ++#define SRAM_TAG_7_SZ 16 ++#define SRAM_TAG_8_MSK 0x0000ffff ++#define SRAM_TAG_8_I_MSK 0xffff0000 ++#define SRAM_TAG_8_SFT 0 ++#define SRAM_TAG_8_HI 15 ++#define SRAM_TAG_8_SZ 16 ++#define SRAM_TAG_9_MSK 0xffff0000 ++#define SRAM_TAG_9_I_MSK 0x0000ffff ++#define SRAM_TAG_9_SFT 16 ++#define SRAM_TAG_9_HI 31 ++#define SRAM_TAG_9_SZ 16 ++#define SRAM_TAG_10_MSK 0x0000ffff ++#define SRAM_TAG_10_I_MSK 0xffff0000 ++#define SRAM_TAG_10_SFT 0 ++#define SRAM_TAG_10_HI 15 ++#define SRAM_TAG_10_SZ 16 ++#define SRAM_TAG_11_MSK 0xffff0000 ++#define SRAM_TAG_11_I_MSK 0x0000ffff ++#define SRAM_TAG_11_SFT 16 ++#define SRAM_TAG_11_HI 31 ++#define SRAM_TAG_11_SZ 16 ++#define SRAM_TAG_12_MSK 0x0000ffff ++#define SRAM_TAG_12_I_MSK 0xffff0000 ++#define SRAM_TAG_12_SFT 0 ++#define SRAM_TAG_12_HI 15 ++#define SRAM_TAG_12_SZ 16 ++#define SRAM_TAG_13_MSK 0xffff0000 ++#define SRAM_TAG_13_I_MSK 0x0000ffff ++#define SRAM_TAG_13_SFT 16 ++#define SRAM_TAG_13_HI 31 ++#define SRAM_TAG_13_SZ 16 ++#define SRAM_TAG_14_MSK 0x0000ffff ++#define SRAM_TAG_14_I_MSK 0xffff0000 ++#define SRAM_TAG_14_SFT 0 ++#define SRAM_TAG_14_HI 15 ++#define SRAM_TAG_14_SZ 16 ++#define SRAM_TAG_15_MSK 0xffff0000 ++#define SRAM_TAG_15_I_MSK 0x0000ffff ++#define SRAM_TAG_15_SFT 16 ++#define SRAM_TAG_15_HI 31 ++#define SRAM_TAG_15_SZ 16 +diff --git a/drivers/net/wireless/ssv6051/include/ssv6200_common.h b/drivers/net/wireless/ssv6051/include/ssv6200_common.h +new file mode 100644 +index 000000000000..e6d30f3714f7 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv6200_common.h +@@ -0,0 +1,452 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV6200_COMMON_H_ ++#define _SSV6200_COMMON_H_ ++#define FW_VERSION_REG ADR_TX_SEG ++#define M_ENG_CPU 0x00 ++#define M_ENG_HWHCI 0x01 ++#define M_ENG_EMPTY 0x02 ++#define M_ENG_ENCRYPT 0x03 ++#define M_ENG_MACRX 0x04 ++#define M_ENG_MIC 0x05 ++#define M_ENG_TX_EDCA0 0x06 ++#define M_ENG_TX_EDCA1 0x07 ++#define M_ENG_TX_EDCA2 0x08 ++#define M_ENG_TX_EDCA3 0x09 ++#define M_ENG_TX_MNG 0x0A ++#define M_ENG_ENCRYPT_SEC 0x0B ++#define M_ENG_MIC_SEC 0x0C ++#define M_ENG_RESERVED_1 0x0D ++#define M_ENG_RESERVED_2 0x0E ++#define M_ENG_TRASH_CAN 0x0F ++#define M_ENG_MAX (M_ENG_TRASH_CAN+1) ++#define M_CPU_HWENG 0x00 ++#define M_CPU_TXL34CS 0x01 ++#define M_CPU_RXL34CS 0x02 ++#define M_CPU_DEFRAG 0x03 ++#define M_CPU_EDCATX 0x04 ++#define M_CPU_RXDATA 0x05 ++#define M_CPU_RXMGMT 0x06 ++#define M_CPU_RXCTRL 0x07 ++#define M_CPU_FRAG 0x08 ++#define M_CPU_TXTPUT 0x09 ++#ifndef ID_TRAP_SW_TXTPUT ++#define ID_TRAP_SW_TXTPUT 50 ++#endif ++#define M0_TXREQ 0 ++#define M1_TXREQ 1 ++#define M2_TXREQ 2 ++#define M0_RXEVENT 3 ++#define M2_RXEVENT 4 ++#define HOST_CMD 5 ++#define HOST_EVENT 6 ++#define TEST_CMD 7 ++#define SSV6XXX_RX_DESC_LEN \ ++ (sizeof(struct ssv6200_rx_desc) + \ ++ sizeof(struct ssv6200_rxphy_info)) ++#define SSV6XXX_TX_DESC_LEN \ ++ (sizeof(struct ssv6200_tx_desc) + 0) ++#define TXPB_OFFSET 80 ++#define RXPB_OFFSET 80 ++#define SSV6200_TX_PKT_RSVD_SETTING 0x3 ++#define SSV6200_TX_PKT_RSVD SSV6200_TX_PKT_RSVD_SETTING*16 ++#define SSV6200_ALLOC_RSVD TXPB_OFFSET+SSV6200_TX_PKT_RSVD ++#define SSV62XX_TX_MAX_RATES 3 ++ ++enum ssv6xxx_sr_bhvr { ++ SUSPEND_RESUME_0, ++ SUSPEND_RESUME_1, ++ SUSPEND_RESUME_MAX ++}; ++ ++enum ssv6xxx_reboot_bhvr { ++ SSV_SYS_REBOOT = 1, ++ SSV_SYS_HALF, ++ SSV_SYS_POWER_OFF ++}; ++ ++struct fw_rc_retry_params { ++ u32 count:4; ++ u32 drate:6; ++ u32 crate:6; ++ u32 rts_cts_nav:16; ++ u32 frame_consume_time:10; ++ u32 dl_length:12; ++ u32 RSVD:10; ++} __attribute__((packed)); ++struct ssv6200_tx_desc { ++ u32 len:16; ++ u32 c_type:3; ++ u32 f80211:1; ++ u32 qos:1; ++ u32 ht:1; ++ u32 use_4addr:1; ++ u32 RSVD_0:3; ++ u32 bc_que:1; ++ u32 security:1; ++ u32 more_data:1; ++ u32 stype_b5b4:2; ++ u32 extra_info:1; ++ u32 fCmd; ++ u32 hdr_offset:8; ++ u32 frag:1; ++ u32 unicast:1; ++ u32 hdr_len:6; ++ u32 tx_report:1; ++ u32 tx_burst:1; ++ u32 ack_policy:2; ++ u32 aggregation:1; ++ u32 RSVD_1:3; ++ u32 do_rts_cts:2; ++ u32 reason:6; ++ u32 payload_offset:8; ++ u32 RSVD_4:7; ++ u32 RSVD_2:1; ++ u32 fCmdIdx:3; ++ u32 wsid:4; ++ u32 txq_idx:3; ++ u32 TxF_ID:6; ++ u32 rts_cts_nav:16; ++ u32 frame_consume_time:10; ++ u32 crate_idx:6; ++ u32 drate_idx:6; ++ u32 dl_length:12; ++ u32 RSVD_3:14; ++ u32 RESERVED[8]; ++ struct fw_rc_retry_params rc_params[SSV62XX_TX_MAX_RATES]; ++}; ++struct ssv6200_rx_desc { ++ u32 len:16; ++ u32 c_type:3; ++ u32 f80211:1; ++ u32 qos:1; ++ u32 ht:1; ++ u32 use_4addr:1; ++ u32 l3cs_err:1; ++ u32 l4cs_err:1; ++ u32 align2:1; ++ u32 RSVD_0:2; ++ u32 psm:1; ++ u32 stype_b5b4:2; ++ u32 extra_info:1; ++ u32 edca0_used:4; ++ u32 edca1_used:5; ++ u32 edca2_used:5; ++ u32 edca3_used:5; ++ u32 mng_used:4; ++ u32 tx_page_used:9; ++ u32 hdr_offset:8; ++ u32 frag:1; ++ u32 unicast:1; ++ u32 hdr_len:6; ++ u32 RxResult:8; ++ u32 wildcard_bssid:1; ++ u32 RSVD_1:1; ++ u32 reason:6; ++ u32 payload_offset:8; ++ u32 tx_id_used:8; ++ u32 fCmdIdx:3; ++ u32 wsid:4; ++ u32 RSVD_3:3; ++ u32 rate_idx:6; ++}; ++struct ssv6200_rxphy_info { ++ u32 len:16; ++ u32 rsvd0:16; ++ u32 mode:3; ++ u32 ch_bw:3; ++ u32 preamble:1; ++ u32 ht_short_gi:1; ++ u32 rate:7; ++ u32 rsvd1:1; ++ u32 smoothing:1; ++ u32 no_sounding:1; ++ u32 aggregate:1; ++ u32 stbc:2; ++ u32 fec:1; ++ u32 n_ess:2; ++ u32 rsvd2:8; ++ u32 l_length:12; ++ u32 l_rate:3; ++ u32 rsvd3:17; ++ u32 rsvd4; ++ u32 rpci:8; ++ u32 snr:8; ++ u32 service:16; ++}; ++struct ssv6200_rxphy_info_padding { ++ u32 rpci:8; ++ u32 snr:8; ++ u32 RSVD:16; ++}; ++struct ssv6200_txphy_info { ++ u32 rsvd[7]; ++}; ++#ifdef CONFIG_P2P_NOA ++struct ssv6xxx_p2p_noa_param { ++ u32 duration; ++ u32 interval; ++ u32 start_time; ++ u32 enable:8; ++ u32 count:8; ++ u8 addr[6]; ++ u8 vif_id; ++} __attribute__((packed)); ++#endif ++typedef struct cfg_host_cmd { ++ u32 len:16; ++ u32 c_type:3; ++ u32 RSVD0:5; ++ u32 h_cmd:8; ++ u32 cmd_seq_no; ++ union { ++ u32 dummy; ++ u8 dat8[0]; ++ u16 dat16[0]; ++ u32 dat32[0]; ++ }; ++} HDR_HostCmd; ++#define HOST_CMD_HDR_LEN ((size_t)(((HDR_HostCmd *)100)->dat8)-100U) ++struct sdio_rxtput_cfg { ++ u32 size_per_frame; ++ u32 total_frames; ++}; ++typedef enum { ++ SSV6XXX_HOST_CMD_START = 0, ++ SSV6XXX_HOST_CMD_LOG, ++ SSV6XXX_HOST_CMD_PS, ++ SSV6XXX_HOST_CMD_INIT_CALI, ++ SSV6XXX_HOST_CMD_RX_TPUT, ++ SSV6XXX_HOST_CMD_TX_TPUT, ++ SSV6XXX_HOST_CMD_WATCHDOG_START, ++ SSV6XXX_HOST_CMD_WATCHDOG_STOP, ++ SSV6XXX_HOST_CMD_WSID_OP, ++#ifdef CONFIG_P2P_NOA ++ SSV6XXX_HOST_CMD_SET_NOA, ++#endif ++ SSV6XXX_HOST_SOC_CMD_MAXID, ++} ssv6xxx_host_cmd_id; ++#define SSV_NUM_HW_STA 2 ++typedef struct cfg_host_event { ++ u32 len:16; ++ u32 c_type:3; ++ u32 RSVD0:5; ++ u32 h_event:8; ++ u32 evt_seq_no; ++ u8 dat[0]; ++} HDR_HostEvent; ++typedef enum { ++#ifdef USE_CMD_RESP ++ SOC_EVT_CMD_RESP, ++ SOC_EVT_SCAN_RESULT, ++ SOC_EVT_DEAUTH, ++#else ++ SOC_EVT_GET_REG_RESP, ++#endif ++ SOC_EVT_NO_BA, ++ SOC_EVT_RC_MPDU_REPORT, ++ SOC_EVT_RC_AMPDU_REPORT, ++ SOC_EVT_LOG, ++#ifdef CONFIG_P2P_NOA ++ SOC_EVT_NOA, ++#endif ++ SOC_EVT_USER_END, ++ SOC_EVT_SDIO_TEST_COMMAND, ++ SOC_EVT_RESET_HOST, ++ SOC_EVT_SDIO_TXTPUT_RESULT, ++ SOC_EVT_WATCHDOG_TRIGGER, ++ SOC_EVT_TXLOOPBK_RESULT, ++ SOC_EVT_MAXID, ++} ssv6xxx_soc_event; ++#ifdef CONFIG_P2P_NOA ++typedef enum { ++ SSV6XXX_NOA_START = 0, ++ SSV6XXX_NOA_STOP, ++} ssv6xxx_host_noa_event; ++struct ssv62xx_noa_evt { ++ u8 evt_id; ++ u8 vif; ++} __attribute__((packed)); ++#endif ++typedef enum { ++ SSV6XXX_RC_COUNTER_CLEAR = 1, ++ SSV6XXX_RC_REPORT, ++} ssv6xxx_host_rate_control_event; ++#define MAX_AGGR_NUM (24) ++struct ssv62xx_tx_rate { ++ s8 data_rate; ++ u8 count; ++} __attribute__((packed)); ++struct ampdu_ba_notify_data { ++ u8 wsid; ++ struct ssv62xx_tx_rate tried_rates[SSV62XX_TX_MAX_RATES]; ++ u16 seq_no[MAX_AGGR_NUM]; ++} __attribute__((packed)); ++struct firmware_rate_control_report_data { ++ u8 wsid; ++ struct ssv62xx_tx_rate rates[SSV62XX_TX_MAX_RATES]; ++ u16 ampdu_len; ++ u16 ampdu_ack_len; ++ int ack_signal; ++} __attribute__((packed)); ++#define RC_RETRY_PARAM_OFFSET ((sizeof(struct fw_rc_retry_params))*SSV62XX_TX_MAX_RATES) ++#define SSV_RC_RATE_MAX 39 ++enum SSV6XXX_WSID_OPS { ++ SSV6XXX_WSID_OPS_ADD, ++ SSV6XXX_WSID_OPS_DEL, ++ SSV6XXX_WSID_OPS_RESETALL, ++ SSV6XXX_WSID_OPS_ENABLE_CAPS, ++ SSV6XXX_WSID_OPS_DISABLE_CAPS, ++ SSV6XXX_WSID_OPS_HWWSID_PAIRWISE_SET_TYPE, ++ SSV6XXX_WSID_OPS_HWWSID_GROUP_SET_TYPE, ++ SSV6XXX_WSID_OPS_MAX ++}; ++enum SSV6XXX_WSID_SEC { ++ SSV6XXX_WSID_SEC_NONE = 0, ++ SSV6XXX_WSID_SEC_PAIRWISE = 1 << 0, ++ SSV6XXX_WSID_SEC_GROUP = 1 << 1, ++}; ++enum SSV6XXX_WSID_SEC_TYPE { ++ SSV6XXX_WSID_SEC_SW, ++ SSV6XXX_WSID_SEC_HW, ++ SSV6XXX_WSID_SEC_TYPE_MAX ++}; ++enum SSV6XXX_RETURN_STATE { ++ SSV6XXX_STATE_OK, ++ SSV6XXX_STATE_NG, ++ SSV6XXX_STATE_MAX ++}; ++struct ssv6xxx_wsid_params { ++ u8 cmd; ++ u8 wsid_idx; ++ u8 target_wsid[6]; ++ u8 hw_security; ++}; ++struct ssv6xxx_iqk_cfg { ++ u32 cfg_xtal:8; ++ u32 cfg_pa:8; ++ u32 cfg_pabias_ctrl:8; ++ u32 cfg_pacascode_ctrl:8; ++ u32 cfg_tssi_trgt:8; ++ u32 cfg_tssi_div:8; ++ u32 cfg_def_tx_scale_11b:8; ++ u32 cfg_def_tx_scale_11b_p0d5:8; ++ u32 cfg_def_tx_scale_11g:8; ++ u32 cfg_def_tx_scale_11g_p0d5:8; ++ u32 cmd_sel; ++ union { ++ u32 fx_sel; ++ u32 argv; ++ }; ++ u32 phy_tbl_size; ++ u32 rf_tbl_size; ++}; ++#define PHY_SETTING_SIZE sizeof(phy_setting) ++struct ssv6xxx_ch_cfg { ++ u32 reg_addr; ++ u32 ch1_12_value; ++ u32 ch13_14_value; ++}; ++#define IQK_CFG_LEN (sizeof(struct ssv6xxx_iqk_cfg)) ++#define RF_SETTING_SIZE (sizeof(asic_rf_setting)) ++#define MAX_PHY_SETTING_TABLE_SIZE 1920 ++#define MAX_RF_SETTING_TABLE_SIZE 512 ++typedef enum { ++ SSV6XXX_VOLT_DCDC_CONVERT = 0, ++ SSV6XXX_VOLT_LDO_CONVERT, ++} ssv6xxx_cfg_volt; ++typedef enum { ++ SSV6XXX_VOLT_33V = 0, ++ SSV6XXX_VOLT_42V, ++} ssv6xxx_cfg_volt_value; ++typedef enum { ++ SSV6XXX_IQK_CFG_XTAL_26M = 0, ++ SSV6XXX_IQK_CFG_XTAL_40M, ++ SSV6XXX_IQK_CFG_XTAL_24M, ++ SSV6XXX_IQK_CFG_XTAL_MAX, ++} ssv6xxx_iqk_cfg_xtal; ++typedef enum { ++ SSV6XXX_IQK_CFG_PA_DEF = 0, ++ SSV6XXX_IQK_CFG_PA_LI_MPB, ++ SSV6XXX_IQK_CFG_PA_LI_EVB, ++ SSV6XXX_IQK_CFG_PA_HP, ++} ssv6xxx_iqk_cfg_pa; ++typedef enum { ++ SSV6XXX_IQK_CMD_INIT_CALI = 0, ++ SSV6XXX_IQK_CMD_RTBL_LOAD, ++ SSV6XXX_IQK_CMD_RTBL_LOAD_DEF, ++ SSV6XXX_IQK_CMD_RTBL_RESET, ++ SSV6XXX_IQK_CMD_RTBL_SET, ++ SSV6XXX_IQK_CMD_RTBL_EXPORT, ++ SSV6XXX_IQK_CMD_TK_EVM, ++ SSV6XXX_IQK_CMD_TK_TONE, ++ SSV6XXX_IQK_CMD_TK_CHCH, ++} ssv6xxx_iqk_cmd_sel; ++#define SSV6XXX_IQK_TEMPERATURE 0x00000004 ++#define SSV6XXX_IQK_RXDC 0x00000008 ++#define SSV6XXX_IQK_RXRC 0x00000010 ++#define SSV6XXX_IQK_TXDC 0x00000020 ++#define SSV6XXX_IQK_TXIQ 0x00000040 ++#define SSV6XXX_IQK_RXIQ 0x00000080 ++#define SSV6XXX_IQK_TSSI 0x00000100 ++#define SSV6XXX_IQK_PAPD 0x00000200 ++typedef struct ssv_cabrio_reg_st { ++ u32 address; ++ u32 data; ++} ssv_cabrio_reg; ++typedef enum __PBuf_Type_E { ++ NOTYPE_BUF = 0, ++ TX_BUF = 1, ++ RX_BUF = 2 ++} PBuf_Type_E; ++struct SKB_info_st { ++ struct ieee80211_sta *sta; ++ u16 mpdu_retry_counter; ++ unsigned long aggr_timestamp; ++ u16 ampdu_tx_status; ++ u16 ampdu_tx_final_retry_count; ++ u16 lowest_rate; ++ struct fw_rc_retry_params rates[SSV62XX_TX_MAX_RATES]; ++#ifdef CONFIG_DEBUG_SKB_TIMESTAMP ++ ktime_t timestamp; ++#endif ++}; ++typedef struct SKB_info_st SKB_info; ++typedef struct SKB_info_st *p_SKB_info; ++#define SSV_SKB_info_size (sizeof(struct SKB_info_st)) ++#ifdef CONFIG_DEBUG_SKB_TIMESTAMP ++#define SKB_DURATION_TIMEOUT_MS 100 ++enum ssv_debug_skb_timestamp { ++ SKB_DURATION_STAGE_TX_ENQ, ++ SKB_DURATION_STAGE_TO_SDIO, ++ SKB_DURATION_STAGE_IN_HWQ, ++ SKB_DURATION_STAGE_END ++}; ++#endif ++#define SSV6051Q_P1 0x00000000 ++#define SSV6051Q_P2 0x70000000 ++#define SSV6051Z 0x71000000 ++#define SSV6051Q 0x73000000 ++#define SSV6051P 0x75000000 ++struct ssv6xxx_tx_loopback { ++ u32 reg; ++ u32 val; ++ u32 restore_val; ++ u8 restore; ++ u8 delay_ms; ++}; ++#endif +diff --git a/drivers/net/wireless/ssv6051/include/ssv6200_configuration.h b/drivers/net/wireless/ssv6051/include/ssv6200_configuration.h +new file mode 100644 +index 000000000000..0327393de3f5 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv6200_configuration.h +@@ -0,0 +1,317 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++static ssv_cabrio_reg phy_setting[] = { ++ {0xce0071bc, 0x565B565B}, ++ {0xce000008, 0x0000006a}, ++ {0xce00000c, 0x00000064}, ++ {0xce000010, 0x00007FFF}, ++ {0xce000014, 0x00000003}, ++ {0xce000018, 0x0055003C}, ++ {0xce00001c, 0x00000064}, ++ {0xce000020, 0x20000000}, ++ {0xce00002c, 0x00000000}, ++ {0xce000030, 0x80046072}, ++ {0xce000034, 0x1f300f6f}, ++ {0xce000038, 0x660F36D0}, ++ {0xce00003c, 0x106C0004}, ++ {0xce000040, 0x01601400}, ++ {0xce000044, 0x00600008}, ++ {0xce000048, 0xff000160}, ++ {0xce00004c, 0x00000840}, ++ {0xce000060, 0x01000405}, ++ {0xce000064, 0x06090813}, ++ {0xce000068, 0x12070000}, ++ {0xce00006c, 0x01000405}, ++ {0xce000070, 0x06090813}, ++ {0xce000074, 0x12010000}, ++ {0xce000078, 0x00000000}, ++ {0xce00007c, 0x10110003}, ++ {0xce000080, 0x0110000F}, ++ {0xce000084, 0x00000000}, ++ {0xce000088, 0x00000000}, ++ {0xce000094, 0x01012425}, ++ {0xce000098, 0x01010101}, ++ {0xce00009c, 0x00000011}, ++ {0xce0000a0, 0x1fff0000}, ++ {0xce0000a4, 0x1fff0000}, ++ {0xce0000a8, 0x1fff0000}, ++ {0xce0000ac, 0x1fff0000}, ++ {0xce0000b8, 0x0000fe3e}, ++ {0xce0000fc, 0xffffffff}, ++ {0xce000108, 0x0ead04f5}, ++ {0xce00010c, 0x0fd60080}, ++ {0xce000110, 0x00000009}, ++ {0xce0010a4, 0x0000002c}, ++ {0xce0010b4, 0x00003001}, ++ {0xce0010d4, 0x00000001}, ++ {0xce002000, 0x00000044}, ++ {0xce002004, 0x00040000}, ++ {0xce002008, 0x20300050}, ++ {0xce00200c, 0x00003467}, ++ {0xce002010, 0x00430000}, ++ {0xce002014, 0x20304015}, ++ {0xce002018, 0x00390005}, ++ {0xce00201c, 0x05555555}, ++ {0xce002020, 0x00570057}, ++ {0xce002024, 0x00570057}, ++ {0xce002028, 0x00236700}, ++ {0xce00202c, 0x000d1746}, ++ {0xce002030, 0x05061787}, ++ {0xce002034, 0x07800000}, ++ {0xce00209c, 0x00900008}, ++ {0xce0020a0, 0x00000000}, ++ {0xce0023f8, 0x00000000}, ++ {0xce0023fc, 0x00000001}, ++ {0xce0030a4, 0x00001901}, ++ {0xce0030b8, 0x5d08908e}, ++ {0xce004000, 0x00000044}, ++ {0xce004004, 0x00750075}, ++ {0xce004008, 0x00000075}, ++ {0xce00400c, 0x10000075}, ++ {0xce004010, 0x3F384905}, ++ {0xce004014, 0x40182000}, ++ {0xce004018, 0x20600000}, ++ {0xce00401c, 0x0C010120}, ++ {0xce004020, 0x50505050}, ++ {0xce004024, 0x50000000}, ++ {0xce004028, 0x50505050}, ++ {0xce00402c, 0x506070A0}, ++ {0xce004030, 0xF0000000}, ++ {0xce004034, 0x00002424}, ++ {0xce004038, 0x00001420}, ++ {0xce00409c, 0x0000300A}, ++ {0xce0040c0, 0x20000280}, ++ {0xce0040c4, 0x30023002}, ++ {0xce0040c8, 0x0000003a}, ++ {0xce004130, 0x40000000}, ++ {0xce004164, 0x009C007E}, ++ {0xce004180, 0x00044400}, ++ {0xce004188, 0x82000000}, ++ {0xce004190, 0x00000000}, ++ {0xce004194, 0xffffffff}, ++ {0xce004380, 0x00700010}, ++ {0xce004384, 0x00007575}, ++ {0xce004388, 0x0001fe3e}, ++ {0xce00438c, 0x0000fe3e}, ++ {0xce0043f8, 0x00000001}, ++ {0xce007000, 0x00000000}, ++ {0xce007004, 0x00008000}, ++ {0xce007008, 0x00000000}, ++ {0xce00700c, 0x00000000}, ++ {0xce007010, 0x00000000}, ++ {0xce007014, 0x00000000}, ++ {0xce007018, 0x00000000}, ++ {0xce00701c, 0x00000000}, ++ {0xce007020, 0x00000000}, ++ {0xce007024, 0x00000000}, ++ {0xce007028, 0x00000000}, ++ {0xce00702c, 0x00000000}, ++ {0xce007030, 0x00000000}, ++ {0xce007034, 0x00000000}, ++ {0xce007038, 0x00000000}, ++ {0xce00703c, 0x00000000}, ++ {0xce007040, 0x02000200}, ++ {0xce007048, 0x00000000}, ++ {0xce00704c, 0x00000000}, ++ {0xce007050, 0x00000000}, ++ {0xce007054, 0x00000000}, ++ {0xce007058, 0x000028ff}, ++ {0xce00705c, 0x00000000}, ++ {0xce007060, 0x00000000}, ++ {0xce007064, 0x00000000}, ++ {0xce007068, 0x00000000}, ++ {0xce00706c, 0x00000202}, ++ {0xce007070, 0x80ffc200}, ++ {0xce007074, 0x00000000}, ++ {0xce007078, 0x00000000}, ++ {0xce00707c, 0x00000000}, ++ {0xce007080, 0x00000000}, ++ {0xce007084, 0x00000000}, ++ {0xce007088, 0x00000000}, ++ {0xce00708c, 0x00000000}, ++ {0xce007090, 0x00000000}, ++ {0xce007094, 0x00000000}, ++ {0xce007098, 0x00000000}, ++ {0xce00709c, 0x00000000}, ++ {0xce0070a0, 0x00000000}, ++ {0xce0070a4, 0x00000000}, ++ {0xce0070a8, 0x00000000}, ++ {0xce0070ac, 0x00000000}, ++ {0xce0070b0, 0x00000000}, ++ {0xce0070b4, 0x00000000}, ++ {0xce0070b8, 0x00000000}, ++ {0xce0070bc, 0x00000000}, ++ {0xce0070c0, 0x00000000}, ++ {0xce0070c4, 0x00000000}, ++ {0xce0070c8, 0x00000000}, ++ {0xce0070cc, 0x00000000}, ++ {0xce0070d0, 0x00000000}, ++ {0xce0070d4, 0x00000000}, ++ {0xce0070d8, 0x00000000}, ++ {0xce0070dc, 0x00000000}, ++ {0xce0070e0, 0x00000000}, ++ {0xce0070e4, 0x00000000}, ++ {0xce0070e8, 0x00000000}, ++ {0xce0070ec, 0x00000000}, ++ {0xce0070f0, 0x00000000}, ++ {0xce0070f4, 0x00000000}, ++ {0xce0070f8, 0x00000000}, ++ {0xce0070fc, 0x00000000}, ++ {0xce007100, 0x00000000}, ++ {0xce007104, 0x00000000}, ++ {0xce007108, 0x00000000}, ++ {0xce00710c, 0x00000000}, ++ {0xce007110, 0x00000000}, ++ {0xce007114, 0x00000000}, ++ {0xce007118, 0x00000000}, ++ {0xce00711c, 0x00000000}, ++ {0xce007120, 0x02000200}, ++ {0xce007124, 0x02000200}, ++ {0xce007128, 0x02000200}, ++ {0xce00712c, 0x02000200}, ++ {0xce007130, 0x02000200}, ++ {0xce007134, 0x02000200}, ++ {0xce007138, 0x02000200}, ++ {0xce00713c, 0x02000200}, ++ {0xce007140, 0x02000200}, ++ {0xce007144, 0x02000200}, ++ {0xce007148, 0x02000200}, ++ {0xce00714c, 0x02000200}, ++ {0xce007150, 0x02000200}, ++ {0xce007154, 0x02000200}, ++ {0xce007158, 0x00000000}, ++ {0xce00715c, 0x00000000}, ++ {0xce007160, 0x00000000}, ++ {0xce007164, 0x00000000}, ++ {0xce007168, 0x00000000}, ++ {0xce00716c, 0x00000000}, ++ {0xce007170, 0x00000000}, ++ {0xce007174, 0x00000000}, ++ {0xce007178, 0x00000000}, ++ {0xce00717c, 0x00000000}, ++ {0xce007180, 0x00000000}, ++ {0xce007184, 0x00000000}, ++ {0xce007188, 0x00000000}, ++ {0xce00718c, 0x00000000}, ++ {0xce007190, 0x00000000}, ++ {0xce007194, 0x00000000}, ++ {0xce007198, 0x00000000}, ++ {0xce00719c, 0x00000000}, ++ {0xce0071a0, 0x00000000}, ++ {0xce0071a4, 0x00000000}, ++ {0xce0071a8, 0x00000000}, ++ {0xce0071ac, 0x00000000}, ++ {0xce0071b0, 0x00000000}, ++ {0xce0071b4, 0x00000100}, ++ {0xce0071b8, 0x00000000}, ++ {0xce0071c0, 0x00000000}, ++ {0xce0071c4, 0x00000000}, ++ {0xce0071c8, 0x00000000}, ++ {0xce0071cc, 0x00000000}, ++ {0xce0071d0, 0x00000000}, ++ {0xce0071d4, 0x00000000}, ++ {0xce0071d8, 0x00000000}, ++ {0xce0071dc, 0x00000000}, ++ {0xce0071e0, 0x00000000}, ++ {0xce0071e4, 0x00000000}, ++ {0xce0071e8, 0x00000000}, ++ {0xce0071ec, 0x00000000}, ++ {0xce0071f0, 0x00000000}, ++ {0xce0071f4, 0x00000000}, ++ {0xce0071f8, 0x00000000}, ++ {0xce0071fc, 0x00000000}, ++ {0xce0043fc, 0x000104E5}, ++ {0xce007044, 0x00028080}, ++ {0xce000000, 0x80000016}, ++}; ++ ++static const u32 wifi_tx_gain[] = { ++ 0x79807980, ++ 0x72797279, ++ 0x6C726C72, ++ 0x666C666C, ++ 0x60666066, ++ 0x5B605B60, ++ 0x565B565B, ++ 0x51565156, ++ 0x4C514C51, ++ 0x484C484C, ++ 0x44484448, ++ 0x40444044, ++ 0x3C403C40, ++ 0x3A3D3A3D, ++ 0x36393639, ++}; ++ ++static ssv_cabrio_reg asic_rf_setting[] = { ++ {0xCE010038, 0x0003E07C}, ++ {0xCE010060, 0x00406000}, ++ {0xCE01009C, 0x00000024}, ++ {0xCE0100A0, 0x00EC4CC5}, ++ {0xCE010000, 0x40002000}, ++ {0xCE010004, 0x00020FC0}, ++ {0xCE010008, 0x000DF69B}, ++ {0xCE010014, 0x3D3E84FE}, ++ {0xCE010018, 0x01457D79}, ++ {0xCE01001C, 0x000103A7}, ++ {0xCE010020, 0x000103A6}, ++ {0xCE01002C, 0x00032CA8}, ++ {0xCE010048, 0xFCCCCF27}, ++ {0xCE010050, 0x00444000}, ++ {0xCE01000C, 0x151558C5}, ++ {0xCE010010, 0x01011A88}, ++ {0xCE010024, 0x00012001}, ++ {0xCE010028, 0x00036000}, ++ {0xCE010030, 0x20EA0224}, ++ {0xCE010034, 0x44000755}, ++ {0xCE01003C, 0x55D89D8A}, ++ {0xCE010040, 0x005508BB}, ++ {0xCE010044, 0x07C08BFF}, ++ {0xCE01004C, 0x07700830}, ++ {0xCE010054, 0x00007FF4}, ++ {0xCE010058, 0x0000000E}, ++ {0xCE01005C, 0x00088018}, ++ {0xCE010064, 0x08820820}, ++ {0xCE010068, 0x00820820}, ++ {0xCE01006C, 0x00820820}, ++ {0xCE010070, 0x00820820}, ++ {0xCE010074, 0x00820820}, ++ {0xCE010078, 0x00820820}, ++ {0xCE01007C, 0x00820820}, ++ {0xCE010080, 0x00820820}, ++ {0xCE010084, 0x00004080}, ++ {0xCE010088, 0x200800FE}, ++ {0xCE01008C, 0xAAAAAAAA}, ++ {0xCE010090, 0xAAAAAAAA}, ++ {0xCE010094, 0x0000A487}, ++ {0xCE010098, 0x0000070E}, ++ {0xCE0100A4, 0x00000F43}, ++ {0xCE0100A8, 0x00098900}, ++ {0xCE0100AC, 0x00000000}, ++ {0xC00003AC, 0x00000000}, ++ {0xC00003B0, 0x00000000}, ++ {0xC00003B4, 0x00000000}, ++ {0xC00003BC, 0x00000000}, ++ {0xC0001D00, 0x5E000040}, ++ {0xC0001D04, 0x015D015D}, ++ {0xC0001D08, 0x00000001}, ++ {0xC0001D0C, 0x55550000}, ++ {0xC0001D20, 0x7FFF0000}, ++ {0xC0001D24, 0x00000003}, ++ {0xC0001D28, 0x00000000}, ++ {0xC0001D2C, 0x00000000}, ++}; +diff --git a/drivers/net/wireless/ssv6051/include/ssv6200_reg.h b/drivers/net/wireless/ssv6051/include/ssv6200_reg.h +new file mode 100644 +index 000000000000..d4a99b25d61f +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv6200_reg.h +@@ -0,0 +1,9694 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#define SYS_REG_BASE 0xc0000000 ++#define WBOOT_REG_BASE 0xc0000100 ++#define TU0_US_REG_BASE 0xc0000200 ++#define TU1_US_REG_BASE 0xc0000210 ++#define TU2_US_REG_BASE 0xc0000220 ++#define TU3_US_REG_BASE 0xc0000230 ++#define TM0_MS_REG_BASE 0xc0000240 ++#define TM1_MS_REG_BASE 0xc0000250 ++#define TM2_MS_REG_BASE 0xc0000260 ++#define TM3_MS_REG_BASE 0xc0000270 ++#define MCU_WDT_REG_BASE 0xc0000280 ++#define SYS_WDT_REG_BASE 0xc0000284 ++#define GPIO_REG_BASE 0xc0000300 ++#define SD_REG_BASE 0xc0000800 ++#define SPI_REG_BASE 0xc0000a00 ++#define CSR_I2C_MST_BASE 0xc0000b00 ++#define UART_REG_BASE 0xc0000c00 ++#define DAT_UART_REG_BASE 0xc0000d00 ++#define INT_REG_BASE 0xc0000e00 ++#define DBG_SPI_REG_BASE 0xc0000f00 ++#define FLASH_SPI_REG_BASE 0xc0001000 ++#define DMA_REG_BASE 0xc0001c00 ++#define CSR_PMU_BASE 0xc0001d00 ++#define CSR_RTC_BASE 0xc0001d20 ++#define RTC_RAM_BASE 0xc0001d80 ++#define D2_DMA_REG_BASE 0xc0001e00 ++#define HCI_REG_BASE 0xc1000000 ++#define CO_REG_BASE 0xc2000000 ++#define EFS_REG_BASE 0xc2000100 ++#define SMS4_REG_BASE 0xc3000000 ++#define MRX_REG_BASE 0xc6000000 ++#define AMPDU_REG_BASE 0xc6001000 ++#define MT_REG_CSR_BASE 0xc6002000 ++#define TXQ0_MT_Q_REG_CSR_BASE 0xc6002100 ++#define TXQ1_MT_Q_REG_CSR_BASE 0xc6002200 ++#define TXQ2_MT_Q_REG_CSR_BASE 0xc6002300 ++#define TXQ3_MT_Q_REG_CSR_BASE 0xc6002400 ++#define TXQ4_MT_Q_REG_CSR_BASE 0xc6002500 ++#define HIF_INFO_BASE 0xca000000 ++#define PHY_RATE_INFO_BASE 0xca000200 ++#define MAC_GLB_SET_BASE 0xca000300 ++#define BTCX_REG_BASE 0xca000400 ++#define MIB_REG_BASE 0xca000800 ++#define CBR_A_REG_BASE 0xcb000000 ++#define MB_REG_BASE 0xcd000000 ++#define ID_MNG_REG_BASE 0xcd010000 ++#define CSR_PHY_BASE 0xce000000 ++#define CSR_RF_BASE 0xce010000 ++#define MMU_REG_BASE 0xcf000000 ++#define SYS_REG_BANK_SIZE 0x000000b4 ++#define WBOOT_REG_BANK_SIZE 0x0000000c ++#define TU0_US_REG_BANK_SIZE 0x00000010 ++#define TU1_US_REG_BANK_SIZE 0x00000010 ++#define TU2_US_REG_BANK_SIZE 0x00000010 ++#define TU3_US_REG_BANK_SIZE 0x00000010 ++#define TM0_MS_REG_BANK_SIZE 0x00000010 ++#define TM1_MS_REG_BANK_SIZE 0x00000010 ++#define TM2_MS_REG_BANK_SIZE 0x00000010 ++#define TM3_MS_REG_BANK_SIZE 0x00000010 ++#define MCU_WDT_REG_BANK_SIZE 0x00000004 ++#define SYS_WDT_REG_BANK_SIZE 0x00000004 ++#define GPIO_REG_BANK_SIZE 0x000000d4 ++#define SD_REG_BANK_SIZE 0x00000180 ++#define SPI_REG_BANK_SIZE 0x00000040 ++#define CSR_I2C_MST_BANK_SIZE 0x00000018 ++#define UART_REG_BANK_SIZE 0x00000028 ++#define DAT_UART_REG_BANK_SIZE 0x00000028 ++#define INT_REG_BANK_SIZE 0x0000004c ++#define DBG_SPI_REG_BANK_SIZE 0x00000040 ++#define FLASH_SPI_REG_BANK_SIZE 0x0000002c ++#define DMA_REG_BANK_SIZE 0x00000014 ++#define CSR_PMU_BANK_SIZE 0x00000100 ++#define CSR_RTC_BANK_SIZE 0x000000e0 ++#define RTC_RAM_BANK_SIZE 0x00000080 ++#define D2_DMA_REG_BANK_SIZE 0x00000014 ++#define HCI_REG_BANK_SIZE 0x000000cc ++#define CO_REG_BANK_SIZE 0x000000ac ++#define EFS_REG_BANK_SIZE 0x0000006c ++#define SMS4_REG_BANK_SIZE 0x00000070 ++#define MRX_REG_BANK_SIZE 0x00000198 ++#define AMPDU_REG_BANK_SIZE 0x00000014 ++#define MT_REG_CSR_BANK_SIZE 0x00000100 ++#define TXQ0_MT_Q_REG_CSR_BANK_SIZE 0x0000001c ++#define TXQ1_MT_Q_REG_CSR_BANK_SIZE 0x0000001c ++#define TXQ2_MT_Q_REG_CSR_BANK_SIZE 0x0000001c ++#define TXQ3_MT_Q_REG_CSR_BANK_SIZE 0x0000001c ++#define TXQ4_MT_Q_REG_CSR_BANK_SIZE 0x0000001c ++#define HIF_INFO_BANK_SIZE 0x0000009c ++#define PHY_RATE_INFO_BANK_SIZE 0x000000b8 ++#define MAC_GLB_SET_BANK_SIZE 0x0000003c ++#define BTCX_REG_BANK_SIZE 0x0000000c ++#define MIB_REG_BANK_SIZE 0x00000480 ++#define CBR_A_REG_BANK_SIZE 0x001203fc ++#define MB_REG_BANK_SIZE 0x000000a0 ++#define ID_MNG_REG_BANK_SIZE 0x00000084 ++#define CSR_PHY_BANK_SIZE 0x000071c0 ++#define CSR_RF_BANK_SIZE 0x000000b0 ++#define MMU_REG_BANK_SIZE 0x000000c0 ++#define ADR_BRG_SW_RST (SYS_REG_BASE+0x00000000) ++#define ADR_BOOT (SYS_REG_BASE+0x00000004) ++#define ADR_CHIP_ID_0 (SYS_REG_BASE+0x00000008) ++#define ADR_CHIP_ID_1 (SYS_REG_BASE+0x0000000c) ++#define ADR_CHIP_ID_2 (SYS_REG_BASE+0x00000010) ++#define ADR_CHIP_ID_3 (SYS_REG_BASE+0x00000014) ++#define ADR_CLOCK_SELECTION (SYS_REG_BASE+0x00000018) ++#define ADR_PLATFORM_CLOCK_ENABLE (SYS_REG_BASE+0x0000001c) ++#define ADR_SYS_CSR_CLOCK_ENABLE (SYS_REG_BASE+0x00000020) ++#define ADR_MCU_DBG_SEL (SYS_REG_BASE+0x00000024) ++#define ADR_MCU_DBG_DATA (SYS_REG_BASE+0x00000028) ++#define ADR_AHB_BRG_STATUS (SYS_REG_BASE+0x0000002c) ++#define ADR_BIST_BIST_CTRL (SYS_REG_BASE+0x00000030) ++#define ADR_BIST_MODE_REG_IN (SYS_REG_BASE+0x00000034) ++#define ADR_BIST_MODE_REG_OUT (SYS_REG_BASE+0x00000038) ++#define ADR_BIST_MONITOR_BUS_LSB (SYS_REG_BASE+0x0000003c) ++#define ADR_BIST_MONITOR_BUS_MSB (SYS_REG_BASE+0x00000040) ++#define ADR_TB_ADR_SEL (SYS_REG_BASE+0x00000044) ++#define ADR_TB_RDATA (SYS_REG_BASE+0x00000048) ++#define ADR_UART_W2B (SYS_REG_BASE+0x0000004c) ++#define ADR_AHB_ILL_ADDR (SYS_REG_BASE+0x00000050) ++#define ADR_AHB_FEN_ADDR (SYS_REG_BASE+0x00000054) ++#define ADR_AHB_ILLFEN_STATUS (SYS_REG_BASE+0x00000058) ++#define ADR_PWM_A (SYS_REG_BASE+0x00000080) ++#define ADR_PWM_B (SYS_REG_BASE+0x00000084) ++#define ADR_HBUSREQ_LOCK (SYS_REG_BASE+0x00000090) ++#define ADR_HBURST_LOCK (SYS_REG_BASE+0x00000094) ++#define ADR_PRESCALER_USTIMER (SYS_REG_BASE+0x000000a0) ++#define ADR_BIST_MODE_REG_IN_MMU (SYS_REG_BASE+0x000000a4) ++#define ADR_BIST_MODE_REG_OUT_MMU (SYS_REG_BASE+0x000000a8) ++#define ADR_BIST_MONITOR_BUS_MMU (SYS_REG_BASE+0x000000ac) ++#define ADR_TEST_MODE (SYS_REG_BASE+0x000000b0) ++#define ADR_BOOT_INFO (WBOOT_REG_BASE+0x00000000) ++#define ADR_SD_INIT_CFG (WBOOT_REG_BASE+0x00000004) ++#define ADR_SPARE_UART_INFO (WBOOT_REG_BASE+0x00000008) ++#define ADR_TU0_MICROSECOND_TIMER (TU0_US_REG_BASE+0x00000000) ++#define ADR_TU0_CURRENT_MICROSECOND_TIME_VALUE (TU0_US_REG_BASE+0x00000004) ++#define ADR_TU0_DUMMY_BIT_0 (TU0_US_REG_BASE+0x00000008) ++#define ADR_TU0_DUMMY_BIT_1 (TU0_US_REG_BASE+0x0000000c) ++#define ADR_TU1_MICROSECOND_TIMER (TU1_US_REG_BASE+0x00000000) ++#define ADR_TU1_CURRENT_MICROSECOND_TIME_VALUE (TU1_US_REG_BASE+0x00000004) ++#define ADR_TU1_DUMMY_BIT_0 (TU1_US_REG_BASE+0x00000008) ++#define ADR_TU1_DUMMY_BIT_1 (TU1_US_REG_BASE+0x0000000c) ++#define ADR_TU2_MICROSECOND_TIMER (TU2_US_REG_BASE+0x00000000) ++#define ADR_TU2_CURRENT_MICROSECOND_TIME_VALUE (TU2_US_REG_BASE+0x00000004) ++#define ADR_TU2_DUMMY_BIT_0 (TU2_US_REG_BASE+0x00000008) ++#define ADR_TU2_DUMMY_BIT_1 (TU2_US_REG_BASE+0x0000000c) ++#define ADR_TU3_MICROSECOND_TIMER (TU3_US_REG_BASE+0x00000000) ++#define ADR_TU3_CURRENT_MICROSECOND_TIME_VALUE (TU3_US_REG_BASE+0x00000004) ++#define ADR_TU3_DUMMY_BIT_0 (TU3_US_REG_BASE+0x00000008) ++#define ADR_TU3_DUMMY_BIT_1 (TU3_US_REG_BASE+0x0000000c) ++#define ADR_TM0_MILISECOND_TIMER (TM0_MS_REG_BASE+0x00000000) ++#define ADR_TM0_CURRENT_MILISECOND_TIME_VALUE (TM0_MS_REG_BASE+0x00000004) ++#define ADR_TM0_DUMMY_BIT_0 (TM0_MS_REG_BASE+0x00000008) ++#define ADR_TM0_DUMMY_BIT_1 (TM0_MS_REG_BASE+0x0000000c) ++#define ADR_TM1_MILISECOND_TIMER (TM1_MS_REG_BASE+0x00000000) ++#define ADR_TM1_CURRENT_MILISECOND_TIME_VALUE (TM1_MS_REG_BASE+0x00000004) ++#define ADR_TM1_DUMMY_BIT_0 (TM1_MS_REG_BASE+0x00000008) ++#define ADR_TM1_DUMMY_BIT_1 (TM1_MS_REG_BASE+0x0000000c) ++#define ADR_TM2_MILISECOND_TIMER (TM2_MS_REG_BASE+0x00000000) ++#define ADR_TM2_CURRENT_MILISECOND_TIME_VALUE (TM2_MS_REG_BASE+0x00000004) ++#define ADR_TM2_DUMMY_BIT_0 (TM2_MS_REG_BASE+0x00000008) ++#define ADR_TM2_DUMMY_BIT_1 (TM2_MS_REG_BASE+0x0000000c) ++#define ADR_TM3_MILISECOND_TIMER (TM3_MS_REG_BASE+0x00000000) ++#define ADR_TM3_CURRENT_MILISECOND_TIME_VALUE (TM3_MS_REG_BASE+0x00000004) ++#define ADR_TM3_DUMMY_BIT_0 (TM3_MS_REG_BASE+0x00000008) ++#define ADR_TM3_DUMMY_BIT_1 (TM3_MS_REG_BASE+0x0000000c) ++#define ADR_MCU_WDOG_REG (MCU_WDT_REG_BASE+0x00000000) ++#define ADR_SYS_WDOG_REG (SYS_WDT_REG_BASE+0x00000000) ++#define ADR_PAD6 (GPIO_REG_BASE+0x00000000) ++#define ADR_PAD7 (GPIO_REG_BASE+0x00000004) ++#define ADR_PAD8 (GPIO_REG_BASE+0x00000008) ++#define ADR_PAD9 (GPIO_REG_BASE+0x0000000c) ++#define ADR_PAD11 (GPIO_REG_BASE+0x00000010) ++#define ADR_PAD15 (GPIO_REG_BASE+0x00000014) ++#define ADR_PAD16 (GPIO_REG_BASE+0x00000018) ++#define ADR_PAD17 (GPIO_REG_BASE+0x0000001c) ++#define ADR_PAD18 (GPIO_REG_BASE+0x00000020) ++#define ADR_PAD19 (GPIO_REG_BASE+0x00000024) ++#define ADR_PAD20 (GPIO_REG_BASE+0x00000028) ++#define ADR_PAD21 (GPIO_REG_BASE+0x0000002c) ++#define ADR_PAD22 (GPIO_REG_BASE+0x00000030) ++#define ADR_PAD24 (GPIO_REG_BASE+0x00000034) ++#define ADR_PAD25 (GPIO_REG_BASE+0x00000038) ++#define ADR_PAD27 (GPIO_REG_BASE+0x0000003c) ++#define ADR_PAD28 (GPIO_REG_BASE+0x00000040) ++#define ADR_PAD29 (GPIO_REG_BASE+0x00000044) ++#define ADR_PAD30 (GPIO_REG_BASE+0x00000048) ++#define ADR_PAD31 (GPIO_REG_BASE+0x0000004c) ++#define ADR_PAD32 (GPIO_REG_BASE+0x00000050) ++#define ADR_PAD33 (GPIO_REG_BASE+0x00000054) ++#define ADR_PAD34 (GPIO_REG_BASE+0x00000058) ++#define ADR_PAD42 (GPIO_REG_BASE+0x0000005c) ++#define ADR_PAD43 (GPIO_REG_BASE+0x00000060) ++#define ADR_PAD44 (GPIO_REG_BASE+0x00000064) ++#define ADR_PAD45 (GPIO_REG_BASE+0x00000068) ++#define ADR_PAD46 (GPIO_REG_BASE+0x0000006c) ++#define ADR_PAD47 (GPIO_REG_BASE+0x00000070) ++#define ADR_PAD48 (GPIO_REG_BASE+0x00000074) ++#define ADR_PAD49 (GPIO_REG_BASE+0x00000078) ++#define ADR_PAD50 (GPIO_REG_BASE+0x0000007c) ++#define ADR_PAD51 (GPIO_REG_BASE+0x00000080) ++#define ADR_PAD52 (GPIO_REG_BASE+0x00000084) ++#define ADR_PAD53 (GPIO_REG_BASE+0x00000088) ++#define ADR_PAD54 (GPIO_REG_BASE+0x0000008c) ++#define ADR_PAD56 (GPIO_REG_BASE+0x00000090) ++#define ADR_PAD57 (GPIO_REG_BASE+0x00000094) ++#define ADR_PAD58 (GPIO_REG_BASE+0x00000098) ++#define ADR_PAD59 (GPIO_REG_BASE+0x0000009c) ++#define ADR_PAD60 (GPIO_REG_BASE+0x000000a0) ++#define ADR_PAD61 (GPIO_REG_BASE+0x000000a4) ++#define ADR_PAD62 (GPIO_REG_BASE+0x000000a8) ++#define ADR_PAD64 (GPIO_REG_BASE+0x000000ac) ++#define ADR_PAD65 (GPIO_REG_BASE+0x000000b0) ++#define ADR_PAD66 (GPIO_REG_BASE+0x000000b4) ++#define ADR_PAD68 (GPIO_REG_BASE+0x000000b8) ++#define ADR_PAD67 (GPIO_REG_BASE+0x000000bc) ++#define ADR_PAD69 (GPIO_REG_BASE+0x000000c0) ++#define ADR_PAD70 (GPIO_REG_BASE+0x000000c4) ++#define ADR_PAD231 (GPIO_REG_BASE+0x000000c8) ++#define ADR_PIN_SEL_0 (GPIO_REG_BASE+0x000000cc) ++#define ADR_PIN_SEL_1 (GPIO_REG_BASE+0x000000d0) ++#define ADR_IO_PORT_REG (SD_REG_BASE+0x00000000) ++#define ADR_INT_MASK_REG (SD_REG_BASE+0x00000004) ++#define ADR_INT_STATUS_REG (SD_REG_BASE+0x00000008) ++#define ADR_FN1_STATUS_REG (SD_REG_BASE+0x0000000c) ++#define ADR_CARD_PKT_STATUS_TEST (SD_REG_BASE+0x00000010) ++#define ADR_SYSTEM_INFORMATION_REG (SD_REG_BASE+0x0000001c) ++#define ADR_CARD_RCA_REG (SD_REG_BASE+0x00000020) ++#define ADR_SDIO_FIFO_WR_THLD_REG (SD_REG_BASE+0x00000024) ++#define ADR_SDIO_FIFO_WR_LIMIT_REG (SD_REG_BASE+0x00000028) ++#define ADR_SDIO_TX_DATA_BATCH_SIZE_REG (SD_REG_BASE+0x0000002c) ++#define ADR_SDIO_THLD_FOR_CMD53RD_REG (SD_REG_BASE+0x00000030) ++#define ADR_SDIO_RX_DATA_BATCH_SIZE_REG (SD_REG_BASE+0x00000034) ++#define ADR_SDIO_LOG_START_END_DATA_REG (SD_REG_BASE+0x00000038) ++#define ADR_SDIO_BYTE_MODE_BATCH_SIZE_REG (SD_REG_BASE+0x00000040) ++#define ADR_SDIO_LAST_CMD_INDEX_CRC_REG (SD_REG_BASE+0x00000044) ++#define ADR_SDIO_LAST_CMD_ARG_REG (SD_REG_BASE+0x00000048) ++#define ADR_SDIO_BUS_STATE_DEBUG_MONITOR (SD_REG_BASE+0x0000004c) ++#define ADR_SDIO_CARD_STATUS_REG (SD_REG_BASE+0x00000050) ++#define ADR_R5_RESP_FLAG_OUT_TIMING (SD_REG_BASE+0x00000054) ++#define ADR_CMD52_DATA_FOR_LAST_TIME (SD_REG_BASE+0x0000005c) ++#define ADR_FN1_DMA_START_ADDR_REG (SD_REG_BASE+0x00000060) ++#define ADR_FN1_INT_CTRL_RESET (SD_REG_BASE+0x00000064) ++#define ADR_IO_REG_PORT_REG (SD_REG_BASE+0x00000070) ++#define ADR_SDIO_FIFO_ERROR_CNT (SD_REG_BASE+0x0000007c) ++#define ADR_SDIO_CRC7_CRC16_ERROR_REG (SD_REG_BASE+0x00000080) ++#define ADR_SDIO_BLOCK_CNT_INFO (SD_REG_BASE+0x00000084) ++#define ADR_RX_DATA_CMD52_ABORT_COUNT (SD_REG_BASE+0x0000008c) ++#define ADR_FIFO_PTR_READ_BLOCK_CNT (SD_REG_BASE+0x00000090) ++#define ADR_TX_TIME_OUT_READ_CTRL (SD_REG_BASE+0x00000094) ++#define ADR_SDIO_TX_ALLOC_REG (SD_REG_BASE+0x00000098) ++#define ADR_SDIO_TX_INFORM (SD_REG_BASE+0x0000009c) ++#define ADR_F1_BLOCK_SIZE_0_REG (SD_REG_BASE+0x000000a0) ++#define ADR_SDIO_COMMAND_LOG_DATA_31_0 (SD_REG_BASE+0x000000b0) ++#define ADR_SDIO_COMMAND_LOG_DATA_63_32 (SD_REG_BASE+0x000000b4) ++#define ADR_SYSTEM_INFORMATION_REGISTER (SD_REG_BASE+0x000000bc) ++#define ADR_CCCR_00H_REG (SD_REG_BASE+0x000000c0) ++#define ADR_CCCR_04H_REG (SD_REG_BASE+0x000000c4) ++#define ADR_CCCR_08H_REG (SD_REG_BASE+0x000000c8) ++#define ADR_CCCR_13H_REG (SD_REG_BASE+0x000000d0) ++#define ADR_FBR_100H_REG (SD_REG_BASE+0x000000e0) ++#define ADR_FBR_109H_REG (SD_REG_BASE+0x000000e8) ++#define ADR_F0_CIS_CONTENT_REG_0 (SD_REG_BASE+0x00000100) ++#define ADR_F0_CIS_CONTENT_REG_1 (SD_REG_BASE+0x00000104) ++#define ADR_F0_CIS_CONTENT_REG_2 (SD_REG_BASE+0x00000108) ++#define ADR_F0_CIS_CONTENT_REG_3 (SD_REG_BASE+0x0000010c) ++#define ADR_F0_CIS_CONTENT_REG_4 (SD_REG_BASE+0x00000110) ++#define ADR_F0_CIS_CONTENT_REG_5 (SD_REG_BASE+0x00000114) ++#define ADR_F0_CIS_CONTENT_REG_6 (SD_REG_BASE+0x00000118) ++#define ADR_F0_CIS_CONTENT_REG_7 (SD_REG_BASE+0x0000011c) ++#define ADR_F0_CIS_CONTENT_REG_8 (SD_REG_BASE+0x00000120) ++#define ADR_F0_CIS_CONTENT_REG_9 (SD_REG_BASE+0x00000124) ++#define ADR_F0_CIS_CONTENT_REG_10 (SD_REG_BASE+0x00000128) ++#define ADR_F0_CIS_CONTENT_REG_11 (SD_REG_BASE+0x0000012c) ++#define ADR_F0_CIS_CONTENT_REG_12 (SD_REG_BASE+0x00000130) ++#define ADR_F0_CIS_CONTENT_REG_13 (SD_REG_BASE+0x00000134) ++#define ADR_F0_CIS_CONTENT_REG_14 (SD_REG_BASE+0x00000138) ++#define ADR_F0_CIS_CONTENT_REG_15 (SD_REG_BASE+0x0000013c) ++#define ADR_F1_CIS_CONTENT_REG_0 (SD_REG_BASE+0x00000140) ++#define ADR_F1_CIS_CONTENT_REG_1 (SD_REG_BASE+0x00000144) ++#define ADR_F1_CIS_CONTENT_REG_2 (SD_REG_BASE+0x00000148) ++#define ADR_F1_CIS_CONTENT_REG_3 (SD_REG_BASE+0x0000014c) ++#define ADR_F1_CIS_CONTENT_REG_4 (SD_REG_BASE+0x00000150) ++#define ADR_F1_CIS_CONTENT_REG_5 (SD_REG_BASE+0x00000154) ++#define ADR_F1_CIS_CONTENT_REG_6 (SD_REG_BASE+0x00000158) ++#define ADR_F1_CIS_CONTENT_REG_7 (SD_REG_BASE+0x0000015c) ++#define ADR_F1_CIS_CONTENT_REG_8 (SD_REG_BASE+0x00000160) ++#define ADR_F1_CIS_CONTENT_REG_9 (SD_REG_BASE+0x00000164) ++#define ADR_F1_CIS_CONTENT_REG_10 (SD_REG_BASE+0x00000168) ++#define ADR_F1_CIS_CONTENT_REG_11 (SD_REG_BASE+0x0000016c) ++#define ADR_F1_CIS_CONTENT_REG_12 (SD_REG_BASE+0x00000170) ++#define ADR_F1_CIS_CONTENT_REG_13 (SD_REG_BASE+0x00000174) ++#define ADR_F1_CIS_CONTENT_REG_14 (SD_REG_BASE+0x00000178) ++#define ADR_F1_CIS_CONTENT_REG_15 (SD_REG_BASE+0x0000017c) ++#define ADR_SPI_MODE (SPI_REG_BASE+0x00000000) ++#define ADR_RX_QUOTA (SPI_REG_BASE+0x00000004) ++#define ADR_CONDITION_NUMBER (SPI_REG_BASE+0x00000008) ++#define ADR_HOST_PATH (SPI_REG_BASE+0x0000000c) ++#define ADR_TX_SEG (SPI_REG_BASE+0x00000010) ++#define ADR_DEBUG_BURST_MODE (SPI_REG_BASE+0x00000014) ++#define ADR_SPI_TO_PHY_PARAM1 (SPI_REG_BASE+0x00000018) ++#define ADR_SPI_TO_PHY_PARAM2 (SPI_REG_BASE+0x0000001c) ++#define ADR_SPI_STS (SPI_REG_BASE+0x00000020) ++#define ADR_TX_ALLOC_SET (SPI_REG_BASE+0x00000024) ++#define ADR_TX_ALLOC (SPI_REG_BASE+0x00000028) ++#define ADR_DBG_CNT (SPI_REG_BASE+0x0000002c) ++#define ADR_DBG_CNT2 (SPI_REG_BASE+0x00000030) ++#define ADR_DBG_CNT3 (SPI_REG_BASE+0x00000034) ++#define ADR_DBG_CNT4 (SPI_REG_BASE+0x00000038) ++#define ADR_INT_TAG (SPI_REG_BASE+0x0000003c) ++#define ADR_I2CM_EN (CSR_I2C_MST_BASE+0x00000000) ++#define ADR_I2CM_DEV_A (CSR_I2C_MST_BASE+0x00000004) ++#define ADR_I2CM_LEN (CSR_I2C_MST_BASE+0x00000008) ++#define ADR_I2CM_WDAT (CSR_I2C_MST_BASE+0x0000000c) ++#define ADR_I2CM_RDAT (CSR_I2C_MST_BASE+0x00000010) ++#define ADR_I2CM_EN_2 (CSR_I2C_MST_BASE+0x00000014) ++#define ADR_UART_DATA (UART_REG_BASE+0x00000000) ++#define ADR_UART_IER (UART_REG_BASE+0x00000004) ++#define ADR_UART_FCR (UART_REG_BASE+0x00000008) ++#define ADR_UART_LCR (UART_REG_BASE+0x0000000c) ++#define ADR_UART_MCR (UART_REG_BASE+0x00000010) ++#define ADR_UART_LSR (UART_REG_BASE+0x00000014) ++#define ADR_UART_MSR (UART_REG_BASE+0x00000018) ++#define ADR_UART_SPR (UART_REG_BASE+0x0000001c) ++#define ADR_UART_RTHR (UART_REG_BASE+0x00000020) ++#define ADR_UART_ISR (UART_REG_BASE+0x00000024) ++#define ADR_DAT_UART_DATA (DAT_UART_REG_BASE+0x00000000) ++#define ADR_DAT_UART_IER (DAT_UART_REG_BASE+0x00000004) ++#define ADR_DAT_UART_FCR (DAT_UART_REG_BASE+0x00000008) ++#define ADR_DAT_UART_LCR (DAT_UART_REG_BASE+0x0000000c) ++#define ADR_DAT_UART_MCR (DAT_UART_REG_BASE+0x00000010) ++#define ADR_DAT_UART_LSR (DAT_UART_REG_BASE+0x00000014) ++#define ADR_DAT_UART_MSR (DAT_UART_REG_BASE+0x00000018) ++#define ADR_DAT_UART_SPR (DAT_UART_REG_BASE+0x0000001c) ++#define ADR_DAT_UART_RTHR (DAT_UART_REG_BASE+0x00000020) ++#define ADR_DAT_UART_ISR (DAT_UART_REG_BASE+0x00000024) ++#define ADR_INT_MASK (INT_REG_BASE+0x00000000) ++#define ADR_INT_MODE (INT_REG_BASE+0x00000004) ++#define ADR_INT_IRQ_STS (INT_REG_BASE+0x00000008) ++#define ADR_INT_FIQ_STS (INT_REG_BASE+0x0000000c) ++#define ADR_INT_IRQ_RAW (INT_REG_BASE+0x00000010) ++#define ADR_INT_FIQ_RAW (INT_REG_BASE+0x00000014) ++#define ADR_INT_PERI_MASK (INT_REG_BASE+0x00000018) ++#define ADR_INT_PERI_STS (INT_REG_BASE+0x0000001c) ++#define ADR_INT_PERI_RAW (INT_REG_BASE+0x00000020) ++#define ADR_INT_GPI_CFG (INT_REG_BASE+0x00000024) ++#define ADR_SYS_INT_FOR_HOST (INT_REG_BASE+0x00000028) ++#define ADR_SPI_IPC (INT_REG_BASE+0x00000034) ++#define ADR_SDIO_IPC (INT_REG_BASE+0x00000038) ++#define ADR_SDIO_MASK (INT_REG_BASE+0x0000003c) ++#define ADR_SDIO_IRQ_STS (INT_REG_BASE+0x00000040) ++#define ADR_SD_PERI_MASK (INT_REG_BASE+0x00000044) ++#define ADR_SD_PERI_STS (INT_REG_BASE+0x00000048) ++#define ADR_DBG_SPI_MODE (DBG_SPI_REG_BASE+0x00000000) ++#define ADR_DBG_RX_QUOTA (DBG_SPI_REG_BASE+0x00000004) ++#define ADR_DBG_CONDITION_NUMBER (DBG_SPI_REG_BASE+0x00000008) ++#define ADR_DBG_HOST_PATH (DBG_SPI_REG_BASE+0x0000000c) ++#define ADR_DBG_TX_SEG (DBG_SPI_REG_BASE+0x00000010) ++#define ADR_DBG_DEBUG_BURST_MODE (DBG_SPI_REG_BASE+0x00000014) ++#define ADR_DBG_SPI_TO_PHY_PARAM1 (DBG_SPI_REG_BASE+0x00000018) ++#define ADR_DBG_SPI_TO_PHY_PARAM2 (DBG_SPI_REG_BASE+0x0000001c) ++#define ADR_DBG_SPI_STS (DBG_SPI_REG_BASE+0x00000020) ++#define ADR_DBG_TX_ALLOC_SET (DBG_SPI_REG_BASE+0x00000024) ++#define ADR_DBG_TX_ALLOC (DBG_SPI_REG_BASE+0x00000028) ++#define ADR_DBG_DBG_CNT (DBG_SPI_REG_BASE+0x0000002c) ++#define ADR_DBG_DBG_CNT2 (DBG_SPI_REG_BASE+0x00000030) ++#define ADR_DBG_DBG_CNT3 (DBG_SPI_REG_BASE+0x00000034) ++#define ADR_DBG_DBG_CNT4 (DBG_SPI_REG_BASE+0x00000038) ++#define ADR_DBG_INT_TAG (DBG_SPI_REG_BASE+0x0000003c) ++#define ADR_BOOT_ADDR (FLASH_SPI_REG_BASE+0x00000000) ++#define ADR_VERIFY_DATA (FLASH_SPI_REG_BASE+0x00000004) ++#define ADR_FLASH_ADDR (FLASH_SPI_REG_BASE+0x00000008) ++#define ADR_SRAM_ADDR (FLASH_SPI_REG_BASE+0x0000000c) ++#define ADR_LEN (FLASH_SPI_REG_BASE+0x00000010) ++#define ADR_SPI_PARAM (FLASH_SPI_REG_BASE+0x00000014) ++#define ADR_SPI_PARAM2 (FLASH_SPI_REG_BASE+0x00000018) ++#define ADR_CHECK_SUM_RESULT (FLASH_SPI_REG_BASE+0x0000001c) ++#define ADR_CHECK_SUM_IN_FILE (FLASH_SPI_REG_BASE+0x00000020) ++#define ADR_COMMAND_LEN (FLASH_SPI_REG_BASE+0x00000024) ++#define ADR_COMMAND_ADDR (FLASH_SPI_REG_BASE+0x00000028) ++#define ADR_DMA_ADR_SRC (DMA_REG_BASE+0x00000000) ++#define ADR_DMA_ADR_DST (DMA_REG_BASE+0x00000004) ++#define ADR_DMA_CTRL (DMA_REG_BASE+0x00000008) ++#define ADR_DMA_INT (DMA_REG_BASE+0x0000000c) ++#define ADR_DMA_FILL_CONST (DMA_REG_BASE+0x00000010) ++#define ADR_PMU_0 (CSR_PMU_BASE+0x00000000) ++#define ADR_PMU_1 (CSR_PMU_BASE+0x00000004) ++#define ADR_PMU_2 (CSR_PMU_BASE+0x00000008) ++#define ADR_PMU_3 (CSR_PMU_BASE+0x0000000c) ++#define ADR_RTC_1 (CSR_RTC_BASE+0x00000000) ++#define ADR_RTC_2 (CSR_RTC_BASE+0x00000004) ++#define ADR_RTC_3W (CSR_RTC_BASE+0x00000008) ++#define ADR_RTC_3R (CSR_RTC_BASE+0x00000008) ++#define ADR_RTC_4 (CSR_RTC_BASE+0x0000000c) ++#define ADR_RTC_RAM (RTC_RAM_BASE+0x00000000) ++#define ADR_D2_DMA_ADR_SRC (D2_DMA_REG_BASE+0x00000000) ++#define ADR_D2_DMA_ADR_DST (D2_DMA_REG_BASE+0x00000004) ++#define ADR_D2_DMA_CTRL (D2_DMA_REG_BASE+0x00000008) ++#define ADR_D2_DMA_INT (D2_DMA_REG_BASE+0x0000000c) ++#define ADR_D2_DMA_FILL_CONST (D2_DMA_REG_BASE+0x00000010) ++#define ADR_CONTROL (HCI_REG_BASE+0x00000000) ++#define ADR_SDIO_WAKE_MODE (HCI_REG_BASE+0x00000004) ++#define ADR_TX_FLOW_0 (HCI_REG_BASE+0x00000008) ++#define ADR_TX_FLOW_1 (HCI_REG_BASE+0x0000000c) ++#define ADR_THREASHOLD (HCI_REG_BASE+0x00000018) ++#define ADR_TXFID_INCREASE (HCI_REG_BASE+0x00000020) ++#define ADR_GLOBAL_SEQUENCE (HCI_REG_BASE+0x00000028) ++#define ADR_HCI_TX_RX_INFO_SIZE (HCI_REG_BASE+0x00000030) ++#define ADR_HCI_TX_INFO_CLEAR (HCI_REG_BASE+0x00000034) ++#define ADR_TX_ETHER_TYPE_0 (HCI_REG_BASE+0x00000050) ++#define ADR_TX_ETHER_TYPE_1 (HCI_REG_BASE+0x00000054) ++#define ADR_RX_ETHER_TYPE_0 (HCI_REG_BASE+0x00000060) ++#define ADR_RX_ETHER_TYPE_1 (HCI_REG_BASE+0x00000064) ++#define ADR_PACKET_COUNTER_INFO_0 (HCI_REG_BASE+0x00000070) ++#define ADR_PACKET_COUNTER_INFO_1 (HCI_REG_BASE+0x00000074) ++#define ADR_PACKET_COUNTER_INFO_2 (HCI_REG_BASE+0x00000078) ++#define ADR_PACKET_COUNTER_INFO_3 (HCI_REG_BASE+0x0000007c) ++#define ADR_PACKET_COUNTER_INFO_4 (HCI_REG_BASE+0x00000080) ++#define ADR_PACKET_COUNTER_INFO_5 (HCI_REG_BASE+0x00000084) ++#define ADR_PACKET_COUNTER_INFO_6 (HCI_REG_BASE+0x00000088) ++#define ADR_PACKET_COUNTER_INFO_7 (HCI_REG_BASE+0x0000008c) ++#define ADR_SDIO_TX_RX_FAIL_COUNTER_0 (HCI_REG_BASE+0x00000090) ++#define ADR_SDIO_TX_RX_FAIL_COUNTER_1 (HCI_REG_BASE+0x00000094) ++#define ADR_HCI_STATE_DEBUG_MODE_0 (HCI_REG_BASE+0x000000a0) ++#define ADR_HCI_STATE_DEBUG_MODE_1 (HCI_REG_BASE+0x000000a4) ++#define ADR_HCI_STATE_DEBUG_MODE_2 (HCI_REG_BASE+0x000000a8) ++#define ADR_HCI_STATE_DEBUG_MODE_3 (HCI_REG_BASE+0x000000ac) ++#define ADR_HCI_STATE_DEBUG_MODE_4 (HCI_REG_BASE+0x000000b0) ++#define ADR_HCI_STATE_DEBUG_MODE_5 (HCI_REG_BASE+0x000000b4) ++#define ADR_HCI_STATE_DEBUG_MODE_6 (HCI_REG_BASE+0x000000b8) ++#define ADR_HCI_STATE_DEBUG_MODE_7 (HCI_REG_BASE+0x000000bc) ++#define ADR_HCI_STATE_DEBUG_MODE_8 (HCI_REG_BASE+0x000000c0) ++#define ADR_HCI_STATE_DEBUG_MODE_9 (HCI_REG_BASE+0x000000c4) ++#define ADR_HCI_STATE_DEBUG_MODE_10 (HCI_REG_BASE+0x000000c8) ++#define ADR_CS_START_ADDR (CO_REG_BASE+0x00000000) ++#define ADR_CS_ADD_LEN (CO_REG_BASE+0x00000004) ++#define ADR_CS_CMD (CO_REG_BASE+0x00000008) ++#define ADR_CS_INI_BUF (CO_REG_BASE+0x0000000c) ++#define ADR_CS_PSEUDO_BUF (CO_REG_BASE+0x00000010) ++#define ADR_CS_CHECK_SUM (CO_REG_BASE+0x00000014) ++#define ADR_RAND_EN (CO_REG_BASE+0x00000018) ++#define ADR_RAND_NUM (CO_REG_BASE+0x0000001c) ++#define ADR_MUL_OP1 (CO_REG_BASE+0x00000060) ++#define ADR_MUL_OP2 (CO_REG_BASE+0x00000064) ++#define ADR_MUL_ANS0 (CO_REG_BASE+0x00000068) ++#define ADR_MUL_ANS1 (CO_REG_BASE+0x0000006c) ++#define ADR_DMA_RDATA (CO_REG_BASE+0x00000070) ++#define ADR_DMA_WDATA (CO_REG_BASE+0x00000074) ++#define ADR_DMA_LEN (CO_REG_BASE+0x00000078) ++#define ADR_DMA_CLR (CO_REG_BASE+0x0000007c) ++#define ADR_NAV_DATA (CO_REG_BASE+0x00000080) ++#define ADR_CO_NAV (CO_REG_BASE+0x00000084) ++#define ADR_SHA_DST_ADDR (CO_REG_BASE+0x000000a0) ++#define ADR_SHA_SRC_ADDR (CO_REG_BASE+0x000000a4) ++#define ADR_SHA_SETTING (CO_REG_BASE+0x000000a8) ++#define ADR_EFUSE_CLK_FREQ (EFS_REG_BASE+0x00000000) ++#define ADR_EFUSE_LDO_TIME (EFS_REG_BASE+0x00000004) ++#define ADR_EFUSE_AHB_RDATA_0 (EFS_REG_BASE+0x00000008) ++#define ADR_EFUSE_WDATA_0 (EFS_REG_BASE+0x00000008) ++#define ADR_EFUSE_AHB_RDATA_1 (EFS_REG_BASE+0x0000000c) ++#define ADR_EFUSE_WDATA_1 (EFS_REG_BASE+0x0000000c) ++#define ADR_EFUSE_AHB_RDATA_2 (EFS_REG_BASE+0x00000010) ++#define ADR_EFUSE_WDATA_2 (EFS_REG_BASE+0x00000010) ++#define ADR_EFUSE_AHB_RDATA_3 (EFS_REG_BASE+0x00000014) ++#define ADR_EFUSE_WDATA_3 (EFS_REG_BASE+0x00000014) ++#define ADR_EFUSE_AHB_RDATA_4 (EFS_REG_BASE+0x00000018) ++#define ADR_EFUSE_WDATA_4 (EFS_REG_BASE+0x00000018) ++#define ADR_EFUSE_AHB_RDATA_5 (EFS_REG_BASE+0x0000001c) ++#define ADR_EFUSE_WDATA_5 (EFS_REG_BASE+0x0000001c) ++#define ADR_EFUSE_AHB_RDATA_6 (EFS_REG_BASE+0x00000020) ++#define ADR_EFUSE_WDATA_6 (EFS_REG_BASE+0x00000020) ++#define ADR_EFUSE_AHB_RDATA_7 (EFS_REG_BASE+0x00000024) ++#define ADR_EFUSE_WDATA_7 (EFS_REG_BASE+0x00000024) ++#define ADR_EFUSE_SPI_RD0_EN (EFS_REG_BASE+0x00000028) ++#define ADR_EFUSE_SPI_RD1_EN (EFS_REG_BASE+0x0000002c) ++#define ADR_EFUSE_SPI_RD2_EN (EFS_REG_BASE+0x00000030) ++#define ADR_EFUSE_SPI_RD3_EN (EFS_REG_BASE+0x00000034) ++#define ADR_EFUSE_SPI_RD4_EN (EFS_REG_BASE+0x00000038) ++#define ADR_EFUSE_SPI_RD5_EN (EFS_REG_BASE+0x0000003c) ++#define ADR_EFUSE_SPI_RD6_EN (EFS_REG_BASE+0x00000040) ++#define ADR_EFUSE_SPI_RD7_EN (EFS_REG_BASE+0x00000044) ++#define ADR_EFUSE_SPI_BUSY (EFS_REG_BASE+0x00000048) ++#define ADR_EFUSE_SPI_RDATA_0 (EFS_REG_BASE+0x0000004c) ++#define ADR_EFUSE_SPI_RDATA_1 (EFS_REG_BASE+0x00000050) ++#define ADR_EFUSE_SPI_RDATA_2 (EFS_REG_BASE+0x00000054) ++#define ADR_EFUSE_SPI_RDATA_3 (EFS_REG_BASE+0x00000058) ++#define ADR_EFUSE_SPI_RDATA_4 (EFS_REG_BASE+0x0000005c) ++#define ADR_EFUSE_SPI_RDATA_5 (EFS_REG_BASE+0x00000060) ++#define ADR_EFUSE_SPI_RDATA_6 (EFS_REG_BASE+0x00000064) ++#define ADR_EFUSE_SPI_RDATA_7 (EFS_REG_BASE+0x00000068) ++#define ADR_SMS4_CFG1 (SMS4_REG_BASE+0x00000000) ++#define ADR_SMS4_CFG2 (SMS4_REG_BASE+0x00000004) ++#define ADR_SMS4_MODE1 (SMS4_REG_BASE+0x00000008) ++#define ADR_SMS4_TRIG (SMS4_REG_BASE+0x00000010) ++#define ADR_SMS4_STATUS1 (SMS4_REG_BASE+0x00000014) ++#define ADR_SMS4_STATUS2 (SMS4_REG_BASE+0x00000018) ++#define ADR_SMS4_DATA_IN0 (SMS4_REG_BASE+0x00000020) ++#define ADR_SMS4_DATA_IN1 (SMS4_REG_BASE+0x00000024) ++#define ADR_SMS4_DATA_IN2 (SMS4_REG_BASE+0x00000028) ++#define ADR_SMS4_DATA_IN3 (SMS4_REG_BASE+0x0000002c) ++#define ADR_SMS4_DATA_OUT0 (SMS4_REG_BASE+0x00000030) ++#define ADR_SMS4_DATA_OUT1 (SMS4_REG_BASE+0x00000034) ++#define ADR_SMS4_DATA_OUT2 (SMS4_REG_BASE+0x00000038) ++#define ADR_SMS4_DATA_OUT3 (SMS4_REG_BASE+0x0000003c) ++#define ADR_SMS4_KEY_0 (SMS4_REG_BASE+0x00000040) ++#define ADR_SMS4_KEY_1 (SMS4_REG_BASE+0x00000044) ++#define ADR_SMS4_KEY_2 (SMS4_REG_BASE+0x00000048) ++#define ADR_SMS4_KEY_3 (SMS4_REG_BASE+0x0000004c) ++#define ADR_SMS4_MODE_IV0 (SMS4_REG_BASE+0x00000050) ++#define ADR_SMS4_MODE_IV1 (SMS4_REG_BASE+0x00000054) ++#define ADR_SMS4_MODE_IV2 (SMS4_REG_BASE+0x00000058) ++#define ADR_SMS4_MODE_IV3 (SMS4_REG_BASE+0x0000005c) ++#define ADR_SMS4_OFB_ENC0 (SMS4_REG_BASE+0x00000060) ++#define ADR_SMS4_OFB_ENC1 (SMS4_REG_BASE+0x00000064) ++#define ADR_SMS4_OFB_ENC2 (SMS4_REG_BASE+0x00000068) ++#define ADR_SMS4_OFB_ENC3 (SMS4_REG_BASE+0x0000006c) ++#define ADR_MRX_MCAST_TB0_0 (MRX_REG_BASE+0x00000000) ++#define ADR_MRX_MCAST_TB0_1 (MRX_REG_BASE+0x00000004) ++#define ADR_MRX_MCAST_MK0_0 (MRX_REG_BASE+0x00000008) ++#define ADR_MRX_MCAST_MK0_1 (MRX_REG_BASE+0x0000000c) ++#define ADR_MRX_MCAST_CTRL0 (MRX_REG_BASE+0x00000010) ++#define ADR_MRX_MCAST_TB1_0 (MRX_REG_BASE+0x00000014) ++#define ADR_MRX_MCAST_TB1_1 (MRX_REG_BASE+0x00000018) ++#define ADR_MRX_MCAST_MK1_0 (MRX_REG_BASE+0x0000001c) ++#define ADR_MRX_MCAST_MK1_1 (MRX_REG_BASE+0x00000020) ++#define ADR_MRX_MCAST_CTRL1 (MRX_REG_BASE+0x00000024) ++#define ADR_MRX_MCAST_TB2_0 (MRX_REG_BASE+0x00000028) ++#define ADR_MRX_MCAST_TB2_1 (MRX_REG_BASE+0x0000002c) ++#define ADR_MRX_MCAST_MK2_0 (MRX_REG_BASE+0x00000030) ++#define ADR_MRX_MCAST_MK2_1 (MRX_REG_BASE+0x00000034) ++#define ADR_MRX_MCAST_CTRL2 (MRX_REG_BASE+0x00000038) ++#define ADR_MRX_MCAST_TB3_0 (MRX_REG_BASE+0x0000003c) ++#define ADR_MRX_MCAST_TB3_1 (MRX_REG_BASE+0x00000040) ++#define ADR_MRX_MCAST_MK3_0 (MRX_REG_BASE+0x00000044) ++#define ADR_MRX_MCAST_MK3_1 (MRX_REG_BASE+0x00000048) ++#define ADR_MRX_MCAST_CTRL3 (MRX_REG_BASE+0x0000004c) ++#define ADR_MRX_PHY_INFO (MRX_REG_BASE+0x00000050) ++#define ADR_MRX_BA_DBG (MRX_REG_BASE+0x00000054) ++#define ADR_MRX_FLT_TB0 (MRX_REG_BASE+0x00000070) ++#define ADR_MRX_FLT_TB1 (MRX_REG_BASE+0x00000074) ++#define ADR_MRX_FLT_TB2 (MRX_REG_BASE+0x00000078) ++#define ADR_MRX_FLT_TB3 (MRX_REG_BASE+0x0000007c) ++#define ADR_MRX_FLT_TB4 (MRX_REG_BASE+0x00000080) ++#define ADR_MRX_FLT_TB5 (MRX_REG_BASE+0x00000084) ++#define ADR_MRX_FLT_TB6 (MRX_REG_BASE+0x00000088) ++#define ADR_MRX_FLT_TB7 (MRX_REG_BASE+0x0000008c) ++#define ADR_MRX_FLT_TB8 (MRX_REG_BASE+0x00000090) ++#define ADR_MRX_FLT_TB9 (MRX_REG_BASE+0x00000094) ++#define ADR_MRX_FLT_TB10 (MRX_REG_BASE+0x00000098) ++#define ADR_MRX_FLT_TB11 (MRX_REG_BASE+0x0000009c) ++#define ADR_MRX_FLT_TB12 (MRX_REG_BASE+0x000000a0) ++#define ADR_MRX_FLT_TB13 (MRX_REG_BASE+0x000000a4) ++#define ADR_MRX_FLT_TB14 (MRX_REG_BASE+0x000000a8) ++#define ADR_MRX_FLT_TB15 (MRX_REG_BASE+0x000000ac) ++#define ADR_MRX_FLT_EN0 (MRX_REG_BASE+0x000000b0) ++#define ADR_MRX_FLT_EN1 (MRX_REG_BASE+0x000000b4) ++#define ADR_MRX_FLT_EN2 (MRX_REG_BASE+0x000000b8) ++#define ADR_MRX_FLT_EN3 (MRX_REG_BASE+0x000000bc) ++#define ADR_MRX_FLT_EN4 (MRX_REG_BASE+0x000000c0) ++#define ADR_MRX_FLT_EN5 (MRX_REG_BASE+0x000000c4) ++#define ADR_MRX_FLT_EN6 (MRX_REG_BASE+0x000000c8) ++#define ADR_MRX_FLT_EN7 (MRX_REG_BASE+0x000000cc) ++#define ADR_MRX_FLT_EN8 (MRX_REG_BASE+0x000000d0) ++#define ADR_MRX_LEN_FLT (MRX_REG_BASE+0x000000d4) ++#define ADR_RX_FLOW_DATA (MRX_REG_BASE+0x000000e0) ++#define ADR_RX_FLOW_MNG (MRX_REG_BASE+0x000000e4) ++#define ADR_RX_FLOW_CTRL (MRX_REG_BASE+0x000000e8) ++#define ADR_RX_TIME_STAMP_CFG (MRX_REG_BASE+0x000000ec) ++#define ADR_DBG_FF_FULL (MRX_REG_BASE+0x000000f0) ++#define ADR_DBG_WFF_FULL (MRX_REG_BASE+0x000000f4) ++#define ADR_DBG_MB_FULL (MRX_REG_BASE+0x000000f8) ++#define ADR_BA_CTRL (MRX_REG_BASE+0x00000100) ++#define ADR_BA_TA_0 (MRX_REG_BASE+0x00000104) ++#define ADR_BA_TA_1 (MRX_REG_BASE+0x00000108) ++#define ADR_BA_TID (MRX_REG_BASE+0x0000010c) ++#define ADR_BA_ST_SEQ (MRX_REG_BASE+0x00000110) ++#define ADR_BA_SB0 (MRX_REG_BASE+0x00000114) ++#define ADR_BA_SB1 (MRX_REG_BASE+0x00000118) ++#define ADR_MRX_WATCH_DOG (MRX_REG_BASE+0x0000011c) ++#define ADR_ACK_GEN_EN (MRX_REG_BASE+0x00000120) ++#define ADR_ACK_GEN_PARA (MRX_REG_BASE+0x00000124) ++#define ADR_ACK_GEN_RA_0 (MRX_REG_BASE+0x00000128) ++#define ADR_ACK_GEN_RA_1 (MRX_REG_BASE+0x0000012c) ++#define ADR_MIB_LEN_FAIL (MRX_REG_BASE+0x00000130) ++#define ADR_TRAP_HW_ID (MRX_REG_BASE+0x00000134) ++#define ADR_ID_IN_USE (MRX_REG_BASE+0x00000138) ++#define ADR_MRX_ERR (MRX_REG_BASE+0x0000013c) ++#define ADR_WSID0_TID0_RX_SEQ (MRX_REG_BASE+0x00000140) ++#define ADR_WSID0_TID1_RX_SEQ (MRX_REG_BASE+0x00000144) ++#define ADR_WSID0_TID2_RX_SEQ (MRX_REG_BASE+0x00000148) ++#define ADR_WSID0_TID3_RX_SEQ (MRX_REG_BASE+0x0000014c) ++#define ADR_WSID0_TID4_RX_SEQ (MRX_REG_BASE+0x00000150) ++#define ADR_WSID0_TID5_RX_SEQ (MRX_REG_BASE+0x00000154) ++#define ADR_WSID0_TID6_RX_SEQ (MRX_REG_BASE+0x00000158) ++#define ADR_WSID0_TID7_RX_SEQ (MRX_REG_BASE+0x0000015c) ++#define ADR_WSID1_TID0_RX_SEQ (MRX_REG_BASE+0x00000170) ++#define ADR_WSID1_TID1_RX_SEQ (MRX_REG_BASE+0x00000174) ++#define ADR_WSID1_TID2_RX_SEQ (MRX_REG_BASE+0x00000178) ++#define ADR_WSID1_TID3_RX_SEQ (MRX_REG_BASE+0x0000017c) ++#define ADR_WSID1_TID4_RX_SEQ (MRX_REG_BASE+0x00000180) ++#define ADR_WSID1_TID5_RX_SEQ (MRX_REG_BASE+0x00000184) ++#define ADR_WSID1_TID6_RX_SEQ (MRX_REG_BASE+0x00000188) ++#define ADR_WSID1_TID7_RX_SEQ (MRX_REG_BASE+0x0000018c) ++#define ADR_HDR_ADDR_SEL (MRX_REG_BASE+0x00000190) ++#define ADR_FRAME_TYPE_CNTR_SET (MRX_REG_BASE+0x00000194) ++#define ADR_PHY_INFO (AMPDU_REG_BASE+0x00000000) ++#define ADR_AMPDU_SIG (AMPDU_REG_BASE+0x00000004) ++#define ADR_MIB_AMPDU (AMPDU_REG_BASE+0x00000008) ++#define ADR_LEN_FLT (AMPDU_REG_BASE+0x0000000c) ++#define ADR_MIB_DELIMITER (AMPDU_REG_BASE+0x00000010) ++#define ADR_MTX_INT_STS (MT_REG_CSR_BASE+0x00000000) ++#define ADR_MTX_INT_EN (MT_REG_CSR_BASE+0x00000004) ++#define ADR_MTX_MISC_EN (MT_REG_CSR_BASE+0x00000008) ++#define ADR_MTX_EDCCA_TOUT (MT_REG_CSR_BASE+0x00000010) ++#define ADR_MTX_BCN_INT_STS (MT_REG_CSR_BASE+0x000000a0) ++#define ADR_MTX_BCN_EN_INT (MT_REG_CSR_BASE+0x000000a4) ++#define ADR_MTX_BCN_EN_MISC (MT_REG_CSR_BASE+0x000000a8) ++#define ADR_MTX_BCN_MISC (MT_REG_CSR_BASE+0x000000ac) ++#define ADR_MTX_BCN_PRD (MT_REG_CSR_BASE+0x000000b0) ++#define ADR_MTX_BCN_TSF_L (MT_REG_CSR_BASE+0x000000b4) ++#define ADR_MTX_BCN_TSF_U (MT_REG_CSR_BASE+0x000000b8) ++#define ADR_MTX_BCN_CFG0 (MT_REG_CSR_BASE+0x000000bc) ++#define ADR_MTX_BCN_CFG1 (MT_REG_CSR_BASE+0x000000c0) ++#define ADR_MTX_STATUS (MT_REG_CSR_BASE+0x000000cc) ++#define ADR_MTX_DBG_CTRL (MT_REG_CSR_BASE+0x000000d0) ++#define ADR_MTX_DBG_DAT0 (MT_REG_CSR_BASE+0x000000d4) ++#define ADR_MTX_DBG_DAT1 (MT_REG_CSR_BASE+0x000000d8) ++#define ADR_MTX_DBG_DAT2 (MT_REG_CSR_BASE+0x000000dc) ++#define ADR_MTX_DUR_TOUT (MT_REG_CSR_BASE+0x000000e0) ++#define ADR_MTX_DUR_IFS (MT_REG_CSR_BASE+0x000000e4) ++#define ADR_MTX_DUR_SIFS_G (MT_REG_CSR_BASE+0x000000e8) ++#define ADR_MTX_DBG_DAT3 (MT_REG_CSR_BASE+0x000000ec) ++#define ADR_MTX_NAV (MT_REG_CSR_BASE+0x000000f0) ++#define ADR_MTX_MIB_WSID0 (MT_REG_CSR_BASE+0x000000f4) ++#define ADR_MTX_MIB_WSID1 (MT_REG_CSR_BASE+0x000000f8) ++#define ADR_MTX_DBG_DAT4 (MT_REG_CSR_BASE+0x000000fc) ++#define ADR_TXQ0_MTX_Q_MISC_EN (TXQ0_MT_Q_REG_CSR_BASE+0x00000000) ++#define ADR_TXQ0_MTX_Q_AIFSN (TXQ0_MT_Q_REG_CSR_BASE+0x00000004) ++#define ADR_TXQ0_MTX_Q_BKF_CNT (TXQ0_MT_Q_REG_CSR_BASE+0x00000008) ++#define ADR_TXQ0_MTX_Q_RC_LIMIT (TXQ0_MT_Q_REG_CSR_BASE+0x0000000c) ++#define ADR_TXQ0_MTX_Q_ID_MAP_L (TXQ0_MT_Q_REG_CSR_BASE+0x00000010) ++#define ADR_TXQ0_MTX_Q_TXOP_CH_THD (TXQ0_MT_Q_REG_CSR_BASE+0x00000014) ++#define ADR_TXQ0_MTX_Q_TXOP_OV_THD (TXQ0_MT_Q_REG_CSR_BASE+0x00000018) ++#define ADR_TXQ1_MTX_Q_MISC_EN (TXQ1_MT_Q_REG_CSR_BASE+0x00000000) ++#define ADR_TXQ1_MTX_Q_AIFSN (TXQ1_MT_Q_REG_CSR_BASE+0x00000004) ++#define ADR_TXQ1_MTX_Q_BKF_CNT (TXQ1_MT_Q_REG_CSR_BASE+0x00000008) ++#define ADR_TXQ1_MTX_Q_RC_LIMIT (TXQ1_MT_Q_REG_CSR_BASE+0x0000000c) ++#define ADR_TXQ1_MTX_Q_ID_MAP_L (TXQ1_MT_Q_REG_CSR_BASE+0x00000010) ++#define ADR_TXQ1_MTX_Q_TXOP_CH_THD (TXQ1_MT_Q_REG_CSR_BASE+0x00000014) ++#define ADR_TXQ1_MTX_Q_TXOP_OV_THD (TXQ1_MT_Q_REG_CSR_BASE+0x00000018) ++#define ADR_TXQ2_MTX_Q_MISC_EN (TXQ2_MT_Q_REG_CSR_BASE+0x00000000) ++#define ADR_TXQ2_MTX_Q_AIFSN (TXQ2_MT_Q_REG_CSR_BASE+0x00000004) ++#define ADR_TXQ2_MTX_Q_BKF_CNT (TXQ2_MT_Q_REG_CSR_BASE+0x00000008) ++#define ADR_TXQ2_MTX_Q_RC_LIMIT (TXQ2_MT_Q_REG_CSR_BASE+0x0000000c) ++#define ADR_TXQ2_MTX_Q_ID_MAP_L (TXQ2_MT_Q_REG_CSR_BASE+0x00000010) ++#define ADR_TXQ2_MTX_Q_TXOP_CH_THD (TXQ2_MT_Q_REG_CSR_BASE+0x00000014) ++#define ADR_TXQ2_MTX_Q_TXOP_OV_THD (TXQ2_MT_Q_REG_CSR_BASE+0x00000018) ++#define ADR_TXQ3_MTX_Q_MISC_EN (TXQ3_MT_Q_REG_CSR_BASE+0x00000000) ++#define ADR_TXQ3_MTX_Q_AIFSN (TXQ3_MT_Q_REG_CSR_BASE+0x00000004) ++#define ADR_TXQ3_MTX_Q_BKF_CNT (TXQ3_MT_Q_REG_CSR_BASE+0x00000008) ++#define ADR_TXQ3_MTX_Q_RC_LIMIT (TXQ3_MT_Q_REG_CSR_BASE+0x0000000c) ++#define ADR_TXQ3_MTX_Q_ID_MAP_L (TXQ3_MT_Q_REG_CSR_BASE+0x00000010) ++#define ADR_TXQ3_MTX_Q_TXOP_CH_THD (TXQ3_MT_Q_REG_CSR_BASE+0x00000014) ++#define ADR_TXQ3_MTX_Q_TXOP_OV_THD (TXQ3_MT_Q_REG_CSR_BASE+0x00000018) ++#define ADR_TXQ4_MTX_Q_MISC_EN (TXQ4_MT_Q_REG_CSR_BASE+0x00000000) ++#define ADR_TXQ4_MTX_Q_AIFSN (TXQ4_MT_Q_REG_CSR_BASE+0x00000004) ++#define ADR_TXQ4_MTX_Q_BKF_CNT (TXQ4_MT_Q_REG_CSR_BASE+0x00000008) ++#define ADR_TXQ4_MTX_Q_RC_LIMIT (TXQ4_MT_Q_REG_CSR_BASE+0x0000000c) ++#define ADR_TXQ4_MTX_Q_ID_MAP_L (TXQ4_MT_Q_REG_CSR_BASE+0x00000010) ++#define ADR_TXQ4_MTX_Q_TXOP_CH_THD (TXQ4_MT_Q_REG_CSR_BASE+0x00000014) ++#define ADR_TXQ4_MTX_Q_TXOP_OV_THD (TXQ4_MT_Q_REG_CSR_BASE+0x00000018) ++#define ADR_WSID0 (HIF_INFO_BASE+0x00000000) ++#define ADR_PEER_MAC0_0 (HIF_INFO_BASE+0x00000004) ++#define ADR_PEER_MAC0_1 (HIF_INFO_BASE+0x00000008) ++#define ADR_TX_ACK_POLICY_0_0 (HIF_INFO_BASE+0x0000000c) ++#define ADR_TX_SEQ_CTRL_0_0 (HIF_INFO_BASE+0x00000010) ++#define ADR_TX_ACK_POLICY_0_1 (HIF_INFO_BASE+0x00000014) ++#define ADR_TX_SEQ_CTRL_0_1 (HIF_INFO_BASE+0x00000018) ++#define ADR_TX_ACK_POLICY_0_2 (HIF_INFO_BASE+0x0000001c) ++#define ADR_TX_SEQ_CTRL_0_2 (HIF_INFO_BASE+0x00000020) ++#define ADR_TX_ACK_POLICY_0_3 (HIF_INFO_BASE+0x00000024) ++#define ADR_TX_SEQ_CTRL_0_3 (HIF_INFO_BASE+0x00000028) ++#define ADR_TX_ACK_POLICY_0_4 (HIF_INFO_BASE+0x0000002c) ++#define ADR_TX_SEQ_CTRL_0_4 (HIF_INFO_BASE+0x00000030) ++#define ADR_TX_ACK_POLICY_0_5 (HIF_INFO_BASE+0x00000034) ++#define ADR_TX_SEQ_CTRL_0_5 (HIF_INFO_BASE+0x00000038) ++#define ADR_TX_ACK_POLICY_0_6 (HIF_INFO_BASE+0x0000003c) ++#define ADR_TX_SEQ_CTRL_0_6 (HIF_INFO_BASE+0x00000040) ++#define ADR_TX_ACK_POLICY_0_7 (HIF_INFO_BASE+0x00000044) ++#define ADR_TX_SEQ_CTRL_0_7 (HIF_INFO_BASE+0x00000048) ++#define ADR_WSID1 (HIF_INFO_BASE+0x00000050) ++#define ADR_PEER_MAC1_0 (HIF_INFO_BASE+0x00000054) ++#define ADR_PEER_MAC1_1 (HIF_INFO_BASE+0x00000058) ++#define ADR_TX_ACK_POLICY_1_0 (HIF_INFO_BASE+0x0000005c) ++#define ADR_TX_SEQ_CTRL_1_0 (HIF_INFO_BASE+0x00000060) ++#define ADR_TX_ACK_POLICY_1_1 (HIF_INFO_BASE+0x00000064) ++#define ADR_TX_SEQ_CTRL_1_1 (HIF_INFO_BASE+0x00000068) ++#define ADR_TX_ACK_POLICY_1_2 (HIF_INFO_BASE+0x0000006c) ++#define ADR_TX_SEQ_CTRL_1_2 (HIF_INFO_BASE+0x00000070) ++#define ADR_TX_ACK_POLICY_1_3 (HIF_INFO_BASE+0x00000074) ++#define ADR_TX_SEQ_CTRL_1_3 (HIF_INFO_BASE+0x00000078) ++#define ADR_TX_ACK_POLICY_1_4 (HIF_INFO_BASE+0x0000007c) ++#define ADR_TX_SEQ_CTRL_1_4 (HIF_INFO_BASE+0x00000080) ++#define ADR_TX_ACK_POLICY_1_5 (HIF_INFO_BASE+0x00000084) ++#define ADR_TX_SEQ_CTRL_1_5 (HIF_INFO_BASE+0x00000088) ++#define ADR_TX_ACK_POLICY_1_6 (HIF_INFO_BASE+0x0000008c) ++#define ADR_TX_SEQ_CTRL_1_6 (HIF_INFO_BASE+0x00000090) ++#define ADR_TX_ACK_POLICY_1_7 (HIF_INFO_BASE+0x00000094) ++#define ADR_TX_SEQ_CTRL_1_7 (HIF_INFO_BASE+0x00000098) ++#define ADR_INFO0 (PHY_RATE_INFO_BASE+0x00000000) ++#define ADR_INFO1 (PHY_RATE_INFO_BASE+0x00000004) ++#define ADR_INFO2 (PHY_RATE_INFO_BASE+0x00000008) ++#define ADR_INFO3 (PHY_RATE_INFO_BASE+0x0000000c) ++#define ADR_INFO4 (PHY_RATE_INFO_BASE+0x00000010) ++#define ADR_INFO5 (PHY_RATE_INFO_BASE+0x00000014) ++#define ADR_INFO6 (PHY_RATE_INFO_BASE+0x00000018) ++#define ADR_INFO7 (PHY_RATE_INFO_BASE+0x0000001c) ++#define ADR_INFO8 (PHY_RATE_INFO_BASE+0x00000020) ++#define ADR_INFO9 (PHY_RATE_INFO_BASE+0x00000024) ++#define ADR_INFO10 (PHY_RATE_INFO_BASE+0x00000028) ++#define ADR_INFO11 (PHY_RATE_INFO_BASE+0x0000002c) ++#define ADR_INFO12 (PHY_RATE_INFO_BASE+0x00000030) ++#define ADR_INFO13 (PHY_RATE_INFO_BASE+0x00000034) ++#define ADR_INFO14 (PHY_RATE_INFO_BASE+0x00000038) ++#define ADR_INFO15 (PHY_RATE_INFO_BASE+0x0000003c) ++#define ADR_INFO16 (PHY_RATE_INFO_BASE+0x00000040) ++#define ADR_INFO17 (PHY_RATE_INFO_BASE+0x00000044) ++#define ADR_INFO18 (PHY_RATE_INFO_BASE+0x00000048) ++#define ADR_INFO19 (PHY_RATE_INFO_BASE+0x0000004c) ++#define ADR_INFO20 (PHY_RATE_INFO_BASE+0x00000050) ++#define ADR_INFO21 (PHY_RATE_INFO_BASE+0x00000054) ++#define ADR_INFO22 (PHY_RATE_INFO_BASE+0x00000058) ++#define ADR_INFO23 (PHY_RATE_INFO_BASE+0x0000005c) ++#define ADR_INFO24 (PHY_RATE_INFO_BASE+0x00000060) ++#define ADR_INFO25 (PHY_RATE_INFO_BASE+0x00000064) ++#define ADR_INFO26 (PHY_RATE_INFO_BASE+0x00000068) ++#define ADR_INFO27 (PHY_RATE_INFO_BASE+0x0000006c) ++#define ADR_INFO28 (PHY_RATE_INFO_BASE+0x00000070) ++#define ADR_INFO29 (PHY_RATE_INFO_BASE+0x00000074) ++#define ADR_INFO30 (PHY_RATE_INFO_BASE+0x00000078) ++#define ADR_INFO31 (PHY_RATE_INFO_BASE+0x0000007c) ++#define ADR_INFO32 (PHY_RATE_INFO_BASE+0x00000080) ++#define ADR_INFO33 (PHY_RATE_INFO_BASE+0x00000084) ++#define ADR_INFO34 (PHY_RATE_INFO_BASE+0x00000088) ++#define ADR_INFO35 (PHY_RATE_INFO_BASE+0x0000008c) ++#define ADR_INFO36 (PHY_RATE_INFO_BASE+0x00000090) ++#define ADR_INFO37 (PHY_RATE_INFO_BASE+0x00000094) ++#define ADR_INFO38 (PHY_RATE_INFO_BASE+0x00000098) ++#define ADR_INFO_MASK (PHY_RATE_INFO_BASE+0x0000009c) ++#define ADR_INFO_RATE_OFFSET (PHY_RATE_INFO_BASE+0x000000a0) ++#define ADR_INFO_IDX_ADDR (PHY_RATE_INFO_BASE+0x000000a4) ++#define ADR_INFO_LEN_ADDR (PHY_RATE_INFO_BASE+0x000000a8) ++#define ADR_IC_TIME_TAG_0 (PHY_RATE_INFO_BASE+0x000000ac) ++#define ADR_IC_TIME_TAG_1 (PHY_RATE_INFO_BASE+0x000000b0) ++#define ADR_PACKET_ID_ALLOCATION_PRIORITY (PHY_RATE_INFO_BASE+0x000000b4) ++#define ADR_MAC_MODE (MAC_GLB_SET_BASE+0x00000000) ++#define ADR_ALL_SOFTWARE_RESET (MAC_GLB_SET_BASE+0x00000004) ++#define ADR_ENG_SOFTWARE_RESET (MAC_GLB_SET_BASE+0x00000008) ++#define ADR_CSR_SOFTWARE_RESET (MAC_GLB_SET_BASE+0x0000000c) ++#define ADR_MAC_CLOCK_ENABLE (MAC_GLB_SET_BASE+0x00000010) ++#define ADR_MAC_ENGINE_CLOCK_ENABLE (MAC_GLB_SET_BASE+0x00000014) ++#define ADR_MAC_CSR_CLOCK_ENABLE (MAC_GLB_SET_BASE+0x00000018) ++#define ADR_GLBLE_SET (MAC_GLB_SET_BASE+0x0000001c) ++#define ADR_REASON_TRAP0 (MAC_GLB_SET_BASE+0x00000020) ++#define ADR_REASON_TRAP1 (MAC_GLB_SET_BASE+0x00000024) ++#define ADR_BSSID_0 (MAC_GLB_SET_BASE+0x00000028) ++#define ADR_BSSID_1 (MAC_GLB_SET_BASE+0x0000002c) ++#define ADR_SCRT_STATE (MAC_GLB_SET_BASE+0x0000002c) ++#define ADR_STA_MAC_0 (MAC_GLB_SET_BASE+0x00000030) ++#define ADR_STA_MAC_1 (MAC_GLB_SET_BASE+0x00000034) ++#define ADR_SCRT_SET (MAC_GLB_SET_BASE+0x00000038) ++#define ADR_BTCX0 (BTCX_REG_BASE+0x00000000) ++#define ADR_BTCX1 (BTCX_REG_BASE+0x00000004) ++#define ADR_SWITCH_CTL (BTCX_REG_BASE+0x00000008) ++#define ADR_MIB_EN (MIB_REG_BASE+0x00000000) ++#define ADR_MTX_WSID0_SUCC (MIB_REG_BASE+0x00000118) ++#define ADR_MTX_WSID0_FRM (MIB_REG_BASE+0x00000128) ++#define ADR_MTX_WSID0_RETRY (MIB_REG_BASE+0x00000138) ++#define ADR_MTX_WSID0_TOTAL (MIB_REG_BASE+0x00000148) ++#define ADR_MTX_GROUP (MIB_REG_BASE+0x0000016c) ++#define ADR_MTX_FAIL (MIB_REG_BASE+0x00000170) ++#define ADR_MTX_RETRY (MIB_REG_BASE+0x00000174) ++#define ADR_MTX_MULTI_RETRY (MIB_REG_BASE+0x00000178) ++#define ADR_MTX_RTS_SUCCESS (MIB_REG_BASE+0x0000017c) ++#define ADR_MTX_RTS_FAIL (MIB_REG_BASE+0x00000180) ++#define ADR_MTX_ACK_FAIL (MIB_REG_BASE+0x00000184) ++#define ADR_MTX_FRM (MIB_REG_BASE+0x00000188) ++#define ADR_MTX_ACK_TX (MIB_REG_BASE+0x0000018c) ++#define ADR_MTX_CTS_TX (MIB_REG_BASE+0x00000190) ++#define ADR_MRX_DUP_FRM (MIB_REG_BASE+0x00000194) ++#define ADR_MRX_FRG_FRM (MIB_REG_BASE+0x00000198) ++#define ADR_MRX_GROUP_FRM (MIB_REG_BASE+0x0000019c) ++#define ADR_MRX_FCS_ERR (MIB_REG_BASE+0x000001a0) ++#define ADR_MRX_FCS_SUCC (MIB_REG_BASE+0x000001a4) ++#define ADR_MRX_MISS (MIB_REG_BASE+0x000001a8) ++#define ADR_MRX_ALC_FAIL (MIB_REG_BASE+0x000001ac) ++#define ADR_MRX_DAT_NTF (MIB_REG_BASE+0x000001b0) ++#define ADR_MRX_RTS_NTF (MIB_REG_BASE+0x000001b4) ++#define ADR_MRX_CTS_NTF (MIB_REG_BASE+0x000001b8) ++#define ADR_MRX_ACK_NTF (MIB_REG_BASE+0x000001bc) ++#define ADR_MRX_BA_NTF (MIB_REG_BASE+0x000001c0) ++#define ADR_MRX_DATA_NTF (MIB_REG_BASE+0x000001c4) ++#define ADR_MRX_MNG_NTF (MIB_REG_BASE+0x000001c8) ++#define ADR_MRX_DAT_CRC_NTF (MIB_REG_BASE+0x000001cc) ++#define ADR_MRX_BAR_NTF (MIB_REG_BASE+0x000001d0) ++#define ADR_MRX_MB_MISS (MIB_REG_BASE+0x000001d4) ++#define ADR_MRX_NIDLE_MISS (MIB_REG_BASE+0x000001d8) ++#define ADR_MRX_CSR_NTF (MIB_REG_BASE+0x000001dc) ++#define ADR_DBG_Q0_FRM_SUCCESS (MIB_REG_BASE+0x00000218) ++#define ADR_DBG_Q0_FRM_FAIL (MIB_REG_BASE+0x0000021c) ++#define ADR_DBG_Q0_ACK_SUCCESS (MIB_REG_BASE+0x00000220) ++#define ADR_DBG_Q0_ACK_FAIL (MIB_REG_BASE+0x00000224) ++#define ADR_DBG_Q1_FRM_SUCCESS (MIB_REG_BASE+0x00000268) ++#define ADR_DBG_Q1_FRM_FAIL (MIB_REG_BASE+0x0000026c) ++#define ADR_DBG_Q1_ACK_SUCCESS (MIB_REG_BASE+0x00000270) ++#define ADR_DBG_Q1_ACK_FAIL (MIB_REG_BASE+0x00000274) ++#define ADR_DBG_Q2_FRM_SUCCESS (MIB_REG_BASE+0x00000318) ++#define ADR_DBG_Q2_FRM_FAIL (MIB_REG_BASE+0x0000031c) ++#define ADR_DBG_Q2_ACK_SUCCESS (MIB_REG_BASE+0x00000320) ++#define ADR_DBG_Q2_ACK_FAIL (MIB_REG_BASE+0x00000324) ++#define ADR_DBG_Q3_FRM_SUCCESS (MIB_REG_BASE+0x00000368) ++#define ADR_DBG_Q3_FRM_FAIL (MIB_REG_BASE+0x0000036c) ++#define ADR_DBG_Q3_ACK_SUCCESS (MIB_REG_BASE+0x00000370) ++#define ADR_DBG_Q3_ACK_FAIL (MIB_REG_BASE+0x00000374) ++#define ADR_MIB_SCRT_TKIP0 (MIB_REG_BASE+0x00000418) ++#define ADR_MIB_SCRT_TKIP1 (MIB_REG_BASE+0x0000041c) ++#define ADR_MIB_SCRT_TKIP2 (MIB_REG_BASE+0x00000420) ++#define ADR_MIB_SCRT_CCMP0 (MIB_REG_BASE+0x00000424) ++#define ADR_MIB_SCRT_CCMP1 (MIB_REG_BASE+0x00000428) ++#define ADR_DBG_LEN_CRC_FAIL (MIB_REG_BASE+0x00000468) ++#define ADR_DBG_LEN_ALC_FAIL (MIB_REG_BASE+0x0000046c) ++#define ADR_DBG_AMPDU_PASS (MIB_REG_BASE+0x00000470) ++#define ADR_DBG_AMPDU_FAIL (MIB_REG_BASE+0x00000474) ++#define ADR_ID_ALC_FAIL1 (MIB_REG_BASE+0x00000478) ++#define ADR_ID_ALC_FAIL2 (MIB_REG_BASE+0x0000047c) ++#define ADR_CBR_HARD_WIRE_PIN_REGISTER (CBR_A_REG_BASE+0x00110000) ++#define ADR_CBR_MANUAL_ENABLE_REGISTER (CBR_A_REG_BASE+0x00110004) ++#define ADR_CBR_LDO_REGISTER (CBR_A_REG_BASE+0x00110008) ++#define ADR_CBR_ABB_REGISTER_1 (CBR_A_REG_BASE+0x0011000c) ++#define ADR_CBR_ABB_REGISTER_2 (CBR_A_REG_BASE+0x00110010) ++#define ADR_CBR_TX_FE_REGISTER (CBR_A_REG_BASE+0x00110014) ++#define ADR_CBR_RX_FE_REGISTER_1 (CBR_A_REG_BASE+0x00110018) ++#define ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1 (CBR_A_REG_BASE+0x0011001c) ++#define ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2 (CBR_A_REG_BASE+0x00110020) ++#define ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3 (CBR_A_REG_BASE+0x00110024) ++#define ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4 (CBR_A_REG_BASE+0x00110028) ++#define ADR_CBR_RX_FSM_REGISTER (CBR_A_REG_BASE+0x0011002c) ++#define ADR_CBR_RX_ADC_REGISTER (CBR_A_REG_BASE+0x00110030) ++#define ADR_CBR_TX_DAC_REGISTER (CBR_A_REG_BASE+0x00110034) ++#define ADR_CBR_SX_ENABLE_RGISTER (CBR_A_REG_BASE+0x00110038) ++#define ADR_CBR_SYN_RGISTER_1 (CBR_A_REG_BASE+0x0011003c) ++#define ADR_CBR_SYN_RGISTER_2 (CBR_A_REG_BASE+0x00110040) ++#define ADR_CBR_SYN_PFD_CHP (CBR_A_REG_BASE+0x00110044) ++#define ADR_CBR_SYN_VCO_LOBF (CBR_A_REG_BASE+0x00110048) ++#define ADR_CBR_SYN_DIV_SDM_XOSC (CBR_A_REG_BASE+0x0011004c) ++#define ADR_CBR_SYN_LCK1 (CBR_A_REG_BASE+0x00110050) ++#define ADR_CBR_SYN_LCK2 (CBR_A_REG_BASE+0x00110054) ++#define ADR_CBR_DPLL_VCO_REGISTER (CBR_A_REG_BASE+0x00110058) ++#define ADR_CBR_DPLL_CP_PFD_REGISTER (CBR_A_REG_BASE+0x0011005c) ++#define ADR_CBR_DPLL_DIVIDER_REGISTER (CBR_A_REG_BASE+0x00110060) ++#define ADR_CBR_DCOC_IDAC_REGISTER1 (CBR_A_REG_BASE+0x00110064) ++#define ADR_CBR_DCOC_IDAC_REGISTER2 (CBR_A_REG_BASE+0x00110068) ++#define ADR_CBR_DCOC_IDAC_REGISTER3 (CBR_A_REG_BASE+0x0011006c) ++#define ADR_CBR_DCOC_IDAC_REGISTER4 (CBR_A_REG_BASE+0x00110070) ++#define ADR_CBR_DCOC_IDAC_REGISTER5 (CBR_A_REG_BASE+0x00110074) ++#define ADR_CBR_DCOC_IDAC_REGISTER6 (CBR_A_REG_BASE+0x00110078) ++#define ADR_CBR_DCOC_IDAC_REGISTER7 (CBR_A_REG_BASE+0x0011007c) ++#define ADR_CBR_DCOC_IDAC_REGISTER8 (CBR_A_REG_BASE+0x00110080) ++#define ADR_CBR_RCAL_REGISTER (CBR_A_REG_BASE+0x00110084) ++#define ADR_CBR_MANUAL_REGISTER (CBR_A_REG_BASE+0x00110088) ++#define ADR_CBR_TRX_DUMMY_REGISTER (CBR_A_REG_BASE+0x0011008c) ++#define ADR_CBR_SX_DUMMY_REGISTER (CBR_A_REG_BASE+0x00110090) ++#define ADR_CBR_READ_ONLY_FLAGS_1 (CBR_A_REG_BASE+0x00110094) ++#define ADR_CBR_READ_ONLY_FLAGS_2 (CBR_A_REG_BASE+0x00110098) ++#define ADR_CBR_RG_PKT_GEN_0 (CBR_A_REG_BASE+0x00120080) ++#define ADR_CBR_RG_PKT_GEN_1 (CBR_A_REG_BASE+0x00120084) ++#define ADR_CBR_RG_PKT_GEN_2 (CBR_A_REG_BASE+0x00120088) ++#define ADR_CBR_RG_INTEGRATION (CBR_A_REG_BASE+0x00120090) ++#define ADR_CBR_RG_PKT_GEN_TXCNT (CBR_A_REG_BASE+0x00120094) ++#define ADR_CBR_PATTERN_GEN (CBR_A_REG_BASE+0x001203f8) ++#define ADR_MB_CPU_INT (MB_REG_BASE+0x00000004) ++#define ADR_CPU_ID_TB0 (MB_REG_BASE+0x00000008) ++#define ADR_CPU_ID_TB1 (MB_REG_BASE+0x0000000c) ++#define ADR_CH0_TRIG_1 (MB_REG_BASE+0x00000010) ++#define ADR_CH0_TRIG_0 (MB_REG_BASE+0x00000010) ++#define ADR_CH0_PRI_TRIG (MB_REG_BASE+0x00000014) ++#define ADR_MCU_STATUS (MB_REG_BASE+0x00000018) ++#define ADR_RD_IN_FFCNT1 (MB_REG_BASE+0x0000001c) ++#define ADR_RD_IN_FFCNT2 (MB_REG_BASE+0x00000020) ++#define ADR_RD_FFIN_FULL (MB_REG_BASE+0x00000024) ++#define ADR_MBOX_HALT_CFG (MB_REG_BASE+0x0000002c) ++#define ADR_MB_DBG_CFG1 (MB_REG_BASE+0x00000030) ++#define ADR_MB_DBG_CFG2 (MB_REG_BASE+0x00000034) ++#define ADR_MB_DBG_CFG3 (MB_REG_BASE+0x00000038) ++#define ADR_MB_DBG_CFG4 (MB_REG_BASE+0x0000003c) ++#define ADR_MB_OUT_QUEUE_CFG (MB_REG_BASE+0x00000040) ++#define ADR_MB_OUT_QUEUE_FLUSH (MB_REG_BASE+0x00000044) ++#define ADR_RD_FFOUT_CNT1 (MB_REG_BASE+0x00000048) ++#define ADR_RD_FFOUT_CNT2 (MB_REG_BASE+0x0000004c) ++#define ADR_RD_FFOUT_CNT3 (MB_REG_BASE+0x00000050) ++#define ADR_RD_FFOUT_FULL (MB_REG_BASE+0x00000054) ++#define ADR_MB_THRESHOLD6 (MB_REG_BASE+0x0000006c) ++#define ADR_MB_THRESHOLD7 (MB_REG_BASE+0x00000070) ++#define ADR_MB_THRESHOLD8 (MB_REG_BASE+0x00000074) ++#define ADR_MB_THRESHOLD9 (MB_REG_BASE+0x00000078) ++#define ADR_MB_THRESHOLD10 (MB_REG_BASE+0x0000007c) ++#define ADR_MB_TRASH_CFG (MB_REG_BASE+0x00000080) ++#define ADR_MB_IN_FF_FLUSH (MB_REG_BASE+0x00000084) ++#define ADR_CPU_ID_TB2 (MB_REG_BASE+0x00000088) ++#define ADR_CPU_ID_TB3 (MB_REG_BASE+0x0000008c) ++#define ADR_PHY_IQ_LOG_CFG0 (MB_REG_BASE+0x00000090) ++#define ADR_PHY_IQ_LOG_CFG1 (MB_REG_BASE+0x00000094) ++#define ADR_PHY_IQ_LOG_LEN (MB_REG_BASE+0x00000098) ++#define ADR_PHY_IQ_LOG_PTR (MB_REG_BASE+0x0000009c) ++#define ADR_WR_ALC (ID_MNG_REG_BASE+0x00000000) ++#define ADR_GETID (ID_MNG_REG_BASE+0x00000000) ++#define ADR_CH_STA_PRI (ID_MNG_REG_BASE+0x00000004) ++#define ADR_RD_ID0 (ID_MNG_REG_BASE+0x00000008) ++#define ADR_RD_ID1 (ID_MNG_REG_BASE+0x0000000c) ++#define ADR_IMD_CFG (ID_MNG_REG_BASE+0x00000010) ++#define ADR_IMD_STA (ID_MNG_REG_BASE+0x00000014) ++#define ADR_ALC_STA (ID_MNG_REG_BASE+0x00000018) ++#define ADR_TRX_ID_COUNT (ID_MNG_REG_BASE+0x0000001c) ++#define ADR_TRX_ID_THRESHOLD (ID_MNG_REG_BASE+0x00000020) ++#define ADR_TX_ID0 (ID_MNG_REG_BASE+0x00000024) ++#define ADR_TX_ID1 (ID_MNG_REG_BASE+0x00000028) ++#define ADR_RX_ID0 (ID_MNG_REG_BASE+0x0000002c) ++#define ADR_RX_ID1 (ID_MNG_REG_BASE+0x00000030) ++#define ADR_RTN_STA (ID_MNG_REG_BASE+0x00000034) ++#define ADR_ID_LEN_THREADSHOLD1 (ID_MNG_REG_BASE+0x00000038) ++#define ADR_ID_LEN_THREADSHOLD2 (ID_MNG_REG_BASE+0x0000003c) ++#define ADR_CH_ARB_PRI (ID_MNG_REG_BASE+0x00000040) ++#define ADR_TX_ID_REMAIN_STATUS (ID_MNG_REG_BASE+0x00000044) ++#define ADR_ID_INFO_STA (ID_MNG_REG_BASE+0x00000048) ++#define ADR_TX_LIMIT_INTR (ID_MNG_REG_BASE+0x0000004c) ++#define ADR_TX_ID_ALL_INFO (ID_MNG_REG_BASE+0x00000050) ++#define ADR_RD_ID2 (ID_MNG_REG_BASE+0x00000054) ++#define ADR_RD_ID3 (ID_MNG_REG_BASE+0x00000058) ++#define ADR_TX_ID2 (ID_MNG_REG_BASE+0x0000005c) ++#define ADR_TX_ID3 (ID_MNG_REG_BASE+0x00000060) ++#define ADR_RX_ID2 (ID_MNG_REG_BASE+0x00000064) ++#define ADR_RX_ID3 (ID_MNG_REG_BASE+0x00000068) ++#define ADR_TX_ID_ALL_INFO2 (ID_MNG_REG_BASE+0x0000006c) ++#define ADR_TX_ID_ALL_INFO_A (ID_MNG_REG_BASE+0x00000070) ++#define ADR_TX_ID_ALL_INFO_B (ID_MNG_REG_BASE+0x00000074) ++#define ADR_TX_ID_REMAIN_STATUS2 (ID_MNG_REG_BASE+0x00000078) ++#define ADR_ALC_ID_INFO (ID_MNG_REG_BASE+0x0000007c) ++#define ADR_ALC_ID_INF1 (ID_MNG_REG_BASE+0x00000080) ++#define ADR_PHY_EN_0 (CSR_PHY_BASE+0x00000000) ++#define ADR_PHY_EN_1 (CSR_PHY_BASE+0x00000004) ++#define ADR_SVN_VERSION_REG (CSR_PHY_BASE+0x00000008) ++#define ADR_PHY_PKT_GEN_0 (CSR_PHY_BASE+0x0000000c) ++#define ADR_PHY_PKT_GEN_1 (CSR_PHY_BASE+0x00000010) ++#define ADR_PHY_PKT_GEN_2 (CSR_PHY_BASE+0x00000014) ++#define ADR_PHY_PKT_GEN_3 (CSR_PHY_BASE+0x00000018) ++#define ADR_PHY_PKT_GEN_4 (CSR_PHY_BASE+0x0000001c) ++#define ADR_PHY_REG_00 (CSR_PHY_BASE+0x00000020) ++#define ADR_PHY_REG_01 (CSR_PHY_BASE+0x0000002c) ++#define ADR_PHY_REG_02_AGC (CSR_PHY_BASE+0x00000030) ++#define ADR_PHY_REG_03_AGC (CSR_PHY_BASE+0x00000034) ++#define ADR_PHY_REG_04_AGC (CSR_PHY_BASE+0x00000038) ++#define ADR_PHY_REG_05_AGC (CSR_PHY_BASE+0x0000003c) ++#define ADR_PHY_REG_06_11B_DAGC (CSR_PHY_BASE+0x00000040) ++#define ADR_PHY_REG_07_11B_DAGC (CSR_PHY_BASE+0x00000044) ++#define ADR_PHY_REG_08_11GN_DAGC (CSR_PHY_BASE+0x00000048) ++#define ADR_PHY_REG_09_11GN_DAGC (CSR_PHY_BASE+0x0000004c) ++#define ADR_PHY_READ_REG_00_DIG_PWR (CSR_PHY_BASE+0x00000050) ++#define ADR_PHY_READ_REG_01_RF_GAIN_PWR (CSR_PHY_BASE+0x00000054) ++#define ADR_PHY_READ_REG_02_RF_GAIN_PWR (CSR_PHY_BASE+0x00000058) ++#define ADR_PHY_READ_REG_03_RF_GAIN_PWR (CSR_PHY_BASE+0x0000005c) ++#define ADR_PHY_REG_10_TX_DES (CSR_PHY_BASE+0x00000060) ++#define ADR_PHY_REG_11_TX_DES (CSR_PHY_BASE+0x00000064) ++#define ADR_PHY_REG_12_TX_DES (CSR_PHY_BASE+0x00000068) ++#define ADR_PHY_REG_13_RX_DES (CSR_PHY_BASE+0x0000006c) ++#define ADR_PHY_REG_14_RX_DES (CSR_PHY_BASE+0x00000070) ++#define ADR_PHY_REG_15_RX_DES (CSR_PHY_BASE+0x00000074) ++#define ADR_PHY_REG_16_TX_DES_EXCP (CSR_PHY_BASE+0x00000078) ++#define ADR_PHY_REG_17_TX_DES_EXCP (CSR_PHY_BASE+0x0000007c) ++#define ADR_PHY_REG_18_RSSI_SNR (CSR_PHY_BASE+0x00000080) ++#define ADR_PHY_REG_19_DAC_MANUAL (CSR_PHY_BASE+0x00000084) ++#define ADR_PHY_REG_20_MRX_CNT (CSR_PHY_BASE+0x00000088) ++#define ADR_PHY_REG_21_TRX_RAMP (CSR_PHY_BASE+0x00000094) ++#define ADR_PHY_REG_22_TRX_RAMP (CSR_PHY_BASE+0x00000098) ++#define ADR_PHY_REG_23_ANT (CSR_PHY_BASE+0x0000009c) ++#define ADR_PHY_REG_24_MTX_LEN_CNT (CSR_PHY_BASE+0x000000a0) ++#define ADR_PHY_REG_25_MTX_LEN_CNT (CSR_PHY_BASE+0x000000a4) ++#define ADR_PHY_REG_26_MRX_LEN_CNT (CSR_PHY_BASE+0x000000a8) ++#define ADR_PHY_REG_27_MRX_LEN_CNT (CSR_PHY_BASE+0x000000ac) ++#define ADR_PHY_READ_REG_04 (CSR_PHY_BASE+0x000000b0) ++#define ADR_PHY_READ_REG_05 (CSR_PHY_BASE+0x000000b4) ++#define ADR_PHY_REG_28_BIST (CSR_PHY_BASE+0x000000b8) ++#define ADR_PHY_READ_REG_06_BIST (CSR_PHY_BASE+0x000000d8) ++#define ADR_PHY_READ_REG_07_BIST (CSR_PHY_BASE+0x000000f0) ++#define ADR_PHY_REG_29_MTRX_MAC (CSR_PHY_BASE+0x000000fc) ++#define ADR_PHY_READ_REG_08_MTRX_MAC (CSR_PHY_BASE+0x00000100) ++#define ADR_PHY_READ_REG_09_MTRX_MAC (CSR_PHY_BASE+0x00000104) ++#define ADR_PHY_REG_30_TX_UP_FIL (CSR_PHY_BASE+0x00000108) ++#define ADR_PHY_REG_31_TX_UP_FIL (CSR_PHY_BASE+0x0000010c) ++#define ADR_PHY_REG_32_TX_UP_FIL (CSR_PHY_BASE+0x00000110) ++#define ADR_PHY_READ_TBUS (CSR_PHY_BASE+0x000003fc) ++#define ADR_TX_11B_FIL_COEF_00 (CSR_PHY_BASE+0x00001000) ++#define ADR_TX_11B_FIL_COEF_01 (CSR_PHY_BASE+0x00001004) ++#define ADR_TX_11B_FIL_COEF_02 (CSR_PHY_BASE+0x00001008) ++#define ADR_TX_11B_FIL_COEF_03 (CSR_PHY_BASE+0x0000100c) ++#define ADR_TX_11B_FIL_COEF_04 (CSR_PHY_BASE+0x00001010) ++#define ADR_TX_11B_FIL_COEF_05 (CSR_PHY_BASE+0x00001014) ++#define ADR_TX_11B_FIL_COEF_06 (CSR_PHY_BASE+0x00001018) ++#define ADR_TX_11B_FIL_COEF_07 (CSR_PHY_BASE+0x0000101c) ++#define ADR_TX_11B_FIL_COEF_08 (CSR_PHY_BASE+0x00001020) ++#define ADR_TX_11B_FIL_COEF_09 (CSR_PHY_BASE+0x00001024) ++#define ADR_TX_11B_FIL_COEF_10 (CSR_PHY_BASE+0x00001028) ++#define ADR_TX_11B_FIL_COEF_11 (CSR_PHY_BASE+0x0000102c) ++#define ADR_TX_11B_FIL_COEF_12 (CSR_PHY_BASE+0x00001030) ++#define ADR_TX_11B_FIL_COEF_13 (CSR_PHY_BASE+0x00001034) ++#define ADR_TX_11B_FIL_COEF_14 (CSR_PHY_BASE+0x00001038) ++#define ADR_TX_11B_FIL_COEF_15 (CSR_PHY_BASE+0x0000103c) ++#define ADR_TX_11B_FIL_COEF_16 (CSR_PHY_BASE+0x00001040) ++#define ADR_TX_11B_FIL_COEF_17 (CSR_PHY_BASE+0x00001044) ++#define ADR_TX_11B_FIL_COEF_18 (CSR_PHY_BASE+0x00001048) ++#define ADR_TX_11B_FIL_COEF_19 (CSR_PHY_BASE+0x0000104c) ++#define ADR_TX_11B_FIL_COEF_20 (CSR_PHY_BASE+0x00001050) ++#define ADR_TX_11B_FIL_COEF_21 (CSR_PHY_BASE+0x00001054) ++#define ADR_TX_11B_FIL_COEF_22 (CSR_PHY_BASE+0x00001058) ++#define ADR_TX_11B_FIL_COEF_23 (CSR_PHY_BASE+0x0000105c) ++#define ADR_TX_11B_FIL_COEF_24 (CSR_PHY_BASE+0x00001060) ++#define ADR_TX_11B_FIL_COEF_25 (CSR_PHY_BASE+0x00001064) ++#define ADR_TX_11B_FIL_COEF_26 (CSR_PHY_BASE+0x00001068) ++#define ADR_TX_11B_FIL_COEF_27 (CSR_PHY_BASE+0x0000106c) ++#define ADR_TX_11B_FIL_COEF_28 (CSR_PHY_BASE+0x00001070) ++#define ADR_TX_11B_FIL_COEF_29 (CSR_PHY_BASE+0x00001074) ++#define ADR_TX_11B_FIL_COEF_30 (CSR_PHY_BASE+0x00001078) ++#define ADR_TX_11B_FIL_COEF_31 (CSR_PHY_BASE+0x0000107c) ++#define ADR_TX_11B_FIL_COEF_32 (CSR_PHY_BASE+0x00001080) ++#define ADR_TX_11B_FIL_COEF_33 (CSR_PHY_BASE+0x00001084) ++#define ADR_TX_11B_FIL_COEF_34 (CSR_PHY_BASE+0x00001088) ++#define ADR_TX_11B_FIL_COEF_35 (CSR_PHY_BASE+0x0000108c) ++#define ADR_TX_11B_FIL_COEF_36 (CSR_PHY_BASE+0x00001090) ++#define ADR_TX_11B_FIL_COEF_37 (CSR_PHY_BASE+0x00001094) ++#define ADR_TX_11B_FIL_COEF_38 (CSR_PHY_BASE+0x00001098) ++#define ADR_TX_11B_FIL_COEF_39 (CSR_PHY_BASE+0x0000109c) ++#define ADR_TX_11B_FIL_COEF_40 (CSR_PHY_BASE+0x000010a0) ++#define ADR_TX_11B_PLCP (CSR_PHY_BASE+0x000010a4) ++#define ADR_TX_11B_RAMP (CSR_PHY_BASE+0x000010b4) ++#define ADR_TX_11B_EN_CNT_RST_N (CSR_PHY_BASE+0x000010d4) ++#define ADR_TX_11B_EN_CNT (CSR_PHY_BASE+0x000010d8) ++#define ADR_TX_11B_PKT_GEN_CNT (CSR_PHY_BASE+0x00001c00) ++#define ADR_RX_11B_DES_DLY (CSR_PHY_BASE+0x00002000) ++#define ADR_RX_11B_CCA_0 (CSR_PHY_BASE+0x00002004) ++#define ADR_RX_11B_CCA_1 (CSR_PHY_BASE+0x00002008) ++#define ADR_RX_11B_TR_KP_KI_0 (CSR_PHY_BASE+0x0000200c) ++#define ADR_RX_11B_TR_KP_KI_1 (CSR_PHY_BASE+0x00002010) ++#define ADR_RX_11B_CE_CNT_THRESHOLD (CSR_PHY_BASE+0x00002014) ++#define ADR_RX_11B_CE_MU_0 (CSR_PHY_BASE+0x00002018) ++#define ADR_RX_11B_CE_MU_1 (CSR_PHY_BASE+0x0000201c) ++#define ADR_RX_11B_EQ_MU_0 (CSR_PHY_BASE+0x00002020) ++#define ADR_RX_11B_EQ_MU_1 (CSR_PHY_BASE+0x00002024) ++#define ADR_RX_11B_EQ_CR_KP_KI (CSR_PHY_BASE+0x00002028) ++#define ADR_RX_11B_LPF_RATE (CSR_PHY_BASE+0x0000202c) ++#define ADR_RX_11B_CIT_CNT_THRESHOLD (CSR_PHY_BASE+0x00002030) ++#define ADR_RX_11B_EQ_CH_MAIN_TAP (CSR_PHY_BASE+0x00002034) ++#define ADR_RX_11B_SEARCH_CNT_TH (CSR_PHY_BASE+0x0000209c) ++#define ADR_RX_11B_CCA_CONTROL (CSR_PHY_BASE+0x000020a0) ++#define ADR_RX_11B_FREQUENCY_OFFSET (CSR_PHY_BASE+0x000023d4) ++#define ADR_RX_11B_SNR_RSSI (CSR_PHY_BASE+0x000023d8) ++#define ADR_RX_11B_SFD_CRC_CNT (CSR_PHY_BASE+0x000023e4) ++#define ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT (CSR_PHY_BASE+0x000023e8) ++#define ADR_RX_11B_PKT_CCA_AND_PKT_CNT (CSR_PHY_BASE+0x000023ec) ++#define ADR_RX_11B_SFD_FILED_0 (CSR_PHY_BASE+0x000023f0) ++#define ADR_RX_11B_SFD_FIELD_1 (CSR_PHY_BASE+0x000023f4) ++#define ADR_RX_11B_PKT_STAT_EN (CSR_PHY_BASE+0x000023f8) ++#define ADR_RX_11B_SOFT_RST (CSR_PHY_BASE+0x000023fc) ++#define ADR_TX_11GN_RAMP (CSR_PHY_BASE+0x000030a4) ++#define ADR_TX_11GN_PLCP (CSR_PHY_BASE+0x000030b8) ++#define ADR_TX_11GN_PKT_GEN_CNT (CSR_PHY_BASE+0x00003c00) ++#define ADR_TX_11GN_PLCP_CRC_ERR_CNT (CSR_PHY_BASE+0x00003c08) ++#define ADR_RX_11GN_DES_DLY (CSR_PHY_BASE+0x00004000) ++#define ADR_RX_11GN_TR_0 (CSR_PHY_BASE+0x00004004) ++#define ADR_RX_11GN_TR_1 (CSR_PHY_BASE+0x00004008) ++#define ADR_RX_11GN_TR_2 (CSR_PHY_BASE+0x0000400c) ++#define ADR_RX_11GN_CCA_0 (CSR_PHY_BASE+0x00004010) ++#define ADR_RX_11GN_CCA_1 (CSR_PHY_BASE+0x00004014) ++#define ADR_RX_11GN_CCA_2 (CSR_PHY_BASE+0x00004018) ++#define ADR_RX_11GN_CCA_FFT_SCALE (CSR_PHY_BASE+0x0000401c) ++#define ADR_RX_11GN_SOFT_DEMAP_0 (CSR_PHY_BASE+0x00004020) ++#define ADR_RX_11GN_SOFT_DEMAP_1 (CSR_PHY_BASE+0x00004024) ++#define ADR_RX_11GN_SOFT_DEMAP_2 (CSR_PHY_BASE+0x00004028) ++#define ADR_RX_11GN_SOFT_DEMAP_3 (CSR_PHY_BASE+0x0000402c) ++#define ADR_RX_11GN_SOFT_DEMAP_4 (CSR_PHY_BASE+0x00004030) ++#define ADR_RX_11GN_SOFT_DEMAP_5 (CSR_PHY_BASE+0x00004034) ++#define ADR_RX_11GN_SYM_BOUND_0 (CSR_PHY_BASE+0x00004038) ++#define ADR_RX_11GN_SYM_BOUND_1 (CSR_PHY_BASE+0x0000409c) ++#define ADR_RX_11GN_CCA_PWR (CSR_PHY_BASE+0x000040c0) ++#define ADR_RX_11GN_CCA_CNT (CSR_PHY_BASE+0x000040c4) ++#define ADR_RX_11GN_CCA_ATCOR_RE_CHECK (CSR_PHY_BASE+0x000040c8) ++#define ADR_RX_11GN_VTB_TB (CSR_PHY_BASE+0x00004130) ++#define ADR_RX_11GN_ERR_UPDATE (CSR_PHY_BASE+0x00004164) ++#define ADR_RX_11GN_SHORT_GI (CSR_PHY_BASE+0x00004180) ++#define ADR_RX_11GN_CHANNEL_UPDATE (CSR_PHY_BASE+0x00004188) ++#define ADR_RX_11GN_PKT_FORMAT_0 (CSR_PHY_BASE+0x00004190) ++#define ADR_RX_11GN_PKT_FORMAT_1 (CSR_PHY_BASE+0x00004194) ++#define ADR_RX_11GN_TX_TIME (CSR_PHY_BASE+0x00004380) ++#define ADR_RX_11GN_STBC_TR_KP_KI (CSR_PHY_BASE+0x00004384) ++#define ADR_RX_11GN_BIST_0 (CSR_PHY_BASE+0x00004388) ++#define ADR_RX_11GN_BIST_1 (CSR_PHY_BASE+0x0000438c) ++#define ADR_RX_11GN_BIST_2 (CSR_PHY_BASE+0x000043c0) ++#define ADR_RX_11GN_BIST_3 (CSR_PHY_BASE+0x000043c4) ++#define ADR_RX_11GN_BIST_4 (CSR_PHY_BASE+0x000043c8) ++#define ADR_RX_11GN_BIST_5 (CSR_PHY_BASE+0x000043cc) ++#define ADR_RX_11GN_SPECTRUM_ANALYZER (CSR_PHY_BASE+0x000043d4) ++#define ADR_RX_11GN_READ_0 (CSR_PHY_BASE+0x000043d8) ++#define ADR_RX_11GN_FREQ_OFFSET (CSR_PHY_BASE+0x000043dc) ++#define ADR_RX_11GN_SIGNAL_FIELD_0 (CSR_PHY_BASE+0x000043e0) ++#define ADR_RX_11GN_SIGNAL_FIELD_1 (CSR_PHY_BASE+0x000043e4) ++#define ADR_RX_11GN_PKT_ERR_CNT (CSR_PHY_BASE+0x000043e8) ++#define ADR_RX_11GN_PKT_CCA_AND_PKT_CNT (CSR_PHY_BASE+0x000043ec) ++#define ADR_RX_11GN_SERVICE_LENGTH_FIELD (CSR_PHY_BASE+0x000043f0) ++#define ADR_RX_11GN_RATE (CSR_PHY_BASE+0x000043f4) ++#define ADR_RX_11GN_STAT_EN (CSR_PHY_BASE+0x000043f8) ++#define ADR_RX_11GN_SOFT_RST (CSR_PHY_BASE+0x000043fc) ++#define ADR_RF_CONTROL_0 (CSR_PHY_BASE+0x00007000) ++#define ADR_RF_CONTROL_1 (CSR_PHY_BASE+0x00007004) ++#define ADR_TX_IQ_CONTROL_0 (CSR_PHY_BASE+0x00007040) ++#define ADR_TX_IQ_CONTROL_1 (CSR_PHY_BASE+0x00007044) ++#define ADR_TX_IQ_CONTROL_2 (CSR_PHY_BASE+0x00007048) ++#define ADR_TX_COMPENSATION_CONTROL (CSR_PHY_BASE+0x0000704c) ++#define ADR_RX_COMPENSATION_CONTROL (CSR_PHY_BASE+0x00007050) ++#define ADR_RX_OBSERVATION_CIRCUIT_0 (CSR_PHY_BASE+0x00007058) ++#define ADR_RX_OBSERVATION_CIRCUIT_1 (CSR_PHY_BASE+0x0000705c) ++#define ADR_RX_OBSERVATION_CIRCUIT_2 (CSR_PHY_BASE+0x00007060) ++#define ADR_RX_OBSERVATION_CIRCUIT_3 (CSR_PHY_BASE+0x00007064) ++#define ADR_RF_IQ_CONTROL_0 (CSR_PHY_BASE+0x0000706c) ++#define ADR_RF_IQ_CONTROL_1 (CSR_PHY_BASE+0x00007070) ++#define ADR_RF_IQ_CONTROL_2 (CSR_PHY_BASE+0x00007074) ++#define ADR_RF_IQ_CONTROL_3 (CSR_PHY_BASE+0x00007078) ++#define ADR_DPD_CONTROL (CSR_PHY_BASE+0x0000711c) ++#define ADR_DPD_GAIN_TABLE_0 (CSR_PHY_BASE+0x00007120) ++#define ADR_DPD_GAIN_TABLE_1 (CSR_PHY_BASE+0x00007124) ++#define ADR_DPD_GAIN_TABLE_2 (CSR_PHY_BASE+0x00007128) ++#define ADR_DPD_GAIN_TABLE_3 (CSR_PHY_BASE+0x00007130) ++#define ADR_DPD_GAIN_TABLE_4 (CSR_PHY_BASE+0x00007134) ++#define ADR_DPD_GAIN_TABLE_5 (CSR_PHY_BASE+0x00007138) ++#define ADR_DPD_GAIN_TABLE_6 (CSR_PHY_BASE+0x0000713c) ++#define ADR_DPD_GAIN_TABLE_7 (CSR_PHY_BASE+0x00007140) ++#define ADR_DPD_GAIN_TABLE_8 (CSR_PHY_BASE+0x00007144) ++#define ADR_DPD_GAIN_TABLE_9 (CSR_PHY_BASE+0x00007148) ++#define ADR_DPD_GAIN_TABLE_A (CSR_PHY_BASE+0x0000714c) ++#define ADR_DPD_GAIN_TABLE_B (CSR_PHY_BASE+0x00007150) ++#define ADR_DPD_GAIN_TABLE_C (CSR_PHY_BASE+0x00007154) ++#define ADR_DPD_PH_TABLE_0 (CSR_PHY_BASE+0x00007170) ++#define ADR_DPD_PH_TABLE_1 (CSR_PHY_BASE+0x00007174) ++#define ADR_DPD_PH_TABLE_2 (CSR_PHY_BASE+0x00007178) ++#define ADR_DPD_PH_TABLE_3 (CSR_PHY_BASE+0x00007180) ++#define ADR_DPD_PH_TABLE_4 (CSR_PHY_BASE+0x00007184) ++#define ADR_DPD_PH_TABLE_5 (CSR_PHY_BASE+0x00007188) ++#define ADR_DPD_PH_TABLE_6 (CSR_PHY_BASE+0x0000718c) ++#define ADR_DPD_PH_TABLE_7 (CSR_PHY_BASE+0x00007190) ++#define ADR_DPD_PH_TABLE_8 (CSR_PHY_BASE+0x00007194) ++#define ADR_DPD_PH_TABLE_9 (CSR_PHY_BASE+0x00007198) ++#define ADR_DPD_PH_TABLE_A (CSR_PHY_BASE+0x0000719c) ++#define ADR_DPD_PH_TABLE_B (CSR_PHY_BASE+0x000071a0) ++#define ADR_DPD_PH_TABLE_C (CSR_PHY_BASE+0x000071a4) ++#define ADR_DPD_GAIN_ESTIMATION_0 (CSR_PHY_BASE+0x000071b0) ++#define ADR_DPD_GAIN_ESTIMATION_1 (CSR_PHY_BASE+0x000071b4) ++#define ADR_DPD_GAIN_ESTIMATION_2 (CSR_PHY_BASE+0x000071b8) ++#define ADR_TX_GAIN_FACTOR (CSR_PHY_BASE+0x000071bc) ++#define ADR_HARD_WIRE_PIN_REGISTER (CSR_RF_BASE+0x00000000) ++#define ADR_MANUAL_ENABLE_REGISTER (CSR_RF_BASE+0x00000004) ++#define ADR_LDO_REGISTER (CSR_RF_BASE+0x00000008) ++#define ADR_ABB_REGISTER_1 (CSR_RF_BASE+0x0000000c) ++#define ADR_ABB_REGISTER_2 (CSR_RF_BASE+0x00000010) ++#define ADR_TX_FE_REGISTER (CSR_RF_BASE+0x00000014) ++#define ADR_RX_FE_REGISTER_1 (CSR_RF_BASE+0x00000018) ++#define ADR_RX_FE_GAIN_DECODER_REGISTER_1 (CSR_RF_BASE+0x0000001c) ++#define ADR_RX_FE_GAIN_DECODER_REGISTER_2 (CSR_RF_BASE+0x00000020) ++#define ADR_RX_FE_GAIN_DECODER_REGISTER_3 (CSR_RF_BASE+0x00000024) ++#define ADR_RX_FE_GAIN_DECODER_REGISTER_4 (CSR_RF_BASE+0x00000028) ++#define ADR_RX_TX_FSM_REGISTER (CSR_RF_BASE+0x0000002c) ++#define ADR_RX_ADC_REGISTER (CSR_RF_BASE+0x00000030) ++#define ADR_TX_DAC_REGISTER (CSR_RF_BASE+0x00000034) ++#define ADR_SX_ENABLE_REGISTER (CSR_RF_BASE+0x00000038) ++#define ADR_SYN_REGISTER_1 (CSR_RF_BASE+0x0000003c) ++#define ADR_SYN_REGISTER_2 (CSR_RF_BASE+0x00000040) ++#define ADR_SYN_PFD_CHP (CSR_RF_BASE+0x00000044) ++#define ADR_SYN_VCO_LOBF (CSR_RF_BASE+0x00000048) ++#define ADR_SYN_DIV_SDM_XOSC (CSR_RF_BASE+0x0000004c) ++#define ADR_SYN_KVCO_XO_FINE_TUNE_CBANK (CSR_RF_BASE+0x00000050) ++#define ADR_SYN_LCK_VT (CSR_RF_BASE+0x00000054) ++#define ADR_DPLL_VCO_REGISTER (CSR_RF_BASE+0x00000058) ++#define ADR_DPLL_CP_PFD_REGISTER (CSR_RF_BASE+0x0000005c) ++#define ADR_DPLL_DIVIDER_REGISTER (CSR_RF_BASE+0x00000060) ++#define ADR_DCOC_IDAC_REGISTER1 (CSR_RF_BASE+0x00000064) ++#define ADR_DCOC_IDAC_REGISTER2 (CSR_RF_BASE+0x00000068) ++#define ADR_DCOC_IDAC_REGISTER3 (CSR_RF_BASE+0x0000006c) ++#define ADR_DCOC_IDAC_REGISTER4 (CSR_RF_BASE+0x00000070) ++#define ADR_DCOC_IDAC_REGISTER5 (CSR_RF_BASE+0x00000074) ++#define ADR_DCOC_IDAC_REGISTER6 (CSR_RF_BASE+0x00000078) ++#define ADR_DCOC_IDAC_REGISTER7 (CSR_RF_BASE+0x0000007c) ++#define ADR_DCOC_IDAC_REGISTER8 (CSR_RF_BASE+0x00000080) ++#define ADR_RCAL_REGISTER (CSR_RF_BASE+0x00000084) ++#define ADR_SX_LCK_BIN_REGISTERS_I (CSR_RF_BASE+0x00000088) ++#define ADR_TRX_DUMMY_REGISTER (CSR_RF_BASE+0x0000008c) ++#define ADR_SX_DUMMY_REGISTER (CSR_RF_BASE+0x00000090) ++#define ADR_READ_ONLY_FLAGS_1 (CSR_RF_BASE+0x00000094) ++#define ADR_READ_ONLY_FLAGS_2 (CSR_RF_BASE+0x00000098) ++#define ADR_DPLL_FB_DIVIDER_REGISTERS_I (CSR_RF_BASE+0x0000009c) ++#define ADR_DPLL_FB_DIVIDER_REGISTERS_II (CSR_RF_BASE+0x000000a0) ++#define ADR_SX_LCK_BIN_REGISTERS_II (CSR_RF_BASE+0x000000a4) ++#define ADR_RC_OSC_32K_CAL_REGISTERS (CSR_RF_BASE+0x000000a8) ++#define ADR_RF_D_DIGITAL_DEBUG_PORT_REGISTER (CSR_RF_BASE+0x000000ac) ++#define ADR_MMU_CTRL (MMU_REG_BASE+0x00000000) ++#define ADR_HS_CTRL (MMU_REG_BASE+0x00000004) ++#define ADR_CPU_POR0_7 (MMU_REG_BASE+0x00000008) ++#define ADR_CPU_POR8_F (MMU_REG_BASE+0x0000000c) ++#define ADR_REG_LEN_CTRL (MMU_REG_BASE+0x00000010) ++#define ADR_DMN_READ_BYPASS (MMU_REG_BASE+0x00000014) ++#define ADR_ALC_RLS_ABORT (MMU_REG_BASE+0x00000018) ++#define ADR_DEBUG_CTL (MMU_REG_BASE+0x00000020) ++#define ADR_DEBUG_OUT (MMU_REG_BASE+0x00000024) ++#define ADR_MMU_STATUS (MMU_REG_BASE+0x00000028) ++#define ADR_DMN_STATUS (MMU_REG_BASE+0x0000002c) ++#define ADR_TAG_STATUS (MMU_REG_BASE+0x00000030) ++#define ADR_DMN_MCU_STATUS (MMU_REG_BASE+0x00000034) ++#define ADR_MB_IDTBL_0_STATUS (MMU_REG_BASE+0x00000040) ++#define ADR_MB_IDTBL_1_STATUS (MMU_REG_BASE+0x00000044) ++#define ADR_MB_IDTBL_2_STATUS (MMU_REG_BASE+0x00000048) ++#define ADR_MB_IDTBL_3_STATUS (MMU_REG_BASE+0x0000004c) ++#define ADR_PKT_IDTBL_0_STATUS (MMU_REG_BASE+0x00000050) ++#define ADR_PKT_IDTBL_1_STATUS (MMU_REG_BASE+0x00000054) ++#define ADR_PKT_IDTBL_2_STATUS (MMU_REG_BASE+0x00000058) ++#define ADR_PKT_IDTBL_3_STATUS (MMU_REG_BASE+0x0000005c) ++#define ADR_DMN_IDTBL_0_STATUS (MMU_REG_BASE+0x00000060) ++#define ADR_DMN_IDTBL_1_STATUS (MMU_REG_BASE+0x00000064) ++#define ADR_DMN_IDTBL_2_STATUS (MMU_REG_BASE+0x00000068) ++#define ADR_DMN_IDTBL_3_STATUS (MMU_REG_BASE+0x0000006c) ++#define ADR_MB_NEQID_0_STATUS (MMU_REG_BASE+0x00000070) ++#define ADR_MB_NEQID_1_STATUS (MMU_REG_BASE+0x00000074) ++#define ADR_MB_NEQID_2_STATUS (MMU_REG_BASE+0x00000078) ++#define ADR_MB_NEQID_3_STATUS (MMU_REG_BASE+0x0000007c) ++#define ADR_PKT_NEQID_0_STATUS (MMU_REG_BASE+0x00000080) ++#define ADR_PKT_NEQID_1_STATUS (MMU_REG_BASE+0x00000084) ++#define ADR_PKT_NEQID_2_STATUS (MMU_REG_BASE+0x00000088) ++#define ADR_PKT_NEQID_3_STATUS (MMU_REG_BASE+0x0000008c) ++#define ADR_ALC_NOCHG_ID_STATUS (MMU_REG_BASE+0x00000090) ++#define ADR_TAG_SRAM0_F_STATUS_0 (MMU_REG_BASE+0x000000a0) ++#define ADR_TAG_SRAM0_F_STATUS_1 (MMU_REG_BASE+0x000000a4) ++#define ADR_TAG_SRAM0_F_STATUS_2 (MMU_REG_BASE+0x000000a8) ++#define ADR_TAG_SRAM0_F_STATUS_3 (MMU_REG_BASE+0x000000ac) ++#define ADR_TAG_SRAM0_F_STATUS_4 (MMU_REG_BASE+0x000000b0) ++#define ADR_TAG_SRAM0_F_STATUS_5 (MMU_REG_BASE+0x000000b4) ++#define ADR_TAG_SRAM0_F_STATUS_6 (MMU_REG_BASE+0x000000b8) ++#define ADR_TAG_SRAM0_F_STATUS_7 (MMU_REG_BASE+0x000000bc) ++#define GET_MCU_ENABLE (((REG32(ADR_BRG_SW_RST)) & 0x00000001 ) >> 0) ++#define GET_MAC_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000002 ) >> 1) ++#define GET_MCU_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000004 ) >> 2) ++#define GET_SDIO_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000008 ) >> 3) ++#define GET_SPI_SLV_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000010 ) >> 4) ++#define GET_UART_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000020 ) >> 5) ++#define GET_DMA_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000040 ) >> 6) ++#define GET_WDT_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000080 ) >> 7) ++#define GET_I2C_SLV_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000100 ) >> 8) ++#define GET_INT_CTL_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000200 ) >> 9) ++#define GET_BTCX_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000400 ) >> 10) ++#define GET_GPIO_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00000800 ) >> 11) ++#define GET_US0TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00001000 ) >> 12) ++#define GET_US1TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00002000 ) >> 13) ++#define GET_US2TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00004000 ) >> 14) ++#define GET_US3TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00008000 ) >> 15) ++#define GET_MS0TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00010000 ) >> 16) ++#define GET_MS1TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00020000 ) >> 17) ++#define GET_MS2TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00040000 ) >> 18) ++#define GET_MS3TMR_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00080000 ) >> 19) ++#define GET_RF_BB_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00100000 ) >> 20) ++#define GET_SYS_ALL_RST (((REG32(ADR_BRG_SW_RST)) & 0x00200000 ) >> 21) ++#define GET_DAT_UART_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00400000 ) >> 22) ++#define GET_I2C_MST_SW_RST (((REG32(ADR_BRG_SW_RST)) & 0x00800000 ) >> 23) ++#define GET_RG_REBOOT (((REG32(ADR_BOOT)) & 0x00000001 ) >> 0) ++#define GET_TRAP_IMG_FLS (((REG32(ADR_BOOT)) & 0x00010000 ) >> 16) ++#define GET_TRAP_REBOOT (((REG32(ADR_BOOT)) & 0x00020000 ) >> 17) ++#define GET_TRAP_BOOT_FLS (((REG32(ADR_BOOT)) & 0x00040000 ) >> 18) ++#define GET_CHIP_ID_31_0 (((REG32(ADR_CHIP_ID_0)) & 0xffffffff ) >> 0) ++#define GET_CHIP_ID_63_32 (((REG32(ADR_CHIP_ID_1)) & 0xffffffff ) >> 0) ++#define GET_CHIP_ID_95_64 (((REG32(ADR_CHIP_ID_2)) & 0xffffffff ) >> 0) ++#define GET_CHIP_ID_127_96 (((REG32(ADR_CHIP_ID_3)) & 0xffffffff ) >> 0) ++#define GET_CK_SEL_1_0 (((REG32(ADR_CLOCK_SELECTION)) & 0x00000003 ) >> 0) ++#define GET_CK_SEL_2 (((REG32(ADR_CLOCK_SELECTION)) & 0x00000004 ) >> 2) ++#define GET_SYS_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000001 ) >> 0) ++#define GET_MAC_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000002 ) >> 1) ++#define GET_MCU_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000004 ) >> 2) ++#define GET_SDIO_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000008 ) >> 3) ++#define GET_SPI_SLV_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000010 ) >> 4) ++#define GET_UART_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000020 ) >> 5) ++#define GET_DMA_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000040 ) >> 6) ++#define GET_WDT_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000080 ) >> 7) ++#define GET_I2C_SLV_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000100 ) >> 8) ++#define GET_INT_CTL_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000200 ) >> 9) ++#define GET_BTCX_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000400 ) >> 10) ++#define GET_GPIO_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00000800 ) >> 11) ++#define GET_US0TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00001000 ) >> 12) ++#define GET_US1TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00002000 ) >> 13) ++#define GET_US2TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00004000 ) >> 14) ++#define GET_US3TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00008000 ) >> 15) ++#define GET_MS0TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00010000 ) >> 16) ++#define GET_MS1TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00020000 ) >> 17) ++#define GET_MS2TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00040000 ) >> 18) ++#define GET_MS3TMR_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00080000 ) >> 19) ++#define GET_BIST_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00100000 ) >> 20) ++#define GET_I2C_MST_CLK_EN (((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0x00800000 ) >> 23) ++#define GET_BTCX_CSR_CLK_EN (((REG32(ADR_SYS_CSR_CLOCK_ENABLE)) & 0x00000400 ) >> 10) ++#define GET_MCU_DBG_SEL (((REG32(ADR_MCU_DBG_SEL)) & 0x0000003f ) >> 0) ++#define GET_MCU_STOP_NOGRANT (((REG32(ADR_MCU_DBG_SEL)) & 0x00000100 ) >> 8) ++#define GET_MCU_STOP_ANYTIME (((REG32(ADR_MCU_DBG_SEL)) & 0x00000200 ) >> 9) ++#define GET_MCU_DBG_DATA (((REG32(ADR_MCU_DBG_DATA)) & 0xffffffff ) >> 0) ++#define GET_AHB_SW_RST (((REG32(ADR_AHB_BRG_STATUS)) & 0x00000001 ) >> 0) ++#define GET_AHB_ERR_RST (((REG32(ADR_AHB_BRG_STATUS)) & 0x00000002 ) >> 1) ++#define GET_REG_AHB_DEBUG_MX (((REG32(ADR_AHB_BRG_STATUS)) & 0x00000030 ) >> 4) ++#define GET_REG_PKT_W_NBRT (((REG32(ADR_AHB_BRG_STATUS)) & 0x00000100 ) >> 8) ++#define GET_REG_PKT_R_NBRT (((REG32(ADR_AHB_BRG_STATUS)) & 0x00000200 ) >> 9) ++#define GET_IQ_SRAM_SEL_0 (((REG32(ADR_AHB_BRG_STATUS)) & 0x00001000 ) >> 12) ++#define GET_IQ_SRAM_SEL_1 (((REG32(ADR_AHB_BRG_STATUS)) & 0x00002000 ) >> 13) ++#define GET_IQ_SRAM_SEL_2 (((REG32(ADR_AHB_BRG_STATUS)) & 0x00004000 ) >> 14) ++#define GET_AHB_STATUS (((REG32(ADR_AHB_BRG_STATUS)) & 0xffff0000 ) >> 16) ++#define GET_PARALLEL_DR (((REG32(ADR_BIST_BIST_CTRL)) & 0x00000001 ) >> 0) ++#define GET_MBRUN (((REG32(ADR_BIST_BIST_CTRL)) & 0x00000010 ) >> 4) ++#define GET_SHIFT_DR (((REG32(ADR_BIST_BIST_CTRL)) & 0x00000100 ) >> 8) ++#define GET_MODE_REG_SI (((REG32(ADR_BIST_BIST_CTRL)) & 0x00000200 ) >> 9) ++#define GET_SIMULATION_MODE (((REG32(ADR_BIST_BIST_CTRL)) & 0x00000400 ) >> 10) ++#define GET_DBIST_MODE (((REG32(ADR_BIST_BIST_CTRL)) & 0x00000800 ) >> 11) ++#define GET_MODE_REG_IN (((REG32(ADR_BIST_MODE_REG_IN)) & 0x001fffff ) >> 0) ++#define GET_MODE_REG_OUT_MCU (((REG32(ADR_BIST_MODE_REG_OUT)) & 0x001fffff ) >> 0) ++#define GET_MODE_REG_SO_MCU (((REG32(ADR_BIST_MODE_REG_OUT)) & 0x80000000 ) >> 31) ++#define GET_MONITOR_BUS_MCU_31_0 (((REG32(ADR_BIST_MONITOR_BUS_LSB)) & 0xffffffff ) >> 0) ++#define GET_MONITOR_BUS_MCU_33_32 (((REG32(ADR_BIST_MONITOR_BUS_MSB)) & 0x00000003 ) >> 0) ++#define GET_TB_ADR_SEL (((REG32(ADR_TB_ADR_SEL)) & 0x0000ffff ) >> 0) ++#define GET_TB_CS (((REG32(ADR_TB_ADR_SEL)) & 0x80000000 ) >> 31) ++#define GET_TB_RDATA (((REG32(ADR_TB_RDATA)) & 0xffffffff ) >> 0) ++#define GET_UART_W2B_EN (((REG32(ADR_UART_W2B)) & 0x00000001 ) >> 0) ++#define GET_DATA_UART_W2B_EN (((REG32(ADR_UART_W2B)) & 0x00000010 ) >> 4) ++#define GET_AHB_ILL_ADDR (((REG32(ADR_AHB_ILL_ADDR)) & 0xffffffff ) >> 0) ++#define GET_AHB_FEN_ADDR (((REG32(ADR_AHB_FEN_ADDR)) & 0xffffffff ) >> 0) ++#define GET_ILL_ADDR_CLR (((REG32(ADR_AHB_ILLFEN_STATUS)) & 0x00000001 ) >> 0) ++#define GET_FENCE_HIT_CLR (((REG32(ADR_AHB_ILLFEN_STATUS)) & 0x00000002 ) >> 1) ++#define GET_ILL_ADDR_INT (((REG32(ADR_AHB_ILLFEN_STATUS)) & 0x00000010 ) >> 4) ++#define GET_FENCE_HIT_INT (((REG32(ADR_AHB_ILLFEN_STATUS)) & 0x00000020 ) >> 5) ++#define GET_PWM_INI_VALUE_P_A (((REG32(ADR_PWM_A)) & 0x000000ff ) >> 0) ++#define GET_PWM_INI_VALUE_N_A (((REG32(ADR_PWM_A)) & 0x0000ff00 ) >> 8) ++#define GET_PWM_POST_SCALER_A (((REG32(ADR_PWM_A)) & 0x000f0000 ) >> 16) ++#define GET_PWM_ALWAYSON_A (((REG32(ADR_PWM_A)) & 0x20000000 ) >> 29) ++#define GET_PWM_INVERT_A (((REG32(ADR_PWM_A)) & 0x40000000 ) >> 30) ++#define GET_PWM_ENABLE_A (((REG32(ADR_PWM_A)) & 0x80000000 ) >> 31) ++#define GET_PWM_INI_VALUE_P_B (((REG32(ADR_PWM_B)) & 0x000000ff ) >> 0) ++#define GET_PWM_INI_VALUE_N_B (((REG32(ADR_PWM_B)) & 0x0000ff00 ) >> 8) ++#define GET_PWM_POST_SCALER_B (((REG32(ADR_PWM_B)) & 0x000f0000 ) >> 16) ++#define GET_PWM_ALWAYSON_B (((REG32(ADR_PWM_B)) & 0x20000000 ) >> 29) ++#define GET_PWM_INVERT_B (((REG32(ADR_PWM_B)) & 0x40000000 ) >> 30) ++#define GET_PWM_ENABLE_B (((REG32(ADR_PWM_B)) & 0x80000000 ) >> 31) ++#define GET_HBUSREQ_LOCK (((REG32(ADR_HBUSREQ_LOCK)) & 0x00001fff ) >> 0) ++#define GET_HBURST_LOCK (((REG32(ADR_HBURST_LOCK)) & 0x00001fff ) >> 0) ++#define GET_PRESCALER_USTIMER (((REG32(ADR_PRESCALER_USTIMER)) & 0x000001ff ) >> 0) ++#define GET_MODE_REG_IN_MMU (((REG32(ADR_BIST_MODE_REG_IN_MMU)) & 0x0000ffff ) >> 0) ++#define GET_MODE_REG_OUT_MMU (((REG32(ADR_BIST_MODE_REG_OUT_MMU)) & 0x0000ffff ) >> 0) ++#define GET_MODE_REG_SO_MMU (((REG32(ADR_BIST_MODE_REG_OUT_MMU)) & 0x80000000 ) >> 31) ++#define GET_MONITOR_BUS_MMU (((REG32(ADR_BIST_MONITOR_BUS_MMU)) & 0x0007ffff ) >> 0) ++#define GET_TEST_MODE0 (((REG32(ADR_TEST_MODE)) & 0x00000001 ) >> 0) ++#define GET_TEST_MODE1 (((REG32(ADR_TEST_MODE)) & 0x00000002 ) >> 1) ++#define GET_TEST_MODE2 (((REG32(ADR_TEST_MODE)) & 0x00000004 ) >> 2) ++#define GET_TEST_MODE3 (((REG32(ADR_TEST_MODE)) & 0x00000008 ) >> 3) ++#define GET_TEST_MODE4 (((REG32(ADR_TEST_MODE)) & 0x00000010 ) >> 4) ++#define GET_TEST_MODE_ALL (((REG32(ADR_TEST_MODE)) & 0x00000020 ) >> 5) ++#define GET_WDT_INIT (((REG32(ADR_BOOT_INFO)) & 0x00000001 ) >> 0) ++#define GET_SD_HOST_INIT (((REG32(ADR_BOOT_INFO)) & 0x00000002 ) >> 1) ++#define GET_ALLOW_SD_RESET (((REG32(ADR_SD_INIT_CFG)) & 0x00000001 ) >> 0) ++#define GET_UART_NRTS (((REG32(ADR_SPARE_UART_INFO)) & 0x00000001 ) >> 0) ++#define GET_UART_NCTS (((REG32(ADR_SPARE_UART_INFO)) & 0x00000002 ) >> 1) ++#define GET_TU0_TM_INIT_VALUE (((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TU0_TM_MODE (((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TU0_TM_INT_STS_DONE (((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TU0_TM_INT_MASK (((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TU0_TM_CUR_VALUE (((REG32(ADR_TU0_CURRENT_MICROSECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TU1_TM_INIT_VALUE (((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TU1_TM_MODE (((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TU1_TM_INT_STS_DONE (((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TU1_TM_INT_MASK (((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TU1_TM_CUR_VALUE (((REG32(ADR_TU1_CURRENT_MICROSECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TU2_TM_INIT_VALUE (((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TU2_TM_MODE (((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TU2_TM_INT_STS_DONE (((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TU2_TM_INT_MASK (((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TU2_TM_CUR_VALUE (((REG32(ADR_TU2_CURRENT_MICROSECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TU3_TM_INIT_VALUE (((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TU3_TM_MODE (((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TU3_TM_INT_STS_DONE (((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TU3_TM_INT_MASK (((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TU3_TM_CUR_VALUE (((REG32(ADR_TU3_CURRENT_MICROSECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TM0_TM_INIT_VALUE (((REG32(ADR_TM0_MILISECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TM0_TM_MODE (((REG32(ADR_TM0_MILISECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TM0_TM_INT_STS_DONE (((REG32(ADR_TM0_MILISECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TM0_TM_INT_MASK (((REG32(ADR_TM0_MILISECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TM0_TM_CUR_VALUE (((REG32(ADR_TM0_CURRENT_MILISECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TM1_TM_INIT_VALUE (((REG32(ADR_TM1_MILISECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TM1_TM_MODE (((REG32(ADR_TM1_MILISECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TM1_TM_INT_STS_DONE (((REG32(ADR_TM1_MILISECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TM1_TM_INT_MASK (((REG32(ADR_TM1_MILISECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TM1_TM_CUR_VALUE (((REG32(ADR_TM1_CURRENT_MILISECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TM2_TM_INIT_VALUE (((REG32(ADR_TM2_MILISECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TM2_TM_MODE (((REG32(ADR_TM2_MILISECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TM2_TM_INT_STS_DONE (((REG32(ADR_TM2_MILISECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TM2_TM_INT_MASK (((REG32(ADR_TM2_MILISECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TM2_TM_CUR_VALUE (((REG32(ADR_TM2_CURRENT_MILISECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_TM3_TM_INIT_VALUE (((REG32(ADR_TM3_MILISECOND_TIMER)) & 0x0000ffff ) >> 0) ++#define GET_TM3_TM_MODE (((REG32(ADR_TM3_MILISECOND_TIMER)) & 0x00010000 ) >> 16) ++#define GET_TM3_TM_INT_STS_DONE (((REG32(ADR_TM3_MILISECOND_TIMER)) & 0x00020000 ) >> 17) ++#define GET_TM3_TM_INT_MASK (((REG32(ADR_TM3_MILISECOND_TIMER)) & 0x00040000 ) >> 18) ++#define GET_TM3_TM_CUR_VALUE (((REG32(ADR_TM3_CURRENT_MILISECOND_TIME_VALUE)) & 0x0000ffff ) >> 0) ++#define GET_MCU_WDT_TIME_CNT (((REG32(ADR_MCU_WDOG_REG)) & 0x0000ffff ) >> 0) ++#define GET_MCU_WDT_STATUS (((REG32(ADR_MCU_WDOG_REG)) & 0x00020000 ) >> 17) ++#define GET_MCU_WDOG_ENA (((REG32(ADR_MCU_WDOG_REG)) & 0x80000000 ) >> 31) ++#define GET_SYS_WDT_TIME_CNT (((REG32(ADR_SYS_WDOG_REG)) & 0x0000ffff ) >> 0) ++#define GET_SYS_WDT_STATUS (((REG32(ADR_SYS_WDOG_REG)) & 0x00020000 ) >> 17) ++#define GET_SYS_WDOG_ENA (((REG32(ADR_SYS_WDOG_REG)) & 0x80000000 ) >> 31) ++#define GET_XLNA_EN_O_OE (((REG32(ADR_PAD6)) & 0x00000001 ) >> 0) ++#define GET_XLNA_EN_O_PE (((REG32(ADR_PAD6)) & 0x00000002 ) >> 1) ++#define GET_PAD6_IE (((REG32(ADR_PAD6)) & 0x00000008 ) >> 3) ++#define GET_PAD6_SEL_I (((REG32(ADR_PAD6)) & 0x00000030 ) >> 4) ++#define GET_PAD6_OD (((REG32(ADR_PAD6)) & 0x00000100 ) >> 8) ++#define GET_PAD6_SEL_O (((REG32(ADR_PAD6)) & 0x00001000 ) >> 12) ++#define GET_XLNA_EN_O_C (((REG32(ADR_PAD6)) & 0x10000000 ) >> 28) ++#define GET_WIFI_TX_SW_O_OE (((REG32(ADR_PAD7)) & 0x00000001 ) >> 0) ++#define GET_WIFI_TX_SW_O_PE (((REG32(ADR_PAD7)) & 0x00000002 ) >> 1) ++#define GET_PAD7_IE (((REG32(ADR_PAD7)) & 0x00000008 ) >> 3) ++#define GET_PAD7_SEL_I (((REG32(ADR_PAD7)) & 0x00000030 ) >> 4) ++#define GET_PAD7_OD (((REG32(ADR_PAD7)) & 0x00000100 ) >> 8) ++#define GET_PAD7_SEL_O (((REG32(ADR_PAD7)) & 0x00001000 ) >> 12) ++#define GET_WIFI_TX_SW_O_C (((REG32(ADR_PAD7)) & 0x10000000 ) >> 28) ++#define GET_WIFI_RX_SW_O_OE (((REG32(ADR_PAD8)) & 0x00000001 ) >> 0) ++#define GET_WIFI_RX_SW_O_PE (((REG32(ADR_PAD8)) & 0x00000002 ) >> 1) ++#define GET_PAD8_IE (((REG32(ADR_PAD8)) & 0x00000008 ) >> 3) ++#define GET_PAD8_SEL_I (((REG32(ADR_PAD8)) & 0x00000030 ) >> 4) ++#define GET_PAD8_OD (((REG32(ADR_PAD8)) & 0x00000100 ) >> 8) ++#define GET_WIFI_RX_SW_O_C (((REG32(ADR_PAD8)) & 0x10000000 ) >> 28) ++#define GET_BT_SW_O_OE (((REG32(ADR_PAD9)) & 0x00000001 ) >> 0) ++#define GET_BT_SW_O_PE (((REG32(ADR_PAD9)) & 0x00000002 ) >> 1) ++#define GET_PAD9_IE (((REG32(ADR_PAD9)) & 0x00000008 ) >> 3) ++#define GET_PAD9_SEL_I (((REG32(ADR_PAD9)) & 0x00000030 ) >> 4) ++#define GET_PAD9_OD (((REG32(ADR_PAD9)) & 0x00000100 ) >> 8) ++#define GET_PAD9_SEL_O (((REG32(ADR_PAD9)) & 0x00001000 ) >> 12) ++#define GET_BT_SW_O_C (((REG32(ADR_PAD9)) & 0x10000000 ) >> 28) ++#define GET_XPA_EN_O_OE (((REG32(ADR_PAD11)) & 0x00000001 ) >> 0) ++#define GET_XPA_EN_O_PE (((REG32(ADR_PAD11)) & 0x00000002 ) >> 1) ++#define GET_PAD11_IE (((REG32(ADR_PAD11)) & 0x00000008 ) >> 3) ++#define GET_PAD11_SEL_I (((REG32(ADR_PAD11)) & 0x00000030 ) >> 4) ++#define GET_PAD11_OD (((REG32(ADR_PAD11)) & 0x00000100 ) >> 8) ++#define GET_PAD11_SEL_O (((REG32(ADR_PAD11)) & 0x00001000 ) >> 12) ++#define GET_XPA_EN_O_C (((REG32(ADR_PAD11)) & 0x10000000 ) >> 28) ++#define GET_PAD15_OE (((REG32(ADR_PAD15)) & 0x00000001 ) >> 0) ++#define GET_PAD15_PE (((REG32(ADR_PAD15)) & 0x00000002 ) >> 1) ++#define GET_PAD15_DS (((REG32(ADR_PAD15)) & 0x00000004 ) >> 2) ++#define GET_PAD15_IE (((REG32(ADR_PAD15)) & 0x00000008 ) >> 3) ++#define GET_PAD15_SEL_I (((REG32(ADR_PAD15)) & 0x00000030 ) >> 4) ++#define GET_PAD15_OD (((REG32(ADR_PAD15)) & 0x00000100 ) >> 8) ++#define GET_PAD15_SEL_O (((REG32(ADR_PAD15)) & 0x00001000 ) >> 12) ++#define GET_TEST_1_ID (((REG32(ADR_PAD15)) & 0x10000000 ) >> 28) ++#define GET_PAD16_OE (((REG32(ADR_PAD16)) & 0x00000001 ) >> 0) ++#define GET_PAD16_PE (((REG32(ADR_PAD16)) & 0x00000002 ) >> 1) ++#define GET_PAD16_DS (((REG32(ADR_PAD16)) & 0x00000004 ) >> 2) ++#define GET_PAD16_IE (((REG32(ADR_PAD16)) & 0x00000008 ) >> 3) ++#define GET_PAD16_SEL_I (((REG32(ADR_PAD16)) & 0x00000030 ) >> 4) ++#define GET_PAD16_OD (((REG32(ADR_PAD16)) & 0x00000100 ) >> 8) ++#define GET_PAD16_SEL_O (((REG32(ADR_PAD16)) & 0x00001000 ) >> 12) ++#define GET_TEST_2_ID (((REG32(ADR_PAD16)) & 0x10000000 ) >> 28) ++#define GET_PAD17_OE (((REG32(ADR_PAD17)) & 0x00000001 ) >> 0) ++#define GET_PAD17_PE (((REG32(ADR_PAD17)) & 0x00000002 ) >> 1) ++#define GET_PAD17_DS (((REG32(ADR_PAD17)) & 0x00000004 ) >> 2) ++#define GET_PAD17_IE (((REG32(ADR_PAD17)) & 0x00000008 ) >> 3) ++#define GET_PAD17_SEL_I (((REG32(ADR_PAD17)) & 0x00000030 ) >> 4) ++#define GET_PAD17_OD (((REG32(ADR_PAD17)) & 0x00000100 ) >> 8) ++#define GET_PAD17_SEL_O (((REG32(ADR_PAD17)) & 0x00001000 ) >> 12) ++#define GET_TEST_3_ID (((REG32(ADR_PAD17)) & 0x10000000 ) >> 28) ++#define GET_PAD18_OE (((REG32(ADR_PAD18)) & 0x00000001 ) >> 0) ++#define GET_PAD18_PE (((REG32(ADR_PAD18)) & 0x00000002 ) >> 1) ++#define GET_PAD18_DS (((REG32(ADR_PAD18)) & 0x00000004 ) >> 2) ++#define GET_PAD18_IE (((REG32(ADR_PAD18)) & 0x00000008 ) >> 3) ++#define GET_PAD18_SEL_I (((REG32(ADR_PAD18)) & 0x00000030 ) >> 4) ++#define GET_PAD18_OD (((REG32(ADR_PAD18)) & 0x00000100 ) >> 8) ++#define GET_PAD18_SEL_O (((REG32(ADR_PAD18)) & 0x00003000 ) >> 12) ++#define GET_TEST_4_ID (((REG32(ADR_PAD18)) & 0x10000000 ) >> 28) ++#define GET_PAD19_OE (((REG32(ADR_PAD19)) & 0x00000001 ) >> 0) ++#define GET_PAD19_PE (((REG32(ADR_PAD19)) & 0x00000002 ) >> 1) ++#define GET_PAD19_DS (((REG32(ADR_PAD19)) & 0x00000004 ) >> 2) ++#define GET_PAD19_IE (((REG32(ADR_PAD19)) & 0x00000008 ) >> 3) ++#define GET_PAD19_SEL_I (((REG32(ADR_PAD19)) & 0x00000030 ) >> 4) ++#define GET_PAD19_OD (((REG32(ADR_PAD19)) & 0x00000100 ) >> 8) ++#define GET_PAD19_SEL_O (((REG32(ADR_PAD19)) & 0x00007000 ) >> 12) ++#define GET_SHORT_TO_20_ID (((REG32(ADR_PAD19)) & 0x10000000 ) >> 28) ++#define GET_PAD20_OE (((REG32(ADR_PAD20)) & 0x00000001 ) >> 0) ++#define GET_PAD20_PE (((REG32(ADR_PAD20)) & 0x00000002 ) >> 1) ++#define GET_PAD20_DS (((REG32(ADR_PAD20)) & 0x00000004 ) >> 2) ++#define GET_PAD20_IE (((REG32(ADR_PAD20)) & 0x00000008 ) >> 3) ++#define GET_PAD20_SEL_I (((REG32(ADR_PAD20)) & 0x000000f0 ) >> 4) ++#define GET_PAD20_OD (((REG32(ADR_PAD20)) & 0x00000100 ) >> 8) ++#define GET_PAD20_SEL_O (((REG32(ADR_PAD20)) & 0x00003000 ) >> 12) ++#define GET_STRAP0 (((REG32(ADR_PAD20)) & 0x08000000 ) >> 27) ++#define GET_GPIO_TEST_1_ID (((REG32(ADR_PAD20)) & 0x10000000 ) >> 28) ++#define GET_PAD21_OE (((REG32(ADR_PAD21)) & 0x00000001 ) >> 0) ++#define GET_PAD21_PE (((REG32(ADR_PAD21)) & 0x00000002 ) >> 1) ++#define GET_PAD21_DS (((REG32(ADR_PAD21)) & 0x00000004 ) >> 2) ++#define GET_PAD21_IE (((REG32(ADR_PAD21)) & 0x00000008 ) >> 3) ++#define GET_PAD21_SEL_I (((REG32(ADR_PAD21)) & 0x00000070 ) >> 4) ++#define GET_PAD21_OD (((REG32(ADR_PAD21)) & 0x00000100 ) >> 8) ++#define GET_PAD21_SEL_O (((REG32(ADR_PAD21)) & 0x00003000 ) >> 12) ++#define GET_STRAP3 (((REG32(ADR_PAD21)) & 0x08000000 ) >> 27) ++#define GET_GPIO_TEST_2_ID (((REG32(ADR_PAD21)) & 0x10000000 ) >> 28) ++#define GET_PAD22_OE (((REG32(ADR_PAD22)) & 0x00000001 ) >> 0) ++#define GET_PAD22_PE (((REG32(ADR_PAD22)) & 0x00000002 ) >> 1) ++#define GET_PAD22_DS (((REG32(ADR_PAD22)) & 0x00000004 ) >> 2) ++#define GET_PAD22_IE (((REG32(ADR_PAD22)) & 0x00000008 ) >> 3) ++#define GET_PAD22_SEL_I (((REG32(ADR_PAD22)) & 0x00000070 ) >> 4) ++#define GET_PAD22_OD (((REG32(ADR_PAD22)) & 0x00000100 ) >> 8) ++#define GET_PAD22_SEL_O (((REG32(ADR_PAD22)) & 0x00007000 ) >> 12) ++#define GET_PAD22_SEL_OE (((REG32(ADR_PAD22)) & 0x00100000 ) >> 20) ++#define GET_GPIO_TEST_3_ID (((REG32(ADR_PAD22)) & 0x10000000 ) >> 28) ++#define GET_PAD24_OE (((REG32(ADR_PAD24)) & 0x00000001 ) >> 0) ++#define GET_PAD24_PE (((REG32(ADR_PAD24)) & 0x00000002 ) >> 1) ++#define GET_PAD24_DS (((REG32(ADR_PAD24)) & 0x00000004 ) >> 2) ++#define GET_PAD24_IE (((REG32(ADR_PAD24)) & 0x00000008 ) >> 3) ++#define GET_PAD24_SEL_I (((REG32(ADR_PAD24)) & 0x00000030 ) >> 4) ++#define GET_PAD24_OD (((REG32(ADR_PAD24)) & 0x00000100 ) >> 8) ++#define GET_PAD24_SEL_O (((REG32(ADR_PAD24)) & 0x00007000 ) >> 12) ++#define GET_GPIO_TEST_4_ID (((REG32(ADR_PAD24)) & 0x10000000 ) >> 28) ++#define GET_PAD25_OE (((REG32(ADR_PAD25)) & 0x00000001 ) >> 0) ++#define GET_PAD25_PE (((REG32(ADR_PAD25)) & 0x00000002 ) >> 1) ++#define GET_PAD25_DS (((REG32(ADR_PAD25)) & 0x00000004 ) >> 2) ++#define GET_PAD25_IE (((REG32(ADR_PAD25)) & 0x00000008 ) >> 3) ++#define GET_PAD25_SEL_I (((REG32(ADR_PAD25)) & 0x00000070 ) >> 4) ++#define GET_PAD25_OD (((REG32(ADR_PAD25)) & 0x00000100 ) >> 8) ++#define GET_PAD25_SEL_O (((REG32(ADR_PAD25)) & 0x00007000 ) >> 12) ++#define GET_PAD25_SEL_OE (((REG32(ADR_PAD25)) & 0x00100000 ) >> 20) ++#define GET_STRAP1 (((REG32(ADR_PAD25)) & 0x08000000 ) >> 27) ++#define GET_GPIO_1_ID (((REG32(ADR_PAD25)) & 0x10000000 ) >> 28) ++#define GET_PAD27_OE (((REG32(ADR_PAD27)) & 0x00000001 ) >> 0) ++#define GET_PAD27_PE (((REG32(ADR_PAD27)) & 0x00000002 ) >> 1) ++#define GET_PAD27_DS (((REG32(ADR_PAD27)) & 0x00000004 ) >> 2) ++#define GET_PAD27_IE (((REG32(ADR_PAD27)) & 0x00000008 ) >> 3) ++#define GET_PAD27_SEL_I (((REG32(ADR_PAD27)) & 0x00000070 ) >> 4) ++#define GET_PAD27_OD (((REG32(ADR_PAD27)) & 0x00000100 ) >> 8) ++#define GET_PAD27_SEL_O (((REG32(ADR_PAD27)) & 0x00007000 ) >> 12) ++#define GET_GPIO_2_ID (((REG32(ADR_PAD27)) & 0x10000000 ) >> 28) ++#define GET_PAD28_OE (((REG32(ADR_PAD28)) & 0x00000001 ) >> 0) ++#define GET_PAD28_PE (((REG32(ADR_PAD28)) & 0x00000002 ) >> 1) ++#define GET_PAD28_DS (((REG32(ADR_PAD28)) & 0x00000004 ) >> 2) ++#define GET_PAD28_IE (((REG32(ADR_PAD28)) & 0x00000008 ) >> 3) ++#define GET_PAD28_SEL_I (((REG32(ADR_PAD28)) & 0x00000070 ) >> 4) ++#define GET_PAD28_OD (((REG32(ADR_PAD28)) & 0x00000100 ) >> 8) ++#define GET_PAD28_SEL_O (((REG32(ADR_PAD28)) & 0x0000f000 ) >> 12) ++#define GET_PAD28_SEL_OE (((REG32(ADR_PAD28)) & 0x00100000 ) >> 20) ++#define GET_GPIO_3_ID (((REG32(ADR_PAD28)) & 0x10000000 ) >> 28) ++#define GET_PAD29_OE (((REG32(ADR_PAD29)) & 0x00000001 ) >> 0) ++#define GET_PAD29_PE (((REG32(ADR_PAD29)) & 0x00000002 ) >> 1) ++#define GET_PAD29_DS (((REG32(ADR_PAD29)) & 0x00000004 ) >> 2) ++#define GET_PAD29_IE (((REG32(ADR_PAD29)) & 0x00000008 ) >> 3) ++#define GET_PAD29_SEL_I (((REG32(ADR_PAD29)) & 0x00000070 ) >> 4) ++#define GET_PAD29_OD (((REG32(ADR_PAD29)) & 0x00000100 ) >> 8) ++#define GET_PAD29_SEL_O (((REG32(ADR_PAD29)) & 0x00007000 ) >> 12) ++#define GET_GPIO_TEST_5_ID (((REG32(ADR_PAD29)) & 0x10000000 ) >> 28) ++#define GET_PAD30_OE (((REG32(ADR_PAD30)) & 0x00000001 ) >> 0) ++#define GET_PAD30_PE (((REG32(ADR_PAD30)) & 0x00000002 ) >> 1) ++#define GET_PAD30_DS (((REG32(ADR_PAD30)) & 0x00000004 ) >> 2) ++#define GET_PAD30_IE (((REG32(ADR_PAD30)) & 0x00000008 ) >> 3) ++#define GET_PAD30_SEL_I (((REG32(ADR_PAD30)) & 0x00000030 ) >> 4) ++#define GET_PAD30_OD (((REG32(ADR_PAD30)) & 0x00000100 ) >> 8) ++#define GET_PAD30_SEL_O (((REG32(ADR_PAD30)) & 0x00003000 ) >> 12) ++#define GET_TEST_6_ID (((REG32(ADR_PAD30)) & 0x10000000 ) >> 28) ++#define GET_PAD31_OE (((REG32(ADR_PAD31)) & 0x00000001 ) >> 0) ++#define GET_PAD31_PE (((REG32(ADR_PAD31)) & 0x00000002 ) >> 1) ++#define GET_PAD31_DS (((REG32(ADR_PAD31)) & 0x00000004 ) >> 2) ++#define GET_PAD31_IE (((REG32(ADR_PAD31)) & 0x00000008 ) >> 3) ++#define GET_PAD31_SEL_I (((REG32(ADR_PAD31)) & 0x00000030 ) >> 4) ++#define GET_PAD31_OD (((REG32(ADR_PAD31)) & 0x00000100 ) >> 8) ++#define GET_PAD31_SEL_O (((REG32(ADR_PAD31)) & 0x00003000 ) >> 12) ++#define GET_TEST_7_ID (((REG32(ADR_PAD31)) & 0x10000000 ) >> 28) ++#define GET_PAD32_OE (((REG32(ADR_PAD32)) & 0x00000001 ) >> 0) ++#define GET_PAD32_PE (((REG32(ADR_PAD32)) & 0x00000002 ) >> 1) ++#define GET_PAD32_DS (((REG32(ADR_PAD32)) & 0x00000004 ) >> 2) ++#define GET_PAD32_IE (((REG32(ADR_PAD32)) & 0x00000008 ) >> 3) ++#define GET_PAD32_SEL_I (((REG32(ADR_PAD32)) & 0x00000030 ) >> 4) ++#define GET_PAD32_OD (((REG32(ADR_PAD32)) & 0x00000100 ) >> 8) ++#define GET_PAD32_SEL_O (((REG32(ADR_PAD32)) & 0x00003000 ) >> 12) ++#define GET_TEST_8_ID (((REG32(ADR_PAD32)) & 0x10000000 ) >> 28) ++#define GET_PAD33_OE (((REG32(ADR_PAD33)) & 0x00000001 ) >> 0) ++#define GET_PAD33_PE (((REG32(ADR_PAD33)) & 0x00000002 ) >> 1) ++#define GET_PAD33_DS (((REG32(ADR_PAD33)) & 0x00000004 ) >> 2) ++#define GET_PAD33_IE (((REG32(ADR_PAD33)) & 0x00000008 ) >> 3) ++#define GET_PAD33_SEL_I (((REG32(ADR_PAD33)) & 0x00000030 ) >> 4) ++#define GET_PAD33_OD (((REG32(ADR_PAD33)) & 0x00000100 ) >> 8) ++#define GET_PAD33_SEL_O (((REG32(ADR_PAD33)) & 0x00003000 ) >> 12) ++#define GET_TEST_9_ID (((REG32(ADR_PAD33)) & 0x10000000 ) >> 28) ++#define GET_PAD34_OE (((REG32(ADR_PAD34)) & 0x00000001 ) >> 0) ++#define GET_PAD34_PE (((REG32(ADR_PAD34)) & 0x00000002 ) >> 1) ++#define GET_PAD34_DS (((REG32(ADR_PAD34)) & 0x00000004 ) >> 2) ++#define GET_PAD34_IE (((REG32(ADR_PAD34)) & 0x00000008 ) >> 3) ++#define GET_PAD34_SEL_I (((REG32(ADR_PAD34)) & 0x00000030 ) >> 4) ++#define GET_PAD34_OD (((REG32(ADR_PAD34)) & 0x00000100 ) >> 8) ++#define GET_PAD34_SEL_O (((REG32(ADR_PAD34)) & 0x00003000 ) >> 12) ++#define GET_TEST_10_ID (((REG32(ADR_PAD34)) & 0x10000000 ) >> 28) ++#define GET_PAD42_OE (((REG32(ADR_PAD42)) & 0x00000001 ) >> 0) ++#define GET_PAD42_PE (((REG32(ADR_PAD42)) & 0x00000002 ) >> 1) ++#define GET_PAD42_DS (((REG32(ADR_PAD42)) & 0x00000004 ) >> 2) ++#define GET_PAD42_IE (((REG32(ADR_PAD42)) & 0x00000008 ) >> 3) ++#define GET_PAD42_SEL_I (((REG32(ADR_PAD42)) & 0x00000030 ) >> 4) ++#define GET_PAD42_OD (((REG32(ADR_PAD42)) & 0x00000100 ) >> 8) ++#define GET_PAD42_SEL_O (((REG32(ADR_PAD42)) & 0x00001000 ) >> 12) ++#define GET_TEST_11_ID (((REG32(ADR_PAD42)) & 0x10000000 ) >> 28) ++#define GET_PAD43_OE (((REG32(ADR_PAD43)) & 0x00000001 ) >> 0) ++#define GET_PAD43_PE (((REG32(ADR_PAD43)) & 0x00000002 ) >> 1) ++#define GET_PAD43_DS (((REG32(ADR_PAD43)) & 0x00000004 ) >> 2) ++#define GET_PAD43_IE (((REG32(ADR_PAD43)) & 0x00000008 ) >> 3) ++#define GET_PAD43_SEL_I (((REG32(ADR_PAD43)) & 0x00000030 ) >> 4) ++#define GET_PAD43_OD (((REG32(ADR_PAD43)) & 0x00000100 ) >> 8) ++#define GET_PAD43_SEL_O (((REG32(ADR_PAD43)) & 0x00001000 ) >> 12) ++#define GET_TEST_12_ID (((REG32(ADR_PAD43)) & 0x10000000 ) >> 28) ++#define GET_PAD44_OE (((REG32(ADR_PAD44)) & 0x00000001 ) >> 0) ++#define GET_PAD44_PE (((REG32(ADR_PAD44)) & 0x00000002 ) >> 1) ++#define GET_PAD44_DS (((REG32(ADR_PAD44)) & 0x00000004 ) >> 2) ++#define GET_PAD44_IE (((REG32(ADR_PAD44)) & 0x00000008 ) >> 3) ++#define GET_PAD44_SEL_I (((REG32(ADR_PAD44)) & 0x00000030 ) >> 4) ++#define GET_PAD44_OD (((REG32(ADR_PAD44)) & 0x00000100 ) >> 8) ++#define GET_PAD44_SEL_O (((REG32(ADR_PAD44)) & 0x00003000 ) >> 12) ++#define GET_TEST_13_ID (((REG32(ADR_PAD44)) & 0x10000000 ) >> 28) ++#define GET_PAD45_OE (((REG32(ADR_PAD45)) & 0x00000001 ) >> 0) ++#define GET_PAD45_PE (((REG32(ADR_PAD45)) & 0x00000002 ) >> 1) ++#define GET_PAD45_DS (((REG32(ADR_PAD45)) & 0x00000004 ) >> 2) ++#define GET_PAD45_IE (((REG32(ADR_PAD45)) & 0x00000008 ) >> 3) ++#define GET_PAD45_SEL_I (((REG32(ADR_PAD45)) & 0x00000030 ) >> 4) ++#define GET_PAD45_OD (((REG32(ADR_PAD45)) & 0x00000100 ) >> 8) ++#define GET_PAD45_SEL_O (((REG32(ADR_PAD45)) & 0x00003000 ) >> 12) ++#define GET_TEST_14_ID (((REG32(ADR_PAD45)) & 0x10000000 ) >> 28) ++#define GET_PAD46_OE (((REG32(ADR_PAD46)) & 0x00000001 ) >> 0) ++#define GET_PAD46_PE (((REG32(ADR_PAD46)) & 0x00000002 ) >> 1) ++#define GET_PAD46_DS (((REG32(ADR_PAD46)) & 0x00000004 ) >> 2) ++#define GET_PAD46_IE (((REG32(ADR_PAD46)) & 0x00000008 ) >> 3) ++#define GET_PAD46_SEL_I (((REG32(ADR_PAD46)) & 0x00000030 ) >> 4) ++#define GET_PAD46_OD (((REG32(ADR_PAD46)) & 0x00000100 ) >> 8) ++#define GET_PAD46_SEL_O (((REG32(ADR_PAD46)) & 0x00003000 ) >> 12) ++#define GET_TEST_15_ID (((REG32(ADR_PAD46)) & 0x10000000 ) >> 28) ++#define GET_PAD47_OE (((REG32(ADR_PAD47)) & 0x00000001 ) >> 0) ++#define GET_PAD47_PE (((REG32(ADR_PAD47)) & 0x00000002 ) >> 1) ++#define GET_PAD47_DS (((REG32(ADR_PAD47)) & 0x00000004 ) >> 2) ++#define GET_PAD47_SEL_I (((REG32(ADR_PAD47)) & 0x00000030 ) >> 4) ++#define GET_PAD47_OD (((REG32(ADR_PAD47)) & 0x00000100 ) >> 8) ++#define GET_PAD47_SEL_O (((REG32(ADR_PAD47)) & 0x00003000 ) >> 12) ++#define GET_PAD47_SEL_OE (((REG32(ADR_PAD47)) & 0x00100000 ) >> 20) ++#define GET_GPIO_9_ID (((REG32(ADR_PAD47)) & 0x10000000 ) >> 28) ++#define GET_PAD48_OE (((REG32(ADR_PAD48)) & 0x00000001 ) >> 0) ++#define GET_PAD48_PE (((REG32(ADR_PAD48)) & 0x00000002 ) >> 1) ++#define GET_PAD48_DS (((REG32(ADR_PAD48)) & 0x00000004 ) >> 2) ++#define GET_PAD48_IE (((REG32(ADR_PAD48)) & 0x00000008 ) >> 3) ++#define GET_PAD48_SEL_I (((REG32(ADR_PAD48)) & 0x00000070 ) >> 4) ++#define GET_PAD48_OD (((REG32(ADR_PAD48)) & 0x00000100 ) >> 8) ++#define GET_PAD48_PE_SEL (((REG32(ADR_PAD48)) & 0x00000800 ) >> 11) ++#define GET_PAD48_SEL_O (((REG32(ADR_PAD48)) & 0x00003000 ) >> 12) ++#define GET_PAD48_SEL_OE (((REG32(ADR_PAD48)) & 0x00100000 ) >> 20) ++#define GET_GPIO_10_ID (((REG32(ADR_PAD48)) & 0x10000000 ) >> 28) ++#define GET_PAD49_OE (((REG32(ADR_PAD49)) & 0x00000001 ) >> 0) ++#define GET_PAD49_PE (((REG32(ADR_PAD49)) & 0x00000002 ) >> 1) ++#define GET_PAD49_DS (((REG32(ADR_PAD49)) & 0x00000004 ) >> 2) ++#define GET_PAD49_IE (((REG32(ADR_PAD49)) & 0x00000008 ) >> 3) ++#define GET_PAD49_SEL_I (((REG32(ADR_PAD49)) & 0x00000070 ) >> 4) ++#define GET_PAD49_OD (((REG32(ADR_PAD49)) & 0x00000100 ) >> 8) ++#define GET_PAD49_SEL_O (((REG32(ADR_PAD49)) & 0x00003000 ) >> 12) ++#define GET_PAD49_SEL_OE (((REG32(ADR_PAD49)) & 0x00100000 ) >> 20) ++#define GET_GPIO_11_ID (((REG32(ADR_PAD49)) & 0x10000000 ) >> 28) ++#define GET_PAD50_OE (((REG32(ADR_PAD50)) & 0x00000001 ) >> 0) ++#define GET_PAD50_PE (((REG32(ADR_PAD50)) & 0x00000002 ) >> 1) ++#define GET_PAD50_DS (((REG32(ADR_PAD50)) & 0x00000004 ) >> 2) ++#define GET_PAD50_IE (((REG32(ADR_PAD50)) & 0x00000008 ) >> 3) ++#define GET_PAD50_SEL_I (((REG32(ADR_PAD50)) & 0x00000070 ) >> 4) ++#define GET_PAD50_OD (((REG32(ADR_PAD50)) & 0x00000100 ) >> 8) ++#define GET_PAD50_SEL_O (((REG32(ADR_PAD50)) & 0x00003000 ) >> 12) ++#define GET_PAD50_SEL_OE (((REG32(ADR_PAD50)) & 0x00100000 ) >> 20) ++#define GET_GPIO_12_ID (((REG32(ADR_PAD50)) & 0x10000000 ) >> 28) ++#define GET_PAD51_OE (((REG32(ADR_PAD51)) & 0x00000001 ) >> 0) ++#define GET_PAD51_PE (((REG32(ADR_PAD51)) & 0x00000002 ) >> 1) ++#define GET_PAD51_DS (((REG32(ADR_PAD51)) & 0x00000004 ) >> 2) ++#define GET_PAD51_IE (((REG32(ADR_PAD51)) & 0x00000008 ) >> 3) ++#define GET_PAD51_SEL_I (((REG32(ADR_PAD51)) & 0x00000030 ) >> 4) ++#define GET_PAD51_OD (((REG32(ADR_PAD51)) & 0x00000100 ) >> 8) ++#define GET_PAD51_SEL_O (((REG32(ADR_PAD51)) & 0x00001000 ) >> 12) ++#define GET_PAD51_SEL_OE (((REG32(ADR_PAD51)) & 0x00100000 ) >> 20) ++#define GET_GPIO_13_ID (((REG32(ADR_PAD51)) & 0x10000000 ) >> 28) ++#define GET_PAD52_OE (((REG32(ADR_PAD52)) & 0x00000001 ) >> 0) ++#define GET_PAD52_PE (((REG32(ADR_PAD52)) & 0x00000002 ) >> 1) ++#define GET_PAD52_DS (((REG32(ADR_PAD52)) & 0x00000004 ) >> 2) ++#define GET_PAD52_SEL_I (((REG32(ADR_PAD52)) & 0x00000030 ) >> 4) ++#define GET_PAD52_OD (((REG32(ADR_PAD52)) & 0x00000100 ) >> 8) ++#define GET_PAD52_SEL_O (((REG32(ADR_PAD52)) & 0x00001000 ) >> 12) ++#define GET_PAD52_SEL_OE (((REG32(ADR_PAD52)) & 0x00100000 ) >> 20) ++#define GET_GPIO_14_ID (((REG32(ADR_PAD52)) & 0x10000000 ) >> 28) ++#define GET_PAD53_OE (((REG32(ADR_PAD53)) & 0x00000001 ) >> 0) ++#define GET_PAD53_PE (((REG32(ADR_PAD53)) & 0x00000002 ) >> 1) ++#define GET_PAD53_DS (((REG32(ADR_PAD53)) & 0x00000004 ) >> 2) ++#define GET_PAD53_IE (((REG32(ADR_PAD53)) & 0x00000008 ) >> 3) ++#define GET_PAD53_SEL_I (((REG32(ADR_PAD53)) & 0x00000030 ) >> 4) ++#define GET_PAD53_OD (((REG32(ADR_PAD53)) & 0x00000100 ) >> 8) ++#define GET_PAD53_SEL_O (((REG32(ADR_PAD53)) & 0x00001000 ) >> 12) ++#define GET_JTAG_TMS_ID (((REG32(ADR_PAD53)) & 0x10000000 ) >> 28) ++#define GET_PAD54_OE (((REG32(ADR_PAD54)) & 0x00000001 ) >> 0) ++#define GET_PAD54_PE (((REG32(ADR_PAD54)) & 0x00000002 ) >> 1) ++#define GET_PAD54_DS (((REG32(ADR_PAD54)) & 0x00000004 ) >> 2) ++#define GET_PAD54_OD (((REG32(ADR_PAD54)) & 0x00000100 ) >> 8) ++#define GET_PAD54_SEL_O (((REG32(ADR_PAD54)) & 0x00003000 ) >> 12) ++#define GET_JTAG_TCK_ID (((REG32(ADR_PAD54)) & 0x10000000 ) >> 28) ++#define GET_PAD56_PE (((REG32(ADR_PAD56)) & 0x00000002 ) >> 1) ++#define GET_PAD56_DS (((REG32(ADR_PAD56)) & 0x00000004 ) >> 2) ++#define GET_PAD56_SEL_I (((REG32(ADR_PAD56)) & 0x00000010 ) >> 4) ++#define GET_PAD56_OD (((REG32(ADR_PAD56)) & 0x00000100 ) >> 8) ++#define GET_JTAG_TDI_ID (((REG32(ADR_PAD56)) & 0x10000000 ) >> 28) ++#define GET_PAD57_OE (((REG32(ADR_PAD57)) & 0x00000001 ) >> 0) ++#define GET_PAD57_PE (((REG32(ADR_PAD57)) & 0x00000002 ) >> 1) ++#define GET_PAD57_DS (((REG32(ADR_PAD57)) & 0x00000004 ) >> 2) ++#define GET_PAD57_IE (((REG32(ADR_PAD57)) & 0x00000008 ) >> 3) ++#define GET_PAD57_SEL_I (((REG32(ADR_PAD57)) & 0x00000030 ) >> 4) ++#define GET_PAD57_OD (((REG32(ADR_PAD57)) & 0x00000100 ) >> 8) ++#define GET_PAD57_SEL_O (((REG32(ADR_PAD57)) & 0x00003000 ) >> 12) ++#define GET_PAD57_SEL_OE (((REG32(ADR_PAD57)) & 0x00100000 ) >> 20) ++#define GET_JTAG_TDO_ID (((REG32(ADR_PAD57)) & 0x10000000 ) >> 28) ++#define GET_PAD58_OE (((REG32(ADR_PAD58)) & 0x00000001 ) >> 0) ++#define GET_PAD58_PE (((REG32(ADR_PAD58)) & 0x00000002 ) >> 1) ++#define GET_PAD58_DS (((REG32(ADR_PAD58)) & 0x00000004 ) >> 2) ++#define GET_PAD58_IE (((REG32(ADR_PAD58)) & 0x00000008 ) >> 3) ++#define GET_PAD58_SEL_I (((REG32(ADR_PAD58)) & 0x00000030 ) >> 4) ++#define GET_PAD58_OD (((REG32(ADR_PAD58)) & 0x00000100 ) >> 8) ++#define GET_PAD58_SEL_O (((REG32(ADR_PAD58)) & 0x00001000 ) >> 12) ++#define GET_TEST_16_ID (((REG32(ADR_PAD58)) & 0x10000000 ) >> 28) ++#define GET_PAD59_OE (((REG32(ADR_PAD59)) & 0x00000001 ) >> 0) ++#define GET_PAD59_PE (((REG32(ADR_PAD59)) & 0x00000002 ) >> 1) ++#define GET_PAD59_DS (((REG32(ADR_PAD59)) & 0x00000004 ) >> 2) ++#define GET_PAD59_IE (((REG32(ADR_PAD59)) & 0x00000008 ) >> 3) ++#define GET_PAD59_SEL_I (((REG32(ADR_PAD59)) & 0x00000030 ) >> 4) ++#define GET_PAD59_OD (((REG32(ADR_PAD59)) & 0x00000100 ) >> 8) ++#define GET_PAD59_SEL_O (((REG32(ADR_PAD59)) & 0x00001000 ) >> 12) ++#define GET_TEST_17_ID (((REG32(ADR_PAD59)) & 0x10000000 ) >> 28) ++#define GET_PAD60_OE (((REG32(ADR_PAD60)) & 0x00000001 ) >> 0) ++#define GET_PAD60_PE (((REG32(ADR_PAD60)) & 0x00000002 ) >> 1) ++#define GET_PAD60_DS (((REG32(ADR_PAD60)) & 0x00000004 ) >> 2) ++#define GET_PAD60_IE (((REG32(ADR_PAD60)) & 0x00000008 ) >> 3) ++#define GET_PAD60_SEL_I (((REG32(ADR_PAD60)) & 0x00000030 ) >> 4) ++#define GET_PAD60_OD (((REG32(ADR_PAD60)) & 0x00000100 ) >> 8) ++#define GET_PAD60_SEL_O (((REG32(ADR_PAD60)) & 0x00001000 ) >> 12) ++#define GET_TEST_18_ID (((REG32(ADR_PAD60)) & 0x10000000 ) >> 28) ++#define GET_PAD61_OE (((REG32(ADR_PAD61)) & 0x00000001 ) >> 0) ++#define GET_PAD61_PE (((REG32(ADR_PAD61)) & 0x00000002 ) >> 1) ++#define GET_PAD61_DS (((REG32(ADR_PAD61)) & 0x00000004 ) >> 2) ++#define GET_PAD61_IE (((REG32(ADR_PAD61)) & 0x00000008 ) >> 3) ++#define GET_PAD61_SEL_I (((REG32(ADR_PAD61)) & 0x00000010 ) >> 4) ++#define GET_PAD61_OD (((REG32(ADR_PAD61)) & 0x00000100 ) >> 8) ++#define GET_PAD61_SEL_O (((REG32(ADR_PAD61)) & 0x00003000 ) >> 12) ++#define GET_TEST_19_ID (((REG32(ADR_PAD61)) & 0x10000000 ) >> 28) ++#define GET_PAD62_OE (((REG32(ADR_PAD62)) & 0x00000001 ) >> 0) ++#define GET_PAD62_PE (((REG32(ADR_PAD62)) & 0x00000002 ) >> 1) ++#define GET_PAD62_DS (((REG32(ADR_PAD62)) & 0x00000004 ) >> 2) ++#define GET_PAD62_IE (((REG32(ADR_PAD62)) & 0x00000008 ) >> 3) ++#define GET_PAD62_SEL_I (((REG32(ADR_PAD62)) & 0x00000010 ) >> 4) ++#define GET_PAD62_OD (((REG32(ADR_PAD62)) & 0x00000100 ) >> 8) ++#define GET_PAD62_SEL_O (((REG32(ADR_PAD62)) & 0x00001000 ) >> 12) ++#define GET_TEST_20_ID (((REG32(ADR_PAD62)) & 0x10000000 ) >> 28) ++#define GET_PAD64_OE (((REG32(ADR_PAD64)) & 0x00000001 ) >> 0) ++#define GET_PAD64_PE (((REG32(ADR_PAD64)) & 0x00000002 ) >> 1) ++#define GET_PAD64_DS (((REG32(ADR_PAD64)) & 0x00000004 ) >> 2) ++#define GET_PAD64_IE (((REG32(ADR_PAD64)) & 0x00000008 ) >> 3) ++#define GET_PAD64_SEL_I (((REG32(ADR_PAD64)) & 0x00000070 ) >> 4) ++#define GET_PAD64_OD (((REG32(ADR_PAD64)) & 0x00000100 ) >> 8) ++#define GET_PAD64_SEL_O (((REG32(ADR_PAD64)) & 0x00003000 ) >> 12) ++#define GET_PAD64_SEL_OE (((REG32(ADR_PAD64)) & 0x00100000 ) >> 20) ++#define GET_GPIO_15_IP_ID (((REG32(ADR_PAD64)) & 0x10000000 ) >> 28) ++#define GET_PAD65_OE (((REG32(ADR_PAD65)) & 0x00000001 ) >> 0) ++#define GET_PAD65_PE (((REG32(ADR_PAD65)) & 0x00000002 ) >> 1) ++#define GET_PAD65_DS (((REG32(ADR_PAD65)) & 0x00000004 ) >> 2) ++#define GET_PAD65_IE (((REG32(ADR_PAD65)) & 0x00000008 ) >> 3) ++#define GET_PAD65_SEL_I (((REG32(ADR_PAD65)) & 0x00000070 ) >> 4) ++#define GET_PAD65_OD (((REG32(ADR_PAD65)) & 0x00000100 ) >> 8) ++#define GET_PAD65_SEL_O (((REG32(ADR_PAD65)) & 0x00001000 ) >> 12) ++#define GET_GPIO_TEST_7_IN_ID (((REG32(ADR_PAD65)) & 0x10000000 ) >> 28) ++#define GET_PAD66_OE (((REG32(ADR_PAD66)) & 0x00000001 ) >> 0) ++#define GET_PAD66_PE (((REG32(ADR_PAD66)) & 0x00000002 ) >> 1) ++#define GET_PAD66_DS (((REG32(ADR_PAD66)) & 0x00000004 ) >> 2) ++#define GET_PAD66_IE (((REG32(ADR_PAD66)) & 0x00000008 ) >> 3) ++#define GET_PAD66_SEL_I (((REG32(ADR_PAD66)) & 0x00000030 ) >> 4) ++#define GET_PAD66_OD (((REG32(ADR_PAD66)) & 0x00000100 ) >> 8) ++#define GET_PAD66_SEL_O (((REG32(ADR_PAD66)) & 0x00003000 ) >> 12) ++#define GET_GPIO_17_QP_ID (((REG32(ADR_PAD66)) & 0x10000000 ) >> 28) ++#define GET_PAD68_OE (((REG32(ADR_PAD68)) & 0x00000001 ) >> 0) ++#define GET_PAD68_PE (((REG32(ADR_PAD68)) & 0x00000002 ) >> 1) ++#define GET_PAD68_DS (((REG32(ADR_PAD68)) & 0x00000004 ) >> 2) ++#define GET_PAD68_IE (((REG32(ADR_PAD68)) & 0x00000008 ) >> 3) ++#define GET_PAD68_OD (((REG32(ADR_PAD68)) & 0x00000100 ) >> 8) ++#define GET_PAD68_SEL_O (((REG32(ADR_PAD68)) & 0x00001000 ) >> 12) ++#define GET_GPIO_19_ID (((REG32(ADR_PAD68)) & 0x10000000 ) >> 28) ++#define GET_PAD67_OE (((REG32(ADR_PAD67)) & 0x00000001 ) >> 0) ++#define GET_PAD67_PE (((REG32(ADR_PAD67)) & 0x00000002 ) >> 1) ++#define GET_PAD67_DS (((REG32(ADR_PAD67)) & 0x00000004 ) >> 2) ++#define GET_PAD67_IE (((REG32(ADR_PAD67)) & 0x00000008 ) >> 3) ++#define GET_PAD67_SEL_I (((REG32(ADR_PAD67)) & 0x00000070 ) >> 4) ++#define GET_PAD67_OD (((REG32(ADR_PAD67)) & 0x00000100 ) >> 8) ++#define GET_PAD67_SEL_O (((REG32(ADR_PAD67)) & 0x00003000 ) >> 12) ++#define GET_GPIO_TEST_8_QN_ID (((REG32(ADR_PAD67)) & 0x10000000 ) >> 28) ++#define GET_PAD69_OE (((REG32(ADR_PAD69)) & 0x00000001 ) >> 0) ++#define GET_PAD69_PE (((REG32(ADR_PAD69)) & 0x00000002 ) >> 1) ++#define GET_PAD69_DS (((REG32(ADR_PAD69)) & 0x00000004 ) >> 2) ++#define GET_PAD69_IE (((REG32(ADR_PAD69)) & 0x00000008 ) >> 3) ++#define GET_PAD69_SEL_I (((REG32(ADR_PAD69)) & 0x00000030 ) >> 4) ++#define GET_PAD69_OD (((REG32(ADR_PAD69)) & 0x00000100 ) >> 8) ++#define GET_PAD69_SEL_O (((REG32(ADR_PAD69)) & 0x00001000 ) >> 12) ++#define GET_STRAP2 (((REG32(ADR_PAD69)) & 0x08000000 ) >> 27) ++#define GET_GPIO_20_ID (((REG32(ADR_PAD69)) & 0x10000000 ) >> 28) ++#define GET_PAD70_OE (((REG32(ADR_PAD70)) & 0x00000001 ) >> 0) ++#define GET_PAD70_PE (((REG32(ADR_PAD70)) & 0x00000002 ) >> 1) ++#define GET_PAD70_DS (((REG32(ADR_PAD70)) & 0x00000004 ) >> 2) ++#define GET_PAD70_IE (((REG32(ADR_PAD70)) & 0x00000008 ) >> 3) ++#define GET_PAD70_SEL_I (((REG32(ADR_PAD70)) & 0x00000030 ) >> 4) ++#define GET_PAD70_OD (((REG32(ADR_PAD70)) & 0x00000100 ) >> 8) ++#define GET_PAD70_SEL_O (((REG32(ADR_PAD70)) & 0x00007000 ) >> 12) ++#define GET_GPIO_21_ID (((REG32(ADR_PAD70)) & 0x10000000 ) >> 28) ++#define GET_PAD231_OE (((REG32(ADR_PAD231)) & 0x00000001 ) >> 0) ++#define GET_PAD231_PE (((REG32(ADR_PAD231)) & 0x00000002 ) >> 1) ++#define GET_PAD231_DS (((REG32(ADR_PAD231)) & 0x00000004 ) >> 2) ++#define GET_PAD231_IE (((REG32(ADR_PAD231)) & 0x00000008 ) >> 3) ++#define GET_PAD231_OD (((REG32(ADR_PAD231)) & 0x00000100 ) >> 8) ++#define GET_PIN_40_OR_56_ID (((REG32(ADR_PAD231)) & 0x10000000 ) >> 28) ++#define GET_MP_PHY2RX_DATA__0_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000001 ) >> 0) ++#define GET_MP_PHY2RX_DATA__1_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000002 ) >> 1) ++#define GET_MP_TX_FF_RPTR__1_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000004 ) >> 2) ++#define GET_MP_RX_FF_WPTR__2_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000008 ) >> 3) ++#define GET_MP_RX_FF_WPTR__1_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000010 ) >> 4) ++#define GET_MP_RX_FF_WPTR__0_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000020 ) >> 5) ++#define GET_MP_PHY2RX_DATA__2_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000040 ) >> 6) ++#define GET_MP_PHY2RX_DATA__4_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000080 ) >> 7) ++#define GET_I2CM_SDA_ID_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000300 ) >> 8) ++#define GET_CRYSTAL_OUT_REQ_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000400 ) >> 10) ++#define GET_MP_PHY2RX_DATA__5_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00000800 ) >> 11) ++#define GET_MP_PHY2RX_DATA__3_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00001000 ) >> 12) ++#define GET_UART_RXD_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00006000 ) >> 13) ++#define GET_MP_PHY2RX_DATA__6_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00008000 ) >> 15) ++#define GET_DAT_UART_NCTS_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00010000 ) >> 16) ++#define GET_GPIO_LOG_STOP_SEL (((REG32(ADR_PIN_SEL_0)) & 0x000e0000 ) >> 17) ++#define GET_MP_TX_FF_RPTR__0_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00100000 ) >> 20) ++#define GET_MP_PHY_RX_WRST_N_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00200000 ) >> 21) ++#define GET_EXT_32K_SEL (((REG32(ADR_PIN_SEL_0)) & 0x00c00000 ) >> 22) ++#define GET_MP_PHY2RX_DATA__7_SEL (((REG32(ADR_PIN_SEL_0)) & 0x01000000 ) >> 24) ++#define GET_MP_TX_FF_RPTR__2_SEL (((REG32(ADR_PIN_SEL_0)) & 0x02000000 ) >> 25) ++#define GET_PMUINT_WAKE_SEL (((REG32(ADR_PIN_SEL_0)) & 0x1c000000 ) >> 26) ++#define GET_I2CM_SCL_ID_SEL (((REG32(ADR_PIN_SEL_0)) & 0x20000000 ) >> 29) ++#define GET_MP_MRX_RX_EN_SEL (((REG32(ADR_PIN_SEL_0)) & 0x40000000 ) >> 30) ++#define GET_DAT_UART_RXD_SEL_0 (((REG32(ADR_PIN_SEL_0)) & 0x80000000 ) >> 31) ++#define GET_DAT_UART_RXD_SEL_1 (((REG32(ADR_PIN_SEL_1)) & 0x00000001 ) >> 0) ++#define GET_SPI_DI_SEL (((REG32(ADR_PIN_SEL_1)) & 0x00000002 ) >> 1) ++#define GET_IO_PORT_REG (((REG32(ADR_IO_PORT_REG)) & 0x0001ffff ) >> 0) ++#define GET_MASK_RX_INT (((REG32(ADR_INT_MASK_REG)) & 0x00000001 ) >> 0) ++#define GET_MASK_TX_INT (((REG32(ADR_INT_MASK_REG)) & 0x00000002 ) >> 1) ++#define GET_MASK_SOC_SYSTEM_INT (((REG32(ADR_INT_MASK_REG)) & 0x00000004 ) >> 2) ++#define GET_EDCA0_LOW_THR_INT_MASK (((REG32(ADR_INT_MASK_REG)) & 0x00000008 ) >> 3) ++#define GET_EDCA1_LOW_THR_INT_MASK (((REG32(ADR_INT_MASK_REG)) & 0x00000010 ) >> 4) ++#define GET_EDCA2_LOW_THR_INT_MASK (((REG32(ADR_INT_MASK_REG)) & 0x00000020 ) >> 5) ++#define GET_EDCA3_LOW_THR_INT_MASK (((REG32(ADR_INT_MASK_REG)) & 0x00000040 ) >> 6) ++#define GET_TX_LIMIT_INT_MASK (((REG32(ADR_INT_MASK_REG)) & 0x00000080 ) >> 7) ++#define GET_RX_INT (((REG32(ADR_INT_STATUS_REG)) & 0x00000001 ) >> 0) ++#define GET_TX_COMPLETE_INT (((REG32(ADR_INT_STATUS_REG)) & 0x00000002 ) >> 1) ++#define GET_SOC_SYSTEM_INT_STATUS (((REG32(ADR_INT_STATUS_REG)) & 0x00000004 ) >> 2) ++#define GET_EDCA0_LOW_THR_INT_STS (((REG32(ADR_INT_STATUS_REG)) & 0x00000008 ) >> 3) ++#define GET_EDCA1_LOW_THR_INT_STS (((REG32(ADR_INT_STATUS_REG)) & 0x00000010 ) >> 4) ++#define GET_EDCA2_LOW_THR_INT_STS (((REG32(ADR_INT_STATUS_REG)) & 0x00000020 ) >> 5) ++#define GET_EDCA3_LOW_THR_INT_STS (((REG32(ADR_INT_STATUS_REG)) & 0x00000040 ) >> 6) ++#define GET_TX_LIMIT_INT_STS (((REG32(ADR_INT_STATUS_REG)) & 0x00000080 ) >> 7) ++#define GET_HOST_TRIGGERED_RX_INT (((REG32(ADR_INT_STATUS_REG)) & 0x00000100 ) >> 8) ++#define GET_HOST_TRIGGERED_TX_INT (((REG32(ADR_INT_STATUS_REG)) & 0x00000200 ) >> 9) ++#define GET_SOC_TRIGGER_RX_INT (((REG32(ADR_INT_STATUS_REG)) & 0x00000400 ) >> 10) ++#define GET_SOC_TRIGGER_TX_INT (((REG32(ADR_INT_STATUS_REG)) & 0x00000800 ) >> 11) ++#define GET_RDY_FOR_TX_RX (((REG32(ADR_FN1_STATUS_REG)) & 0x00000001 ) >> 0) ++#define GET_RDY_FOR_FW_DOWNLOAD (((REG32(ADR_FN1_STATUS_REG)) & 0x00000002 ) >> 1) ++#define GET_ILLEGAL_CMD_RESP_OPTION (((REG32(ADR_FN1_STATUS_REG)) & 0x00000004 ) >> 2) ++#define GET_SDIO_TRX_DATA_SEQUENCE (((REG32(ADR_FN1_STATUS_REG)) & 0x00000008 ) >> 3) ++#define GET_GPIO_INT_TRIGGER_OPTION (((REG32(ADR_FN1_STATUS_REG)) & 0x00000010 ) >> 4) ++#define GET_TRIGGER_FUNCTION_SETTING (((REG32(ADR_FN1_STATUS_REG)) & 0x00000060 ) >> 5) ++#define GET_CMD52_ABORT_RESPONSE (((REG32(ADR_FN1_STATUS_REG)) & 0x00000080 ) >> 7) ++#define GET_RX_PACKET_LENGTH (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x0000ffff ) >> 0) ++#define GET_CARD_FW_DL_STATUS (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x00ff0000 ) >> 16) ++#define GET_TX_RX_LOOP_BACK_TEST (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x01000000 ) >> 24) ++#define GET_SDIO_LOOP_BACK_TEST (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x02000000 ) >> 25) ++#define GET_CMD52_ABORT_ACTIVE (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x10000000 ) >> 28) ++#define GET_CMD52_RESET_ACTIVE (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x20000000 ) >> 29) ++#define GET_SDIO_PARTIAL_RESET_ACTIVE (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x40000000 ) >> 30) ++#define GET_SDIO_ALL_RESE_ACTIVE (((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x80000000 ) >> 31) ++#define GET_RX_PACKET_LENGTH2 (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x0000ffff ) >> 0) ++#define GET_RX_INT1 (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x00010000 ) >> 16) ++#define GET_TX_DONE (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x00020000 ) >> 17) ++#define GET_HCI_TRX_FINISH (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x00040000 ) >> 18) ++#define GET_ALLOCATE_STATUS (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x00080000 ) >> 19) ++#define GET_HCI_INPUT_FF_CNT (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x00f00000 ) >> 20) ++#define GET_HCI_OUTPUT_FF_CNT (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x1f000000 ) >> 24) ++#define GET_AHB_HANG4 (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x20000000 ) >> 29) ++#define GET_HCI_IN_QUE_EMPTY (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x40000000 ) >> 30) ++#define GET_SYSTEM_INT (((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x80000000 ) >> 31) ++#define GET_CARD_RCA_REG (((REG32(ADR_CARD_RCA_REG)) & 0x0000ffff ) >> 0) ++#define GET_SDIO_FIFO_WR_THLD_REG (((REG32(ADR_SDIO_FIFO_WR_THLD_REG)) & 0x000001ff ) >> 0) ++#define GET_SDIO_FIFO_WR_LIMIT_REG (((REG32(ADR_SDIO_FIFO_WR_LIMIT_REG)) & 0x000001ff ) >> 0) ++#define GET_SDIO_TX_DATA_BATCH_SIZE_REG (((REG32(ADR_SDIO_TX_DATA_BATCH_SIZE_REG)) & 0x000001ff ) >> 0) ++#define GET_SDIO_THLD_FOR_CMD53RD_REG (((REG32(ADR_SDIO_THLD_FOR_CMD53RD_REG)) & 0x000001ff ) >> 0) ++#define GET_SDIO_RX_DATA_BATCH_SIZE_REG (((REG32(ADR_SDIO_RX_DATA_BATCH_SIZE_REG)) & 0x000001ff ) >> 0) ++#define GET_START_BYTE_VALUE (((REG32(ADR_SDIO_LOG_START_END_DATA_REG)) & 0x000000ff ) >> 0) ++#define GET_END_BYTE_VALUE (((REG32(ADR_SDIO_LOG_START_END_DATA_REG)) & 0x0000ff00 ) >> 8) ++#define GET_SDIO_BYTE_MODE_BATCH_SIZE_REG (((REG32(ADR_SDIO_BYTE_MODE_BATCH_SIZE_REG)) & 0x000000ff ) >> 0) ++#define GET_SDIO_LAST_CMD_INDEX_REG (((REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) & 0x0000003f ) >> 0) ++#define GET_SDIO_LAST_CMD_CRC_REG (((REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) & 0x00007f00 ) >> 8) ++#define GET_SDIO_LAST_CMD_ARG_REG (((REG32(ADR_SDIO_LAST_CMD_ARG_REG)) & 0xffffffff ) >> 0) ++#define GET_SDIO_BUS_STATE_REG (((REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) & 0x0000001f ) >> 0) ++#define GET_SDIO_BUSY_LONG_CNT (((REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) & 0xffff0000 ) >> 16) ++#define GET_SDIO_CARD_STATUS_REG (((REG32(ADR_SDIO_CARD_STATUS_REG)) & 0xffffffff ) >> 0) ++#define GET_R5_RESPONSE_FLAG (((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0x000000ff ) >> 0) ++#define GET_RESP_OUT_EDGE (((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0x00000100 ) >> 8) ++#define GET_DAT_OUT_EDGE (((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0x00000200 ) >> 9) ++#define GET_MCU_TO_SDIO_INFO_MASK (((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0x00010000 ) >> 16) ++#define GET_INT_THROUGH_PIN (((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0x00020000 ) >> 17) ++#define GET_WRITE_DATA (((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0x000000ff ) >> 0) ++#define GET_WRITE_ADDRESS (((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0x0000ff00 ) >> 8) ++#define GET_READ_DATA (((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0x00ff0000 ) >> 16) ++#define GET_READ_ADDRESS (((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0xff000000 ) >> 24) ++#define GET_FN1_DMA_START_ADDR_REG (((REG32(ADR_FN1_DMA_START_ADDR_REG)) & 0xffffffff ) >> 0) ++#define GET_SDIO_TO_MCU_INFO (((REG32(ADR_FN1_INT_CTRL_RESET)) & 0x000000ff ) >> 0) ++#define GET_SDIO_PARTIAL_RESET (((REG32(ADR_FN1_INT_CTRL_RESET)) & 0x00000100 ) >> 8) ++#define GET_SDIO_ALL_RESET (((REG32(ADR_FN1_INT_CTRL_RESET)) & 0x00000200 ) >> 9) ++#define GET_PERI_MAC_ALL_RESET (((REG32(ADR_FN1_INT_CTRL_RESET)) & 0x00000400 ) >> 10) ++#define GET_MAC_ALL_RESET (((REG32(ADR_FN1_INT_CTRL_RESET)) & 0x00000800 ) >> 11) ++#define GET_AHB_BRIDGE_RESET (((REG32(ADR_FN1_INT_CTRL_RESET)) & 0x00001000 ) >> 12) ++#define GET_IO_REG_PORT_REG (((REG32(ADR_IO_REG_PORT_REG)) & 0x0001ffff ) >> 0) ++#define GET_SDIO_FIFO_EMPTY_CNT (((REG32(ADR_SDIO_FIFO_ERROR_CNT)) & 0x0000ffff ) >> 0) ++#define GET_SDIO_FIFO_FULL_CNT (((REG32(ADR_SDIO_FIFO_ERROR_CNT)) & 0xffff0000 ) >> 16) ++#define GET_SDIO_CRC7_ERROR_CNT (((REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) & 0x0000ffff ) >> 0) ++#define GET_SDIO_CRC16_ERROR_CNT (((REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) & 0xffff0000 ) >> 16) ++#define GET_SDIO_RD_BLOCK_CNT (((REG32(ADR_SDIO_BLOCK_CNT_INFO)) & 0x000001ff ) >> 0) ++#define GET_SDIO_WR_BLOCK_CNT (((REG32(ADR_SDIO_BLOCK_CNT_INFO)) & 0x01ff0000 ) >> 16) ++#define GET_CMD52_RD_ABORT_CNT (((REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) & 0x000f0000 ) >> 16) ++#define GET_CMD52_WR_ABORT_CNT (((REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) & 0x00f00000 ) >> 20) ++#define GET_SDIO_FIFO_WR_PTR_REG (((REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) & 0x000000ff ) >> 0) ++#define GET_SDIO_FIFO_RD_PTR_REG (((REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) & 0x0000ff00 ) >> 8) ++#define GET_SDIO_READ_DATA_CTRL (((REG32(ADR_TX_TIME_OUT_READ_CTRL)) & 0x00010000 ) >> 16) ++#define GET_TX_SIZE_BEFORE_SHIFT (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x000000ff ) >> 0) ++#define GET_TX_SIZE_SHIFT_BITS (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00000700 ) >> 8) ++#define GET_SDIO_TX_ALLOC_STATE (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00001000 ) >> 12) ++#define GET_ALLOCATE_STATUS2 (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00010000 ) >> 16) ++#define GET_NO_ALLOCATE_SEND_ERROR (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00020000 ) >> 17) ++#define GET_DOUBLE_ALLOCATE_ERROR (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00040000 ) >> 18) ++#define GET_TX_DONE_STATUS (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00080000 ) >> 19) ++#define GET_AHB_HANG2 (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00100000 ) >> 20) ++#define GET_HCI_TRX_FINISH2 (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00200000 ) >> 21) ++#define GET_INTR_RX (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00400000 ) >> 22) ++#define GET_HCI_INPUT_QUEUE_FULL (((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0x00800000 ) >> 23) ++#define GET_ALLOCATESTATUS (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000001 ) >> 0) ++#define GET_HCI_TRX_FINISH3 (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000002 ) >> 1) ++#define GET_HCI_IN_QUE_EMPTY2 (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000004 ) >> 2) ++#define GET_MTX_MNG_UPTHOLD_INT (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000008 ) >> 3) ++#define GET_EDCA0_UPTHOLD_INT (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000010 ) >> 4) ++#define GET_EDCA1_UPTHOLD_INT (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000020 ) >> 5) ++#define GET_EDCA2_UPTHOLD_INT (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000040 ) >> 6) ++#define GET_EDCA3_UPTHOLD_INT (((REG32(ADR_SDIO_TX_INFORM)) & 0x00000080 ) >> 7) ++#define GET_TX_PAGE_REMAIN2 (((REG32(ADR_SDIO_TX_INFORM)) & 0x0000ff00 ) >> 8) ++#define GET_TX_ID_REMAIN3 (((REG32(ADR_SDIO_TX_INFORM)) & 0x007f0000 ) >> 16) ++#define GET_HCI_OUTPUT_FF_CNT_0 (((REG32(ADR_SDIO_TX_INFORM)) & 0x00800000 ) >> 23) ++#define GET_HCI_OUTPUT_FF_CNT2 (((REG32(ADR_SDIO_TX_INFORM)) & 0x0f000000 ) >> 24) ++#define GET_HCI_INPUT_FF_CNT2 (((REG32(ADR_SDIO_TX_INFORM)) & 0xf0000000 ) >> 28) ++#define GET_F1_BLOCK_SIZE_0_REG (((REG32(ADR_F1_BLOCK_SIZE_0_REG)) & 0x00000fff ) >> 0) ++#define GET_START_BYTE_VALUE2 (((REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) & 0x000000ff ) >> 0) ++#define GET_COMMAND_COUNTER (((REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) & 0x0000ff00 ) >> 8) ++#define GET_CMD_LOG_PART1 (((REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) & 0xffff0000 ) >> 16) ++#define GET_CMD_LOG_PART2 (((REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) & 0x00ffffff ) >> 0) ++#define GET_END_BYTE_VALUE2 (((REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) & 0xff000000 ) >> 24) ++#define GET_RX_PACKET_LENGTH3 (((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0x0000ffff ) >> 0) ++#define GET_RX_INT3 (((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0x00010000 ) >> 16) ++#define GET_TX_ID_REMAIN2 (((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0x00fe0000 ) >> 17) ++#define GET_TX_PAGE_REMAIN3 (((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0xff000000 ) >> 24) ++#define GET_CCCR_00H_REG (((REG32(ADR_CCCR_00H_REG)) & 0x000000ff ) >> 0) ++#define GET_CCCR_02H_REG (((REG32(ADR_CCCR_00H_REG)) & 0x00ff0000 ) >> 16) ++#define GET_CCCR_03H_REG (((REG32(ADR_CCCR_00H_REG)) & 0xff000000 ) >> 24) ++#define GET_CCCR_04H_REG (((REG32(ADR_CCCR_04H_REG)) & 0x000000ff ) >> 0) ++#define GET_CCCR_05H_REG (((REG32(ADR_CCCR_04H_REG)) & 0x0000ff00 ) >> 8) ++#define GET_CCCR_06H_REG (((REG32(ADR_CCCR_04H_REG)) & 0x000f0000 ) >> 16) ++#define GET_CCCR_07H_REG (((REG32(ADR_CCCR_04H_REG)) & 0xff000000 ) >> 24) ++#define GET_SUPPORT_DIRECT_COMMAND_SDIO (((REG32(ADR_CCCR_08H_REG)) & 0x00000001 ) >> 0) ++#define GET_SUPPORT_MULTIPLE_BLOCK_TRANSFER (((REG32(ADR_CCCR_08H_REG)) & 0x00000002 ) >> 1) ++#define GET_SUPPORT_READ_WAIT (((REG32(ADR_CCCR_08H_REG)) & 0x00000004 ) >> 2) ++#define GET_SUPPORT_BUS_CONTROL (((REG32(ADR_CCCR_08H_REG)) & 0x00000008 ) >> 3) ++#define GET_SUPPORT_BLOCK_GAP_INTERRUPT (((REG32(ADR_CCCR_08H_REG)) & 0x00000010 ) >> 4) ++#define GET_ENABLE_BLOCK_GAP_INTERRUPT (((REG32(ADR_CCCR_08H_REG)) & 0x00000020 ) >> 5) ++#define GET_LOW_SPEED_CARD (((REG32(ADR_CCCR_08H_REG)) & 0x00000040 ) >> 6) ++#define GET_LOW_SPEED_CARD_4BIT (((REG32(ADR_CCCR_08H_REG)) & 0x00000080 ) >> 7) ++#define GET_COMMON_CIS_PONTER (((REG32(ADR_CCCR_08H_REG)) & 0x01ffff00 ) >> 8) ++#define GET_SUPPORT_HIGH_SPEED (((REG32(ADR_CCCR_13H_REG)) & 0x01000000 ) >> 24) ++#define GET_BSS (((REG32(ADR_CCCR_13H_REG)) & 0x0e000000 ) >> 25) ++#define GET_FBR_100H_REG (((REG32(ADR_FBR_100H_REG)) & 0x0000000f ) >> 0) ++#define GET_CSASUPPORT (((REG32(ADR_FBR_100H_REG)) & 0x00000040 ) >> 6) ++#define GET_ENABLECSA (((REG32(ADR_FBR_100H_REG)) & 0x00000080 ) >> 7) ++#define GET_FBR_101H_REG (((REG32(ADR_FBR_100H_REG)) & 0x0000ff00 ) >> 8) ++#define GET_FBR_109H_REG (((REG32(ADR_FBR_109H_REG)) & 0x01ffff00 ) >> 8) ++#define GET_F0_CIS_CONTENT_REG_31_0 (((REG32(ADR_F0_CIS_CONTENT_REG_0)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_63_32 (((REG32(ADR_F0_CIS_CONTENT_REG_1)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_95_64 (((REG32(ADR_F0_CIS_CONTENT_REG_2)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_127_96 (((REG32(ADR_F0_CIS_CONTENT_REG_3)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_159_128 (((REG32(ADR_F0_CIS_CONTENT_REG_4)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_191_160 (((REG32(ADR_F0_CIS_CONTENT_REG_5)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_223_192 (((REG32(ADR_F0_CIS_CONTENT_REG_6)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_255_224 (((REG32(ADR_F0_CIS_CONTENT_REG_7)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_287_256 (((REG32(ADR_F0_CIS_CONTENT_REG_8)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_319_288 (((REG32(ADR_F0_CIS_CONTENT_REG_9)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_351_320 (((REG32(ADR_F0_CIS_CONTENT_REG_10)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_383_352 (((REG32(ADR_F0_CIS_CONTENT_REG_11)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_415_384 (((REG32(ADR_F0_CIS_CONTENT_REG_12)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_447_416 (((REG32(ADR_F0_CIS_CONTENT_REG_13)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_479_448 (((REG32(ADR_F0_CIS_CONTENT_REG_14)) & 0xffffffff ) >> 0) ++#define GET_F0_CIS_CONTENT_REG_511_480 (((REG32(ADR_F0_CIS_CONTENT_REG_15)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_31_0 (((REG32(ADR_F1_CIS_CONTENT_REG_0)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_63_32 (((REG32(ADR_F1_CIS_CONTENT_REG_1)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_95_64 (((REG32(ADR_F1_CIS_CONTENT_REG_2)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_127_96 (((REG32(ADR_F1_CIS_CONTENT_REG_3)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_159_128 (((REG32(ADR_F1_CIS_CONTENT_REG_4)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_191_160 (((REG32(ADR_F1_CIS_CONTENT_REG_5)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_223_192 (((REG32(ADR_F1_CIS_CONTENT_REG_6)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_255_224 (((REG32(ADR_F1_CIS_CONTENT_REG_7)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_287_256 (((REG32(ADR_F1_CIS_CONTENT_REG_8)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_319_288 (((REG32(ADR_F1_CIS_CONTENT_REG_9)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_351_320 (((REG32(ADR_F1_CIS_CONTENT_REG_10)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_383_352 (((REG32(ADR_F1_CIS_CONTENT_REG_11)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_415_384 (((REG32(ADR_F1_CIS_CONTENT_REG_12)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_447_416 (((REG32(ADR_F1_CIS_CONTENT_REG_13)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_479_448 (((REG32(ADR_F1_CIS_CONTENT_REG_14)) & 0xffffffff ) >> 0) ++#define GET_F1_CIS_CONTENT_REG_511_480 (((REG32(ADR_F1_CIS_CONTENT_REG_15)) & 0xffffffff ) >> 0) ++#define GET_SPI_MODE (((REG32(ADR_SPI_MODE)) & 0xffffffff ) >> 0) ++#define GET_RX_QUOTA (((REG32(ADR_RX_QUOTA)) & 0x0000ffff ) >> 0) ++#define GET_CONDI_NUM (((REG32(ADR_CONDITION_NUMBER)) & 0x000000ff ) >> 0) ++#define GET_HOST_PATH (((REG32(ADR_HOST_PATH)) & 0x00000001 ) >> 0) ++#define GET_TX_SEG (((REG32(ADR_TX_SEG)) & 0xffffffff ) >> 0) ++#define GET_BRST_MODE (((REG32(ADR_DEBUG_BURST_MODE)) & 0x00000001 ) >> 0) ++#define GET_CLK_WIDTH (((REG32(ADR_SPI_TO_PHY_PARAM1)) & 0x0000ffff ) >> 0) ++#define GET_CSN_INTER (((REG32(ADR_SPI_TO_PHY_PARAM1)) & 0xffff0000 ) >> 16) ++#define GET_BACK_DLY (((REG32(ADR_SPI_TO_PHY_PARAM2)) & 0x0000ffff ) >> 0) ++#define GET_FRONT_DLY (((REG32(ADR_SPI_TO_PHY_PARAM2)) & 0xffff0000 ) >> 16) ++#define GET_RX_FIFO_FAIL (((REG32(ADR_SPI_STS)) & 0x00000002 ) >> 1) ++#define GET_RX_HOST_FAIL (((REG32(ADR_SPI_STS)) & 0x00000004 ) >> 2) ++#define GET_TX_FIFO_FAIL (((REG32(ADR_SPI_STS)) & 0x00000008 ) >> 3) ++#define GET_TX_HOST_FAIL (((REG32(ADR_SPI_STS)) & 0x00000010 ) >> 4) ++#define GET_SPI_DOUBLE_ALLOC (((REG32(ADR_SPI_STS)) & 0x00000020 ) >> 5) ++#define GET_SPI_TX_NO_ALLOC (((REG32(ADR_SPI_STS)) & 0x00000040 ) >> 6) ++#define GET_RDATA_RDY (((REG32(ADR_SPI_STS)) & 0x00000080 ) >> 7) ++#define GET_SPI_ALLOC_STATUS (((REG32(ADR_SPI_STS)) & 0x00000100 ) >> 8) ++#define GET_SPI_DBG_WR_FIFO_FULL (((REG32(ADR_SPI_STS)) & 0x00000200 ) >> 9) ++#define GET_RX_LEN (((REG32(ADR_SPI_STS)) & 0xffff0000 ) >> 16) ++#define GET_SPI_TX_ALLOC_SIZE_SHIFT_BITS (((REG32(ADR_TX_ALLOC_SET)) & 0x00000007 ) >> 0) ++#define GET_SPI_HOST_TX_ALLOC_PKBUF (((REG32(ADR_TX_ALLOC_SET)) & 0x00000100 ) >> 8) ++#define GET_SPI_TX_ALLOC_SIZE (((REG32(ADR_TX_ALLOC)) & 0x000000ff ) >> 0) ++#define GET_RD_DAT_CNT (((REG32(ADR_DBG_CNT)) & 0x0000ffff ) >> 0) ++#define GET_RD_STS_CNT (((REG32(ADR_DBG_CNT)) & 0xffff0000 ) >> 16) ++#define GET_JUDGE_CNT (((REG32(ADR_DBG_CNT2)) & 0x0000ffff ) >> 0) ++#define GET_RD_STS_CNT_CLR (((REG32(ADR_DBG_CNT2)) & 0x00010000 ) >> 16) ++#define GET_RD_DAT_CNT_CLR (((REG32(ADR_DBG_CNT2)) & 0x00020000 ) >> 17) ++#define GET_JUDGE_CNT_CLR (((REG32(ADR_DBG_CNT2)) & 0x00040000 ) >> 18) ++#define GET_TX_DONE_CNT (((REG32(ADR_DBG_CNT3)) & 0x0000ffff ) >> 0) ++#define GET_TX_DISCARD_CNT (((REG32(ADR_DBG_CNT3)) & 0xffff0000 ) >> 16) ++#define GET_TX_SET_CNT (((REG32(ADR_DBG_CNT4)) & 0x0000ffff ) >> 0) ++#define GET_TX_DISCARD_CNT_CLR (((REG32(ADR_DBG_CNT4)) & 0x00010000 ) >> 16) ++#define GET_TX_DONE_CNT_CLR (((REG32(ADR_DBG_CNT4)) & 0x00020000 ) >> 17) ++#define GET_TX_SET_CNT_CLR (((REG32(ADR_DBG_CNT4)) & 0x00040000 ) >> 18) ++#define GET_DAT_MODE_OFF (((REG32(ADR_DBG_CNT4)) & 0x00080000 ) >> 19) ++#define GET_TX_FIFO_RESIDUE (((REG32(ADR_DBG_CNT4)) & 0x00700000 ) >> 20) ++#define GET_RX_FIFO_RESIDUE (((REG32(ADR_DBG_CNT4)) & 0x07000000 ) >> 24) ++#define GET_RX_RDY (((REG32(ADR_INT_TAG)) & 0x00000001 ) >> 0) ++#define GET_SDIO_SYS_INT (((REG32(ADR_INT_TAG)) & 0x00000004 ) >> 2) ++#define GET_EDCA0_LOWTHOLD_INT (((REG32(ADR_INT_TAG)) & 0x00000008 ) >> 3) ++#define GET_EDCA1_LOWTHOLD_INT (((REG32(ADR_INT_TAG)) & 0x00000010 ) >> 4) ++#define GET_EDCA2_LOWTHOLD_INT (((REG32(ADR_INT_TAG)) & 0x00000020 ) >> 5) ++#define GET_EDCA3_LOWTHOLD_INT (((REG32(ADR_INT_TAG)) & 0x00000040 ) >> 6) ++#define GET_TX_LIMIT_INT_IN (((REG32(ADR_INT_TAG)) & 0x00000080 ) >> 7) ++#define GET_SPI_FN1 (((REG32(ADR_INT_TAG)) & 0x00007f00 ) >> 8) ++#define GET_SPI_CLK_EN_INT (((REG32(ADR_INT_TAG)) & 0x00008000 ) >> 15) ++#define GET_SPI_HOST_MASK (((REG32(ADR_INT_TAG)) & 0x00ff0000 ) >> 16) ++#define GET_I2CM_INT_WDONE (((REG32(ADR_I2CM_EN)) & 0x00000001 ) >> 0) ++#define GET_I2CM_INT_RDONE (((REG32(ADR_I2CM_EN)) & 0x00000002 ) >> 1) ++#define GET_I2CM_IDLE (((REG32(ADR_I2CM_EN)) & 0x00000004 ) >> 2) ++#define GET_I2CM_INT_MISMATCH (((REG32(ADR_I2CM_EN)) & 0x00000008 ) >> 3) ++#define GET_I2CM_PSCL (((REG32(ADR_I2CM_EN)) & 0x00003ff0 ) >> 4) ++#define GET_I2CM_MANUAL_MODE (((REG32(ADR_I2CM_EN)) & 0x00010000 ) >> 16) ++#define GET_I2CM_INT_WDATA_NEED (((REG32(ADR_I2CM_EN)) & 0x00020000 ) >> 17) ++#define GET_I2CM_INT_RDATA_NEED (((REG32(ADR_I2CM_EN)) & 0x00040000 ) >> 18) ++#define GET_I2CM_DEV_A (((REG32(ADR_I2CM_DEV_A)) & 0x000003ff ) >> 0) ++#define GET_I2CM_DEV_A10B (((REG32(ADR_I2CM_DEV_A)) & 0x00004000 ) >> 14) ++#define GET_I2CM_RX (((REG32(ADR_I2CM_DEV_A)) & 0x00008000 ) >> 15) ++#define GET_I2CM_LEN (((REG32(ADR_I2CM_LEN)) & 0x0000ffff ) >> 0) ++#define GET_I2CM_T_LEFT (((REG32(ADR_I2CM_LEN)) & 0x00070000 ) >> 16) ++#define GET_I2CM_R_GET (((REG32(ADR_I2CM_LEN)) & 0x07000000 ) >> 24) ++#define GET_I2CM_WDAT (((REG32(ADR_I2CM_WDAT)) & 0xffffffff ) >> 0) ++#define GET_I2CM_RDAT (((REG32(ADR_I2CM_RDAT)) & 0xffffffff ) >> 0) ++#define GET_I2CM_SR_LEN (((REG32(ADR_I2CM_EN_2)) & 0x0000ffff ) >> 0) ++#define GET_I2CM_SR_RX (((REG32(ADR_I2CM_EN_2)) & 0x00010000 ) >> 16) ++#define GET_I2CM_REPEAT_START (((REG32(ADR_I2CM_EN_2)) & 0x00020000 ) >> 17) ++#define GET_UART_DATA (((REG32(ADR_UART_DATA)) & 0x000000ff ) >> 0) ++#define GET_DATA_RDY_IE (((REG32(ADR_UART_IER)) & 0x00000001 ) >> 0) ++#define GET_THR_EMPTY_IE (((REG32(ADR_UART_IER)) & 0x00000002 ) >> 1) ++#define GET_RX_LINESTS_IE (((REG32(ADR_UART_IER)) & 0x00000004 ) >> 2) ++#define GET_MDM_STS_IE (((REG32(ADR_UART_IER)) & 0x00000008 ) >> 3) ++#define GET_DMA_RXEND_IE (((REG32(ADR_UART_IER)) & 0x00000040 ) >> 6) ++#define GET_DMA_TXEND_IE (((REG32(ADR_UART_IER)) & 0x00000080 ) >> 7) ++#define GET_FIFO_EN (((REG32(ADR_UART_FCR)) & 0x00000001 ) >> 0) ++#define GET_RXFIFO_RST (((REG32(ADR_UART_FCR)) & 0x00000002 ) >> 1) ++#define GET_TXFIFO_RST (((REG32(ADR_UART_FCR)) & 0x00000004 ) >> 2) ++#define GET_DMA_MODE (((REG32(ADR_UART_FCR)) & 0x00000008 ) >> 3) ++#define GET_EN_AUTO_RTS (((REG32(ADR_UART_FCR)) & 0x00000010 ) >> 4) ++#define GET_EN_AUTO_CTS (((REG32(ADR_UART_FCR)) & 0x00000020 ) >> 5) ++#define GET_RXFIFO_TRGLVL (((REG32(ADR_UART_FCR)) & 0x000000c0 ) >> 6) ++#define GET_WORD_LEN (((REG32(ADR_UART_LCR)) & 0x00000003 ) >> 0) ++#define GET_STOP_BIT (((REG32(ADR_UART_LCR)) & 0x00000004 ) >> 2) ++#define GET_PARITY_EN (((REG32(ADR_UART_LCR)) & 0x00000008 ) >> 3) ++#define GET_EVEN_PARITY (((REG32(ADR_UART_LCR)) & 0x00000010 ) >> 4) ++#define GET_FORCE_PARITY (((REG32(ADR_UART_LCR)) & 0x00000020 ) >> 5) ++#define GET_SET_BREAK (((REG32(ADR_UART_LCR)) & 0x00000040 ) >> 6) ++#define GET_DLAB (((REG32(ADR_UART_LCR)) & 0x00000080 ) >> 7) ++#define GET_DTR (((REG32(ADR_UART_MCR)) & 0x00000001 ) >> 0) ++#define GET_RTS (((REG32(ADR_UART_MCR)) & 0x00000002 ) >> 1) ++#define GET_OUT_1 (((REG32(ADR_UART_MCR)) & 0x00000004 ) >> 2) ++#define GET_OUT_2 (((REG32(ADR_UART_MCR)) & 0x00000008 ) >> 3) ++#define GET_LOOP_BACK (((REG32(ADR_UART_MCR)) & 0x00000010 ) >> 4) ++#define GET_DATA_RDY (((REG32(ADR_UART_LSR)) & 0x00000001 ) >> 0) ++#define GET_OVERRUN_ERR (((REG32(ADR_UART_LSR)) & 0x00000002 ) >> 1) ++#define GET_PARITY_ERR (((REG32(ADR_UART_LSR)) & 0x00000004 ) >> 2) ++#define GET_FRAMING_ERR (((REG32(ADR_UART_LSR)) & 0x00000008 ) >> 3) ++#define GET_BREAK_INT (((REG32(ADR_UART_LSR)) & 0x00000010 ) >> 4) ++#define GET_THR_EMPTY (((REG32(ADR_UART_LSR)) & 0x00000020 ) >> 5) ++#define GET_TX_EMPTY (((REG32(ADR_UART_LSR)) & 0x00000040 ) >> 6) ++#define GET_FIFODATA_ERR (((REG32(ADR_UART_LSR)) & 0x00000080 ) >> 7) ++#define GET_DELTA_CTS (((REG32(ADR_UART_MSR)) & 0x00000001 ) >> 0) ++#define GET_DELTA_DSR (((REG32(ADR_UART_MSR)) & 0x00000002 ) >> 1) ++#define GET_TRAILEDGE_RI (((REG32(ADR_UART_MSR)) & 0x00000004 ) >> 2) ++#define GET_DELTA_CD (((REG32(ADR_UART_MSR)) & 0x00000008 ) >> 3) ++#define GET_CTS (((REG32(ADR_UART_MSR)) & 0x00000010 ) >> 4) ++#define GET_DSR (((REG32(ADR_UART_MSR)) & 0x00000020 ) >> 5) ++#define GET_RI (((REG32(ADR_UART_MSR)) & 0x00000040 ) >> 6) ++#define GET_CD (((REG32(ADR_UART_MSR)) & 0x00000080 ) >> 7) ++#define GET_BRDC_DIV (((REG32(ADR_UART_SPR)) & 0x0000ffff ) >> 0) ++#define GET_RTHR_L (((REG32(ADR_UART_RTHR)) & 0x0000000f ) >> 0) ++#define GET_RTHR_H (((REG32(ADR_UART_RTHR)) & 0x000000f0 ) >> 4) ++#define GET_INT_IDCODE (((REG32(ADR_UART_ISR)) & 0x0000000f ) >> 0) ++#define GET_FIFOS_ENABLED (((REG32(ADR_UART_ISR)) & 0x000000c0 ) >> 6) ++#define GET_DAT_UART_DATA (((REG32(ADR_DAT_UART_DATA)) & 0x000000ff ) >> 0) ++#define GET_DAT_DATA_RDY_IE (((REG32(ADR_DAT_UART_IER)) & 0x00000001 ) >> 0) ++#define GET_DAT_THR_EMPTY_IE (((REG32(ADR_DAT_UART_IER)) & 0x00000002 ) >> 1) ++#define GET_DAT_RX_LINESTS_IE (((REG32(ADR_DAT_UART_IER)) & 0x00000004 ) >> 2) ++#define GET_DAT_MDM_STS_IE (((REG32(ADR_DAT_UART_IER)) & 0x00000008 ) >> 3) ++#define GET_DAT_DMA_RXEND_IE (((REG32(ADR_DAT_UART_IER)) & 0x00000040 ) >> 6) ++#define GET_DAT_DMA_TXEND_IE (((REG32(ADR_DAT_UART_IER)) & 0x00000080 ) >> 7) ++#define GET_DAT_FIFO_EN (((REG32(ADR_DAT_UART_FCR)) & 0x00000001 ) >> 0) ++#define GET_DAT_RXFIFO_RST (((REG32(ADR_DAT_UART_FCR)) & 0x00000002 ) >> 1) ++#define GET_DAT_TXFIFO_RST (((REG32(ADR_DAT_UART_FCR)) & 0x00000004 ) >> 2) ++#define GET_DAT_DMA_MODE (((REG32(ADR_DAT_UART_FCR)) & 0x00000008 ) >> 3) ++#define GET_DAT_EN_AUTO_RTS (((REG32(ADR_DAT_UART_FCR)) & 0x00000010 ) >> 4) ++#define GET_DAT_EN_AUTO_CTS (((REG32(ADR_DAT_UART_FCR)) & 0x00000020 ) >> 5) ++#define GET_DAT_RXFIFO_TRGLVL (((REG32(ADR_DAT_UART_FCR)) & 0x000000c0 ) >> 6) ++#define GET_DAT_WORD_LEN (((REG32(ADR_DAT_UART_LCR)) & 0x00000003 ) >> 0) ++#define GET_DAT_STOP_BIT (((REG32(ADR_DAT_UART_LCR)) & 0x00000004 ) >> 2) ++#define GET_DAT_PARITY_EN (((REG32(ADR_DAT_UART_LCR)) & 0x00000008 ) >> 3) ++#define GET_DAT_EVEN_PARITY (((REG32(ADR_DAT_UART_LCR)) & 0x00000010 ) >> 4) ++#define GET_DAT_FORCE_PARITY (((REG32(ADR_DAT_UART_LCR)) & 0x00000020 ) >> 5) ++#define GET_DAT_SET_BREAK (((REG32(ADR_DAT_UART_LCR)) & 0x00000040 ) >> 6) ++#define GET_DAT_DLAB (((REG32(ADR_DAT_UART_LCR)) & 0x00000080 ) >> 7) ++#define GET_DAT_DTR (((REG32(ADR_DAT_UART_MCR)) & 0x00000001 ) >> 0) ++#define GET_DAT_RTS (((REG32(ADR_DAT_UART_MCR)) & 0x00000002 ) >> 1) ++#define GET_DAT_OUT_1 (((REG32(ADR_DAT_UART_MCR)) & 0x00000004 ) >> 2) ++#define GET_DAT_OUT_2 (((REG32(ADR_DAT_UART_MCR)) & 0x00000008 ) >> 3) ++#define GET_DAT_LOOP_BACK (((REG32(ADR_DAT_UART_MCR)) & 0x00000010 ) >> 4) ++#define GET_DAT_DATA_RDY (((REG32(ADR_DAT_UART_LSR)) & 0x00000001 ) >> 0) ++#define GET_DAT_OVERRUN_ERR (((REG32(ADR_DAT_UART_LSR)) & 0x00000002 ) >> 1) ++#define GET_DAT_PARITY_ERR (((REG32(ADR_DAT_UART_LSR)) & 0x00000004 ) >> 2) ++#define GET_DAT_FRAMING_ERR (((REG32(ADR_DAT_UART_LSR)) & 0x00000008 ) >> 3) ++#define GET_DAT_BREAK_INT (((REG32(ADR_DAT_UART_LSR)) & 0x00000010 ) >> 4) ++#define GET_DAT_THR_EMPTY (((REG32(ADR_DAT_UART_LSR)) & 0x00000020 ) >> 5) ++#define GET_DAT_TX_EMPTY (((REG32(ADR_DAT_UART_LSR)) & 0x00000040 ) >> 6) ++#define GET_DAT_FIFODATA_ERR (((REG32(ADR_DAT_UART_LSR)) & 0x00000080 ) >> 7) ++#define GET_DAT_DELTA_CTS (((REG32(ADR_DAT_UART_MSR)) & 0x00000001 ) >> 0) ++#define GET_DAT_DELTA_DSR (((REG32(ADR_DAT_UART_MSR)) & 0x00000002 ) >> 1) ++#define GET_DAT_TRAILEDGE_RI (((REG32(ADR_DAT_UART_MSR)) & 0x00000004 ) >> 2) ++#define GET_DAT_DELTA_CD (((REG32(ADR_DAT_UART_MSR)) & 0x00000008 ) >> 3) ++#define GET_DAT_CTS (((REG32(ADR_DAT_UART_MSR)) & 0x00000010 ) >> 4) ++#define GET_DAT_DSR (((REG32(ADR_DAT_UART_MSR)) & 0x00000020 ) >> 5) ++#define GET_DAT_RI (((REG32(ADR_DAT_UART_MSR)) & 0x00000040 ) >> 6) ++#define GET_DAT_CD (((REG32(ADR_DAT_UART_MSR)) & 0x00000080 ) >> 7) ++#define GET_DAT_BRDC_DIV (((REG32(ADR_DAT_UART_SPR)) & 0x0000ffff ) >> 0) ++#define GET_DAT_RTHR_L (((REG32(ADR_DAT_UART_RTHR)) & 0x0000000f ) >> 0) ++#define GET_DAT_RTHR_H (((REG32(ADR_DAT_UART_RTHR)) & 0x000000f0 ) >> 4) ++#define GET_DAT_INT_IDCODE (((REG32(ADR_DAT_UART_ISR)) & 0x0000000f ) >> 0) ++#define GET_DAT_FIFOS_ENABLED (((REG32(ADR_DAT_UART_ISR)) & 0x000000c0 ) >> 6) ++#define GET_MASK_TOP (((REG32(ADR_INT_MASK)) & 0xffffffff ) >> 0) ++#define GET_INT_MODE (((REG32(ADR_INT_MODE)) & 0xffffffff ) >> 0) ++#define GET_IRQ_PHY_0 (((REG32(ADR_INT_IRQ_STS)) & 0x00000001 ) >> 0) ++#define GET_IRQ_PHY_1 (((REG32(ADR_INT_IRQ_STS)) & 0x00000002 ) >> 1) ++#define GET_IRQ_SDIO (((REG32(ADR_INT_IRQ_STS)) & 0x00000004 ) >> 2) ++#define GET_IRQ_BEACON_DONE (((REG32(ADR_INT_IRQ_STS)) & 0x00000008 ) >> 3) ++#define GET_IRQ_BEACON (((REG32(ADR_INT_IRQ_STS)) & 0x00000010 ) >> 4) ++#define GET_IRQ_PRE_BEACON (((REG32(ADR_INT_IRQ_STS)) & 0x00000020 ) >> 5) ++#define GET_IRQ_EDCA0_TX_DONE (((REG32(ADR_INT_IRQ_STS)) & 0x00000040 ) >> 6) ++#define GET_IRQ_EDCA1_TX_DONE (((REG32(ADR_INT_IRQ_STS)) & 0x00000080 ) >> 7) ++#define GET_IRQ_EDCA2_TX_DONE (((REG32(ADR_INT_IRQ_STS)) & 0x00000100 ) >> 8) ++#define GET_IRQ_EDCA3_TX_DONE (((REG32(ADR_INT_IRQ_STS)) & 0x00000200 ) >> 9) ++#define GET_IRQ_EDCA4_TX_DONE (((REG32(ADR_INT_IRQ_STS)) & 0x00000400 ) >> 10) ++#define GET_IRQ_BEACON_DTIM (((REG32(ADR_INT_IRQ_STS)) & 0x00001000 ) >> 12) ++#define GET_IRQ_EDCA0_LOWTHOLD_INT (((REG32(ADR_INT_IRQ_STS)) & 0x00002000 ) >> 13) ++#define GET_IRQ_EDCA1_LOWTHOLD_INT (((REG32(ADR_INT_IRQ_STS)) & 0x00004000 ) >> 14) ++#define GET_IRQ_EDCA2_LOWTHOLD_INT (((REG32(ADR_INT_IRQ_STS)) & 0x00008000 ) >> 15) ++#define GET_IRQ_EDCA3_LOWTHOLD_INT (((REG32(ADR_INT_IRQ_STS)) & 0x00010000 ) >> 16) ++#define GET_IRQ_FENCE_HIT_INT (((REG32(ADR_INT_IRQ_STS)) & 0x00020000 ) >> 17) ++#define GET_IRQ_ILL_ADDR_INT (((REG32(ADR_INT_IRQ_STS)) & 0x00040000 ) >> 18) ++#define GET_IRQ_MBOX (((REG32(ADR_INT_IRQ_STS)) & 0x00080000 ) >> 19) ++#define GET_IRQ_US_TIMER0 (((REG32(ADR_INT_IRQ_STS)) & 0x00100000 ) >> 20) ++#define GET_IRQ_US_TIMER1 (((REG32(ADR_INT_IRQ_STS)) & 0x00200000 ) >> 21) ++#define GET_IRQ_US_TIMER2 (((REG32(ADR_INT_IRQ_STS)) & 0x00400000 ) >> 22) ++#define GET_IRQ_US_TIMER3 (((REG32(ADR_INT_IRQ_STS)) & 0x00800000 ) >> 23) ++#define GET_IRQ_MS_TIMER0 (((REG32(ADR_INT_IRQ_STS)) & 0x01000000 ) >> 24) ++#define GET_IRQ_MS_TIMER1 (((REG32(ADR_INT_IRQ_STS)) & 0x02000000 ) >> 25) ++#define GET_IRQ_MS_TIMER2 (((REG32(ADR_INT_IRQ_STS)) & 0x04000000 ) >> 26) ++#define GET_IRQ_MS_TIMER3 (((REG32(ADR_INT_IRQ_STS)) & 0x08000000 ) >> 27) ++#define GET_IRQ_TX_LIMIT_INT (((REG32(ADR_INT_IRQ_STS)) & 0x10000000 ) >> 28) ++#define GET_IRQ_DMA0 (((REG32(ADR_INT_IRQ_STS)) & 0x20000000 ) >> 29) ++#define GET_IRQ_CO_DMA (((REG32(ADR_INT_IRQ_STS)) & 0x40000000 ) >> 30) ++#define GET_IRQ_PERI_GROUP (((REG32(ADR_INT_IRQ_STS)) & 0x80000000 ) >> 31) ++#define GET_FIQ_STATUS (((REG32(ADR_INT_FIQ_STS)) & 0xffffffff ) >> 0) ++#define GET_IRQ_RAW (((REG32(ADR_INT_IRQ_RAW)) & 0xffffffff ) >> 0) ++#define GET_FIQ_RAW (((REG32(ADR_INT_FIQ_RAW)) & 0xffffffff ) >> 0) ++#define GET_INT_PERI_MASK (((REG32(ADR_INT_PERI_MASK)) & 0xffffffff ) >> 0) ++#define GET_PERI_RTC (((REG32(ADR_INT_PERI_STS)) & 0x00000001 ) >> 0) ++#define GET_IRQ_UART0_TX (((REG32(ADR_INT_PERI_STS)) & 0x00000002 ) >> 1) ++#define GET_IRQ_UART0_RX (((REG32(ADR_INT_PERI_STS)) & 0x00000004 ) >> 2) ++#define GET_PERI_GPI_2 (((REG32(ADR_INT_PERI_STS)) & 0x00000008 ) >> 3) ++#define GET_IRQ_SPI_IPC (((REG32(ADR_INT_PERI_STS)) & 0x00000010 ) >> 4) ++#define GET_PERI_GPI_1_0 (((REG32(ADR_INT_PERI_STS)) & 0x00000060 ) >> 5) ++#define GET_SCRT_INT_1 (((REG32(ADR_INT_PERI_STS)) & 0x00000080 ) >> 7) ++#define GET_MMU_ALC_ERR (((REG32(ADR_INT_PERI_STS)) & 0x00000100 ) >> 8) ++#define GET_MMU_RLS_ERR (((REG32(ADR_INT_PERI_STS)) & 0x00000200 ) >> 9) ++#define GET_ID_MNG_INT_1 (((REG32(ADR_INT_PERI_STS)) & 0x00000400 ) >> 10) ++#define GET_MBOX_INT_1 (((REG32(ADR_INT_PERI_STS)) & 0x00000800 ) >> 11) ++#define GET_MBOX_INT_2 (((REG32(ADR_INT_PERI_STS)) & 0x00001000 ) >> 12) ++#define GET_MBOX_INT_3 (((REG32(ADR_INT_PERI_STS)) & 0x00002000 ) >> 13) ++#define GET_HCI_INT_1 (((REG32(ADR_INT_PERI_STS)) & 0x00004000 ) >> 14) ++#define GET_UART_RX_TIMEOUT (((REG32(ADR_INT_PERI_STS)) & 0x00008000 ) >> 15) ++#define GET_UART_MULTI_IRQ (((REG32(ADR_INT_PERI_STS)) & 0x00010000 ) >> 16) ++#define GET_ID_MNG_INT_2 (((REG32(ADR_INT_PERI_STS)) & 0x00020000 ) >> 17) ++#define GET_DMN_NOHIT_INT (((REG32(ADR_INT_PERI_STS)) & 0x00040000 ) >> 18) ++#define GET_ID_THOLD_RX (((REG32(ADR_INT_PERI_STS)) & 0x00080000 ) >> 19) ++#define GET_ID_THOLD_TX (((REG32(ADR_INT_PERI_STS)) & 0x00100000 ) >> 20) ++#define GET_ID_DOUBLE_RLS (((REG32(ADR_INT_PERI_STS)) & 0x00200000 ) >> 21) ++#define GET_RX_ID_LEN_THOLD (((REG32(ADR_INT_PERI_STS)) & 0x00400000 ) >> 22) ++#define GET_TX_ID_LEN_THOLD (((REG32(ADR_INT_PERI_STS)) & 0x00800000 ) >> 23) ++#define GET_ALL_ID_LEN_THOLD (((REG32(ADR_INT_PERI_STS)) & 0x01000000 ) >> 24) ++#define GET_DMN_MCU_INT (((REG32(ADR_INT_PERI_STS)) & 0x02000000 ) >> 25) ++#define GET_IRQ_DAT_UART_TX (((REG32(ADR_INT_PERI_STS)) & 0x04000000 ) >> 26) ++#define GET_IRQ_DAT_UART_RX (((REG32(ADR_INT_PERI_STS)) & 0x08000000 ) >> 27) ++#define GET_DAT_UART_RX_TIMEOUT (((REG32(ADR_INT_PERI_STS)) & 0x10000000 ) >> 28) ++#define GET_DAT_UART_MULTI_IRQ (((REG32(ADR_INT_PERI_STS)) & 0x20000000 ) >> 29) ++#define GET_ALR_ABT_NOCHG_INT_IRQ (((REG32(ADR_INT_PERI_STS)) & 0x40000000 ) >> 30) ++#define GET_TBLNEQ_MNGPKT_INT_IRQ (((REG32(ADR_INT_PERI_STS)) & 0x80000000 ) >> 31) ++#define GET_INTR_PERI_RAW (((REG32(ADR_INT_PERI_RAW)) & 0xffffffff ) >> 0) ++#define GET_INTR_GPI00_CFG (((REG32(ADR_INT_GPI_CFG)) & 0x00000003 ) >> 0) ++#define GET_INTR_GPI01_CFG (((REG32(ADR_INT_GPI_CFG)) & 0x0000000c ) >> 2) ++#define GET_SYS_RST_INT (((REG32(ADR_SYS_INT_FOR_HOST)) & 0x00000001 ) >> 0) ++#define GET_SPI_IPC_ADDR (((REG32(ADR_SPI_IPC)) & 0xffffffff ) >> 0) ++#define GET_SD_MASK_TOP (((REG32(ADR_SDIO_MASK)) & 0xffffffff ) >> 0) ++#define GET_IRQ_PHY_0_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000001 ) >> 0) ++#define GET_IRQ_PHY_1_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000002 ) >> 1) ++#define GET_IRQ_SDIO_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000004 ) >> 2) ++#define GET_IRQ_BEACON_DONE_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000008 ) >> 3) ++#define GET_IRQ_BEACON_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000010 ) >> 4) ++#define GET_IRQ_PRE_BEACON_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000020 ) >> 5) ++#define GET_IRQ_EDCA0_TX_DONE_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000040 ) >> 6) ++#define GET_IRQ_EDCA1_TX_DONE_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000080 ) >> 7) ++#define GET_IRQ_EDCA2_TX_DONE_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000100 ) >> 8) ++#define GET_IRQ_EDCA3_TX_DONE_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000200 ) >> 9) ++#define GET_IRQ_EDCA4_TX_DONE_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00000400 ) >> 10) ++#define GET_IRQ_BEACON_DTIM_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00001000 ) >> 12) ++#define GET_IRQ_EDCA0_LOWTHOLD_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00002000 ) >> 13) ++#define GET_IRQ_EDCA1_LOWTHOLD_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00004000 ) >> 14) ++#define GET_IRQ_EDCA2_LOWTHOLD_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00008000 ) >> 15) ++#define GET_IRQ_EDCA3_LOWTHOLD_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00010000 ) >> 16) ++#define GET_IRQ_FENCE_HIT_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00020000 ) >> 17) ++#define GET_IRQ_ILL_ADDR_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00040000 ) >> 18) ++#define GET_IRQ_MBOX_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00080000 ) >> 19) ++#define GET_IRQ_US_TIMER0_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00100000 ) >> 20) ++#define GET_IRQ_US_TIMER1_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00200000 ) >> 21) ++#define GET_IRQ_US_TIMER2_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00400000 ) >> 22) ++#define GET_IRQ_US_TIMER3_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x00800000 ) >> 23) ++#define GET_IRQ_MS_TIMER0_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x01000000 ) >> 24) ++#define GET_IRQ_MS_TIMER1_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x02000000 ) >> 25) ++#define GET_IRQ_MS_TIMER2_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x04000000 ) >> 26) ++#define GET_IRQ_MS_TIMER3_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x08000000 ) >> 27) ++#define GET_IRQ_TX_LIMIT_INT_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x10000000 ) >> 28) ++#define GET_IRQ_DMA0_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x20000000 ) >> 29) ++#define GET_IRQ_CO_DMA_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x40000000 ) >> 30) ++#define GET_IRQ_PERI_GROUP_SD (((REG32(ADR_SDIO_IRQ_STS)) & 0x80000000 ) >> 31) ++#define GET_INT_PERI_MASK_SD (((REG32(ADR_SD_PERI_MASK)) & 0xffffffff ) >> 0) ++#define GET_PERI_RTC_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000001 ) >> 0) ++#define GET_IRQ_UART0_TX_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000002 ) >> 1) ++#define GET_IRQ_UART0_RX_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000004 ) >> 2) ++#define GET_PERI_GPI_SD_2 (((REG32(ADR_SD_PERI_STS)) & 0x00000008 ) >> 3) ++#define GET_IRQ_SPI_IPC_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000010 ) >> 4) ++#define GET_PERI_GPI_SD_1_0 (((REG32(ADR_SD_PERI_STS)) & 0x00000060 ) >> 5) ++#define GET_SCRT_INT_1_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000080 ) >> 7) ++#define GET_MMU_ALC_ERR_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000100 ) >> 8) ++#define GET_MMU_RLS_ERR_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000200 ) >> 9) ++#define GET_ID_MNG_INT_1_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000400 ) >> 10) ++#define GET_MBOX_INT_1_SD (((REG32(ADR_SD_PERI_STS)) & 0x00000800 ) >> 11) ++#define GET_MBOX_INT_2_SD (((REG32(ADR_SD_PERI_STS)) & 0x00001000 ) >> 12) ++#define GET_MBOX_INT_3_SD (((REG32(ADR_SD_PERI_STS)) & 0x00002000 ) >> 13) ++#define GET_HCI_INT_1_SD (((REG32(ADR_SD_PERI_STS)) & 0x00004000 ) >> 14) ++#define GET_UART_RX_TIMEOUT_SD (((REG32(ADR_SD_PERI_STS)) & 0x00008000 ) >> 15) ++#define GET_UART_MULTI_IRQ_SD (((REG32(ADR_SD_PERI_STS)) & 0x00010000 ) >> 16) ++#define GET_ID_MNG_INT_2_SD (((REG32(ADR_SD_PERI_STS)) & 0x00020000 ) >> 17) ++#define GET_DMN_NOHIT_INT_SD (((REG32(ADR_SD_PERI_STS)) & 0x00040000 ) >> 18) ++#define GET_ID_THOLD_RX_SD (((REG32(ADR_SD_PERI_STS)) & 0x00080000 ) >> 19) ++#define GET_ID_THOLD_TX_SD (((REG32(ADR_SD_PERI_STS)) & 0x00100000 ) >> 20) ++#define GET_ID_DOUBLE_RLS_SD (((REG32(ADR_SD_PERI_STS)) & 0x00200000 ) >> 21) ++#define GET_RX_ID_LEN_THOLD_SD (((REG32(ADR_SD_PERI_STS)) & 0x00400000 ) >> 22) ++#define GET_TX_ID_LEN_THOLD_SD (((REG32(ADR_SD_PERI_STS)) & 0x00800000 ) >> 23) ++#define GET_ALL_ID_LEN_THOLD_SD (((REG32(ADR_SD_PERI_STS)) & 0x01000000 ) >> 24) ++#define GET_DMN_MCU_INT_SD (((REG32(ADR_SD_PERI_STS)) & 0x02000000 ) >> 25) ++#define GET_IRQ_DAT_UART_TX_SD (((REG32(ADR_SD_PERI_STS)) & 0x04000000 ) >> 26) ++#define GET_IRQ_DAT_UART_RX_SD (((REG32(ADR_SD_PERI_STS)) & 0x08000000 ) >> 27) ++#define GET_DAT_UART_RX_TIMEOUT_SD (((REG32(ADR_SD_PERI_STS)) & 0x10000000 ) >> 28) ++#define GET_DAT_UART_MULTI_IRQ_SD (((REG32(ADR_SD_PERI_STS)) & 0x20000000 ) >> 29) ++#define GET_ALR_ABT_NOCHG_INT_IRQ_SD (((REG32(ADR_SD_PERI_STS)) & 0x40000000 ) >> 30) ++#define GET_TBLNEQ_MNGPKT_INT_IRQ_SD (((REG32(ADR_SD_PERI_STS)) & 0x80000000 ) >> 31) ++#define GET_DBG_SPI_MODE (((REG32(ADR_DBG_SPI_MODE)) & 0xffffffff ) >> 0) ++#define GET_DBG_RX_QUOTA (((REG32(ADR_DBG_RX_QUOTA)) & 0x0000ffff ) >> 0) ++#define GET_DBG_CONDI_NUM (((REG32(ADR_DBG_CONDITION_NUMBER)) & 0x000000ff ) >> 0) ++#define GET_DBG_HOST_PATH (((REG32(ADR_DBG_HOST_PATH)) & 0x00000001 ) >> 0) ++#define GET_DBG_TX_SEG (((REG32(ADR_DBG_TX_SEG)) & 0xffffffff ) >> 0) ++#define GET_DBG_BRST_MODE (((REG32(ADR_DBG_DEBUG_BURST_MODE)) & 0x00000001 ) >> 0) ++#define GET_DBG_CLK_WIDTH (((REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) & 0x0000ffff ) >> 0) ++#define GET_DBG_CSN_INTER (((REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) & 0xffff0000 ) >> 16) ++#define GET_DBG_BACK_DLY (((REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) & 0x0000ffff ) >> 0) ++#define GET_DBG_FRONT_DLY (((REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) & 0xffff0000 ) >> 16) ++#define GET_DBG_RX_FIFO_FAIL (((REG32(ADR_DBG_SPI_STS)) & 0x00000002 ) >> 1) ++#define GET_DBG_RX_HOST_FAIL (((REG32(ADR_DBG_SPI_STS)) & 0x00000004 ) >> 2) ++#define GET_DBG_TX_FIFO_FAIL (((REG32(ADR_DBG_SPI_STS)) & 0x00000008 ) >> 3) ++#define GET_DBG_TX_HOST_FAIL (((REG32(ADR_DBG_SPI_STS)) & 0x00000010 ) >> 4) ++#define GET_DBG_SPI_DOUBLE_ALLOC (((REG32(ADR_DBG_SPI_STS)) & 0x00000020 ) >> 5) ++#define GET_DBG_SPI_TX_NO_ALLOC (((REG32(ADR_DBG_SPI_STS)) & 0x00000040 ) >> 6) ++#define GET_DBG_RDATA_RDY (((REG32(ADR_DBG_SPI_STS)) & 0x00000080 ) >> 7) ++#define GET_DBG_SPI_ALLOC_STATUS (((REG32(ADR_DBG_SPI_STS)) & 0x00000100 ) >> 8) ++#define GET_DBG_SPI_DBG_WR_FIFO_FULL (((REG32(ADR_DBG_SPI_STS)) & 0x00000200 ) >> 9) ++#define GET_DBG_RX_LEN (((REG32(ADR_DBG_SPI_STS)) & 0xffff0000 ) >> 16) ++#define GET_DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS (((REG32(ADR_DBG_TX_ALLOC_SET)) & 0x00000007 ) >> 0) ++#define GET_DBG_SPI_HOST_TX_ALLOC_PKBUF (((REG32(ADR_DBG_TX_ALLOC_SET)) & 0x00000100 ) >> 8) ++#define GET_DBG_SPI_TX_ALLOC_SIZE (((REG32(ADR_DBG_TX_ALLOC)) & 0x000000ff ) >> 0) ++#define GET_DBG_RD_DAT_CNT (((REG32(ADR_DBG_DBG_CNT)) & 0x0000ffff ) >> 0) ++#define GET_DBG_RD_STS_CNT (((REG32(ADR_DBG_DBG_CNT)) & 0xffff0000 ) >> 16) ++#define GET_DBG_JUDGE_CNT (((REG32(ADR_DBG_DBG_CNT2)) & 0x0000ffff ) >> 0) ++#define GET_DBG_RD_STS_CNT_CLR (((REG32(ADR_DBG_DBG_CNT2)) & 0x00010000 ) >> 16) ++#define GET_DBG_RD_DAT_CNT_CLR (((REG32(ADR_DBG_DBG_CNT2)) & 0x00020000 ) >> 17) ++#define GET_DBG_JUDGE_CNT_CLR (((REG32(ADR_DBG_DBG_CNT2)) & 0x00040000 ) >> 18) ++#define GET_DBG_TX_DONE_CNT (((REG32(ADR_DBG_DBG_CNT3)) & 0x0000ffff ) >> 0) ++#define GET_DBG_TX_DISCARD_CNT (((REG32(ADR_DBG_DBG_CNT3)) & 0xffff0000 ) >> 16) ++#define GET_DBG_TX_SET_CNT (((REG32(ADR_DBG_DBG_CNT4)) & 0x0000ffff ) >> 0) ++#define GET_DBG_TX_DISCARD_CNT_CLR (((REG32(ADR_DBG_DBG_CNT4)) & 0x00010000 ) >> 16) ++#define GET_DBG_TX_DONE_CNT_CLR (((REG32(ADR_DBG_DBG_CNT4)) & 0x00020000 ) >> 17) ++#define GET_DBG_TX_SET_CNT_CLR (((REG32(ADR_DBG_DBG_CNT4)) & 0x00040000 ) >> 18) ++#define GET_DBG_DAT_MODE_OFF (((REG32(ADR_DBG_DBG_CNT4)) & 0x00080000 ) >> 19) ++#define GET_DBG_TX_FIFO_RESIDUE (((REG32(ADR_DBG_DBG_CNT4)) & 0x00700000 ) >> 20) ++#define GET_DBG_RX_FIFO_RESIDUE (((REG32(ADR_DBG_DBG_CNT4)) & 0x07000000 ) >> 24) ++#define GET_DBG_RX_RDY (((REG32(ADR_DBG_INT_TAG)) & 0x00000001 ) >> 0) ++#define GET_DBG_SDIO_SYS_INT (((REG32(ADR_DBG_INT_TAG)) & 0x00000004 ) >> 2) ++#define GET_DBG_EDCA0_LOWTHOLD_INT (((REG32(ADR_DBG_INT_TAG)) & 0x00000008 ) >> 3) ++#define GET_DBG_EDCA1_LOWTHOLD_INT (((REG32(ADR_DBG_INT_TAG)) & 0x00000010 ) >> 4) ++#define GET_DBG_EDCA2_LOWTHOLD_INT (((REG32(ADR_DBG_INT_TAG)) & 0x00000020 ) >> 5) ++#define GET_DBG_EDCA3_LOWTHOLD_INT (((REG32(ADR_DBG_INT_TAG)) & 0x00000040 ) >> 6) ++#define GET_DBG_TX_LIMIT_INT_IN (((REG32(ADR_DBG_INT_TAG)) & 0x00000080 ) >> 7) ++#define GET_DBG_SPI_FN1 (((REG32(ADR_DBG_INT_TAG)) & 0x00007f00 ) >> 8) ++#define GET_DBG_SPI_CLK_EN_INT (((REG32(ADR_DBG_INT_TAG)) & 0x00008000 ) >> 15) ++#define GET_DBG_SPI_HOST_MASK (((REG32(ADR_DBG_INT_TAG)) & 0x00ff0000 ) >> 16) ++#define GET_BOOT_ADDR (((REG32(ADR_BOOT_ADDR)) & 0x00ffffff ) >> 0) ++#define GET_CHECK_SUM_FAIL (((REG32(ADR_BOOT_ADDR)) & 0x80000000 ) >> 31) ++#define GET_VERIFY_DATA (((REG32(ADR_VERIFY_DATA)) & 0xffffffff ) >> 0) ++#define GET_FLASH_ADDR (((REG32(ADR_FLASH_ADDR)) & 0x00ffffff ) >> 0) ++#define GET_FLASH_CMD_CLR (((REG32(ADR_FLASH_ADDR)) & 0x10000000 ) >> 28) ++#define GET_FLASH_DMA_CLR (((REG32(ADR_FLASH_ADDR)) & 0x20000000 ) >> 29) ++#define GET_DMA_EN (((REG32(ADR_FLASH_ADDR)) & 0x40000000 ) >> 30) ++#define GET_DMA_BUSY (((REG32(ADR_FLASH_ADDR)) & 0x80000000 ) >> 31) ++#define GET_SRAM_ADDR (((REG32(ADR_SRAM_ADDR)) & 0xffffffff ) >> 0) ++#define GET_FLASH_DMA_LEN (((REG32(ADR_LEN)) & 0xffffffff ) >> 0) ++#define GET_FLASH_FRONT_DLY (((REG32(ADR_SPI_PARAM)) & 0x0000ffff ) >> 0) ++#define GET_FLASH_BACK_DLY (((REG32(ADR_SPI_PARAM)) & 0xffff0000 ) >> 16) ++#define GET_FLASH_CLK_WIDTH (((REG32(ADR_SPI_PARAM2)) & 0x0000ffff ) >> 0) ++#define GET_SPI_BUSY (((REG32(ADR_SPI_PARAM2)) & 0x00010000 ) >> 16) ++#define GET_FLS_REMAP (((REG32(ADR_SPI_PARAM2)) & 0x00020000 ) >> 17) ++#define GET_PBUS_SWP (((REG32(ADR_SPI_PARAM2)) & 0x00040000 ) >> 18) ++#define GET_BIT_MODE1 (((REG32(ADR_SPI_PARAM2)) & 0x00080000 ) >> 19) ++#define GET_BIT_MODE2 (((REG32(ADR_SPI_PARAM2)) & 0x00100000 ) >> 20) ++#define GET_BIT_MODE4 (((REG32(ADR_SPI_PARAM2)) & 0x00200000 ) >> 21) ++#define GET_BOOT_CHECK_SUM (((REG32(ADR_CHECK_SUM_RESULT)) & 0xffffffff ) >> 0) ++#define GET_CHECK_SUM_TAG (((REG32(ADR_CHECK_SUM_IN_FILE)) & 0xffffffff ) >> 0) ++#define GET_CMD_LEN (((REG32(ADR_COMMAND_LEN)) & 0x0000ffff ) >> 0) ++#define GET_CMD_ADDR (((REG32(ADR_COMMAND_ADDR)) & 0xffffffff ) >> 0) ++#define GET_DMA_ADR_SRC (((REG32(ADR_DMA_ADR_SRC)) & 0xffffffff ) >> 0) ++#define GET_DMA_ADR_DST (((REG32(ADR_DMA_ADR_DST)) & 0xffffffff ) >> 0) ++#define GET_DMA_SRC_SIZE (((REG32(ADR_DMA_CTRL)) & 0x00000007 ) >> 0) ++#define GET_DMA_SRC_INC (((REG32(ADR_DMA_CTRL)) & 0x00000008 ) >> 3) ++#define GET_DMA_DST_SIZE (((REG32(ADR_DMA_CTRL)) & 0x00000070 ) >> 4) ++#define GET_DMA_DST_INC (((REG32(ADR_DMA_CTRL)) & 0x00000080 ) >> 7) ++#define GET_DMA_FAST_FILL (((REG32(ADR_DMA_CTRL)) & 0x00000100 ) >> 8) ++#define GET_DMA_SDIO_KICK (((REG32(ADR_DMA_CTRL)) & 0x00001000 ) >> 12) ++#define GET_DMA_BADR_EN (((REG32(ADR_DMA_CTRL)) & 0x00002000 ) >> 13) ++#define GET_DMA_LEN (((REG32(ADR_DMA_CTRL)) & 0xffff0000 ) >> 16) ++#define GET_DMA_INT_MASK (((REG32(ADR_DMA_INT)) & 0x00000001 ) >> 0) ++#define GET_DMA_STS (((REG32(ADR_DMA_INT)) & 0x00000100 ) >> 8) ++#define GET_DMA_FINISH (((REG32(ADR_DMA_INT)) & 0x80000000 ) >> 31) ++#define GET_DMA_CONST (((REG32(ADR_DMA_FILL_CONST)) & 0xffffffff ) >> 0) ++#define GET_SLEEP_WAKE_CNT (((REG32(ADR_PMU_0)) & 0x00ffffff ) >> 0) ++#define GET_RG_DLDO_LEVEL (((REG32(ADR_PMU_0)) & 0x07000000 ) >> 24) ++#define GET_RG_DLDO_BOOST_IQ (((REG32(ADR_PMU_0)) & 0x08000000 ) >> 27) ++#define GET_RG_BUCK_LEVEL (((REG32(ADR_PMU_0)) & 0x70000000 ) >> 28) ++#define GET_RG_BUCK_VREF_SEL (((REG32(ADR_PMU_0)) & 0x80000000 ) >> 31) ++#define GET_RG_RTC_OSC_RES_SW_MANUAL (((REG32(ADR_PMU_1)) & 0x000003ff ) >> 0) ++#define GET_RG_RTC_OSC_RES_SW (((REG32(ADR_PMU_1)) & 0x03ff0000 ) >> 16) ++#define GET_RTC_OSC_CAL_RES_RDY (((REG32(ADR_PMU_1)) & 0x80000000 ) >> 31) ++#define GET_RG_DCDC_MODE (((REG32(ADR_PMU_2)) & 0x00000001 ) >> 0) ++#define GET_RG_BUCK_EN_PSM (((REG32(ADR_PMU_2)) & 0x00000010 ) >> 4) ++#define GET_RG_BUCK_PSM_VTH (((REG32(ADR_PMU_2)) & 0x00000100 ) >> 8) ++#define GET_RG_RTC_OSC_RES_SW_MANUAL_EN (((REG32(ADR_PMU_2)) & 0x00001000 ) >> 12) ++#define GET_RG_RTC_RDY_DEGLITCH_TIMER (((REG32(ADR_PMU_2)) & 0x00006000 ) >> 13) ++#define GET_RTC_CAL_ENA (((REG32(ADR_PMU_2)) & 0x00010000 ) >> 16) ++#define GET_PMU_WAKE_TRIG_EVENT (((REG32(ADR_PMU_3)) & 0x00000003 ) >> 0) ++#define GET_DIGI_TOP_POR_MASK (((REG32(ADR_PMU_3)) & 0x00000010 ) >> 4) ++#define GET_PMU_ENTER_SLEEP_MODE (((REG32(ADR_PMU_3)) & 0x00000100 ) >> 8) ++#define GET_RG_RTC_DUMMIES (((REG32(ADR_PMU_3)) & 0xffff0000 ) >> 16) ++#define GET_RTC_EN (((REG32(ADR_RTC_1)) & 0x00000001 ) >> 0) ++#define GET_RTC_SRC (((REG32(ADR_RTC_1)) & 0x00000002 ) >> 1) ++#define GET_RTC_TICK_CNT (((REG32(ADR_RTC_1)) & 0x7fff0000 ) >> 16) ++#define GET_RTC_INT_SEC_MASK (((REG32(ADR_RTC_2)) & 0x00000001 ) >> 0) ++#define GET_RTC_INT_ALARM_MASK (((REG32(ADR_RTC_2)) & 0x00000002 ) >> 1) ++#define GET_RTC_INT_SEC (((REG32(ADR_RTC_2)) & 0x00010000 ) >> 16) ++#define GET_RTC_INT_ALARM (((REG32(ADR_RTC_2)) & 0x00020000 ) >> 17) ++#define GET_RTC_SEC_START_CNT (((REG32(ADR_RTC_3W)) & 0xffffffff ) >> 0) ++#define GET_RTC_SEC_CNT (((REG32(ADR_RTC_3R)) & 0xffffffff ) >> 0) ++#define GET_RTC_SEC_ALARM_VALUE (((REG32(ADR_RTC_4)) & 0xffffffff ) >> 0) ++#define GET_D2_DMA_ADR_SRC (((REG32(ADR_D2_DMA_ADR_SRC)) & 0xffffffff ) >> 0) ++#define GET_D2_DMA_ADR_DST (((REG32(ADR_D2_DMA_ADR_DST)) & 0xffffffff ) >> 0) ++#define GET_D2_DMA_SRC_SIZE (((REG32(ADR_D2_DMA_CTRL)) & 0x00000007 ) >> 0) ++#define GET_D2_DMA_SRC_INC (((REG32(ADR_D2_DMA_CTRL)) & 0x00000008 ) >> 3) ++#define GET_D2_DMA_DST_SIZE (((REG32(ADR_D2_DMA_CTRL)) & 0x00000070 ) >> 4) ++#define GET_D2_DMA_DST_INC (((REG32(ADR_D2_DMA_CTRL)) & 0x00000080 ) >> 7) ++#define GET_D2_DMA_FAST_FILL (((REG32(ADR_D2_DMA_CTRL)) & 0x00000100 ) >> 8) ++#define GET_D2_DMA_SDIO_KICK (((REG32(ADR_D2_DMA_CTRL)) & 0x00001000 ) >> 12) ++#define GET_D2_DMA_BADR_EN (((REG32(ADR_D2_DMA_CTRL)) & 0x00002000 ) >> 13) ++#define GET_D2_DMA_LEN (((REG32(ADR_D2_DMA_CTRL)) & 0xffff0000 ) >> 16) ++#define GET_D2_DMA_INT_MASK (((REG32(ADR_D2_DMA_INT)) & 0x00000001 ) >> 0) ++#define GET_D2_DMA_STS (((REG32(ADR_D2_DMA_INT)) & 0x00000100 ) >> 8) ++#define GET_D2_DMA_FINISH (((REG32(ADR_D2_DMA_INT)) & 0x80000000 ) >> 31) ++#define GET_D2_DMA_CONST (((REG32(ADR_D2_DMA_FILL_CONST)) & 0xffffffff ) >> 0) ++#define GET_TRAP_UNKNOWN_TYPE (((REG32(ADR_CONTROL)) & 0x00000001 ) >> 0) ++#define GET_TX_ON_DEMAND_ENA (((REG32(ADR_CONTROL)) & 0x00000002 ) >> 1) ++#define GET_RX_2_HOST (((REG32(ADR_CONTROL)) & 0x00000004 ) >> 2) ++#define GET_AUTO_SEQNO (((REG32(ADR_CONTROL)) & 0x00000008 ) >> 3) ++#define GET_BYPASSS_TX_PARSER_ENCAP (((REG32(ADR_CONTROL)) & 0x00000010 ) >> 4) ++#define GET_HDR_STRIP (((REG32(ADR_CONTROL)) & 0x00000020 ) >> 5) ++#define GET_ERP_PROTECT (((REG32(ADR_CONTROL)) & 0x000000c0 ) >> 6) ++#define GET_PRO_VER (((REG32(ADR_CONTROL)) & 0x00000300 ) >> 8) ++#define GET_TXQ_ID0 (((REG32(ADR_CONTROL)) & 0x00007000 ) >> 12) ++#define GET_TXQ_ID1 (((REG32(ADR_CONTROL)) & 0x00070000 ) >> 16) ++#define GET_TX_ETHER_TRAP_EN (((REG32(ADR_CONTROL)) & 0x00100000 ) >> 20) ++#define GET_RX_ETHER_TRAP_EN (((REG32(ADR_CONTROL)) & 0x00200000 ) >> 21) ++#define GET_RX_NULL_TRAP_EN (((REG32(ADR_CONTROL)) & 0x00400000 ) >> 22) ++#define GET_RX_GET_TX_QUEUE_EN (((REG32(ADR_CONTROL)) & 0x02000000 ) >> 25) ++#define GET_HCI_INQ_SEL (((REG32(ADR_CONTROL)) & 0x04000000 ) >> 26) ++#define GET_TRX_DEBUG_CNT_ENA (((REG32(ADR_CONTROL)) & 0x10000000 ) >> 28) ++#define GET_WAKE_SOON_WITH_SCK (((REG32(ADR_SDIO_WAKE_MODE)) & 0x00000001 ) >> 0) ++#define GET_TX_FLOW_CTRL (((REG32(ADR_TX_FLOW_0)) & 0x0000ffff ) >> 0) ++#define GET_TX_FLOW_MGMT (((REG32(ADR_TX_FLOW_0)) & 0xffff0000 ) >> 16) ++#define GET_TX_FLOW_DATA (((REG32(ADR_TX_FLOW_1)) & 0xffffffff ) >> 0) ++#define GET_DOT11RTSTHRESHOLD (((REG32(ADR_THREASHOLD)) & 0xffff0000 ) >> 16) ++#define GET_TXF_ID (((REG32(ADR_TXFID_INCREASE)) & 0x0000003f ) >> 0) ++#define GET_SEQ_CTRL (((REG32(ADR_GLOBAL_SEQUENCE)) & 0x0000ffff ) >> 0) ++#define GET_TX_PBOFFSET (((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0x000000ff ) >> 0) ++#define GET_TX_INFO_SIZE (((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0x0000ff00 ) >> 8) ++#define GET_RX_INFO_SIZE (((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0x00ff0000 ) >> 16) ++#define GET_RX_LAST_PHY_SIZE (((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0xff000000 ) >> 24) ++#define GET_TX_INFO_CLEAR_SIZE (((REG32(ADR_HCI_TX_INFO_CLEAR)) & 0x0000003f ) >> 0) ++#define GET_TX_INFO_CLEAR_ENABLE (((REG32(ADR_HCI_TX_INFO_CLEAR)) & 0x00000100 ) >> 8) ++#define GET_TXTRAP_ETHTYPE1 (((REG32(ADR_TX_ETHER_TYPE_1)) & 0x0000ffff ) >> 0) ++#define GET_TXTRAP_ETHTYPE0 (((REG32(ADR_TX_ETHER_TYPE_1)) & 0xffff0000 ) >> 16) ++#define GET_RXTRAP_ETHTYPE1 (((REG32(ADR_RX_ETHER_TYPE_1)) & 0x0000ffff ) >> 0) ++#define GET_RXTRAP_ETHTYPE0 (((REG32(ADR_RX_ETHER_TYPE_1)) & 0xffff0000 ) >> 16) ++#define GET_TX_PKT_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_0)) & 0xffffffff ) >> 0) ++#define GET_RX_PKT_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_1)) & 0xffffffff ) >> 0) ++#define GET_HOST_CMD_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_2)) & 0x000000ff ) >> 0) ++#define GET_HOST_EVENT_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_3)) & 0x000000ff ) >> 0) ++#define GET_TX_PKT_DROP_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_4)) & 0x000000ff ) >> 0) ++#define GET_RX_PKT_DROP_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_5)) & 0x000000ff ) >> 0) ++#define GET_TX_PKT_TRAP_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_6)) & 0x000000ff ) >> 0) ++#define GET_RX_PKT_TRAP_COUNTER (((REG32(ADR_PACKET_COUNTER_INFO_7)) & 0x000000ff ) >> 0) ++#define GET_HOST_TX_FAIL_COUNTER (((REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_0)) & 0x000000ff ) >> 0) ++#define GET_HOST_RX_FAIL_COUNTER (((REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_1)) & 0x000000ff ) >> 0) ++#define GET_HCI_STATE_MONITOR (((REG32(ADR_HCI_STATE_DEBUG_MODE_0)) & 0xffffffff ) >> 0) ++#define GET_HCI_ST_TIMEOUT_MONITOR (((REG32(ADR_HCI_STATE_DEBUG_MODE_1)) & 0xffffffff ) >> 0) ++#define GET_TX_ON_DEMAND_LENGTH (((REG32(ADR_HCI_STATE_DEBUG_MODE_2)) & 0xffffffff ) >> 0) ++#define GET_HCI_MONITOR_REG1 (((REG32(ADR_HCI_STATE_DEBUG_MODE_3)) & 0xffffffff ) >> 0) ++#define GET_HCI_MONITOR_REG2 (((REG32(ADR_HCI_STATE_DEBUG_MODE_4)) & 0xffffffff ) >> 0) ++#define GET_HCI_TX_ALLOC_TIME_31_0 (((REG32(ADR_HCI_STATE_DEBUG_MODE_5)) & 0xffffffff ) >> 0) ++#define GET_HCI_TX_ALLOC_TIME_47_32 (((REG32(ADR_HCI_STATE_DEBUG_MODE_6)) & 0x0000ffff ) >> 0) ++#define GET_HCI_MB_MAX_CNT (((REG32(ADR_HCI_STATE_DEBUG_MODE_6)) & 0x00ff0000 ) >> 16) ++#define GET_HCI_TX_ALLOC_CNT_31_0 (((REG32(ADR_HCI_STATE_DEBUG_MODE_7)) & 0xffffffff ) >> 0) ++#define GET_HCI_TX_ALLOC_CNT_47_32 (((REG32(ADR_HCI_STATE_DEBUG_MODE_8)) & 0x0000ffff ) >> 0) ++#define GET_HCI_PROC_CNT (((REG32(ADR_HCI_STATE_DEBUG_MODE_8)) & 0x00ff0000 ) >> 16) ++#define GET_SDIO_TRANS_CNT (((REG32(ADR_HCI_STATE_DEBUG_MODE_8)) & 0xff000000 ) >> 24) ++#define GET_SDIO_TX_INVALID_CNT_31_0 (((REG32(ADR_HCI_STATE_DEBUG_MODE_9)) & 0xffffffff ) >> 0) ++#define GET_SDIO_TX_INVALID_CNT_47_32 (((REG32(ADR_HCI_STATE_DEBUG_MODE_10)) & 0x0000ffff ) >> 0) ++#define GET_CS_START_ADDR (((REG32(ADR_CS_START_ADDR)) & 0x0000ffff ) >> 0) ++#define GET_CS_PKT_ID (((REG32(ADR_CS_START_ADDR)) & 0x007f0000 ) >> 16) ++#define GET_ADD_LEN (((REG32(ADR_CS_ADD_LEN)) & 0x0000ffff ) >> 0) ++#define GET_CS_ADDER_EN (((REG32(ADR_CS_CMD)) & 0x00000001 ) >> 0) ++#define GET_PSEUDO (((REG32(ADR_CS_CMD)) & 0x00000002 ) >> 1) ++#define GET_CALCULATE (((REG32(ADR_CS_INI_BUF)) & 0xffffffff ) >> 0) ++#define GET_L4_LEN (((REG32(ADR_CS_PSEUDO_BUF)) & 0x0000ffff ) >> 0) ++#define GET_L4_PROTOL (((REG32(ADR_CS_PSEUDO_BUF)) & 0x00ff0000 ) >> 16) ++#define GET_CHECK_SUM (((REG32(ADR_CS_CHECK_SUM)) & 0x0000ffff ) >> 0) ++#define GET_RAND_EN (((REG32(ADR_RAND_EN)) & 0x00000001 ) >> 0) ++#define GET_RAND_NUM (((REG32(ADR_RAND_NUM)) & 0xffffffff ) >> 0) ++#define GET_MUL_OP1 (((REG32(ADR_MUL_OP1)) & 0xffffffff ) >> 0) ++#define GET_MUL_OP2 (((REG32(ADR_MUL_OP2)) & 0xffffffff ) >> 0) ++#define GET_MUL_ANS0 (((REG32(ADR_MUL_ANS0)) & 0xffffffff ) >> 0) ++#define GET_MUL_ANS1 (((REG32(ADR_MUL_ANS1)) & 0xffffffff ) >> 0) ++#define GET_RD_ADDR (((REG32(ADR_DMA_RDATA)) & 0x0000ffff ) >> 0) ++#define GET_RD_ID (((REG32(ADR_DMA_RDATA)) & 0x007f0000 ) >> 16) ++#define GET_WR_ADDR (((REG32(ADR_DMA_WDATA)) & 0x0000ffff ) >> 0) ++#define GET_WR_ID (((REG32(ADR_DMA_WDATA)) & 0x007f0000 ) >> 16) ++#define GET_LEN (((REG32(ADR_DMA_LEN)) & 0x0000ffff ) >> 0) ++#define GET_CLR (((REG32(ADR_DMA_CLR)) & 0x00000001 ) >> 0) ++#define GET_PHY_MODE (((REG32(ADR_NAV_DATA)) & 0x00000003 ) >> 0) ++#define GET_SHRT_PREAM (((REG32(ADR_NAV_DATA)) & 0x00000004 ) >> 2) ++#define GET_SHRT_GI (((REG32(ADR_NAV_DATA)) & 0x00000008 ) >> 3) ++#define GET_DATA_RATE (((REG32(ADR_NAV_DATA)) & 0x000007f0 ) >> 4) ++#define GET_MCS (((REG32(ADR_NAV_DATA)) & 0x00007000 ) >> 12) ++#define GET_FRAME_LEN (((REG32(ADR_NAV_DATA)) & 0xffff0000 ) >> 16) ++#define GET_DURATION (((REG32(ADR_CO_NAV)) & 0x0000ffff ) >> 0) ++#define GET_SHA_DST_ADDR (((REG32(ADR_SHA_DST_ADDR)) & 0xffffffff ) >> 0) ++#define GET_SHA_SRC_ADDR (((REG32(ADR_SHA_SRC_ADDR)) & 0xffffffff ) >> 0) ++#define GET_SHA_BUSY (((REG32(ADR_SHA_SETTING)) & 0x00000001 ) >> 0) ++#define GET_SHA_ENDIAN (((REG32(ADR_SHA_SETTING)) & 0x00000002 ) >> 1) ++#define GET_EFS_CLKFREQ (((REG32(ADR_EFUSE_CLK_FREQ)) & 0x00000fff ) >> 0) ++#define GET_LOW_ACTIVE (((REG32(ADR_EFUSE_CLK_FREQ)) & 0x00010000 ) >> 16) ++#define GET_EFS_CLKFREQ_RD (((REG32(ADR_EFUSE_CLK_FREQ)) & 0x0ff00000 ) >> 20) ++#define GET_EFS_PRE_RD (((REG32(ADR_EFUSE_CLK_FREQ)) & 0xf0000000 ) >> 28) ++#define GET_EFS_LDO_ON (((REG32(ADR_EFUSE_LDO_TIME)) & 0x0000ffff ) >> 0) ++#define GET_EFS_LDO_OFF (((REG32(ADR_EFUSE_LDO_TIME)) & 0xffff0000 ) >> 16) ++#define GET_EFS_RDATA_0 (((REG32(ADR_EFUSE_AHB_RDATA_0)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_0 (((REG32(ADR_EFUSE_WDATA_0)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_1 (((REG32(ADR_EFUSE_AHB_RDATA_1)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_1 (((REG32(ADR_EFUSE_WDATA_1)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_2 (((REG32(ADR_EFUSE_AHB_RDATA_2)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_2 (((REG32(ADR_EFUSE_WDATA_2)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_3 (((REG32(ADR_EFUSE_AHB_RDATA_3)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_3 (((REG32(ADR_EFUSE_WDATA_3)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_4 (((REG32(ADR_EFUSE_AHB_RDATA_4)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_4 (((REG32(ADR_EFUSE_WDATA_4)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_5 (((REG32(ADR_EFUSE_AHB_RDATA_5)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_5 (((REG32(ADR_EFUSE_WDATA_5)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_6 (((REG32(ADR_EFUSE_AHB_RDATA_6)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_6 (((REG32(ADR_EFUSE_WDATA_6)) & 0xffffffff ) >> 0) ++#define GET_EFS_RDATA_7 (((REG32(ADR_EFUSE_AHB_RDATA_7)) & 0xffffffff ) >> 0) ++#define GET_EFS_WDATA_7 (((REG32(ADR_EFUSE_WDATA_7)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RD0_EN (((REG32(ADR_EFUSE_SPI_RD0_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD1_EN (((REG32(ADR_EFUSE_SPI_RD1_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD2_EN (((REG32(ADR_EFUSE_SPI_RD2_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD3_EN (((REG32(ADR_EFUSE_SPI_RD3_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD4_EN (((REG32(ADR_EFUSE_SPI_RD4_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD5_EN (((REG32(ADR_EFUSE_SPI_RD5_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD6_EN (((REG32(ADR_EFUSE_SPI_RD6_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RD7_EN (((REG32(ADR_EFUSE_SPI_RD7_EN)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RBUSY (((REG32(ADR_EFUSE_SPI_BUSY)) & 0x00000001 ) >> 0) ++#define GET_EFS_SPI_RDATA_0 (((REG32(ADR_EFUSE_SPI_RDATA_0)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_1 (((REG32(ADR_EFUSE_SPI_RDATA_1)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_2 (((REG32(ADR_EFUSE_SPI_RDATA_2)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_3 (((REG32(ADR_EFUSE_SPI_RDATA_3)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_4 (((REG32(ADR_EFUSE_SPI_RDATA_4)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_5 (((REG32(ADR_EFUSE_SPI_RDATA_5)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_6 (((REG32(ADR_EFUSE_SPI_RDATA_6)) & 0xffffffff ) >> 0) ++#define GET_EFS_SPI_RDATA_7 (((REG32(ADR_EFUSE_SPI_RDATA_7)) & 0xffffffff ) >> 0) ++#define GET_GET_RK (((REG32(ADR_SMS4_CFG1)) & 0x00000001 ) >> 0) ++#define GET_FORCE_GET_RK (((REG32(ADR_SMS4_CFG1)) & 0x00000002 ) >> 1) ++#define GET_SMS4_DESCRY_EN (((REG32(ADR_SMS4_CFG1)) & 0x00000010 ) >> 4) ++#define GET_DEC_DOUT_MSB (((REG32(ADR_SMS4_CFG2)) & 0x00000001 ) >> 0) ++#define GET_DEC_DIN_MSB (((REG32(ADR_SMS4_CFG2)) & 0x00000002 ) >> 1) ++#define GET_ENC_DOUT_MSB (((REG32(ADR_SMS4_CFG2)) & 0x00000004 ) >> 2) ++#define GET_ENC_DIN_MSB (((REG32(ADR_SMS4_CFG2)) & 0x00000008 ) >> 3) ++#define GET_KEY_DIN_MSB (((REG32(ADR_SMS4_CFG2)) & 0x00000010 ) >> 4) ++#define GET_SMS4_CBC_EN (((REG32(ADR_SMS4_MODE1)) & 0x00000001 ) >> 0) ++#define GET_SMS4_CFB_EN (((REG32(ADR_SMS4_MODE1)) & 0x00000002 ) >> 1) ++#define GET_SMS4_OFB_EN (((REG32(ADR_SMS4_MODE1)) & 0x00000004 ) >> 2) ++#define GET_SMS4_START_TRIG (((REG32(ADR_SMS4_TRIG)) & 0x00000001 ) >> 0) ++#define GET_SMS4_BUSY (((REG32(ADR_SMS4_STATUS1)) & 0x00000001 ) >> 0) ++#define GET_SMS4_DONE (((REG32(ADR_SMS4_STATUS2)) & 0x00000001 ) >> 0) ++#define GET_SMS4_DATAIN_0 (((REG32(ADR_SMS4_DATA_IN0)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAIN_1 (((REG32(ADR_SMS4_DATA_IN1)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAIN_2 (((REG32(ADR_SMS4_DATA_IN2)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAIN_3 (((REG32(ADR_SMS4_DATA_IN3)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAOUT_0 (((REG32(ADR_SMS4_DATA_OUT0)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAOUT_1 (((REG32(ADR_SMS4_DATA_OUT1)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAOUT_2 (((REG32(ADR_SMS4_DATA_OUT2)) & 0xffffffff ) >> 0) ++#define GET_SMS4_DATAOUT_3 (((REG32(ADR_SMS4_DATA_OUT3)) & 0xffffffff ) >> 0) ++#define GET_SMS4_KEY_0 (((REG32(ADR_SMS4_KEY_0)) & 0xffffffff ) >> 0) ++#define GET_SMS4_KEY_1 (((REG32(ADR_SMS4_KEY_1)) & 0xffffffff ) >> 0) ++#define GET_SMS4_KEY_2 (((REG32(ADR_SMS4_KEY_2)) & 0xffffffff ) >> 0) ++#define GET_SMS4_KEY_3 (((REG32(ADR_SMS4_KEY_3)) & 0xffffffff ) >> 0) ++#define GET_SMS4_MODE_IV0 (((REG32(ADR_SMS4_MODE_IV0)) & 0xffffffff ) >> 0) ++#define GET_SMS4_MODE_IV1 (((REG32(ADR_SMS4_MODE_IV1)) & 0xffffffff ) >> 0) ++#define GET_SMS4_MODE_IV2 (((REG32(ADR_SMS4_MODE_IV2)) & 0xffffffff ) >> 0) ++#define GET_SMS4_MODE_IV3 (((REG32(ADR_SMS4_MODE_IV3)) & 0xffffffff ) >> 0) ++#define GET_SMS4_OFB_ENC0 (((REG32(ADR_SMS4_OFB_ENC0)) & 0xffffffff ) >> 0) ++#define GET_SMS4_OFB_ENC1 (((REG32(ADR_SMS4_OFB_ENC1)) & 0xffffffff ) >> 0) ++#define GET_SMS4_OFB_ENC2 (((REG32(ADR_SMS4_OFB_ENC2)) & 0xffffffff ) >> 0) ++#define GET_SMS4_OFB_ENC3 (((REG32(ADR_SMS4_OFB_ENC3)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_TB0_31_0 (((REG32(ADR_MRX_MCAST_TB0_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_TB0_47_32 (((REG32(ADR_MRX_MCAST_TB0_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_MASK0_31_0 (((REG32(ADR_MRX_MCAST_MK0_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_MASK0_47_32 (((REG32(ADR_MRX_MCAST_MK0_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_CTRL_0 (((REG32(ADR_MRX_MCAST_CTRL0)) & 0x00000003 ) >> 0) ++#define GET_MRX_MCAST_TB1_31_0 (((REG32(ADR_MRX_MCAST_TB1_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_TB1_47_32 (((REG32(ADR_MRX_MCAST_TB1_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_MASK1_31_0 (((REG32(ADR_MRX_MCAST_MK1_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_MASK1_47_32 (((REG32(ADR_MRX_MCAST_MK1_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_CTRL_1 (((REG32(ADR_MRX_MCAST_CTRL1)) & 0x00000003 ) >> 0) ++#define GET_MRX_MCAST_TB2_31_0 (((REG32(ADR_MRX_MCAST_TB2_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_TB2_47_32 (((REG32(ADR_MRX_MCAST_TB2_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_MASK2_31_0 (((REG32(ADR_MRX_MCAST_MK2_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_MASK2_47_32 (((REG32(ADR_MRX_MCAST_MK2_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_CTRL_2 (((REG32(ADR_MRX_MCAST_CTRL2)) & 0x00000003 ) >> 0) ++#define GET_MRX_MCAST_TB3_31_0 (((REG32(ADR_MRX_MCAST_TB3_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_TB3_47_32 (((REG32(ADR_MRX_MCAST_TB3_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_MASK3_31_0 (((REG32(ADR_MRX_MCAST_MK3_0)) & 0xffffffff ) >> 0) ++#define GET_MRX_MCAST_MASK3_47_32 (((REG32(ADR_MRX_MCAST_MK3_1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MCAST_CTRL_3 (((REG32(ADR_MRX_MCAST_CTRL3)) & 0x00000003 ) >> 0) ++#define GET_MRX_PHY_INFO (((REG32(ADR_MRX_PHY_INFO)) & 0xffffffff ) >> 0) ++#define GET_DBG_BA_TYPE (((REG32(ADR_MRX_BA_DBG)) & 0x0000003f ) >> 0) ++#define GET_DBG_BA_SEQ (((REG32(ADR_MRX_BA_DBG)) & 0x000fff00 ) >> 8) ++#define GET_MRX_FLT_TB0 (((REG32(ADR_MRX_FLT_TB0)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB1 (((REG32(ADR_MRX_FLT_TB1)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB2 (((REG32(ADR_MRX_FLT_TB2)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB3 (((REG32(ADR_MRX_FLT_TB3)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB4 (((REG32(ADR_MRX_FLT_TB4)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB5 (((REG32(ADR_MRX_FLT_TB5)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB6 (((REG32(ADR_MRX_FLT_TB6)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB7 (((REG32(ADR_MRX_FLT_TB7)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB8 (((REG32(ADR_MRX_FLT_TB8)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB9 (((REG32(ADR_MRX_FLT_TB9)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB10 (((REG32(ADR_MRX_FLT_TB10)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB11 (((REG32(ADR_MRX_FLT_TB11)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB12 (((REG32(ADR_MRX_FLT_TB12)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB13 (((REG32(ADR_MRX_FLT_TB13)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB14 (((REG32(ADR_MRX_FLT_TB14)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_TB15 (((REG32(ADR_MRX_FLT_TB15)) & 0x00007fff ) >> 0) ++#define GET_MRX_FLT_EN0 (((REG32(ADR_MRX_FLT_EN0)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN1 (((REG32(ADR_MRX_FLT_EN1)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN2 (((REG32(ADR_MRX_FLT_EN2)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN3 (((REG32(ADR_MRX_FLT_EN3)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN4 (((REG32(ADR_MRX_FLT_EN4)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN5 (((REG32(ADR_MRX_FLT_EN5)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN6 (((REG32(ADR_MRX_FLT_EN6)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN7 (((REG32(ADR_MRX_FLT_EN7)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FLT_EN8 (((REG32(ADR_MRX_FLT_EN8)) & 0x0000ffff ) >> 0) ++#define GET_MRX_LEN_FLT (((REG32(ADR_MRX_LEN_FLT)) & 0x0000ffff ) >> 0) ++#define GET_RX_FLOW_DATA (((REG32(ADR_RX_FLOW_DATA)) & 0xffffffff ) >> 0) ++#define GET_RX_FLOW_MNG (((REG32(ADR_RX_FLOW_MNG)) & 0x0000ffff ) >> 0) ++#define GET_RX_FLOW_CTRL (((REG32(ADR_RX_FLOW_CTRL)) & 0x0000ffff ) >> 0) ++#define GET_MRX_STP_EN (((REG32(ADR_RX_TIME_STAMP_CFG)) & 0x00000001 ) >> 0) ++#define GET_MRX_STP_OFST (((REG32(ADR_RX_TIME_STAMP_CFG)) & 0x0000ff00 ) >> 8) ++#define GET_DBG_FF_FULL (((REG32(ADR_DBG_FF_FULL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_FF_FULL_CLR (((REG32(ADR_DBG_FF_FULL)) & 0x80000000 ) >> 31) ++#define GET_DBG_WFF_FULL (((REG32(ADR_DBG_WFF_FULL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_WFF_FULL_CLR (((REG32(ADR_DBG_WFF_FULL)) & 0x80000000 ) >> 31) ++#define GET_DBG_MB_FULL (((REG32(ADR_DBG_MB_FULL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_MB_FULL_CLR (((REG32(ADR_DBG_MB_FULL)) & 0x80000000 ) >> 31) ++#define GET_BA_CTRL (((REG32(ADR_BA_CTRL)) & 0x00000003 ) >> 0) ++#define GET_BA_DBG_EN (((REG32(ADR_BA_CTRL)) & 0x00000004 ) >> 2) ++#define GET_BA_AGRE_EN (((REG32(ADR_BA_CTRL)) & 0x00000008 ) >> 3) ++#define GET_BA_TA_31_0 (((REG32(ADR_BA_TA_0)) & 0xffffffff ) >> 0) ++#define GET_BA_TA_47_32 (((REG32(ADR_BA_TA_1)) & 0x0000ffff ) >> 0) ++#define GET_BA_TID (((REG32(ADR_BA_TID)) & 0x0000000f ) >> 0) ++#define GET_BA_ST_SEQ (((REG32(ADR_BA_ST_SEQ)) & 0x00000fff ) >> 0) ++#define GET_BA_SB0 (((REG32(ADR_BA_SB0)) & 0xffffffff ) >> 0) ++#define GET_BA_SB1 (((REG32(ADR_BA_SB1)) & 0xffffffff ) >> 0) ++#define GET_MRX_WD (((REG32(ADR_MRX_WATCH_DOG)) & 0x0001ffff ) >> 0) ++#define GET_ACK_GEN_EN (((REG32(ADR_ACK_GEN_EN)) & 0x00000001 ) >> 0) ++#define GET_BA_GEN_EN (((REG32(ADR_ACK_GEN_EN)) & 0x00000002 ) >> 1) ++#define GET_ACK_GEN_DUR (((REG32(ADR_ACK_GEN_PARA)) & 0x0000ffff ) >> 0) ++#define GET_ACK_GEN_INFO (((REG32(ADR_ACK_GEN_PARA)) & 0x003f0000 ) >> 16) ++#define GET_ACK_GEN_RA_31_0 (((REG32(ADR_ACK_GEN_RA_0)) & 0xffffffff ) >> 0) ++#define GET_ACK_GEN_RA_47_32 (((REG32(ADR_ACK_GEN_RA_1)) & 0x0000ffff ) >> 0) ++#define GET_MIB_LEN_FAIL (((REG32(ADR_MIB_LEN_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_TRAP_HW_ID (((REG32(ADR_TRAP_HW_ID)) & 0x0000000f ) >> 0) ++#define GET_ID_IN_USE (((REG32(ADR_ID_IN_USE)) & 0x000000ff ) >> 0) ++#define GET_MRX_ERR (((REG32(ADR_MRX_ERR)) & 0xffffffff ) >> 0) ++#define GET_W0_T0_SEQ (((REG32(ADR_WSID0_TID0_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T1_SEQ (((REG32(ADR_WSID0_TID1_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T2_SEQ (((REG32(ADR_WSID0_TID2_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T3_SEQ (((REG32(ADR_WSID0_TID3_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T4_SEQ (((REG32(ADR_WSID0_TID4_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T5_SEQ (((REG32(ADR_WSID0_TID5_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T6_SEQ (((REG32(ADR_WSID0_TID6_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W0_T7_SEQ (((REG32(ADR_WSID0_TID7_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T0_SEQ (((REG32(ADR_WSID1_TID0_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T1_SEQ (((REG32(ADR_WSID1_TID1_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T2_SEQ (((REG32(ADR_WSID1_TID2_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T3_SEQ (((REG32(ADR_WSID1_TID3_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T4_SEQ (((REG32(ADR_WSID1_TID4_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T5_SEQ (((REG32(ADR_WSID1_TID5_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T6_SEQ (((REG32(ADR_WSID1_TID6_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_W1_T7_SEQ (((REG32(ADR_WSID1_TID7_RX_SEQ)) & 0x0000ffff ) >> 0) ++#define GET_ADDR1A_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x00000003 ) >> 0) ++#define GET_ADDR2A_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x0000000c ) >> 2) ++#define GET_ADDR3A_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x00000030 ) >> 4) ++#define GET_ADDR1B_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x000000c0 ) >> 6) ++#define GET_ADDR2B_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x00000300 ) >> 8) ++#define GET_ADDR3B_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x00000c00 ) >> 10) ++#define GET_ADDR3C_SEL (((REG32(ADR_HDR_ADDR_SEL)) & 0x00003000 ) >> 12) ++#define GET_FRM_CTRL (((REG32(ADR_FRAME_TYPE_CNTR_SET)) & 0x0000003f ) >> 0) ++#define GET_CSR_PHY_INFO (((REG32(ADR_PHY_INFO)) & 0x00007fff ) >> 0) ++#define GET_AMPDU_SIG (((REG32(ADR_AMPDU_SIG)) & 0x000000ff ) >> 0) ++#define GET_MIB_AMPDU (((REG32(ADR_MIB_AMPDU)) & 0xffffffff ) >> 0) ++#define GET_LEN_FLT (((REG32(ADR_LEN_FLT)) & 0x0000ffff ) >> 0) ++#define GET_MIB_DELIMITER (((REG32(ADR_MIB_DELIMITER)) & 0x0000ffff ) >> 0) ++#define GET_MTX_INT_Q0_Q_EMPTY (((REG32(ADR_MTX_INT_STS)) & 0x00010000 ) >> 16) ++#define GET_MTX_INT_Q0_TXOP_RUNOUT (((REG32(ADR_MTX_INT_STS)) & 0x00020000 ) >> 17) ++#define GET_MTX_INT_Q1_Q_EMPTY (((REG32(ADR_MTX_INT_STS)) & 0x00040000 ) >> 18) ++#define GET_MTX_INT_Q1_TXOP_RUNOUT (((REG32(ADR_MTX_INT_STS)) & 0x00080000 ) >> 19) ++#define GET_MTX_INT_Q2_Q_EMPTY (((REG32(ADR_MTX_INT_STS)) & 0x00100000 ) >> 20) ++#define GET_MTX_INT_Q2_TXOP_RUNOUT (((REG32(ADR_MTX_INT_STS)) & 0x00200000 ) >> 21) ++#define GET_MTX_INT_Q3_Q_EMPTY (((REG32(ADR_MTX_INT_STS)) & 0x00400000 ) >> 22) ++#define GET_MTX_INT_Q3_TXOP_RUNOUT (((REG32(ADR_MTX_INT_STS)) & 0x00800000 ) >> 23) ++#define GET_MTX_INT_Q4_Q_EMPTY (((REG32(ADR_MTX_INT_STS)) & 0x01000000 ) >> 24) ++#define GET_MTX_INT_Q4_TXOP_RUNOUT (((REG32(ADR_MTX_INT_STS)) & 0x02000000 ) >> 25) ++#define GET_MTX_EN_INT_Q0_Q_EMPTY (((REG32(ADR_MTX_INT_EN)) & 0x00010000 ) >> 16) ++#define GET_MTX_EN_INT_Q0_TXOP_RUNOUT (((REG32(ADR_MTX_INT_EN)) & 0x00020000 ) >> 17) ++#define GET_MTX_EN_INT_Q1_Q_EMPTY (((REG32(ADR_MTX_INT_EN)) & 0x00040000 ) >> 18) ++#define GET_MTX_EN_INT_Q1_TXOP_RUNOUT (((REG32(ADR_MTX_INT_EN)) & 0x00080000 ) >> 19) ++#define GET_MTX_EN_INT_Q2_Q_EMPTY (((REG32(ADR_MTX_INT_EN)) & 0x00100000 ) >> 20) ++#define GET_MTX_EN_INT_Q2_TXOP_RUNOUT (((REG32(ADR_MTX_INT_EN)) & 0x00200000 ) >> 21) ++#define GET_MTX_EN_INT_Q3_Q_EMPTY (((REG32(ADR_MTX_INT_EN)) & 0x00400000 ) >> 22) ++#define GET_MTX_EN_INT_Q3_TXOP_RUNOUT (((REG32(ADR_MTX_INT_EN)) & 0x00800000 ) >> 23) ++#define GET_MTX_EN_INT_Q4_Q_EMPTY (((REG32(ADR_MTX_INT_EN)) & 0x01000000 ) >> 24) ++#define GET_MTX_EN_INT_Q4_TXOP_RUNOUT (((REG32(ADR_MTX_INT_EN)) & 0x02000000 ) >> 25) ++#define GET_MTX_MTX2PHY_SLOW (((REG32(ADR_MTX_MISC_EN)) & 0x00000001 ) >> 0) ++#define GET_MTX_M2M_SLOW_PRD (((REG32(ADR_MTX_MISC_EN)) & 0x0000000e ) >> 1) ++#define GET_MTX_AMPDU_CRC_AUTO (((REG32(ADR_MTX_MISC_EN)) & 0x00000020 ) >> 5) ++#define GET_MTX_FAST_RSP_MODE (((REG32(ADR_MTX_MISC_EN)) & 0x00000040 ) >> 6) ++#define GET_MTX_RAW_DATA_MODE (((REG32(ADR_MTX_MISC_EN)) & 0x00000080 ) >> 7) ++#define GET_MTX_ACK_DUR0 (((REG32(ADR_MTX_MISC_EN)) & 0x00000100 ) >> 8) ++#define GET_MTX_TSF_AUTO_BCN (((REG32(ADR_MTX_MISC_EN)) & 0x00000400 ) >> 10) ++#define GET_MTX_TSF_AUTO_MISC (((REG32(ADR_MTX_MISC_EN)) & 0x00000800 ) >> 11) ++#define GET_MTX_FORCE_CS_IDLE (((REG32(ADR_MTX_MISC_EN)) & 0x00001000 ) >> 12) ++#define GET_MTX_FORCE_BKF_RXEN0 (((REG32(ADR_MTX_MISC_EN)) & 0x00002000 ) >> 13) ++#define GET_MTX_FORCE_DMA_RXEN0 (((REG32(ADR_MTX_MISC_EN)) & 0x00004000 ) >> 14) ++#define GET_MTX_FORCE_RXEN0 (((REG32(ADR_MTX_MISC_EN)) & 0x00008000 ) >> 15) ++#define GET_MTX_HALT_Q_MB (((REG32(ADR_MTX_MISC_EN)) & 0x003f0000 ) >> 16) ++#define GET_MTX_CTS_SET_DIF (((REG32(ADR_MTX_MISC_EN)) & 0x00400000 ) >> 22) ++#define GET_MTX_AMPDU_SET_DIF (((REG32(ADR_MTX_MISC_EN)) & 0x00800000 ) >> 23) ++#define GET_MTX_EDCCA_TOUT (((REG32(ADR_MTX_EDCCA_TOUT)) & 0x000003ff ) >> 0) ++#define GET_MTX_INT_BCN (((REG32(ADR_MTX_BCN_INT_STS)) & 0x00000002 ) >> 1) ++#define GET_MTX_INT_DTIM (((REG32(ADR_MTX_BCN_INT_STS)) & 0x00000008 ) >> 3) ++#define GET_MTX_EN_INT_BCN (((REG32(ADR_MTX_BCN_EN_INT)) & 0x00000002 ) >> 1) ++#define GET_MTX_EN_INT_DTIM (((REG32(ADR_MTX_BCN_EN_INT)) & 0x00000008 ) >> 3) ++#define GET_MTX_BCN_TIMER_EN (((REG32(ADR_MTX_BCN_EN_MISC)) & 0x00000001 ) >> 0) ++#define GET_MTX_TIME_STAMP_AUTO_FILL (((REG32(ADR_MTX_BCN_EN_MISC)) & 0x00000002 ) >> 1) ++#define GET_MTX_TSF_TIMER_EN (((REG32(ADR_MTX_BCN_EN_MISC)) & 0x00000020 ) >> 5) ++#define GET_MTX_HALT_MNG_UNTIL_DTIM (((REG32(ADR_MTX_BCN_EN_MISC)) & 0x00000040 ) >> 6) ++#define GET_MTX_INT_DTIM_NUM (((REG32(ADR_MTX_BCN_EN_MISC)) & 0x0000ff00 ) >> 8) ++#define GET_MTX_AUTO_FLUSH_Q4 (((REG32(ADR_MTX_BCN_EN_MISC)) & 0x00010000 ) >> 16) ++#define GET_MTX_BCN_PKTID_CH_LOCK (((REG32(ADR_MTX_BCN_MISC)) & 0x00000001 ) >> 0) ++#define GET_MTX_BCN_CFG_VLD (((REG32(ADR_MTX_BCN_MISC)) & 0x00000006 ) >> 1) ++#define GET_MTX_AUTO_BCN_ONGOING (((REG32(ADR_MTX_BCN_MISC)) & 0x00000008 ) >> 3) ++#define GET_MTX_BCN_TIMER (((REG32(ADR_MTX_BCN_MISC)) & 0xffff0000 ) >> 16) ++#define GET_MTX_BCN_PERIOD (((REG32(ADR_MTX_BCN_PRD)) & 0x0000ffff ) >> 0) ++#define GET_MTX_DTIM_NUM (((REG32(ADR_MTX_BCN_PRD)) & 0xff000000 ) >> 24) ++#define GET_MTX_BCN_TSF_L (((REG32(ADR_MTX_BCN_TSF_L)) & 0xffffffff ) >> 0) ++#define GET_MTX_BCN_TSF_U (((REG32(ADR_MTX_BCN_TSF_U)) & 0xffffffff ) >> 0) ++#define GET_MTX_BCN_PKT_ID0 (((REG32(ADR_MTX_BCN_CFG0)) & 0x0000007f ) >> 0) ++#define GET_MTX_DTIM_OFST0 (((REG32(ADR_MTX_BCN_CFG0)) & 0x03ff0000 ) >> 16) ++#define GET_MTX_BCN_PKT_ID1 (((REG32(ADR_MTX_BCN_CFG1)) & 0x0000007f ) >> 0) ++#define GET_MTX_DTIM_OFST1 (((REG32(ADR_MTX_BCN_CFG1)) & 0x03ff0000 ) >> 16) ++#define GET_MTX_CCA (((REG32(ADR_MTX_STATUS)) & 0x00000001 ) >> 0) ++#define GET_MRX_CCA (((REG32(ADR_MTX_STATUS)) & 0x00000002 ) >> 1) ++#define GET_MTX_DMA_FSM (((REG32(ADR_MTX_STATUS)) & 0x0000001c ) >> 2) ++#define GET_CH_ST_FSM (((REG32(ADR_MTX_STATUS)) & 0x000000e0 ) >> 5) ++#define GET_MTX_GNT_LOCK (((REG32(ADR_MTX_STATUS)) & 0x00000100 ) >> 8) ++#define GET_MTX_DMA_REQ (((REG32(ADR_MTX_STATUS)) & 0x00000200 ) >> 9) ++#define GET_MTX_Q_REQ (((REG32(ADR_MTX_STATUS)) & 0x00000400 ) >> 10) ++#define GET_MTX_TX_EN (((REG32(ADR_MTX_STATUS)) & 0x00000800 ) >> 11) ++#define GET_MRX_RX_EN (((REG32(ADR_MTX_STATUS)) & 0x00001000 ) >> 12) ++#define GET_DBG_PRTC_PRD (((REG32(ADR_MTX_STATUS)) & 0x00002000 ) >> 13) ++#define GET_DBG_DMA_RDY (((REG32(ADR_MTX_STATUS)) & 0x00004000 ) >> 14) ++#define GET_DBG_WAIT_RSP (((REG32(ADR_MTX_STATUS)) & 0x00008000 ) >> 15) ++#define GET_DBG_CFRM_BUSY (((REG32(ADR_MTX_STATUS)) & 0x00010000 ) >> 16) ++#define GET_DBG_RST (((REG32(ADR_MTX_DBG_CTRL)) & 0x00000001 ) >> 0) ++#define GET_DBG_MODE (((REG32(ADR_MTX_DBG_CTRL)) & 0x00000002 ) >> 1) ++#define GET_MB_REQ_DUR (((REG32(ADR_MTX_DBG_DAT0)) & 0x0000ffff ) >> 0) ++#define GET_RX_EN_DUR (((REG32(ADR_MTX_DBG_DAT0)) & 0xffff0000 ) >> 16) ++#define GET_RX_CS_DUR (((REG32(ADR_MTX_DBG_DAT1)) & 0x0000ffff ) >> 0) ++#define GET_TX_CCA_DUR (((REG32(ADR_MTX_DBG_DAT1)) & 0xffff0000 ) >> 16) ++#define GET_Q_REQ_DUR (((REG32(ADR_MTX_DBG_DAT2)) & 0x0000ffff ) >> 0) ++#define GET_CH_STA0_DUR (((REG32(ADR_MTX_DBG_DAT2)) & 0xffff0000 ) >> 16) ++#define GET_MTX_DUR_RSP_TOUT_B (((REG32(ADR_MTX_DUR_TOUT)) & 0x000000ff ) >> 0) ++#define GET_MTX_DUR_RSP_TOUT_G (((REG32(ADR_MTX_DUR_TOUT)) & 0x0000ff00 ) >> 8) ++#define GET_MTX_DUR_RSP_SIFS (((REG32(ADR_MTX_DUR_IFS)) & 0x000000ff ) >> 0) ++#define GET_MTX_DUR_BURST_SIFS (((REG32(ADR_MTX_DUR_IFS)) & 0x0000ff00 ) >> 8) ++#define GET_MTX_DUR_SLOT (((REG32(ADR_MTX_DUR_IFS)) & 0x003f0000 ) >> 16) ++#define GET_MTX_DUR_RSP_EIFS (((REG32(ADR_MTX_DUR_IFS)) & 0xffc00000 ) >> 22) ++#define GET_MTX_DUR_RSP_SIFS_G (((REG32(ADR_MTX_DUR_SIFS_G)) & 0x000000ff ) >> 0) ++#define GET_MTX_DUR_BURST_SIFS_G (((REG32(ADR_MTX_DUR_SIFS_G)) & 0x0000ff00 ) >> 8) ++#define GET_MTX_DUR_SLOT_G (((REG32(ADR_MTX_DUR_SIFS_G)) & 0x003f0000 ) >> 16) ++#define GET_MTX_DUR_RSP_EIFS_G (((REG32(ADR_MTX_DUR_SIFS_G)) & 0xffc00000 ) >> 22) ++#define GET_CH_STA1_DUR (((REG32(ADR_MTX_DBG_DAT3)) & 0x0000ffff ) >> 0) ++#define GET_CH_STA2_DUR (((REG32(ADR_MTX_DBG_DAT3)) & 0xffff0000 ) >> 16) ++#define GET_MTX_NAV (((REG32(ADR_MTX_NAV)) & 0x0000ffff ) >> 0) ++#define GET_MTX_MIB_CNT0 (((REG32(ADR_MTX_MIB_WSID0)) & 0x3fffffff ) >> 0) ++#define GET_MTX_MIB_EN0 (((REG32(ADR_MTX_MIB_WSID0)) & 0x40000000 ) >> 30) ++#define GET_MTX_MIB_CNT1 (((REG32(ADR_MTX_MIB_WSID1)) & 0x3fffffff ) >> 0) ++#define GET_MTX_MIB_EN1 (((REG32(ADR_MTX_MIB_WSID1)) & 0x40000000 ) >> 30) ++#define GET_CH_STA3_DUR (((REG32(ADR_MTX_DBG_DAT4)) & 0x0000ffff ) >> 0) ++#define GET_CH_STA4_DUR (((REG32(ADR_MTX_DBG_DAT4)) & 0xffff0000 ) >> 16) ++#define GET_TXQ0_MTX_Q_PRE_LD (((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0x00000002 ) >> 1) ++#define GET_TXQ0_MTX_Q_BKF_CNT_FIXED (((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0x00000004 ) >> 2) ++#define GET_TXQ0_MTX_Q_TXOP_SUB_FRM_TIME (((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0x00000008 ) >> 3) ++#define GET_TXQ0_MTX_Q_MB_NO_RLS (((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0x00000010 ) >> 4) ++#define GET_TXQ0_MTX_Q_TXOP_FRC_BUR (((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0x00000020 ) >> 5) ++#define GET_TXQ0_MTX_Q_RND_MODE (((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0x000000c0 ) >> 6) ++#define GET_TXQ0_MTX_Q_AIFSN (((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0x0000000f ) >> 0) ++#define GET_TXQ0_MTX_Q_ECWMIN (((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0x00000f00 ) >> 8) ++#define GET_TXQ0_MTX_Q_ECWMAX (((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0x0000f000 ) >> 12) ++#define GET_TXQ0_MTX_Q_TXOP_LIMIT (((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0xffff0000 ) >> 16) ++#define GET_TXQ0_MTX_Q_BKF_CNT (((REG32(ADR_TXQ0_MTX_Q_BKF_CNT)) & 0x0000ffff ) >> 0) ++#define GET_TXQ0_MTX_Q_SRC_LIMIT (((REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) & 0x000000ff ) >> 0) ++#define GET_TXQ0_MTX_Q_LRC_LIMIT (((REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) & 0x0000ff00 ) >> 8) ++#define GET_TXQ0_MTX_Q_ID_MAP_L (((REG32(ADR_TXQ0_MTX_Q_ID_MAP_L)) & 0xffffffff ) >> 0) ++#define GET_TXQ0_MTX_Q_TXOP_CH_THD (((REG32(ADR_TXQ0_MTX_Q_TXOP_CH_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ0_MTX_Q_TXOP_OV_THD (((REG32(ADR_TXQ0_MTX_Q_TXOP_OV_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ1_MTX_Q_PRE_LD (((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0x00000002 ) >> 1) ++#define GET_TXQ1_MTX_Q_BKF_CNT_FIXED (((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0x00000004 ) >> 2) ++#define GET_TXQ1_MTX_Q_TXOP_SUB_FRM_TIME (((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0x00000008 ) >> 3) ++#define GET_TXQ1_MTX_Q_MB_NO_RLS (((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0x00000010 ) >> 4) ++#define GET_TXQ1_MTX_Q_TXOP_FRC_BUR (((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0x00000020 ) >> 5) ++#define GET_TXQ1_MTX_Q_RND_MODE (((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0x000000c0 ) >> 6) ++#define GET_TXQ1_MTX_Q_AIFSN (((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0x0000000f ) >> 0) ++#define GET_TXQ1_MTX_Q_ECWMIN (((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0x00000f00 ) >> 8) ++#define GET_TXQ1_MTX_Q_ECWMAX (((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0x0000f000 ) >> 12) ++#define GET_TXQ1_MTX_Q_TXOP_LIMIT (((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0xffff0000 ) >> 16) ++#define GET_TXQ1_MTX_Q_BKF_CNT (((REG32(ADR_TXQ1_MTX_Q_BKF_CNT)) & 0x0000ffff ) >> 0) ++#define GET_TXQ1_MTX_Q_SRC_LIMIT (((REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) & 0x000000ff ) >> 0) ++#define GET_TXQ1_MTX_Q_LRC_LIMIT (((REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) & 0x0000ff00 ) >> 8) ++#define GET_TXQ1_MTX_Q_ID_MAP_L (((REG32(ADR_TXQ1_MTX_Q_ID_MAP_L)) & 0xffffffff ) >> 0) ++#define GET_TXQ1_MTX_Q_TXOP_CH_THD (((REG32(ADR_TXQ1_MTX_Q_TXOP_CH_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ1_MTX_Q_TXOP_OV_THD (((REG32(ADR_TXQ1_MTX_Q_TXOP_OV_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ2_MTX_Q_PRE_LD (((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0x00000002 ) >> 1) ++#define GET_TXQ2_MTX_Q_BKF_CNT_FIXED (((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0x00000004 ) >> 2) ++#define GET_TXQ2_MTX_Q_TXOP_SUB_FRM_TIME (((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0x00000008 ) >> 3) ++#define GET_TXQ2_MTX_Q_MB_NO_RLS (((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0x00000010 ) >> 4) ++#define GET_TXQ2_MTX_Q_TXOP_FRC_BUR (((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0x00000020 ) >> 5) ++#define GET_TXQ2_MTX_Q_RND_MODE (((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0x000000c0 ) >> 6) ++#define GET_TXQ2_MTX_Q_AIFSN (((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0x0000000f ) >> 0) ++#define GET_TXQ2_MTX_Q_ECWMIN (((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0x00000f00 ) >> 8) ++#define GET_TXQ2_MTX_Q_ECWMAX (((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0x0000f000 ) >> 12) ++#define GET_TXQ2_MTX_Q_TXOP_LIMIT (((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0xffff0000 ) >> 16) ++#define GET_TXQ2_MTX_Q_BKF_CNT (((REG32(ADR_TXQ2_MTX_Q_BKF_CNT)) & 0x0000ffff ) >> 0) ++#define GET_TXQ2_MTX_Q_SRC_LIMIT (((REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) & 0x000000ff ) >> 0) ++#define GET_TXQ2_MTX_Q_LRC_LIMIT (((REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) & 0x0000ff00 ) >> 8) ++#define GET_TXQ2_MTX_Q_ID_MAP_L (((REG32(ADR_TXQ2_MTX_Q_ID_MAP_L)) & 0xffffffff ) >> 0) ++#define GET_TXQ2_MTX_Q_TXOP_CH_THD (((REG32(ADR_TXQ2_MTX_Q_TXOP_CH_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ2_MTX_Q_TXOP_OV_THD (((REG32(ADR_TXQ2_MTX_Q_TXOP_OV_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ3_MTX_Q_PRE_LD (((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0x00000002 ) >> 1) ++#define GET_TXQ3_MTX_Q_BKF_CNT_FIXED (((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0x00000004 ) >> 2) ++#define GET_TXQ3_MTX_Q_TXOP_SUB_FRM_TIME (((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0x00000008 ) >> 3) ++#define GET_TXQ3_MTX_Q_MB_NO_RLS (((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0x00000010 ) >> 4) ++#define GET_TXQ3_MTX_Q_TXOP_FRC_BUR (((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0x00000020 ) >> 5) ++#define GET_TXQ3_MTX_Q_RND_MODE (((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0x000000c0 ) >> 6) ++#define GET_TXQ3_MTX_Q_AIFSN (((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0x0000000f ) >> 0) ++#define GET_TXQ3_MTX_Q_ECWMIN (((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0x00000f00 ) >> 8) ++#define GET_TXQ3_MTX_Q_ECWMAX (((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0x0000f000 ) >> 12) ++#define GET_TXQ3_MTX_Q_TXOP_LIMIT (((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0xffff0000 ) >> 16) ++#define GET_TXQ3_MTX_Q_BKF_CNT (((REG32(ADR_TXQ3_MTX_Q_BKF_CNT)) & 0x0000ffff ) >> 0) ++#define GET_TXQ3_MTX_Q_SRC_LIMIT (((REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) & 0x000000ff ) >> 0) ++#define GET_TXQ3_MTX_Q_LRC_LIMIT (((REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) & 0x0000ff00 ) >> 8) ++#define GET_TXQ3_MTX_Q_ID_MAP_L (((REG32(ADR_TXQ3_MTX_Q_ID_MAP_L)) & 0xffffffff ) >> 0) ++#define GET_TXQ3_MTX_Q_TXOP_CH_THD (((REG32(ADR_TXQ3_MTX_Q_TXOP_CH_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ3_MTX_Q_TXOP_OV_THD (((REG32(ADR_TXQ3_MTX_Q_TXOP_OV_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ4_MTX_Q_PRE_LD (((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0x00000002 ) >> 1) ++#define GET_TXQ4_MTX_Q_BKF_CNT_FIXED (((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0x00000004 ) >> 2) ++#define GET_TXQ4_MTX_Q_TXOP_SUB_FRM_TIME (((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0x00000008 ) >> 3) ++#define GET_TXQ4_MTX_Q_MB_NO_RLS (((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0x00000010 ) >> 4) ++#define GET_TXQ4_MTX_Q_TXOP_FRC_BUR (((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0x00000020 ) >> 5) ++#define GET_TXQ4_MTX_Q_RND_MODE (((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0x000000c0 ) >> 6) ++#define GET_TXQ4_MTX_Q_AIFSN (((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0x0000000f ) >> 0) ++#define GET_TXQ4_MTX_Q_ECWMIN (((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0x00000f00 ) >> 8) ++#define GET_TXQ4_MTX_Q_ECWMAX (((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0x0000f000 ) >> 12) ++#define GET_TXQ4_MTX_Q_TXOP_LIMIT (((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0xffff0000 ) >> 16) ++#define GET_TXQ4_MTX_Q_BKF_CNT (((REG32(ADR_TXQ4_MTX_Q_BKF_CNT)) & 0x0000ffff ) >> 0) ++#define GET_TXQ4_MTX_Q_SRC_LIMIT (((REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) & 0x000000ff ) >> 0) ++#define GET_TXQ4_MTX_Q_LRC_LIMIT (((REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) & 0x0000ff00 ) >> 8) ++#define GET_TXQ4_MTX_Q_ID_MAP_L (((REG32(ADR_TXQ4_MTX_Q_ID_MAP_L)) & 0xffffffff ) >> 0) ++#define GET_TXQ4_MTX_Q_TXOP_CH_THD (((REG32(ADR_TXQ4_MTX_Q_TXOP_CH_THD)) & 0x0000ffff ) >> 0) ++#define GET_TXQ4_MTX_Q_TXOP_OV_THD (((REG32(ADR_TXQ4_MTX_Q_TXOP_OV_THD)) & 0x0000ffff ) >> 0) ++#define GET_VALID0 (((REG32(ADR_WSID0)) & 0x00000001 ) >> 0) ++#define GET_PEER_QOS_EN0 (((REG32(ADR_WSID0)) & 0x00000002 ) >> 1) ++#define GET_PEER_OP_MODE0 (((REG32(ADR_WSID0)) & 0x0000000c ) >> 2) ++#define GET_PEER_HT_MODE0 (((REG32(ADR_WSID0)) & 0x00000030 ) >> 4) ++#define GET_PEER_MAC0_31_0 (((REG32(ADR_PEER_MAC0_0)) & 0xffffffff ) >> 0) ++#define GET_PEER_MAC0_47_32 (((REG32(ADR_PEER_MAC0_1)) & 0x0000ffff ) >> 0) ++#define GET_TX_ACK_POLICY_0_0 (((REG32(ADR_TX_ACK_POLICY_0_0)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_0 (((REG32(ADR_TX_SEQ_CTRL_0_0)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_1 (((REG32(ADR_TX_ACK_POLICY_0_1)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_1 (((REG32(ADR_TX_SEQ_CTRL_0_1)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_2 (((REG32(ADR_TX_ACK_POLICY_0_2)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_2 (((REG32(ADR_TX_SEQ_CTRL_0_2)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_3 (((REG32(ADR_TX_ACK_POLICY_0_3)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_3 (((REG32(ADR_TX_SEQ_CTRL_0_3)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_4 (((REG32(ADR_TX_ACK_POLICY_0_4)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_4 (((REG32(ADR_TX_SEQ_CTRL_0_4)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_5 (((REG32(ADR_TX_ACK_POLICY_0_5)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_5 (((REG32(ADR_TX_SEQ_CTRL_0_5)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_6 (((REG32(ADR_TX_ACK_POLICY_0_6)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_6 (((REG32(ADR_TX_SEQ_CTRL_0_6)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_0_7 (((REG32(ADR_TX_ACK_POLICY_0_7)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_0_7 (((REG32(ADR_TX_SEQ_CTRL_0_7)) & 0x00000fff ) >> 0) ++#define GET_VALID1 (((REG32(ADR_WSID1)) & 0x00000001 ) >> 0) ++#define GET_PEER_QOS_EN1 (((REG32(ADR_WSID1)) & 0x00000002 ) >> 1) ++#define GET_PEER_OP_MODE1 (((REG32(ADR_WSID1)) & 0x0000000c ) >> 2) ++#define GET_PEER_HT_MODE1 (((REG32(ADR_WSID1)) & 0x00000030 ) >> 4) ++#define GET_PEER_MAC1_31_0 (((REG32(ADR_PEER_MAC1_0)) & 0xffffffff ) >> 0) ++#define GET_PEER_MAC1_47_32 (((REG32(ADR_PEER_MAC1_1)) & 0x0000ffff ) >> 0) ++#define GET_TX_ACK_POLICY_1_0 (((REG32(ADR_TX_ACK_POLICY_1_0)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_0 (((REG32(ADR_TX_SEQ_CTRL_1_0)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_1 (((REG32(ADR_TX_ACK_POLICY_1_1)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_1 (((REG32(ADR_TX_SEQ_CTRL_1_1)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_2 (((REG32(ADR_TX_ACK_POLICY_1_2)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_2 (((REG32(ADR_TX_SEQ_CTRL_1_2)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_3 (((REG32(ADR_TX_ACK_POLICY_1_3)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_3 (((REG32(ADR_TX_SEQ_CTRL_1_3)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_4 (((REG32(ADR_TX_ACK_POLICY_1_4)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_4 (((REG32(ADR_TX_SEQ_CTRL_1_4)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_5 (((REG32(ADR_TX_ACK_POLICY_1_5)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_5 (((REG32(ADR_TX_SEQ_CTRL_1_5)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_6 (((REG32(ADR_TX_ACK_POLICY_1_6)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_6 (((REG32(ADR_TX_SEQ_CTRL_1_6)) & 0x00000fff ) >> 0) ++#define GET_TX_ACK_POLICY_1_7 (((REG32(ADR_TX_ACK_POLICY_1_7)) & 0x00000003 ) >> 0) ++#define GET_TX_SEQ_CTRL_1_7 (((REG32(ADR_TX_SEQ_CTRL_1_7)) & 0x00000fff ) >> 0) ++#define GET_INFO0 (((REG32(ADR_INFO0)) & 0xffffffff ) >> 0) ++#define GET_INFO1 (((REG32(ADR_INFO1)) & 0xffffffff ) >> 0) ++#define GET_INFO2 (((REG32(ADR_INFO2)) & 0xffffffff ) >> 0) ++#define GET_INFO3 (((REG32(ADR_INFO3)) & 0xffffffff ) >> 0) ++#define GET_INFO4 (((REG32(ADR_INFO4)) & 0xffffffff ) >> 0) ++#define GET_INFO5 (((REG32(ADR_INFO5)) & 0xffffffff ) >> 0) ++#define GET_INFO6 (((REG32(ADR_INFO6)) & 0xffffffff ) >> 0) ++#define GET_INFO7 (((REG32(ADR_INFO7)) & 0xffffffff ) >> 0) ++#define GET_INFO8 (((REG32(ADR_INFO8)) & 0xffffffff ) >> 0) ++#define GET_INFO9 (((REG32(ADR_INFO9)) & 0xffffffff ) >> 0) ++#define GET_INFO10 (((REG32(ADR_INFO10)) & 0xffffffff ) >> 0) ++#define GET_INFO11 (((REG32(ADR_INFO11)) & 0xffffffff ) >> 0) ++#define GET_INFO12 (((REG32(ADR_INFO12)) & 0xffffffff ) >> 0) ++#define GET_INFO13 (((REG32(ADR_INFO13)) & 0xffffffff ) >> 0) ++#define GET_INFO14 (((REG32(ADR_INFO14)) & 0xffffffff ) >> 0) ++#define GET_INFO15 (((REG32(ADR_INFO15)) & 0xffffffff ) >> 0) ++#define GET_INFO16 (((REG32(ADR_INFO16)) & 0xffffffff ) >> 0) ++#define GET_INFO17 (((REG32(ADR_INFO17)) & 0xffffffff ) >> 0) ++#define GET_INFO18 (((REG32(ADR_INFO18)) & 0xffffffff ) >> 0) ++#define GET_INFO19 (((REG32(ADR_INFO19)) & 0xffffffff ) >> 0) ++#define GET_INFO20 (((REG32(ADR_INFO20)) & 0xffffffff ) >> 0) ++#define GET_INFO21 (((REG32(ADR_INFO21)) & 0xffffffff ) >> 0) ++#define GET_INFO22 (((REG32(ADR_INFO22)) & 0xffffffff ) >> 0) ++#define GET_INFO23 (((REG32(ADR_INFO23)) & 0xffffffff ) >> 0) ++#define GET_INFO24 (((REG32(ADR_INFO24)) & 0xffffffff ) >> 0) ++#define GET_INFO25 (((REG32(ADR_INFO25)) & 0xffffffff ) >> 0) ++#define GET_INFO26 (((REG32(ADR_INFO26)) & 0xffffffff ) >> 0) ++#define GET_INFO27 (((REG32(ADR_INFO27)) & 0xffffffff ) >> 0) ++#define GET_INFO28 (((REG32(ADR_INFO28)) & 0xffffffff ) >> 0) ++#define GET_INFO29 (((REG32(ADR_INFO29)) & 0xffffffff ) >> 0) ++#define GET_INFO30 (((REG32(ADR_INFO30)) & 0xffffffff ) >> 0) ++#define GET_INFO31 (((REG32(ADR_INFO31)) & 0xffffffff ) >> 0) ++#define GET_INFO32 (((REG32(ADR_INFO32)) & 0xffffffff ) >> 0) ++#define GET_INFO33 (((REG32(ADR_INFO33)) & 0xffffffff ) >> 0) ++#define GET_INFO34 (((REG32(ADR_INFO34)) & 0xffffffff ) >> 0) ++#define GET_INFO35 (((REG32(ADR_INFO35)) & 0xffffffff ) >> 0) ++#define GET_INFO36 (((REG32(ADR_INFO36)) & 0xffffffff ) >> 0) ++#define GET_INFO37 (((REG32(ADR_INFO37)) & 0xffffffff ) >> 0) ++#define GET_INFO38 (((REG32(ADR_INFO38)) & 0xffffffff ) >> 0) ++#define GET_INFO_MASK (((REG32(ADR_INFO_MASK)) & 0xffffffff ) >> 0) ++#define GET_INFO_DEF_RATE (((REG32(ADR_INFO_RATE_OFFSET)) & 0x0000003f ) >> 0) ++#define GET_INFO_MRX_OFFSET (((REG32(ADR_INFO_RATE_OFFSET)) & 0x000f0000 ) >> 16) ++#define GET_BCAST_RATEUNKNOW (((REG32(ADR_INFO_RATE_OFFSET)) & 0x3f000000 ) >> 24) ++#define GET_INFO_IDX_TBL_ADDR (((REG32(ADR_INFO_IDX_ADDR)) & 0xffffffff ) >> 0) ++#define GET_INFO_LEN_TBL_ADDR (((REG32(ADR_INFO_LEN_ADDR)) & 0xffffffff ) >> 0) ++#define GET_IC_TAG_31_0 (((REG32(ADR_IC_TIME_TAG_0)) & 0xffffffff ) >> 0) ++#define GET_IC_TAG_63_32 (((REG32(ADR_IC_TIME_TAG_1)) & 0xffffffff ) >> 0) ++#define GET_CH1_PRI (((REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) & 0x00000003 ) >> 0) ++#define GET_CH2_PRI (((REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) & 0x00000300 ) >> 8) ++#define GET_CH3_PRI (((REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) & 0x00030000 ) >> 16) ++#define GET_RG_MAC_LPBK (((REG32(ADR_MAC_MODE)) & 0x00000001 ) >> 0) ++#define GET_RG_MAC_M2M (((REG32(ADR_MAC_MODE)) & 0x00000002 ) >> 1) ++#define GET_RG_PHY_LPBK (((REG32(ADR_MAC_MODE)) & 0x00000004 ) >> 2) ++#define GET_RG_LPBK_RX_EN (((REG32(ADR_MAC_MODE)) & 0x00000008 ) >> 3) ++#define GET_EXT_MAC_MODE (((REG32(ADR_MAC_MODE)) & 0x00000010 ) >> 4) ++#define GET_EXT_PHY_MODE (((REG32(ADR_MAC_MODE)) & 0x00000020 ) >> 5) ++#define GET_ASIC_TAG (((REG32(ADR_MAC_MODE)) & 0xff000000 ) >> 24) ++#define GET_HCI_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000001 ) >> 0) ++#define GET_CO_PROC_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000002 ) >> 1) ++#define GET_MTX_MISC_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000008 ) >> 3) ++#define GET_MTX_QUE_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000010 ) >> 4) ++#define GET_MTX_CHST_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000020 ) >> 5) ++#define GET_MTX_BCN_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000040 ) >> 6) ++#define GET_MRX_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000080 ) >> 7) ++#define GET_AMPDU_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000100 ) >> 8) ++#define GET_MMU_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000200 ) >> 9) ++#define GET_ID_MNG_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00000800 ) >> 11) ++#define GET_MBOX_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00001000 ) >> 12) ++#define GET_SCRT_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00002000 ) >> 13) ++#define GET_MIC_SW_RST (((REG32(ADR_ALL_SOFTWARE_RESET)) & 0x00004000 ) >> 14) ++#define GET_CO_PROC_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000002 ) >> 1) ++#define GET_MTX_MISC_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000008 ) >> 3) ++#define GET_MTX_QUE_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000010 ) >> 4) ++#define GET_MTX_CHST_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000020 ) >> 5) ++#define GET_MTX_BCN_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000040 ) >> 6) ++#define GET_MRX_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000080 ) >> 7) ++#define GET_AMPDU_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00000100 ) >> 8) ++#define GET_ID_MNG_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00004000 ) >> 14) ++#define GET_MBOX_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00008000 ) >> 15) ++#define GET_SCRT_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00010000 ) >> 16) ++#define GET_MIC_ENG_RST (((REG32(ADR_ENG_SOFTWARE_RESET)) & 0x00020000 ) >> 17) ++#define GET_CO_PROC_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000002 ) >> 1) ++#define GET_MTX_MISC_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000008 ) >> 3) ++#define GET_MTX_QUE0_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000010 ) >> 4) ++#define GET_MTX_QUE1_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000020 ) >> 5) ++#define GET_MTX_QUE2_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000040 ) >> 6) ++#define GET_MTX_QUE3_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000080 ) >> 7) ++#define GET_MTX_QUE4_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000100 ) >> 8) ++#define GET_MTX_QUE5_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000200 ) >> 9) ++#define GET_MRX_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000400 ) >> 10) ++#define GET_AMPDU_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00000800 ) >> 11) ++#define GET_SCRT_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00002000 ) >> 13) ++#define GET_ID_MNG_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00004000 ) >> 14) ++#define GET_MBOX_CSR_RST (((REG32(ADR_CSR_SOFTWARE_RESET)) & 0x00008000 ) >> 15) ++#define GET_HCI_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000001 ) >> 0) ++#define GET_CO_PROC_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000002 ) >> 1) ++#define GET_MTX_MISC_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000008 ) >> 3) ++#define GET_MTX_QUE_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000010 ) >> 4) ++#define GET_MRX_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000020 ) >> 5) ++#define GET_AMPDU_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000040 ) >> 6) ++#define GET_MMU_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000080 ) >> 7) ++#define GET_ID_MNG_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000200 ) >> 9) ++#define GET_MBOX_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000400 ) >> 10) ++#define GET_SCRT_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00000800 ) >> 11) ++#define GET_MIC_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00001000 ) >> 12) ++#define GET_MIB_CLK_EN (((REG32(ADR_MAC_CLOCK_ENABLE)) & 0x00002000 ) >> 13) ++#define GET_HCI_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00000001 ) >> 0) ++#define GET_CO_PROC_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00000002 ) >> 1) ++#define GET_MTX_MISC_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00000008 ) >> 3) ++#define GET_MTX_QUE_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00000010 ) >> 4) ++#define GET_MRX_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00000020 ) >> 5) ++#define GET_AMPDU_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00000040 ) >> 6) ++#define GET_ID_MNG_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00001000 ) >> 12) ++#define GET_MBOX_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00002000 ) >> 13) ++#define GET_SCRT_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00004000 ) >> 14) ++#define GET_MIC_ENG_CLK_EN (((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0x00008000 ) >> 15) ++#define GET_CO_PROC_CSR_CLK_EN (((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0x00000002 ) >> 1) ++#define GET_MRX_CSR_CLK_EN (((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0x00000400 ) >> 10) ++#define GET_AMPDU_CSR_CLK_EN (((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0x00000800 ) >> 11) ++#define GET_SCRT_CSR_CLK_EN (((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0x00002000 ) >> 13) ++#define GET_ID_MNG_CSR_CLK_EN (((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0x00004000 ) >> 14) ++#define GET_MBOX_CSR_CLK_EN (((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0x00008000 ) >> 15) ++#define GET_OP_MODE (((REG32(ADR_GLBLE_SET)) & 0x00000003 ) >> 0) ++#define GET_HT_MODE (((REG32(ADR_GLBLE_SET)) & 0x0000000c ) >> 2) ++#define GET_QOS_EN (((REG32(ADR_GLBLE_SET)) & 0x00000010 ) >> 4) ++#define GET_PB_OFFSET (((REG32(ADR_GLBLE_SET)) & 0x0000ff00 ) >> 8) ++#define GET_SNIFFER_MODE (((REG32(ADR_GLBLE_SET)) & 0x00010000 ) >> 16) ++#define GET_DUP_FLT (((REG32(ADR_GLBLE_SET)) & 0x00020000 ) >> 17) ++#define GET_TX_PKT_RSVD (((REG32(ADR_GLBLE_SET)) & 0x001c0000 ) >> 18) ++#define GET_AMPDU_SNIFFER (((REG32(ADR_GLBLE_SET)) & 0x00200000 ) >> 21) ++#define GET_REASON_TRAP0 (((REG32(ADR_REASON_TRAP0)) & 0xffffffff ) >> 0) ++#define GET_REASON_TRAP1 (((REG32(ADR_REASON_TRAP1)) & 0xffffffff ) >> 0) ++#define GET_BSSID_31_0 (((REG32(ADR_BSSID_0)) & 0xffffffff ) >> 0) ++#define GET_BSSID_47_32 (((REG32(ADR_BSSID_1)) & 0x0000ffff ) >> 0) ++#define GET_SCRT_STATE (((REG32(ADR_SCRT_STATE)) & 0x0000000f ) >> 0) ++#define GET_STA_MAC_31_0 (((REG32(ADR_STA_MAC_0)) & 0xffffffff ) >> 0) ++#define GET_STA_MAC_47_32 (((REG32(ADR_STA_MAC_1)) & 0x0000ffff ) >> 0) ++#define GET_PAIR_SCRT (((REG32(ADR_SCRT_SET)) & 0x00000007 ) >> 0) ++#define GET_GRP_SCRT (((REG32(ADR_SCRT_SET)) & 0x00000038 ) >> 3) ++#define GET_SCRT_PKT_ID (((REG32(ADR_SCRT_SET)) & 0x00001fc0 ) >> 6) ++#define GET_SCRT_RPLY_IGNORE (((REG32(ADR_SCRT_SET)) & 0x00010000 ) >> 16) ++#define GET_COEXIST_EN (((REG32(ADR_BTCX0)) & 0x00000001 ) >> 0) ++#define GET_WIRE_MODE (((REG32(ADR_BTCX0)) & 0x0000000e ) >> 1) ++#define GET_WL_RX_PRI (((REG32(ADR_BTCX0)) & 0x00000010 ) >> 4) ++#define GET_WL_TX_PRI (((REG32(ADR_BTCX0)) & 0x00000020 ) >> 5) ++#define GET_GURAN_USE_EN (((REG32(ADR_BTCX0)) & 0x00000100 ) >> 8) ++#define GET_GURAN_USE_CTRL (((REG32(ADR_BTCX0)) & 0x00000200 ) >> 9) ++#define GET_BEACON_TIMEOUT_EN (((REG32(ADR_BTCX0)) & 0x00000400 ) >> 10) ++#define GET_WLAN_ACT_POL (((REG32(ADR_BTCX0)) & 0x00000800 ) >> 11) ++#define GET_DUAL_ANT_EN (((REG32(ADR_BTCX0)) & 0x00001000 ) >> 12) ++#define GET_TRSW_PHY_POL (((REG32(ADR_BTCX0)) & 0x00010000 ) >> 16) ++#define GET_WIFI_TX_SW_POL (((REG32(ADR_BTCX0)) & 0x00020000 ) >> 17) ++#define GET_WIFI_RX_SW_POL (((REG32(ADR_BTCX0)) & 0x00040000 ) >> 18) ++#define GET_BT_SW_POL (((REG32(ADR_BTCX0)) & 0x00080000 ) >> 19) ++#define GET_BT_PRI_SMP_TIME (((REG32(ADR_BTCX1)) & 0x000000ff ) >> 0) ++#define GET_BT_STA_SMP_TIME (((REG32(ADR_BTCX1)) & 0x0000ff00 ) >> 8) ++#define GET_BEACON_TIMEOUT (((REG32(ADR_BTCX1)) & 0x00ff0000 ) >> 16) ++#define GET_WLAN_REMAIN_TIME (((REG32(ADR_BTCX1)) & 0xff000000 ) >> 24) ++#define GET_SW_MANUAL_EN (((REG32(ADR_SWITCH_CTL)) & 0x00000001 ) >> 0) ++#define GET_SW_WL_TX (((REG32(ADR_SWITCH_CTL)) & 0x00000002 ) >> 1) ++#define GET_SW_WL_RX (((REG32(ADR_SWITCH_CTL)) & 0x00000004 ) >> 2) ++#define GET_SW_BT_TRX (((REG32(ADR_SWITCH_CTL)) & 0x00000008 ) >> 3) ++#define GET_BT_TXBAR_MANUAL_EN (((REG32(ADR_SWITCH_CTL)) & 0x00000010 ) >> 4) ++#define GET_BT_TXBAR_SET (((REG32(ADR_SWITCH_CTL)) & 0x00000020 ) >> 5) ++#define GET_BT_BUSY_MANUAL_EN (((REG32(ADR_SWITCH_CTL)) & 0x00000100 ) >> 8) ++#define GET_BT_BUSY_SET (((REG32(ADR_SWITCH_CTL)) & 0x00000200 ) >> 9) ++#define GET_G0_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00000004 ) >> 2) ++#define GET_G0_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00000008 ) >> 3) ++#define GET_G1_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00000010 ) >> 4) ++#define GET_G1_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00000020 ) >> 5) ++#define GET_Q0_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00000040 ) >> 6) ++#define GET_Q0_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00000080 ) >> 7) ++#define GET_Q1_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00000100 ) >> 8) ++#define GET_Q1_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00000200 ) >> 9) ++#define GET_Q2_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00000400 ) >> 10) ++#define GET_Q2_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00000800 ) >> 11) ++#define GET_Q3_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00001000 ) >> 12) ++#define GET_Q3_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00002000 ) >> 13) ++#define GET_SCRT_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00004000 ) >> 14) ++#define GET_SCRT_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00008000 ) >> 15) ++#define GET_MISC_PKT_CLS_MIB_EN (((REG32(ADR_MIB_EN)) & 0x00010000 ) >> 16) ++#define GET_MISC_PKT_CLS_ONGOING (((REG32(ADR_MIB_EN)) & 0x00020000 ) >> 17) ++#define GET_MTX_WSID0_SUCC (((REG32(ADR_MTX_WSID0_SUCC)) & 0x0000ffff ) >> 0) ++#define GET_MTX_WSID0_FRM (((REG32(ADR_MTX_WSID0_FRM)) & 0x0000ffff ) >> 0) ++#define GET_MTX_WSID0_RETRY (((REG32(ADR_MTX_WSID0_RETRY)) & 0x0000ffff ) >> 0) ++#define GET_MTX_WSID0_TOTAL (((REG32(ADR_MTX_WSID0_TOTAL)) & 0x0000ffff ) >> 0) ++#define GET_MTX_GRP (((REG32(ADR_MTX_GROUP)) & 0x000fffff ) >> 0) ++#define GET_MTX_FAIL (((REG32(ADR_MTX_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_MTX_RETRY (((REG32(ADR_MTX_RETRY)) & 0x000fffff ) >> 0) ++#define GET_MTX_MULTI_RETRY (((REG32(ADR_MTX_MULTI_RETRY)) & 0x000fffff ) >> 0) ++#define GET_MTX_RTS_SUCC (((REG32(ADR_MTX_RTS_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_MTX_RTS_FAIL (((REG32(ADR_MTX_RTS_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_MTX_ACK_FAIL (((REG32(ADR_MTX_ACK_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_MTX_FRM (((REG32(ADR_MTX_FRM)) & 0x000fffff ) >> 0) ++#define GET_MTX_ACK_TX (((REG32(ADR_MTX_ACK_TX)) & 0x0000ffff ) >> 0) ++#define GET_MTX_CTS_TX (((REG32(ADR_MTX_CTS_TX)) & 0x0000ffff ) >> 0) ++#define GET_MRX_DUP (((REG32(ADR_MRX_DUP_FRM)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FRG (((REG32(ADR_MRX_FRG_FRM)) & 0x000fffff ) >> 0) ++#define GET_MRX_GRP (((REG32(ADR_MRX_GROUP_FRM)) & 0x000fffff ) >> 0) ++#define GET_MRX_FCS_ERR (((REG32(ADR_MRX_FCS_ERR)) & 0x0000ffff ) >> 0) ++#define GET_MRX_FCS_SUC (((REG32(ADR_MRX_FCS_SUCC)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MISS (((REG32(ADR_MRX_MISS)) & 0x0000ffff ) >> 0) ++#define GET_MRX_ALC_FAIL (((REG32(ADR_MRX_ALC_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_MRX_DAT_NTF (((REG32(ADR_MRX_DAT_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_RTS_NTF (((REG32(ADR_MRX_RTS_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_CTS_NTF (((REG32(ADR_MRX_CTS_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_ACK_NTF (((REG32(ADR_MRX_ACK_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_BA_NTF (((REG32(ADR_MRX_BA_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_DATA_NTF (((REG32(ADR_MRX_DATA_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MNG_NTF (((REG32(ADR_MRX_MNG_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_DAT_CRC_NTF (((REG32(ADR_MRX_DAT_CRC_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_BAR_NTF (((REG32(ADR_MRX_BAR_NTF)) & 0x0000ffff ) >> 0) ++#define GET_MRX_MB_MISS (((REG32(ADR_MRX_MB_MISS)) & 0x0000ffff ) >> 0) ++#define GET_MRX_NIDLE_MISS (((REG32(ADR_MRX_NIDLE_MISS)) & 0x0000ffff ) >> 0) ++#define GET_MRX_CSR_NTF (((REG32(ADR_MRX_CSR_NTF)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q0_SUCC (((REG32(ADR_DBG_Q0_FRM_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q0_FAIL (((REG32(ADR_DBG_Q0_FRM_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q0_ACK_SUCC (((REG32(ADR_DBG_Q0_ACK_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q0_ACK_FAIL (((REG32(ADR_DBG_Q0_ACK_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q1_SUCC (((REG32(ADR_DBG_Q1_FRM_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q1_FAIL (((REG32(ADR_DBG_Q1_FRM_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q1_ACK_SUCC (((REG32(ADR_DBG_Q1_ACK_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q1_ACK_FAIL (((REG32(ADR_DBG_Q1_ACK_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q2_SUCC (((REG32(ADR_DBG_Q2_FRM_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q2_FAIL (((REG32(ADR_DBG_Q2_FRM_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q2_ACK_SUCC (((REG32(ADR_DBG_Q2_ACK_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q2_ACK_FAIL (((REG32(ADR_DBG_Q2_ACK_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q3_SUCC (((REG32(ADR_DBG_Q3_FRM_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q3_FAIL (((REG32(ADR_DBG_Q3_FRM_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q3_ACK_SUCC (((REG32(ADR_DBG_Q3_ACK_SUCCESS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_Q3_ACK_FAIL (((REG32(ADR_DBG_Q3_ACK_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_SCRT_TKIP_CERR (((REG32(ADR_MIB_SCRT_TKIP0)) & 0x000fffff ) >> 0) ++#define GET_SCRT_TKIP_MIC_ERR (((REG32(ADR_MIB_SCRT_TKIP1)) & 0x000fffff ) >> 0) ++#define GET_SCRT_TKIP_RPLY (((REG32(ADR_MIB_SCRT_TKIP2)) & 0x000fffff ) >> 0) ++#define GET_SCRT_CCMP_RPLY (((REG32(ADR_MIB_SCRT_CCMP0)) & 0x000fffff ) >> 0) ++#define GET_SCRT_CCMP_CERR (((REG32(ADR_MIB_SCRT_CCMP1)) & 0x000fffff ) >> 0) ++#define GET_DBG_LEN_CRC_FAIL (((REG32(ADR_DBG_LEN_CRC_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_LEN_ALC_FAIL (((REG32(ADR_DBG_LEN_ALC_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_DBG_AMPDU_PASS (((REG32(ADR_DBG_AMPDU_PASS)) & 0x0000ffff ) >> 0) ++#define GET_DBG_AMPDU_FAIL (((REG32(ADR_DBG_AMPDU_FAIL)) & 0x0000ffff ) >> 0) ++#define GET_RXID_ALC_CNT_FAIL (((REG32(ADR_ID_ALC_FAIL1)) & 0x0000ffff ) >> 0) ++#define GET_RXID_ALC_LEN_FAIL (((REG32(ADR_ID_ALC_FAIL2)) & 0x0000ffff ) >> 0) ++#define GET_CBR_RG_EN_MANUAL (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_TX_EN (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_CBR_RG_TX_PA_EN (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_CBR_RG_TX_DAC_EN (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_CBR_RG_RX_AGC (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000010 ) >> 4) ++#define GET_CBR_RG_RX_GAIN_MANUAL (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000020 ) >> 5) ++#define GET_CBR_RG_RFG (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x000000c0 ) >> 6) ++#define GET_CBR_RG_PGAG (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00000f00 ) >> 8) ++#define GET_CBR_RG_MODE (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00003000 ) >> 12) ++#define GET_CBR_RG_EN_TX_TRSW (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00004000 ) >> 14) ++#define GET_CBR_RG_EN_SX (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00008000 ) >> 15) ++#define GET_CBR_RG_EN_RX_LNA (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00010000 ) >> 16) ++#define GET_CBR_RG_EN_RX_MIXER (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00020000 ) >> 17) ++#define GET_CBR_RG_EN_RX_DIV2 (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00040000 ) >> 18) ++#define GET_CBR_RG_EN_RX_LOBUF (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00080000 ) >> 19) ++#define GET_CBR_RG_EN_RX_TZ (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00100000 ) >> 20) ++#define GET_CBR_RG_EN_RX_FILTER (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00200000 ) >> 21) ++#define GET_CBR_RG_EN_RX_HPF (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00400000 ) >> 22) ++#define GET_CBR_RG_EN_RX_RSSI (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x00800000 ) >> 23) ++#define GET_CBR_RG_EN_ADC (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x01000000 ) >> 24) ++#define GET_CBR_RG_EN_TX_MOD (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x02000000 ) >> 25) ++#define GET_CBR_RG_EN_TX_DIV2 (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x04000000 ) >> 26) ++#define GET_CBR_RG_EN_TX_DIV2_BUF (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x08000000 ) >> 27) ++#define GET_CBR_RG_EN_TX_LOBF (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x10000000 ) >> 28) ++#define GET_CBR_RG_EN_RX_LOBF (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x20000000 ) >> 29) ++#define GET_CBR_RG_SEL_DPLL_CLK (((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0x40000000 ) >> 30) ++#define GET_CBR_RG_EN_TX_DPD (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_EN_TX_TSSI (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_CBR_RG_EN_RX_IQCAL (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_CBR_RG_EN_TX_DAC_CAL (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_CBR_RG_EN_TX_SELF_MIXER (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000010 ) >> 4) ++#define GET_CBR_RG_EN_TX_DAC_OUT (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000020 ) >> 5) ++#define GET_CBR_RG_EN_LDO_RX_FE (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000040 ) >> 6) ++#define GET_CBR_RG_EN_LDO_ABB (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000080 ) >> 7) ++#define GET_CBR_RG_EN_LDO_AFE (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000100 ) >> 8) ++#define GET_CBR_RG_EN_SX_CHPLDO (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000200 ) >> 9) ++#define GET_CBR_RG_EN_SX_LOBFLDO (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000400 ) >> 10) ++#define GET_CBR_RG_EN_IREF_RX (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00000800 ) >> 11) ++#define GET_CBR_RG_DCDC_MODE (((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0x00001000 ) >> 12) ++#define GET_CBR_RG_LDO_LEVEL_RX_FE (((REG32(ADR_CBR_LDO_REGISTER)) & 0x00000007 ) >> 0) ++#define GET_CBR_RG_LDO_LEVEL_ABB (((REG32(ADR_CBR_LDO_REGISTER)) & 0x00000038 ) >> 3) ++#define GET_CBR_RG_LDO_LEVEL_AFE (((REG32(ADR_CBR_LDO_REGISTER)) & 0x000001c0 ) >> 6) ++#define GET_CBR_RG_SX_LDO_CHP_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x00000e00 ) >> 9) ++#define GET_CBR_RG_SX_LDO_LOBF_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x00007000 ) >> 12) ++#define GET_CBR_RG_SX_LDO_XOSC_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x00038000 ) >> 15) ++#define GET_CBR_RG_DP_LDO_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x001c0000 ) >> 18) ++#define GET_CBR_RG_SX_LDO_VCO_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x00e00000 ) >> 21) ++#define GET_CBR_RG_TX_LDO_TX_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x07000000 ) >> 24) ++#define GET_CBR_RG_BUCK_LEVEL (((REG32(ADR_CBR_LDO_REGISTER)) & 0x38000000 ) >> 27) ++#define GET_CBR_RG_EN_RX_PADSW (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_EN_RX_TESTNODE (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00000002 ) >> 1) ++#define GET_CBR_RG_RX_ABBCFIX (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00000004 ) >> 2) ++#define GET_CBR_RG_RX_ABBCTUNE (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x000001f8 ) >> 3) ++#define GET_CBR_RG_RX_ABBOUT_TRI_STATE (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00000200 ) >> 9) ++#define GET_CBR_RG_RX_ABB_N_MODE (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00000400 ) >> 10) ++#define GET_CBR_RG_RX_EN_LOOPA (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00000800 ) >> 11) ++#define GET_CBR_RG_RX_FILTERI1ST (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00003000 ) >> 12) ++#define GET_CBR_RG_RX_FILTERI2ND (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_RX_FILTERI3RD (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00030000 ) >> 16) ++#define GET_CBR_RG_RX_FILTERI_COURSE (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x000c0000 ) >> 18) ++#define GET_CBR_RG_RX_FILTERVCM (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00300000 ) >> 20) ++#define GET_CBR_RG_RX_HPF3M (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00400000 ) >> 22) ++#define GET_CBR_RG_RX_HPF300K (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x00800000 ) >> 23) ++#define GET_CBR_RG_RX_HPFI (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x03000000 ) >> 24) ++#define GET_CBR_RG_RX_HPF_FINALCORNER (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x0c000000 ) >> 26) ++#define GET_CBR_RG_RX_HPF_SETTLE1_C (((REG32(ADR_CBR_ABB_REGISTER_1)) & 0x30000000 ) >> 28) ++#define GET_CBR_RG_RX_HPF_SETTLE1_R (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_RX_HPF_SETTLE2_C (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x0000000c ) >> 2) ++#define GET_CBR_RG_RX_HPF_SETTLE2_R (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00000030 ) >> 4) ++#define GET_CBR_RG_RX_HPF_VCMCON2 (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x000000c0 ) >> 6) ++#define GET_CBR_RG_RX_HPF_VCMCON (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00000300 ) >> 8) ++#define GET_CBR_RG_RX_OUTVCM (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00000c00 ) >> 10) ++#define GET_CBR_RG_RX_TZI (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00003000 ) >> 12) ++#define GET_CBR_RG_RX_TZ_OUT_TRISTATE (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00004000 ) >> 14) ++#define GET_CBR_RG_RX_TZ_VCM (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00018000 ) >> 15) ++#define GET_CBR_RG_EN_RX_RSSI_TESTNODE (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x000e0000 ) >> 17) ++#define GET_CBR_RG_RX_ADCRSSI_CLKSEL (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00100000 ) >> 20) ++#define GET_CBR_RG_RX_ADCRSSI_VCM (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x00600000 ) >> 21) ++#define GET_CBR_RG_RX_REC_LPFCORNER (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x01800000 ) >> 23) ++#define GET_CBR_RG_RSSI_CLOCK_GATING (((REG32(ADR_CBR_ABB_REGISTER_2)) & 0x02000000 ) >> 25) ++#define GET_CBR_RG_TXPGA_CAPSW (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_TXPGA_MAIN (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x000000fc ) >> 2) ++#define GET_CBR_RG_TXPGA_STEER (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x00003f00 ) >> 8) ++#define GET_CBR_RG_TXMOD_GMCELL (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_TXLPF_GMCELL (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x00030000 ) >> 16) ++#define GET_CBR_RG_PACELL_EN (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x001c0000 ) >> 18) ++#define GET_CBR_RG_PABIAS_CTRL (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x01e00000 ) >> 21) ++#define GET_CBR_RG_PABIAS_AB (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x02000000 ) >> 25) ++#define GET_CBR_RG_TX_DIV_VSET (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x0c000000 ) >> 26) ++#define GET_CBR_RG_TX_LOBUF_VSET (((REG32(ADR_CBR_TX_FE_REGISTER)) & 0x30000000 ) >> 28) ++#define GET_CBR_RG_RX_SQDC (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00000007 ) >> 0) ++#define GET_CBR_RG_RX_DIV2_CORE (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00000018 ) >> 3) ++#define GET_CBR_RG_RX_LOBUF (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00000060 ) >> 5) ++#define GET_CBR_RG_TX_DPDGM_BIAS (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00000780 ) >> 7) ++#define GET_CBR_RG_TX_DPD_DIV (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00007800 ) >> 11) ++#define GET_CBR_RG_TX_TSSI_BIAS (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00038000 ) >> 15) ++#define GET_CBR_RG_TX_TSSI_DIV (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x001c0000 ) >> 18) ++#define GET_CBR_RG_TX_TSSI_TESTMODE (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00200000 ) >> 21) ++#define GET_CBR_RG_TX_TSSI_TEST (((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0x00c00000 ) >> 22) ++#define GET_CBR_RG_RX_HG_LNA_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_RX_HG_LNAHGN_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x0000003c ) >> 2) ++#define GET_CBR_RG_RX_HG_LNAHGP_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x000003c0 ) >> 6) ++#define GET_CBR_RG_RX_HG_LNALG_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x00003c00 ) >> 10) ++#define GET_CBR_RG_RX_HG_TZ_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_RX_HG_TZ_CAP (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x00070000 ) >> 16) ++#define GET_CBR_RG_RX_MG_LNA_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_RX_MG_LNAHGN_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x0000003c ) >> 2) ++#define GET_CBR_RG_RX_MG_LNAHGP_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x000003c0 ) >> 6) ++#define GET_CBR_RG_RX_MG_LNALG_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x00003c00 ) >> 10) ++#define GET_CBR_RG_RX_MG_TZ_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_RX_MG_TZ_CAP (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x00070000 ) >> 16) ++#define GET_CBR_RG_RX_LG_LNA_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_RX_LG_LNAHGN_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x0000003c ) >> 2) ++#define GET_CBR_RG_RX_LG_LNAHGP_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x000003c0 ) >> 6) ++#define GET_CBR_RG_RX_LG_LNALG_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x00003c00 ) >> 10) ++#define GET_CBR_RG_RX_LG_TZ_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_RX_LG_TZ_CAP (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x00070000 ) >> 16) ++#define GET_CBR_RG_RX_ULG_LNA_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_RX_ULG_LNAHGN_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x0000003c ) >> 2) ++#define GET_CBR_RG_RX_ULG_LNAHGP_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x000003c0 ) >> 6) ++#define GET_CBR_RG_RX_ULG_LNALG_BIAS (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x00003c00 ) >> 10) ++#define GET_CBR_RG_RX_ULG_TZ_GC (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_RX_ULG_TZ_CAP (((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x00070000 ) >> 16) ++#define GET_CBR_RG_HPF1_FAST_SET_X (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_HPF1_FAST_SET_Y (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_CBR_RG_HPF1_FAST_SET_Z (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_CBR_RG_HPF_T1A (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000018 ) >> 3) ++#define GET_CBR_RG_HPF_T1B (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000060 ) >> 5) ++#define GET_CBR_RG_HPF_T1C (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000180 ) >> 7) ++#define GET_CBR_RG_RX_LNA_TRI_SEL (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00000600 ) >> 9) ++#define GET_CBR_RG_RX_LNA_SETTLE (((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0x00001800 ) >> 11) ++#define GET_CBR_RG_ADC_CLKSEL (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_ADC_DIBIAS (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00000006 ) >> 1) ++#define GET_CBR_RG_ADC_DIVR (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_CBR_RG_ADC_DVCMI (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00000030 ) >> 4) ++#define GET_CBR_RG_ADC_SAMSEL (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x000003c0 ) >> 6) ++#define GET_CBR_RG_ADC_STNBY (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00000400 ) >> 10) ++#define GET_CBR_RG_ADC_TESTMODE (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00000800 ) >> 11) ++#define GET_CBR_RG_ADC_TSEL (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x0000f000 ) >> 12) ++#define GET_CBR_RG_ADC_VRSEL (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00030000 ) >> 16) ++#define GET_CBR_RG_DICMP (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x000c0000 ) >> 18) ++#define GET_CBR_RG_DIOP (((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0x00300000 ) >> 20) ++#define GET_CBR_RG_DACI1ST (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_TX_DACLPF_ICOURSE (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x0000000c ) >> 2) ++#define GET_CBR_RG_TX_DACLPF_IFINE (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00000030 ) >> 4) ++#define GET_CBR_RG_TX_DACLPF_VCM (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x000000c0 ) >> 6) ++#define GET_CBR_RG_TX_DAC_CKEDGE_SEL (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00000100 ) >> 8) ++#define GET_CBR_RG_TX_DAC_IBIAS (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00000600 ) >> 9) ++#define GET_CBR_RG_TX_DAC_OS (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00003800 ) >> 11) ++#define GET_CBR_RG_TX_DAC_RCAL (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x0000c000 ) >> 14) ++#define GET_CBR_RG_TX_DAC_TSEL (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x000f0000 ) >> 16) ++#define GET_CBR_RG_TX_EN_VOLTAGE_IN (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00100000 ) >> 20) ++#define GET_CBR_RG_TXLPF_BYPASS (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00200000 ) >> 21) ++#define GET_CBR_RG_TXLPF_BOOSTI (((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0x00400000 ) >> 22) ++#define GET_CBR_RG_EN_SX_R3 (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_EN_SX_CH (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000002 ) >> 1) ++#define GET_CBR_RG_EN_SX_CHP (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000004 ) >> 2) ++#define GET_CBR_RG_EN_SX_DIVCK (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000008 ) >> 3) ++#define GET_CBR_RG_EN_SX_VCOBF (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000010 ) >> 4) ++#define GET_CBR_RG_EN_SX_VCO (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000020 ) >> 5) ++#define GET_CBR_RG_EN_SX_MOD (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000040 ) >> 6) ++#define GET_CBR_RG_EN_SX_LCK (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000080 ) >> 7) ++#define GET_CBR_RG_EN_SX_DITHER (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000100 ) >> 8) ++#define GET_CBR_RG_EN_SX_DELCAL (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000200 ) >> 9) ++#define GET_CBR_RG_EN_SX_PC_BYPASS (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000400 ) >> 10) ++#define GET_CBR_RG_EN_SX_VT_MON (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00000800 ) >> 11) ++#define GET_CBR_RG_EN_SX_VT_MON_DG (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00001000 ) >> 12) ++#define GET_CBR_RG_EN_SX_DIV (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00002000 ) >> 13) ++#define GET_CBR_RG_EN_SX_LPF (((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0x00004000 ) >> 14) ++#define GET_CBR_RG_SX_RFCTRL_F (((REG32(ADR_CBR_SYN_RGISTER_1)) & 0x00ffffff ) >> 0) ++#define GET_CBR_RG_SX_SEL_CP (((REG32(ADR_CBR_SYN_RGISTER_1)) & 0x0f000000 ) >> 24) ++#define GET_CBR_RG_SX_SEL_CS (((REG32(ADR_CBR_SYN_RGISTER_1)) & 0xf0000000 ) >> 28) ++#define GET_CBR_RG_SX_RFCTRL_CH (((REG32(ADR_CBR_SYN_RGISTER_2)) & 0x000007ff ) >> 0) ++#define GET_CBR_RG_SX_SEL_C3 (((REG32(ADR_CBR_SYN_RGISTER_2)) & 0x00007800 ) >> 11) ++#define GET_CBR_RG_SX_SEL_RS (((REG32(ADR_CBR_SYN_RGISTER_2)) & 0x000f8000 ) >> 15) ++#define GET_CBR_RG_SX_SEL_R3 (((REG32(ADR_CBR_SYN_RGISTER_2)) & 0x01f00000 ) >> 20) ++#define GET_CBR_RG_SX_SEL_ICHP (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x0000001f ) >> 0) ++#define GET_CBR_RG_SX_SEL_PCHP (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x000003e0 ) >> 5) ++#define GET_CBR_RG_SX_SEL_CHP_REGOP (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x00003c00 ) >> 10) ++#define GET_CBR_RG_SX_SEL_CHP_UNIOP (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x0003c000 ) >> 14) ++#define GET_CBR_RG_SX_CHP_IOST_POL (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x00040000 ) >> 18) ++#define GET_CBR_RG_SX_CHP_IOST (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x00380000 ) >> 19) ++#define GET_CBR_RG_SX_PFDSEL (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x00400000 ) >> 22) ++#define GET_CBR_RG_SX_PFD_SET (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x00800000 ) >> 23) ++#define GET_CBR_RG_SX_PFD_SET1 (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x01000000 ) >> 24) ++#define GET_CBR_RG_SX_PFD_SET2 (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x02000000 ) >> 25) ++#define GET_CBR_RG_SX_VBNCAS_SEL (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x04000000 ) >> 26) ++#define GET_CBR_RG_SX_PFD_RST_H (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x08000000 ) >> 27) ++#define GET_CBR_RG_SX_PFD_TRUP (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x10000000 ) >> 28) ++#define GET_CBR_RG_SX_PFD_TRDN (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x20000000 ) >> 29) ++#define GET_CBR_RG_SX_PFD_TRSEL (((REG32(ADR_CBR_SYN_PFD_CHP)) & 0x40000000 ) >> 30) ++#define GET_CBR_RG_SX_VCOBA_R (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x00000007 ) >> 0) ++#define GET_CBR_RG_SX_VCORSEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x000000f8 ) >> 3) ++#define GET_CBR_RG_SX_VCOCUSEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x00000f00 ) >> 8) ++#define GET_CBR_RG_SX_RXBFSEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x0000f000 ) >> 12) ++#define GET_CBR_RG_SX_TXBFSEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x000f0000 ) >> 16) ++#define GET_CBR_RG_SX_VCOBFSEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x00f00000 ) >> 20) ++#define GET_CBR_RG_SX_DIVBFSEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x0f000000 ) >> 24) ++#define GET_CBR_RG_SX_GNDR_SEL (((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xf0000000 ) >> 28) ++#define GET_CBR_RG_SX_DITHER_WEIGHT (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_SX_MOD_ERRCMP (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x0000000c ) >> 2) ++#define GET_CBR_RG_SX_MOD_ORDER (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000030 ) >> 4) ++#define GET_CBR_RG_SX_SDM_D1 (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000040 ) >> 6) ++#define GET_CBR_RG_SX_SDM_D2 (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000080 ) >> 7) ++#define GET_CBR_RG_SDM_PASS (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000100 ) >> 8) ++#define GET_CBR_RG_SX_RST_H_DIV (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000200 ) >> 9) ++#define GET_CBR_RG_SX_SDM_EDGE (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00000400 ) >> 10) ++#define GET_CBR_RG_SX_XO_GM (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00001800 ) >> 11) ++#define GET_CBR_RG_SX_REFBYTWO (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00002000 ) >> 13) ++#define GET_CBR_RG_SX_XO_SWCAP (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x0003c000 ) >> 14) ++#define GET_CBR_RG_SX_SDMLUT_INV (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00040000 ) >> 18) ++#define GET_CBR_RG_SX_LCKEN (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00080000 ) >> 19) ++#define GET_CBR_RG_SX_PREVDD (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x00f00000 ) >> 20) ++#define GET_CBR_RG_SX_PSCONTERVDD (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x0f000000 ) >> 24) ++#define GET_CBR_RG_SX_MOD_ERR_DELAY (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x30000000 ) >> 28) ++#define GET_CBR_RG_SX_MODDB (((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0x40000000 ) >> 30) ++#define GET_CBR_RG_SX_CV_CURVE_SEL (((REG32(ADR_CBR_SYN_LCK1)) & 0x00000003 ) >> 0) ++#define GET_CBR_RG_SX_SEL_DELAY (((REG32(ADR_CBR_SYN_LCK1)) & 0x0000007c ) >> 2) ++#define GET_CBR_RG_SX_REF_CYCLE (((REG32(ADR_CBR_SYN_LCK1)) & 0x00000780 ) >> 7) ++#define GET_CBR_RG_SX_VCOBY16 (((REG32(ADR_CBR_SYN_LCK1)) & 0x00000800 ) >> 11) ++#define GET_CBR_RG_SX_VCOBY32 (((REG32(ADR_CBR_SYN_LCK1)) & 0x00001000 ) >> 12) ++#define GET_CBR_RG_SX_PH (((REG32(ADR_CBR_SYN_LCK1)) & 0x00002000 ) >> 13) ++#define GET_CBR_RG_SX_PL (((REG32(ADR_CBR_SYN_LCK1)) & 0x00004000 ) >> 14) ++#define GET_CBR_RG_SX_VT_MON_MODE (((REG32(ADR_CBR_SYN_LCK2)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_SX_VT_TH_HI (((REG32(ADR_CBR_SYN_LCK2)) & 0x00000006 ) >> 1) ++#define GET_CBR_RG_SX_VT_TH_LO (((REG32(ADR_CBR_SYN_LCK2)) & 0x00000018 ) >> 3) ++#define GET_CBR_RG_SX_VT_SET (((REG32(ADR_CBR_SYN_LCK2)) & 0x00000020 ) >> 5) ++#define GET_CBR_RG_SX_VT_MON_TMR (((REG32(ADR_CBR_SYN_LCK2)) & 0x00007fc0 ) >> 6) ++#define GET_CBR_RG_IDEAL_CYCLE (((REG32(ADR_CBR_SYN_LCK2)) & 0x0fff8000 ) >> 15) ++#define GET_CBR_RG_EN_DP_VT_MON (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_DP_VT_TH_HI (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x00000006 ) >> 1) ++#define GET_CBR_RG_DP_VT_TH_LO (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x00000018 ) >> 3) ++#define GET_CBR_RG_DP_VT_MON_TMR (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x00003fe0 ) >> 5) ++#define GET_CBR_RG_DP_CK320BY2 (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x00004000 ) >> 14) ++#define GET_CBR_RG_SX_DELCTRL (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x001f8000 ) >> 15) ++#define GET_CBR_RG_DP_OD_TEST (((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0x00200000 ) >> 21) ++#define GET_CBR_RG_DP_BBPLL_BP (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_DP_BBPLL_ICP (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00000006 ) >> 1) ++#define GET_CBR_RG_DP_BBPLL_IDUAL (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00000018 ) >> 3) ++#define GET_CBR_RG_DP_BBPLL_OD_TEST (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x000001e0 ) >> 5) ++#define GET_CBR_RG_DP_BBPLL_PD (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00000200 ) >> 9) ++#define GET_CBR_RG_DP_BBPLL_TESTSEL (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00001c00 ) >> 10) ++#define GET_CBR_RG_DP_BBPLL_PFD_DLY (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00006000 ) >> 13) ++#define GET_CBR_RG_DP_RP (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00038000 ) >> 15) ++#define GET_CBR_RG_DP_RHP (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x000c0000 ) >> 18) ++#define GET_CBR_RG_DP_DR3 (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x00700000 ) >> 20) ++#define GET_CBR_RG_DP_DCP (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x07800000 ) >> 23) ++#define GET_CBR_RG_DP_DCS (((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x78000000 ) >> 27) ++#define GET_CBR_RG_DP_FBDIV (((REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) & 0x00000fff ) >> 0) ++#define GET_CBR_RG_DP_FODIV (((REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) & 0x003ff000 ) >> 12) ++#define GET_CBR_RG_DP_REFDIV (((REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) & 0xffc00000 ) >> 22) ++#define GET_CBR_RG_IDACAI_PGAG15 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG15 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG14 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG14 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG13 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG13 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG12 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG12 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG11 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG11 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG10 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG10 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG9 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG9 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG8 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG8 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG7 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG7 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG6 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG6 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG5 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG5 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG4 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG4 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG3 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG3 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG2 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG2 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_IDACAI_PGAG1 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0x0000003f ) >> 0) ++#define GET_CBR_RG_IDACAQ_PGAG1 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0x00000fc0 ) >> 6) ++#define GET_CBR_RG_IDACAI_PGAG0 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0x0003f000 ) >> 12) ++#define GET_CBR_RG_IDACAQ_PGAG0 (((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0x00fc0000 ) >> 18) ++#define GET_CBR_RG_EN_RCAL (((REG32(ADR_CBR_RCAL_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_RCAL_SPD (((REG32(ADR_CBR_RCAL_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_CBR_RG_RCAL_TMR (((REG32(ADR_CBR_RCAL_REGISTER)) & 0x000001fc ) >> 2) ++#define GET_CBR_RG_RCAL_CODE_CWR (((REG32(ADR_CBR_RCAL_REGISTER)) & 0x00000200 ) >> 9) ++#define GET_CBR_RG_RCAL_CODE_CWD (((REG32(ADR_CBR_RCAL_REGISTER)) & 0x00007c00 ) >> 10) ++#define GET_CBR_RG_SX_SUB_SEL_CWR (((REG32(ADR_CBR_MANUAL_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_SX_SUB_SEL_CWD (((REG32(ADR_CBR_MANUAL_REGISTER)) & 0x000000fe ) >> 1) ++#define GET_CBR_RG_DP_BBPLL_BS_CWR (((REG32(ADR_CBR_MANUAL_REGISTER)) & 0x00000100 ) >> 8) ++#define GET_CBR_RG_DP_BBPLL_BS_CWD (((REG32(ADR_CBR_MANUAL_REGISTER)) & 0x00007e00 ) >> 9) ++#define GET_CBR_RCAL_RDY (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00000001 ) >> 0) ++#define GET_CBR_DA_LCK_RDY (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00000002 ) >> 1) ++#define GET_CBR_VT_MON_RDY (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00000004 ) >> 2) ++#define GET_CBR_DP_VT_MON_RDY (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00000008 ) >> 3) ++#define GET_CBR_CH_RDY (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00000010 ) >> 4) ++#define GET_CBR_DA_R_CODE_LUT (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x000007c0 ) >> 6) ++#define GET_CBR_AD_SX_VT_MON_Q (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00001800 ) >> 11) ++#define GET_CBR_AD_DP_VT_MON_Q (((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0x00006000 ) >> 13) ++#define GET_CBR_DA_R_CAL_CODE (((REG32(ADR_CBR_READ_ONLY_FLAGS_2)) & 0x0000001f ) >> 0) ++#define GET_CBR_DA_SX_SUB_SEL (((REG32(ADR_CBR_READ_ONLY_FLAGS_2)) & 0x00000fe0 ) >> 5) ++#define GET_CBR_DA_DP_BBPLL_BS (((REG32(ADR_CBR_READ_ONLY_FLAGS_2)) & 0x0003f000 ) >> 12) ++#define GET_CBR_TX_EN (((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0x00000001 ) >> 0) ++#define GET_CBR_TX_CNT_RST (((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0x00000002 ) >> 1) ++#define GET_CBR_IFS_TIME (((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0x000000fc ) >> 2) ++#define GET_CBR_LENGTH_TARGET (((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0x000fff00 ) >> 8) ++#define GET_CBR_TX_CNT_TARGET (((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0xff000000 ) >> 24) ++#define GET_CBR_TC_CNT_TARGET (((REG32(ADR_CBR_RG_PKT_GEN_1)) & 0x00ffffff ) >> 0) ++#define GET_CBR_PLCP_PSDU_DATA_MEM (((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0x000000ff ) >> 0) ++#define GET_CBR_PLCP_PSDU_PREAMBLE_SHORT (((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0x00000100 ) >> 8) ++#define GET_CBR_PLCP_BYTE_LENGTH (((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0x001ffe00 ) >> 9) ++#define GET_CBR_PLCP_PSDU_RATE (((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0x00600000 ) >> 21) ++#define GET_CBR_TAIL_TIME (((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0x1f800000 ) >> 23) ++#define GET_CBR_RG_O_PAD_PD (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000001 ) >> 0) ++#define GET_CBR_RG_I_PAD_PD (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000002 ) >> 1) ++#define GET_CBR_SEL_ADCKP_INV (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000004 ) >> 2) ++#define GET_CBR_RG_PAD_DS (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000008 ) >> 3) ++#define GET_CBR_SEL_ADCKP_MUX (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000010 ) >> 4) ++#define GET_CBR_RG_PAD_DS_CLK (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000020 ) >> 5) ++#define GET_CBR_INTP_SEL (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000200 ) >> 9) ++#define GET_CBR_IQ_SWP (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000400 ) >> 10) ++#define GET_CBR_RG_EN_EXT_DA (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00000800 ) >> 11) ++#define GET_CBR_RG_DIS_DA_OFFSET (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00001000 ) >> 12) ++#define GET_CBR_DBG_SEL (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x000f0000 ) >> 16) ++#define GET_CBR_DBG_EN (((REG32(ADR_CBR_RG_INTEGRATION)) & 0x00100000 ) >> 20) ++#define GET_CBR_RG_PKT_GEN_TX_CNT (((REG32(ADR_CBR_RG_PKT_GEN_TXCNT)) & 0xffffffff ) >> 0) ++#define GET_CBR_TP_SEL (((REG32(ADR_CBR_PATTERN_GEN)) & 0x0000001f ) >> 0) ++#define GET_CBR_IDEAL_IQ_EN (((REG32(ADR_CBR_PATTERN_GEN)) & 0x00000020 ) >> 5) ++#define GET_CBR_DATA_OUT_SEL (((REG32(ADR_CBR_PATTERN_GEN)) & 0x000001c0 ) >> 6) ++#define GET_CBR_TWO_TONE_EN (((REG32(ADR_CBR_PATTERN_GEN)) & 0x00000200 ) >> 9) ++#define GET_CBR_FREQ_SEL (((REG32(ADR_CBR_PATTERN_GEN)) & 0x00ff0000 ) >> 16) ++#define GET_CBR_IQ_SCALE (((REG32(ADR_CBR_PATTERN_GEN)) & 0xff000000 ) >> 24) ++#define GET_CPU_QUE_POP (((REG32(ADR_MB_CPU_INT)) & 0x00000001 ) >> 0) ++#define GET_CPU_INT (((REG32(ADR_MB_CPU_INT)) & 0x00000004 ) >> 2) ++#define GET_CPU_ID_TB0 (((REG32(ADR_CPU_ID_TB0)) & 0xffffffff ) >> 0) ++#define GET_CPU_ID_TB1 (((REG32(ADR_CPU_ID_TB1)) & 0xffffffff ) >> 0) ++#define GET_HW_PKTID (((REG32(ADR_CH0_TRIG_1)) & 0x000007ff ) >> 0) ++#define GET_CH0_INT_ADDR (((REG32(ADR_CH0_TRIG_0)) & 0xffffffff ) >> 0) ++#define GET_PRI_HW_PKTID (((REG32(ADR_CH0_PRI_TRIG)) & 0x000007ff ) >> 0) ++#define GET_CH0_FULL (((REG32(ADR_MCU_STATUS)) & 0x00000001 ) >> 0) ++#define GET_FF0_EMPTY (((REG32(ADR_MCU_STATUS)) & 0x00000002 ) >> 1) ++#define GET_RLS_BUSY (((REG32(ADR_MCU_STATUS)) & 0x00000200 ) >> 9) ++#define GET_RLS_COUNT_CLR (((REG32(ADR_MCU_STATUS)) & 0x00000400 ) >> 10) ++#define GET_RTN_COUNT_CLR (((REG32(ADR_MCU_STATUS)) & 0x00000800 ) >> 11) ++#define GET_RLS_COUNT (((REG32(ADR_MCU_STATUS)) & 0x00ff0000 ) >> 16) ++#define GET_RTN_COUNT (((REG32(ADR_MCU_STATUS)) & 0xff000000 ) >> 24) ++#define GET_FF0_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x0000001f ) >> 0) ++#define GET_FF1_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x000001e0 ) >> 5) ++#define GET_FF3_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x00003800 ) >> 11) ++#define GET_FF5_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x000e0000 ) >> 17) ++#define GET_FF6_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x00700000 ) >> 20) ++#define GET_FF7_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x03800000 ) >> 23) ++#define GET_FF8_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0x1c000000 ) >> 26) ++#define GET_FF9_CNT (((REG32(ADR_RD_IN_FFCNT1)) & 0xe0000000 ) >> 29) ++#define GET_FF10_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x00000007 ) >> 0) ++#define GET_FF11_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x00000038 ) >> 3) ++#define GET_FF12_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x000001c0 ) >> 6) ++#define GET_FF13_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x00000600 ) >> 9) ++#define GET_FF14_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x00001800 ) >> 11) ++#define GET_FF15_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x00006000 ) >> 13) ++#define GET_FF4_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x000f8000 ) >> 15) ++#define GET_FF2_CNT (((REG32(ADR_RD_IN_FFCNT2)) & 0x00700000 ) >> 20) ++#define GET_CH1_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000002 ) >> 1) ++#define GET_CH2_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000004 ) >> 2) ++#define GET_CH3_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000008 ) >> 3) ++#define GET_CH4_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000010 ) >> 4) ++#define GET_CH5_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000020 ) >> 5) ++#define GET_CH6_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000040 ) >> 6) ++#define GET_CH7_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000080 ) >> 7) ++#define GET_CH8_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000100 ) >> 8) ++#define GET_CH9_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000200 ) >> 9) ++#define GET_CH10_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000400 ) >> 10) ++#define GET_CH11_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00000800 ) >> 11) ++#define GET_CH12_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00001000 ) >> 12) ++#define GET_CH13_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00002000 ) >> 13) ++#define GET_CH14_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00004000 ) >> 14) ++#define GET_CH15_FULL (((REG32(ADR_RD_FFIN_FULL)) & 0x00008000 ) >> 15) ++#define GET_HALT_CH0 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000001 ) >> 0) ++#define GET_HALT_CH1 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000002 ) >> 1) ++#define GET_HALT_CH2 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000004 ) >> 2) ++#define GET_HALT_CH3 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000008 ) >> 3) ++#define GET_HALT_CH4 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000010 ) >> 4) ++#define GET_HALT_CH5 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000020 ) >> 5) ++#define GET_HALT_CH6 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000040 ) >> 6) ++#define GET_HALT_CH7 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000080 ) >> 7) ++#define GET_HALT_CH8 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000100 ) >> 8) ++#define GET_HALT_CH9 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000200 ) >> 9) ++#define GET_HALT_CH10 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000400 ) >> 10) ++#define GET_HALT_CH11 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00000800 ) >> 11) ++#define GET_HALT_CH12 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00001000 ) >> 12) ++#define GET_HALT_CH13 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00002000 ) >> 13) ++#define GET_HALT_CH14 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00004000 ) >> 14) ++#define GET_HALT_CH15 (((REG32(ADR_MBOX_HALT_CFG)) & 0x00008000 ) >> 15) ++#define GET_STOP_MBOX (((REG32(ADR_MBOX_HALT_CFG)) & 0x00010000 ) >> 16) ++#define GET_MB_ERR_AUTO_HALT_EN (((REG32(ADR_MBOX_HALT_CFG)) & 0x00100000 ) >> 20) ++#define GET_MB_EXCEPT_CLR (((REG32(ADR_MBOX_HALT_CFG)) & 0x00200000 ) >> 21) ++#define GET_MB_EXCEPT_CASE (((REG32(ADR_MBOX_HALT_CFG)) & 0xff000000 ) >> 24) ++#define GET_MB_DBG_TIME_STEP (((REG32(ADR_MB_DBG_CFG1)) & 0x0000ffff ) >> 0) ++#define GET_DBG_TYPE (((REG32(ADR_MB_DBG_CFG1)) & 0x00030000 ) >> 16) ++#define GET_MB_DBG_CLR (((REG32(ADR_MB_DBG_CFG1)) & 0x00040000 ) >> 18) ++#define GET_DBG_ALC_LOG_EN (((REG32(ADR_MB_DBG_CFG1)) & 0x00080000 ) >> 19) ++#define GET_MB_DBG_COUNTER_EN (((REG32(ADR_MB_DBG_CFG1)) & 0x01000000 ) >> 24) ++#define GET_MB_DBG_EN (((REG32(ADR_MB_DBG_CFG1)) & 0x80000000 ) >> 31) ++#define GET_MB_DBG_RECORD_CNT (((REG32(ADR_MB_DBG_CFG2)) & 0x0000ffff ) >> 0) ++#define GET_MB_DBG_LENGTH (((REG32(ADR_MB_DBG_CFG2)) & 0xffff0000 ) >> 16) ++#define GET_MB_DBG_CFG_ADDR (((REG32(ADR_MB_DBG_CFG3)) & 0xffffffff ) >> 0) ++#define GET_DBG_HWID0_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000001 ) >> 0) ++#define GET_DBG_HWID1_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000002 ) >> 1) ++#define GET_DBG_HWID2_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000004 ) >> 2) ++#define GET_DBG_HWID3_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000008 ) >> 3) ++#define GET_DBG_HWID4_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000010 ) >> 4) ++#define GET_DBG_HWID5_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000020 ) >> 5) ++#define GET_DBG_HWID6_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000040 ) >> 6) ++#define GET_DBG_HWID7_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000080 ) >> 7) ++#define GET_DBG_HWID8_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000100 ) >> 8) ++#define GET_DBG_HWID9_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000200 ) >> 9) ++#define GET_DBG_HWID10_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000400 ) >> 10) ++#define GET_DBG_HWID11_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00000800 ) >> 11) ++#define GET_DBG_HWID12_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00001000 ) >> 12) ++#define GET_DBG_HWID13_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00002000 ) >> 13) ++#define GET_DBG_HWID14_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00004000 ) >> 14) ++#define GET_DBG_HWID15_WR_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00008000 ) >> 15) ++#define GET_DBG_HWID0_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00010000 ) >> 16) ++#define GET_DBG_HWID1_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00020000 ) >> 17) ++#define GET_DBG_HWID2_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00040000 ) >> 18) ++#define GET_DBG_HWID3_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00080000 ) >> 19) ++#define GET_DBG_HWID4_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00100000 ) >> 20) ++#define GET_DBG_HWID5_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00200000 ) >> 21) ++#define GET_DBG_HWID6_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00400000 ) >> 22) ++#define GET_DBG_HWID7_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x00800000 ) >> 23) ++#define GET_DBG_HWID8_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x01000000 ) >> 24) ++#define GET_DBG_HWID9_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x02000000 ) >> 25) ++#define GET_DBG_HWID10_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x04000000 ) >> 26) ++#define GET_DBG_HWID11_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x08000000 ) >> 27) ++#define GET_DBG_HWID12_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x10000000 ) >> 28) ++#define GET_DBG_HWID13_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x20000000 ) >> 29) ++#define GET_DBG_HWID14_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x40000000 ) >> 30) ++#define GET_DBG_HWID15_RD_EN (((REG32(ADR_MB_DBG_CFG4)) & 0x80000000 ) >> 31) ++#define GET_MB_OUT_QUEUE_EN (((REG32(ADR_MB_OUT_QUEUE_CFG)) & 0x00000002 ) >> 1) ++#define GET_CH0_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000001 ) >> 0) ++#define GET_CH1_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000002 ) >> 1) ++#define GET_CH2_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000004 ) >> 2) ++#define GET_CH3_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000008 ) >> 3) ++#define GET_CH4_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000010 ) >> 4) ++#define GET_CH5_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000020 ) >> 5) ++#define GET_CH6_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000040 ) >> 6) ++#define GET_CH7_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000080 ) >> 7) ++#define GET_CH8_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000100 ) >> 8) ++#define GET_CH9_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000200 ) >> 9) ++#define GET_CH10_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000400 ) >> 10) ++#define GET_CH11_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00000800 ) >> 11) ++#define GET_CH12_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00001000 ) >> 12) ++#define GET_CH13_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00002000 ) >> 13) ++#define GET_CH14_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00004000 ) >> 14) ++#define GET_CH15_QUEUE_FLUSH (((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0x00008000 ) >> 15) ++#define GET_FFO0_CNT (((REG32(ADR_RD_FFOUT_CNT1)) & 0x0000001f ) >> 0) ++#define GET_FFO1_CNT (((REG32(ADR_RD_FFOUT_CNT1)) & 0x000003e0 ) >> 5) ++#define GET_FFO2_CNT (((REG32(ADR_RD_FFOUT_CNT1)) & 0x00000c00 ) >> 10) ++#define GET_FFO3_CNT (((REG32(ADR_RD_FFOUT_CNT1)) & 0x000f8000 ) >> 15) ++#define GET_FFO4_CNT (((REG32(ADR_RD_FFOUT_CNT1)) & 0x00300000 ) >> 20) ++#define GET_FFO5_CNT (((REG32(ADR_RD_FFOUT_CNT1)) & 0x0e000000 ) >> 25) ++#define GET_FFO6_CNT (((REG32(ADR_RD_FFOUT_CNT2)) & 0x0000000f ) >> 0) ++#define GET_FFO7_CNT (((REG32(ADR_RD_FFOUT_CNT2)) & 0x000003e0 ) >> 5) ++#define GET_FFO8_CNT (((REG32(ADR_RD_FFOUT_CNT2)) & 0x00007c00 ) >> 10) ++#define GET_FFO9_CNT (((REG32(ADR_RD_FFOUT_CNT2)) & 0x000f8000 ) >> 15) ++#define GET_FFO10_CNT (((REG32(ADR_RD_FFOUT_CNT2)) & 0x00f00000 ) >> 20) ++#define GET_FFO11_CNT (((REG32(ADR_RD_FFOUT_CNT2)) & 0x3e000000 ) >> 25) ++#define GET_FFO12_CNT (((REG32(ADR_RD_FFOUT_CNT3)) & 0x00000007 ) >> 0) ++#define GET_FFO13_CNT (((REG32(ADR_RD_FFOUT_CNT3)) & 0x00000060 ) >> 5) ++#define GET_FFO14_CNT (((REG32(ADR_RD_FFOUT_CNT3)) & 0x00000c00 ) >> 10) ++#define GET_FFO15_CNT (((REG32(ADR_RD_FFOUT_CNT3)) & 0x001f8000 ) >> 15) ++#define GET_CH0_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000001 ) >> 0) ++#define GET_CH1_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000002 ) >> 1) ++#define GET_CH2_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000004 ) >> 2) ++#define GET_CH3_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000008 ) >> 3) ++#define GET_CH4_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000010 ) >> 4) ++#define GET_CH5_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000020 ) >> 5) ++#define GET_CH6_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000040 ) >> 6) ++#define GET_CH7_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000080 ) >> 7) ++#define GET_CH8_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000100 ) >> 8) ++#define GET_CH9_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000200 ) >> 9) ++#define GET_CH10_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000400 ) >> 10) ++#define GET_CH11_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00000800 ) >> 11) ++#define GET_CH12_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00001000 ) >> 12) ++#define GET_CH13_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00002000 ) >> 13) ++#define GET_CH14_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00004000 ) >> 14) ++#define GET_CH15_FFO_FULL (((REG32(ADR_RD_FFOUT_FULL)) & 0x00008000 ) >> 15) ++#define GET_CH0_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000001 ) >> 0) ++#define GET_CH1_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000002 ) >> 1) ++#define GET_CH2_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000004 ) >> 2) ++#define GET_CH3_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000008 ) >> 3) ++#define GET_CH4_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000010 ) >> 4) ++#define GET_CH5_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000020 ) >> 5) ++#define GET_CH6_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000040 ) >> 6) ++#define GET_CH7_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000080 ) >> 7) ++#define GET_CH8_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000100 ) >> 8) ++#define GET_CH9_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000200 ) >> 9) ++#define GET_CH10_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000400 ) >> 10) ++#define GET_CH11_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00000800 ) >> 11) ++#define GET_CH12_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00001000 ) >> 12) ++#define GET_CH13_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00002000 ) >> 13) ++#define GET_CH14_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00004000 ) >> 14) ++#define GET_CH15_LOWTHOLD_INT (((REG32(ADR_MB_THRESHOLD6)) & 0x00008000 ) >> 15) ++#define GET_MB_LOW_THOLD_EN (((REG32(ADR_MB_THRESHOLD6)) & 0x80000000 ) >> 31) ++#define GET_CH0_LOWTHOLD (((REG32(ADR_MB_THRESHOLD7)) & 0x0000001f ) >> 0) ++#define GET_CH1_LOWTHOLD (((REG32(ADR_MB_THRESHOLD7)) & 0x00001f00 ) >> 8) ++#define GET_CH2_LOWTHOLD (((REG32(ADR_MB_THRESHOLD7)) & 0x001f0000 ) >> 16) ++#define GET_CH3_LOWTHOLD (((REG32(ADR_MB_THRESHOLD7)) & 0x1f000000 ) >> 24) ++#define GET_CH4_LOWTHOLD (((REG32(ADR_MB_THRESHOLD8)) & 0x0000001f ) >> 0) ++#define GET_CH5_LOWTHOLD (((REG32(ADR_MB_THRESHOLD8)) & 0x00001f00 ) >> 8) ++#define GET_CH6_LOWTHOLD (((REG32(ADR_MB_THRESHOLD8)) & 0x001f0000 ) >> 16) ++#define GET_CH7_LOWTHOLD (((REG32(ADR_MB_THRESHOLD8)) & 0x1f000000 ) >> 24) ++#define GET_CH8_LOWTHOLD (((REG32(ADR_MB_THRESHOLD9)) & 0x0000001f ) >> 0) ++#define GET_CH9_LOWTHOLD (((REG32(ADR_MB_THRESHOLD9)) & 0x00001f00 ) >> 8) ++#define GET_CH10_LOWTHOLD (((REG32(ADR_MB_THRESHOLD9)) & 0x001f0000 ) >> 16) ++#define GET_CH11_LOWTHOLD (((REG32(ADR_MB_THRESHOLD9)) & 0x1f000000 ) >> 24) ++#define GET_CH12_LOWTHOLD (((REG32(ADR_MB_THRESHOLD10)) & 0x0000001f ) >> 0) ++#define GET_CH13_LOWTHOLD (((REG32(ADR_MB_THRESHOLD10)) & 0x00001f00 ) >> 8) ++#define GET_CH14_LOWTHOLD (((REG32(ADR_MB_THRESHOLD10)) & 0x001f0000 ) >> 16) ++#define GET_CH15_LOWTHOLD (((REG32(ADR_MB_THRESHOLD10)) & 0x1f000000 ) >> 24) ++#define GET_TRASH_TIMEOUT_EN (((REG32(ADR_MB_TRASH_CFG)) & 0x00000001 ) >> 0) ++#define GET_TRASH_CAN_INT (((REG32(ADR_MB_TRASH_CFG)) & 0x00000002 ) >> 1) ++#define GET_TRASH_INT_ID (((REG32(ADR_MB_TRASH_CFG)) & 0x000007f0 ) >> 4) ++#define GET_TRASH_TIMEOUT (((REG32(ADR_MB_TRASH_CFG)) & 0x03ff0000 ) >> 16) ++#define GET_CH0_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000001 ) >> 0) ++#define GET_CH1_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000002 ) >> 1) ++#define GET_CH2_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000004 ) >> 2) ++#define GET_CH3_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000008 ) >> 3) ++#define GET_CH4_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000010 ) >> 4) ++#define GET_CH5_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000020 ) >> 5) ++#define GET_CH6_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000040 ) >> 6) ++#define GET_CH7_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000080 ) >> 7) ++#define GET_CH8_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000100 ) >> 8) ++#define GET_CH9_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000200 ) >> 9) ++#define GET_CH10_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000400 ) >> 10) ++#define GET_CH11_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00000800 ) >> 11) ++#define GET_CH12_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00001000 ) >> 12) ++#define GET_CH13_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00002000 ) >> 13) ++#define GET_CH14_WRFF_FLUSH (((REG32(ADR_MB_IN_FF_FLUSH)) & 0x00004000 ) >> 14) ++#define GET_CPU_ID_TB2 (((REG32(ADR_CPU_ID_TB2)) & 0xffffffff ) >> 0) ++#define GET_CPU_ID_TB3 (((REG32(ADR_CPU_ID_TB3)) & 0xffffffff ) >> 0) ++#define GET_IQ_LOG_EN (((REG32(ADR_PHY_IQ_LOG_CFG0)) & 0x00000001 ) >> 0) ++#define GET_IQ_LOG_STOP_MODE (((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0x00000001 ) >> 0) ++#define GET_GPIO_STOP_EN (((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0x00000010 ) >> 4) ++#define GET_GPIO_STOP_POL (((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0x00000020 ) >> 5) ++#define GET_IQ_LOG_TIMER (((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0xffff0000 ) >> 16) ++#define GET_IQ_LOG_LEN (((REG32(ADR_PHY_IQ_LOG_LEN)) & 0x0000ffff ) >> 0) ++#define GET_IQ_LOG_TAIL_ADR (((REG32(ADR_PHY_IQ_LOG_PTR)) & 0x0000ffff ) >> 0) ++#define GET_ALC_LENG (((REG32(ADR_WR_ALC)) & 0x0003ffff ) >> 0) ++#define GET_CH0_DYN_PRI (((REG32(ADR_WR_ALC)) & 0x00300000 ) >> 20) ++#define GET_MCU_PKTID (((REG32(ADR_GETID)) & 0xffffffff ) >> 0) ++#define GET_CH0_STA_PRI (((REG32(ADR_CH_STA_PRI)) & 0x00000003 ) >> 0) ++#define GET_CH1_STA_PRI (((REG32(ADR_CH_STA_PRI)) & 0x00000030 ) >> 4) ++#define GET_CH2_STA_PRI (((REG32(ADR_CH_STA_PRI)) & 0x00000300 ) >> 8) ++#define GET_CH3_STA_PRI (((REG32(ADR_CH_STA_PRI)) & 0x00003000 ) >> 12) ++#define GET_ID_TB0 (((REG32(ADR_RD_ID0)) & 0xffffffff ) >> 0) ++#define GET_ID_TB1 (((REG32(ADR_RD_ID1)) & 0xffffffff ) >> 0) ++#define GET_ID_MNG_HALT (((REG32(ADR_IMD_CFG)) & 0x00000010 ) >> 4) ++#define GET_ID_MNG_ERR_HALT_EN (((REG32(ADR_IMD_CFG)) & 0x00000020 ) >> 5) ++#define GET_ID_EXCEPT_FLG_CLR (((REG32(ADR_IMD_CFG)) & 0x00000040 ) >> 6) ++#define GET_ID_EXCEPT_FLG (((REG32(ADR_IMD_CFG)) & 0x00000080 ) >> 7) ++#define GET_ID_FULL (((REG32(ADR_IMD_STA)) & 0x00000001 ) >> 0) ++#define GET_ID_MNG_BUSY (((REG32(ADR_IMD_STA)) & 0x00000002 ) >> 1) ++#define GET_REQ_LOCK (((REG32(ADR_IMD_STA)) & 0x00000004 ) >> 2) ++#define GET_CH0_REQ_LOCK (((REG32(ADR_IMD_STA)) & 0x00000010 ) >> 4) ++#define GET_CH1_REQ_LOCK (((REG32(ADR_IMD_STA)) & 0x00000020 ) >> 5) ++#define GET_CH2_REQ_LOCK (((REG32(ADR_IMD_STA)) & 0x00000040 ) >> 6) ++#define GET_CH3_REQ_LOCK (((REG32(ADR_IMD_STA)) & 0x00000080 ) >> 7) ++#define GET_REQ_LOCK_INT_EN (((REG32(ADR_IMD_STA)) & 0x00000100 ) >> 8) ++#define GET_REQ_LOCK_INT (((REG32(ADR_IMD_STA)) & 0x00000200 ) >> 9) ++#define GET_MCU_ALC_READY (((REG32(ADR_ALC_STA)) & 0x00000001 ) >> 0) ++#define GET_ALC_FAIL (((REG32(ADR_ALC_STA)) & 0x00000002 ) >> 1) ++#define GET_ALC_BUSY (((REG32(ADR_ALC_STA)) & 0x00000004 ) >> 2) ++#define GET_CH0_NVLD (((REG32(ADR_ALC_STA)) & 0x00000010 ) >> 4) ++#define GET_CH1_NVLD (((REG32(ADR_ALC_STA)) & 0x00000020 ) >> 5) ++#define GET_CH2_NVLD (((REG32(ADR_ALC_STA)) & 0x00000040 ) >> 6) ++#define GET_CH3_NVLD (((REG32(ADR_ALC_STA)) & 0x00000080 ) >> 7) ++#define GET_ALC_INT_ID (((REG32(ADR_ALC_STA)) & 0x00007f00 ) >> 8) ++#define GET_ALC_TIMEOUT (((REG32(ADR_ALC_STA)) & 0x03ff0000 ) >> 16) ++#define GET_ALC_TIMEOUT_INT_EN (((REG32(ADR_ALC_STA)) & 0x40000000 ) >> 30) ++#define GET_ALC_TIMEOUT_INT (((REG32(ADR_ALC_STA)) & 0x80000000 ) >> 31) ++#define GET_TX_ID_COUNT (((REG32(ADR_TRX_ID_COUNT)) & 0x000000ff ) >> 0) ++#define GET_RX_ID_COUNT (((REG32(ADR_TRX_ID_COUNT)) & 0x0000ff00 ) >> 8) ++#define GET_TX_ID_THOLD (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x000000ff ) >> 0) ++#define GET_RX_ID_THOLD (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x0000ff00 ) >> 8) ++#define GET_ID_THOLD_RX_INT (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x00010000 ) >> 16) ++#define GET_RX_INT_CH (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x000e0000 ) >> 17) ++#define GET_ID_THOLD_TX_INT (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x00100000 ) >> 20) ++#define GET_TX_INT_CH (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x00e00000 ) >> 21) ++#define GET_ID_THOLD_INT_EN (((REG32(ADR_TRX_ID_THRESHOLD)) & 0x01000000 ) >> 24) ++#define GET_TX_ID_TB0 (((REG32(ADR_TX_ID0)) & 0xffffffff ) >> 0) ++#define GET_TX_ID_TB1 (((REG32(ADR_TX_ID1)) & 0xffffffff ) >> 0) ++#define GET_RX_ID_TB0 (((REG32(ADR_RX_ID0)) & 0xffffffff ) >> 0) ++#define GET_RX_ID_TB1 (((REG32(ADR_RX_ID1)) & 0xffffffff ) >> 0) ++#define GET_DOUBLE_RLS_INT_EN (((REG32(ADR_RTN_STA)) & 0x00000001 ) >> 0) ++#define GET_ID_DOUBLE_RLS_INT (((REG32(ADR_RTN_STA)) & 0x00000002 ) >> 1) ++#define GET_DOUBLE_RLS_ID (((REG32(ADR_RTN_STA)) & 0x00007f00 ) >> 8) ++#define GET_ID_LEN_THOLD_INT_EN (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x00000001 ) >> 0) ++#define GET_ALL_ID_LEN_THOLD_INT (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x00000002 ) >> 1) ++#define GET_TX_ID_LEN_THOLD_INT (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x00000004 ) >> 2) ++#define GET_RX_ID_LEN_THOLD_INT (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x00000008 ) >> 3) ++#define GET_ID_TX_LEN_THOLD (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x00001ff0 ) >> 4) ++#define GET_ID_RX_LEN_THOLD (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x003fe000 ) >> 13) ++#define GET_ID_LEN_THOLD (((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x7fc00000 ) >> 22) ++#define GET_ALL_ID_ALC_LEN (((REG32(ADR_ID_LEN_THREADSHOLD2)) & 0x000001ff ) >> 0) ++#define GET_TX_ID_ALC_LEN (((REG32(ADR_ID_LEN_THREADSHOLD2)) & 0x0003fe00 ) >> 9) ++#define GET_RX_ID_ALC_LEN (((REG32(ADR_ID_LEN_THREADSHOLD2)) & 0x07fc0000 ) >> 18) ++#define GET_CH_ARB_EN (((REG32(ADR_CH_ARB_PRI)) & 0x00000001 ) >> 0) ++#define GET_CH_PRI1 (((REG32(ADR_CH_ARB_PRI)) & 0x00000030 ) >> 4) ++#define GET_CH_PRI2 (((REG32(ADR_CH_ARB_PRI)) & 0x00000300 ) >> 8) ++#define GET_CH_PRI3 (((REG32(ADR_CH_ARB_PRI)) & 0x00003000 ) >> 12) ++#define GET_CH_PRI4 (((REG32(ADR_CH_ARB_PRI)) & 0x00030000 ) >> 16) ++#define GET_TX_ID_REMAIN (((REG32(ADR_TX_ID_REMAIN_STATUS)) & 0x0000007f ) >> 0) ++#define GET_TX_PAGE_REMAIN (((REG32(ADR_TX_ID_REMAIN_STATUS)) & 0x0001ff00 ) >> 8) ++#define GET_ID_PAGE_MAX_SIZE (((REG32(ADR_ID_INFO_STA)) & 0x000001ff ) >> 0) ++#define GET_TX_PAGE_LIMIT (((REG32(ADR_TX_LIMIT_INTR)) & 0x000001ff ) >> 0) ++#define GET_TX_COUNT_LIMIT (((REG32(ADR_TX_LIMIT_INTR)) & 0x00ff0000 ) >> 16) ++#define GET_TX_LIMIT_INT (((REG32(ADR_TX_LIMIT_INTR)) & 0x40000000 ) >> 30) ++#define GET_TX_LIMIT_INT_EN (((REG32(ADR_TX_LIMIT_INTR)) & 0x80000000 ) >> 31) ++#define GET_TX_PAGE_USE_7_0 (((REG32(ADR_TX_ID_ALL_INFO)) & 0x000000ff ) >> 0) ++#define GET_TX_ID_USE_5_0 (((REG32(ADR_TX_ID_ALL_INFO)) & 0x00003f00 ) >> 8) ++#define GET_EDCA0_FFO_CNT (((REG32(ADR_TX_ID_ALL_INFO)) & 0x0003c000 ) >> 14) ++#define GET_EDCA1_FFO_CNT_3_0 (((REG32(ADR_TX_ID_ALL_INFO)) & 0x003c0000 ) >> 18) ++#define GET_EDCA2_FFO_CNT (((REG32(ADR_TX_ID_ALL_INFO)) & 0x07c00000 ) >> 22) ++#define GET_EDCA3_FFO_CNT (((REG32(ADR_TX_ID_ALL_INFO)) & 0xf8000000 ) >> 27) ++#define GET_ID_TB2 (((REG32(ADR_RD_ID2)) & 0xffffffff ) >> 0) ++#define GET_ID_TB3 (((REG32(ADR_RD_ID3)) & 0xffffffff ) >> 0) ++#define GET_TX_ID_TB2 (((REG32(ADR_TX_ID2)) & 0xffffffff ) >> 0) ++#define GET_TX_ID_TB3 (((REG32(ADR_TX_ID3)) & 0xffffffff ) >> 0) ++#define GET_RX_ID_TB2 (((REG32(ADR_RX_ID2)) & 0xffffffff ) >> 0) ++#define GET_RX_ID_TB3 (((REG32(ADR_RX_ID3)) & 0xffffffff ) >> 0) ++#define GET_TX_PAGE_USE2 (((REG32(ADR_TX_ID_ALL_INFO2)) & 0x000001ff ) >> 0) ++#define GET_TX_ID_USE2 (((REG32(ADR_TX_ID_ALL_INFO2)) & 0x0001fe00 ) >> 9) ++#define GET_EDCA4_FFO_CNT (((REG32(ADR_TX_ID_ALL_INFO2)) & 0x001e0000 ) >> 17) ++#define GET_TX_PAGE_USE3 (((REG32(ADR_TX_ID_ALL_INFO_A)) & 0x000001ff ) >> 0) ++#define GET_TX_ID_USE3 (((REG32(ADR_TX_ID_ALL_INFO_A)) & 0x0001fe00 ) >> 9) ++#define GET_EDCA1_FFO_CNT2 (((REG32(ADR_TX_ID_ALL_INFO_A)) & 0x03e00000 ) >> 21) ++#define GET_EDCA4_FFO_CNT2 (((REG32(ADR_TX_ID_ALL_INFO_A)) & 0x3c000000 ) >> 26) ++#define GET_TX_PAGE_USE4 (((REG32(ADR_TX_ID_ALL_INFO_B)) & 0x000001ff ) >> 0) ++#define GET_TX_ID_USE4 (((REG32(ADR_TX_ID_ALL_INFO_B)) & 0x0001fe00 ) >> 9) ++#define GET_EDCA2_FFO_CNT2 (((REG32(ADR_TX_ID_ALL_INFO_B)) & 0x003e0000 ) >> 17) ++#define GET_EDCA3_FFO_CNT2 (((REG32(ADR_TX_ID_ALL_INFO_B)) & 0x07c00000 ) >> 22) ++#define GET_TX_ID_IFO_LEN (((REG32(ADR_TX_ID_REMAIN_STATUS2)) & 0x000001ff ) >> 0) ++#define GET_RX_ID_IFO_LEN (((REG32(ADR_TX_ID_REMAIN_STATUS2)) & 0x01ff0000 ) >> 16) ++#define GET_MAX_ALL_ALC_ID_CNT (((REG32(ADR_ALC_ID_INFO)) & 0x000000ff ) >> 0) ++#define GET_MAX_TX_ALC_ID_CNT (((REG32(ADR_ALC_ID_INFO)) & 0x0000ff00 ) >> 8) ++#define GET_MAX_RX_ALC_ID_CNT (((REG32(ADR_ALC_ID_INFO)) & 0x00ff0000 ) >> 16) ++#define GET_MAX_ALL_ID_ALC_LEN (((REG32(ADR_ALC_ID_INF1)) & 0x000001ff ) >> 0) ++#define GET_MAX_TX_ID_ALC_LEN (((REG32(ADR_ALC_ID_INF1)) & 0x0003fe00 ) >> 9) ++#define GET_MAX_RX_ID_ALC_LEN (((REG32(ADR_ALC_ID_INF1)) & 0x07fc0000 ) >> 18) ++#define GET_RG_PMDLBK (((REG32(ADR_PHY_EN_0)) & 0x00000001 ) >> 0) ++#define GET_RG_RDYACK_SEL (((REG32(ADR_PHY_EN_0)) & 0x00000006 ) >> 1) ++#define GET_RG_ADEDGE_SEL (((REG32(ADR_PHY_EN_0)) & 0x00000008 ) >> 3) ++#define GET_RG_SIGN_SWAP (((REG32(ADR_PHY_EN_0)) & 0x00000010 ) >> 4) ++#define GET_RG_IQ_SWAP (((REG32(ADR_PHY_EN_0)) & 0x00000020 ) >> 5) ++#define GET_RG_Q_INV (((REG32(ADR_PHY_EN_0)) & 0x00000040 ) >> 6) ++#define GET_RG_I_INV (((REG32(ADR_PHY_EN_0)) & 0x00000080 ) >> 7) ++#define GET_RG_BYPASS_ACI (((REG32(ADR_PHY_EN_0)) & 0x00000100 ) >> 8) ++#define GET_RG_LBK_ANA_PATH (((REG32(ADR_PHY_EN_0)) & 0x00000200 ) >> 9) ++#define GET_RG_SPECTRUM_LEAKY_FACTOR (((REG32(ADR_PHY_EN_0)) & 0x00000c00 ) >> 10) ++#define GET_RG_SPECTRUM_BW (((REG32(ADR_PHY_EN_0)) & 0x00003000 ) >> 12) ++#define GET_RG_SPECTRUM_FREQ_MANUAL (((REG32(ADR_PHY_EN_0)) & 0x00004000 ) >> 14) ++#define GET_RG_SPECTRUM_EN (((REG32(ADR_PHY_EN_0)) & 0x00008000 ) >> 15) ++#define GET_RG_TXPWRLVL_SET (((REG32(ADR_PHY_EN_0)) & 0x00ff0000 ) >> 16) ++#define GET_RG_TXPWRLVL_SEL (((REG32(ADR_PHY_EN_0)) & 0x01000000 ) >> 24) ++#define GET_RG_RF_BB_CLK_SEL (((REG32(ADR_PHY_EN_0)) & 0x80000000 ) >> 31) ++#define GET_RG_PHY_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000001 ) >> 0) ++#define GET_RG_PHYRX_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000002 ) >> 1) ++#define GET_RG_PHYTX_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000004 ) >> 2) ++#define GET_RG_PHY11GN_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000008 ) >> 3) ++#define GET_RG_PHY11B_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000010 ) >> 4) ++#define GET_RG_PHYRXFIFO_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000020 ) >> 5) ++#define GET_RG_PHYTXFIFO_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000040 ) >> 6) ++#define GET_RG_PHY11BGN_MD_EN (((REG32(ADR_PHY_EN_1)) & 0x00000100 ) >> 8) ++#define GET_RG_FORCE_11GN_EN (((REG32(ADR_PHY_EN_1)) & 0x00001000 ) >> 12) ++#define GET_RG_FORCE_11B_EN (((REG32(ADR_PHY_EN_1)) & 0x00002000 ) >> 13) ++#define GET_RG_FFT_MEM_CLK_EN_RX (((REG32(ADR_PHY_EN_1)) & 0x00004000 ) >> 14) ++#define GET_RG_FFT_MEM_CLK_EN_TX (((REG32(ADR_PHY_EN_1)) & 0x00008000 ) >> 15) ++#define GET_RG_PHY_IQ_TRIG_SEL (((REG32(ADR_PHY_EN_1)) & 0x000f0000 ) >> 16) ++#define GET_RG_SPECTRUM_FREQ (((REG32(ADR_PHY_EN_1)) & 0x3ff00000 ) >> 20) ++#define GET_SVN_VERSION (((REG32(ADR_SVN_VERSION_REG)) & 0xffffffff ) >> 0) ++#define GET_RG_LENGTH (((REG32(ADR_PHY_PKT_GEN_0)) & 0x0000ffff ) >> 0) ++#define GET_RG_PKT_MODE (((REG32(ADR_PHY_PKT_GEN_0)) & 0x00070000 ) >> 16) ++#define GET_RG_CH_BW (((REG32(ADR_PHY_PKT_GEN_0)) & 0x00380000 ) >> 19) ++#define GET_RG_PRM (((REG32(ADR_PHY_PKT_GEN_0)) & 0x00400000 ) >> 22) ++#define GET_RG_SHORTGI (((REG32(ADR_PHY_PKT_GEN_0)) & 0x00800000 ) >> 23) ++#define GET_RG_RATE (((REG32(ADR_PHY_PKT_GEN_0)) & 0x7f000000 ) >> 24) ++#define GET_RG_L_LENGTH (((REG32(ADR_PHY_PKT_GEN_1)) & 0x00000fff ) >> 0) ++#define GET_RG_L_RATE (((REG32(ADR_PHY_PKT_GEN_1)) & 0x00007000 ) >> 12) ++#define GET_RG_SERVICE (((REG32(ADR_PHY_PKT_GEN_1)) & 0xffff0000 ) >> 16) ++#define GET_RG_SMOOTHING (((REG32(ADR_PHY_PKT_GEN_2)) & 0x00000001 ) >> 0) ++#define GET_RG_NO_SOUND (((REG32(ADR_PHY_PKT_GEN_2)) & 0x00000002 ) >> 1) ++#define GET_RG_AGGREGATE (((REG32(ADR_PHY_PKT_GEN_2)) & 0x00000004 ) >> 2) ++#define GET_RG_STBC (((REG32(ADR_PHY_PKT_GEN_2)) & 0x00000018 ) >> 3) ++#define GET_RG_FEC (((REG32(ADR_PHY_PKT_GEN_2)) & 0x00000020 ) >> 5) ++#define GET_RG_N_ESS (((REG32(ADR_PHY_PKT_GEN_2)) & 0x000000c0 ) >> 6) ++#define GET_RG_TXPWRLVL (((REG32(ADR_PHY_PKT_GEN_2)) & 0x0000ff00 ) >> 8) ++#define GET_RG_TX_START (((REG32(ADR_PHY_PKT_GEN_3)) & 0x00000001 ) >> 0) ++#define GET_RG_IFS_TIME (((REG32(ADR_PHY_PKT_GEN_3)) & 0x000000fc ) >> 2) ++#define GET_RG_CONTINUOUS_DATA (((REG32(ADR_PHY_PKT_GEN_3)) & 0x00000100 ) >> 8) ++#define GET_RG_DATA_SEL (((REG32(ADR_PHY_PKT_GEN_3)) & 0x00000600 ) >> 9) ++#define GET_RG_TX_D (((REG32(ADR_PHY_PKT_GEN_3)) & 0x00ff0000 ) >> 16) ++#define GET_RG_TX_CNT_TARGET (((REG32(ADR_PHY_PKT_GEN_4)) & 0xffffffff ) >> 0) ++#define GET_RG_FFT_IFFT_MODE (((REG32(ADR_PHY_REG_00)) & 0x000000c0 ) >> 6) ++#define GET_RG_DAC_DBG_MODE (((REG32(ADR_PHY_REG_00)) & 0x00000100 ) >> 8) ++#define GET_RG_DAC_SGN_SWAP (((REG32(ADR_PHY_REG_00)) & 0x00000200 ) >> 9) ++#define GET_RG_TXD_SEL (((REG32(ADR_PHY_REG_00)) & 0x00000c00 ) >> 10) ++#define GET_RG_UP8X (((REG32(ADR_PHY_REG_00)) & 0x00ff0000 ) >> 16) ++#define GET_RG_IQ_DC_BYP (((REG32(ADR_PHY_REG_00)) & 0x01000000 ) >> 24) ++#define GET_RG_IQ_DC_LEAKY_FACTOR (((REG32(ADR_PHY_REG_00)) & 0x30000000 ) >> 28) ++#define GET_RG_DAC_DCEN (((REG32(ADR_PHY_REG_01)) & 0x00000001 ) >> 0) ++#define GET_RG_DAC_DCQ (((REG32(ADR_PHY_REG_01)) & 0x00003ff0 ) >> 4) ++#define GET_RG_DAC_DCI (((REG32(ADR_PHY_REG_01)) & 0x03ff0000 ) >> 16) ++#define GET_RG_PGA_REFDB_SAT (((REG32(ADR_PHY_REG_02_AGC)) & 0x0000007f ) >> 0) ++#define GET_RG_PGA_REFDB_TOP (((REG32(ADR_PHY_REG_02_AGC)) & 0x00007f00 ) >> 8) ++#define GET_RG_PGA_REF_UND (((REG32(ADR_PHY_REG_02_AGC)) & 0x03ff0000 ) >> 16) ++#define GET_RG_RF_REF_SAT (((REG32(ADR_PHY_REG_02_AGC)) & 0xf0000000 ) >> 28) ++#define GET_RG_PGAGC_SET (((REG32(ADR_PHY_REG_03_AGC)) & 0x0000000f ) >> 0) ++#define GET_RG_PGAGC_OW (((REG32(ADR_PHY_REG_03_AGC)) & 0x00000010 ) >> 4) ++#define GET_RG_RFGC_SET (((REG32(ADR_PHY_REG_03_AGC)) & 0x00000060 ) >> 5) ++#define GET_RG_RFGC_OW (((REG32(ADR_PHY_REG_03_AGC)) & 0x00000080 ) >> 7) ++#define GET_RG_WAIT_T_RXAGC (((REG32(ADR_PHY_REG_03_AGC)) & 0x00003f00 ) >> 8) ++#define GET_RG_RXAGC_SET (((REG32(ADR_PHY_REG_03_AGC)) & 0x00004000 ) >> 14) ++#define GET_RG_RXAGC_OW (((REG32(ADR_PHY_REG_03_AGC)) & 0x00008000 ) >> 15) ++#define GET_RG_WAIT_T_FINAL (((REG32(ADR_PHY_REG_03_AGC)) & 0x003f0000 ) >> 16) ++#define GET_RG_WAIT_T (((REG32(ADR_PHY_REG_03_AGC)) & 0x3f000000 ) >> 24) ++#define GET_RG_ULG_PGA_SAT_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x0000000f ) >> 0) ++#define GET_RG_LG_PGA_UND_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x000000f0 ) >> 4) ++#define GET_RG_LG_PGA_SAT_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x00000f00 ) >> 8) ++#define GET_RG_LG_RF_SAT_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x0000f000 ) >> 12) ++#define GET_RG_MG_RF_SAT_PGANOREF_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x000f0000 ) >> 16) ++#define GET_RG_HG_PGA_SAT2_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x00f00000 ) >> 20) ++#define GET_RG_HG_PGA_SAT1_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0x0f000000 ) >> 24) ++#define GET_RG_HG_RF_SAT_PGA_GAIN (((REG32(ADR_PHY_REG_04_AGC)) & 0xf0000000 ) >> 28) ++#define GET_RG_MG_PGA_JB_TH (((REG32(ADR_PHY_REG_05_AGC)) & 0x0000000f ) >> 0) ++#define GET_RG_MA_PGA_LOW_TH_CNT_LMT (((REG32(ADR_PHY_REG_05_AGC)) & 0x001f0000 ) >> 16) ++#define GET_RG_WR_RFGC_INIT_SET (((REG32(ADR_PHY_REG_05_AGC)) & 0x00600000 ) >> 21) ++#define GET_RG_WR_RFGC_INIT_EN (((REG32(ADR_PHY_REG_05_AGC)) & 0x00800000 ) >> 23) ++#define GET_RG_MA_PGA_HIGH_TH_CNT_LMT (((REG32(ADR_PHY_REG_05_AGC)) & 0x1f000000 ) >> 24) ++#define GET_RG_AGC_THRESHOLD (((REG32(ADR_PHY_REG_06_11B_DAGC)) & 0x00003fff ) >> 0) ++#define GET_RG_ACI_POINT_CNT_LMT_11B (((REG32(ADR_PHY_REG_06_11B_DAGC)) & 0x007f0000 ) >> 16) ++#define GET_RG_ACI_DAGC_LEAKY_FACTOR_11B (((REG32(ADR_PHY_REG_06_11B_DAGC)) & 0x03000000 ) >> 24) ++#define GET_RG_WR_ACI_GAIN_INI_SEL_11B (((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0x000000ff ) >> 0) ++#define GET_RG_WR_ACI_GAIN_SEL_11B (((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0x0000ff00 ) >> 8) ++#define GET_RG_ACI_DAGC_SET_VALUE_11B (((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0x007f0000 ) >> 16) ++#define GET_RG_WR_ACI_GAIN_OW_11B (((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0x80000000 ) >> 31) ++#define GET_RG_ACI_POINT_CNT_LMT_11GN (((REG32(ADR_PHY_REG_08_11GN_DAGC)) & 0x000000ff ) >> 0) ++#define GET_RG_ACI_DAGC_LEAKY_FACTOR_11GN (((REG32(ADR_PHY_REG_08_11GN_DAGC)) & 0x00000300 ) >> 8) ++#define GET_RG_ACI_DAGC_DONE_CNT_LMT_11GN (((REG32(ADR_PHY_REG_08_11GN_DAGC)) & 0xff000000 ) >> 24) ++#define GET_RG_ACI_DAGC_SET_VALUE_11GN (((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0x0000007f ) >> 0) ++#define GET_RG_ACI_GAIN_INI_VAL_11GN (((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0x0000ff00 ) >> 8) ++#define GET_RG_ACI_GAIN_OW_VAL_11GN (((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0x00ff0000 ) >> 16) ++#define GET_RG_ACI_GAIN_OW_11GN (((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0x80000000 ) >> 31) ++#define GET_RO_CCA_PWR_MA_11GN (((REG32(ADR_PHY_READ_REG_00_DIG_PWR)) & 0x0000007f ) >> 0) ++#define GET_RO_ED_STATE (((REG32(ADR_PHY_READ_REG_00_DIG_PWR)) & 0x00008000 ) >> 15) ++#define GET_RO_CCA_PWR_MA_11B (((REG32(ADR_PHY_READ_REG_00_DIG_PWR)) & 0x007f0000 ) >> 16) ++#define GET_RO_PGA_PWR_FF1 (((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0x00003fff ) >> 0) ++#define GET_RO_RF_PWR_FF1 (((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0x000f0000 ) >> 16) ++#define GET_RO_PGAGC_FF1 (((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0x0f000000 ) >> 24) ++#define GET_RO_RFGC_FF1 (((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0x30000000 ) >> 28) ++#define GET_RO_PGA_PWR_FF2 (((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0x00003fff ) >> 0) ++#define GET_RO_RF_PWR_FF2 (((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0x000f0000 ) >> 16) ++#define GET_RO_PGAGC_FF2 (((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0x0f000000 ) >> 24) ++#define GET_RO_RFGC_FF2 (((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0x30000000 ) >> 28) ++#define GET_RO_PGA_PWR_FF3 (((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0x00003fff ) >> 0) ++#define GET_RO_RF_PWR_FF3 (((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0x000f0000 ) >> 16) ++#define GET_RO_PGAGC_FF3 (((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0x0f000000 ) >> 24) ++#define GET_RO_RFGC_FF3 (((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0x30000000 ) >> 28) ++#define GET_RG_TX_DES_RATE (((REG32(ADR_PHY_REG_10_TX_DES)) & 0x0000001f ) >> 0) ++#define GET_RG_TX_DES_MODE (((REG32(ADR_PHY_REG_10_TX_DES)) & 0x00001f00 ) >> 8) ++#define GET_RG_TX_DES_LEN_LO (((REG32(ADR_PHY_REG_10_TX_DES)) & 0x001f0000 ) >> 16) ++#define GET_RG_TX_DES_LEN_UP (((REG32(ADR_PHY_REG_10_TX_DES)) & 0x1f000000 ) >> 24) ++#define GET_RG_TX_DES_SRVC_UP (((REG32(ADR_PHY_REG_11_TX_DES)) & 0x0000001f ) >> 0) ++#define GET_RG_TX_DES_L_LEN_LO (((REG32(ADR_PHY_REG_11_TX_DES)) & 0x00001f00 ) >> 8) ++#define GET_RG_TX_DES_L_LEN_UP (((REG32(ADR_PHY_REG_11_TX_DES)) & 0x001f0000 ) >> 16) ++#define GET_RG_TX_DES_TYPE (((REG32(ADR_PHY_REG_11_TX_DES)) & 0x1f000000 ) >> 24) ++#define GET_RG_TX_DES_L_LEN_UP_COMB (((REG32(ADR_PHY_REG_12_TX_DES)) & 0x00000001 ) >> 0) ++#define GET_RG_TX_DES_TYPE_COMB (((REG32(ADR_PHY_REG_12_TX_DES)) & 0x00000010 ) >> 4) ++#define GET_RG_TX_DES_RATE_COMB (((REG32(ADR_PHY_REG_12_TX_DES)) & 0x00000100 ) >> 8) ++#define GET_RG_TX_DES_MODE_COMB (((REG32(ADR_PHY_REG_12_TX_DES)) & 0x00001000 ) >> 12) ++#define GET_RG_TX_DES_PWRLVL (((REG32(ADR_PHY_REG_12_TX_DES)) & 0x001f0000 ) >> 16) ++#define GET_RG_TX_DES_SRVC_LO (((REG32(ADR_PHY_REG_12_TX_DES)) & 0x1f000000 ) >> 24) ++#define GET_RG_RX_DES_RATE (((REG32(ADR_PHY_REG_13_RX_DES)) & 0x0000003f ) >> 0) ++#define GET_RG_RX_DES_MODE (((REG32(ADR_PHY_REG_13_RX_DES)) & 0x00003f00 ) >> 8) ++#define GET_RG_RX_DES_LEN_LO (((REG32(ADR_PHY_REG_13_RX_DES)) & 0x003f0000 ) >> 16) ++#define GET_RG_RX_DES_LEN_UP (((REG32(ADR_PHY_REG_13_RX_DES)) & 0x3f000000 ) >> 24) ++#define GET_RG_RX_DES_SRVC_UP (((REG32(ADR_PHY_REG_14_RX_DES)) & 0x0000003f ) >> 0) ++#define GET_RG_RX_DES_L_LEN_LO (((REG32(ADR_PHY_REG_14_RX_DES)) & 0x00003f00 ) >> 8) ++#define GET_RG_RX_DES_L_LEN_UP (((REG32(ADR_PHY_REG_14_RX_DES)) & 0x003f0000 ) >> 16) ++#define GET_RG_RX_DES_TYPE (((REG32(ADR_PHY_REG_14_RX_DES)) & 0x3f000000 ) >> 24) ++#define GET_RG_RX_DES_L_LEN_UP_COMB (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x00000001 ) >> 0) ++#define GET_RG_RX_DES_TYPE_COMB (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x00000010 ) >> 4) ++#define GET_RG_RX_DES_RATE_COMB (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x00000100 ) >> 8) ++#define GET_RG_RX_DES_MODE_COMB (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x00001000 ) >> 12) ++#define GET_RG_RX_DES_SNR (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x000f0000 ) >> 16) ++#define GET_RG_RX_DES_RCPI (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x00f00000 ) >> 20) ++#define GET_RG_RX_DES_SRVC_LO (((REG32(ADR_PHY_REG_15_RX_DES)) & 0x3f000000 ) >> 24) ++#define GET_RO_TX_DES_EXCP_RATE_CNT (((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x000000ff ) >> 0) ++#define GET_RO_TX_DES_EXCP_CH_BW_CNT (((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x0000ff00 ) >> 8) ++#define GET_RO_TX_DES_EXCP_MODE_CNT (((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x00ff0000 ) >> 16) ++#define GET_RG_TX_DES_EXCP_RATE_DEFAULT (((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x07000000 ) >> 24) ++#define GET_RG_TX_DES_EXCP_MODE_DEFAULT (((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x70000000 ) >> 28) ++#define GET_RG_TX_DES_EXCP_CLR (((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x80000000 ) >> 31) ++#define GET_RG_TX_DES_ACK_WIDTH (((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0x00000001 ) >> 0) ++#define GET_RG_TX_DES_ACK_PRD (((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0x0000000e ) >> 1) ++#define GET_RG_RX_DES_SNR_GN (((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0x003f0000 ) >> 16) ++#define GET_RG_RX_DES_RCPI_GN (((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0x3f000000 ) >> 24) ++#define GET_RG_TST_TBUS_SEL (((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0x0000000f ) >> 0) ++#define GET_RG_RSSI_OFFSET (((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0x00ff0000 ) >> 16) ++#define GET_RG_RSSI_INV (((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0x01000000 ) >> 24) ++#define GET_RG_TST_ADC_ON (((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0x40000000 ) >> 30) ++#define GET_RG_TST_EXT_GAIN (((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0x80000000 ) >> 31) ++#define GET_RG_DAC_Q_SET (((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x000003ff ) >> 0) ++#define GET_RG_DAC_I_SET (((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x003ff000 ) >> 12) ++#define GET_RG_DAC_EN_MAN (((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x10000000 ) >> 28) ++#define GET_RG_IQC_FFT_EN (((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x20000000 ) >> 29) ++#define GET_RG_DAC_MAN_Q_EN (((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x40000000 ) >> 30) ++#define GET_RG_DAC_MAN_I_EN (((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x80000000 ) >> 31) ++#define GET_RO_MRX_EN_CNT (((REG32(ADR_PHY_REG_20_MRX_CNT)) & 0x0000ffff ) >> 0) ++#define GET_RG_MRX_EN_CNT_RST_N (((REG32(ADR_PHY_REG_20_MRX_CNT)) & 0x80000000 ) >> 31) ++#define GET_RG_PA_RISE_TIME (((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0x000000ff ) >> 0) ++#define GET_RG_RFTX_RISE_TIME (((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0x0000ff00 ) >> 8) ++#define GET_RG_DAC_RISE_TIME (((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0x00ff0000 ) >> 16) ++#define GET_RG_SW_RISE_TIME (((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0xff000000 ) >> 24) ++#define GET_RG_PA_FALL_TIME (((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0x000000ff ) >> 0) ++#define GET_RG_RFTX_FALL_TIME (((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0x0000ff00 ) >> 8) ++#define GET_RG_DAC_FALL_TIME (((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0x00ff0000 ) >> 16) ++#define GET_RG_SW_FALL_TIME (((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0xff000000 ) >> 24) ++#define GET_RG_ANT_SW_0 (((REG32(ADR_PHY_REG_23_ANT)) & 0x00000007 ) >> 0) ++#define GET_RG_ANT_SW_1 (((REG32(ADR_PHY_REG_23_ANT)) & 0x00000038 ) >> 3) ++#define GET_RG_MTX_LEN_LOWER_TH_0 (((REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) & 0x00001fff ) >> 0) ++#define GET_RG_MTX_LEN_UPPER_TH_0 (((REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) & 0x1fff0000 ) >> 16) ++#define GET_RG_MTX_LEN_CNT_EN_0 (((REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) & 0x80000000 ) >> 31) ++#define GET_RG_MTX_LEN_LOWER_TH_1 (((REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) & 0x00001fff ) >> 0) ++#define GET_RG_MTX_LEN_UPPER_TH_1 (((REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) & 0x1fff0000 ) >> 16) ++#define GET_RG_MTX_LEN_CNT_EN_1 (((REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) & 0x80000000 ) >> 31) ++#define GET_RG_MRX_LEN_LOWER_TH_0 (((REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) & 0x00001fff ) >> 0) ++#define GET_RG_MRX_LEN_UPPER_TH_0 (((REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) & 0x1fff0000 ) >> 16) ++#define GET_RG_MRX_LEN_CNT_EN_0 (((REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) & 0x80000000 ) >> 31) ++#define GET_RG_MRX_LEN_LOWER_TH_1 (((REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) & 0x00001fff ) >> 0) ++#define GET_RG_MRX_LEN_UPPER_TH_1 (((REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) & 0x1fff0000 ) >> 16) ++#define GET_RG_MRX_LEN_CNT_EN_1 (((REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) & 0x80000000 ) >> 31) ++#define GET_RO_MTX_LEN_CNT_1 (((REG32(ADR_PHY_READ_REG_04)) & 0x0000ffff ) >> 0) ++#define GET_RO_MTX_LEN_CNT_0 (((REG32(ADR_PHY_READ_REG_04)) & 0xffff0000 ) >> 16) ++#define GET_RO_MRX_LEN_CNT_1 (((REG32(ADR_PHY_READ_REG_05)) & 0x0000ffff ) >> 0) ++#define GET_RO_MRX_LEN_CNT_0 (((REG32(ADR_PHY_READ_REG_05)) & 0xffff0000 ) >> 16) ++#define GET_RG_MODE_REG_IN_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x0000ffff ) >> 0) ++#define GET_RG_PARALLEL_DR_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x00100000 ) >> 20) ++#define GET_RG_MBRUN_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x01000000 ) >> 24) ++#define GET_RG_SHIFT_DR_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x10000000 ) >> 28) ++#define GET_RG_MODE_REG_SI_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x20000000 ) >> 29) ++#define GET_RG_SIMULATION_MODE_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x40000000 ) >> 30) ++#define GET_RG_DBIST_MODE_16 (((REG32(ADR_PHY_REG_28_BIST)) & 0x80000000 ) >> 31) ++#define GET_RO_MODE_REG_OUT_16 (((REG32(ADR_PHY_READ_REG_06_BIST)) & 0x0000ffff ) >> 0) ++#define GET_RO_MODE_REG_SO_16 (((REG32(ADR_PHY_READ_REG_06_BIST)) & 0x01000000 ) >> 24) ++#define GET_RO_MONITOR_BUS_16 (((REG32(ADR_PHY_READ_REG_07_BIST)) & 0x0007ffff ) >> 0) ++#define GET_RG_MRX_TYPE_1 (((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0x000000ff ) >> 0) ++#define GET_RG_MRX_TYPE_0 (((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0x0000ff00 ) >> 8) ++#define GET_RG_MTX_TYPE_1 (((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0x00ff0000 ) >> 16) ++#define GET_RG_MTX_TYPE_0 (((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0xff000000 ) >> 24) ++#define GET_RO_MTX_TYPE_CNT_1 (((REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) & 0x0000ffff ) >> 0) ++#define GET_RO_MTX_TYPE_CNT_0 (((REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) & 0xffff0000 ) >> 16) ++#define GET_RO_MRX_TYPE_CNT_1 (((REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) & 0x0000ffff ) >> 0) ++#define GET_RO_MRX_TYPE_CNT_0 (((REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) & 0xffff0000 ) >> 16) ++#define GET_RG_HB_COEF0 (((REG32(ADR_PHY_REG_30_TX_UP_FIL)) & 0x00000fff ) >> 0) ++#define GET_RG_HB_COEF1 (((REG32(ADR_PHY_REG_30_TX_UP_FIL)) & 0x0fff0000 ) >> 16) ++#define GET_RG_HB_COEF2 (((REG32(ADR_PHY_REG_31_TX_UP_FIL)) & 0x00000fff ) >> 0) ++#define GET_RG_HB_COEF3 (((REG32(ADR_PHY_REG_31_TX_UP_FIL)) & 0x0fff0000 ) >> 16) ++#define GET_RG_HB_COEF4 (((REG32(ADR_PHY_REG_32_TX_UP_FIL)) & 0x00000fff ) >> 0) ++#define GET_RO_TBUS_O (((REG32(ADR_PHY_READ_TBUS)) & 0x000fffff ) >> 0) ++#define GET_RG_LPF4_00 (((REG32(ADR_TX_11B_FIL_COEF_00)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_01 (((REG32(ADR_TX_11B_FIL_COEF_01)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_02 (((REG32(ADR_TX_11B_FIL_COEF_02)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_03 (((REG32(ADR_TX_11B_FIL_COEF_03)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_04 (((REG32(ADR_TX_11B_FIL_COEF_04)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_05 (((REG32(ADR_TX_11B_FIL_COEF_05)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_06 (((REG32(ADR_TX_11B_FIL_COEF_06)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_07 (((REG32(ADR_TX_11B_FIL_COEF_07)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_08 (((REG32(ADR_TX_11B_FIL_COEF_08)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_09 (((REG32(ADR_TX_11B_FIL_COEF_09)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_10 (((REG32(ADR_TX_11B_FIL_COEF_10)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_11 (((REG32(ADR_TX_11B_FIL_COEF_11)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_12 (((REG32(ADR_TX_11B_FIL_COEF_12)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_13 (((REG32(ADR_TX_11B_FIL_COEF_13)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_14 (((REG32(ADR_TX_11B_FIL_COEF_14)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_15 (((REG32(ADR_TX_11B_FIL_COEF_15)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_16 (((REG32(ADR_TX_11B_FIL_COEF_16)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_17 (((REG32(ADR_TX_11B_FIL_COEF_17)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_18 (((REG32(ADR_TX_11B_FIL_COEF_18)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_19 (((REG32(ADR_TX_11B_FIL_COEF_19)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_20 (((REG32(ADR_TX_11B_FIL_COEF_20)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_21 (((REG32(ADR_TX_11B_FIL_COEF_21)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_22 (((REG32(ADR_TX_11B_FIL_COEF_22)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_23 (((REG32(ADR_TX_11B_FIL_COEF_23)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_24 (((REG32(ADR_TX_11B_FIL_COEF_24)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_25 (((REG32(ADR_TX_11B_FIL_COEF_25)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_26 (((REG32(ADR_TX_11B_FIL_COEF_26)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_27 (((REG32(ADR_TX_11B_FIL_COEF_27)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_28 (((REG32(ADR_TX_11B_FIL_COEF_28)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_29 (((REG32(ADR_TX_11B_FIL_COEF_29)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_30 (((REG32(ADR_TX_11B_FIL_COEF_30)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_31 (((REG32(ADR_TX_11B_FIL_COEF_31)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_32 (((REG32(ADR_TX_11B_FIL_COEF_32)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_33 (((REG32(ADR_TX_11B_FIL_COEF_33)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_34 (((REG32(ADR_TX_11B_FIL_COEF_34)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_35 (((REG32(ADR_TX_11B_FIL_COEF_35)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_36 (((REG32(ADR_TX_11B_FIL_COEF_36)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_37 (((REG32(ADR_TX_11B_FIL_COEF_37)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_38 (((REG32(ADR_TX_11B_FIL_COEF_38)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_39 (((REG32(ADR_TX_11B_FIL_COEF_39)) & 0x00001fff ) >> 0) ++#define GET_RG_LPF4_40 (((REG32(ADR_TX_11B_FIL_COEF_40)) & 0x00001fff ) >> 0) ++#define GET_RG_BP_SMB (((REG32(ADR_TX_11B_PLCP)) & 0x00002000 ) >> 13) ++#define GET_RG_EN_SRVC (((REG32(ADR_TX_11B_PLCP)) & 0x00004000 ) >> 14) ++#define GET_RG_DES_SPD (((REG32(ADR_TX_11B_PLCP)) & 0x00030000 ) >> 16) ++#define GET_RG_BB_11B_RISE_TIME (((REG32(ADR_TX_11B_RAMP)) & 0x000000ff ) >> 0) ++#define GET_RG_BB_11B_FALL_TIME (((REG32(ADR_TX_11B_RAMP)) & 0x0000ff00 ) >> 8) ++#define GET_RG_WR_TX_EN_CNT_RST_N (((REG32(ADR_TX_11B_EN_CNT_RST_N)) & 0x00000001 ) >> 0) ++#define GET_RO_TX_EN_CNT (((REG32(ADR_TX_11B_EN_CNT)) & 0x0000ffff ) >> 0) ++#define GET_RO_TX_CNT (((REG32(ADR_TX_11B_PKT_GEN_CNT)) & 0xffffffff ) >> 0) ++#define GET_RG_POS_DES_11B_L_EXT (((REG32(ADR_RX_11B_DES_DLY)) & 0x0000000f ) >> 0) ++#define GET_RG_PRE_DES_11B_DLY (((REG32(ADR_RX_11B_DES_DLY)) & 0x000000f0 ) >> 4) ++#define GET_RG_CNT_CCA_LMT (((REG32(ADR_RX_11B_CCA_0)) & 0x000f0000 ) >> 16) ++#define GET_RG_BYPASS_DESCRAMBLER (((REG32(ADR_RX_11B_CCA_0)) & 0x20000000 ) >> 29) ++#define GET_RG_BYPASS_AGC (((REG32(ADR_RX_11B_CCA_0)) & 0x80000000 ) >> 31) ++#define GET_RG_CCA_BIT_CNT_LMT_RX (((REG32(ADR_RX_11B_CCA_1)) & 0x000000f0 ) >> 4) ++#define GET_RG_CCA_SCALE_BF (((REG32(ADR_RX_11B_CCA_1)) & 0x007f0000 ) >> 16) ++#define GET_RG_PEAK_IDX_CNT_SEL (((REG32(ADR_RX_11B_CCA_1)) & 0x30000000 ) >> 28) ++#define GET_RG_TR_KI_T2 (((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0x00000007 ) >> 0) ++#define GET_RG_TR_KP_T2 (((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0x00000070 ) >> 4) ++#define GET_RG_TR_KI_T1 (((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0x00000700 ) >> 8) ++#define GET_RG_TR_KP_T1 (((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0x00007000 ) >> 12) ++#define GET_RG_CR_KI_T1 (((REG32(ADR_RX_11B_TR_KP_KI_1)) & 0x00070000 ) >> 16) ++#define GET_RG_CR_KP_T1 (((REG32(ADR_RX_11B_TR_KP_KI_1)) & 0x00700000 ) >> 20) ++#define GET_RG_CHIP_CNT_SLICER (((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0x0000001f ) >> 0) ++#define GET_RG_CE_T4_CNT_LMT (((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0x0000ff00 ) >> 8) ++#define GET_RG_CE_T3_CNT_LMT (((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0x00ff0000 ) >> 16) ++#define GET_RG_CE_T2_CNT_LMT (((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0xff000000 ) >> 24) ++#define GET_RG_CE_MU_T1 (((REG32(ADR_RX_11B_CE_MU_0)) & 0x00000007 ) >> 0) ++#define GET_RG_CE_DLY_SEL (((REG32(ADR_RX_11B_CE_MU_0)) & 0x003f0000 ) >> 16) ++#define GET_RG_CE_MU_T8 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x00000007 ) >> 0) ++#define GET_RG_CE_MU_T7 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x00000070 ) >> 4) ++#define GET_RG_CE_MU_T6 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x00000700 ) >> 8) ++#define GET_RG_CE_MU_T5 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x00007000 ) >> 12) ++#define GET_RG_CE_MU_T4 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x00070000 ) >> 16) ++#define GET_RG_CE_MU_T3 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x00700000 ) >> 20) ++#define GET_RG_CE_MU_T2 (((REG32(ADR_RX_11B_CE_MU_1)) & 0x07000000 ) >> 24) ++#define GET_RG_EQ_MU_FB_T2 (((REG32(ADR_RX_11B_EQ_MU_0)) & 0x0000000f ) >> 0) ++#define GET_RG_EQ_MU_FF_T2 (((REG32(ADR_RX_11B_EQ_MU_0)) & 0x000000f0 ) >> 4) ++#define GET_RG_EQ_MU_FB_T1 (((REG32(ADR_RX_11B_EQ_MU_0)) & 0x000f0000 ) >> 16) ++#define GET_RG_EQ_MU_FF_T1 (((REG32(ADR_RX_11B_EQ_MU_0)) & 0x00f00000 ) >> 20) ++#define GET_RG_EQ_MU_FB_T4 (((REG32(ADR_RX_11B_EQ_MU_1)) & 0x0000000f ) >> 0) ++#define GET_RG_EQ_MU_FF_T4 (((REG32(ADR_RX_11B_EQ_MU_1)) & 0x000000f0 ) >> 4) ++#define GET_RG_EQ_MU_FB_T3 (((REG32(ADR_RX_11B_EQ_MU_1)) & 0x000f0000 ) >> 16) ++#define GET_RG_EQ_MU_FF_T3 (((REG32(ADR_RX_11B_EQ_MU_1)) & 0x00f00000 ) >> 20) ++#define GET_RG_EQ_KI_T2 (((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0x00000700 ) >> 8) ++#define GET_RG_EQ_KP_T2 (((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0x00007000 ) >> 12) ++#define GET_RG_EQ_KI_T1 (((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0x00070000 ) >> 16) ++#define GET_RG_EQ_KP_T1 (((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0x00700000 ) >> 20) ++#define GET_RG_TR_LPF_RATE (((REG32(ADR_RX_11B_LPF_RATE)) & 0x003fffff ) >> 0) ++#define GET_RG_CE_BIT_CNT_LMT (((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0x0000007f ) >> 0) ++#define GET_RG_CE_CH_MAIN_SET (((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0x00000080 ) >> 7) ++#define GET_RG_TC_BIT_CNT_LMT (((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0x00007f00 ) >> 8) ++#define GET_RG_CR_BIT_CNT_LMT (((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0x007f0000 ) >> 16) ++#define GET_RG_TR_BIT_CNT_LMT (((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0x7f000000 ) >> 24) ++#define GET_RG_EQ_MAIN_TAP_MAN (((REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) & 0x00000001 ) >> 0) ++#define GET_RG_EQ_MAIN_TAP_COEF (((REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) & 0x07ff0000 ) >> 16) ++#define GET_RG_PWRON_DLY_TH_11B (((REG32(ADR_RX_11B_SEARCH_CNT_TH)) & 0x000000ff ) >> 0) ++#define GET_RG_SFD_BIT_CNT_LMT (((REG32(ADR_RX_11B_SEARCH_CNT_TH)) & 0x00ff0000 ) >> 16) ++#define GET_RG_CCA_PWR_TH_RX (((REG32(ADR_RX_11B_CCA_CONTROL)) & 0x00007fff ) >> 0) ++#define GET_RG_CCA_PWR_CNT_TH (((REG32(ADR_RX_11B_CCA_CONTROL)) & 0x001f0000 ) >> 16) ++#define GET_B_FREQ_OS (((REG32(ADR_RX_11B_FREQUENCY_OFFSET)) & 0x000007ff ) >> 0) ++#define GET_B_SNR (((REG32(ADR_RX_11B_SNR_RSSI)) & 0x0000007f ) >> 0) ++#define GET_B_RCPI (((REG32(ADR_RX_11B_SNR_RSSI)) & 0x007f0000 ) >> 16) ++#define GET_CRC_CNT (((REG32(ADR_RX_11B_SFD_CRC_CNT)) & 0x0000ffff ) >> 0) ++#define GET_SFD_CNT (((REG32(ADR_RX_11B_SFD_CRC_CNT)) & 0xffff0000 ) >> 16) ++#define GET_B_PACKET_ERR_CNT (((REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) & 0x0000ffff ) >> 0) ++#define GET_PACKET_ERR (((REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) & 0x00010000 ) >> 16) ++#define GET_B_PACKET_CNT (((REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) & 0x0000ffff ) >> 0) ++#define GET_B_CCA_CNT (((REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) & 0xffff0000 ) >> 16) ++#define GET_B_LENGTH_FIELD (((REG32(ADR_RX_11B_SFD_FILED_0)) & 0x0000ffff ) >> 0) ++#define GET_SFD_FIELD (((REG32(ADR_RX_11B_SFD_FILED_0)) & 0xffff0000 ) >> 16) ++#define GET_SIGNAL_FIELD (((REG32(ADR_RX_11B_SFD_FIELD_1)) & 0x000000ff ) >> 0) ++#define GET_B_SERVICE_FIELD (((REG32(ADR_RX_11B_SFD_FIELD_1)) & 0x0000ff00 ) >> 8) ++#define GET_CRC_CORRECT (((REG32(ADR_RX_11B_SFD_FIELD_1)) & 0x00010000 ) >> 16) ++#define GET_DEBUG_SEL (((REG32(ADR_RX_11B_PKT_STAT_EN)) & 0x0000000f ) >> 0) ++#define GET_RG_PACKET_STAT_EN_11B (((REG32(ADR_RX_11B_PKT_STAT_EN)) & 0x00100000 ) >> 20) ++#define GET_RG_BIT_REVERSE (((REG32(ADR_RX_11B_PKT_STAT_EN)) & 0x00200000 ) >> 21) ++#define GET_RX_PHY_11B_SOFT_RST_N (((REG32(ADR_RX_11B_SOFT_RST)) & 0x00000001 ) >> 0) ++#define GET_RG_CE_BYPASS_TAP (((REG32(ADR_RX_11B_SOFT_RST)) & 0x000000f0 ) >> 4) ++#define GET_RG_EQ_BYPASS_FBW_TAP (((REG32(ADR_RX_11B_SOFT_RST)) & 0x00000f00 ) >> 8) ++#define GET_RG_BB_11GN_RISE_TIME (((REG32(ADR_TX_11GN_RAMP)) & 0x000000ff ) >> 0) ++#define GET_RG_BB_11GN_FALL_TIME (((REG32(ADR_TX_11GN_RAMP)) & 0x0000ff00 ) >> 8) ++#define GET_RG_HTCARR52_FFT_SCALE (((REG32(ADR_TX_11GN_PLCP)) & 0x000003ff ) >> 0) ++#define GET_RG_HTCARR56_FFT_SCALE (((REG32(ADR_TX_11GN_PLCP)) & 0x003ff000 ) >> 12) ++#define GET_RG_PACKET_STAT_EN (((REG32(ADR_TX_11GN_PLCP)) & 0x00800000 ) >> 23) ++#define GET_RG_SMB_DEF (((REG32(ADR_TX_11GN_PLCP)) & 0x7f000000 ) >> 24) ++#define GET_RG_CONTINUOUS_DATA_11GN (((REG32(ADR_TX_11GN_PLCP)) & 0x80000000 ) >> 31) ++#define GET_RO_TX_CNT_R (((REG32(ADR_TX_11GN_PKT_GEN_CNT)) & 0xffffffff ) >> 0) ++#define GET_RO_PACKET_ERR_CNT (((REG32(ADR_TX_11GN_PLCP_CRC_ERR_CNT)) & 0x0000ffff ) >> 0) ++#define GET_RG_POS_DES_11GN_L_EXT (((REG32(ADR_RX_11GN_DES_DLY)) & 0x0000000f ) >> 0) ++#define GET_RG_PRE_DES_11GN_DLY (((REG32(ADR_RX_11GN_DES_DLY)) & 0x000000f0 ) >> 4) ++#define GET_RG_TR_LPF_KI_G_T1 (((REG32(ADR_RX_11GN_TR_0)) & 0x0000000f ) >> 0) ++#define GET_RG_TR_LPF_KP_G_T1 (((REG32(ADR_RX_11GN_TR_0)) & 0x000000f0 ) >> 4) ++#define GET_RG_TR_CNT_T1 (((REG32(ADR_RX_11GN_TR_0)) & 0x0000ff00 ) >> 8) ++#define GET_RG_TR_LPF_KI_G_T0 (((REG32(ADR_RX_11GN_TR_0)) & 0x000f0000 ) >> 16) ++#define GET_RG_TR_LPF_KP_G_T0 (((REG32(ADR_RX_11GN_TR_0)) & 0x00f00000 ) >> 20) ++#define GET_RG_TR_CNT_T0 (((REG32(ADR_RX_11GN_TR_0)) & 0xff000000 ) >> 24) ++#define GET_RG_TR_LPF_KI_G_T2 (((REG32(ADR_RX_11GN_TR_1)) & 0x0000000f ) >> 0) ++#define GET_RG_TR_LPF_KP_G_T2 (((REG32(ADR_RX_11GN_TR_1)) & 0x000000f0 ) >> 4) ++#define GET_RG_TR_CNT_T2 (((REG32(ADR_RX_11GN_TR_1)) & 0x0000ff00 ) >> 8) ++#define GET_RG_TR_LPF_KI_G (((REG32(ADR_RX_11GN_TR_2)) & 0x0000000f ) >> 0) ++#define GET_RG_TR_LPF_KP_G (((REG32(ADR_RX_11GN_TR_2)) & 0x000000f0 ) >> 4) ++#define GET_RG_TR_LPF_RATE_G (((REG32(ADR_RX_11GN_TR_2)) & 0x3fffff00 ) >> 8) ++#define GET_RG_CR_LPF_KI_G (((REG32(ADR_RX_11GN_CCA_0)) & 0x00000007 ) >> 0) ++#define GET_RG_SYM_BOUND_CNT (((REG32(ADR_RX_11GN_CCA_0)) & 0x00007f00 ) >> 8) ++#define GET_RG_XSCOR32_RATIO (((REG32(ADR_RX_11GN_CCA_0)) & 0x007f0000 ) >> 16) ++#define GET_RG_ATCOR64_CNT_LMT (((REG32(ADR_RX_11GN_CCA_0)) & 0x7f000000 ) >> 24) ++#define GET_RG_ATCOR16_CNT_LMT2 (((REG32(ADR_RX_11GN_CCA_1)) & 0x00007f00 ) >> 8) ++#define GET_RG_ATCOR16_CNT_LMT1 (((REG32(ADR_RX_11GN_CCA_1)) & 0x007f0000 ) >> 16) ++#define GET_RG_ATCOR16_RATIO_SB (((REG32(ADR_RX_11GN_CCA_1)) & 0x7f000000 ) >> 24) ++#define GET_RG_XSCOR64_CNT_LMT2 (((REG32(ADR_RX_11GN_CCA_2)) & 0x007f0000 ) >> 16) ++#define GET_RG_XSCOR64_CNT_LMT1 (((REG32(ADR_RX_11GN_CCA_2)) & 0x7f000000 ) >> 24) ++#define GET_RG_RX_FFT_SCALE (((REG32(ADR_RX_11GN_CCA_FFT_SCALE)) & 0x000003ff ) >> 0) ++#define GET_RG_VITERBI_AB_SWAP (((REG32(ADR_RX_11GN_CCA_FFT_SCALE)) & 0x00010000 ) >> 16) ++#define GET_RG_ATCOR16_CNT_TH (((REG32(ADR_RX_11GN_CCA_FFT_SCALE)) & 0x0f000000 ) >> 24) ++#define GET_RG_NORMSQUARE_LOW_SNR_7 (((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0x000000ff ) >> 0) ++#define GET_RG_NORMSQUARE_LOW_SNR_6 (((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0x0000ff00 ) >> 8) ++#define GET_RG_NORMSQUARE_LOW_SNR_5 (((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0x00ff0000 ) >> 16) ++#define GET_RG_NORMSQUARE_LOW_SNR_4 (((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0xff000000 ) >> 24) ++#define GET_RG_NORMSQUARE_LOW_SNR_8 (((REG32(ADR_RX_11GN_SOFT_DEMAP_1)) & 0xff000000 ) >> 24) ++#define GET_RG_NORMSQUARE_SNR_3 (((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0x000000ff ) >> 0) ++#define GET_RG_NORMSQUARE_SNR_2 (((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0x0000ff00 ) >> 8) ++#define GET_RG_NORMSQUARE_SNR_1 (((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0x00ff0000 ) >> 16) ++#define GET_RG_NORMSQUARE_SNR_0 (((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0xff000000 ) >> 24) ++#define GET_RG_NORMSQUARE_SNR_7 (((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0x000000ff ) >> 0) ++#define GET_RG_NORMSQUARE_SNR_6 (((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0x0000ff00 ) >> 8) ++#define GET_RG_NORMSQUARE_SNR_5 (((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0x00ff0000 ) >> 16) ++#define GET_RG_NORMSQUARE_SNR_4 (((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0xff000000 ) >> 24) ++#define GET_RG_NORMSQUARE_SNR_8 (((REG32(ADR_RX_11GN_SOFT_DEMAP_4)) & 0xff000000 ) >> 24) ++#define GET_RG_SNR_TH_64QAM (((REG32(ADR_RX_11GN_SOFT_DEMAP_5)) & 0x0000007f ) >> 0) ++#define GET_RG_SNR_TH_16QAM (((REG32(ADR_RX_11GN_SOFT_DEMAP_5)) & 0x00007f00 ) >> 8) ++#define GET_RG_ATCOR16_CNT_PLUS_LMT2 (((REG32(ADR_RX_11GN_SYM_BOUND_0)) & 0x0000007f ) >> 0) ++#define GET_RG_ATCOR16_CNT_PLUS_LMT1 (((REG32(ADR_RX_11GN_SYM_BOUND_0)) & 0x00007f00 ) >> 8) ++#define GET_RG_SYM_BOUND_METHOD (((REG32(ADR_RX_11GN_SYM_BOUND_0)) & 0x00030000 ) >> 16) ++#define GET_RG_PWRON_DLY_TH_11GN (((REG32(ADR_RX_11GN_SYM_BOUND_1)) & 0x000000ff ) >> 0) ++#define GET_RG_SB_START_CNT (((REG32(ADR_RX_11GN_SYM_BOUND_1)) & 0x00007f00 ) >> 8) ++#define GET_RG_POW16_CNT_TH (((REG32(ADR_RX_11GN_CCA_PWR)) & 0x000000f0 ) >> 4) ++#define GET_RG_POW16_SHORT_CNT_LMT (((REG32(ADR_RX_11GN_CCA_PWR)) & 0x00000700 ) >> 8) ++#define GET_RG_POW16_TH_L (((REG32(ADR_RX_11GN_CCA_PWR)) & 0x7f000000 ) >> 24) ++#define GET_RG_XSCOR16_SHORT_CNT_LMT (((REG32(ADR_RX_11GN_CCA_CNT)) & 0x00000007 ) >> 0) ++#define GET_RG_XSCOR16_RATIO (((REG32(ADR_RX_11GN_CCA_CNT)) & 0x00007f00 ) >> 8) ++#define GET_RG_ATCOR16_SHORT_CNT_LMT (((REG32(ADR_RX_11GN_CCA_CNT)) & 0x00070000 ) >> 16) ++#define GET_RG_ATCOR16_RATIO_CCD (((REG32(ADR_RX_11GN_CCA_CNT)) & 0x7f000000 ) >> 24) ++#define GET_RG_ATCOR64_ACC_LMT (((REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) & 0x0000007f ) >> 0) ++#define GET_RG_ATCOR16_SHORT_CNT_LMT2 (((REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) & 0x00070000 ) >> 16) ++#define GET_RG_VITERBI_TB_BITS (((REG32(ADR_RX_11GN_VTB_TB)) & 0xff000000 ) >> 24) ++#define GET_RG_CR_CNT_UPDATE (((REG32(ADR_RX_11GN_ERR_UPDATE)) & 0x000000ff ) >> 0) ++#define GET_RG_TR_CNT_UPDATE (((REG32(ADR_RX_11GN_ERR_UPDATE)) & 0x00ff0000 ) >> 16) ++#define GET_RG_BYPASS_CPE_MA (((REG32(ADR_RX_11GN_SHORT_GI)) & 0x00000010 ) >> 4) ++#define GET_RG_PILOT_BNDRY_SHIFT (((REG32(ADR_RX_11GN_SHORT_GI)) & 0x00000700 ) >> 8) ++#define GET_RG_EQ_SHORT_GI_SHIFT (((REG32(ADR_RX_11GN_SHORT_GI)) & 0x00007000 ) >> 12) ++#define GET_RG_FFT_WDW_SHORT_SHIFT (((REG32(ADR_RX_11GN_SHORT_GI)) & 0x00070000 ) >> 16) ++#define GET_RG_CHSMTH_COEF (((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0x00030000 ) >> 16) ++#define GET_RG_CHSMTH_EN (((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0x00040000 ) >> 18) ++#define GET_RG_CHEST_DD_FACTOR (((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0x07000000 ) >> 24) ++#define GET_RG_CH_UPDATE (((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0x80000000 ) >> 31) ++#define GET_RG_FMT_DET_MM_TH (((REG32(ADR_RX_11GN_PKT_FORMAT_0)) & 0x000000ff ) >> 0) ++#define GET_RG_FMT_DET_GF_TH (((REG32(ADR_RX_11GN_PKT_FORMAT_0)) & 0x0000ff00 ) >> 8) ++#define GET_RG_DO_NOT_CHECK_L_RATE (((REG32(ADR_RX_11GN_PKT_FORMAT_0)) & 0x02000000 ) >> 25) ++#define GET_RG_FMT_DET_LENGTH_TH (((REG32(ADR_RX_11GN_PKT_FORMAT_1)) & 0x0000ffff ) >> 0) ++#define GET_RG_L_LENGTH_MAX (((REG32(ADR_RX_11GN_PKT_FORMAT_1)) & 0xffff0000 ) >> 16) ++#define GET_RG_TX_TIME_EXT (((REG32(ADR_RX_11GN_TX_TIME)) & 0x000000ff ) >> 0) ++#define GET_RG_MAC_DES_SPACE (((REG32(ADR_RX_11GN_TX_TIME)) & 0x00f00000 ) >> 20) ++#define GET_RG_TR_LPF_STBC_GF_KI_G (((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0x0000000f ) >> 0) ++#define GET_RG_TR_LPF_STBC_GF_KP_G (((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0x000000f0 ) >> 4) ++#define GET_RG_TR_LPF_STBC_MF_KI_G (((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0x00000f00 ) >> 8) ++#define GET_RG_TR_LPF_STBC_MF_KP_G (((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0x0000f000 ) >> 12) ++#define GET_RG_MODE_REG_IN_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x0001ffff ) >> 0) ++#define GET_RG_PARALLEL_DR_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x00100000 ) >> 20) ++#define GET_RG_MBRUN_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x01000000 ) >> 24) ++#define GET_RG_SHIFT_DR_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x10000000 ) >> 28) ++#define GET_RG_MODE_REG_SI_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x20000000 ) >> 29) ++#define GET_RG_SIMULATION_MODE_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x40000000 ) >> 30) ++#define GET_RG_DBIST_MODE_80 (((REG32(ADR_RX_11GN_BIST_0)) & 0x80000000 ) >> 31) ++#define GET_RG_MODE_REG_IN_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x0000ffff ) >> 0) ++#define GET_RG_PARALLEL_DR_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x00100000 ) >> 20) ++#define GET_RG_MBRUN_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x01000000 ) >> 24) ++#define GET_RG_SHIFT_DR_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x10000000 ) >> 28) ++#define GET_RG_MODE_REG_SI_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x20000000 ) >> 29) ++#define GET_RG_SIMULATION_MODE_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x40000000 ) >> 30) ++#define GET_RG_DBIST_MODE_64 (((REG32(ADR_RX_11GN_BIST_1)) & 0x80000000 ) >> 31) ++#define GET_RO_MODE_REG_OUT_80 (((REG32(ADR_RX_11GN_BIST_2)) & 0x0001ffff ) >> 0) ++#define GET_RO_MODE_REG_SO_80 (((REG32(ADR_RX_11GN_BIST_2)) & 0x01000000 ) >> 24) ++#define GET_RO_MONITOR_BUS_80 (((REG32(ADR_RX_11GN_BIST_3)) & 0x003fffff ) >> 0) ++#define GET_RO_MODE_REG_OUT_64 (((REG32(ADR_RX_11GN_BIST_4)) & 0x0000ffff ) >> 0) ++#define GET_RO_MODE_REG_SO_64 (((REG32(ADR_RX_11GN_BIST_4)) & 0x01000000 ) >> 24) ++#define GET_RO_MONITOR_BUS_64 (((REG32(ADR_RX_11GN_BIST_5)) & 0x0007ffff ) >> 0) ++#define GET_RO_SPECTRUM_DATA (((REG32(ADR_RX_11GN_SPECTRUM_ANALYZER)) & 0xffffffff ) >> 0) ++#define GET_GN_SNR (((REG32(ADR_RX_11GN_READ_0)) & 0x0000007f ) >> 0) ++#define GET_GN_NOISE_PWR (((REG32(ADR_RX_11GN_READ_0)) & 0x00007f00 ) >> 8) ++#define GET_GN_RCPI (((REG32(ADR_RX_11GN_READ_0)) & 0x007f0000 ) >> 16) ++#define GET_GN_SIGNAL_PWR (((REG32(ADR_RX_11GN_READ_0)) & 0x7f000000 ) >> 24) ++#define GET_RO_FREQ_OS_LTS (((REG32(ADR_RX_11GN_FREQ_OFFSET)) & 0x00007fff ) >> 0) ++#define GET_CSTATE (((REG32(ADR_RX_11GN_FREQ_OFFSET)) & 0x000f0000 ) >> 16) ++#define GET_SIGNAL_FIELD0 (((REG32(ADR_RX_11GN_SIGNAL_FIELD_0)) & 0x00ffffff ) >> 0) ++#define GET_SIGNAL_FIELD1 (((REG32(ADR_RX_11GN_SIGNAL_FIELD_1)) & 0x00ffffff ) >> 0) ++#define GET_GN_PACKET_ERR_CNT (((REG32(ADR_RX_11GN_PKT_ERR_CNT)) & 0x0000ffff ) >> 0) ++#define GET_GN_PACKET_CNT (((REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) & 0x0000ffff ) >> 0) ++#define GET_GN_CCA_CNT (((REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) & 0xffff0000 ) >> 16) ++#define GET_GN_LENGTH_FIELD (((REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) & 0x0000ffff ) >> 0) ++#define GET_GN_SERVICE_FIELD (((REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) & 0xffff0000 ) >> 16) ++#define GET_RO_HT_MCS_40M (((REG32(ADR_RX_11GN_RATE)) & 0x0000007f ) >> 0) ++#define GET_RO_L_RATE_40M (((REG32(ADR_RX_11GN_RATE)) & 0x00003f00 ) >> 8) ++#define GET_RG_DAGC_CNT_TH (((REG32(ADR_RX_11GN_STAT_EN)) & 0x00000003 ) >> 0) ++#define GET_RG_PACKET_STAT_EN_11GN (((REG32(ADR_RX_11GN_STAT_EN)) & 0x00100000 ) >> 20) ++#define GET_RX_PHY_11GN_SOFT_RST_N (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000001 ) >> 0) ++#define GET_RG_RIFS_EN (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000002 ) >> 1) ++#define GET_RG_STBC_EN (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000004 ) >> 2) ++#define GET_RG_COR_SEL (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000008 ) >> 3) ++#define GET_RG_INI_PHASE (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000030 ) >> 4) ++#define GET_RG_HT_LTF_SEL_EQ (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000040 ) >> 6) ++#define GET_RG_HT_LTF_SEL_PILOT (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000080 ) >> 7) ++#define GET_RG_CCA_PWR_SEL (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000200 ) >> 9) ++#define GET_RG_CCA_XSCOR_PWR_SEL (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000400 ) >> 10) ++#define GET_RG_CCA_XSCOR_AVGPWR_SEL (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00000800 ) >> 11) ++#define GET_RG_DEBUG_SEL (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x0000f000 ) >> 12) ++#define GET_RG_POST_CLK_EN (((REG32(ADR_RX_11GN_SOFT_RST)) & 0x00010000 ) >> 16) ++#define GET_IQCAL_RF_TX_EN (((REG32(ADR_RF_CONTROL_0)) & 0x00000001 ) >> 0) ++#define GET_IQCAL_RF_TX_PA_EN (((REG32(ADR_RF_CONTROL_0)) & 0x00000002 ) >> 1) ++#define GET_IQCAL_RF_TX_DAC_EN (((REG32(ADR_RF_CONTROL_0)) & 0x00000004 ) >> 2) ++#define GET_IQCAL_RF_RX_AGC (((REG32(ADR_RF_CONTROL_0)) & 0x00000008 ) >> 3) ++#define GET_IQCAL_RF_PGAG (((REG32(ADR_RF_CONTROL_0)) & 0x00000f00 ) >> 8) ++#define GET_IQCAL_RF_RFG (((REG32(ADR_RF_CONTROL_0)) & 0x00003000 ) >> 12) ++#define GET_RG_TONEGEN_FREQ (((REG32(ADR_RF_CONTROL_0)) & 0x007f0000 ) >> 16) ++#define GET_RG_TONEGEN_EN (((REG32(ADR_RF_CONTROL_0)) & 0x00800000 ) >> 23) ++#define GET_RG_TONEGEN_INIT_PH (((REG32(ADR_RF_CONTROL_0)) & 0x7f000000 ) >> 24) ++#define GET_RG_TONEGEN2_FREQ (((REG32(ADR_RF_CONTROL_1)) & 0x0000007f ) >> 0) ++#define GET_RG_TONEGEN2_EN (((REG32(ADR_RF_CONTROL_1)) & 0x00000080 ) >> 7) ++#define GET_RG_TONEGEN2_SCALE (((REG32(ADR_RF_CONTROL_1)) & 0x0000ff00 ) >> 8) ++#define GET_RG_TXIQ_CLP_THD_I (((REG32(ADR_TX_IQ_CONTROL_0)) & 0x000003ff ) >> 0) ++#define GET_RG_TXIQ_CLP_THD_Q (((REG32(ADR_TX_IQ_CONTROL_0)) & 0x03ff0000 ) >> 16) ++#define GET_RG_TX_I_SCALE (((REG32(ADR_TX_IQ_CONTROL_1)) & 0x000000ff ) >> 0) ++#define GET_RG_TX_Q_SCALE (((REG32(ADR_TX_IQ_CONTROL_1)) & 0x0000ff00 ) >> 8) ++#define GET_RG_TX_IQ_SWP (((REG32(ADR_TX_IQ_CONTROL_1)) & 0x00010000 ) >> 16) ++#define GET_RG_TX_SGN_OUT (((REG32(ADR_TX_IQ_CONTROL_1)) & 0x00020000 ) >> 17) ++#define GET_RG_TXIQ_EMU_IDX (((REG32(ADR_TX_IQ_CONTROL_1)) & 0x003c0000 ) >> 18) ++#define GET_RG_TX_IQ_SRC (((REG32(ADR_TX_IQ_CONTROL_1)) & 0x03000000 ) >> 24) ++#define GET_RG_TX_I_DC (((REG32(ADR_TX_IQ_CONTROL_2)) & 0x000003ff ) >> 0) ++#define GET_RG_TX_Q_DC (((REG32(ADR_TX_IQ_CONTROL_2)) & 0x03ff0000 ) >> 16) ++#define GET_RG_TX_IQ_THETA (((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0x0000001f ) >> 0) ++#define GET_RG_TX_IQ_ALPHA (((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0x00001f00 ) >> 8) ++#define GET_RG_TXIQ_NOSHRINK (((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0x00002000 ) >> 13) ++#define GET_RG_TX_I_OFFSET (((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0x00ff0000 ) >> 16) ++#define GET_RG_TX_Q_OFFSET (((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0xff000000 ) >> 24) ++#define GET_RG_RX_IQ_THETA (((REG32(ADR_RX_COMPENSATION_CONTROL)) & 0x0000001f ) >> 0) ++#define GET_RG_RX_IQ_ALPHA (((REG32(ADR_RX_COMPENSATION_CONTROL)) & 0x00001f00 ) >> 8) ++#define GET_RG_RXIQ_NOSHRINK (((REG32(ADR_RX_COMPENSATION_CONTROL)) & 0x00002000 ) >> 13) ++#define GET_RG_MA_DPTH (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x0000000f ) >> 0) ++#define GET_RG_INTG_PH (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x000003f0 ) >> 4) ++#define GET_RG_INTG_PRD (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x00001c00 ) >> 10) ++#define GET_RG_INTG_MU (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x00006000 ) >> 13) ++#define GET_RG_IQCAL_SPRM_SELQ (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x00010000 ) >> 16) ++#define GET_RG_IQCAL_SPRM_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x00020000 ) >> 17) ++#define GET_RG_IQCAL_SPRM_FREQ (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IQCAL_IQCOL_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x01000000 ) >> 24) ++#define GET_RG_IQCAL_ALPHA_ESTM_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x02000000 ) >> 25) ++#define GET_RG_IQCAL_DC_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x04000000 ) >> 26) ++#define GET_RG_PHEST_STBY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x08000000 ) >> 27) ++#define GET_RG_PHEST_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x10000000 ) >> 28) ++#define GET_RG_GP_DIV_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x20000000 ) >> 29) ++#define GET_RG_DPD_GAIN_EST_EN (((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0x40000000 ) >> 30) ++#define GET_RG_IQCAL_MULT_OP0 (((REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) & 0x000003ff ) >> 0) ++#define GET_RG_IQCAL_MULT_OP1 (((REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) & 0x03ff0000 ) >> 16) ++#define GET_RO_IQCAL_O (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x000fffff ) >> 0) ++#define GET_RO_IQCAL_SPRM_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x00100000 ) >> 20) ++#define GET_RO_IQCAL_IQCOL_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x00200000 ) >> 21) ++#define GET_RO_IQCAL_ALPHA_ESTM_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x00400000 ) >> 22) ++#define GET_RO_IQCAL_DC_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x00800000 ) >> 23) ++#define GET_RO_IQCAL_MULT_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x01000000 ) >> 24) ++#define GET_RO_FFT_ENRG_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x02000000 ) >> 25) ++#define GET_RO_PHEST_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x04000000 ) >> 26) ++#define GET_RO_GP_DIV_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x08000000 ) >> 27) ++#define GET_RO_GAIN_EST_RDY (((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0x10000000 ) >> 28) ++#define GET_RO_AMP_O (((REG32(ADR_RX_OBSERVATION_CIRCUIT_3)) & 0x000001ff ) >> 0) ++#define GET_RG_RX_I_SCALE (((REG32(ADR_RF_IQ_CONTROL_0)) & 0x000000ff ) >> 0) ++#define GET_RG_RX_Q_SCALE (((REG32(ADR_RF_IQ_CONTROL_0)) & 0x0000ff00 ) >> 8) ++#define GET_RG_RX_I_OFFSET (((REG32(ADR_RF_IQ_CONTROL_0)) & 0x00ff0000 ) >> 16) ++#define GET_RG_RX_Q_OFFSET (((REG32(ADR_RF_IQ_CONTROL_0)) & 0xff000000 ) >> 24) ++#define GET_RG_RX_IQ_SWP (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x00000001 ) >> 0) ++#define GET_RG_RX_SGN_IN (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x00000002 ) >> 1) ++#define GET_RG_RX_IQ_SRC (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x0000000c ) >> 2) ++#define GET_RG_ACI_GAIN (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x00000ff0 ) >> 4) ++#define GET_RG_FFT_EN (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x00001000 ) >> 12) ++#define GET_RG_FFT_MOD (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x00002000 ) >> 13) ++#define GET_RG_FFT_SCALE (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x00ffc000 ) >> 14) ++#define GET_RG_FFT_ENRG_FREQ (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x3f000000 ) >> 24) ++#define GET_RG_FPGA_80M_PH_UP (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x40000000 ) >> 30) ++#define GET_RG_FPGA_80M_PH_STP (((REG32(ADR_RF_IQ_CONTROL_1)) & 0x80000000 ) >> 31) ++#define GET_RG_ADC2LA_SEL (((REG32(ADR_RF_IQ_CONTROL_2)) & 0x00000001 ) >> 0) ++#define GET_RG_ADC2LA_CLKPH (((REG32(ADR_RF_IQ_CONTROL_2)) & 0x00000002 ) >> 1) ++#define GET_RG_RXIQ_EMU_IDX (((REG32(ADR_RF_IQ_CONTROL_3)) & 0x0000000f ) >> 0) ++#define GET_RG_IQCAL_BP_ACI (((REG32(ADR_RF_IQ_CONTROL_3)) & 0x00000010 ) >> 4) ++#define GET_RG_DPD_AM_EN (((REG32(ADR_DPD_CONTROL)) & 0x00000001 ) >> 0) ++#define GET_RG_DPD_PM_EN (((REG32(ADR_DPD_CONTROL)) & 0x00000002 ) >> 1) ++#define GET_RG_DPD_PM_AMSEL (((REG32(ADR_DPD_CONTROL)) & 0x00000004 ) >> 2) ++#define GET_RG_DPD_020_GAIN (((REG32(ADR_DPD_GAIN_TABLE_0)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_040_GAIN (((REG32(ADR_DPD_GAIN_TABLE_0)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_060_GAIN (((REG32(ADR_DPD_GAIN_TABLE_1)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_080_GAIN (((REG32(ADR_DPD_GAIN_TABLE_1)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_0A0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_2)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_0C0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_2)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_0D0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_3)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_0E0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_3)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_0F0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_4)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_100_GAIN (((REG32(ADR_DPD_GAIN_TABLE_4)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_110_GAIN (((REG32(ADR_DPD_GAIN_TABLE_5)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_120_GAIN (((REG32(ADR_DPD_GAIN_TABLE_5)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_130_GAIN (((REG32(ADR_DPD_GAIN_TABLE_6)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_140_GAIN (((REG32(ADR_DPD_GAIN_TABLE_6)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_150_GAIN (((REG32(ADR_DPD_GAIN_TABLE_7)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_160_GAIN (((REG32(ADR_DPD_GAIN_TABLE_7)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_170_GAIN (((REG32(ADR_DPD_GAIN_TABLE_8)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_180_GAIN (((REG32(ADR_DPD_GAIN_TABLE_8)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_190_GAIN (((REG32(ADR_DPD_GAIN_TABLE_9)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_1A0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_9)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_1B0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_A)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_1C0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_A)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_1D0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_B)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_1E0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_B)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_1F0_GAIN (((REG32(ADR_DPD_GAIN_TABLE_C)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_200_GAIN (((REG32(ADR_DPD_GAIN_TABLE_C)) & 0x03ff0000 ) >> 16) ++#define GET_RG_DPD_020_PH (((REG32(ADR_DPD_PH_TABLE_0)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_040_PH (((REG32(ADR_DPD_PH_TABLE_0)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_060_PH (((REG32(ADR_DPD_PH_TABLE_1)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_080_PH (((REG32(ADR_DPD_PH_TABLE_1)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_0A0_PH (((REG32(ADR_DPD_PH_TABLE_2)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_0C0_PH (((REG32(ADR_DPD_PH_TABLE_2)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_0D0_PH (((REG32(ADR_DPD_PH_TABLE_3)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_0E0_PH (((REG32(ADR_DPD_PH_TABLE_3)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_0F0_PH (((REG32(ADR_DPD_PH_TABLE_4)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_100_PH (((REG32(ADR_DPD_PH_TABLE_4)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_110_PH (((REG32(ADR_DPD_PH_TABLE_5)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_120_PH (((REG32(ADR_DPD_PH_TABLE_5)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_130_PH (((REG32(ADR_DPD_PH_TABLE_6)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_140_PH (((REG32(ADR_DPD_PH_TABLE_6)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_150_PH (((REG32(ADR_DPD_PH_TABLE_7)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_160_PH (((REG32(ADR_DPD_PH_TABLE_7)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_170_PH (((REG32(ADR_DPD_PH_TABLE_8)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_180_PH (((REG32(ADR_DPD_PH_TABLE_8)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_190_PH (((REG32(ADR_DPD_PH_TABLE_9)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_1A0_PH (((REG32(ADR_DPD_PH_TABLE_9)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_1B0_PH (((REG32(ADR_DPD_PH_TABLE_A)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_1C0_PH (((REG32(ADR_DPD_PH_TABLE_A)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_1D0_PH (((REG32(ADR_DPD_PH_TABLE_B)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_1E0_PH (((REG32(ADR_DPD_PH_TABLE_B)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_1F0_PH (((REG32(ADR_DPD_PH_TABLE_C)) & 0x00001fff ) >> 0) ++#define GET_RG_DPD_200_PH (((REG32(ADR_DPD_PH_TABLE_C)) & 0x1fff0000 ) >> 16) ++#define GET_RG_DPD_GAIN_EST_Y0 (((REG32(ADR_DPD_GAIN_ESTIMATION_0)) & 0x000001ff ) >> 0) ++#define GET_RG_DPD_GAIN_EST_Y1 (((REG32(ADR_DPD_GAIN_ESTIMATION_0)) & 0x01ff0000 ) >> 16) ++#define GET_RG_DPD_LOOP_GAIN (((REG32(ADR_DPD_GAIN_ESTIMATION_1)) & 0x000003ff ) >> 0) ++#define GET_RG_DPD_GAIN_EST_X0 (((REG32(ADR_DPD_GAIN_ESTIMATION_2)) & 0x000001ff ) >> 0) ++#define GET_RO_DPD_GAIN (((REG32(ADR_DPD_GAIN_ESTIMATION_2)) & 0x03ff0000 ) >> 16) ++#define GET_TX_SCALE_11B (((REG32(ADR_TX_GAIN_FACTOR)) & 0x000000ff ) >> 0) ++#define GET_TX_SCALE_11B_P0D5 (((REG32(ADR_TX_GAIN_FACTOR)) & 0x0000ff00 ) >> 8) ++#define GET_TX_SCALE_11G (((REG32(ADR_TX_GAIN_FACTOR)) & 0x00ff0000 ) >> 16) ++#define GET_TX_SCALE_11G_P0D5 (((REG32(ADR_TX_GAIN_FACTOR)) & 0xff000000 ) >> 24) ++#define GET_RG_EN_MANUAL (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_TX_EN (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_RG_TX_PA_EN (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_RG_TX_DAC_EN (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_RG_RX_AGC (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000010 ) >> 4) ++#define GET_RG_RX_GAIN_MANUAL (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000020 ) >> 5) ++#define GET_RG_RFG (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x000000c0 ) >> 6) ++#define GET_RG_PGAG (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00000f00 ) >> 8) ++#define GET_RG_MODE (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00003000 ) >> 12) ++#define GET_RG_EN_TX_TRSW (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00004000 ) >> 14) ++#define GET_RG_EN_SX (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00008000 ) >> 15) ++#define GET_RG_EN_RX_LNA (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00010000 ) >> 16) ++#define GET_RG_EN_RX_MIXER (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00020000 ) >> 17) ++#define GET_RG_EN_RX_DIV2 (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00040000 ) >> 18) ++#define GET_RG_EN_RX_LOBUF (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00080000 ) >> 19) ++#define GET_RG_EN_RX_TZ (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00100000 ) >> 20) ++#define GET_RG_EN_RX_FILTER (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00200000 ) >> 21) ++#define GET_RG_EN_RX_HPF (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00400000 ) >> 22) ++#define GET_RG_EN_RX_RSSI (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x00800000 ) >> 23) ++#define GET_RG_EN_ADC (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x01000000 ) >> 24) ++#define GET_RG_EN_TX_MOD (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x02000000 ) >> 25) ++#define GET_RG_EN_TX_DIV2 (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x04000000 ) >> 26) ++#define GET_RG_EN_TX_DIV2_BUF (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x08000000 ) >> 27) ++#define GET_RG_EN_TX_LOBF (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x10000000 ) >> 28) ++#define GET_RG_EN_RX_LOBF (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x20000000 ) >> 29) ++#define GET_RG_SEL_DPLL_CLK (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x40000000 ) >> 30) ++#define GET_RG_EN_CLK_960MBY13_UART (((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x80000000 ) >> 31) ++#define GET_RG_EN_TX_DPD (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_EN_TX_TSSI (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_RG_EN_RX_IQCAL (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_RG_EN_TX_DAC_CAL (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_RG_EN_TX_SELF_MIXER (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000010 ) >> 4) ++#define GET_RG_EN_TX_DAC_OUT (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000020 ) >> 5) ++#define GET_RG_EN_LDO_RX_FE (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000040 ) >> 6) ++#define GET_RG_EN_LDO_ABB (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000080 ) >> 7) ++#define GET_RG_EN_LDO_AFE (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000100 ) >> 8) ++#define GET_RG_EN_SX_CHPLDO (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000200 ) >> 9) ++#define GET_RG_EN_SX_LOBFLDO (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000400 ) >> 10) ++#define GET_RG_EN_IREF_RX (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00000800 ) >> 11) ++#define GET_RG_EN_TX_DAC_VOUT (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00002000 ) >> 13) ++#define GET_RG_EN_SX_LCK_BIN (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00004000 ) >> 14) ++#define GET_RG_RTC_CAL_MODE (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00010000 ) >> 16) ++#define GET_RG_EN_IQPAD_IOSW (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00020000 ) >> 17) ++#define GET_RG_EN_TESTPAD_IOSW (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00040000 ) >> 18) ++#define GET_RG_EN_TRXBF_BYPASS (((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0x00080000 ) >> 19) ++#define GET_RG_LDO_LEVEL_RX_FE (((REG32(ADR_LDO_REGISTER)) & 0x00000007 ) >> 0) ++#define GET_RG_LDO_LEVEL_ABB (((REG32(ADR_LDO_REGISTER)) & 0x00000038 ) >> 3) ++#define GET_RG_LDO_LEVEL_AFE (((REG32(ADR_LDO_REGISTER)) & 0x000001c0 ) >> 6) ++#define GET_RG_SX_LDO_CHP_LEVEL (((REG32(ADR_LDO_REGISTER)) & 0x00000e00 ) >> 9) ++#define GET_RG_SX_LDO_LOBF_LEVEL (((REG32(ADR_LDO_REGISTER)) & 0x00007000 ) >> 12) ++#define GET_RG_SX_LDO_XOSC_LEVEL (((REG32(ADR_LDO_REGISTER)) & 0x00038000 ) >> 15) ++#define GET_RG_DP_LDO_LEVEL (((REG32(ADR_LDO_REGISTER)) & 0x001c0000 ) >> 18) ++#define GET_RG_SX_LDO_VCO_LEVEL (((REG32(ADR_LDO_REGISTER)) & 0x00e00000 ) >> 21) ++#define GET_RG_TX_LDO_TX_LEVEL (((REG32(ADR_LDO_REGISTER)) & 0x07000000 ) >> 24) ++#define GET_RG_EN_RX_PADSW (((REG32(ADR_ABB_REGISTER_1)) & 0x00000001 ) >> 0) ++#define GET_RG_EN_RX_TESTNODE (((REG32(ADR_ABB_REGISTER_1)) & 0x00000002 ) >> 1) ++#define GET_RG_RX_ABBCFIX (((REG32(ADR_ABB_REGISTER_1)) & 0x00000004 ) >> 2) ++#define GET_RG_RX_ABBCTUNE (((REG32(ADR_ABB_REGISTER_1)) & 0x000001f8 ) >> 3) ++#define GET_RG_RX_ABBOUT_TRI_STATE (((REG32(ADR_ABB_REGISTER_1)) & 0x00000200 ) >> 9) ++#define GET_RG_RX_ABB_N_MODE (((REG32(ADR_ABB_REGISTER_1)) & 0x00000400 ) >> 10) ++#define GET_RG_RX_EN_LOOPA (((REG32(ADR_ABB_REGISTER_1)) & 0x00000800 ) >> 11) ++#define GET_RG_RX_FILTERI1ST (((REG32(ADR_ABB_REGISTER_1)) & 0x00003000 ) >> 12) ++#define GET_RG_RX_FILTERI2ND (((REG32(ADR_ABB_REGISTER_1)) & 0x0000c000 ) >> 14) ++#define GET_RG_RX_FILTERI3RD (((REG32(ADR_ABB_REGISTER_1)) & 0x00030000 ) >> 16) ++#define GET_RG_RX_FILTERI_COURSE (((REG32(ADR_ABB_REGISTER_1)) & 0x000c0000 ) >> 18) ++#define GET_RG_RX_FILTERVCM (((REG32(ADR_ABB_REGISTER_1)) & 0x00300000 ) >> 20) ++#define GET_RG_RX_HPF3M (((REG32(ADR_ABB_REGISTER_1)) & 0x00400000 ) >> 22) ++#define GET_RG_RX_HPF300K (((REG32(ADR_ABB_REGISTER_1)) & 0x00800000 ) >> 23) ++#define GET_RG_RX_HPFI (((REG32(ADR_ABB_REGISTER_1)) & 0x03000000 ) >> 24) ++#define GET_RG_RX_HPF_FINALCORNER (((REG32(ADR_ABB_REGISTER_1)) & 0x0c000000 ) >> 26) ++#define GET_RG_RX_HPF_SETTLE1_C (((REG32(ADR_ABB_REGISTER_1)) & 0x30000000 ) >> 28) ++#define GET_RG_RX_HPF_SETTLE1_R (((REG32(ADR_ABB_REGISTER_2)) & 0x00000003 ) >> 0) ++#define GET_RG_RX_HPF_SETTLE2_C (((REG32(ADR_ABB_REGISTER_2)) & 0x0000000c ) >> 2) ++#define GET_RG_RX_HPF_SETTLE2_R (((REG32(ADR_ABB_REGISTER_2)) & 0x00000030 ) >> 4) ++#define GET_RG_RX_HPF_VCMCON2 (((REG32(ADR_ABB_REGISTER_2)) & 0x000000c0 ) >> 6) ++#define GET_RG_RX_HPF_VCMCON (((REG32(ADR_ABB_REGISTER_2)) & 0x00000300 ) >> 8) ++#define GET_RG_RX_OUTVCM (((REG32(ADR_ABB_REGISTER_2)) & 0x00000c00 ) >> 10) ++#define GET_RG_RX_TZI (((REG32(ADR_ABB_REGISTER_2)) & 0x00003000 ) >> 12) ++#define GET_RG_RX_TZ_OUT_TRISTATE (((REG32(ADR_ABB_REGISTER_2)) & 0x00004000 ) >> 14) ++#define GET_RG_RX_TZ_VCM (((REG32(ADR_ABB_REGISTER_2)) & 0x00018000 ) >> 15) ++#define GET_RG_EN_RX_RSSI_TESTNODE (((REG32(ADR_ABB_REGISTER_2)) & 0x000e0000 ) >> 17) ++#define GET_RG_RX_ADCRSSI_CLKSEL (((REG32(ADR_ABB_REGISTER_2)) & 0x00100000 ) >> 20) ++#define GET_RG_RX_ADCRSSI_VCM (((REG32(ADR_ABB_REGISTER_2)) & 0x00600000 ) >> 21) ++#define GET_RG_RX_REC_LPFCORNER (((REG32(ADR_ABB_REGISTER_2)) & 0x01800000 ) >> 23) ++#define GET_RG_RSSI_CLOCK_GATING (((REG32(ADR_ABB_REGISTER_2)) & 0x02000000 ) >> 25) ++#define GET_RG_TXPGA_CAPSW (((REG32(ADR_TX_FE_REGISTER)) & 0x00000003 ) >> 0) ++#define GET_RG_TXPGA_MAIN (((REG32(ADR_TX_FE_REGISTER)) & 0x000000fc ) >> 2) ++#define GET_RG_TXPGA_STEER (((REG32(ADR_TX_FE_REGISTER)) & 0x00003f00 ) >> 8) ++#define GET_RG_TXMOD_GMCELL (((REG32(ADR_TX_FE_REGISTER)) & 0x0000c000 ) >> 14) ++#define GET_RG_TXLPF_GMCELL (((REG32(ADR_TX_FE_REGISTER)) & 0x00030000 ) >> 16) ++#define GET_RG_PACELL_EN (((REG32(ADR_TX_FE_REGISTER)) & 0x001c0000 ) >> 18) ++#define GET_RG_PABIAS_CTRL (((REG32(ADR_TX_FE_REGISTER)) & 0x01e00000 ) >> 21) ++#define GET_RG_TX_DIV_VSET (((REG32(ADR_TX_FE_REGISTER)) & 0x0c000000 ) >> 26) ++#define GET_RG_TX_LOBUF_VSET (((REG32(ADR_TX_FE_REGISTER)) & 0x30000000 ) >> 28) ++#define GET_RG_RX_SQDC (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00000007 ) >> 0) ++#define GET_RG_RX_DIV2_CORE (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00000018 ) >> 3) ++#define GET_RG_RX_LOBUF (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00000060 ) >> 5) ++#define GET_RG_TX_DPDGM_BIAS (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00000780 ) >> 7) ++#define GET_RG_TX_DPD_DIV (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00007800 ) >> 11) ++#define GET_RG_TX_TSSI_BIAS (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00038000 ) >> 15) ++#define GET_RG_TX_TSSI_DIV (((REG32(ADR_RX_FE_REGISTER_1)) & 0x001c0000 ) >> 18) ++#define GET_RG_TX_TSSI_TESTMODE (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00200000 ) >> 21) ++#define GET_RG_TX_TSSI_TEST (((REG32(ADR_RX_FE_REGISTER_1)) & 0x00c00000 ) >> 22) ++#define GET_RG_PACASCODE_CTRL (((REG32(ADR_RX_FE_REGISTER_1)) & 0x07000000 ) >> 24) ++#define GET_RG_RX_HG_LNA_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x00000003 ) >> 0) ++#define GET_RG_RX_HG_LNAHGN_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x0000003c ) >> 2) ++#define GET_RG_RX_HG_LNAHGP_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x000003c0 ) >> 6) ++#define GET_RG_RX_HG_LNALG_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x00003c00 ) >> 10) ++#define GET_RG_RX_HG_TZ_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x0000c000 ) >> 14) ++#define GET_RG_RX_HG_TZ_CAP (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0x00070000 ) >> 16) ++#define GET_RG_RX_MG_LNA_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x00000003 ) >> 0) ++#define GET_RG_RX_MG_LNAHGN_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x0000003c ) >> 2) ++#define GET_RG_RX_MG_LNAHGP_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x000003c0 ) >> 6) ++#define GET_RG_RX_MG_LNALG_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x00003c00 ) >> 10) ++#define GET_RG_RX_MG_TZ_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x0000c000 ) >> 14) ++#define GET_RG_RX_MG_TZ_CAP (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0x00070000 ) >> 16) ++#define GET_RG_RX_LG_LNA_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x00000003 ) >> 0) ++#define GET_RG_RX_LG_LNAHGN_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x0000003c ) >> 2) ++#define GET_RG_RX_LG_LNAHGP_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x000003c0 ) >> 6) ++#define GET_RG_RX_LG_LNALG_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x00003c00 ) >> 10) ++#define GET_RG_RX_LG_TZ_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x0000c000 ) >> 14) ++#define GET_RG_RX_LG_TZ_CAP (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0x00070000 ) >> 16) ++#define GET_RG_RX_ULG_LNA_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x00000003 ) >> 0) ++#define GET_RG_RX_ULG_LNAHGN_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x0000003c ) >> 2) ++#define GET_RG_RX_ULG_LNAHGP_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x000003c0 ) >> 6) ++#define GET_RG_RX_ULG_LNALG_BIAS (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x00003c00 ) >> 10) ++#define GET_RG_RX_ULG_TZ_GC (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x0000c000 ) >> 14) ++#define GET_RG_RX_ULG_TZ_CAP (((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0x00070000 ) >> 16) ++#define GET_RG_HPF1_FAST_SET_X (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_HPF1_FAST_SET_Y (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_RG_HPF1_FAST_SET_Z (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_RG_HPF_T1A (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000018 ) >> 3) ++#define GET_RG_HPF_T1B (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000060 ) >> 5) ++#define GET_RG_HPF_T1C (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000180 ) >> 7) ++#define GET_RG_RX_LNA_TRI_SEL (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00000600 ) >> 9) ++#define GET_RG_RX_LNA_SETTLE (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00001800 ) >> 11) ++#define GET_RG_TXGAIN_PHYCTRL (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00002000 ) >> 13) ++#define GET_RG_TX_GAIN (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x003fc000 ) >> 14) ++#define GET_RG_TXGAIN_MANUAL (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x00400000 ) >> 22) ++#define GET_RG_TX_GAIN_OFFSET (((REG32(ADR_RX_TX_FSM_REGISTER)) & 0x07800000 ) >> 23) ++#define GET_RG_ADC_CLKSEL (((REG32(ADR_RX_ADC_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_ADC_DIBIAS (((REG32(ADR_RX_ADC_REGISTER)) & 0x00000006 ) >> 1) ++#define GET_RG_ADC_DIVR (((REG32(ADR_RX_ADC_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_RG_ADC_DVCMI (((REG32(ADR_RX_ADC_REGISTER)) & 0x00000030 ) >> 4) ++#define GET_RG_ADC_SAMSEL (((REG32(ADR_RX_ADC_REGISTER)) & 0x000003c0 ) >> 6) ++#define GET_RG_ADC_STNBY (((REG32(ADR_RX_ADC_REGISTER)) & 0x00000400 ) >> 10) ++#define GET_RG_ADC_TESTMODE (((REG32(ADR_RX_ADC_REGISTER)) & 0x00000800 ) >> 11) ++#define GET_RG_ADC_TSEL (((REG32(ADR_RX_ADC_REGISTER)) & 0x0000f000 ) >> 12) ++#define GET_RG_ADC_VRSEL (((REG32(ADR_RX_ADC_REGISTER)) & 0x00030000 ) >> 16) ++#define GET_RG_DICMP (((REG32(ADR_RX_ADC_REGISTER)) & 0x000c0000 ) >> 18) ++#define GET_RG_DIOP (((REG32(ADR_RX_ADC_REGISTER)) & 0x00300000 ) >> 20) ++#define GET_RG_SARADC_VRSEL (((REG32(ADR_RX_ADC_REGISTER)) & 0x00c00000 ) >> 22) ++#define GET_RG_EN_SAR_TEST (((REG32(ADR_RX_ADC_REGISTER)) & 0x03000000 ) >> 24) ++#define GET_RG_SARADC_THERMAL (((REG32(ADR_RX_ADC_REGISTER)) & 0x04000000 ) >> 26) ++#define GET_RG_SARADC_TSSI (((REG32(ADR_RX_ADC_REGISTER)) & 0x08000000 ) >> 27) ++#define GET_RG_CLK_SAR_SEL (((REG32(ADR_RX_ADC_REGISTER)) & 0x30000000 ) >> 28) ++#define GET_RG_EN_SARADC (((REG32(ADR_RX_ADC_REGISTER)) & 0x40000000 ) >> 30) ++#define GET_RG_DACI1ST (((REG32(ADR_TX_DAC_REGISTER)) & 0x00000003 ) >> 0) ++#define GET_RG_TX_DACLPF_ICOURSE (((REG32(ADR_TX_DAC_REGISTER)) & 0x0000000c ) >> 2) ++#define GET_RG_TX_DACLPF_IFINE (((REG32(ADR_TX_DAC_REGISTER)) & 0x00000030 ) >> 4) ++#define GET_RG_TX_DACLPF_VCM (((REG32(ADR_TX_DAC_REGISTER)) & 0x000000c0 ) >> 6) ++#define GET_RG_TX_DAC_CKEDGE_SEL (((REG32(ADR_TX_DAC_REGISTER)) & 0x00000100 ) >> 8) ++#define GET_RG_TX_DAC_IBIAS (((REG32(ADR_TX_DAC_REGISTER)) & 0x00000600 ) >> 9) ++#define GET_RG_TX_DAC_OS (((REG32(ADR_TX_DAC_REGISTER)) & 0x00003800 ) >> 11) ++#define GET_RG_TX_DAC_RCAL (((REG32(ADR_TX_DAC_REGISTER)) & 0x0000c000 ) >> 14) ++#define GET_RG_TX_DAC_TSEL (((REG32(ADR_TX_DAC_REGISTER)) & 0x000f0000 ) >> 16) ++#define GET_RG_TX_EN_VOLTAGE_IN (((REG32(ADR_TX_DAC_REGISTER)) & 0x00100000 ) >> 20) ++#define GET_RG_TXLPF_BYPASS (((REG32(ADR_TX_DAC_REGISTER)) & 0x00200000 ) >> 21) ++#define GET_RG_TXLPF_BOOSTI (((REG32(ADR_TX_DAC_REGISTER)) & 0x00400000 ) >> 22) ++#define GET_RG_TX_DAC_IOFFSET (((REG32(ADR_TX_DAC_REGISTER)) & 0x07800000 ) >> 23) ++#define GET_RG_TX_DAC_QOFFSET (((REG32(ADR_TX_DAC_REGISTER)) & 0x78000000 ) >> 27) ++#define GET_RG_EN_SX_R3 (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_EN_SX_CH (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_RG_EN_SX_CHP (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000004 ) >> 2) ++#define GET_RG_EN_SX_DIVCK (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000008 ) >> 3) ++#define GET_RG_EN_SX_VCOBF (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000010 ) >> 4) ++#define GET_RG_EN_SX_VCO (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000020 ) >> 5) ++#define GET_RG_EN_SX_MOD (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000040 ) >> 6) ++#define GET_RG_EN_SX_DITHER (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000100 ) >> 8) ++#define GET_RG_EN_SX_VT_MON (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00000800 ) >> 11) ++#define GET_RG_EN_SX_VT_MON_DG (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00001000 ) >> 12) ++#define GET_RG_EN_SX_DIV (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00002000 ) >> 13) ++#define GET_RG_EN_SX_LPF (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00004000 ) >> 14) ++#define GET_RG_EN_DPL_MOD (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00008000 ) >> 15) ++#define GET_RG_DPL_MOD_ORDER (((REG32(ADR_SX_ENABLE_REGISTER)) & 0x00030000 ) >> 16) ++#define GET_RG_SX_RFCTRL_F (((REG32(ADR_SYN_REGISTER_1)) & 0x00ffffff ) >> 0) ++#define GET_RG_SX_SEL_CP (((REG32(ADR_SYN_REGISTER_1)) & 0x0f000000 ) >> 24) ++#define GET_RG_SX_SEL_CS (((REG32(ADR_SYN_REGISTER_1)) & 0xf0000000 ) >> 28) ++#define GET_RG_SX_RFCTRL_CH (((REG32(ADR_SYN_REGISTER_2)) & 0x000007ff ) >> 0) ++#define GET_RG_SX_SEL_C3 (((REG32(ADR_SYN_REGISTER_2)) & 0x00007800 ) >> 11) ++#define GET_RG_SX_SEL_RS (((REG32(ADR_SYN_REGISTER_2)) & 0x000f8000 ) >> 15) ++#define GET_RG_SX_SEL_R3 (((REG32(ADR_SYN_REGISTER_2)) & 0x01f00000 ) >> 20) ++#define GET_RG_SX_SEL_ICHP (((REG32(ADR_SYN_PFD_CHP)) & 0x0000001f ) >> 0) ++#define GET_RG_SX_SEL_PCHP (((REG32(ADR_SYN_PFD_CHP)) & 0x000003e0 ) >> 5) ++#define GET_RG_SX_SEL_CHP_REGOP (((REG32(ADR_SYN_PFD_CHP)) & 0x00003c00 ) >> 10) ++#define GET_RG_SX_SEL_CHP_UNIOP (((REG32(ADR_SYN_PFD_CHP)) & 0x0003c000 ) >> 14) ++#define GET_RG_SX_CHP_IOST_POL (((REG32(ADR_SYN_PFD_CHP)) & 0x00040000 ) >> 18) ++#define GET_RG_SX_CHP_IOST (((REG32(ADR_SYN_PFD_CHP)) & 0x00380000 ) >> 19) ++#define GET_RG_SX_PFDSEL (((REG32(ADR_SYN_PFD_CHP)) & 0x00400000 ) >> 22) ++#define GET_RG_SX_PFD_SET (((REG32(ADR_SYN_PFD_CHP)) & 0x00800000 ) >> 23) ++#define GET_RG_SX_PFD_SET1 (((REG32(ADR_SYN_PFD_CHP)) & 0x01000000 ) >> 24) ++#define GET_RG_SX_PFD_SET2 (((REG32(ADR_SYN_PFD_CHP)) & 0x02000000 ) >> 25) ++#define GET_RG_SX_VBNCAS_SEL (((REG32(ADR_SYN_PFD_CHP)) & 0x04000000 ) >> 26) ++#define GET_RG_SX_PFD_RST_H (((REG32(ADR_SYN_PFD_CHP)) & 0x08000000 ) >> 27) ++#define GET_RG_SX_PFD_TRUP (((REG32(ADR_SYN_PFD_CHP)) & 0x10000000 ) >> 28) ++#define GET_RG_SX_PFD_TRDN (((REG32(ADR_SYN_PFD_CHP)) & 0x20000000 ) >> 29) ++#define GET_RG_SX_PFD_TRSEL (((REG32(ADR_SYN_PFD_CHP)) & 0x40000000 ) >> 30) ++#define GET_RG_SX_VCOBA_R (((REG32(ADR_SYN_VCO_LOBF)) & 0x00000007 ) >> 0) ++#define GET_RG_SX_VCORSEL (((REG32(ADR_SYN_VCO_LOBF)) & 0x000000f8 ) >> 3) ++#define GET_RG_SX_VCOCUSEL (((REG32(ADR_SYN_VCO_LOBF)) & 0x00000f00 ) >> 8) ++#define GET_RG_SX_RXBFSEL (((REG32(ADR_SYN_VCO_LOBF)) & 0x0000f000 ) >> 12) ++#define GET_RG_SX_TXBFSEL (((REG32(ADR_SYN_VCO_LOBF)) & 0x000f0000 ) >> 16) ++#define GET_RG_SX_VCOBFSEL (((REG32(ADR_SYN_VCO_LOBF)) & 0x00f00000 ) >> 20) ++#define GET_RG_SX_DIVBFSEL (((REG32(ADR_SYN_VCO_LOBF)) & 0x0f000000 ) >> 24) ++#define GET_RG_SX_GNDR_SEL (((REG32(ADR_SYN_VCO_LOBF)) & 0xf0000000 ) >> 28) ++#define GET_RG_SX_DITHER_WEIGHT (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00000003 ) >> 0) ++#define GET_RG_SX_MOD_ORDER (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00000030 ) >> 4) ++#define GET_RG_SX_RST_H_DIV (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00000200 ) >> 9) ++#define GET_RG_SX_SDM_EDGE (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00000400 ) >> 10) ++#define GET_RG_SX_XO_GM (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00001800 ) >> 11) ++#define GET_RG_SX_REFBYTWO (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00002000 ) >> 13) ++#define GET_RG_SX_LCKEN (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00080000 ) >> 19) ++#define GET_RG_SX_PREVDD (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x00f00000 ) >> 20) ++#define GET_RG_SX_PSCONTERVDD (((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0x0f000000 ) >> 24) ++#define GET_RG_SX_PH (((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0x00002000 ) >> 13) ++#define GET_RG_SX_PL (((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0x00004000 ) >> 14) ++#define GET_RG_XOSC_CBANK_XO (((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0x00078000 ) >> 15) ++#define GET_RG_XOSC_CBANK_XI (((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0x00780000 ) >> 19) ++#define GET_RG_SX_VT_MON_MODE (((REG32(ADR_SYN_LCK_VT)) & 0x00000001 ) >> 0) ++#define GET_RG_SX_VT_TH_HI (((REG32(ADR_SYN_LCK_VT)) & 0x00000006 ) >> 1) ++#define GET_RG_SX_VT_TH_LO (((REG32(ADR_SYN_LCK_VT)) & 0x00000018 ) >> 3) ++#define GET_RG_SX_VT_SET (((REG32(ADR_SYN_LCK_VT)) & 0x00000020 ) >> 5) ++#define GET_RG_SX_VT_MON_TMR (((REG32(ADR_SYN_LCK_VT)) & 0x00007fc0 ) >> 6) ++#define GET_RG_EN_DP_VT_MON (((REG32(ADR_DPLL_VCO_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_DP_VT_TH_HI (((REG32(ADR_DPLL_VCO_REGISTER)) & 0x00000006 ) >> 1) ++#define GET_RG_DP_VT_TH_LO (((REG32(ADR_DPLL_VCO_REGISTER)) & 0x00000018 ) >> 3) ++#define GET_RG_DP_CK320BY2 (((REG32(ADR_DPLL_VCO_REGISTER)) & 0x00004000 ) >> 14) ++#define GET_RG_DP_OD_TEST (((REG32(ADR_DPLL_VCO_REGISTER)) & 0x00200000 ) >> 21) ++#define GET_RG_DP_BBPLL_BP (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_DP_BBPLL_ICP (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00000006 ) >> 1) ++#define GET_RG_DP_BBPLL_IDUAL (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00000018 ) >> 3) ++#define GET_RG_DP_BBPLL_OD_TEST (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x000001e0 ) >> 5) ++#define GET_RG_DP_BBPLL_PD (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00000200 ) >> 9) ++#define GET_RG_DP_BBPLL_TESTSEL (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00001c00 ) >> 10) ++#define GET_RG_DP_BBPLL_PFD_DLY (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00006000 ) >> 13) ++#define GET_RG_DP_RP (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x00038000 ) >> 15) ++#define GET_RG_DP_RHP (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x000c0000 ) >> 18) ++#define GET_RG_DP_BBPLL_SDM_EDGE (((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x80000000 ) >> 31) ++#define GET_RG_DP_FODIV (((REG32(ADR_DPLL_DIVIDER_REGISTER)) & 0x0007f000 ) >> 12) ++#define GET_RG_DP_REFDIV (((REG32(ADR_DPLL_DIVIDER_REGISTER)) & 0x1fc00000 ) >> 22) ++#define GET_RG_IDACAI_PGAG15 (((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG15 (((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG14 (((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG14 (((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0x00fc0000 ) >> 18) ++#define GET_RG_DP_BBPLL_BS (((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0x3f000000 ) >> 24) ++#define GET_RG_IDACAI_PGAG13 (((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG13 (((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG12 (((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG12 (((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IDACAI_PGAG11 (((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG11 (((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG10 (((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG10 (((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IDACAI_PGAG9 (((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG9 (((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG8 (((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG8 (((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IDACAI_PGAG7 (((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG7 (((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG6 (((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG6 (((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IDACAI_PGAG5 (((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG5 (((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG4 (((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG4 (((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IDACAI_PGAG3 (((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG3 (((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG2 (((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG2 (((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0x00fc0000 ) >> 18) ++#define GET_RG_IDACAI_PGAG1 (((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0x0000003f ) >> 0) ++#define GET_RG_IDACAQ_PGAG1 (((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0x00000fc0 ) >> 6) ++#define GET_RG_IDACAI_PGAG0 (((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0x0003f000 ) >> 12) ++#define GET_RG_IDACAQ_PGAG0 (((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0x00fc0000 ) >> 18) ++#define GET_RG_EN_RCAL (((REG32(ADR_RCAL_REGISTER)) & 0x00000001 ) >> 0) ++#define GET_RG_RCAL_SPD (((REG32(ADR_RCAL_REGISTER)) & 0x00000002 ) >> 1) ++#define GET_RG_RCAL_TMR (((REG32(ADR_RCAL_REGISTER)) & 0x000001fc ) >> 2) ++#define GET_RG_RCAL_CODE_CWR (((REG32(ADR_RCAL_REGISTER)) & 0x00000200 ) >> 9) ++#define GET_RG_RCAL_CODE_CWD (((REG32(ADR_RCAL_REGISTER)) & 0x00007c00 ) >> 10) ++#define GET_RG_SX_SUB_SEL_CWR (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x00000001 ) >> 0) ++#define GET_RG_SX_SUB_SEL_CWD (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x000000fe ) >> 1) ++#define GET_RG_SX_LCK_BIN_OFFSET (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x00078000 ) >> 15) ++#define GET_RG_SX_LCK_BIN_PRECISION (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x00080000 ) >> 19) ++#define GET_RG_SX_LOCK_EN_N (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x00100000 ) >> 20) ++#define GET_RG_SX_LOCK_MANUAL (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x00200000 ) >> 21) ++#define GET_RG_SX_SUB_MANUAL (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x00400000 ) >> 22) ++#define GET_RG_SX_SUB_SEL (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x3f800000 ) >> 23) ++#define GET_RG_SX_MUX_SEL_VTH_BINL (((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0x40000000 ) >> 30) ++#define GET_RG_TRX_DUMMMY (((REG32(ADR_TRX_DUMMY_REGISTER)) & 0xffffffff ) >> 0) ++#define GET_RG_SX_DUMMMY (((REG32(ADR_SX_DUMMY_REGISTER)) & 0xffffffff ) >> 0) ++#define GET_RCAL_RDY (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00000001 ) >> 0) ++#define GET_LCK_BIN_RDY (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00000002 ) >> 1) ++#define GET_VT_MON_RDY (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00000004 ) >> 2) ++#define GET_DA_R_CODE_LUT (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x000007c0 ) >> 6) ++#define GET_AD_SX_VT_MON_Q (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00001800 ) >> 11) ++#define GET_AD_DP_VT_MON_Q (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00006000 ) >> 13) ++#define GET_RTC_CAL_RDY (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00008000 ) >> 15) ++#define GET_RG_SARADC_BIT (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x003f0000 ) >> 16) ++#define GET_SAR_ADC_FSM_RDY (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x00400000 ) >> 22) ++#define GET_AD_CIRCUIT_VERSION (((REG32(ADR_READ_ONLY_FLAGS_1)) & 0x07800000 ) >> 23) ++#define GET_DA_R_CAL_CODE (((REG32(ADR_READ_ONLY_FLAGS_2)) & 0x0000001f ) >> 0) ++#define GET_DA_SX_SUB_SEL (((REG32(ADR_READ_ONLY_FLAGS_2)) & 0x00000fe0 ) >> 5) ++#define GET_RG_DPL_RFCTRL_CH (((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0x000007ff ) >> 0) ++#define GET_RG_RSSIADC_RO_BIT (((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0x00007800 ) >> 11) ++#define GET_RG_RX_ADC_I_RO_BIT (((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0x007f8000 ) >> 15) ++#define GET_RG_RX_ADC_Q_RO_BIT (((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0x7f800000 ) >> 23) ++#define GET_RG_DPL_RFCTRL_F (((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_II)) & 0x00ffffff ) >> 0) ++#define GET_RG_SX_TARGET_CNT (((REG32(ADR_SX_LCK_BIN_REGISTERS_II)) & 0x00001fff ) >> 0) ++#define GET_RG_RTC_OFFSET (((REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) & 0x000000ff ) >> 0) ++#define GET_RG_RTC_CAL_TARGET_COUNT (((REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) & 0x000fff00 ) >> 8) ++#define GET_RG_RF_D_REG (((REG32(ADR_RF_D_DIGITAL_DEBUG_PORT_REGISTER)) & 0x0000ffff ) >> 0) ++#define GET_DIRECT_MODE (((REG32(ADR_MMU_CTRL)) & 0x00000001 ) >> 0) ++#define GET_TAG_INTERLEAVE_MD (((REG32(ADR_MMU_CTRL)) & 0x00000002 ) >> 1) ++#define GET_DIS_DEMAND (((REG32(ADR_MMU_CTRL)) & 0x00000004 ) >> 2) ++#define GET_SAME_ID_ALLOC_MD (((REG32(ADR_MMU_CTRL)) & 0x00000008 ) >> 3) ++#define GET_HS_ACCESS_MD (((REG32(ADR_MMU_CTRL)) & 0x00000010 ) >> 4) ++#define GET_SRAM_ACCESS_MD (((REG32(ADR_MMU_CTRL)) & 0x00000020 ) >> 5) ++#define GET_NOHIT_RPASS_MD (((REG32(ADR_MMU_CTRL)) & 0x00000040 ) >> 6) ++#define GET_DMN_FLAG_CLR (((REG32(ADR_MMU_CTRL)) & 0x00000080 ) >> 7) ++#define GET_ERR_SW_RST_N (((REG32(ADR_MMU_CTRL)) & 0x00000100 ) >> 8) ++#define GET_ALR_SW_RST_N (((REG32(ADR_MMU_CTRL)) & 0x00000200 ) >> 9) ++#define GET_MCH_SW_RST_N (((REG32(ADR_MMU_CTRL)) & 0x00000400 ) >> 10) ++#define GET_TAG_SW_RST_N (((REG32(ADR_MMU_CTRL)) & 0x00000800 ) >> 11) ++#define GET_ABT_SW_RST_N (((REG32(ADR_MMU_CTRL)) & 0x00001000 ) >> 12) ++#define GET_MMU_VER (((REG32(ADR_MMU_CTRL)) & 0x0000e000 ) >> 13) ++#define GET_MMU_SHARE_MCU (((REG32(ADR_MMU_CTRL)) & 0x00ff0000 ) >> 16) ++#define GET_HS_WR (((REG32(ADR_HS_CTRL)) & 0x00000001 ) >> 0) ++#define GET_HS_FLAG (((REG32(ADR_HS_CTRL)) & 0x00000010 ) >> 4) ++#define GET_HS_ID (((REG32(ADR_HS_CTRL)) & 0x00007f00 ) >> 8) ++#define GET_HS_CHANNEL (((REG32(ADR_HS_CTRL)) & 0x000f0000 ) >> 16) ++#define GET_HS_PAGE (((REG32(ADR_HS_CTRL)) & 0x00f00000 ) >> 20) ++#define GET_HS_DATA (((REG32(ADR_HS_CTRL)) & 0xff000000 ) >> 24) ++#define GET_CPU_POR0 (((REG32(ADR_CPU_POR0_7)) & 0x0000000f ) >> 0) ++#define GET_CPU_POR1 (((REG32(ADR_CPU_POR0_7)) & 0x000000f0 ) >> 4) ++#define GET_CPU_POR2 (((REG32(ADR_CPU_POR0_7)) & 0x00000f00 ) >> 8) ++#define GET_CPU_POR3 (((REG32(ADR_CPU_POR0_7)) & 0x0000f000 ) >> 12) ++#define GET_CPU_POR4 (((REG32(ADR_CPU_POR0_7)) & 0x000f0000 ) >> 16) ++#define GET_CPU_POR5 (((REG32(ADR_CPU_POR0_7)) & 0x00f00000 ) >> 20) ++#define GET_CPU_POR6 (((REG32(ADR_CPU_POR0_7)) & 0x0f000000 ) >> 24) ++#define GET_CPU_POR7 (((REG32(ADR_CPU_POR0_7)) & 0xf0000000 ) >> 28) ++#define GET_CPU_POR8 (((REG32(ADR_CPU_POR8_F)) & 0x0000000f ) >> 0) ++#define GET_CPU_POR9 (((REG32(ADR_CPU_POR8_F)) & 0x000000f0 ) >> 4) ++#define GET_CPU_PORA (((REG32(ADR_CPU_POR8_F)) & 0x00000f00 ) >> 8) ++#define GET_CPU_PORB (((REG32(ADR_CPU_POR8_F)) & 0x0000f000 ) >> 12) ++#define GET_CPU_PORC (((REG32(ADR_CPU_POR8_F)) & 0x000f0000 ) >> 16) ++#define GET_CPU_PORD (((REG32(ADR_CPU_POR8_F)) & 0x00f00000 ) >> 20) ++#define GET_CPU_PORE (((REG32(ADR_CPU_POR8_F)) & 0x0f000000 ) >> 24) ++#define GET_CPU_PORF (((REG32(ADR_CPU_POR8_F)) & 0xf0000000 ) >> 28) ++#define GET_ACC_WR_LEN (((REG32(ADR_REG_LEN_CTRL)) & 0x0000003f ) >> 0) ++#define GET_ACC_RD_LEN (((REG32(ADR_REG_LEN_CTRL)) & 0x00003f00 ) >> 8) ++#define GET_REQ_NACK_CLR (((REG32(ADR_REG_LEN_CTRL)) & 0x00008000 ) >> 15) ++#define GET_NACK_FLAG_BUS (((REG32(ADR_REG_LEN_CTRL)) & 0xffff0000 ) >> 16) ++#define GET_DMN_R_PASS (((REG32(ADR_DMN_READ_BYPASS)) & 0x0000ffff ) >> 0) ++#define GET_PARA_ALC_RLS (((REG32(ADR_DMN_READ_BYPASS)) & 0x00010000 ) >> 16) ++#define GET_REQ_PORNS_CHGEN (((REG32(ADR_DMN_READ_BYPASS)) & 0x01000000 ) >> 24) ++#define GET_ALC_ABT_ID (((REG32(ADR_ALC_RLS_ABORT)) & 0x0000007f ) >> 0) ++#define GET_ALC_ABT_INT (((REG32(ADR_ALC_RLS_ABORT)) & 0x00008000 ) >> 15) ++#define GET_RLS_ABT_ID (((REG32(ADR_ALC_RLS_ABORT)) & 0x007f0000 ) >> 16) ++#define GET_RLS_ABT_INT (((REG32(ADR_ALC_RLS_ABORT)) & 0x80000000 ) >> 31) ++#define GET_DEBUG_CTL (((REG32(ADR_DEBUG_CTL)) & 0x000000ff ) >> 0) ++#define GET_DEBUG_H16 (((REG32(ADR_DEBUG_CTL)) & 0x00000100 ) >> 8) ++#define GET_DEBUG_OUT (((REG32(ADR_DEBUG_OUT)) & 0xffffffff ) >> 0) ++#define GET_ALC_ERR (((REG32(ADR_MMU_STATUS)) & 0x00000001 ) >> 0) ++#define GET_RLS_ERR (((REG32(ADR_MMU_STATUS)) & 0x00000002 ) >> 1) ++#define GET_AL_STATE (((REG32(ADR_MMU_STATUS)) & 0x00000700 ) >> 8) ++#define GET_RL_STATE (((REG32(ADR_MMU_STATUS)) & 0x00007000 ) >> 12) ++#define GET_ALC_ERR_ID (((REG32(ADR_MMU_STATUS)) & 0x007f0000 ) >> 16) ++#define GET_RLS_ERR_ID (((REG32(ADR_MMU_STATUS)) & 0x7f000000 ) >> 24) ++#define GET_DMN_NOHIT_FLAG (((REG32(ADR_DMN_STATUS)) & 0x00000001 ) >> 0) ++#define GET_DMN_FLAG (((REG32(ADR_DMN_STATUS)) & 0x00000002 ) >> 1) ++#define GET_DMN_WR (((REG32(ADR_DMN_STATUS)) & 0x00000008 ) >> 3) ++#define GET_DMN_PORT (((REG32(ADR_DMN_STATUS)) & 0x000000f0 ) >> 4) ++#define GET_DMN_NHIT_ID (((REG32(ADR_DMN_STATUS)) & 0x00007f00 ) >> 8) ++#define GET_DMN_NHIT_ADDR (((REG32(ADR_DMN_STATUS)) & 0xffff0000 ) >> 16) ++#define GET_TX_MOUNT (((REG32(ADR_TAG_STATUS)) & 0x000000ff ) >> 0) ++#define GET_RX_MOUNT (((REG32(ADR_TAG_STATUS)) & 0x0000ff00 ) >> 8) ++#define GET_AVA_TAG (((REG32(ADR_TAG_STATUS)) & 0x01ff0000 ) >> 16) ++#define GET_PKTBUF_FULL (((REG32(ADR_TAG_STATUS)) & 0x80000000 ) >> 31) ++#define GET_DMN_NOHIT_MCU (((REG32(ADR_DMN_MCU_STATUS)) & 0x00000001 ) >> 0) ++#define GET_DMN_MCU_FLAG (((REG32(ADR_DMN_MCU_STATUS)) & 0x00000002 ) >> 1) ++#define GET_DMN_MCU_WR (((REG32(ADR_DMN_MCU_STATUS)) & 0x00000008 ) >> 3) ++#define GET_DMN_MCU_PORT (((REG32(ADR_DMN_MCU_STATUS)) & 0x000000f0 ) >> 4) ++#define GET_DMN_MCU_ID (((REG32(ADR_DMN_MCU_STATUS)) & 0x00007f00 ) >> 8) ++#define GET_DMN_MCU_ADDR (((REG32(ADR_DMN_MCU_STATUS)) & 0xffff0000 ) >> 16) ++#define GET_MB_IDTBL_31_0 (((REG32(ADR_MB_IDTBL_0_STATUS)) & 0xffffffff ) >> 0) ++#define GET_MB_IDTBL_63_32 (((REG32(ADR_MB_IDTBL_1_STATUS)) & 0xffffffff ) >> 0) ++#define GET_MB_IDTBL_95_64 (((REG32(ADR_MB_IDTBL_2_STATUS)) & 0xffffffff ) >> 0) ++#define GET_MB_IDTBL_127_96 (((REG32(ADR_MB_IDTBL_3_STATUS)) & 0xffffffff ) >> 0) ++#define GET_PKT_IDTBL_31_0 (((REG32(ADR_PKT_IDTBL_0_STATUS)) & 0xffffffff ) >> 0) ++#define GET_PKT_IDTBL_63_32 (((REG32(ADR_PKT_IDTBL_1_STATUS)) & 0xffffffff ) >> 0) ++#define GET_PKT_IDTBL_95_64 (((REG32(ADR_PKT_IDTBL_2_STATUS)) & 0xffffffff ) >> 0) ++#define GET_PKT_IDTBL_127_96 (((REG32(ADR_PKT_IDTBL_3_STATUS)) & 0xffffffff ) >> 0) ++#define GET_DMN_IDTBL_31_0 (((REG32(ADR_DMN_IDTBL_0_STATUS)) & 0xffffffff ) >> 0) ++#define GET_DMN_IDTBL_63_32 (((REG32(ADR_DMN_IDTBL_1_STATUS)) & 0xffffffff ) >> 0) ++#define GET_DMN_IDTBL_95_64 (((REG32(ADR_DMN_IDTBL_2_STATUS)) & 0xffffffff ) >> 0) ++#define GET_DMN_IDTBL_127_96 (((REG32(ADR_DMN_IDTBL_3_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_MB_ID_31_0 (((REG32(ADR_MB_NEQID_0_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_MB_ID_63_32 (((REG32(ADR_MB_NEQID_1_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_MB_ID_95_64 (((REG32(ADR_MB_NEQID_2_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_MB_ID_127_96 (((REG32(ADR_MB_NEQID_3_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_PKT_ID_31_0 (((REG32(ADR_PKT_NEQID_0_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_PKT_ID_63_32 (((REG32(ADR_PKT_NEQID_1_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_PKT_ID_95_64 (((REG32(ADR_PKT_NEQID_2_STATUS)) & 0xffffffff ) >> 0) ++#define GET_NEQ_PKT_ID_127_96 (((REG32(ADR_PKT_NEQID_3_STATUS)) & 0xffffffff ) >> 0) ++#define GET_ALC_NOCHG_ID (((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0x0000007f ) >> 0) ++#define GET_ALC_NOCHG_INT (((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0x00008000 ) >> 15) ++#define GET_NEQ_PKT_FLAG (((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0x00010000 ) >> 16) ++#define GET_NEQ_MB_FLAG (((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0x01000000 ) >> 24) ++#define GET_SRAM_TAG_0 (((REG32(ADR_TAG_SRAM0_F_STATUS_0)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_1 (((REG32(ADR_TAG_SRAM0_F_STATUS_0)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_2 (((REG32(ADR_TAG_SRAM0_F_STATUS_1)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_3 (((REG32(ADR_TAG_SRAM0_F_STATUS_1)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_4 (((REG32(ADR_TAG_SRAM0_F_STATUS_2)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_5 (((REG32(ADR_TAG_SRAM0_F_STATUS_2)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_6 (((REG32(ADR_TAG_SRAM0_F_STATUS_3)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_7 (((REG32(ADR_TAG_SRAM0_F_STATUS_3)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_8 (((REG32(ADR_TAG_SRAM0_F_STATUS_4)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_9 (((REG32(ADR_TAG_SRAM0_F_STATUS_4)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_10 (((REG32(ADR_TAG_SRAM0_F_STATUS_5)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_11 (((REG32(ADR_TAG_SRAM0_F_STATUS_5)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_12 (((REG32(ADR_TAG_SRAM0_F_STATUS_6)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_13 (((REG32(ADR_TAG_SRAM0_F_STATUS_6)) & 0xffff0000 ) >> 16) ++#define GET_SRAM_TAG_14 (((REG32(ADR_TAG_SRAM0_F_STATUS_7)) & 0x0000ffff ) >> 0) ++#define GET_SRAM_TAG_15 (((REG32(ADR_TAG_SRAM0_F_STATUS_7)) & 0xffff0000 ) >> 16) ++#define SET_MCU_ENABLE(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 0) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffffe)) ++#define SET_MAC_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 1) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffffd)) ++#define SET_MCU_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 2) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffffb)) ++#define SET_SDIO_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 3) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffff7)) ++#define SET_SPI_SLV_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 4) | ((REG32(ADR_BRG_SW_RST)) & 0xffffffef)) ++#define SET_UART_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 5) | ((REG32(ADR_BRG_SW_RST)) & 0xffffffdf)) ++#define SET_DMA_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 6) | ((REG32(ADR_BRG_SW_RST)) & 0xffffffbf)) ++#define SET_WDT_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 7) | ((REG32(ADR_BRG_SW_RST)) & 0xffffff7f)) ++#define SET_I2C_SLV_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 8) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffeff)) ++#define SET_INT_CTL_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 9) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffdff)) ++#define SET_BTCX_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 10) | ((REG32(ADR_BRG_SW_RST)) & 0xfffffbff)) ++#define SET_GPIO_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 11) | ((REG32(ADR_BRG_SW_RST)) & 0xfffff7ff)) ++#define SET_US0TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 12) | ((REG32(ADR_BRG_SW_RST)) & 0xffffefff)) ++#define SET_US1TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 13) | ((REG32(ADR_BRG_SW_RST)) & 0xffffdfff)) ++#define SET_US2TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 14) | ((REG32(ADR_BRG_SW_RST)) & 0xffffbfff)) ++#define SET_US3TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 15) | ((REG32(ADR_BRG_SW_RST)) & 0xffff7fff)) ++#define SET_MS0TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 16) | ((REG32(ADR_BRG_SW_RST)) & 0xfffeffff)) ++#define SET_MS1TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 17) | ((REG32(ADR_BRG_SW_RST)) & 0xfffdffff)) ++#define SET_MS2TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 18) | ((REG32(ADR_BRG_SW_RST)) & 0xfffbffff)) ++#define SET_MS3TMR_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 19) | ((REG32(ADR_BRG_SW_RST)) & 0xfff7ffff)) ++#define SET_RF_BB_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 20) | ((REG32(ADR_BRG_SW_RST)) & 0xffefffff)) ++#define SET_SYS_ALL_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 21) | ((REG32(ADR_BRG_SW_RST)) & 0xffdfffff)) ++#define SET_DAT_UART_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 22) | ((REG32(ADR_BRG_SW_RST)) & 0xffbfffff)) ++#define SET_I2C_MST_SW_RST(_VAL_) (REG32(ADR_BRG_SW_RST)) = (((_VAL_) << 23) | ((REG32(ADR_BRG_SW_RST)) & 0xff7fffff)) ++#define SET_RG_REBOOT(_VAL_) (REG32(ADR_BOOT)) = (((_VAL_) << 0) | ((REG32(ADR_BOOT)) & 0xfffffffe)) ++#define SET_TRAP_IMG_FLS(_VAL_) (REG32(ADR_BOOT)) = (((_VAL_) << 16) | ((REG32(ADR_BOOT)) & 0xfffeffff)) ++#define SET_TRAP_REBOOT(_VAL_) (REG32(ADR_BOOT)) = (((_VAL_) << 17) | ((REG32(ADR_BOOT)) & 0xfffdffff)) ++#define SET_TRAP_BOOT_FLS(_VAL_) (REG32(ADR_BOOT)) = (((_VAL_) << 18) | ((REG32(ADR_BOOT)) & 0xfffbffff)) ++#define SET_CHIP_ID_31_0(_VAL_) (REG32(ADR_CHIP_ID_0)) = (((_VAL_) << 0) | ((REG32(ADR_CHIP_ID_0)) & 0x00000000)) ++#define SET_CHIP_ID_63_32(_VAL_) (REG32(ADR_CHIP_ID_1)) = (((_VAL_) << 0) | ((REG32(ADR_CHIP_ID_1)) & 0x00000000)) ++#define SET_CHIP_ID_95_64(_VAL_) (REG32(ADR_CHIP_ID_2)) = (((_VAL_) << 0) | ((REG32(ADR_CHIP_ID_2)) & 0x00000000)) ++#define SET_CHIP_ID_127_96(_VAL_) (REG32(ADR_CHIP_ID_3)) = (((_VAL_) << 0) | ((REG32(ADR_CHIP_ID_3)) & 0x00000000)) ++#define SET_CK_SEL_1_0(_VAL_) (REG32(ADR_CLOCK_SELECTION)) = (((_VAL_) << 0) | ((REG32(ADR_CLOCK_SELECTION)) & 0xfffffffc)) ++#define SET_CK_SEL_2(_VAL_) (REG32(ADR_CLOCK_SELECTION)) = (((_VAL_) << 2) | ((REG32(ADR_CLOCK_SELECTION)) & 0xfffffffb)) ++#define SET_SYS_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 0) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffffe)) ++#define SET_MAC_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 1) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffffd)) ++#define SET_MCU_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 2) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffffb)) ++#define SET_SDIO_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 3) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffff7)) ++#define SET_SPI_SLV_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 4) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffffef)) ++#define SET_UART_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 5) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffffdf)) ++#define SET_DMA_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 6) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffffbf)) ++#define SET_WDT_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 7) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffff7f)) ++#define SET_I2C_SLV_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 8) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffeff)) ++#define SET_INT_CTL_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 9) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffdff)) ++#define SET_BTCX_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 10) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffffbff)) ++#define SET_GPIO_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 11) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffff7ff)) ++#define SET_US0TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 12) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffefff)) ++#define SET_US1TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 13) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffdfff)) ++#define SET_US2TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 14) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffffbfff)) ++#define SET_US3TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 15) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffff7fff)) ++#define SET_MS0TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 16) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffeffff)) ++#define SET_MS1TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 17) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffdffff)) ++#define SET_MS2TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 18) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfffbffff)) ++#define SET_MS3TMR_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 19) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xfff7ffff)) ++#define SET_BIST_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 20) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xffefffff)) ++#define SET_I2C_MST_CLK_EN(_VAL_) (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (((_VAL_) << 23) | ((REG32(ADR_PLATFORM_CLOCK_ENABLE)) & 0xff7fffff)) ++#define SET_BTCX_CSR_CLK_EN(_VAL_) (REG32(ADR_SYS_CSR_CLOCK_ENABLE)) = (((_VAL_) << 10) | ((REG32(ADR_SYS_CSR_CLOCK_ENABLE)) & 0xfffffbff)) ++#define SET_MCU_DBG_SEL(_VAL_) (REG32(ADR_MCU_DBG_SEL)) = (((_VAL_) << 0) | ((REG32(ADR_MCU_DBG_SEL)) & 0xffffffc0)) ++#define SET_MCU_STOP_NOGRANT(_VAL_) (REG32(ADR_MCU_DBG_SEL)) = (((_VAL_) << 8) | ((REG32(ADR_MCU_DBG_SEL)) & 0xfffffeff)) ++#define SET_MCU_STOP_ANYTIME(_VAL_) (REG32(ADR_MCU_DBG_SEL)) = (((_VAL_) << 9) | ((REG32(ADR_MCU_DBG_SEL)) & 0xfffffdff)) ++#define SET_MCU_DBG_DATA(_VAL_) (REG32(ADR_MCU_DBG_DATA)) = (((_VAL_) << 0) | ((REG32(ADR_MCU_DBG_DATA)) & 0x00000000)) ++#define SET_AHB_SW_RST(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xfffffffe)) ++#define SET_AHB_ERR_RST(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xfffffffd)) ++#define SET_REG_AHB_DEBUG_MX(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 4) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xffffffcf)) ++#define SET_REG_PKT_W_NBRT(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xfffffeff)) ++#define SET_REG_PKT_R_NBRT(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 9) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xfffffdff)) ++#define SET_IQ_SRAM_SEL_0(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 12) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xffffefff)) ++#define SET_IQ_SRAM_SEL_1(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 13) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xffffdfff)) ++#define SET_IQ_SRAM_SEL_2(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 14) | ((REG32(ADR_AHB_BRG_STATUS)) & 0xffffbfff)) ++#define SET_AHB_STATUS(_VAL_) (REG32(ADR_AHB_BRG_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_AHB_BRG_STATUS)) & 0x0000ffff)) ++#define SET_PARALLEL_DR(_VAL_) (REG32(ADR_BIST_BIST_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_BIST_CTRL)) & 0xfffffffe)) ++#define SET_MBRUN(_VAL_) (REG32(ADR_BIST_BIST_CTRL)) = (((_VAL_) << 4) | ((REG32(ADR_BIST_BIST_CTRL)) & 0xffffffef)) ++#define SET_SHIFT_DR(_VAL_) (REG32(ADR_BIST_BIST_CTRL)) = (((_VAL_) << 8) | ((REG32(ADR_BIST_BIST_CTRL)) & 0xfffffeff)) ++#define SET_MODE_REG_SI(_VAL_) (REG32(ADR_BIST_BIST_CTRL)) = (((_VAL_) << 9) | ((REG32(ADR_BIST_BIST_CTRL)) & 0xfffffdff)) ++#define SET_SIMULATION_MODE(_VAL_) (REG32(ADR_BIST_BIST_CTRL)) = (((_VAL_) << 10) | ((REG32(ADR_BIST_BIST_CTRL)) & 0xfffffbff)) ++#define SET_DBIST_MODE(_VAL_) (REG32(ADR_BIST_BIST_CTRL)) = (((_VAL_) << 11) | ((REG32(ADR_BIST_BIST_CTRL)) & 0xfffff7ff)) ++#define SET_MODE_REG_IN(_VAL_) (REG32(ADR_BIST_MODE_REG_IN)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MODE_REG_IN)) & 0xffe00000)) ++#define SET_MODE_REG_OUT_MCU(_VAL_) (REG32(ADR_BIST_MODE_REG_OUT)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MODE_REG_OUT)) & 0xffe00000)) ++#define SET_MODE_REG_SO_MCU(_VAL_) (REG32(ADR_BIST_MODE_REG_OUT)) = (((_VAL_) << 31) | ((REG32(ADR_BIST_MODE_REG_OUT)) & 0x7fffffff)) ++#define SET_MONITOR_BUS_MCU_31_0(_VAL_) (REG32(ADR_BIST_MONITOR_BUS_LSB)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MONITOR_BUS_LSB)) & 0x00000000)) ++#define SET_MONITOR_BUS_MCU_33_32(_VAL_) (REG32(ADR_BIST_MONITOR_BUS_MSB)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MONITOR_BUS_MSB)) & 0xfffffffc)) ++#define SET_TB_ADR_SEL(_VAL_) (REG32(ADR_TB_ADR_SEL)) = (((_VAL_) << 0) | ((REG32(ADR_TB_ADR_SEL)) & 0xffff0000)) ++#define SET_TB_CS(_VAL_) (REG32(ADR_TB_ADR_SEL)) = (((_VAL_) << 31) | ((REG32(ADR_TB_ADR_SEL)) & 0x7fffffff)) ++#define SET_TB_RDATA(_VAL_) (REG32(ADR_TB_RDATA)) = (((_VAL_) << 0) | ((REG32(ADR_TB_RDATA)) & 0x00000000)) ++#define SET_UART_W2B_EN(_VAL_) (REG32(ADR_UART_W2B)) = (((_VAL_) << 0) | ((REG32(ADR_UART_W2B)) & 0xfffffffe)) ++#define SET_DATA_UART_W2B_EN(_VAL_) (REG32(ADR_UART_W2B)) = (((_VAL_) << 4) | ((REG32(ADR_UART_W2B)) & 0xffffffef)) ++#define SET_AHB_ILL_ADDR(_VAL_) (REG32(ADR_AHB_ILL_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_AHB_ILL_ADDR)) & 0x00000000)) ++#define SET_AHB_FEN_ADDR(_VAL_) (REG32(ADR_AHB_FEN_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_AHB_FEN_ADDR)) & 0x00000000)) ++#define SET_ILL_ADDR_CLR(_VAL_) (REG32(ADR_AHB_ILLFEN_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_AHB_ILLFEN_STATUS)) & 0xfffffffe)) ++#define SET_FENCE_HIT_CLR(_VAL_) (REG32(ADR_AHB_ILLFEN_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_AHB_ILLFEN_STATUS)) & 0xfffffffd)) ++#define SET_ILL_ADDR_INT(_VAL_) (REG32(ADR_AHB_ILLFEN_STATUS)) = (((_VAL_) << 4) | ((REG32(ADR_AHB_ILLFEN_STATUS)) & 0xffffffef)) ++#define SET_FENCE_HIT_INT(_VAL_) (REG32(ADR_AHB_ILLFEN_STATUS)) = (((_VAL_) << 5) | ((REG32(ADR_AHB_ILLFEN_STATUS)) & 0xffffffdf)) ++#define SET_PWM_INI_VALUE_P_A(_VAL_) (REG32(ADR_PWM_A)) = (((_VAL_) << 0) | ((REG32(ADR_PWM_A)) & 0xffffff00)) ++#define SET_PWM_INI_VALUE_N_A(_VAL_) (REG32(ADR_PWM_A)) = (((_VAL_) << 8) | ((REG32(ADR_PWM_A)) & 0xffff00ff)) ++#define SET_PWM_POST_SCALER_A(_VAL_) (REG32(ADR_PWM_A)) = (((_VAL_) << 16) | ((REG32(ADR_PWM_A)) & 0xfff0ffff)) ++#define SET_PWM_ALWAYSON_A(_VAL_) (REG32(ADR_PWM_A)) = (((_VAL_) << 29) | ((REG32(ADR_PWM_A)) & 0xdfffffff)) ++#define SET_PWM_INVERT_A(_VAL_) (REG32(ADR_PWM_A)) = (((_VAL_) << 30) | ((REG32(ADR_PWM_A)) & 0xbfffffff)) ++#define SET_PWM_ENABLE_A(_VAL_) (REG32(ADR_PWM_A)) = (((_VAL_) << 31) | ((REG32(ADR_PWM_A)) & 0x7fffffff)) ++#define SET_PWM_INI_VALUE_P_B(_VAL_) (REG32(ADR_PWM_B)) = (((_VAL_) << 0) | ((REG32(ADR_PWM_B)) & 0xffffff00)) ++#define SET_PWM_INI_VALUE_N_B(_VAL_) (REG32(ADR_PWM_B)) = (((_VAL_) << 8) | ((REG32(ADR_PWM_B)) & 0xffff00ff)) ++#define SET_PWM_POST_SCALER_B(_VAL_) (REG32(ADR_PWM_B)) = (((_VAL_) << 16) | ((REG32(ADR_PWM_B)) & 0xfff0ffff)) ++#define SET_PWM_ALWAYSON_B(_VAL_) (REG32(ADR_PWM_B)) = (((_VAL_) << 29) | ((REG32(ADR_PWM_B)) & 0xdfffffff)) ++#define SET_PWM_INVERT_B(_VAL_) (REG32(ADR_PWM_B)) = (((_VAL_) << 30) | ((REG32(ADR_PWM_B)) & 0xbfffffff)) ++#define SET_PWM_ENABLE_B(_VAL_) (REG32(ADR_PWM_B)) = (((_VAL_) << 31) | ((REG32(ADR_PWM_B)) & 0x7fffffff)) ++#define SET_HBUSREQ_LOCK(_VAL_) (REG32(ADR_HBUSREQ_LOCK)) = (((_VAL_) << 0) | ((REG32(ADR_HBUSREQ_LOCK)) & 0xffffe000)) ++#define SET_HBURST_LOCK(_VAL_) (REG32(ADR_HBURST_LOCK)) = (((_VAL_) << 0) | ((REG32(ADR_HBURST_LOCK)) & 0xffffe000)) ++#define SET_PRESCALER_USTIMER(_VAL_) (REG32(ADR_PRESCALER_USTIMER)) = (((_VAL_) << 0) | ((REG32(ADR_PRESCALER_USTIMER)) & 0xfffffe00)) ++#define SET_MODE_REG_IN_MMU(_VAL_) (REG32(ADR_BIST_MODE_REG_IN_MMU)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MODE_REG_IN_MMU)) & 0xffff0000)) ++#define SET_MODE_REG_OUT_MMU(_VAL_) (REG32(ADR_BIST_MODE_REG_OUT_MMU)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MODE_REG_OUT_MMU)) & 0xffff0000)) ++#define SET_MODE_REG_SO_MMU(_VAL_) (REG32(ADR_BIST_MODE_REG_OUT_MMU)) = (((_VAL_) << 31) | ((REG32(ADR_BIST_MODE_REG_OUT_MMU)) & 0x7fffffff)) ++#define SET_MONITOR_BUS_MMU(_VAL_) (REG32(ADR_BIST_MONITOR_BUS_MMU)) = (((_VAL_) << 0) | ((REG32(ADR_BIST_MONITOR_BUS_MMU)) & 0xfff80000)) ++#define SET_TEST_MODE0(_VAL_) (REG32(ADR_TEST_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_TEST_MODE)) & 0xfffffffe)) ++#define SET_TEST_MODE1(_VAL_) (REG32(ADR_TEST_MODE)) = (((_VAL_) << 1) | ((REG32(ADR_TEST_MODE)) & 0xfffffffd)) ++#define SET_TEST_MODE2(_VAL_) (REG32(ADR_TEST_MODE)) = (((_VAL_) << 2) | ((REG32(ADR_TEST_MODE)) & 0xfffffffb)) ++#define SET_TEST_MODE3(_VAL_) (REG32(ADR_TEST_MODE)) = (((_VAL_) << 3) | ((REG32(ADR_TEST_MODE)) & 0xfffffff7)) ++#define SET_TEST_MODE4(_VAL_) (REG32(ADR_TEST_MODE)) = (((_VAL_) << 4) | ((REG32(ADR_TEST_MODE)) & 0xffffffef)) ++#define SET_TEST_MODE_ALL(_VAL_) (REG32(ADR_TEST_MODE)) = (((_VAL_) << 5) | ((REG32(ADR_TEST_MODE)) & 0xffffffdf)) ++#define SET_WDT_INIT(_VAL_) (REG32(ADR_BOOT_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_BOOT_INFO)) & 0xfffffffe)) ++#define SET_SD_HOST_INIT(_VAL_) (REG32(ADR_BOOT_INFO)) = (((_VAL_) << 1) | ((REG32(ADR_BOOT_INFO)) & 0xfffffffd)) ++#define SET_ALLOW_SD_RESET(_VAL_) (REG32(ADR_SD_INIT_CFG)) = (((_VAL_) << 0) | ((REG32(ADR_SD_INIT_CFG)) & 0xfffffffe)) ++#define SET_UART_NRTS(_VAL_) (REG32(ADR_SPARE_UART_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_SPARE_UART_INFO)) & 0xfffffffe)) ++#define SET_UART_NCTS(_VAL_) (REG32(ADR_SPARE_UART_INFO)) = (((_VAL_) << 1) | ((REG32(ADR_SPARE_UART_INFO)) & 0xfffffffd)) ++#define SET_TU0_TM_INIT_VALUE(_VAL_) (REG32(ADR_TU0_MICROSECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0xffff0000)) ++#define SET_TU0_TM_MODE(_VAL_) (REG32(ADR_TU0_MICROSECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0xfffeffff)) ++#define SET_TU0_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TU0_MICROSECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0xfffdffff)) ++#define SET_TU0_TM_INT_MASK(_VAL_) (REG32(ADR_TU0_MICROSECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TU0_MICROSECOND_TIMER)) & 0xfffbffff)) ++#define SET_TU0_TM_CUR_VALUE(_VAL_) (REG32(ADR_TU0_CURRENT_MICROSECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TU0_CURRENT_MICROSECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TU1_TM_INIT_VALUE(_VAL_) (REG32(ADR_TU1_MICROSECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0xffff0000)) ++#define SET_TU1_TM_MODE(_VAL_) (REG32(ADR_TU1_MICROSECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0xfffeffff)) ++#define SET_TU1_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TU1_MICROSECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0xfffdffff)) ++#define SET_TU1_TM_INT_MASK(_VAL_) (REG32(ADR_TU1_MICROSECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TU1_MICROSECOND_TIMER)) & 0xfffbffff)) ++#define SET_TU1_TM_CUR_VALUE(_VAL_) (REG32(ADR_TU1_CURRENT_MICROSECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TU1_CURRENT_MICROSECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TU2_TM_INIT_VALUE(_VAL_) (REG32(ADR_TU2_MICROSECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0xffff0000)) ++#define SET_TU2_TM_MODE(_VAL_) (REG32(ADR_TU2_MICROSECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0xfffeffff)) ++#define SET_TU2_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TU2_MICROSECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0xfffdffff)) ++#define SET_TU2_TM_INT_MASK(_VAL_) (REG32(ADR_TU2_MICROSECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TU2_MICROSECOND_TIMER)) & 0xfffbffff)) ++#define SET_TU2_TM_CUR_VALUE(_VAL_) (REG32(ADR_TU2_CURRENT_MICROSECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TU2_CURRENT_MICROSECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TU3_TM_INIT_VALUE(_VAL_) (REG32(ADR_TU3_MICROSECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0xffff0000)) ++#define SET_TU3_TM_MODE(_VAL_) (REG32(ADR_TU3_MICROSECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0xfffeffff)) ++#define SET_TU3_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TU3_MICROSECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0xfffdffff)) ++#define SET_TU3_TM_INT_MASK(_VAL_) (REG32(ADR_TU3_MICROSECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TU3_MICROSECOND_TIMER)) & 0xfffbffff)) ++#define SET_TU3_TM_CUR_VALUE(_VAL_) (REG32(ADR_TU3_CURRENT_MICROSECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TU3_CURRENT_MICROSECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TM0_TM_INIT_VALUE(_VAL_) (REG32(ADR_TM0_MILISECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TM0_MILISECOND_TIMER)) & 0xffff0000)) ++#define SET_TM0_TM_MODE(_VAL_) (REG32(ADR_TM0_MILISECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TM0_MILISECOND_TIMER)) & 0xfffeffff)) ++#define SET_TM0_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TM0_MILISECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TM0_MILISECOND_TIMER)) & 0xfffdffff)) ++#define SET_TM0_TM_INT_MASK(_VAL_) (REG32(ADR_TM0_MILISECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TM0_MILISECOND_TIMER)) & 0xfffbffff)) ++#define SET_TM0_TM_CUR_VALUE(_VAL_) (REG32(ADR_TM0_CURRENT_MILISECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TM0_CURRENT_MILISECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TM1_TM_INIT_VALUE(_VAL_) (REG32(ADR_TM1_MILISECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TM1_MILISECOND_TIMER)) & 0xffff0000)) ++#define SET_TM1_TM_MODE(_VAL_) (REG32(ADR_TM1_MILISECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TM1_MILISECOND_TIMER)) & 0xfffeffff)) ++#define SET_TM1_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TM1_MILISECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TM1_MILISECOND_TIMER)) & 0xfffdffff)) ++#define SET_TM1_TM_INT_MASK(_VAL_) (REG32(ADR_TM1_MILISECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TM1_MILISECOND_TIMER)) & 0xfffbffff)) ++#define SET_TM1_TM_CUR_VALUE(_VAL_) (REG32(ADR_TM1_CURRENT_MILISECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TM1_CURRENT_MILISECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TM2_TM_INIT_VALUE(_VAL_) (REG32(ADR_TM2_MILISECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TM2_MILISECOND_TIMER)) & 0xffff0000)) ++#define SET_TM2_TM_MODE(_VAL_) (REG32(ADR_TM2_MILISECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TM2_MILISECOND_TIMER)) & 0xfffeffff)) ++#define SET_TM2_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TM2_MILISECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TM2_MILISECOND_TIMER)) & 0xfffdffff)) ++#define SET_TM2_TM_INT_MASK(_VAL_) (REG32(ADR_TM2_MILISECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TM2_MILISECOND_TIMER)) & 0xfffbffff)) ++#define SET_TM2_TM_CUR_VALUE(_VAL_) (REG32(ADR_TM2_CURRENT_MILISECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TM2_CURRENT_MILISECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_TM3_TM_INIT_VALUE(_VAL_) (REG32(ADR_TM3_MILISECOND_TIMER)) = (((_VAL_) << 0) | ((REG32(ADR_TM3_MILISECOND_TIMER)) & 0xffff0000)) ++#define SET_TM3_TM_MODE(_VAL_) (REG32(ADR_TM3_MILISECOND_TIMER)) = (((_VAL_) << 16) | ((REG32(ADR_TM3_MILISECOND_TIMER)) & 0xfffeffff)) ++#define SET_TM3_TM_INT_STS_DONE(_VAL_) (REG32(ADR_TM3_MILISECOND_TIMER)) = (((_VAL_) << 17) | ((REG32(ADR_TM3_MILISECOND_TIMER)) & 0xfffdffff)) ++#define SET_TM3_TM_INT_MASK(_VAL_) (REG32(ADR_TM3_MILISECOND_TIMER)) = (((_VAL_) << 18) | ((REG32(ADR_TM3_MILISECOND_TIMER)) & 0xfffbffff)) ++#define SET_TM3_TM_CUR_VALUE(_VAL_) (REG32(ADR_TM3_CURRENT_MILISECOND_TIME_VALUE)) = (((_VAL_) << 0) | ((REG32(ADR_TM3_CURRENT_MILISECOND_TIME_VALUE)) & 0xffff0000)) ++#define SET_MCU_WDT_TIME_CNT(_VAL_) (REG32(ADR_MCU_WDOG_REG)) = (((_VAL_) << 0) | ((REG32(ADR_MCU_WDOG_REG)) & 0xffff0000)) ++#define SET_MCU_WDT_STATUS(_VAL_) (REG32(ADR_MCU_WDOG_REG)) = (((_VAL_) << 17) | ((REG32(ADR_MCU_WDOG_REG)) & 0xfffdffff)) ++#define SET_MCU_WDOG_ENA(_VAL_) (REG32(ADR_MCU_WDOG_REG)) = (((_VAL_) << 31) | ((REG32(ADR_MCU_WDOG_REG)) & 0x7fffffff)) ++#define SET_SYS_WDT_TIME_CNT(_VAL_) (REG32(ADR_SYS_WDOG_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SYS_WDOG_REG)) & 0xffff0000)) ++#define SET_SYS_WDT_STATUS(_VAL_) (REG32(ADR_SYS_WDOG_REG)) = (((_VAL_) << 17) | ((REG32(ADR_SYS_WDOG_REG)) & 0xfffdffff)) ++#define SET_SYS_WDOG_ENA(_VAL_) (REG32(ADR_SYS_WDOG_REG)) = (((_VAL_) << 31) | ((REG32(ADR_SYS_WDOG_REG)) & 0x7fffffff)) ++#define SET_XLNA_EN_O_OE(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 0) | ((REG32(ADR_PAD6)) & 0xfffffffe)) ++#define SET_XLNA_EN_O_PE(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 1) | ((REG32(ADR_PAD6)) & 0xfffffffd)) ++#define SET_PAD6_IE(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 3) | ((REG32(ADR_PAD6)) & 0xfffffff7)) ++#define SET_PAD6_SEL_I(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 4) | ((REG32(ADR_PAD6)) & 0xffffffcf)) ++#define SET_PAD6_OD(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 8) | ((REG32(ADR_PAD6)) & 0xfffffeff)) ++#define SET_PAD6_SEL_O(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 12) | ((REG32(ADR_PAD6)) & 0xffffefff)) ++#define SET_XLNA_EN_O_C(_VAL_) (REG32(ADR_PAD6)) = (((_VAL_) << 28) | ((REG32(ADR_PAD6)) & 0xefffffff)) ++#define SET_WIFI_TX_SW_O_OE(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 0) | ((REG32(ADR_PAD7)) & 0xfffffffe)) ++#define SET_WIFI_TX_SW_O_PE(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 1) | ((REG32(ADR_PAD7)) & 0xfffffffd)) ++#define SET_PAD7_IE(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 3) | ((REG32(ADR_PAD7)) & 0xfffffff7)) ++#define SET_PAD7_SEL_I(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 4) | ((REG32(ADR_PAD7)) & 0xffffffcf)) ++#define SET_PAD7_OD(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 8) | ((REG32(ADR_PAD7)) & 0xfffffeff)) ++#define SET_PAD7_SEL_O(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 12) | ((REG32(ADR_PAD7)) & 0xffffefff)) ++#define SET_WIFI_TX_SW_O_C(_VAL_) (REG32(ADR_PAD7)) = (((_VAL_) << 28) | ((REG32(ADR_PAD7)) & 0xefffffff)) ++#define SET_WIFI_RX_SW_O_OE(_VAL_) (REG32(ADR_PAD8)) = (((_VAL_) << 0) | ((REG32(ADR_PAD8)) & 0xfffffffe)) ++#define SET_WIFI_RX_SW_O_PE(_VAL_) (REG32(ADR_PAD8)) = (((_VAL_) << 1) | ((REG32(ADR_PAD8)) & 0xfffffffd)) ++#define SET_PAD8_IE(_VAL_) (REG32(ADR_PAD8)) = (((_VAL_) << 3) | ((REG32(ADR_PAD8)) & 0xfffffff7)) ++#define SET_PAD8_SEL_I(_VAL_) (REG32(ADR_PAD8)) = (((_VAL_) << 4) | ((REG32(ADR_PAD8)) & 0xffffffcf)) ++#define SET_PAD8_OD(_VAL_) (REG32(ADR_PAD8)) = (((_VAL_) << 8) | ((REG32(ADR_PAD8)) & 0xfffffeff)) ++#define SET_WIFI_RX_SW_O_C(_VAL_) (REG32(ADR_PAD8)) = (((_VAL_) << 28) | ((REG32(ADR_PAD8)) & 0xefffffff)) ++#define SET_BT_SW_O_OE(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 0) | ((REG32(ADR_PAD9)) & 0xfffffffe)) ++#define SET_BT_SW_O_PE(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 1) | ((REG32(ADR_PAD9)) & 0xfffffffd)) ++#define SET_PAD9_IE(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 3) | ((REG32(ADR_PAD9)) & 0xfffffff7)) ++#define SET_PAD9_SEL_I(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 4) | ((REG32(ADR_PAD9)) & 0xffffffcf)) ++#define SET_PAD9_OD(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 8) | ((REG32(ADR_PAD9)) & 0xfffffeff)) ++#define SET_PAD9_SEL_O(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 12) | ((REG32(ADR_PAD9)) & 0xffffefff)) ++#define SET_BT_SW_O_C(_VAL_) (REG32(ADR_PAD9)) = (((_VAL_) << 28) | ((REG32(ADR_PAD9)) & 0xefffffff)) ++#define SET_XPA_EN_O_OE(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 0) | ((REG32(ADR_PAD11)) & 0xfffffffe)) ++#define SET_XPA_EN_O_PE(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 1) | ((REG32(ADR_PAD11)) & 0xfffffffd)) ++#define SET_PAD11_IE(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 3) | ((REG32(ADR_PAD11)) & 0xfffffff7)) ++#define SET_PAD11_SEL_I(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 4) | ((REG32(ADR_PAD11)) & 0xffffffcf)) ++#define SET_PAD11_OD(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 8) | ((REG32(ADR_PAD11)) & 0xfffffeff)) ++#define SET_PAD11_SEL_O(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 12) | ((REG32(ADR_PAD11)) & 0xffffefff)) ++#define SET_XPA_EN_O_C(_VAL_) (REG32(ADR_PAD11)) = (((_VAL_) << 28) | ((REG32(ADR_PAD11)) & 0xefffffff)) ++#define SET_PAD15_OE(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 0) | ((REG32(ADR_PAD15)) & 0xfffffffe)) ++#define SET_PAD15_PE(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 1) | ((REG32(ADR_PAD15)) & 0xfffffffd)) ++#define SET_PAD15_DS(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 2) | ((REG32(ADR_PAD15)) & 0xfffffffb)) ++#define SET_PAD15_IE(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 3) | ((REG32(ADR_PAD15)) & 0xfffffff7)) ++#define SET_PAD15_SEL_I(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 4) | ((REG32(ADR_PAD15)) & 0xffffffcf)) ++#define SET_PAD15_OD(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 8) | ((REG32(ADR_PAD15)) & 0xfffffeff)) ++#define SET_PAD15_SEL_O(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 12) | ((REG32(ADR_PAD15)) & 0xffffefff)) ++#define SET_TEST_1_ID(_VAL_) (REG32(ADR_PAD15)) = (((_VAL_) << 28) | ((REG32(ADR_PAD15)) & 0xefffffff)) ++#define SET_PAD16_OE(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 0) | ((REG32(ADR_PAD16)) & 0xfffffffe)) ++#define SET_PAD16_PE(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 1) | ((REG32(ADR_PAD16)) & 0xfffffffd)) ++#define SET_PAD16_DS(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 2) | ((REG32(ADR_PAD16)) & 0xfffffffb)) ++#define SET_PAD16_IE(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 3) | ((REG32(ADR_PAD16)) & 0xfffffff7)) ++#define SET_PAD16_SEL_I(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 4) | ((REG32(ADR_PAD16)) & 0xffffffcf)) ++#define SET_PAD16_OD(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 8) | ((REG32(ADR_PAD16)) & 0xfffffeff)) ++#define SET_PAD16_SEL_O(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 12) | ((REG32(ADR_PAD16)) & 0xffffefff)) ++#define SET_TEST_2_ID(_VAL_) (REG32(ADR_PAD16)) = (((_VAL_) << 28) | ((REG32(ADR_PAD16)) & 0xefffffff)) ++#define SET_PAD17_OE(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 0) | ((REG32(ADR_PAD17)) & 0xfffffffe)) ++#define SET_PAD17_PE(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 1) | ((REG32(ADR_PAD17)) & 0xfffffffd)) ++#define SET_PAD17_DS(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 2) | ((REG32(ADR_PAD17)) & 0xfffffffb)) ++#define SET_PAD17_IE(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 3) | ((REG32(ADR_PAD17)) & 0xfffffff7)) ++#define SET_PAD17_SEL_I(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 4) | ((REG32(ADR_PAD17)) & 0xffffffcf)) ++#define SET_PAD17_OD(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 8) | ((REG32(ADR_PAD17)) & 0xfffffeff)) ++#define SET_PAD17_SEL_O(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 12) | ((REG32(ADR_PAD17)) & 0xffffefff)) ++#define SET_TEST_3_ID(_VAL_) (REG32(ADR_PAD17)) = (((_VAL_) << 28) | ((REG32(ADR_PAD17)) & 0xefffffff)) ++#define SET_PAD18_OE(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 0) | ((REG32(ADR_PAD18)) & 0xfffffffe)) ++#define SET_PAD18_PE(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 1) | ((REG32(ADR_PAD18)) & 0xfffffffd)) ++#define SET_PAD18_DS(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 2) | ((REG32(ADR_PAD18)) & 0xfffffffb)) ++#define SET_PAD18_IE(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 3) | ((REG32(ADR_PAD18)) & 0xfffffff7)) ++#define SET_PAD18_SEL_I(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 4) | ((REG32(ADR_PAD18)) & 0xffffffcf)) ++#define SET_PAD18_OD(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 8) | ((REG32(ADR_PAD18)) & 0xfffffeff)) ++#define SET_PAD18_SEL_O(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 12) | ((REG32(ADR_PAD18)) & 0xffffcfff)) ++#define SET_TEST_4_ID(_VAL_) (REG32(ADR_PAD18)) = (((_VAL_) << 28) | ((REG32(ADR_PAD18)) & 0xefffffff)) ++#define SET_PAD19_OE(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 0) | ((REG32(ADR_PAD19)) & 0xfffffffe)) ++#define SET_PAD19_PE(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 1) | ((REG32(ADR_PAD19)) & 0xfffffffd)) ++#define SET_PAD19_DS(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 2) | ((REG32(ADR_PAD19)) & 0xfffffffb)) ++#define SET_PAD19_IE(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 3) | ((REG32(ADR_PAD19)) & 0xfffffff7)) ++#define SET_PAD19_SEL_I(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 4) | ((REG32(ADR_PAD19)) & 0xffffffcf)) ++#define SET_PAD19_OD(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 8) | ((REG32(ADR_PAD19)) & 0xfffffeff)) ++#define SET_PAD19_SEL_O(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 12) | ((REG32(ADR_PAD19)) & 0xffff8fff)) ++#define SET_SHORT_TO_20_ID(_VAL_) (REG32(ADR_PAD19)) = (((_VAL_) << 28) | ((REG32(ADR_PAD19)) & 0xefffffff)) ++#define SET_PAD20_OE(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 0) | ((REG32(ADR_PAD20)) & 0xfffffffe)) ++#define SET_PAD20_PE(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 1) | ((REG32(ADR_PAD20)) & 0xfffffffd)) ++#define SET_PAD20_DS(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 2) | ((REG32(ADR_PAD20)) & 0xfffffffb)) ++#define SET_PAD20_IE(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 3) | ((REG32(ADR_PAD20)) & 0xfffffff7)) ++#define SET_PAD20_SEL_I(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 4) | ((REG32(ADR_PAD20)) & 0xffffff0f)) ++#define SET_PAD20_OD(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 8) | ((REG32(ADR_PAD20)) & 0xfffffeff)) ++#define SET_PAD20_SEL_O(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 12) | ((REG32(ADR_PAD20)) & 0xffffcfff)) ++#define SET_STRAP0(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 27) | ((REG32(ADR_PAD20)) & 0xf7ffffff)) ++#define SET_GPIO_TEST_1_ID(_VAL_) (REG32(ADR_PAD20)) = (((_VAL_) << 28) | ((REG32(ADR_PAD20)) & 0xefffffff)) ++#define SET_PAD21_OE(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 0) | ((REG32(ADR_PAD21)) & 0xfffffffe)) ++#define SET_PAD21_PE(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 1) | ((REG32(ADR_PAD21)) & 0xfffffffd)) ++#define SET_PAD21_DS(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 2) | ((REG32(ADR_PAD21)) & 0xfffffffb)) ++#define SET_PAD21_IE(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 3) | ((REG32(ADR_PAD21)) & 0xfffffff7)) ++#define SET_PAD21_SEL_I(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 4) | ((REG32(ADR_PAD21)) & 0xffffff8f)) ++#define SET_PAD21_OD(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 8) | ((REG32(ADR_PAD21)) & 0xfffffeff)) ++#define SET_PAD21_SEL_O(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 12) | ((REG32(ADR_PAD21)) & 0xffffcfff)) ++#define SET_STRAP3(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 27) | ((REG32(ADR_PAD21)) & 0xf7ffffff)) ++#define SET_GPIO_TEST_2_ID(_VAL_) (REG32(ADR_PAD21)) = (((_VAL_) << 28) | ((REG32(ADR_PAD21)) & 0xefffffff)) ++#define SET_PAD22_OE(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 0) | ((REG32(ADR_PAD22)) & 0xfffffffe)) ++#define SET_PAD22_PE(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 1) | ((REG32(ADR_PAD22)) & 0xfffffffd)) ++#define SET_PAD22_DS(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 2) | ((REG32(ADR_PAD22)) & 0xfffffffb)) ++#define SET_PAD22_IE(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 3) | ((REG32(ADR_PAD22)) & 0xfffffff7)) ++#define SET_PAD22_SEL_I(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 4) | ((REG32(ADR_PAD22)) & 0xffffff8f)) ++#define SET_PAD22_OD(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 8) | ((REG32(ADR_PAD22)) & 0xfffffeff)) ++#define SET_PAD22_SEL_O(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 12) | ((REG32(ADR_PAD22)) & 0xffff8fff)) ++#define SET_PAD22_SEL_OE(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 20) | ((REG32(ADR_PAD22)) & 0xffefffff)) ++#define SET_GPIO_TEST_3_ID(_VAL_) (REG32(ADR_PAD22)) = (((_VAL_) << 28) | ((REG32(ADR_PAD22)) & 0xefffffff)) ++#define SET_PAD24_OE(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 0) | ((REG32(ADR_PAD24)) & 0xfffffffe)) ++#define SET_PAD24_PE(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 1) | ((REG32(ADR_PAD24)) & 0xfffffffd)) ++#define SET_PAD24_DS(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 2) | ((REG32(ADR_PAD24)) & 0xfffffffb)) ++#define SET_PAD24_IE(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 3) | ((REG32(ADR_PAD24)) & 0xfffffff7)) ++#define SET_PAD24_SEL_I(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 4) | ((REG32(ADR_PAD24)) & 0xffffffcf)) ++#define SET_PAD24_OD(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 8) | ((REG32(ADR_PAD24)) & 0xfffffeff)) ++#define SET_PAD24_SEL_O(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 12) | ((REG32(ADR_PAD24)) & 0xffff8fff)) ++#define SET_GPIO_TEST_4_ID(_VAL_) (REG32(ADR_PAD24)) = (((_VAL_) << 28) | ((REG32(ADR_PAD24)) & 0xefffffff)) ++#define SET_PAD25_OE(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 0) | ((REG32(ADR_PAD25)) & 0xfffffffe)) ++#define SET_PAD25_PE(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 1) | ((REG32(ADR_PAD25)) & 0xfffffffd)) ++#define SET_PAD25_DS(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 2) | ((REG32(ADR_PAD25)) & 0xfffffffb)) ++#define SET_PAD25_IE(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 3) | ((REG32(ADR_PAD25)) & 0xfffffff7)) ++#define SET_PAD25_SEL_I(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 4) | ((REG32(ADR_PAD25)) & 0xffffff8f)) ++#define SET_PAD25_OD(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 8) | ((REG32(ADR_PAD25)) & 0xfffffeff)) ++#define SET_PAD25_SEL_O(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 12) | ((REG32(ADR_PAD25)) & 0xffff8fff)) ++#define SET_PAD25_SEL_OE(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 20) | ((REG32(ADR_PAD25)) & 0xffefffff)) ++#define SET_STRAP1(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 27) | ((REG32(ADR_PAD25)) & 0xf7ffffff)) ++#define SET_GPIO_1_ID(_VAL_) (REG32(ADR_PAD25)) = (((_VAL_) << 28) | ((REG32(ADR_PAD25)) & 0xefffffff)) ++#define SET_PAD27_OE(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 0) | ((REG32(ADR_PAD27)) & 0xfffffffe)) ++#define SET_PAD27_PE(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 1) | ((REG32(ADR_PAD27)) & 0xfffffffd)) ++#define SET_PAD27_DS(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 2) | ((REG32(ADR_PAD27)) & 0xfffffffb)) ++#define SET_PAD27_IE(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 3) | ((REG32(ADR_PAD27)) & 0xfffffff7)) ++#define SET_PAD27_SEL_I(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 4) | ((REG32(ADR_PAD27)) & 0xffffff8f)) ++#define SET_PAD27_OD(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 8) | ((REG32(ADR_PAD27)) & 0xfffffeff)) ++#define SET_PAD27_SEL_O(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 12) | ((REG32(ADR_PAD27)) & 0xffff8fff)) ++#define SET_GPIO_2_ID(_VAL_) (REG32(ADR_PAD27)) = (((_VAL_) << 28) | ((REG32(ADR_PAD27)) & 0xefffffff)) ++#define SET_PAD28_OE(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 0) | ((REG32(ADR_PAD28)) & 0xfffffffe)) ++#define SET_PAD28_PE(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 1) | ((REG32(ADR_PAD28)) & 0xfffffffd)) ++#define SET_PAD28_DS(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 2) | ((REG32(ADR_PAD28)) & 0xfffffffb)) ++#define SET_PAD28_IE(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 3) | ((REG32(ADR_PAD28)) & 0xfffffff7)) ++#define SET_PAD28_SEL_I(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 4) | ((REG32(ADR_PAD28)) & 0xffffff8f)) ++#define SET_PAD28_OD(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 8) | ((REG32(ADR_PAD28)) & 0xfffffeff)) ++#define SET_PAD28_SEL_O(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 12) | ((REG32(ADR_PAD28)) & 0xffff0fff)) ++#define SET_PAD28_SEL_OE(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 20) | ((REG32(ADR_PAD28)) & 0xffefffff)) ++#define SET_GPIO_3_ID(_VAL_) (REG32(ADR_PAD28)) = (((_VAL_) << 28) | ((REG32(ADR_PAD28)) & 0xefffffff)) ++#define SET_PAD29_OE(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 0) | ((REG32(ADR_PAD29)) & 0xfffffffe)) ++#define SET_PAD29_PE(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 1) | ((REG32(ADR_PAD29)) & 0xfffffffd)) ++#define SET_PAD29_DS(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 2) | ((REG32(ADR_PAD29)) & 0xfffffffb)) ++#define SET_PAD29_IE(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 3) | ((REG32(ADR_PAD29)) & 0xfffffff7)) ++#define SET_PAD29_SEL_I(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 4) | ((REG32(ADR_PAD29)) & 0xffffff8f)) ++#define SET_PAD29_OD(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 8) | ((REG32(ADR_PAD29)) & 0xfffffeff)) ++#define SET_PAD29_SEL_O(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 12) | ((REG32(ADR_PAD29)) & 0xffff8fff)) ++#define SET_GPIO_TEST_5_ID(_VAL_) (REG32(ADR_PAD29)) = (((_VAL_) << 28) | ((REG32(ADR_PAD29)) & 0xefffffff)) ++#define SET_PAD30_OE(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 0) | ((REG32(ADR_PAD30)) & 0xfffffffe)) ++#define SET_PAD30_PE(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 1) | ((REG32(ADR_PAD30)) & 0xfffffffd)) ++#define SET_PAD30_DS(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 2) | ((REG32(ADR_PAD30)) & 0xfffffffb)) ++#define SET_PAD30_IE(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 3) | ((REG32(ADR_PAD30)) & 0xfffffff7)) ++#define SET_PAD30_SEL_I(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 4) | ((REG32(ADR_PAD30)) & 0xffffffcf)) ++#define SET_PAD30_OD(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 8) | ((REG32(ADR_PAD30)) & 0xfffffeff)) ++#define SET_PAD30_SEL_O(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 12) | ((REG32(ADR_PAD30)) & 0xffffcfff)) ++#define SET_TEST_6_ID(_VAL_) (REG32(ADR_PAD30)) = (((_VAL_) << 28) | ((REG32(ADR_PAD30)) & 0xefffffff)) ++#define SET_PAD31_OE(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 0) | ((REG32(ADR_PAD31)) & 0xfffffffe)) ++#define SET_PAD31_PE(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 1) | ((REG32(ADR_PAD31)) & 0xfffffffd)) ++#define SET_PAD31_DS(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 2) | ((REG32(ADR_PAD31)) & 0xfffffffb)) ++#define SET_PAD31_IE(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 3) | ((REG32(ADR_PAD31)) & 0xfffffff7)) ++#define SET_PAD31_SEL_I(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 4) | ((REG32(ADR_PAD31)) & 0xffffffcf)) ++#define SET_PAD31_OD(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 8) | ((REG32(ADR_PAD31)) & 0xfffffeff)) ++#define SET_PAD31_SEL_O(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 12) | ((REG32(ADR_PAD31)) & 0xffffcfff)) ++#define SET_TEST_7_ID(_VAL_) (REG32(ADR_PAD31)) = (((_VAL_) << 28) | ((REG32(ADR_PAD31)) & 0xefffffff)) ++#define SET_PAD32_OE(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 0) | ((REG32(ADR_PAD32)) & 0xfffffffe)) ++#define SET_PAD32_PE(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 1) | ((REG32(ADR_PAD32)) & 0xfffffffd)) ++#define SET_PAD32_DS(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 2) | ((REG32(ADR_PAD32)) & 0xfffffffb)) ++#define SET_PAD32_IE(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 3) | ((REG32(ADR_PAD32)) & 0xfffffff7)) ++#define SET_PAD32_SEL_I(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 4) | ((REG32(ADR_PAD32)) & 0xffffffcf)) ++#define SET_PAD32_OD(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 8) | ((REG32(ADR_PAD32)) & 0xfffffeff)) ++#define SET_PAD32_SEL_O(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 12) | ((REG32(ADR_PAD32)) & 0xffffcfff)) ++#define SET_TEST_8_ID(_VAL_) (REG32(ADR_PAD32)) = (((_VAL_) << 28) | ((REG32(ADR_PAD32)) & 0xefffffff)) ++#define SET_PAD33_OE(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 0) | ((REG32(ADR_PAD33)) & 0xfffffffe)) ++#define SET_PAD33_PE(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 1) | ((REG32(ADR_PAD33)) & 0xfffffffd)) ++#define SET_PAD33_DS(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 2) | ((REG32(ADR_PAD33)) & 0xfffffffb)) ++#define SET_PAD33_IE(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 3) | ((REG32(ADR_PAD33)) & 0xfffffff7)) ++#define SET_PAD33_SEL_I(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 4) | ((REG32(ADR_PAD33)) & 0xffffffcf)) ++#define SET_PAD33_OD(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 8) | ((REG32(ADR_PAD33)) & 0xfffffeff)) ++#define SET_PAD33_SEL_O(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 12) | ((REG32(ADR_PAD33)) & 0xffffcfff)) ++#define SET_TEST_9_ID(_VAL_) (REG32(ADR_PAD33)) = (((_VAL_) << 28) | ((REG32(ADR_PAD33)) & 0xefffffff)) ++#define SET_PAD34_OE(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 0) | ((REG32(ADR_PAD34)) & 0xfffffffe)) ++#define SET_PAD34_PE(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 1) | ((REG32(ADR_PAD34)) & 0xfffffffd)) ++#define SET_PAD34_DS(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 2) | ((REG32(ADR_PAD34)) & 0xfffffffb)) ++#define SET_PAD34_IE(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 3) | ((REG32(ADR_PAD34)) & 0xfffffff7)) ++#define SET_PAD34_SEL_I(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 4) | ((REG32(ADR_PAD34)) & 0xffffffcf)) ++#define SET_PAD34_OD(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 8) | ((REG32(ADR_PAD34)) & 0xfffffeff)) ++#define SET_PAD34_SEL_O(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 12) | ((REG32(ADR_PAD34)) & 0xffffcfff)) ++#define SET_TEST_10_ID(_VAL_) (REG32(ADR_PAD34)) = (((_VAL_) << 28) | ((REG32(ADR_PAD34)) & 0xefffffff)) ++#define SET_PAD42_OE(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 0) | ((REG32(ADR_PAD42)) & 0xfffffffe)) ++#define SET_PAD42_PE(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 1) | ((REG32(ADR_PAD42)) & 0xfffffffd)) ++#define SET_PAD42_DS(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 2) | ((REG32(ADR_PAD42)) & 0xfffffffb)) ++#define SET_PAD42_IE(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 3) | ((REG32(ADR_PAD42)) & 0xfffffff7)) ++#define SET_PAD42_SEL_I(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 4) | ((REG32(ADR_PAD42)) & 0xffffffcf)) ++#define SET_PAD42_OD(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 8) | ((REG32(ADR_PAD42)) & 0xfffffeff)) ++#define SET_PAD42_SEL_O(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 12) | ((REG32(ADR_PAD42)) & 0xffffefff)) ++#define SET_TEST_11_ID(_VAL_) (REG32(ADR_PAD42)) = (((_VAL_) << 28) | ((REG32(ADR_PAD42)) & 0xefffffff)) ++#define SET_PAD43_OE(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 0) | ((REG32(ADR_PAD43)) & 0xfffffffe)) ++#define SET_PAD43_PE(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 1) | ((REG32(ADR_PAD43)) & 0xfffffffd)) ++#define SET_PAD43_DS(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 2) | ((REG32(ADR_PAD43)) & 0xfffffffb)) ++#define SET_PAD43_IE(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 3) | ((REG32(ADR_PAD43)) & 0xfffffff7)) ++#define SET_PAD43_SEL_I(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 4) | ((REG32(ADR_PAD43)) & 0xffffffcf)) ++#define SET_PAD43_OD(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 8) | ((REG32(ADR_PAD43)) & 0xfffffeff)) ++#define SET_PAD43_SEL_O(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 12) | ((REG32(ADR_PAD43)) & 0xffffefff)) ++#define SET_TEST_12_ID(_VAL_) (REG32(ADR_PAD43)) = (((_VAL_) << 28) | ((REG32(ADR_PAD43)) & 0xefffffff)) ++#define SET_PAD44_OE(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 0) | ((REG32(ADR_PAD44)) & 0xfffffffe)) ++#define SET_PAD44_PE(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 1) | ((REG32(ADR_PAD44)) & 0xfffffffd)) ++#define SET_PAD44_DS(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 2) | ((REG32(ADR_PAD44)) & 0xfffffffb)) ++#define SET_PAD44_IE(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 3) | ((REG32(ADR_PAD44)) & 0xfffffff7)) ++#define SET_PAD44_SEL_I(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 4) | ((REG32(ADR_PAD44)) & 0xffffffcf)) ++#define SET_PAD44_OD(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 8) | ((REG32(ADR_PAD44)) & 0xfffffeff)) ++#define SET_PAD44_SEL_O(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 12) | ((REG32(ADR_PAD44)) & 0xffffcfff)) ++#define SET_TEST_13_ID(_VAL_) (REG32(ADR_PAD44)) = (((_VAL_) << 28) | ((REG32(ADR_PAD44)) & 0xefffffff)) ++#define SET_PAD45_OE(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 0) | ((REG32(ADR_PAD45)) & 0xfffffffe)) ++#define SET_PAD45_PE(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 1) | ((REG32(ADR_PAD45)) & 0xfffffffd)) ++#define SET_PAD45_DS(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 2) | ((REG32(ADR_PAD45)) & 0xfffffffb)) ++#define SET_PAD45_IE(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 3) | ((REG32(ADR_PAD45)) & 0xfffffff7)) ++#define SET_PAD45_SEL_I(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 4) | ((REG32(ADR_PAD45)) & 0xffffffcf)) ++#define SET_PAD45_OD(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 8) | ((REG32(ADR_PAD45)) & 0xfffffeff)) ++#define SET_PAD45_SEL_O(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 12) | ((REG32(ADR_PAD45)) & 0xffffcfff)) ++#define SET_TEST_14_ID(_VAL_) (REG32(ADR_PAD45)) = (((_VAL_) << 28) | ((REG32(ADR_PAD45)) & 0xefffffff)) ++#define SET_PAD46_OE(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 0) | ((REG32(ADR_PAD46)) & 0xfffffffe)) ++#define SET_PAD46_PE(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 1) | ((REG32(ADR_PAD46)) & 0xfffffffd)) ++#define SET_PAD46_DS(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 2) | ((REG32(ADR_PAD46)) & 0xfffffffb)) ++#define SET_PAD46_IE(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 3) | ((REG32(ADR_PAD46)) & 0xfffffff7)) ++#define SET_PAD46_SEL_I(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 4) | ((REG32(ADR_PAD46)) & 0xffffffcf)) ++#define SET_PAD46_OD(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 8) | ((REG32(ADR_PAD46)) & 0xfffffeff)) ++#define SET_PAD46_SEL_O(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 12) | ((REG32(ADR_PAD46)) & 0xffffcfff)) ++#define SET_TEST_15_ID(_VAL_) (REG32(ADR_PAD46)) = (((_VAL_) << 28) | ((REG32(ADR_PAD46)) & 0xefffffff)) ++#define SET_PAD47_OE(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 0) | ((REG32(ADR_PAD47)) & 0xfffffffe)) ++#define SET_PAD47_PE(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 1) | ((REG32(ADR_PAD47)) & 0xfffffffd)) ++#define SET_PAD47_DS(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 2) | ((REG32(ADR_PAD47)) & 0xfffffffb)) ++#define SET_PAD47_SEL_I(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 4) | ((REG32(ADR_PAD47)) & 0xffffffcf)) ++#define SET_PAD47_OD(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 8) | ((REG32(ADR_PAD47)) & 0xfffffeff)) ++#define SET_PAD47_SEL_O(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 12) | ((REG32(ADR_PAD47)) & 0xffffcfff)) ++#define SET_PAD47_SEL_OE(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 20) | ((REG32(ADR_PAD47)) & 0xffefffff)) ++#define SET_GPIO_9_ID(_VAL_) (REG32(ADR_PAD47)) = (((_VAL_) << 28) | ((REG32(ADR_PAD47)) & 0xefffffff)) ++#define SET_PAD48_OE(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 0) | ((REG32(ADR_PAD48)) & 0xfffffffe)) ++#define SET_PAD48_PE(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 1) | ((REG32(ADR_PAD48)) & 0xfffffffd)) ++#define SET_PAD48_DS(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 2) | ((REG32(ADR_PAD48)) & 0xfffffffb)) ++#define SET_PAD48_IE(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 3) | ((REG32(ADR_PAD48)) & 0xfffffff7)) ++#define SET_PAD48_SEL_I(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 4) | ((REG32(ADR_PAD48)) & 0xffffff8f)) ++#define SET_PAD48_OD(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 8) | ((REG32(ADR_PAD48)) & 0xfffffeff)) ++#define SET_PAD48_PE_SEL(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 11) | ((REG32(ADR_PAD48)) & 0xfffff7ff)) ++#define SET_PAD48_SEL_O(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 12) | ((REG32(ADR_PAD48)) & 0xffffcfff)) ++#define SET_PAD48_SEL_OE(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 20) | ((REG32(ADR_PAD48)) & 0xffefffff)) ++#define SET_GPIO_10_ID(_VAL_) (REG32(ADR_PAD48)) = (((_VAL_) << 28) | ((REG32(ADR_PAD48)) & 0xefffffff)) ++#define SET_PAD49_OE(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 0) | ((REG32(ADR_PAD49)) & 0xfffffffe)) ++#define SET_PAD49_PE(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 1) | ((REG32(ADR_PAD49)) & 0xfffffffd)) ++#define SET_PAD49_DS(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 2) | ((REG32(ADR_PAD49)) & 0xfffffffb)) ++#define SET_PAD49_IE(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 3) | ((REG32(ADR_PAD49)) & 0xfffffff7)) ++#define SET_PAD49_SEL_I(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 4) | ((REG32(ADR_PAD49)) & 0xffffff8f)) ++#define SET_PAD49_OD(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 8) | ((REG32(ADR_PAD49)) & 0xfffffeff)) ++#define SET_PAD49_SEL_O(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 12) | ((REG32(ADR_PAD49)) & 0xffffcfff)) ++#define SET_PAD49_SEL_OE(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 20) | ((REG32(ADR_PAD49)) & 0xffefffff)) ++#define SET_GPIO_11_ID(_VAL_) (REG32(ADR_PAD49)) = (((_VAL_) << 28) | ((REG32(ADR_PAD49)) & 0xefffffff)) ++#define SET_PAD50_OE(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 0) | ((REG32(ADR_PAD50)) & 0xfffffffe)) ++#define SET_PAD50_PE(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 1) | ((REG32(ADR_PAD50)) & 0xfffffffd)) ++#define SET_PAD50_DS(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 2) | ((REG32(ADR_PAD50)) & 0xfffffffb)) ++#define SET_PAD50_IE(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 3) | ((REG32(ADR_PAD50)) & 0xfffffff7)) ++#define SET_PAD50_SEL_I(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 4) | ((REG32(ADR_PAD50)) & 0xffffff8f)) ++#define SET_PAD50_OD(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 8) | ((REG32(ADR_PAD50)) & 0xfffffeff)) ++#define SET_PAD50_SEL_O(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 12) | ((REG32(ADR_PAD50)) & 0xffffcfff)) ++#define SET_PAD50_SEL_OE(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 20) | ((REG32(ADR_PAD50)) & 0xffefffff)) ++#define SET_GPIO_12_ID(_VAL_) (REG32(ADR_PAD50)) = (((_VAL_) << 28) | ((REG32(ADR_PAD50)) & 0xefffffff)) ++#define SET_PAD51_OE(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 0) | ((REG32(ADR_PAD51)) & 0xfffffffe)) ++#define SET_PAD51_PE(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 1) | ((REG32(ADR_PAD51)) & 0xfffffffd)) ++#define SET_PAD51_DS(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 2) | ((REG32(ADR_PAD51)) & 0xfffffffb)) ++#define SET_PAD51_IE(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 3) | ((REG32(ADR_PAD51)) & 0xfffffff7)) ++#define SET_PAD51_SEL_I(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 4) | ((REG32(ADR_PAD51)) & 0xffffffcf)) ++#define SET_PAD51_OD(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 8) | ((REG32(ADR_PAD51)) & 0xfffffeff)) ++#define SET_PAD51_SEL_O(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 12) | ((REG32(ADR_PAD51)) & 0xffffefff)) ++#define SET_PAD51_SEL_OE(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 20) | ((REG32(ADR_PAD51)) & 0xffefffff)) ++#define SET_GPIO_13_ID(_VAL_) (REG32(ADR_PAD51)) = (((_VAL_) << 28) | ((REG32(ADR_PAD51)) & 0xefffffff)) ++#define SET_PAD52_OE(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 0) | ((REG32(ADR_PAD52)) & 0xfffffffe)) ++#define SET_PAD52_PE(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 1) | ((REG32(ADR_PAD52)) & 0xfffffffd)) ++#define SET_PAD52_DS(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 2) | ((REG32(ADR_PAD52)) & 0xfffffffb)) ++#define SET_PAD52_SEL_I(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 4) | ((REG32(ADR_PAD52)) & 0xffffffcf)) ++#define SET_PAD52_OD(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 8) | ((REG32(ADR_PAD52)) & 0xfffffeff)) ++#define SET_PAD52_SEL_O(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 12) | ((REG32(ADR_PAD52)) & 0xffffefff)) ++#define SET_PAD52_SEL_OE(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 20) | ((REG32(ADR_PAD52)) & 0xffefffff)) ++#define SET_GPIO_14_ID(_VAL_) (REG32(ADR_PAD52)) = (((_VAL_) << 28) | ((REG32(ADR_PAD52)) & 0xefffffff)) ++#define SET_PAD53_OE(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 0) | ((REG32(ADR_PAD53)) & 0xfffffffe)) ++#define SET_PAD53_PE(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 1) | ((REG32(ADR_PAD53)) & 0xfffffffd)) ++#define SET_PAD53_DS(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 2) | ((REG32(ADR_PAD53)) & 0xfffffffb)) ++#define SET_PAD53_IE(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 3) | ((REG32(ADR_PAD53)) & 0xfffffff7)) ++#define SET_PAD53_SEL_I(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 4) | ((REG32(ADR_PAD53)) & 0xffffffcf)) ++#define SET_PAD53_OD(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 8) | ((REG32(ADR_PAD53)) & 0xfffffeff)) ++#define SET_PAD53_SEL_O(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 12) | ((REG32(ADR_PAD53)) & 0xffffefff)) ++#define SET_JTAG_TMS_ID(_VAL_) (REG32(ADR_PAD53)) = (((_VAL_) << 28) | ((REG32(ADR_PAD53)) & 0xefffffff)) ++#define SET_PAD54_OE(_VAL_) (REG32(ADR_PAD54)) = (((_VAL_) << 0) | ((REG32(ADR_PAD54)) & 0xfffffffe)) ++#define SET_PAD54_PE(_VAL_) (REG32(ADR_PAD54)) = (((_VAL_) << 1) | ((REG32(ADR_PAD54)) & 0xfffffffd)) ++#define SET_PAD54_DS(_VAL_) (REG32(ADR_PAD54)) = (((_VAL_) << 2) | ((REG32(ADR_PAD54)) & 0xfffffffb)) ++#define SET_PAD54_OD(_VAL_) (REG32(ADR_PAD54)) = (((_VAL_) << 8) | ((REG32(ADR_PAD54)) & 0xfffffeff)) ++#define SET_PAD54_SEL_O(_VAL_) (REG32(ADR_PAD54)) = (((_VAL_) << 12) | ((REG32(ADR_PAD54)) & 0xffffcfff)) ++#define SET_JTAG_TCK_ID(_VAL_) (REG32(ADR_PAD54)) = (((_VAL_) << 28) | ((REG32(ADR_PAD54)) & 0xefffffff)) ++#define SET_PAD56_PE(_VAL_) (REG32(ADR_PAD56)) = (((_VAL_) << 1) | ((REG32(ADR_PAD56)) & 0xfffffffd)) ++#define SET_PAD56_DS(_VAL_) (REG32(ADR_PAD56)) = (((_VAL_) << 2) | ((REG32(ADR_PAD56)) & 0xfffffffb)) ++#define SET_PAD56_SEL_I(_VAL_) (REG32(ADR_PAD56)) = (((_VAL_) << 4) | ((REG32(ADR_PAD56)) & 0xffffffef)) ++#define SET_PAD56_OD(_VAL_) (REG32(ADR_PAD56)) = (((_VAL_) << 8) | ((REG32(ADR_PAD56)) & 0xfffffeff)) ++#define SET_JTAG_TDI_ID(_VAL_) (REG32(ADR_PAD56)) = (((_VAL_) << 28) | ((REG32(ADR_PAD56)) & 0xefffffff)) ++#define SET_PAD57_OE(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 0) | ((REG32(ADR_PAD57)) & 0xfffffffe)) ++#define SET_PAD57_PE(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 1) | ((REG32(ADR_PAD57)) & 0xfffffffd)) ++#define SET_PAD57_DS(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 2) | ((REG32(ADR_PAD57)) & 0xfffffffb)) ++#define SET_PAD57_IE(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 3) | ((REG32(ADR_PAD57)) & 0xfffffff7)) ++#define SET_PAD57_SEL_I(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 4) | ((REG32(ADR_PAD57)) & 0xffffffcf)) ++#define SET_PAD57_OD(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 8) | ((REG32(ADR_PAD57)) & 0xfffffeff)) ++#define SET_PAD57_SEL_O(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 12) | ((REG32(ADR_PAD57)) & 0xffffcfff)) ++#define SET_PAD57_SEL_OE(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 20) | ((REG32(ADR_PAD57)) & 0xffefffff)) ++#define SET_JTAG_TDO_ID(_VAL_) (REG32(ADR_PAD57)) = (((_VAL_) << 28) | ((REG32(ADR_PAD57)) & 0xefffffff)) ++#define SET_PAD58_OE(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 0) | ((REG32(ADR_PAD58)) & 0xfffffffe)) ++#define SET_PAD58_PE(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 1) | ((REG32(ADR_PAD58)) & 0xfffffffd)) ++#define SET_PAD58_DS(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 2) | ((REG32(ADR_PAD58)) & 0xfffffffb)) ++#define SET_PAD58_IE(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 3) | ((REG32(ADR_PAD58)) & 0xfffffff7)) ++#define SET_PAD58_SEL_I(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 4) | ((REG32(ADR_PAD58)) & 0xffffffcf)) ++#define SET_PAD58_OD(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 8) | ((REG32(ADR_PAD58)) & 0xfffffeff)) ++#define SET_PAD58_SEL_O(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 12) | ((REG32(ADR_PAD58)) & 0xffffefff)) ++#define SET_TEST_16_ID(_VAL_) (REG32(ADR_PAD58)) = (((_VAL_) << 28) | ((REG32(ADR_PAD58)) & 0xefffffff)) ++#define SET_PAD59_OE(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 0) | ((REG32(ADR_PAD59)) & 0xfffffffe)) ++#define SET_PAD59_PE(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 1) | ((REG32(ADR_PAD59)) & 0xfffffffd)) ++#define SET_PAD59_DS(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 2) | ((REG32(ADR_PAD59)) & 0xfffffffb)) ++#define SET_PAD59_IE(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 3) | ((REG32(ADR_PAD59)) & 0xfffffff7)) ++#define SET_PAD59_SEL_I(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 4) | ((REG32(ADR_PAD59)) & 0xffffffcf)) ++#define SET_PAD59_OD(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 8) | ((REG32(ADR_PAD59)) & 0xfffffeff)) ++#define SET_PAD59_SEL_O(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 12) | ((REG32(ADR_PAD59)) & 0xffffefff)) ++#define SET_TEST_17_ID(_VAL_) (REG32(ADR_PAD59)) = (((_VAL_) << 28) | ((REG32(ADR_PAD59)) & 0xefffffff)) ++#define SET_PAD60_OE(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 0) | ((REG32(ADR_PAD60)) & 0xfffffffe)) ++#define SET_PAD60_PE(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 1) | ((REG32(ADR_PAD60)) & 0xfffffffd)) ++#define SET_PAD60_DS(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 2) | ((REG32(ADR_PAD60)) & 0xfffffffb)) ++#define SET_PAD60_IE(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 3) | ((REG32(ADR_PAD60)) & 0xfffffff7)) ++#define SET_PAD60_SEL_I(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 4) | ((REG32(ADR_PAD60)) & 0xffffffcf)) ++#define SET_PAD60_OD(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 8) | ((REG32(ADR_PAD60)) & 0xfffffeff)) ++#define SET_PAD60_SEL_O(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 12) | ((REG32(ADR_PAD60)) & 0xffffefff)) ++#define SET_TEST_18_ID(_VAL_) (REG32(ADR_PAD60)) = (((_VAL_) << 28) | ((REG32(ADR_PAD60)) & 0xefffffff)) ++#define SET_PAD61_OE(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 0) | ((REG32(ADR_PAD61)) & 0xfffffffe)) ++#define SET_PAD61_PE(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 1) | ((REG32(ADR_PAD61)) & 0xfffffffd)) ++#define SET_PAD61_DS(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 2) | ((REG32(ADR_PAD61)) & 0xfffffffb)) ++#define SET_PAD61_IE(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 3) | ((REG32(ADR_PAD61)) & 0xfffffff7)) ++#define SET_PAD61_SEL_I(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 4) | ((REG32(ADR_PAD61)) & 0xffffffef)) ++#define SET_PAD61_OD(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 8) | ((REG32(ADR_PAD61)) & 0xfffffeff)) ++#define SET_PAD61_SEL_O(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 12) | ((REG32(ADR_PAD61)) & 0xffffcfff)) ++#define SET_TEST_19_ID(_VAL_) (REG32(ADR_PAD61)) = (((_VAL_) << 28) | ((REG32(ADR_PAD61)) & 0xefffffff)) ++#define SET_PAD62_OE(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 0) | ((REG32(ADR_PAD62)) & 0xfffffffe)) ++#define SET_PAD62_PE(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 1) | ((REG32(ADR_PAD62)) & 0xfffffffd)) ++#define SET_PAD62_DS(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 2) | ((REG32(ADR_PAD62)) & 0xfffffffb)) ++#define SET_PAD62_IE(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 3) | ((REG32(ADR_PAD62)) & 0xfffffff7)) ++#define SET_PAD62_SEL_I(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 4) | ((REG32(ADR_PAD62)) & 0xffffffef)) ++#define SET_PAD62_OD(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 8) | ((REG32(ADR_PAD62)) & 0xfffffeff)) ++#define SET_PAD62_SEL_O(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 12) | ((REG32(ADR_PAD62)) & 0xffffefff)) ++#define SET_TEST_20_ID(_VAL_) (REG32(ADR_PAD62)) = (((_VAL_) << 28) | ((REG32(ADR_PAD62)) & 0xefffffff)) ++#define SET_PAD64_OE(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 0) | ((REG32(ADR_PAD64)) & 0xfffffffe)) ++#define SET_PAD64_PE(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 1) | ((REG32(ADR_PAD64)) & 0xfffffffd)) ++#define SET_PAD64_DS(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 2) | ((REG32(ADR_PAD64)) & 0xfffffffb)) ++#define SET_PAD64_IE(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 3) | ((REG32(ADR_PAD64)) & 0xfffffff7)) ++#define SET_PAD64_SEL_I(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 4) | ((REG32(ADR_PAD64)) & 0xffffff8f)) ++#define SET_PAD64_OD(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 8) | ((REG32(ADR_PAD64)) & 0xfffffeff)) ++#define SET_PAD64_SEL_O(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 12) | ((REG32(ADR_PAD64)) & 0xffffcfff)) ++#define SET_PAD64_SEL_OE(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 20) | ((REG32(ADR_PAD64)) & 0xffefffff)) ++#define SET_GPIO_15_IP_ID(_VAL_) (REG32(ADR_PAD64)) = (((_VAL_) << 28) | ((REG32(ADR_PAD64)) & 0xefffffff)) ++#define SET_PAD65_OE(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 0) | ((REG32(ADR_PAD65)) & 0xfffffffe)) ++#define SET_PAD65_PE(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 1) | ((REG32(ADR_PAD65)) & 0xfffffffd)) ++#define SET_PAD65_DS(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 2) | ((REG32(ADR_PAD65)) & 0xfffffffb)) ++#define SET_PAD65_IE(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 3) | ((REG32(ADR_PAD65)) & 0xfffffff7)) ++#define SET_PAD65_SEL_I(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 4) | ((REG32(ADR_PAD65)) & 0xffffff8f)) ++#define SET_PAD65_OD(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 8) | ((REG32(ADR_PAD65)) & 0xfffffeff)) ++#define SET_PAD65_SEL_O(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 12) | ((REG32(ADR_PAD65)) & 0xffffefff)) ++#define SET_GPIO_TEST_7_IN_ID(_VAL_) (REG32(ADR_PAD65)) = (((_VAL_) << 28) | ((REG32(ADR_PAD65)) & 0xefffffff)) ++#define SET_PAD66_OE(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 0) | ((REG32(ADR_PAD66)) & 0xfffffffe)) ++#define SET_PAD66_PE(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 1) | ((REG32(ADR_PAD66)) & 0xfffffffd)) ++#define SET_PAD66_DS(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 2) | ((REG32(ADR_PAD66)) & 0xfffffffb)) ++#define SET_PAD66_IE(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 3) | ((REG32(ADR_PAD66)) & 0xfffffff7)) ++#define SET_PAD66_SEL_I(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 4) | ((REG32(ADR_PAD66)) & 0xffffffcf)) ++#define SET_PAD66_OD(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 8) | ((REG32(ADR_PAD66)) & 0xfffffeff)) ++#define SET_PAD66_SEL_O(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 12) | ((REG32(ADR_PAD66)) & 0xffffcfff)) ++#define SET_GPIO_17_QP_ID(_VAL_) (REG32(ADR_PAD66)) = (((_VAL_) << 28) | ((REG32(ADR_PAD66)) & 0xefffffff)) ++#define SET_PAD68_OE(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 0) | ((REG32(ADR_PAD68)) & 0xfffffffe)) ++#define SET_PAD68_PE(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 1) | ((REG32(ADR_PAD68)) & 0xfffffffd)) ++#define SET_PAD68_DS(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 2) | ((REG32(ADR_PAD68)) & 0xfffffffb)) ++#define SET_PAD68_IE(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 3) | ((REG32(ADR_PAD68)) & 0xfffffff7)) ++#define SET_PAD68_OD(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 8) | ((REG32(ADR_PAD68)) & 0xfffffeff)) ++#define SET_PAD68_SEL_O(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 12) | ((REG32(ADR_PAD68)) & 0xffffefff)) ++#define SET_GPIO_19_ID(_VAL_) (REG32(ADR_PAD68)) = (((_VAL_) << 28) | ((REG32(ADR_PAD68)) & 0xefffffff)) ++#define SET_PAD67_OE(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 0) | ((REG32(ADR_PAD67)) & 0xfffffffe)) ++#define SET_PAD67_PE(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 1) | ((REG32(ADR_PAD67)) & 0xfffffffd)) ++#define SET_PAD67_DS(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 2) | ((REG32(ADR_PAD67)) & 0xfffffffb)) ++#define SET_PAD67_IE(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 3) | ((REG32(ADR_PAD67)) & 0xfffffff7)) ++#define SET_PAD67_SEL_I(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 4) | ((REG32(ADR_PAD67)) & 0xffffff8f)) ++#define SET_PAD67_OD(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 8) | ((REG32(ADR_PAD67)) & 0xfffffeff)) ++#define SET_PAD67_SEL_O(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 12) | ((REG32(ADR_PAD67)) & 0xffffcfff)) ++#define SET_GPIO_TEST_8_QN_ID(_VAL_) (REG32(ADR_PAD67)) = (((_VAL_) << 28) | ((REG32(ADR_PAD67)) & 0xefffffff)) ++#define SET_PAD69_OE(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 0) | ((REG32(ADR_PAD69)) & 0xfffffffe)) ++#define SET_PAD69_PE(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 1) | ((REG32(ADR_PAD69)) & 0xfffffffd)) ++#define SET_PAD69_DS(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 2) | ((REG32(ADR_PAD69)) & 0xfffffffb)) ++#define SET_PAD69_IE(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 3) | ((REG32(ADR_PAD69)) & 0xfffffff7)) ++#define SET_PAD69_SEL_I(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 4) | ((REG32(ADR_PAD69)) & 0xffffffcf)) ++#define SET_PAD69_OD(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 8) | ((REG32(ADR_PAD69)) & 0xfffffeff)) ++#define SET_PAD69_SEL_O(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 12) | ((REG32(ADR_PAD69)) & 0xffffefff)) ++#define SET_STRAP2(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 27) | ((REG32(ADR_PAD69)) & 0xf7ffffff)) ++#define SET_GPIO_20_ID(_VAL_) (REG32(ADR_PAD69)) = (((_VAL_) << 28) | ((REG32(ADR_PAD69)) & 0xefffffff)) ++#define SET_PAD70_OE(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 0) | ((REG32(ADR_PAD70)) & 0xfffffffe)) ++#define SET_PAD70_PE(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 1) | ((REG32(ADR_PAD70)) & 0xfffffffd)) ++#define SET_PAD70_DS(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 2) | ((REG32(ADR_PAD70)) & 0xfffffffb)) ++#define SET_PAD70_IE(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 3) | ((REG32(ADR_PAD70)) & 0xfffffff7)) ++#define SET_PAD70_SEL_I(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 4) | ((REG32(ADR_PAD70)) & 0xffffffcf)) ++#define SET_PAD70_OD(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 8) | ((REG32(ADR_PAD70)) & 0xfffffeff)) ++#define SET_PAD70_SEL_O(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 12) | ((REG32(ADR_PAD70)) & 0xffff8fff)) ++#define SET_GPIO_21_ID(_VAL_) (REG32(ADR_PAD70)) = (((_VAL_) << 28) | ((REG32(ADR_PAD70)) & 0xefffffff)) ++#define SET_PAD231_OE(_VAL_) (REG32(ADR_PAD231)) = (((_VAL_) << 0) | ((REG32(ADR_PAD231)) & 0xfffffffe)) ++#define SET_PAD231_PE(_VAL_) (REG32(ADR_PAD231)) = (((_VAL_) << 1) | ((REG32(ADR_PAD231)) & 0xfffffffd)) ++#define SET_PAD231_DS(_VAL_) (REG32(ADR_PAD231)) = (((_VAL_) << 2) | ((REG32(ADR_PAD231)) & 0xfffffffb)) ++#define SET_PAD231_IE(_VAL_) (REG32(ADR_PAD231)) = (((_VAL_) << 3) | ((REG32(ADR_PAD231)) & 0xfffffff7)) ++#define SET_PAD231_OD(_VAL_) (REG32(ADR_PAD231)) = (((_VAL_) << 8) | ((REG32(ADR_PAD231)) & 0xfffffeff)) ++#define SET_PIN_40_OR_56_ID(_VAL_) (REG32(ADR_PAD231)) = (((_VAL_) << 28) | ((REG32(ADR_PAD231)) & 0xefffffff)) ++#define SET_MP_PHY2RX_DATA__0_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 0) | ((REG32(ADR_PIN_SEL_0)) & 0xfffffffe)) ++#define SET_MP_PHY2RX_DATA__1_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 1) | ((REG32(ADR_PIN_SEL_0)) & 0xfffffffd)) ++#define SET_MP_TX_FF_RPTR__1_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 2) | ((REG32(ADR_PIN_SEL_0)) & 0xfffffffb)) ++#define SET_MP_RX_FF_WPTR__2_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 3) | ((REG32(ADR_PIN_SEL_0)) & 0xfffffff7)) ++#define SET_MP_RX_FF_WPTR__1_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 4) | ((REG32(ADR_PIN_SEL_0)) & 0xffffffef)) ++#define SET_MP_RX_FF_WPTR__0_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 5) | ((REG32(ADR_PIN_SEL_0)) & 0xffffffdf)) ++#define SET_MP_PHY2RX_DATA__2_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 6) | ((REG32(ADR_PIN_SEL_0)) & 0xffffffbf)) ++#define SET_MP_PHY2RX_DATA__4_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 7) | ((REG32(ADR_PIN_SEL_0)) & 0xffffff7f)) ++#define SET_I2CM_SDA_ID_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 8) | ((REG32(ADR_PIN_SEL_0)) & 0xfffffcff)) ++#define SET_CRYSTAL_OUT_REQ_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 10) | ((REG32(ADR_PIN_SEL_0)) & 0xfffffbff)) ++#define SET_MP_PHY2RX_DATA__5_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 11) | ((REG32(ADR_PIN_SEL_0)) & 0xfffff7ff)) ++#define SET_MP_PHY2RX_DATA__3_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 12) | ((REG32(ADR_PIN_SEL_0)) & 0xffffefff)) ++#define SET_UART_RXD_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 13) | ((REG32(ADR_PIN_SEL_0)) & 0xffff9fff)) ++#define SET_MP_PHY2RX_DATA__6_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 15) | ((REG32(ADR_PIN_SEL_0)) & 0xffff7fff)) ++#define SET_DAT_UART_NCTS_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 16) | ((REG32(ADR_PIN_SEL_0)) & 0xfffeffff)) ++#define SET_GPIO_LOG_STOP_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 17) | ((REG32(ADR_PIN_SEL_0)) & 0xfff1ffff)) ++#define SET_MP_TX_FF_RPTR__0_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 20) | ((REG32(ADR_PIN_SEL_0)) & 0xffefffff)) ++#define SET_MP_PHY_RX_WRST_N_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 21) | ((REG32(ADR_PIN_SEL_0)) & 0xffdfffff)) ++#define SET_EXT_32K_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 22) | ((REG32(ADR_PIN_SEL_0)) & 0xff3fffff)) ++#define SET_MP_PHY2RX_DATA__7_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 24) | ((REG32(ADR_PIN_SEL_0)) & 0xfeffffff)) ++#define SET_MP_TX_FF_RPTR__2_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 25) | ((REG32(ADR_PIN_SEL_0)) & 0xfdffffff)) ++#define SET_PMUINT_WAKE_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 26) | ((REG32(ADR_PIN_SEL_0)) & 0xe3ffffff)) ++#define SET_I2CM_SCL_ID_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 29) | ((REG32(ADR_PIN_SEL_0)) & 0xdfffffff)) ++#define SET_MP_MRX_RX_EN_SEL(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 30) | ((REG32(ADR_PIN_SEL_0)) & 0xbfffffff)) ++#define SET_DAT_UART_RXD_SEL_0(_VAL_) (REG32(ADR_PIN_SEL_0)) = (((_VAL_) << 31) | ((REG32(ADR_PIN_SEL_0)) & 0x7fffffff)) ++#define SET_DAT_UART_RXD_SEL_1(_VAL_) (REG32(ADR_PIN_SEL_1)) = (((_VAL_) << 0) | ((REG32(ADR_PIN_SEL_1)) & 0xfffffffe)) ++#define SET_SPI_DI_SEL(_VAL_) (REG32(ADR_PIN_SEL_1)) = (((_VAL_) << 1) | ((REG32(ADR_PIN_SEL_1)) & 0xfffffffd)) ++#define SET_IO_PORT_REG(_VAL_) (REG32(ADR_IO_PORT_REG)) = (((_VAL_) << 0) | ((REG32(ADR_IO_PORT_REG)) & 0xfffe0000)) ++#define SET_MASK_RX_INT(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 0) | ((REG32(ADR_INT_MASK_REG)) & 0xfffffffe)) ++#define SET_MASK_TX_INT(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 1) | ((REG32(ADR_INT_MASK_REG)) & 0xfffffffd)) ++#define SET_MASK_SOC_SYSTEM_INT(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 2) | ((REG32(ADR_INT_MASK_REG)) & 0xfffffffb)) ++#define SET_EDCA0_LOW_THR_INT_MASK(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 3) | ((REG32(ADR_INT_MASK_REG)) & 0xfffffff7)) ++#define SET_EDCA1_LOW_THR_INT_MASK(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 4) | ((REG32(ADR_INT_MASK_REG)) & 0xffffffef)) ++#define SET_EDCA2_LOW_THR_INT_MASK(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 5) | ((REG32(ADR_INT_MASK_REG)) & 0xffffffdf)) ++#define SET_EDCA3_LOW_THR_INT_MASK(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 6) | ((REG32(ADR_INT_MASK_REG)) & 0xffffffbf)) ++#define SET_TX_LIMIT_INT_MASK(_VAL_) (REG32(ADR_INT_MASK_REG)) = (((_VAL_) << 7) | ((REG32(ADR_INT_MASK_REG)) & 0xffffff7f)) ++#define SET_RX_INT(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 0) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffffe)) ++#define SET_TX_COMPLETE_INT(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 1) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffffd)) ++#define SET_SOC_SYSTEM_INT_STATUS(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 2) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffffb)) ++#define SET_EDCA0_LOW_THR_INT_STS(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 3) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffff7)) ++#define SET_EDCA1_LOW_THR_INT_STS(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 4) | ((REG32(ADR_INT_STATUS_REG)) & 0xffffffef)) ++#define SET_EDCA2_LOW_THR_INT_STS(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 5) | ((REG32(ADR_INT_STATUS_REG)) & 0xffffffdf)) ++#define SET_EDCA3_LOW_THR_INT_STS(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 6) | ((REG32(ADR_INT_STATUS_REG)) & 0xffffffbf)) ++#define SET_TX_LIMIT_INT_STS(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 7) | ((REG32(ADR_INT_STATUS_REG)) & 0xffffff7f)) ++#define SET_HOST_TRIGGERED_RX_INT(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 8) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffeff)) ++#define SET_HOST_TRIGGERED_TX_INT(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 9) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffdff)) ++#define SET_SOC_TRIGGER_RX_INT(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 10) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffffbff)) ++#define SET_SOC_TRIGGER_TX_INT(_VAL_) (REG32(ADR_INT_STATUS_REG)) = (((_VAL_) << 11) | ((REG32(ADR_INT_STATUS_REG)) & 0xfffff7ff)) ++#define SET_RDY_FOR_TX_RX(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 0) | ((REG32(ADR_FN1_STATUS_REG)) & 0xfffffffe)) ++#define SET_RDY_FOR_FW_DOWNLOAD(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 1) | ((REG32(ADR_FN1_STATUS_REG)) & 0xfffffffd)) ++#define SET_ILLEGAL_CMD_RESP_OPTION(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 2) | ((REG32(ADR_FN1_STATUS_REG)) & 0xfffffffb)) ++#define SET_SDIO_TRX_DATA_SEQUENCE(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 3) | ((REG32(ADR_FN1_STATUS_REG)) & 0xfffffff7)) ++#define SET_GPIO_INT_TRIGGER_OPTION(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 4) | ((REG32(ADR_FN1_STATUS_REG)) & 0xffffffef)) ++#define SET_TRIGGER_FUNCTION_SETTING(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 5) | ((REG32(ADR_FN1_STATUS_REG)) & 0xffffff9f)) ++#define SET_CMD52_ABORT_RESPONSE(_VAL_) (REG32(ADR_FN1_STATUS_REG)) = (((_VAL_) << 7) | ((REG32(ADR_FN1_STATUS_REG)) & 0xffffff7f)) ++#define SET_RX_PACKET_LENGTH(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 0) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xffff0000)) ++#define SET_CARD_FW_DL_STATUS(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 16) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xff00ffff)) ++#define SET_TX_RX_LOOP_BACK_TEST(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 24) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xfeffffff)) ++#define SET_SDIO_LOOP_BACK_TEST(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 25) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xfdffffff)) ++#define SET_CMD52_ABORT_ACTIVE(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 28) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xefffffff)) ++#define SET_CMD52_RESET_ACTIVE(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 29) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xdfffffff)) ++#define SET_SDIO_PARTIAL_RESET_ACTIVE(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 30) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0xbfffffff)) ++#define SET_SDIO_ALL_RESE_ACTIVE(_VAL_) (REG32(ADR_CARD_PKT_STATUS_TEST)) = (((_VAL_) << 31) | ((REG32(ADR_CARD_PKT_STATUS_TEST)) & 0x7fffffff)) ++#define SET_RX_PACKET_LENGTH2(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xffff0000)) ++#define SET_RX_INT1(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 16) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xfffeffff)) ++#define SET_TX_DONE(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 17) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xfffdffff)) ++#define SET_HCI_TRX_FINISH(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 18) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xfffbffff)) ++#define SET_ALLOCATE_STATUS(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 19) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xfff7ffff)) ++#define SET_HCI_INPUT_FF_CNT(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 20) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xff0fffff)) ++#define SET_HCI_OUTPUT_FF_CNT(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 24) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xe0ffffff)) ++#define SET_AHB_HANG4(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 29) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xdfffffff)) ++#define SET_HCI_IN_QUE_EMPTY(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 30) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0xbfffffff)) ++#define SET_SYSTEM_INT(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REG)) = (((_VAL_) << 31) | ((REG32(ADR_SYSTEM_INFORMATION_REG)) & 0x7fffffff)) ++#define SET_CARD_RCA_REG(_VAL_) (REG32(ADR_CARD_RCA_REG)) = (((_VAL_) << 0) | ((REG32(ADR_CARD_RCA_REG)) & 0xffff0000)) ++#define SET_SDIO_FIFO_WR_THLD_REG(_VAL_) (REG32(ADR_SDIO_FIFO_WR_THLD_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_FIFO_WR_THLD_REG)) & 0xfffffe00)) ++#define SET_SDIO_FIFO_WR_LIMIT_REG(_VAL_) (REG32(ADR_SDIO_FIFO_WR_LIMIT_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_FIFO_WR_LIMIT_REG)) & 0xfffffe00)) ++#define SET_SDIO_TX_DATA_BATCH_SIZE_REG(_VAL_) (REG32(ADR_SDIO_TX_DATA_BATCH_SIZE_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_TX_DATA_BATCH_SIZE_REG)) & 0xfffffe00)) ++#define SET_SDIO_THLD_FOR_CMD53RD_REG(_VAL_) (REG32(ADR_SDIO_THLD_FOR_CMD53RD_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_THLD_FOR_CMD53RD_REG)) & 0xfffffe00)) ++#define SET_SDIO_RX_DATA_BATCH_SIZE_REG(_VAL_) (REG32(ADR_SDIO_RX_DATA_BATCH_SIZE_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_RX_DATA_BATCH_SIZE_REG)) & 0xfffffe00)) ++#define SET_START_BYTE_VALUE(_VAL_) (REG32(ADR_SDIO_LOG_START_END_DATA_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_LOG_START_END_DATA_REG)) & 0xffffff00)) ++#define SET_END_BYTE_VALUE(_VAL_) (REG32(ADR_SDIO_LOG_START_END_DATA_REG)) = (((_VAL_) << 8) | ((REG32(ADR_SDIO_LOG_START_END_DATA_REG)) & 0xffff00ff)) ++#define SET_SDIO_BYTE_MODE_BATCH_SIZE_REG(_VAL_) (REG32(ADR_SDIO_BYTE_MODE_BATCH_SIZE_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_BYTE_MODE_BATCH_SIZE_REG)) & 0xffffff00)) ++#define SET_SDIO_LAST_CMD_INDEX_REG(_VAL_) (REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) & 0xffffffc0)) ++#define SET_SDIO_LAST_CMD_CRC_REG(_VAL_) (REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) = (((_VAL_) << 8) | ((REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) & 0xffff80ff)) ++#define SET_SDIO_LAST_CMD_ARG_REG(_VAL_) (REG32(ADR_SDIO_LAST_CMD_ARG_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_LAST_CMD_ARG_REG)) & 0x00000000)) ++#define SET_SDIO_BUS_STATE_REG(_VAL_) (REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) & 0xffffffe0)) ++#define SET_SDIO_BUSY_LONG_CNT(_VAL_) (REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) & 0x0000ffff)) ++#define SET_SDIO_CARD_STATUS_REG(_VAL_) (REG32(ADR_SDIO_CARD_STATUS_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_CARD_STATUS_REG)) & 0x00000000)) ++#define SET_R5_RESPONSE_FLAG(_VAL_) (REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) = (((_VAL_) << 0) | ((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0xffffff00)) ++#define SET_RESP_OUT_EDGE(_VAL_) (REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) = (((_VAL_) << 8) | ((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0xfffffeff)) ++#define SET_DAT_OUT_EDGE(_VAL_) (REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) = (((_VAL_) << 9) | ((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0xfffffdff)) ++#define SET_MCU_TO_SDIO_INFO_MASK(_VAL_) (REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) = (((_VAL_) << 16) | ((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0xfffeffff)) ++#define SET_INT_THROUGH_PIN(_VAL_) (REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) = (((_VAL_) << 17) | ((REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) & 0xfffdffff)) ++#define SET_WRITE_DATA(_VAL_) (REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) = (((_VAL_) << 0) | ((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0xffffff00)) ++#define SET_WRITE_ADDRESS(_VAL_) (REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) = (((_VAL_) << 8) | ((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0xffff00ff)) ++#define SET_READ_DATA(_VAL_) (REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) = (((_VAL_) << 16) | ((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0xff00ffff)) ++#define SET_READ_ADDRESS(_VAL_) (REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) = (((_VAL_) << 24) | ((REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) & 0x00ffffff)) ++#define SET_FN1_DMA_START_ADDR_REG(_VAL_) (REG32(ADR_FN1_DMA_START_ADDR_REG)) = (((_VAL_) << 0) | ((REG32(ADR_FN1_DMA_START_ADDR_REG)) & 0x00000000)) ++#define SET_SDIO_TO_MCU_INFO(_VAL_) (REG32(ADR_FN1_INT_CTRL_RESET)) = (((_VAL_) << 0) | ((REG32(ADR_FN1_INT_CTRL_RESET)) & 0xffffff00)) ++#define SET_SDIO_PARTIAL_RESET(_VAL_) (REG32(ADR_FN1_INT_CTRL_RESET)) = (((_VAL_) << 8) | ((REG32(ADR_FN1_INT_CTRL_RESET)) & 0xfffffeff)) ++#define SET_SDIO_ALL_RESET(_VAL_) (REG32(ADR_FN1_INT_CTRL_RESET)) = (((_VAL_) << 9) | ((REG32(ADR_FN1_INT_CTRL_RESET)) & 0xfffffdff)) ++#define SET_PERI_MAC_ALL_RESET(_VAL_) (REG32(ADR_FN1_INT_CTRL_RESET)) = (((_VAL_) << 10) | ((REG32(ADR_FN1_INT_CTRL_RESET)) & 0xfffffbff)) ++#define SET_MAC_ALL_RESET(_VAL_) (REG32(ADR_FN1_INT_CTRL_RESET)) = (((_VAL_) << 11) | ((REG32(ADR_FN1_INT_CTRL_RESET)) & 0xfffff7ff)) ++#define SET_AHB_BRIDGE_RESET(_VAL_) (REG32(ADR_FN1_INT_CTRL_RESET)) = (((_VAL_) << 12) | ((REG32(ADR_FN1_INT_CTRL_RESET)) & 0xffffefff)) ++#define SET_IO_REG_PORT_REG(_VAL_) (REG32(ADR_IO_REG_PORT_REG)) = (((_VAL_) << 0) | ((REG32(ADR_IO_REG_PORT_REG)) & 0xfffe0000)) ++#define SET_SDIO_FIFO_EMPTY_CNT(_VAL_) (REG32(ADR_SDIO_FIFO_ERROR_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_FIFO_ERROR_CNT)) & 0xffff0000)) ++#define SET_SDIO_FIFO_FULL_CNT(_VAL_) (REG32(ADR_SDIO_FIFO_ERROR_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_FIFO_ERROR_CNT)) & 0x0000ffff)) ++#define SET_SDIO_CRC7_ERROR_CNT(_VAL_) (REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) & 0xffff0000)) ++#define SET_SDIO_CRC16_ERROR_CNT(_VAL_) (REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) & 0x0000ffff)) ++#define SET_SDIO_RD_BLOCK_CNT(_VAL_) (REG32(ADR_SDIO_BLOCK_CNT_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_BLOCK_CNT_INFO)) & 0xfffffe00)) ++#define SET_SDIO_WR_BLOCK_CNT(_VAL_) (REG32(ADR_SDIO_BLOCK_CNT_INFO)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_BLOCK_CNT_INFO)) & 0xfe00ffff)) ++#define SET_CMD52_RD_ABORT_CNT(_VAL_) (REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) = (((_VAL_) << 16) | ((REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) & 0xfff0ffff)) ++#define SET_CMD52_WR_ABORT_CNT(_VAL_) (REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) = (((_VAL_) << 20) | ((REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) & 0xff0fffff)) ++#define SET_SDIO_FIFO_WR_PTR_REG(_VAL_) (REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) & 0xffffff00)) ++#define SET_SDIO_FIFO_RD_PTR_REG(_VAL_) (REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) = (((_VAL_) << 8) | ((REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) & 0xffff00ff)) ++#define SET_SDIO_READ_DATA_CTRL(_VAL_) (REG32(ADR_TX_TIME_OUT_READ_CTRL)) = (((_VAL_) << 16) | ((REG32(ADR_TX_TIME_OUT_READ_CTRL)) & 0xfffeffff)) ++#define SET_TX_SIZE_BEFORE_SHIFT(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xffffff00)) ++#define SET_TX_SIZE_SHIFT_BITS(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 8) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xfffff8ff)) ++#define SET_SDIO_TX_ALLOC_STATE(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 12) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xffffefff)) ++#define SET_ALLOCATE_STATUS2(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xfffeffff)) ++#define SET_NO_ALLOCATE_SEND_ERROR(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 17) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xfffdffff)) ++#define SET_DOUBLE_ALLOCATE_ERROR(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 18) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xfffbffff)) ++#define SET_TX_DONE_STATUS(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 19) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xfff7ffff)) ++#define SET_AHB_HANG2(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 20) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xffefffff)) ++#define SET_HCI_TRX_FINISH2(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 21) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xffdfffff)) ++#define SET_INTR_RX(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 22) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xffbfffff)) ++#define SET_HCI_INPUT_QUEUE_FULL(_VAL_) (REG32(ADR_SDIO_TX_ALLOC_REG)) = (((_VAL_) << 23) | ((REG32(ADR_SDIO_TX_ALLOC_REG)) & 0xff7fffff)) ++#define SET_ALLOCATESTATUS(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xfffffffe)) ++#define SET_HCI_TRX_FINISH3(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 1) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xfffffffd)) ++#define SET_HCI_IN_QUE_EMPTY2(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 2) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xfffffffb)) ++#define SET_MTX_MNG_UPTHOLD_INT(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 3) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xfffffff7)) ++#define SET_EDCA0_UPTHOLD_INT(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 4) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xffffffef)) ++#define SET_EDCA1_UPTHOLD_INT(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 5) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xffffffdf)) ++#define SET_EDCA2_UPTHOLD_INT(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 6) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xffffffbf)) ++#define SET_EDCA3_UPTHOLD_INT(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 7) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xffffff7f)) ++#define SET_TX_PAGE_REMAIN2(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 8) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xffff00ff)) ++#define SET_TX_ID_REMAIN3(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xff80ffff)) ++#define SET_HCI_OUTPUT_FF_CNT_0(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 23) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xff7fffff)) ++#define SET_HCI_OUTPUT_FF_CNT2(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 24) | ((REG32(ADR_SDIO_TX_INFORM)) & 0xf0ffffff)) ++#define SET_HCI_INPUT_FF_CNT2(_VAL_) (REG32(ADR_SDIO_TX_INFORM)) = (((_VAL_) << 28) | ((REG32(ADR_SDIO_TX_INFORM)) & 0x0fffffff)) ++#define SET_F1_BLOCK_SIZE_0_REG(_VAL_) (REG32(ADR_F1_BLOCK_SIZE_0_REG)) = (((_VAL_) << 0) | ((REG32(ADR_F1_BLOCK_SIZE_0_REG)) & 0xfffff000)) ++#define SET_START_BYTE_VALUE2(_VAL_) (REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) & 0xffffff00)) ++#define SET_COMMAND_COUNTER(_VAL_) (REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) = (((_VAL_) << 8) | ((REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) & 0xffff00ff)) ++#define SET_CMD_LOG_PART1(_VAL_) (REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) & 0x0000ffff)) ++#define SET_CMD_LOG_PART2(_VAL_) (REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) & 0xff000000)) ++#define SET_END_BYTE_VALUE2(_VAL_) (REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) = (((_VAL_) << 24) | ((REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) & 0x00ffffff)) ++#define SET_RX_PACKET_LENGTH3(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0xffff0000)) ++#define SET_RX_INT3(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0xfffeffff)) ++#define SET_TX_ID_REMAIN2(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REGISTER)) = (((_VAL_) << 17) | ((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0xff01ffff)) ++#define SET_TX_PAGE_REMAIN3(_VAL_) (REG32(ADR_SYSTEM_INFORMATION_REGISTER)) = (((_VAL_) << 24) | ((REG32(ADR_SYSTEM_INFORMATION_REGISTER)) & 0x00ffffff)) ++#define SET_CCCR_00H_REG(_VAL_) (REG32(ADR_CCCR_00H_REG)) = (((_VAL_) << 0) | ((REG32(ADR_CCCR_00H_REG)) & 0xffffff00)) ++#define SET_CCCR_02H_REG(_VAL_) (REG32(ADR_CCCR_00H_REG)) = (((_VAL_) << 16) | ((REG32(ADR_CCCR_00H_REG)) & 0xff00ffff)) ++#define SET_CCCR_03H_REG(_VAL_) (REG32(ADR_CCCR_00H_REG)) = (((_VAL_) << 24) | ((REG32(ADR_CCCR_00H_REG)) & 0x00ffffff)) ++#define SET_CCCR_04H_REG(_VAL_) (REG32(ADR_CCCR_04H_REG)) = (((_VAL_) << 0) | ((REG32(ADR_CCCR_04H_REG)) & 0xffffff00)) ++#define SET_CCCR_05H_REG(_VAL_) (REG32(ADR_CCCR_04H_REG)) = (((_VAL_) << 8) | ((REG32(ADR_CCCR_04H_REG)) & 0xffff00ff)) ++#define SET_CCCR_06H_REG(_VAL_) (REG32(ADR_CCCR_04H_REG)) = (((_VAL_) << 16) | ((REG32(ADR_CCCR_04H_REG)) & 0xfff0ffff)) ++#define SET_CCCR_07H_REG(_VAL_) (REG32(ADR_CCCR_04H_REG)) = (((_VAL_) << 24) | ((REG32(ADR_CCCR_04H_REG)) & 0x00ffffff)) ++#define SET_SUPPORT_DIRECT_COMMAND_SDIO(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 0) | ((REG32(ADR_CCCR_08H_REG)) & 0xfffffffe)) ++#define SET_SUPPORT_MULTIPLE_BLOCK_TRANSFER(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 1) | ((REG32(ADR_CCCR_08H_REG)) & 0xfffffffd)) ++#define SET_SUPPORT_READ_WAIT(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 2) | ((REG32(ADR_CCCR_08H_REG)) & 0xfffffffb)) ++#define SET_SUPPORT_BUS_CONTROL(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 3) | ((REG32(ADR_CCCR_08H_REG)) & 0xfffffff7)) ++#define SET_SUPPORT_BLOCK_GAP_INTERRUPT(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 4) | ((REG32(ADR_CCCR_08H_REG)) & 0xffffffef)) ++#define SET_ENABLE_BLOCK_GAP_INTERRUPT(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 5) | ((REG32(ADR_CCCR_08H_REG)) & 0xffffffdf)) ++#define SET_LOW_SPEED_CARD(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 6) | ((REG32(ADR_CCCR_08H_REG)) & 0xffffffbf)) ++#define SET_LOW_SPEED_CARD_4BIT(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 7) | ((REG32(ADR_CCCR_08H_REG)) & 0xffffff7f)) ++#define SET_COMMON_CIS_PONTER(_VAL_) (REG32(ADR_CCCR_08H_REG)) = (((_VAL_) << 8) | ((REG32(ADR_CCCR_08H_REG)) & 0xfe0000ff)) ++#define SET_SUPPORT_HIGH_SPEED(_VAL_) (REG32(ADR_CCCR_13H_REG)) = (((_VAL_) << 24) | ((REG32(ADR_CCCR_13H_REG)) & 0xfeffffff)) ++#define SET_BSS(_VAL_) (REG32(ADR_CCCR_13H_REG)) = (((_VAL_) << 25) | ((REG32(ADR_CCCR_13H_REG)) & 0xf1ffffff)) ++#define SET_FBR_100H_REG(_VAL_) (REG32(ADR_FBR_100H_REG)) = (((_VAL_) << 0) | ((REG32(ADR_FBR_100H_REG)) & 0xfffffff0)) ++#define SET_CSASUPPORT(_VAL_) (REG32(ADR_FBR_100H_REG)) = (((_VAL_) << 6) | ((REG32(ADR_FBR_100H_REG)) & 0xffffffbf)) ++#define SET_ENABLECSA(_VAL_) (REG32(ADR_FBR_100H_REG)) = (((_VAL_) << 7) | ((REG32(ADR_FBR_100H_REG)) & 0xffffff7f)) ++#define SET_FBR_101H_REG(_VAL_) (REG32(ADR_FBR_100H_REG)) = (((_VAL_) << 8) | ((REG32(ADR_FBR_100H_REG)) & 0xffff00ff)) ++#define SET_FBR_109H_REG(_VAL_) (REG32(ADR_FBR_109H_REG)) = (((_VAL_) << 8) | ((REG32(ADR_FBR_109H_REG)) & 0xfe0000ff)) ++#define SET_F0_CIS_CONTENT_REG_31_0(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_0)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_0)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_63_32(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_1)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_1)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_95_64(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_2)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_2)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_127_96(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_3)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_3)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_159_128(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_4)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_4)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_191_160(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_5)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_5)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_223_192(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_6)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_6)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_255_224(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_7)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_7)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_287_256(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_8)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_8)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_319_288(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_9)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_9)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_351_320(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_10)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_10)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_383_352(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_11)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_11)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_415_384(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_12)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_12)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_447_416(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_13)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_13)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_479_448(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_14)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_14)) & 0x00000000)) ++#define SET_F0_CIS_CONTENT_REG_511_480(_VAL_) (REG32(ADR_F0_CIS_CONTENT_REG_15)) = (((_VAL_) << 0) | ((REG32(ADR_F0_CIS_CONTENT_REG_15)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_31_0(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_0)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_0)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_63_32(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_1)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_1)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_95_64(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_2)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_2)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_127_96(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_3)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_3)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_159_128(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_4)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_4)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_191_160(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_5)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_5)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_223_192(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_6)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_6)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_255_224(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_7)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_7)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_287_256(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_8)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_8)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_319_288(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_9)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_9)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_351_320(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_10)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_10)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_383_352(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_11)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_11)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_415_384(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_12)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_12)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_447_416(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_13)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_13)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_479_448(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_14)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_14)) & 0x00000000)) ++#define SET_F1_CIS_CONTENT_REG_511_480(_VAL_) (REG32(ADR_F1_CIS_CONTENT_REG_15)) = (((_VAL_) << 0) | ((REG32(ADR_F1_CIS_CONTENT_REG_15)) & 0x00000000)) ++#define SET_SPI_MODE(_VAL_) (REG32(ADR_SPI_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_SPI_MODE)) & 0x00000000)) ++#define SET_RX_QUOTA(_VAL_) (REG32(ADR_RX_QUOTA)) = (((_VAL_) << 0) | ((REG32(ADR_RX_QUOTA)) & 0xffff0000)) ++#define SET_CONDI_NUM(_VAL_) (REG32(ADR_CONDITION_NUMBER)) = (((_VAL_) << 0) | ((REG32(ADR_CONDITION_NUMBER)) & 0xffffff00)) ++#define SET_HOST_PATH(_VAL_) (REG32(ADR_HOST_PATH)) = (((_VAL_) << 0) | ((REG32(ADR_HOST_PATH)) & 0xfffffffe)) ++#define SET_TX_SEG(_VAL_) (REG32(ADR_TX_SEG)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEG)) & 0x00000000)) ++#define SET_BRST_MODE(_VAL_) (REG32(ADR_DEBUG_BURST_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_DEBUG_BURST_MODE)) & 0xfffffffe)) ++#define SET_CLK_WIDTH(_VAL_) (REG32(ADR_SPI_TO_PHY_PARAM1)) = (((_VAL_) << 0) | ((REG32(ADR_SPI_TO_PHY_PARAM1)) & 0xffff0000)) ++#define SET_CSN_INTER(_VAL_) (REG32(ADR_SPI_TO_PHY_PARAM1)) = (((_VAL_) << 16) | ((REG32(ADR_SPI_TO_PHY_PARAM1)) & 0x0000ffff)) ++#define SET_BACK_DLY(_VAL_) (REG32(ADR_SPI_TO_PHY_PARAM2)) = (((_VAL_) << 0) | ((REG32(ADR_SPI_TO_PHY_PARAM2)) & 0xffff0000)) ++#define SET_FRONT_DLY(_VAL_) (REG32(ADR_SPI_TO_PHY_PARAM2)) = (((_VAL_) << 16) | ((REG32(ADR_SPI_TO_PHY_PARAM2)) & 0x0000ffff)) ++#define SET_RX_FIFO_FAIL(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 1) | ((REG32(ADR_SPI_STS)) & 0xfffffffd)) ++#define SET_RX_HOST_FAIL(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 2) | ((REG32(ADR_SPI_STS)) & 0xfffffffb)) ++#define SET_TX_FIFO_FAIL(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 3) | ((REG32(ADR_SPI_STS)) & 0xfffffff7)) ++#define SET_TX_HOST_FAIL(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 4) | ((REG32(ADR_SPI_STS)) & 0xffffffef)) ++#define SET_SPI_DOUBLE_ALLOC(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 5) | ((REG32(ADR_SPI_STS)) & 0xffffffdf)) ++#define SET_SPI_TX_NO_ALLOC(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 6) | ((REG32(ADR_SPI_STS)) & 0xffffffbf)) ++#define SET_RDATA_RDY(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 7) | ((REG32(ADR_SPI_STS)) & 0xffffff7f)) ++#define SET_SPI_ALLOC_STATUS(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 8) | ((REG32(ADR_SPI_STS)) & 0xfffffeff)) ++#define SET_SPI_DBG_WR_FIFO_FULL(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 9) | ((REG32(ADR_SPI_STS)) & 0xfffffdff)) ++#define SET_RX_LEN(_VAL_) (REG32(ADR_SPI_STS)) = (((_VAL_) << 16) | ((REG32(ADR_SPI_STS)) & 0x0000ffff)) ++#define SET_SPI_TX_ALLOC_SIZE_SHIFT_BITS(_VAL_) (REG32(ADR_TX_ALLOC_SET)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ALLOC_SET)) & 0xfffffff8)) ++#define SET_SPI_HOST_TX_ALLOC_PKBUF(_VAL_) (REG32(ADR_TX_ALLOC_SET)) = (((_VAL_) << 8) | ((REG32(ADR_TX_ALLOC_SET)) & 0xfffffeff)) ++#define SET_SPI_TX_ALLOC_SIZE(_VAL_) (REG32(ADR_TX_ALLOC)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ALLOC)) & 0xffffff00)) ++#define SET_RD_DAT_CNT(_VAL_) (REG32(ADR_DBG_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_CNT)) & 0xffff0000)) ++#define SET_RD_STS_CNT(_VAL_) (REG32(ADR_DBG_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_CNT)) & 0x0000ffff)) ++#define SET_JUDGE_CNT(_VAL_) (REG32(ADR_DBG_CNT2)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_CNT2)) & 0xffff0000)) ++#define SET_RD_STS_CNT_CLR(_VAL_) (REG32(ADR_DBG_CNT2)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_CNT2)) & 0xfffeffff)) ++#define SET_RD_DAT_CNT_CLR(_VAL_) (REG32(ADR_DBG_CNT2)) = (((_VAL_) << 17) | ((REG32(ADR_DBG_CNT2)) & 0xfffdffff)) ++#define SET_JUDGE_CNT_CLR(_VAL_) (REG32(ADR_DBG_CNT2)) = (((_VAL_) << 18) | ((REG32(ADR_DBG_CNT2)) & 0xfffbffff)) ++#define SET_TX_DONE_CNT(_VAL_) (REG32(ADR_DBG_CNT3)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_CNT3)) & 0xffff0000)) ++#define SET_TX_DISCARD_CNT(_VAL_) (REG32(ADR_DBG_CNT3)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_CNT3)) & 0x0000ffff)) ++#define SET_TX_SET_CNT(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_CNT4)) & 0xffff0000)) ++#define SET_TX_DISCARD_CNT_CLR(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_CNT4)) & 0xfffeffff)) ++#define SET_TX_DONE_CNT_CLR(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 17) | ((REG32(ADR_DBG_CNT4)) & 0xfffdffff)) ++#define SET_TX_SET_CNT_CLR(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 18) | ((REG32(ADR_DBG_CNT4)) & 0xfffbffff)) ++#define SET_DAT_MODE_OFF(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 19) | ((REG32(ADR_DBG_CNT4)) & 0xfff7ffff)) ++#define SET_TX_FIFO_RESIDUE(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 20) | ((REG32(ADR_DBG_CNT4)) & 0xff8fffff)) ++#define SET_RX_FIFO_RESIDUE(_VAL_) (REG32(ADR_DBG_CNT4)) = (((_VAL_) << 24) | ((REG32(ADR_DBG_CNT4)) & 0xf8ffffff)) ++#define SET_RX_RDY(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 0) | ((REG32(ADR_INT_TAG)) & 0xfffffffe)) ++#define SET_SDIO_SYS_INT(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 2) | ((REG32(ADR_INT_TAG)) & 0xfffffffb)) ++#define SET_EDCA0_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 3) | ((REG32(ADR_INT_TAG)) & 0xfffffff7)) ++#define SET_EDCA1_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 4) | ((REG32(ADR_INT_TAG)) & 0xffffffef)) ++#define SET_EDCA2_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 5) | ((REG32(ADR_INT_TAG)) & 0xffffffdf)) ++#define SET_EDCA3_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 6) | ((REG32(ADR_INT_TAG)) & 0xffffffbf)) ++#define SET_TX_LIMIT_INT_IN(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 7) | ((REG32(ADR_INT_TAG)) & 0xffffff7f)) ++#define SET_SPI_FN1(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 8) | ((REG32(ADR_INT_TAG)) & 0xffff80ff)) ++#define SET_SPI_CLK_EN_INT(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 15) | ((REG32(ADR_INT_TAG)) & 0xffff7fff)) ++#define SET_SPI_HOST_MASK(_VAL_) (REG32(ADR_INT_TAG)) = (((_VAL_) << 16) | ((REG32(ADR_INT_TAG)) & 0xff00ffff)) ++#define SET_I2CM_INT_WDONE(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 0) | ((REG32(ADR_I2CM_EN)) & 0xfffffffe)) ++#define SET_I2CM_INT_RDONE(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 1) | ((REG32(ADR_I2CM_EN)) & 0xfffffffd)) ++#define SET_I2CM_IDLE(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 2) | ((REG32(ADR_I2CM_EN)) & 0xfffffffb)) ++#define SET_I2CM_INT_MISMATCH(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 3) | ((REG32(ADR_I2CM_EN)) & 0xfffffff7)) ++#define SET_I2CM_PSCL(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 4) | ((REG32(ADR_I2CM_EN)) & 0xffffc00f)) ++#define SET_I2CM_MANUAL_MODE(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 16) | ((REG32(ADR_I2CM_EN)) & 0xfffeffff)) ++#define SET_I2CM_INT_WDATA_NEED(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 17) | ((REG32(ADR_I2CM_EN)) & 0xfffdffff)) ++#define SET_I2CM_INT_RDATA_NEED(_VAL_) (REG32(ADR_I2CM_EN)) = (((_VAL_) << 18) | ((REG32(ADR_I2CM_EN)) & 0xfffbffff)) ++#define SET_I2CM_DEV_A(_VAL_) (REG32(ADR_I2CM_DEV_A)) = (((_VAL_) << 0) | ((REG32(ADR_I2CM_DEV_A)) & 0xfffffc00)) ++#define SET_I2CM_DEV_A10B(_VAL_) (REG32(ADR_I2CM_DEV_A)) = (((_VAL_) << 14) | ((REG32(ADR_I2CM_DEV_A)) & 0xffffbfff)) ++#define SET_I2CM_RX(_VAL_) (REG32(ADR_I2CM_DEV_A)) = (((_VAL_) << 15) | ((REG32(ADR_I2CM_DEV_A)) & 0xffff7fff)) ++#define SET_I2CM_LEN(_VAL_) (REG32(ADR_I2CM_LEN)) = (((_VAL_) << 0) | ((REG32(ADR_I2CM_LEN)) & 0xffff0000)) ++#define SET_I2CM_T_LEFT(_VAL_) (REG32(ADR_I2CM_LEN)) = (((_VAL_) << 16) | ((REG32(ADR_I2CM_LEN)) & 0xfff8ffff)) ++#define SET_I2CM_R_GET(_VAL_) (REG32(ADR_I2CM_LEN)) = (((_VAL_) << 24) | ((REG32(ADR_I2CM_LEN)) & 0xf8ffffff)) ++#define SET_I2CM_WDAT(_VAL_) (REG32(ADR_I2CM_WDAT)) = (((_VAL_) << 0) | ((REG32(ADR_I2CM_WDAT)) & 0x00000000)) ++#define SET_I2CM_RDAT(_VAL_) (REG32(ADR_I2CM_RDAT)) = (((_VAL_) << 0) | ((REG32(ADR_I2CM_RDAT)) & 0x00000000)) ++#define SET_I2CM_SR_LEN(_VAL_) (REG32(ADR_I2CM_EN_2)) = (((_VAL_) << 0) | ((REG32(ADR_I2CM_EN_2)) & 0xffff0000)) ++#define SET_I2CM_SR_RX(_VAL_) (REG32(ADR_I2CM_EN_2)) = (((_VAL_) << 16) | ((REG32(ADR_I2CM_EN_2)) & 0xfffeffff)) ++#define SET_I2CM_REPEAT_START(_VAL_) (REG32(ADR_I2CM_EN_2)) = (((_VAL_) << 17) | ((REG32(ADR_I2CM_EN_2)) & 0xfffdffff)) ++#define SET_UART_DATA(_VAL_) (REG32(ADR_UART_DATA)) = (((_VAL_) << 0) | ((REG32(ADR_UART_DATA)) & 0xffffff00)) ++#define SET_DATA_RDY_IE(_VAL_) (REG32(ADR_UART_IER)) = (((_VAL_) << 0) | ((REG32(ADR_UART_IER)) & 0xfffffffe)) ++#define SET_THR_EMPTY_IE(_VAL_) (REG32(ADR_UART_IER)) = (((_VAL_) << 1) | ((REG32(ADR_UART_IER)) & 0xfffffffd)) ++#define SET_RX_LINESTS_IE(_VAL_) (REG32(ADR_UART_IER)) = (((_VAL_) << 2) | ((REG32(ADR_UART_IER)) & 0xfffffffb)) ++#define SET_MDM_STS_IE(_VAL_) (REG32(ADR_UART_IER)) = (((_VAL_) << 3) | ((REG32(ADR_UART_IER)) & 0xfffffff7)) ++#define SET_DMA_RXEND_IE(_VAL_) (REG32(ADR_UART_IER)) = (((_VAL_) << 6) | ((REG32(ADR_UART_IER)) & 0xffffffbf)) ++#define SET_DMA_TXEND_IE(_VAL_) (REG32(ADR_UART_IER)) = (((_VAL_) << 7) | ((REG32(ADR_UART_IER)) & 0xffffff7f)) ++#define SET_FIFO_EN(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_FCR)) & 0xfffffffe)) ++#define SET_RXFIFO_RST(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 1) | ((REG32(ADR_UART_FCR)) & 0xfffffffd)) ++#define SET_TXFIFO_RST(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 2) | ((REG32(ADR_UART_FCR)) & 0xfffffffb)) ++#define SET_DMA_MODE(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 3) | ((REG32(ADR_UART_FCR)) & 0xfffffff7)) ++#define SET_EN_AUTO_RTS(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 4) | ((REG32(ADR_UART_FCR)) & 0xffffffef)) ++#define SET_EN_AUTO_CTS(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 5) | ((REG32(ADR_UART_FCR)) & 0xffffffdf)) ++#define SET_RXFIFO_TRGLVL(_VAL_) (REG32(ADR_UART_FCR)) = (((_VAL_) << 6) | ((REG32(ADR_UART_FCR)) & 0xffffff3f)) ++#define SET_WORD_LEN(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_LCR)) & 0xfffffffc)) ++#define SET_STOP_BIT(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 2) | ((REG32(ADR_UART_LCR)) & 0xfffffffb)) ++#define SET_PARITY_EN(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 3) | ((REG32(ADR_UART_LCR)) & 0xfffffff7)) ++#define SET_EVEN_PARITY(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 4) | ((REG32(ADR_UART_LCR)) & 0xffffffef)) ++#define SET_FORCE_PARITY(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 5) | ((REG32(ADR_UART_LCR)) & 0xffffffdf)) ++#define SET_SET_BREAK(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 6) | ((REG32(ADR_UART_LCR)) & 0xffffffbf)) ++#define SET_DLAB(_VAL_) (REG32(ADR_UART_LCR)) = (((_VAL_) << 7) | ((REG32(ADR_UART_LCR)) & 0xffffff7f)) ++#define SET_DTR(_VAL_) (REG32(ADR_UART_MCR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_MCR)) & 0xfffffffe)) ++#define SET_RTS(_VAL_) (REG32(ADR_UART_MCR)) = (((_VAL_) << 1) | ((REG32(ADR_UART_MCR)) & 0xfffffffd)) ++#define SET_OUT_1(_VAL_) (REG32(ADR_UART_MCR)) = (((_VAL_) << 2) | ((REG32(ADR_UART_MCR)) & 0xfffffffb)) ++#define SET_OUT_2(_VAL_) (REG32(ADR_UART_MCR)) = (((_VAL_) << 3) | ((REG32(ADR_UART_MCR)) & 0xfffffff7)) ++#define SET_LOOP_BACK(_VAL_) (REG32(ADR_UART_MCR)) = (((_VAL_) << 4) | ((REG32(ADR_UART_MCR)) & 0xffffffef)) ++#define SET_DATA_RDY(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_LSR)) & 0xfffffffe)) ++#define SET_OVERRUN_ERR(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 1) | ((REG32(ADR_UART_LSR)) & 0xfffffffd)) ++#define SET_PARITY_ERR(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 2) | ((REG32(ADR_UART_LSR)) & 0xfffffffb)) ++#define SET_FRAMING_ERR(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 3) | ((REG32(ADR_UART_LSR)) & 0xfffffff7)) ++#define SET_BREAK_INT(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 4) | ((REG32(ADR_UART_LSR)) & 0xffffffef)) ++#define SET_THR_EMPTY(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 5) | ((REG32(ADR_UART_LSR)) & 0xffffffdf)) ++#define SET_TX_EMPTY(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 6) | ((REG32(ADR_UART_LSR)) & 0xffffffbf)) ++#define SET_FIFODATA_ERR(_VAL_) (REG32(ADR_UART_LSR)) = (((_VAL_) << 7) | ((REG32(ADR_UART_LSR)) & 0xffffff7f)) ++#define SET_DELTA_CTS(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_MSR)) & 0xfffffffe)) ++#define SET_DELTA_DSR(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 1) | ((REG32(ADR_UART_MSR)) & 0xfffffffd)) ++#define SET_TRAILEDGE_RI(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 2) | ((REG32(ADR_UART_MSR)) & 0xfffffffb)) ++#define SET_DELTA_CD(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 3) | ((REG32(ADR_UART_MSR)) & 0xfffffff7)) ++#define SET_CTS(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 4) | ((REG32(ADR_UART_MSR)) & 0xffffffef)) ++#define SET_DSR(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 5) | ((REG32(ADR_UART_MSR)) & 0xffffffdf)) ++#define SET_RI(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 6) | ((REG32(ADR_UART_MSR)) & 0xffffffbf)) ++#define SET_CD(_VAL_) (REG32(ADR_UART_MSR)) = (((_VAL_) << 7) | ((REG32(ADR_UART_MSR)) & 0xffffff7f)) ++#define SET_BRDC_DIV(_VAL_) (REG32(ADR_UART_SPR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_SPR)) & 0xffff0000)) ++#define SET_RTHR_L(_VAL_) (REG32(ADR_UART_RTHR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_RTHR)) & 0xfffffff0)) ++#define SET_RTHR_H(_VAL_) (REG32(ADR_UART_RTHR)) = (((_VAL_) << 4) | ((REG32(ADR_UART_RTHR)) & 0xffffff0f)) ++#define SET_INT_IDCODE(_VAL_) (REG32(ADR_UART_ISR)) = (((_VAL_) << 0) | ((REG32(ADR_UART_ISR)) & 0xfffffff0)) ++#define SET_FIFOS_ENABLED(_VAL_) (REG32(ADR_UART_ISR)) = (((_VAL_) << 6) | ((REG32(ADR_UART_ISR)) & 0xffffff3f)) ++#define SET_DAT_UART_DATA(_VAL_) (REG32(ADR_DAT_UART_DATA)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_DATA)) & 0xffffff00)) ++#define SET_DAT_DATA_RDY_IE(_VAL_) (REG32(ADR_DAT_UART_IER)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_IER)) & 0xfffffffe)) ++#define SET_DAT_THR_EMPTY_IE(_VAL_) (REG32(ADR_DAT_UART_IER)) = (((_VAL_) << 1) | ((REG32(ADR_DAT_UART_IER)) & 0xfffffffd)) ++#define SET_DAT_RX_LINESTS_IE(_VAL_) (REG32(ADR_DAT_UART_IER)) = (((_VAL_) << 2) | ((REG32(ADR_DAT_UART_IER)) & 0xfffffffb)) ++#define SET_DAT_MDM_STS_IE(_VAL_) (REG32(ADR_DAT_UART_IER)) = (((_VAL_) << 3) | ((REG32(ADR_DAT_UART_IER)) & 0xfffffff7)) ++#define SET_DAT_DMA_RXEND_IE(_VAL_) (REG32(ADR_DAT_UART_IER)) = (((_VAL_) << 6) | ((REG32(ADR_DAT_UART_IER)) & 0xffffffbf)) ++#define SET_DAT_DMA_TXEND_IE(_VAL_) (REG32(ADR_DAT_UART_IER)) = (((_VAL_) << 7) | ((REG32(ADR_DAT_UART_IER)) & 0xffffff7f)) ++#define SET_DAT_FIFO_EN(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_FCR)) & 0xfffffffe)) ++#define SET_DAT_RXFIFO_RST(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 1) | ((REG32(ADR_DAT_UART_FCR)) & 0xfffffffd)) ++#define SET_DAT_TXFIFO_RST(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 2) | ((REG32(ADR_DAT_UART_FCR)) & 0xfffffffb)) ++#define SET_DAT_DMA_MODE(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 3) | ((REG32(ADR_DAT_UART_FCR)) & 0xfffffff7)) ++#define SET_DAT_EN_AUTO_RTS(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 4) | ((REG32(ADR_DAT_UART_FCR)) & 0xffffffef)) ++#define SET_DAT_EN_AUTO_CTS(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 5) | ((REG32(ADR_DAT_UART_FCR)) & 0xffffffdf)) ++#define SET_DAT_RXFIFO_TRGLVL(_VAL_) (REG32(ADR_DAT_UART_FCR)) = (((_VAL_) << 6) | ((REG32(ADR_DAT_UART_FCR)) & 0xffffff3f)) ++#define SET_DAT_WORD_LEN(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_LCR)) & 0xfffffffc)) ++#define SET_DAT_STOP_BIT(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 2) | ((REG32(ADR_DAT_UART_LCR)) & 0xfffffffb)) ++#define SET_DAT_PARITY_EN(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 3) | ((REG32(ADR_DAT_UART_LCR)) & 0xfffffff7)) ++#define SET_DAT_EVEN_PARITY(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 4) | ((REG32(ADR_DAT_UART_LCR)) & 0xffffffef)) ++#define SET_DAT_FORCE_PARITY(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 5) | ((REG32(ADR_DAT_UART_LCR)) & 0xffffffdf)) ++#define SET_DAT_SET_BREAK(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 6) | ((REG32(ADR_DAT_UART_LCR)) & 0xffffffbf)) ++#define SET_DAT_DLAB(_VAL_) (REG32(ADR_DAT_UART_LCR)) = (((_VAL_) << 7) | ((REG32(ADR_DAT_UART_LCR)) & 0xffffff7f)) ++#define SET_DAT_DTR(_VAL_) (REG32(ADR_DAT_UART_MCR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_MCR)) & 0xfffffffe)) ++#define SET_DAT_RTS(_VAL_) (REG32(ADR_DAT_UART_MCR)) = (((_VAL_) << 1) | ((REG32(ADR_DAT_UART_MCR)) & 0xfffffffd)) ++#define SET_DAT_OUT_1(_VAL_) (REG32(ADR_DAT_UART_MCR)) = (((_VAL_) << 2) | ((REG32(ADR_DAT_UART_MCR)) & 0xfffffffb)) ++#define SET_DAT_OUT_2(_VAL_) (REG32(ADR_DAT_UART_MCR)) = (((_VAL_) << 3) | ((REG32(ADR_DAT_UART_MCR)) & 0xfffffff7)) ++#define SET_DAT_LOOP_BACK(_VAL_) (REG32(ADR_DAT_UART_MCR)) = (((_VAL_) << 4) | ((REG32(ADR_DAT_UART_MCR)) & 0xffffffef)) ++#define SET_DAT_DATA_RDY(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_LSR)) & 0xfffffffe)) ++#define SET_DAT_OVERRUN_ERR(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 1) | ((REG32(ADR_DAT_UART_LSR)) & 0xfffffffd)) ++#define SET_DAT_PARITY_ERR(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 2) | ((REG32(ADR_DAT_UART_LSR)) & 0xfffffffb)) ++#define SET_DAT_FRAMING_ERR(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 3) | ((REG32(ADR_DAT_UART_LSR)) & 0xfffffff7)) ++#define SET_DAT_BREAK_INT(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 4) | ((REG32(ADR_DAT_UART_LSR)) & 0xffffffef)) ++#define SET_DAT_THR_EMPTY(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 5) | ((REG32(ADR_DAT_UART_LSR)) & 0xffffffdf)) ++#define SET_DAT_TX_EMPTY(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 6) | ((REG32(ADR_DAT_UART_LSR)) & 0xffffffbf)) ++#define SET_DAT_FIFODATA_ERR(_VAL_) (REG32(ADR_DAT_UART_LSR)) = (((_VAL_) << 7) | ((REG32(ADR_DAT_UART_LSR)) & 0xffffff7f)) ++#define SET_DAT_DELTA_CTS(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_MSR)) & 0xfffffffe)) ++#define SET_DAT_DELTA_DSR(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 1) | ((REG32(ADR_DAT_UART_MSR)) & 0xfffffffd)) ++#define SET_DAT_TRAILEDGE_RI(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 2) | ((REG32(ADR_DAT_UART_MSR)) & 0xfffffffb)) ++#define SET_DAT_DELTA_CD(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 3) | ((REG32(ADR_DAT_UART_MSR)) & 0xfffffff7)) ++#define SET_DAT_CTS(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 4) | ((REG32(ADR_DAT_UART_MSR)) & 0xffffffef)) ++#define SET_DAT_DSR(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 5) | ((REG32(ADR_DAT_UART_MSR)) & 0xffffffdf)) ++#define SET_DAT_RI(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 6) | ((REG32(ADR_DAT_UART_MSR)) & 0xffffffbf)) ++#define SET_DAT_CD(_VAL_) (REG32(ADR_DAT_UART_MSR)) = (((_VAL_) << 7) | ((REG32(ADR_DAT_UART_MSR)) & 0xffffff7f)) ++#define SET_DAT_BRDC_DIV(_VAL_) (REG32(ADR_DAT_UART_SPR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_SPR)) & 0xffff0000)) ++#define SET_DAT_RTHR_L(_VAL_) (REG32(ADR_DAT_UART_RTHR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_RTHR)) & 0xfffffff0)) ++#define SET_DAT_RTHR_H(_VAL_) (REG32(ADR_DAT_UART_RTHR)) = (((_VAL_) << 4) | ((REG32(ADR_DAT_UART_RTHR)) & 0xffffff0f)) ++#define SET_DAT_INT_IDCODE(_VAL_) (REG32(ADR_DAT_UART_ISR)) = (((_VAL_) << 0) | ((REG32(ADR_DAT_UART_ISR)) & 0xfffffff0)) ++#define SET_DAT_FIFOS_ENABLED(_VAL_) (REG32(ADR_DAT_UART_ISR)) = (((_VAL_) << 6) | ((REG32(ADR_DAT_UART_ISR)) & 0xffffff3f)) ++#define SET_MASK_TOP(_VAL_) (REG32(ADR_INT_MASK)) = (((_VAL_) << 0) | ((REG32(ADR_INT_MASK)) & 0x00000000)) ++#define SET_INT_MODE(_VAL_) (REG32(ADR_INT_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_INT_MODE)) & 0x00000000)) ++#define SET_IRQ_PHY_0(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 0) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffffe)) ++#define SET_IRQ_PHY_1(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 1) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffffd)) ++#define SET_IRQ_SDIO(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 2) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffffb)) ++#define SET_IRQ_BEACON_DONE(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 3) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffff7)) ++#define SET_IRQ_BEACON(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 4) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffffef)) ++#define SET_IRQ_PRE_BEACON(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 5) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffffdf)) ++#define SET_IRQ_EDCA0_TX_DONE(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 6) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffffbf)) ++#define SET_IRQ_EDCA1_TX_DONE(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 7) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffff7f)) ++#define SET_IRQ_EDCA2_TX_DONE(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 8) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffeff)) ++#define SET_IRQ_EDCA3_TX_DONE(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 9) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffdff)) ++#define SET_IRQ_EDCA4_TX_DONE(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 10) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffffbff)) ++#define SET_IRQ_BEACON_DTIM(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 12) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffefff)) ++#define SET_IRQ_EDCA0_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 13) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffdfff)) ++#define SET_IRQ_EDCA1_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 14) | ((REG32(ADR_INT_IRQ_STS)) & 0xffffbfff)) ++#define SET_IRQ_EDCA2_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 15) | ((REG32(ADR_INT_IRQ_STS)) & 0xffff7fff)) ++#define SET_IRQ_EDCA3_LOWTHOLD_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 16) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffeffff)) ++#define SET_IRQ_FENCE_HIT_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 17) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffdffff)) ++#define SET_IRQ_ILL_ADDR_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 18) | ((REG32(ADR_INT_IRQ_STS)) & 0xfffbffff)) ++#define SET_IRQ_MBOX(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 19) | ((REG32(ADR_INT_IRQ_STS)) & 0xfff7ffff)) ++#define SET_IRQ_US_TIMER0(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 20) | ((REG32(ADR_INT_IRQ_STS)) & 0xffefffff)) ++#define SET_IRQ_US_TIMER1(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 21) | ((REG32(ADR_INT_IRQ_STS)) & 0xffdfffff)) ++#define SET_IRQ_US_TIMER2(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 22) | ((REG32(ADR_INT_IRQ_STS)) & 0xffbfffff)) ++#define SET_IRQ_US_TIMER3(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 23) | ((REG32(ADR_INT_IRQ_STS)) & 0xff7fffff)) ++#define SET_IRQ_MS_TIMER0(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 24) | ((REG32(ADR_INT_IRQ_STS)) & 0xfeffffff)) ++#define SET_IRQ_MS_TIMER1(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 25) | ((REG32(ADR_INT_IRQ_STS)) & 0xfdffffff)) ++#define SET_IRQ_MS_TIMER2(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 26) | ((REG32(ADR_INT_IRQ_STS)) & 0xfbffffff)) ++#define SET_IRQ_MS_TIMER3(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 27) | ((REG32(ADR_INT_IRQ_STS)) & 0xf7ffffff)) ++#define SET_IRQ_TX_LIMIT_INT(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 28) | ((REG32(ADR_INT_IRQ_STS)) & 0xefffffff)) ++#define SET_IRQ_DMA0(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 29) | ((REG32(ADR_INT_IRQ_STS)) & 0xdfffffff)) ++#define SET_IRQ_CO_DMA(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 30) | ((REG32(ADR_INT_IRQ_STS)) & 0xbfffffff)) ++#define SET_IRQ_PERI_GROUP(_VAL_) (REG32(ADR_INT_IRQ_STS)) = (((_VAL_) << 31) | ((REG32(ADR_INT_IRQ_STS)) & 0x7fffffff)) ++#define SET_FIQ_STATUS(_VAL_) (REG32(ADR_INT_FIQ_STS)) = (((_VAL_) << 0) | ((REG32(ADR_INT_FIQ_STS)) & 0x00000000)) ++#define SET_IRQ_RAW(_VAL_) (REG32(ADR_INT_IRQ_RAW)) = (((_VAL_) << 0) | ((REG32(ADR_INT_IRQ_RAW)) & 0x00000000)) ++#define SET_FIQ_RAW(_VAL_) (REG32(ADR_INT_FIQ_RAW)) = (((_VAL_) << 0) | ((REG32(ADR_INT_FIQ_RAW)) & 0x00000000)) ++#define SET_INT_PERI_MASK(_VAL_) (REG32(ADR_INT_PERI_MASK)) = (((_VAL_) << 0) | ((REG32(ADR_INT_PERI_MASK)) & 0x00000000)) ++#define SET_PERI_RTC(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 0) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffffe)) ++#define SET_IRQ_UART0_TX(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 1) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffffd)) ++#define SET_IRQ_UART0_RX(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 2) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffffb)) ++#define SET_PERI_GPI_2(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 3) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffff7)) ++#define SET_IRQ_SPI_IPC(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 4) | ((REG32(ADR_INT_PERI_STS)) & 0xffffffef)) ++#define SET_PERI_GPI_1_0(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 5) | ((REG32(ADR_INT_PERI_STS)) & 0xffffff9f)) ++#define SET_SCRT_INT_1(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 7) | ((REG32(ADR_INT_PERI_STS)) & 0xffffff7f)) ++#define SET_MMU_ALC_ERR(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 8) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffeff)) ++#define SET_MMU_RLS_ERR(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 9) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffdff)) ++#define SET_ID_MNG_INT_1(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 10) | ((REG32(ADR_INT_PERI_STS)) & 0xfffffbff)) ++#define SET_MBOX_INT_1(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 11) | ((REG32(ADR_INT_PERI_STS)) & 0xfffff7ff)) ++#define SET_MBOX_INT_2(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 12) | ((REG32(ADR_INT_PERI_STS)) & 0xffffefff)) ++#define SET_MBOX_INT_3(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 13) | ((REG32(ADR_INT_PERI_STS)) & 0xffffdfff)) ++#define SET_HCI_INT_1(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 14) | ((REG32(ADR_INT_PERI_STS)) & 0xffffbfff)) ++#define SET_UART_RX_TIMEOUT(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 15) | ((REG32(ADR_INT_PERI_STS)) & 0xffff7fff)) ++#define SET_UART_MULTI_IRQ(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 16) | ((REG32(ADR_INT_PERI_STS)) & 0xfffeffff)) ++#define SET_ID_MNG_INT_2(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 17) | ((REG32(ADR_INT_PERI_STS)) & 0xfffdffff)) ++#define SET_DMN_NOHIT_INT(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 18) | ((REG32(ADR_INT_PERI_STS)) & 0xfffbffff)) ++#define SET_ID_THOLD_RX(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 19) | ((REG32(ADR_INT_PERI_STS)) & 0xfff7ffff)) ++#define SET_ID_THOLD_TX(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 20) | ((REG32(ADR_INT_PERI_STS)) & 0xffefffff)) ++#define SET_ID_DOUBLE_RLS(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 21) | ((REG32(ADR_INT_PERI_STS)) & 0xffdfffff)) ++#define SET_RX_ID_LEN_THOLD(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 22) | ((REG32(ADR_INT_PERI_STS)) & 0xffbfffff)) ++#define SET_TX_ID_LEN_THOLD(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 23) | ((REG32(ADR_INT_PERI_STS)) & 0xff7fffff)) ++#define SET_ALL_ID_LEN_THOLD(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 24) | ((REG32(ADR_INT_PERI_STS)) & 0xfeffffff)) ++#define SET_DMN_MCU_INT(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 25) | ((REG32(ADR_INT_PERI_STS)) & 0xfdffffff)) ++#define SET_IRQ_DAT_UART_TX(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 26) | ((REG32(ADR_INT_PERI_STS)) & 0xfbffffff)) ++#define SET_IRQ_DAT_UART_RX(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 27) | ((REG32(ADR_INT_PERI_STS)) & 0xf7ffffff)) ++#define SET_DAT_UART_RX_TIMEOUT(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 28) | ((REG32(ADR_INT_PERI_STS)) & 0xefffffff)) ++#define SET_DAT_UART_MULTI_IRQ(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 29) | ((REG32(ADR_INT_PERI_STS)) & 0xdfffffff)) ++#define SET_ALR_ABT_NOCHG_INT_IRQ(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 30) | ((REG32(ADR_INT_PERI_STS)) & 0xbfffffff)) ++#define SET_TBLNEQ_MNGPKT_INT_IRQ(_VAL_) (REG32(ADR_INT_PERI_STS)) = (((_VAL_) << 31) | ((REG32(ADR_INT_PERI_STS)) & 0x7fffffff)) ++#define SET_INTR_PERI_RAW(_VAL_) (REG32(ADR_INT_PERI_RAW)) = (((_VAL_) << 0) | ((REG32(ADR_INT_PERI_RAW)) & 0x00000000)) ++#define SET_INTR_GPI00_CFG(_VAL_) (REG32(ADR_INT_GPI_CFG)) = (((_VAL_) << 0) | ((REG32(ADR_INT_GPI_CFG)) & 0xfffffffc)) ++#define SET_INTR_GPI01_CFG(_VAL_) (REG32(ADR_INT_GPI_CFG)) = (((_VAL_) << 2) | ((REG32(ADR_INT_GPI_CFG)) & 0xfffffff3)) ++#define SET_SYS_RST_INT(_VAL_) (REG32(ADR_SYS_INT_FOR_HOST)) = (((_VAL_) << 0) | ((REG32(ADR_SYS_INT_FOR_HOST)) & 0xfffffffe)) ++#define SET_SPI_IPC_ADDR(_VAL_) (REG32(ADR_SPI_IPC)) = (((_VAL_) << 0) | ((REG32(ADR_SPI_IPC)) & 0x00000000)) ++#define SET_SD_MASK_TOP(_VAL_) (REG32(ADR_SDIO_MASK)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_MASK)) & 0x00000000)) ++#define SET_IRQ_PHY_0_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffffe)) ++#define SET_IRQ_PHY_1_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 1) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffffd)) ++#define SET_IRQ_SDIO_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 2) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffffb)) ++#define SET_IRQ_BEACON_DONE_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 3) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffff7)) ++#define SET_IRQ_BEACON_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 4) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffffef)) ++#define SET_IRQ_PRE_BEACON_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 5) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffffdf)) ++#define SET_IRQ_EDCA0_TX_DONE_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 6) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffffbf)) ++#define SET_IRQ_EDCA1_TX_DONE_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 7) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffff7f)) ++#define SET_IRQ_EDCA2_TX_DONE_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 8) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffeff)) ++#define SET_IRQ_EDCA3_TX_DONE_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 9) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffdff)) ++#define SET_IRQ_EDCA4_TX_DONE_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 10) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffffbff)) ++#define SET_IRQ_BEACON_DTIM_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 12) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffefff)) ++#define SET_IRQ_EDCA0_LOWTHOLD_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 13) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffdfff)) ++#define SET_IRQ_EDCA1_LOWTHOLD_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 14) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffffbfff)) ++#define SET_IRQ_EDCA2_LOWTHOLD_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 15) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffff7fff)) ++#define SET_IRQ_EDCA3_LOWTHOLD_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 16) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffeffff)) ++#define SET_IRQ_FENCE_HIT_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 17) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffdffff)) ++#define SET_IRQ_ILL_ADDR_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 18) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfffbffff)) ++#define SET_IRQ_MBOX_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 19) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfff7ffff)) ++#define SET_IRQ_US_TIMER0_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 20) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffefffff)) ++#define SET_IRQ_US_TIMER1_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 21) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffdfffff)) ++#define SET_IRQ_US_TIMER2_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 22) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xffbfffff)) ++#define SET_IRQ_US_TIMER3_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 23) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xff7fffff)) ++#define SET_IRQ_MS_TIMER0_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 24) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfeffffff)) ++#define SET_IRQ_MS_TIMER1_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 25) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfdffffff)) ++#define SET_IRQ_MS_TIMER2_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 26) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xfbffffff)) ++#define SET_IRQ_MS_TIMER3_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 27) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xf7ffffff)) ++#define SET_IRQ_TX_LIMIT_INT_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 28) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xefffffff)) ++#define SET_IRQ_DMA0_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 29) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xdfffffff)) ++#define SET_IRQ_CO_DMA_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 30) | ((REG32(ADR_SDIO_IRQ_STS)) & 0xbfffffff)) ++#define SET_IRQ_PERI_GROUP_SD(_VAL_) (REG32(ADR_SDIO_IRQ_STS)) = (((_VAL_) << 31) | ((REG32(ADR_SDIO_IRQ_STS)) & 0x7fffffff)) ++#define SET_INT_PERI_MASK_SD(_VAL_) (REG32(ADR_SD_PERI_MASK)) = (((_VAL_) << 0) | ((REG32(ADR_SD_PERI_MASK)) & 0x00000000)) ++#define SET_PERI_RTC_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 0) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffffe)) ++#define SET_IRQ_UART0_TX_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 1) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffffd)) ++#define SET_IRQ_UART0_RX_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 2) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffffb)) ++#define SET_PERI_GPI_SD_2(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 3) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffff7)) ++#define SET_IRQ_SPI_IPC_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 4) | ((REG32(ADR_SD_PERI_STS)) & 0xffffffef)) ++#define SET_PERI_GPI_SD_1_0(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 5) | ((REG32(ADR_SD_PERI_STS)) & 0xffffff9f)) ++#define SET_SCRT_INT_1_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 7) | ((REG32(ADR_SD_PERI_STS)) & 0xffffff7f)) ++#define SET_MMU_ALC_ERR_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 8) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffeff)) ++#define SET_MMU_RLS_ERR_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 9) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffdff)) ++#define SET_ID_MNG_INT_1_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 10) | ((REG32(ADR_SD_PERI_STS)) & 0xfffffbff)) ++#define SET_MBOX_INT_1_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 11) | ((REG32(ADR_SD_PERI_STS)) & 0xfffff7ff)) ++#define SET_MBOX_INT_2_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 12) | ((REG32(ADR_SD_PERI_STS)) & 0xffffefff)) ++#define SET_MBOX_INT_3_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 13) | ((REG32(ADR_SD_PERI_STS)) & 0xffffdfff)) ++#define SET_HCI_INT_1_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 14) | ((REG32(ADR_SD_PERI_STS)) & 0xffffbfff)) ++#define SET_UART_RX_TIMEOUT_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 15) | ((REG32(ADR_SD_PERI_STS)) & 0xffff7fff)) ++#define SET_UART_MULTI_IRQ_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 16) | ((REG32(ADR_SD_PERI_STS)) & 0xfffeffff)) ++#define SET_ID_MNG_INT_2_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 17) | ((REG32(ADR_SD_PERI_STS)) & 0xfffdffff)) ++#define SET_DMN_NOHIT_INT_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 18) | ((REG32(ADR_SD_PERI_STS)) & 0xfffbffff)) ++#define SET_ID_THOLD_RX_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 19) | ((REG32(ADR_SD_PERI_STS)) & 0xfff7ffff)) ++#define SET_ID_THOLD_TX_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 20) | ((REG32(ADR_SD_PERI_STS)) & 0xffefffff)) ++#define SET_ID_DOUBLE_RLS_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 21) | ((REG32(ADR_SD_PERI_STS)) & 0xffdfffff)) ++#define SET_RX_ID_LEN_THOLD_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 22) | ((REG32(ADR_SD_PERI_STS)) & 0xffbfffff)) ++#define SET_TX_ID_LEN_THOLD_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 23) | ((REG32(ADR_SD_PERI_STS)) & 0xff7fffff)) ++#define SET_ALL_ID_LEN_THOLD_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 24) | ((REG32(ADR_SD_PERI_STS)) & 0xfeffffff)) ++#define SET_DMN_MCU_INT_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 25) | ((REG32(ADR_SD_PERI_STS)) & 0xfdffffff)) ++#define SET_IRQ_DAT_UART_TX_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 26) | ((REG32(ADR_SD_PERI_STS)) & 0xfbffffff)) ++#define SET_IRQ_DAT_UART_RX_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 27) | ((REG32(ADR_SD_PERI_STS)) & 0xf7ffffff)) ++#define SET_DAT_UART_RX_TIMEOUT_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 28) | ((REG32(ADR_SD_PERI_STS)) & 0xefffffff)) ++#define SET_DAT_UART_MULTI_IRQ_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 29) | ((REG32(ADR_SD_PERI_STS)) & 0xdfffffff)) ++#define SET_ALR_ABT_NOCHG_INT_IRQ_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 30) | ((REG32(ADR_SD_PERI_STS)) & 0xbfffffff)) ++#define SET_TBLNEQ_MNGPKT_INT_IRQ_SD(_VAL_) (REG32(ADR_SD_PERI_STS)) = (((_VAL_) << 31) | ((REG32(ADR_SD_PERI_STS)) & 0x7fffffff)) ++#define SET_DBG_SPI_MODE(_VAL_) (REG32(ADR_DBG_SPI_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_SPI_MODE)) & 0x00000000)) ++#define SET_DBG_RX_QUOTA(_VAL_) (REG32(ADR_DBG_RX_QUOTA)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_RX_QUOTA)) & 0xffff0000)) ++#define SET_DBG_CONDI_NUM(_VAL_) (REG32(ADR_DBG_CONDITION_NUMBER)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_CONDITION_NUMBER)) & 0xffffff00)) ++#define SET_DBG_HOST_PATH(_VAL_) (REG32(ADR_DBG_HOST_PATH)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_HOST_PATH)) & 0xfffffffe)) ++#define SET_DBG_TX_SEG(_VAL_) (REG32(ADR_DBG_TX_SEG)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_TX_SEG)) & 0x00000000)) ++#define SET_DBG_BRST_MODE(_VAL_) (REG32(ADR_DBG_DEBUG_BURST_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_DEBUG_BURST_MODE)) & 0xfffffffe)) ++#define SET_DBG_CLK_WIDTH(_VAL_) (REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) & 0xffff0000)) ++#define SET_DBG_CSN_INTER(_VAL_) (REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) & 0x0000ffff)) ++#define SET_DBG_BACK_DLY(_VAL_) (REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) & 0xffff0000)) ++#define SET_DBG_FRONT_DLY(_VAL_) (REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) & 0x0000ffff)) ++#define SET_DBG_RX_FIFO_FAIL(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 1) | ((REG32(ADR_DBG_SPI_STS)) & 0xfffffffd)) ++#define SET_DBG_RX_HOST_FAIL(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 2) | ((REG32(ADR_DBG_SPI_STS)) & 0xfffffffb)) ++#define SET_DBG_TX_FIFO_FAIL(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 3) | ((REG32(ADR_DBG_SPI_STS)) & 0xfffffff7)) ++#define SET_DBG_TX_HOST_FAIL(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 4) | ((REG32(ADR_DBG_SPI_STS)) & 0xffffffef)) ++#define SET_DBG_SPI_DOUBLE_ALLOC(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 5) | ((REG32(ADR_DBG_SPI_STS)) & 0xffffffdf)) ++#define SET_DBG_SPI_TX_NO_ALLOC(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 6) | ((REG32(ADR_DBG_SPI_STS)) & 0xffffffbf)) ++#define SET_DBG_RDATA_RDY(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 7) | ((REG32(ADR_DBG_SPI_STS)) & 0xffffff7f)) ++#define SET_DBG_SPI_ALLOC_STATUS(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 8) | ((REG32(ADR_DBG_SPI_STS)) & 0xfffffeff)) ++#define SET_DBG_SPI_DBG_WR_FIFO_FULL(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 9) | ((REG32(ADR_DBG_SPI_STS)) & 0xfffffdff)) ++#define SET_DBG_RX_LEN(_VAL_) (REG32(ADR_DBG_SPI_STS)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_SPI_STS)) & 0x0000ffff)) ++#define SET_DBG_SPI_TX_ALLOC_SIZE_SHIFT_BITS(_VAL_) (REG32(ADR_DBG_TX_ALLOC_SET)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_TX_ALLOC_SET)) & 0xfffffff8)) ++#define SET_DBG_SPI_HOST_TX_ALLOC_PKBUF(_VAL_) (REG32(ADR_DBG_TX_ALLOC_SET)) = (((_VAL_) << 8) | ((REG32(ADR_DBG_TX_ALLOC_SET)) & 0xfffffeff)) ++#define SET_DBG_SPI_TX_ALLOC_SIZE(_VAL_) (REG32(ADR_DBG_TX_ALLOC)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_TX_ALLOC)) & 0xffffff00)) ++#define SET_DBG_RD_DAT_CNT(_VAL_) (REG32(ADR_DBG_DBG_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_DBG_CNT)) & 0xffff0000)) ++#define SET_DBG_RD_STS_CNT(_VAL_) (REG32(ADR_DBG_DBG_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_DBG_CNT)) & 0x0000ffff)) ++#define SET_DBG_JUDGE_CNT(_VAL_) (REG32(ADR_DBG_DBG_CNT2)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_DBG_CNT2)) & 0xffff0000)) ++#define SET_DBG_RD_STS_CNT_CLR(_VAL_) (REG32(ADR_DBG_DBG_CNT2)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_DBG_CNT2)) & 0xfffeffff)) ++#define SET_DBG_RD_DAT_CNT_CLR(_VAL_) (REG32(ADR_DBG_DBG_CNT2)) = (((_VAL_) << 17) | ((REG32(ADR_DBG_DBG_CNT2)) & 0xfffdffff)) ++#define SET_DBG_JUDGE_CNT_CLR(_VAL_) (REG32(ADR_DBG_DBG_CNT2)) = (((_VAL_) << 18) | ((REG32(ADR_DBG_DBG_CNT2)) & 0xfffbffff)) ++#define SET_DBG_TX_DONE_CNT(_VAL_) (REG32(ADR_DBG_DBG_CNT3)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_DBG_CNT3)) & 0xffff0000)) ++#define SET_DBG_TX_DISCARD_CNT(_VAL_) (REG32(ADR_DBG_DBG_CNT3)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_DBG_CNT3)) & 0x0000ffff)) ++#define SET_DBG_TX_SET_CNT(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xffff0000)) ++#define SET_DBG_TX_DISCARD_CNT_CLR(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xfffeffff)) ++#define SET_DBG_TX_DONE_CNT_CLR(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 17) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xfffdffff)) ++#define SET_DBG_TX_SET_CNT_CLR(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 18) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xfffbffff)) ++#define SET_DBG_DAT_MODE_OFF(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 19) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xfff7ffff)) ++#define SET_DBG_TX_FIFO_RESIDUE(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 20) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xff8fffff)) ++#define SET_DBG_RX_FIFO_RESIDUE(_VAL_) (REG32(ADR_DBG_DBG_CNT4)) = (((_VAL_) << 24) | ((REG32(ADR_DBG_DBG_CNT4)) & 0xf8ffffff)) ++#define SET_DBG_RX_RDY(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_INT_TAG)) & 0xfffffffe)) ++#define SET_DBG_SDIO_SYS_INT(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 2) | ((REG32(ADR_DBG_INT_TAG)) & 0xfffffffb)) ++#define SET_DBG_EDCA0_LOWTHOLD_INT(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 3) | ((REG32(ADR_DBG_INT_TAG)) & 0xfffffff7)) ++#define SET_DBG_EDCA1_LOWTHOLD_INT(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 4) | ((REG32(ADR_DBG_INT_TAG)) & 0xffffffef)) ++#define SET_DBG_EDCA2_LOWTHOLD_INT(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 5) | ((REG32(ADR_DBG_INT_TAG)) & 0xffffffdf)) ++#define SET_DBG_EDCA3_LOWTHOLD_INT(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 6) | ((REG32(ADR_DBG_INT_TAG)) & 0xffffffbf)) ++#define SET_DBG_TX_LIMIT_INT_IN(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 7) | ((REG32(ADR_DBG_INT_TAG)) & 0xffffff7f)) ++#define SET_DBG_SPI_FN1(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 8) | ((REG32(ADR_DBG_INT_TAG)) & 0xffff80ff)) ++#define SET_DBG_SPI_CLK_EN_INT(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 15) | ((REG32(ADR_DBG_INT_TAG)) & 0xffff7fff)) ++#define SET_DBG_SPI_HOST_MASK(_VAL_) (REG32(ADR_DBG_INT_TAG)) = (((_VAL_) << 16) | ((REG32(ADR_DBG_INT_TAG)) & 0xff00ffff)) ++#define SET_BOOT_ADDR(_VAL_) (REG32(ADR_BOOT_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_BOOT_ADDR)) & 0xff000000)) ++#define SET_CHECK_SUM_FAIL(_VAL_) (REG32(ADR_BOOT_ADDR)) = (((_VAL_) << 31) | ((REG32(ADR_BOOT_ADDR)) & 0x7fffffff)) ++#define SET_VERIFY_DATA(_VAL_) (REG32(ADR_VERIFY_DATA)) = (((_VAL_) << 0) | ((REG32(ADR_VERIFY_DATA)) & 0x00000000)) ++#define SET_FLASH_ADDR(_VAL_) (REG32(ADR_FLASH_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_FLASH_ADDR)) & 0xff000000)) ++#define SET_FLASH_CMD_CLR(_VAL_) (REG32(ADR_FLASH_ADDR)) = (((_VAL_) << 28) | ((REG32(ADR_FLASH_ADDR)) & 0xefffffff)) ++#define SET_FLASH_DMA_CLR(_VAL_) (REG32(ADR_FLASH_ADDR)) = (((_VAL_) << 29) | ((REG32(ADR_FLASH_ADDR)) & 0xdfffffff)) ++#define SET_DMA_EN(_VAL_) (REG32(ADR_FLASH_ADDR)) = (((_VAL_) << 30) | ((REG32(ADR_FLASH_ADDR)) & 0xbfffffff)) ++#define SET_DMA_BUSY(_VAL_) (REG32(ADR_FLASH_ADDR)) = (((_VAL_) << 31) | ((REG32(ADR_FLASH_ADDR)) & 0x7fffffff)) ++#define SET_SRAM_ADDR(_VAL_) (REG32(ADR_SRAM_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_SRAM_ADDR)) & 0x00000000)) ++#define SET_FLASH_DMA_LEN(_VAL_) (REG32(ADR_LEN)) = (((_VAL_) << 0) | ((REG32(ADR_LEN)) & 0x00000000)) ++#define SET_FLASH_FRONT_DLY(_VAL_) (REG32(ADR_SPI_PARAM)) = (((_VAL_) << 0) | ((REG32(ADR_SPI_PARAM)) & 0xffff0000)) ++#define SET_FLASH_BACK_DLY(_VAL_) (REG32(ADR_SPI_PARAM)) = (((_VAL_) << 16) | ((REG32(ADR_SPI_PARAM)) & 0x0000ffff)) ++#define SET_FLASH_CLK_WIDTH(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 0) | ((REG32(ADR_SPI_PARAM2)) & 0xffff0000)) ++#define SET_SPI_BUSY(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 16) | ((REG32(ADR_SPI_PARAM2)) & 0xfffeffff)) ++#define SET_FLS_REMAP(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 17) | ((REG32(ADR_SPI_PARAM2)) & 0xfffdffff)) ++#define SET_PBUS_SWP(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 18) | ((REG32(ADR_SPI_PARAM2)) & 0xfffbffff)) ++#define SET_BIT_MODE1(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 19) | ((REG32(ADR_SPI_PARAM2)) & 0xfff7ffff)) ++#define SET_BIT_MODE2(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 20) | ((REG32(ADR_SPI_PARAM2)) & 0xffefffff)) ++#define SET_BIT_MODE4(_VAL_) (REG32(ADR_SPI_PARAM2)) = (((_VAL_) << 21) | ((REG32(ADR_SPI_PARAM2)) & 0xffdfffff)) ++#define SET_BOOT_CHECK_SUM(_VAL_) (REG32(ADR_CHECK_SUM_RESULT)) = (((_VAL_) << 0) | ((REG32(ADR_CHECK_SUM_RESULT)) & 0x00000000)) ++#define SET_CHECK_SUM_TAG(_VAL_) (REG32(ADR_CHECK_SUM_IN_FILE)) = (((_VAL_) << 0) | ((REG32(ADR_CHECK_SUM_IN_FILE)) & 0x00000000)) ++#define SET_CMD_LEN(_VAL_) (REG32(ADR_COMMAND_LEN)) = (((_VAL_) << 0) | ((REG32(ADR_COMMAND_LEN)) & 0xffff0000)) ++#define SET_CMD_ADDR(_VAL_) (REG32(ADR_COMMAND_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_COMMAND_ADDR)) & 0x00000000)) ++#define SET_DMA_ADR_SRC(_VAL_) (REG32(ADR_DMA_ADR_SRC)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_ADR_SRC)) & 0x00000000)) ++#define SET_DMA_ADR_DST(_VAL_) (REG32(ADR_DMA_ADR_DST)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_ADR_DST)) & 0x00000000)) ++#define SET_DMA_SRC_SIZE(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_CTRL)) & 0xfffffff8)) ++#define SET_DMA_SRC_INC(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 3) | ((REG32(ADR_DMA_CTRL)) & 0xfffffff7)) ++#define SET_DMA_DST_SIZE(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 4) | ((REG32(ADR_DMA_CTRL)) & 0xffffff8f)) ++#define SET_DMA_DST_INC(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 7) | ((REG32(ADR_DMA_CTRL)) & 0xffffff7f)) ++#define SET_DMA_FAST_FILL(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 8) | ((REG32(ADR_DMA_CTRL)) & 0xfffffeff)) ++#define SET_DMA_SDIO_KICK(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 12) | ((REG32(ADR_DMA_CTRL)) & 0xffffefff)) ++#define SET_DMA_BADR_EN(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 13) | ((REG32(ADR_DMA_CTRL)) & 0xffffdfff)) ++#define SET_DMA_LEN(_VAL_) (REG32(ADR_DMA_CTRL)) = (((_VAL_) << 16) | ((REG32(ADR_DMA_CTRL)) & 0x0000ffff)) ++#define SET_DMA_INT_MASK(_VAL_) (REG32(ADR_DMA_INT)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_INT)) & 0xfffffffe)) ++#define SET_DMA_STS(_VAL_) (REG32(ADR_DMA_INT)) = (((_VAL_) << 8) | ((REG32(ADR_DMA_INT)) & 0xfffffeff)) ++#define SET_DMA_FINISH(_VAL_) (REG32(ADR_DMA_INT)) = (((_VAL_) << 31) | ((REG32(ADR_DMA_INT)) & 0x7fffffff)) ++#define SET_DMA_CONST(_VAL_) (REG32(ADR_DMA_FILL_CONST)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_FILL_CONST)) & 0x00000000)) ++#define SET_SLEEP_WAKE_CNT(_VAL_) (REG32(ADR_PMU_0)) = (((_VAL_) << 0) | ((REG32(ADR_PMU_0)) & 0xff000000)) ++#define SET_RG_DLDO_LEVEL(_VAL_) (REG32(ADR_PMU_0)) = (((_VAL_) << 24) | ((REG32(ADR_PMU_0)) & 0xf8ffffff)) ++#define SET_RG_DLDO_BOOST_IQ(_VAL_) (REG32(ADR_PMU_0)) = (((_VAL_) << 27) | ((REG32(ADR_PMU_0)) & 0xf7ffffff)) ++#define SET_RG_BUCK_LEVEL(_VAL_) (REG32(ADR_PMU_0)) = (((_VAL_) << 28) | ((REG32(ADR_PMU_0)) & 0x8fffffff)) ++#define SET_RG_BUCK_VREF_SEL(_VAL_) (REG32(ADR_PMU_0)) = (((_VAL_) << 31) | ((REG32(ADR_PMU_0)) & 0x7fffffff)) ++#define SET_RG_RTC_OSC_RES_SW_MANUAL(_VAL_) (REG32(ADR_PMU_1)) = (((_VAL_) << 0) | ((REG32(ADR_PMU_1)) & 0xfffffc00)) ++#define SET_RG_RTC_OSC_RES_SW(_VAL_) (REG32(ADR_PMU_1)) = (((_VAL_) << 16) | ((REG32(ADR_PMU_1)) & 0xfc00ffff)) ++#define SET_RTC_OSC_CAL_RES_RDY(_VAL_) (REG32(ADR_PMU_1)) = (((_VAL_) << 31) | ((REG32(ADR_PMU_1)) & 0x7fffffff)) ++#define SET_RG_DCDC_MODE(_VAL_) (REG32(ADR_PMU_2)) = (((_VAL_) << 0) | ((REG32(ADR_PMU_2)) & 0xfffffffe)) ++#define SET_RG_BUCK_EN_PSM(_VAL_) (REG32(ADR_PMU_2)) = (((_VAL_) << 4) | ((REG32(ADR_PMU_2)) & 0xffffffef)) ++#define SET_RG_BUCK_PSM_VTH(_VAL_) (REG32(ADR_PMU_2)) = (((_VAL_) << 8) | ((REG32(ADR_PMU_2)) & 0xfffffeff)) ++#define SET_RG_RTC_OSC_RES_SW_MANUAL_EN(_VAL_) (REG32(ADR_PMU_2)) = (((_VAL_) << 12) | ((REG32(ADR_PMU_2)) & 0xffffefff)) ++#define SET_RG_RTC_RDY_DEGLITCH_TIMER(_VAL_) (REG32(ADR_PMU_2)) = (((_VAL_) << 13) | ((REG32(ADR_PMU_2)) & 0xffff9fff)) ++#define SET_RTC_CAL_ENA(_VAL_) (REG32(ADR_PMU_2)) = (((_VAL_) << 16) | ((REG32(ADR_PMU_2)) & 0xfffeffff)) ++#define SET_PMU_WAKE_TRIG_EVENT(_VAL_) (REG32(ADR_PMU_3)) = (((_VAL_) << 0) | ((REG32(ADR_PMU_3)) & 0xfffffffc)) ++#define SET_DIGI_TOP_POR_MASK(_VAL_) (REG32(ADR_PMU_3)) = (((_VAL_) << 4) | ((REG32(ADR_PMU_3)) & 0xffffffef)) ++#define SET_PMU_ENTER_SLEEP_MODE(_VAL_) (REG32(ADR_PMU_3)) = (((_VAL_) << 8) | ((REG32(ADR_PMU_3)) & 0xfffffeff)) ++#define SET_RG_RTC_DUMMIES(_VAL_) (REG32(ADR_PMU_3)) = (((_VAL_) << 16) | ((REG32(ADR_PMU_3)) & 0x0000ffff)) ++#define SET_RTC_EN(_VAL_) (REG32(ADR_RTC_1)) = (((_VAL_) << 0) | ((REG32(ADR_RTC_1)) & 0xfffffffe)) ++#define SET_RTC_SRC(_VAL_) (REG32(ADR_RTC_1)) = (((_VAL_) << 1) | ((REG32(ADR_RTC_1)) & 0xfffffffd)) ++#define SET_RTC_TICK_CNT(_VAL_) (REG32(ADR_RTC_1)) = (((_VAL_) << 16) | ((REG32(ADR_RTC_1)) & 0x8000ffff)) ++#define SET_RTC_INT_SEC_MASK(_VAL_) (REG32(ADR_RTC_2)) = (((_VAL_) << 0) | ((REG32(ADR_RTC_2)) & 0xfffffffe)) ++#define SET_RTC_INT_ALARM_MASK(_VAL_) (REG32(ADR_RTC_2)) = (((_VAL_) << 1) | ((REG32(ADR_RTC_2)) & 0xfffffffd)) ++#define SET_RTC_INT_SEC(_VAL_) (REG32(ADR_RTC_2)) = (((_VAL_) << 16) | ((REG32(ADR_RTC_2)) & 0xfffeffff)) ++#define SET_RTC_INT_ALARM(_VAL_) (REG32(ADR_RTC_2)) = (((_VAL_) << 17) | ((REG32(ADR_RTC_2)) & 0xfffdffff)) ++#define SET_RTC_SEC_START_CNT(_VAL_) (REG32(ADR_RTC_3W)) = (((_VAL_) << 0) | ((REG32(ADR_RTC_3W)) & 0x00000000)) ++#define SET_RTC_SEC_CNT(_VAL_) (REG32(ADR_RTC_3R)) = (((_VAL_) << 0) | ((REG32(ADR_RTC_3R)) & 0x00000000)) ++#define SET_RTC_SEC_ALARM_VALUE(_VAL_) (REG32(ADR_RTC_4)) = (((_VAL_) << 0) | ((REG32(ADR_RTC_4)) & 0x00000000)) ++#define SET_D2_DMA_ADR_SRC(_VAL_) (REG32(ADR_D2_DMA_ADR_SRC)) = (((_VAL_) << 0) | ((REG32(ADR_D2_DMA_ADR_SRC)) & 0x00000000)) ++#define SET_D2_DMA_ADR_DST(_VAL_) (REG32(ADR_D2_DMA_ADR_DST)) = (((_VAL_) << 0) | ((REG32(ADR_D2_DMA_ADR_DST)) & 0x00000000)) ++#define SET_D2_DMA_SRC_SIZE(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_D2_DMA_CTRL)) & 0xfffffff8)) ++#define SET_D2_DMA_SRC_INC(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 3) | ((REG32(ADR_D2_DMA_CTRL)) & 0xfffffff7)) ++#define SET_D2_DMA_DST_SIZE(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 4) | ((REG32(ADR_D2_DMA_CTRL)) & 0xffffff8f)) ++#define SET_D2_DMA_DST_INC(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 7) | ((REG32(ADR_D2_DMA_CTRL)) & 0xffffff7f)) ++#define SET_D2_DMA_FAST_FILL(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 8) | ((REG32(ADR_D2_DMA_CTRL)) & 0xfffffeff)) ++#define SET_D2_DMA_SDIO_KICK(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 12) | ((REG32(ADR_D2_DMA_CTRL)) & 0xffffefff)) ++#define SET_D2_DMA_BADR_EN(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 13) | ((REG32(ADR_D2_DMA_CTRL)) & 0xffffdfff)) ++#define SET_D2_DMA_LEN(_VAL_) (REG32(ADR_D2_DMA_CTRL)) = (((_VAL_) << 16) | ((REG32(ADR_D2_DMA_CTRL)) & 0x0000ffff)) ++#define SET_D2_DMA_INT_MASK(_VAL_) (REG32(ADR_D2_DMA_INT)) = (((_VAL_) << 0) | ((REG32(ADR_D2_DMA_INT)) & 0xfffffffe)) ++#define SET_D2_DMA_STS(_VAL_) (REG32(ADR_D2_DMA_INT)) = (((_VAL_) << 8) | ((REG32(ADR_D2_DMA_INT)) & 0xfffffeff)) ++#define SET_D2_DMA_FINISH(_VAL_) (REG32(ADR_D2_DMA_INT)) = (((_VAL_) << 31) | ((REG32(ADR_D2_DMA_INT)) & 0x7fffffff)) ++#define SET_D2_DMA_CONST(_VAL_) (REG32(ADR_D2_DMA_FILL_CONST)) = (((_VAL_) << 0) | ((REG32(ADR_D2_DMA_FILL_CONST)) & 0x00000000)) ++#define SET_TRAP_UNKNOWN_TYPE(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 0) | ((REG32(ADR_CONTROL)) & 0xfffffffe)) ++#define SET_TX_ON_DEMAND_ENA(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 1) | ((REG32(ADR_CONTROL)) & 0xfffffffd)) ++#define SET_RX_2_HOST(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 2) | ((REG32(ADR_CONTROL)) & 0xfffffffb)) ++#define SET_AUTO_SEQNO(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 3) | ((REG32(ADR_CONTROL)) & 0xfffffff7)) ++#define SET_BYPASSS_TX_PARSER_ENCAP(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 4) | ((REG32(ADR_CONTROL)) & 0xffffffef)) ++#define SET_HDR_STRIP(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 5) | ((REG32(ADR_CONTROL)) & 0xffffffdf)) ++#define SET_ERP_PROTECT(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 6) | ((REG32(ADR_CONTROL)) & 0xffffff3f)) ++#define SET_PRO_VER(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 8) | ((REG32(ADR_CONTROL)) & 0xfffffcff)) ++#define SET_TXQ_ID0(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 12) | ((REG32(ADR_CONTROL)) & 0xffff8fff)) ++#define SET_TXQ_ID1(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 16) | ((REG32(ADR_CONTROL)) & 0xfff8ffff)) ++#define SET_TX_ETHER_TRAP_EN(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 20) | ((REG32(ADR_CONTROL)) & 0xffefffff)) ++#define SET_RX_ETHER_TRAP_EN(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 21) | ((REG32(ADR_CONTROL)) & 0xffdfffff)) ++#define SET_RX_NULL_TRAP_EN(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 22) | ((REG32(ADR_CONTROL)) & 0xffbfffff)) ++#define SET_RX_GET_TX_QUEUE_EN(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 25) | ((REG32(ADR_CONTROL)) & 0xfdffffff)) ++#define SET_HCI_INQ_SEL(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 26) | ((REG32(ADR_CONTROL)) & 0xfbffffff)) ++#define SET_TRX_DEBUG_CNT_ENA(_VAL_) (REG32(ADR_CONTROL)) = (((_VAL_) << 28) | ((REG32(ADR_CONTROL)) & 0xefffffff)) ++#define SET_WAKE_SOON_WITH_SCK(_VAL_) (REG32(ADR_SDIO_WAKE_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_WAKE_MODE)) & 0xfffffffe)) ++#define SET_TX_FLOW_CTRL(_VAL_) (REG32(ADR_TX_FLOW_0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_FLOW_0)) & 0xffff0000)) ++#define SET_TX_FLOW_MGMT(_VAL_) (REG32(ADR_TX_FLOW_0)) = (((_VAL_) << 16) | ((REG32(ADR_TX_FLOW_0)) & 0x0000ffff)) ++#define SET_TX_FLOW_DATA(_VAL_) (REG32(ADR_TX_FLOW_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_FLOW_1)) & 0x00000000)) ++#define SET_DOT11RTSTHRESHOLD(_VAL_) (REG32(ADR_THREASHOLD)) = (((_VAL_) << 16) | ((REG32(ADR_THREASHOLD)) & 0x0000ffff)) ++#define SET_TXF_ID(_VAL_) (REG32(ADR_TXFID_INCREASE)) = (((_VAL_) << 0) | ((REG32(ADR_TXFID_INCREASE)) & 0xffffffc0)) ++#define SET_SEQ_CTRL(_VAL_) (REG32(ADR_GLOBAL_SEQUENCE)) = (((_VAL_) << 0) | ((REG32(ADR_GLOBAL_SEQUENCE)) & 0xffff0000)) ++#define SET_TX_PBOFFSET(_VAL_) (REG32(ADR_HCI_TX_RX_INFO_SIZE)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0xffffff00)) ++#define SET_TX_INFO_SIZE(_VAL_) (REG32(ADR_HCI_TX_RX_INFO_SIZE)) = (((_VAL_) << 8) | ((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0xffff00ff)) ++#define SET_RX_INFO_SIZE(_VAL_) (REG32(ADR_HCI_TX_RX_INFO_SIZE)) = (((_VAL_) << 16) | ((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0xff00ffff)) ++#define SET_RX_LAST_PHY_SIZE(_VAL_) (REG32(ADR_HCI_TX_RX_INFO_SIZE)) = (((_VAL_) << 24) | ((REG32(ADR_HCI_TX_RX_INFO_SIZE)) & 0x00ffffff)) ++#define SET_TX_INFO_CLEAR_SIZE(_VAL_) (REG32(ADR_HCI_TX_INFO_CLEAR)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_TX_INFO_CLEAR)) & 0xffffffc0)) ++#define SET_TX_INFO_CLEAR_ENABLE(_VAL_) (REG32(ADR_HCI_TX_INFO_CLEAR)) = (((_VAL_) << 8) | ((REG32(ADR_HCI_TX_INFO_CLEAR)) & 0xfffffeff)) ++#define SET_TXTRAP_ETHTYPE1(_VAL_) (REG32(ADR_TX_ETHER_TYPE_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ETHER_TYPE_1)) & 0xffff0000)) ++#define SET_TXTRAP_ETHTYPE0(_VAL_) (REG32(ADR_TX_ETHER_TYPE_1)) = (((_VAL_) << 16) | ((REG32(ADR_TX_ETHER_TYPE_1)) & 0x0000ffff)) ++#define SET_RXTRAP_ETHTYPE1(_VAL_) (REG32(ADR_RX_ETHER_TYPE_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_ETHER_TYPE_1)) & 0xffff0000)) ++#define SET_RXTRAP_ETHTYPE0(_VAL_) (REG32(ADR_RX_ETHER_TYPE_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_ETHER_TYPE_1)) & 0x0000ffff)) ++#define SET_TX_PKT_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_0)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_0)) & 0x00000000)) ++#define SET_RX_PKT_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_1)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_1)) & 0x00000000)) ++#define SET_HOST_CMD_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_2)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_2)) & 0xffffff00)) ++#define SET_HOST_EVENT_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_3)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_3)) & 0xffffff00)) ++#define SET_TX_PKT_DROP_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_4)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_4)) & 0xffffff00)) ++#define SET_RX_PKT_DROP_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_5)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_5)) & 0xffffff00)) ++#define SET_TX_PKT_TRAP_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_6)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_6)) & 0xffffff00)) ++#define SET_RX_PKT_TRAP_COUNTER(_VAL_) (REG32(ADR_PACKET_COUNTER_INFO_7)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_COUNTER_INFO_7)) & 0xffffff00)) ++#define SET_HOST_TX_FAIL_COUNTER(_VAL_) (REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_0)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_0)) & 0xffffff00)) ++#define SET_HOST_RX_FAIL_COUNTER(_VAL_) (REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_1)) & 0xffffff00)) ++#define SET_HCI_STATE_MONITOR(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_0)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_0)) & 0x00000000)) ++#define SET_HCI_ST_TIMEOUT_MONITOR(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_1)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_1)) & 0x00000000)) ++#define SET_TX_ON_DEMAND_LENGTH(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_2)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_2)) & 0x00000000)) ++#define SET_HCI_MONITOR_REG1(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_3)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_3)) & 0x00000000)) ++#define SET_HCI_MONITOR_REG2(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_4)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_4)) & 0x00000000)) ++#define SET_HCI_TX_ALLOC_TIME_31_0(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_5)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_5)) & 0x00000000)) ++#define SET_HCI_TX_ALLOC_TIME_47_32(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_6)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_6)) & 0xffff0000)) ++#define SET_HCI_MB_MAX_CNT(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_6)) = (((_VAL_) << 16) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_6)) & 0xff00ffff)) ++#define SET_HCI_TX_ALLOC_CNT_31_0(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_7)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_7)) & 0x00000000)) ++#define SET_HCI_TX_ALLOC_CNT_47_32(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_8)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_8)) & 0xffff0000)) ++#define SET_HCI_PROC_CNT(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_8)) = (((_VAL_) << 16) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_8)) & 0xff00ffff)) ++#define SET_SDIO_TRANS_CNT(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_8)) = (((_VAL_) << 24) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_8)) & 0x00ffffff)) ++#define SET_SDIO_TX_INVALID_CNT_31_0(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_9)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_9)) & 0x00000000)) ++#define SET_SDIO_TX_INVALID_CNT_47_32(_VAL_) (REG32(ADR_HCI_STATE_DEBUG_MODE_10)) = (((_VAL_) << 0) | ((REG32(ADR_HCI_STATE_DEBUG_MODE_10)) & 0xffff0000)) ++#define SET_CS_START_ADDR(_VAL_) (REG32(ADR_CS_START_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_CS_START_ADDR)) & 0xffff0000)) ++#define SET_CS_PKT_ID(_VAL_) (REG32(ADR_CS_START_ADDR)) = (((_VAL_) << 16) | ((REG32(ADR_CS_START_ADDR)) & 0xff80ffff)) ++#define SET_ADD_LEN(_VAL_) (REG32(ADR_CS_ADD_LEN)) = (((_VAL_) << 0) | ((REG32(ADR_CS_ADD_LEN)) & 0xffff0000)) ++#define SET_CS_ADDER_EN(_VAL_) (REG32(ADR_CS_CMD)) = (((_VAL_) << 0) | ((REG32(ADR_CS_CMD)) & 0xfffffffe)) ++#define SET_PSEUDO(_VAL_) (REG32(ADR_CS_CMD)) = (((_VAL_) << 1) | ((REG32(ADR_CS_CMD)) & 0xfffffffd)) ++#define SET_CALCULATE(_VAL_) (REG32(ADR_CS_INI_BUF)) = (((_VAL_) << 0) | ((REG32(ADR_CS_INI_BUF)) & 0x00000000)) ++#define SET_L4_LEN(_VAL_) (REG32(ADR_CS_PSEUDO_BUF)) = (((_VAL_) << 0) | ((REG32(ADR_CS_PSEUDO_BUF)) & 0xffff0000)) ++#define SET_L4_PROTOL(_VAL_) (REG32(ADR_CS_PSEUDO_BUF)) = (((_VAL_) << 16) | ((REG32(ADR_CS_PSEUDO_BUF)) & 0xff00ffff)) ++#define SET_CHECK_SUM(_VAL_) (REG32(ADR_CS_CHECK_SUM)) = (((_VAL_) << 0) | ((REG32(ADR_CS_CHECK_SUM)) & 0xffff0000)) ++#define SET_RAND_EN(_VAL_) (REG32(ADR_RAND_EN)) = (((_VAL_) << 0) | ((REG32(ADR_RAND_EN)) & 0xfffffffe)) ++#define SET_RAND_NUM(_VAL_) (REG32(ADR_RAND_NUM)) = (((_VAL_) << 0) | ((REG32(ADR_RAND_NUM)) & 0x00000000)) ++#define SET_MUL_OP1(_VAL_) (REG32(ADR_MUL_OP1)) = (((_VAL_) << 0) | ((REG32(ADR_MUL_OP1)) & 0x00000000)) ++#define SET_MUL_OP2(_VAL_) (REG32(ADR_MUL_OP2)) = (((_VAL_) << 0) | ((REG32(ADR_MUL_OP2)) & 0x00000000)) ++#define SET_MUL_ANS0(_VAL_) (REG32(ADR_MUL_ANS0)) = (((_VAL_) << 0) | ((REG32(ADR_MUL_ANS0)) & 0x00000000)) ++#define SET_MUL_ANS1(_VAL_) (REG32(ADR_MUL_ANS1)) = (((_VAL_) << 0) | ((REG32(ADR_MUL_ANS1)) & 0x00000000)) ++#define SET_RD_ADDR(_VAL_) (REG32(ADR_DMA_RDATA)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_RDATA)) & 0xffff0000)) ++#define SET_RD_ID(_VAL_) (REG32(ADR_DMA_RDATA)) = (((_VAL_) << 16) | ((REG32(ADR_DMA_RDATA)) & 0xff80ffff)) ++#define SET_WR_ADDR(_VAL_) (REG32(ADR_DMA_WDATA)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_WDATA)) & 0xffff0000)) ++#define SET_WR_ID(_VAL_) (REG32(ADR_DMA_WDATA)) = (((_VAL_) << 16) | ((REG32(ADR_DMA_WDATA)) & 0xff80ffff)) ++#define SET_LEN(_VAL_) (REG32(ADR_DMA_LEN)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_LEN)) & 0xffff0000)) ++#define SET_CLR(_VAL_) (REG32(ADR_DMA_CLR)) = (((_VAL_) << 0) | ((REG32(ADR_DMA_CLR)) & 0xfffffffe)) ++#define SET_PHY_MODE(_VAL_) (REG32(ADR_NAV_DATA)) = (((_VAL_) << 0) | ((REG32(ADR_NAV_DATA)) & 0xfffffffc)) ++#define SET_SHRT_PREAM(_VAL_) (REG32(ADR_NAV_DATA)) = (((_VAL_) << 2) | ((REG32(ADR_NAV_DATA)) & 0xfffffffb)) ++#define SET_SHRT_GI(_VAL_) (REG32(ADR_NAV_DATA)) = (((_VAL_) << 3) | ((REG32(ADR_NAV_DATA)) & 0xfffffff7)) ++#define SET_DATA_RATE(_VAL_) (REG32(ADR_NAV_DATA)) = (((_VAL_) << 4) | ((REG32(ADR_NAV_DATA)) & 0xfffff80f)) ++#define SET_MCS(_VAL_) (REG32(ADR_NAV_DATA)) = (((_VAL_) << 12) | ((REG32(ADR_NAV_DATA)) & 0xffff8fff)) ++#define SET_FRAME_LEN(_VAL_) (REG32(ADR_NAV_DATA)) = (((_VAL_) << 16) | ((REG32(ADR_NAV_DATA)) & 0x0000ffff)) ++#define SET_DURATION(_VAL_) (REG32(ADR_CO_NAV)) = (((_VAL_) << 0) | ((REG32(ADR_CO_NAV)) & 0xffff0000)) ++#define SET_SHA_DST_ADDR(_VAL_) (REG32(ADR_SHA_DST_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_SHA_DST_ADDR)) & 0x00000000)) ++#define SET_SHA_SRC_ADDR(_VAL_) (REG32(ADR_SHA_SRC_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_SHA_SRC_ADDR)) & 0x00000000)) ++#define SET_SHA_BUSY(_VAL_) (REG32(ADR_SHA_SETTING)) = (((_VAL_) << 0) | ((REG32(ADR_SHA_SETTING)) & 0xfffffffe)) ++#define SET_SHA_ENDIAN(_VAL_) (REG32(ADR_SHA_SETTING)) = (((_VAL_) << 1) | ((REG32(ADR_SHA_SETTING)) & 0xfffffffd)) ++#define SET_EFS_CLKFREQ(_VAL_) (REG32(ADR_EFUSE_CLK_FREQ)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_CLK_FREQ)) & 0xfffff000)) ++#define SET_LOW_ACTIVE(_VAL_) (REG32(ADR_EFUSE_CLK_FREQ)) = (((_VAL_) << 16) | ((REG32(ADR_EFUSE_CLK_FREQ)) & 0xfffeffff)) ++#define SET_EFS_CLKFREQ_RD(_VAL_) (REG32(ADR_EFUSE_CLK_FREQ)) = (((_VAL_) << 20) | ((REG32(ADR_EFUSE_CLK_FREQ)) & 0xf00fffff)) ++#define SET_EFS_PRE_RD(_VAL_) (REG32(ADR_EFUSE_CLK_FREQ)) = (((_VAL_) << 28) | ((REG32(ADR_EFUSE_CLK_FREQ)) & 0x0fffffff)) ++#define SET_EFS_LDO_ON(_VAL_) (REG32(ADR_EFUSE_LDO_TIME)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_LDO_TIME)) & 0xffff0000)) ++#define SET_EFS_LDO_OFF(_VAL_) (REG32(ADR_EFUSE_LDO_TIME)) = (((_VAL_) << 16) | ((REG32(ADR_EFUSE_LDO_TIME)) & 0x0000ffff)) ++#define SET_EFS_RDATA_0(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_0)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_0)) & 0x00000000)) ++#define SET_EFS_WDATA_0(_VAL_) (REG32(ADR_EFUSE_WDATA_0)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_0)) & 0x00000000)) ++#define SET_EFS_RDATA_1(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_1)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_1)) & 0x00000000)) ++#define SET_EFS_WDATA_1(_VAL_) (REG32(ADR_EFUSE_WDATA_1)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_1)) & 0x00000000)) ++#define SET_EFS_RDATA_2(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_2)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_2)) & 0x00000000)) ++#define SET_EFS_WDATA_2(_VAL_) (REG32(ADR_EFUSE_WDATA_2)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_2)) & 0x00000000)) ++#define SET_EFS_RDATA_3(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_3)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_3)) & 0x00000000)) ++#define SET_EFS_WDATA_3(_VAL_) (REG32(ADR_EFUSE_WDATA_3)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_3)) & 0x00000000)) ++#define SET_EFS_RDATA_4(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_4)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_4)) & 0x00000000)) ++#define SET_EFS_WDATA_4(_VAL_) (REG32(ADR_EFUSE_WDATA_4)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_4)) & 0x00000000)) ++#define SET_EFS_RDATA_5(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_5)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_5)) & 0x00000000)) ++#define SET_EFS_WDATA_5(_VAL_) (REG32(ADR_EFUSE_WDATA_5)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_5)) & 0x00000000)) ++#define SET_EFS_RDATA_6(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_6)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_6)) & 0x00000000)) ++#define SET_EFS_WDATA_6(_VAL_) (REG32(ADR_EFUSE_WDATA_6)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_6)) & 0x00000000)) ++#define SET_EFS_RDATA_7(_VAL_) (REG32(ADR_EFUSE_AHB_RDATA_7)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_AHB_RDATA_7)) & 0x00000000)) ++#define SET_EFS_WDATA_7(_VAL_) (REG32(ADR_EFUSE_WDATA_7)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_WDATA_7)) & 0x00000000)) ++#define SET_EFS_SPI_RD0_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD0_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD0_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD1_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD1_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD1_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD2_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD2_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD2_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD3_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD3_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD3_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD4_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD4_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD4_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD5_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD5_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD5_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD6_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD6_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD6_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RD7_EN(_VAL_) (REG32(ADR_EFUSE_SPI_RD7_EN)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RD7_EN)) & 0xfffffffe)) ++#define SET_EFS_SPI_RBUSY(_VAL_) (REG32(ADR_EFUSE_SPI_BUSY)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_BUSY)) & 0xfffffffe)) ++#define SET_EFS_SPI_RDATA_0(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_0)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_0)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_1(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_1)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_1)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_2(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_2)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_2)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_3(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_3)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_3)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_4(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_4)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_4)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_5(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_5)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_5)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_6(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_6)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_6)) & 0x00000000)) ++#define SET_EFS_SPI_RDATA_7(_VAL_) (REG32(ADR_EFUSE_SPI_RDATA_7)) = (((_VAL_) << 0) | ((REG32(ADR_EFUSE_SPI_RDATA_7)) & 0x00000000)) ++#define SET_GET_RK(_VAL_) (REG32(ADR_SMS4_CFG1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_CFG1)) & 0xfffffffe)) ++#define SET_FORCE_GET_RK(_VAL_) (REG32(ADR_SMS4_CFG1)) = (((_VAL_) << 1) | ((REG32(ADR_SMS4_CFG1)) & 0xfffffffd)) ++#define SET_SMS4_DESCRY_EN(_VAL_) (REG32(ADR_SMS4_CFG1)) = (((_VAL_) << 4) | ((REG32(ADR_SMS4_CFG1)) & 0xffffffef)) ++#define SET_DEC_DOUT_MSB(_VAL_) (REG32(ADR_SMS4_CFG2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_CFG2)) & 0xfffffffe)) ++#define SET_DEC_DIN_MSB(_VAL_) (REG32(ADR_SMS4_CFG2)) = (((_VAL_) << 1) | ((REG32(ADR_SMS4_CFG2)) & 0xfffffffd)) ++#define SET_ENC_DOUT_MSB(_VAL_) (REG32(ADR_SMS4_CFG2)) = (((_VAL_) << 2) | ((REG32(ADR_SMS4_CFG2)) & 0xfffffffb)) ++#define SET_ENC_DIN_MSB(_VAL_) (REG32(ADR_SMS4_CFG2)) = (((_VAL_) << 3) | ((REG32(ADR_SMS4_CFG2)) & 0xfffffff7)) ++#define SET_KEY_DIN_MSB(_VAL_) (REG32(ADR_SMS4_CFG2)) = (((_VAL_) << 4) | ((REG32(ADR_SMS4_CFG2)) & 0xffffffef)) ++#define SET_SMS4_CBC_EN(_VAL_) (REG32(ADR_SMS4_MODE1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_MODE1)) & 0xfffffffe)) ++#define SET_SMS4_CFB_EN(_VAL_) (REG32(ADR_SMS4_MODE1)) = (((_VAL_) << 1) | ((REG32(ADR_SMS4_MODE1)) & 0xfffffffd)) ++#define SET_SMS4_OFB_EN(_VAL_) (REG32(ADR_SMS4_MODE1)) = (((_VAL_) << 2) | ((REG32(ADR_SMS4_MODE1)) & 0xfffffffb)) ++#define SET_SMS4_START_TRIG(_VAL_) (REG32(ADR_SMS4_TRIG)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_TRIG)) & 0xfffffffe)) ++#define SET_SMS4_BUSY(_VAL_) (REG32(ADR_SMS4_STATUS1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_STATUS1)) & 0xfffffffe)) ++#define SET_SMS4_DONE(_VAL_) (REG32(ADR_SMS4_STATUS2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_STATUS2)) & 0xfffffffe)) ++#define SET_SMS4_DATAIN_0(_VAL_) (REG32(ADR_SMS4_DATA_IN0)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_IN0)) & 0x00000000)) ++#define SET_SMS4_DATAIN_1(_VAL_) (REG32(ADR_SMS4_DATA_IN1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_IN1)) & 0x00000000)) ++#define SET_SMS4_DATAIN_2(_VAL_) (REG32(ADR_SMS4_DATA_IN2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_IN2)) & 0x00000000)) ++#define SET_SMS4_DATAIN_3(_VAL_) (REG32(ADR_SMS4_DATA_IN3)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_IN3)) & 0x00000000)) ++#define SET_SMS4_DATAOUT_0(_VAL_) (REG32(ADR_SMS4_DATA_OUT0)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_OUT0)) & 0x00000000)) ++#define SET_SMS4_DATAOUT_1(_VAL_) (REG32(ADR_SMS4_DATA_OUT1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_OUT1)) & 0x00000000)) ++#define SET_SMS4_DATAOUT_2(_VAL_) (REG32(ADR_SMS4_DATA_OUT2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_OUT2)) & 0x00000000)) ++#define SET_SMS4_DATAOUT_3(_VAL_) (REG32(ADR_SMS4_DATA_OUT3)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_DATA_OUT3)) & 0x00000000)) ++#define SET_SMS4_KEY_0(_VAL_) (REG32(ADR_SMS4_KEY_0)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_KEY_0)) & 0x00000000)) ++#define SET_SMS4_KEY_1(_VAL_) (REG32(ADR_SMS4_KEY_1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_KEY_1)) & 0x00000000)) ++#define SET_SMS4_KEY_2(_VAL_) (REG32(ADR_SMS4_KEY_2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_KEY_2)) & 0x00000000)) ++#define SET_SMS4_KEY_3(_VAL_) (REG32(ADR_SMS4_KEY_3)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_KEY_3)) & 0x00000000)) ++#define SET_SMS4_MODE_IV0(_VAL_) (REG32(ADR_SMS4_MODE_IV0)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_MODE_IV0)) & 0x00000000)) ++#define SET_SMS4_MODE_IV1(_VAL_) (REG32(ADR_SMS4_MODE_IV1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_MODE_IV1)) & 0x00000000)) ++#define SET_SMS4_MODE_IV2(_VAL_) (REG32(ADR_SMS4_MODE_IV2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_MODE_IV2)) & 0x00000000)) ++#define SET_SMS4_MODE_IV3(_VAL_) (REG32(ADR_SMS4_MODE_IV3)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_MODE_IV3)) & 0x00000000)) ++#define SET_SMS4_OFB_ENC0(_VAL_) (REG32(ADR_SMS4_OFB_ENC0)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_OFB_ENC0)) & 0x00000000)) ++#define SET_SMS4_OFB_ENC1(_VAL_) (REG32(ADR_SMS4_OFB_ENC1)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_OFB_ENC1)) & 0x00000000)) ++#define SET_SMS4_OFB_ENC2(_VAL_) (REG32(ADR_SMS4_OFB_ENC2)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_OFB_ENC2)) & 0x00000000)) ++#define SET_SMS4_OFB_ENC3(_VAL_) (REG32(ADR_SMS4_OFB_ENC3)) = (((_VAL_) << 0) | ((REG32(ADR_SMS4_OFB_ENC3)) & 0x00000000)) ++#define SET_MRX_MCAST_TB0_31_0(_VAL_) (REG32(ADR_MRX_MCAST_TB0_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB0_0)) & 0x00000000)) ++#define SET_MRX_MCAST_TB0_47_32(_VAL_) (REG32(ADR_MRX_MCAST_TB0_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB0_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_MASK0_31_0(_VAL_) (REG32(ADR_MRX_MCAST_MK0_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK0_0)) & 0x00000000)) ++#define SET_MRX_MCAST_MASK0_47_32(_VAL_) (REG32(ADR_MRX_MCAST_MK0_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK0_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_CTRL_0(_VAL_) (REG32(ADR_MRX_MCAST_CTRL0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_CTRL0)) & 0xfffffffc)) ++#define SET_MRX_MCAST_TB1_31_0(_VAL_) (REG32(ADR_MRX_MCAST_TB1_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB1_0)) & 0x00000000)) ++#define SET_MRX_MCAST_TB1_47_32(_VAL_) (REG32(ADR_MRX_MCAST_TB1_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB1_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_MASK1_31_0(_VAL_) (REG32(ADR_MRX_MCAST_MK1_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK1_0)) & 0x00000000)) ++#define SET_MRX_MCAST_MASK1_47_32(_VAL_) (REG32(ADR_MRX_MCAST_MK1_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK1_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_CTRL_1(_VAL_) (REG32(ADR_MRX_MCAST_CTRL1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_CTRL1)) & 0xfffffffc)) ++#define SET_MRX_MCAST_TB2_31_0(_VAL_) (REG32(ADR_MRX_MCAST_TB2_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB2_0)) & 0x00000000)) ++#define SET_MRX_MCAST_TB2_47_32(_VAL_) (REG32(ADR_MRX_MCAST_TB2_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB2_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_MASK2_31_0(_VAL_) (REG32(ADR_MRX_MCAST_MK2_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK2_0)) & 0x00000000)) ++#define SET_MRX_MCAST_MASK2_47_32(_VAL_) (REG32(ADR_MRX_MCAST_MK2_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK2_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_CTRL_2(_VAL_) (REG32(ADR_MRX_MCAST_CTRL2)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_CTRL2)) & 0xfffffffc)) ++#define SET_MRX_MCAST_TB3_31_0(_VAL_) (REG32(ADR_MRX_MCAST_TB3_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB3_0)) & 0x00000000)) ++#define SET_MRX_MCAST_TB3_47_32(_VAL_) (REG32(ADR_MRX_MCAST_TB3_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_TB3_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_MASK3_31_0(_VAL_) (REG32(ADR_MRX_MCAST_MK3_0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK3_0)) & 0x00000000)) ++#define SET_MRX_MCAST_MASK3_47_32(_VAL_) (REG32(ADR_MRX_MCAST_MK3_1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_MK3_1)) & 0xffff0000)) ++#define SET_MRX_MCAST_CTRL_3(_VAL_) (REG32(ADR_MRX_MCAST_CTRL3)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MCAST_CTRL3)) & 0xfffffffc)) ++#define SET_MRX_PHY_INFO(_VAL_) (REG32(ADR_MRX_PHY_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_PHY_INFO)) & 0x00000000)) ++#define SET_DBG_BA_TYPE(_VAL_) (REG32(ADR_MRX_BA_DBG)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_BA_DBG)) & 0xffffffc0)) ++#define SET_DBG_BA_SEQ(_VAL_) (REG32(ADR_MRX_BA_DBG)) = (((_VAL_) << 8) | ((REG32(ADR_MRX_BA_DBG)) & 0xfff000ff)) ++#define SET_MRX_FLT_TB0(_VAL_) (REG32(ADR_MRX_FLT_TB0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB0)) & 0xffff8000)) ++#define SET_MRX_FLT_TB1(_VAL_) (REG32(ADR_MRX_FLT_TB1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB1)) & 0xffff8000)) ++#define SET_MRX_FLT_TB2(_VAL_) (REG32(ADR_MRX_FLT_TB2)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB2)) & 0xffff8000)) ++#define SET_MRX_FLT_TB3(_VAL_) (REG32(ADR_MRX_FLT_TB3)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB3)) & 0xffff8000)) ++#define SET_MRX_FLT_TB4(_VAL_) (REG32(ADR_MRX_FLT_TB4)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB4)) & 0xffff8000)) ++#define SET_MRX_FLT_TB5(_VAL_) (REG32(ADR_MRX_FLT_TB5)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB5)) & 0xffff8000)) ++#define SET_MRX_FLT_TB6(_VAL_) (REG32(ADR_MRX_FLT_TB6)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB6)) & 0xffff8000)) ++#define SET_MRX_FLT_TB7(_VAL_) (REG32(ADR_MRX_FLT_TB7)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB7)) & 0xffff8000)) ++#define SET_MRX_FLT_TB8(_VAL_) (REG32(ADR_MRX_FLT_TB8)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB8)) & 0xffff8000)) ++#define SET_MRX_FLT_TB9(_VAL_) (REG32(ADR_MRX_FLT_TB9)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB9)) & 0xffff8000)) ++#define SET_MRX_FLT_TB10(_VAL_) (REG32(ADR_MRX_FLT_TB10)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB10)) & 0xffff8000)) ++#define SET_MRX_FLT_TB11(_VAL_) (REG32(ADR_MRX_FLT_TB11)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB11)) & 0xffff8000)) ++#define SET_MRX_FLT_TB12(_VAL_) (REG32(ADR_MRX_FLT_TB12)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB12)) & 0xffff8000)) ++#define SET_MRX_FLT_TB13(_VAL_) (REG32(ADR_MRX_FLT_TB13)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB13)) & 0xffff8000)) ++#define SET_MRX_FLT_TB14(_VAL_) (REG32(ADR_MRX_FLT_TB14)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB14)) & 0xffff8000)) ++#define SET_MRX_FLT_TB15(_VAL_) (REG32(ADR_MRX_FLT_TB15)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_TB15)) & 0xffff8000)) ++#define SET_MRX_FLT_EN0(_VAL_) (REG32(ADR_MRX_FLT_EN0)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN0)) & 0xffff0000)) ++#define SET_MRX_FLT_EN1(_VAL_) (REG32(ADR_MRX_FLT_EN1)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN1)) & 0xffff0000)) ++#define SET_MRX_FLT_EN2(_VAL_) (REG32(ADR_MRX_FLT_EN2)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN2)) & 0xffff0000)) ++#define SET_MRX_FLT_EN3(_VAL_) (REG32(ADR_MRX_FLT_EN3)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN3)) & 0xffff0000)) ++#define SET_MRX_FLT_EN4(_VAL_) (REG32(ADR_MRX_FLT_EN4)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN4)) & 0xffff0000)) ++#define SET_MRX_FLT_EN5(_VAL_) (REG32(ADR_MRX_FLT_EN5)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN5)) & 0xffff0000)) ++#define SET_MRX_FLT_EN6(_VAL_) (REG32(ADR_MRX_FLT_EN6)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN6)) & 0xffff0000)) ++#define SET_MRX_FLT_EN7(_VAL_) (REG32(ADR_MRX_FLT_EN7)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN7)) & 0xffff0000)) ++#define SET_MRX_FLT_EN8(_VAL_) (REG32(ADR_MRX_FLT_EN8)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FLT_EN8)) & 0xffff0000)) ++#define SET_MRX_LEN_FLT(_VAL_) (REG32(ADR_MRX_LEN_FLT)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_LEN_FLT)) & 0xffff0000)) ++#define SET_RX_FLOW_DATA(_VAL_) (REG32(ADR_RX_FLOW_DATA)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FLOW_DATA)) & 0x00000000)) ++#define SET_RX_FLOW_MNG(_VAL_) (REG32(ADR_RX_FLOW_MNG)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FLOW_MNG)) & 0xffff0000)) ++#define SET_RX_FLOW_CTRL(_VAL_) (REG32(ADR_RX_FLOW_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FLOW_CTRL)) & 0xffff0000)) ++#define SET_MRX_STP_EN(_VAL_) (REG32(ADR_RX_TIME_STAMP_CFG)) = (((_VAL_) << 0) | ((REG32(ADR_RX_TIME_STAMP_CFG)) & 0xfffffffe)) ++#define SET_MRX_STP_OFST(_VAL_) (REG32(ADR_RX_TIME_STAMP_CFG)) = (((_VAL_) << 8) | ((REG32(ADR_RX_TIME_STAMP_CFG)) & 0xffff00ff)) ++#define SET_DBG_FF_FULL(_VAL_) (REG32(ADR_DBG_FF_FULL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_FF_FULL)) & 0xffff0000)) ++#define SET_DBG_FF_FULL_CLR(_VAL_) (REG32(ADR_DBG_FF_FULL)) = (((_VAL_) << 31) | ((REG32(ADR_DBG_FF_FULL)) & 0x7fffffff)) ++#define SET_DBG_WFF_FULL(_VAL_) (REG32(ADR_DBG_WFF_FULL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_WFF_FULL)) & 0xffff0000)) ++#define SET_DBG_WFF_FULL_CLR(_VAL_) (REG32(ADR_DBG_WFF_FULL)) = (((_VAL_) << 31) | ((REG32(ADR_DBG_WFF_FULL)) & 0x7fffffff)) ++#define SET_DBG_MB_FULL(_VAL_) (REG32(ADR_DBG_MB_FULL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_MB_FULL)) & 0xffff0000)) ++#define SET_DBG_MB_FULL_CLR(_VAL_) (REG32(ADR_DBG_MB_FULL)) = (((_VAL_) << 31) | ((REG32(ADR_DBG_MB_FULL)) & 0x7fffffff)) ++#define SET_BA_CTRL(_VAL_) (REG32(ADR_BA_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_BA_CTRL)) & 0xfffffffc)) ++#define SET_BA_DBG_EN(_VAL_) (REG32(ADR_BA_CTRL)) = (((_VAL_) << 2) | ((REG32(ADR_BA_CTRL)) & 0xfffffffb)) ++#define SET_BA_AGRE_EN(_VAL_) (REG32(ADR_BA_CTRL)) = (((_VAL_) << 3) | ((REG32(ADR_BA_CTRL)) & 0xfffffff7)) ++#define SET_BA_TA_31_0(_VAL_) (REG32(ADR_BA_TA_0)) = (((_VAL_) << 0) | ((REG32(ADR_BA_TA_0)) & 0x00000000)) ++#define SET_BA_TA_47_32(_VAL_) (REG32(ADR_BA_TA_1)) = (((_VAL_) << 0) | ((REG32(ADR_BA_TA_1)) & 0xffff0000)) ++#define SET_BA_TID(_VAL_) (REG32(ADR_BA_TID)) = (((_VAL_) << 0) | ((REG32(ADR_BA_TID)) & 0xfffffff0)) ++#define SET_BA_ST_SEQ(_VAL_) (REG32(ADR_BA_ST_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_BA_ST_SEQ)) & 0xfffff000)) ++#define SET_BA_SB0(_VAL_) (REG32(ADR_BA_SB0)) = (((_VAL_) << 0) | ((REG32(ADR_BA_SB0)) & 0x00000000)) ++#define SET_BA_SB1(_VAL_) (REG32(ADR_BA_SB1)) = (((_VAL_) << 0) | ((REG32(ADR_BA_SB1)) & 0x00000000)) ++#define SET_MRX_WD(_VAL_) (REG32(ADR_MRX_WATCH_DOG)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_WATCH_DOG)) & 0xfffe0000)) ++#define SET_ACK_GEN_EN(_VAL_) (REG32(ADR_ACK_GEN_EN)) = (((_VAL_) << 0) | ((REG32(ADR_ACK_GEN_EN)) & 0xfffffffe)) ++#define SET_BA_GEN_EN(_VAL_) (REG32(ADR_ACK_GEN_EN)) = (((_VAL_) << 1) | ((REG32(ADR_ACK_GEN_EN)) & 0xfffffffd)) ++#define SET_ACK_GEN_DUR(_VAL_) (REG32(ADR_ACK_GEN_PARA)) = (((_VAL_) << 0) | ((REG32(ADR_ACK_GEN_PARA)) & 0xffff0000)) ++#define SET_ACK_GEN_INFO(_VAL_) (REG32(ADR_ACK_GEN_PARA)) = (((_VAL_) << 16) | ((REG32(ADR_ACK_GEN_PARA)) & 0xffc0ffff)) ++#define SET_ACK_GEN_RA_31_0(_VAL_) (REG32(ADR_ACK_GEN_RA_0)) = (((_VAL_) << 0) | ((REG32(ADR_ACK_GEN_RA_0)) & 0x00000000)) ++#define SET_ACK_GEN_RA_47_32(_VAL_) (REG32(ADR_ACK_GEN_RA_1)) = (((_VAL_) << 0) | ((REG32(ADR_ACK_GEN_RA_1)) & 0xffff0000)) ++#define SET_MIB_LEN_FAIL(_VAL_) (REG32(ADR_MIB_LEN_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_LEN_FAIL)) & 0xffff0000)) ++#define SET_TRAP_HW_ID(_VAL_) (REG32(ADR_TRAP_HW_ID)) = (((_VAL_) << 0) | ((REG32(ADR_TRAP_HW_ID)) & 0xfffffff0)) ++#define SET_ID_IN_USE(_VAL_) (REG32(ADR_ID_IN_USE)) = (((_VAL_) << 0) | ((REG32(ADR_ID_IN_USE)) & 0xffffff00)) ++#define SET_MRX_ERR(_VAL_) (REG32(ADR_MRX_ERR)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_ERR)) & 0x00000000)) ++#define SET_W0_T0_SEQ(_VAL_) (REG32(ADR_WSID0_TID0_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID0_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T1_SEQ(_VAL_) (REG32(ADR_WSID0_TID1_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID1_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T2_SEQ(_VAL_) (REG32(ADR_WSID0_TID2_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID2_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T3_SEQ(_VAL_) (REG32(ADR_WSID0_TID3_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID3_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T4_SEQ(_VAL_) (REG32(ADR_WSID0_TID4_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID4_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T5_SEQ(_VAL_) (REG32(ADR_WSID0_TID5_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID5_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T6_SEQ(_VAL_) (REG32(ADR_WSID0_TID6_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID6_RX_SEQ)) & 0xffff0000)) ++#define SET_W0_T7_SEQ(_VAL_) (REG32(ADR_WSID0_TID7_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0_TID7_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T0_SEQ(_VAL_) (REG32(ADR_WSID1_TID0_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID0_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T1_SEQ(_VAL_) (REG32(ADR_WSID1_TID1_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID1_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T2_SEQ(_VAL_) (REG32(ADR_WSID1_TID2_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID2_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T3_SEQ(_VAL_) (REG32(ADR_WSID1_TID3_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID3_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T4_SEQ(_VAL_) (REG32(ADR_WSID1_TID4_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID4_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T5_SEQ(_VAL_) (REG32(ADR_WSID1_TID5_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID5_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T6_SEQ(_VAL_) (REG32(ADR_WSID1_TID6_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID6_RX_SEQ)) & 0xffff0000)) ++#define SET_W1_T7_SEQ(_VAL_) (REG32(ADR_WSID1_TID7_RX_SEQ)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1_TID7_RX_SEQ)) & 0xffff0000)) ++#define SET_ADDR1A_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 0) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xfffffffc)) ++#define SET_ADDR2A_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 2) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xfffffff3)) ++#define SET_ADDR3A_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 4) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xffffffcf)) ++#define SET_ADDR1B_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 6) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xffffff3f)) ++#define SET_ADDR2B_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 8) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xfffffcff)) ++#define SET_ADDR3B_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 10) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xfffff3ff)) ++#define SET_ADDR3C_SEL(_VAL_) (REG32(ADR_HDR_ADDR_SEL)) = (((_VAL_) << 12) | ((REG32(ADR_HDR_ADDR_SEL)) & 0xffffcfff)) ++#define SET_FRM_CTRL(_VAL_) (REG32(ADR_FRAME_TYPE_CNTR_SET)) = (((_VAL_) << 0) | ((REG32(ADR_FRAME_TYPE_CNTR_SET)) & 0xffffffc0)) ++#define SET_CSR_PHY_INFO(_VAL_) (REG32(ADR_PHY_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_INFO)) & 0xffff8000)) ++#define SET_AMPDU_SIG(_VAL_) (REG32(ADR_AMPDU_SIG)) = (((_VAL_) << 0) | ((REG32(ADR_AMPDU_SIG)) & 0xffffff00)) ++#define SET_MIB_AMPDU(_VAL_) (REG32(ADR_MIB_AMPDU)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_AMPDU)) & 0x00000000)) ++#define SET_LEN_FLT(_VAL_) (REG32(ADR_LEN_FLT)) = (((_VAL_) << 0) | ((REG32(ADR_LEN_FLT)) & 0xffff0000)) ++#define SET_MIB_DELIMITER(_VAL_) (REG32(ADR_MIB_DELIMITER)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_DELIMITER)) & 0xffff0000)) ++#define SET_MTX_INT_Q0_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_INT_STS)) & 0xfffeffff)) ++#define SET_MTX_INT_Q0_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 17) | ((REG32(ADR_MTX_INT_STS)) & 0xfffdffff)) ++#define SET_MTX_INT_Q1_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 18) | ((REG32(ADR_MTX_INT_STS)) & 0xfffbffff)) ++#define SET_MTX_INT_Q1_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 19) | ((REG32(ADR_MTX_INT_STS)) & 0xfff7ffff)) ++#define SET_MTX_INT_Q2_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 20) | ((REG32(ADR_MTX_INT_STS)) & 0xffefffff)) ++#define SET_MTX_INT_Q2_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 21) | ((REG32(ADR_MTX_INT_STS)) & 0xffdfffff)) ++#define SET_MTX_INT_Q3_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 22) | ((REG32(ADR_MTX_INT_STS)) & 0xffbfffff)) ++#define SET_MTX_INT_Q3_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 23) | ((REG32(ADR_MTX_INT_STS)) & 0xff7fffff)) ++#define SET_MTX_INT_Q4_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 24) | ((REG32(ADR_MTX_INT_STS)) & 0xfeffffff)) ++#define SET_MTX_INT_Q4_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_STS)) = (((_VAL_) << 25) | ((REG32(ADR_MTX_INT_STS)) & 0xfdffffff)) ++#define SET_MTX_EN_INT_Q0_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_INT_EN)) & 0xfffeffff)) ++#define SET_MTX_EN_INT_Q0_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 17) | ((REG32(ADR_MTX_INT_EN)) & 0xfffdffff)) ++#define SET_MTX_EN_INT_Q1_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 18) | ((REG32(ADR_MTX_INT_EN)) & 0xfffbffff)) ++#define SET_MTX_EN_INT_Q1_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 19) | ((REG32(ADR_MTX_INT_EN)) & 0xfff7ffff)) ++#define SET_MTX_EN_INT_Q2_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 20) | ((REG32(ADR_MTX_INT_EN)) & 0xffefffff)) ++#define SET_MTX_EN_INT_Q2_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 21) | ((REG32(ADR_MTX_INT_EN)) & 0xffdfffff)) ++#define SET_MTX_EN_INT_Q3_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 22) | ((REG32(ADR_MTX_INT_EN)) & 0xffbfffff)) ++#define SET_MTX_EN_INT_Q3_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 23) | ((REG32(ADR_MTX_INT_EN)) & 0xff7fffff)) ++#define SET_MTX_EN_INT_Q4_Q_EMPTY(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 24) | ((REG32(ADR_MTX_INT_EN)) & 0xfeffffff)) ++#define SET_MTX_EN_INT_Q4_TXOP_RUNOUT(_VAL_) (REG32(ADR_MTX_INT_EN)) = (((_VAL_) << 25) | ((REG32(ADR_MTX_INT_EN)) & 0xfdffffff)) ++#define SET_MTX_MTX2PHY_SLOW(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_MISC_EN)) & 0xfffffffe)) ++#define SET_MTX_M2M_SLOW_PRD(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_MISC_EN)) & 0xfffffff1)) ++#define SET_MTX_AMPDU_CRC_AUTO(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 5) | ((REG32(ADR_MTX_MISC_EN)) & 0xffffffdf)) ++#define SET_MTX_FAST_RSP_MODE(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 6) | ((REG32(ADR_MTX_MISC_EN)) & 0xffffffbf)) ++#define SET_MTX_RAW_DATA_MODE(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 7) | ((REG32(ADR_MTX_MISC_EN)) & 0xffffff7f)) ++#define SET_MTX_ACK_DUR0(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 8) | ((REG32(ADR_MTX_MISC_EN)) & 0xfffffeff)) ++#define SET_MTX_TSF_AUTO_BCN(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 10) | ((REG32(ADR_MTX_MISC_EN)) & 0xfffffbff)) ++#define SET_MTX_TSF_AUTO_MISC(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 11) | ((REG32(ADR_MTX_MISC_EN)) & 0xfffff7ff)) ++#define SET_MTX_FORCE_CS_IDLE(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 12) | ((REG32(ADR_MTX_MISC_EN)) & 0xffffefff)) ++#define SET_MTX_FORCE_BKF_RXEN0(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 13) | ((REG32(ADR_MTX_MISC_EN)) & 0xffffdfff)) ++#define SET_MTX_FORCE_DMA_RXEN0(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 14) | ((REG32(ADR_MTX_MISC_EN)) & 0xffffbfff)) ++#define SET_MTX_FORCE_RXEN0(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 15) | ((REG32(ADR_MTX_MISC_EN)) & 0xffff7fff)) ++#define SET_MTX_HALT_Q_MB(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_MISC_EN)) & 0xffc0ffff)) ++#define SET_MTX_CTS_SET_DIF(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 22) | ((REG32(ADR_MTX_MISC_EN)) & 0xffbfffff)) ++#define SET_MTX_AMPDU_SET_DIF(_VAL_) (REG32(ADR_MTX_MISC_EN)) = (((_VAL_) << 23) | ((REG32(ADR_MTX_MISC_EN)) & 0xff7fffff)) ++#define SET_MTX_EDCCA_TOUT(_VAL_) (REG32(ADR_MTX_EDCCA_TOUT)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_EDCCA_TOUT)) & 0xfffffc00)) ++#define SET_MTX_INT_BCN(_VAL_) (REG32(ADR_MTX_BCN_INT_STS)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_BCN_INT_STS)) & 0xfffffffd)) ++#define SET_MTX_INT_DTIM(_VAL_) (REG32(ADR_MTX_BCN_INT_STS)) = (((_VAL_) << 3) | ((REG32(ADR_MTX_BCN_INT_STS)) & 0xfffffff7)) ++#define SET_MTX_EN_INT_BCN(_VAL_) (REG32(ADR_MTX_BCN_EN_INT)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_BCN_EN_INT)) & 0xfffffffd)) ++#define SET_MTX_EN_INT_DTIM(_VAL_) (REG32(ADR_MTX_BCN_EN_INT)) = (((_VAL_) << 3) | ((REG32(ADR_MTX_BCN_EN_INT)) & 0xfffffff7)) ++#define SET_MTX_BCN_TIMER_EN(_VAL_) (REG32(ADR_MTX_BCN_EN_MISC)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_EN_MISC)) & 0xfffffffe)) ++#define SET_MTX_TIME_STAMP_AUTO_FILL(_VAL_) (REG32(ADR_MTX_BCN_EN_MISC)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_BCN_EN_MISC)) & 0xfffffffd)) ++#define SET_MTX_TSF_TIMER_EN(_VAL_) (REG32(ADR_MTX_BCN_EN_MISC)) = (((_VAL_) << 5) | ((REG32(ADR_MTX_BCN_EN_MISC)) & 0xffffffdf)) ++#define SET_MTX_HALT_MNG_UNTIL_DTIM(_VAL_) (REG32(ADR_MTX_BCN_EN_MISC)) = (((_VAL_) << 6) | ((REG32(ADR_MTX_BCN_EN_MISC)) & 0xffffffbf)) ++#define SET_MTX_INT_DTIM_NUM(_VAL_) (REG32(ADR_MTX_BCN_EN_MISC)) = (((_VAL_) << 8) | ((REG32(ADR_MTX_BCN_EN_MISC)) & 0xffff00ff)) ++#define SET_MTX_AUTO_FLUSH_Q4(_VAL_) (REG32(ADR_MTX_BCN_EN_MISC)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_BCN_EN_MISC)) & 0xfffeffff)) ++#define SET_MTX_BCN_PKTID_CH_LOCK(_VAL_) (REG32(ADR_MTX_BCN_MISC)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_MISC)) & 0xfffffffe)) ++#define SET_MTX_BCN_CFG_VLD(_VAL_) (REG32(ADR_MTX_BCN_MISC)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_BCN_MISC)) & 0xfffffff9)) ++#define SET_MTX_AUTO_BCN_ONGOING(_VAL_) (REG32(ADR_MTX_BCN_MISC)) = (((_VAL_) << 3) | ((REG32(ADR_MTX_BCN_MISC)) & 0xfffffff7)) ++#define SET_MTX_BCN_TIMER(_VAL_) (REG32(ADR_MTX_BCN_MISC)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_BCN_MISC)) & 0x0000ffff)) ++#define SET_MTX_BCN_PERIOD(_VAL_) (REG32(ADR_MTX_BCN_PRD)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_PRD)) & 0xffff0000)) ++#define SET_MTX_DTIM_NUM(_VAL_) (REG32(ADR_MTX_BCN_PRD)) = (((_VAL_) << 24) | ((REG32(ADR_MTX_BCN_PRD)) & 0x00ffffff)) ++#define SET_MTX_BCN_TSF_L(_VAL_) (REG32(ADR_MTX_BCN_TSF_L)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_TSF_L)) & 0x00000000)) ++#define SET_MTX_BCN_TSF_U(_VAL_) (REG32(ADR_MTX_BCN_TSF_U)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_TSF_U)) & 0x00000000)) ++#define SET_MTX_BCN_PKT_ID0(_VAL_) (REG32(ADR_MTX_BCN_CFG0)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_CFG0)) & 0xffffff80)) ++#define SET_MTX_DTIM_OFST0(_VAL_) (REG32(ADR_MTX_BCN_CFG0)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_BCN_CFG0)) & 0xfc00ffff)) ++#define SET_MTX_BCN_PKT_ID1(_VAL_) (REG32(ADR_MTX_BCN_CFG1)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_BCN_CFG1)) & 0xffffff80)) ++#define SET_MTX_DTIM_OFST1(_VAL_) (REG32(ADR_MTX_BCN_CFG1)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_BCN_CFG1)) & 0xfc00ffff)) ++#define SET_MTX_CCA(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_STATUS)) & 0xfffffffe)) ++#define SET_MRX_CCA(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_STATUS)) & 0xfffffffd)) ++#define SET_MTX_DMA_FSM(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 2) | ((REG32(ADR_MTX_STATUS)) & 0xffffffe3)) ++#define SET_CH_ST_FSM(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 5) | ((REG32(ADR_MTX_STATUS)) & 0xffffff1f)) ++#define SET_MTX_GNT_LOCK(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_MTX_STATUS)) & 0xfffffeff)) ++#define SET_MTX_DMA_REQ(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 9) | ((REG32(ADR_MTX_STATUS)) & 0xfffffdff)) ++#define SET_MTX_Q_REQ(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 10) | ((REG32(ADR_MTX_STATUS)) & 0xfffffbff)) ++#define SET_MTX_TX_EN(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 11) | ((REG32(ADR_MTX_STATUS)) & 0xfffff7ff)) ++#define SET_MRX_RX_EN(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 12) | ((REG32(ADR_MTX_STATUS)) & 0xffffefff)) ++#define SET_DBG_PRTC_PRD(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 13) | ((REG32(ADR_MTX_STATUS)) & 0xffffdfff)) ++#define SET_DBG_DMA_RDY(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 14) | ((REG32(ADR_MTX_STATUS)) & 0xffffbfff)) ++#define SET_DBG_WAIT_RSP(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 15) | ((REG32(ADR_MTX_STATUS)) & 0xffff7fff)) ++#define SET_DBG_CFRM_BUSY(_VAL_) (REG32(ADR_MTX_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_STATUS)) & 0xfffeffff)) ++#define SET_DBG_RST(_VAL_) (REG32(ADR_MTX_DBG_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DBG_CTRL)) & 0xfffffffe)) ++#define SET_DBG_MODE(_VAL_) (REG32(ADR_MTX_DBG_CTRL)) = (((_VAL_) << 1) | ((REG32(ADR_MTX_DBG_CTRL)) & 0xfffffffd)) ++#define SET_MB_REQ_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT0)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DBG_DAT0)) & 0xffff0000)) ++#define SET_RX_EN_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT0)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DBG_DAT0)) & 0x0000ffff)) ++#define SET_RX_CS_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT1)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DBG_DAT1)) & 0xffff0000)) ++#define SET_TX_CCA_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT1)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DBG_DAT1)) & 0x0000ffff)) ++#define SET_Q_REQ_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT2)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DBG_DAT2)) & 0xffff0000)) ++#define SET_CH_STA0_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT2)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DBG_DAT2)) & 0x0000ffff)) ++#define SET_MTX_DUR_RSP_TOUT_B(_VAL_) (REG32(ADR_MTX_DUR_TOUT)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DUR_TOUT)) & 0xffffff00)) ++#define SET_MTX_DUR_RSP_TOUT_G(_VAL_) (REG32(ADR_MTX_DUR_TOUT)) = (((_VAL_) << 8) | ((REG32(ADR_MTX_DUR_TOUT)) & 0xffff00ff)) ++#define SET_MTX_DUR_RSP_SIFS(_VAL_) (REG32(ADR_MTX_DUR_IFS)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DUR_IFS)) & 0xffffff00)) ++#define SET_MTX_DUR_BURST_SIFS(_VAL_) (REG32(ADR_MTX_DUR_IFS)) = (((_VAL_) << 8) | ((REG32(ADR_MTX_DUR_IFS)) & 0xffff00ff)) ++#define SET_MTX_DUR_SLOT(_VAL_) (REG32(ADR_MTX_DUR_IFS)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DUR_IFS)) & 0xffc0ffff)) ++#define SET_MTX_DUR_RSP_EIFS(_VAL_) (REG32(ADR_MTX_DUR_IFS)) = (((_VAL_) << 22) | ((REG32(ADR_MTX_DUR_IFS)) & 0x003fffff)) ++#define SET_MTX_DUR_RSP_SIFS_G(_VAL_) (REG32(ADR_MTX_DUR_SIFS_G)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DUR_SIFS_G)) & 0xffffff00)) ++#define SET_MTX_DUR_BURST_SIFS_G(_VAL_) (REG32(ADR_MTX_DUR_SIFS_G)) = (((_VAL_) << 8) | ((REG32(ADR_MTX_DUR_SIFS_G)) & 0xffff00ff)) ++#define SET_MTX_DUR_SLOT_G(_VAL_) (REG32(ADR_MTX_DUR_SIFS_G)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DUR_SIFS_G)) & 0xffc0ffff)) ++#define SET_MTX_DUR_RSP_EIFS_G(_VAL_) (REG32(ADR_MTX_DUR_SIFS_G)) = (((_VAL_) << 22) | ((REG32(ADR_MTX_DUR_SIFS_G)) & 0x003fffff)) ++#define SET_CH_STA1_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT3)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DBG_DAT3)) & 0xffff0000)) ++#define SET_CH_STA2_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT3)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DBG_DAT3)) & 0x0000ffff)) ++#define SET_MTX_NAV(_VAL_) (REG32(ADR_MTX_NAV)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_NAV)) & 0xffff0000)) ++#define SET_MTX_MIB_CNT0(_VAL_) (REG32(ADR_MTX_MIB_WSID0)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_MIB_WSID0)) & 0xc0000000)) ++#define SET_MTX_MIB_EN0(_VAL_) (REG32(ADR_MTX_MIB_WSID0)) = (((_VAL_) << 30) | ((REG32(ADR_MTX_MIB_WSID0)) & 0xbfffffff)) ++#define SET_MTX_MIB_CNT1(_VAL_) (REG32(ADR_MTX_MIB_WSID1)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_MIB_WSID1)) & 0xc0000000)) ++#define SET_MTX_MIB_EN1(_VAL_) (REG32(ADR_MTX_MIB_WSID1)) = (((_VAL_) << 30) | ((REG32(ADR_MTX_MIB_WSID1)) & 0xbfffffff)) ++#define SET_CH_STA3_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT4)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_DBG_DAT4)) & 0xffff0000)) ++#define SET_CH_STA4_DUR(_VAL_) (REG32(ADR_MTX_DBG_DAT4)) = (((_VAL_) << 16) | ((REG32(ADR_MTX_DBG_DAT4)) & 0x0000ffff)) ++#define SET_TXQ0_MTX_Q_PRE_LD(_VAL_) (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (((_VAL_) << 1) | ((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0xfffffffd)) ++#define SET_TXQ0_MTX_Q_BKF_CNT_FIXED(_VAL_) (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (((_VAL_) << 2) | ((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0xfffffffb)) ++#define SET_TXQ0_MTX_Q_TXOP_SUB_FRM_TIME(_VAL_) (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (((_VAL_) << 3) | ((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0xfffffff7)) ++#define SET_TXQ0_MTX_Q_MB_NO_RLS(_VAL_) (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (((_VAL_) << 4) | ((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0xffffffef)) ++#define SET_TXQ0_MTX_Q_TXOP_FRC_BUR(_VAL_) (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (((_VAL_) << 5) | ((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0xffffffdf)) ++#define SET_TXQ0_MTX_Q_RND_MODE(_VAL_) (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (((_VAL_) << 6) | ((REG32(ADR_TXQ0_MTX_Q_MISC_EN)) & 0xffffff3f)) ++#define SET_TXQ0_MTX_Q_AIFSN(_VAL_) (REG32(ADR_TXQ0_MTX_Q_AIFSN)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0xfffffff0)) ++#define SET_TXQ0_MTX_Q_ECWMIN(_VAL_) (REG32(ADR_TXQ0_MTX_Q_AIFSN)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0xfffff0ff)) ++#define SET_TXQ0_MTX_Q_ECWMAX(_VAL_) (REG32(ADR_TXQ0_MTX_Q_AIFSN)) = (((_VAL_) << 12) | ((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0xffff0fff)) ++#define SET_TXQ0_MTX_Q_TXOP_LIMIT(_VAL_) (REG32(ADR_TXQ0_MTX_Q_AIFSN)) = (((_VAL_) << 16) | ((REG32(ADR_TXQ0_MTX_Q_AIFSN)) & 0x0000ffff)) ++#define SET_TXQ0_MTX_Q_BKF_CNT(_VAL_) (REG32(ADR_TXQ0_MTX_Q_BKF_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ0_MTX_Q_BKF_CNT)) & 0xffff0000)) ++#define SET_TXQ0_MTX_Q_SRC_LIMIT(_VAL_) (REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) & 0xffffff00)) ++#define SET_TXQ0_MTX_Q_LRC_LIMIT(_VAL_) (REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) & 0xffff00ff)) ++#define SET_TXQ0_MTX_Q_ID_MAP_L(_VAL_) (REG32(ADR_TXQ0_MTX_Q_ID_MAP_L)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ0_MTX_Q_ID_MAP_L)) & 0x00000000)) ++#define SET_TXQ0_MTX_Q_TXOP_CH_THD(_VAL_) (REG32(ADR_TXQ0_MTX_Q_TXOP_CH_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ0_MTX_Q_TXOP_CH_THD)) & 0xffff0000)) ++#define SET_TXQ0_MTX_Q_TXOP_OV_THD(_VAL_) (REG32(ADR_TXQ0_MTX_Q_TXOP_OV_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ0_MTX_Q_TXOP_OV_THD)) & 0xffff0000)) ++#define SET_TXQ1_MTX_Q_PRE_LD(_VAL_) (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (((_VAL_) << 1) | ((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0xfffffffd)) ++#define SET_TXQ1_MTX_Q_BKF_CNT_FIXED(_VAL_) (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (((_VAL_) << 2) | ((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0xfffffffb)) ++#define SET_TXQ1_MTX_Q_TXOP_SUB_FRM_TIME(_VAL_) (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (((_VAL_) << 3) | ((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0xfffffff7)) ++#define SET_TXQ1_MTX_Q_MB_NO_RLS(_VAL_) (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (((_VAL_) << 4) | ((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0xffffffef)) ++#define SET_TXQ1_MTX_Q_TXOP_FRC_BUR(_VAL_) (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (((_VAL_) << 5) | ((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0xffffffdf)) ++#define SET_TXQ1_MTX_Q_RND_MODE(_VAL_) (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (((_VAL_) << 6) | ((REG32(ADR_TXQ1_MTX_Q_MISC_EN)) & 0xffffff3f)) ++#define SET_TXQ1_MTX_Q_AIFSN(_VAL_) (REG32(ADR_TXQ1_MTX_Q_AIFSN)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0xfffffff0)) ++#define SET_TXQ1_MTX_Q_ECWMIN(_VAL_) (REG32(ADR_TXQ1_MTX_Q_AIFSN)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0xfffff0ff)) ++#define SET_TXQ1_MTX_Q_ECWMAX(_VAL_) (REG32(ADR_TXQ1_MTX_Q_AIFSN)) = (((_VAL_) << 12) | ((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0xffff0fff)) ++#define SET_TXQ1_MTX_Q_TXOP_LIMIT(_VAL_) (REG32(ADR_TXQ1_MTX_Q_AIFSN)) = (((_VAL_) << 16) | ((REG32(ADR_TXQ1_MTX_Q_AIFSN)) & 0x0000ffff)) ++#define SET_TXQ1_MTX_Q_BKF_CNT(_VAL_) (REG32(ADR_TXQ1_MTX_Q_BKF_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ1_MTX_Q_BKF_CNT)) & 0xffff0000)) ++#define SET_TXQ1_MTX_Q_SRC_LIMIT(_VAL_) (REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) & 0xffffff00)) ++#define SET_TXQ1_MTX_Q_LRC_LIMIT(_VAL_) (REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) & 0xffff00ff)) ++#define SET_TXQ1_MTX_Q_ID_MAP_L(_VAL_) (REG32(ADR_TXQ1_MTX_Q_ID_MAP_L)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ1_MTX_Q_ID_MAP_L)) & 0x00000000)) ++#define SET_TXQ1_MTX_Q_TXOP_CH_THD(_VAL_) (REG32(ADR_TXQ1_MTX_Q_TXOP_CH_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ1_MTX_Q_TXOP_CH_THD)) & 0xffff0000)) ++#define SET_TXQ1_MTX_Q_TXOP_OV_THD(_VAL_) (REG32(ADR_TXQ1_MTX_Q_TXOP_OV_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ1_MTX_Q_TXOP_OV_THD)) & 0xffff0000)) ++#define SET_TXQ2_MTX_Q_PRE_LD(_VAL_) (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (((_VAL_) << 1) | ((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0xfffffffd)) ++#define SET_TXQ2_MTX_Q_BKF_CNT_FIXED(_VAL_) (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (((_VAL_) << 2) | ((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0xfffffffb)) ++#define SET_TXQ2_MTX_Q_TXOP_SUB_FRM_TIME(_VAL_) (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (((_VAL_) << 3) | ((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0xfffffff7)) ++#define SET_TXQ2_MTX_Q_MB_NO_RLS(_VAL_) (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (((_VAL_) << 4) | ((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0xffffffef)) ++#define SET_TXQ2_MTX_Q_TXOP_FRC_BUR(_VAL_) (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (((_VAL_) << 5) | ((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0xffffffdf)) ++#define SET_TXQ2_MTX_Q_RND_MODE(_VAL_) (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (((_VAL_) << 6) | ((REG32(ADR_TXQ2_MTX_Q_MISC_EN)) & 0xffffff3f)) ++#define SET_TXQ2_MTX_Q_AIFSN(_VAL_) (REG32(ADR_TXQ2_MTX_Q_AIFSN)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0xfffffff0)) ++#define SET_TXQ2_MTX_Q_ECWMIN(_VAL_) (REG32(ADR_TXQ2_MTX_Q_AIFSN)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0xfffff0ff)) ++#define SET_TXQ2_MTX_Q_ECWMAX(_VAL_) (REG32(ADR_TXQ2_MTX_Q_AIFSN)) = (((_VAL_) << 12) | ((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0xffff0fff)) ++#define SET_TXQ2_MTX_Q_TXOP_LIMIT(_VAL_) (REG32(ADR_TXQ2_MTX_Q_AIFSN)) = (((_VAL_) << 16) | ((REG32(ADR_TXQ2_MTX_Q_AIFSN)) & 0x0000ffff)) ++#define SET_TXQ2_MTX_Q_BKF_CNT(_VAL_) (REG32(ADR_TXQ2_MTX_Q_BKF_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ2_MTX_Q_BKF_CNT)) & 0xffff0000)) ++#define SET_TXQ2_MTX_Q_SRC_LIMIT(_VAL_) (REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) & 0xffffff00)) ++#define SET_TXQ2_MTX_Q_LRC_LIMIT(_VAL_) (REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) & 0xffff00ff)) ++#define SET_TXQ2_MTX_Q_ID_MAP_L(_VAL_) (REG32(ADR_TXQ2_MTX_Q_ID_MAP_L)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ2_MTX_Q_ID_MAP_L)) & 0x00000000)) ++#define SET_TXQ2_MTX_Q_TXOP_CH_THD(_VAL_) (REG32(ADR_TXQ2_MTX_Q_TXOP_CH_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ2_MTX_Q_TXOP_CH_THD)) & 0xffff0000)) ++#define SET_TXQ2_MTX_Q_TXOP_OV_THD(_VAL_) (REG32(ADR_TXQ2_MTX_Q_TXOP_OV_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ2_MTX_Q_TXOP_OV_THD)) & 0xffff0000)) ++#define SET_TXQ3_MTX_Q_PRE_LD(_VAL_) (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (((_VAL_) << 1) | ((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0xfffffffd)) ++#define SET_TXQ3_MTX_Q_BKF_CNT_FIXED(_VAL_) (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (((_VAL_) << 2) | ((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0xfffffffb)) ++#define SET_TXQ3_MTX_Q_TXOP_SUB_FRM_TIME(_VAL_) (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (((_VAL_) << 3) | ((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0xfffffff7)) ++#define SET_TXQ3_MTX_Q_MB_NO_RLS(_VAL_) (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (((_VAL_) << 4) | ((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0xffffffef)) ++#define SET_TXQ3_MTX_Q_TXOP_FRC_BUR(_VAL_) (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (((_VAL_) << 5) | ((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0xffffffdf)) ++#define SET_TXQ3_MTX_Q_RND_MODE(_VAL_) (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (((_VAL_) << 6) | ((REG32(ADR_TXQ3_MTX_Q_MISC_EN)) & 0xffffff3f)) ++#define SET_TXQ3_MTX_Q_AIFSN(_VAL_) (REG32(ADR_TXQ3_MTX_Q_AIFSN)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0xfffffff0)) ++#define SET_TXQ3_MTX_Q_ECWMIN(_VAL_) (REG32(ADR_TXQ3_MTX_Q_AIFSN)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0xfffff0ff)) ++#define SET_TXQ3_MTX_Q_ECWMAX(_VAL_) (REG32(ADR_TXQ3_MTX_Q_AIFSN)) = (((_VAL_) << 12) | ((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0xffff0fff)) ++#define SET_TXQ3_MTX_Q_TXOP_LIMIT(_VAL_) (REG32(ADR_TXQ3_MTX_Q_AIFSN)) = (((_VAL_) << 16) | ((REG32(ADR_TXQ3_MTX_Q_AIFSN)) & 0x0000ffff)) ++#define SET_TXQ3_MTX_Q_BKF_CNT(_VAL_) (REG32(ADR_TXQ3_MTX_Q_BKF_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ3_MTX_Q_BKF_CNT)) & 0xffff0000)) ++#define SET_TXQ3_MTX_Q_SRC_LIMIT(_VAL_) (REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) & 0xffffff00)) ++#define SET_TXQ3_MTX_Q_LRC_LIMIT(_VAL_) (REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) & 0xffff00ff)) ++#define SET_TXQ3_MTX_Q_ID_MAP_L(_VAL_) (REG32(ADR_TXQ3_MTX_Q_ID_MAP_L)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ3_MTX_Q_ID_MAP_L)) & 0x00000000)) ++#define SET_TXQ3_MTX_Q_TXOP_CH_THD(_VAL_) (REG32(ADR_TXQ3_MTX_Q_TXOP_CH_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ3_MTX_Q_TXOP_CH_THD)) & 0xffff0000)) ++#define SET_TXQ3_MTX_Q_TXOP_OV_THD(_VAL_) (REG32(ADR_TXQ3_MTX_Q_TXOP_OV_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ3_MTX_Q_TXOP_OV_THD)) & 0xffff0000)) ++#define SET_TXQ4_MTX_Q_PRE_LD(_VAL_) (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (((_VAL_) << 1) | ((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0xfffffffd)) ++#define SET_TXQ4_MTX_Q_BKF_CNT_FIXED(_VAL_) (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (((_VAL_) << 2) | ((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0xfffffffb)) ++#define SET_TXQ4_MTX_Q_TXOP_SUB_FRM_TIME(_VAL_) (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (((_VAL_) << 3) | ((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0xfffffff7)) ++#define SET_TXQ4_MTX_Q_MB_NO_RLS(_VAL_) (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (((_VAL_) << 4) | ((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0xffffffef)) ++#define SET_TXQ4_MTX_Q_TXOP_FRC_BUR(_VAL_) (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (((_VAL_) << 5) | ((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0xffffffdf)) ++#define SET_TXQ4_MTX_Q_RND_MODE(_VAL_) (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (((_VAL_) << 6) | ((REG32(ADR_TXQ4_MTX_Q_MISC_EN)) & 0xffffff3f)) ++#define SET_TXQ4_MTX_Q_AIFSN(_VAL_) (REG32(ADR_TXQ4_MTX_Q_AIFSN)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0xfffffff0)) ++#define SET_TXQ4_MTX_Q_ECWMIN(_VAL_) (REG32(ADR_TXQ4_MTX_Q_AIFSN)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0xfffff0ff)) ++#define SET_TXQ4_MTX_Q_ECWMAX(_VAL_) (REG32(ADR_TXQ4_MTX_Q_AIFSN)) = (((_VAL_) << 12) | ((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0xffff0fff)) ++#define SET_TXQ4_MTX_Q_TXOP_LIMIT(_VAL_) (REG32(ADR_TXQ4_MTX_Q_AIFSN)) = (((_VAL_) << 16) | ((REG32(ADR_TXQ4_MTX_Q_AIFSN)) & 0x0000ffff)) ++#define SET_TXQ4_MTX_Q_BKF_CNT(_VAL_) (REG32(ADR_TXQ4_MTX_Q_BKF_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ4_MTX_Q_BKF_CNT)) & 0xffff0000)) ++#define SET_TXQ4_MTX_Q_SRC_LIMIT(_VAL_) (REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) & 0xffffff00)) ++#define SET_TXQ4_MTX_Q_LRC_LIMIT(_VAL_) (REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) = (((_VAL_) << 8) | ((REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) & 0xffff00ff)) ++#define SET_TXQ4_MTX_Q_ID_MAP_L(_VAL_) (REG32(ADR_TXQ4_MTX_Q_ID_MAP_L)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ4_MTX_Q_ID_MAP_L)) & 0x00000000)) ++#define SET_TXQ4_MTX_Q_TXOP_CH_THD(_VAL_) (REG32(ADR_TXQ4_MTX_Q_TXOP_CH_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ4_MTX_Q_TXOP_CH_THD)) & 0xffff0000)) ++#define SET_TXQ4_MTX_Q_TXOP_OV_THD(_VAL_) (REG32(ADR_TXQ4_MTX_Q_TXOP_OV_THD)) = (((_VAL_) << 0) | ((REG32(ADR_TXQ4_MTX_Q_TXOP_OV_THD)) & 0xffff0000)) ++#define SET_VALID0(_VAL_) (REG32(ADR_WSID0)) = (((_VAL_) << 0) | ((REG32(ADR_WSID0)) & 0xfffffffe)) ++#define SET_PEER_QOS_EN0(_VAL_) (REG32(ADR_WSID0)) = (((_VAL_) << 1) | ((REG32(ADR_WSID0)) & 0xfffffffd)) ++#define SET_PEER_OP_MODE0(_VAL_) (REG32(ADR_WSID0)) = (((_VAL_) << 2) | ((REG32(ADR_WSID0)) & 0xfffffff3)) ++#define SET_PEER_HT_MODE0(_VAL_) (REG32(ADR_WSID0)) = (((_VAL_) << 4) | ((REG32(ADR_WSID0)) & 0xffffffcf)) ++#define SET_PEER_MAC0_31_0(_VAL_) (REG32(ADR_PEER_MAC0_0)) = (((_VAL_) << 0) | ((REG32(ADR_PEER_MAC0_0)) & 0x00000000)) ++#define SET_PEER_MAC0_47_32(_VAL_) (REG32(ADR_PEER_MAC0_1)) = (((_VAL_) << 0) | ((REG32(ADR_PEER_MAC0_1)) & 0xffff0000)) ++#define SET_TX_ACK_POLICY_0_0(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_0)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_0(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_0)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_1(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_1)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_1(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_1)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_2(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_2)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_2(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_2)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_3(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_3)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_3)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_3(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_3)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_3)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_4(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_4)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_4)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_4(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_4)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_4)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_5(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_5)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_5)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_5(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_5)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_5)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_6(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_6)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_6)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_6(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_6)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_6)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_0_7(_VAL_) (REG32(ADR_TX_ACK_POLICY_0_7)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_0_7)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_0_7(_VAL_) (REG32(ADR_TX_SEQ_CTRL_0_7)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_0_7)) & 0xfffff000)) ++#define SET_VALID1(_VAL_) (REG32(ADR_WSID1)) = (((_VAL_) << 0) | ((REG32(ADR_WSID1)) & 0xfffffffe)) ++#define SET_PEER_QOS_EN1(_VAL_) (REG32(ADR_WSID1)) = (((_VAL_) << 1) | ((REG32(ADR_WSID1)) & 0xfffffffd)) ++#define SET_PEER_OP_MODE1(_VAL_) (REG32(ADR_WSID1)) = (((_VAL_) << 2) | ((REG32(ADR_WSID1)) & 0xfffffff3)) ++#define SET_PEER_HT_MODE1(_VAL_) (REG32(ADR_WSID1)) = (((_VAL_) << 4) | ((REG32(ADR_WSID1)) & 0xffffffcf)) ++#define SET_PEER_MAC1_31_0(_VAL_) (REG32(ADR_PEER_MAC1_0)) = (((_VAL_) << 0) | ((REG32(ADR_PEER_MAC1_0)) & 0x00000000)) ++#define SET_PEER_MAC1_47_32(_VAL_) (REG32(ADR_PEER_MAC1_1)) = (((_VAL_) << 0) | ((REG32(ADR_PEER_MAC1_1)) & 0xffff0000)) ++#define SET_TX_ACK_POLICY_1_0(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_0)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_0(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_0)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_1(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_1)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_1(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_1)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_2(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_2)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_2(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_2)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_3(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_3)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_3)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_3(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_3)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_3)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_4(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_4)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_4)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_4(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_4)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_4)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_5(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_5)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_5)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_5(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_5)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_5)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_6(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_6)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_6)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_6(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_6)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_6)) & 0xfffff000)) ++#define SET_TX_ACK_POLICY_1_7(_VAL_) (REG32(ADR_TX_ACK_POLICY_1_7)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ACK_POLICY_1_7)) & 0xfffffffc)) ++#define SET_TX_SEQ_CTRL_1_7(_VAL_) (REG32(ADR_TX_SEQ_CTRL_1_7)) = (((_VAL_) << 0) | ((REG32(ADR_TX_SEQ_CTRL_1_7)) & 0xfffff000)) ++#define SET_INFO0(_VAL_) (REG32(ADR_INFO0)) = (((_VAL_) << 0) | ((REG32(ADR_INFO0)) & 0x00000000)) ++#define SET_INFO1(_VAL_) (REG32(ADR_INFO1)) = (((_VAL_) << 0) | ((REG32(ADR_INFO1)) & 0x00000000)) ++#define SET_INFO2(_VAL_) (REG32(ADR_INFO2)) = (((_VAL_) << 0) | ((REG32(ADR_INFO2)) & 0x00000000)) ++#define SET_INFO3(_VAL_) (REG32(ADR_INFO3)) = (((_VAL_) << 0) | ((REG32(ADR_INFO3)) & 0x00000000)) ++#define SET_INFO4(_VAL_) (REG32(ADR_INFO4)) = (((_VAL_) << 0) | ((REG32(ADR_INFO4)) & 0x00000000)) ++#define SET_INFO5(_VAL_) (REG32(ADR_INFO5)) = (((_VAL_) << 0) | ((REG32(ADR_INFO5)) & 0x00000000)) ++#define SET_INFO6(_VAL_) (REG32(ADR_INFO6)) = (((_VAL_) << 0) | ((REG32(ADR_INFO6)) & 0x00000000)) ++#define SET_INFO7(_VAL_) (REG32(ADR_INFO7)) = (((_VAL_) << 0) | ((REG32(ADR_INFO7)) & 0x00000000)) ++#define SET_INFO8(_VAL_) (REG32(ADR_INFO8)) = (((_VAL_) << 0) | ((REG32(ADR_INFO8)) & 0x00000000)) ++#define SET_INFO9(_VAL_) (REG32(ADR_INFO9)) = (((_VAL_) << 0) | ((REG32(ADR_INFO9)) & 0x00000000)) ++#define SET_INFO10(_VAL_) (REG32(ADR_INFO10)) = (((_VAL_) << 0) | ((REG32(ADR_INFO10)) & 0x00000000)) ++#define SET_INFO11(_VAL_) (REG32(ADR_INFO11)) = (((_VAL_) << 0) | ((REG32(ADR_INFO11)) & 0x00000000)) ++#define SET_INFO12(_VAL_) (REG32(ADR_INFO12)) = (((_VAL_) << 0) | ((REG32(ADR_INFO12)) & 0x00000000)) ++#define SET_INFO13(_VAL_) (REG32(ADR_INFO13)) = (((_VAL_) << 0) | ((REG32(ADR_INFO13)) & 0x00000000)) ++#define SET_INFO14(_VAL_) (REG32(ADR_INFO14)) = (((_VAL_) << 0) | ((REG32(ADR_INFO14)) & 0x00000000)) ++#define SET_INFO15(_VAL_) (REG32(ADR_INFO15)) = (((_VAL_) << 0) | ((REG32(ADR_INFO15)) & 0x00000000)) ++#define SET_INFO16(_VAL_) (REG32(ADR_INFO16)) = (((_VAL_) << 0) | ((REG32(ADR_INFO16)) & 0x00000000)) ++#define SET_INFO17(_VAL_) (REG32(ADR_INFO17)) = (((_VAL_) << 0) | ((REG32(ADR_INFO17)) & 0x00000000)) ++#define SET_INFO18(_VAL_) (REG32(ADR_INFO18)) = (((_VAL_) << 0) | ((REG32(ADR_INFO18)) & 0x00000000)) ++#define SET_INFO19(_VAL_) (REG32(ADR_INFO19)) = (((_VAL_) << 0) | ((REG32(ADR_INFO19)) & 0x00000000)) ++#define SET_INFO20(_VAL_) (REG32(ADR_INFO20)) = (((_VAL_) << 0) | ((REG32(ADR_INFO20)) & 0x00000000)) ++#define SET_INFO21(_VAL_) (REG32(ADR_INFO21)) = (((_VAL_) << 0) | ((REG32(ADR_INFO21)) & 0x00000000)) ++#define SET_INFO22(_VAL_) (REG32(ADR_INFO22)) = (((_VAL_) << 0) | ((REG32(ADR_INFO22)) & 0x00000000)) ++#define SET_INFO23(_VAL_) (REG32(ADR_INFO23)) = (((_VAL_) << 0) | ((REG32(ADR_INFO23)) & 0x00000000)) ++#define SET_INFO24(_VAL_) (REG32(ADR_INFO24)) = (((_VAL_) << 0) | ((REG32(ADR_INFO24)) & 0x00000000)) ++#define SET_INFO25(_VAL_) (REG32(ADR_INFO25)) = (((_VAL_) << 0) | ((REG32(ADR_INFO25)) & 0x00000000)) ++#define SET_INFO26(_VAL_) (REG32(ADR_INFO26)) = (((_VAL_) << 0) | ((REG32(ADR_INFO26)) & 0x00000000)) ++#define SET_INFO27(_VAL_) (REG32(ADR_INFO27)) = (((_VAL_) << 0) | ((REG32(ADR_INFO27)) & 0x00000000)) ++#define SET_INFO28(_VAL_) (REG32(ADR_INFO28)) = (((_VAL_) << 0) | ((REG32(ADR_INFO28)) & 0x00000000)) ++#define SET_INFO29(_VAL_) (REG32(ADR_INFO29)) = (((_VAL_) << 0) | ((REG32(ADR_INFO29)) & 0x00000000)) ++#define SET_INFO30(_VAL_) (REG32(ADR_INFO30)) = (((_VAL_) << 0) | ((REG32(ADR_INFO30)) & 0x00000000)) ++#define SET_INFO31(_VAL_) (REG32(ADR_INFO31)) = (((_VAL_) << 0) | ((REG32(ADR_INFO31)) & 0x00000000)) ++#define SET_INFO32(_VAL_) (REG32(ADR_INFO32)) = (((_VAL_) << 0) | ((REG32(ADR_INFO32)) & 0x00000000)) ++#define SET_INFO33(_VAL_) (REG32(ADR_INFO33)) = (((_VAL_) << 0) | ((REG32(ADR_INFO33)) & 0x00000000)) ++#define SET_INFO34(_VAL_) (REG32(ADR_INFO34)) = (((_VAL_) << 0) | ((REG32(ADR_INFO34)) & 0x00000000)) ++#define SET_INFO35(_VAL_) (REG32(ADR_INFO35)) = (((_VAL_) << 0) | ((REG32(ADR_INFO35)) & 0x00000000)) ++#define SET_INFO36(_VAL_) (REG32(ADR_INFO36)) = (((_VAL_) << 0) | ((REG32(ADR_INFO36)) & 0x00000000)) ++#define SET_INFO37(_VAL_) (REG32(ADR_INFO37)) = (((_VAL_) << 0) | ((REG32(ADR_INFO37)) & 0x00000000)) ++#define SET_INFO38(_VAL_) (REG32(ADR_INFO38)) = (((_VAL_) << 0) | ((REG32(ADR_INFO38)) & 0x00000000)) ++#define SET_INFO_MASK(_VAL_) (REG32(ADR_INFO_MASK)) = (((_VAL_) << 0) | ((REG32(ADR_INFO_MASK)) & 0x00000000)) ++#define SET_INFO_DEF_RATE(_VAL_) (REG32(ADR_INFO_RATE_OFFSET)) = (((_VAL_) << 0) | ((REG32(ADR_INFO_RATE_OFFSET)) & 0xffffffc0)) ++#define SET_INFO_MRX_OFFSET(_VAL_) (REG32(ADR_INFO_RATE_OFFSET)) = (((_VAL_) << 16) | ((REG32(ADR_INFO_RATE_OFFSET)) & 0xfff0ffff)) ++#define SET_BCAST_RATEUNKNOW(_VAL_) (REG32(ADR_INFO_RATE_OFFSET)) = (((_VAL_) << 24) | ((REG32(ADR_INFO_RATE_OFFSET)) & 0xc0ffffff)) ++#define SET_INFO_IDX_TBL_ADDR(_VAL_) (REG32(ADR_INFO_IDX_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_INFO_IDX_ADDR)) & 0x00000000)) ++#define SET_INFO_LEN_TBL_ADDR(_VAL_) (REG32(ADR_INFO_LEN_ADDR)) = (((_VAL_) << 0) | ((REG32(ADR_INFO_LEN_ADDR)) & 0x00000000)) ++#define SET_IC_TAG_31_0(_VAL_) (REG32(ADR_IC_TIME_TAG_0)) = (((_VAL_) << 0) | ((REG32(ADR_IC_TIME_TAG_0)) & 0x00000000)) ++#define SET_IC_TAG_63_32(_VAL_) (REG32(ADR_IC_TIME_TAG_1)) = (((_VAL_) << 0) | ((REG32(ADR_IC_TIME_TAG_1)) & 0x00000000)) ++#define SET_CH1_PRI(_VAL_) (REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) = (((_VAL_) << 0) | ((REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) & 0xfffffffc)) ++#define SET_CH2_PRI(_VAL_) (REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) = (((_VAL_) << 8) | ((REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) & 0xfffffcff)) ++#define SET_CH3_PRI(_VAL_) (REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) = (((_VAL_) << 16) | ((REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) & 0xfffcffff)) ++#define SET_RG_MAC_LPBK(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 0) | ((REG32(ADR_MAC_MODE)) & 0xfffffffe)) ++#define SET_RG_MAC_M2M(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 1) | ((REG32(ADR_MAC_MODE)) & 0xfffffffd)) ++#define SET_RG_PHY_LPBK(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 2) | ((REG32(ADR_MAC_MODE)) & 0xfffffffb)) ++#define SET_RG_LPBK_RX_EN(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 3) | ((REG32(ADR_MAC_MODE)) & 0xfffffff7)) ++#define SET_EXT_MAC_MODE(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 4) | ((REG32(ADR_MAC_MODE)) & 0xffffffef)) ++#define SET_EXT_PHY_MODE(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 5) | ((REG32(ADR_MAC_MODE)) & 0xffffffdf)) ++#define SET_ASIC_TAG(_VAL_) (REG32(ADR_MAC_MODE)) = (((_VAL_) << 24) | ((REG32(ADR_MAC_MODE)) & 0x00ffffff)) ++#define SET_HCI_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 0) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xfffffffe)) ++#define SET_CO_PROC_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 1) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xfffffffd)) ++#define SET_MTX_MISC_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 3) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xfffffff7)) ++#define SET_MTX_QUE_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 4) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffffef)) ++#define SET_MTX_CHST_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 5) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffffdf)) ++#define SET_MTX_BCN_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 6) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffffbf)) ++#define SET_MRX_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 7) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffff7f)) ++#define SET_AMPDU_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 8) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xfffffeff)) ++#define SET_MMU_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 9) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xfffffdff)) ++#define SET_ID_MNG_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 11) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xfffff7ff)) ++#define SET_MBOX_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 12) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffefff)) ++#define SET_SCRT_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 13) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffdfff)) ++#define SET_MIC_SW_RST(_VAL_) (REG32(ADR_ALL_SOFTWARE_RESET)) = (((_VAL_) << 14) | ((REG32(ADR_ALL_SOFTWARE_RESET)) & 0xffffbfff)) ++#define SET_CO_PROC_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 1) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xfffffffd)) ++#define SET_MTX_MISC_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 3) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xfffffff7)) ++#define SET_MTX_QUE_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 4) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xffffffef)) ++#define SET_MTX_CHST_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 5) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xffffffdf)) ++#define SET_MTX_BCN_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 6) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xffffffbf)) ++#define SET_MRX_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 7) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xffffff7f)) ++#define SET_AMPDU_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 8) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xfffffeff)) ++#define SET_ID_MNG_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 14) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xffffbfff)) ++#define SET_MBOX_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 15) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xffff7fff)) ++#define SET_SCRT_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 16) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xfffeffff)) ++#define SET_MIC_ENG_RST(_VAL_) (REG32(ADR_ENG_SOFTWARE_RESET)) = (((_VAL_) << 17) | ((REG32(ADR_ENG_SOFTWARE_RESET)) & 0xfffdffff)) ++#define SET_CO_PROC_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 1) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xfffffffd)) ++#define SET_MTX_MISC_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 3) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xfffffff7)) ++#define SET_MTX_QUE0_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 4) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffffffef)) ++#define SET_MTX_QUE1_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 5) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffffffdf)) ++#define SET_MTX_QUE2_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 6) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffffffbf)) ++#define SET_MTX_QUE3_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 7) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffffff7f)) ++#define SET_MTX_QUE4_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 8) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xfffffeff)) ++#define SET_MTX_QUE5_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 9) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xfffffdff)) ++#define SET_MRX_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 10) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xfffffbff)) ++#define SET_AMPDU_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 11) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xfffff7ff)) ++#define SET_SCRT_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 13) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffffdfff)) ++#define SET_ID_MNG_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 14) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffffbfff)) ++#define SET_MBOX_CSR_RST(_VAL_) (REG32(ADR_CSR_SOFTWARE_RESET)) = (((_VAL_) << 15) | ((REG32(ADR_CSR_SOFTWARE_RESET)) & 0xffff7fff)) ++#define SET_HCI_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 0) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xfffffffe)) ++#define SET_CO_PROC_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 1) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xfffffffd)) ++#define SET_MTX_MISC_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 3) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xfffffff7)) ++#define SET_MTX_QUE_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 4) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xffffffef)) ++#define SET_MRX_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 5) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xffffffdf)) ++#define SET_AMPDU_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 6) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xffffffbf)) ++#define SET_MMU_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 7) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xffffff7f)) ++#define SET_ID_MNG_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 9) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xfffffdff)) ++#define SET_MBOX_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 10) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xfffffbff)) ++#define SET_SCRT_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 11) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xfffff7ff)) ++#define SET_MIC_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 12) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xffffefff)) ++#define SET_MIB_CLK_EN(_VAL_) (REG32(ADR_MAC_CLOCK_ENABLE)) = (((_VAL_) << 13) | ((REG32(ADR_MAC_CLOCK_ENABLE)) & 0xffffdfff)) ++#define SET_HCI_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 0) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xfffffffe)) ++#define SET_CO_PROC_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 1) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xfffffffd)) ++#define SET_MTX_MISC_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 3) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xfffffff7)) ++#define SET_MTX_QUE_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 4) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffffffef)) ++#define SET_MRX_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 5) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffffffdf)) ++#define SET_AMPDU_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 6) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffffffbf)) ++#define SET_ID_MNG_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 12) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffffefff)) ++#define SET_MBOX_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 13) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffffdfff)) ++#define SET_SCRT_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 14) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffffbfff)) ++#define SET_MIC_ENG_CLK_EN(_VAL_) (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (((_VAL_) << 15) | ((REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) & 0xffff7fff)) ++#define SET_CO_PROC_CSR_CLK_EN(_VAL_) (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (((_VAL_) << 1) | ((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0xfffffffd)) ++#define SET_MRX_CSR_CLK_EN(_VAL_) (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (((_VAL_) << 10) | ((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0xfffffbff)) ++#define SET_AMPDU_CSR_CLK_EN(_VAL_) (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (((_VAL_) << 11) | ((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0xfffff7ff)) ++#define SET_SCRT_CSR_CLK_EN(_VAL_) (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (((_VAL_) << 13) | ((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0xffffdfff)) ++#define SET_ID_MNG_CSR_CLK_EN(_VAL_) (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (((_VAL_) << 14) | ((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0xffffbfff)) ++#define SET_MBOX_CSR_CLK_EN(_VAL_) (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (((_VAL_) << 15) | ((REG32(ADR_MAC_CSR_CLOCK_ENABLE)) & 0xffff7fff)) ++#define SET_OP_MODE(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 0) | ((REG32(ADR_GLBLE_SET)) & 0xfffffffc)) ++#define SET_HT_MODE(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 2) | ((REG32(ADR_GLBLE_SET)) & 0xfffffff3)) ++#define SET_QOS_EN(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 4) | ((REG32(ADR_GLBLE_SET)) & 0xffffffef)) ++#define SET_PB_OFFSET(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 8) | ((REG32(ADR_GLBLE_SET)) & 0xffff00ff)) ++#define SET_SNIFFER_MODE(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 16) | ((REG32(ADR_GLBLE_SET)) & 0xfffeffff)) ++#define SET_DUP_FLT(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 17) | ((REG32(ADR_GLBLE_SET)) & 0xfffdffff)) ++#define SET_TX_PKT_RSVD(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 18) | ((REG32(ADR_GLBLE_SET)) & 0xffe3ffff)) ++#define SET_AMPDU_SNIFFER(_VAL_) (REG32(ADR_GLBLE_SET)) = (((_VAL_) << 21) | ((REG32(ADR_GLBLE_SET)) & 0xffdfffff)) ++#define SET_REASON_TRAP0(_VAL_) (REG32(ADR_REASON_TRAP0)) = (((_VAL_) << 0) | ((REG32(ADR_REASON_TRAP0)) & 0x00000000)) ++#define SET_REASON_TRAP1(_VAL_) (REG32(ADR_REASON_TRAP1)) = (((_VAL_) << 0) | ((REG32(ADR_REASON_TRAP1)) & 0x00000000)) ++#define SET_BSSID_31_0(_VAL_) (REG32(ADR_BSSID_0)) = (((_VAL_) << 0) | ((REG32(ADR_BSSID_0)) & 0x00000000)) ++#define SET_BSSID_47_32(_VAL_) (REG32(ADR_BSSID_1)) = (((_VAL_) << 0) | ((REG32(ADR_BSSID_1)) & 0xffff0000)) ++#define SET_SCRT_STATE(_VAL_) (REG32(ADR_SCRT_STATE)) = (((_VAL_) << 0) | ((REG32(ADR_SCRT_STATE)) & 0xfffffff0)) ++#define SET_STA_MAC_31_0(_VAL_) (REG32(ADR_STA_MAC_0)) = (((_VAL_) << 0) | ((REG32(ADR_STA_MAC_0)) & 0x00000000)) ++#define SET_STA_MAC_47_32(_VAL_) (REG32(ADR_STA_MAC_1)) = (((_VAL_) << 0) | ((REG32(ADR_STA_MAC_1)) & 0xffff0000)) ++#define SET_PAIR_SCRT(_VAL_) (REG32(ADR_SCRT_SET)) = (((_VAL_) << 0) | ((REG32(ADR_SCRT_SET)) & 0xfffffff8)) ++#define SET_GRP_SCRT(_VAL_) (REG32(ADR_SCRT_SET)) = (((_VAL_) << 3) | ((REG32(ADR_SCRT_SET)) & 0xffffffc7)) ++#define SET_SCRT_PKT_ID(_VAL_) (REG32(ADR_SCRT_SET)) = (((_VAL_) << 6) | ((REG32(ADR_SCRT_SET)) & 0xffffe03f)) ++#define SET_SCRT_RPLY_IGNORE(_VAL_) (REG32(ADR_SCRT_SET)) = (((_VAL_) << 16) | ((REG32(ADR_SCRT_SET)) & 0xfffeffff)) ++#define SET_COEXIST_EN(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 0) | ((REG32(ADR_BTCX0)) & 0xfffffffe)) ++#define SET_WIRE_MODE(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 1) | ((REG32(ADR_BTCX0)) & 0xfffffff1)) ++#define SET_WL_RX_PRI(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 4) | ((REG32(ADR_BTCX0)) & 0xffffffef)) ++#define SET_WL_TX_PRI(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 5) | ((REG32(ADR_BTCX0)) & 0xffffffdf)) ++#define SET_GURAN_USE_EN(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 8) | ((REG32(ADR_BTCX0)) & 0xfffffeff)) ++#define SET_GURAN_USE_CTRL(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 9) | ((REG32(ADR_BTCX0)) & 0xfffffdff)) ++#define SET_BEACON_TIMEOUT_EN(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 10) | ((REG32(ADR_BTCX0)) & 0xfffffbff)) ++#define SET_WLAN_ACT_POL(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 11) | ((REG32(ADR_BTCX0)) & 0xfffff7ff)) ++#define SET_DUAL_ANT_EN(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 12) | ((REG32(ADR_BTCX0)) & 0xffffefff)) ++#define SET_TRSW_PHY_POL(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 16) | ((REG32(ADR_BTCX0)) & 0xfffeffff)) ++#define SET_WIFI_TX_SW_POL(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 17) | ((REG32(ADR_BTCX0)) & 0xfffdffff)) ++#define SET_WIFI_RX_SW_POL(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 18) | ((REG32(ADR_BTCX0)) & 0xfffbffff)) ++#define SET_BT_SW_POL(_VAL_) (REG32(ADR_BTCX0)) = (((_VAL_) << 19) | ((REG32(ADR_BTCX0)) & 0xfff7ffff)) ++#define SET_BT_PRI_SMP_TIME(_VAL_) (REG32(ADR_BTCX1)) = (((_VAL_) << 0) | ((REG32(ADR_BTCX1)) & 0xffffff00)) ++#define SET_BT_STA_SMP_TIME(_VAL_) (REG32(ADR_BTCX1)) = (((_VAL_) << 8) | ((REG32(ADR_BTCX1)) & 0xffff00ff)) ++#define SET_BEACON_TIMEOUT(_VAL_) (REG32(ADR_BTCX1)) = (((_VAL_) << 16) | ((REG32(ADR_BTCX1)) & 0xff00ffff)) ++#define SET_WLAN_REMAIN_TIME(_VAL_) (REG32(ADR_BTCX1)) = (((_VAL_) << 24) | ((REG32(ADR_BTCX1)) & 0x00ffffff)) ++#define SET_SW_MANUAL_EN(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 0) | ((REG32(ADR_SWITCH_CTL)) & 0xfffffffe)) ++#define SET_SW_WL_TX(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 1) | ((REG32(ADR_SWITCH_CTL)) & 0xfffffffd)) ++#define SET_SW_WL_RX(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 2) | ((REG32(ADR_SWITCH_CTL)) & 0xfffffffb)) ++#define SET_SW_BT_TRX(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 3) | ((REG32(ADR_SWITCH_CTL)) & 0xfffffff7)) ++#define SET_BT_TXBAR_MANUAL_EN(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 4) | ((REG32(ADR_SWITCH_CTL)) & 0xffffffef)) ++#define SET_BT_TXBAR_SET(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 5) | ((REG32(ADR_SWITCH_CTL)) & 0xffffffdf)) ++#define SET_BT_BUSY_MANUAL_EN(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 8) | ((REG32(ADR_SWITCH_CTL)) & 0xfffffeff)) ++#define SET_BT_BUSY_SET(_VAL_) (REG32(ADR_SWITCH_CTL)) = (((_VAL_) << 9) | ((REG32(ADR_SWITCH_CTL)) & 0xfffffdff)) ++#define SET_G0_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 2) | ((REG32(ADR_MIB_EN)) & 0xfffffffb)) ++#define SET_G0_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 3) | ((REG32(ADR_MIB_EN)) & 0xfffffff7)) ++#define SET_G1_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 4) | ((REG32(ADR_MIB_EN)) & 0xffffffef)) ++#define SET_G1_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 5) | ((REG32(ADR_MIB_EN)) & 0xffffffdf)) ++#define SET_Q0_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 6) | ((REG32(ADR_MIB_EN)) & 0xffffffbf)) ++#define SET_Q0_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 7) | ((REG32(ADR_MIB_EN)) & 0xffffff7f)) ++#define SET_Q1_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 8) | ((REG32(ADR_MIB_EN)) & 0xfffffeff)) ++#define SET_Q1_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 9) | ((REG32(ADR_MIB_EN)) & 0xfffffdff)) ++#define SET_Q2_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 10) | ((REG32(ADR_MIB_EN)) & 0xfffffbff)) ++#define SET_Q2_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 11) | ((REG32(ADR_MIB_EN)) & 0xfffff7ff)) ++#define SET_Q3_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 12) | ((REG32(ADR_MIB_EN)) & 0xffffefff)) ++#define SET_Q3_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 13) | ((REG32(ADR_MIB_EN)) & 0xffffdfff)) ++#define SET_SCRT_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 14) | ((REG32(ADR_MIB_EN)) & 0xffffbfff)) ++#define SET_SCRT_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 15) | ((REG32(ADR_MIB_EN)) & 0xffff7fff)) ++#define SET_MISC_PKT_CLS_MIB_EN(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 16) | ((REG32(ADR_MIB_EN)) & 0xfffeffff)) ++#define SET_MISC_PKT_CLS_ONGOING(_VAL_) (REG32(ADR_MIB_EN)) = (((_VAL_) << 17) | ((REG32(ADR_MIB_EN)) & 0xfffdffff)) ++#define SET_MTX_WSID0_SUCC(_VAL_) (REG32(ADR_MTX_WSID0_SUCC)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_WSID0_SUCC)) & 0xffff0000)) ++#define SET_MTX_WSID0_FRM(_VAL_) (REG32(ADR_MTX_WSID0_FRM)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_WSID0_FRM)) & 0xffff0000)) ++#define SET_MTX_WSID0_RETRY(_VAL_) (REG32(ADR_MTX_WSID0_RETRY)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_WSID0_RETRY)) & 0xffff0000)) ++#define SET_MTX_WSID0_TOTAL(_VAL_) (REG32(ADR_MTX_WSID0_TOTAL)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_WSID0_TOTAL)) & 0xffff0000)) ++#define SET_MTX_GRP(_VAL_) (REG32(ADR_MTX_GROUP)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_GROUP)) & 0xfff00000)) ++#define SET_MTX_FAIL(_VAL_) (REG32(ADR_MTX_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_FAIL)) & 0xffff0000)) ++#define SET_MTX_RETRY(_VAL_) (REG32(ADR_MTX_RETRY)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_RETRY)) & 0xfff00000)) ++#define SET_MTX_MULTI_RETRY(_VAL_) (REG32(ADR_MTX_MULTI_RETRY)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_MULTI_RETRY)) & 0xfff00000)) ++#define SET_MTX_RTS_SUCC(_VAL_) (REG32(ADR_MTX_RTS_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_RTS_SUCCESS)) & 0xffff0000)) ++#define SET_MTX_RTS_FAIL(_VAL_) (REG32(ADR_MTX_RTS_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_RTS_FAIL)) & 0xffff0000)) ++#define SET_MTX_ACK_FAIL(_VAL_) (REG32(ADR_MTX_ACK_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_ACK_FAIL)) & 0xffff0000)) ++#define SET_MTX_FRM(_VAL_) (REG32(ADR_MTX_FRM)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_FRM)) & 0xfff00000)) ++#define SET_MTX_ACK_TX(_VAL_) (REG32(ADR_MTX_ACK_TX)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_ACK_TX)) & 0xffff0000)) ++#define SET_MTX_CTS_TX(_VAL_) (REG32(ADR_MTX_CTS_TX)) = (((_VAL_) << 0) | ((REG32(ADR_MTX_CTS_TX)) & 0xffff0000)) ++#define SET_MRX_DUP(_VAL_) (REG32(ADR_MRX_DUP_FRM)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_DUP_FRM)) & 0xffff0000)) ++#define SET_MRX_FRG(_VAL_) (REG32(ADR_MRX_FRG_FRM)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FRG_FRM)) & 0xfff00000)) ++#define SET_MRX_GRP(_VAL_) (REG32(ADR_MRX_GROUP_FRM)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_GROUP_FRM)) & 0xfff00000)) ++#define SET_MRX_FCS_ERR(_VAL_) (REG32(ADR_MRX_FCS_ERR)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FCS_ERR)) & 0xffff0000)) ++#define SET_MRX_FCS_SUC(_VAL_) (REG32(ADR_MRX_FCS_SUCC)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_FCS_SUCC)) & 0xffff0000)) ++#define SET_MRX_MISS(_VAL_) (REG32(ADR_MRX_MISS)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MISS)) & 0xffff0000)) ++#define SET_MRX_ALC_FAIL(_VAL_) (REG32(ADR_MRX_ALC_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_ALC_FAIL)) & 0xffff0000)) ++#define SET_MRX_DAT_NTF(_VAL_) (REG32(ADR_MRX_DAT_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_DAT_NTF)) & 0xffff0000)) ++#define SET_MRX_RTS_NTF(_VAL_) (REG32(ADR_MRX_RTS_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_RTS_NTF)) & 0xffff0000)) ++#define SET_MRX_CTS_NTF(_VAL_) (REG32(ADR_MRX_CTS_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_CTS_NTF)) & 0xffff0000)) ++#define SET_MRX_ACK_NTF(_VAL_) (REG32(ADR_MRX_ACK_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_ACK_NTF)) & 0xffff0000)) ++#define SET_MRX_BA_NTF(_VAL_) (REG32(ADR_MRX_BA_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_BA_NTF)) & 0xffff0000)) ++#define SET_MRX_DATA_NTF(_VAL_) (REG32(ADR_MRX_DATA_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_DATA_NTF)) & 0xffff0000)) ++#define SET_MRX_MNG_NTF(_VAL_) (REG32(ADR_MRX_MNG_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MNG_NTF)) & 0xffff0000)) ++#define SET_MRX_DAT_CRC_NTF(_VAL_) (REG32(ADR_MRX_DAT_CRC_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_DAT_CRC_NTF)) & 0xffff0000)) ++#define SET_MRX_BAR_NTF(_VAL_) (REG32(ADR_MRX_BAR_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_BAR_NTF)) & 0xffff0000)) ++#define SET_MRX_MB_MISS(_VAL_) (REG32(ADR_MRX_MB_MISS)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_MB_MISS)) & 0xffff0000)) ++#define SET_MRX_NIDLE_MISS(_VAL_) (REG32(ADR_MRX_NIDLE_MISS)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_NIDLE_MISS)) & 0xffff0000)) ++#define SET_MRX_CSR_NTF(_VAL_) (REG32(ADR_MRX_CSR_NTF)) = (((_VAL_) << 0) | ((REG32(ADR_MRX_CSR_NTF)) & 0xffff0000)) ++#define SET_DBG_Q0_SUCC(_VAL_) (REG32(ADR_DBG_Q0_FRM_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q0_FRM_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q0_FAIL(_VAL_) (REG32(ADR_DBG_Q0_FRM_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q0_FRM_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q0_ACK_SUCC(_VAL_) (REG32(ADR_DBG_Q0_ACK_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q0_ACK_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q0_ACK_FAIL(_VAL_) (REG32(ADR_DBG_Q0_ACK_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q0_ACK_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q1_SUCC(_VAL_) (REG32(ADR_DBG_Q1_FRM_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q1_FRM_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q1_FAIL(_VAL_) (REG32(ADR_DBG_Q1_FRM_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q1_FRM_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q1_ACK_SUCC(_VAL_) (REG32(ADR_DBG_Q1_ACK_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q1_ACK_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q1_ACK_FAIL(_VAL_) (REG32(ADR_DBG_Q1_ACK_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q1_ACK_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q2_SUCC(_VAL_) (REG32(ADR_DBG_Q2_FRM_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q2_FRM_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q2_FAIL(_VAL_) (REG32(ADR_DBG_Q2_FRM_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q2_FRM_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q2_ACK_SUCC(_VAL_) (REG32(ADR_DBG_Q2_ACK_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q2_ACK_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q2_ACK_FAIL(_VAL_) (REG32(ADR_DBG_Q2_ACK_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q2_ACK_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q3_SUCC(_VAL_) (REG32(ADR_DBG_Q3_FRM_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q3_FRM_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q3_FAIL(_VAL_) (REG32(ADR_DBG_Q3_FRM_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q3_FRM_FAIL)) & 0xffff0000)) ++#define SET_DBG_Q3_ACK_SUCC(_VAL_) (REG32(ADR_DBG_Q3_ACK_SUCCESS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q3_ACK_SUCCESS)) & 0xffff0000)) ++#define SET_DBG_Q3_ACK_FAIL(_VAL_) (REG32(ADR_DBG_Q3_ACK_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_Q3_ACK_FAIL)) & 0xffff0000)) ++#define SET_SCRT_TKIP_CERR(_VAL_) (REG32(ADR_MIB_SCRT_TKIP0)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_SCRT_TKIP0)) & 0xfff00000)) ++#define SET_SCRT_TKIP_MIC_ERR(_VAL_) (REG32(ADR_MIB_SCRT_TKIP1)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_SCRT_TKIP1)) & 0xfff00000)) ++#define SET_SCRT_TKIP_RPLY(_VAL_) (REG32(ADR_MIB_SCRT_TKIP2)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_SCRT_TKIP2)) & 0xfff00000)) ++#define SET_SCRT_CCMP_RPLY(_VAL_) (REG32(ADR_MIB_SCRT_CCMP0)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_SCRT_CCMP0)) & 0xfff00000)) ++#define SET_SCRT_CCMP_CERR(_VAL_) (REG32(ADR_MIB_SCRT_CCMP1)) = (((_VAL_) << 0) | ((REG32(ADR_MIB_SCRT_CCMP1)) & 0xfff00000)) ++#define SET_DBG_LEN_CRC_FAIL(_VAL_) (REG32(ADR_DBG_LEN_CRC_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_LEN_CRC_FAIL)) & 0xffff0000)) ++#define SET_DBG_LEN_ALC_FAIL(_VAL_) (REG32(ADR_DBG_LEN_ALC_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_LEN_ALC_FAIL)) & 0xffff0000)) ++#define SET_DBG_AMPDU_PASS(_VAL_) (REG32(ADR_DBG_AMPDU_PASS)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_AMPDU_PASS)) & 0xffff0000)) ++#define SET_DBG_AMPDU_FAIL(_VAL_) (REG32(ADR_DBG_AMPDU_FAIL)) = (((_VAL_) << 0) | ((REG32(ADR_DBG_AMPDU_FAIL)) & 0xffff0000)) ++#define SET_RXID_ALC_CNT_FAIL(_VAL_) (REG32(ADR_ID_ALC_FAIL1)) = (((_VAL_) << 0) | ((REG32(ADR_ID_ALC_FAIL1)) & 0xffff0000)) ++#define SET_RXID_ALC_LEN_FAIL(_VAL_) (REG32(ADR_ID_ALC_FAIL2)) = (((_VAL_) << 0) | ((REG32(ADR_ID_ALC_FAIL2)) & 0xffff0000)) ++#define SET_CBR_RG_EN_MANUAL(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_TX_EN(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffffffd)) ++#define SET_CBR_RG_TX_PA_EN(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffffffb)) ++#define SET_CBR_RG_TX_DAC_EN(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffffff7)) ++#define SET_CBR_RG_RX_AGC(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffffffef)) ++#define SET_CBR_RG_RX_GAIN_MANUAL(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffffffdf)) ++#define SET_CBR_RG_RFG(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffffff3f)) ++#define SET_CBR_RG_PGAG(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffff0ff)) ++#define SET_CBR_RG_MODE(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffffcfff)) ++#define SET_CBR_RG_EN_TX_TRSW(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffffbfff)) ++#define SET_CBR_RG_EN_SX(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffff7fff)) ++#define SET_CBR_RG_EN_RX_LNA(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffeffff)) ++#define SET_CBR_RG_EN_RX_MIXER(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 17) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffdffff)) ++#define SET_CBR_RG_EN_RX_DIV2(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfffbffff)) ++#define SET_CBR_RG_EN_RX_LOBUF(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 19) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfff7ffff)) ++#define SET_CBR_RG_EN_RX_TZ(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffefffff)) ++#define SET_CBR_RG_EN_RX_FILTER(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffdfffff)) ++#define SET_CBR_RG_EN_RX_HPF(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xffbfffff)) ++#define SET_CBR_RG_EN_RX_RSSI(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 23) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xff7fffff)) ++#define SET_CBR_RG_EN_ADC(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfeffffff)) ++#define SET_CBR_RG_EN_TX_MOD(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 25) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfdffffff)) ++#define SET_CBR_RG_EN_TX_DIV2(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 26) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xfbffffff)) ++#define SET_CBR_RG_EN_TX_DIV2_BUF(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 27) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xf7ffffff)) ++#define SET_CBR_RG_EN_TX_LOBF(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xefffffff)) ++#define SET_CBR_RG_EN_RX_LOBF(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 29) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xdfffffff)) ++#define SET_CBR_RG_SEL_DPLL_CLK(_VAL_) (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 30) | ((REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) & 0xbfffffff)) ++#define SET_CBR_RG_EN_TX_DPD(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_EN_TX_TSSI(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffffd)) ++#define SET_CBR_RG_EN_RX_IQCAL(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffffb)) ++#define SET_CBR_RG_EN_TX_DAC_CAL(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffff7)) ++#define SET_CBR_RG_EN_TX_SELF_MIXER(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xffffffef)) ++#define SET_CBR_RG_EN_TX_DAC_OUT(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xffffffdf)) ++#define SET_CBR_RG_EN_LDO_RX_FE(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xffffffbf)) ++#define SET_CBR_RG_EN_LDO_ABB(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 7) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xffffff7f)) ++#define SET_CBR_RG_EN_LDO_AFE(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffeff)) ++#define SET_CBR_RG_EN_SX_CHPLDO(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffdff)) ++#define SET_CBR_RG_EN_SX_LOBFLDO(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffffbff)) ++#define SET_CBR_RG_EN_IREF_RX(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xfffff7ff)) ++#define SET_CBR_RG_DCDC_MODE(_VAL_) (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) & 0xffffefff)) ++#define SET_CBR_RG_LDO_LEVEL_RX_FE(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xfffffff8)) ++#define SET_CBR_RG_LDO_LEVEL_ABB(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xffffffc7)) ++#define SET_CBR_RG_LDO_LEVEL_AFE(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xfffffe3f)) ++#define SET_CBR_RG_SX_LDO_CHP_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xfffff1ff)) ++#define SET_CBR_RG_SX_LDO_LOBF_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xffff8fff)) ++#define SET_CBR_RG_SX_LDO_XOSC_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xfffc7fff)) ++#define SET_CBR_RG_DP_LDO_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xffe3ffff)) ++#define SET_CBR_RG_SX_LDO_VCO_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xff1fffff)) ++#define SET_CBR_RG_TX_LDO_TX_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xf8ffffff)) ++#define SET_CBR_RG_BUCK_LEVEL(_VAL_) (REG32(ADR_CBR_LDO_REGISTER)) = (((_VAL_) << 27) | ((REG32(ADR_CBR_LDO_REGISTER)) & 0xc7ffffff)) ++#define SET_CBR_RG_EN_RX_PADSW(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffffffe)) ++#define SET_CBR_RG_EN_RX_TESTNODE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffffffd)) ++#define SET_CBR_RG_RX_ABBCFIX(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffffffb)) ++#define SET_CBR_RG_RX_ABBCTUNE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffffe07)) ++#define SET_CBR_RG_RX_ABBOUT_TRI_STATE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffffdff)) ++#define SET_CBR_RG_RX_ABB_N_MODE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffffbff)) ++#define SET_CBR_RG_RX_EN_LOOPA(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffff7ff)) ++#define SET_CBR_RG_RX_FILTERI1ST(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xffffcfff)) ++#define SET_CBR_RG_RX_FILTERI2ND(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xffff3fff)) ++#define SET_CBR_RG_RX_FILTERI3RD(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfffcffff)) ++#define SET_CBR_RG_RX_FILTERI_COURSE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfff3ffff)) ++#define SET_CBR_RG_RX_FILTERVCM(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xffcfffff)) ++#define SET_CBR_RG_RX_HPF3M(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 22) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xffbfffff)) ++#define SET_CBR_RG_RX_HPF300K(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 23) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xff7fffff)) ++#define SET_CBR_RG_RX_HPFI(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xfcffffff)) ++#define SET_CBR_RG_RX_HPF_FINALCORNER(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 26) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xf3ffffff)) ++#define SET_CBR_RG_RX_HPF_SETTLE1_C(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_1)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_ABB_REGISTER_1)) & 0xcfffffff)) ++#define SET_CBR_RG_RX_HPF_SETTLE1_R(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfffffffc)) ++#define SET_CBR_RG_RX_HPF_SETTLE2_C(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfffffff3)) ++#define SET_CBR_RG_RX_HPF_SETTLE2_R(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xffffffcf)) ++#define SET_CBR_RG_RX_HPF_VCMCON2(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xffffff3f)) ++#define SET_CBR_RG_RX_HPF_VCMCON(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfffffcff)) ++#define SET_CBR_RG_RX_OUTVCM(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfffff3ff)) ++#define SET_CBR_RG_RX_TZI(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xffffcfff)) ++#define SET_CBR_RG_RX_TZ_OUT_TRISTATE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xffffbfff)) ++#define SET_CBR_RG_RX_TZ_VCM(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfffe7fff)) ++#define SET_CBR_RG_EN_RX_RSSI_TESTNODE(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 17) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfff1ffff)) ++#define SET_CBR_RG_RX_ADCRSSI_CLKSEL(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xffefffff)) ++#define SET_CBR_RG_RX_ADCRSSI_VCM(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xff9fffff)) ++#define SET_CBR_RG_RX_REC_LPFCORNER(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 23) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfe7fffff)) ++#define SET_CBR_RG_RSSI_CLOCK_GATING(_VAL_) (REG32(ADR_CBR_ABB_REGISTER_2)) = (((_VAL_) << 25) | ((REG32(ADR_CBR_ABB_REGISTER_2)) & 0xfdffffff)) ++#define SET_CBR_RG_TXPGA_CAPSW(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xfffffffc)) ++#define SET_CBR_RG_TXPGA_MAIN(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xffffff03)) ++#define SET_CBR_RG_TXPGA_STEER(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xffffc0ff)) ++#define SET_CBR_RG_TXMOD_GMCELL(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xffff3fff)) ++#define SET_CBR_RG_TXLPF_GMCELL(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xfffcffff)) ++#define SET_CBR_RG_PACELL_EN(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xffe3ffff)) ++#define SET_CBR_RG_PABIAS_CTRL(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xfe1fffff)) ++#define SET_CBR_RG_PABIAS_AB(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 25) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xfdffffff)) ++#define SET_CBR_RG_TX_DIV_VSET(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 26) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xf3ffffff)) ++#define SET_CBR_RG_TX_LOBUF_VSET(_VAL_) (REG32(ADR_CBR_TX_FE_REGISTER)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_TX_FE_REGISTER)) & 0xcfffffff)) ++#define SET_CBR_RG_RX_SQDC(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xfffffff8)) ++#define SET_CBR_RG_RX_DIV2_CORE(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xffffffe7)) ++#define SET_CBR_RG_RX_LOBUF(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xffffff9f)) ++#define SET_CBR_RG_TX_DPDGM_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 7) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xfffff87f)) ++#define SET_CBR_RG_TX_DPD_DIV(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xffff87ff)) ++#define SET_CBR_RG_TX_TSSI_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xfffc7fff)) ++#define SET_CBR_RG_TX_TSSI_DIV(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xffe3ffff)) ++#define SET_CBR_RG_TX_TSSI_TESTMODE(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xffdfffff)) ++#define SET_CBR_RG_TX_TSSI_TEST(_VAL_) (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (((_VAL_) << 22) | ((REG32(ADR_CBR_RX_FE_REGISTER_1)) & 0xff3fffff)) ++#define SET_CBR_RG_RX_HG_LNA_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xfffffffc)) ++#define SET_CBR_RG_RX_HG_LNAHGN_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xffffffc3)) ++#define SET_CBR_RG_RX_HG_LNAHGP_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xfffffc3f)) ++#define SET_CBR_RG_RX_HG_LNALG_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xffffc3ff)) ++#define SET_CBR_RG_RX_HG_TZ_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xffff3fff)) ++#define SET_CBR_RG_RX_HG_TZ_CAP(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xfff8ffff)) ++#define SET_CBR_RG_RX_MG_LNA_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xfffffffc)) ++#define SET_CBR_RG_RX_MG_LNAHGN_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xffffffc3)) ++#define SET_CBR_RG_RX_MG_LNAHGP_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xfffffc3f)) ++#define SET_CBR_RG_RX_MG_LNALG_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xffffc3ff)) ++#define SET_CBR_RG_RX_MG_TZ_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xffff3fff)) ++#define SET_CBR_RG_RX_MG_TZ_CAP(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xfff8ffff)) ++#define SET_CBR_RG_RX_LG_LNA_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xfffffffc)) ++#define SET_CBR_RG_RX_LG_LNAHGN_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xffffffc3)) ++#define SET_CBR_RG_RX_LG_LNAHGP_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xfffffc3f)) ++#define SET_CBR_RG_RX_LG_LNALG_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xffffc3ff)) ++#define SET_CBR_RG_RX_LG_TZ_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xffff3fff)) ++#define SET_CBR_RG_RX_LG_TZ_CAP(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xfff8ffff)) ++#define SET_CBR_RG_RX_ULG_LNA_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xfffffffc)) ++#define SET_CBR_RG_RX_ULG_LNAHGN_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xffffffc3)) ++#define SET_CBR_RG_RX_ULG_LNAHGP_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xfffffc3f)) ++#define SET_CBR_RG_RX_ULG_LNALG_BIAS(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xffffc3ff)) ++#define SET_CBR_RG_RX_ULG_TZ_GC(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xffff3fff)) ++#define SET_CBR_RG_RX_ULG_TZ_CAP(_VAL_) (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xfff8ffff)) ++#define SET_CBR_RG_HPF1_FAST_SET_X(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_HPF1_FAST_SET_Y(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xfffffffd)) ++#define SET_CBR_RG_HPF1_FAST_SET_Z(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xfffffffb)) ++#define SET_CBR_RG_HPF_T1A(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xffffffe7)) ++#define SET_CBR_RG_HPF_T1B(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xffffff9f)) ++#define SET_CBR_RG_HPF_T1C(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 7) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xfffffe7f)) ++#define SET_CBR_RG_RX_LNA_TRI_SEL(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xfffff9ff)) ++#define SET_CBR_RG_RX_LNA_SETTLE(_VAL_) (REG32(ADR_CBR_RX_FSM_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_RX_FSM_REGISTER)) & 0xffffe7ff)) ++#define SET_CBR_RG_ADC_CLKSEL(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_ADC_DIBIAS(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffffff9)) ++#define SET_CBR_RG_ADC_DIVR(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffffff7)) ++#define SET_CBR_RG_ADC_DVCMI(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xffffffcf)) ++#define SET_CBR_RG_ADC_SAMSEL(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffffc3f)) ++#define SET_CBR_RG_ADC_STNBY(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffffbff)) ++#define SET_CBR_RG_ADC_TESTMODE(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffff7ff)) ++#define SET_CBR_RG_ADC_TSEL(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xffff0fff)) ++#define SET_CBR_RG_ADC_VRSEL(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfffcffff)) ++#define SET_CBR_RG_DICMP(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xfff3ffff)) ++#define SET_CBR_RG_DIOP(_VAL_) (REG32(ADR_CBR_RX_ADC_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_RX_ADC_REGISTER)) & 0xffcfffff)) ++#define SET_CBR_RG_DACI1ST(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xfffffffc)) ++#define SET_CBR_RG_TX_DACLPF_ICOURSE(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xfffffff3)) ++#define SET_CBR_RG_TX_DACLPF_IFINE(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffffffcf)) ++#define SET_CBR_RG_TX_DACLPF_VCM(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffffff3f)) ++#define SET_CBR_RG_TX_DAC_CKEDGE_SEL(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xfffffeff)) ++#define SET_CBR_RG_TX_DAC_IBIAS(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xfffff9ff)) ++#define SET_CBR_RG_TX_DAC_OS(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffffc7ff)) ++#define SET_CBR_RG_TX_DAC_RCAL(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffff3fff)) ++#define SET_CBR_RG_TX_DAC_TSEL(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xfff0ffff)) ++#define SET_CBR_RG_TX_EN_VOLTAGE_IN(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffefffff)) ++#define SET_CBR_RG_TXLPF_BYPASS(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffdfffff)) ++#define SET_CBR_RG_TXLPF_BOOSTI(_VAL_) (REG32(ADR_CBR_TX_DAC_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_CBR_TX_DAC_REGISTER)) & 0xffbfffff)) ++#define SET_CBR_RG_EN_SX_R3(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_EN_SX_CH(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffffd)) ++#define SET_CBR_RG_EN_SX_CHP(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffffb)) ++#define SET_CBR_RG_EN_SX_DIVCK(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffff7)) ++#define SET_CBR_RG_EN_SX_VCOBF(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffffef)) ++#define SET_CBR_RG_EN_SX_VCO(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffffdf)) ++#define SET_CBR_RG_EN_SX_MOD(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffffbf)) ++#define SET_CBR_RG_EN_SX_LCK(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 7) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffff7f)) ++#define SET_CBR_RG_EN_SX_DITHER(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffeff)) ++#define SET_CBR_RG_EN_SX_DELCAL(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffdff)) ++#define SET_CBR_RG_EN_SX_PC_BYPASS(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffffbff)) ++#define SET_CBR_RG_EN_SX_VT_MON(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xfffff7ff)) ++#define SET_CBR_RG_EN_SX_VT_MON_DG(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffefff)) ++#define SET_CBR_RG_EN_SX_DIV(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 13) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffdfff)) ++#define SET_CBR_RG_EN_SX_LPF(_VAL_) (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_SX_ENABLE_RGISTER)) & 0xffffbfff)) ++#define SET_CBR_RG_SX_RFCTRL_F(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_RGISTER_1)) & 0xff000000)) ++#define SET_CBR_RG_SX_SEL_CP(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_1)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_SYN_RGISTER_1)) & 0xf0ffffff)) ++#define SET_CBR_RG_SX_SEL_CS(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_1)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_SYN_RGISTER_1)) & 0x0fffffff)) ++#define SET_CBR_RG_SX_RFCTRL_CH(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_RGISTER_2)) & 0xfffff800)) ++#define SET_CBR_RG_SX_SEL_C3(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_2)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_SYN_RGISTER_2)) & 0xffff87ff)) ++#define SET_CBR_RG_SX_SEL_RS(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_2)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_SYN_RGISTER_2)) & 0xfff07fff)) ++#define SET_CBR_RG_SX_SEL_R3(_VAL_) (REG32(ADR_CBR_SYN_RGISTER_2)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_SYN_RGISTER_2)) & 0xfe0fffff)) ++#define SET_CBR_RG_SX_SEL_ICHP(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xffffffe0)) ++#define SET_CBR_RG_SX_SEL_PCHP(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xfffffc1f)) ++#define SET_CBR_RG_SX_SEL_CHP_REGOP(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xffffc3ff)) ++#define SET_CBR_RG_SX_SEL_CHP_UNIOP(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xfffc3fff)) ++#define SET_CBR_RG_SX_CHP_IOST_POL(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xfffbffff)) ++#define SET_CBR_RG_SX_CHP_IOST(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 19) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xffc7ffff)) ++#define SET_CBR_RG_SX_PFDSEL(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 22) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xffbfffff)) ++#define SET_CBR_RG_SX_PFD_SET(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 23) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xff7fffff)) ++#define SET_CBR_RG_SX_PFD_SET1(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xfeffffff)) ++#define SET_CBR_RG_SX_PFD_SET2(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 25) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xfdffffff)) ++#define SET_CBR_RG_SX_VBNCAS_SEL(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 26) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xfbffffff)) ++#define SET_CBR_RG_SX_PFD_RST_H(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 27) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xf7ffffff)) ++#define SET_CBR_RG_SX_PFD_TRUP(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xefffffff)) ++#define SET_CBR_RG_SX_PFD_TRDN(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 29) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xdfffffff)) ++#define SET_CBR_RG_SX_PFD_TRSEL(_VAL_) (REG32(ADR_CBR_SYN_PFD_CHP)) = (((_VAL_) << 30) | ((REG32(ADR_CBR_SYN_PFD_CHP)) & 0xbfffffff)) ++#define SET_CBR_RG_SX_VCOBA_R(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xfffffff8)) ++#define SET_CBR_RG_SX_VCORSEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xffffff07)) ++#define SET_CBR_RG_SX_VCOCUSEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xfffff0ff)) ++#define SET_CBR_RG_SX_RXBFSEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xffff0fff)) ++#define SET_CBR_RG_SX_TXBFSEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xfff0ffff)) ++#define SET_CBR_RG_SX_VCOBFSEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xff0fffff)) ++#define SET_CBR_RG_SX_DIVBFSEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0xf0ffffff)) ++#define SET_CBR_RG_SX_GNDR_SEL(_VAL_) (REG32(ADR_CBR_SYN_VCO_LOBF)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_SYN_VCO_LOBF)) & 0x0fffffff)) ++#define SET_CBR_RG_SX_DITHER_WEIGHT(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffffffc)) ++#define SET_CBR_RG_SX_MOD_ERRCMP(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffffff3)) ++#define SET_CBR_RG_SX_MOD_ORDER(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xffffffcf)) ++#define SET_CBR_RG_SX_SDM_D1(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xffffffbf)) ++#define SET_CBR_RG_SX_SDM_D2(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 7) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xffffff7f)) ++#define SET_CBR_RG_SDM_PASS(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffffeff)) ++#define SET_CBR_RG_SX_RST_H_DIV(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffffdff)) ++#define SET_CBR_RG_SX_SDM_EDGE(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffffbff)) ++#define SET_CBR_RG_SX_XO_GM(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xffffe7ff)) ++#define SET_CBR_RG_SX_REFBYTWO(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 13) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xffffdfff)) ++#define SET_CBR_RG_SX_XO_SWCAP(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffc3fff)) ++#define SET_CBR_RG_SX_SDMLUT_INV(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfffbffff)) ++#define SET_CBR_RG_SX_LCKEN(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 19) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xfff7ffff)) ++#define SET_CBR_RG_SX_PREVDD(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xff0fffff)) ++#define SET_CBR_RG_SX_PSCONTERVDD(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xf0ffffff)) ++#define SET_CBR_RG_SX_MOD_ERR_DELAY(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 28) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xcfffffff)) ++#define SET_CBR_RG_SX_MODDB(_VAL_) (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 30) | ((REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) & 0xbfffffff)) ++#define SET_CBR_RG_SX_CV_CURVE_SEL(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xfffffffc)) ++#define SET_CBR_RG_SX_SEL_DELAY(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xffffff83)) ++#define SET_CBR_RG_SX_REF_CYCLE(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 7) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xfffff87f)) ++#define SET_CBR_RG_SX_VCOBY16(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xfffff7ff)) ++#define SET_CBR_RG_SX_VCOBY32(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xffffefff)) ++#define SET_CBR_RG_SX_PH(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 13) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xffffdfff)) ++#define SET_CBR_RG_SX_PL(_VAL_) (REG32(ADR_CBR_SYN_LCK1)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_SYN_LCK1)) & 0xffffbfff)) ++#define SET_CBR_RG_SX_VT_MON_MODE(_VAL_) (REG32(ADR_CBR_SYN_LCK2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_SYN_LCK2)) & 0xfffffffe)) ++#define SET_CBR_RG_SX_VT_TH_HI(_VAL_) (REG32(ADR_CBR_SYN_LCK2)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_SYN_LCK2)) & 0xfffffff9)) ++#define SET_CBR_RG_SX_VT_TH_LO(_VAL_) (REG32(ADR_CBR_SYN_LCK2)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_SYN_LCK2)) & 0xffffffe7)) ++#define SET_CBR_RG_SX_VT_SET(_VAL_) (REG32(ADR_CBR_SYN_LCK2)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_SYN_LCK2)) & 0xffffffdf)) ++#define SET_CBR_RG_SX_VT_MON_TMR(_VAL_) (REG32(ADR_CBR_SYN_LCK2)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_SYN_LCK2)) & 0xffff803f)) ++#define SET_CBR_RG_IDEAL_CYCLE(_VAL_) (REG32(ADR_CBR_SYN_LCK2)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_SYN_LCK2)) & 0xf0007fff)) ++#define SET_CBR_RG_EN_DP_VT_MON(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_DP_VT_TH_HI(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xfffffff9)) ++#define SET_CBR_RG_DP_VT_TH_LO(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xffffffe7)) ++#define SET_CBR_RG_DP_VT_MON_TMR(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xffffc01f)) ++#define SET_CBR_RG_DP_CK320BY2(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xffffbfff)) ++#define SET_CBR_RG_SX_DELCTRL(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xffe07fff)) ++#define SET_CBR_RG_DP_OD_TEST(_VAL_) (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_DPLL_VCO_REGISTER)) & 0xffdfffff)) ++#define SET_CBR_RG_DP_BBPLL_BP(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_DP_BBPLL_ICP(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xfffffff9)) ++#define SET_CBR_RG_DP_BBPLL_IDUAL(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xffffffe7)) ++#define SET_CBR_RG_DP_BBPLL_OD_TEST(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xfffffe1f)) ++#define SET_CBR_RG_DP_BBPLL_PD(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xfffffdff)) ++#define SET_CBR_RG_DP_BBPLL_TESTSEL(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xffffe3ff)) ++#define SET_CBR_RG_DP_BBPLL_PFD_DLY(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 13) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xffff9fff)) ++#define SET_CBR_RG_DP_RP(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xfffc7fff)) ++#define SET_CBR_RG_DP_RHP(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xfff3ffff)) ++#define SET_CBR_RG_DP_DR3(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xff8fffff)) ++#define SET_CBR_RG_DP_DCP(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 23) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0xf87fffff)) ++#define SET_CBR_RG_DP_DCS(_VAL_) (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 27) | ((REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) & 0x87ffffff)) ++#define SET_CBR_RG_DP_FBDIV(_VAL_) (REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) & 0xfffff000)) ++#define SET_CBR_RG_DP_FODIV(_VAL_) (REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) & 0xffc00fff)) ++#define SET_CBR_RG_DP_REFDIV(_VAL_) (REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) & 0x003fffff)) ++#define SET_CBR_RG_IDACAI_PGAG15(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG15(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG14(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG14(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG13(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG13(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG12(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG12(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG11(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG11(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG10(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG10(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG9(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG9(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG8(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG8(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG7(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG7(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG6(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG6(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG5(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG5(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG4(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG4(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG3(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG3(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG2(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG2(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) & 0xff03ffff)) ++#define SET_CBR_RG_IDACAI_PGAG1(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0xffffffc0)) ++#define SET_CBR_RG_IDACAQ_PGAG1(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0xfffff03f)) ++#define SET_CBR_RG_IDACAI_PGAG0(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0xfffc0fff)) ++#define SET_CBR_RG_IDACAQ_PGAG0(_VAL_) (REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 18) | ((REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) & 0xff03ffff)) ++#define SET_CBR_RG_EN_RCAL(_VAL_) (REG32(ADR_CBR_RCAL_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RCAL_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_RCAL_SPD(_VAL_) (REG32(ADR_CBR_RCAL_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_RCAL_REGISTER)) & 0xfffffffd)) ++#define SET_CBR_RG_RCAL_TMR(_VAL_) (REG32(ADR_CBR_RCAL_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RCAL_REGISTER)) & 0xfffffe03)) ++#define SET_CBR_RG_RCAL_CODE_CWR(_VAL_) (REG32(ADR_CBR_RCAL_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_RCAL_REGISTER)) & 0xfffffdff)) ++#define SET_CBR_RG_RCAL_CODE_CWD(_VAL_) (REG32(ADR_CBR_RCAL_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RCAL_REGISTER)) & 0xffff83ff)) ++#define SET_CBR_RG_SX_SUB_SEL_CWR(_VAL_) (REG32(ADR_CBR_MANUAL_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_MANUAL_REGISTER)) & 0xfffffffe)) ++#define SET_CBR_RG_SX_SUB_SEL_CWD(_VAL_) (REG32(ADR_CBR_MANUAL_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_MANUAL_REGISTER)) & 0xffffff01)) ++#define SET_CBR_RG_DP_BBPLL_BS_CWR(_VAL_) (REG32(ADR_CBR_MANUAL_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_MANUAL_REGISTER)) & 0xfffffeff)) ++#define SET_CBR_RG_DP_BBPLL_BS_CWD(_VAL_) (REG32(ADR_CBR_MANUAL_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_MANUAL_REGISTER)) & 0xffff81ff)) ++#define SET_CBR_RCAL_RDY(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xfffffffe)) ++#define SET_CBR_DA_LCK_RDY(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xfffffffd)) ++#define SET_CBR_VT_MON_RDY(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xfffffffb)) ++#define SET_CBR_DP_VT_MON_RDY(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xfffffff7)) ++#define SET_CBR_CH_RDY(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xffffffef)) ++#define SET_CBR_DA_R_CODE_LUT(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xfffff83f)) ++#define SET_CBR_AD_SX_VT_MON_Q(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xffffe7ff)) ++#define SET_CBR_AD_DP_VT_MON_Q(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 13) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_1)) & 0xffff9fff)) ++#define SET_CBR_DA_R_CAL_CODE(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_2)) & 0xffffffe0)) ++#define SET_CBR_DA_SX_SUB_SEL(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_2)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_2)) & 0xfffff01f)) ++#define SET_CBR_DA_DP_BBPLL_BS(_VAL_) (REG32(ADR_CBR_READ_ONLY_FLAGS_2)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_READ_ONLY_FLAGS_2)) & 0xfffc0fff)) ++#define SET_CBR_TX_EN(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_0)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0xfffffffe)) ++#define SET_CBR_TX_CNT_RST(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_0)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0xfffffffd)) ++#define SET_CBR_IFS_TIME(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_0)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0xffffff03)) ++#define SET_CBR_LENGTH_TARGET(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_0)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0xfff000ff)) ++#define SET_CBR_TX_CNT_TARGET(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_0)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_RG_PKT_GEN_0)) & 0x00ffffff)) ++#define SET_CBR_TC_CNT_TARGET(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_1)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RG_PKT_GEN_1)) & 0xff000000)) ++#define SET_CBR_PLCP_PSDU_DATA_MEM(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_2)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0xffffff00)) ++#define SET_CBR_PLCP_PSDU_PREAMBLE_SHORT(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_2)) = (((_VAL_) << 8) | ((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0xfffffeff)) ++#define SET_CBR_PLCP_BYTE_LENGTH(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_2)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0xffe001ff)) ++#define SET_CBR_PLCP_PSDU_RATE(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_2)) = (((_VAL_) << 21) | ((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0xff9fffff)) ++#define SET_CBR_TAIL_TIME(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_2)) = (((_VAL_) << 23) | ((REG32(ADR_CBR_RG_PKT_GEN_2)) & 0xe07fffff)) ++#define SET_CBR_RG_O_PAD_PD(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffffffe)) ++#define SET_CBR_RG_I_PAD_PD(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 1) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffffffd)) ++#define SET_CBR_SEL_ADCKP_INV(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 2) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffffffb)) ++#define SET_CBR_RG_PAD_DS(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 3) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffffff7)) ++#define SET_CBR_SEL_ADCKP_MUX(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 4) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xffffffef)) ++#define SET_CBR_RG_PAD_DS_CLK(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xffffffdf)) ++#define SET_CBR_INTP_SEL(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffffdff)) ++#define SET_CBR_IQ_SWP(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 10) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffffbff)) ++#define SET_CBR_RG_EN_EXT_DA(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 11) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfffff7ff)) ++#define SET_CBR_RG_DIS_DA_OFFSET(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 12) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xffffefff)) ++#define SET_CBR_DBG_SEL(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xfff0ffff)) ++#define SET_CBR_DBG_EN(_VAL_) (REG32(ADR_CBR_RG_INTEGRATION)) = (((_VAL_) << 20) | ((REG32(ADR_CBR_RG_INTEGRATION)) & 0xffefffff)) ++#define SET_CBR_RG_PKT_GEN_TX_CNT(_VAL_) (REG32(ADR_CBR_RG_PKT_GEN_TXCNT)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_RG_PKT_GEN_TXCNT)) & 0x00000000)) ++#define SET_CBR_TP_SEL(_VAL_) (REG32(ADR_CBR_PATTERN_GEN)) = (((_VAL_) << 0) | ((REG32(ADR_CBR_PATTERN_GEN)) & 0xffffffe0)) ++#define SET_CBR_IDEAL_IQ_EN(_VAL_) (REG32(ADR_CBR_PATTERN_GEN)) = (((_VAL_) << 5) | ((REG32(ADR_CBR_PATTERN_GEN)) & 0xffffffdf)) ++#define SET_CBR_DATA_OUT_SEL(_VAL_) (REG32(ADR_CBR_PATTERN_GEN)) = (((_VAL_) << 6) | ((REG32(ADR_CBR_PATTERN_GEN)) & 0xfffffe3f)) ++#define SET_CBR_TWO_TONE_EN(_VAL_) (REG32(ADR_CBR_PATTERN_GEN)) = (((_VAL_) << 9) | ((REG32(ADR_CBR_PATTERN_GEN)) & 0xfffffdff)) ++#define SET_CBR_FREQ_SEL(_VAL_) (REG32(ADR_CBR_PATTERN_GEN)) = (((_VAL_) << 16) | ((REG32(ADR_CBR_PATTERN_GEN)) & 0xff00ffff)) ++#define SET_CBR_IQ_SCALE(_VAL_) (REG32(ADR_CBR_PATTERN_GEN)) = (((_VAL_) << 24) | ((REG32(ADR_CBR_PATTERN_GEN)) & 0x00ffffff)) ++#define SET_CPU_QUE_POP(_VAL_) (REG32(ADR_MB_CPU_INT)) = (((_VAL_) << 0) | ((REG32(ADR_MB_CPU_INT)) & 0xfffffffe)) ++#define SET_CPU_INT(_VAL_) (REG32(ADR_MB_CPU_INT)) = (((_VAL_) << 2) | ((REG32(ADR_MB_CPU_INT)) & 0xfffffffb)) ++#define SET_CPU_ID_TB0(_VAL_) (REG32(ADR_CPU_ID_TB0)) = (((_VAL_) << 0) | ((REG32(ADR_CPU_ID_TB0)) & 0x00000000)) ++#define SET_CPU_ID_TB1(_VAL_) (REG32(ADR_CPU_ID_TB1)) = (((_VAL_) << 0) | ((REG32(ADR_CPU_ID_TB1)) & 0x00000000)) ++#define SET_HW_PKTID(_VAL_) (REG32(ADR_CH0_TRIG_1)) = (((_VAL_) << 0) | ((REG32(ADR_CH0_TRIG_1)) & 0xfffff800)) ++#define SET_CH0_INT_ADDR(_VAL_) (REG32(ADR_CH0_TRIG_0)) = (((_VAL_) << 0) | ((REG32(ADR_CH0_TRIG_0)) & 0x00000000)) ++#define SET_PRI_HW_PKTID(_VAL_) (REG32(ADR_CH0_PRI_TRIG)) = (((_VAL_) << 0) | ((REG32(ADR_CH0_PRI_TRIG)) & 0xfffff800)) ++#define SET_CH0_FULL(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MCU_STATUS)) & 0xfffffffe)) ++#define SET_FF0_EMPTY(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_MCU_STATUS)) & 0xfffffffd)) ++#define SET_RLS_BUSY(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 9) | ((REG32(ADR_MCU_STATUS)) & 0xfffffdff)) ++#define SET_RLS_COUNT_CLR(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 10) | ((REG32(ADR_MCU_STATUS)) & 0xfffffbff)) ++#define SET_RTN_COUNT_CLR(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 11) | ((REG32(ADR_MCU_STATUS)) & 0xfffff7ff)) ++#define SET_RLS_COUNT(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_MCU_STATUS)) & 0xff00ffff)) ++#define SET_RTN_COUNT(_VAL_) (REG32(ADR_MCU_STATUS)) = (((_VAL_) << 24) | ((REG32(ADR_MCU_STATUS)) & 0x00ffffff)) ++#define SET_FF0_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 0) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xffffffe0)) ++#define SET_FF1_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 5) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xfffffe1f)) ++#define SET_FF3_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 11) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xffffc7ff)) ++#define SET_FF5_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 17) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xfff1ffff)) ++#define SET_FF6_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 20) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xff8fffff)) ++#define SET_FF7_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 23) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xfc7fffff)) ++#define SET_FF8_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 26) | ((REG32(ADR_RD_IN_FFCNT1)) & 0xe3ffffff)) ++#define SET_FF9_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT1)) = (((_VAL_) << 29) | ((REG32(ADR_RD_IN_FFCNT1)) & 0x1fffffff)) ++#define SET_FF10_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 0) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xfffffff8)) ++#define SET_FF11_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 3) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xffffffc7)) ++#define SET_FF12_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 6) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xfffffe3f)) ++#define SET_FF13_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 9) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xfffff9ff)) ++#define SET_FF14_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 11) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xffffe7ff)) ++#define SET_FF15_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 13) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xffff9fff)) ++#define SET_FF4_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 15) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xfff07fff)) ++#define SET_FF2_CNT(_VAL_) (REG32(ADR_RD_IN_FFCNT2)) = (((_VAL_) << 20) | ((REG32(ADR_RD_IN_FFCNT2)) & 0xff8fffff)) ++#define SET_CH1_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 1) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffffffd)) ++#define SET_CH2_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 2) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffffffb)) ++#define SET_CH3_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 3) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffffff7)) ++#define SET_CH4_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 4) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffffef)) ++#define SET_CH5_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 5) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffffdf)) ++#define SET_CH6_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 6) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffffbf)) ++#define SET_CH7_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 7) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffff7f)) ++#define SET_CH8_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 8) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffffeff)) ++#define SET_CH9_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 9) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffffdff)) ++#define SET_CH10_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 10) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffffbff)) ++#define SET_CH11_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 11) | ((REG32(ADR_RD_FFIN_FULL)) & 0xfffff7ff)) ++#define SET_CH12_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 12) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffefff)) ++#define SET_CH13_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 13) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffdfff)) ++#define SET_CH14_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 14) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffffbfff)) ++#define SET_CH15_FULL(_VAL_) (REG32(ADR_RD_FFIN_FULL)) = (((_VAL_) << 15) | ((REG32(ADR_RD_FFIN_FULL)) & 0xffff7fff)) ++#define SET_HALT_CH0(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 0) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffffe)) ++#define SET_HALT_CH1(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 1) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffffd)) ++#define SET_HALT_CH2(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 2) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffffb)) ++#define SET_HALT_CH3(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 3) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffff7)) ++#define SET_HALT_CH4(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 4) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffffef)) ++#define SET_HALT_CH5(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 5) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffffdf)) ++#define SET_HALT_CH6(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 6) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffffbf)) ++#define SET_HALT_CH7(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 7) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffff7f)) ++#define SET_HALT_CH8(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 8) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffeff)) ++#define SET_HALT_CH9(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 9) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffdff)) ++#define SET_HALT_CH10(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 10) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffffbff)) ++#define SET_HALT_CH11(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 11) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffff7ff)) ++#define SET_HALT_CH12(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 12) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffefff)) ++#define SET_HALT_CH13(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 13) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffdfff)) ++#define SET_HALT_CH14(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 14) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffffbfff)) ++#define SET_HALT_CH15(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 15) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffff7fff)) ++#define SET_STOP_MBOX(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 16) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xfffeffff)) ++#define SET_MB_ERR_AUTO_HALT_EN(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 20) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffefffff)) ++#define SET_MB_EXCEPT_CLR(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 21) | ((REG32(ADR_MBOX_HALT_CFG)) & 0xffdfffff)) ++#define SET_MB_EXCEPT_CASE(_VAL_) (REG32(ADR_MBOX_HALT_CFG)) = (((_VAL_) << 24) | ((REG32(ADR_MBOX_HALT_CFG)) & 0x00ffffff)) ++#define SET_MB_DBG_TIME_STEP(_VAL_) (REG32(ADR_MB_DBG_CFG1)) = (((_VAL_) << 0) | ((REG32(ADR_MB_DBG_CFG1)) & 0xffff0000)) ++#define SET_DBG_TYPE(_VAL_) (REG32(ADR_MB_DBG_CFG1)) = (((_VAL_) << 16) | ((REG32(ADR_MB_DBG_CFG1)) & 0xfffcffff)) ++#define SET_MB_DBG_CLR(_VAL_) (REG32(ADR_MB_DBG_CFG1)) = (((_VAL_) << 18) | ((REG32(ADR_MB_DBG_CFG1)) & 0xfffbffff)) ++#define SET_DBG_ALC_LOG_EN(_VAL_) (REG32(ADR_MB_DBG_CFG1)) = (((_VAL_) << 19) | ((REG32(ADR_MB_DBG_CFG1)) & 0xfff7ffff)) ++#define SET_MB_DBG_COUNTER_EN(_VAL_) (REG32(ADR_MB_DBG_CFG1)) = (((_VAL_) << 24) | ((REG32(ADR_MB_DBG_CFG1)) & 0xfeffffff)) ++#define SET_MB_DBG_EN(_VAL_) (REG32(ADR_MB_DBG_CFG1)) = (((_VAL_) << 31) | ((REG32(ADR_MB_DBG_CFG1)) & 0x7fffffff)) ++#define SET_MB_DBG_RECORD_CNT(_VAL_) (REG32(ADR_MB_DBG_CFG2)) = (((_VAL_) << 0) | ((REG32(ADR_MB_DBG_CFG2)) & 0xffff0000)) ++#define SET_MB_DBG_LENGTH(_VAL_) (REG32(ADR_MB_DBG_CFG2)) = (((_VAL_) << 16) | ((REG32(ADR_MB_DBG_CFG2)) & 0x0000ffff)) ++#define SET_MB_DBG_CFG_ADDR(_VAL_) (REG32(ADR_MB_DBG_CFG3)) = (((_VAL_) << 0) | ((REG32(ADR_MB_DBG_CFG3)) & 0x00000000)) ++#define SET_DBG_HWID0_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 0) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffffe)) ++#define SET_DBG_HWID1_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 1) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffffd)) ++#define SET_DBG_HWID2_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 2) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffffb)) ++#define SET_DBG_HWID3_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 3) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffff7)) ++#define SET_DBG_HWID4_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 4) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffffef)) ++#define SET_DBG_HWID5_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 5) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffffdf)) ++#define SET_DBG_HWID6_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 6) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffffbf)) ++#define SET_DBG_HWID7_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 7) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffff7f)) ++#define SET_DBG_HWID8_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 8) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffeff)) ++#define SET_DBG_HWID9_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 9) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffdff)) ++#define SET_DBG_HWID10_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 10) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffffbff)) ++#define SET_DBG_HWID11_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 11) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffff7ff)) ++#define SET_DBG_HWID12_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 12) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffefff)) ++#define SET_DBG_HWID13_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 13) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffdfff)) ++#define SET_DBG_HWID14_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 14) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffffbfff)) ++#define SET_DBG_HWID15_WR_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 15) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffff7fff)) ++#define SET_DBG_HWID0_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 16) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffeffff)) ++#define SET_DBG_HWID1_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 17) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffdffff)) ++#define SET_DBG_HWID2_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 18) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfffbffff)) ++#define SET_DBG_HWID3_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 19) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfff7ffff)) ++#define SET_DBG_HWID4_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 20) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffefffff)) ++#define SET_DBG_HWID5_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 21) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffdfffff)) ++#define SET_DBG_HWID6_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 22) | ((REG32(ADR_MB_DBG_CFG4)) & 0xffbfffff)) ++#define SET_DBG_HWID7_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 23) | ((REG32(ADR_MB_DBG_CFG4)) & 0xff7fffff)) ++#define SET_DBG_HWID8_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 24) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfeffffff)) ++#define SET_DBG_HWID9_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 25) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfdffffff)) ++#define SET_DBG_HWID10_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 26) | ((REG32(ADR_MB_DBG_CFG4)) & 0xfbffffff)) ++#define SET_DBG_HWID11_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 27) | ((REG32(ADR_MB_DBG_CFG4)) & 0xf7ffffff)) ++#define SET_DBG_HWID12_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 28) | ((REG32(ADR_MB_DBG_CFG4)) & 0xefffffff)) ++#define SET_DBG_HWID13_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 29) | ((REG32(ADR_MB_DBG_CFG4)) & 0xdfffffff)) ++#define SET_DBG_HWID14_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 30) | ((REG32(ADR_MB_DBG_CFG4)) & 0xbfffffff)) ++#define SET_DBG_HWID15_RD_EN(_VAL_) (REG32(ADR_MB_DBG_CFG4)) = (((_VAL_) << 31) | ((REG32(ADR_MB_DBG_CFG4)) & 0x7fffffff)) ++#define SET_MB_OUT_QUEUE_EN(_VAL_) (REG32(ADR_MB_OUT_QUEUE_CFG)) = (((_VAL_) << 1) | ((REG32(ADR_MB_OUT_QUEUE_CFG)) & 0xfffffffd)) ++#define SET_CH0_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 0) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffffe)) ++#define SET_CH1_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 1) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffffd)) ++#define SET_CH2_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 2) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffffb)) ++#define SET_CH3_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 3) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffff7)) ++#define SET_CH4_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 4) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffffef)) ++#define SET_CH5_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 5) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffffdf)) ++#define SET_CH6_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 6) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffffbf)) ++#define SET_CH7_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 7) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffff7f)) ++#define SET_CH8_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 8) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffeff)) ++#define SET_CH9_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 9) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffdff)) ++#define SET_CH10_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 10) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffffbff)) ++#define SET_CH11_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 11) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xfffff7ff)) ++#define SET_CH12_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 12) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffefff)) ++#define SET_CH13_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 13) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffdfff)) ++#define SET_CH14_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 14) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffffbfff)) ++#define SET_CH15_QUEUE_FLUSH(_VAL_) (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (((_VAL_) << 15) | ((REG32(ADR_MB_OUT_QUEUE_FLUSH)) & 0xffff7fff)) ++#define SET_FFO0_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT1)) = (((_VAL_) << 0) | ((REG32(ADR_RD_FFOUT_CNT1)) & 0xffffffe0)) ++#define SET_FFO1_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT1)) = (((_VAL_) << 5) | ((REG32(ADR_RD_FFOUT_CNT1)) & 0xfffffc1f)) ++#define SET_FFO2_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT1)) = (((_VAL_) << 10) | ((REG32(ADR_RD_FFOUT_CNT1)) & 0xfffff3ff)) ++#define SET_FFO3_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT1)) = (((_VAL_) << 15) | ((REG32(ADR_RD_FFOUT_CNT1)) & 0xfff07fff)) ++#define SET_FFO4_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT1)) = (((_VAL_) << 20) | ((REG32(ADR_RD_FFOUT_CNT1)) & 0xffcfffff)) ++#define SET_FFO5_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT1)) = (((_VAL_) << 25) | ((REG32(ADR_RD_FFOUT_CNT1)) & 0xf1ffffff)) ++#define SET_FFO6_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT2)) = (((_VAL_) << 0) | ((REG32(ADR_RD_FFOUT_CNT2)) & 0xfffffff0)) ++#define SET_FFO7_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT2)) = (((_VAL_) << 5) | ((REG32(ADR_RD_FFOUT_CNT2)) & 0xfffffc1f)) ++#define SET_FFO8_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT2)) = (((_VAL_) << 10) | ((REG32(ADR_RD_FFOUT_CNT2)) & 0xffff83ff)) ++#define SET_FFO9_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT2)) = (((_VAL_) << 15) | ((REG32(ADR_RD_FFOUT_CNT2)) & 0xfff07fff)) ++#define SET_FFO10_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT2)) = (((_VAL_) << 20) | ((REG32(ADR_RD_FFOUT_CNT2)) & 0xff0fffff)) ++#define SET_FFO11_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT2)) = (((_VAL_) << 25) | ((REG32(ADR_RD_FFOUT_CNT2)) & 0xc1ffffff)) ++#define SET_FFO12_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT3)) = (((_VAL_) << 0) | ((REG32(ADR_RD_FFOUT_CNT3)) & 0xfffffff8)) ++#define SET_FFO13_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT3)) = (((_VAL_) << 5) | ((REG32(ADR_RD_FFOUT_CNT3)) & 0xffffff9f)) ++#define SET_FFO14_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT3)) = (((_VAL_) << 10) | ((REG32(ADR_RD_FFOUT_CNT3)) & 0xfffff3ff)) ++#define SET_FFO15_CNT(_VAL_) (REG32(ADR_RD_FFOUT_CNT3)) = (((_VAL_) << 15) | ((REG32(ADR_RD_FFOUT_CNT3)) & 0xffe07fff)) ++#define SET_CH0_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 0) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffffe)) ++#define SET_CH1_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 1) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffffd)) ++#define SET_CH2_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 2) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffffb)) ++#define SET_CH3_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 3) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffff7)) ++#define SET_CH4_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 4) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffffef)) ++#define SET_CH5_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 5) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffffdf)) ++#define SET_CH6_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 6) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffffbf)) ++#define SET_CH7_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 7) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffff7f)) ++#define SET_CH8_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 8) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffeff)) ++#define SET_CH9_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 9) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffdff)) ++#define SET_CH10_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 10) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffffbff)) ++#define SET_CH11_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 11) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xfffff7ff)) ++#define SET_CH12_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 12) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffefff)) ++#define SET_CH13_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 13) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffdfff)) ++#define SET_CH14_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 14) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffffbfff)) ++#define SET_CH15_FFO_FULL(_VAL_) (REG32(ADR_RD_FFOUT_FULL)) = (((_VAL_) << 15) | ((REG32(ADR_RD_FFOUT_FULL)) & 0xffff7fff)) ++#define SET_CH0_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 0) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffffe)) ++#define SET_CH1_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 1) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffffd)) ++#define SET_CH2_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 2) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffffb)) ++#define SET_CH3_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 3) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffff7)) ++#define SET_CH4_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 4) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffffef)) ++#define SET_CH5_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 5) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffffdf)) ++#define SET_CH6_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 6) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffffbf)) ++#define SET_CH7_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 7) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffff7f)) ++#define SET_CH8_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 8) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffeff)) ++#define SET_CH9_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 9) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffdff)) ++#define SET_CH10_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 10) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffffbff)) ++#define SET_CH11_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 11) | ((REG32(ADR_MB_THRESHOLD6)) & 0xfffff7ff)) ++#define SET_CH12_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 12) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffefff)) ++#define SET_CH13_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 13) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffdfff)) ++#define SET_CH14_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 14) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffffbfff)) ++#define SET_CH15_LOWTHOLD_INT(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 15) | ((REG32(ADR_MB_THRESHOLD6)) & 0xffff7fff)) ++#define SET_MB_LOW_THOLD_EN(_VAL_) (REG32(ADR_MB_THRESHOLD6)) = (((_VAL_) << 31) | ((REG32(ADR_MB_THRESHOLD6)) & 0x7fffffff)) ++#define SET_CH0_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD7)) = (((_VAL_) << 0) | ((REG32(ADR_MB_THRESHOLD7)) & 0xffffffe0)) ++#define SET_CH1_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD7)) = (((_VAL_) << 8) | ((REG32(ADR_MB_THRESHOLD7)) & 0xffffe0ff)) ++#define SET_CH2_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD7)) = (((_VAL_) << 16) | ((REG32(ADR_MB_THRESHOLD7)) & 0xffe0ffff)) ++#define SET_CH3_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD7)) = (((_VAL_) << 24) | ((REG32(ADR_MB_THRESHOLD7)) & 0xe0ffffff)) ++#define SET_CH4_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD8)) = (((_VAL_) << 0) | ((REG32(ADR_MB_THRESHOLD8)) & 0xffffffe0)) ++#define SET_CH5_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD8)) = (((_VAL_) << 8) | ((REG32(ADR_MB_THRESHOLD8)) & 0xffffe0ff)) ++#define SET_CH6_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD8)) = (((_VAL_) << 16) | ((REG32(ADR_MB_THRESHOLD8)) & 0xffe0ffff)) ++#define SET_CH7_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD8)) = (((_VAL_) << 24) | ((REG32(ADR_MB_THRESHOLD8)) & 0xe0ffffff)) ++#define SET_CH8_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD9)) = (((_VAL_) << 0) | ((REG32(ADR_MB_THRESHOLD9)) & 0xffffffe0)) ++#define SET_CH9_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD9)) = (((_VAL_) << 8) | ((REG32(ADR_MB_THRESHOLD9)) & 0xffffe0ff)) ++#define SET_CH10_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD9)) = (((_VAL_) << 16) | ((REG32(ADR_MB_THRESHOLD9)) & 0xffe0ffff)) ++#define SET_CH11_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD9)) = (((_VAL_) << 24) | ((REG32(ADR_MB_THRESHOLD9)) & 0xe0ffffff)) ++#define SET_CH12_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD10)) = (((_VAL_) << 0) | ((REG32(ADR_MB_THRESHOLD10)) & 0xffffffe0)) ++#define SET_CH13_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD10)) = (((_VAL_) << 8) | ((REG32(ADR_MB_THRESHOLD10)) & 0xffffe0ff)) ++#define SET_CH14_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD10)) = (((_VAL_) << 16) | ((REG32(ADR_MB_THRESHOLD10)) & 0xffe0ffff)) ++#define SET_CH15_LOWTHOLD(_VAL_) (REG32(ADR_MB_THRESHOLD10)) = (((_VAL_) << 24) | ((REG32(ADR_MB_THRESHOLD10)) & 0xe0ffffff)) ++#define SET_TRASH_TIMEOUT_EN(_VAL_) (REG32(ADR_MB_TRASH_CFG)) = (((_VAL_) << 0) | ((REG32(ADR_MB_TRASH_CFG)) & 0xfffffffe)) ++#define SET_TRASH_CAN_INT(_VAL_) (REG32(ADR_MB_TRASH_CFG)) = (((_VAL_) << 1) | ((REG32(ADR_MB_TRASH_CFG)) & 0xfffffffd)) ++#define SET_TRASH_INT_ID(_VAL_) (REG32(ADR_MB_TRASH_CFG)) = (((_VAL_) << 4) | ((REG32(ADR_MB_TRASH_CFG)) & 0xfffff80f)) ++#define SET_TRASH_TIMEOUT(_VAL_) (REG32(ADR_MB_TRASH_CFG)) = (((_VAL_) << 16) | ((REG32(ADR_MB_TRASH_CFG)) & 0xfc00ffff)) ++#define SET_CH0_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 0) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffffe)) ++#define SET_CH1_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 1) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffffd)) ++#define SET_CH2_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 2) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffffb)) ++#define SET_CH3_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 3) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffff7)) ++#define SET_CH4_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 4) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffffef)) ++#define SET_CH5_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 5) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffffdf)) ++#define SET_CH6_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 6) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffffbf)) ++#define SET_CH7_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 7) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffff7f)) ++#define SET_CH8_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 8) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffeff)) ++#define SET_CH9_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 9) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffdff)) ++#define SET_CH10_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 10) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffffbff)) ++#define SET_CH11_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 11) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xfffff7ff)) ++#define SET_CH12_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 12) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffefff)) ++#define SET_CH13_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 13) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffdfff)) ++#define SET_CH14_WRFF_FLUSH(_VAL_) (REG32(ADR_MB_IN_FF_FLUSH)) = (((_VAL_) << 14) | ((REG32(ADR_MB_IN_FF_FLUSH)) & 0xffffbfff)) ++#define SET_CPU_ID_TB2(_VAL_) (REG32(ADR_CPU_ID_TB2)) = (((_VAL_) << 0) | ((REG32(ADR_CPU_ID_TB2)) & 0x00000000)) ++#define SET_CPU_ID_TB3(_VAL_) (REG32(ADR_CPU_ID_TB3)) = (((_VAL_) << 0) | ((REG32(ADR_CPU_ID_TB3)) & 0x00000000)) ++#define SET_IQ_LOG_EN(_VAL_) (REG32(ADR_PHY_IQ_LOG_CFG0)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_IQ_LOG_CFG0)) & 0xfffffffe)) ++#define SET_IQ_LOG_STOP_MODE(_VAL_) (REG32(ADR_PHY_IQ_LOG_CFG1)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0xfffffffe)) ++#define SET_GPIO_STOP_EN(_VAL_) (REG32(ADR_PHY_IQ_LOG_CFG1)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0xffffffef)) ++#define SET_GPIO_STOP_POL(_VAL_) (REG32(ADR_PHY_IQ_LOG_CFG1)) = (((_VAL_) << 5) | ((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0xffffffdf)) ++#define SET_IQ_LOG_TIMER(_VAL_) (REG32(ADR_PHY_IQ_LOG_CFG1)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_IQ_LOG_CFG1)) & 0x0000ffff)) ++#define SET_IQ_LOG_LEN(_VAL_) (REG32(ADR_PHY_IQ_LOG_LEN)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_IQ_LOG_LEN)) & 0xffff0000)) ++#define SET_IQ_LOG_TAIL_ADR(_VAL_) (REG32(ADR_PHY_IQ_LOG_PTR)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_IQ_LOG_PTR)) & 0xffff0000)) ++#define SET_ALC_LENG(_VAL_) (REG32(ADR_WR_ALC)) = (((_VAL_) << 0) | ((REG32(ADR_WR_ALC)) & 0xfffc0000)) ++#define SET_CH0_DYN_PRI(_VAL_) (REG32(ADR_WR_ALC)) = (((_VAL_) << 20) | ((REG32(ADR_WR_ALC)) & 0xffcfffff)) ++#define SET_MCU_PKTID(_VAL_) (REG32(ADR_GETID)) = (((_VAL_) << 0) | ((REG32(ADR_GETID)) & 0x00000000)) ++#define SET_CH0_STA_PRI(_VAL_) (REG32(ADR_CH_STA_PRI)) = (((_VAL_) << 0) | ((REG32(ADR_CH_STA_PRI)) & 0xfffffffc)) ++#define SET_CH1_STA_PRI(_VAL_) (REG32(ADR_CH_STA_PRI)) = (((_VAL_) << 4) | ((REG32(ADR_CH_STA_PRI)) & 0xffffffcf)) ++#define SET_CH2_STA_PRI(_VAL_) (REG32(ADR_CH_STA_PRI)) = (((_VAL_) << 8) | ((REG32(ADR_CH_STA_PRI)) & 0xfffffcff)) ++#define SET_CH3_STA_PRI(_VAL_) (REG32(ADR_CH_STA_PRI)) = (((_VAL_) << 12) | ((REG32(ADR_CH_STA_PRI)) & 0xffffcfff)) ++#define SET_ID_TB0(_VAL_) (REG32(ADR_RD_ID0)) = (((_VAL_) << 0) | ((REG32(ADR_RD_ID0)) & 0x00000000)) ++#define SET_ID_TB1(_VAL_) (REG32(ADR_RD_ID1)) = (((_VAL_) << 0) | ((REG32(ADR_RD_ID1)) & 0x00000000)) ++#define SET_ID_MNG_HALT(_VAL_) (REG32(ADR_IMD_CFG)) = (((_VAL_) << 4) | ((REG32(ADR_IMD_CFG)) & 0xffffffef)) ++#define SET_ID_MNG_ERR_HALT_EN(_VAL_) (REG32(ADR_IMD_CFG)) = (((_VAL_) << 5) | ((REG32(ADR_IMD_CFG)) & 0xffffffdf)) ++#define SET_ID_EXCEPT_FLG_CLR(_VAL_) (REG32(ADR_IMD_CFG)) = (((_VAL_) << 6) | ((REG32(ADR_IMD_CFG)) & 0xffffffbf)) ++#define SET_ID_EXCEPT_FLG(_VAL_) (REG32(ADR_IMD_CFG)) = (((_VAL_) << 7) | ((REG32(ADR_IMD_CFG)) & 0xffffff7f)) ++#define SET_ID_FULL(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 0) | ((REG32(ADR_IMD_STA)) & 0xfffffffe)) ++#define SET_ID_MNG_BUSY(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 1) | ((REG32(ADR_IMD_STA)) & 0xfffffffd)) ++#define SET_REQ_LOCK(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 2) | ((REG32(ADR_IMD_STA)) & 0xfffffffb)) ++#define SET_CH0_REQ_LOCK(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 4) | ((REG32(ADR_IMD_STA)) & 0xffffffef)) ++#define SET_CH1_REQ_LOCK(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 5) | ((REG32(ADR_IMD_STA)) & 0xffffffdf)) ++#define SET_CH2_REQ_LOCK(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 6) | ((REG32(ADR_IMD_STA)) & 0xffffffbf)) ++#define SET_CH3_REQ_LOCK(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 7) | ((REG32(ADR_IMD_STA)) & 0xffffff7f)) ++#define SET_REQ_LOCK_INT_EN(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 8) | ((REG32(ADR_IMD_STA)) & 0xfffffeff)) ++#define SET_REQ_LOCK_INT(_VAL_) (REG32(ADR_IMD_STA)) = (((_VAL_) << 9) | ((REG32(ADR_IMD_STA)) & 0xfffffdff)) ++#define SET_MCU_ALC_READY(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 0) | ((REG32(ADR_ALC_STA)) & 0xfffffffe)) ++#define SET_ALC_FAIL(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 1) | ((REG32(ADR_ALC_STA)) & 0xfffffffd)) ++#define SET_ALC_BUSY(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 2) | ((REG32(ADR_ALC_STA)) & 0xfffffffb)) ++#define SET_CH0_NVLD(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 4) | ((REG32(ADR_ALC_STA)) & 0xffffffef)) ++#define SET_CH1_NVLD(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 5) | ((REG32(ADR_ALC_STA)) & 0xffffffdf)) ++#define SET_CH2_NVLD(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 6) | ((REG32(ADR_ALC_STA)) & 0xffffffbf)) ++#define SET_CH3_NVLD(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 7) | ((REG32(ADR_ALC_STA)) & 0xffffff7f)) ++#define SET_ALC_INT_ID(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 8) | ((REG32(ADR_ALC_STA)) & 0xffff80ff)) ++#define SET_ALC_TIMEOUT(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 16) | ((REG32(ADR_ALC_STA)) & 0xfc00ffff)) ++#define SET_ALC_TIMEOUT_INT_EN(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 30) | ((REG32(ADR_ALC_STA)) & 0xbfffffff)) ++#define SET_ALC_TIMEOUT_INT(_VAL_) (REG32(ADR_ALC_STA)) = (((_VAL_) << 31) | ((REG32(ADR_ALC_STA)) & 0x7fffffff)) ++#define SET_TX_ID_COUNT(_VAL_) (REG32(ADR_TRX_ID_COUNT)) = (((_VAL_) << 0) | ((REG32(ADR_TRX_ID_COUNT)) & 0xffffff00)) ++#define SET_RX_ID_COUNT(_VAL_) (REG32(ADR_TRX_ID_COUNT)) = (((_VAL_) << 8) | ((REG32(ADR_TRX_ID_COUNT)) & 0xffff00ff)) ++#define SET_TX_ID_THOLD(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 0) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xffffff00)) ++#define SET_RX_ID_THOLD(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 8) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xffff00ff)) ++#define SET_ID_THOLD_RX_INT(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 16) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xfffeffff)) ++#define SET_RX_INT_CH(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 17) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xfff1ffff)) ++#define SET_ID_THOLD_TX_INT(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 20) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xffefffff)) ++#define SET_TX_INT_CH(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 21) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xff1fffff)) ++#define SET_ID_THOLD_INT_EN(_VAL_) (REG32(ADR_TRX_ID_THRESHOLD)) = (((_VAL_) << 24) | ((REG32(ADR_TRX_ID_THRESHOLD)) & 0xfeffffff)) ++#define SET_TX_ID_TB0(_VAL_) (REG32(ADR_TX_ID0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID0)) & 0x00000000)) ++#define SET_TX_ID_TB1(_VAL_) (REG32(ADR_TX_ID1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID1)) & 0x00000000)) ++#define SET_RX_ID_TB0(_VAL_) (REG32(ADR_RX_ID0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_ID0)) & 0x00000000)) ++#define SET_RX_ID_TB1(_VAL_) (REG32(ADR_RX_ID1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_ID1)) & 0x00000000)) ++#define SET_DOUBLE_RLS_INT_EN(_VAL_) (REG32(ADR_RTN_STA)) = (((_VAL_) << 0) | ((REG32(ADR_RTN_STA)) & 0xfffffffe)) ++#define SET_ID_DOUBLE_RLS_INT(_VAL_) (REG32(ADR_RTN_STA)) = (((_VAL_) << 1) | ((REG32(ADR_RTN_STA)) & 0xfffffffd)) ++#define SET_DOUBLE_RLS_ID(_VAL_) (REG32(ADR_RTN_STA)) = (((_VAL_) << 8) | ((REG32(ADR_RTN_STA)) & 0xffff80ff)) ++#define SET_ID_LEN_THOLD_INT_EN(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 0) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0xfffffffe)) ++#define SET_ALL_ID_LEN_THOLD_INT(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 1) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0xfffffffd)) ++#define SET_TX_ID_LEN_THOLD_INT(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 2) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0xfffffffb)) ++#define SET_RX_ID_LEN_THOLD_INT(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 3) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0xfffffff7)) ++#define SET_ID_TX_LEN_THOLD(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 4) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0xffffe00f)) ++#define SET_ID_RX_LEN_THOLD(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 13) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0xffc01fff)) ++#define SET_ID_LEN_THOLD(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD1)) = (((_VAL_) << 22) | ((REG32(ADR_ID_LEN_THREADSHOLD1)) & 0x803fffff)) ++#define SET_ALL_ID_ALC_LEN(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD2)) = (((_VAL_) << 0) | ((REG32(ADR_ID_LEN_THREADSHOLD2)) & 0xfffffe00)) ++#define SET_TX_ID_ALC_LEN(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD2)) = (((_VAL_) << 9) | ((REG32(ADR_ID_LEN_THREADSHOLD2)) & 0xfffc01ff)) ++#define SET_RX_ID_ALC_LEN(_VAL_) (REG32(ADR_ID_LEN_THREADSHOLD2)) = (((_VAL_) << 18) | ((REG32(ADR_ID_LEN_THREADSHOLD2)) & 0xf803ffff)) ++#define SET_CH_ARB_EN(_VAL_) (REG32(ADR_CH_ARB_PRI)) = (((_VAL_) << 0) | ((REG32(ADR_CH_ARB_PRI)) & 0xfffffffe)) ++#define SET_CH_PRI1(_VAL_) (REG32(ADR_CH_ARB_PRI)) = (((_VAL_) << 4) | ((REG32(ADR_CH_ARB_PRI)) & 0xffffffcf)) ++#define SET_CH_PRI2(_VAL_) (REG32(ADR_CH_ARB_PRI)) = (((_VAL_) << 8) | ((REG32(ADR_CH_ARB_PRI)) & 0xfffffcff)) ++#define SET_CH_PRI3(_VAL_) (REG32(ADR_CH_ARB_PRI)) = (((_VAL_) << 12) | ((REG32(ADR_CH_ARB_PRI)) & 0xffffcfff)) ++#define SET_CH_PRI4(_VAL_) (REG32(ADR_CH_ARB_PRI)) = (((_VAL_) << 16) | ((REG32(ADR_CH_ARB_PRI)) & 0xfffcffff)) ++#define SET_TX_ID_REMAIN(_VAL_) (REG32(ADR_TX_ID_REMAIN_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID_REMAIN_STATUS)) & 0xffffff80)) ++#define SET_TX_PAGE_REMAIN(_VAL_) (REG32(ADR_TX_ID_REMAIN_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_TX_ID_REMAIN_STATUS)) & 0xfffe00ff)) ++#define SET_ID_PAGE_MAX_SIZE(_VAL_) (REG32(ADR_ID_INFO_STA)) = (((_VAL_) << 0) | ((REG32(ADR_ID_INFO_STA)) & 0xfffffe00)) ++#define SET_TX_PAGE_LIMIT(_VAL_) (REG32(ADR_TX_LIMIT_INTR)) = (((_VAL_) << 0) | ((REG32(ADR_TX_LIMIT_INTR)) & 0xfffffe00)) ++#define SET_TX_COUNT_LIMIT(_VAL_) (REG32(ADR_TX_LIMIT_INTR)) = (((_VAL_) << 16) | ((REG32(ADR_TX_LIMIT_INTR)) & 0xff00ffff)) ++#define SET_TX_LIMIT_INT(_VAL_) (REG32(ADR_TX_LIMIT_INTR)) = (((_VAL_) << 30) | ((REG32(ADR_TX_LIMIT_INTR)) & 0xbfffffff)) ++#define SET_TX_LIMIT_INT_EN(_VAL_) (REG32(ADR_TX_LIMIT_INTR)) = (((_VAL_) << 31) | ((REG32(ADR_TX_LIMIT_INTR)) & 0x7fffffff)) ++#define SET_TX_PAGE_USE_7_0(_VAL_) (REG32(ADR_TX_ID_ALL_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID_ALL_INFO)) & 0xffffff00)) ++#define SET_TX_ID_USE_5_0(_VAL_) (REG32(ADR_TX_ID_ALL_INFO)) = (((_VAL_) << 8) | ((REG32(ADR_TX_ID_ALL_INFO)) & 0xffffc0ff)) ++#define SET_EDCA0_FFO_CNT(_VAL_) (REG32(ADR_TX_ID_ALL_INFO)) = (((_VAL_) << 14) | ((REG32(ADR_TX_ID_ALL_INFO)) & 0xfffc3fff)) ++#define SET_EDCA1_FFO_CNT_3_0(_VAL_) (REG32(ADR_TX_ID_ALL_INFO)) = (((_VAL_) << 18) | ((REG32(ADR_TX_ID_ALL_INFO)) & 0xffc3ffff)) ++#define SET_EDCA2_FFO_CNT(_VAL_) (REG32(ADR_TX_ID_ALL_INFO)) = (((_VAL_) << 22) | ((REG32(ADR_TX_ID_ALL_INFO)) & 0xf83fffff)) ++#define SET_EDCA3_FFO_CNT(_VAL_) (REG32(ADR_TX_ID_ALL_INFO)) = (((_VAL_) << 27) | ((REG32(ADR_TX_ID_ALL_INFO)) & 0x07ffffff)) ++#define SET_ID_TB2(_VAL_) (REG32(ADR_RD_ID2)) = (((_VAL_) << 0) | ((REG32(ADR_RD_ID2)) & 0x00000000)) ++#define SET_ID_TB3(_VAL_) (REG32(ADR_RD_ID3)) = (((_VAL_) << 0) | ((REG32(ADR_RD_ID3)) & 0x00000000)) ++#define SET_TX_ID_TB2(_VAL_) (REG32(ADR_TX_ID2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID2)) & 0x00000000)) ++#define SET_TX_ID_TB3(_VAL_) (REG32(ADR_TX_ID3)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID3)) & 0x00000000)) ++#define SET_RX_ID_TB2(_VAL_) (REG32(ADR_RX_ID2)) = (((_VAL_) << 0) | ((REG32(ADR_RX_ID2)) & 0x00000000)) ++#define SET_RX_ID_TB3(_VAL_) (REG32(ADR_RX_ID3)) = (((_VAL_) << 0) | ((REG32(ADR_RX_ID3)) & 0x00000000)) ++#define SET_TX_PAGE_USE2(_VAL_) (REG32(ADR_TX_ID_ALL_INFO2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID_ALL_INFO2)) & 0xfffffe00)) ++#define SET_TX_ID_USE2(_VAL_) (REG32(ADR_TX_ID_ALL_INFO2)) = (((_VAL_) << 9) | ((REG32(ADR_TX_ID_ALL_INFO2)) & 0xfffe01ff)) ++#define SET_EDCA4_FFO_CNT(_VAL_) (REG32(ADR_TX_ID_ALL_INFO2)) = (((_VAL_) << 17) | ((REG32(ADR_TX_ID_ALL_INFO2)) & 0xffe1ffff)) ++#define SET_TX_PAGE_USE3(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_A)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID_ALL_INFO_A)) & 0xfffffe00)) ++#define SET_TX_ID_USE3(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_A)) = (((_VAL_) << 9) | ((REG32(ADR_TX_ID_ALL_INFO_A)) & 0xfffe01ff)) ++#define SET_EDCA1_FFO_CNT2(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_A)) = (((_VAL_) << 21) | ((REG32(ADR_TX_ID_ALL_INFO_A)) & 0xfc1fffff)) ++#define SET_EDCA4_FFO_CNT2(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_A)) = (((_VAL_) << 26) | ((REG32(ADR_TX_ID_ALL_INFO_A)) & 0xc3ffffff)) ++#define SET_TX_PAGE_USE4(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_B)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID_ALL_INFO_B)) & 0xfffffe00)) ++#define SET_TX_ID_USE4(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_B)) = (((_VAL_) << 9) | ((REG32(ADR_TX_ID_ALL_INFO_B)) & 0xfffe01ff)) ++#define SET_EDCA2_FFO_CNT2(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_B)) = (((_VAL_) << 17) | ((REG32(ADR_TX_ID_ALL_INFO_B)) & 0xffc1ffff)) ++#define SET_EDCA3_FFO_CNT2(_VAL_) (REG32(ADR_TX_ID_ALL_INFO_B)) = (((_VAL_) << 22) | ((REG32(ADR_TX_ID_ALL_INFO_B)) & 0xf83fffff)) ++#define SET_TX_ID_IFO_LEN(_VAL_) (REG32(ADR_TX_ID_REMAIN_STATUS2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_ID_REMAIN_STATUS2)) & 0xfffffe00)) ++#define SET_RX_ID_IFO_LEN(_VAL_) (REG32(ADR_TX_ID_REMAIN_STATUS2)) = (((_VAL_) << 16) | ((REG32(ADR_TX_ID_REMAIN_STATUS2)) & 0xfe00ffff)) ++#define SET_MAX_ALL_ALC_ID_CNT(_VAL_) (REG32(ADR_ALC_ID_INFO)) = (((_VAL_) << 0) | ((REG32(ADR_ALC_ID_INFO)) & 0xffffff00)) ++#define SET_MAX_TX_ALC_ID_CNT(_VAL_) (REG32(ADR_ALC_ID_INFO)) = (((_VAL_) << 8) | ((REG32(ADR_ALC_ID_INFO)) & 0xffff00ff)) ++#define SET_MAX_RX_ALC_ID_CNT(_VAL_) (REG32(ADR_ALC_ID_INFO)) = (((_VAL_) << 16) | ((REG32(ADR_ALC_ID_INFO)) & 0xff00ffff)) ++#define SET_MAX_ALL_ID_ALC_LEN(_VAL_) (REG32(ADR_ALC_ID_INF1)) = (((_VAL_) << 0) | ((REG32(ADR_ALC_ID_INF1)) & 0xfffffe00)) ++#define SET_MAX_TX_ID_ALC_LEN(_VAL_) (REG32(ADR_ALC_ID_INF1)) = (((_VAL_) << 9) | ((REG32(ADR_ALC_ID_INF1)) & 0xfffc01ff)) ++#define SET_MAX_RX_ID_ALC_LEN(_VAL_) (REG32(ADR_ALC_ID_INF1)) = (((_VAL_) << 18) | ((REG32(ADR_ALC_ID_INF1)) & 0xf803ffff)) ++#define SET_RG_PMDLBK(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_EN_0)) & 0xfffffffe)) ++#define SET_RG_RDYACK_SEL(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 1) | ((REG32(ADR_PHY_EN_0)) & 0xfffffff9)) ++#define SET_RG_ADEDGE_SEL(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 3) | ((REG32(ADR_PHY_EN_0)) & 0xfffffff7)) ++#define SET_RG_SIGN_SWAP(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_EN_0)) & 0xffffffef)) ++#define SET_RG_IQ_SWAP(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 5) | ((REG32(ADR_PHY_EN_0)) & 0xffffffdf)) ++#define SET_RG_Q_INV(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 6) | ((REG32(ADR_PHY_EN_0)) & 0xffffffbf)) ++#define SET_RG_I_INV(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 7) | ((REG32(ADR_PHY_EN_0)) & 0xffffff7f)) ++#define SET_RG_BYPASS_ACI(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_EN_0)) & 0xfffffeff)) ++#define SET_RG_LBK_ANA_PATH(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 9) | ((REG32(ADR_PHY_EN_0)) & 0xfffffdff)) ++#define SET_RG_SPECTRUM_LEAKY_FACTOR(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 10) | ((REG32(ADR_PHY_EN_0)) & 0xfffff3ff)) ++#define SET_RG_SPECTRUM_BW(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_EN_0)) & 0xffffcfff)) ++#define SET_RG_SPECTRUM_FREQ_MANUAL(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 14) | ((REG32(ADR_PHY_EN_0)) & 0xffffbfff)) ++#define SET_RG_SPECTRUM_EN(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 15) | ((REG32(ADR_PHY_EN_0)) & 0xffff7fff)) ++#define SET_RG_TXPWRLVL_SET(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_EN_0)) & 0xff00ffff)) ++#define SET_RG_TXPWRLVL_SEL(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_EN_0)) & 0xfeffffff)) ++#define SET_RG_RF_BB_CLK_SEL(_VAL_) (REG32(ADR_PHY_EN_0)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_EN_0)) & 0x7fffffff)) ++#define SET_RG_PHY_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_EN_1)) & 0xfffffffe)) ++#define SET_RG_PHYRX_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 1) | ((REG32(ADR_PHY_EN_1)) & 0xfffffffd)) ++#define SET_RG_PHYTX_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 2) | ((REG32(ADR_PHY_EN_1)) & 0xfffffffb)) ++#define SET_RG_PHY11GN_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 3) | ((REG32(ADR_PHY_EN_1)) & 0xfffffff7)) ++#define SET_RG_PHY11B_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_EN_1)) & 0xffffffef)) ++#define SET_RG_PHYRXFIFO_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 5) | ((REG32(ADR_PHY_EN_1)) & 0xffffffdf)) ++#define SET_RG_PHYTXFIFO_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 6) | ((REG32(ADR_PHY_EN_1)) & 0xffffffbf)) ++#define SET_RG_PHY11BGN_MD_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_EN_1)) & 0xfffffeff)) ++#define SET_RG_FORCE_11GN_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_EN_1)) & 0xffffefff)) ++#define SET_RG_FORCE_11B_EN(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 13) | ((REG32(ADR_PHY_EN_1)) & 0xffffdfff)) ++#define SET_RG_FFT_MEM_CLK_EN_RX(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 14) | ((REG32(ADR_PHY_EN_1)) & 0xffffbfff)) ++#define SET_RG_FFT_MEM_CLK_EN_TX(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 15) | ((REG32(ADR_PHY_EN_1)) & 0xffff7fff)) ++#define SET_RG_PHY_IQ_TRIG_SEL(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_EN_1)) & 0xfff0ffff)) ++#define SET_RG_SPECTRUM_FREQ(_VAL_) (REG32(ADR_PHY_EN_1)) = (((_VAL_) << 20) | ((REG32(ADR_PHY_EN_1)) & 0xc00fffff)) ++#define SET_SVN_VERSION(_VAL_) (REG32(ADR_SVN_VERSION_REG)) = (((_VAL_) << 0) | ((REG32(ADR_SVN_VERSION_REG)) & 0x00000000)) ++#define SET_RG_LENGTH(_VAL_) (REG32(ADR_PHY_PKT_GEN_0)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_PKT_GEN_0)) & 0xffff0000)) ++#define SET_RG_PKT_MODE(_VAL_) (REG32(ADR_PHY_PKT_GEN_0)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_PKT_GEN_0)) & 0xfff8ffff)) ++#define SET_RG_CH_BW(_VAL_) (REG32(ADR_PHY_PKT_GEN_0)) = (((_VAL_) << 19) | ((REG32(ADR_PHY_PKT_GEN_0)) & 0xffc7ffff)) ++#define SET_RG_PRM(_VAL_) (REG32(ADR_PHY_PKT_GEN_0)) = (((_VAL_) << 22) | ((REG32(ADR_PHY_PKT_GEN_0)) & 0xffbfffff)) ++#define SET_RG_SHORTGI(_VAL_) (REG32(ADR_PHY_PKT_GEN_0)) = (((_VAL_) << 23) | ((REG32(ADR_PHY_PKT_GEN_0)) & 0xff7fffff)) ++#define SET_RG_RATE(_VAL_) (REG32(ADR_PHY_PKT_GEN_0)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_PKT_GEN_0)) & 0x80ffffff)) ++#define SET_RG_L_LENGTH(_VAL_) (REG32(ADR_PHY_PKT_GEN_1)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_PKT_GEN_1)) & 0xfffff000)) ++#define SET_RG_L_RATE(_VAL_) (REG32(ADR_PHY_PKT_GEN_1)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_PKT_GEN_1)) & 0xffff8fff)) ++#define SET_RG_SERVICE(_VAL_) (REG32(ADR_PHY_PKT_GEN_1)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_PKT_GEN_1)) & 0x0000ffff)) ++#define SET_RG_SMOOTHING(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xfffffffe)) ++#define SET_RG_NO_SOUND(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 1) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xfffffffd)) ++#define SET_RG_AGGREGATE(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 2) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xfffffffb)) ++#define SET_RG_STBC(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 3) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xffffffe7)) ++#define SET_RG_FEC(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 5) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xffffffdf)) ++#define SET_RG_N_ESS(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 6) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xffffff3f)) ++#define SET_RG_TXPWRLVL(_VAL_) (REG32(ADR_PHY_PKT_GEN_2)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_PKT_GEN_2)) & 0xffff00ff)) ++#define SET_RG_TX_START(_VAL_) (REG32(ADR_PHY_PKT_GEN_3)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_PKT_GEN_3)) & 0xfffffffe)) ++#define SET_RG_IFS_TIME(_VAL_) (REG32(ADR_PHY_PKT_GEN_3)) = (((_VAL_) << 2) | ((REG32(ADR_PHY_PKT_GEN_3)) & 0xffffff03)) ++#define SET_RG_CONTINUOUS_DATA(_VAL_) (REG32(ADR_PHY_PKT_GEN_3)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_PKT_GEN_3)) & 0xfffffeff)) ++#define SET_RG_DATA_SEL(_VAL_) (REG32(ADR_PHY_PKT_GEN_3)) = (((_VAL_) << 9) | ((REG32(ADR_PHY_PKT_GEN_3)) & 0xfffff9ff)) ++#define SET_RG_TX_D(_VAL_) (REG32(ADR_PHY_PKT_GEN_3)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_PKT_GEN_3)) & 0xff00ffff)) ++#define SET_RG_TX_CNT_TARGET(_VAL_) (REG32(ADR_PHY_PKT_GEN_4)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_PKT_GEN_4)) & 0x00000000)) ++#define SET_RG_FFT_IFFT_MODE(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 6) | ((REG32(ADR_PHY_REG_00)) & 0xffffff3f)) ++#define SET_RG_DAC_DBG_MODE(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_00)) & 0xfffffeff)) ++#define SET_RG_DAC_SGN_SWAP(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 9) | ((REG32(ADR_PHY_REG_00)) & 0xfffffdff)) ++#define SET_RG_TXD_SEL(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 10) | ((REG32(ADR_PHY_REG_00)) & 0xfffff3ff)) ++#define SET_RG_UP8X(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_00)) & 0xff00ffff)) ++#define SET_RG_IQ_DC_BYP(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_00)) & 0xfeffffff)) ++#define SET_RG_IQ_DC_LEAKY_FACTOR(_VAL_) (REG32(ADR_PHY_REG_00)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_REG_00)) & 0xcfffffff)) ++#define SET_RG_DAC_DCEN(_VAL_) (REG32(ADR_PHY_REG_01)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_01)) & 0xfffffffe)) ++#define SET_RG_DAC_DCQ(_VAL_) (REG32(ADR_PHY_REG_01)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_REG_01)) & 0xffffc00f)) ++#define SET_RG_DAC_DCI(_VAL_) (REG32(ADR_PHY_REG_01)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_01)) & 0xfc00ffff)) ++#define SET_RG_PGA_REFDB_SAT(_VAL_) (REG32(ADR_PHY_REG_02_AGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_02_AGC)) & 0xffffff80)) ++#define SET_RG_PGA_REFDB_TOP(_VAL_) (REG32(ADR_PHY_REG_02_AGC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_02_AGC)) & 0xffff80ff)) ++#define SET_RG_PGA_REF_UND(_VAL_) (REG32(ADR_PHY_REG_02_AGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_02_AGC)) & 0xfc00ffff)) ++#define SET_RG_RF_REF_SAT(_VAL_) (REG32(ADR_PHY_REG_02_AGC)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_REG_02_AGC)) & 0x0fffffff)) ++#define SET_RG_PGAGC_SET(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xfffffff0)) ++#define SET_RG_PGAGC_OW(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffffffef)) ++#define SET_RG_RFGC_SET(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 5) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffffff9f)) ++#define SET_RG_RFGC_OW(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 7) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffffff7f)) ++#define SET_RG_WAIT_T_RXAGC(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffffc0ff)) ++#define SET_RG_RXAGC_SET(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 14) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffffbfff)) ++#define SET_RG_RXAGC_OW(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 15) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffff7fff)) ++#define SET_RG_WAIT_T_FINAL(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xffc0ffff)) ++#define SET_RG_WAIT_T(_VAL_) (REG32(ADR_PHY_REG_03_AGC)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_03_AGC)) & 0xc0ffffff)) ++#define SET_RG_ULG_PGA_SAT_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xfffffff0)) ++#define SET_RG_LG_PGA_UND_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xffffff0f)) ++#define SET_RG_LG_PGA_SAT_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xfffff0ff)) ++#define SET_RG_LG_RF_SAT_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xffff0fff)) ++#define SET_RG_MG_RF_SAT_PGANOREF_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xfff0ffff)) ++#define SET_RG_HG_PGA_SAT2_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 20) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xff0fffff)) ++#define SET_RG_HG_PGA_SAT1_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_04_AGC)) & 0xf0ffffff)) ++#define SET_RG_HG_RF_SAT_PGA_GAIN(_VAL_) (REG32(ADR_PHY_REG_04_AGC)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_REG_04_AGC)) & 0x0fffffff)) ++#define SET_RG_MG_PGA_JB_TH(_VAL_) (REG32(ADR_PHY_REG_05_AGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_05_AGC)) & 0xfffffff0)) ++#define SET_RG_MA_PGA_LOW_TH_CNT_LMT(_VAL_) (REG32(ADR_PHY_REG_05_AGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_05_AGC)) & 0xffe0ffff)) ++#define SET_RG_WR_RFGC_INIT_SET(_VAL_) (REG32(ADR_PHY_REG_05_AGC)) = (((_VAL_) << 21) | ((REG32(ADR_PHY_REG_05_AGC)) & 0xff9fffff)) ++#define SET_RG_WR_RFGC_INIT_EN(_VAL_) (REG32(ADR_PHY_REG_05_AGC)) = (((_VAL_) << 23) | ((REG32(ADR_PHY_REG_05_AGC)) & 0xff7fffff)) ++#define SET_RG_MA_PGA_HIGH_TH_CNT_LMT(_VAL_) (REG32(ADR_PHY_REG_05_AGC)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_05_AGC)) & 0xe0ffffff)) ++#define SET_RG_AGC_THRESHOLD(_VAL_) (REG32(ADR_PHY_REG_06_11B_DAGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_06_11B_DAGC)) & 0xffffc000)) ++#define SET_RG_ACI_POINT_CNT_LMT_11B(_VAL_) (REG32(ADR_PHY_REG_06_11B_DAGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_06_11B_DAGC)) & 0xff80ffff)) ++#define SET_RG_ACI_DAGC_LEAKY_FACTOR_11B(_VAL_) (REG32(ADR_PHY_REG_06_11B_DAGC)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_06_11B_DAGC)) & 0xfcffffff)) ++#define SET_RG_WR_ACI_GAIN_INI_SEL_11B(_VAL_) (REG32(ADR_PHY_REG_07_11B_DAGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0xffffff00)) ++#define SET_RG_WR_ACI_GAIN_SEL_11B(_VAL_) (REG32(ADR_PHY_REG_07_11B_DAGC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0xffff00ff)) ++#define SET_RG_ACI_DAGC_SET_VALUE_11B(_VAL_) (REG32(ADR_PHY_REG_07_11B_DAGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0xff80ffff)) ++#define SET_RG_WR_ACI_GAIN_OW_11B(_VAL_) (REG32(ADR_PHY_REG_07_11B_DAGC)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_07_11B_DAGC)) & 0x7fffffff)) ++#define SET_RG_ACI_POINT_CNT_LMT_11GN(_VAL_) (REG32(ADR_PHY_REG_08_11GN_DAGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_08_11GN_DAGC)) & 0xffffff00)) ++#define SET_RG_ACI_DAGC_LEAKY_FACTOR_11GN(_VAL_) (REG32(ADR_PHY_REG_08_11GN_DAGC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_08_11GN_DAGC)) & 0xfffffcff)) ++#define SET_RG_ACI_DAGC_DONE_CNT_LMT_11GN(_VAL_) (REG32(ADR_PHY_REG_08_11GN_DAGC)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_08_11GN_DAGC)) & 0x00ffffff)) ++#define SET_RG_ACI_DAGC_SET_VALUE_11GN(_VAL_) (REG32(ADR_PHY_REG_09_11GN_DAGC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0xffffff80)) ++#define SET_RG_ACI_GAIN_INI_VAL_11GN(_VAL_) (REG32(ADR_PHY_REG_09_11GN_DAGC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0xffff00ff)) ++#define SET_RG_ACI_GAIN_OW_VAL_11GN(_VAL_) (REG32(ADR_PHY_REG_09_11GN_DAGC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0xff00ffff)) ++#define SET_RG_ACI_GAIN_OW_11GN(_VAL_) (REG32(ADR_PHY_REG_09_11GN_DAGC)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_09_11GN_DAGC)) & 0x7fffffff)) ++#define SET_RO_CCA_PWR_MA_11GN(_VAL_) (REG32(ADR_PHY_READ_REG_00_DIG_PWR)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_00_DIG_PWR)) & 0xffffff80)) ++#define SET_RO_ED_STATE(_VAL_) (REG32(ADR_PHY_READ_REG_00_DIG_PWR)) = (((_VAL_) << 15) | ((REG32(ADR_PHY_READ_REG_00_DIG_PWR)) & 0xffff7fff)) ++#define SET_RO_CCA_PWR_MA_11B(_VAL_) (REG32(ADR_PHY_READ_REG_00_DIG_PWR)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_00_DIG_PWR)) & 0xff80ffff)) ++#define SET_RO_PGA_PWR_FF1(_VAL_) (REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0xffffc000)) ++#define SET_RO_RF_PWR_FF1(_VAL_) (REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0xfff0ffff)) ++#define SET_RO_PGAGC_FF1(_VAL_) (REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0xf0ffffff)) ++#define SET_RO_RFGC_FF1(_VAL_) (REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) & 0xcfffffff)) ++#define SET_RO_PGA_PWR_FF2(_VAL_) (REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0xffffc000)) ++#define SET_RO_RF_PWR_FF2(_VAL_) (REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0xfff0ffff)) ++#define SET_RO_PGAGC_FF2(_VAL_) (REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0xf0ffffff)) ++#define SET_RO_RFGC_FF2(_VAL_) (REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) & 0xcfffffff)) ++#define SET_RO_PGA_PWR_FF3(_VAL_) (REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0xffffc000)) ++#define SET_RO_RF_PWR_FF3(_VAL_) (REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0xfff0ffff)) ++#define SET_RO_PGAGC_FF3(_VAL_) (REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0xf0ffffff)) ++#define SET_RO_RFGC_FF3(_VAL_) (REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) & 0xcfffffff)) ++#define SET_RG_TX_DES_RATE(_VAL_) (REG32(ADR_PHY_REG_10_TX_DES)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_10_TX_DES)) & 0xffffffe0)) ++#define SET_RG_TX_DES_MODE(_VAL_) (REG32(ADR_PHY_REG_10_TX_DES)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_10_TX_DES)) & 0xffffe0ff)) ++#define SET_RG_TX_DES_LEN_LO(_VAL_) (REG32(ADR_PHY_REG_10_TX_DES)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_10_TX_DES)) & 0xffe0ffff)) ++#define SET_RG_TX_DES_LEN_UP(_VAL_) (REG32(ADR_PHY_REG_10_TX_DES)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_10_TX_DES)) & 0xe0ffffff)) ++#define SET_RG_TX_DES_SRVC_UP(_VAL_) (REG32(ADR_PHY_REG_11_TX_DES)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_11_TX_DES)) & 0xffffffe0)) ++#define SET_RG_TX_DES_L_LEN_LO(_VAL_) (REG32(ADR_PHY_REG_11_TX_DES)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_11_TX_DES)) & 0xffffe0ff)) ++#define SET_RG_TX_DES_L_LEN_UP(_VAL_) (REG32(ADR_PHY_REG_11_TX_DES)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_11_TX_DES)) & 0xffe0ffff)) ++#define SET_RG_TX_DES_TYPE(_VAL_) (REG32(ADR_PHY_REG_11_TX_DES)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_11_TX_DES)) & 0xe0ffffff)) ++#define SET_RG_TX_DES_L_LEN_UP_COMB(_VAL_) (REG32(ADR_PHY_REG_12_TX_DES)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_12_TX_DES)) & 0xfffffffe)) ++#define SET_RG_TX_DES_TYPE_COMB(_VAL_) (REG32(ADR_PHY_REG_12_TX_DES)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_REG_12_TX_DES)) & 0xffffffef)) ++#define SET_RG_TX_DES_RATE_COMB(_VAL_) (REG32(ADR_PHY_REG_12_TX_DES)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_12_TX_DES)) & 0xfffffeff)) ++#define SET_RG_TX_DES_MODE_COMB(_VAL_) (REG32(ADR_PHY_REG_12_TX_DES)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_REG_12_TX_DES)) & 0xffffefff)) ++#define SET_RG_TX_DES_PWRLVL(_VAL_) (REG32(ADR_PHY_REG_12_TX_DES)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_12_TX_DES)) & 0xffe0ffff)) ++#define SET_RG_TX_DES_SRVC_LO(_VAL_) (REG32(ADR_PHY_REG_12_TX_DES)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_12_TX_DES)) & 0xe0ffffff)) ++#define SET_RG_RX_DES_RATE(_VAL_) (REG32(ADR_PHY_REG_13_RX_DES)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_13_RX_DES)) & 0xffffffc0)) ++#define SET_RG_RX_DES_MODE(_VAL_) (REG32(ADR_PHY_REG_13_RX_DES)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_13_RX_DES)) & 0xffffc0ff)) ++#define SET_RG_RX_DES_LEN_LO(_VAL_) (REG32(ADR_PHY_REG_13_RX_DES)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_13_RX_DES)) & 0xffc0ffff)) ++#define SET_RG_RX_DES_LEN_UP(_VAL_) (REG32(ADR_PHY_REG_13_RX_DES)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_13_RX_DES)) & 0xc0ffffff)) ++#define SET_RG_RX_DES_SRVC_UP(_VAL_) (REG32(ADR_PHY_REG_14_RX_DES)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_14_RX_DES)) & 0xffffffc0)) ++#define SET_RG_RX_DES_L_LEN_LO(_VAL_) (REG32(ADR_PHY_REG_14_RX_DES)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_14_RX_DES)) & 0xffffc0ff)) ++#define SET_RG_RX_DES_L_LEN_UP(_VAL_) (REG32(ADR_PHY_REG_14_RX_DES)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_14_RX_DES)) & 0xffc0ffff)) ++#define SET_RG_RX_DES_TYPE(_VAL_) (REG32(ADR_PHY_REG_14_RX_DES)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_14_RX_DES)) & 0xc0ffffff)) ++#define SET_RG_RX_DES_L_LEN_UP_COMB(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xfffffffe)) ++#define SET_RG_RX_DES_TYPE_COMB(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 4) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xffffffef)) ++#define SET_RG_RX_DES_RATE_COMB(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xfffffeff)) ++#define SET_RG_RX_DES_MODE_COMB(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xffffefff)) ++#define SET_RG_RX_DES_SNR(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xfff0ffff)) ++#define SET_RG_RX_DES_RCPI(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 20) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xff0fffff)) ++#define SET_RG_RX_DES_SRVC_LO(_VAL_) (REG32(ADR_PHY_REG_15_RX_DES)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_15_RX_DES)) & 0xc0ffffff)) ++#define SET_RO_TX_DES_EXCP_RATE_CNT(_VAL_) (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0xffffff00)) ++#define SET_RO_TX_DES_EXCP_CH_BW_CNT(_VAL_) (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0xffff00ff)) ++#define SET_RO_TX_DES_EXCP_MODE_CNT(_VAL_) (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0xff00ffff)) ++#define SET_RG_TX_DES_EXCP_RATE_DEFAULT(_VAL_) (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0xf8ffffff)) ++#define SET_RG_TX_DES_EXCP_MODE_DEFAULT(_VAL_) (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x8fffffff)) ++#define SET_RG_TX_DES_EXCP_CLR(_VAL_) (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_16_TX_DES_EXCP)) & 0x7fffffff)) ++#define SET_RG_TX_DES_ACK_WIDTH(_VAL_) (REG32(ADR_PHY_REG_17_TX_DES_EXCP)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0xfffffffe)) ++#define SET_RG_TX_DES_ACK_PRD(_VAL_) (REG32(ADR_PHY_REG_17_TX_DES_EXCP)) = (((_VAL_) << 1) | ((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0xfffffff1)) ++#define SET_RG_RX_DES_SNR_GN(_VAL_) (REG32(ADR_PHY_REG_17_TX_DES_EXCP)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0xffc0ffff)) ++#define SET_RG_RX_DES_RCPI_GN(_VAL_) (REG32(ADR_PHY_REG_17_TX_DES_EXCP)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_17_TX_DES_EXCP)) & 0xc0ffffff)) ++#define SET_RG_TST_TBUS_SEL(_VAL_) (REG32(ADR_PHY_REG_18_RSSI_SNR)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0xfffffff0)) ++#define SET_RG_RSSI_OFFSET(_VAL_) (REG32(ADR_PHY_REG_18_RSSI_SNR)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0xff00ffff)) ++#define SET_RG_RSSI_INV(_VAL_) (REG32(ADR_PHY_REG_18_RSSI_SNR)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0xfeffffff)) ++#define SET_RG_TST_ADC_ON(_VAL_) (REG32(ADR_PHY_REG_18_RSSI_SNR)) = (((_VAL_) << 30) | ((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0xbfffffff)) ++#define SET_RG_TST_EXT_GAIN(_VAL_) (REG32(ADR_PHY_REG_18_RSSI_SNR)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_18_RSSI_SNR)) & 0x7fffffff)) ++#define SET_RG_DAC_Q_SET(_VAL_) (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0xfffffc00)) ++#define SET_RG_DAC_I_SET(_VAL_) (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (((_VAL_) << 12) | ((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0xffc00fff)) ++#define SET_RG_DAC_EN_MAN(_VAL_) (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0xefffffff)) ++#define SET_RG_IQC_FFT_EN(_VAL_) (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (((_VAL_) << 29) | ((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0xdfffffff)) ++#define SET_RG_DAC_MAN_Q_EN(_VAL_) (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (((_VAL_) << 30) | ((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0xbfffffff)) ++#define SET_RG_DAC_MAN_I_EN(_VAL_) (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_19_DAC_MANUAL)) & 0x7fffffff)) ++#define SET_RO_MRX_EN_CNT(_VAL_) (REG32(ADR_PHY_REG_20_MRX_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_20_MRX_CNT)) & 0xffff0000)) ++#define SET_RG_MRX_EN_CNT_RST_N(_VAL_) (REG32(ADR_PHY_REG_20_MRX_CNT)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_20_MRX_CNT)) & 0x7fffffff)) ++#define SET_RG_PA_RISE_TIME(_VAL_) (REG32(ADR_PHY_REG_21_TRX_RAMP)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0xffffff00)) ++#define SET_RG_RFTX_RISE_TIME(_VAL_) (REG32(ADR_PHY_REG_21_TRX_RAMP)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0xffff00ff)) ++#define SET_RG_DAC_RISE_TIME(_VAL_) (REG32(ADR_PHY_REG_21_TRX_RAMP)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0xff00ffff)) ++#define SET_RG_SW_RISE_TIME(_VAL_) (REG32(ADR_PHY_REG_21_TRX_RAMP)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_21_TRX_RAMP)) & 0x00ffffff)) ++#define SET_RG_PA_FALL_TIME(_VAL_) (REG32(ADR_PHY_REG_22_TRX_RAMP)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0xffffff00)) ++#define SET_RG_RFTX_FALL_TIME(_VAL_) (REG32(ADR_PHY_REG_22_TRX_RAMP)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0xffff00ff)) ++#define SET_RG_DAC_FALL_TIME(_VAL_) (REG32(ADR_PHY_REG_22_TRX_RAMP)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0xff00ffff)) ++#define SET_RG_SW_FALL_TIME(_VAL_) (REG32(ADR_PHY_REG_22_TRX_RAMP)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_22_TRX_RAMP)) & 0x00ffffff)) ++#define SET_RG_ANT_SW_0(_VAL_) (REG32(ADR_PHY_REG_23_ANT)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_23_ANT)) & 0xfffffff8)) ++#define SET_RG_ANT_SW_1(_VAL_) (REG32(ADR_PHY_REG_23_ANT)) = (((_VAL_) << 3) | ((REG32(ADR_PHY_REG_23_ANT)) & 0xffffffc7)) ++#define SET_RG_MTX_LEN_LOWER_TH_0(_VAL_) (REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) & 0xffffe000)) ++#define SET_RG_MTX_LEN_UPPER_TH_0(_VAL_) (REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) & 0xe000ffff)) ++#define SET_RG_MTX_LEN_CNT_EN_0(_VAL_) (REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) & 0x7fffffff)) ++#define SET_RG_MTX_LEN_LOWER_TH_1(_VAL_) (REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) & 0xffffe000)) ++#define SET_RG_MTX_LEN_UPPER_TH_1(_VAL_) (REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) & 0xe000ffff)) ++#define SET_RG_MTX_LEN_CNT_EN_1(_VAL_) (REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) & 0x7fffffff)) ++#define SET_RG_MRX_LEN_LOWER_TH_0(_VAL_) (REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) & 0xffffe000)) ++#define SET_RG_MRX_LEN_UPPER_TH_0(_VAL_) (REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) & 0xe000ffff)) ++#define SET_RG_MRX_LEN_CNT_EN_0(_VAL_) (REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) & 0x7fffffff)) ++#define SET_RG_MRX_LEN_LOWER_TH_1(_VAL_) (REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) & 0xffffe000)) ++#define SET_RG_MRX_LEN_UPPER_TH_1(_VAL_) (REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) & 0xe000ffff)) ++#define SET_RG_MRX_LEN_CNT_EN_1(_VAL_) (REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) & 0x7fffffff)) ++#define SET_RO_MTX_LEN_CNT_1(_VAL_) (REG32(ADR_PHY_READ_REG_04)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_04)) & 0xffff0000)) ++#define SET_RO_MTX_LEN_CNT_0(_VAL_) (REG32(ADR_PHY_READ_REG_04)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_04)) & 0x0000ffff)) ++#define SET_RO_MRX_LEN_CNT_1(_VAL_) (REG32(ADR_PHY_READ_REG_05)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_05)) & 0xffff0000)) ++#define SET_RO_MRX_LEN_CNT_0(_VAL_) (REG32(ADR_PHY_READ_REG_05)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_05)) & 0x0000ffff)) ++#define SET_RG_MODE_REG_IN_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_28_BIST)) & 0xffff0000)) ++#define SET_RG_PARALLEL_DR_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 20) | ((REG32(ADR_PHY_REG_28_BIST)) & 0xffefffff)) ++#define SET_RG_MBRUN_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_28_BIST)) & 0xfeffffff)) ++#define SET_RG_SHIFT_DR_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 28) | ((REG32(ADR_PHY_REG_28_BIST)) & 0xefffffff)) ++#define SET_RG_MODE_REG_SI_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 29) | ((REG32(ADR_PHY_REG_28_BIST)) & 0xdfffffff)) ++#define SET_RG_SIMULATION_MODE_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 30) | ((REG32(ADR_PHY_REG_28_BIST)) & 0xbfffffff)) ++#define SET_RG_DBIST_MODE_16(_VAL_) (REG32(ADR_PHY_REG_28_BIST)) = (((_VAL_) << 31) | ((REG32(ADR_PHY_REG_28_BIST)) & 0x7fffffff)) ++#define SET_RO_MODE_REG_OUT_16(_VAL_) (REG32(ADR_PHY_READ_REG_06_BIST)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_06_BIST)) & 0xffff0000)) ++#define SET_RO_MODE_REG_SO_16(_VAL_) (REG32(ADR_PHY_READ_REG_06_BIST)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_READ_REG_06_BIST)) & 0xfeffffff)) ++#define SET_RO_MONITOR_BUS_16(_VAL_) (REG32(ADR_PHY_READ_REG_07_BIST)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_07_BIST)) & 0xfff80000)) ++#define SET_RG_MRX_TYPE_1(_VAL_) (REG32(ADR_PHY_REG_29_MTRX_MAC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0xffffff00)) ++#define SET_RG_MRX_TYPE_0(_VAL_) (REG32(ADR_PHY_REG_29_MTRX_MAC)) = (((_VAL_) << 8) | ((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0xffff00ff)) ++#define SET_RG_MTX_TYPE_1(_VAL_) (REG32(ADR_PHY_REG_29_MTRX_MAC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0xff00ffff)) ++#define SET_RG_MTX_TYPE_0(_VAL_) (REG32(ADR_PHY_REG_29_MTRX_MAC)) = (((_VAL_) << 24) | ((REG32(ADR_PHY_REG_29_MTRX_MAC)) & 0x00ffffff)) ++#define SET_RO_MTX_TYPE_CNT_1(_VAL_) (REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) & 0xffff0000)) ++#define SET_RO_MTX_TYPE_CNT_0(_VAL_) (REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) & 0x0000ffff)) ++#define SET_RO_MRX_TYPE_CNT_1(_VAL_) (REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) & 0xffff0000)) ++#define SET_RO_MRX_TYPE_CNT_0(_VAL_) (REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) & 0x0000ffff)) ++#define SET_RG_HB_COEF0(_VAL_) (REG32(ADR_PHY_REG_30_TX_UP_FIL)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_30_TX_UP_FIL)) & 0xfffff000)) ++#define SET_RG_HB_COEF1(_VAL_) (REG32(ADR_PHY_REG_30_TX_UP_FIL)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_30_TX_UP_FIL)) & 0xf000ffff)) ++#define SET_RG_HB_COEF2(_VAL_) (REG32(ADR_PHY_REG_31_TX_UP_FIL)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_31_TX_UP_FIL)) & 0xfffff000)) ++#define SET_RG_HB_COEF3(_VAL_) (REG32(ADR_PHY_REG_31_TX_UP_FIL)) = (((_VAL_) << 16) | ((REG32(ADR_PHY_REG_31_TX_UP_FIL)) & 0xf000ffff)) ++#define SET_RG_HB_COEF4(_VAL_) (REG32(ADR_PHY_REG_32_TX_UP_FIL)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_REG_32_TX_UP_FIL)) & 0xfffff000)) ++#define SET_RO_TBUS_O(_VAL_) (REG32(ADR_PHY_READ_TBUS)) = (((_VAL_) << 0) | ((REG32(ADR_PHY_READ_TBUS)) & 0xfff00000)) ++#define SET_RG_LPF4_00(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_00)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_00)) & 0xffffe000)) ++#define SET_RG_LPF4_01(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_01)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_01)) & 0xffffe000)) ++#define SET_RG_LPF4_02(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_02)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_02)) & 0xffffe000)) ++#define SET_RG_LPF4_03(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_03)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_03)) & 0xffffe000)) ++#define SET_RG_LPF4_04(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_04)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_04)) & 0xffffe000)) ++#define SET_RG_LPF4_05(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_05)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_05)) & 0xffffe000)) ++#define SET_RG_LPF4_06(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_06)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_06)) & 0xffffe000)) ++#define SET_RG_LPF4_07(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_07)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_07)) & 0xffffe000)) ++#define SET_RG_LPF4_08(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_08)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_08)) & 0xffffe000)) ++#define SET_RG_LPF4_09(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_09)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_09)) & 0xffffe000)) ++#define SET_RG_LPF4_10(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_10)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_10)) & 0xffffe000)) ++#define SET_RG_LPF4_11(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_11)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_11)) & 0xffffe000)) ++#define SET_RG_LPF4_12(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_12)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_12)) & 0xffffe000)) ++#define SET_RG_LPF4_13(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_13)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_13)) & 0xffffe000)) ++#define SET_RG_LPF4_14(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_14)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_14)) & 0xffffe000)) ++#define SET_RG_LPF4_15(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_15)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_15)) & 0xffffe000)) ++#define SET_RG_LPF4_16(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_16)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_16)) & 0xffffe000)) ++#define SET_RG_LPF4_17(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_17)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_17)) & 0xffffe000)) ++#define SET_RG_LPF4_18(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_18)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_18)) & 0xffffe000)) ++#define SET_RG_LPF4_19(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_19)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_19)) & 0xffffe000)) ++#define SET_RG_LPF4_20(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_20)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_20)) & 0xffffe000)) ++#define SET_RG_LPF4_21(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_21)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_21)) & 0xffffe000)) ++#define SET_RG_LPF4_22(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_22)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_22)) & 0xffffe000)) ++#define SET_RG_LPF4_23(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_23)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_23)) & 0xffffe000)) ++#define SET_RG_LPF4_24(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_24)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_24)) & 0xffffe000)) ++#define SET_RG_LPF4_25(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_25)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_25)) & 0xffffe000)) ++#define SET_RG_LPF4_26(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_26)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_26)) & 0xffffe000)) ++#define SET_RG_LPF4_27(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_27)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_27)) & 0xffffe000)) ++#define SET_RG_LPF4_28(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_28)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_28)) & 0xffffe000)) ++#define SET_RG_LPF4_29(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_29)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_29)) & 0xffffe000)) ++#define SET_RG_LPF4_30(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_30)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_30)) & 0xffffe000)) ++#define SET_RG_LPF4_31(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_31)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_31)) & 0xffffe000)) ++#define SET_RG_LPF4_32(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_32)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_32)) & 0xffffe000)) ++#define SET_RG_LPF4_33(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_33)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_33)) & 0xffffe000)) ++#define SET_RG_LPF4_34(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_34)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_34)) & 0xffffe000)) ++#define SET_RG_LPF4_35(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_35)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_35)) & 0xffffe000)) ++#define SET_RG_LPF4_36(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_36)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_36)) & 0xffffe000)) ++#define SET_RG_LPF4_37(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_37)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_37)) & 0xffffe000)) ++#define SET_RG_LPF4_38(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_38)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_38)) & 0xffffe000)) ++#define SET_RG_LPF4_39(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_39)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_39)) & 0xffffe000)) ++#define SET_RG_LPF4_40(_VAL_) (REG32(ADR_TX_11B_FIL_COEF_40)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_FIL_COEF_40)) & 0xffffe000)) ++#define SET_RG_BP_SMB(_VAL_) (REG32(ADR_TX_11B_PLCP)) = (((_VAL_) << 13) | ((REG32(ADR_TX_11B_PLCP)) & 0xffffdfff)) ++#define SET_RG_EN_SRVC(_VAL_) (REG32(ADR_TX_11B_PLCP)) = (((_VAL_) << 14) | ((REG32(ADR_TX_11B_PLCP)) & 0xffffbfff)) ++#define SET_RG_DES_SPD(_VAL_) (REG32(ADR_TX_11B_PLCP)) = (((_VAL_) << 16) | ((REG32(ADR_TX_11B_PLCP)) & 0xfffcffff)) ++#define SET_RG_BB_11B_RISE_TIME(_VAL_) (REG32(ADR_TX_11B_RAMP)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_RAMP)) & 0xffffff00)) ++#define SET_RG_BB_11B_FALL_TIME(_VAL_) (REG32(ADR_TX_11B_RAMP)) = (((_VAL_) << 8) | ((REG32(ADR_TX_11B_RAMP)) & 0xffff00ff)) ++#define SET_RG_WR_TX_EN_CNT_RST_N(_VAL_) (REG32(ADR_TX_11B_EN_CNT_RST_N)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_EN_CNT_RST_N)) & 0xfffffffe)) ++#define SET_RO_TX_EN_CNT(_VAL_) (REG32(ADR_TX_11B_EN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_EN_CNT)) & 0xffff0000)) ++#define SET_RO_TX_CNT(_VAL_) (REG32(ADR_TX_11B_PKT_GEN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11B_PKT_GEN_CNT)) & 0x00000000)) ++#define SET_RG_POS_DES_11B_L_EXT(_VAL_) (REG32(ADR_RX_11B_DES_DLY)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_DES_DLY)) & 0xfffffff0)) ++#define SET_RG_PRE_DES_11B_DLY(_VAL_) (REG32(ADR_RX_11B_DES_DLY)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_DES_DLY)) & 0xffffff0f)) ++#define SET_RG_CNT_CCA_LMT(_VAL_) (REG32(ADR_RX_11B_CCA_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CCA_0)) & 0xfff0ffff)) ++#define SET_RG_BYPASS_DESCRAMBLER(_VAL_) (REG32(ADR_RX_11B_CCA_0)) = (((_VAL_) << 29) | ((REG32(ADR_RX_11B_CCA_0)) & 0xdfffffff)) ++#define SET_RG_BYPASS_AGC(_VAL_) (REG32(ADR_RX_11B_CCA_0)) = (((_VAL_) << 31) | ((REG32(ADR_RX_11B_CCA_0)) & 0x7fffffff)) ++#define SET_RG_CCA_BIT_CNT_LMT_RX(_VAL_) (REG32(ADR_RX_11B_CCA_1)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_CCA_1)) & 0xffffff0f)) ++#define SET_RG_CCA_SCALE_BF(_VAL_) (REG32(ADR_RX_11B_CCA_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CCA_1)) & 0xff80ffff)) ++#define SET_RG_PEAK_IDX_CNT_SEL(_VAL_) (REG32(ADR_RX_11B_CCA_1)) = (((_VAL_) << 28) | ((REG32(ADR_RX_11B_CCA_1)) & 0xcfffffff)) ++#define SET_RG_TR_KI_T2(_VAL_) (REG32(ADR_RX_11B_TR_KP_KI_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0xfffffff8)) ++#define SET_RG_TR_KP_T2(_VAL_) (REG32(ADR_RX_11B_TR_KP_KI_0)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0xffffff8f)) ++#define SET_RG_TR_KI_T1(_VAL_) (REG32(ADR_RX_11B_TR_KP_KI_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0xfffff8ff)) ++#define SET_RG_TR_KP_T1(_VAL_) (REG32(ADR_RX_11B_TR_KP_KI_0)) = (((_VAL_) << 12) | ((REG32(ADR_RX_11B_TR_KP_KI_0)) & 0xffff8fff)) ++#define SET_RG_CR_KI_T1(_VAL_) (REG32(ADR_RX_11B_TR_KP_KI_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_TR_KP_KI_1)) & 0xfff8ffff)) ++#define SET_RG_CR_KP_T1(_VAL_) (REG32(ADR_RX_11B_TR_KP_KI_1)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11B_TR_KP_KI_1)) & 0xff8fffff)) ++#define SET_RG_CHIP_CNT_SLICER(_VAL_) (REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0xffffffe0)) ++#define SET_RG_CE_T4_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0xffff00ff)) ++#define SET_RG_CE_T3_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0xff00ffff)) ++#define SET_RG_CE_T2_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) & 0x00ffffff)) ++#define SET_RG_CE_MU_T1(_VAL_) (REG32(ADR_RX_11B_CE_MU_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_CE_MU_0)) & 0xfffffff8)) ++#define SET_RG_CE_DLY_SEL(_VAL_) (REG32(ADR_RX_11B_CE_MU_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CE_MU_0)) & 0xffc0ffff)) ++#define SET_RG_CE_MU_T8(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xfffffff8)) ++#define SET_RG_CE_MU_T7(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xffffff8f)) ++#define SET_RG_CE_MU_T6(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xfffff8ff)) ++#define SET_RG_CE_MU_T5(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 12) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xffff8fff)) ++#define SET_RG_CE_MU_T4(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xfff8ffff)) ++#define SET_RG_CE_MU_T3(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xff8fffff)) ++#define SET_RG_CE_MU_T2(_VAL_) (REG32(ADR_RX_11B_CE_MU_1)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11B_CE_MU_1)) & 0xf8ffffff)) ++#define SET_RG_EQ_MU_FB_T2(_VAL_) (REG32(ADR_RX_11B_EQ_MU_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_EQ_MU_0)) & 0xfffffff0)) ++#define SET_RG_EQ_MU_FF_T2(_VAL_) (REG32(ADR_RX_11B_EQ_MU_0)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_EQ_MU_0)) & 0xffffff0f)) ++#define SET_RG_EQ_MU_FB_T1(_VAL_) (REG32(ADR_RX_11B_EQ_MU_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_EQ_MU_0)) & 0xfff0ffff)) ++#define SET_RG_EQ_MU_FF_T1(_VAL_) (REG32(ADR_RX_11B_EQ_MU_0)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11B_EQ_MU_0)) & 0xff0fffff)) ++#define SET_RG_EQ_MU_FB_T4(_VAL_) (REG32(ADR_RX_11B_EQ_MU_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_EQ_MU_1)) & 0xfffffff0)) ++#define SET_RG_EQ_MU_FF_T4(_VAL_) (REG32(ADR_RX_11B_EQ_MU_1)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_EQ_MU_1)) & 0xffffff0f)) ++#define SET_RG_EQ_MU_FB_T3(_VAL_) (REG32(ADR_RX_11B_EQ_MU_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_EQ_MU_1)) & 0xfff0ffff)) ++#define SET_RG_EQ_MU_FF_T3(_VAL_) (REG32(ADR_RX_11B_EQ_MU_1)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11B_EQ_MU_1)) & 0xff0fffff)) ++#define SET_RG_EQ_KI_T2(_VAL_) (REG32(ADR_RX_11B_EQ_CR_KP_KI)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0xfffff8ff)) ++#define SET_RG_EQ_KP_T2(_VAL_) (REG32(ADR_RX_11B_EQ_CR_KP_KI)) = (((_VAL_) << 12) | ((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0xffff8fff)) ++#define SET_RG_EQ_KI_T1(_VAL_) (REG32(ADR_RX_11B_EQ_CR_KP_KI)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0xfff8ffff)) ++#define SET_RG_EQ_KP_T1(_VAL_) (REG32(ADR_RX_11B_EQ_CR_KP_KI)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11B_EQ_CR_KP_KI)) & 0xff8fffff)) ++#define SET_RG_TR_LPF_RATE(_VAL_) (REG32(ADR_RX_11B_LPF_RATE)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_LPF_RATE)) & 0xffc00000)) ++#define SET_RG_CE_BIT_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0xffffff80)) ++#define SET_RG_CE_CH_MAIN_SET(_VAL_) (REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) = (((_VAL_) << 7) | ((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0xffffff7f)) ++#define SET_RG_TC_BIT_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0xffff80ff)) ++#define SET_RG_CR_BIT_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0xff80ffff)) ++#define SET_RG_TR_BIT_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) & 0x80ffffff)) ++#define SET_RG_EQ_MAIN_TAP_MAN(_VAL_) (REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) & 0xfffffffe)) ++#define SET_RG_EQ_MAIN_TAP_COEF(_VAL_) (REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) & 0xf800ffff)) ++#define SET_RG_PWRON_DLY_TH_11B(_VAL_) (REG32(ADR_RX_11B_SEARCH_CNT_TH)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_SEARCH_CNT_TH)) & 0xffffff00)) ++#define SET_RG_SFD_BIT_CNT_LMT(_VAL_) (REG32(ADR_RX_11B_SEARCH_CNT_TH)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_SEARCH_CNT_TH)) & 0xff00ffff)) ++#define SET_RG_CCA_PWR_TH_RX(_VAL_) (REG32(ADR_RX_11B_CCA_CONTROL)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_CCA_CONTROL)) & 0xffff8000)) ++#define SET_RG_CCA_PWR_CNT_TH(_VAL_) (REG32(ADR_RX_11B_CCA_CONTROL)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_CCA_CONTROL)) & 0xffe0ffff)) ++#define SET_B_FREQ_OS(_VAL_) (REG32(ADR_RX_11B_FREQUENCY_OFFSET)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_FREQUENCY_OFFSET)) & 0xfffff800)) ++#define SET_B_SNR(_VAL_) (REG32(ADR_RX_11B_SNR_RSSI)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_SNR_RSSI)) & 0xffffff80)) ++#define SET_B_RCPI(_VAL_) (REG32(ADR_RX_11B_SNR_RSSI)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_SNR_RSSI)) & 0xff80ffff)) ++#define SET_CRC_CNT(_VAL_) (REG32(ADR_RX_11B_SFD_CRC_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_SFD_CRC_CNT)) & 0xffff0000)) ++#define SET_SFD_CNT(_VAL_) (REG32(ADR_RX_11B_SFD_CRC_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_SFD_CRC_CNT)) & 0x0000ffff)) ++#define SET_B_PACKET_ERR_CNT(_VAL_) (REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) & 0xffff0000)) ++#define SET_PACKET_ERR(_VAL_) (REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) & 0xfffeffff)) ++#define SET_B_PACKET_CNT(_VAL_) (REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) & 0xffff0000)) ++#define SET_B_CCA_CNT(_VAL_) (REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) & 0x0000ffff)) ++#define SET_B_LENGTH_FIELD(_VAL_) (REG32(ADR_RX_11B_SFD_FILED_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_SFD_FILED_0)) & 0xffff0000)) ++#define SET_SFD_FIELD(_VAL_) (REG32(ADR_RX_11B_SFD_FILED_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_SFD_FILED_0)) & 0x0000ffff)) ++#define SET_SIGNAL_FIELD(_VAL_) (REG32(ADR_RX_11B_SFD_FIELD_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_SFD_FIELD_1)) & 0xffffff00)) ++#define SET_B_SERVICE_FIELD(_VAL_) (REG32(ADR_RX_11B_SFD_FIELD_1)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_SFD_FIELD_1)) & 0xffff00ff)) ++#define SET_CRC_CORRECT(_VAL_) (REG32(ADR_RX_11B_SFD_FIELD_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11B_SFD_FIELD_1)) & 0xfffeffff)) ++#define SET_DEBUG_SEL(_VAL_) (REG32(ADR_RX_11B_PKT_STAT_EN)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_PKT_STAT_EN)) & 0xfffffff0)) ++#define SET_RG_PACKET_STAT_EN_11B(_VAL_) (REG32(ADR_RX_11B_PKT_STAT_EN)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11B_PKT_STAT_EN)) & 0xffefffff)) ++#define SET_RG_BIT_REVERSE(_VAL_) (REG32(ADR_RX_11B_PKT_STAT_EN)) = (((_VAL_) << 21) | ((REG32(ADR_RX_11B_PKT_STAT_EN)) & 0xffdfffff)) ++#define SET_RX_PHY_11B_SOFT_RST_N(_VAL_) (REG32(ADR_RX_11B_SOFT_RST)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11B_SOFT_RST)) & 0xfffffffe)) ++#define SET_RG_CE_BYPASS_TAP(_VAL_) (REG32(ADR_RX_11B_SOFT_RST)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11B_SOFT_RST)) & 0xffffff0f)) ++#define SET_RG_EQ_BYPASS_FBW_TAP(_VAL_) (REG32(ADR_RX_11B_SOFT_RST)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11B_SOFT_RST)) & 0xfffff0ff)) ++#define SET_RG_BB_11GN_RISE_TIME(_VAL_) (REG32(ADR_TX_11GN_RAMP)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11GN_RAMP)) & 0xffffff00)) ++#define SET_RG_BB_11GN_FALL_TIME(_VAL_) (REG32(ADR_TX_11GN_RAMP)) = (((_VAL_) << 8) | ((REG32(ADR_TX_11GN_RAMP)) & 0xffff00ff)) ++#define SET_RG_HTCARR52_FFT_SCALE(_VAL_) (REG32(ADR_TX_11GN_PLCP)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11GN_PLCP)) & 0xfffffc00)) ++#define SET_RG_HTCARR56_FFT_SCALE(_VAL_) (REG32(ADR_TX_11GN_PLCP)) = (((_VAL_) << 12) | ((REG32(ADR_TX_11GN_PLCP)) & 0xffc00fff)) ++#define SET_RG_PACKET_STAT_EN(_VAL_) (REG32(ADR_TX_11GN_PLCP)) = (((_VAL_) << 23) | ((REG32(ADR_TX_11GN_PLCP)) & 0xff7fffff)) ++#define SET_RG_SMB_DEF(_VAL_) (REG32(ADR_TX_11GN_PLCP)) = (((_VAL_) << 24) | ((REG32(ADR_TX_11GN_PLCP)) & 0x80ffffff)) ++#define SET_RG_CONTINUOUS_DATA_11GN(_VAL_) (REG32(ADR_TX_11GN_PLCP)) = (((_VAL_) << 31) | ((REG32(ADR_TX_11GN_PLCP)) & 0x7fffffff)) ++#define SET_RO_TX_CNT_R(_VAL_) (REG32(ADR_TX_11GN_PKT_GEN_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11GN_PKT_GEN_CNT)) & 0x00000000)) ++#define SET_RO_PACKET_ERR_CNT(_VAL_) (REG32(ADR_TX_11GN_PLCP_CRC_ERR_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_TX_11GN_PLCP_CRC_ERR_CNT)) & 0xffff0000)) ++#define SET_RG_POS_DES_11GN_L_EXT(_VAL_) (REG32(ADR_RX_11GN_DES_DLY)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_DES_DLY)) & 0xfffffff0)) ++#define SET_RG_PRE_DES_11GN_DLY(_VAL_) (REG32(ADR_RX_11GN_DES_DLY)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_DES_DLY)) & 0xffffff0f)) ++#define SET_RG_TR_LPF_KI_G_T1(_VAL_) (REG32(ADR_RX_11GN_TR_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_TR_0)) & 0xfffffff0)) ++#define SET_RG_TR_LPF_KP_G_T1(_VAL_) (REG32(ADR_RX_11GN_TR_0)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_TR_0)) & 0xffffff0f)) ++#define SET_RG_TR_CNT_T1(_VAL_) (REG32(ADR_RX_11GN_TR_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_TR_0)) & 0xffff00ff)) ++#define SET_RG_TR_LPF_KI_G_T0(_VAL_) (REG32(ADR_RX_11GN_TR_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_TR_0)) & 0xfff0ffff)) ++#define SET_RG_TR_LPF_KP_G_T0(_VAL_) (REG32(ADR_RX_11GN_TR_0)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11GN_TR_0)) & 0xff0fffff)) ++#define SET_RG_TR_CNT_T0(_VAL_) (REG32(ADR_RX_11GN_TR_0)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_TR_0)) & 0x00ffffff)) ++#define SET_RG_TR_LPF_KI_G_T2(_VAL_) (REG32(ADR_RX_11GN_TR_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_TR_1)) & 0xfffffff0)) ++#define SET_RG_TR_LPF_KP_G_T2(_VAL_) (REG32(ADR_RX_11GN_TR_1)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_TR_1)) & 0xffffff0f)) ++#define SET_RG_TR_CNT_T2(_VAL_) (REG32(ADR_RX_11GN_TR_1)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_TR_1)) & 0xffff00ff)) ++#define SET_RG_TR_LPF_KI_G(_VAL_) (REG32(ADR_RX_11GN_TR_2)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_TR_2)) & 0xfffffff0)) ++#define SET_RG_TR_LPF_KP_G(_VAL_) (REG32(ADR_RX_11GN_TR_2)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_TR_2)) & 0xffffff0f)) ++#define SET_RG_TR_LPF_RATE_G(_VAL_) (REG32(ADR_RX_11GN_TR_2)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_TR_2)) & 0xc00000ff)) ++#define SET_RG_CR_LPF_KI_G(_VAL_) (REG32(ADR_RX_11GN_CCA_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_CCA_0)) & 0xfffffff8)) ++#define SET_RG_SYM_BOUND_CNT(_VAL_) (REG32(ADR_RX_11GN_CCA_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_CCA_0)) & 0xffff80ff)) ++#define SET_RG_XSCOR32_RATIO(_VAL_) (REG32(ADR_RX_11GN_CCA_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CCA_0)) & 0xff80ffff)) ++#define SET_RG_ATCOR64_CNT_LMT(_VAL_) (REG32(ADR_RX_11GN_CCA_0)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CCA_0)) & 0x80ffffff)) ++#define SET_RG_ATCOR16_CNT_LMT2(_VAL_) (REG32(ADR_RX_11GN_CCA_1)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_CCA_1)) & 0xffff80ff)) ++#define SET_RG_ATCOR16_CNT_LMT1(_VAL_) (REG32(ADR_RX_11GN_CCA_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CCA_1)) & 0xff80ffff)) ++#define SET_RG_ATCOR16_RATIO_SB(_VAL_) (REG32(ADR_RX_11GN_CCA_1)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CCA_1)) & 0x80ffffff)) ++#define SET_RG_XSCOR64_CNT_LMT2(_VAL_) (REG32(ADR_RX_11GN_CCA_2)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CCA_2)) & 0xff80ffff)) ++#define SET_RG_XSCOR64_CNT_LMT1(_VAL_) (REG32(ADR_RX_11GN_CCA_2)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CCA_2)) & 0x80ffffff)) ++#define SET_RG_RX_FFT_SCALE(_VAL_) (REG32(ADR_RX_11GN_CCA_FFT_SCALE)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_CCA_FFT_SCALE)) & 0xfffffc00)) ++#define SET_RG_VITERBI_AB_SWAP(_VAL_) (REG32(ADR_RX_11GN_CCA_FFT_SCALE)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CCA_FFT_SCALE)) & 0xfffeffff)) ++#define SET_RG_ATCOR16_CNT_TH(_VAL_) (REG32(ADR_RX_11GN_CCA_FFT_SCALE)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CCA_FFT_SCALE)) & 0xf0ffffff)) ++#define SET_RG_NORMSQUARE_LOW_SNR_7(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0xffffff00)) ++#define SET_RG_NORMSQUARE_LOW_SNR_6(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0xffff00ff)) ++#define SET_RG_NORMSQUARE_LOW_SNR_5(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0xff00ffff)) ++#define SET_RG_NORMSQUARE_LOW_SNR_4(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_0)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_0)) & 0x00ffffff)) ++#define SET_RG_NORMSQUARE_LOW_SNR_8(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_1)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_1)) & 0x00ffffff)) ++#define SET_RG_NORMSQUARE_SNR_3(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_2)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0xffffff00)) ++#define SET_RG_NORMSQUARE_SNR_2(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_2)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0xffff00ff)) ++#define SET_RG_NORMSQUARE_SNR_1(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_2)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0xff00ffff)) ++#define SET_RG_NORMSQUARE_SNR_0(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_2)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_2)) & 0x00ffffff)) ++#define SET_RG_NORMSQUARE_SNR_7(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_3)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0xffffff00)) ++#define SET_RG_NORMSQUARE_SNR_6(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_3)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0xffff00ff)) ++#define SET_RG_NORMSQUARE_SNR_5(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_3)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0xff00ffff)) ++#define SET_RG_NORMSQUARE_SNR_4(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_3)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_3)) & 0x00ffffff)) ++#define SET_RG_NORMSQUARE_SNR_8(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_4)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_4)) & 0x00ffffff)) ++#define SET_RG_SNR_TH_64QAM(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_5)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_5)) & 0xffffff80)) ++#define SET_RG_SNR_TH_16QAM(_VAL_) (REG32(ADR_RX_11GN_SOFT_DEMAP_5)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SOFT_DEMAP_5)) & 0xffff80ff)) ++#define SET_RG_ATCOR16_CNT_PLUS_LMT2(_VAL_) (REG32(ADR_RX_11GN_SYM_BOUND_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SYM_BOUND_0)) & 0xffffff80)) ++#define SET_RG_ATCOR16_CNT_PLUS_LMT1(_VAL_) (REG32(ADR_RX_11GN_SYM_BOUND_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SYM_BOUND_0)) & 0xffff80ff)) ++#define SET_RG_SYM_BOUND_METHOD(_VAL_) (REG32(ADR_RX_11GN_SYM_BOUND_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SYM_BOUND_0)) & 0xfffcffff)) ++#define SET_RG_PWRON_DLY_TH_11GN(_VAL_) (REG32(ADR_RX_11GN_SYM_BOUND_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SYM_BOUND_1)) & 0xffffff00)) ++#define SET_RG_SB_START_CNT(_VAL_) (REG32(ADR_RX_11GN_SYM_BOUND_1)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SYM_BOUND_1)) & 0xffff80ff)) ++#define SET_RG_POW16_CNT_TH(_VAL_) (REG32(ADR_RX_11GN_CCA_PWR)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_CCA_PWR)) & 0xffffff0f)) ++#define SET_RG_POW16_SHORT_CNT_LMT(_VAL_) (REG32(ADR_RX_11GN_CCA_PWR)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_CCA_PWR)) & 0xfffff8ff)) ++#define SET_RG_POW16_TH_L(_VAL_) (REG32(ADR_RX_11GN_CCA_PWR)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CCA_PWR)) & 0x80ffffff)) ++#define SET_RG_XSCOR16_SHORT_CNT_LMT(_VAL_) (REG32(ADR_RX_11GN_CCA_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_CCA_CNT)) & 0xfffffff8)) ++#define SET_RG_XSCOR16_RATIO(_VAL_) (REG32(ADR_RX_11GN_CCA_CNT)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_CCA_CNT)) & 0xffff80ff)) ++#define SET_RG_ATCOR16_SHORT_CNT_LMT(_VAL_) (REG32(ADR_RX_11GN_CCA_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CCA_CNT)) & 0xfff8ffff)) ++#define SET_RG_ATCOR16_RATIO_CCD(_VAL_) (REG32(ADR_RX_11GN_CCA_CNT)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CCA_CNT)) & 0x80ffffff)) ++#define SET_RG_ATCOR64_ACC_LMT(_VAL_) (REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) & 0xffffff80)) ++#define SET_RG_ATCOR16_SHORT_CNT_LMT2(_VAL_) (REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) & 0xfff8ffff)) ++#define SET_RG_VITERBI_TB_BITS(_VAL_) (REG32(ADR_RX_11GN_VTB_TB)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_VTB_TB)) & 0x00ffffff)) ++#define SET_RG_CR_CNT_UPDATE(_VAL_) (REG32(ADR_RX_11GN_ERR_UPDATE)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_ERR_UPDATE)) & 0xffffff00)) ++#define SET_RG_TR_CNT_UPDATE(_VAL_) (REG32(ADR_RX_11GN_ERR_UPDATE)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_ERR_UPDATE)) & 0xff00ffff)) ++#define SET_RG_BYPASS_CPE_MA(_VAL_) (REG32(ADR_RX_11GN_SHORT_GI)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_SHORT_GI)) & 0xffffffef)) ++#define SET_RG_PILOT_BNDRY_SHIFT(_VAL_) (REG32(ADR_RX_11GN_SHORT_GI)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_SHORT_GI)) & 0xfffff8ff)) ++#define SET_RG_EQ_SHORT_GI_SHIFT(_VAL_) (REG32(ADR_RX_11GN_SHORT_GI)) = (((_VAL_) << 12) | ((REG32(ADR_RX_11GN_SHORT_GI)) & 0xffff8fff)) ++#define SET_RG_FFT_WDW_SHORT_SHIFT(_VAL_) (REG32(ADR_RX_11GN_SHORT_GI)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SHORT_GI)) & 0xfff8ffff)) ++#define SET_RG_CHSMTH_COEF(_VAL_) (REG32(ADR_RX_11GN_CHANNEL_UPDATE)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0xfffcffff)) ++#define SET_RG_CHSMTH_EN(_VAL_) (REG32(ADR_RX_11GN_CHANNEL_UPDATE)) = (((_VAL_) << 18) | ((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0xfffbffff)) ++#define SET_RG_CHEST_DD_FACTOR(_VAL_) (REG32(ADR_RX_11GN_CHANNEL_UPDATE)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0xf8ffffff)) ++#define SET_RG_CH_UPDATE(_VAL_) (REG32(ADR_RX_11GN_CHANNEL_UPDATE)) = (((_VAL_) << 31) | ((REG32(ADR_RX_11GN_CHANNEL_UPDATE)) & 0x7fffffff)) ++#define SET_RG_FMT_DET_MM_TH(_VAL_) (REG32(ADR_RX_11GN_PKT_FORMAT_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_PKT_FORMAT_0)) & 0xffffff00)) ++#define SET_RG_FMT_DET_GF_TH(_VAL_) (REG32(ADR_RX_11GN_PKT_FORMAT_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_PKT_FORMAT_0)) & 0xffff00ff)) ++#define SET_RG_DO_NOT_CHECK_L_RATE(_VAL_) (REG32(ADR_RX_11GN_PKT_FORMAT_0)) = (((_VAL_) << 25) | ((REG32(ADR_RX_11GN_PKT_FORMAT_0)) & 0xfdffffff)) ++#define SET_RG_FMT_DET_LENGTH_TH(_VAL_) (REG32(ADR_RX_11GN_PKT_FORMAT_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_PKT_FORMAT_1)) & 0xffff0000)) ++#define SET_RG_L_LENGTH_MAX(_VAL_) (REG32(ADR_RX_11GN_PKT_FORMAT_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_PKT_FORMAT_1)) & 0x0000ffff)) ++#define SET_RG_TX_TIME_EXT(_VAL_) (REG32(ADR_RX_11GN_TX_TIME)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_TX_TIME)) & 0xffffff00)) ++#define SET_RG_MAC_DES_SPACE(_VAL_) (REG32(ADR_RX_11GN_TX_TIME)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11GN_TX_TIME)) & 0xff0fffff)) ++#define SET_RG_TR_LPF_STBC_GF_KI_G(_VAL_) (REG32(ADR_RX_11GN_STBC_TR_KP_KI)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0xfffffff0)) ++#define SET_RG_TR_LPF_STBC_GF_KP_G(_VAL_) (REG32(ADR_RX_11GN_STBC_TR_KP_KI)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0xffffff0f)) ++#define SET_RG_TR_LPF_STBC_MF_KI_G(_VAL_) (REG32(ADR_RX_11GN_STBC_TR_KP_KI)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0xfffff0ff)) ++#define SET_RG_TR_LPF_STBC_MF_KP_G(_VAL_) (REG32(ADR_RX_11GN_STBC_TR_KP_KI)) = (((_VAL_) << 12) | ((REG32(ADR_RX_11GN_STBC_TR_KP_KI)) & 0xffff0fff)) ++#define SET_RG_MODE_REG_IN_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_BIST_0)) & 0xfffe0000)) ++#define SET_RG_PARALLEL_DR_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11GN_BIST_0)) & 0xffefffff)) ++#define SET_RG_MBRUN_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_BIST_0)) & 0xfeffffff)) ++#define SET_RG_SHIFT_DR_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 28) | ((REG32(ADR_RX_11GN_BIST_0)) & 0xefffffff)) ++#define SET_RG_MODE_REG_SI_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 29) | ((REG32(ADR_RX_11GN_BIST_0)) & 0xdfffffff)) ++#define SET_RG_SIMULATION_MODE_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 30) | ((REG32(ADR_RX_11GN_BIST_0)) & 0xbfffffff)) ++#define SET_RG_DBIST_MODE_80(_VAL_) (REG32(ADR_RX_11GN_BIST_0)) = (((_VAL_) << 31) | ((REG32(ADR_RX_11GN_BIST_0)) & 0x7fffffff)) ++#define SET_RG_MODE_REG_IN_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_BIST_1)) & 0xffff0000)) ++#define SET_RG_PARALLEL_DR_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11GN_BIST_1)) & 0xffefffff)) ++#define SET_RG_MBRUN_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_BIST_1)) & 0xfeffffff)) ++#define SET_RG_SHIFT_DR_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 28) | ((REG32(ADR_RX_11GN_BIST_1)) & 0xefffffff)) ++#define SET_RG_MODE_REG_SI_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 29) | ((REG32(ADR_RX_11GN_BIST_1)) & 0xdfffffff)) ++#define SET_RG_SIMULATION_MODE_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 30) | ((REG32(ADR_RX_11GN_BIST_1)) & 0xbfffffff)) ++#define SET_RG_DBIST_MODE_64(_VAL_) (REG32(ADR_RX_11GN_BIST_1)) = (((_VAL_) << 31) | ((REG32(ADR_RX_11GN_BIST_1)) & 0x7fffffff)) ++#define SET_RO_MODE_REG_OUT_80(_VAL_) (REG32(ADR_RX_11GN_BIST_2)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_BIST_2)) & 0xfffe0000)) ++#define SET_RO_MODE_REG_SO_80(_VAL_) (REG32(ADR_RX_11GN_BIST_2)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_BIST_2)) & 0xfeffffff)) ++#define SET_RO_MONITOR_BUS_80(_VAL_) (REG32(ADR_RX_11GN_BIST_3)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_BIST_3)) & 0xffc00000)) ++#define SET_RO_MODE_REG_OUT_64(_VAL_) (REG32(ADR_RX_11GN_BIST_4)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_BIST_4)) & 0xffff0000)) ++#define SET_RO_MODE_REG_SO_64(_VAL_) (REG32(ADR_RX_11GN_BIST_4)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_BIST_4)) & 0xfeffffff)) ++#define SET_RO_MONITOR_BUS_64(_VAL_) (REG32(ADR_RX_11GN_BIST_5)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_BIST_5)) & 0xfff80000)) ++#define SET_RO_SPECTRUM_DATA(_VAL_) (REG32(ADR_RX_11GN_SPECTRUM_ANALYZER)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SPECTRUM_ANALYZER)) & 0x00000000)) ++#define SET_GN_SNR(_VAL_) (REG32(ADR_RX_11GN_READ_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_READ_0)) & 0xffffff80)) ++#define SET_GN_NOISE_PWR(_VAL_) (REG32(ADR_RX_11GN_READ_0)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_READ_0)) & 0xffff80ff)) ++#define SET_GN_RCPI(_VAL_) (REG32(ADR_RX_11GN_READ_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_READ_0)) & 0xff80ffff)) ++#define SET_GN_SIGNAL_PWR(_VAL_) (REG32(ADR_RX_11GN_READ_0)) = (((_VAL_) << 24) | ((REG32(ADR_RX_11GN_READ_0)) & 0x80ffffff)) ++#define SET_RO_FREQ_OS_LTS(_VAL_) (REG32(ADR_RX_11GN_FREQ_OFFSET)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_FREQ_OFFSET)) & 0xffff8000)) ++#define SET_CSTATE(_VAL_) (REG32(ADR_RX_11GN_FREQ_OFFSET)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_FREQ_OFFSET)) & 0xfff0ffff)) ++#define SET_SIGNAL_FIELD0(_VAL_) (REG32(ADR_RX_11GN_SIGNAL_FIELD_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SIGNAL_FIELD_0)) & 0xff000000)) ++#define SET_SIGNAL_FIELD1(_VAL_) (REG32(ADR_RX_11GN_SIGNAL_FIELD_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SIGNAL_FIELD_1)) & 0xff000000)) ++#define SET_GN_PACKET_ERR_CNT(_VAL_) (REG32(ADR_RX_11GN_PKT_ERR_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_PKT_ERR_CNT)) & 0xffff0000)) ++#define SET_GN_PACKET_CNT(_VAL_) (REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) & 0xffff0000)) ++#define SET_GN_CCA_CNT(_VAL_) (REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) & 0x0000ffff)) ++#define SET_GN_LENGTH_FIELD(_VAL_) (REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) & 0xffff0000)) ++#define SET_GN_SERVICE_FIELD(_VAL_) (REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) & 0x0000ffff)) ++#define SET_RO_HT_MCS_40M(_VAL_) (REG32(ADR_RX_11GN_RATE)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_RATE)) & 0xffffff80)) ++#define SET_RO_L_RATE_40M(_VAL_) (REG32(ADR_RX_11GN_RATE)) = (((_VAL_) << 8) | ((REG32(ADR_RX_11GN_RATE)) & 0xffffc0ff)) ++#define SET_RG_DAGC_CNT_TH(_VAL_) (REG32(ADR_RX_11GN_STAT_EN)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_STAT_EN)) & 0xfffffffc)) ++#define SET_RG_PACKET_STAT_EN_11GN(_VAL_) (REG32(ADR_RX_11GN_STAT_EN)) = (((_VAL_) << 20) | ((REG32(ADR_RX_11GN_STAT_EN)) & 0xffefffff)) ++#define SET_RX_PHY_11GN_SOFT_RST_N(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 0) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffffffe)) ++#define SET_RG_RIFS_EN(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 1) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffffffd)) ++#define SET_RG_STBC_EN(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 2) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffffffb)) ++#define SET_RG_COR_SEL(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 3) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffffff7)) ++#define SET_RG_INI_PHASE(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 4) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xffffffcf)) ++#define SET_RG_HT_LTF_SEL_EQ(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 6) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xffffffbf)) ++#define SET_RG_HT_LTF_SEL_PILOT(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 7) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xffffff7f)) ++#define SET_RG_CCA_PWR_SEL(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 9) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffffdff)) ++#define SET_RG_CCA_XSCOR_PWR_SEL(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 10) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffffbff)) ++#define SET_RG_CCA_XSCOR_AVGPWR_SEL(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 11) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffff7ff)) ++#define SET_RG_DEBUG_SEL(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 12) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xffff0fff)) ++#define SET_RG_POST_CLK_EN(_VAL_) (REG32(ADR_RX_11GN_SOFT_RST)) = (((_VAL_) << 16) | ((REG32(ADR_RX_11GN_SOFT_RST)) & 0xfffeffff)) ++#define SET_IQCAL_RF_TX_EN(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 0) | ((REG32(ADR_RF_CONTROL_0)) & 0xfffffffe)) ++#define SET_IQCAL_RF_TX_PA_EN(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 1) | ((REG32(ADR_RF_CONTROL_0)) & 0xfffffffd)) ++#define SET_IQCAL_RF_TX_DAC_EN(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 2) | ((REG32(ADR_RF_CONTROL_0)) & 0xfffffffb)) ++#define SET_IQCAL_RF_RX_AGC(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 3) | ((REG32(ADR_RF_CONTROL_0)) & 0xfffffff7)) ++#define SET_IQCAL_RF_PGAG(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 8) | ((REG32(ADR_RF_CONTROL_0)) & 0xfffff0ff)) ++#define SET_IQCAL_RF_RFG(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 12) | ((REG32(ADR_RF_CONTROL_0)) & 0xffffcfff)) ++#define SET_RG_TONEGEN_FREQ(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 16) | ((REG32(ADR_RF_CONTROL_0)) & 0xff80ffff)) ++#define SET_RG_TONEGEN_EN(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 23) | ((REG32(ADR_RF_CONTROL_0)) & 0xff7fffff)) ++#define SET_RG_TONEGEN_INIT_PH(_VAL_) (REG32(ADR_RF_CONTROL_0)) = (((_VAL_) << 24) | ((REG32(ADR_RF_CONTROL_0)) & 0x80ffffff)) ++#define SET_RG_TONEGEN2_FREQ(_VAL_) (REG32(ADR_RF_CONTROL_1)) = (((_VAL_) << 0) | ((REG32(ADR_RF_CONTROL_1)) & 0xffffff80)) ++#define SET_RG_TONEGEN2_EN(_VAL_) (REG32(ADR_RF_CONTROL_1)) = (((_VAL_) << 7) | ((REG32(ADR_RF_CONTROL_1)) & 0xffffff7f)) ++#define SET_RG_TONEGEN2_SCALE(_VAL_) (REG32(ADR_RF_CONTROL_1)) = (((_VAL_) << 8) | ((REG32(ADR_RF_CONTROL_1)) & 0xffff00ff)) ++#define SET_RG_TXIQ_CLP_THD_I(_VAL_) (REG32(ADR_TX_IQ_CONTROL_0)) = (((_VAL_) << 0) | ((REG32(ADR_TX_IQ_CONTROL_0)) & 0xfffffc00)) ++#define SET_RG_TXIQ_CLP_THD_Q(_VAL_) (REG32(ADR_TX_IQ_CONTROL_0)) = (((_VAL_) << 16) | ((REG32(ADR_TX_IQ_CONTROL_0)) & 0xfc00ffff)) ++#define SET_RG_TX_I_SCALE(_VAL_) (REG32(ADR_TX_IQ_CONTROL_1)) = (((_VAL_) << 0) | ((REG32(ADR_TX_IQ_CONTROL_1)) & 0xffffff00)) ++#define SET_RG_TX_Q_SCALE(_VAL_) (REG32(ADR_TX_IQ_CONTROL_1)) = (((_VAL_) << 8) | ((REG32(ADR_TX_IQ_CONTROL_1)) & 0xffff00ff)) ++#define SET_RG_TX_IQ_SWP(_VAL_) (REG32(ADR_TX_IQ_CONTROL_1)) = (((_VAL_) << 16) | ((REG32(ADR_TX_IQ_CONTROL_1)) & 0xfffeffff)) ++#define SET_RG_TX_SGN_OUT(_VAL_) (REG32(ADR_TX_IQ_CONTROL_1)) = (((_VAL_) << 17) | ((REG32(ADR_TX_IQ_CONTROL_1)) & 0xfffdffff)) ++#define SET_RG_TXIQ_EMU_IDX(_VAL_) (REG32(ADR_TX_IQ_CONTROL_1)) = (((_VAL_) << 18) | ((REG32(ADR_TX_IQ_CONTROL_1)) & 0xffc3ffff)) ++#define SET_RG_TX_IQ_SRC(_VAL_) (REG32(ADR_TX_IQ_CONTROL_1)) = (((_VAL_) << 24) | ((REG32(ADR_TX_IQ_CONTROL_1)) & 0xfcffffff)) ++#define SET_RG_TX_I_DC(_VAL_) (REG32(ADR_TX_IQ_CONTROL_2)) = (((_VAL_) << 0) | ((REG32(ADR_TX_IQ_CONTROL_2)) & 0xfffffc00)) ++#define SET_RG_TX_Q_DC(_VAL_) (REG32(ADR_TX_IQ_CONTROL_2)) = (((_VAL_) << 16) | ((REG32(ADR_TX_IQ_CONTROL_2)) & 0xfc00ffff)) ++#define SET_RG_TX_IQ_THETA(_VAL_) (REG32(ADR_TX_COMPENSATION_CONTROL)) = (((_VAL_) << 0) | ((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0xffffffe0)) ++#define SET_RG_TX_IQ_ALPHA(_VAL_) (REG32(ADR_TX_COMPENSATION_CONTROL)) = (((_VAL_) << 8) | ((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0xffffe0ff)) ++#define SET_RG_TXIQ_NOSHRINK(_VAL_) (REG32(ADR_TX_COMPENSATION_CONTROL)) = (((_VAL_) << 13) | ((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0xffffdfff)) ++#define SET_RG_TX_I_OFFSET(_VAL_) (REG32(ADR_TX_COMPENSATION_CONTROL)) = (((_VAL_) << 16) | ((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0xff00ffff)) ++#define SET_RG_TX_Q_OFFSET(_VAL_) (REG32(ADR_TX_COMPENSATION_CONTROL)) = (((_VAL_) << 24) | ((REG32(ADR_TX_COMPENSATION_CONTROL)) & 0x00ffffff)) ++#define SET_RG_RX_IQ_THETA(_VAL_) (REG32(ADR_RX_COMPENSATION_CONTROL)) = (((_VAL_) << 0) | ((REG32(ADR_RX_COMPENSATION_CONTROL)) & 0xffffffe0)) ++#define SET_RG_RX_IQ_ALPHA(_VAL_) (REG32(ADR_RX_COMPENSATION_CONTROL)) = (((_VAL_) << 8) | ((REG32(ADR_RX_COMPENSATION_CONTROL)) & 0xffffe0ff)) ++#define SET_RG_RXIQ_NOSHRINK(_VAL_) (REG32(ADR_RX_COMPENSATION_CONTROL)) = (((_VAL_) << 13) | ((REG32(ADR_RX_COMPENSATION_CONTROL)) & 0xffffdfff)) ++#define SET_RG_MA_DPTH(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 0) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfffffff0)) ++#define SET_RG_INTG_PH(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 4) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfffffc0f)) ++#define SET_RG_INTG_PRD(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 10) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xffffe3ff)) ++#define SET_RG_INTG_MU(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 13) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xffff9fff)) ++#define SET_RG_IQCAL_SPRM_SELQ(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 16) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfffeffff)) ++#define SET_RG_IQCAL_SPRM_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 17) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfffdffff)) ++#define SET_RG_IQCAL_SPRM_FREQ(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 18) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xff03ffff)) ++#define SET_RG_IQCAL_IQCOL_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 24) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfeffffff)) ++#define SET_RG_IQCAL_ALPHA_ESTM_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 25) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfdffffff)) ++#define SET_RG_IQCAL_DC_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 26) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xfbffffff)) ++#define SET_RG_PHEST_STBY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 27) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xf7ffffff)) ++#define SET_RG_PHEST_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 28) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xefffffff)) ++#define SET_RG_GP_DIV_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 29) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xdfffffff)) ++#define SET_RG_DPD_GAIN_EST_EN(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (((_VAL_) << 30) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) & 0xbfffffff)) ++#define SET_RG_IQCAL_MULT_OP0(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) & 0xfffffc00)) ++#define SET_RG_IQCAL_MULT_OP1(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) & 0xfc00ffff)) ++#define SET_RO_IQCAL_O(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 0) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xfff00000)) ++#define SET_RO_IQCAL_SPRM_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 20) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xffefffff)) ++#define SET_RO_IQCAL_IQCOL_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 21) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xffdfffff)) ++#define SET_RO_IQCAL_ALPHA_ESTM_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 22) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xffbfffff)) ++#define SET_RO_IQCAL_DC_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 23) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xff7fffff)) ++#define SET_RO_IQCAL_MULT_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 24) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xfeffffff)) ++#define SET_RO_FFT_ENRG_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 25) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xfdffffff)) ++#define SET_RO_PHEST_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 26) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xfbffffff)) ++#define SET_RO_GP_DIV_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 27) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xf7ffffff)) ++#define SET_RO_GAIN_EST_RDY(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (((_VAL_) << 28) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) & 0xefffffff)) ++#define SET_RO_AMP_O(_VAL_) (REG32(ADR_RX_OBSERVATION_CIRCUIT_3)) = (((_VAL_) << 0) | ((REG32(ADR_RX_OBSERVATION_CIRCUIT_3)) & 0xfffffe00)) ++#define SET_RG_RX_I_SCALE(_VAL_) (REG32(ADR_RF_IQ_CONTROL_0)) = (((_VAL_) << 0) | ((REG32(ADR_RF_IQ_CONTROL_0)) & 0xffffff00)) ++#define SET_RG_RX_Q_SCALE(_VAL_) (REG32(ADR_RF_IQ_CONTROL_0)) = (((_VAL_) << 8) | ((REG32(ADR_RF_IQ_CONTROL_0)) & 0xffff00ff)) ++#define SET_RG_RX_I_OFFSET(_VAL_) (REG32(ADR_RF_IQ_CONTROL_0)) = (((_VAL_) << 16) | ((REG32(ADR_RF_IQ_CONTROL_0)) & 0xff00ffff)) ++#define SET_RG_RX_Q_OFFSET(_VAL_) (REG32(ADR_RF_IQ_CONTROL_0)) = (((_VAL_) << 24) | ((REG32(ADR_RF_IQ_CONTROL_0)) & 0x00ffffff)) ++#define SET_RG_RX_IQ_SWP(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 0) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xfffffffe)) ++#define SET_RG_RX_SGN_IN(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 1) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xfffffffd)) ++#define SET_RG_RX_IQ_SRC(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 2) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xfffffff3)) ++#define SET_RG_ACI_GAIN(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 4) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xfffff00f)) ++#define SET_RG_FFT_EN(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 12) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xffffefff)) ++#define SET_RG_FFT_MOD(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 13) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xffffdfff)) ++#define SET_RG_FFT_SCALE(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 14) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xff003fff)) ++#define SET_RG_FFT_ENRG_FREQ(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 24) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xc0ffffff)) ++#define SET_RG_FPGA_80M_PH_UP(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 30) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0xbfffffff)) ++#define SET_RG_FPGA_80M_PH_STP(_VAL_) (REG32(ADR_RF_IQ_CONTROL_1)) = (((_VAL_) << 31) | ((REG32(ADR_RF_IQ_CONTROL_1)) & 0x7fffffff)) ++#define SET_RG_ADC2LA_SEL(_VAL_) (REG32(ADR_RF_IQ_CONTROL_2)) = (((_VAL_) << 0) | ((REG32(ADR_RF_IQ_CONTROL_2)) & 0xfffffffe)) ++#define SET_RG_ADC2LA_CLKPH(_VAL_) (REG32(ADR_RF_IQ_CONTROL_2)) = (((_VAL_) << 1) | ((REG32(ADR_RF_IQ_CONTROL_2)) & 0xfffffffd)) ++#define SET_RG_RXIQ_EMU_IDX(_VAL_) (REG32(ADR_RF_IQ_CONTROL_3)) = (((_VAL_) << 0) | ((REG32(ADR_RF_IQ_CONTROL_3)) & 0xfffffff0)) ++#define SET_RG_IQCAL_BP_ACI(_VAL_) (REG32(ADR_RF_IQ_CONTROL_3)) = (((_VAL_) << 4) | ((REG32(ADR_RF_IQ_CONTROL_3)) & 0xffffffef)) ++#define SET_RG_DPD_AM_EN(_VAL_) (REG32(ADR_DPD_CONTROL)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_CONTROL)) & 0xfffffffe)) ++#define SET_RG_DPD_PM_EN(_VAL_) (REG32(ADR_DPD_CONTROL)) = (((_VAL_) << 1) | ((REG32(ADR_DPD_CONTROL)) & 0xfffffffd)) ++#define SET_RG_DPD_PM_AMSEL(_VAL_) (REG32(ADR_DPD_CONTROL)) = (((_VAL_) << 2) | ((REG32(ADR_DPD_CONTROL)) & 0xfffffffb)) ++#define SET_RG_DPD_020_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_0)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_0)) & 0xfffffc00)) ++#define SET_RG_DPD_040_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_0)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_0)) & 0xfc00ffff)) ++#define SET_RG_DPD_060_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_1)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_1)) & 0xfffffc00)) ++#define SET_RG_DPD_080_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_1)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_1)) & 0xfc00ffff)) ++#define SET_RG_DPD_0A0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_2)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_2)) & 0xfffffc00)) ++#define SET_RG_DPD_0C0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_2)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_2)) & 0xfc00ffff)) ++#define SET_RG_DPD_0D0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_3)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_3)) & 0xfffffc00)) ++#define SET_RG_DPD_0E0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_3)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_3)) & 0xfc00ffff)) ++#define SET_RG_DPD_0F0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_4)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_4)) & 0xfffffc00)) ++#define SET_RG_DPD_100_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_4)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_4)) & 0xfc00ffff)) ++#define SET_RG_DPD_110_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_5)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_5)) & 0xfffffc00)) ++#define SET_RG_DPD_120_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_5)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_5)) & 0xfc00ffff)) ++#define SET_RG_DPD_130_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_6)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_6)) & 0xfffffc00)) ++#define SET_RG_DPD_140_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_6)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_6)) & 0xfc00ffff)) ++#define SET_RG_DPD_150_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_7)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_7)) & 0xfffffc00)) ++#define SET_RG_DPD_160_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_7)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_7)) & 0xfc00ffff)) ++#define SET_RG_DPD_170_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_8)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_8)) & 0xfffffc00)) ++#define SET_RG_DPD_180_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_8)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_8)) & 0xfc00ffff)) ++#define SET_RG_DPD_190_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_9)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_9)) & 0xfffffc00)) ++#define SET_RG_DPD_1A0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_9)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_9)) & 0xfc00ffff)) ++#define SET_RG_DPD_1B0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_A)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_A)) & 0xfffffc00)) ++#define SET_RG_DPD_1C0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_A)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_A)) & 0xfc00ffff)) ++#define SET_RG_DPD_1D0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_B)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_B)) & 0xfffffc00)) ++#define SET_RG_DPD_1E0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_B)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_B)) & 0xfc00ffff)) ++#define SET_RG_DPD_1F0_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_C)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_TABLE_C)) & 0xfffffc00)) ++#define SET_RG_DPD_200_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_TABLE_C)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_TABLE_C)) & 0xfc00ffff)) ++#define SET_RG_DPD_020_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_0)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_0)) & 0xffffe000)) ++#define SET_RG_DPD_040_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_0)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_0)) & 0xe000ffff)) ++#define SET_RG_DPD_060_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_1)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_1)) & 0xffffe000)) ++#define SET_RG_DPD_080_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_1)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_1)) & 0xe000ffff)) ++#define SET_RG_DPD_0A0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_2)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_2)) & 0xffffe000)) ++#define SET_RG_DPD_0C0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_2)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_2)) & 0xe000ffff)) ++#define SET_RG_DPD_0D0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_3)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_3)) & 0xffffe000)) ++#define SET_RG_DPD_0E0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_3)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_3)) & 0xe000ffff)) ++#define SET_RG_DPD_0F0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_4)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_4)) & 0xffffe000)) ++#define SET_RG_DPD_100_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_4)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_4)) & 0xe000ffff)) ++#define SET_RG_DPD_110_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_5)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_5)) & 0xffffe000)) ++#define SET_RG_DPD_120_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_5)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_5)) & 0xe000ffff)) ++#define SET_RG_DPD_130_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_6)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_6)) & 0xffffe000)) ++#define SET_RG_DPD_140_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_6)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_6)) & 0xe000ffff)) ++#define SET_RG_DPD_150_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_7)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_7)) & 0xffffe000)) ++#define SET_RG_DPD_160_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_7)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_7)) & 0xe000ffff)) ++#define SET_RG_DPD_170_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_8)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_8)) & 0xffffe000)) ++#define SET_RG_DPD_180_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_8)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_8)) & 0xe000ffff)) ++#define SET_RG_DPD_190_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_9)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_9)) & 0xffffe000)) ++#define SET_RG_DPD_1A0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_9)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_9)) & 0xe000ffff)) ++#define SET_RG_DPD_1B0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_A)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_A)) & 0xffffe000)) ++#define SET_RG_DPD_1C0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_A)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_A)) & 0xe000ffff)) ++#define SET_RG_DPD_1D0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_B)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_B)) & 0xffffe000)) ++#define SET_RG_DPD_1E0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_B)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_B)) & 0xe000ffff)) ++#define SET_RG_DPD_1F0_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_C)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_PH_TABLE_C)) & 0xffffe000)) ++#define SET_RG_DPD_200_PH(_VAL_) (REG32(ADR_DPD_PH_TABLE_C)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_PH_TABLE_C)) & 0xe000ffff)) ++#define SET_RG_DPD_GAIN_EST_Y0(_VAL_) (REG32(ADR_DPD_GAIN_ESTIMATION_0)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_ESTIMATION_0)) & 0xfffffe00)) ++#define SET_RG_DPD_GAIN_EST_Y1(_VAL_) (REG32(ADR_DPD_GAIN_ESTIMATION_0)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_ESTIMATION_0)) & 0xfe00ffff)) ++#define SET_RG_DPD_LOOP_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_ESTIMATION_1)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_ESTIMATION_1)) & 0xfffffc00)) ++#define SET_RG_DPD_GAIN_EST_X0(_VAL_) (REG32(ADR_DPD_GAIN_ESTIMATION_2)) = (((_VAL_) << 0) | ((REG32(ADR_DPD_GAIN_ESTIMATION_2)) & 0xfffffe00)) ++#define SET_RO_DPD_GAIN(_VAL_) (REG32(ADR_DPD_GAIN_ESTIMATION_2)) = (((_VAL_) << 16) | ((REG32(ADR_DPD_GAIN_ESTIMATION_2)) & 0xfc00ffff)) ++#define SET_TX_SCALE_11B(_VAL_) (REG32(ADR_TX_GAIN_FACTOR)) = (((_VAL_) << 0) | ((REG32(ADR_TX_GAIN_FACTOR)) & 0xffffff00)) ++#define SET_TX_SCALE_11B_P0D5(_VAL_) (REG32(ADR_TX_GAIN_FACTOR)) = (((_VAL_) << 8) | ((REG32(ADR_TX_GAIN_FACTOR)) & 0xffff00ff)) ++#define SET_TX_SCALE_11G(_VAL_) (REG32(ADR_TX_GAIN_FACTOR)) = (((_VAL_) << 16) | ((REG32(ADR_TX_GAIN_FACTOR)) & 0xff00ffff)) ++#define SET_TX_SCALE_11G_P0D5(_VAL_) (REG32(ADR_TX_GAIN_FACTOR)) = (((_VAL_) << 24) | ((REG32(ADR_TX_GAIN_FACTOR)) & 0x00ffffff)) ++#define SET_RG_EN_MANUAL(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffffffe)) ++#define SET_RG_TX_EN(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffffffd)) ++#define SET_RG_TX_PA_EN(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffffffb)) ++#define SET_RG_TX_DAC_EN(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffffff7)) ++#define SET_RG_RX_AGC(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffffffef)) ++#define SET_RG_RX_GAIN_MANUAL(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffffffdf)) ++#define SET_RG_RFG(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffffff3f)) ++#define SET_RG_PGAG(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffff0ff)) ++#define SET_RG_MODE(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffffcfff)) ++#define SET_RG_EN_TX_TRSW(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffffbfff)) ++#define SET_RG_EN_SX(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffff7fff)) ++#define SET_RG_EN_RX_LNA(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffeffff)) ++#define SET_RG_EN_RX_MIXER(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 17) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffdffff)) ++#define SET_RG_EN_RX_DIV2(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfffbffff)) ++#define SET_RG_EN_RX_LOBUF(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 19) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfff7ffff)) ++#define SET_RG_EN_RX_TZ(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffefffff)) ++#define SET_RG_EN_RX_FILTER(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffdfffff)) ++#define SET_RG_EN_RX_HPF(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xffbfffff)) ++#define SET_RG_EN_RX_RSSI(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 23) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xff7fffff)) ++#define SET_RG_EN_ADC(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 24) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfeffffff)) ++#define SET_RG_EN_TX_MOD(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 25) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfdffffff)) ++#define SET_RG_EN_TX_DIV2(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 26) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xfbffffff)) ++#define SET_RG_EN_TX_DIV2_BUF(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 27) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xf7ffffff)) ++#define SET_RG_EN_TX_LOBF(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 28) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xefffffff)) ++#define SET_RG_EN_RX_LOBF(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 29) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xdfffffff)) ++#define SET_RG_SEL_DPLL_CLK(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 30) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0xbfffffff)) ++#define SET_RG_EN_CLK_960MBY13_UART(_VAL_) (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (((_VAL_) << 31) | ((REG32(ADR_HARD_WIRE_PIN_REGISTER)) & 0x7fffffff)) ++#define SET_RG_EN_TX_DPD(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffffe)) ++#define SET_RG_EN_TX_TSSI(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffffd)) ++#define SET_RG_EN_RX_IQCAL(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffffb)) ++#define SET_RG_EN_TX_DAC_CAL(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffff7)) ++#define SET_RG_EN_TX_SELF_MIXER(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xffffffef)) ++#define SET_RG_EN_TX_DAC_OUT(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xffffffdf)) ++#define SET_RG_EN_LDO_RX_FE(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xffffffbf)) ++#define SET_RG_EN_LDO_ABB(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 7) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xffffff7f)) ++#define SET_RG_EN_LDO_AFE(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffeff)) ++#define SET_RG_EN_SX_CHPLDO(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffdff)) ++#define SET_RG_EN_SX_LOBFLDO(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffffbff)) ++#define SET_RG_EN_IREF_RX(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffff7ff)) ++#define SET_RG_EN_TX_DAC_VOUT(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 13) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xffffdfff)) ++#define SET_RG_EN_SX_LCK_BIN(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xffffbfff)) ++#define SET_RG_RTC_CAL_MODE(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffeffff)) ++#define SET_RG_EN_IQPAD_IOSW(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 17) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffdffff)) ++#define SET_RG_EN_TESTPAD_IOSW(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfffbffff)) ++#define SET_RG_EN_TRXBF_BYPASS(_VAL_) (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (((_VAL_) << 19) | ((REG32(ADR_MANUAL_ENABLE_REGISTER)) & 0xfff7ffff)) ++#define SET_RG_LDO_LEVEL_RX_FE(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_LDO_REGISTER)) & 0xfffffff8)) ++#define SET_RG_LDO_LEVEL_ABB(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_LDO_REGISTER)) & 0xffffffc7)) ++#define SET_RG_LDO_LEVEL_AFE(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_LDO_REGISTER)) & 0xfffffe3f)) ++#define SET_RG_SX_LDO_CHP_LEVEL(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_LDO_REGISTER)) & 0xfffff1ff)) ++#define SET_RG_SX_LDO_LOBF_LEVEL(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_LDO_REGISTER)) & 0xffff8fff)) ++#define SET_RG_SX_LDO_XOSC_LEVEL(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_LDO_REGISTER)) & 0xfffc7fff)) ++#define SET_RG_DP_LDO_LEVEL(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_LDO_REGISTER)) & 0xffe3ffff)) ++#define SET_RG_SX_LDO_VCO_LEVEL(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_LDO_REGISTER)) & 0xff1fffff)) ++#define SET_RG_TX_LDO_TX_LEVEL(_VAL_) (REG32(ADR_LDO_REGISTER)) = (((_VAL_) << 24) | ((REG32(ADR_LDO_REGISTER)) & 0xf8ffffff)) ++#define SET_RG_EN_RX_PADSW(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffffffe)) ++#define SET_RG_EN_RX_TESTNODE(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 1) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffffffd)) ++#define SET_RG_RX_ABBCFIX(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 2) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffffffb)) ++#define SET_RG_RX_ABBCTUNE(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 3) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffffe07)) ++#define SET_RG_RX_ABBOUT_TRI_STATE(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 9) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffffdff)) ++#define SET_RG_RX_ABB_N_MODE(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 10) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffffbff)) ++#define SET_RG_RX_EN_LOOPA(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 11) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffff7ff)) ++#define SET_RG_RX_FILTERI1ST(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 12) | ((REG32(ADR_ABB_REGISTER_1)) & 0xffffcfff)) ++#define SET_RG_RX_FILTERI2ND(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 14) | ((REG32(ADR_ABB_REGISTER_1)) & 0xffff3fff)) ++#define SET_RG_RX_FILTERI3RD(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 16) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfffcffff)) ++#define SET_RG_RX_FILTERI_COURSE(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 18) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfff3ffff)) ++#define SET_RG_RX_FILTERVCM(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 20) | ((REG32(ADR_ABB_REGISTER_1)) & 0xffcfffff)) ++#define SET_RG_RX_HPF3M(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 22) | ((REG32(ADR_ABB_REGISTER_1)) & 0xffbfffff)) ++#define SET_RG_RX_HPF300K(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 23) | ((REG32(ADR_ABB_REGISTER_1)) & 0xff7fffff)) ++#define SET_RG_RX_HPFI(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 24) | ((REG32(ADR_ABB_REGISTER_1)) & 0xfcffffff)) ++#define SET_RG_RX_HPF_FINALCORNER(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 26) | ((REG32(ADR_ABB_REGISTER_1)) & 0xf3ffffff)) ++#define SET_RG_RX_HPF_SETTLE1_C(_VAL_) (REG32(ADR_ABB_REGISTER_1)) = (((_VAL_) << 28) | ((REG32(ADR_ABB_REGISTER_1)) & 0xcfffffff)) ++#define SET_RG_RX_HPF_SETTLE1_R(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 0) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfffffffc)) ++#define SET_RG_RX_HPF_SETTLE2_C(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 2) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfffffff3)) ++#define SET_RG_RX_HPF_SETTLE2_R(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 4) | ((REG32(ADR_ABB_REGISTER_2)) & 0xffffffcf)) ++#define SET_RG_RX_HPF_VCMCON2(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 6) | ((REG32(ADR_ABB_REGISTER_2)) & 0xffffff3f)) ++#define SET_RG_RX_HPF_VCMCON(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 8) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfffffcff)) ++#define SET_RG_RX_OUTVCM(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 10) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfffff3ff)) ++#define SET_RG_RX_TZI(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 12) | ((REG32(ADR_ABB_REGISTER_2)) & 0xffffcfff)) ++#define SET_RG_RX_TZ_OUT_TRISTATE(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 14) | ((REG32(ADR_ABB_REGISTER_2)) & 0xffffbfff)) ++#define SET_RG_RX_TZ_VCM(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 15) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfffe7fff)) ++#define SET_RG_EN_RX_RSSI_TESTNODE(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 17) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfff1ffff)) ++#define SET_RG_RX_ADCRSSI_CLKSEL(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 20) | ((REG32(ADR_ABB_REGISTER_2)) & 0xffefffff)) ++#define SET_RG_RX_ADCRSSI_VCM(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 21) | ((REG32(ADR_ABB_REGISTER_2)) & 0xff9fffff)) ++#define SET_RG_RX_REC_LPFCORNER(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 23) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfe7fffff)) ++#define SET_RG_RSSI_CLOCK_GATING(_VAL_) (REG32(ADR_ABB_REGISTER_2)) = (((_VAL_) << 25) | ((REG32(ADR_ABB_REGISTER_2)) & 0xfdffffff)) ++#define SET_RG_TXPGA_CAPSW(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_TX_FE_REGISTER)) & 0xfffffffc)) ++#define SET_RG_TXPGA_MAIN(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_TX_FE_REGISTER)) & 0xffffff03)) ++#define SET_RG_TXPGA_STEER(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_TX_FE_REGISTER)) & 0xffffc0ff)) ++#define SET_RG_TXMOD_GMCELL(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_TX_FE_REGISTER)) & 0xffff3fff)) ++#define SET_RG_TXLPF_GMCELL(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_TX_FE_REGISTER)) & 0xfffcffff)) ++#define SET_RG_PACELL_EN(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_TX_FE_REGISTER)) & 0xffe3ffff)) ++#define SET_RG_PABIAS_CTRL(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_TX_FE_REGISTER)) & 0xfe1fffff)) ++#define SET_RG_TX_DIV_VSET(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 26) | ((REG32(ADR_TX_FE_REGISTER)) & 0xf3ffffff)) ++#define SET_RG_TX_LOBUF_VSET(_VAL_) (REG32(ADR_TX_FE_REGISTER)) = (((_VAL_) << 28) | ((REG32(ADR_TX_FE_REGISTER)) & 0xcfffffff)) ++#define SET_RG_RX_SQDC(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xfffffff8)) ++#define SET_RG_RX_DIV2_CORE(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 3) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xffffffe7)) ++#define SET_RG_RX_LOBUF(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 5) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xffffff9f)) ++#define SET_RG_TX_DPDGM_BIAS(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 7) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xfffff87f)) ++#define SET_RG_TX_DPD_DIV(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 11) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xffff87ff)) ++#define SET_RG_TX_TSSI_BIAS(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 15) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xfffc7fff)) ++#define SET_RG_TX_TSSI_DIV(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 18) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xffe3ffff)) ++#define SET_RG_TX_TSSI_TESTMODE(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 21) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xffdfffff)) ++#define SET_RG_TX_TSSI_TEST(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 22) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xff3fffff)) ++#define SET_RG_PACASCODE_CTRL(_VAL_) (REG32(ADR_RX_FE_REGISTER_1)) = (((_VAL_) << 24) | ((REG32(ADR_RX_FE_REGISTER_1)) & 0xf8ffffff)) ++#define SET_RG_RX_HG_LNA_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xfffffffc)) ++#define SET_RG_RX_HG_LNAHGN_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 2) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xffffffc3)) ++#define SET_RG_RX_HG_LNAHGP_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 6) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xfffffc3f)) ++#define SET_RG_RX_HG_LNALG_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 10) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xffffc3ff)) ++#define SET_RG_RX_HG_TZ_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 14) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xffff3fff)) ++#define SET_RG_RX_HG_TZ_CAP(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (((_VAL_) << 16) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) & 0xfff8ffff)) ++#define SET_RG_RX_MG_LNA_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xfffffffc)) ++#define SET_RG_RX_MG_LNAHGN_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 2) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xffffffc3)) ++#define SET_RG_RX_MG_LNAHGP_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 6) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xfffffc3f)) ++#define SET_RG_RX_MG_LNALG_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 10) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xffffc3ff)) ++#define SET_RG_RX_MG_TZ_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 14) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xffff3fff)) ++#define SET_RG_RX_MG_TZ_CAP(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (((_VAL_) << 16) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) & 0xfff8ffff)) ++#define SET_RG_RX_LG_LNA_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xfffffffc)) ++#define SET_RG_RX_LG_LNAHGN_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 2) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xffffffc3)) ++#define SET_RG_RX_LG_LNAHGP_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 6) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xfffffc3f)) ++#define SET_RG_RX_LG_LNALG_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 10) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xffffc3ff)) ++#define SET_RG_RX_LG_TZ_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 14) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xffff3fff)) ++#define SET_RG_RX_LG_TZ_CAP(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (((_VAL_) << 16) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) & 0xfff8ffff)) ++#define SET_RG_RX_ULG_LNA_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 0) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xfffffffc)) ++#define SET_RG_RX_ULG_LNAHGN_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 2) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xffffffc3)) ++#define SET_RG_RX_ULG_LNAHGP_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 6) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xfffffc3f)) ++#define SET_RG_RX_ULG_LNALG_BIAS(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 10) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xffffc3ff)) ++#define SET_RG_RX_ULG_TZ_GC(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 14) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xffff3fff)) ++#define SET_RG_RX_ULG_TZ_CAP(_VAL_) (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (((_VAL_) << 16) | ((REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) & 0xfff8ffff)) ++#define SET_RG_HPF1_FAST_SET_X(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xfffffffe)) ++#define SET_RG_HPF1_FAST_SET_Y(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xfffffffd)) ++#define SET_RG_HPF1_FAST_SET_Z(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xfffffffb)) ++#define SET_RG_HPF_T1A(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xffffffe7)) ++#define SET_RG_HPF_T1B(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xffffff9f)) ++#define SET_RG_HPF_T1C(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 7) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xfffffe7f)) ++#define SET_RG_RX_LNA_TRI_SEL(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xfffff9ff)) ++#define SET_RG_RX_LNA_SETTLE(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xffffe7ff)) ++#define SET_RG_TXGAIN_PHYCTRL(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 13) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xffffdfff)) ++#define SET_RG_TX_GAIN(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xffc03fff)) ++#define SET_RG_TXGAIN_MANUAL(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xffbfffff)) ++#define SET_RG_TX_GAIN_OFFSET(_VAL_) (REG32(ADR_RX_TX_FSM_REGISTER)) = (((_VAL_) << 23) | ((REG32(ADR_RX_TX_FSM_REGISTER)) & 0xf87fffff)) ++#define SET_RG_ADC_CLKSEL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffffffe)) ++#define SET_RG_ADC_DIBIAS(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffffff9)) ++#define SET_RG_ADC_DIVR(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffffff7)) ++#define SET_RG_ADC_DVCMI(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xffffffcf)) ++#define SET_RG_ADC_SAMSEL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffffc3f)) ++#define SET_RG_ADC_STNBY(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffffbff)) ++#define SET_RG_ADC_TESTMODE(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffff7ff)) ++#define SET_RG_ADC_TSEL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xffff0fff)) ++#define SET_RG_ADC_VRSEL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfffcffff)) ++#define SET_RG_DICMP(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfff3ffff)) ++#define SET_RG_DIOP(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xffcfffff)) ++#define SET_RG_SARADC_VRSEL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xff3fffff)) ++#define SET_RG_EN_SAR_TEST(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 24) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfcffffff)) ++#define SET_RG_SARADC_THERMAL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 26) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xfbffffff)) ++#define SET_RG_SARADC_TSSI(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 27) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xf7ffffff)) ++#define SET_RG_CLK_SAR_SEL(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 28) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xcfffffff)) ++#define SET_RG_EN_SARADC(_VAL_) (REG32(ADR_RX_ADC_REGISTER)) = (((_VAL_) << 30) | ((REG32(ADR_RX_ADC_REGISTER)) & 0xbfffffff)) ++#define SET_RG_DACI1ST(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xfffffffc)) ++#define SET_RG_TX_DACLPF_ICOURSE(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xfffffff3)) ++#define SET_RG_TX_DACLPF_IFINE(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffffffcf)) ++#define SET_RG_TX_DACLPF_VCM(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffffff3f)) ++#define SET_RG_TX_DAC_CKEDGE_SEL(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xfffffeff)) ++#define SET_RG_TX_DAC_IBIAS(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xfffff9ff)) ++#define SET_RG_TX_DAC_OS(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffffc7ff)) ++#define SET_RG_TX_DAC_RCAL(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffff3fff)) ++#define SET_RG_TX_DAC_TSEL(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xfff0ffff)) ++#define SET_RG_TX_EN_VOLTAGE_IN(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 20) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffefffff)) ++#define SET_RG_TXLPF_BYPASS(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffdfffff)) ++#define SET_RG_TXLPF_BOOSTI(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xffbfffff)) ++#define SET_RG_TX_DAC_IOFFSET(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 23) | ((REG32(ADR_TX_DAC_REGISTER)) & 0xf87fffff)) ++#define SET_RG_TX_DAC_QOFFSET(_VAL_) (REG32(ADR_TX_DAC_REGISTER)) = (((_VAL_) << 27) | ((REG32(ADR_TX_DAC_REGISTER)) & 0x87ffffff)) ++#define SET_RG_EN_SX_R3(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffffffe)) ++#define SET_RG_EN_SX_CH(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffffffd)) ++#define SET_RG_EN_SX_CHP(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffffffb)) ++#define SET_RG_EN_SX_DIVCK(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffffff7)) ++#define SET_RG_EN_SX_VCOBF(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 4) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffffffef)) ++#define SET_RG_EN_SX_VCO(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffffffdf)) ++#define SET_RG_EN_SX_MOD(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 6) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffffffbf)) ++#define SET_RG_EN_SX_DITHER(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 8) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffffeff)) ++#define SET_RG_EN_SX_VT_MON(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 11) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffff7ff)) ++#define SET_RG_EN_SX_VT_MON_DG(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffffefff)) ++#define SET_RG_EN_SX_DIV(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 13) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffffdfff)) ++#define SET_RG_EN_SX_LPF(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffffbfff)) ++#define SET_RG_EN_DPL_MOD(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xffff7fff)) ++#define SET_RG_DPL_MOD_ORDER(_VAL_) (REG32(ADR_SX_ENABLE_REGISTER)) = (((_VAL_) << 16) | ((REG32(ADR_SX_ENABLE_REGISTER)) & 0xfffcffff)) ++#define SET_RG_SX_RFCTRL_F(_VAL_) (REG32(ADR_SYN_REGISTER_1)) = (((_VAL_) << 0) | ((REG32(ADR_SYN_REGISTER_1)) & 0xff000000)) ++#define SET_RG_SX_SEL_CP(_VAL_) (REG32(ADR_SYN_REGISTER_1)) = (((_VAL_) << 24) | ((REG32(ADR_SYN_REGISTER_1)) & 0xf0ffffff)) ++#define SET_RG_SX_SEL_CS(_VAL_) (REG32(ADR_SYN_REGISTER_1)) = (((_VAL_) << 28) | ((REG32(ADR_SYN_REGISTER_1)) & 0x0fffffff)) ++#define SET_RG_SX_RFCTRL_CH(_VAL_) (REG32(ADR_SYN_REGISTER_2)) = (((_VAL_) << 0) | ((REG32(ADR_SYN_REGISTER_2)) & 0xfffff800)) ++#define SET_RG_SX_SEL_C3(_VAL_) (REG32(ADR_SYN_REGISTER_2)) = (((_VAL_) << 11) | ((REG32(ADR_SYN_REGISTER_2)) & 0xffff87ff)) ++#define SET_RG_SX_SEL_RS(_VAL_) (REG32(ADR_SYN_REGISTER_2)) = (((_VAL_) << 15) | ((REG32(ADR_SYN_REGISTER_2)) & 0xfff07fff)) ++#define SET_RG_SX_SEL_R3(_VAL_) (REG32(ADR_SYN_REGISTER_2)) = (((_VAL_) << 20) | ((REG32(ADR_SYN_REGISTER_2)) & 0xfe0fffff)) ++#define SET_RG_SX_SEL_ICHP(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 0) | ((REG32(ADR_SYN_PFD_CHP)) & 0xffffffe0)) ++#define SET_RG_SX_SEL_PCHP(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 5) | ((REG32(ADR_SYN_PFD_CHP)) & 0xfffffc1f)) ++#define SET_RG_SX_SEL_CHP_REGOP(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 10) | ((REG32(ADR_SYN_PFD_CHP)) & 0xffffc3ff)) ++#define SET_RG_SX_SEL_CHP_UNIOP(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 14) | ((REG32(ADR_SYN_PFD_CHP)) & 0xfffc3fff)) ++#define SET_RG_SX_CHP_IOST_POL(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 18) | ((REG32(ADR_SYN_PFD_CHP)) & 0xfffbffff)) ++#define SET_RG_SX_CHP_IOST(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 19) | ((REG32(ADR_SYN_PFD_CHP)) & 0xffc7ffff)) ++#define SET_RG_SX_PFDSEL(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 22) | ((REG32(ADR_SYN_PFD_CHP)) & 0xffbfffff)) ++#define SET_RG_SX_PFD_SET(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 23) | ((REG32(ADR_SYN_PFD_CHP)) & 0xff7fffff)) ++#define SET_RG_SX_PFD_SET1(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 24) | ((REG32(ADR_SYN_PFD_CHP)) & 0xfeffffff)) ++#define SET_RG_SX_PFD_SET2(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 25) | ((REG32(ADR_SYN_PFD_CHP)) & 0xfdffffff)) ++#define SET_RG_SX_VBNCAS_SEL(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 26) | ((REG32(ADR_SYN_PFD_CHP)) & 0xfbffffff)) ++#define SET_RG_SX_PFD_RST_H(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 27) | ((REG32(ADR_SYN_PFD_CHP)) & 0xf7ffffff)) ++#define SET_RG_SX_PFD_TRUP(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 28) | ((REG32(ADR_SYN_PFD_CHP)) & 0xefffffff)) ++#define SET_RG_SX_PFD_TRDN(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 29) | ((REG32(ADR_SYN_PFD_CHP)) & 0xdfffffff)) ++#define SET_RG_SX_PFD_TRSEL(_VAL_) (REG32(ADR_SYN_PFD_CHP)) = (((_VAL_) << 30) | ((REG32(ADR_SYN_PFD_CHP)) & 0xbfffffff)) ++#define SET_RG_SX_VCOBA_R(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 0) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xfffffff8)) ++#define SET_RG_SX_VCORSEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 3) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xffffff07)) ++#define SET_RG_SX_VCOCUSEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 8) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xfffff0ff)) ++#define SET_RG_SX_RXBFSEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 12) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xffff0fff)) ++#define SET_RG_SX_TXBFSEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 16) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xfff0ffff)) ++#define SET_RG_SX_VCOBFSEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 20) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xff0fffff)) ++#define SET_RG_SX_DIVBFSEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 24) | ((REG32(ADR_SYN_VCO_LOBF)) & 0xf0ffffff)) ++#define SET_RG_SX_GNDR_SEL(_VAL_) (REG32(ADR_SYN_VCO_LOBF)) = (((_VAL_) << 28) | ((REG32(ADR_SYN_VCO_LOBF)) & 0x0fffffff)) ++#define SET_RG_SX_DITHER_WEIGHT(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 0) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xfffffffc)) ++#define SET_RG_SX_MOD_ORDER(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 4) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xffffffcf)) ++#define SET_RG_SX_RST_H_DIV(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 9) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xfffffdff)) ++#define SET_RG_SX_SDM_EDGE(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 10) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xfffffbff)) ++#define SET_RG_SX_XO_GM(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 11) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xffffe7ff)) ++#define SET_RG_SX_REFBYTWO(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 13) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xffffdfff)) ++#define SET_RG_SX_LCKEN(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 19) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xfff7ffff)) ++#define SET_RG_SX_PREVDD(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 20) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xff0fffff)) ++#define SET_RG_SX_PSCONTERVDD(_VAL_) (REG32(ADR_SYN_DIV_SDM_XOSC)) = (((_VAL_) << 24) | ((REG32(ADR_SYN_DIV_SDM_XOSC)) & 0xf0ffffff)) ++#define SET_RG_SX_PH(_VAL_) (REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) = (((_VAL_) << 13) | ((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0xffffdfff)) ++#define SET_RG_SX_PL(_VAL_) (REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) = (((_VAL_) << 14) | ((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0xffffbfff)) ++#define SET_RG_XOSC_CBANK_XO(_VAL_) (REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) = (((_VAL_) << 15) | ((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0xfff87fff)) ++#define SET_RG_XOSC_CBANK_XI(_VAL_) (REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) = (((_VAL_) << 19) | ((REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) & 0xff87ffff)) ++#define SET_RG_SX_VT_MON_MODE(_VAL_) (REG32(ADR_SYN_LCK_VT)) = (((_VAL_) << 0) | ((REG32(ADR_SYN_LCK_VT)) & 0xfffffffe)) ++#define SET_RG_SX_VT_TH_HI(_VAL_) (REG32(ADR_SYN_LCK_VT)) = (((_VAL_) << 1) | ((REG32(ADR_SYN_LCK_VT)) & 0xfffffff9)) ++#define SET_RG_SX_VT_TH_LO(_VAL_) (REG32(ADR_SYN_LCK_VT)) = (((_VAL_) << 3) | ((REG32(ADR_SYN_LCK_VT)) & 0xffffffe7)) ++#define SET_RG_SX_VT_SET(_VAL_) (REG32(ADR_SYN_LCK_VT)) = (((_VAL_) << 5) | ((REG32(ADR_SYN_LCK_VT)) & 0xffffffdf)) ++#define SET_RG_SX_VT_MON_TMR(_VAL_) (REG32(ADR_SYN_LCK_VT)) = (((_VAL_) << 6) | ((REG32(ADR_SYN_LCK_VT)) & 0xffff803f)) ++#define SET_RG_EN_DP_VT_MON(_VAL_) (REG32(ADR_DPLL_VCO_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_DPLL_VCO_REGISTER)) & 0xfffffffe)) ++#define SET_RG_DP_VT_TH_HI(_VAL_) (REG32(ADR_DPLL_VCO_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_DPLL_VCO_REGISTER)) & 0xfffffff9)) ++#define SET_RG_DP_VT_TH_LO(_VAL_) (REG32(ADR_DPLL_VCO_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_DPLL_VCO_REGISTER)) & 0xffffffe7)) ++#define SET_RG_DP_CK320BY2(_VAL_) (REG32(ADR_DPLL_VCO_REGISTER)) = (((_VAL_) << 14) | ((REG32(ADR_DPLL_VCO_REGISTER)) & 0xffffbfff)) ++#define SET_RG_DP_OD_TEST(_VAL_) (REG32(ADR_DPLL_VCO_REGISTER)) = (((_VAL_) << 21) | ((REG32(ADR_DPLL_VCO_REGISTER)) & 0xffdfffff)) ++#define SET_RG_DP_BBPLL_BP(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xfffffffe)) ++#define SET_RG_DP_BBPLL_ICP(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xfffffff9)) ++#define SET_RG_DP_BBPLL_IDUAL(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 3) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xffffffe7)) ++#define SET_RG_DP_BBPLL_OD_TEST(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 5) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xfffffe1f)) ++#define SET_RG_DP_BBPLL_PD(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xfffffdff)) ++#define SET_RG_DP_BBPLL_TESTSEL(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xffffe3ff)) ++#define SET_RG_DP_BBPLL_PFD_DLY(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 13) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xffff9fff)) ++#define SET_RG_DP_RP(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 15) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xfffc7fff)) ++#define SET_RG_DP_RHP(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 18) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0xfff3ffff)) ++#define SET_RG_DP_BBPLL_SDM_EDGE(_VAL_) (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (((_VAL_) << 31) | ((REG32(ADR_DPLL_CP_PFD_REGISTER)) & 0x7fffffff)) ++#define SET_RG_DP_FODIV(_VAL_) (REG32(ADR_DPLL_DIVIDER_REGISTER)) = (((_VAL_) << 12) | ((REG32(ADR_DPLL_DIVIDER_REGISTER)) & 0xfff80fff)) ++#define SET_RG_DP_REFDIV(_VAL_) (REG32(ADR_DPLL_DIVIDER_REGISTER)) = (((_VAL_) << 22) | ((REG32(ADR_DPLL_DIVIDER_REGISTER)) & 0xe03fffff)) ++#define SET_RG_IDACAI_PGAG15(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG15(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG14(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG14(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0xff03ffff)) ++#define SET_RG_DP_BBPLL_BS(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER1)) = (((_VAL_) << 24) | ((REG32(ADR_DCOC_IDAC_REGISTER1)) & 0xc0ffffff)) ++#define SET_RG_IDACAI_PGAG13(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG13(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG12(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG12(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER2)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER2)) & 0xff03ffff)) ++#define SET_RG_IDACAI_PGAG11(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG11(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG10(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG10(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER3)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER3)) & 0xff03ffff)) ++#define SET_RG_IDACAI_PGAG9(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG9(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG8(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG8(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER4)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER4)) & 0xff03ffff)) ++#define SET_RG_IDACAI_PGAG7(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG7(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG6(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG6(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER5)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER5)) & 0xff03ffff)) ++#define SET_RG_IDACAI_PGAG5(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG5(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG4(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG4(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER6)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER6)) & 0xff03ffff)) ++#define SET_RG_IDACAI_PGAG3(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG3(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG2(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG2(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER7)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER7)) & 0xff03ffff)) ++#define SET_RG_IDACAI_PGAG1(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 0) | ((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0xffffffc0)) ++#define SET_RG_IDACAQ_PGAG1(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 6) | ((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0xfffff03f)) ++#define SET_RG_IDACAI_PGAG0(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 12) | ((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0xfffc0fff)) ++#define SET_RG_IDACAQ_PGAG0(_VAL_) (REG32(ADR_DCOC_IDAC_REGISTER8)) = (((_VAL_) << 18) | ((REG32(ADR_DCOC_IDAC_REGISTER8)) & 0xff03ffff)) ++#define SET_RG_EN_RCAL(_VAL_) (REG32(ADR_RCAL_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_RCAL_REGISTER)) & 0xfffffffe)) ++#define SET_RG_RCAL_SPD(_VAL_) (REG32(ADR_RCAL_REGISTER)) = (((_VAL_) << 1) | ((REG32(ADR_RCAL_REGISTER)) & 0xfffffffd)) ++#define SET_RG_RCAL_TMR(_VAL_) (REG32(ADR_RCAL_REGISTER)) = (((_VAL_) << 2) | ((REG32(ADR_RCAL_REGISTER)) & 0xfffffe03)) ++#define SET_RG_RCAL_CODE_CWR(_VAL_) (REG32(ADR_RCAL_REGISTER)) = (((_VAL_) << 9) | ((REG32(ADR_RCAL_REGISTER)) & 0xfffffdff)) ++#define SET_RG_RCAL_CODE_CWD(_VAL_) (REG32(ADR_RCAL_REGISTER)) = (((_VAL_) << 10) | ((REG32(ADR_RCAL_REGISTER)) & 0xffff83ff)) ++#define SET_RG_SX_SUB_SEL_CWR(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 0) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xfffffffe)) ++#define SET_RG_SX_SUB_SEL_CWD(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 1) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xffffff01)) ++#define SET_RG_SX_LCK_BIN_OFFSET(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 15) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xfff87fff)) ++#define SET_RG_SX_LCK_BIN_PRECISION(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 19) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xfff7ffff)) ++#define SET_RG_SX_LOCK_EN_N(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 20) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xffefffff)) ++#define SET_RG_SX_LOCK_MANUAL(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 21) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xffdfffff)) ++#define SET_RG_SX_SUB_MANUAL(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 22) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xffbfffff)) ++#define SET_RG_SX_SUB_SEL(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 23) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xc07fffff)) ++#define SET_RG_SX_MUX_SEL_VTH_BINL(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (((_VAL_) << 30) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_I)) & 0xbfffffff)) ++#define SET_RG_TRX_DUMMMY(_VAL_) (REG32(ADR_TRX_DUMMY_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_TRX_DUMMY_REGISTER)) & 0x00000000)) ++#define SET_RG_SX_DUMMMY(_VAL_) (REG32(ADR_SX_DUMMY_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_SX_DUMMY_REGISTER)) & 0x00000000)) ++#define SET_RCAL_RDY(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 0) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xfffffffe)) ++#define SET_LCK_BIN_RDY(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 1) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xfffffffd)) ++#define SET_VT_MON_RDY(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 2) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xfffffffb)) ++#define SET_DA_R_CODE_LUT(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 6) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xfffff83f)) ++#define SET_AD_SX_VT_MON_Q(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 11) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xffffe7ff)) ++#define SET_AD_DP_VT_MON_Q(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 13) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xffff9fff)) ++#define SET_RTC_CAL_RDY(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 15) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xffff7fff)) ++#define SET_RG_SARADC_BIT(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 16) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xffc0ffff)) ++#define SET_SAR_ADC_FSM_RDY(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 22) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xffbfffff)) ++#define SET_AD_CIRCUIT_VERSION(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_1)) = (((_VAL_) << 23) | ((REG32(ADR_READ_ONLY_FLAGS_1)) & 0xf87fffff)) ++#define SET_DA_R_CAL_CODE(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_2)) = (((_VAL_) << 0) | ((REG32(ADR_READ_ONLY_FLAGS_2)) & 0xffffffe0)) ++#define SET_DA_SX_SUB_SEL(_VAL_) (REG32(ADR_READ_ONLY_FLAGS_2)) = (((_VAL_) << 5) | ((REG32(ADR_READ_ONLY_FLAGS_2)) & 0xfffff01f)) ++#define SET_RG_DPL_RFCTRL_CH(_VAL_) (REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) = (((_VAL_) << 0) | ((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0xfffff800)) ++#define SET_RG_RSSIADC_RO_BIT(_VAL_) (REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) = (((_VAL_) << 11) | ((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0xffff87ff)) ++#define SET_RG_RX_ADC_I_RO_BIT(_VAL_) (REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) = (((_VAL_) << 15) | ((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0xff807fff)) ++#define SET_RG_RX_ADC_Q_RO_BIT(_VAL_) (REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) = (((_VAL_) << 23) | ((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_I)) & 0x807fffff)) ++#define SET_RG_DPL_RFCTRL_F(_VAL_) (REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_II)) = (((_VAL_) << 0) | ((REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_II)) & 0xff000000)) ++#define SET_RG_SX_TARGET_CNT(_VAL_) (REG32(ADR_SX_LCK_BIN_REGISTERS_II)) = (((_VAL_) << 0) | ((REG32(ADR_SX_LCK_BIN_REGISTERS_II)) & 0xffffe000)) ++#define SET_RG_RTC_OFFSET(_VAL_) (REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) = (((_VAL_) << 0) | ((REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) & 0xffffff00)) ++#define SET_RG_RTC_CAL_TARGET_COUNT(_VAL_) (REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) = (((_VAL_) << 8) | ((REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) & 0xfff000ff)) ++#define SET_RG_RF_D_REG(_VAL_) (REG32(ADR_RF_D_DIGITAL_DEBUG_PORT_REGISTER)) = (((_VAL_) << 0) | ((REG32(ADR_RF_D_DIGITAL_DEBUG_PORT_REGISTER)) & 0xffff0000)) ++#define SET_DIRECT_MODE(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_MMU_CTRL)) & 0xfffffffe)) ++#define SET_TAG_INTERLEAVE_MD(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 1) | ((REG32(ADR_MMU_CTRL)) & 0xfffffffd)) ++#define SET_DIS_DEMAND(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 2) | ((REG32(ADR_MMU_CTRL)) & 0xfffffffb)) ++#define SET_SAME_ID_ALLOC_MD(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 3) | ((REG32(ADR_MMU_CTRL)) & 0xfffffff7)) ++#define SET_HS_ACCESS_MD(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 4) | ((REG32(ADR_MMU_CTRL)) & 0xffffffef)) ++#define SET_SRAM_ACCESS_MD(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 5) | ((REG32(ADR_MMU_CTRL)) & 0xffffffdf)) ++#define SET_NOHIT_RPASS_MD(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 6) | ((REG32(ADR_MMU_CTRL)) & 0xffffffbf)) ++#define SET_DMN_FLAG_CLR(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 7) | ((REG32(ADR_MMU_CTRL)) & 0xffffff7f)) ++#define SET_ERR_SW_RST_N(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 8) | ((REG32(ADR_MMU_CTRL)) & 0xfffffeff)) ++#define SET_ALR_SW_RST_N(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 9) | ((REG32(ADR_MMU_CTRL)) & 0xfffffdff)) ++#define SET_MCH_SW_RST_N(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 10) | ((REG32(ADR_MMU_CTRL)) & 0xfffffbff)) ++#define SET_TAG_SW_RST_N(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 11) | ((REG32(ADR_MMU_CTRL)) & 0xfffff7ff)) ++#define SET_ABT_SW_RST_N(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 12) | ((REG32(ADR_MMU_CTRL)) & 0xffffefff)) ++#define SET_MMU_VER(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 13) | ((REG32(ADR_MMU_CTRL)) & 0xffff1fff)) ++#define SET_MMU_SHARE_MCU(_VAL_) (REG32(ADR_MMU_CTRL)) = (((_VAL_) << 16) | ((REG32(ADR_MMU_CTRL)) & 0xff00ffff)) ++#define SET_HS_WR(_VAL_) (REG32(ADR_HS_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_HS_CTRL)) & 0xfffffffe)) ++#define SET_HS_FLAG(_VAL_) (REG32(ADR_HS_CTRL)) = (((_VAL_) << 4) | ((REG32(ADR_HS_CTRL)) & 0xffffffef)) ++#define SET_HS_ID(_VAL_) (REG32(ADR_HS_CTRL)) = (((_VAL_) << 8) | ((REG32(ADR_HS_CTRL)) & 0xffff80ff)) ++#define SET_HS_CHANNEL(_VAL_) (REG32(ADR_HS_CTRL)) = (((_VAL_) << 16) | ((REG32(ADR_HS_CTRL)) & 0xfff0ffff)) ++#define SET_HS_PAGE(_VAL_) (REG32(ADR_HS_CTRL)) = (((_VAL_) << 20) | ((REG32(ADR_HS_CTRL)) & 0xff0fffff)) ++#define SET_HS_DATA(_VAL_) (REG32(ADR_HS_CTRL)) = (((_VAL_) << 24) | ((REG32(ADR_HS_CTRL)) & 0x00ffffff)) ++#define SET_CPU_POR0(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 0) | ((REG32(ADR_CPU_POR0_7)) & 0xfffffff0)) ++#define SET_CPU_POR1(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 4) | ((REG32(ADR_CPU_POR0_7)) & 0xffffff0f)) ++#define SET_CPU_POR2(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 8) | ((REG32(ADR_CPU_POR0_7)) & 0xfffff0ff)) ++#define SET_CPU_POR3(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 12) | ((REG32(ADR_CPU_POR0_7)) & 0xffff0fff)) ++#define SET_CPU_POR4(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 16) | ((REG32(ADR_CPU_POR0_7)) & 0xfff0ffff)) ++#define SET_CPU_POR5(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 20) | ((REG32(ADR_CPU_POR0_7)) & 0xff0fffff)) ++#define SET_CPU_POR6(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 24) | ((REG32(ADR_CPU_POR0_7)) & 0xf0ffffff)) ++#define SET_CPU_POR7(_VAL_) (REG32(ADR_CPU_POR0_7)) = (((_VAL_) << 28) | ((REG32(ADR_CPU_POR0_7)) & 0x0fffffff)) ++#define SET_CPU_POR8(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 0) | ((REG32(ADR_CPU_POR8_F)) & 0xfffffff0)) ++#define SET_CPU_POR9(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 4) | ((REG32(ADR_CPU_POR8_F)) & 0xffffff0f)) ++#define SET_CPU_PORA(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 8) | ((REG32(ADR_CPU_POR8_F)) & 0xfffff0ff)) ++#define SET_CPU_PORB(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 12) | ((REG32(ADR_CPU_POR8_F)) & 0xffff0fff)) ++#define SET_CPU_PORC(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 16) | ((REG32(ADR_CPU_POR8_F)) & 0xfff0ffff)) ++#define SET_CPU_PORD(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 20) | ((REG32(ADR_CPU_POR8_F)) & 0xff0fffff)) ++#define SET_CPU_PORE(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 24) | ((REG32(ADR_CPU_POR8_F)) & 0xf0ffffff)) ++#define SET_CPU_PORF(_VAL_) (REG32(ADR_CPU_POR8_F)) = (((_VAL_) << 28) | ((REG32(ADR_CPU_POR8_F)) & 0x0fffffff)) ++#define SET_ACC_WR_LEN(_VAL_) (REG32(ADR_REG_LEN_CTRL)) = (((_VAL_) << 0) | ((REG32(ADR_REG_LEN_CTRL)) & 0xffffffc0)) ++#define SET_ACC_RD_LEN(_VAL_) (REG32(ADR_REG_LEN_CTRL)) = (((_VAL_) << 8) | ((REG32(ADR_REG_LEN_CTRL)) & 0xffffc0ff)) ++#define SET_REQ_NACK_CLR(_VAL_) (REG32(ADR_REG_LEN_CTRL)) = (((_VAL_) << 15) | ((REG32(ADR_REG_LEN_CTRL)) & 0xffff7fff)) ++#define SET_NACK_FLAG_BUS(_VAL_) (REG32(ADR_REG_LEN_CTRL)) = (((_VAL_) << 16) | ((REG32(ADR_REG_LEN_CTRL)) & 0x0000ffff)) ++#define SET_DMN_R_PASS(_VAL_) (REG32(ADR_DMN_READ_BYPASS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_READ_BYPASS)) & 0xffff0000)) ++#define SET_PARA_ALC_RLS(_VAL_) (REG32(ADR_DMN_READ_BYPASS)) = (((_VAL_) << 16) | ((REG32(ADR_DMN_READ_BYPASS)) & 0xfffeffff)) ++#define SET_REQ_PORNS_CHGEN(_VAL_) (REG32(ADR_DMN_READ_BYPASS)) = (((_VAL_) << 24) | ((REG32(ADR_DMN_READ_BYPASS)) & 0xfeffffff)) ++#define SET_ALC_ABT_ID(_VAL_) (REG32(ADR_ALC_RLS_ABORT)) = (((_VAL_) << 0) | ((REG32(ADR_ALC_RLS_ABORT)) & 0xffffff80)) ++#define SET_ALC_ABT_INT(_VAL_) (REG32(ADR_ALC_RLS_ABORT)) = (((_VAL_) << 15) | ((REG32(ADR_ALC_RLS_ABORT)) & 0xffff7fff)) ++#define SET_RLS_ABT_ID(_VAL_) (REG32(ADR_ALC_RLS_ABORT)) = (((_VAL_) << 16) | ((REG32(ADR_ALC_RLS_ABORT)) & 0xff80ffff)) ++#define SET_RLS_ABT_INT(_VAL_) (REG32(ADR_ALC_RLS_ABORT)) = (((_VAL_) << 31) | ((REG32(ADR_ALC_RLS_ABORT)) & 0x7fffffff)) ++#define SET_DEBUG_CTL(_VAL_) (REG32(ADR_DEBUG_CTL)) = (((_VAL_) << 0) | ((REG32(ADR_DEBUG_CTL)) & 0xffffff00)) ++#define SET_DEBUG_H16(_VAL_) (REG32(ADR_DEBUG_CTL)) = (((_VAL_) << 8) | ((REG32(ADR_DEBUG_CTL)) & 0xfffffeff)) ++#define SET_DEBUG_OUT(_VAL_) (REG32(ADR_DEBUG_OUT)) = (((_VAL_) << 0) | ((REG32(ADR_DEBUG_OUT)) & 0x00000000)) ++#define SET_ALC_ERR(_VAL_) (REG32(ADR_MMU_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MMU_STATUS)) & 0xfffffffe)) ++#define SET_RLS_ERR(_VAL_) (REG32(ADR_MMU_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_MMU_STATUS)) & 0xfffffffd)) ++#define SET_AL_STATE(_VAL_) (REG32(ADR_MMU_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_MMU_STATUS)) & 0xfffff8ff)) ++#define SET_RL_STATE(_VAL_) (REG32(ADR_MMU_STATUS)) = (((_VAL_) << 12) | ((REG32(ADR_MMU_STATUS)) & 0xffff8fff)) ++#define SET_ALC_ERR_ID(_VAL_) (REG32(ADR_MMU_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_MMU_STATUS)) & 0xff80ffff)) ++#define SET_RLS_ERR_ID(_VAL_) (REG32(ADR_MMU_STATUS)) = (((_VAL_) << 24) | ((REG32(ADR_MMU_STATUS)) & 0x80ffffff)) ++#define SET_DMN_NOHIT_FLAG(_VAL_) (REG32(ADR_DMN_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_STATUS)) & 0xfffffffe)) ++#define SET_DMN_FLAG(_VAL_) (REG32(ADR_DMN_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_DMN_STATUS)) & 0xfffffffd)) ++#define SET_DMN_WR(_VAL_) (REG32(ADR_DMN_STATUS)) = (((_VAL_) << 3) | ((REG32(ADR_DMN_STATUS)) & 0xfffffff7)) ++#define SET_DMN_PORT(_VAL_) (REG32(ADR_DMN_STATUS)) = (((_VAL_) << 4) | ((REG32(ADR_DMN_STATUS)) & 0xffffff0f)) ++#define SET_DMN_NHIT_ID(_VAL_) (REG32(ADR_DMN_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_DMN_STATUS)) & 0xffff80ff)) ++#define SET_DMN_NHIT_ADDR(_VAL_) (REG32(ADR_DMN_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_DMN_STATUS)) & 0x0000ffff)) ++#define SET_TX_MOUNT(_VAL_) (REG32(ADR_TAG_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_STATUS)) & 0xffffff00)) ++#define SET_RX_MOUNT(_VAL_) (REG32(ADR_TAG_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_TAG_STATUS)) & 0xffff00ff)) ++#define SET_AVA_TAG(_VAL_) (REG32(ADR_TAG_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_STATUS)) & 0xfe00ffff)) ++#define SET_PKTBUF_FULL(_VAL_) (REG32(ADR_TAG_STATUS)) = (((_VAL_) << 31) | ((REG32(ADR_TAG_STATUS)) & 0x7fffffff)) ++#define SET_DMN_NOHIT_MCU(_VAL_) (REG32(ADR_DMN_MCU_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_MCU_STATUS)) & 0xfffffffe)) ++#define SET_DMN_MCU_FLAG(_VAL_) (REG32(ADR_DMN_MCU_STATUS)) = (((_VAL_) << 1) | ((REG32(ADR_DMN_MCU_STATUS)) & 0xfffffffd)) ++#define SET_DMN_MCU_WR(_VAL_) (REG32(ADR_DMN_MCU_STATUS)) = (((_VAL_) << 3) | ((REG32(ADR_DMN_MCU_STATUS)) & 0xfffffff7)) ++#define SET_DMN_MCU_PORT(_VAL_) (REG32(ADR_DMN_MCU_STATUS)) = (((_VAL_) << 4) | ((REG32(ADR_DMN_MCU_STATUS)) & 0xffffff0f)) ++#define SET_DMN_MCU_ID(_VAL_) (REG32(ADR_DMN_MCU_STATUS)) = (((_VAL_) << 8) | ((REG32(ADR_DMN_MCU_STATUS)) & 0xffff80ff)) ++#define SET_DMN_MCU_ADDR(_VAL_) (REG32(ADR_DMN_MCU_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_DMN_MCU_STATUS)) & 0x0000ffff)) ++#define SET_MB_IDTBL_31_0(_VAL_) (REG32(ADR_MB_IDTBL_0_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_IDTBL_0_STATUS)) & 0x00000000)) ++#define SET_MB_IDTBL_63_32(_VAL_) (REG32(ADR_MB_IDTBL_1_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_IDTBL_1_STATUS)) & 0x00000000)) ++#define SET_MB_IDTBL_95_64(_VAL_) (REG32(ADR_MB_IDTBL_2_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_IDTBL_2_STATUS)) & 0x00000000)) ++#define SET_MB_IDTBL_127_96(_VAL_) (REG32(ADR_MB_IDTBL_3_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_IDTBL_3_STATUS)) & 0x00000000)) ++#define SET_PKT_IDTBL_31_0(_VAL_) (REG32(ADR_PKT_IDTBL_0_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_IDTBL_0_STATUS)) & 0x00000000)) ++#define SET_PKT_IDTBL_63_32(_VAL_) (REG32(ADR_PKT_IDTBL_1_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_IDTBL_1_STATUS)) & 0x00000000)) ++#define SET_PKT_IDTBL_95_64(_VAL_) (REG32(ADR_PKT_IDTBL_2_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_IDTBL_2_STATUS)) & 0x00000000)) ++#define SET_PKT_IDTBL_127_96(_VAL_) (REG32(ADR_PKT_IDTBL_3_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_IDTBL_3_STATUS)) & 0x00000000)) ++#define SET_DMN_IDTBL_31_0(_VAL_) (REG32(ADR_DMN_IDTBL_0_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_IDTBL_0_STATUS)) & 0x00000000)) ++#define SET_DMN_IDTBL_63_32(_VAL_) (REG32(ADR_DMN_IDTBL_1_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_IDTBL_1_STATUS)) & 0x00000000)) ++#define SET_DMN_IDTBL_95_64(_VAL_) (REG32(ADR_DMN_IDTBL_2_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_IDTBL_2_STATUS)) & 0x00000000)) ++#define SET_DMN_IDTBL_127_96(_VAL_) (REG32(ADR_DMN_IDTBL_3_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_DMN_IDTBL_3_STATUS)) & 0x00000000)) ++#define SET_NEQ_MB_ID_31_0(_VAL_) (REG32(ADR_MB_NEQID_0_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_NEQID_0_STATUS)) & 0x00000000)) ++#define SET_NEQ_MB_ID_63_32(_VAL_) (REG32(ADR_MB_NEQID_1_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_NEQID_1_STATUS)) & 0x00000000)) ++#define SET_NEQ_MB_ID_95_64(_VAL_) (REG32(ADR_MB_NEQID_2_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_NEQID_2_STATUS)) & 0x00000000)) ++#define SET_NEQ_MB_ID_127_96(_VAL_) (REG32(ADR_MB_NEQID_3_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_MB_NEQID_3_STATUS)) & 0x00000000)) ++#define SET_NEQ_PKT_ID_31_0(_VAL_) (REG32(ADR_PKT_NEQID_0_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_NEQID_0_STATUS)) & 0x00000000)) ++#define SET_NEQ_PKT_ID_63_32(_VAL_) (REG32(ADR_PKT_NEQID_1_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_NEQID_1_STATUS)) & 0x00000000)) ++#define SET_NEQ_PKT_ID_95_64(_VAL_) (REG32(ADR_PKT_NEQID_2_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_NEQID_2_STATUS)) & 0x00000000)) ++#define SET_NEQ_PKT_ID_127_96(_VAL_) (REG32(ADR_PKT_NEQID_3_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_PKT_NEQID_3_STATUS)) & 0x00000000)) ++#define SET_ALC_NOCHG_ID(_VAL_) (REG32(ADR_ALC_NOCHG_ID_STATUS)) = (((_VAL_) << 0) | ((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0xffffff80)) ++#define SET_ALC_NOCHG_INT(_VAL_) (REG32(ADR_ALC_NOCHG_ID_STATUS)) = (((_VAL_) << 15) | ((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0xffff7fff)) ++#define SET_NEQ_PKT_FLAG(_VAL_) (REG32(ADR_ALC_NOCHG_ID_STATUS)) = (((_VAL_) << 16) | ((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0xfffeffff)) ++#define SET_NEQ_MB_FLAG(_VAL_) (REG32(ADR_ALC_NOCHG_ID_STATUS)) = (((_VAL_) << 24) | ((REG32(ADR_ALC_NOCHG_ID_STATUS)) & 0xfeffffff)) ++#define SET_SRAM_TAG_0(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_0)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_0)) & 0xffff0000)) ++#define SET_SRAM_TAG_1(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_0)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_0)) & 0x0000ffff)) ++#define SET_SRAM_TAG_2(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_1)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_1)) & 0xffff0000)) ++#define SET_SRAM_TAG_3(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_1)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_1)) & 0x0000ffff)) ++#define SET_SRAM_TAG_4(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_2)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_2)) & 0xffff0000)) ++#define SET_SRAM_TAG_5(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_2)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_2)) & 0x0000ffff)) ++#define SET_SRAM_TAG_6(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_3)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_3)) & 0xffff0000)) ++#define SET_SRAM_TAG_7(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_3)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_3)) & 0x0000ffff)) ++#define SET_SRAM_TAG_8(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_4)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_4)) & 0xffff0000)) ++#define SET_SRAM_TAG_9(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_4)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_4)) & 0x0000ffff)) ++#define SET_SRAM_TAG_10(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_5)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_5)) & 0xffff0000)) ++#define SET_SRAM_TAG_11(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_5)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_5)) & 0x0000ffff)) ++#define SET_SRAM_TAG_12(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_6)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_6)) & 0xffff0000)) ++#define SET_SRAM_TAG_13(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_6)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_6)) & 0x0000ffff)) ++#define SET_SRAM_TAG_14(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_7)) = (((_VAL_) << 0) | ((REG32(ADR_TAG_SRAM0_F_STATUS_7)) & 0xffff0000)) ++#define SET_SRAM_TAG_15(_VAL_) (REG32(ADR_TAG_SRAM0_F_STATUS_7)) = (((_VAL_) << 16) | ((REG32(ADR_TAG_SRAM0_F_STATUS_7)) & 0x0000ffff)) ++#define DEF_BRG_SW_RST() (REG32(ADR_BRG_SW_RST)) = (0x00000000) ++#define DEF_BOOT() (REG32(ADR_BOOT)) = (0x00040000) ++#define DEF_CHIP_ID_0() (REG32(ADR_CHIP_ID_0)) = (0x31333131) ++#define DEF_CHIP_ID_1() (REG32(ADR_CHIP_ID_1)) = (0x322d3230) ++#define DEF_CHIP_ID_2() (REG32(ADR_CHIP_ID_2)) = (0x32303041) ++#define DEF_CHIP_ID_3() (REG32(ADR_CHIP_ID_3)) = (0x53535636) ++#define DEF_CLOCK_SELECTION() (REG32(ADR_CLOCK_SELECTION)) = (0x00000000) ++#define DEF_PLATFORM_CLOCK_ENABLE() (REG32(ADR_PLATFORM_CLOCK_ENABLE)) = (0x008fffff) ++#define DEF_SYS_CSR_CLOCK_ENABLE() (REG32(ADR_SYS_CSR_CLOCK_ENABLE)) = (0x00000400) ++#define DEF_MCU_DBG_SEL() (REG32(ADR_MCU_DBG_SEL)) = (0x00000000) ++#define DEF_MCU_DBG_DATA() (REG32(ADR_MCU_DBG_DATA)) = (0x00000000) ++#define DEF_AHB_BRG_STATUS() (REG32(ADR_AHB_BRG_STATUS)) = (0x00000000) ++#define DEF_BIST_BIST_CTRL() (REG32(ADR_BIST_BIST_CTRL)) = (0x00000000) ++#define DEF_BIST_MODE_REG_IN() (REG32(ADR_BIST_MODE_REG_IN)) = (0x001ffe3e) ++#define DEF_BIST_MODE_REG_OUT() (REG32(ADR_BIST_MODE_REG_OUT)) = (0x00000000) ++#define DEF_BIST_MONITOR_BUS_LSB() (REG32(ADR_BIST_MONITOR_BUS_LSB)) = (0x00000000) ++#define DEF_BIST_MONITOR_BUS_MSB() (REG32(ADR_BIST_MONITOR_BUS_MSB)) = (0x00000000) ++#define DEF_TB_ADR_SEL() (REG32(ADR_TB_ADR_SEL)) = (0x00000000) ++#define DEF_TB_RDATA() (REG32(ADR_TB_RDATA)) = (0x00000000) ++#define DEF_UART_W2B() (REG32(ADR_UART_W2B)) = (0x00000000) ++#define DEF_AHB_ILL_ADDR() (REG32(ADR_AHB_ILL_ADDR)) = (0x00000000) ++#define DEF_AHB_FEN_ADDR() (REG32(ADR_AHB_FEN_ADDR)) = (0x00000000) ++#define DEF_AHB_ILLFEN_STATUS() (REG32(ADR_AHB_ILLFEN_STATUS)) = (0x00000000) ++#define DEF_PWM_A() (REG32(ADR_PWM_A)) = (0x400a1010) ++#define DEF_PWM_B() (REG32(ADR_PWM_B)) = (0x400a1010) ++#define DEF_HBUSREQ_LOCK() (REG32(ADR_HBUSREQ_LOCK)) = (0x00001ffd) ++#define DEF_HBURST_LOCK() (REG32(ADR_HBURST_LOCK)) = (0x00000000) ++#define DEF_PRESCALER_USTIMER() (REG32(ADR_PRESCALER_USTIMER)) = (0x00000028) ++#define DEF_BIST_MODE_REG_IN_MMU() (REG32(ADR_BIST_MODE_REG_IN_MMU)) = (0x0000fe3e) ++#define DEF_BIST_MODE_REG_OUT_MMU() (REG32(ADR_BIST_MODE_REG_OUT_MMU)) = (0x00000000) ++#define DEF_BIST_MONITOR_BUS_MMU() (REG32(ADR_BIST_MONITOR_BUS_MMU)) = (0x00000000) ++#define DEF_TEST_MODE() (REG32(ADR_TEST_MODE)) = (0x00000000) ++#define DEF_BOOT_INFO() (REG32(ADR_BOOT_INFO)) = (0x00000000) ++#define DEF_SD_INIT_CFG() (REG32(ADR_SD_INIT_CFG)) = (0x00000000) ++#define DEF_SPARE_UART_INFO() (REG32(ADR_SPARE_UART_INFO)) = (0x00000000) ++#define DEF_TU0_MICROSECOND_TIMER() (REG32(ADR_TU0_MICROSECOND_TIMER)) = (0x00000000) ++#define DEF_TU0_CURRENT_MICROSECOND_TIME_VALUE() (REG32(ADR_TU0_CURRENT_MICROSECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TU0_DUMMY_BIT_0() (REG32(ADR_TU0_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TU0_DUMMY_BIT_1() (REG32(ADR_TU0_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TU1_MICROSECOND_TIMER() (REG32(ADR_TU1_MICROSECOND_TIMER)) = (0x00000000) ++#define DEF_TU1_CURRENT_MICROSECOND_TIME_VALUE() (REG32(ADR_TU1_CURRENT_MICROSECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TU1_DUMMY_BIT_0() (REG32(ADR_TU1_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TU1_DUMMY_BIT_1() (REG32(ADR_TU1_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TU2_MICROSECOND_TIMER() (REG32(ADR_TU2_MICROSECOND_TIMER)) = (0x00000000) ++#define DEF_TU2_CURRENT_MICROSECOND_TIME_VALUE() (REG32(ADR_TU2_CURRENT_MICROSECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TU2_DUMMY_BIT_0() (REG32(ADR_TU2_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TU2_DUMMY_BIT_1() (REG32(ADR_TU2_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TU3_MICROSECOND_TIMER() (REG32(ADR_TU3_MICROSECOND_TIMER)) = (0x00000000) ++#define DEF_TU3_CURRENT_MICROSECOND_TIME_VALUE() (REG32(ADR_TU3_CURRENT_MICROSECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TU3_DUMMY_BIT_0() (REG32(ADR_TU3_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TU3_DUMMY_BIT_1() (REG32(ADR_TU3_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TM0_MILISECOND_TIMER() (REG32(ADR_TM0_MILISECOND_TIMER)) = (0x00000000) ++#define DEF_TM0_CURRENT_MILISECOND_TIME_VALUE() (REG32(ADR_TM0_CURRENT_MILISECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TM0_DUMMY_BIT_0() (REG32(ADR_TM0_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TM0_DUMMY_BIT_1() (REG32(ADR_TM0_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TM1_MILISECOND_TIMER() (REG32(ADR_TM1_MILISECOND_TIMER)) = (0x00000000) ++#define DEF_TM1_CURRENT_MILISECOND_TIME_VALUE() (REG32(ADR_TM1_CURRENT_MILISECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TM1_DUMMY_BIT_0() (REG32(ADR_TM1_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TM1_DUMMY_BIT_1() (REG32(ADR_TM1_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TM2_MILISECOND_TIMER() (REG32(ADR_TM2_MILISECOND_TIMER)) = (0x00000000) ++#define DEF_TM2_CURRENT_MILISECOND_TIME_VALUE() (REG32(ADR_TM2_CURRENT_MILISECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TM2_DUMMY_BIT_0() (REG32(ADR_TM2_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TM2_DUMMY_BIT_1() (REG32(ADR_TM2_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_TM3_MILISECOND_TIMER() (REG32(ADR_TM3_MILISECOND_TIMER)) = (0x00000000) ++#define DEF_TM3_CURRENT_MILISECOND_TIME_VALUE() (REG32(ADR_TM3_CURRENT_MILISECOND_TIME_VALUE)) = (0x00000000) ++#define DEF_TM3_DUMMY_BIT_0() (REG32(ADR_TM3_DUMMY_BIT_0)) = (0x00000000) ++#define DEF_TM3_DUMMY_BIT_1() (REG32(ADR_TM3_DUMMY_BIT_1)) = (0x00000000) ++#define DEF_MCU_WDOG_REG() (REG32(ADR_MCU_WDOG_REG)) = (0x00000000) ++#define DEF_SYS_WDOG_REG() (REG32(ADR_SYS_WDOG_REG)) = (0x00000000) ++#define DEF_PAD6() (REG32(ADR_PAD6)) = (0x00000008) ++#define DEF_PAD7() (REG32(ADR_PAD7)) = (0x00000008) ++#define DEF_PAD8() (REG32(ADR_PAD8)) = (0x00000008) ++#define DEF_PAD9() (REG32(ADR_PAD9)) = (0x00000008) ++#define DEF_PAD11() (REG32(ADR_PAD11)) = (0x00000008) ++#define DEF_PAD15() (REG32(ADR_PAD15)) = (0x0000000a) ++#define DEF_PAD16() (REG32(ADR_PAD16)) = (0x0000000a) ++#define DEF_PAD17() (REG32(ADR_PAD17)) = (0x0000000a) ++#define DEF_PAD18() (REG32(ADR_PAD18)) = (0x0000000a) ++#define DEF_PAD19() (REG32(ADR_PAD19)) = (0x00007000) ++#define DEF_PAD20() (REG32(ADR_PAD20)) = (0x0000000a) ++#define DEF_PAD21() (REG32(ADR_PAD21)) = (0x0000000a) ++#define DEF_PAD22() (REG32(ADR_PAD22)) = (0x00000009) ++#define DEF_PAD24() (REG32(ADR_PAD24)) = (0x00000008) ++#define DEF_PAD25() (REG32(ADR_PAD25)) = (0x0000000b) ++#define DEF_PAD27() (REG32(ADR_PAD27)) = (0x00000008) ++#define DEF_PAD28() (REG32(ADR_PAD28)) = (0x00000008) ++#define DEF_PAD29() (REG32(ADR_PAD29)) = (0x00000009) ++#define DEF_PAD30() (REG32(ADR_PAD30)) = (0x0000000a) ++#define DEF_PAD31() (REG32(ADR_PAD31)) = (0x0000000a) ++#define DEF_PAD32() (REG32(ADR_PAD32)) = (0x0000000a) ++#define DEF_PAD33() (REG32(ADR_PAD33)) = (0x0000000a) ++#define DEF_PAD34() (REG32(ADR_PAD34)) = (0x0000000a) ++#define DEF_PAD42() (REG32(ADR_PAD42)) = (0x0000000a) ++#define DEF_PAD43() (REG32(ADR_PAD43)) = (0x0000000a) ++#define DEF_PAD44() (REG32(ADR_PAD44)) = (0x0000000a) ++#define DEF_PAD45() (REG32(ADR_PAD45)) = (0x0000000a) ++#define DEF_PAD46() (REG32(ADR_PAD46)) = (0x0000000a) ++#define DEF_PAD47() (REG32(ADR_PAD47)) = (0x00100000) ++#define DEF_PAD48() (REG32(ADR_PAD48)) = (0x00100808) ++#define DEF_PAD49() (REG32(ADR_PAD49)) = (0x00100008) ++#define DEF_PAD50() (REG32(ADR_PAD50)) = (0x00100008) ++#define DEF_PAD51() (REG32(ADR_PAD51)) = (0x00100008) ++#define DEF_PAD52() (REG32(ADR_PAD52)) = (0x00100000) ++#define DEF_PAD53() (REG32(ADR_PAD53)) = (0x0000000a) ++#define DEF_PAD54() (REG32(ADR_PAD54)) = (0x00000000) ++#define DEF_PAD56() (REG32(ADR_PAD56)) = (0x00000000) ++#define DEF_PAD57() (REG32(ADR_PAD57)) = (0x00000008) ++#define DEF_PAD58() (REG32(ADR_PAD58)) = (0x0000000a) ++#define DEF_PAD59() (REG32(ADR_PAD59)) = (0x0000000a) ++#define DEF_PAD60() (REG32(ADR_PAD60)) = (0x0000000a) ++#define DEF_PAD61() (REG32(ADR_PAD61)) = (0x0000000a) ++#define DEF_PAD62() (REG32(ADR_PAD62)) = (0x0000000a) ++#define DEF_PAD64() (REG32(ADR_PAD64)) = (0x00000009) ++#define DEF_PAD65() (REG32(ADR_PAD65)) = (0x00000009) ++#define DEF_PAD66() (REG32(ADR_PAD66)) = (0x00000008) ++#define DEF_PAD68() (REG32(ADR_PAD68)) = (0x00000008) ++#define DEF_PAD67() (REG32(ADR_PAD67)) = (0x00000159) ++#define DEF_PAD69() (REG32(ADR_PAD69)) = (0x0000000b) ++#define DEF_PAD70() (REG32(ADR_PAD70)) = (0x00000008) ++#define DEF_PAD231() (REG32(ADR_PAD231)) = (0x00000008) ++#define DEF_PIN_SEL_0() (REG32(ADR_PIN_SEL_0)) = (0x00000000) ++#define DEF_PIN_SEL_1() (REG32(ADR_PIN_SEL_1)) = (0x00000000) ++#define DEF_IO_PORT_REG() (REG32(ADR_IO_PORT_REG)) = (0x00010000) ++#define DEF_INT_MASK_REG() (REG32(ADR_INT_MASK_REG)) = (0x000000ff) ++#define DEF_INT_STATUS_REG() (REG32(ADR_INT_STATUS_REG)) = (0x00000000) ++#define DEF_FN1_STATUS_REG() (REG32(ADR_FN1_STATUS_REG)) = (0x00000000) ++#define DEF_CARD_PKT_STATUS_TEST() (REG32(ADR_CARD_PKT_STATUS_TEST)) = (0x00000000) ++#define DEF_SYSTEM_INFORMATION_REG() (REG32(ADR_SYSTEM_INFORMATION_REG)) = (0x00000000) ++#define DEF_CARD_RCA_REG() (REG32(ADR_CARD_RCA_REG)) = (0x00000000) ++#define DEF_SDIO_FIFO_WR_THLD_REG() (REG32(ADR_SDIO_FIFO_WR_THLD_REG)) = (0x00000000) ++#define DEF_SDIO_FIFO_WR_LIMIT_REG() (REG32(ADR_SDIO_FIFO_WR_LIMIT_REG)) = (0x00000000) ++#define DEF_SDIO_TX_DATA_BATCH_SIZE_REG() (REG32(ADR_SDIO_TX_DATA_BATCH_SIZE_REG)) = (0x00000000) ++#define DEF_SDIO_THLD_FOR_CMD53RD_REG() (REG32(ADR_SDIO_THLD_FOR_CMD53RD_REG)) = (0x00000000) ++#define DEF_SDIO_RX_DATA_BATCH_SIZE_REG() (REG32(ADR_SDIO_RX_DATA_BATCH_SIZE_REG)) = (0x00000000) ++#define DEF_SDIO_LOG_START_END_DATA_REG() (REG32(ADR_SDIO_LOG_START_END_DATA_REG)) = (0x00000000) ++#define DEF_SDIO_BYTE_MODE_BATCH_SIZE_REG() (REG32(ADR_SDIO_BYTE_MODE_BATCH_SIZE_REG)) = (0x00000000) ++#define DEF_SDIO_LAST_CMD_INDEX_CRC_REG() (REG32(ADR_SDIO_LAST_CMD_INDEX_CRC_REG)) = (0x00000000) ++#define DEF_SDIO_LAST_CMD_ARG_REG() (REG32(ADR_SDIO_LAST_CMD_ARG_REG)) = (0x00000000) ++#define DEF_SDIO_BUS_STATE_DEBUG_MONITOR() (REG32(ADR_SDIO_BUS_STATE_DEBUG_MONITOR)) = (0x00000000) ++#define DEF_SDIO_CARD_STATUS_REG() (REG32(ADR_SDIO_CARD_STATUS_REG)) = (0x00000000) ++#define DEF_R5_RESP_FLAG_OUT_TIMING() (REG32(ADR_R5_RESP_FLAG_OUT_TIMING)) = (0x00000000) ++#define DEF_CMD52_DATA_FOR_LAST_TIME() (REG32(ADR_CMD52_DATA_FOR_LAST_TIME)) = (0x00000000) ++#define DEF_FN1_DMA_START_ADDR_REG() (REG32(ADR_FN1_DMA_START_ADDR_REG)) = (0x00000000) ++#define DEF_FN1_INT_CTRL_RESET() (REG32(ADR_FN1_INT_CTRL_RESET)) = (0x00000000) ++#define DEF_IO_REG_PORT_REG() (REG32(ADR_IO_REG_PORT_REG)) = (0x00010020) ++#define DEF_SDIO_FIFO_ERROR_CNT() (REG32(ADR_SDIO_FIFO_ERROR_CNT)) = (0x00000000) ++#define DEF_SDIO_CRC7_CRC16_ERROR_REG() (REG32(ADR_SDIO_CRC7_CRC16_ERROR_REG)) = (0x00000000) ++#define DEF_SDIO_BLOCK_CNT_INFO() (REG32(ADR_SDIO_BLOCK_CNT_INFO)) = (0x00000000) ++#define DEF_RX_DATA_CMD52_ABORT_COUNT() (REG32(ADR_RX_DATA_CMD52_ABORT_COUNT)) = (0x00000000) ++#define DEF_FIFO_PTR_READ_BLOCK_CNT() (REG32(ADR_FIFO_PTR_READ_BLOCK_CNT)) = (0x00000000) ++#define DEF_TX_TIME_OUT_READ_CTRL() (REG32(ADR_TX_TIME_OUT_READ_CTRL)) = (0x00000000) ++#define DEF_SDIO_TX_ALLOC_REG() (REG32(ADR_SDIO_TX_ALLOC_REG)) = (0x00000000) ++#define DEF_SDIO_TX_INFORM() (REG32(ADR_SDIO_TX_INFORM)) = (0x00000000) ++#define DEF_F1_BLOCK_SIZE_0_REG() (REG32(ADR_F1_BLOCK_SIZE_0_REG)) = (0x00000000) ++#define DEF_SDIO_COMMAND_LOG_DATA_31_0() (REG32(ADR_SDIO_COMMAND_LOG_DATA_31_0)) = (0x000000ec) ++#define DEF_SDIO_COMMAND_LOG_DATA_63_32() (REG32(ADR_SDIO_COMMAND_LOG_DATA_63_32)) = (0xce000000) ++#define DEF_SYSTEM_INFORMATION_REGISTER() (REG32(ADR_SYSTEM_INFORMATION_REGISTER)) = (0x00000000) ++#define DEF_CCCR_00H_REG() (REG32(ADR_CCCR_00H_REG)) = (0x00000000) ++#define DEF_CCCR_04H_REG() (REG32(ADR_CCCR_04H_REG)) = (0x00000000) ++#define DEF_CCCR_08H_REG() (REG32(ADR_CCCR_08H_REG)) = (0x00000000) ++#define DEF_CCCR_13H_REG() (REG32(ADR_CCCR_13H_REG)) = (0x00000000) ++#define DEF_FBR_100H_REG() (REG32(ADR_FBR_100H_REG)) = (0x00000000) ++#define DEF_FBR_109H_REG() (REG32(ADR_FBR_109H_REG)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_0() (REG32(ADR_F0_CIS_CONTENT_REG_0)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_1() (REG32(ADR_F0_CIS_CONTENT_REG_1)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_2() (REG32(ADR_F0_CIS_CONTENT_REG_2)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_3() (REG32(ADR_F0_CIS_CONTENT_REG_3)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_4() (REG32(ADR_F0_CIS_CONTENT_REG_4)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_5() (REG32(ADR_F0_CIS_CONTENT_REG_5)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_6() (REG32(ADR_F0_CIS_CONTENT_REG_6)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_7() (REG32(ADR_F0_CIS_CONTENT_REG_7)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_8() (REG32(ADR_F0_CIS_CONTENT_REG_8)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_9() (REG32(ADR_F0_CIS_CONTENT_REG_9)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_10() (REG32(ADR_F0_CIS_CONTENT_REG_10)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_11() (REG32(ADR_F0_CIS_CONTENT_REG_11)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_12() (REG32(ADR_F0_CIS_CONTENT_REG_12)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_13() (REG32(ADR_F0_CIS_CONTENT_REG_13)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_14() (REG32(ADR_F0_CIS_CONTENT_REG_14)) = (0x00000000) ++#define DEF_F0_CIS_CONTENT_REG_15() (REG32(ADR_F0_CIS_CONTENT_REG_15)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_0() (REG32(ADR_F1_CIS_CONTENT_REG_0)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_1() (REG32(ADR_F1_CIS_CONTENT_REG_1)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_2() (REG32(ADR_F1_CIS_CONTENT_REG_2)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_3() (REG32(ADR_F1_CIS_CONTENT_REG_3)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_4() (REG32(ADR_F1_CIS_CONTENT_REG_4)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_5() (REG32(ADR_F1_CIS_CONTENT_REG_5)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_6() (REG32(ADR_F1_CIS_CONTENT_REG_6)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_7() (REG32(ADR_F1_CIS_CONTENT_REG_7)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_8() (REG32(ADR_F1_CIS_CONTENT_REG_8)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_9() (REG32(ADR_F1_CIS_CONTENT_REG_9)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_10() (REG32(ADR_F1_CIS_CONTENT_REG_10)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_11() (REG32(ADR_F1_CIS_CONTENT_REG_11)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_12() (REG32(ADR_F1_CIS_CONTENT_REG_12)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_13() (REG32(ADR_F1_CIS_CONTENT_REG_13)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_14() (REG32(ADR_F1_CIS_CONTENT_REG_14)) = (0x00000000) ++#define DEF_F1_CIS_CONTENT_REG_15() (REG32(ADR_F1_CIS_CONTENT_REG_15)) = (0x00000000) ++#define DEF_SPI_MODE() (REG32(ADR_SPI_MODE)) = (0x00000000) ++#define DEF_RX_QUOTA() (REG32(ADR_RX_QUOTA)) = (0x00000000) ++#define DEF_CONDITION_NUMBER() (REG32(ADR_CONDITION_NUMBER)) = (0x00000004) ++#define DEF_HOST_PATH() (REG32(ADR_HOST_PATH)) = (0x00000001) ++#define DEF_TX_SEG() (REG32(ADR_TX_SEG)) = (0x00000000) ++#define DEF_DEBUG_BURST_MODE() (REG32(ADR_DEBUG_BURST_MODE)) = (0x00000000) ++#define DEF_SPI_TO_PHY_PARAM1() (REG32(ADR_SPI_TO_PHY_PARAM1)) = (0x000e0006) ++#define DEF_SPI_TO_PHY_PARAM2() (REG32(ADR_SPI_TO_PHY_PARAM2)) = (0x000e000e) ++#define DEF_SPI_STS() (REG32(ADR_SPI_STS)) = (0x00000000) ++#define DEF_TX_ALLOC_SET() (REG32(ADR_TX_ALLOC_SET)) = (0x00000000) ++#define DEF_TX_ALLOC() (REG32(ADR_TX_ALLOC)) = (0x00000000) ++#define DEF_DBG_CNT() (REG32(ADR_DBG_CNT)) = (0x00000000) ++#define DEF_DBG_CNT2() (REG32(ADR_DBG_CNT2)) = (0x00000000) ++#define DEF_DBG_CNT3() (REG32(ADR_DBG_CNT3)) = (0x00000000) ++#define DEF_DBG_CNT4() (REG32(ADR_DBG_CNT4)) = (0x00000000) ++#define DEF_INT_TAG() (REG32(ADR_INT_TAG)) = (0x00000000) ++#define DEF_I2CM_EN() (REG32(ADR_I2CM_EN)) = (0x00000074) ++#define DEF_I2CM_DEV_A() (REG32(ADR_I2CM_DEV_A)) = (0x00008000) ++#define DEF_I2CM_LEN() (REG32(ADR_I2CM_LEN)) = (0x00000000) ++#define DEF_I2CM_WDAT() (REG32(ADR_I2CM_WDAT)) = (0x00000000) ++#define DEF_I2CM_RDAT() (REG32(ADR_I2CM_RDAT)) = (0x00000000) ++#define DEF_I2CM_EN_2() (REG32(ADR_I2CM_EN_2)) = (0x00010000) ++#define DEF_UART_DATA() (REG32(ADR_UART_DATA)) = (0x00000000) ++#define DEF_UART_IER() (REG32(ADR_UART_IER)) = (0x00000000) ++#define DEF_UART_FCR() (REG32(ADR_UART_FCR)) = (0x00000001) ++#define DEF_UART_LCR() (REG32(ADR_UART_LCR)) = (0x00000003) ++#define DEF_UART_MCR() (REG32(ADR_UART_MCR)) = (0x00000000) ++#define DEF_UART_LSR() (REG32(ADR_UART_LSR)) = (0x00000000) ++#define DEF_UART_MSR() (REG32(ADR_UART_MSR)) = (0x00000000) ++#define DEF_UART_SPR() (REG32(ADR_UART_SPR)) = (0x00000000) ++#define DEF_UART_RTHR() (REG32(ADR_UART_RTHR)) = (0x000000c8) ++#define DEF_UART_ISR() (REG32(ADR_UART_ISR)) = (0x000000c1) ++#define DEF_DAT_UART_DATA() (REG32(ADR_DAT_UART_DATA)) = (0x00000000) ++#define DEF_DAT_UART_IER() (REG32(ADR_DAT_UART_IER)) = (0x00000000) ++#define DEF_DAT_UART_FCR() (REG32(ADR_DAT_UART_FCR)) = (0x00000001) ++#define DEF_DAT_UART_LCR() (REG32(ADR_DAT_UART_LCR)) = (0x00000003) ++#define DEF_DAT_UART_MCR() (REG32(ADR_DAT_UART_MCR)) = (0x00000000) ++#define DEF_DAT_UART_LSR() (REG32(ADR_DAT_UART_LSR)) = (0x00000000) ++#define DEF_DAT_UART_MSR() (REG32(ADR_DAT_UART_MSR)) = (0x00000000) ++#define DEF_DAT_UART_SPR() (REG32(ADR_DAT_UART_SPR)) = (0x00000000) ++#define DEF_DAT_UART_RTHR() (REG32(ADR_DAT_UART_RTHR)) = (0x000000c8) ++#define DEF_DAT_UART_ISR() (REG32(ADR_DAT_UART_ISR)) = (0x000000c1) ++#define DEF_INT_MASK() (REG32(ADR_INT_MASK)) = (0xffffffff) ++#define DEF_INT_MODE() (REG32(ADR_INT_MODE)) = (0x00000000) ++#define DEF_INT_IRQ_STS() (REG32(ADR_INT_IRQ_STS)) = (0x00000000) ++#define DEF_INT_FIQ_STS() (REG32(ADR_INT_FIQ_STS)) = (0x00000000) ++#define DEF_INT_IRQ_RAW() (REG32(ADR_INT_IRQ_RAW)) = (0x00000000) ++#define DEF_INT_FIQ_RAW() (REG32(ADR_INT_FIQ_RAW)) = (0x00000000) ++#define DEF_INT_PERI_MASK() (REG32(ADR_INT_PERI_MASK)) = (0xffffffff) ++#define DEF_INT_PERI_STS() (REG32(ADR_INT_PERI_STS)) = (0x00000000) ++#define DEF_INT_PERI_RAW() (REG32(ADR_INT_PERI_RAW)) = (0x00000000) ++#define DEF_INT_GPI_CFG() (REG32(ADR_INT_GPI_CFG)) = (0x00000000) ++#define DEF_SYS_INT_FOR_HOST() (REG32(ADR_SYS_INT_FOR_HOST)) = (0x00000001) ++#define DEF_SPI_IPC() (REG32(ADR_SPI_IPC)) = (0x00000000) ++#define DEF_SDIO_IPC() (REG32(ADR_SDIO_IPC)) = (0x00000000) ++#define DEF_SDIO_MASK() (REG32(ADR_SDIO_MASK)) = (0xffffffff) ++#define DEF_SDIO_IRQ_STS() (REG32(ADR_SDIO_IRQ_STS)) = (0x00000000) ++#define DEF_SD_PERI_MASK() (REG32(ADR_SD_PERI_MASK)) = (0xffffffff) ++#define DEF_SD_PERI_STS() (REG32(ADR_SD_PERI_STS)) = (0x00000000) ++#define DEF_DBG_SPI_MODE() (REG32(ADR_DBG_SPI_MODE)) = (0x00000000) ++#define DEF_DBG_RX_QUOTA() (REG32(ADR_DBG_RX_QUOTA)) = (0x00000000) ++#define DEF_DBG_CONDITION_NUMBER() (REG32(ADR_DBG_CONDITION_NUMBER)) = (0x00000004) ++#define DEF_DBG_HOST_PATH() (REG32(ADR_DBG_HOST_PATH)) = (0x00000001) ++#define DEF_DBG_TX_SEG() (REG32(ADR_DBG_TX_SEG)) = (0x00000000) ++#define DEF_DBG_DEBUG_BURST_MODE() (REG32(ADR_DBG_DEBUG_BURST_MODE)) = (0x00000000) ++#define DEF_DBG_SPI_TO_PHY_PARAM1() (REG32(ADR_DBG_SPI_TO_PHY_PARAM1)) = (0x000e0006) ++#define DEF_DBG_SPI_TO_PHY_PARAM2() (REG32(ADR_DBG_SPI_TO_PHY_PARAM2)) = (0x000e000e) ++#define DEF_DBG_SPI_STS() (REG32(ADR_DBG_SPI_STS)) = (0x00000000) ++#define DEF_DBG_TX_ALLOC_SET() (REG32(ADR_DBG_TX_ALLOC_SET)) = (0x00000000) ++#define DEF_DBG_TX_ALLOC() (REG32(ADR_DBG_TX_ALLOC)) = (0x00000000) ++#define DEF_DBG_DBG_CNT() (REG32(ADR_DBG_DBG_CNT)) = (0x00000000) ++#define DEF_DBG_DBG_CNT2() (REG32(ADR_DBG_DBG_CNT2)) = (0x00000000) ++#define DEF_DBG_DBG_CNT3() (REG32(ADR_DBG_DBG_CNT3)) = (0x00000000) ++#define DEF_DBG_DBG_CNT4() (REG32(ADR_DBG_DBG_CNT4)) = (0x00000000) ++#define DEF_DBG_INT_TAG() (REG32(ADR_DBG_INT_TAG)) = (0x00000000) ++#define DEF_BOOT_ADDR() (REG32(ADR_BOOT_ADDR)) = (0x00000000) ++#define DEF_VERIFY_DATA() (REG32(ADR_VERIFY_DATA)) = (0x5e11aa11) ++#define DEF_FLASH_ADDR() (REG32(ADR_FLASH_ADDR)) = (0x00000000) ++#define DEF_SRAM_ADDR() (REG32(ADR_SRAM_ADDR)) = (0x00000000) ++#define DEF_LEN() (REG32(ADR_LEN)) = (0x00000000) ++#define DEF_SPI_PARAM() (REG32(ADR_SPI_PARAM)) = (0x000f000f) ++#define DEF_SPI_PARAM2() (REG32(ADR_SPI_PARAM2)) = (0x00040001) ++#define DEF_CHECK_SUM_RESULT() (REG32(ADR_CHECK_SUM_RESULT)) = (0x00000000) ++#define DEF_CHECK_SUM_IN_FILE() (REG32(ADR_CHECK_SUM_IN_FILE)) = (0x00000000) ++#define DEF_COMMAND_LEN() (REG32(ADR_COMMAND_LEN)) = (0x00000000) ++#define DEF_COMMAND_ADDR() (REG32(ADR_COMMAND_ADDR)) = (0x00000000) ++#define DEF_DMA_ADR_SRC() (REG32(ADR_DMA_ADR_SRC)) = (0x00000000) ++#define DEF_DMA_ADR_DST() (REG32(ADR_DMA_ADR_DST)) = (0x00000000) ++#define DEF_DMA_CTRL() (REG32(ADR_DMA_CTRL)) = (0x000000aa) ++#define DEF_DMA_INT() (REG32(ADR_DMA_INT)) = (0x00000001) ++#define DEF_DMA_FILL_CONST() (REG32(ADR_DMA_FILL_CONST)) = (0x00000000) ++#define DEF_PMU_0() (REG32(ADR_PMU_0)) = (0x0f000040) ++#define DEF_PMU_1() (REG32(ADR_PMU_1)) = (0x015d015d) ++#define DEF_PMU_2() (REG32(ADR_PMU_2)) = (0x00000000) ++#define DEF_PMU_3() (REG32(ADR_PMU_3)) = (0x55550000) ++#define DEF_RTC_1() (REG32(ADR_RTC_1)) = (0x7fff0000) ++#define DEF_RTC_2() (REG32(ADR_RTC_2)) = (0x00000003) ++#define DEF_RTC_3W() (REG32(ADR_RTC_3W)) = (0x00000000) ++#define DEF_RTC_3R() (REG32(ADR_RTC_3R)) = (0x00000000) ++#define DEF_RTC_4() (REG32(ADR_RTC_4)) = (0x00000000) ++#define DEF_D2_DMA_ADR_SRC() (REG32(ADR_D2_DMA_ADR_SRC)) = (0x00000000) ++#define DEF_D2_DMA_ADR_DST() (REG32(ADR_D2_DMA_ADR_DST)) = (0x00000000) ++#define DEF_D2_DMA_CTRL() (REG32(ADR_D2_DMA_CTRL)) = (0x000000aa) ++#define DEF_D2_DMA_INT() (REG32(ADR_D2_DMA_INT)) = (0x00000001) ++#define DEF_D2_DMA_FILL_CONST() (REG32(ADR_D2_DMA_FILL_CONST)) = (0x00000000) ++#define DEF_CONTROL() (REG32(ADR_CONTROL)) = (0x02700008) ++#define DEF_SDIO_WAKE_MODE() (REG32(ADR_SDIO_WAKE_MODE)) = (0x00000000) ++#define DEF_TX_FLOW_0() (REG32(ADR_TX_FLOW_0)) = (0x00000000) ++#define DEF_TX_FLOW_1() (REG32(ADR_TX_FLOW_1)) = (0x00000000) ++#define DEF_THREASHOLD() (REG32(ADR_THREASHOLD)) = (0x09000000) ++#define DEF_TXFID_INCREASE() (REG32(ADR_TXFID_INCREASE)) = (0x00000000) ++#define DEF_GLOBAL_SEQUENCE() (REG32(ADR_GLOBAL_SEQUENCE)) = (0x00000000) ++#define DEF_HCI_TX_RX_INFO_SIZE() (REG32(ADR_HCI_TX_RX_INFO_SIZE)) = (0x00040450) ++#define DEF_HCI_TX_INFO_CLEAR() (REG32(ADR_HCI_TX_INFO_CLEAR)) = (0x00000008) ++#define DEF_TX_ETHER_TYPE_0() (REG32(ADR_TX_ETHER_TYPE_0)) = (0x00000000) ++#define DEF_TX_ETHER_TYPE_1() (REG32(ADR_TX_ETHER_TYPE_1)) = (0x00000000) ++#define DEF_RX_ETHER_TYPE_0() (REG32(ADR_RX_ETHER_TYPE_0)) = (0x00000000) ++#define DEF_RX_ETHER_TYPE_1() (REG32(ADR_RX_ETHER_TYPE_1)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_0() (REG32(ADR_PACKET_COUNTER_INFO_0)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_1() (REG32(ADR_PACKET_COUNTER_INFO_1)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_2() (REG32(ADR_PACKET_COUNTER_INFO_2)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_3() (REG32(ADR_PACKET_COUNTER_INFO_3)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_4() (REG32(ADR_PACKET_COUNTER_INFO_4)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_5() (REG32(ADR_PACKET_COUNTER_INFO_5)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_6() (REG32(ADR_PACKET_COUNTER_INFO_6)) = (0x00000000) ++#define DEF_PACKET_COUNTER_INFO_7() (REG32(ADR_PACKET_COUNTER_INFO_7)) = (0x00000000) ++#define DEF_SDIO_TX_RX_FAIL_COUNTER_0() (REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_0)) = (0x00000000) ++#define DEF_SDIO_TX_RX_FAIL_COUNTER_1() (REG32(ADR_SDIO_TX_RX_FAIL_COUNTER_1)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_0() (REG32(ADR_HCI_STATE_DEBUG_MODE_0)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_1() (REG32(ADR_HCI_STATE_DEBUG_MODE_1)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_2() (REG32(ADR_HCI_STATE_DEBUG_MODE_2)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_3() (REG32(ADR_HCI_STATE_DEBUG_MODE_3)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_4() (REG32(ADR_HCI_STATE_DEBUG_MODE_4)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_5() (REG32(ADR_HCI_STATE_DEBUG_MODE_5)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_6() (REG32(ADR_HCI_STATE_DEBUG_MODE_6)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_7() (REG32(ADR_HCI_STATE_DEBUG_MODE_7)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_8() (REG32(ADR_HCI_STATE_DEBUG_MODE_8)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_9() (REG32(ADR_HCI_STATE_DEBUG_MODE_9)) = (0x00000000) ++#define DEF_HCI_STATE_DEBUG_MODE_10() (REG32(ADR_HCI_STATE_DEBUG_MODE_10)) = (0x00000000) ++#define DEF_CS_START_ADDR() (REG32(ADR_CS_START_ADDR)) = (0x00000000) ++#define DEF_CS_ADD_LEN() (REG32(ADR_CS_ADD_LEN)) = (0x00000000) ++#define DEF_CS_CMD() (REG32(ADR_CS_CMD)) = (0x00000000) ++#define DEF_CS_INI_BUF() (REG32(ADR_CS_INI_BUF)) = (0x00000000) ++#define DEF_CS_PSEUDO_BUF() (REG32(ADR_CS_PSEUDO_BUF)) = (0x00000000) ++#define DEF_CS_CHECK_SUM() (REG32(ADR_CS_CHECK_SUM)) = (0x00000000) ++#define DEF_RAND_EN() (REG32(ADR_RAND_EN)) = (0x00000000) ++#define DEF_RAND_NUM() (REG32(ADR_RAND_NUM)) = (0x00000000) ++#define DEF_MUL_OP1() (REG32(ADR_MUL_OP1)) = (0x00000000) ++#define DEF_MUL_OP2() (REG32(ADR_MUL_OP2)) = (0x00000000) ++#define DEF_MUL_ANS0() (REG32(ADR_MUL_ANS0)) = (0x00000000) ++#define DEF_MUL_ANS1() (REG32(ADR_MUL_ANS1)) = (0x00000000) ++#define DEF_DMA_RDATA() (REG32(ADR_DMA_RDATA)) = (0x00000000) ++#define DEF_DMA_WDATA() (REG32(ADR_DMA_WDATA)) = (0x00000000) ++#define DEF_DMA_LEN() (REG32(ADR_DMA_LEN)) = (0x00000000) ++#define DEF_DMA_CLR() (REG32(ADR_DMA_CLR)) = (0x00000000) ++#define DEF_NAV_DATA() (REG32(ADR_NAV_DATA)) = (0x00000000) ++#define DEF_CO_NAV() (REG32(ADR_CO_NAV)) = (0x00000000) ++#define DEF_SHA_DST_ADDR() (REG32(ADR_SHA_DST_ADDR)) = (0x00000000) ++#define DEF_SHA_SRC_ADDR() (REG32(ADR_SHA_SRC_ADDR)) = (0x00000000) ++#define DEF_SHA_SETTING() (REG32(ADR_SHA_SETTING)) = (0x00000002) ++#define DEF_EFUSE_CLK_FREQ() (REG32(ADR_EFUSE_CLK_FREQ)) = (0x610100d0) ++#define DEF_EFUSE_LDO_TIME() (REG32(ADR_EFUSE_LDO_TIME)) = (0x00020002) ++#define DEF_EFUSE_AHB_RDATA_0() (REG32(ADR_EFUSE_AHB_RDATA_0)) = (0x00000000) ++#define DEF_EFUSE_WDATA_0() (REG32(ADR_EFUSE_WDATA_0)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_1() (REG32(ADR_EFUSE_AHB_RDATA_1)) = (0x00000000) ++#define DEF_EFUSE_WDATA_1() (REG32(ADR_EFUSE_WDATA_1)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_2() (REG32(ADR_EFUSE_AHB_RDATA_2)) = (0x00000000) ++#define DEF_EFUSE_WDATA_2() (REG32(ADR_EFUSE_WDATA_2)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_3() (REG32(ADR_EFUSE_AHB_RDATA_3)) = (0x00000000) ++#define DEF_EFUSE_WDATA_3() (REG32(ADR_EFUSE_WDATA_3)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_4() (REG32(ADR_EFUSE_AHB_RDATA_4)) = (0x00000000) ++#define DEF_EFUSE_WDATA_4() (REG32(ADR_EFUSE_WDATA_4)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_5() (REG32(ADR_EFUSE_AHB_RDATA_5)) = (0x00000000) ++#define DEF_EFUSE_WDATA_5() (REG32(ADR_EFUSE_WDATA_5)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_6() (REG32(ADR_EFUSE_AHB_RDATA_6)) = (0x00000000) ++#define DEF_EFUSE_WDATA_6() (REG32(ADR_EFUSE_WDATA_6)) = (0x00000000) ++#define DEF_EFUSE_AHB_RDATA_7() (REG32(ADR_EFUSE_AHB_RDATA_7)) = (0x00000000) ++#define DEF_EFUSE_WDATA_7() (REG32(ADR_EFUSE_WDATA_7)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD0_EN() (REG32(ADR_EFUSE_SPI_RD0_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD1_EN() (REG32(ADR_EFUSE_SPI_RD1_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD2_EN() (REG32(ADR_EFUSE_SPI_RD2_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD3_EN() (REG32(ADR_EFUSE_SPI_RD3_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD4_EN() (REG32(ADR_EFUSE_SPI_RD4_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD5_EN() (REG32(ADR_EFUSE_SPI_RD5_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD6_EN() (REG32(ADR_EFUSE_SPI_RD6_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_RD7_EN() (REG32(ADR_EFUSE_SPI_RD7_EN)) = (0x00000000) ++#define DEF_EFUSE_SPI_BUSY() (REG32(ADR_EFUSE_SPI_BUSY)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_0() (REG32(ADR_EFUSE_SPI_RDATA_0)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_1() (REG32(ADR_EFUSE_SPI_RDATA_1)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_2() (REG32(ADR_EFUSE_SPI_RDATA_2)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_3() (REG32(ADR_EFUSE_SPI_RDATA_3)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_4() (REG32(ADR_EFUSE_SPI_RDATA_4)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_5() (REG32(ADR_EFUSE_SPI_RDATA_5)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_6() (REG32(ADR_EFUSE_SPI_RDATA_6)) = (0x00000000) ++#define DEF_EFUSE_SPI_RDATA_7() (REG32(ADR_EFUSE_SPI_RDATA_7)) = (0x00000000) ++#define DEF_SMS4_CFG1() (REG32(ADR_SMS4_CFG1)) = (0x00000002) ++#define DEF_SMS4_CFG2() (REG32(ADR_SMS4_CFG2)) = (0x00000000) ++#define DEF_SMS4_MODE1() (REG32(ADR_SMS4_MODE1)) = (0x00000000) ++#define DEF_SMS4_TRIG() (REG32(ADR_SMS4_TRIG)) = (0x00000000) ++#define DEF_SMS4_STATUS1() (REG32(ADR_SMS4_STATUS1)) = (0x00000000) ++#define DEF_SMS4_STATUS2() (REG32(ADR_SMS4_STATUS2)) = (0x00000000) ++#define DEF_SMS4_DATA_IN0() (REG32(ADR_SMS4_DATA_IN0)) = (0x00000000) ++#define DEF_SMS4_DATA_IN1() (REG32(ADR_SMS4_DATA_IN1)) = (0x00000000) ++#define DEF_SMS4_DATA_IN2() (REG32(ADR_SMS4_DATA_IN2)) = (0x00000000) ++#define DEF_SMS4_DATA_IN3() (REG32(ADR_SMS4_DATA_IN3)) = (0x00000000) ++#define DEF_SMS4_DATA_OUT0() (REG32(ADR_SMS4_DATA_OUT0)) = (0x00000000) ++#define DEF_SMS4_DATA_OUT1() (REG32(ADR_SMS4_DATA_OUT1)) = (0x00000000) ++#define DEF_SMS4_DATA_OUT2() (REG32(ADR_SMS4_DATA_OUT2)) = (0x00000000) ++#define DEF_SMS4_DATA_OUT3() (REG32(ADR_SMS4_DATA_OUT3)) = (0x00000000) ++#define DEF_SMS4_KEY_0() (REG32(ADR_SMS4_KEY_0)) = (0x00000000) ++#define DEF_SMS4_KEY_1() (REG32(ADR_SMS4_KEY_1)) = (0x00000000) ++#define DEF_SMS4_KEY_2() (REG32(ADR_SMS4_KEY_2)) = (0x00000000) ++#define DEF_SMS4_KEY_3() (REG32(ADR_SMS4_KEY_3)) = (0x00000000) ++#define DEF_SMS4_MODE_IV0() (REG32(ADR_SMS4_MODE_IV0)) = (0x00000000) ++#define DEF_SMS4_MODE_IV1() (REG32(ADR_SMS4_MODE_IV1)) = (0x00000000) ++#define DEF_SMS4_MODE_IV2() (REG32(ADR_SMS4_MODE_IV2)) = (0x00000000) ++#define DEF_SMS4_MODE_IV3() (REG32(ADR_SMS4_MODE_IV3)) = (0x00000000) ++#define DEF_SMS4_OFB_ENC0() (REG32(ADR_SMS4_OFB_ENC0)) = (0x00000000) ++#define DEF_SMS4_OFB_ENC1() (REG32(ADR_SMS4_OFB_ENC1)) = (0x00000000) ++#define DEF_SMS4_OFB_ENC2() (REG32(ADR_SMS4_OFB_ENC2)) = (0x00000000) ++#define DEF_SMS4_OFB_ENC3() (REG32(ADR_SMS4_OFB_ENC3)) = (0x00000000) ++#define DEF_MRX_MCAST_TB0_0() (REG32(ADR_MRX_MCAST_TB0_0)) = (0x00000000) ++#define DEF_MRX_MCAST_TB0_1() (REG32(ADR_MRX_MCAST_TB0_1)) = (0x00000000) ++#define DEF_MRX_MCAST_MK0_0() (REG32(ADR_MRX_MCAST_MK0_0)) = (0x00000000) ++#define DEF_MRX_MCAST_MK0_1() (REG32(ADR_MRX_MCAST_MK0_1)) = (0x00000000) ++#define DEF_MRX_MCAST_CTRL0() (REG32(ADR_MRX_MCAST_CTRL0)) = (0x00000000) ++#define DEF_MRX_MCAST_TB1_0() (REG32(ADR_MRX_MCAST_TB1_0)) = (0x00000000) ++#define DEF_MRX_MCAST_TB1_1() (REG32(ADR_MRX_MCAST_TB1_1)) = (0x00000000) ++#define DEF_MRX_MCAST_MK1_0() (REG32(ADR_MRX_MCAST_MK1_0)) = (0x00000000) ++#define DEF_MRX_MCAST_MK1_1() (REG32(ADR_MRX_MCAST_MK1_1)) = (0x00000000) ++#define DEF_MRX_MCAST_CTRL1() (REG32(ADR_MRX_MCAST_CTRL1)) = (0x00000000) ++#define DEF_MRX_MCAST_TB2_0() (REG32(ADR_MRX_MCAST_TB2_0)) = (0x00000000) ++#define DEF_MRX_MCAST_TB2_1() (REG32(ADR_MRX_MCAST_TB2_1)) = (0x00000000) ++#define DEF_MRX_MCAST_MK2_0() (REG32(ADR_MRX_MCAST_MK2_0)) = (0x00000000) ++#define DEF_MRX_MCAST_MK2_1() (REG32(ADR_MRX_MCAST_MK2_1)) = (0x00000000) ++#define DEF_MRX_MCAST_CTRL2() (REG32(ADR_MRX_MCAST_CTRL2)) = (0x00000000) ++#define DEF_MRX_MCAST_TB3_0() (REG32(ADR_MRX_MCAST_TB3_0)) = (0x00000000) ++#define DEF_MRX_MCAST_TB3_1() (REG32(ADR_MRX_MCAST_TB3_1)) = (0x00000000) ++#define DEF_MRX_MCAST_MK3_0() (REG32(ADR_MRX_MCAST_MK3_0)) = (0x00000000) ++#define DEF_MRX_MCAST_MK3_1() (REG32(ADR_MRX_MCAST_MK3_1)) = (0x00000000) ++#define DEF_MRX_MCAST_CTRL3() (REG32(ADR_MRX_MCAST_CTRL3)) = (0x00000000) ++#define DEF_MRX_PHY_INFO() (REG32(ADR_MRX_PHY_INFO)) = (0x00000000) ++#define DEF_MRX_BA_DBG() (REG32(ADR_MRX_BA_DBG)) = (0x00000000) ++#define DEF_MRX_FLT_TB0() (REG32(ADR_MRX_FLT_TB0)) = (0x00003df5) ++#define DEF_MRX_FLT_TB1() (REG32(ADR_MRX_FLT_TB1)) = (0x000031f6) ++#define DEF_MRX_FLT_TB2() (REG32(ADR_MRX_FLT_TB2)) = (0x000035f9) ++#define DEF_MRX_FLT_TB3() (REG32(ADR_MRX_FLT_TB3)) = (0x000021c1) ++#define DEF_MRX_FLT_TB4() (REG32(ADR_MRX_FLT_TB4)) = (0x00004bf9) ++#define DEF_MRX_FLT_TB5() (REG32(ADR_MRX_FLT_TB5)) = (0x00004db1) ++#define DEF_MRX_FLT_TB6() (REG32(ADR_MRX_FLT_TB6)) = (0x000011fe) ++#define DEF_MRX_FLT_TB7() (REG32(ADR_MRX_FLT_TB7)) = (0x00000bfe) ++#define DEF_MRX_FLT_TB8() (REG32(ADR_MRX_FLT_TB8)) = (0x00000000) ++#define DEF_MRX_FLT_TB9() (REG32(ADR_MRX_FLT_TB9)) = (0x00000000) ++#define DEF_MRX_FLT_TB10() (REG32(ADR_MRX_FLT_TB10)) = (0x00000000) ++#define DEF_MRX_FLT_TB11() (REG32(ADR_MRX_FLT_TB11)) = (0x00000006) ++#define DEF_MRX_FLT_TB12() (REG32(ADR_MRX_FLT_TB12)) = (0x00000001) ++#define DEF_MRX_FLT_TB13() (REG32(ADR_MRX_FLT_TB13)) = (0x00000003) ++#define DEF_MRX_FLT_TB14() (REG32(ADR_MRX_FLT_TB14)) = (0x00000005) ++#define DEF_MRX_FLT_TB15() (REG32(ADR_MRX_FLT_TB15)) = (0x00000007) ++#define DEF_MRX_FLT_EN0() (REG32(ADR_MRX_FLT_EN0)) = (0x00002008) ++#define DEF_MRX_FLT_EN1() (REG32(ADR_MRX_FLT_EN1)) = (0x00001001) ++#define DEF_MRX_FLT_EN2() (REG32(ADR_MRX_FLT_EN2)) = (0x00000808) ++#define DEF_MRX_FLT_EN3() (REG32(ADR_MRX_FLT_EN3)) = (0x00001000) ++#define DEF_MRX_FLT_EN4() (REG32(ADR_MRX_FLT_EN4)) = (0x00002008) ++#define DEF_MRX_FLT_EN5() (REG32(ADR_MRX_FLT_EN5)) = (0x0000800e) ++#define DEF_MRX_FLT_EN6() (REG32(ADR_MRX_FLT_EN6)) = (0x00000838) ++#define DEF_MRX_FLT_EN7() (REG32(ADR_MRX_FLT_EN7)) = (0x00002008) ++#define DEF_MRX_FLT_EN8() (REG32(ADR_MRX_FLT_EN8)) = (0x00002008) ++#define DEF_MRX_LEN_FLT() (REG32(ADR_MRX_LEN_FLT)) = (0x00000000) ++#define DEF_RX_FLOW_DATA() (REG32(ADR_RX_FLOW_DATA)) = (0x00105034) ++#define DEF_RX_FLOW_MNG() (REG32(ADR_RX_FLOW_MNG)) = (0x00000004) ++#define DEF_RX_FLOW_CTRL() (REG32(ADR_RX_FLOW_CTRL)) = (0x00000004) ++#define DEF_RX_TIME_STAMP_CFG() (REG32(ADR_RX_TIME_STAMP_CFG)) = (0x00001c00) ++#define DEF_DBG_FF_FULL() (REG32(ADR_DBG_FF_FULL)) = (0x00000000) ++#define DEF_DBG_WFF_FULL() (REG32(ADR_DBG_WFF_FULL)) = (0x00000000) ++#define DEF_DBG_MB_FULL() (REG32(ADR_DBG_MB_FULL)) = (0x00000000) ++#define DEF_BA_CTRL() (REG32(ADR_BA_CTRL)) = (0x00000008) ++#define DEF_BA_TA_0() (REG32(ADR_BA_TA_0)) = (0x00000000) ++#define DEF_BA_TA_1() (REG32(ADR_BA_TA_1)) = (0x00000000) ++#define DEF_BA_TID() (REG32(ADR_BA_TID)) = (0x00000000) ++#define DEF_BA_ST_SEQ() (REG32(ADR_BA_ST_SEQ)) = (0x00000000) ++#define DEF_BA_SB0() (REG32(ADR_BA_SB0)) = (0x00000000) ++#define DEF_BA_SB1() (REG32(ADR_BA_SB1)) = (0x00000000) ++#define DEF_MRX_WATCH_DOG() (REG32(ADR_MRX_WATCH_DOG)) = (0x0000ffff) ++#define DEF_ACK_GEN_EN() (REG32(ADR_ACK_GEN_EN)) = (0x00000000) ++#define DEF_ACK_GEN_PARA() (REG32(ADR_ACK_GEN_PARA)) = (0x00000000) ++#define DEF_ACK_GEN_RA_0() (REG32(ADR_ACK_GEN_RA_0)) = (0x00000000) ++#define DEF_ACK_GEN_RA_1() (REG32(ADR_ACK_GEN_RA_1)) = (0x00000000) ++#define DEF_MIB_LEN_FAIL() (REG32(ADR_MIB_LEN_FAIL)) = (0x00000000) ++#define DEF_TRAP_HW_ID() (REG32(ADR_TRAP_HW_ID)) = (0x00000000) ++#define DEF_ID_IN_USE() (REG32(ADR_ID_IN_USE)) = (0x00000000) ++#define DEF_MRX_ERR() (REG32(ADR_MRX_ERR)) = (0x00000000) ++#define DEF_WSID0_TID0_RX_SEQ() (REG32(ADR_WSID0_TID0_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID1_RX_SEQ() (REG32(ADR_WSID0_TID1_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID2_RX_SEQ() (REG32(ADR_WSID0_TID2_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID3_RX_SEQ() (REG32(ADR_WSID0_TID3_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID4_RX_SEQ() (REG32(ADR_WSID0_TID4_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID5_RX_SEQ() (REG32(ADR_WSID0_TID5_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID6_RX_SEQ() (REG32(ADR_WSID0_TID6_RX_SEQ)) = (0x00000000) ++#define DEF_WSID0_TID7_RX_SEQ() (REG32(ADR_WSID0_TID7_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID0_RX_SEQ() (REG32(ADR_WSID1_TID0_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID1_RX_SEQ() (REG32(ADR_WSID1_TID1_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID2_RX_SEQ() (REG32(ADR_WSID1_TID2_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID3_RX_SEQ() (REG32(ADR_WSID1_TID3_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID4_RX_SEQ() (REG32(ADR_WSID1_TID4_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID5_RX_SEQ() (REG32(ADR_WSID1_TID5_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID6_RX_SEQ() (REG32(ADR_WSID1_TID6_RX_SEQ)) = (0x00000000) ++#define DEF_WSID1_TID7_RX_SEQ() (REG32(ADR_WSID1_TID7_RX_SEQ)) = (0x00000000) ++#define DEF_HDR_ADDR_SEL() (REG32(ADR_HDR_ADDR_SEL)) = (0x00003e79) ++#define DEF_FRAME_TYPE_CNTR_SET() (REG32(ADR_FRAME_TYPE_CNTR_SET)) = (0x00000000) ++#define DEF_PHY_INFO() (REG32(ADR_PHY_INFO)) = (0x00000000) ++#define DEF_AMPDU_SIG() (REG32(ADR_AMPDU_SIG)) = (0x0000004e) ++#define DEF_MIB_AMPDU() (REG32(ADR_MIB_AMPDU)) = (0x00000000) ++#define DEF_LEN_FLT() (REG32(ADR_LEN_FLT)) = (0x00000000) ++#define DEF_MIB_DELIMITER() (REG32(ADR_MIB_DELIMITER)) = (0x00000000) ++#define DEF_MTX_INT_STS() (REG32(ADR_MTX_INT_STS)) = (0x00000000) ++#define DEF_MTX_INT_EN() (REG32(ADR_MTX_INT_EN)) = (0x00000000) ++#define DEF_MTX_MISC_EN() (REG32(ADR_MTX_MISC_EN)) = (0x00c00c00) ++#define DEF_MTX_EDCCA_TOUT() (REG32(ADR_MTX_EDCCA_TOUT)) = (0x00000200) ++#define DEF_MTX_BCN_INT_STS() (REG32(ADR_MTX_BCN_INT_STS)) = (0x00000000) ++#define DEF_MTX_BCN_EN_INT() (REG32(ADR_MTX_BCN_EN_INT)) = (0x00000000) ++#define DEF_MTX_BCN_EN_MISC() (REG32(ADR_MTX_BCN_EN_MISC)) = (0x00000042) ++#define DEF_MTX_BCN_MISC() (REG32(ADR_MTX_BCN_MISC)) = (0x00000000) ++#define DEF_MTX_BCN_PRD() (REG32(ADR_MTX_BCN_PRD)) = (0x00000064) ++#define DEF_MTX_BCN_TSF_L() (REG32(ADR_MTX_BCN_TSF_L)) = (0x00000000) ++#define DEF_MTX_BCN_TSF_U() (REG32(ADR_MTX_BCN_TSF_U)) = (0x00000000) ++#define DEF_MTX_BCN_CFG0() (REG32(ADR_MTX_BCN_CFG0)) = (0x00000000) ++#define DEF_MTX_BCN_CFG1() (REG32(ADR_MTX_BCN_CFG1)) = (0x00000000) ++#define DEF_MTX_STATUS() (REG32(ADR_MTX_STATUS)) = (0x00000000) ++#define DEF_MTX_DBG_CTRL() (REG32(ADR_MTX_DBG_CTRL)) = (0x00000000) ++#define DEF_MTX_DBG_DAT0() (REG32(ADR_MTX_DBG_DAT0)) = (0x00000000) ++#define DEF_MTX_DBG_DAT1() (REG32(ADR_MTX_DBG_DAT1)) = (0x00000000) ++#define DEF_MTX_DBG_DAT2() (REG32(ADR_MTX_DBG_DAT2)) = (0x00000000) ++#define DEF_MTX_DUR_TOUT() (REG32(ADR_MTX_DUR_TOUT)) = (0x00002c2c) ++#define DEF_MTX_DUR_IFS() (REG32(ADR_MTX_DUR_IFS)) = (0x12d40a05) ++#define DEF_MTX_DUR_SIFS_G() (REG32(ADR_MTX_DUR_SIFS_G)) = (0x12c90100) ++#define DEF_MTX_DBG_DAT3() (REG32(ADR_MTX_DBG_DAT3)) = (0x00000000) ++#define DEF_MTX_NAV() (REG32(ADR_MTX_NAV)) = (0x00000000) ++#define DEF_MTX_MIB_WSID0() (REG32(ADR_MTX_MIB_WSID0)) = (0x00000000) ++#define DEF_MTX_MIB_WSID1() (REG32(ADR_MTX_MIB_WSID1)) = (0x00000000) ++#define DEF_MTX_DBG_DAT4() (REG32(ADR_MTX_DBG_DAT4)) = (0x00000000) ++#define DEF_TXQ0_MTX_Q_MISC_EN() (REG32(ADR_TXQ0_MTX_Q_MISC_EN)) = (0x00000000) ++#define DEF_TXQ0_MTX_Q_AIFSN() (REG32(ADR_TXQ0_MTX_Q_AIFSN)) = (0x0000a502) ++#define DEF_TXQ0_MTX_Q_BKF_CNT() (REG32(ADR_TXQ0_MTX_Q_BKF_CNT)) = (0x00000000) ++#define DEF_TXQ0_MTX_Q_RC_LIMIT() (REG32(ADR_TXQ0_MTX_Q_RC_LIMIT)) = (0x00000407) ++#define DEF_TXQ0_MTX_Q_ID_MAP_L() (REG32(ADR_TXQ0_MTX_Q_ID_MAP_L)) = (0x00000000) ++#define DEF_TXQ0_MTX_Q_TXOP_CH_THD() (REG32(ADR_TXQ0_MTX_Q_TXOP_CH_THD)) = (0x00000000) ++#define DEF_TXQ0_MTX_Q_TXOP_OV_THD() (REG32(ADR_TXQ0_MTX_Q_TXOP_OV_THD)) = (0x00000000) ++#define DEF_TXQ1_MTX_Q_MISC_EN() (REG32(ADR_TXQ1_MTX_Q_MISC_EN)) = (0x00000000) ++#define DEF_TXQ1_MTX_Q_AIFSN() (REG32(ADR_TXQ1_MTX_Q_AIFSN)) = (0x0000a502) ++#define DEF_TXQ1_MTX_Q_BKF_CNT() (REG32(ADR_TXQ1_MTX_Q_BKF_CNT)) = (0x00000000) ++#define DEF_TXQ1_MTX_Q_RC_LIMIT() (REG32(ADR_TXQ1_MTX_Q_RC_LIMIT)) = (0x00000407) ++#define DEF_TXQ1_MTX_Q_ID_MAP_L() (REG32(ADR_TXQ1_MTX_Q_ID_MAP_L)) = (0x00000000) ++#define DEF_TXQ1_MTX_Q_TXOP_CH_THD() (REG32(ADR_TXQ1_MTX_Q_TXOP_CH_THD)) = (0x00000000) ++#define DEF_TXQ1_MTX_Q_TXOP_OV_THD() (REG32(ADR_TXQ1_MTX_Q_TXOP_OV_THD)) = (0x00000000) ++#define DEF_TXQ2_MTX_Q_MISC_EN() (REG32(ADR_TXQ2_MTX_Q_MISC_EN)) = (0x00000000) ++#define DEF_TXQ2_MTX_Q_AIFSN() (REG32(ADR_TXQ2_MTX_Q_AIFSN)) = (0x0000a502) ++#define DEF_TXQ2_MTX_Q_BKF_CNT() (REG32(ADR_TXQ2_MTX_Q_BKF_CNT)) = (0x00000000) ++#define DEF_TXQ2_MTX_Q_RC_LIMIT() (REG32(ADR_TXQ2_MTX_Q_RC_LIMIT)) = (0x00000407) ++#define DEF_TXQ2_MTX_Q_ID_MAP_L() (REG32(ADR_TXQ2_MTX_Q_ID_MAP_L)) = (0x00000000) ++#define DEF_TXQ2_MTX_Q_TXOP_CH_THD() (REG32(ADR_TXQ2_MTX_Q_TXOP_CH_THD)) = (0x00000000) ++#define DEF_TXQ2_MTX_Q_TXOP_OV_THD() (REG32(ADR_TXQ2_MTX_Q_TXOP_OV_THD)) = (0x00000000) ++#define DEF_TXQ3_MTX_Q_MISC_EN() (REG32(ADR_TXQ3_MTX_Q_MISC_EN)) = (0x00000000) ++#define DEF_TXQ3_MTX_Q_AIFSN() (REG32(ADR_TXQ3_MTX_Q_AIFSN)) = (0x0000a502) ++#define DEF_TXQ3_MTX_Q_BKF_CNT() (REG32(ADR_TXQ3_MTX_Q_BKF_CNT)) = (0x00000000) ++#define DEF_TXQ3_MTX_Q_RC_LIMIT() (REG32(ADR_TXQ3_MTX_Q_RC_LIMIT)) = (0x00000407) ++#define DEF_TXQ3_MTX_Q_ID_MAP_L() (REG32(ADR_TXQ3_MTX_Q_ID_MAP_L)) = (0x00000000) ++#define DEF_TXQ3_MTX_Q_TXOP_CH_THD() (REG32(ADR_TXQ3_MTX_Q_TXOP_CH_THD)) = (0x00000000) ++#define DEF_TXQ3_MTX_Q_TXOP_OV_THD() (REG32(ADR_TXQ3_MTX_Q_TXOP_OV_THD)) = (0x00000000) ++#define DEF_TXQ4_MTX_Q_MISC_EN() (REG32(ADR_TXQ4_MTX_Q_MISC_EN)) = (0x00000000) ++#define DEF_TXQ4_MTX_Q_AIFSN() (REG32(ADR_TXQ4_MTX_Q_AIFSN)) = (0x0000a502) ++#define DEF_TXQ4_MTX_Q_BKF_CNT() (REG32(ADR_TXQ4_MTX_Q_BKF_CNT)) = (0x00000000) ++#define DEF_TXQ4_MTX_Q_RC_LIMIT() (REG32(ADR_TXQ4_MTX_Q_RC_LIMIT)) = (0x00000407) ++#define DEF_TXQ4_MTX_Q_ID_MAP_L() (REG32(ADR_TXQ4_MTX_Q_ID_MAP_L)) = (0x00000000) ++#define DEF_TXQ4_MTX_Q_TXOP_CH_THD() (REG32(ADR_TXQ4_MTX_Q_TXOP_CH_THD)) = (0x00000000) ++#define DEF_TXQ4_MTX_Q_TXOP_OV_THD() (REG32(ADR_TXQ4_MTX_Q_TXOP_OV_THD)) = (0x00000000) ++#define DEF_WSID0() (REG32(ADR_WSID0)) = (0x00000000) ++#define DEF_PEER_MAC0_0() (REG32(ADR_PEER_MAC0_0)) = (0x00000000) ++#define DEF_PEER_MAC0_1() (REG32(ADR_PEER_MAC0_1)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_0() (REG32(ADR_TX_ACK_POLICY_0_0)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_0() (REG32(ADR_TX_SEQ_CTRL_0_0)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_1() (REG32(ADR_TX_ACK_POLICY_0_1)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_1() (REG32(ADR_TX_SEQ_CTRL_0_1)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_2() (REG32(ADR_TX_ACK_POLICY_0_2)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_2() (REG32(ADR_TX_SEQ_CTRL_0_2)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_3() (REG32(ADR_TX_ACK_POLICY_0_3)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_3() (REG32(ADR_TX_SEQ_CTRL_0_3)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_4() (REG32(ADR_TX_ACK_POLICY_0_4)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_4() (REG32(ADR_TX_SEQ_CTRL_0_4)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_5() (REG32(ADR_TX_ACK_POLICY_0_5)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_5() (REG32(ADR_TX_SEQ_CTRL_0_5)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_6() (REG32(ADR_TX_ACK_POLICY_0_6)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_6() (REG32(ADR_TX_SEQ_CTRL_0_6)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_0_7() (REG32(ADR_TX_ACK_POLICY_0_7)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_0_7() (REG32(ADR_TX_SEQ_CTRL_0_7)) = (0x00000000) ++#define DEF_WSID1() (REG32(ADR_WSID1)) = (0x00000000) ++#define DEF_PEER_MAC1_0() (REG32(ADR_PEER_MAC1_0)) = (0x00000000) ++#define DEF_PEER_MAC1_1() (REG32(ADR_PEER_MAC1_1)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_0() (REG32(ADR_TX_ACK_POLICY_1_0)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_0() (REG32(ADR_TX_SEQ_CTRL_1_0)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_1() (REG32(ADR_TX_ACK_POLICY_1_1)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_1() (REG32(ADR_TX_SEQ_CTRL_1_1)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_2() (REG32(ADR_TX_ACK_POLICY_1_2)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_2() (REG32(ADR_TX_SEQ_CTRL_1_2)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_3() (REG32(ADR_TX_ACK_POLICY_1_3)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_3() (REG32(ADR_TX_SEQ_CTRL_1_3)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_4() (REG32(ADR_TX_ACK_POLICY_1_4)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_4() (REG32(ADR_TX_SEQ_CTRL_1_4)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_5() (REG32(ADR_TX_ACK_POLICY_1_5)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_5() (REG32(ADR_TX_SEQ_CTRL_1_5)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_6() (REG32(ADR_TX_ACK_POLICY_1_6)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_6() (REG32(ADR_TX_SEQ_CTRL_1_6)) = (0x00000000) ++#define DEF_TX_ACK_POLICY_1_7() (REG32(ADR_TX_ACK_POLICY_1_7)) = (0x00000000) ++#define DEF_TX_SEQ_CTRL_1_7() (REG32(ADR_TX_SEQ_CTRL_1_7)) = (0x00000000) ++#define DEF_INFO0() (REG32(ADR_INFO0)) = (0x00000000) ++#define DEF_INFO1() (REG32(ADR_INFO1)) = (0x00000100) ++#define DEF_INFO2() (REG32(ADR_INFO2)) = (0x00000200) ++#define DEF_INFO3() (REG32(ADR_INFO3)) = (0x00000300) ++#define DEF_INFO4() (REG32(ADR_INFO4)) = (0x00000140) ++#define DEF_INFO5() (REG32(ADR_INFO5)) = (0x00000240) ++#define DEF_INFO6() (REG32(ADR_INFO6)) = (0x00000340) ++#define DEF_INFO7() (REG32(ADR_INFO7)) = (0x00000001) ++#define DEF_INFO8() (REG32(ADR_INFO8)) = (0x00000101) ++#define DEF_INFO9() (REG32(ADR_INFO9)) = (0x00000201) ++#define DEF_INFO10() (REG32(ADR_INFO10)) = (0x00000301) ++#define DEF_INFO11() (REG32(ADR_INFO11)) = (0x00000401) ++#define DEF_INFO12() (REG32(ADR_INFO12)) = (0x00000501) ++#define DEF_INFO13() (REG32(ADR_INFO13)) = (0x00000601) ++#define DEF_INFO14() (REG32(ADR_INFO14)) = (0x00000701) ++#define DEF_INFO15() (REG32(ADR_INFO15)) = (0x00030002) ++#define DEF_INFO16() (REG32(ADR_INFO16)) = (0x00030102) ++#define DEF_INFO17() (REG32(ADR_INFO17)) = (0x00030202) ++#define DEF_INFO18() (REG32(ADR_INFO18)) = (0x00030302) ++#define DEF_INFO19() (REG32(ADR_INFO19)) = (0x00030402) ++#define DEF_INFO20() (REG32(ADR_INFO20)) = (0x00030502) ++#define DEF_INFO21() (REG32(ADR_INFO21)) = (0x00030602) ++#define DEF_INFO22() (REG32(ADR_INFO22)) = (0x00030702) ++#define DEF_INFO23() (REG32(ADR_INFO23)) = (0x00030082) ++#define DEF_INFO24() (REG32(ADR_INFO24)) = (0x00030182) ++#define DEF_INFO25() (REG32(ADR_INFO25)) = (0x00030282) ++#define DEF_INFO26() (REG32(ADR_INFO26)) = (0x00030382) ++#define DEF_INFO27() (REG32(ADR_INFO27)) = (0x00030482) ++#define DEF_INFO28() (REG32(ADR_INFO28)) = (0x00030582) ++#define DEF_INFO29() (REG32(ADR_INFO29)) = (0x00030682) ++#define DEF_INFO30() (REG32(ADR_INFO30)) = (0x00030782) ++#define DEF_INFO31() (REG32(ADR_INFO31)) = (0x00030042) ++#define DEF_INFO32() (REG32(ADR_INFO32)) = (0x00030142) ++#define DEF_INFO33() (REG32(ADR_INFO33)) = (0x00030242) ++#define DEF_INFO34() (REG32(ADR_INFO34)) = (0x00030342) ++#define DEF_INFO35() (REG32(ADR_INFO35)) = (0x00030442) ++#define DEF_INFO36() (REG32(ADR_INFO36)) = (0x00030542) ++#define DEF_INFO37() (REG32(ADR_INFO37)) = (0x00030642) ++#define DEF_INFO38() (REG32(ADR_INFO38)) = (0x00030742) ++#define DEF_INFO_MASK() (REG32(ADR_INFO_MASK)) = (0x00007fc7) ++#define DEF_INFO_RATE_OFFSET() (REG32(ADR_INFO_RATE_OFFSET)) = (0x00040000) ++#define DEF_INFO_IDX_ADDR() (REG32(ADR_INFO_IDX_ADDR)) = (0x00000000) ++#define DEF_INFO_LEN_ADDR() (REG32(ADR_INFO_LEN_ADDR)) = (0x00000000) ++#define DEF_IC_TIME_TAG_0() (REG32(ADR_IC_TIME_TAG_0)) = (0x00000000) ++#define DEF_IC_TIME_TAG_1() (REG32(ADR_IC_TIME_TAG_1)) = (0x00000000) ++#define DEF_PACKET_ID_ALLOCATION_PRIORITY() (REG32(ADR_PACKET_ID_ALLOCATION_PRIORITY)) = (0x00000000) ++#define DEF_MAC_MODE() (REG32(ADR_MAC_MODE)) = (0x00000000) ++#define DEF_ALL_SOFTWARE_RESET() (REG32(ADR_ALL_SOFTWARE_RESET)) = (0x00000000) ++#define DEF_ENG_SOFTWARE_RESET() (REG32(ADR_ENG_SOFTWARE_RESET)) = (0x00000000) ++#define DEF_CSR_SOFTWARE_RESET() (REG32(ADR_CSR_SOFTWARE_RESET)) = (0x00000000) ++#define DEF_MAC_CLOCK_ENABLE() (REG32(ADR_MAC_CLOCK_ENABLE)) = (0x00003efb) ++#define DEF_MAC_ENGINE_CLOCK_ENABLE() (REG32(ADR_MAC_ENGINE_CLOCK_ENABLE)) = (0x0000f07b) ++#define DEF_MAC_CSR_CLOCK_ENABLE() (REG32(ADR_MAC_CSR_CLOCK_ENABLE)) = (0x0000ec02) ++#define DEF_GLBLE_SET() (REG32(ADR_GLBLE_SET)) = (0x000e5000) ++#define DEF_REASON_TRAP0() (REG32(ADR_REASON_TRAP0)) = (0x00000000) ++#define DEF_REASON_TRAP1() (REG32(ADR_REASON_TRAP1)) = (0x00000000) ++#define DEF_BSSID_0() (REG32(ADR_BSSID_0)) = (0x00000000) ++#define DEF_BSSID_1() (REG32(ADR_BSSID_1)) = (0x00000000) ++#define DEF_SCRT_STATE() (REG32(ADR_SCRT_STATE)) = (0x00000000) ++#define DEF_STA_MAC_0() (REG32(ADR_STA_MAC_0)) = (0x00000000) ++#define DEF_STA_MAC_1() (REG32(ADR_STA_MAC_1)) = (0x00000000) ++#define DEF_SCRT_SET() (REG32(ADR_SCRT_SET)) = (0x00000000) ++#define DEF_BTCX0() (REG32(ADR_BTCX0)) = (0x00000006) ++#define DEF_BTCX1() (REG32(ADR_BTCX1)) = (0x00000000) ++#define DEF_SWITCH_CTL() (REG32(ADR_SWITCH_CTL)) = (0x00000000) ++#define DEF_MIB_EN() (REG32(ADR_MIB_EN)) = (0x00000000) ++#define DEF_MTX_WSID0_SUCC() (REG32(ADR_MTX_WSID0_SUCC)) = (0x00000000) ++#define DEF_MTX_WSID0_FRM() (REG32(ADR_MTX_WSID0_FRM)) = (0x00000000) ++#define DEF_MTX_WSID0_RETRY() (REG32(ADR_MTX_WSID0_RETRY)) = (0x00000000) ++#define DEF_MTX_WSID0_TOTAL() (REG32(ADR_MTX_WSID0_TOTAL)) = (0x00000000) ++#define DEF_MTX_GROUP() (REG32(ADR_MTX_GROUP)) = (0x00000000) ++#define DEF_MTX_FAIL() (REG32(ADR_MTX_FAIL)) = (0x00000000) ++#define DEF_MTX_RETRY() (REG32(ADR_MTX_RETRY)) = (0x00000000) ++#define DEF_MTX_MULTI_RETRY() (REG32(ADR_MTX_MULTI_RETRY)) = (0x00000000) ++#define DEF_MTX_RTS_SUCCESS() (REG32(ADR_MTX_RTS_SUCCESS)) = (0x00000000) ++#define DEF_MTX_RTS_FAIL() (REG32(ADR_MTX_RTS_FAIL)) = (0x00000000) ++#define DEF_MTX_ACK_FAIL() (REG32(ADR_MTX_ACK_FAIL)) = (0x00000000) ++#define DEF_MTX_FRM() (REG32(ADR_MTX_FRM)) = (0x00000000) ++#define DEF_MTX_ACK_TX() (REG32(ADR_MTX_ACK_TX)) = (0x00000000) ++#define DEF_MTX_CTS_TX() (REG32(ADR_MTX_CTS_TX)) = (0x00000000) ++#define DEF_MRX_DUP_FRM() (REG32(ADR_MRX_DUP_FRM)) = (0x00000000) ++#define DEF_MRX_FRG_FRM() (REG32(ADR_MRX_FRG_FRM)) = (0x00000000) ++#define DEF_MRX_GROUP_FRM() (REG32(ADR_MRX_GROUP_FRM)) = (0x00000000) ++#define DEF_MRX_FCS_ERR() (REG32(ADR_MRX_FCS_ERR)) = (0x00000000) ++#define DEF_MRX_FCS_SUCC() (REG32(ADR_MRX_FCS_SUCC)) = (0x00000000) ++#define DEF_MRX_MISS() (REG32(ADR_MRX_MISS)) = (0x00000000) ++#define DEF_MRX_ALC_FAIL() (REG32(ADR_MRX_ALC_FAIL)) = (0x00000000) ++#define DEF_MRX_DAT_NTF() (REG32(ADR_MRX_DAT_NTF)) = (0x00000000) ++#define DEF_MRX_RTS_NTF() (REG32(ADR_MRX_RTS_NTF)) = (0x00000000) ++#define DEF_MRX_CTS_NTF() (REG32(ADR_MRX_CTS_NTF)) = (0x00000000) ++#define DEF_MRX_ACK_NTF() (REG32(ADR_MRX_ACK_NTF)) = (0x00000000) ++#define DEF_MRX_BA_NTF() (REG32(ADR_MRX_BA_NTF)) = (0x00000000) ++#define DEF_MRX_DATA_NTF() (REG32(ADR_MRX_DATA_NTF)) = (0x00000000) ++#define DEF_MRX_MNG_NTF() (REG32(ADR_MRX_MNG_NTF)) = (0x00000000) ++#define DEF_MRX_DAT_CRC_NTF() (REG32(ADR_MRX_DAT_CRC_NTF)) = (0x00000000) ++#define DEF_MRX_BAR_NTF() (REG32(ADR_MRX_BAR_NTF)) = (0x00000000) ++#define DEF_MRX_MB_MISS() (REG32(ADR_MRX_MB_MISS)) = (0x00000000) ++#define DEF_MRX_NIDLE_MISS() (REG32(ADR_MRX_NIDLE_MISS)) = (0x00000000) ++#define DEF_MRX_CSR_NTF() (REG32(ADR_MRX_CSR_NTF)) = (0x00000000) ++#define DEF_DBG_Q0_FRM_SUCCESS() (REG32(ADR_DBG_Q0_FRM_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q0_FRM_FAIL() (REG32(ADR_DBG_Q0_FRM_FAIL)) = (0x00000000) ++#define DEF_DBG_Q0_ACK_SUCCESS() (REG32(ADR_DBG_Q0_ACK_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q0_ACK_FAIL() (REG32(ADR_DBG_Q0_ACK_FAIL)) = (0x00000000) ++#define DEF_DBG_Q1_FRM_SUCCESS() (REG32(ADR_DBG_Q1_FRM_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q1_FRM_FAIL() (REG32(ADR_DBG_Q1_FRM_FAIL)) = (0x00000000) ++#define DEF_DBG_Q1_ACK_SUCCESS() (REG32(ADR_DBG_Q1_ACK_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q1_ACK_FAIL() (REG32(ADR_DBG_Q1_ACK_FAIL)) = (0x00000000) ++#define DEF_DBG_Q2_FRM_SUCCESS() (REG32(ADR_DBG_Q2_FRM_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q2_FRM_FAIL() (REG32(ADR_DBG_Q2_FRM_FAIL)) = (0x00000000) ++#define DEF_DBG_Q2_ACK_SUCCESS() (REG32(ADR_DBG_Q2_ACK_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q2_ACK_FAIL() (REG32(ADR_DBG_Q2_ACK_FAIL)) = (0x00000000) ++#define DEF_DBG_Q3_FRM_SUCCESS() (REG32(ADR_DBG_Q3_FRM_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q3_FRM_FAIL() (REG32(ADR_DBG_Q3_FRM_FAIL)) = (0x00000000) ++#define DEF_DBG_Q3_ACK_SUCCESS() (REG32(ADR_DBG_Q3_ACK_SUCCESS)) = (0x00000000) ++#define DEF_DBG_Q3_ACK_FAIL() (REG32(ADR_DBG_Q3_ACK_FAIL)) = (0x00000000) ++#define DEF_MIB_SCRT_TKIP0() (REG32(ADR_MIB_SCRT_TKIP0)) = (0x00000000) ++#define DEF_MIB_SCRT_TKIP1() (REG32(ADR_MIB_SCRT_TKIP1)) = (0x00000000) ++#define DEF_MIB_SCRT_TKIP2() (REG32(ADR_MIB_SCRT_TKIP2)) = (0x00000000) ++#define DEF_MIB_SCRT_CCMP0() (REG32(ADR_MIB_SCRT_CCMP0)) = (0x00000000) ++#define DEF_MIB_SCRT_CCMP1() (REG32(ADR_MIB_SCRT_CCMP1)) = (0x00000000) ++#define DEF_DBG_LEN_CRC_FAIL() (REG32(ADR_DBG_LEN_CRC_FAIL)) = (0x00000000) ++#define DEF_DBG_LEN_ALC_FAIL() (REG32(ADR_DBG_LEN_ALC_FAIL)) = (0x00000000) ++#define DEF_DBG_AMPDU_PASS() (REG32(ADR_DBG_AMPDU_PASS)) = (0x00000000) ++#define DEF_DBG_AMPDU_FAIL() (REG32(ADR_DBG_AMPDU_FAIL)) = (0x00000000) ++#define DEF_ID_ALC_FAIL1() (REG32(ADR_ID_ALC_FAIL1)) = (0x00000000) ++#define DEF_ID_ALC_FAIL2() (REG32(ADR_ID_ALC_FAIL2)) = (0x00000000) ++#define DEF_CBR_HARD_WIRE_PIN_REGISTER() (REG32(ADR_CBR_HARD_WIRE_PIN_REGISTER)) = (0x00004000) ++#define DEF_CBR_MANUAL_ENABLE_REGISTER() (REG32(ADR_CBR_MANUAL_ENABLE_REGISTER)) = (0x00001fc0) ++#define DEF_CBR_LDO_REGISTER() (REG32(ADR_CBR_LDO_REGISTER)) = (0x2496db1b) ++#define DEF_CBR_ABB_REGISTER_1() (REG32(ADR_CBR_ABB_REGISTER_1)) = (0x151558dd) ++#define DEF_CBR_ABB_REGISTER_2() (REG32(ADR_CBR_ABB_REGISTER_2)) = (0x01011a88) ++#define DEF_CBR_TX_FE_REGISTER() (REG32(ADR_CBR_TX_FE_REGISTER)) = (0x3cbe84fe) ++#define DEF_CBR_RX_FE_REGISTER_1() (REG32(ADR_CBR_RX_FE_REGISTER_1)) = (0x00657579) ++#define DEF_CBR_RX_FE_GAIN_DECODER_REGISTER_1() (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_1)) = (0x000103a7) ++#define DEF_CBR_RX_FE_GAIN_DECODER_REGISTER_2() (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_2)) = (0x000103a6) ++#define DEF_CBR_RX_FE_GAIN_DECODER_REGISTER_3() (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_3)) = (0x00012001) ++#define DEF_CBR_RX_FE_GAIN_DECODER_REGISTER_4() (REG32(ADR_CBR_RX_FE_GAIN_DECODER_REGISTER_4)) = (0x00036000) ++#define DEF_CBR_RX_FSM_REGISTER() (REG32(ADR_CBR_RX_FSM_REGISTER)) = (0x00000ca8) ++#define DEF_CBR_RX_ADC_REGISTER() (REG32(ADR_CBR_RX_ADC_REGISTER)) = (0x002a0224) ++#define DEF_CBR_TX_DAC_REGISTER() (REG32(ADR_CBR_TX_DAC_REGISTER)) = (0x00002655) ++#define DEF_CBR_SX_ENABLE_RGISTER() (REG32(ADR_CBR_SX_ENABLE_RGISTER)) = (0x0000647c) ++#define DEF_CBR_SYN_RGISTER_1() (REG32(ADR_CBR_SYN_RGISTER_1)) = (0xaa800000) ++#define DEF_CBR_SYN_RGISTER_2() (REG32(ADR_CBR_SYN_RGISTER_2)) = (0x00550800) ++#define DEF_CBR_SYN_PFD_CHP() (REG32(ADR_CBR_SYN_PFD_CHP)) = (0x07c0894a) ++#define DEF_CBR_SYN_VCO_LOBF() (REG32(ADR_CBR_SYN_VCO_LOBF)) = (0xfcccca27) ++#define DEF_CBR_SYN_DIV_SDM_XOSC() (REG32(ADR_CBR_SYN_DIV_SDM_XOSC)) = (0x2773c93c) ++#define DEF_CBR_SYN_LCK1() (REG32(ADR_CBR_SYN_LCK1)) = (0x00000a7c) ++#define DEF_CBR_SYN_LCK2() (REG32(ADR_CBR_SYN_LCK2)) = (0x01c67ff4) ++#define DEF_CBR_DPLL_VCO_REGISTER() (REG32(ADR_CBR_DPLL_VCO_REGISTER)) = (0x00103014) ++#define DEF_CBR_DPLL_CP_PFD_REGISTER() (REG32(ADR_CBR_DPLL_CP_PFD_REGISTER)) = (0x0001848c) ++#define DEF_CBR_DPLL_DIVIDER_REGISTER() (REG32(ADR_CBR_DPLL_DIVIDER_REGISTER)) = (0x034061e0) ++#define DEF_CBR_DCOC_IDAC_REGISTER1() (REG32(ADR_CBR_DCOC_IDAC_REGISTER1)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER2() (REG32(ADR_CBR_DCOC_IDAC_REGISTER2)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER3() (REG32(ADR_CBR_DCOC_IDAC_REGISTER3)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER4() (REG32(ADR_CBR_DCOC_IDAC_REGISTER4)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER5() (REG32(ADR_CBR_DCOC_IDAC_REGISTER5)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER6() (REG32(ADR_CBR_DCOC_IDAC_REGISTER6)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER7() (REG32(ADR_CBR_DCOC_IDAC_REGISTER7)) = (0x00820820) ++#define DEF_CBR_DCOC_IDAC_REGISTER8() (REG32(ADR_CBR_DCOC_IDAC_REGISTER8)) = (0x00820820) ++#define DEF_CBR_RCAL_REGISTER() (REG32(ADR_CBR_RCAL_REGISTER)) = (0x00004080) ++#define DEF_CBR_MANUAL_REGISTER() (REG32(ADR_CBR_MANUAL_REGISTER)) = (0x00003e7e) ++#define DEF_CBR_TRX_DUMMY_REGISTER() (REG32(ADR_CBR_TRX_DUMMY_REGISTER)) = (0xaaaaaaaa) ++#define DEF_CBR_SX_DUMMY_REGISTER() (REG32(ADR_CBR_SX_DUMMY_REGISTER)) = (0xaaaaaaaa) ++#define DEF_CBR_RG_PKT_GEN_0() (REG32(ADR_CBR_RG_PKT_GEN_0)) = (0x00000000) ++#define DEF_CBR_RG_PKT_GEN_1() (REG32(ADR_CBR_RG_PKT_GEN_1)) = (0x00000000) ++#define DEF_CBR_RG_PKT_GEN_2() (REG32(ADR_CBR_RG_PKT_GEN_2)) = (0x00000000) ++#define DEF_CBR_RG_INTEGRATION() (REG32(ADR_CBR_RG_INTEGRATION)) = (0x00000000) ++#define DEF_CBR_RG_PKT_GEN_TXCNT() (REG32(ADR_CBR_RG_PKT_GEN_TXCNT)) = (0x00000000) ++#define DEF_CBR_PATTERN_GEN() (REG32(ADR_CBR_PATTERN_GEN)) = (0xff000000) ++#define DEF_MB_CPU_INT() (REG32(ADR_MB_CPU_INT)) = (0x00000000) ++#define DEF_CPU_ID_TB0() (REG32(ADR_CPU_ID_TB0)) = (0x00000000) ++#define DEF_CPU_ID_TB1() (REG32(ADR_CPU_ID_TB1)) = (0x00000000) ++#define DEF_CH0_TRIG_1() (REG32(ADR_CH0_TRIG_1)) = (0x00000000) ++#define DEF_CH0_TRIG_0() (REG32(ADR_CH0_TRIG_0)) = (0x00000000) ++#define DEF_CH0_PRI_TRIG() (REG32(ADR_CH0_PRI_TRIG)) = (0x00000000) ++#define DEF_MCU_STATUS() (REG32(ADR_MCU_STATUS)) = (0x00000000) ++#define DEF_RD_IN_FFCNT1() (REG32(ADR_RD_IN_FFCNT1)) = (0x00000000) ++#define DEF_RD_IN_FFCNT2() (REG32(ADR_RD_IN_FFCNT2)) = (0x00000000) ++#define DEF_RD_FFIN_FULL() (REG32(ADR_RD_FFIN_FULL)) = (0x00000000) ++#define DEF_MBOX_HALT_CFG() (REG32(ADR_MBOX_HALT_CFG)) = (0x00000000) ++#define DEF_MB_DBG_CFG1() (REG32(ADR_MB_DBG_CFG1)) = (0x00080000) ++#define DEF_MB_DBG_CFG2() (REG32(ADR_MB_DBG_CFG2)) = (0x00000000) ++#define DEF_MB_DBG_CFG3() (REG32(ADR_MB_DBG_CFG3)) = (0x00000000) ++#define DEF_MB_DBG_CFG4() (REG32(ADR_MB_DBG_CFG4)) = (0xffffffff) ++#define DEF_MB_OUT_QUEUE_CFG() (REG32(ADR_MB_OUT_QUEUE_CFG)) = (0x00000002) ++#define DEF_MB_OUT_QUEUE_FLUSH() (REG32(ADR_MB_OUT_QUEUE_FLUSH)) = (0x00000000) ++#define DEF_RD_FFOUT_CNT1() (REG32(ADR_RD_FFOUT_CNT1)) = (0x00000000) ++#define DEF_RD_FFOUT_CNT2() (REG32(ADR_RD_FFOUT_CNT2)) = (0x00000000) ++#define DEF_RD_FFOUT_CNT3() (REG32(ADR_RD_FFOUT_CNT3)) = (0x00000000) ++#define DEF_RD_FFOUT_FULL() (REG32(ADR_RD_FFOUT_FULL)) = (0x00000000) ++#define DEF_MB_THRESHOLD6() (REG32(ADR_MB_THRESHOLD6)) = (0x00000000) ++#define DEF_MB_THRESHOLD7() (REG32(ADR_MB_THRESHOLD7)) = (0x00000000) ++#define DEF_MB_THRESHOLD8() (REG32(ADR_MB_THRESHOLD8)) = (0x00000000) ++#define DEF_MB_THRESHOLD9() (REG32(ADR_MB_THRESHOLD9)) = (0x00000000) ++#define DEF_MB_THRESHOLD10() (REG32(ADR_MB_THRESHOLD10)) = (0x00000000) ++#define DEF_MB_TRASH_CFG() (REG32(ADR_MB_TRASH_CFG)) = (0x01000001) ++#define DEF_MB_IN_FF_FLUSH() (REG32(ADR_MB_IN_FF_FLUSH)) = (0x00000000) ++#define DEF_CPU_ID_TB2() (REG32(ADR_CPU_ID_TB2)) = (0x00000000) ++#define DEF_CPU_ID_TB3() (REG32(ADR_CPU_ID_TB3)) = (0x00000000) ++#define DEF_PHY_IQ_LOG_CFG0() (REG32(ADR_PHY_IQ_LOG_CFG0)) = (0x00000000) ++#define DEF_PHY_IQ_LOG_CFG1() (REG32(ADR_PHY_IQ_LOG_CFG1)) = (0x00000000) ++#define DEF_PHY_IQ_LOG_LEN() (REG32(ADR_PHY_IQ_LOG_LEN)) = (0x00001000) ++#define DEF_PHY_IQ_LOG_PTR() (REG32(ADR_PHY_IQ_LOG_PTR)) = (0x00000000) ++#define DEF_WR_ALC() (REG32(ADR_WR_ALC)) = (0x00000000) ++#define DEF_GETID() (REG32(ADR_GETID)) = (0x00000000) ++#define DEF_CH_STA_PRI() (REG32(ADR_CH_STA_PRI)) = (0x00000213) ++#define DEF_RD_ID0() (REG32(ADR_RD_ID0)) = (0x00000000) ++#define DEF_RD_ID1() (REG32(ADR_RD_ID1)) = (0x00000000) ++#define DEF_IMD_CFG() (REG32(ADR_IMD_CFG)) = (0x00000000) ++#define DEF_IMD_STA() (REG32(ADR_IMD_STA)) = (0x00000000) ++#define DEF_ALC_STA() (REG32(ADR_ALC_STA)) = (0x01000000) ++#define DEF_TRX_ID_COUNT() (REG32(ADR_TRX_ID_COUNT)) = (0x00000000) ++#define DEF_TRX_ID_THRESHOLD() (REG32(ADR_TRX_ID_THRESHOLD)) = (0x01ee3c3c) ++#define DEF_TX_ID0() (REG32(ADR_TX_ID0)) = (0x00000000) ++#define DEF_TX_ID1() (REG32(ADR_TX_ID1)) = (0x00000000) ++#define DEF_RX_ID0() (REG32(ADR_RX_ID0)) = (0x00000000) ++#define DEF_RX_ID1() (REG32(ADR_RX_ID1)) = (0x00000000) ++#define DEF_RTN_STA() (REG32(ADR_RTN_STA)) = (0x00000001) ++#define DEF_ID_LEN_THREADSHOLD1() (REG32(ADR_ID_LEN_THREADSHOLD1)) = (0x000f0641) ++#define DEF_ID_LEN_THREADSHOLD2() (REG32(ADR_ID_LEN_THREADSHOLD2)) = (0x00000000) ++#define DEF_CH_ARB_PRI() (REG32(ADR_CH_ARB_PRI)) = (0x00031201) ++#define DEF_TX_ID_REMAIN_STATUS() (REG32(ADR_TX_ID_REMAIN_STATUS)) = (0x00000000) ++#define DEF_ID_INFO_STA() (REG32(ADR_ID_INFO_STA)) = (0x00000100) ++#define DEF_TX_LIMIT_INTR() (REG32(ADR_TX_LIMIT_INTR)) = (0x00000000) ++#define DEF_TX_ID_ALL_INFO() (REG32(ADR_TX_ID_ALL_INFO)) = (0x00000000) ++#define DEF_RD_ID2() (REG32(ADR_RD_ID2)) = (0x00000000) ++#define DEF_RD_ID3() (REG32(ADR_RD_ID3)) = (0x00000000) ++#define DEF_TX_ID2() (REG32(ADR_TX_ID2)) = (0x00000000) ++#define DEF_TX_ID3() (REG32(ADR_TX_ID3)) = (0x00000000) ++#define DEF_RX_ID2() (REG32(ADR_RX_ID2)) = (0x00000000) ++#define DEF_RX_ID3() (REG32(ADR_RX_ID3)) = (0x00000000) ++#define DEF_TX_ID_ALL_INFO2() (REG32(ADR_TX_ID_ALL_INFO2)) = (0x00000000) ++#define DEF_TX_ID_ALL_INFO_A() (REG32(ADR_TX_ID_ALL_INFO_A)) = (0x00000000) ++#define DEF_TX_ID_ALL_INFO_B() (REG32(ADR_TX_ID_ALL_INFO_B)) = (0x00000000) ++#define DEF_TX_ID_REMAIN_STATUS2() (REG32(ADR_TX_ID_REMAIN_STATUS2)) = (0x01000100) ++#define DEF_ALC_ID_INFO() (REG32(ADR_ALC_ID_INFO)) = (0x00000000) ++#define DEF_ALC_ID_INF1() (REG32(ADR_ALC_ID_INF1)) = (0x00000000) ++#define DEF_PHY_EN_0() (REG32(ADR_PHY_EN_0)) = (0x00000014) ++#define DEF_PHY_EN_1() (REG32(ADR_PHY_EN_1)) = (0x00000000) ++#define DEF_SVN_VERSION_REG() (REG32(ADR_SVN_VERSION_REG)) = (0x00000000) ++#define DEF_PHY_PKT_GEN_0() (REG32(ADR_PHY_PKT_GEN_0)) = (0x00000064) ++#define DEF_PHY_PKT_GEN_1() (REG32(ADR_PHY_PKT_GEN_1)) = (0x00000fff) ++#define DEF_PHY_PKT_GEN_2() (REG32(ADR_PHY_PKT_GEN_2)) = (0x00000003) ++#define DEF_PHY_PKT_GEN_3() (REG32(ADR_PHY_PKT_GEN_3)) = (0x005a0220) ++#define DEF_PHY_PKT_GEN_4() (REG32(ADR_PHY_PKT_GEN_4)) = (0x00000001) ++#define DEF_PHY_REG_00() (REG32(ADR_PHY_REG_00)) = (0x10000000) ++#define DEF_PHY_REG_01() (REG32(ADR_PHY_REG_01)) = (0x00000000) ++#define DEF_PHY_REG_02_AGC() (REG32(ADR_PHY_REG_02_AGC)) = (0x80046771) ++#define DEF_PHY_REG_03_AGC() (REG32(ADR_PHY_REG_03_AGC)) = (0x1f300f6f) ++#define DEF_PHY_REG_04_AGC() (REG32(ADR_PHY_REG_04_AGC)) = (0x663f36d0) ++#define DEF_PHY_REG_05_AGC() (REG32(ADR_PHY_REG_05_AGC)) = (0x106c0000) ++#define DEF_PHY_REG_06_11B_DAGC() (REG32(ADR_PHY_REG_06_11B_DAGC)) = (0x01603fff) ++#define DEF_PHY_REG_07_11B_DAGC() (REG32(ADR_PHY_REG_07_11B_DAGC)) = (0x00600808) ++#define DEF_PHY_REG_08_11GN_DAGC() (REG32(ADR_PHY_REG_08_11GN_DAGC)) = (0xff000160) ++#define DEF_PHY_REG_09_11GN_DAGC() (REG32(ADR_PHY_REG_09_11GN_DAGC)) = (0x00080840) ++#define DEF_PHY_READ_REG_00_DIG_PWR() (REG32(ADR_PHY_READ_REG_00_DIG_PWR)) = (0x00000000) ++#define DEF_PHY_READ_REG_01_RF_GAIN_PWR() (REG32(ADR_PHY_READ_REG_01_RF_GAIN_PWR)) = (0x00000000) ++#define DEF_PHY_READ_REG_02_RF_GAIN_PWR() (REG32(ADR_PHY_READ_REG_02_RF_GAIN_PWR)) = (0x00000000) ++#define DEF_PHY_READ_REG_03_RF_GAIN_PWR() (REG32(ADR_PHY_READ_REG_03_RF_GAIN_PWR)) = (0x00000000) ++#define DEF_PHY_REG_10_TX_DES() (REG32(ADR_PHY_REG_10_TX_DES)) = (0x00010405) ++#define DEF_PHY_REG_11_TX_DES() (REG32(ADR_PHY_REG_11_TX_DES)) = (0x06090813) ++#define DEF_PHY_REG_12_TX_DES() (REG32(ADR_PHY_REG_12_TX_DES)) = (0x12070000) ++#define DEF_PHY_REG_13_RX_DES() (REG32(ADR_PHY_REG_13_RX_DES)) = (0x01000405) ++#define DEF_PHY_REG_14_RX_DES() (REG32(ADR_PHY_REG_14_RX_DES)) = (0x06090813) ++#define DEF_PHY_REG_15_RX_DES() (REG32(ADR_PHY_REG_15_RX_DES)) = (0x12010000) ++#define DEF_PHY_REG_16_TX_DES_EXCP() (REG32(ADR_PHY_REG_16_TX_DES_EXCP)) = (0x00000000) ++#define DEF_PHY_REG_17_TX_DES_EXCP() (REG32(ADR_PHY_REG_17_TX_DES_EXCP)) = (0x10110000) ++#define DEF_PHY_REG_18_RSSI_SNR() (REG32(ADR_PHY_REG_18_RSSI_SNR)) = (0x00fc000f) ++#define DEF_PHY_REG_19_DAC_MANUAL() (REG32(ADR_PHY_REG_19_DAC_MANUAL)) = (0x00000000) ++#define DEF_PHY_REG_20_MRX_CNT() (REG32(ADR_PHY_REG_20_MRX_CNT)) = (0x00000000) ++#define DEF_PHY_REG_21_TRX_RAMP() (REG32(ADR_PHY_REG_21_TRX_RAMP)) = (0x3c012801) ++#define DEF_PHY_REG_22_TRX_RAMP() (REG32(ADR_PHY_REG_22_TRX_RAMP)) = (0x24243724) ++#define DEF_PHY_REG_23_ANT() (REG32(ADR_PHY_REG_23_ANT)) = (0x00000011) ++#define DEF_PHY_REG_24_MTX_LEN_CNT() (REG32(ADR_PHY_REG_24_MTX_LEN_CNT)) = (0x1fff0000) ++#define DEF_PHY_REG_25_MTX_LEN_CNT() (REG32(ADR_PHY_REG_25_MTX_LEN_CNT)) = (0x1fff0000) ++#define DEF_PHY_REG_26_MRX_LEN_CNT() (REG32(ADR_PHY_REG_26_MRX_LEN_CNT)) = (0x1fff0000) ++#define DEF_PHY_REG_27_MRX_LEN_CNT() (REG32(ADR_PHY_REG_27_MRX_LEN_CNT)) = (0x1fff0000) ++#define DEF_PHY_READ_REG_04() (REG32(ADR_PHY_READ_REG_04)) = (0x00000000) ++#define DEF_PHY_READ_REG_05() (REG32(ADR_PHY_READ_REG_05)) = (0x00000000) ++#define DEF_PHY_REG_28_BIST() (REG32(ADR_PHY_REG_28_BIST)) = (0x0000fe3e) ++#define DEF_PHY_READ_REG_06_BIST() (REG32(ADR_PHY_READ_REG_06_BIST)) = (0x00000000) ++#define DEF_PHY_READ_REG_07_BIST() (REG32(ADR_PHY_READ_REG_07_BIST)) = (0x00000000) ++#define DEF_PHY_REG_29_MTRX_MAC() (REG32(ADR_PHY_REG_29_MTRX_MAC)) = (0xffffffff) ++#define DEF_PHY_READ_REG_08_MTRX_MAC() (REG32(ADR_PHY_READ_REG_08_MTRX_MAC)) = (0x00000000) ++#define DEF_PHY_READ_REG_09_MTRX_MAC() (REG32(ADR_PHY_READ_REG_09_MTRX_MAC)) = (0x00000000) ++#define DEF_PHY_REG_30_TX_UP_FIL() (REG32(ADR_PHY_REG_30_TX_UP_FIL)) = (0x0ead04f5) ++#define DEF_PHY_REG_31_TX_UP_FIL() (REG32(ADR_PHY_REG_31_TX_UP_FIL)) = (0x0fd60080) ++#define DEF_PHY_REG_32_TX_UP_FIL() (REG32(ADR_PHY_REG_32_TX_UP_FIL)) = (0x00000009) ++#define DEF_PHY_READ_TBUS() (REG32(ADR_PHY_READ_TBUS)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_00() (REG32(ADR_TX_11B_FIL_COEF_00)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_01() (REG32(ADR_TX_11B_FIL_COEF_01)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_02() (REG32(ADR_TX_11B_FIL_COEF_02)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_03() (REG32(ADR_TX_11B_FIL_COEF_03)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_04() (REG32(ADR_TX_11B_FIL_COEF_04)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_05() (REG32(ADR_TX_11B_FIL_COEF_05)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_06() (REG32(ADR_TX_11B_FIL_COEF_06)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_07() (REG32(ADR_TX_11B_FIL_COEF_07)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_08() (REG32(ADR_TX_11B_FIL_COEF_08)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_09() (REG32(ADR_TX_11B_FIL_COEF_09)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_10() (REG32(ADR_TX_11B_FIL_COEF_10)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_11() (REG32(ADR_TX_11B_FIL_COEF_11)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_12() (REG32(ADR_TX_11B_FIL_COEF_12)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_13() (REG32(ADR_TX_11B_FIL_COEF_13)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_14() (REG32(ADR_TX_11B_FIL_COEF_14)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_15() (REG32(ADR_TX_11B_FIL_COEF_15)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_16() (REG32(ADR_TX_11B_FIL_COEF_16)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_17() (REG32(ADR_TX_11B_FIL_COEF_17)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_18() (REG32(ADR_TX_11B_FIL_COEF_18)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_19() (REG32(ADR_TX_11B_FIL_COEF_19)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_20() (REG32(ADR_TX_11B_FIL_COEF_20)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_21() (REG32(ADR_TX_11B_FIL_COEF_21)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_22() (REG32(ADR_TX_11B_FIL_COEF_22)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_23() (REG32(ADR_TX_11B_FIL_COEF_23)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_24() (REG32(ADR_TX_11B_FIL_COEF_24)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_25() (REG32(ADR_TX_11B_FIL_COEF_25)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_26() (REG32(ADR_TX_11B_FIL_COEF_26)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_27() (REG32(ADR_TX_11B_FIL_COEF_27)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_28() (REG32(ADR_TX_11B_FIL_COEF_28)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_29() (REG32(ADR_TX_11B_FIL_COEF_29)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_30() (REG32(ADR_TX_11B_FIL_COEF_30)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_31() (REG32(ADR_TX_11B_FIL_COEF_31)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_32() (REG32(ADR_TX_11B_FIL_COEF_32)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_33() (REG32(ADR_TX_11B_FIL_COEF_33)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_34() (REG32(ADR_TX_11B_FIL_COEF_34)) = (0x00000000) ++#define DEF_TX_11B_FIL_COEF_35() (REG32(ADR_TX_11B_FIL_COEF_35)) = (0x00000005) ++#define DEF_TX_11B_FIL_COEF_36() (REG32(ADR_TX_11B_FIL_COEF_36)) = (0x0000003d) ++#define DEF_TX_11B_FIL_COEF_37() (REG32(ADR_TX_11B_FIL_COEF_37)) = (0x00000162) ++#define DEF_TX_11B_FIL_COEF_38() (REG32(ADR_TX_11B_FIL_COEF_38)) = (0x00000400) ++#define DEF_TX_11B_FIL_COEF_39() (REG32(ADR_TX_11B_FIL_COEF_39)) = (0x00000699) ++#define DEF_TX_11B_FIL_COEF_40() (REG32(ADR_TX_11B_FIL_COEF_40)) = (0x00000787) ++#define DEF_TX_11B_PLCP() (REG32(ADR_TX_11B_PLCP)) = (0x00000000) ++#define DEF_TX_11B_RAMP() (REG32(ADR_TX_11B_RAMP)) = (0x0000403c) ++#define DEF_TX_11B_EN_CNT_RST_N() (REG32(ADR_TX_11B_EN_CNT_RST_N)) = (0x00000001) ++#define DEF_TX_11B_EN_CNT() (REG32(ADR_TX_11B_EN_CNT)) = (0x00000000) ++#define DEF_TX_11B_PKT_GEN_CNT() (REG32(ADR_TX_11B_PKT_GEN_CNT)) = (0x00000000) ++#define DEF_RX_11B_DES_DLY() (REG32(ADR_RX_11B_DES_DLY)) = (0x00000044) ++#define DEF_RX_11B_CCA_0() (REG32(ADR_RX_11B_CCA_0)) = (0x00040000) ++#define DEF_RX_11B_CCA_1() (REG32(ADR_RX_11B_CCA_1)) = (0x00400040) ++#define DEF_RX_11B_TR_KP_KI_0() (REG32(ADR_RX_11B_TR_KP_KI_0)) = (0x00003467) ++#define DEF_RX_11B_TR_KP_KI_1() (REG32(ADR_RX_11B_TR_KP_KI_1)) = (0x00540000) ++#define DEF_RX_11B_CE_CNT_THRESHOLD() (REG32(ADR_RX_11B_CE_CNT_THRESHOLD)) = (0x12243615) ++#define DEF_RX_11B_CE_MU_0() (REG32(ADR_RX_11B_CE_MU_0)) = (0x00390002) ++#define DEF_RX_11B_CE_MU_1() (REG32(ADR_RX_11B_CE_MU_1)) = (0x03456777) ++#define DEF_RX_11B_EQ_MU_0() (REG32(ADR_RX_11B_EQ_MU_0)) = (0x00350046) ++#define DEF_RX_11B_EQ_MU_1() (REG32(ADR_RX_11B_EQ_MU_1)) = (0x00570057) ++#define DEF_RX_11B_EQ_CR_KP_KI() (REG32(ADR_RX_11B_EQ_CR_KP_KI)) = (0x00236700) ++#define DEF_RX_11B_LPF_RATE() (REG32(ADR_RX_11B_LPF_RATE)) = (0x000d1746) ++#define DEF_RX_11B_CIT_CNT_THRESHOLD() (REG32(ADR_RX_11B_CIT_CNT_THRESHOLD)) = (0x04061787) ++#define DEF_RX_11B_EQ_CH_MAIN_TAP() (REG32(ADR_RX_11B_EQ_CH_MAIN_TAP)) = (0x07800000) ++#define DEF_RX_11B_SEARCH_CNT_TH() (REG32(ADR_RX_11B_SEARCH_CNT_TH)) = (0x00c0000a) ++#define DEF_RX_11B_CCA_CONTROL() (REG32(ADR_RX_11B_CCA_CONTROL)) = (0x00000000) ++#define DEF_RX_11B_FREQUENCY_OFFSET() (REG32(ADR_RX_11B_FREQUENCY_OFFSET)) = (0x00000000) ++#define DEF_RX_11B_SNR_RSSI() (REG32(ADR_RX_11B_SNR_RSSI)) = (0x00000000) ++#define DEF_RX_11B_SFD_CRC_CNT() (REG32(ADR_RX_11B_SFD_CRC_CNT)) = (0x00000000) ++#define DEF_RX_11B_PKT_ERR_AND_PKT_ERR_CNT() (REG32(ADR_RX_11B_PKT_ERR_AND_PKT_ERR_CNT)) = (0x00000000) ++#define DEF_RX_11B_PKT_CCA_AND_PKT_CNT() (REG32(ADR_RX_11B_PKT_CCA_AND_PKT_CNT)) = (0x00000000) ++#define DEF_RX_11B_SFD_FILED_0() (REG32(ADR_RX_11B_SFD_FILED_0)) = (0x00000000) ++#define DEF_RX_11B_SFD_FIELD_1() (REG32(ADR_RX_11B_SFD_FIELD_1)) = (0x00000000) ++#define DEF_RX_11B_PKT_STAT_EN() (REG32(ADR_RX_11B_PKT_STAT_EN)) = (0x00100000) ++#define DEF_RX_11B_SOFT_RST() (REG32(ADR_RX_11B_SOFT_RST)) = (0x00000001) ++#define DEF_TX_11GN_RAMP() (REG32(ADR_TX_11GN_RAMP)) = (0x0000233c) ++#define DEF_TX_11GN_PLCP() (REG32(ADR_TX_11GN_PLCP)) = (0x5d08908e) ++#define DEF_TX_11GN_PKT_GEN_CNT() (REG32(ADR_TX_11GN_PKT_GEN_CNT)) = (0x00000000) ++#define DEF_TX_11GN_PLCP_CRC_ERR_CNT() (REG32(ADR_TX_11GN_PLCP_CRC_ERR_CNT)) = (0x00000000) ++#define DEF_RX_11GN_DES_DLY() (REG32(ADR_RX_11GN_DES_DLY)) = (0x00000044) ++#define DEF_RX_11GN_TR_0() (REG32(ADR_RX_11GN_TR_0)) = (0x00750075) ++#define DEF_RX_11GN_TR_1() (REG32(ADR_RX_11GN_TR_1)) = (0x00000075) ++#define DEF_RX_11GN_TR_2() (REG32(ADR_RX_11GN_TR_2)) = (0x10000075) ++#define DEF_RX_11GN_CCA_0() (REG32(ADR_RX_11GN_CCA_0)) = (0x38324705) ++#define DEF_RX_11GN_CCA_1() (REG32(ADR_RX_11GN_CCA_1)) = (0x30182000) ++#define DEF_RX_11GN_CCA_2() (REG32(ADR_RX_11GN_CCA_2)) = (0x20600000) ++#define DEF_RX_11GN_CCA_FFT_SCALE() (REG32(ADR_RX_11GN_CCA_FFT_SCALE)) = (0x0a010100) ++#define DEF_RX_11GN_SOFT_DEMAP_0() (REG32(ADR_RX_11GN_SOFT_DEMAP_0)) = (0x50505050) ++#define DEF_RX_11GN_SOFT_DEMAP_1() (REG32(ADR_RX_11GN_SOFT_DEMAP_1)) = (0x50000000) ++#define DEF_RX_11GN_SOFT_DEMAP_2() (REG32(ADR_RX_11GN_SOFT_DEMAP_2)) = (0x50505050) ++#define DEF_RX_11GN_SOFT_DEMAP_3() (REG32(ADR_RX_11GN_SOFT_DEMAP_3)) = (0x50505050) ++#define DEF_RX_11GN_SOFT_DEMAP_4() (REG32(ADR_RX_11GN_SOFT_DEMAP_4)) = (0x50000000) ++#define DEF_RX_11GN_SOFT_DEMAP_5() (REG32(ADR_RX_11GN_SOFT_DEMAP_5)) = (0x00000000) ++#define DEF_RX_11GN_SYM_BOUND_0() (REG32(ADR_RX_11GN_SYM_BOUND_0)) = (0x00001420) ++#define DEF_RX_11GN_SYM_BOUND_1() (REG32(ADR_RX_11GN_SYM_BOUND_1)) = (0x0000200a) ++#define DEF_RX_11GN_CCA_PWR() (REG32(ADR_RX_11GN_CCA_PWR)) = (0x30000280) ++#define DEF_RX_11GN_CCA_CNT() (REG32(ADR_RX_11GN_CCA_CNT)) = (0x30023002) ++#define DEF_RX_11GN_CCA_ATCOR_RE_CHECK() (REG32(ADR_RX_11GN_CCA_ATCOR_RE_CHECK)) = (0x0000003a) ++#define DEF_RX_11GN_VTB_TB() (REG32(ADR_RX_11GN_VTB_TB)) = (0x40000000) ++#define DEF_RX_11GN_ERR_UPDATE() (REG32(ADR_RX_11GN_ERR_UPDATE)) = (0x009e007e) ++#define DEF_RX_11GN_SHORT_GI() (REG32(ADR_RX_11GN_SHORT_GI)) = (0x00044400) ++#define DEF_RX_11GN_CHANNEL_UPDATE() (REG32(ADR_RX_11GN_CHANNEL_UPDATE)) = (0x82000000) ++#define DEF_RX_11GN_PKT_FORMAT_0() (REG32(ADR_RX_11GN_PKT_FORMAT_0)) = (0x02003030) ++#define DEF_RX_11GN_PKT_FORMAT_1() (REG32(ADR_RX_11GN_PKT_FORMAT_1)) = (0x092a092a) ++#define DEF_RX_11GN_TX_TIME() (REG32(ADR_RX_11GN_TX_TIME)) = (0x00700010) ++#define DEF_RX_11GN_STBC_TR_KP_KI() (REG32(ADR_RX_11GN_STBC_TR_KP_KI)) = (0x00007575) ++#define DEF_RX_11GN_BIST_0() (REG32(ADR_RX_11GN_BIST_0)) = (0x0001fe3e) ++#define DEF_RX_11GN_BIST_1() (REG32(ADR_RX_11GN_BIST_1)) = (0x0000fe3e) ++#define DEF_RX_11GN_BIST_2() (REG32(ADR_RX_11GN_BIST_2)) = (0x00000000) ++#define DEF_RX_11GN_BIST_3() (REG32(ADR_RX_11GN_BIST_3)) = (0x00000000) ++#define DEF_RX_11GN_BIST_4() (REG32(ADR_RX_11GN_BIST_4)) = (0x00000000) ++#define DEF_RX_11GN_BIST_5() (REG32(ADR_RX_11GN_BIST_5)) = (0x00000000) ++#define DEF_RX_11GN_SPECTRUM_ANALYZER() (REG32(ADR_RX_11GN_SPECTRUM_ANALYZER)) = (0x00000000) ++#define DEF_RX_11GN_READ_0() (REG32(ADR_RX_11GN_READ_0)) = (0x00000000) ++#define DEF_RX_11GN_FREQ_OFFSET() (REG32(ADR_RX_11GN_FREQ_OFFSET)) = (0x00000000) ++#define DEF_RX_11GN_SIGNAL_FIELD_0() (REG32(ADR_RX_11GN_SIGNAL_FIELD_0)) = (0x00000000) ++#define DEF_RX_11GN_SIGNAL_FIELD_1() (REG32(ADR_RX_11GN_SIGNAL_FIELD_1)) = (0x00000000) ++#define DEF_RX_11GN_PKT_ERR_CNT() (REG32(ADR_RX_11GN_PKT_ERR_CNT)) = (0x00000000) ++#define DEF_RX_11GN_PKT_CCA_AND_PKT_CNT() (REG32(ADR_RX_11GN_PKT_CCA_AND_PKT_CNT)) = (0x00000000) ++#define DEF_RX_11GN_SERVICE_LENGTH_FIELD() (REG32(ADR_RX_11GN_SERVICE_LENGTH_FIELD)) = (0x00000000) ++#define DEF_RX_11GN_RATE() (REG32(ADR_RX_11GN_RATE)) = (0x00000000) ++#define DEF_RX_11GN_STAT_EN() (REG32(ADR_RX_11GN_STAT_EN)) = (0x00100001) ++#define DEF_RX_11GN_SOFT_RST() (REG32(ADR_RX_11GN_SOFT_RST)) = (0x00000001) ++#define DEF_RF_CONTROL_0() (REG32(ADR_RF_CONTROL_0)) = (0x00000000) ++#define DEF_RF_CONTROL_1() (REG32(ADR_RF_CONTROL_1)) = (0x00008000) ++#define DEF_TX_IQ_CONTROL_0() (REG32(ADR_TX_IQ_CONTROL_0)) = (0x00200020) ++#define DEF_TX_IQ_CONTROL_1() (REG32(ADR_TX_IQ_CONTROL_1)) = (0x00028080) ++#define DEF_TX_IQ_CONTROL_2() (REG32(ADR_TX_IQ_CONTROL_2)) = (0x00000000) ++#define DEF_TX_COMPENSATION_CONTROL() (REG32(ADR_TX_COMPENSATION_CONTROL)) = (0x00000000) ++#define DEF_RX_COMPENSATION_CONTROL() (REG32(ADR_RX_COMPENSATION_CONTROL)) = (0x00000000) ++#define DEF_RX_OBSERVATION_CIRCUIT_0() (REG32(ADR_RX_OBSERVATION_CIRCUIT_0)) = (0x000028ff) ++#define DEF_RX_OBSERVATION_CIRCUIT_1() (REG32(ADR_RX_OBSERVATION_CIRCUIT_1)) = (0x00000000) ++#define DEF_RX_OBSERVATION_CIRCUIT_2() (REG32(ADR_RX_OBSERVATION_CIRCUIT_2)) = (0x00000000) ++#define DEF_RX_OBSERVATION_CIRCUIT_3() (REG32(ADR_RX_OBSERVATION_CIRCUIT_3)) = (0x00000000) ++#define DEF_RF_IQ_CONTROL_0() (REG32(ADR_RF_IQ_CONTROL_0)) = (0x00000202) ++#define DEF_RF_IQ_CONTROL_1() (REG32(ADR_RF_IQ_CONTROL_1)) = (0x00ffc200) ++#define DEF_RF_IQ_CONTROL_2() (REG32(ADR_RF_IQ_CONTROL_2)) = (0x00000000) ++#define DEF_RF_IQ_CONTROL_3() (REG32(ADR_RF_IQ_CONTROL_3)) = (0x00000000) ++#define DEF_DPD_CONTROL() (REG32(ADR_DPD_CONTROL)) = (0x00000000) ++#define DEF_DPD_GAIN_TABLE_0() (REG32(ADR_DPD_GAIN_TABLE_0)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_1() (REG32(ADR_DPD_GAIN_TABLE_1)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_2() (REG32(ADR_DPD_GAIN_TABLE_2)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_3() (REG32(ADR_DPD_GAIN_TABLE_3)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_4() (REG32(ADR_DPD_GAIN_TABLE_4)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_5() (REG32(ADR_DPD_GAIN_TABLE_5)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_6() (REG32(ADR_DPD_GAIN_TABLE_6)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_7() (REG32(ADR_DPD_GAIN_TABLE_7)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_8() (REG32(ADR_DPD_GAIN_TABLE_8)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_9() (REG32(ADR_DPD_GAIN_TABLE_9)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_A() (REG32(ADR_DPD_GAIN_TABLE_A)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_B() (REG32(ADR_DPD_GAIN_TABLE_B)) = (0x02000200) ++#define DEF_DPD_GAIN_TABLE_C() (REG32(ADR_DPD_GAIN_TABLE_C)) = (0x02000200) ++#define DEF_DPD_PH_TABLE_0() (REG32(ADR_DPD_PH_TABLE_0)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_1() (REG32(ADR_DPD_PH_TABLE_1)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_2() (REG32(ADR_DPD_PH_TABLE_2)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_3() (REG32(ADR_DPD_PH_TABLE_3)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_4() (REG32(ADR_DPD_PH_TABLE_4)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_5() (REG32(ADR_DPD_PH_TABLE_5)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_6() (REG32(ADR_DPD_PH_TABLE_6)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_7() (REG32(ADR_DPD_PH_TABLE_7)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_8() (REG32(ADR_DPD_PH_TABLE_8)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_9() (REG32(ADR_DPD_PH_TABLE_9)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_A() (REG32(ADR_DPD_PH_TABLE_A)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_B() (REG32(ADR_DPD_PH_TABLE_B)) = (0x00000000) ++#define DEF_DPD_PH_TABLE_C() (REG32(ADR_DPD_PH_TABLE_C)) = (0x00000000) ++#define DEF_DPD_GAIN_ESTIMATION_0() (REG32(ADR_DPD_GAIN_ESTIMATION_0)) = (0x00000000) ++#define DEF_DPD_GAIN_ESTIMATION_1() (REG32(ADR_DPD_GAIN_ESTIMATION_1)) = (0x00000100) ++#define DEF_DPD_GAIN_ESTIMATION_2() (REG32(ADR_DPD_GAIN_ESTIMATION_2)) = (0x00000000) ++#define DEF_TX_GAIN_FACTOR() (REG32(ADR_TX_GAIN_FACTOR)) = (0x80808080) ++#define DEF_HARD_WIRE_PIN_REGISTER() (REG32(ADR_HARD_WIRE_PIN_REGISTER)) = (0x00004000) ++#define DEF_MANUAL_ENABLE_REGISTER() (REG32(ADR_MANUAL_ENABLE_REGISTER)) = (0x00000fc0) ++#define DEF_LDO_REGISTER() (REG32(ADR_LDO_REGISTER)) = (0x000db71b) ++#define DEF_ABB_REGISTER_1() (REG32(ADR_ABB_REGISTER_1)) = (0x151558dd) ++#define DEF_ABB_REGISTER_2() (REG32(ADR_ABB_REGISTER_2)) = (0x01011a88) ++#define DEF_TX_FE_REGISTER() (REG32(ADR_TX_FE_REGISTER)) = (0x3d3e84fe) ++#define DEF_RX_FE_REGISTER_1() (REG32(ADR_RX_FE_REGISTER_1)) = (0x03457579) ++#define DEF_RX_FE_GAIN_DECODER_REGISTER_1() (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_1)) = (0x000103a7) ++#define DEF_RX_FE_GAIN_DECODER_REGISTER_2() (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_2)) = (0x000103a6) ++#define DEF_RX_FE_GAIN_DECODER_REGISTER_3() (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_3)) = (0x00012001) ++#define DEF_RX_FE_GAIN_DECODER_REGISTER_4() (REG32(ADR_RX_FE_GAIN_DECODER_REGISTER_4)) = (0x00036000) ++#define DEF_RX_TX_FSM_REGISTER() (REG32(ADR_RX_TX_FSM_REGISTER)) = (0x00030ca8) ++#define DEF_RX_ADC_REGISTER() (REG32(ADR_RX_ADC_REGISTER)) = (0x20ea0224) ++#define DEF_TX_DAC_REGISTER() (REG32(ADR_TX_DAC_REGISTER)) = (0x44000655) ++#define DEF_SX_ENABLE_REGISTER() (REG32(ADR_SX_ENABLE_REGISTER)) = (0x0003e07c) ++#define DEF_SYN_REGISTER_1() (REG32(ADR_SYN_REGISTER_1)) = (0xaa800000) ++#define DEF_SYN_REGISTER_2() (REG32(ADR_SYN_REGISTER_2)) = (0x00550800) ++#define DEF_SYN_PFD_CHP() (REG32(ADR_SYN_PFD_CHP)) = (0x07c0894a) ++#define DEF_SYN_VCO_LOBF() (REG32(ADR_SYN_VCO_LOBF)) = (0xfcccca27) ++#define DEF_SYN_DIV_SDM_XOSC() (REG32(ADR_SYN_DIV_SDM_XOSC)) = (0x07700830) ++#define DEF_SYN_KVCO_XO_FINE_TUNE_CBANK() (REG32(ADR_SYN_KVCO_XO_FINE_TUNE_CBANK)) = (0x00440000) ++#define DEF_SYN_LCK_VT() (REG32(ADR_SYN_LCK_VT)) = (0x00007ff4) ++#define DEF_DPLL_VCO_REGISTER() (REG32(ADR_DPLL_VCO_REGISTER)) = (0x0000000e) ++#define DEF_DPLL_CP_PFD_REGISTER() (REG32(ADR_DPLL_CP_PFD_REGISTER)) = (0x00088008) ++#define DEF_DPLL_DIVIDER_REGISTER() (REG32(ADR_DPLL_DIVIDER_REGISTER)) = (0x00406000) ++#define DEF_DCOC_IDAC_REGISTER1() (REG32(ADR_DCOC_IDAC_REGISTER1)) = (0x08820820) ++#define DEF_DCOC_IDAC_REGISTER2() (REG32(ADR_DCOC_IDAC_REGISTER2)) = (0x00820820) ++#define DEF_DCOC_IDAC_REGISTER3() (REG32(ADR_DCOC_IDAC_REGISTER3)) = (0x00820820) ++#define DEF_DCOC_IDAC_REGISTER4() (REG32(ADR_DCOC_IDAC_REGISTER4)) = (0x00820820) ++#define DEF_DCOC_IDAC_REGISTER5() (REG32(ADR_DCOC_IDAC_REGISTER5)) = (0x00820820) ++#define DEF_DCOC_IDAC_REGISTER6() (REG32(ADR_DCOC_IDAC_REGISTER6)) = (0x00820820) ++#define DEF_DCOC_IDAC_REGISTER7() (REG32(ADR_DCOC_IDAC_REGISTER7)) = (0x00820820) ++#define DEF_DCOC_IDAC_REGISTER8() (REG32(ADR_DCOC_IDAC_REGISTER8)) = (0x00820820) ++#define DEF_RCAL_REGISTER() (REG32(ADR_RCAL_REGISTER)) = (0x00004080) ++#define DEF_SX_LCK_BIN_REGISTERS_I() (REG32(ADR_SX_LCK_BIN_REGISTERS_I)) = (0x20080080) ++#define DEF_TRX_DUMMY_REGISTER() (REG32(ADR_TRX_DUMMY_REGISTER)) = (0xaaaaaaaa) ++#define DEF_SX_DUMMY_REGISTER() (REG32(ADR_SX_DUMMY_REGISTER)) = (0xaaaaaaaa) ++#define DEF_DPLL_FB_DIVIDER_REGISTERS_II() (REG32(ADR_DPLL_FB_DIVIDER_REGISTERS_II)) = (0x00ec2ec5) ++#define DEF_SX_LCK_BIN_REGISTERS_II() (REG32(ADR_SX_LCK_BIN_REGISTERS_II)) = (0x00000f13) ++#define DEF_RC_OSC_32K_CAL_REGISTERS() (REG32(ADR_RC_OSC_32K_CAL_REGISTERS)) = (0x00098900) ++#define DEF_RF_D_DIGITAL_DEBUG_PORT_REGISTER() (REG32(ADR_RF_D_DIGITAL_DEBUG_PORT_REGISTER)) = (0x00000000) ++#define DEF_MMU_CTRL() (REG32(ADR_MMU_CTRL)) = (0x00002042) ++#define DEF_HS_CTRL() (REG32(ADR_HS_CTRL)) = (0x00000000) ++#define DEF_CPU_POR0_7() (REG32(ADR_CPU_POR0_7)) = (0x00000000) ++#define DEF_CPU_POR8_F() (REG32(ADR_CPU_POR8_F)) = (0x00000000) ++#define DEF_REG_LEN_CTRL() (REG32(ADR_REG_LEN_CTRL)) = (0x00000f0f) ++#define DEF_DMN_READ_BYPASS() (REG32(ADR_DMN_READ_BYPASS)) = (0x0000ffff) ++#define DEF_ALC_RLS_ABORT() (REG32(ADR_ALC_RLS_ABORT)) = (0x00000000) ++#define DEF_DEBUG_CTL() (REG32(ADR_DEBUG_CTL)) = (0x00000000) ++#define DEF_DEBUG_OUT() (REG32(ADR_DEBUG_OUT)) = (0x00000000) ++#define DEF_MMU_STATUS() (REG32(ADR_MMU_STATUS)) = (0x00000000) ++#define DEF_DMN_STATUS() (REG32(ADR_DMN_STATUS)) = (0x00000000) ++#define DEF_TAG_STATUS() (REG32(ADR_TAG_STATUS)) = (0x00000000) ++#define DEF_DMN_MCU_STATUS() (REG32(ADR_DMN_MCU_STATUS)) = (0x00000000) ++#define DEF_MB_IDTBL_0_STATUS() (REG32(ADR_MB_IDTBL_0_STATUS)) = (0x00000000) ++#define DEF_MB_IDTBL_1_STATUS() (REG32(ADR_MB_IDTBL_1_STATUS)) = (0x00000000) ++#define DEF_MB_IDTBL_2_STATUS() (REG32(ADR_MB_IDTBL_2_STATUS)) = (0x00000000) ++#define DEF_MB_IDTBL_3_STATUS() (REG32(ADR_MB_IDTBL_3_STATUS)) = (0x00000000) ++#define DEF_PKT_IDTBL_0_STATUS() (REG32(ADR_PKT_IDTBL_0_STATUS)) = (0x00000000) ++#define DEF_PKT_IDTBL_1_STATUS() (REG32(ADR_PKT_IDTBL_1_STATUS)) = (0x00000000) ++#define DEF_PKT_IDTBL_2_STATUS() (REG32(ADR_PKT_IDTBL_2_STATUS)) = (0x00000000) ++#define DEF_PKT_IDTBL_3_STATUS() (REG32(ADR_PKT_IDTBL_3_STATUS)) = (0x00000000) ++#define DEF_DMN_IDTBL_0_STATUS() (REG32(ADR_DMN_IDTBL_0_STATUS)) = (0x00000000) ++#define DEF_DMN_IDTBL_1_STATUS() (REG32(ADR_DMN_IDTBL_1_STATUS)) = (0x00000000) ++#define DEF_DMN_IDTBL_2_STATUS() (REG32(ADR_DMN_IDTBL_2_STATUS)) = (0x00000000) ++#define DEF_DMN_IDTBL_3_STATUS() (REG32(ADR_DMN_IDTBL_3_STATUS)) = (0x00000000) ++#define DEF_MB_NEQID_0_STATUS() (REG32(ADR_MB_NEQID_0_STATUS)) = (0x00000000) ++#define DEF_MB_NEQID_1_STATUS() (REG32(ADR_MB_NEQID_1_STATUS)) = (0x00000000) ++#define DEF_MB_NEQID_2_STATUS() (REG32(ADR_MB_NEQID_2_STATUS)) = (0x00000000) ++#define DEF_MB_NEQID_3_STATUS() (REG32(ADR_MB_NEQID_3_STATUS)) = (0x00000000) ++#define DEF_PKT_NEQID_0_STATUS() (REG32(ADR_PKT_NEQID_0_STATUS)) = (0x00000000) ++#define DEF_PKT_NEQID_1_STATUS() (REG32(ADR_PKT_NEQID_1_STATUS)) = (0x00000000) ++#define DEF_PKT_NEQID_2_STATUS() (REG32(ADR_PKT_NEQID_2_STATUS)) = (0x00000000) ++#define DEF_PKT_NEQID_3_STATUS() (REG32(ADR_PKT_NEQID_3_STATUS)) = (0x00000000) ++#define DEF_ALC_NOCHG_ID_STATUS() (REG32(ADR_ALC_NOCHG_ID_STATUS)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_0() (REG32(ADR_TAG_SRAM0_F_STATUS_0)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_1() (REG32(ADR_TAG_SRAM0_F_STATUS_1)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_2() (REG32(ADR_TAG_SRAM0_F_STATUS_2)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_3() (REG32(ADR_TAG_SRAM0_F_STATUS_3)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_4() (REG32(ADR_TAG_SRAM0_F_STATUS_4)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_5() (REG32(ADR_TAG_SRAM0_F_STATUS_5)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_6() (REG32(ADR_TAG_SRAM0_F_STATUS_6)) = (0x00000000) ++#define DEF_TAG_SRAM0_F_STATUS_7() (REG32(ADR_TAG_SRAM0_F_STATUS_7)) = (0x00000000) +diff --git a/drivers/net/wireless/ssv6051/include/ssv6200_reg_sim.h b/drivers/net/wireless/ssv6051/include/ssv6200_reg_sim.h +new file mode 100644 +index 000000000000..e15a481ba300 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv6200_reg_sim.h +@@ -0,0 +1,176 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include "ssv6200_reg.h" ++#define BANK_COUNT 49 ++static const u32 BASE_BANK_SSV6200[] = { ++ SYS_REG_BASE, ++ WBOOT_REG_BASE, ++ TU0_US_REG_BASE, ++ TU1_US_REG_BASE, ++ TU2_US_REG_BASE, ++ TU3_US_REG_BASE, ++ TM0_MS_REG_BASE, ++ TM1_MS_REG_BASE, ++ TM2_MS_REG_BASE, ++ TM3_MS_REG_BASE, ++ MCU_WDT_REG_BASE, ++ SYS_WDT_REG_BASE, ++ GPIO_REG_BASE, ++ SD_REG_BASE, ++ SPI_REG_BASE, ++ CSR_I2C_MST_BASE, ++ UART_REG_BASE, ++ DAT_UART_REG_BASE, ++ INT_REG_BASE, ++ DBG_SPI_REG_BASE, ++ FLASH_SPI_REG_BASE, ++ DMA_REG_BASE, ++ CSR_PMU_BASE, ++ CSR_RTC_BASE, ++ RTC_RAM_BASE, ++ D2_DMA_REG_BASE, ++ HCI_REG_BASE, ++ CO_REG_BASE, ++ EFS_REG_BASE, ++ SMS4_REG_BASE, ++ MRX_REG_BASE, ++ AMPDU_REG_BASE, ++ MT_REG_CSR_BASE, ++ TXQ0_MT_Q_REG_CSR_BASE, ++ TXQ1_MT_Q_REG_CSR_BASE, ++ TXQ2_MT_Q_REG_CSR_BASE, ++ TXQ3_MT_Q_REG_CSR_BASE, ++ TXQ4_MT_Q_REG_CSR_BASE, ++ HIF_INFO_BASE, ++ PHY_RATE_INFO_BASE, ++ MAC_GLB_SET_BASE, ++ BTCX_REG_BASE, ++ MIB_REG_BASE, ++ CBR_A_REG_BASE, ++ MB_REG_BASE, ++ ID_MNG_REG_BASE, ++ CSR_PHY_BASE, ++ CSR_RF_BASE, ++ MMU_REG_BASE, ++ 0x00000000 ++}; ++ ++static const char *STR_BANK_SSV6200[] = { ++ "SYS_REG", ++ "WBOOT_REG", ++ "TU0_US_REG", ++ "TU1_US_REG", ++ "TU2_US_REG", ++ "TU3_US_REG", ++ "TM0_MS_REG", ++ "TM1_MS_REG", ++ "TM2_MS_REG", ++ "TM3_MS_REG", ++ "MCU_WDT_REG", ++ "SYS_WDT_REG", ++ "GPIO_REG", ++ "SD_REG", ++ "SPI_REG", ++ "CSR_I2C_MST", ++ "UART_REG", ++ "DAT_UART_REG", ++ "INT_REG", ++ "DBG_SPI_REG", ++ "FLASH_SPI_REG", ++ "DMA_REG", ++ "CSR_PMU", ++ "CSR_RTC", ++ "RTC_RAM", ++ "D2_DMA_REG", ++ "HCI_REG", ++ "CO_REG", ++ "EFS_REG", ++ "SMS4_REG", ++ "MRX_REG", ++ "AMPDU_REG", ++ "MT_REG_CSR", ++ "TXQ0_MT_Q_REG_CSR", ++ "TXQ1_MT_Q_REG_CSR", ++ "TXQ2_MT_Q_REG_CSR", ++ "TXQ3_MT_Q_REG_CSR", ++ "TXQ4_MT_Q_REG_CSR", ++ "HIF_INFO", ++ "PHY_RATE_INFO", ++ "MAC_GLB_SET", ++ "BTCX_REG", ++ "MIB_REG", ++ "CBR_A_REG", ++ "MB_REG", ++ "ID_MNG_REG", ++ "CSR_PHY", ++ "CSR_RF", ++ "MMU_REG", ++ "" ++}; ++ ++static const u32 SIZE_BANK_SSV6200[] = { ++ SYS_REG_BANK_SIZE, ++ WBOOT_REG_BANK_SIZE, ++ TU0_US_REG_BANK_SIZE, ++ TU1_US_REG_BANK_SIZE, ++ TU2_US_REG_BANK_SIZE, ++ TU3_US_REG_BANK_SIZE, ++ TM0_MS_REG_BANK_SIZE, ++ TM1_MS_REG_BANK_SIZE, ++ TM2_MS_REG_BANK_SIZE, ++ TM3_MS_REG_BANK_SIZE, ++ MCU_WDT_REG_BANK_SIZE, ++ SYS_WDT_REG_BANK_SIZE, ++ GPIO_REG_BANK_SIZE, ++ SD_REG_BANK_SIZE, ++ SPI_REG_BANK_SIZE, ++ CSR_I2C_MST_BANK_SIZE, ++ UART_REG_BANK_SIZE, ++ DAT_UART_REG_BANK_SIZE, ++ INT_REG_BANK_SIZE, ++ DBG_SPI_REG_BANK_SIZE, ++ FLASH_SPI_REG_BANK_SIZE, ++ DMA_REG_BANK_SIZE, ++ CSR_PMU_BANK_SIZE, ++ CSR_RTC_BANK_SIZE, ++ RTC_RAM_BANK_SIZE, ++ D2_DMA_REG_BANK_SIZE, ++ HCI_REG_BANK_SIZE, ++ CO_REG_BANK_SIZE, ++ EFS_REG_BANK_SIZE, ++ SMS4_REG_BANK_SIZE, ++ MRX_REG_BANK_SIZE, ++ AMPDU_REG_BANK_SIZE, ++ MT_REG_CSR_BANK_SIZE, ++ TXQ0_MT_Q_REG_CSR_BANK_SIZE, ++ TXQ1_MT_Q_REG_CSR_BANK_SIZE, ++ TXQ2_MT_Q_REG_CSR_BANK_SIZE, ++ TXQ3_MT_Q_REG_CSR_BANK_SIZE, ++ TXQ4_MT_Q_REG_CSR_BANK_SIZE, ++ HIF_INFO_BANK_SIZE, ++ PHY_RATE_INFO_BANK_SIZE, ++ MAC_GLB_SET_BANK_SIZE, ++ BTCX_REG_BANK_SIZE, ++ MIB_REG_BANK_SIZE, ++ CBR_A_REG_BANK_SIZE, ++ MB_REG_BANK_SIZE, ++ ID_MNG_REG_BANK_SIZE, ++ CSR_PHY_BANK_SIZE, ++ CSR_RF_BANK_SIZE, ++ MMU_REG_BANK_SIZE, ++ 0x00000000 ++}; +diff --git a/drivers/net/wireless/ssv6051/include/ssv_cfg.h b/drivers/net/wireless/ssv6051/include/ssv_cfg.h +new file mode 100644 +index 000000000000..79b75619936e +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv_cfg.h +@@ -0,0 +1,60 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_CFG_H_ ++#define _SSV_CFG_H_ ++#define SSV6200_HW_CAP_HT 0x00000001 ++#define SSV6200_HW_CAP_GF 0x00000002 ++#define SSV6200_HW_CAP_2GHZ 0x00000004 ++#define SSV6200_HW_CAP_5GHZ 0x00000008 ++#define SSV6200_HW_CAP_SECURITY 0x00000010 ++#define SSV6200_HT_CAP_SGI_20 0x00000020 ++#define SSV6200_HT_CAP_SGI_40 0x00000040 ++#define SSV6200_HW_CAP_AP 0x00000080 ++#define SSV6200_HW_CAP_P2P 0x00000100 ++#define SSV6200_HW_CAP_AMPDU_RX 0x00000200 ++#define SSV6200_HW_CAP_AMPDU_TX 0x00000400 ++#define SSV6200_HW_CAP_TDLS 0x00000800 ++#define EXTERNEL_CONFIG_SUPPORT 64 ++struct ssv6xxx_cfg { ++ u32 hw_caps; ++ u32 def_chan; ++ u32 crystal_type; ++ u32 volt_regulator; ++ u32 force_chip_identity; ++ u8 maddr[2][6]; ++ u32 n_maddr; ++ u32 use_wpa2_only; ++ u32 ignore_reset_in_ap; ++ u32 r_calbration_result; ++ u32 sar_result; ++ u32 crystal_frequency_offset; ++ u32 tx_power_index_1; ++ u32 tx_power_index_2; ++ u32 chip_identity; ++ u32 wifi_tx_gain_level_gn; ++ u32 wifi_tx_gain_level_b; ++ u32 rssi_ctl; ++ u32 sr_bhvr; ++ u32 configuration[EXTERNEL_CONFIG_SUPPORT + 1][2]; ++ u8 firmware_path[128]; ++ u8 flash_bin_path[128]; ++ u8 mac_address_path[128]; ++ u8 mac_output_path[128]; ++ u32 ignore_efuse_mac; ++ u32 mac_address_mode; ++}; ++#endif +diff --git a/drivers/net/wireless/ssv6051/include/ssv_firmware_version.h b/drivers/net/wireless/ssv6051/include/ssv_firmware_version.h +new file mode 100644 +index 000000000000..7fabbe308f9d +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv_firmware_version.h +@@ -0,0 +1,25 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_FIRMWARE_VERSION_H_ ++#define _SSV_FIRMWARE_VERSION_H_ ++static u32 ssv_firmware_version = 16380; ++#define SSV_FIRMWARE_URl "http://192.168.15.30/svn/software/wifi/tag/smac-release-tag/6051.Q0.1009.21.000000/ssv6xxx/smac/firmware" ++#define FIRMWARE_COMPILERHOST "ssv-ThinkPad-X230" ++#define FIRMWARE_COMPILERDATE "11-06-2017-09:17:18" ++#define FIRMWARE_COMPILEROS "linux" ++#define FIRMWARE_COMPILEROSARCH "x86_64-linux-gnu-thread-multi" ++#endif +diff --git a/drivers/net/wireless/ssv6051/include/ssv_version.h b/drivers/net/wireless/ssv6051/include/ssv_version.h +new file mode 100644 +index 000000000000..99be5354f783 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/include/ssv_version.h +@@ -0,0 +1,12 @@ ++#ifndef _SSV_VERSION_H_ ++#define _SSV_VERSION_H_ ++ ++static u32 ssv_root_version = 16529; ++ ++#define SSV_ROOT_URl "http://192.168.15.30/svn/software/project/release/android/box/rk3x28/6051.Q0.1009.21.400401/ssv6xxx" ++#define COMPILERHOST "icomm-buildserver-T320" ++#define COMPILERDATE "12-08-2017-10:34:54" ++#define COMPILEROS "linux" ++#define COMPILEROSARCH "x86_64-linux-gnu-thread-multi" ++ ++#endif +diff --git a/drivers/net/wireless/ssv6051/platform-config.mak b/drivers/net/wireless/ssv6051/platform-config.mak +new file mode 100644 +index 000000000000..b1b6f0510d28 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/platform-config.mak +@@ -0,0 +1,97 @@ ++ ++ccflags-y += -DCONFIG_SSV6200_CORE ++ ++########################################################################### ++# Compiler options # ++########################################################################### ++ ++# Enable -g to help debug. Deassembly from .o to .S would help to track to ++# the problomatic line from call stack dump. ++#ccflags-y += -g ++ccflags += -Os ++ ++############################################################ ++# If you change the settings, please change the file synchronization ++# smac\firmware\include\config.h & compiler firmware ++############################################################ ++#ccflags-y += -DCONFIG_SSV_CABRIO_A ++ccflags-y += -DCONFIG_SSV_CABRIO_E ++ ++#CONFIG_SSV_SUPPORT_BTCX=y ++ ++#ccflags-y += -DDEBUG ++ccflags-y += -DCONFIG_SSV6200_CLI_ENABLE ++ ++#PADPD ++#ccflags-y += -DCONFIG_SSV_DPD ++ ++#ccflags-y += -DCONFIG_SSV_CABRIO_MB_DEBUG ++#ccflags-y += -DCONFIG_SSV6XXX_DEBUGFS ++ ++#SDIO ++ccflags-y += -DCONFIG_SSV_TX_LOWTHRESHOLD ++ ++ccflags-y += -DCONFIG_FW_ALIGNMENT_CHECK ++ccflags-y += -DCONFIG_PLATFORM_SDIO_OUTPUT_TIMING=3 ++ccflags-y += -DCONFIG_PLATFORM_SDIO_BLOCK_SIZE=128 ++#ccflags-y += -DMULTI_THREAD_ENCRYPT ++#ccflags-y += -DKTHREAD_BIND ++#ccflags-y += -DROCKCHIP_WIFI_AUTO_SUPPORT ++ccflags-y += -DCONFIG_SSV_RSSI ++ccflags-y += -DCONFIG_SSV_VENDOR_EXT_SUPPORT ++ ++############################################################ ++# Rate control update for MPDU. ++############################################################ ++ccflags-y += -DRATE_CONTROL_REALTIME_UPDATA ++ ++#workaround ++#ccflags-y += -DCONFIG_SSV_CABRIO_EXT_PA ++ ++############################################################ ++# NOTE: ++# Only one of the following flags could be turned on. ++# It also turned off the following flags. In this case, ++# pure software security or pure hardware security is used. ++# ++############################################################ ++#ccflags-y += -DCONFIG_SSV_SW_ENCRYPT_HW_DECRYPT ++#ccflags-y += -DCONFIG_SSV_HW_ENCRYPT_SW_DECRYPT ++ ++# FOR WFA ++#ccflags-y += -DWIFI_CERTIFIED ++ ++#ccflags-y += -DCONFIG_SSV_SDIO_EXT_INT ++ ++####################################################### ++ccflags-y += -DCONFIG_SSV6200_HAS_RX_WORKQUEUE ++#ccflags-y += -DUSE_THREAD_RX ++ccflags-y += -DUSE_THREAD_TX ++ccflags-y += -DENABLE_AGGREGATE_IN_TIME ++ccflags-y += -DENABLE_INCREMENTAL_AGGREGATION ++ ++# Generic decision table applicable to both AP and STA modes. ++ccflags-y += -DUSE_GENERIC_DECI_TBL ++ ++#ccflags-y += -DCONFIG_SSV_WAPI ++ ++ccflags-y += -DFW_WSID_WATCH_LIST ++#ccflags-y += -DUSE_BATCH_RX ++#ccflags-y += -DCONFIG_IRQ_DEBUG_COUNT ++ ++ccflags-y += -DSSV6200_ECO ++#ccflags-y += -DENABLE_WAKE_IO_ISR_WHEN_HCI_ENQUEUE ++ccflags-y += -DHAS_CRYPTO_LOCK ++ccflags-y += -DENABLE_TX_Q_FLOW_CONTROL ++ ++#ccflags-y += -DCONFIG_DEBUG_SKB_TIMESTAMP ++ ++ ++#enable p2p client to parse GO broadcast noa ++#ccflags-y += -DCONFIG_P2P_NOA ++ ++#enable rx management frame check ++#ccflags-y += -DCONFIG_RX_MGMT_CHECK ++ ++#force SW Broadcast/Multicast decryption ++ccflags-y += -DUSE_MAC80211_DECRYPT_BROADCAST +\ No newline at end of file +diff --git a/drivers/net/wireless/ssv6051/rules.mak b/drivers/net/wireless/ssv6051/rules.mak +new file mode 100644 +index 000000000000..b3262852249c +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/rules.mak +@@ -0,0 +1,19 @@ ++ ++ ++$(KMODULE_NAME)-y += $(KERN_SRCS:.c=.o) ++obj-$(CONFIG_SSV6200_CORE) += $(KMODULE_NAME).o ++ ++ ++.PHONY: all clean install ++ ++all: ++ @$(MAKE) -C /lib/modules/$(KVERSION)/build \ ++ SUBDIRS=$(KBUILD_DIR) CONFIG_DEBUG_SECTION_MISMATCH=y \ ++ modules ++ ++clean: ++ @$(MAKE) -C /lib/modules/$(KVERSION)/build SUBDIRS=$(KBUILD_DIR) clean ++ ++install: ++ @$(MAKE) INSTALL_MOD_DIR=$(DRVPATH) -C /lib/modules/$(KVERSION)/build \ ++ M=$(KBUILD_DIR) modules_install +diff --git a/drivers/net/wireless/ssv6051/smac/ampdu.c b/drivers/net/wireless/ssv6051/smac/ampdu.c +new file mode 100644 +index 000000000000..846830f3d209 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ampdu.c +@@ -0,0 +1,2111 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include "dev.h" ++#include "ap.h" ++#include "sec.h" ++#include "ssv_rc_common.h" ++#include "ssv_ht_rc.h" ++extern struct ieee80211_ops ssv6200_ops; ++ ++// Hack: redefine MAX_AMPDU_BUF because buf_size here is a 8-bit char ++// and mainline kernel value is 0x100, which overflows ++#ifdef IEEE80211_MAX_AMPDU_BUF ++#undef IEEE80211_MAX_AMPDU_BUF ++#endif ++#define IEEE80211_MAX_AMPDU_BUF 0x40 ++ ++#define BA_WAIT_TIMEOUT (800) ++#define AMPDU_BA_FRAME_LEN (68) ++#define ampdu_skb_hdr(skb) ((struct ieee80211_hdr*)((u8*)((skb)->data)+AMPDU_DELIMITER_LEN)) ++#define ampdu_skb_ssn(skb) ((ampdu_skb_hdr(skb)->seq_ctrl)>>SSV_SEQ_NUM_SHIFT) ++#define ampdu_hdr_ssn(hdr) ((hdr)->seq_ctrl>>SSV_SEQ_NUM_SHIFT) ++#undef prn_aggr_dbg ++#define prn_aggr_dbg(fmt,...) ++static void void_func(const char *fmt, ...) ++{ ++} ++ ++#define prn_aggr_err(fmt,...) \ ++ do { \ ++ void_func(KERN_ERR fmt, ##__VA_ARGS__);\ ++ } while (0) ++#define get_tid_aggr_len(agg_len,tid_data) \ ++ ({ \ ++ u32 agg_max_num = (tid_data)->agg_num_max; \ ++ u32 to_agg_len = (agg_len); \ ++ (agg_len >= agg_max_num) ? agg_max_num : to_agg_len; \ ++ }) ++#define INDEX_PKT_BY_SSN(tid,ssn) \ ++ ((tid)->aggr_pkts[(ssn) % SSV_AMPDU_BA_WINDOW_SIZE]) ++#define NEXT_PKT_SN(sn) \ ++ ({ (sn + 1) % SSV_AMPDU_MAX_SSN; }) ++#define INC_PKT_SN(sn) \ ++ ({ \ ++ sn = NEXT_PKT_SN(sn); \ ++ sn; \ ++ }) ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++static ssize_t ampdu_tx_mib_dump(struct ssv_sta_priv_data *ssv_sta_priv, ++ char *mib_str, ssize_t length); ++static int _dump_ba_skb(char *buf, int buf_size, struct sk_buff *ba_skb); ++#endif ++static struct sk_buff *_aggr_retry_mpdu(struct ssv_softc *sc, ++ struct AMPDU_TID_st *cur_AMPDU_TID, ++ struct sk_buff_head *retry_queue, ++ u32 max_aggr_len); ++static int _dump_BA_notification(char *buf, ++ struct ampdu_ba_notify_data *ba_notification); ++static struct sk_buff *_alloc_ampdu_skb(struct ssv_softc *sc, ++ struct AMPDU_TID_st *ampdu_tid, ++ u32 len); ++static bool _sync_ampdu_pkt_arr(struct AMPDU_TID_st *ampdu_tid, ++ struct sk_buff *ampdu_skb, bool retry); ++static void _put_mpdu_to_ampdu(struct sk_buff *ampdu, struct sk_buff *mpdu); ++static void _add_ampdu_txinfo(struct ssv_softc *sc, struct sk_buff *ampdu_skb); ++static u32 _flush_early_ampdu_q(struct ssv_softc *sc, ++ struct AMPDU_TID_st *ampdu_tid); ++static bool _is_skb_q_empty(struct ssv_softc *sc, struct sk_buff *skb); ++static void _aggr_ampdu_tx_q(struct ieee80211_hw *hw, ++ struct AMPDU_TID_st *ampdu_tid); ++static void _queue_early_ampdu(struct ssv_softc *sc, ++ struct AMPDU_TID_st *ampdu_tid, ++ struct sk_buff *ampdu_skb); ++static int _mark_skb_retry(struct SKB_info_st *skb_info, struct sk_buff *skb); ++#ifdef CONFIG_DEBUG_SKB_TIMESTAMP ++unsigned int cal_duration_of_ampdu(struct sk_buff *ampdu_skb, int stage) ++{ ++ unsigned int timeout; ++ SKB_info *mpdu_skb_info; ++ u16 ssn = 0; ++ struct sk_buff *mpdu = NULL; ++ struct ampdu_hdr_st *ampdu_hdr = NULL; ++ ktime_t current_ktime; ++ ampdu_hdr = (struct ampdu_hdr_st *)ampdu_skb->head; ++ ssn = ampdu_hdr->ssn[0]; ++ mpdu = INDEX_PKT_BY_SSN(ampdu_hdr->ampdu_tid, ssn); ++ if (mpdu == NULL) ++ return 0; ++ mpdu_skb_info = (SKB_info *) (mpdu->head); ++ current_ktime = ktime_get(); ++ timeout = ++ (unsigned int) ++ ktime_to_ms(ktime_sub(current_ktime, mpdu_skb_info->timestamp)); ++ if (timeout > SKB_DURATION_TIMEOUT_MS) { ++ if (stage == SKB_DURATION_STAGE_TO_SDIO) ++ pr_debug("*a_to_sdio: %ums\n", timeout); ++ else if (stage == SKB_DURATION_STAGE_TX_ENQ) ++ pr_debug("*a_to_txenqueue: %ums\n", timeout); ++ else ++ pr_debug("*a_in_hwq: %ums\n", timeout); ++ } ++ return timeout; ++} ++#endif ++static u8 _cal_ampdu_delm_half_crc(u8 value) ++{ ++ u32 c32 = value, v32 = value; ++ c32 ^= (v32 >> 1) | (v32 << 7); ++ c32 ^= (v32 >> 2); ++ if (v32 & 2) ++ c32 ^= (0xC0); ++ c32 ^= ((v32 << 4) & 0x30); ++ return (u8) c32; ++} ++ ++static u8 _cal_ampdu_delm_crc(u8 * pointer) ++{ ++ u8 crc = 0xCF; ++ crc ^= _cal_ampdu_delm_half_crc(*pointer++); ++ crc = ++ _cal_ampdu_delm_half_crc(crc) ^ _cal_ampdu_delm_half_crc(*pointer); ++ return ~crc; ++} ++ ++static bool ssv6200_ampdu_add_delimiter_and_crc32(struct sk_buff *mpdu) ++{ ++ p_AMPDU_DELIMITER delimiter_p; ++ struct ieee80211_hdr *mpdu_hdr; ++ int ret; ++ u32 orig_mpdu_len = mpdu->len; ++ u32 pad = (4 - (orig_mpdu_len % 4)) % 4; ++ mpdu_hdr = (struct ieee80211_hdr *)(mpdu->data); ++ mpdu_hdr->duration_id = AMPDU_TX_NAV_MCS_567; ++ ret = skb_padto(mpdu, mpdu->len + (AMPDU_FCS_LEN + pad)); ++ if (ret) { ++ pr_err("Failed to extand skb for aggregation\n"); ++ return false; ++ } ++ skb_put(mpdu, AMPDU_FCS_LEN + pad); ++ skb_push(mpdu, AMPDU_DELIMITER_LEN); ++ delimiter_p = (p_AMPDU_DELIMITER) mpdu->data; ++ delimiter_p->reserved = 0; ++ delimiter_p->length = orig_mpdu_len + AMPDU_FCS_LEN; ++ delimiter_p->signature = AMPDU_SIGNATURE; ++ delimiter_p->crc = _cal_ampdu_delm_crc((u8 *) (delimiter_p)); ++ return true; ++} ++ ++static void ssv6200_ampdu_hw_init(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ u32 temp32; ++ SMAC_REG_READ(sc->sh, ADR_MTX_MISC_EN, &temp32); ++ temp32 |= (0x1 << MTX_AMPDU_CRC_AUTO_SFT); ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_MISC_EN, temp32); ++ SMAC_REG_READ(sc->sh, ADR_MTX_MISC_EN, &temp32); ++} ++ ++bool _sync_ampdu_pkt_arr(struct AMPDU_TID_st *ampdu_tid, struct sk_buff *ampdu, ++ bool retry) ++{ ++ struct sk_buff **pp_aggr_pkt; ++ struct sk_buff *p_aggr_pkt; ++ unsigned long flags; ++ struct ampdu_hdr_st *ampdu_hdr = (struct ampdu_hdr_st *)ampdu->head; ++ struct sk_buff *mpdu; ++ u32 first_ssn = SSV_ILLEGAL_SN; ++ u32 old_aggr_pkt_num; ++ u32 old_baw_head; ++ u32 sync_num = skb_queue_len(&du_hdr->mpdu_q); ++ bool ret = true; ++ spin_lock_irqsave(&du_tid->pkt_array_lock, flags); ++ old_baw_head = ampdu_tid->ssv_baw_head; ++ old_aggr_pkt_num = ampdu_tid->aggr_pkt_num; ++ ampdu_tid->mib.ampdu_mib_ampdu_counter += 1; ++ ampdu_tid->mib.ampdu_mib_dist[sync_num] += 1; ++ do { ++ if (!retry) { ++ ampdu_tid->mib.ampdu_mib_mpdu_counter += sync_num; ++ mpdu = skb_peek_tail(&du_hdr->mpdu_q); ++ if (mpdu == NULL) { ++ ret = false; ++ break; ++ } else { ++ u32 ssn = ampdu_skb_ssn(mpdu); ++ p_aggr_pkt = INDEX_PKT_BY_SSN(ampdu_tid, ssn); ++ if (p_aggr_pkt != NULL) { ++ char msg[256]; ++ u32 sn = ampdu_skb_ssn(mpdu); ++ skb_queue_walk(&du_hdr->mpdu_q, mpdu) { ++ sn = ampdu_skb_ssn(mpdu); ++ sprintf(msg, " %d", sn); ++ } ++ prn_aggr_err("ES %d -> %d (%s)\n", ++ ssn, ++ ampdu_skb_ssn(p_aggr_pkt), ++ msg); ++ ret = false; ++ break; ++ } ++ } ++ } else ++ ampdu_tid->mib.ampdu_mib_aggr_retry_counter += 1; ++ skb_queue_walk(&du_hdr->mpdu_q, mpdu) { ++ u32 ssn = ampdu_skb_ssn(mpdu); ++ SKB_info *mpdu_skb_info = (SKB_info *) (mpdu->head); ++ if (first_ssn == SSV_ILLEGAL_SN) ++ first_ssn = ssn; ++ pp_aggr_pkt = &INDEX_PKT_BY_SSN(ampdu_tid, ssn); ++ p_aggr_pkt = *pp_aggr_pkt; ++ *pp_aggr_pkt = mpdu; ++ if (!retry) ++ ampdu_tid->aggr_pkt_num++; ++ mpdu_skb_info->ampdu_tx_status = AMPDU_ST_AGGREGATED; ++ if (ampdu_tid->ssv_baw_head == SSV_ILLEGAL_SN) { ++ ampdu_tid->ssv_baw_head = ssn; ++ } ++ if ((p_aggr_pkt != NULL) && (mpdu != p_aggr_pkt)) ++ prn_aggr_err("%d -> %d (H%d, N%d, Q%d)\n", ++ ssn, ampdu_skb_ssn(p_aggr_pkt), ++ old_baw_head, old_aggr_pkt_num, ++ sync_num); ++ } ++ } while (0); ++ spin_unlock_irqrestore(&du_tid->pkt_array_lock, flags); ++ { ++ u32 page_count = (ampdu->len + SSV6200_ALLOC_RSVD); ++ if (page_count & HW_MMU_PAGE_MASK) ++ page_count = (page_count >> HW_MMU_PAGE_SHIFT) + 1; ++ else ++ page_count = page_count >> HW_MMU_PAGE_SHIFT; ++ if (page_count > (SSV6200_PAGE_TX_THRESHOLD / 2)) ++ pr_err("AMPDU requires pages %d(%d-%d-%d) exceeds resource limit %d.\n", ++ page_count, ampdu->len, ampdu_hdr->max_size, ++ ampdu_hdr->size, ++ (SSV6200_PAGE_TX_THRESHOLD / 2)); ++ } ++ return ret; ++} ++ ++struct sk_buff *_aggr_retry_mpdu(struct ssv_softc *sc, ++ struct AMPDU_TID_st *ampdu_tid, ++ struct sk_buff_head *retry_queue, ++ u32 max_aggr_len) ++{ ++ struct sk_buff *retry_mpdu; ++ struct sk_buff *new_ampdu_skb; ++ u32 num_retry_mpdu; ++ u32 temp_i; ++ u32 total_skb_size; ++ unsigned long flags; ++ u16 head_ssn = ampdu_tid->ssv_baw_head; ++ struct ampdu_hdr_st *ampdu_hdr; ++ BUG_ON(head_ssn == SSV_ILLEGAL_SN); ++ num_retry_mpdu = skb_queue_len(retry_queue); ++ if (num_retry_mpdu == 0) ++ return NULL; ++ new_ampdu_skb = _alloc_ampdu_skb(sc, ampdu_tid, max_aggr_len); ++ if (new_ampdu_skb == 0) ++ return NULL; ++ ampdu_hdr = (struct ampdu_hdr_st *)new_ampdu_skb->head; ++ total_skb_size = 0; ++ spin_lock_irqsave(&retry_queue->lock, flags); ++ for (temp_i = 0; temp_i < ampdu_tid->agg_num_max; temp_i++) { ++ struct ieee80211_hdr *mpdu_hdr; ++ u16 mpdu_sn; ++ u16 diff; ++ u32 new_total_skb_size; ++ retry_mpdu = skb_peek(retry_queue); ++ if (retry_mpdu == NULL) { ++ break; ++ } ++ mpdu_hdr = ampdu_skb_hdr(retry_mpdu); ++ mpdu_sn = ampdu_hdr_ssn(mpdu_hdr); ++ diff = SSV_AMPDU_SN_a_minus_b(head_ssn, mpdu_sn); ++ if ((head_ssn != SSV_ILLEGAL_SN) ++ && (diff > 0) ++ && (diff <= ampdu_tid->ssv_baw_size)) { ++ struct SKB_info_st *skb_info; ++ prn_aggr_err("Z. release skb (s %d, h %d, d %d)\n", ++ mpdu_sn, head_ssn, diff); ++ skb_info = (struct SKB_info_st *)(retry_mpdu->head); ++ skb_info->ampdu_tx_status = AMPDU_ST_DROPPED; ++ ampdu_tid->mib.ampdu_mib_discard_counter++; ++ continue; ++ } ++ new_total_skb_size = total_skb_size + retry_mpdu->len; ++ if (new_total_skb_size > ampdu_hdr->max_size) ++ break; ++ total_skb_size = new_total_skb_size; ++ retry_mpdu = __skb_dequeue(retry_queue); ++ _put_mpdu_to_ampdu(new_ampdu_skb, retry_mpdu); ++ ampdu_tid->mib.ampdu_mib_retry_counter++; ++ } ++ ampdu_tid->mib.ampdu_mib_aggr_retry_counter += 1; ++ ampdu_tid->mib.ampdu_mib_dist[temp_i] += 1; ++ spin_unlock_irqrestore(&retry_queue->lock, flags); ++ if (ampdu_hdr->mpdu_num == 0) { ++ dev_kfree_skb_any(new_ampdu_skb); ++ return NULL; ++ } ++ return new_ampdu_skb; ++} ++ ++static void _add_ampdu_txinfo(struct ssv_softc *sc, struct sk_buff *ampdu_skb) ++{ ++ struct ssv6200_tx_desc *tx_desc; ++ ssv6xxx_add_txinfo(sc, ampdu_skb); ++ tx_desc = (struct ssv6200_tx_desc *)ampdu_skb->data; ++ tx_desc->tx_report = 1; ++} ++ ++void _send_hci_skb(struct ssv_softc *sc, struct sk_buff *skb, u32 tx_flag) ++{ ++ struct ssv6200_tx_desc *tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ int ret = AMPDU_HCI_SEND(sc->sh, skb, tx_desc->txq_idx, tx_flag); ++ if ((tx_desc->txq_idx > 3) && (ret <= 0)) { ++ prn_aggr_err("BUG!! %d %d\n", tx_desc->txq_idx, ret); ++ } ++} ++ ++static void ssv6200_ampdu_add_txinfo_and_send_HCI(struct ssv_softc *sc, ++ struct sk_buff *ampdu_skb, ++ u32 tx_flag) ++{ ++ _add_ampdu_txinfo(sc, ampdu_skb); ++ _send_hci_skb(sc, ampdu_skb, tx_flag); ++} ++ ++static void ssv6200_ampdu_send_retry(struct ieee80211_hw *hw, ++ AMPDU_TID * cur_ampdu_tid, ++ struct sk_buff_head ++ *ampdu_skb_retry_queue_p, ++ bool send_aggr_tx) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct sk_buff *ampdu_retry_skb; ++ u32 ampdu_skb_retry_queue_len; ++ u32 max_agg_len; ++ u16 lowest_rate; ++ struct fw_rc_retry_params rates[SSV62XX_TX_MAX_RATES]; ++ ampdu_skb_retry_queue_len = skb_queue_len(ampdu_skb_retry_queue_p); ++ if (ampdu_skb_retry_queue_len == 0) ++ return; ++ ampdu_retry_skb = skb_peek(ampdu_skb_retry_queue_p); ++ lowest_rate = ssv62xx_ht_rate_update(ampdu_retry_skb, sc, rates); ++ max_agg_len = ampdu_max_transmit_length[lowest_rate]; ++ if (max_agg_len > 0) { ++ u32 cur_ampdu_max_size = SSV_GET_MAX_AMPDU_SIZE(sc->sh); ++ if (max_agg_len >= cur_ampdu_max_size) ++ max_agg_len = cur_ampdu_max_size; ++ while (ampdu_skb_retry_queue_len > 0) { ++ struct sk_buff *retry_mpdu = ++ skb_peek(ampdu_skb_retry_queue_p); ++ SKB_info *mpdu_skb_info = ++ (SKB_info *) (retry_mpdu->head); ++ mpdu_skb_info->lowest_rate = lowest_rate; ++ memcpy(mpdu_skb_info->rates, rates, sizeof(rates)); ++ ampdu_retry_skb = ++ _aggr_retry_mpdu(sc, cur_ampdu_tid, ++ ampdu_skb_retry_queue_p, ++ max_agg_len); ++ if (ampdu_retry_skb != NULL) { ++ _sync_ampdu_pkt_arr(cur_ampdu_tid, ++ ampdu_retry_skb, true); ++ ssv6200_ampdu_add_txinfo_and_send_HCI(sc, ++ ampdu_retry_skb, ++ AMPDU_HCI_SEND_HEAD_WITHOUT_FLOWCTRL); ++ } else { ++ prn_aggr_err("AMPDU retry failed.\n"); ++ return; ++ } ++ ampdu_skb_retry_queue_len = ++ skb_queue_len(ampdu_skb_retry_queue_p); ++ } ++ } else { ++ struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; ++ struct ieee80211_tx_info *info = ++ IEEE80211_SKB_CB(ampdu_retry_skb); ++ memcpy(rates, info->control.rates, sizeof(info->control.rates)); ++ while ((ampdu_retry_skb = ++ __skb_dequeue_tail(ampdu_skb_retry_queue_p)) != NULL) { ++ struct ieee80211_tx_info *info = ++ IEEE80211_SKB_CB(ampdu_retry_skb); ++ info->flags &= ~IEEE80211_TX_CTL_AMPDU; ++ memcpy(info->control.rates, rates, ++ sizeof(info->control.rates)); ++ ssv6xxx_update_txinfo(sc, ampdu_retry_skb); ++ _send_hci_skb(sc, ampdu_retry_skb, ++ AMPDU_HCI_SEND_HEAD_WITHOUT_FLOWCTRL); ++ } ++ } ++} ++ ++void ssv6200_ampdu_init(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ ssv6200_ampdu_hw_init(hw); ++ sc->tx.ampdu_tx_group_id = 0; ++#ifdef USE_ENCRYPT_WORK ++ INIT_WORK(&sc->ampdu_tx_encry_work, encry_work); ++ INIT_WORK(&sc->sync_hwkey_work, sync_hw_key_work); ++#endif ++} ++ ++void ssv6200_ampdu_deinit(struct ieee80211_hw *hw) ++{ ++} ++ ++void ssv6200_ampdu_release_skb(struct sk_buff *skb, struct ieee80211_hw *hw) ++{ ++ ieee80211_free_txskb(hw, skb); ++} ++ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++struct mib_dump_data { ++ char *prt_buff; ++ size_t buff_size; ++ size_t prt_len; ++}; ++#define AMPDU_TX_MIB_SUMMARY_BUF_SIZE (4096) ++static ssize_t ampdu_tx_mib_summary_read(struct file *file, ++ char __user * user_buf, size_t count, ++ loff_t * ppos) ++{ ++ struct ssv_sta_priv_data *ssv_sta_priv = ++ (struct ssv_sta_priv_data *)file->private_data; ++ char *summary_buf = kzalloc(AMPDU_TX_MIB_SUMMARY_BUF_SIZE, GFP_KERNEL); ++ ssize_t summary_size; ++ ssize_t ret; ++ if (!summary_buf) ++ return -ENOMEM; ++ summary_size = ampdu_tx_mib_dump(ssv_sta_priv, summary_buf, ++ AMPDU_TX_MIB_SUMMARY_BUF_SIZE); ++ ret = simple_read_from_buffer(user_buf, count, ppos, summary_buf, ++ summary_size); ++ kfree(summary_buf); ++ return ret; ++} ++ ++static int ampdu_tx_mib_summary_open(struct inode *inode, struct file *file) ++{ ++ file->private_data = inode->i_private; ++ return 0; ++} ++ ++static const struct file_operations mib_summary_fops = {.read = ++ ampdu_tx_mib_summary_read,.open = ampdu_tx_mib_summary_open, ++}; ++ ++static ssize_t ampdu_tx_tid_window_read(struct file *file, ++ char __user * user_buf, size_t count, ++ loff_t * ppos) ++{ ++ struct AMPDU_TID_st *ampdu_tid = ++ (struct AMPDU_TID_st *)file->private_data; ++ char *summary_buf = kzalloc(AMPDU_TX_MIB_SUMMARY_BUF_SIZE, GFP_KERNEL); ++ ssize_t ret; ++ char *prn_ptr = summary_buf; ++ int prt_size; ++ int buf_size = AMPDU_TX_MIB_SUMMARY_BUF_SIZE; ++ int i; ++ struct sk_buff *ba_skb, *tmp_ba_skb; ++ if (!summary_buf) ++ return -ENOMEM; ++ prt_size = snprintf(prn_ptr, buf_size, "\nWMM_TID %d:\n" ++ "\tWindow:", ampdu_tid->tidno); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ for (i = 0; i < SSV_AMPDU_BA_WINDOW_SIZE; i++) { ++ struct sk_buff *skb = ampdu_tid->aggr_pkts[i]; ++ if ((i % 8) == 0) { ++ prt_size = snprintf(prn_ptr, buf_size, "\n\t\t"); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ } ++ if (skb == NULL) ++ prt_size = snprintf(prn_ptr, buf_size, " %s", "NULL "); ++ else { ++ struct SKB_info_st *skb_info = ++ (struct SKB_info_st *)(skb->head); ++ const char status_symbol[] = { 'N', ++ 'A', ++ 'S', ++ 'R', ++ 'P', ++ 'D' ++ }; ++ prt_size = ++ snprintf(prn_ptr, buf_size, " %4d%c", ++ ampdu_skb_ssn(skb), ++ ((skb_info->ampdu_tx_status <= ++ AMPDU_ST_DONE) ++ ? status_symbol[skb_info->ampdu_tx_status] ++ : 'X')); ++ } ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ } ++ prt_size = ++ snprintf(prn_ptr, buf_size, "\n\tEarly aggregated #: %d\n", ++ ampdu_tid->early_aggr_skb_num); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(prn_ptr, buf_size, "\tBAW skb #: %d\n", ++ ampdu_tid->aggr_pkt_num); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(prn_ptr, buf_size, "\tBAW head: %d\n", ++ ampdu_tid->ssv_baw_head); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(prn_ptr, buf_size, "\tState: %d\n", ampdu_tid->state); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(prn_ptr, buf_size, "\tBA:\n"); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ skb_queue_walk_safe(&du_tid->ba_q, ba_skb, tmp_ba_skb) { ++ prt_size = _dump_ba_skb(prn_ptr, buf_size, ba_skb); ++ prn_ptr += prt_size; ++ buf_size -= prt_size; ++ } ++ buf_size = AMPDU_TX_MIB_SUMMARY_BUF_SIZE - buf_size; ++ ret = simple_read_from_buffer(user_buf, count, ppos, summary_buf, ++ buf_size); ++ kfree(summary_buf); ++ return ret; ++} ++ ++static int ampdu_tx_tid_window_open(struct inode *inode, struct file *file) ++{ ++ file->private_data = inode->i_private; ++ return 0; ++} ++ ++static const struct file_operations tid_window_fops = {.read = ++ ampdu_tx_tid_window_read,.open = ampdu_tx_tid_window_open, ++}; ++ ++static int ampdu_tx_mib_reset_open(struct inode *inode, struct file *file) ++{ ++ file->private_data = inode->i_private; ++ return 0; ++} ++ ++static ssize_t ampdu_tx_mib_reset_read(struct file *file, ++ char __user * user_buf, size_t count, ++ loff_t * ppos) ++{ ++ char *reset_buf = kzalloc(64, GFP_KERNEL); ++ ssize_t ret; ++ u32 reset_size; ++ if (!reset_buf) ++ return -ENOMEM; ++ reset_size = snprintf(reset_buf, 63, "%d", 0); ++ ret = simple_read_from_buffer(user_buf, count, ppos, reset_buf, ++ reset_size); ++ kfree(reset_buf); ++ return ret; ++} ++ ++static ssize_t ampdu_tx_mib_reset_write(struct file *file, ++ const char __user * buffer, ++ size_t count, loff_t * pos) ++{ ++ struct AMPDU_TID_st *ampdu_tid = ++ (struct AMPDU_TID_st *)file->private_data; ++ memset(&du_tid->mib, 0, sizeof(struct AMPDU_MIB_st)); ++ return count; ++} ++ ++static const struct file_operations mib_reset_fops ++ = {.read = ampdu_tx_mib_reset_read, ++ .open = ampdu_tx_mib_reset_open, ++ .write = ampdu_tx_mib_reset_write ++}; ++ ++static void ssv6200_ampdu_tx_init_debugfs(struct ssv_softc *sc, ++ struct ssv_sta_priv_data ++ *ssv_sta_priv) ++{ ++ struct ssv_sta_info *sta_info = ssv_sta_priv->sta_info; ++ int i; ++ struct dentry *sta_debugfs_dir = sta_info->debugfs_dir; ++ dev_info(sc->dev, "Creating AMPDU TX debugfs.\n"); ++ if (sta_debugfs_dir == NULL) { ++ dev_err(sc->dev, "No STA debugfs.\n"); ++ return; ++ } ++ debugfs_create_file("ampdu_tx_summary", 00444, sta_debugfs_dir, ++ ssv_sta_priv, &mib_summary_fops); ++ debugfs_create_u32("total_BA", 00644, sta_debugfs_dir, ++ &ssv_sta_priv->ampdu_mib_total_BA_counter); ++ for (i = 0; i < WMM_TID_NUM; i++) { ++ char debugfs_name[20]; ++ struct dentry *ampdu_tx_debugfs_dir; ++ int j; ++ struct AMPDU_TID_st *ampdu_tid = &ssv_sta_priv->ampdu_tid[i]; ++ struct AMPDU_MIB_st *ampdu_mib = &du_tid->mib; ++ snprintf(debugfs_name, sizeof(debugfs_name), "ampdu_tx_%d", i); ++ ampdu_tx_debugfs_dir = debugfs_create_dir(debugfs_name, ++ sta_debugfs_dir); ++ if (ampdu_tx_debugfs_dir == NULL) { ++ dev_err(sc->dev, ++ "Failed to create debugfs for AMPDU TX TID %d: %s\n", ++ i, debugfs_name); ++ continue; ++ } ++ ssv_sta_priv->ampdu_tid[i].debugfs_dir = ampdu_tx_debugfs_dir; ++ debugfs_create_file("baw_status", 00444, ampdu_tx_debugfs_dir, ++ ampdu_tid, &tid_window_fops); ++ debugfs_create_file("reset", 00644, ampdu_tx_debugfs_dir, ++ ampdu_tid, &mib_reset_fops); ++ debugfs_create_u32("total", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_ampdu_counter); ++ debugfs_create_u32("retry", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_retry_counter); ++ debugfs_create_u32("aggr_retry", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_aggr_retry_counter); ++ debugfs_create_u32("BAR", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_bar_counter); ++ debugfs_create_u32("Discarded", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_discard_counter); ++ debugfs_create_u32("BA", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_BA_counter); ++ debugfs_create_u32("Pass", 00444, ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_pass_counter); ++ for (j = 0; j <= SSV_AMPDU_aggr_num_max; j++) { ++ char dist_dbg_name[10]; ++ snprintf(dist_dbg_name, sizeof(dist_dbg_name), ++ "aggr_%d", j); ++ debugfs_create_u32(dist_dbg_name, 00444, ++ ampdu_tx_debugfs_dir, ++ &du_mib->ampdu_mib_dist[j]); ++ } ++ skb_queue_head_init(&ssv_sta_priv->ampdu_tid[i].ba_q); ++ } ++} ++#endif ++void ssv6200_ampdu_tx_add_sta(struct ieee80211_hw *hw, ++ struct ieee80211_sta *sta) ++{ ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ struct ssv_softc *sc; ++ u32 temp_i; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ sc = (struct ssv_softc *)hw->priv; ++ for (temp_i = 0; temp_i < WMM_TID_NUM; temp_i++) { ++ ssv_sta_priv->ampdu_tid[temp_i].sta = sta; ++ ssv_sta_priv->ampdu_tid[temp_i].state = AMPDU_STATE_STOP; ++ spin_lock_init(&ssv_sta_priv->ampdu_tid[temp_i]. ++ ampdu_skb_tx_queue_lock); ++ spin_lock_init(&ssv_sta_priv->ampdu_tid[temp_i].pkt_array_lock); ++ } ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ssv6200_ampdu_tx_init_debugfs(sc, ssv_sta_priv); ++#endif ++} ++ ++void ssv6200_ampdu_tx_start(u16 tid, struct ieee80211_sta *sta, ++ struct ieee80211_hw *hw, u16 * ssn) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ struct AMPDU_TID_st *ampdu_tid; ++ int i; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ ampdu_tid = &ssv_sta_priv->ampdu_tid[tid]; ++ ampdu_tid->ssv_baw_head = SSV_ILLEGAL_SN; ++#ifdef DEBUG_AMPDU_FLUSH ++ pr_debug("Adding %02X-%02X-%02X-%02X-%02X-%02X TID %d (%p).\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], ++ sta->addr[3], sta->addr[4], sta->addr[5], ++ ampdu_tid->tidno, ampdu_tid); ++ { ++ int j; ++ for (j = 0; j <= MAX_TID; j++) { ++ if (sc->tid[j] == 0) ++ break; ++ } ++ if (j == MAX_TID) { ++ dev_err(sc->dev, "No room for new TID.\n"); ++ } else ++ sc->tid[j] = ampdu_tid; ++ } ++#endif ++ list_add_tail_rcu(&du_tid->list, &sc->tx.ampdu_tx_que); ++ skb_queue_head_init(&du_tid->ampdu_skb_tx_queue); ++ skb_queue_head_init(&du_tid->early_aggr_ampdu_q); ++ ampdu_tid->early_aggr_skb_num = 0; ++ skb_queue_head_init(&du_tid->ampdu_skb_wait_encry_queue); ++ skb_queue_head_init(&du_tid->retry_queue); ++ skb_queue_head_init(&du_tid->release_queue); ++ for (i = 0; ++ i < ++ (sizeof(ampdu_tid->aggr_pkts) / sizeof(ampdu_tid->aggr_pkts[0])); ++ i++) ++ ampdu_tid->aggr_pkts[i] = 0; ++ ampdu_tid->aggr_pkt_num = 0; ++ ampdu_tid->cur_ampdu_pkt = _alloc_ampdu_skb(sc, ampdu_tid, 0); ++#ifdef AMPDU_CHECK_SKB_SEQNO ++ ssv_sta_priv->ampdu_tid[tid].last_seqno = (-1); ++#endif ++ ssv_sta_priv->ampdu_mib_total_BA_counter = 0; ++ memset(&ssv_sta_priv->ampdu_tid[tid].mib, 0, ++ sizeof(struct AMPDU_MIB_st)); ++ ssv_sta_priv->ampdu_tid[tid].state = AMPDU_STATE_START; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ skb_queue_head_init(&ssv_sta_priv->ampdu_tid[tid].ba_q); ++#endif ++} ++ ++void ssv6200_ampdu_tx_operation(u16 tid, struct ieee80211_sta *sta, ++ struct ieee80211_hw *hw, u8 buffer_size) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ ssv_sta_priv->ampdu_tid[tid].tidno = tid; ++ ssv_sta_priv->ampdu_tid[tid].sta = sta; ++ ssv_sta_priv->ampdu_tid[tid].agg_num_max = MAX_AGGR_NUM; ++ if (buffer_size > IEEE80211_MAX_AMPDU_BUF) { ++ buffer_size = IEEE80211_MAX_AMPDU_BUF; ++ } ++ dev_info(sc->dev, "AMPDU buffer_size=%d\n", buffer_size); ++ ssv_sta_priv->ampdu_tid[tid].ssv_baw_size = SSV_AMPDU_WINDOW_SIZE; ++ ssv_sta_priv->ampdu_tid[tid].state = AMPDU_STATE_OPERATION; ++} ++ ++static void _clear_mpdu_q(struct ieee80211_hw *hw, struct sk_buff_head *q, ++ bool aggregated_mpdu) ++{ ++ struct sk_buff *skb; ++ while (1) { ++ skb = skb_dequeue(q); ++ if (!skb) ++ break; ++ if (aggregated_mpdu) ++ skb_pull(skb, AMPDU_DELIMITER_LEN); ++ ieee80211_tx_status_skb(hw, skb); ++ } ++} ++ ++void ssv6200_ampdu_tx_stop(u16 tid, struct ieee80211_sta *sta, ++ struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ if (ssv_sta_priv->ampdu_tid[tid].state == AMPDU_STATE_STOP) ++ return; ++ ssv_sta_priv->ampdu_tid[tid].state = AMPDU_STATE_STOP; ++ dev_dbg(sc->dev, "ssv6200_ampdu_tx_stop\n"); ++ if (!list_empty(&sc->tx.ampdu_tx_que)) { ++#ifdef DEBUG_AMPDU_FLUSH ++ { ++ int j; ++ struct AMPDU_TID_st *ampdu_tid = ++ &ssv_sta_priv->ampdu_tid[tid]; ++ for (j = 0; j <= MAX_TID; j++) { ++ if (sc->tid[j] == ampdu_tid) ++ break; ++ } ++ if (j == MAX_TID) { ++ dev_dbg(sc->dev, "No TID found when deleting it.\n"); ++ } else ++ sc->tid[j] = NULL; ++ dev_dbg(sc->dev, "Deleting %02X-%02X-%02X-%02X-%02X-%02X TID %d (%p).\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], ++ sta->addr[3], sta->addr[4], sta->addr[5], ++ ampdu_tid->tidno, ampdu_tid); ++ } ++#endif ++ list_del_rcu(&ssv_sta_priv->ampdu_tid[tid].list); ++ } ++ dev_dbg(sc->dev, "clear tx q len=%d\n", ++ skb_queue_len(&ssv_sta_priv->ampdu_tid[tid].ampdu_skb_tx_queue)); ++ _clear_mpdu_q(sc->hw, &ssv_sta_priv->ampdu_tid[tid].ampdu_skb_tx_queue, ++ true); ++ dev_dbg(sc->dev, "clear retry q len=%d\n", ++ skb_queue_len(&ssv_sta_priv->ampdu_tid[tid].retry_queue)); ++ _clear_mpdu_q(sc->hw, &ssv_sta_priv->ampdu_tid[tid].retry_queue, true); ++#ifdef USE_ENCRYPT_WORK ++ dev_dbg(sc->dev, "clear encrypt q len=%d\n", ++ skb_queue_len(&ssv_sta_priv->ampdu_tid[tid]. ++ ampdu_skb_wait_encry_queue)); ++ _clear_mpdu_q(sc->hw, ++ &ssv_sta_priv->ampdu_tid[tid].ampdu_skb_wait_encry_queue, ++ false); ++#endif ++ if (ssv_sta_priv->ampdu_tid[tid].cur_ampdu_pkt != NULL) { ++ dev_kfree_skb_any(ssv_sta_priv->ampdu_tid[tid].cur_ampdu_pkt); ++ ssv_sta_priv->ampdu_tid[tid].cur_ampdu_pkt = NULL; ++ } ++ ssv6200_tx_flow_control((void *)sc, ++ sc->tx.hw_txqid[ssv_sta_priv->ampdu_tid[tid]. ++ ac], false, 1000); ++} ++ ++static void ssv6200_ampdu_tx_state_stop_func(struct ssv_softc *sc, ++ struct ieee80211_sta *sta, ++ struct sk_buff *skb, ++ struct AMPDU_TID_st *cur_AMPDU_TID) ++{ ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ++ u8 *skb_qos_ctl = ieee80211_get_qos_ctl(hdr); ++ u8 tid_no = skb_qos_ctl[0] & 0xf; ++ if ((sta->deflink.ht_cap.ht_supported == true) ++ && (!!(sc->sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_TX))) { ++ ieee80211_start_tx_ba_session(sta, tid_no, 0); ++ ampdu_db_log("start ampdu_tx(rc) : tid_no = %d\n", tid_no); ++ } ++} ++ ++static void ssv6200_ampdu_tx_state_operation_func(struct ssv_softc *sc, ++ struct ieee80211_sta *sta, ++ struct sk_buff *skb, ++ struct AMPDU_TID_st ++ *cur_AMPDU_TID) ++{ ++} ++ ++void ssv6200_ampdu_tx_update_state(void *priv, struct ieee80211_sta *sta, ++ struct sk_buff *skb) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)priv; ++ struct ssv_sta_priv_data *ssv_sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ++ u8 *skb_qos_ctl; ++ u8 tid_no; ++ { ++ skb_qos_ctl = ieee80211_get_qos_ctl(hdr); ++ tid_no = skb_qos_ctl[0] & 0xf; ++ switch (ssv_sta_priv->ampdu_tid[tid_no].state) { ++ case AMPDU_STATE_STOP: ++ ssv6200_ampdu_tx_state_stop_func(sc, sta, skb, ++ &(ssv_sta_priv-> ++ ampdu_tid[tid_no])); ++ break; ++ case AMPDU_STATE_START: ++ break; ++ case AMPDU_STATE_OPERATION: ++ ssv6200_ampdu_tx_state_operation_func(sc, sta, skb, ++ &(ssv_sta_priv-> ++ ampdu_tid ++ [tid_no])); ++ break; ++ default: ++ break; ++ } ++ } ++} ++ ++void _put_mpdu_to_ampdu(struct sk_buff *ampdu, struct sk_buff *mpdu) ++{ ++ bool is_empty_ampdu = (ampdu->len == 0); ++ unsigned char *data_dest; ++ struct ampdu_hdr_st *ampdu_hdr = (struct ampdu_hdr_st *)ampdu->head; ++ BUG_ON(skb_tailroom(ampdu) < mpdu->len); ++ data_dest = skb_tail_pointer(ampdu); ++ skb_put(ampdu, mpdu->len); ++ if (is_empty_ampdu) { ++ struct ieee80211_tx_info *ampdu_info = IEEE80211_SKB_CB(ampdu); ++ struct ieee80211_tx_info *mpdu_info = IEEE80211_SKB_CB(mpdu); ++ SKB_info *mpdu_skb_info = (SKB_info *) (mpdu->head); ++ u32 max_size_for_rate = ++ ampdu_max_transmit_length[mpdu_skb_info->lowest_rate]; ++ BUG_ON(max_size_for_rate == 0); ++ memcpy(ampdu_info, mpdu_info, sizeof(struct ieee80211_tx_info)); ++ skb_set_queue_mapping(ampdu, skb_get_queue_mapping(mpdu)); ++ ampdu_hdr->first_sn = ampdu_skb_ssn(mpdu); ++ ampdu_hdr->sta = ((struct SKB_info_st *)mpdu->head)->sta; ++ if (ampdu_hdr->max_size > max_size_for_rate) ++ ampdu_hdr->max_size = max_size_for_rate; ++ memcpy(ampdu_hdr->rates, mpdu_skb_info->rates, ++ sizeof(ampdu_hdr->rates)); ++ } ++ memcpy(data_dest, mpdu->data, mpdu->len); ++ __skb_queue_tail(&du_hdr->mpdu_q, mpdu); ++ ampdu_hdr->ssn[ampdu_hdr->mpdu_num++] = ampdu_skb_ssn(mpdu); ++ ampdu_hdr->size += mpdu->len; ++ BUG_ON(ampdu_hdr->size > ampdu_hdr->max_size); ++} ++ ++u32 _flush_early_ampdu_q(struct ssv_softc *sc, struct AMPDU_TID_st *ampdu_tid) ++{ ++ u32 flushed_ampdu = 0; ++ unsigned long flags; ++ struct sk_buff_head *early_aggr_ampdu_q = ++ &du_tid->early_aggr_ampdu_q; ++ spin_lock_irqsave(&early_aggr_ampdu_q->lock, flags); ++ while (skb_queue_len(early_aggr_ampdu_q)) { ++ struct sk_buff *head_ampdu; ++ struct ampdu_hdr_st *head_ampdu_hdr; ++ u32 ampdu_aggr_num; ++ head_ampdu = skb_peek(early_aggr_ampdu_q); ++ head_ampdu_hdr = (struct ampdu_hdr_st *)head_ampdu->head; ++ ampdu_aggr_num = skb_queue_len(&head_ampdu_hdr->mpdu_q); ++ if ((SSV_AMPDU_BA_WINDOW_SIZE - ampdu_tid->aggr_pkt_num) ++ < ampdu_aggr_num) ++ break; ++ if (_sync_ampdu_pkt_arr(ampdu_tid, head_ampdu, false)) { ++ head_ampdu = __skb_dequeue(early_aggr_ampdu_q); ++ ampdu_tid->early_aggr_skb_num -= ampdu_aggr_num; ++#ifdef SSV_AMPDU_FLOW_CONTROL ++ if (ampdu_tid->early_aggr_skb_num ++ <= SSV_AMPDU_FLOW_CONTROL_LOWER_BOUND) { ++ ssv6200_tx_flow_control((void *)sc, ++ sc->tx. ++ hw_txqid[ampdu_tid->ac], ++ false, 1000); ++ } ++#endif ++ if ((skb_queue_len(early_aggr_ampdu_q) == 0) ++ && (ampdu_tid->early_aggr_skb_num > 0)) { ++ dev_warn(sc->dev, "Empty early Q w. %d.\n", ++ ampdu_tid->early_aggr_skb_num); ++ } ++ spin_unlock_irqrestore(&early_aggr_ampdu_q->lock, ++ flags); ++ _send_hci_skb(sc, head_ampdu, ++ AMPDU_HCI_SEND_TAIL_WITHOUT_FLOWCTRL); ++ spin_lock_irqsave(&early_aggr_ampdu_q->lock, flags); ++ flushed_ampdu++; ++ } else ++ break; ++ } ++ spin_unlock_irqrestore(&early_aggr_ampdu_q->lock, flags); ++ return flushed_ampdu; ++} ++ ++volatile int max_aggr_num = 24; ++void _aggr_ampdu_tx_q(struct ieee80211_hw *hw, struct AMPDU_TID_st *ampdu_tid) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct sk_buff *ampdu_skb = ampdu_tid->cur_ampdu_pkt; ++ while (skb_queue_len(&du_tid->ampdu_skb_tx_queue)) { ++ u32 aggr_len; ++ struct sk_buff *mpdu_skb; ++ struct ampdu_hdr_st *ampdu_hdr; ++ bool is_aggr_full = false; ++ if (ampdu_skb == NULL) { ++ ampdu_skb = _alloc_ampdu_skb(sc, ampdu_tid, 0); ++ if (ampdu_skb == NULL) ++ break; ++ ampdu_tid->cur_ampdu_pkt = ampdu_skb; ++ } ++ ampdu_hdr = (struct ampdu_hdr_st *)ampdu_skb->head; ++ aggr_len = skb_queue_len(&du_hdr->mpdu_q); ++ do { ++ struct sk_buff_head *tx_q = ++ &du_tid->ampdu_skb_tx_queue; ++ unsigned long flags; ++ spin_lock_irqsave(&tx_q->lock, flags); ++ mpdu_skb = skb_peek(&du_tid->ampdu_skb_tx_queue); ++ if (mpdu_skb == NULL) { ++ spin_unlock_irqrestore(&tx_q->lock, flags); ++ break; ++ } ++ if ((mpdu_skb->len + ampdu_hdr->size) > ++ ampdu_hdr->max_size) { ++ is_aggr_full = true; ++ spin_unlock_irqrestore(&tx_q->lock, flags); ++ break; ++ } ++ mpdu_skb = ++ __skb_dequeue(&du_tid->ampdu_skb_tx_queue); ++ spin_unlock_irqrestore(&tx_q->lock, flags); ++ _put_mpdu_to_ampdu(ampdu_skb, mpdu_skb); ++ } while (++aggr_len < max_aggr_num); ++ if ((is_aggr_full || (aggr_len >= max_aggr_num)) ++ || ((aggr_len > 0) ++ && (skb_queue_len(&du_tid->early_aggr_ampdu_q) == 0) ++ && (ampdu_tid->ssv_baw_head == SSV_ILLEGAL_SN) ++ && _is_skb_q_empty(sc, ampdu_skb))) { ++ _add_ampdu_txinfo(sc, ampdu_skb); ++ _queue_early_ampdu(sc, ampdu_tid, ampdu_skb); ++ ampdu_tid->cur_ampdu_pkt = ampdu_skb = NULL; ++ } ++ _flush_early_ampdu_q(sc, ampdu_tid); ++ } ++} ++ ++void _queue_early_ampdu(struct ssv_softc *sc, struct AMPDU_TID_st *ampdu_tid, ++ struct sk_buff *ampdu_skb) ++{ ++ unsigned long flags; ++ struct ampdu_hdr_st *ampdu_hdr = (struct ampdu_hdr_st *)ampdu_skb->head; ++ spin_lock_irqsave(&du_tid->early_aggr_ampdu_q.lock, flags); ++ __skb_queue_tail(&du_tid->early_aggr_ampdu_q, ampdu_skb); ++ ampdu_tid->early_aggr_skb_num += skb_queue_len(&du_hdr->mpdu_q); ++#ifdef SSV_AMPDU_FLOW_CONTROL ++ if (ampdu_tid->early_aggr_skb_num >= SSV_AMPDU_FLOW_CONTROL_UPPER_BOUND) { ++ ssv6200_tx_flow_control((void *)sc, ++ sc->tx.hw_txqid[ampdu_tid->ac], true, ++ 1000); ++ } ++#endif ++ spin_unlock_irqrestore(&du_tid->early_aggr_ampdu_q.lock, flags); ++} ++ ++void _flush_mpdu(struct ssv_softc *sc, struct ieee80211_sta *sta) ++{ ++ unsigned long flags; ++ struct ssv_sta_priv_data *ssv_sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ int i; ++ for (i = 0; ++ i < ++ (sizeof(ssv_sta_priv->ampdu_tid) / ++ sizeof(ssv_sta_priv->ampdu_tid[0])); i++) { ++ struct AMPDU_TID_st *ampdu_tid = &ssv_sta_priv->ampdu_tid[i]; ++ struct sk_buff_head *early_aggr_ampdu_q; ++ struct sk_buff *ampdu; ++ struct ampdu_hdr_st *ampdu_hdr; ++ struct sk_buff_head *mpdu_q; ++ struct sk_buff *mpdu; ++ if (ampdu_tid->state != AMPDU_STATE_OPERATION) ++ continue; ++ early_aggr_ampdu_q = &du_tid->early_aggr_ampdu_q; ++ spin_lock_irqsave(&early_aggr_ampdu_q->lock, flags); ++ while ((ampdu = __skb_dequeue(early_aggr_ampdu_q)) != NULL) { ++ ampdu_hdr = (struct ampdu_hdr_st *)ampdu->head; ++ mpdu_q = &du_hdr->mpdu_q; ++ spin_unlock_irqrestore(&early_aggr_ampdu_q->lock, ++ flags); ++ while ((mpdu = __skb_dequeue(mpdu_q)) != NULL) { ++ _send_hci_skb(sc, mpdu, ++ AMPDU_HCI_SEND_TAIL_WITHOUT_FLOWCTRL); ++ } ++ ssv6200_ampdu_release_skb(ampdu, sc->hw); ++ spin_lock_irqsave(&early_aggr_ampdu_q->lock, flags); ++ } ++ if (ampdu_tid->cur_ampdu_pkt != NULL) { ++ ampdu_hdr = ++ (struct ampdu_hdr_st *)ampdu_tid->cur_ampdu_pkt-> ++ head; ++ mpdu_q = &du_hdr->mpdu_q; ++ spin_unlock_irqrestore(&early_aggr_ampdu_q->lock, ++ flags); ++ while ((mpdu = __skb_dequeue(mpdu_q)) != NULL) { ++ _send_hci_skb(sc, mpdu, ++ AMPDU_HCI_SEND_TAIL_WITHOUT_FLOWCTRL); ++ } ++ ssv6200_ampdu_release_skb(ampdu_tid->cur_ampdu_pkt, ++ sc->hw); ++ spin_lock_irqsave(&early_aggr_ampdu_q->lock, flags); ++ ampdu_tid->cur_ampdu_pkt = NULL; ++ } ++ spin_unlock_irqrestore(&early_aggr_ampdu_q->lock, flags); ++ } ++} ++ ++bool ssv6200_ampdu_tx_handler(struct ieee80211_hw *hw, struct sk_buff *skb) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ++#ifdef REPORT_TX_STATUS_DIRECTLY ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ struct sk_buff *tx_skb = skb; ++ struct sk_buff *copy_skb = NULL; ++#endif ++ struct SKB_info_st *mpdu_skb_info_p = (SKB_info *) (skb->head); ++ struct ieee80211_sta *sta = mpdu_skb_info_p->sta; ++ struct ssv_sta_priv_data *ssv_sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ u8 tidno; ++ struct AMPDU_TID_st *ampdu_tid; ++ if (sta == NULL) { ++ WARN_ON(1); ++ return false; ++ } ++ tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; ++ ampdu_db_log("tidno = %d\n", tidno); ++ ampdu_tid = &ssv_sta_priv->ampdu_tid[tidno]; ++ if (ampdu_tid->state != AMPDU_STATE_OPERATION) ++ return false; ++#ifdef AMPDU_CHECK_SKB_SEQNO ++ { ++ u32 skb_seqno = ((struct ieee80211_hdr *)(skb->data))->seq_ctrl ++ >> SSV_SEQ_NUM_SHIFT; ++ u32 tid_seqno = ampdu_tid->last_seqno; ++ if ((tid_seqno != (-1)) ++ && (skb_seqno != NEXT_PKT_SN(tid_seqno))) { ++ prn_aggr_err("Non continueous seq no: %d - %d\n", ++ tid_seqno, skb_seqno); ++ return false; ++ } ++ ampdu_tid->last_seqno = skb_seqno; ++ } ++#endif ++ mpdu_skb_info_p->lowest_rate = ++ ssv62xx_ht_rate_update(skb, sc, mpdu_skb_info_p->rates); ++ if (ampdu_max_transmit_length[mpdu_skb_info_p->lowest_rate] == 0) { ++ _flush_mpdu(sc, sta); ++ return false; ++ } ++ mpdu_skb_info_p = (SKB_info *) (skb->head); ++ mpdu_skb_info_p->mpdu_retry_counter = 0; ++ mpdu_skb_info_p->ampdu_tx_status = AMPDU_ST_NON_AMPDU; ++ mpdu_skb_info_p->ampdu_tx_final_retry_count = 0; ++ ssv_sta_priv->ampdu_tid[tidno].ac = skb_get_queue_mapping(skb); ++#ifdef REPORT_TX_STATUS_DIRECTLY ++ info->flags |= IEEE80211_TX_STAT_ACK; ++ copy_skb = skb_copy(tx_skb, GFP_ATOMIC); ++ if (!copy_skb) { ++ dev_err(sc->dev, "create TX skb copy failed!\n"); ++ return false; ++ } ++ ieee80211_tx_status_skb(sc->hw, tx_skb); ++ skb = copy_skb; ++#endif ++ { ++ bool ret; ++ ret = ssv6200_ampdu_add_delimiter_and_crc32(skb); ++ if (ret == false) { ++ ssv6200_ampdu_release_skb(skb, hw); ++ return false; ++ } ++ skb_queue_tail(&ssv_sta_priv->ampdu_tid[tidno]. ++ ampdu_skb_tx_queue, skb); ++ ssv_sta_priv->ampdu_tid[tidno].timestamp = jiffies; ++ } ++ _aggr_ampdu_tx_q(hw, &ssv_sta_priv->ampdu_tid[tidno]); ++ return true; ++} ++ ++u32 ssv6xxx_ampdu_flush(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct AMPDU_TID_st *cur_AMPDU_TID; ++ u32 flushed_ampdu = 0; ++ u32 tid_idx = 0; ++ if (!list_empty(&sc->tx.ampdu_tx_que)) { ++ list_for_each_entry_rcu(cur_AMPDU_TID, &sc->tx.ampdu_tx_que, ++ list) { ++ tid_idx++; ++#ifdef DEBUG_AMPDU_FLUSH ++ { ++ int i = 0; ++ for (i = 0; i < MAX_TID; i++) ++ if (sc->tid[i] == cur_AMPDU_TID) ++ break; ++ if (i == MAX_TID) { ++ dev_err(sc->dev, "No matching TID (%d) found! %p\n", ++ tid_idx, cur_AMPDU_TID); ++ continue; ++ } ++ } ++#endif ++ if (cur_AMPDU_TID->state != AMPDU_STATE_OPERATION) { ++ struct ieee80211_sta *sta = cur_AMPDU_TID->sta; ++ struct ssv_sta_priv_data *sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ dev_dbg(sc->dev, "STA %d TID %d is @%d\n", ++ sta_priv->sta_idx, cur_AMPDU_TID->tidno, ++ cur_AMPDU_TID->state); ++ continue; ++ } ++ if ((cur_AMPDU_TID->state == AMPDU_STATE_OPERATION) ++ && ++ (skb_queue_len(&cur_AMPDU_TID->early_aggr_ampdu_q) ++ == 0) ++ && (cur_AMPDU_TID->cur_ampdu_pkt != NULL)) { ++ struct ampdu_hdr_st *ampdu_hdr = ++ (struct ampdu_hdr_st *)(cur_AMPDU_TID-> ++ cur_ampdu_pkt-> ++ head); ++ u32 aggr_len = ++ skb_queue_len(&du_hdr->mpdu_q); ++ if (aggr_len) { ++ struct sk_buff *ampdu_skb = ++ cur_AMPDU_TID->cur_ampdu_pkt; ++ cur_AMPDU_TID->cur_ampdu_pkt = NULL; ++ _add_ampdu_txinfo(sc, ampdu_skb); ++ _queue_early_ampdu(sc, cur_AMPDU_TID, ++ ampdu_skb); ++ } ++ } ++ if (skb_queue_len(&cur_AMPDU_TID->early_aggr_ampdu_q) > ++ 0) ++ flushed_ampdu += ++ _flush_early_ampdu_q(sc, cur_AMPDU_TID); ++ } ++ } ++ return flushed_ampdu; ++} ++ ++int _dump_BA_notification(char *buf, ++ struct ampdu_ba_notify_data *ba_notification) ++{ ++ int i; ++ char *orig_buf = buf; ++ for (i = 0; i < MAX_AGGR_NUM; i++) { ++ if (ba_notification->seq_no[i] == (u16) (-1)) ++ break; ++ buf += sprintf(buf, " %d", ba_notification->seq_no[i]); ++ } ++ return ((size_t)buf - (size_t)orig_buf); ++} ++ ++int _dump_ba_skb(char *buf, int buf_size, struct sk_buff *ba_skb) ++{ ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(ba_skb->data ++ + ++ SSV6XXX_RX_DESC_LEN); ++ AMPDU_BLOCKACK *BA_frame = (AMPDU_BLOCKACK *) hdr; ++ u32 ssn = BA_frame->BA_ssn; ++ struct ampdu_ba_notify_data *ba_notification = ++ (struct ampdu_ba_notify_data *)(ba_skb->data + ba_skb->len ++ - ++ sizeof(struct ++ ampdu_ba_notify_data)); ++ int prt_size; ++ prt_size = snprintf(buf, buf_size, "\n\t\t%04d %08X %08X -", ++ ssn, BA_frame->BA_sn_bit_map[0], ++ BA_frame->BA_sn_bit_map[1]); ++ buf_size -= prt_size; ++ buf += prt_size; ++ prt_size = prt_size + _dump_BA_notification(buf, ba_notification); ++ return prt_size; ++} ++ ++static bool _ssn_to_bit_idx(u32 start_ssn, u32 mpdu_ssn, u32 * word_idx, ++ u32 * bit_idx) ++{ ++ u32 ret_bit_idx, ret_word_idx = 0; ++ s32 diff = mpdu_ssn - start_ssn; ++ if (diff >= 0) { ++ if (diff >= SSV_AMPDU_BA_WINDOW_SIZE) { ++ return false; ++ } ++ ret_bit_idx = diff; ++ } else { ++ diff = -diff; ++ if (diff <= (SSV_AMPDU_MAX_SSN - SSV_AMPDU_BA_WINDOW_SIZE)) { ++ *word_idx = 0; ++ *bit_idx = 0; ++ return false; ++ } ++ ret_bit_idx = SSV_AMPDU_MAX_SSN - diff; ++ } ++ if (ret_bit_idx >= 32) { ++ ret_bit_idx -= 32; ++ ret_word_idx = 1; ++ } ++ *bit_idx = ret_bit_idx; ++ *word_idx = ret_word_idx; ++ return true; ++} ++ ++static bool _inc_bit_idx(u32 ssn_1st, u32 ssn_next, u32 * word_idx, ++ u32 * bit_idx) ++{ ++ u32 ret_word_idx = *word_idx, ret_bit_idx = *bit_idx; ++ s32 diff = (s32) ssn_1st - (s32) ssn_next; ++ if (diff > 0) { ++ if (diff < (SSV_AMPDU_MAX_SSN - SSV_AMPDU_BA_WINDOW_SIZE)) { ++ prn_aggr_err ++ ("Irrational SN distance in AMPDU: %d %d.\n", ++ ssn_1st, ssn_next); ++ return false; ++ } ++ diff = SSV_AMPDU_MAX_SSN - diff; ++ } else { ++ diff = -diff; ++ } ++ if (diff > SSV_AMPDU_MAX_SSN) ++ prn_aggr_err("DF %d - %d = %d\n", ssn_1st, ssn_next, diff); ++ ret_bit_idx += diff; ++ if (ret_bit_idx >= 32) { ++ ret_bit_idx -= 32; ++ ret_word_idx++; ++ } ++ *word_idx = ret_word_idx; ++ *bit_idx = ret_bit_idx; ++ return true; ++} ++ ++static void _release_frames(struct AMPDU_TID_st *ampdu_tid) ++{ ++ u32 head_ssn, head_ssn_before, last_ssn; ++ struct sk_buff **skb; ++ struct SKB_info_st *skb_info; ++ spin_lock_bh(&du_tid->pkt_array_lock); ++ head_ssn_before = ampdu_tid->ssv_baw_head; ++ if (head_ssn_before >= SSV_AMPDU_MAX_SSN) { ++ spin_unlock_bh(&du_tid->pkt_array_lock); ++ prn_aggr_err("l x.x %d\n", head_ssn_before); ++ return; ++ } ++ head_ssn = ampdu_tid->ssv_baw_head; ++ last_ssn = head_ssn; ++ do { ++ skb = &INDEX_PKT_BY_SSN(ampdu_tid, head_ssn); ++ if (*skb == NULL) { ++ head_ssn = SSV_ILLEGAL_SN; ++ { ++ int i; ++ char sn_str[66 * 5] = ""; ++ char *str = sn_str; ++ for (i = 0; i < 64; i++) ++ if (ampdu_tid->aggr_pkts[i] != NULL) { ++ str += sprintf(str, "%d ", ++ ampdu_skb_ssn ++ (ampdu_tid-> ++ aggr_pkts[i])); ++ } ++ *str = 0; ++ if (str == sn_str) { ++ } else ++ prn_aggr_err("ILL %d %d - %d (%s)\n", ++ head_ssn_before, last_ssn, ++ ampdu_tid->aggr_pkt_num, ++ sn_str); ++ } ++ break; ++ } ++ skb_info = (struct SKB_info_st *)((*skb)->head); ++ if ((skb_info->ampdu_tx_status == AMPDU_ST_DONE) ++ || (skb_info->ampdu_tx_status == AMPDU_ST_DROPPED)) { ++ __skb_queue_tail(&du_tid->release_queue, *skb); ++ *skb = NULL; ++ last_ssn = head_ssn; ++ INC_PKT_SN(head_ssn); ++ ampdu_tid->aggr_pkt_num--; ++ if (skb_info->ampdu_tx_status == AMPDU_ST_DROPPED) ++ ampdu_tid->mib.ampdu_mib_discard_counter++; ++ } else { ++ break; ++ } ++ } while (1); ++ ampdu_tid->ssv_baw_head = head_ssn; ++ spin_unlock_bh(&du_tid->pkt_array_lock); ++} ++ ++static int _collect_retry_frames(struct AMPDU_TID_st *ampdu_tid) ++{ ++ u16 ssn, head_ssn, end_ssn; ++ int num_retry = 0; ++ int timeout_check = 1; ++ unsigned long check_jiffies = jiffies; ++ head_ssn = ampdu_tid->ssv_baw_head; ++ ssn = head_ssn; ++ if (ssn == SSV_ILLEGAL_SN) ++ return 0; ++ end_ssn = (head_ssn + SSV_AMPDU_BA_WINDOW_SIZE) % SSV_AMPDU_MAX_SSN; ++ do { ++ struct sk_buff *skb = INDEX_PKT_BY_SSN(ampdu_tid, ssn); ++ struct SKB_info_st *skb_info; ++ int timeout_retry = 0; ++ if (skb == NULL) ++ break; ++ skb_info = (SKB_info *) (skb->head); ++ if (timeout_check ++ && (skb_info->ampdu_tx_status == AMPDU_ST_SENT)) { ++ unsigned long cur_jiffies = jiffies; ++ unsigned long timeout_jiffies = skb_info->aggr_timestamp ++ + msecs_to_jiffies(BA_WAIT_TIMEOUT); ++ u32 delta_ms; ++ if (time_before(cur_jiffies, timeout_jiffies)) { ++ timeout_check = 0; ++ continue; ++ } ++ _mark_skb_retry(skb_info, skb); ++ delta_ms = ++ jiffies_to_msecs(cur_jiffies - ++ skb_info->aggr_timestamp); ++ prn_aggr_err("t S%d-T%d-%d (%u)\n", ++ ((struct ssv_sta_priv_data *)skb_info-> ++ sta->drv_priv)->sta_idx, ampdu_tid->tidno, ++ ssn, delta_ms); ++ if (delta_ms > 1000) { ++ prn_aggr_err("Last checktime %lu - %lu = %u\n", ++ check_jiffies, ++ ampdu_tid->timestamp, ++ jiffies_to_msecs(check_jiffies - ++ ampdu_tid-> ++ timestamp)); ++ } ++ timeout_retry = 1; ++ } ++ if (skb_info->ampdu_tx_status == AMPDU_ST_RETRY) { ++ skb_queue_tail(&du_tid->retry_queue, skb); ++ ampdu_tid->mib.ampdu_mib_retry_counter++; ++ num_retry++; ++ } ++ INC_PKT_SN(ssn); ++ } while (ssn != end_ssn); ++ ampdu_tid->timestamp = check_jiffies; ++ return num_retry; ++} ++ ++int _mark_skb_retry(struct SKB_info_st *skb_info, struct sk_buff *skb) ++{ ++ if (skb_info->mpdu_retry_counter < SSV_AMPDU_retry_counter_max) { ++ if (skb_info->mpdu_retry_counter == 0) { ++ struct ieee80211_hdr *skb_hdr = ampdu_skb_hdr(skb); ++ skb_hdr->frame_control |= ++ cpu_to_le16(IEEE80211_FCTL_RETRY); ++ } ++ skb_info->ampdu_tx_status = AMPDU_ST_RETRY; ++ skb_info->mpdu_retry_counter++; ++ return 1; ++ } else { ++ skb_info->ampdu_tx_status = AMPDU_ST_DROPPED; ++ prn_aggr_err("p %d\n", ampdu_skb_ssn(skb)); ++ return 0; ++ } ++} ++ ++static u32 _ba_map_walker(struct AMPDU_TID_st *ampdu_tid, u32 start_ssn, ++ u32 sn_bit_map[2], ++ struct ampdu_ba_notify_data *ba_notify_data, ++ u32 * p_acked_num) ++{ ++ int i = 0; ++ u32 ssn = ba_notify_data->seq_no[0]; ++ u32 word_idx = (-1), bit_idx = (-1); ++ bool found = _ssn_to_bit_idx(start_ssn, ssn, &word_idx, &bit_idx); ++ bool first_found = found; ++ u32 aggr_num = 0; ++ u32 acked_num = 0; ++ if (found && (word_idx >= 2 || bit_idx >= 32)) ++ prn_aggr_err("idx error 1: %d %d %d %d\n", ++ start_ssn, ssn, word_idx, bit_idx); ++ while ((i < MAX_AGGR_NUM) && (ssn < SSV_AMPDU_MAX_SSN)) { ++ u32 cur_ssn; ++ struct sk_buff *skb = INDEX_PKT_BY_SSN(ampdu_tid, ssn); ++ u32 skb_ssn = (skb == NULL) ? (-1) : ampdu_skb_ssn(skb); ++ struct SKB_info_st *skb_info; ++ aggr_num++; ++ if (skb_ssn != ssn) { ++ prn_aggr_err("Unmatched SSN packet: %d - %d - %d\n", ++ ssn, skb_ssn, start_ssn); ++ } else { ++ skb_info = (struct SKB_info_st *)(skb->head); ++ if (found && (sn_bit_map[word_idx] & (1 << bit_idx))) { ++ if (skb_info->ampdu_tx_status != AMPDU_ST_SENT) { ++ pr_err("BA marks a MPDU of status %d!\n", ++ skb_info->ampdu_tx_status); ++ } ++ skb_info->ampdu_tx_status = AMPDU_ST_DONE; ++ acked_num++; ++ } else { ++ _mark_skb_retry(skb_info, skb); ++ } ++ } ++ cur_ssn = ssn; ++ if (++i >= MAX_AGGR_NUM) ++ break; ++ ssn = ba_notify_data->seq_no[i]; ++ if (ssn >= SSV_AMPDU_MAX_SSN) ++ break; ++ if (first_found) { ++ u32 old_word_idx = word_idx, old_bit_idx = bit_idx; ++ found = _inc_bit_idx(cur_ssn, ssn, &word_idx, &bit_idx); ++ if (found && (word_idx >= 2 || bit_idx >= 32)) { ++ prn_aggr_err ++ ("idx error 2: %d 0x%08X 0X%08X %d %d (%d %d) (%d %d)\n", ++ start_ssn, sn_bit_map[1], sn_bit_map[0], ++ cur_ssn, ssn, word_idx, bit_idx, ++ old_word_idx, old_bit_idx); ++ found = false; ++ } else if (!found) { ++ char strbuf[256]; ++ _dump_BA_notification(strbuf, ba_notify_data); ++ prn_aggr_err("SN out-of-order: %d\n%s\n", ++ start_ssn, strbuf); ++ } ++ } else { ++ found = ++ _ssn_to_bit_idx(start_ssn, ssn, &word_idx, ++ &bit_idx); ++ first_found = found; ++ if (found && (word_idx >= 2 || bit_idx >= 32)) ++ prn_aggr_err("idx error 3: %d %d %d %d\n", ++ cur_ssn, ssn, word_idx, bit_idx); ++ } ++ } ++ _release_frames(ampdu_tid); ++ if (p_acked_num != NULL) ++ *p_acked_num = acked_num; ++ return aggr_num; ++} ++ ++static void _flush_release_queue(struct ieee80211_hw *hw, ++ struct sk_buff_head *release_queue) ++{ ++ do { ++ struct sk_buff *ampdu_skb = __skb_dequeue(release_queue); ++ struct ieee80211_tx_info *tx_info; ++ struct SKB_info_st *skb_info; ++ if (ampdu_skb == NULL) ++ break; ++ skb_info = (struct SKB_info_st *)(ampdu_skb->head); ++ skb_pull(ampdu_skb, AMPDU_DELIMITER_LEN); ++ tx_info = IEEE80211_SKB_CB(ampdu_skb); ++ ieee80211_tx_info_clear_status(tx_info); ++ tx_info->flags |= IEEE80211_TX_STAT_AMPDU; ++ if (skb_info->ampdu_tx_status == AMPDU_ST_DONE) ++ tx_info->flags |= IEEE80211_TX_STAT_ACK; ++ tx_info->status.ampdu_len = 1; ++ tx_info->status.ampdu_ack_len = 1; ++#ifdef REPORT_TX_STATUS_DIRECTLY ++ dev_kfree_skb_any(ampdu_skb); ++#else ++#if defined(USE_THREAD_RX) && !defined(IRQ_PROC_TX_DATA) ++ ieee80211_tx_status_skb(hw, ampdu_skb); ++#else ++ ieee80211_tx_status_irqsafe(hw, ampdu_skb); ++#endif ++#endif ++ } while (1); ++} ++ ++void ssv6200_ampdu_no_BA_handler(struct ieee80211_hw *hw, struct sk_buff *skb) ++{ ++ struct cfg_host_event *host_event = (struct cfg_host_event *)skb->data; ++ struct ampdu_ba_notify_data *ba_notification = ++ (struct ampdu_ba_notify_data *)&host_event->dat[0]; ++ struct ieee80211_hdr *hdr = ++ (struct ieee80211_hdr *)(ba_notification + 1); ++ struct ssv_softc *sc = hw->priv; ++ struct ieee80211_sta *sta = ssv6xxx_find_sta_by_addr(sc, hdr->addr1); ++ u8 tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ char seq_str[256]; ++ struct AMPDU_TID_st *ampdu_tid; ++ int i; ++ u16 aggr_num = 0; ++ struct firmware_rate_control_report_data *report_data; ++ if (sta == NULL) { ++ prn_aggr_err ++ ("NO BA for %d to unmatched STA %02X-%02X-%02X-%02X-%02X-%02X: %s\n", ++ tidno, hdr->addr1[0], hdr->addr1[1], hdr->addr1[2], ++ hdr->addr1[3], hdr->addr1[4], hdr->addr1[5], seq_str); ++ dev_kfree_skb_any(skb); ++ return; ++ } ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ _dump_BA_notification(seq_str, ba_notification); ++ prn_aggr_err("NO BA for %d to %02X-%02X-%02X-%02X-%02X-%02X: %s\n", ++ tidno, sta->addr[0], sta->addr[1], sta->addr[2], ++ sta->addr[3], sta->addr[4], sta->addr[5], seq_str); ++ ampdu_tid = &ssv_sta_priv->ampdu_tid[tidno]; ++ if (ampdu_tid->state != AMPDU_STATE_OPERATION) { ++ dev_kfree_skb_any(skb); ++ return; ++ } ++ for (i = 0; i < MAX_AGGR_NUM; i++) { ++ u32 ssn = ba_notification->seq_no[i]; ++ struct sk_buff *skb; ++ u32 skb_ssn; ++ struct SKB_info_st *skb_info; ++ if (ssn >= (4096)) ++ break; ++ aggr_num++; ++ skb = INDEX_PKT_BY_SSN(ampdu_tid, ssn); ++ skb_ssn = (skb == NULL) ? (-1) : ampdu_skb_ssn(skb); ++ if (skb_ssn != ssn) { ++ prn_aggr_err("Unmatched SSN packet: %d - %d\n", ssn, ++ skb_ssn); ++ continue; ++ } ++ skb_info = (struct SKB_info_st *)(skb->head); ++ if (skb_info->ampdu_tx_status == AMPDU_ST_SENT) { ++ if (skb_info->mpdu_retry_counter < ++ SSV_AMPDU_retry_counter_max) { ++ if (skb_info->mpdu_retry_counter == 0) { ++ struct ieee80211_hdr *skb_hdr = ++ ampdu_skb_hdr(skb); ++ skb_hdr->frame_control |= ++ cpu_to_le16(IEEE80211_FCTL_RETRY); ++ } ++ skb_info->ampdu_tx_status = AMPDU_ST_RETRY; ++ skb_info->mpdu_retry_counter++; ++ } else { ++ skb_info->ampdu_tx_status = AMPDU_ST_DROPPED; ++ prn_aggr_err("p %d\n", skb_ssn); ++ } ++ } else { ++ prn_aggr_err("S %d %d\n", skb_ssn, ++ skb_info->ampdu_tx_status); ++ } ++ } ++ _release_frames(ampdu_tid); ++ host_event->h_event = SOC_EVT_RC_AMPDU_REPORT; ++ report_data = ++ (struct firmware_rate_control_report_data *)&host_event->dat[0]; ++ report_data->ampdu_len = aggr_num; ++ report_data->ampdu_ack_len = 0; ++ report_data->wsid = ssv_sta_priv->sta_info->hw_wsid; ++ skb_queue_tail(&sc->rc_report_queue, skb); ++ if (sc->rc_sample_sechedule == 0) ++ queue_work(sc->rc_sample_workqueue, &sc->rc_sample_work); ++} ++ ++void ssv6200_ampdu_BA_handler(struct ieee80211_hw *hw, struct sk_buff *skb) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data ++ + ++ SSV6XXX_RX_DESC_LEN); ++ AMPDU_BLOCKACK *BA_frame = (AMPDU_BLOCKACK *) hdr; ++ struct ieee80211_sta *sta; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ struct ampdu_ba_notify_data *ba_notification; ++ u32 ssn, aggr_num = 0, acked_num = 0; ++ u8 tid_no; ++ u32 sn_bit_map[2]; ++ struct firmware_rate_control_report_data *report_data; ++ HDR_HostEvent *host_evt; ++ sta = ssv6xxx_find_sta_by_rx_skb(sc, skb); ++ if (sta == NULL) { ++ if (skb->len > AMPDU_BA_FRAME_LEN) { ++ char strbuf[256]; ++ struct ampdu_ba_notify_data *ba_notification = ++ (struct ampdu_ba_notify_data *)(skb->data + skb->len ++ - ++ sizeof(struct ++ ampdu_ba_notify_data)); ++ _dump_BA_notification(strbuf, ba_notification); ++ prn_aggr_err ++ ("BA from not connected STA (%02X-%02X-%02X-%02X-%02X-%02X) (%s)\n", ++ BA_frame->ta_addr[0], BA_frame->ta_addr[1], ++ BA_frame->ta_addr[2], BA_frame->ta_addr[3], ++ BA_frame->ta_addr[4], BA_frame->ta_addr[5], ++ strbuf); ++ } ++ dev_kfree_skb_any(skb); ++ return; ++ } ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ ssn = BA_frame->BA_ssn; ++ sn_bit_map[0] = BA_frame->BA_sn_bit_map[0]; ++ sn_bit_map[1] = BA_frame->BA_sn_bit_map[1]; ++ tid_no = BA_frame->tid_info; ++ ssv_sta_priv->ampdu_mib_total_BA_counter++; ++ if (ssv_sta_priv->ampdu_tid[tid_no].state == AMPDU_STATE_STOP) { ++ prn_aggr_err ++ ("ssv6200_ampdu_BA_handler state == AMPDU_STATE_STOP.\n"); ++ dev_kfree_skb_any(skb); ++ return; ++ } ++ ssv_sta_priv->ampdu_tid[tid_no].mib.ampdu_mib_BA_counter++; ++ if (skb->len <= AMPDU_BA_FRAME_LEN) { ++ prn_aggr_err("b %d\n", ssn); ++ dev_kfree_skb_any(skb); ++ return; ++ } ++ ba_notification = ++ (struct ampdu_ba_notify_data *)(skb->data + skb->len ++ - ++ sizeof(struct ++ ampdu_ba_notify_data)); ++ aggr_num = ++ _ba_map_walker(&(ssv_sta_priv->ampdu_tid[tid_no]), ssn, sn_bit_map, ++ ba_notification, &acked_num); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (ssv_sta_priv->ampdu_tid[tid_no].debugfs_dir) { ++ struct sk_buff *dup_skb; ++ if (skb_queue_len(&ssv_sta_priv->ampdu_tid[tid_no].ba_q) > 24) { ++ struct sk_buff *ba_skb = ++ skb_dequeue(&ssv_sta_priv->ampdu_tid[tid_no].ba_q); ++ if (ba_skb) ++ dev_kfree_skb_any(ba_skb); ++ } ++ dup_skb = skb_clone(skb, GFP_ATOMIC); ++ if (dup_skb) ++ skb_queue_tail(&ssv_sta_priv->ampdu_tid[tid_no].ba_q, ++ dup_skb); ++ } ++#endif ++ skb_trim(skb, skb->len - sizeof(struct ampdu_ba_notify_data)); ++ host_evt = (HDR_HostEvent *) skb->data; ++ host_evt->h_event = SOC_EVT_RC_AMPDU_REPORT; ++ report_data = ++ (struct firmware_rate_control_report_data *)&host_evt->dat[0]; ++ memcpy(report_data, ba_notification, ++ sizeof(struct firmware_rate_control_report_data)); ++ report_data->ampdu_len = aggr_num; ++ report_data->ampdu_ack_len = acked_num; ++#ifdef RATE_CONTROL_HT_PERCENTAGE_TRACE ++ if ((acked_num) && (acked_num != aggr_num)) { ++ int i; ++ for (i = 0; i < SSV62XX_TX_MAX_RATES; i++) { ++ if (report_data->rates[i].data_rate == -1) ++ break; ++ if (report_data->rates[i].count == 0) ++ dev_err(sc->dev, "illegal HT report\n"); ++ ++ dev_dbg(sc->dev, "i=[%d] rate[%d] count[%d]\n", i, ++ report_data->rates[i].data_rate, ++ report_data->rates[i].count); ++ } ++ dev_dbg(sc->dev, "AMPDU percentage = %d%% \n", ++ acked_num * 100 / aggr_num); ++ } else if (acked_num == 0) { ++ dev_dbg(sc->dev, "AMPDU percentage = 0%% aggr_num=%d acked_num=%d\n", ++ aggr_num, acked_num); ++ } ++#endif ++ skb_queue_tail(&sc->rc_report_queue, skb); ++ if (sc->rc_sample_sechedule == 0) ++ queue_work(sc->rc_sample_workqueue, &sc->rc_sample_work); ++} ++ ++static void _postprocess_BA(struct ssv_softc *sc, struct ssv_sta_info *sta_info, ++ void *param) ++{ ++ int j; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ if ((sta_info->sta == NULL) ++ || ((sta_info->s_flags & STA_FLAG_VALID) == 0)) ++ return; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta_info->sta->drv_priv; ++ for (j = 0; j < WMM_TID_NUM; j++) { ++ AMPDU_TID *ampdu_tid = &ssv_sta_priv->ampdu_tid[j]; ++ if (ampdu_tid->state != AMPDU_STATE_OPERATION) ++ continue; ++ _collect_retry_frames(ampdu_tid); ++ ssv6200_ampdu_send_retry(sc->hw, ampdu_tid, ++ &du_tid->retry_queue, true); ++ _flush_early_ampdu_q(sc, ampdu_tid); ++ _flush_release_queue(sc->hw, &du_tid->release_queue); ++ } ++} ++ ++void ssv6xxx_ampdu_postprocess_BA(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ ssv6xxx_foreach_sta(sc, _postprocess_BA, NULL); ++} ++ ++static void ssv6200_hw_set_rx_ba_session(struct ssv_hw *sh, bool on, u8 * ta, ++ u16 tid, u16 ssn, u8 buf_size) ++{ ++ if (on) { ++ u32 u32ta; ++ u32ta = 0; ++ u32ta |= (ta[0] & 0xff) << (8 * 0); ++ u32ta |= (ta[1] & 0xff) << (8 * 1); ++ u32ta |= (ta[2] & 0xff) << (8 * 2); ++ u32ta |= (ta[3] & 0xff) << (8 * 3); ++ SMAC_REG_WRITE(sh, ADR_BA_TA_0, u32ta); ++ u32ta = 0; ++ u32ta |= (ta[4] & 0xff) << (8 * 0); ++ u32ta |= (ta[5] & 0xff) << (8 * 1); ++ SMAC_REG_WRITE(sh, ADR_BA_TA_1, u32ta); ++ SMAC_REG_WRITE(sh, ADR_BA_TID, tid); ++ SMAC_REG_WRITE(sh, ADR_BA_ST_SEQ, ssn); ++ SMAC_REG_WRITE(sh, ADR_BA_SB0, 0); ++ SMAC_REG_WRITE(sh, ADR_BA_SB1, 0); ++ SMAC_REG_WRITE(sh, ADR_BA_CTRL, 0xb); ++ } else { ++ SMAC_REG_WRITE(sh, ADR_BA_CTRL, 0x0); ++ } ++} ++ ++void ssv6xxx_set_ampdu_rx_add_work(struct work_struct *work) ++{ ++ struct ssv_softc ++ *sc = container_of(work, struct ssv_softc, set_ampdu_rx_add_work); ++ ssv6200_hw_set_rx_ba_session(sc->sh, true, sc->ba_ra_addr, sc->ba_tid, ++ sc->ba_ssn, 64); ++} ++ ++void ssv6xxx_set_ampdu_rx_del_work(struct work_struct *work) ++{ ++ struct ssv_softc *sc = container_of(work, struct ssv_softc, ++ set_ampdu_rx_del_work); ++ u8 addr[6] = { 0 }; ++ ssv6200_hw_set_rx_ba_session(sc->sh, false, addr, 0, 0, 0); ++} ++ ++static void _reset_ampdu_mib(struct ssv_softc *sc, ++ struct ssv_sta_info *sta_info, void *param) ++{ ++ struct ieee80211_sta *sta = sta_info->sta; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ int i; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ for (i = 0; i < WMM_TID_NUM; i++) { ++ ssv_sta_priv->ampdu_tid[i].ampdu_mib_reset = 1; ++ } ++} ++ ++void ssv6xxx_ampdu_mib_reset(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ if (sc == NULL) ++ return; ++ ssv6xxx_foreach_sta(sc, _reset_ampdu_mib, NULL); ++} ++ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ssize_t ampdu_tx_mib_dump(struct ssv_sta_priv_data *ssv_sta_priv, ++ char *mib_str, ssize_t length) ++{ ++ ssize_t buf_size = length; ++ ssize_t prt_size; ++ int j; ++ struct ssv_sta_info *ssv_sta = ssv_sta_priv->sta_info; ++ if (ssv_sta->sta == NULL) { ++ prt_size = snprintf(mib_str, buf_size, "\n NULL STA.\n"); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ goto mib_dump_exit; ++ } ++ for (j = 0; j < WMM_TID_NUM; j++) { ++ int k; ++ struct AMPDU_TID_st *ampdu_tid = &ssv_sta_priv->ampdu_tid[j]; ++ struct AMPDU_MIB_st *ampdu_mib = &du_tid->mib; ++ prt_size = ++ snprintf(mib_str, buf_size, "\n WMM_TID %d@%d\n", j, ++ ampdu_tid->state); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ if (ampdu_tid->state != AMPDU_STATE_OPERATION) ++ continue; ++ prt_size = ++ snprintf(mib_str, buf_size, " BA window size: %d\n", ++ ampdu_tid->ssv_baw_size); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(mib_str, buf_size, " BA window head: %d\n", ++ ampdu_tid->ssv_baw_head); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " Sending aggregated #: %d\n", ++ ampdu_tid->aggr_pkt_num); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(mib_str, buf_size, " Waiting #: %d\n", ++ skb_queue_len(&du_tid->ampdu_skb_tx_queue)); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(mib_str, buf_size, " Early aggregated %d\n", ++ ampdu_tid->early_aggr_skb_num); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " MPDU: %d\n", ++ ampdu_mib->ampdu_mib_mpdu_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " Passed: %d\n", ++ ampdu_mib->ampdu_mib_pass_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " Retry: %d\n", ++ ampdu_mib->ampdu_mib_retry_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " AMPDU: %d\n", ++ ampdu_mib->ampdu_mib_ampdu_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " Retry AMPDU: %d\n", ++ ampdu_mib->ampdu_mib_aggr_retry_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " BAR count: %d\n", ++ ampdu_mib->ampdu_mib_bar_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " Discard count: %d\n", ++ ampdu_mib->ampdu_mib_discard_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(mib_str, buf_size, ++ " BA count: %d\n", ++ ampdu_mib->ampdu_mib_BA_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(mib_str, buf_size, " Total BA count: %d\n", ++ ssv_sta_priv->ampdu_mib_total_BA_counter); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ prt_size = ++ snprintf(mib_str, buf_size, " Aggr # count:\n"); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ for (k = 0; k <= SSV_AMPDU_aggr_num_max; k++) { ++ prt_size = ++ snprintf(mib_str, buf_size, " %d: %d\n", ++ k, ampdu_mib->ampdu_mib_dist[k]); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ } ++ } ++ mib_dump_exit: ++ return (length - buf_size); ++} ++ ++static void _dump_ampdu_mib(struct ssv_softc *sc, struct ssv_sta_info *sta_info, ++ void *param) ++{ ++ struct mib_dump_data *dump_data = (struct mib_dump_data *)param; ++ struct ieee80211_sta *sta; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ ssize_t buf_size; ++ ssize_t prt_size; ++ char *mib_str = dump_data->prt_buff; ++ if (param == NULL) ++ return; ++ buf_size = dump_data->buff_size - 1; ++ sta = sta_info->sta; ++ if ((sta == NULL) || ((sta_info->s_flags & STA_FLAG_VALID) == 0)) ++ return; ++ prt_size = snprintf(mib_str, buf_size, ++ "STA: %02X-%02X-%02X-%02X-%02X-%02X:\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], ++ sta->addr[3], sta->addr[4], sta->addr[5]); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ prt_size = ampdu_tx_mib_dump(ssv_sta_priv, mib_str, buf_size); ++ mib_str += prt_size; ++ buf_size -= prt_size; ++ dump_data->prt_len = (dump_data->buff_size - 1 - buf_size); ++ dump_data->prt_buff = mib_str; ++ dump_data->buff_size = buf_size; ++} ++ ++ssize_t ssv6xxx_ampdu_mib_dump(struct ieee80211_hw *hw, char *mib_str, ++ ssize_t length) ++{ ++ struct ssv_softc *sc = hw->priv; ++ ssize_t buf_size = length - 1; ++ struct mib_dump_data dump_data = { mib_str, buf_size, 0 }; ++ if (sc == NULL) ++ return 0; ++ ssv6xxx_foreach_sta(sc, _dump_ampdu_mib, &dump_data); ++ return dump_data.prt_len; ++} ++#endif ++struct sk_buff *_alloc_ampdu_skb(struct ssv_softc *sc, ++ struct AMPDU_TID_st *ampdu_tid, u32 len) ++{ ++ unsigned char *payload_addr; ++ u32 headroom = sc->hw->extra_tx_headroom; ++ u32 offset; ++ u32 cur_max_ampdu_size = SSV_GET_MAX_AMPDU_SIZE(sc->sh); ++ u32 extra_room = sc->sh->tx_desc_len * 2 + 48; ++ u32 max_physical_len = (len ++ && ((len + extra_room) < cur_max_ampdu_size)) ++ ? (len + extra_room) ++ : cur_max_ampdu_size; ++ u32 skb_len = max_physical_len + headroom + 3; ++ struct sk_buff *ampdu_skb = __dev_alloc_skb(skb_len, GFP_KERNEL); ++ struct ampdu_hdr_st *ampdu_hdr; ++ if (ampdu_skb == NULL) { ++ dev_err(sc->dev, "AMPDU allocation of size %d(%d) failed\n", ++ len, skb_len); ++ return NULL; ++ } ++ payload_addr = ampdu_skb->data + headroom - sc->sh->tx_desc_len; ++ offset = ((size_t)payload_addr) % 4U; ++ if (offset) { ++ dev_dbg(sc->dev, "Align AMPDU data %d\n", offset); ++ skb_reserve(ampdu_skb, headroom + 4 - offset); ++ } else ++ skb_reserve(ampdu_skb, headroom); ++ ampdu_hdr = (struct ampdu_hdr_st *)ampdu_skb->head; ++ skb_queue_head_init(&du_hdr->mpdu_q); ++ ampdu_hdr->max_size = max_physical_len - extra_room; ++ ampdu_hdr->size = 0; ++ ampdu_hdr->ampdu_tid = ampdu_tid; ++ memset(ampdu_hdr->ssn, 0xFF, sizeof(ampdu_hdr->ssn)); ++ ampdu_hdr->mpdu_num = 0; ++ return ampdu_skb; ++} ++ ++bool _is_skb_q_empty(struct ssv_softc *sc, struct sk_buff *skb) ++{ ++ u32 ac = skb_get_queue_mapping(skb); ++ u32 hw_txqid = sc->tx.hw_txqid[ac]; ++ return AMPDU_HCI_Q_EMPTY(sc->sh, hw_txqid); ++} ++ ++static u32 _check_timeout(struct AMPDU_TID_st *ampdu_tid) ++{ ++ u16 ssn, head_ssn, end_ssn; ++ unsigned long check_jiffies = jiffies; ++ u32 has_retry = 0; ++ head_ssn = ampdu_tid->ssv_baw_head; ++ ssn = head_ssn; ++ if (ssn == SSV_ILLEGAL_SN) ++ return 0; ++ end_ssn = (head_ssn + SSV_AMPDU_BA_WINDOW_SIZE) % SSV_AMPDU_MAX_SSN; ++ do { ++ struct sk_buff *skb = INDEX_PKT_BY_SSN(ampdu_tid, ssn); ++ struct SKB_info_st *skb_info; ++ unsigned long cur_jiffies; ++ unsigned long timeout_jiffies; ++ u32 delta_ms; ++ if (skb == NULL) ++ break; ++ skb_info = (SKB_info *) (skb->head); ++ cur_jiffies = jiffies; ++ timeout_jiffies = ++ skb_info->aggr_timestamp + ++ msecs_to_jiffies(BA_WAIT_TIMEOUT); ++ if ((skb_info->ampdu_tx_status != AMPDU_ST_SENT) ++ || time_before(cur_jiffies, timeout_jiffies)) ++ break; ++ delta_ms = ++ jiffies_to_msecs(cur_jiffies - skb_info->aggr_timestamp); ++ prn_aggr_err("rt S%d-T%d-%d (%u)\n", ++ ((struct ssv_sta_priv_data *)skb_info->sta-> ++ drv_priv)->sta_idx, ampdu_tid->tidno, ssn, ++ delta_ms); ++ if (delta_ms > 1000) { ++ prn_aggr_err("Last checktime %lu - %lu = %u\n", ++ check_jiffies, ampdu_tid->timestamp, ++ jiffies_to_msecs(check_jiffies - ++ ampdu_tid->timestamp)); ++ } ++ has_retry += _mark_skb_retry(skb_info, skb); ++ INC_PKT_SN(ssn); ++ } while (ssn != end_ssn); ++ ampdu_tid->timestamp = check_jiffies; ++ return has_retry; ++} ++ ++void ssv6xxx_ampdu_check_timeout(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct AMPDU_TID_st *cur_AMPDU_TID; ++ if (!list_empty(&sc->tx.ampdu_tx_que)) { ++ list_for_each_entry_rcu(cur_AMPDU_TID, &sc->tx.ampdu_tx_que, ++ list) { ++ u32 has_retry; ++ if (cur_AMPDU_TID->state != AMPDU_STATE_OPERATION) ++ continue; ++ has_retry = _check_timeout(cur_AMPDU_TID); ++ if (has_retry) { ++ _collect_retry_frames(cur_AMPDU_TID); ++ ssv6200_ampdu_send_retry(sc->hw, cur_AMPDU_TID, ++ &cur_AMPDU_TID-> ++ retry_queue, true); ++ } ++ } ++ } ++} ++ ++void ssv6xxx_ampdu_sent(struct ieee80211_hw *hw, struct sk_buff *ampdu) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ampdu_hdr_st *ampdu_hdr = (struct ampdu_hdr_st *)ampdu->head; ++ struct sk_buff *mpdu; ++ unsigned long cur_jiffies = jiffies; ++ int i; ++ SKB_info *mpdu_skb_info; ++ u16 ssn; ++ if (ampdu_hdr->ampdu_tid->state != AMPDU_STATE_OPERATION) ++ return; ++ spin_lock_bh(&du_hdr->ampdu_tid->pkt_array_lock); ++ for (i = 0; i < ampdu_hdr->mpdu_num; i++) { ++ ssn = ampdu_hdr->ssn[i]; ++ mpdu = INDEX_PKT_BY_SSN(ampdu_hdr->ampdu_tid, ssn); ++ if (mpdu == NULL) { ++ dev_err(sc->dev, "T%d-%d is a NULL MPDU.\n", ++ ampdu_hdr->ampdu_tid->tidno, ssn); ++ continue; ++ } ++ if (ampdu_skb_ssn(mpdu) != ssn) { ++ dev_err(sc->dev, "T%d-%d does not match %d MPDU.\n", ++ ampdu_hdr->ampdu_tid->tidno, ssn, ++ ampdu_skb_ssn(mpdu)); ++ continue; ++ } ++ mpdu_skb_info = (SKB_info *) (mpdu->head); ++ mpdu_skb_info->aggr_timestamp = cur_jiffies; ++ mpdu_skb_info->ampdu_tx_status = AMPDU_ST_SENT; ++ } ++ spin_unlock_bh(&du_hdr->ampdu_tid->pkt_array_lock); ++} +diff --git a/drivers/net/wireless/ssv6051/smac/ampdu.h b/drivers/net/wireless/ssv6051/smac/ampdu.h +new file mode 100644 +index 000000000000..faa61c4f9297 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ampdu.h +@@ -0,0 +1,215 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _AMPDU_H_ ++#define _AMPDU_H_ ++#include ++#include ++#define Enable_ampdu_debug_log (0) ++#define Enable_AMPDU_Live_Time (0) ++#define Enable_HW_AUTO_CRC_32 (1) ++#define Enable_AMPDU_Rx (1) ++#define Enable_AMPDU_Tx (1) ++#define Enable_AMPDU_FW_Retry (1) ++#define Enable_AMPDU_delay_work (1) ++#define USE_FLUSH_RETRY ++#define USE_AMPDU_TX_STATUS_ARRAY ++#define SSV_AMPDU_FLOW_CONTROL ++#define AMPDU_CHECK_SKB_SEQNO ++#define REPORT_TX_STATUS_DIRECTLY ++#define SSV_AMPDU_aggr_num_max MAX_AGGR_NUM ++#define SSV_AMPDU_seq_num_max (4096) ++#define SSV_AMPDU_retry_counter_max (3) ++#define SSV_AMPDU_tx_group_id_max (64) ++#define SSV_AMPDU_MAX_SSN (4096) ++#define SSV_AMPDU_BA_WINDOW_SIZE (64) ++#define SSV_AMPDU_WINDOW_SIZE (64) ++#define SSV_GET_MAX_AMPDU_SIZE(sh) (((sh)->tx_page_available/(sh)->ampdu_divider) << HW_MMU_PAGE_SHIFT) ++#define SSV_AMPDU_FLOW_CONTROL_UPPER_BOUND (64) ++#define SSV_AMPDU_FLOW_CONTROL_LOWER_BOUND (48) ++#define SSV_AMPDU_timer_period (50) ++#define SSV_AMPDU_TX_TIME_THRESHOLD (50) ++#define SSV_AMPDU_MPDU_LIVE_TIME (SSV_AMPDU_retry_counter_max*8) ++#define SSV_AMPDU_BA_TIME (50) ++#define SSV_ILLEGAL_SN (0xffff) ++#define AMPDU_BUFFER_SIZE (32*1024) ++#define AMPDU_SIGNATURE (0x4E) ++#define AMPDU_DELIMITER_LEN (4) ++#define AMPDU_FCS_LEN (4) ++#define AMPDU_RESERVED_LEN (3) ++#define AMPDU_TX_NAV_MCS_567 (48) ++#define SSV_SEQ_NUM_SHIFT (4) ++#define SSV_RETRY_BIT_SHIFT (11) ++#define IEEE80211_SEQ_SEQ_SHIFT (4) ++#define IEEE80211_AMPDU_BA_LEN (34) ++#define SSV6200_AMPDU_TRIGGER_INDEX 0 ++#define SSV_SN_STATUS_Release (0xaa) ++#define SSV_SN_STATUS_Retry (0xbb) ++#define SSV_SN_STATUS_Wait_BA (0xcc) ++#define SSV_SN_STATUS_Discard (0xdd) ++#define AMPDU_HCI_SEND_TAIL_WITH_FLOWCTRL (0) ++#define AMPDU_HCI_SEND_HEAD_WITH_FLOWCTRL (1) ++#define AMPDU_HCI_SEND_TAIL_WITHOUT_FLOWCTRL (2) ++#define AMPDU_HCI_SEND_HEAD_WITHOUT_FLOWCTRL (3) ++#define SSV_BAR_CTRL_ACK_POLICY_NORMAL (0x0000) ++#define SSV_BAR_CTRL_CBMTID_COMPRESSED_BA (0x0004) ++#define SSV_BAR_CTRL_TID_INFO_SHIFT (12) ++#define AMPDU_STATE_START BIT(0) ++#define AMPDU_STATE_OPERATION BIT(1) ++#define AMPDU_STATE_STOP BIT(2) ++typedef enum { ++ AMPDU_REKEY_PAUSE_STOP = 0, ++ AMPDU_REKEY_PAUSE_START, ++ AMPDU_REKEY_PAUSE_ONGOING, ++ AMPDU_REKEY_PAUSE_DEFER, ++ AMPDU_REKEY_PAUSE_HWKEY_SYNC, ++} AMPDU_REKEY_PAUSE_STATE; ++#define SSV_a_minus_b_in_c(a,b,c) (((a)>=(b))?((a)-(b)):((c)-(b)+(a))) ++#define SSV_AMPDU_SN_a_minus_b(a,b) (SSV_a_minus_b_in_c((a), (b), SSV_AMPDU_seq_num_max)) ++#define AMPDU_HCI_SEND(_sh,_sk,_q,_flag) (_sh)->hci.hci_ops->hci_tx((_sk), (_q), (_flag)) ++#define AMPDU_HCI_Q_EMPTY(_sh,_q) (_sh)->hci.hci_ops->hci_txq_empty((_q)) ++struct ampdu_hdr_st { ++ u32 first_sn; ++ struct sk_buff_head mpdu_q; ++ u32 max_size; ++ u32 size; ++ struct AMPDU_TID_st *ampdu_tid; ++ u16 ssn[MAX_AGGR_NUM]; ++ u16 mpdu_num; ++ struct fw_rc_retry_params rates[SSV62XX_TX_MAX_RATES]; ++ struct ieee80211_sta *sta; ++}; ++enum AMPDU_TX_STATUS_E { ++ AMPDU_ST_NON_AMPDU, ++ AMPDU_ST_AGGREGATED, ++ AMPDU_ST_SENT, ++ AMPDU_ST_RETRY, ++ AMPDU_ST_DROPPED, ++ AMPDU_ST_DONE, ++}; ++typedef struct AMPDU_MIB_st { ++ u32 ampdu_mib_mpdu_counter; ++ u32 ampdu_mib_retry_counter; ++ u32 ampdu_mib_ampdu_counter; ++ u32 ampdu_mib_aggr_retry_counter; ++ u32 ampdu_mib_bar_counter; ++ u32 ampdu_mib_discard_counter; ++ u32 ampdu_mib_total_BA_counter; ++ u32 ampdu_mib_BA_counter; ++ u32 ampdu_mib_pass_counter; ++ u32 ampdu_mib_dist[SSV_AMPDU_aggr_num_max + 1]; ++} AMPDU_MIB; ++typedef struct AMPDU_TID_st { ++ struct list_head list; ++ volatile unsigned long timestamp; ++ u32 tidno; ++ u16 ac; ++ struct ieee80211_sta *sta; ++ u16 ssv_baw_size; ++ u8 agg_num_max; ++ u8 state; ++#ifdef AMPDU_CHECK_SKB_SEQNO ++ u32 last_seqno; ++#endif ++ struct sk_buff_head ampdu_skb_tx_queue; ++ spinlock_t ampdu_skb_tx_queue_lock; ++ struct sk_buff_head retry_queue; ++ struct sk_buff_head release_queue; ++ struct sk_buff *aggr_pkts[SSV_AMPDU_BA_WINDOW_SIZE]; ++ volatile u32 aggr_pkt_num; ++ volatile u16 ssv_baw_head; ++ spinlock_t pkt_array_lock; ++ struct sk_buff *cur_ampdu_pkt; ++ struct sk_buff_head early_aggr_ampdu_q; ++ u32 early_aggr_skb_num; ++ struct sk_buff_head ampdu_skb_wait_encry_queue; ++ u32 ampdu_mib_reset; ++ struct AMPDU_MIB_st mib; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct dentry *debugfs_dir; ++ struct sk_buff_head ba_q; ++#endif ++} AMPDU_TID, *p_AMPDU_TID; ++typedef struct AMPDU_DELIMITER_st { ++ u16 reserved:4; ++ u16 length:12; ++ u8 crc; ++ u8 signature; ++} AMPDU_DELIMITER, *p_AMPDU_DELIMITER; ++typedef struct AMPDU_BLOCKACK_st { ++ u16 frame_control; ++ u16 duration; ++ u8 ra_addr[ETH_ALEN]; ++ u8 ta_addr[ETH_ALEN]; ++ u16 BA_ack_ploicy:1; ++ u16 multi_tid:1; ++ u16 compress_bitmap:1; ++ u16 reserved:9; ++ u16 tid_info:4; ++ u16 BA_fragment_sn:4; ++ u16 BA_ssn:12; ++ u32 BA_sn_bit_map[2]; ++} AMPDU_BLOCKACK, *p_AMPDU_BLOCKACK; ++struct ssv_bar { ++ unsigned short frame_control; ++ unsigned short duration; ++ unsigned char ra[6]; ++ unsigned char ta[6]; ++ unsigned short control; ++ unsigned short start_seq_num; ++} __packed; ++#if Enable_ampdu_debug_log ++#define ampdu_db_log(format, args...) printk("~~~ampdu [%s:%d] "format, __FUNCTION__, __LINE__, ##args) ++#define ampdu_db_log_simple(format, args...) printk(format, ##args) ++#else ++#define ampdu_db_log(...) do {} while (0) ++#define ampdu_db_log_simple(...) do {} while (0) ++#endif ++#if Enable_AMPDU_delay_work ++void ssv6200_ampdu_delayed_work_callback_func(struct work_struct *work); ++#else ++void ssv6200_ampdu_timer_callback_func(unsigned long data); ++#endif ++void ssv6200_ampdu_init(struct ieee80211_hw *hw); ++void ssv6200_ampdu_deinit(struct ieee80211_hw *hw); ++void ssv6200_ampdu_release_skb(struct sk_buff *skb, struct ieee80211_hw *hw); ++void ssv6200_ampdu_tx_start(u16 tid, struct ieee80211_sta *sta, ++ struct ieee80211_hw *hw, u16 * ssn); ++void ssv6200_ampdu_tx_operation(u16 tid, struct ieee80211_sta *sta, ++ struct ieee80211_hw *hw, u8 buffer_size); ++void ssv6200_ampdu_tx_stop(u16 tid, struct ieee80211_sta *sta, ++ struct ieee80211_hw *hw); ++bool ssv6200_ampdu_tx_handler(struct ieee80211_hw *hw, struct sk_buff *skb); ++u32 ssv6xxx_ampdu_flush(struct ieee80211_hw *hw); ++void ssv6200_ampdu_timeout_tx(struct ieee80211_hw *hw); ++struct cfg_host_event; ++void ssv6200_ampdu_no_BA_handler(struct ieee80211_hw *hw, struct sk_buff *skb); ++void ssv6200_ampdu_BA_handler(struct ieee80211_hw *hw, struct sk_buff *skb); ++void ssv6200_ampdu_tx_update_state(void *priv, struct ieee80211_sta *sta, ++ struct sk_buff *skb); ++void ssv6200_ampdu_tx_add_sta(struct ieee80211_hw *hw, ++ struct ieee80211_sta *sta); ++void ssv6xxx_ampdu_postprocess_BA(struct ieee80211_hw *hw); ++void ssv6xxx_ampdu_check_timeout(struct ieee80211_hw *hw); ++void ssv6xxx_ampdu_sent(struct ieee80211_hw *hw, struct sk_buff *ampdu); ++extern void ssv6xxx_set_ampdu_rx_add_work(struct work_struct *work); ++extern void ssv6xxx_set_ampdu_rx_del_work(struct work_struct *work); ++void ssv6xxx_mib_reset(struct ieee80211_hw *hw); ++ssize_t ssv6xxx_mib_dump(struct ieee80211_hw *hw, char *mib_str, ++ ssize_t length); ++void encry_work(struct work_struct *work); ++void sync_hw_key_work(struct work_struct *work); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/ap.c b/drivers/net/wireless/ssv6051/smac/ap.c +new file mode 100644 +index 000000000000..0f2ba6a31a05 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ap.c +@@ -0,0 +1,598 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "lib.h" ++#include "dev.h" ++#include "ap.h" ++#include "ssv_rc_common.h" ++#include "ssv_rc.h" ++int ssv6200_bcast_queue_len(struct ssv6xxx_bcast_txq *bcast_txq); ++#define IS_EQUAL(a,b) ( (a) == (b) ) ++#define SET_BIT(v,b) ( (v) |= (0x01<>PBUF_ADDR_SHIFT) ++#define PBUF_MapIDtoPkt(_ID) (PBUF_BASE_ADDR|((_ID)<sh, ADR_MTX_BCN_MISC, val); ++} ++ ++void ssv6xxx_beacon_set_info(struct ssv_softc *sc, u8 beacon_interval, ++ u8 dtim_cnt) ++{ ++ u32 val; ++ if (beacon_interval == 0) ++ beacon_interval = 100; ++#ifdef BEACON_DEBUG ++ printk("[A] BSS_CHANGED_BEACON_INT beacon_int[%d] dtim_cnt[%d]\n", ++ beacon_interval, (dtim_cnt)); ++#endif ++ val = ++ (beacon_interval << MTX_BCN_PERIOD_SHIFT) | (dtim_cnt << ++ MTX_DTIM_NUM_SHIFT); ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_BCN_PRD, val); ++} ++ ++bool ssv6xxx_beacon_enable(struct ssv_softc *sc, bool bEnable) ++{ ++ u32 regval = 0; ++ int ret = 0; ++ if (bEnable && !sc->beacon_usage) { ++ printk ++ ("[A] Reject to set beacon!!!. ssv6xxx_beacon_enable bEnable[%d] sc->beacon_usage[%d]\n", ++ bEnable, sc->beacon_usage); ++ sc->enable_beacon = BEACON_WAITING_ENABLED; ++ return 0; ++ } ++ if ((bEnable && (BEACON_ENABLED & sc->enable_beacon)) || ++ (!bEnable && !sc->enable_beacon)) { ++ printk ++ ("[A] ssv6xxx_beacon_enable bEnable[%d] and sc->enable_beacon[%d] are the same. no need to execute.\n", ++ bEnable, sc->enable_beacon); ++ if (bEnable) { ++ printk(" Ignore enable beacon cmd!!!!\n"); ++ return 0; ++ } ++ } ++ SMAC_REG_READ(sc->sh, ADR_MTX_BCN_EN_MISC, ®val); ++#ifdef BEACON_DEBUG ++ printk("[A] ssv6xxx_beacon_enable read misc reg val [%08x]\n", regval); ++#endif ++ regval &= MTX_BCN_ENABLE_MASK; ++#ifdef BEACON_DEBUG ++ printk("[A] ssv6xxx_beacon_enable read misc reg val [%08x]\n", regval); ++#endif ++ regval |= (bEnable << MTX_BCN_TIMER_EN_SHIFT); ++ ret = SMAC_REG_WRITE(sc->sh, ADR_MTX_BCN_EN_MISC, regval); ++#ifdef BEACON_DEBUG ++ printk("[A] ssv6xxx_beacon_enable read misc reg val [%08x]\n", regval); ++#endif ++ sc->enable_beacon = (bEnable == true) ? BEACON_ENABLED : 0; ++ return ret; ++} ++ ++int ssv6xxx_beacon_fill_content(struct ssv_softc *sc, u32 regaddr, u8 * beacon, ++ int size) ++{ ++ u32 i, val; ++ u32 *ptr = (u32 *) beacon; ++ size = size / 4; ++ for (i = 0; i < size; i++) { ++ val = (u32) (*(ptr + i)); ++#ifdef BEACON_DEBUG ++ printk("[%08x] ", val); ++#endif ++ SMAC_REG_WRITE(sc->sh, regaddr + i * 4, val); ++ } ++#ifdef BEACON_DEBUG ++ printk("\n"); ++#endif ++ return 0; ++} ++ ++void ssv6xxx_beacon_fill_tx_desc(struct ssv_softc *sc, ++ struct sk_buff *beacon_skb) ++{ ++ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(beacon_skb); ++ struct ssv6200_tx_desc *tx_desc; ++ u16 pb_offset = TXPB_OFFSET; ++ struct ssv_rate_info ssv_rate; ++ skb_push(beacon_skb, pb_offset); ++ tx_desc = (struct ssv6200_tx_desc *)beacon_skb->data; ++ memset(tx_desc, 0, pb_offset); ++ ssv6xxx_rc_hw_rate_idx(sc, tx_info, &ssv_rate); ++ tx_desc->len = beacon_skb->len - pb_offset; ++ tx_desc->c_type = M2_TXREQ; ++ tx_desc->f80211 = 1; ++ tx_desc->ack_policy = 1; ++ tx_desc->hdr_offset = pb_offset; ++ tx_desc->hdr_len = 24; ++ tx_desc->payload_offset = tx_desc->hdr_offset + tx_desc->hdr_len; ++ tx_desc->crate_idx = ssv_rate.crate_hw_idx; ++ tx_desc->drate_idx = ssv_rate.drate_hw_idx; ++ skb_put(beacon_skb, 4); ++} ++ ++inline enum ssv6xxx_beacon_type ssv6xxx_beacon_get_valid_reg(struct ssv_softc ++ *sc) ++{ ++ u32 regval = 0; ++ SMAC_REG_READ(sc->sh, ADR_MTX_BCN_MISC, ®val); ++ regval &= MTX_BCN_CFG_VLD_MASK; ++ regval = regval >> MTX_BCN_CFG_VLD_SHIFT; ++ if (regval == 0x2 || regval == 0x0) ++ return SSV6xxx_BEACON_0; ++ else if (regval == 0x1) ++ return SSV6xxx_BEACON_1; ++ else ++ printk("=============>ERROR!!drv_bcn_reg_available\n"); ++ return SSV6xxx_BEACON_0; ++} ++ ++bool ssv6xxx_beacon_set(struct ssv_softc *sc, struct sk_buff *beacon_skb, ++ int dtim_offset) ++{ ++ u32 reg_tx_beacon_adr = ADR_MTX_BCN_CFG0; ++ enum ssv6xxx_beacon_type avl_bcn_type = SSV6xxx_BEACON_0; ++ bool ret = true; ++ int val; ++ ssv6xxx_beacon_reg_lock(sc, 1); ++ avl_bcn_type = ssv6xxx_beacon_get_valid_reg(sc); ++ if (avl_bcn_type == SSV6xxx_BEACON_1) ++ reg_tx_beacon_adr = ADR_MTX_BCN_CFG1; ++#ifdef BEACON_DEBUG ++ printk("[A] ssv6xxx_beacon_set avl_bcn_type[%d]\n", avl_bcn_type); ++#endif ++ do { ++ if (IS_BIT_SET(sc->beacon_usage, avl_bcn_type)) { ++#ifdef BEACON_DEBUG ++ printk ++ ("[A] beacon has already been set old len[%d] new len[%d]\n", ++ sc->beacon_info[avl_bcn_type].len, ++ beacon_skb->len); ++#endif ++ if (sc->beacon_info[avl_bcn_type].len >= ++ beacon_skb->len) { ++ break; ++ } else { ++ if (false == ++ ssv6xxx_pbuf_free(sc, ++ sc-> ++ beacon_info[avl_bcn_type]. ++ pubf_addr)) { ++#ifdef BEACON_DEBUG ++ printk ++ ("=============>ERROR!!Intend to allcoate beacon from ASIC fail.\n"); ++#endif ++ ret = false; ++ goto out; ++ } ++ CLEAR_BIT(sc->beacon_usage, avl_bcn_type); ++ } ++ } ++ sc->beacon_info[avl_bcn_type].pubf_addr = ++ ssv6xxx_pbuf_alloc(sc, beacon_skb->len, TX_BUF); ++ sc->beacon_info[avl_bcn_type].len = beacon_skb->len; ++ if (sc->beacon_info[avl_bcn_type].pubf_addr == 0) { ++ ret = false; ++ goto out; ++ } ++ SET_BIT(sc->beacon_usage, avl_bcn_type); ++#ifdef BEACON_DEBUG ++ printk ++ ("[A] beacon type[%d] usage[%d] allocate new beacon addr[%08x] \n", ++ avl_bcn_type, sc->beacon_usage, ++ sc->beacon_info[avl_bcn_type].pubf_addr); ++#endif ++ } while (0); ++ ssv6xxx_beacon_fill_content(sc, sc->beacon_info[avl_bcn_type].pubf_addr, ++ beacon_skb->data, beacon_skb->len); ++ val = ++ (PBUF_MapPkttoID(sc->beacon_info[avl_bcn_type].pubf_addr)) | ++ (dtim_offset << MTX_DTIM_OFST0); ++ SMAC_REG_WRITE(sc->sh, reg_tx_beacon_adr, val); ++#ifdef BEACON_DEBUG ++ printk("[A] update to register reg_tx_beacon_adr[%08x] val[%08x]\n", ++ reg_tx_beacon_adr, val); ++#endif ++ out: ++ ssv6xxx_beacon_reg_lock(sc, 0); ++ if (sc->beacon_usage && (sc->enable_beacon & BEACON_WAITING_ENABLED)) { ++ printk("[A] enable beacon for BEACON_WAITING_ENABLED flags\n"); ++ ssv6xxx_beacon_enable(sc, true); ++ } ++ return ret; ++} ++ ++inline bool ssv6xxx_auto_bcn_ongoing(struct ssv_softc *sc) ++{ ++ u32 regval; ++ SMAC_REG_READ(sc->sh, ADR_MTX_BCN_MISC, ®val); ++ return ((AUTO_BCN_ONGOING_MASK & regval) >> AUTO_BCN_ONGOING_SHIFT); ++} ++ ++void ssv6xxx_beacon_release(struct ssv_softc *sc) ++{ ++ int cnt = 10; ++ printk("[A] ssv6xxx_beacon_release Enter\n"); ++ cancel_work_sync(&sc->set_tim_work); ++ do { ++ if (ssv6xxx_auto_bcn_ongoing(sc)) ++ ssv6xxx_beacon_enable(sc, false); ++ else ++ break; ++ cnt--; ++ if (cnt <= 0) ++ break; ++ } while (1); ++ if (IS_BIT_SET(sc->beacon_usage, SSV6xxx_BEACON_0)) { ++ ssv6xxx_pbuf_free(sc, ++ sc->beacon_info[SSV6xxx_BEACON_0].pubf_addr); ++ CLEAR_BIT(sc->beacon_usage, SSV6xxx_BEACON_0); ++ } ++ if (IS_BIT_SET(sc->beacon_usage, SSV6xxx_BEACON_1)) { ++ ssv6xxx_pbuf_free(sc, ++ sc->beacon_info[SSV6xxx_BEACON_1].pubf_addr); ++ CLEAR_BIT(sc->beacon_usage, SSV6xxx_BEACON_1); ++ } ++ sc->enable_beacon = 0; ++ if (sc->beacon_buf) { ++ dev_kfree_skb_any(sc->beacon_buf); ++ sc->beacon_buf = NULL; ++ } ++#ifdef BEACON_DEBUG ++ printk("[A] ssv6xxx_beacon_release leave\n"); ++#endif ++} ++ ++void ssv6xxx_beacon_change(struct ssv_softc *sc, struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, bool aid0_bit_set) ++{ ++ struct sk_buff *skb; ++ struct sk_buff *old_skb = NULL; ++ u16 tim_offset, tim_length; ++ if (sc == NULL || hw == NULL || vif == NULL) { ++ printk("[Error]........ssv6xxx_beacon_change input error\n"); ++ return; ++ } ++ do { ++ skb = ieee80211_beacon_get_tim(hw, vif, ++ &tim_offset, &tim_length, 0); ++ if (skb == NULL) { ++ printk("[Error]........skb is NULL\n"); ++ break; ++ } ++ if (tim_offset && tim_length >= 6) { ++ skb->data[tim_offset + 2] = 0; ++ if (aid0_bit_set) ++ skb->data[tim_offset + 4] |= 1; ++ else ++ skb->data[tim_offset + 4] &= ~1; ++ } ++#ifdef BEACON_DEBUG ++ printk("[A] beacon len [%d] tim_offset[%d]\n", skb->len, ++ tim_offset); ++#endif ++ ssv6xxx_beacon_fill_tx_desc(sc, skb); ++#ifdef BEACON_DEBUG ++ printk("[A] beacon len [%d] tim_offset[%d]\n", skb->len, ++ tim_offset); ++#endif ++ if (sc->beacon_buf) { ++ if (memcmp ++ (sc->beacon_buf->data, skb->data, ++ (skb->len - FCS_LEN)) == 0) { ++ old_skb = skb; ++ break; ++ } else { ++ old_skb = sc->beacon_buf; ++ sc->beacon_buf = skb; ++ } ++ } else { ++ sc->beacon_buf = skb; ++ } ++ tim_offset += 2; ++ if (ssv6xxx_beacon_set(sc, skb, tim_offset)) { ++ u8 dtim_cnt = vif->bss_conf.dtim_period - 1; ++ if (sc->beacon_dtim_cnt != dtim_cnt) { ++ sc->beacon_dtim_cnt = dtim_cnt; ++#ifdef BEACON_DEBUG ++ printk("[A] beacon_dtim_cnt [%d]\n", ++ sc->beacon_dtim_cnt); ++#endif ++ ssv6xxx_beacon_set_info(sc, sc->beacon_interval, ++ sc->beacon_dtim_cnt); ++ } ++ } ++ } while (0); ++ if (old_skb) ++ dev_kfree_skb_any(old_skb); ++} ++ ++void ssv6200_set_tim_work(struct work_struct *work) ++{ ++ struct ssv_softc *sc = ++ container_of(work, struct ssv_softc, set_tim_work); ++#ifdef BROADCAST_DEBUG ++ printk("%s() enter\n", __FUNCTION__); ++#endif ++ ssv6xxx_beacon_change(sc, sc->hw, sc->ap_vif, sc->aid0_bit_set); ++#ifdef BROADCAST_DEBUG ++ printk("%s() leave\n", __FUNCTION__); ++#endif ++} ++ ++int ssv6200_bcast_queue_len(struct ssv6xxx_bcast_txq *bcast_txq) ++{ ++ u32 len; ++ unsigned long flags; ++ spin_lock_irqsave(&bcast_txq->txq_lock, flags); ++ len = bcast_txq->cur_qsize; ++ spin_unlock_irqrestore(&bcast_txq->txq_lock, flags); ++ return len; ++} ++ ++struct sk_buff *ssv6200_bcast_dequeue(struct ssv6xxx_bcast_txq *bcast_txq, ++ u8 * remain_len) ++{ ++ struct sk_buff *skb = NULL; ++ unsigned long flags; ++ spin_lock_irqsave(&bcast_txq->txq_lock, flags); ++ if (bcast_txq->cur_qsize) { ++ bcast_txq->cur_qsize--; ++ if (remain_len) ++ *remain_len = bcast_txq->cur_qsize; ++ skb = __skb_dequeue(&bcast_txq->qhead); ++ } ++ spin_unlock_irqrestore(&bcast_txq->txq_lock, flags); ++ return skb; ++} ++ ++int ssv6200_bcast_enqueue(struct ssv_softc *sc, ++ struct ssv6xxx_bcast_txq *bcast_txq, ++ struct sk_buff *skb) ++{ ++ unsigned long flags; ++ spin_lock_irqsave(&bcast_txq->txq_lock, flags); ++ if (bcast_txq->cur_qsize >= SSV6200_MAX_BCAST_QUEUE_LEN) { ++ struct sk_buff *old_skb; ++ old_skb = __skb_dequeue(&bcast_txq->qhead); ++ bcast_txq->cur_qsize--; ++ ssv6xxx_txbuf_free_skb(old_skb, (void *)sc); ++ printk("[B] ssv6200_bcast_enqueue - remove oldest queue\n"); ++ } ++ __skb_queue_tail(&bcast_txq->qhead, skb); ++ bcast_txq->cur_qsize++; ++ spin_unlock_irqrestore(&bcast_txq->txq_lock, flags); ++ return bcast_txq->cur_qsize; ++} ++ ++void ssv6200_bcast_flush(struct ssv_softc *sc, ++ struct ssv6xxx_bcast_txq *bcast_txq) ++{ ++ struct sk_buff *skb; ++ unsigned long flags; ++#ifdef BCAST_DEBUG ++ printk("ssv6200_bcast_flush\n"); ++#endif ++ spin_lock_irqsave(&bcast_txq->txq_lock, flags); ++ while (bcast_txq->cur_qsize > 0) { ++ skb = __skb_dequeue(&bcast_txq->qhead); ++ bcast_txq->cur_qsize--; ++ ssv6xxx_txbuf_free_skb(skb, (void *)sc); ++ } ++ spin_unlock_irqrestore(&bcast_txq->txq_lock, flags); ++} ++ ++static int queue_block_cnt = 0; ++void ssv6200_bcast_tx_work(struct work_struct *work) ++{ ++ struct ssv_softc *sc = ++ container_of(work, struct ssv_softc, bcast_tx_work.work); ++ struct sk_buff *skb; ++ int i; ++ u8 remain_size; ++ unsigned long flags; ++ bool needtimer = true; ++ long tmo = sc->bcast_interval; ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ do { ++#ifdef BCAST_DEBUG ++ printk ++ ("[B] bcast_timer: hw_mng_used[%d] HCI_TXQ_EMPTY[%d] bcast_queue_len[%d].....................\n", ++ sc->hw_mng_used, HCI_TXQ_EMPTY(sc->sh, 4), ++ ssv6200_bcast_queue_len(&sc->bcast_txq)); ++#endif ++ if (sc->hw_mng_used != 0 || false == HCI_TXQ_EMPTY(sc->sh, 4)) { ++#ifdef BCAST_DEBUG ++ printk ++ ("HW queue still have frames insdide. skip this one hw_mng_used[%d] bEmptyTXQ4[%d]\n", ++ sc->hw_mng_used, HCI_TXQ_EMPTY(sc->sh, 4)); ++#endif ++ queue_block_cnt++; ++ if (queue_block_cnt > 5) { ++ queue_block_cnt = 0; ++ ssv6200_bcast_flush(sc, &sc->bcast_txq); ++ needtimer = false; ++ } ++ break; ++ } ++ queue_block_cnt = 0; ++ for (i = 0; i < SSV6200_ID_MANAGER_QUEUE; i++) { ++ skb = ++ ssv6200_bcast_dequeue(&sc->bcast_txq, &remain_size); ++ if (!skb) { ++ needtimer = false; ++ break; ++ } ++ if ((0 != remain_size) && ++ (SSV6200_ID_MANAGER_QUEUE - 1) != i) { ++ struct ieee80211_hdr *hdr; ++ struct ssv6200_tx_desc *tx_desc = ++ (struct ssv6200_tx_desc *)skb->data; ++ hdr = ++ (struct ieee80211_hdr *)((u8 *) tx_desc + ++ tx_desc-> ++ hdr_offset); ++ hdr->frame_control |= ++ cpu_to_le16(IEEE80211_FCTL_MOREDATA); ++ } ++#ifdef BCAST_DEBUG ++ printk("[B] bcast_timer:tx remain_size[%d] i[%d]\n", ++ remain_size, i); ++#endif ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ if (HCI_SEND(sc->sh, skb, 4) < 0) { ++ printk("bcast_timer send fail!!!!!!! \n"); ++ ssv6xxx_txbuf_free_skb(skb, (void *)sc); ++ BUG_ON(1); ++ } ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ } ++ } while (0); ++ if (needtimer) { ++#ifdef BCAST_DEBUG ++ printk ++ ("[B] bcast_timer:need more timer to tx bcast frame time[%d]\n", ++ sc->bcast_interval); ++#endif ++ queue_delayed_work(sc->config_wq, &sc->bcast_tx_work, tmo); ++ } else { ++#ifdef BCAST_DEBUG ++ printk("[B] bcast_timer: ssv6200_bcast_stop\n"); ++#endif ++ ssv6200_bcast_stop(sc); ++ } ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++#ifdef BCAST_DEBUG ++ printk("[B] bcast_timer: leave.....................\n"); ++#endif ++} ++ ++void ssv6200_bcast_start_work(struct work_struct *work) ++{ ++ struct ssv_softc *sc = ++ container_of(work, struct ssv_softc, bcast_start_work); ++#ifdef BCAST_DEBUG ++ printk("[B] ssv6200_bcast_start_work==\n"); ++#endif ++ sc->bcast_interval = (sc->beacon_dtim_cnt + 1) * ++ (sc->beacon_interval + 20) * HZ / 1000; ++ if (!sc->aid0_bit_set) { ++ sc->aid0_bit_set = true; ++ ssv6xxx_beacon_change(sc, sc->hw, sc->ap_vif, sc->aid0_bit_set); ++ queue_delayed_work(sc->config_wq, ++ &sc->bcast_tx_work, sc->bcast_interval); ++#ifdef BCAST_DEBUG ++ printk("[B] bcast_start_work: Modify timer to DTIM[%d]ms==\n", ++ (sc->beacon_dtim_cnt + 1) * (sc->beacon_interval + 20)); ++#endif ++ } ++} ++ ++void ssv6200_bcast_stop_work(struct work_struct *work) ++{ ++ struct ssv_softc *sc = ++ container_of(work, struct ssv_softc, bcast_stop_work.work); ++ long tmo = HZ / 100; ++#ifdef BCAST_DEBUG ++ printk("[B] ssv6200_bcast_stop_work\n"); ++#endif ++ if (sc->aid0_bit_set) { ++ if (0 == ssv6200_bcast_queue_len(&sc->bcast_txq)) { ++ cancel_delayed_work_sync(&sc->bcast_tx_work); ++ sc->aid0_bit_set = false; ++ ssv6xxx_beacon_change(sc, sc->hw, ++ sc->ap_vif, sc->aid0_bit_set); ++#ifdef BCAST_DEBUG ++ printk("remove group bit in DTIM\n"); ++#endif ++ } else { ++#ifdef BCAST_DEBUG ++ printk ++ ("bcast_stop_work: bcast queue still have data. just modify timer to 10ms\n"); ++#endif ++ queue_delayed_work(sc->config_wq, ++ &sc->bcast_tx_work, tmo); ++ } ++ } ++} ++ ++void ssv6200_bcast_stop(struct ssv_softc *sc) ++{ ++ queue_delayed_work(sc->config_wq, ++ &sc->bcast_stop_work, ++ sc->beacon_interval * HZ / 1024); ++} ++ ++void ssv6200_bcast_start(struct ssv_softc *sc) ++{ ++ queue_work(sc->config_wq, &sc->bcast_start_work); ++} ++ ++void ssv6200_release_bcast_frame_res(struct ssv_softc *sc, ++ struct ieee80211_vif *vif) ++{ ++ unsigned long flags; ++ struct ssv_vif_priv_data *priv_vif = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ priv_vif->sta_asleep_mask = 0; ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ cancel_work_sync(&sc->bcast_start_work); ++ cancel_delayed_work_sync(&sc->bcast_stop_work); ++ ssv6200_bcast_flush(sc, &sc->bcast_txq); ++ cancel_delayed_work_sync(&sc->bcast_tx_work); ++} +diff --git a/drivers/net/wireless/ssv6051/smac/ap.h b/drivers/net/wireless/ssv6051/smac/ap.h +new file mode 100644 +index 000000000000..93b5275715b5 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ap.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _AP_H_ ++#define _AP_H_ ++#define BEACON_WAITING_ENABLED 1<<0 ++#define BEACON_ENABLED 1<<1 ++void ssv6xxx_beacon_change(struct ssv_softc *sc, struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, bool aid0_bit_set); ++void ssv6xxx_beacon_set_info(struct ssv_softc *sc, u8 beacon_interval, ++ u8 dtim_cnt); ++bool ssv6xxx_beacon_enable(struct ssv_softc *sc, bool bEnable); ++void ssv6xxx_beacon_release(struct ssv_softc *sc); ++void ssv6200_set_tim_work(struct work_struct *work); ++void ssv6200_bcast_start_work(struct work_struct *work); ++void ssv6200_bcast_stop_work(struct work_struct *work); ++void ssv6200_bcast_tx_work(struct work_struct *work); ++int ssv6200_bcast_queue_len(struct ssv6xxx_bcast_txq *bcast_txq); ++struct sk_buff *ssv6200_bcast_dequeue(struct ssv6xxx_bcast_txq *bcast_txq, ++ u8 * remain_len); ++int ssv6200_bcast_enqueue(struct ssv_softc *sc, ++ struct ssv6xxx_bcast_txq *bcast_txq, ++ struct sk_buff *skb); ++void ssv6200_bcast_start(struct ssv_softc *sc); ++void ssv6200_bcast_stop(struct ssv_softc *sc); ++void ssv6200_release_bcast_frame_res(struct ssv_softc *sc, ++ struct ieee80211_vif *vif); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/dev.c b/drivers/net/wireless/ssv6051/smac/dev.c +new file mode 100644 +index 000000000000..214e93fae460 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/dev.c +@@ -0,0 +1,3881 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include "linux_80211.h" ++#include "lib.h" ++#include "ssv_rc.h" ++#include "ssv_ht_rc.h" ++#include "dev.h" ++#include "ap.h" ++#include "init.h" ++#include "p2p.h" ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++#include "ssv6xxx_debugfs.h" ++#endif ++struct rssi_res_st rssi_res, *p_rssi_res; ++#define NO_USE_RXQ_LOCK ++#ifndef WLAN_CIPHER_SUITE_SMS4 ++#define WLAN_CIPHER_SUITE_SMS4 0x00147201 ++#endif ++#define MAX_TX_Q_LEN (64) ++#define LOW_TX_Q_LEN (MAX_TX_Q_LEN/2) ++static u16 bits_per_symbol[][2] = { ++ {26, 54}, ++ {52, 108}, ++ {78, 162}, ++ {104, 216}, ++ {156, 324}, ++ {208, 432}, ++ {234, 486}, ++ {260, 540}, ++}; ++ ++#ifdef CONFIG_DEBUG_SKB_TIMESTAMP ++extern struct ssv6xxx_hci_ctrl *ssv_dbg_ctrl_hci; ++extern unsigned int cal_duration_of_ampdu(struct sk_buff *ampdu_skb, int stage); ++#endif ++struct ssv6xxx_calib_table { ++ u16 channel_id; ++ u32 rf_ctrl_N; ++ u32 rf_ctrl_F; ++ u16 rf_precision_default; ++}; ++static void _process_rx_q(struct ssv_softc *sc, struct sk_buff_head *rx_q, ++ spinlock_t * rx_q_lock); ++static u32 _process_tx_done(struct ssv_softc *sc); ++ ++void ssv6xxx_txbuf_free_skb(struct sk_buff *skb, void *args) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)args; ++ if (!skb) ++ return; ++ ieee80211_free_txskb(sc->hw, skb); ++} ++ ++#define ADDRESS_OFFSET 16 ++#define HW_ID_OFFSET 7 ++#define CH0_FULL_MASK CH0_FULL_MSK ++#define MAX_FAIL_COUNT 100 ++#define MAX_RETRY_COUNT 20 ++inline bool ssv6xxx_mcu_input_full(struct ssv_softc *sc) ++{ ++ u32 regval = 0; ++ SMAC_REG_READ(sc->sh, ADR_MCU_STATUS, ®val); ++ return CH0_FULL_MASK & regval; ++} ++ ++u32 ssv6xxx_pbuf_alloc(struct ssv_softc *sc, int size, int type) ++{ ++ u32 regval, pad; ++ int cnt = MAX_RETRY_COUNT; ++ int page_cnt = ++ (size + ((1 << HW_MMU_PAGE_SHIFT) - 1)) >> HW_MMU_PAGE_SHIFT; ++ regval = 0; ++ mutex_lock(&sc->mem_mutex); ++ pad = size % 4; ++ size += pad; ++ do { ++ SMAC_REG_WRITE(sc->sh, ADR_WR_ALC, (size | (type << 16))); ++ SMAC_REG_READ(sc->sh, ADR_WR_ALC, ®val); ++ if (regval == 0) { ++ cnt--; ++ msleep(1); ++ } else ++ break; ++ } while (cnt); ++ if (type == TX_BUF) { ++ sc->sh->tx_page_available -= page_cnt; ++ sc->sh->page_count[PACKET_ADDR_2_ID(regval)] = page_cnt; ++ } ++ mutex_unlock(&sc->mem_mutex); ++ if (regval == 0) ++ dev_err(sc->dev, ++ "Failed to allocate packet buffer of %d bytes in %d type.", ++ size, type); ++ else { ++ dev_dbg(sc->dev, ++ "Allocated %d type packet buffer of size %d (%d) at address %x.\n", ++ type, size, page_cnt, regval); ++ } ++ return regval; ++} ++ ++bool ssv6xxx_pbuf_free(struct ssv_softc *sc, u32 pbuf_addr) ++{ ++ u32 regval = 0; ++ u16 failCount = 0; ++ u8 *p_tx_page_cnt = &sc->sh->page_count[PACKET_ADDR_2_ID(pbuf_addr)]; ++ while (ssv6xxx_mcu_input_full(sc)) { ++ if (failCount++ < 1000) ++ continue; ++ dev_err(sc->dev, "Error in mailbox block after %d iterations\n", failCount); ++ return false; ++ } ++ mutex_lock(&sc->mem_mutex); ++ regval = ++ ((M_ENG_TRASH_CAN << HW_ID_OFFSET) | (pbuf_addr >> ADDRESS_OFFSET)); ++ SMAC_REG_WRITE(sc->sh, ADR_CH0_TRIG_1, regval); ++ if (*p_tx_page_cnt) { ++ sc->sh->tx_page_available += *p_tx_page_cnt; ++ *p_tx_page_cnt = 0; ++ } ++ mutex_unlock(&sc->mem_mutex); ++ return true; ++} ++ ++static const struct ssv6xxx_calib_table vt_tbl[SSV6XXX_IQK_CFG_XTAL_MAX][14] = { ++ { ++ {1, 0xB9, 0x89D89E, 3859}, ++ {2, 0xB9, 0xEC4EC5, 3867}, ++ {3, 0xBA, 0x4EC4EC, 3875}, ++ {4, 0xBA, 0xB13B14, 3883}, ++ {5, 0xBB, 0x13B13B, 3891}, ++ {6, 0xBB, 0x762762, 3899}, ++ {7, 0xBB, 0xD89D8A, 3907}, ++ {8, 0xBC, 0x3B13B1, 3915}, ++ {9, 0xBC, 0x9D89D9, 3923}, ++ {10, 0xBD, 0x000000, 3931}, ++ {11, 0xBD, 0x627627, 3939}, ++ {12, 0xBD, 0xC4EC4F, 3947}, ++ {13, 0xBE, 0x276276, 3955}, ++ {14, 0xBF, 0x13B13B, 3974}, ++ }, ++ { ++ {1, 0xf1, 0x333333, 3859}, ++ {2, 0xf1, 0xB33333, 3867}, ++ {3, 0xf2, 0x333333, 3875}, ++ {4, 0xf2, 0xB33333, 3883}, ++ {5, 0xf3, 0x333333, 3891}, ++ {6, 0xf3, 0xB33333, 3899}, ++ {7, 0xf4, 0x333333, 3907}, ++ {8, 0xf4, 0xB33333, 3915}, ++ {9, 0xf5, 0x333333, 3923}, ++ {10, 0xf5, 0xB33333, 3931}, ++ {11, 0xf6, 0x333333, 3939}, ++ {12, 0xf6, 0xB33333, 3947}, ++ {13, 0xf7, 0x333333, 3955}, ++ {14, 0xf8, 0x666666, 3974}, ++ }, ++ { ++ {1, 0xC9, 0x000000, 3859}, ++ {2, 0xC9, 0x6AAAAB, 3867}, ++ {3, 0xC9, 0xD55555, 3875}, ++ {4, 0xCA, 0x400000, 3883}, ++ {5, 0xCA, 0xAAAAAB, 3891}, ++ {6, 0xCB, 0x155555, 3899}, ++ {7, 0xCB, 0x800000, 3907}, ++ {8, 0xCB, 0xEAAAAB, 3915}, ++ {9, 0xCC, 0x555555, 3923}, ++ {10, 0xCC, 0xC00000, 3931}, ++ {11, 0xCD, 0x2AAAAB, 3939}, ++ {12, 0xCD, 0x955555, 3947}, ++ {13, 0xCE, 0x000000, 3955}, ++ {14, 0xCF, 0x000000, 3974}, ++ } ++}; ++ ++#define FAIL_MAX 100 ++#define RETRY_MAX 20 ++int ssv6xxx_set_channel(struct ssv_softc *sc, int ch) ++{ ++ struct ssv_hw *sh = sc->sh; ++ int retry_cnt, fail_cnt = 0; ++ u32 regval; ++ int ret = -1; ++ int chidx; ++ bool chidx_vld = 0; ++ dev_dbg(sc->dev, "Setting channel to %d\n", ch); ++ if ((sh->cfg.chip_identity == SSV6051Z) ++ || (sc->sh->cfg.chip_identity == SSV6051P)) { ++ if ((ch == 13) || (ch == 14)) { ++ if (sh->ipd_channel_touch == 0) { ++ for (chidx = 0; chidx < sh->ch_cfg_size; ++ chidx++) { ++ SMAC_REG_WRITE(sh, ++ sh->p_ch_cfg[chidx]. ++ reg_addr, ++ sh->p_ch_cfg[chidx]. ++ ch13_14_value); ++ } ++ sh->ipd_channel_touch = 1; ++ } ++ } else { ++ if (sh->ipd_channel_touch) { ++ for (chidx = 0; chidx < sh->ch_cfg_size; ++ chidx++) { ++ SMAC_REG_WRITE(sh, ++ sh->p_ch_cfg[chidx]. ++ reg_addr, ++ sh->p_ch_cfg[chidx]. ++ ch1_12_value); ++ } ++ sh->ipd_channel_touch = 0; ++ } ++ } ++ } ++ for (chidx = 0; chidx < 14; chidx++) { ++ if (vt_tbl[sh->cfg.crystal_type][chidx].channel_id == ch) { ++ chidx_vld = 1; ++ break; ++ } ++ } ++ if (chidx_vld == 0) { ++ dev_dbg(sc->dev, "%s(): fail! channel_id not found in vt_tbl\n", ++ __FUNCTION__); ++ goto exit; ++ } ++ if ((ret = ssv6xxx_rf_disable(sc->sh)) != 0) ++ goto exit; ++ do { ++ if ((sh->cfg.crystal_type == SSV6XXX_IQK_CFG_XTAL_26M) ++ || (sh->cfg.crystal_type == SSV6XXX_IQK_CFG_XTAL_24M)) { ++ if ((ret = ++ SMAC_REG_SET_BITS(sc->sh, ADR_SYN_DIV_SDM_XOSC, ++ (0x00 << 13), ++ (0x01 << 13))) != 0) ++ break; ++ } else if (sh->cfg.crystal_type == SSV6XXX_IQK_CFG_XTAL_40M) { ++ if ((ret = ++ SMAC_REG_SET_BITS(sc->sh, ADR_SYN_DIV_SDM_XOSC, ++ (0x01 << 13), ++ (0x01 << 13))) != 0) ++ break; ++ } else { ++ dev_warn(sc->dev, "Illegal crystal setting in ssv6xxx_set_channel\n"); ++ BUG_ON(1); ++ } ++ if ((ret = SMAC_REG_SET_BITS(sc->sh, ADR_SX_LCK_BIN_REGISTERS_I, ++ (0x01 << 19), (0x01 << 19))) != 0) ++ break; ++ regval = vt_tbl[sh->cfg.crystal_type][chidx].rf_ctrl_F; ++ if ((ret = SMAC_REG_SET_BITS(sc->sh, ADR_SYN_REGISTER_1, ++ (regval << 0), ++ (0x00ffffff << 0))) != 0) ++ break; ++ regval = vt_tbl[sh->cfg.crystal_type][chidx].rf_ctrl_N; ++ if ((ret = SMAC_REG_SET_BITS(sc->sh, ADR_SYN_REGISTER_2, ++ (regval << 0), ++ (0x07ff << 0))) != 0) ++ break; ++ if ((ret = ++ SMAC_REG_READ(sc->sh, ADR_SX_LCK_BIN_REGISTERS_I, ++ ®val)) != 0) ++ break; ++ regval = ++ vt_tbl[sh->cfg.crystal_type][chidx].rf_precision_default; ++ if ((ret = ++ SMAC_REG_SET_BITS(sc->sh, ADR_SX_LCK_BIN_REGISTERS_II, ++ (regval << 0), (0x1fff << 0))) != 0) ++ break; ++ if ((ret = SMAC_REG_SET_BITS(sc->sh, ADR_MANUAL_ENABLE_REGISTER, ++ (0x00 << 14), (0x01 << 14))) != 0) ++ break; ++ if ((ret = SMAC_REG_SET_BITS(sc->sh, ADR_MANUAL_ENABLE_REGISTER, ++ (0x01 << 14), (0x01 << 14))) != 0) ++ break; ++ retry_cnt = 0; ++ do { ++ mdelay(1); ++ if ((ret = ++ SMAC_REG_READ(sc->sh, ADR_READ_ONLY_FLAGS_1, ++ ®val)) != 0) ++ break; ++ if (regval & 0x00000002) { ++ if ((ret = ++ SMAC_REG_READ(sc->sh, ++ ADR_READ_ONLY_FLAGS_2, ++ ®val)) != 0) ++ break; ++ ret = ssv6xxx_rf_enable(sc->sh); ++ //dev_info(sc->dev, "Lock to channel %d ([0xce010098]=%x)!!\n", vt_tbl[sh->cfg.crystal_type][chidx].channel_id, regval); ++ sc->hw_chan = ch; ++ goto exit; ++ } ++ retry_cnt++; ++ } ++ while (retry_cnt < RETRY_MAX); ++ fail_cnt++; ++ dev_warn(sc->dev, "calibation fail after %d iterations\n", fail_cnt); ++ } ++ while ((fail_cnt < FAIL_MAX) && (ret == 0)); ++ exit: ++ if (ch == 14 && regval == 0xff0) { ++ SMAC_IFC_RESET(sc->sh); ++ ssv6xxx_restart_hw(sc); ++ } ++ if (ch <= 7) { ++ if (sh->cfg.tx_power_index_1) { ++ SMAC_REG_READ(sc->sh, ADR_RX_TX_FSM_REGISTER, ®val); ++ regval &= RG_TX_GAIN_OFFSET_I_MSK; ++ regval |= ++ (sh->cfg.tx_power_index_1 << RG_TX_GAIN_OFFSET_SFT); ++ SMAC_REG_WRITE(sc->sh, ADR_RX_TX_FSM_REGISTER, regval); ++ } else if (sh->cfg.tx_power_index_2) { ++ SMAC_REG_READ(sc->sh, ADR_RX_TX_FSM_REGISTER, ®val); ++ regval &= RG_TX_GAIN_OFFSET_I_MSK; ++ SMAC_REG_WRITE(sc->sh, ADR_RX_TX_FSM_REGISTER, regval); ++ } ++ } else { ++ if (sh->cfg.tx_power_index_2) { ++ SMAC_REG_READ(sc->sh, ADR_RX_TX_FSM_REGISTER, ®val); ++ regval &= RG_TX_GAIN_OFFSET_I_MSK; ++ regval |= ++ (sh->cfg.tx_power_index_2 << RG_TX_GAIN_OFFSET_SFT); ++ SMAC_REG_WRITE(sc->sh, ADR_RX_TX_FSM_REGISTER, regval); ++ } else if (sh->cfg.tx_power_index_1) { ++ SMAC_REG_READ(sc->sh, ADR_RX_TX_FSM_REGISTER, ®val); ++ regval &= RG_TX_GAIN_OFFSET_I_MSK; ++ SMAC_REG_WRITE(sc->sh, ADR_RX_TX_FSM_REGISTER, regval); ++ } ++ } ++ return ret; ++} ++ ++#ifdef CONFIG_SSV_SMARTLINK ++int ssv6xxx_get_channel(struct ssv_softc *sc, int *pch) ++{ ++ *pch = sc->hw_chan; ++ return 0; ++} ++ ++int ssv6xxx_set_promisc(struct ssv_softc *sc, int accept) ++{ ++ u32 val = 0; ++ if (accept) { ++ val = 0x2; ++ } else { ++ val = 0x3; ++ } ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_TB13, val); ++ return 0; ++} ++ ++int ssv6xxx_get_promisc(struct ssv_softc *sc, int *paccept) ++{ ++ u32 val = 0; ++ SMAC_REG_READ(sc->sh, ADR_MRX_FLT_TB13, &val); ++ if (val == 0x2) { ++ *paccept = 1; ++ } else { ++ *paccept = 0; ++ } ++ return 0; ++} ++#endif ++int ssv6xxx_rf_enable(struct ssv_hw *sh) ++{ ++ return SMAC_REG_SET_BITS(sh, 0xce010000, (0x02 << 12), (0x03 << 12) ++ ); ++} ++ ++int ssv6xxx_rf_disable(struct ssv_hw *sh) ++{ ++ return SMAC_REG_SET_BITS(sh, 0xce010000, (0x01 << 12), (0x03 << 12) ++ ); ++} ++ ++int ssv6xxx_update_decision_table(struct ssv_softc *sc) ++{ ++ int i; ++ for (i = 0; i < MAC_DECITBL1_SIZE; i++) { ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_TB0 + i * 4, ++ sc->mac_deci_tbl[i]); ++ SMAC_REG_CONFIRM(sc->sh, ADR_MRX_FLT_TB0 + i * 4, ++ sc->mac_deci_tbl[i]); ++ } ++ for (i = 0; i < MAC_DECITBL2_SIZE; i++) { ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_EN0 + i * 4, ++ sc->mac_deci_tbl[i + MAC_DECITBL1_SIZE]); ++ SMAC_REG_CONFIRM(sc->sh, ADR_MRX_FLT_EN0 + i * 4, ++ sc->mac_deci_tbl[i + MAC_DECITBL1_SIZE]); ++ } ++ return 0; ++} ++ ++static int ssv6xxx_frame_hdrlen(struct ieee80211_hdr *hdr, bool is_ht) ++{ ++#define CTRL_FRAME_INDEX(fc) ((hdr->frame_control-IEEE80211_STYPE_BACK_REQ)>>4) ++ u16 fc, CTRL_FLEN[] = { 16, 16, 16, 16, 10, 10, 16, 16 }; ++ int hdr_len = 24; ++ fc = hdr->frame_control; ++ if (ieee80211_is_ctl(fc)) ++ hdr_len = CTRL_FLEN[CTRL_FRAME_INDEX(fc)]; ++ else if (ieee80211_is_mgmt(fc)) { ++ if (ieee80211_has_order(fc)) ++ hdr_len += ((is_ht == 1) ? 4 : 0); ++ } else { ++ if (ieee80211_has_a4(fc)) ++ hdr_len += 6; ++ if (ieee80211_is_data_qos(fc)) { ++ hdr_len += 2; ++ if (ieee80211_has_order(hdr->frame_control) && ++ is_ht == true) ++ hdr_len += 4; ++ } ++ } ++ return hdr_len; ++} ++ ++static u32 ssv6xxx_ht_txtime(u8 rix, int pktlen, int width, ++ int half_gi, bool is_gf) ++{ ++ u32 nbits, nsymbits, duration, nsymbols; ++ int streams; ++ streams = 1; ++ nbits = (pktlen << 3) + OFDM_PLCP_BITS; ++ nsymbits = bits_per_symbol[rix % 8][width] * streams; ++ nsymbols = (nbits + nsymbits - 1) / nsymbits; ++ if (!half_gi) ++ duration = SYMBOL_TIME(nsymbols); ++ else { ++ if (!is_gf) ++ duration = ++ DIV_ROUND_UP(SYMBOL_TIME_HALFGI(nsymbols), 4) << 2; ++ else ++ duration = SYMBOL_TIME_HALFGI(nsymbols); ++ } ++ duration += ++ L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams) + ++ HT_SIGNAL_EXT; ++ if (is_gf) ++ duration -= 12; ++ duration += HT_SIFS_TIME; ++ return duration; ++} ++ ++static u32 ssv6xxx_non_ht_txtime(u8 phy, int kbps, ++ u32 frameLen, bool shortPreamble) ++{ ++ u32 bits_per_symbol, num_bits, num_symbols; ++ u32 phy_time, tx_time; ++ if (kbps == 0) ++ return 0; ++ switch (phy) { ++ case WLAN_RC_PHY_CCK: ++ phy_time = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; ++ if (shortPreamble) ++ phy_time >>= 1; ++ num_bits = frameLen << 3; ++ tx_time = CCK_SIFS_TIME + phy_time + ((num_bits * 1000) / kbps); ++ break; ++ case WLAN_RC_PHY_OFDM: ++ bits_per_symbol = (kbps * OFDM_SYMBOL_TIME) / 1000; ++ num_bits = OFDM_PLCP_BITS + (frameLen << 3); ++ num_symbols = DIV_ROUND_UP(num_bits, bits_per_symbol); ++ tx_time = OFDM_SIFS_TIME + OFDM_PREAMBLE_TIME ++ + (num_symbols * OFDM_SYMBOL_TIME); ++ break; ++ default: ++ pr_err("ssv6051: unknown phy %u\n", phy); ++ BUG_ON(1); ++ tx_time = 0; ++ break; ++ } ++ return tx_time; ++} ++ ++static u32 ssv6xxx_set_frame_duration(struct ieee80211_tx_info *info, ++ struct ssv_rate_info *ssv_rate, u16 len, ++ struct ssv6200_tx_desc *tx_desc, ++ struct fw_rc_retry_params *rc_params, ++ struct ssv_softc *sc) ++{ ++ struct ieee80211_tx_rate *tx_drate; ++ u32 frame_time = 0, ack_time = 0, rts_cts_nav = 0, frame_consume_time = ++ 0; ++ u32 l_length = 0, drate_kbps = 0, crate_kbps = 0; ++ bool ctrl_short_preamble = false, is_sgi, is_ht40; ++ bool is_ht, is_gf; ++ int d_phy, c_phy, nRCParams, mcsidx; ++ struct ssv_rate_ctrl *ssv_rc = NULL; ++ tx_drate = &info->control.rates[0]; ++ is_sgi = !!(tx_drate->flags & IEEE80211_TX_RC_SHORT_GI); ++ is_ht40 = !!(tx_drate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH); ++ is_ht = !!(tx_drate->flags & IEEE80211_TX_RC_MCS); ++ is_gf = !!(tx_drate->flags & IEEE80211_TX_RC_GREEN_FIELD); ++ if ((info->control.short_preamble) || ++ (tx_drate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) ++ ctrl_short_preamble = true; ++ pr_debug("mcs = %d, data rate idx=%d\n", tx_drate->idx, tx_drate[3].count); ++ for (nRCParams = 0; (nRCParams < SSV62XX_TX_MAX_RATES); nRCParams++) { ++ if ((rc_params == NULL) || (sc == NULL)) { ++ mcsidx = tx_drate->idx; ++ drate_kbps = ssv_rate->drate_kbps; ++ crate_kbps = ssv_rate->crate_kbps; ++ } else { ++ if (rc_params[nRCParams].count == 0) { ++ break; ++ } ++ ssv_rc = sc->rc; ++ mcsidx = ++ (rc_params[nRCParams].drate - ++ SSV62XX_RATE_MCS_INDEX) % MCS_GROUP_RATES; ++ drate_kbps = ++ ssv_rc->rc_table[rc_params[nRCParams].drate]. ++ rate_kbps; ++ crate_kbps = ++ ssv_rc->rc_table[rc_params[nRCParams].crate]. ++ rate_kbps; ++ } ++ if (tx_drate->flags & IEEE80211_TX_RC_MCS) { ++ frame_time = ssv6xxx_ht_txtime(mcsidx, ++ len, is_ht40, is_sgi, ++ is_gf); ++ d_phy = 0; ++ } else { ++ if ((info->band == INDEX_80211_BAND_2GHZ) && ++ !(ssv_rate->d_flags & IEEE80211_RATE_ERP_G)) ++ d_phy = WLAN_RC_PHY_CCK; ++ else ++ d_phy = WLAN_RC_PHY_OFDM; ++ frame_time = ssv6xxx_non_ht_txtime(d_phy, drate_kbps, ++ len, ++ ctrl_short_preamble); ++ } ++ if ((info->band == INDEX_80211_BAND_2GHZ) && ++ !(ssv_rate->c_flags & IEEE80211_RATE_ERP_G)) ++ c_phy = WLAN_RC_PHY_CCK; ++ else ++ c_phy = WLAN_RC_PHY_OFDM; ++ if (tx_desc->unicast) { ++ if (info->flags & IEEE80211_TX_CTL_AMPDU) { ++ ack_time = ssv6xxx_non_ht_txtime(c_phy, ++ crate_kbps, ++ BA_LEN, ++ ctrl_short_preamble); ++ } else { ++ ack_time = ssv6xxx_non_ht_txtime(c_phy, ++ crate_kbps, ++ ACK_LEN, ++ ctrl_short_preamble); ++ } ++ } ++ if (tx_desc->do_rts_cts & IEEE80211_TX_RC_USE_RTS_CTS) { ++ rts_cts_nav = frame_time; ++ rts_cts_nav += ack_time; ++ rts_cts_nav += ssv6xxx_non_ht_txtime(c_phy, ++ crate_kbps, ++ CTS_LEN, ++ ctrl_short_preamble); ++ frame_consume_time = rts_cts_nav; ++ frame_consume_time += ssv6xxx_non_ht_txtime(c_phy, ++ crate_kbps, ++ RTS_LEN, ++ ctrl_short_preamble); ++ } else if (tx_desc-> ++ do_rts_cts & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ rts_cts_nav = frame_time; ++ rts_cts_nav += ack_time; ++ frame_consume_time = rts_cts_nav; ++ frame_consume_time += ssv6xxx_non_ht_txtime(c_phy, ++ crate_kbps, ++ CTS_LEN, ++ ctrl_short_preamble); ++ } else {; ++ } ++ if (tx_drate->flags & IEEE80211_TX_RC_MCS) { ++ l_length = frame_time - HT_SIFS_TIME; ++ l_length = ((l_length - (HT_SIGNAL_EXT + 20)) + 3) >> 2; ++ l_length += ((l_length << 1) - 3); ++ } ++ if ((rc_params == NULL) || (sc == NULL)) { ++ tx_desc->rts_cts_nav = rts_cts_nav; ++ tx_desc->frame_consume_time = ++ (frame_consume_time >> 5) + 1;; ++ tx_desc->dl_length = l_length; ++ break; ++ } else { ++ rc_params[nRCParams].rts_cts_nav = rts_cts_nav; ++ rc_params[nRCParams].frame_consume_time = ++ (frame_consume_time >> 5) + 1; ++ rc_params[nRCParams].dl_length = l_length; ++ if (nRCParams == 0) { ++ tx_desc->drate_idx = rc_params[nRCParams].drate; ++ tx_desc->crate_idx = rc_params[nRCParams].crate; ++ tx_desc->rts_cts_nav = ++ rc_params[nRCParams].rts_cts_nav; ++ tx_desc->frame_consume_time = ++ rc_params[nRCParams].frame_consume_time; ++ tx_desc->dl_length = ++ rc_params[nRCParams].dl_length; ++ } ++ } ++ } ++ return ack_time; ++} ++ ++static void ssv6200_hw_set_pair_type(struct ssv_hw *sh, u8 type) ++{ ++ u32 temp; ++ SMAC_REG_READ(sh, ADR_SCRT_SET, &temp); ++ temp = (temp & PAIR_SCRT_I_MSK); ++ temp |= (type << PAIR_SCRT_SFT); ++ SMAC_REG_WRITE(sh, ADR_SCRT_SET, temp); ++ dev_dbg(sh->sc->dev, "==>%s: write cipher type %d into hw\n", __func__, type); ++} ++ ++static u32 ssv6200_hw_get_pair_type(struct ssv_hw *sh) ++{ ++ u32 temp; ++ SMAC_REG_READ(sh, ADR_SCRT_SET, &temp); ++ temp &= PAIR_SCRT_MSK; ++ temp = (temp >> PAIR_SCRT_SFT); ++ SMAC_REG_WRITE(sh, ADR_SCRT_SET, temp); ++ dev_dbg(sh->sc->dev, "==>%s: read cipher type %d from hw\n", __func__, temp); ++ return temp; ++} ++ ++static void ssv6200_hw_set_group_type(struct ssv_hw *sh, u8 type) ++{ ++ u32 temp; ++ SMAC_REG_READ(sh, ADR_SCRT_SET, &temp); ++ temp = temp & GRP_SCRT_I_MSK; ++ temp |= (type << GRP_SCRT_SFT); ++ SMAC_REG_WRITE(sh, ADR_SCRT_SET, temp); ++ dev_dbg(sh->sc->dev, "Set group key type %d\n", type); ++} ++ ++void ssv6xxx_reset_sec_module(struct ssv_softc *sc) ++{ ++ ssv6200_hw_set_group_type(sc->sh, ME_NONE); ++ ssv6200_hw_set_pair_type(sc->sh, ME_NONE); ++} ++ ++static int hw_update_watch_wsid(struct ssv_softc *sc, struct ieee80211_sta *sta, ++ struct ssv_sta_info *sta_info, int sta_idx, ++ int rx_hw_sec, int ops) ++{ ++ int ret = 0; ++ int retry_cnt = 20; ++ struct sk_buff *skb = NULL; ++ struct cfg_host_cmd *host_cmd; ++ struct ssv6xxx_wsid_params *ptr; ++ dev_dbg(sc->dev, "cmd=%d for fw wsid list, wsid %d \n", ops, sta_idx); ++ skb = ++ ssv_skb_alloc(HOST_CMD_HDR_LEN + ++ sizeof(struct ssv6xxx_wsid_params)); ++ if (skb == NULL || sta_info == NULL || sc == NULL) ++ return -1; ++ skb->data_len = HOST_CMD_HDR_LEN + sizeof(struct ssv6xxx_wsid_params); ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_WSID_OP; ++ host_cmd->len = skb->data_len; ++ ptr = (struct ssv6xxx_wsid_params *)host_cmd->dat8; ++ ptr->cmd = ops; ++ ptr->hw_security = rx_hw_sec; ++ if ((ptr->cmd != SSV6XXX_WSID_OPS_HWWSID_PAIRWISE_SET_TYPE) ++ && (ptr->cmd != SSV6XXX_WSID_OPS_HWWSID_GROUP_SET_TYPE)) { ++ ptr->wsid_idx = (u8) (sta_idx - SSV_NUM_HW_STA); ++ } else { ++ ptr->wsid_idx = (u8) (sta_idx); ++ }; ++ memcpy(&ptr->target_wsid, &sta->addr[0], 6); ++ while (((sc->sh->hci.hci_ops->hci_send_cmd(skb)) != 0) && (retry_cnt)) { ++ dev_dbg(sc->dev, "WSID cmd=%d retry=%d!!\n", ops, retry_cnt); ++ retry_cnt--; ++ } ++ dev_dbg(sc->dev, "%s: wsid_idx = %u\n", __FUNCTION__, ptr->wsid_idx); ++ ssv_skb_free(skb); ++ if (ops == SSV6XXX_WSID_OPS_ADD) ++ sta_info->hw_wsid = sta_idx; ++ return ret; ++} ++ ++static void hw_crypto_key_clear(struct ieee80211_hw *hw, int index, ++ struct ieee80211_key_conf *key, ++ struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_info *sta_info = NULL; ++ if ((index == 0) && (sta_priv == NULL)) ++ return; ++ if ((index < 0) || (index >= 4)) ++ return; ++ if (index > 0) { ++ if (vif_priv) ++ vif_priv->group_key_idx = 0; ++ if (sta_priv) ++ sta_priv->group_key_idx = 0; ++ } ++ if (sta_priv) { ++ sta_info = &sc->sta_info[sta_priv->sta_idx]; ++ if ((index == 0) && (sta_priv->has_hw_decrypt == true) ++ && (sta_info->hw_wsid >= SSV_NUM_HW_STA)) { ++ hw_update_watch_wsid(sc, sta_info->sta, sta_info, ++ sta_priv->sta_idx, ++ SSV6XXX_WSID_SEC_PAIRWISE, ++ SSV6XXX_WSID_OPS_DISABLE_CAPS); ++ } ++ } ++ if (vif_priv) { ++ if ((index != 0) && !list_empty(&vif_priv->sta_list)) { ++ struct ssv_sta_priv_data *sta_priv_iter; ++ list_for_each_entry(sta_priv_iter, &vif_priv->sta_list, ++ list) { ++ if (((sta_priv_iter->sta_info-> ++ s_flags & STA_FLAG_VALID) == 0) ++ || (sta_priv_iter->sta_info->hw_wsid < ++ SSV_NUM_HW_STA)) ++ continue; ++ hw_update_watch_wsid(sc, ++ sta_priv_iter->sta_info-> ++ sta, ++ sta_priv_iter->sta_info, ++ sta_priv_iter->sta_idx, ++ SSV6XXX_WSID_SEC_GROUP, ++ SSV6XXX_WSID_OPS_DISABLE_CAPS); ++ } ++ } ++ } ++} ++ ++static void _set_wep_sw_crypto_key(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ struct ssv_sta_info *sta_info, void *param) ++{ ++ struct ssv_sta_priv_data *sta_priv = ++ (struct ssv_sta_priv_data *)sta_info->sta->drv_priv; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif_info->vif->drv_priv; ++ sta_priv->has_hw_encrypt = vif_priv->has_hw_encrypt; ++ sta_priv->has_hw_decrypt = vif_priv->has_hw_decrypt; ++ sta_priv->need_sw_encrypt = vif_priv->need_sw_encrypt; ++ sta_priv->need_sw_decrypt = vif_priv->need_sw_decrypt; ++} ++ ++static void _set_wep_hw_crypto_pair_key(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ struct ssv_sta_info *sta_info, ++ void *param) ++{ ++ int wsid = sta_info->hw_wsid; ++ struct ssv6xxx_hw_sec *sram_key = (struct ssv6xxx_hw_sec *)param; ++ int address = 0; ++ int *pointer = NULL; ++ u32 sec_key_tbl_base = sc->sh->hw_sec_key[0]; ++ u32 sec_key_tbl = sec_key_tbl_base; ++ int i; ++ u8 *key = sram_key->sta_key[0].pair.key; ++ u32 key_len = *(u16 *) & sram_key->sta_key[0].reserve[0]; ++ struct ssv_sta_priv_data *sta_priv = ++ (struct ssv_sta_priv_data *)sta_info->sta->drv_priv; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif_info->vif->drv_priv; ++ if (wsid == (-1)) ++ return; ++ sram_key->sta_key[wsid].pair_key_idx = 0; ++ sram_key->sta_key[wsid].group_key_idx = 0; ++ sta_priv->has_hw_encrypt = vif_priv->has_hw_encrypt; ++ sta_priv->has_hw_decrypt = vif_priv->has_hw_decrypt; ++ sta_priv->need_sw_encrypt = vif_priv->need_sw_encrypt; ++ sta_priv->need_sw_decrypt = vif_priv->need_sw_decrypt; ++ if (wsid != 0) ++ memcpy(sram_key->sta_key[wsid].pair.key, key, key_len); ++ address = sec_key_tbl + (3 * sizeof(struct ssv6xxx_hw_key)) ++ + wsid * sizeof(struct ssv6xxx_hw_sta_key); ++ address += (0x10000 * wsid); ++ pointer = (int *)&sram_key->sta_key[wsid]; ++ for (i = 0; i < (sizeof(struct ssv6xxx_hw_sta_key) / 4); i++) ++ SMAC_REG_WRITE(sc->sh, address + (i * 4), *(pointer++)); ++} ++ ++static void _set_wep_hw_crypto_group_key(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ struct ssv_sta_info *sta_info, ++ void *param) ++{ ++ int wsid = sta_info->hw_wsid; ++ struct ssv6xxx_hw_sec *sram_key = (struct ssv6xxx_hw_sec *)param; ++ int address = 0; ++ int *pointer = NULL; ++ u32 key_idx = sram_key->sta_key[0].pair_key_idx; ++ u32 sec_key_tbl_base = sc->sh->hw_sec_key[0]; ++ u32 key_len = *(u16 *) & sram_key->sta_key[0].reserve[0]; ++ u8 *key = sram_key->group_key[key_idx - 1].key; ++ u32 sec_key_tbl = sec_key_tbl_base; ++ struct ssv_sta_priv_data *sta_priv = ++ (struct ssv_sta_priv_data *)sta_info->sta->drv_priv; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif_info->vif->drv_priv; ++ if (wsid == (-1)) ++ return; ++ if (wsid != 0) { ++ sram_key->sta_key[wsid].pair_key_idx = key_idx; ++ sram_key->sta_key[wsid].group_key_idx = key_idx; ++ sta_priv->has_hw_encrypt = vif_priv->has_hw_encrypt; ++ sta_priv->has_hw_decrypt = vif_priv->has_hw_decrypt; ++ sta_priv->need_sw_encrypt = vif_priv->need_sw_encrypt; ++ sta_priv->need_sw_decrypt = vif_priv->need_sw_decrypt; ++ } ++ if (wsid != 0) ++ memcpy(sram_key->group_key[key_idx - 1].key, key, key_len); ++ sec_key_tbl += (0x10000 * wsid); ++ address = sec_key_tbl + ((key_idx - 1) * sizeof(struct ssv6xxx_hw_key)); ++ pointer = (int *)&sram_key->group_key[key_idx - 1]; ++ { ++ int i; ++ for (i = 0; i < (sizeof(struct ssv6xxx_hw_key) / 4); i++) ++ SMAC_REG_WRITE(sc->sh, address + (i * 4), *(pointer++)); ++ } ++ address = sec_key_tbl + (3 * sizeof(struct ssv6xxx_hw_key)) ++ + (wsid * sizeof(struct ssv6xxx_hw_sta_key)); ++ pointer = (int *)&sram_key->sta_key[wsid]; ++ SMAC_REG_WRITE(sc->sh, address, *(pointer)); ++} ++ ++static int hw_crypto_key_write_wep(struct ieee80211_hw *hw, ++ struct ieee80211_key_conf *key, ++ u8 algorithm, struct ssv_vif_info *vif_info) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv6xxx_hw_sec *sramKey = &vif_info->sramKey; ++ if (key->keyidx == 0) { ++ ssv6xxx_foreach_vif_sta(sc, vif_info, ++ _set_wep_hw_crypto_pair_key, sramKey); ++ } else { ++ ssv6xxx_foreach_vif_sta(sc, vif_info, ++ _set_wep_hw_crypto_group_key, sramKey); ++ } ++ return 0; ++} ++ ++static void _set_aes_tkip_hw_crypto_group_key(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ struct ssv_sta_info *sta_info, ++ void *param) ++{ ++ int wsid = sta_info->hw_wsid; ++ int j; ++ u32 sec_key_tbl_base = sc->sh->hw_sec_key[0]; ++ u32 sec_key_tbl = sec_key_tbl_base; ++ int address = 0; ++ int *pointer = 0; ++ struct ssv6xxx_hw_sec *sramKey = &(vif_info->sramKey); ++ int index = *(u8 *) param; ++ if (wsid == (-1)) ++ return; ++ BUG_ON(index == 0); ++ sramKey->sta_key[wsid].group_key_idx = index; ++ sec_key_tbl += (0x10000 * wsid); ++ address = sec_key_tbl + ((index - 1) * sizeof(struct ssv6xxx_hw_key)); ++ if (vif_info->vif_priv != NULL) ++ dev_dbg(sc->dev, "Write group key %d to VIF %d to %08X\n", ++ index, vif_info->vif_priv->vif_idx, address); ++ else ++ dev_err(sc->dev, "NULL VIF.\n"); ++ pointer = (int *)&sramKey->group_key[index - 1]; ++ for (j = 0; j < (sizeof(struct ssv6xxx_hw_key) / 4); j++) ++ SMAC_REG_WRITE(sc->sh, address + (j * 4), *(pointer++)); ++ address = sec_key_tbl + (3 * sizeof(struct ssv6xxx_hw_key)) ++ + (wsid * sizeof(struct ssv6xxx_hw_sta_key)); ++ pointer = (int *)&sramKey->sta_key[wsid]; ++ SMAC_REG_WRITE(sc->sh, address, *(pointer)); ++ if (wsid >= SSV_NUM_HW_STA) { ++ hw_update_watch_wsid(sc, sta_info->sta, sta_info, ++ wsid, SSV6XXX_WSID_SEC_GROUP, ++ SSV6XXX_WSID_OPS_ENABLE_CAPS); ++ } ++} ++ ++static int _write_pairwise_key_to_hw(struct ssv_softc *sc, ++ int index, u8 algorithm, ++ const u8 * key, int key_len, ++ struct ieee80211_key_conf *keyconf, ++ struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv) ++{ ++ int i; ++ struct ssv6xxx_hw_sec *sramKey; ++ int address = 0; ++ int *pointer = NULL; ++ u32 sec_key_tbl_base = sc->sh->hw_sec_key[0]; ++ u32 sec_key_tbl; ++ int wsid = (-1); ++ if (sta_priv == NULL) { ++ dev_err(sc->dev, "Set pair-wise key with NULL STA.\n"); ++ return -EOPNOTSUPP; ++ } ++ wsid = sta_priv->sta_info->hw_wsid; ++ if ((wsid < 0) || (wsid >= SSV_NUM_STA)) { ++ dev_err(sc->dev, "Set pair-wise key to invalid WSID %d.\n", ++ wsid); ++ return -EOPNOTSUPP; ++ } ++ dev_dbg(sc->dev, "Set STA %d's pair-wise key of %d bytes.\n", wsid, ++ key_len); ++ sramKey = &(sc->vif_info[vif_priv->vif_idx].sramKey); ++ sramKey->sta_key[wsid].pair_key_idx = 0; ++ sramKey->sta_key[wsid].group_key_idx = vif_priv->group_key_idx; ++ memcpy(sramKey->sta_key[wsid].pair.key, key, key_len); ++ sec_key_tbl = sec_key_tbl_base; ++ sec_key_tbl += (0x10000 * wsid); ++ address = sec_key_tbl + (3 * sizeof(struct ssv6xxx_hw_key)) ++ + wsid * sizeof(struct ssv6xxx_hw_sta_key); ++ pointer = (int *)&sramKey->sta_key[wsid]; ++ for (i = 0; i < (sizeof(struct ssv6xxx_hw_sta_key) / 4); i++) ++ SMAC_REG_WRITE(sc->sh, (address + (i * 4)), *(pointer++)); ++ if (wsid >= SSV_NUM_HW_STA) { ++ hw_update_watch_wsid(sc, sta_priv->sta_info->sta, ++ sta_priv->sta_info, sta_priv->sta_idx, ++ SSV6XXX_WSID_SEC_PAIRWISE, ++ SSV6XXX_WSID_OPS_ENABLE_CAPS); ++ } ++ return 0; ++} ++ ++static int _write_group_key_to_hw(struct ssv_softc *sc, ++ int index, u8 algorithm, ++ const u8 * key, int key_len, ++ struct ieee80211_key_conf *keyconf, ++ struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv) ++{ ++ struct ssv6xxx_hw_sec *sramKey; ++ int wsid = sta_priv ? sta_priv->sta_info->hw_wsid : (-1); ++ int ret = 0; ++ if (vif_priv == NULL) { ++ dev_err(sc->dev, "Setting group key to NULL VIF\n"); ++ return -EOPNOTSUPP; ++ } ++ dev_dbg(sc->dev, ++ "Setting VIF %d group key %d of length %d to WSID %d.\n", ++ vif_priv->vif_idx, index, key_len, wsid); ++ sramKey = &(sc->vif_info[vif_priv->vif_idx].sramKey); ++ vif_priv->group_key_idx = index; ++ if (sta_priv) ++ sta_priv->group_key_idx = index; ++ memcpy(sramKey->group_key[index - 1].key, key, key_len); ++ WARN_ON(sc->vif_info[vif_priv->vif_idx].vif_priv == NULL); ++ ssv6xxx_foreach_vif_sta(sc, &sc->vif_info[vif_priv->vif_idx], ++ _set_aes_tkip_hw_crypto_group_key, &index); ++ ret = 0; ++ return ret; ++} ++ ++static enum SSV_CIPHER_E _prepare_key(struct ieee80211_key_conf *key) ++{ ++ enum SSV_CIPHER_E cipher; ++ switch (key->cipher) { ++ case WLAN_CIPHER_SUITE_WEP40: ++ cipher = SSV_CIPHER_WEP40; ++ break; ++ case WLAN_CIPHER_SUITE_WEP104: ++ cipher = SSV_CIPHER_WEP104; ++ break; ++ case WLAN_CIPHER_SUITE_TKIP: ++ key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; ++ cipher = SSV_CIPHER_TKIP; ++ break; ++ case WLAN_CIPHER_SUITE_CCMP: ++ key->flags |= ++ (IEEE80211_KEY_FLAG_SW_MGMT_TX | ++ IEEE80211_KEY_FLAG_RX_MGMT); ++ cipher = SSV_CIPHER_CCMP; ++ break; ++ default: ++ cipher = SSV_CIPHER_INVALID; ++ break; ++ } ++ return cipher; ++} ++int _set_key_wep(struct ssv_softc *sc, struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv, enum SSV_CIPHER_E cipher, ++ struct ieee80211_key_conf *key) ++{ ++ int ret = 0; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ struct ssv6xxx_hw_sec *sram_key = &vif_info->sramKey; ++ sram_key->sta_key[0].pair_key_idx = key->keyidx; ++ sram_key->sta_key[0].group_key_idx = key->keyidx; ++ *(u16 *) & sram_key->sta_key[0].reserve[0] = key->keylen; ++ dev_dbg(sc->dev, "Set WEP %02X %02X %02X %02X %02X %02X %02X %02X... (%d %d)\n", ++ key->key[0], key->key[1], key->key[2], key->key[3], key->key[4], ++ key->key[5], key->key[6], key->key[7], key->keyidx, key->keylen); ++ if (key->keyidx == 0) { ++ memcpy(sram_key->sta_key[0].pair.key, key->key, key->keylen); ++ } else { ++ memcpy(sram_key->group_key[key->keyidx - 1].key, key->key, ++ key->keylen); ++ } ++ if (sc->sh->cfg.use_wpa2_only) { ++ dev_warn(sc->dev, "WEP: use WPA2 HW security mode only.\n"); ++ } ++ if ((sc->sh->cfg.use_wpa2_only == 0) ++ && vif_priv->vif_idx == 0) { ++ vif_priv->has_hw_decrypt = true; ++ vif_priv->has_hw_encrypt = true; ++ vif_priv->need_sw_decrypt = false; ++ vif_priv->need_sw_encrypt = false; ++ vif_priv->use_mac80211_decrypt = false; ++ ssv6200_hw_set_pair_type(sc->sh, cipher); ++ ssv6200_hw_set_group_type(sc->sh, cipher); ++ hw_crypto_key_write_wep(sc->hw, key, cipher, ++ &sc->vif_info[vif_priv->vif_idx]); ++ } else { ++ vif_priv->has_hw_decrypt = false; ++ vif_priv->has_hw_encrypt = false; ++ vif_priv->need_sw_decrypt = false; ++ vif_priv->need_sw_encrypt = false; ++ vif_priv->use_mac80211_decrypt = true; ++ ssv6xxx_foreach_vif_sta(sc, vif_info, _set_wep_sw_crypto_key, ++ NULL); ++ ret = -EOPNOTSUPP; ++ } ++ vif_priv->pair_cipher = vif_priv->group_cipher = cipher; ++ vif_priv->is_security_valid = true; ++ return ret; ++} ++ ++static int _set_pairwise_key_tkip_ccmp(struct ssv_softc *sc, ++ struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv, ++ enum SSV_CIPHER_E cipher, ++ struct ieee80211_key_conf *key) ++{ ++ int ret = 0; ++ const char *cipher_name = (cipher == SSV_CIPHER_CCMP) ? "CCMP" : "TKIP"; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ bool tdls_link = false, tdls_use_sw_cipher = false, tkip_use_sw_cipher = ++ false; ++ bool use_non_ccmp = false; ++ int another_vif_idx = ((vif_priv->vif_idx + 1) % 2); ++ struct ssv_vif_priv_data *another_vif_priv = ++ (struct ssv_vif_priv_data *)sc->vif_info[another_vif_idx].vif_priv; ++ if (sta_priv == NULL) { ++ dev_err(sc->dev, ++ "Setting pairwise TKIP/CCMP key to NULL STA.\n"); ++ return -EOPNOTSUPP; ++ } ++ if (sc->sh->cfg.use_wpa2_only) { ++ dev_warn(sc->dev, "Pairwise TKIP/CCMP: use WPA2 HW security mode only.\n"); ++ } ++ if (vif_info->if_type == NL80211_IFTYPE_STATION) { ++ struct ssv_sta_priv_data *first_sta_priv = ++ list_first_entry(&vif_priv->sta_list, ++ struct ssv_sta_priv_data, list); ++ if (first_sta_priv->sta_idx != sta_priv->sta_idx) { ++ tdls_link = true; ++ } ++ dev_dbg(sc->dev, "first sta idx %d, current sta idx %d\n", ++ first_sta_priv->sta_idx, sta_priv->sta_idx); ++ } ++ if ((tdls_link) && (vif_priv->pair_cipher != SSV_CIPHER_CCMP) ++ && (sc->sh->cfg.use_wpa2_only == false)) { ++ tdls_use_sw_cipher = true; ++ } ++ if (another_vif_priv != NULL) { ++ if ((another_vif_priv->pair_cipher != SSV_CIPHER_CCMP) ++ && (another_vif_priv->pair_cipher != SSV_CIPHER_NONE)) { ++ use_non_ccmp = true; ++ dev_dbg(sc->dev, "another vif use none ccmp\n"); ++ } ++ } ++ if ((((tdls_link) && (vif_priv->pair_cipher != SSV_CIPHER_CCMP)) ++ || (use_non_ccmp)) ++ && (sc->sh->cfg.use_wpa2_only == 1) && (cipher == SSV_CIPHER_CCMP)) { ++ u32 val; ++ SMAC_REG_READ(sc->sh, ADR_RX_FLOW_DATA, &val); ++ if (((val >> 4) & 0xF) != M_ENG_CPU) { ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_DATA, ++ ((val & 0xf) | (M_ENG_CPU << 4) ++ | (val & 0xfffffff0) << 4)); ++ dev_dbg(sc->dev, ++ "orginal Rx_Flow %x , modified flow %x \n", val, ++ ((val & 0xf) | (M_ENG_CPU << 4) | ++ (val & 0xfffffff0) << 4)); ++ } ++ } ++ if ((cipher == SSV_CIPHER_TKIP) && (sc->sh->cfg.use_wpa2_only == 1)) { ++ tkip_use_sw_cipher = true; ++ } ++ if (tkip_use_sw_cipher == true) ++ dev_info(sc->dev, "Using software TKIP cipher\n"); ++ if ((((vif_priv->vif_idx == 0) && (tdls_use_sw_cipher == false) ++ && (tkip_use_sw_cipher == false))) ++ || ((cipher == SSV_CIPHER_CCMP) ++ && (sc->sh->cfg.use_wpa2_only == 1))) { ++ sta_priv->has_hw_decrypt = true; ++ sta_priv->need_sw_decrypt = false; ++ if ((cipher == SSV_CIPHER_TKIP) ++ || ((!(sc->sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_TX) || ++ (sta_priv->sta_info->sta->deflink.ht_cap.ht_supported == ++ false)) ++ && (vif_priv->force_sw_encrypt == false))) { ++ dev_dbg(sc->dev, ++ "STA %d uses HW encrypter for pairwise.\n", ++ sta_priv->sta_idx); ++ sta_priv->has_hw_encrypt = true; ++ sta_priv->need_sw_encrypt = false; ++ sta_priv->use_mac80211_decrypt = false; ++ ret = 0; ++ } else { ++ sta_priv->has_hw_encrypt = false; ++ sta_priv->need_sw_encrypt = false; ++ sta_priv->use_mac80211_decrypt = true; ++ ret = -EOPNOTSUPP; ++ } ++ } else { ++ sta_priv->has_hw_encrypt = false; ++ sta_priv->has_hw_decrypt = false; ++ dev_err(sc->dev, "STA %d MAC80211's %s cipher.\n", ++ sta_priv->sta_idx, cipher_name); ++ sta_priv->need_sw_encrypt = false; ++ sta_priv->need_sw_decrypt = false; ++ sta_priv->use_mac80211_decrypt = true; ++ ret = -EOPNOTSUPP; ++ } ++ if (sta_priv->has_hw_encrypt || sta_priv->has_hw_decrypt) { ++ ssv6200_hw_set_pair_type(sc->sh, cipher); ++ _write_pairwise_key_to_hw(sc, key->keyidx, cipher, ++ key->key, key->keylen, key, ++ vif_priv, sta_priv); ++ } ++ if ((vif_priv->has_hw_encrypt || vif_priv->has_hw_decrypt) ++ && (vif_priv->group_key_idx > 0)) { ++ _set_aes_tkip_hw_crypto_group_key(sc, ++ &sc->vif_info[vif_priv-> ++ vif_idx], ++ sta_priv->sta_info, ++ &vif_priv->group_key_idx); ++ } ++ return ret; ++} ++ ++static int _set_group_key_tkip_ccmp(struct ssv_softc *sc, ++ struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv, ++ enum SSV_CIPHER_E cipher, ++ struct ieee80211_key_conf *key) ++{ ++ int ret = 0; ++ const char *cipher_name = (cipher == SSV_CIPHER_CCMP) ? "CCMP" : "TKIP"; ++ bool tkip_use_sw_cipher = false; ++ vif_priv->group_cipher = cipher; ++ if (sc->sh->cfg.use_wpa2_only) { ++ dev_warn(sc->dev, "Group TKIP/CCMP: use WPA2 HW security mode only.\n"); ++ } ++ if ((cipher == SSV_CIPHER_TKIP) && (sc->sh->cfg.use_wpa2_only == 1)) { ++ tkip_use_sw_cipher = true; ++ } ++ if (((vif_priv->vif_idx == 0) && (tkip_use_sw_cipher == false)) ++ || ((cipher == SSV_CIPHER_CCMP) ++ && (sc->sh->cfg.use_wpa2_only == 1))) { ++ dev_dbg(sc->dev, "VIF %d uses HW %s cipher for group.\n", ++ vif_priv->vif_idx, cipher_name); ++#ifdef USE_MAC80211_DECRYPT_BROADCAST ++ vif_priv->has_hw_decrypt = false; ++ ret = -EOPNOTSUPP; ++#else ++ vif_priv->has_hw_decrypt = true; ++#endif ++ vif_priv->has_hw_encrypt = true; ++ vif_priv->need_sw_decrypt = false; ++ vif_priv->need_sw_encrypt = false; ++ vif_priv->use_mac80211_decrypt = false; ++ } else { ++ vif_priv->has_hw_decrypt = false; ++ vif_priv->has_hw_encrypt = false; ++ dev_err(sc->dev, "VIF %d uses MAC80211's %s cipher.\n", ++ vif_priv->vif_idx, cipher_name); ++ vif_priv->need_sw_encrypt = false; ++ vif_priv->need_sw_encrypt = false; ++ vif_priv->use_mac80211_decrypt = true; ++ ret = -EOPNOTSUPP; ++ } ++ if (vif_priv->has_hw_encrypt || vif_priv->has_hw_decrypt) { ++#ifdef USE_MAC80211_DECRYPT_BROADCAST ++ ssv6200_hw_set_group_type(sc->sh, ME_NONE); ++#else ++ ssv6200_hw_set_group_type(sc->sh, cipher); ++#endif ++ key->hw_key_idx = key->keyidx; ++ _write_group_key_to_hw(sc, key->keyidx, cipher, ++ key->key, key->keylen, key, ++ vif_priv, sta_priv); ++ } ++ vif_priv->is_security_valid = true; ++ { ++ int another_vif_idx = ((vif_priv->vif_idx + 1) % 2); ++ struct ssv_vif_priv_data *another_vif_priv = ++ (struct ssv_vif_priv_data *)sc->vif_info[another_vif_idx]. ++ vif_priv; ++ if (another_vif_priv != NULL) { ++ if (((SSV6XXX_USE_SW_DECRYPT(vif_priv) ++ && SSV6XXX_USE_HW_DECRYPT(another_vif_priv))) ++ || ((SSV6XXX_USE_HW_DECRYPT(vif_priv) ++ && ++ (SSV6XXX_USE_SW_DECRYPT(another_vif_priv))))) { ++ u32 val; ++ SMAC_REG_READ(sc->sh, ADR_RX_FLOW_DATA, &val); ++ if (((val >> 4) & 0xF) != M_ENG_CPU) { ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_DATA, ++ ((val & 0xf) | ++ (M_ENG_CPU << 4) ++ | (val & 0xfffffff0) << ++ 4)); ++ dev_dbg(sc->dev, ++ "orginal Rx_Flow %x , modified flow %x \n", ++ val, ++ ((val & 0xf) | (M_ENG_CPU << 4) ++ | (val & 0xfffffff0) << 4)); ++ } else { ++ dev_dbg(sc->dev, " doesn't need to change rx flow\n"); ++ } ++ } ++ } ++ } ++ return ret; ++} ++ ++static int _set_key_tkip_ccmp(struct ssv_softc *sc, ++ struct ssv_vif_priv_data *vif_priv, ++ struct ssv_sta_priv_data *sta_priv, ++ enum SSV_CIPHER_E cipher, ++ struct ieee80211_key_conf *key) ++{ ++ if (key->keyidx == 0) ++ return _set_pairwise_key_tkip_ccmp(sc, vif_priv, sta_priv, ++ cipher, key); ++ else ++ return _set_group_key_tkip_ccmp(sc, vif_priv, sta_priv, cipher, ++ key); ++} ++ ++static int ssv6200_set_key(struct ieee80211_hw *hw, ++ enum set_key_cmd cmd, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ struct ieee80211_key_conf *key) ++{ ++ struct ssv_softc *sc = hw->priv; ++ int ret = 0; ++ enum SSV_CIPHER_E cipher = SSV_CIPHER_NONE; ++ int sta_idx = (-1); ++ struct ssv_sta_info *sta_info = NULL; ++ struct ssv_sta_priv_data *sta_priv = NULL; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ if (sta) { ++ sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ sta_idx = sta_priv->sta_idx; ++ sta_info = sta_priv->sta_info; ++ } ++ BUG_ON((cmd != SET_KEY) && (cmd != DISABLE_KEY)); ++ if (!(sc->sh->cfg.hw_caps & SSV6200_HW_CAP_SECURITY)) { ++ dev_warn(sc->dev, "HW does not support security.\n"); ++ return -EOPNOTSUPP; ++ } ++ if (sta_info && (sta_info->hw_wsid == (-1))) { ++ dev_warn(sc->dev, ++ "Add STA without HW resource. Use MAC80211's solution.\n"); ++ return -EOPNOTSUPP; ++ } ++ cipher = _prepare_key(key); ++ dev_dbg(sc->dev, ++ "Set key VIF %d VIF type %d STA %d algorithm = %d, key->keyidx = %d, cmd = %d\n", ++ vif_priv->vif_idx, vif->type, sta_idx, cipher, key->keyidx, ++ cmd); ++ if (cipher == SSV_CIPHER_INVALID) { ++ dev_warn(sc->dev, "Unsupported cipher type.\n"); ++ return -EOPNOTSUPP; ++ } ++ mutex_lock(&sc->mutex); ++ switch (cmd) { ++ case SET_KEY: ++ { ++ switch (cipher) { ++ case SSV_CIPHER_WEP40: ++ case SSV_CIPHER_WEP104: ++ ret = ++ _set_key_wep(sc, vif_priv, sta_priv, cipher, ++ key); ++ break; ++ case SSV_CIPHER_TKIP: ++ case SSV_CIPHER_CCMP: ++ ret = ++ _set_key_tkip_ccmp(sc, vif_priv, sta_priv, ++ cipher, key); ++ break; ++ default: ++ break; ++ } ++ if (sta) { ++ struct ssv_sta_priv_data *first_sta_priv = ++ list_first_entry(&vif_priv->sta_list, ++ struct ssv_sta_priv_data, ++ list); ++ if (first_sta_priv->sta_idx == ++ sta_priv->sta_idx) { ++ vif_priv->pair_cipher = cipher; ++ } ++ if (SSV6200_USE_HW_WSID(sta_idx)) { ++ if (SSV6XXX_USE_SW_DECRYPT(sta_priv)) { ++ u32 cipher_setting; ++ cipher_setting = ++ ssv6200_hw_get_pair_type ++ (sc->sh); ++ if (cipher_setting != ME_NONE) { ++ u32 val; ++ SMAC_REG_READ(sc->sh, ++ ADR_RX_FLOW_DATA, ++ &val); ++ if (((val >> 4) & 0xF) ++ != M_ENG_CPU) { ++ SMAC_REG_WRITE ++ (sc->sh, ++ ADR_RX_FLOW_DATA, ++ ((val & ++ 0xf) | ++ (M_ENG_CPU ++ << 4) ++ | (val & ++ 0xfffffff0) ++ << 4)); ++ dev_dbg(sc->dev, ++ "orginal Rx_Flow %x , modified flow %x \n", ++ val, ++ ((val & ++ 0xf) | ++ (M_ENG_CPU ++ << 4) ++ | (val ++ & ++ 0xfffffff0) ++ << 4)); ++ } else { ++ dev_dbg(sc->dev, " doesn't need to change rx flow\n"); ++ } ++ } ++ } ++ if (sta_priv->has_hw_decrypt) { ++ hw_update_watch_wsid(sc, sta, ++ sta_info, ++ sta_idx, ++ SSV6XXX_WSID_SEC_HW, ++ SSV6XXX_WSID_OPS_HWWSID_PAIRWISE_SET_TYPE); ++ dev_info(sc->dev, "set hw wsid %d cipher mode to HW cipher for pairwise key\n", sta_idx); ++ } ++ } ++ } else { ++ if (vif_info->if_type == NL80211_IFTYPE_STATION) { ++ struct ssv_sta_priv_data *first_sta_priv ++ = ++ list_first_entry(&vif_priv-> ++ sta_list, ++ struct ++ ssv_sta_priv_data, ++ list); ++ if (SSV6200_USE_HW_WSID ++ (first_sta_priv->sta_idx)) { ++ if (vif_priv->has_hw_decrypt) { ++ hw_update_watch_wsid(sc, ++ sta, ++ sta_info, ++ first_sta_priv-> ++ sta_idx, ++ SSV6XXX_WSID_SEC_HW, ++ SSV6XXX_WSID_OPS_HWWSID_GROUP_SET_TYPE); ++ dev_info(sc->dev, "set hw wsid %d cipher mode to HW cipher for group key\n", first_sta_priv->sta_idx); ++ } ++ } ++ } ++ } ++ } ++ break; ++ case DISABLE_KEY: ++ { ++ int another_vif_idx = ((vif_priv->vif_idx + 1) % 2); ++ struct ssv_vif_priv_data *another_vif_priv = ++ (struct ssv_vif_priv_data *)sc-> ++ vif_info[another_vif_idx].vif_priv; ++ if (another_vif_priv != NULL) { ++ struct ssv_vif_info *vif_info = ++ &sc->vif_info[vif_priv->vif_idx]; ++ if (vif_info->if_type != NL80211_IFTYPE_AP) { ++ if ((SSV6XXX_USE_SW_DECRYPT(vif_priv) ++ && ++ SSV6XXX_USE_HW_DECRYPT ++ (another_vif_priv)) ++ || ++ (SSV6XXX_USE_SW_DECRYPT ++ (another_vif_priv) ++ && ++ SSV6XXX_USE_HW_DECRYPT(vif_priv))) ++ { ++ SMAC_REG_WRITE(sc->sh, ++ ADR_RX_FLOW_DATA, ++ M_ENG_MACRX | ++ (M_ENG_ENCRYPT_SEC ++ << 4) | ++ (M_ENG_HWHCI << ++ 8)); ++ dev_dbg(sc->dev, "redirect Rx flow for disconnect\n"); ++ } ++ } else { ++ if (sta == NULL) { ++ if (SSV6XXX_USE_SW_DECRYPT ++ (another_vif_priv) ++ && ++ SSV6XXX_USE_HW_DECRYPT ++ (vif_priv)) { ++ SMAC_REG_WRITE(sc->sh, ++ ADR_RX_FLOW_DATA, ++ M_ENG_MACRX ++ | ++ (M_ENG_ENCRYPT_SEC ++ << 4) | ++ (M_ENG_HWHCI ++ << 8)); ++ dev_dbg(sc->dev, "redirect Rx flow for disconnect\n"); ++ } ++ } ++ } ++ } ++ if (sta == NULL) { ++ vif_priv->group_cipher = ME_NONE; ++ if ((another_vif_priv == NULL) ++ || ((another_vif_priv != NULL) ++ && ++ (!SSV6XXX_USE_HW_DECRYPT ++ (another_vif_priv)))) { ++ ssv6200_hw_set_group_type(sc->sh, ++ ME_NONE); ++ } ++ } else { ++ struct ssv_vif_info *vif_info = ++ &sc->vif_info[vif_priv->vif_idx]; ++ if ((vif_info->if_type != NL80211_IFTYPE_AP) ++ && (another_vif_priv == NULL)) { ++ struct ssv_sta_priv_data *first_sta_priv ++ = ++ list_first_entry(&vif_priv-> ++ sta_list, ++ struct ++ ssv_sta_priv_data, ++ list); ++ if (sta_priv == first_sta_priv) { ++ ssv6200_hw_set_pair_type(sc->sh, ++ ME_NONE); ++ } ++ } ++ vif_priv->pair_cipher = ME_NONE; ++ } ++ if ((cipher == ME_TKIP) || (cipher == ME_CCMP)) { ++ dev_dbg(sc->dev, "Clear key %d VIF %d, STA %d\n", ++ key->keyidx, (vif != NULL), ++ (sta != NULL)); ++ hw_crypto_key_clear(hw, key->keyidx, key, ++ vif_priv, sta_priv); ++ } ++ { ++ if ((key->keyidx == 0) && (sta_priv != NULL)) { ++ sta_priv->has_hw_decrypt = false; ++ sta_priv->has_hw_encrypt = false; ++ sta_priv->need_sw_encrypt = false; ++ sta_priv->use_mac80211_decrypt = false; ++ } ++ if ((vif_priv->is_security_valid) ++ && (key->keyidx != 0)) { ++ vif_priv->is_security_valid = false; ++ } ++ } ++ ret = 0; ++ } ++ break; ++ default: ++ ret = -EINVAL; ++ } ++ mutex_unlock(&sc->mutex); ++ if (sta_priv != NULL) { ++ dev_info(sc->dev, "station mode: hardware encrypt:%d/decrypt:%d, software encrypt:%d/decrypt:%d\n", ++ (sta_priv->has_hw_encrypt == true), ++ (sta_priv->has_hw_decrypt == true), ++ (sta_priv->need_sw_encrypt == true), ++ (sta_priv->need_sw_decrypt == true)); ++ } ++ if (vif_priv) { ++ dev_info ++ (sc->dev, "vif mode: hardware encrypt:%d/decrypt:%d, software encrypt:%d/decrypt:%d, mac80211 decrypt: %d, valid:%d\n", ++ (vif_priv->has_hw_encrypt == true), ++ (vif_priv->has_hw_decrypt == true), ++ (vif_priv->need_sw_encrypt == true), ++ (vif_priv->need_sw_decrypt == true), ++ (vif_priv->use_mac80211_decrypt == true), ++ (vif_priv->is_security_valid == true)); ++ } ++ if (vif_priv->force_sw_encrypt ++ || (sta_info && (sta_info->hw_wsid != 1) ++ && (sta_info->hw_wsid != 0))) { ++ if (vif_priv->force_sw_encrypt == false) ++ vif_priv->force_sw_encrypt = true; ++ ret = -EOPNOTSUPP; ++ } ++ dev_dbg(sc->dev, "SET KEY %d\n", ret); ++ return ret; ++} ++ ++u32 _process_tx_done(struct ssv_softc *sc) ++{ ++ struct ieee80211_tx_info *tx_info; ++ struct sk_buff *skb; ++ while ((skb = skb_dequeue(&sc->tx_done_q))) { ++ struct ssv6200_tx_desc *tx_desc; ++ tx_info = IEEE80211_SKB_CB(skb); ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ if (tx_desc->c_type > M2_TXREQ) { ++ ssv_skb_free(skb); ++ dev_dbg(sc->dev, "free cmd skb!\n"); ++ continue; ++ } ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { ++ ssv6200_ampdu_release_skb(skb, sc->hw); ++ continue; ++ } ++ skb_pull(skb, SSV6XXX_TX_DESC_LEN); ++ ieee80211_tx_info_clear_status(tx_info); ++ tx_info->flags |= IEEE80211_TX_STAT_ACK; ++ tx_info->status.ack_signal = 100; ++#ifdef REPORT_TX_DONE_IN_IRQ ++ ieee80211_tx_status_irqsafe(sc->hw, skb); ++#else ++ ieee80211_tx_status_skb(sc->hw, skb); ++ if (skb_queue_len(&sc->rx_skb_q)) ++ break; ++#endif ++ } ++ return skb_queue_len(&sc->tx_done_q); ++} ++ ++#ifdef REPORT_TX_DONE_IN_IRQ ++void ssv6xxx_tx_cb(struct sk_buff_head *skb_head, void *args) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)args; ++ _process_tx_done *(sc); ++} ++#else ++void ssv6xxx_tx_cb(struct sk_buff_head *skb_head, void *args) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)args; ++ struct sk_buff *skb; ++ while ((skb = skb_dequeue(skb_head))) { ++ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); ++ struct ssv6200_tx_desc *tx_desc; ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ if (tx_desc->c_type > M2_TXREQ) { ++ ssv_skb_free(skb); ++ dev_dbg(sc->dev, "free cmd skb!\n"); ++ continue; ++ } ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) ++ ssv6xxx_ampdu_sent(sc->hw, skb); ++ skb_queue_tail(&sc->tx_done_q, skb); ++ } ++ wake_up_interruptible(&sc->rx_wait_q); ++} ++#endif ++void ssv6xxx_tx_rate_update(struct sk_buff *skb, void *args) ++{ ++ struct ieee80211_hdr *hdr; ++ struct ssv_softc *sc = args; ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ struct ssv6200_tx_desc *tx_desc; ++ struct ssv_rate_info ssv_rate; ++ u32 nav = 0; ++ int ret = 0; ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ if (tx_desc->c_type > M2_TXREQ) ++ return; ++ if (!(info->flags & IEEE80211_TX_CTL_AMPDU)) { ++ hdr = (struct ieee80211_hdr *)(skb->data + SSV6XXX_TX_DESC_LEN); ++ if ((ieee80211_is_data_qos(hdr->frame_control) ++ || ieee80211_is_data(hdr->frame_control)) ++ && (tx_desc->wsid < SSV_RC_MAX_HARDWARE_SUPPORT)) { ++ ret = ++ ssv6xxx_rc_hw_rate_update_check(skb, sc, ++ tx_desc-> ++ do_rts_cts); ++ if (ret & RC_FIRMWARE_REPORT_FLAG) { ++ { ++ tx_desc->RSVD_0 = SSV6XXX_RC_REPORT; ++ tx_desc->tx_report = 1; ++ } ++ ret &= 0xf; ++ } ++ if (ret) { ++ ssv6xxx_rc_hw_rate_idx(sc, info, &ssv_rate); ++ tx_desc->crate_idx = ssv_rate.crate_hw_idx; ++ tx_desc->drate_idx = ssv_rate.drate_hw_idx; ++ nav = ++ ssv6xxx_set_frame_duration(info, &ssv_rate, ++ skb->len + ++ FCS_LEN, tx_desc, ++ NULL, NULL); ++ if (tx_desc->tx_burst == 0) { ++ if (tx_desc->ack_policy != 0x01) ++ hdr->duration_id = nav; ++ } ++ } ++ } ++ } else { ++ } ++ return; ++} ++ ++void ssv6xxx_update_txinfo(struct ssv_softc *sc, struct sk_buff *skb) ++{ ++ struct ieee80211_hdr *hdr; ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ struct ieee80211_sta *sta; ++ struct ssv_sta_info *sta_info = NULL; ++ struct ssv_sta_priv_data *ssv_sta_priv = NULL; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)info->control.vif->drv_priv; ++ struct ssv6200_tx_desc *tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ struct ieee80211_tx_rate *tx_drate; ++ struct ssv_rate_info ssv_rate; ++ int ac, hw_txqid; ++ u32 nav = 0; ++ if (info->flags & IEEE80211_TX_CTL_AMPDU) { ++ struct ampdu_hdr_st *ampdu_hdr = ++ (struct ampdu_hdr_st *)skb->head; ++ sta = ampdu_hdr->ampdu_tid->sta; ++ hdr = ++ (struct ieee80211_hdr *)(skb->data + TXPB_OFFSET + ++ AMPDU_DELIMITER_LEN); ++ } else { ++ struct SKB_info_st *skb_info = (struct SKB_info_st *)skb->head; ++ sta = skb_info->sta; ++ hdr = (struct ieee80211_hdr *)(skb->data + TXPB_OFFSET); ++ } ++ if (sta) { ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ sta_info = ssv_sta_priv->sta_info; ++ } ++ if ((!sc->bq4_dtim) && ++ (ieee80211_is_mgmt(hdr->frame_control) || ++ ieee80211_is_nullfunc(hdr->frame_control) || ++ ieee80211_is_qos_nullfunc(hdr->frame_control))) { ++ ac = 4; ++ hw_txqid = 4; ++ } else if ((sc->bq4_dtim) && ++ info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { ++ hw_txqid = 4; ++ ac = 4; ++ } else { ++ ac = skb_get_queue_mapping(skb); ++ hw_txqid = sc->tx.hw_txqid[ac]; ++ } ++ tx_drate = &info->control.rates[0]; ++ ssv6xxx_rc_hw_rate_idx(sc, info, &ssv_rate); ++ tx_desc->len = skb->len; ++ tx_desc->c_type = M2_TXREQ; ++ tx_desc->f80211 = 1; ++ tx_desc->qos = (ieee80211_is_data_qos(hdr->frame_control)) ? 1 : 0; ++ if (tx_drate->flags & IEEE80211_TX_RC_MCS) { ++ if (ieee80211_is_mgmt(hdr->frame_control) && ++ ieee80211_has_order(hdr->frame_control)) ++ tx_desc->ht = 1; ++ } ++ tx_desc->use_4addr = (ieee80211_has_a4(hdr->frame_control)) ? 1 : 0; ++ tx_desc->more_data = ++ (ieee80211_has_morefrags(hdr->frame_control)) ? 1 : 0; ++ tx_desc->stype_b5b4 = (cpu_to_le16(hdr->frame_control) >> 4) & 0x3; ++ tx_desc->frag = (tx_desc->more_data || (hdr->seq_ctrl & 0xf)) ? 1 : 0; ++ tx_desc->unicast = (is_multicast_ether_addr(hdr->addr1)) ? 0 : 1; ++ tx_desc->tx_burst = (tx_desc->frag) ? 1 : 0; ++ tx_desc->wsid = (!sta_info ++ || (sta_info->hw_wsid < 0)) ? 0x0F : sta_info->hw_wsid; ++ tx_desc->txq_idx = hw_txqid; ++ tx_desc->hdr_offset = TXPB_OFFSET; ++ tx_desc->hdr_len = ssv6xxx_frame_hdrlen(hdr, tx_desc->ht); ++ tx_desc->payload_offset = tx_desc->hdr_offset + tx_desc->hdr_len; ++ if (info->control.use_rts) ++ tx_desc->do_rts_cts = IEEE80211_TX_RC_USE_RTS_CTS; ++ else if (info->control.use_cts_prot) ++ tx_desc->do_rts_cts = IEEE80211_TX_RC_USE_CTS_PROTECT; ++ if (tx_desc->do_rts_cts == IEEE80211_TX_RC_USE_CTS_PROTECT) ++ tx_desc->do_rts_cts = IEEE80211_TX_RC_USE_RTS_CTS; ++ if (tx_desc->do_rts_cts == IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ tx_desc->crate_idx = 0; ++ } else ++ tx_desc->crate_idx = ssv_rate.crate_hw_idx; ++ tx_desc->drate_idx = ssv_rate.drate_hw_idx; ++ if (tx_desc->unicast == 0) ++ tx_desc->ack_policy = 1; ++ else if (tx_desc->qos == 1) ++ tx_desc->ack_policy = (*ieee80211_get_qos_ctl(hdr) & 0x60) >> 5; ++ else if (ieee80211_is_ctl(hdr->frame_control)) ++ tx_desc->ack_policy = 1; ++ tx_desc->security = 0; ++ tx_desc->fCmdIdx = 0; ++ tx_desc->fCmd = (hw_txqid + M_ENG_TX_EDCA0); ++ if (info->flags & IEEE80211_TX_CTL_AMPDU) { ++#ifdef AMPDU_HAS_LEADING_FRAME ++ tx_desc->fCmd = (tx_desc->fCmd << 4) | M_ENG_CPU; ++#else ++ tx_desc->RSVD_1 = 1; ++#endif ++ tx_desc->aggregation = 1; ++ tx_desc->ack_policy = 0x01; ++ if ((tx_desc->do_rts_cts == 0) ++ && ((sc->hw->wiphy->rts_threshold == (-1)) ++ || ((skb->len - sc->sh->tx_desc_len) > ++ sc->hw->wiphy->rts_threshold))) { ++ tx_drate->flags |= IEEE80211_TX_RC_USE_RTS_CTS; ++ tx_desc->do_rts_cts = 1; ++ } ++ } ++ if (ieee80211_has_protected(hdr->frame_control) ++ && (ieee80211_is_data_qos(hdr->frame_control) ++ || ieee80211_is_data(hdr->frame_control))) { ++ if ((tx_desc->unicast && ssv_sta_priv ++ && ssv_sta_priv->has_hw_encrypt) ++ || (!tx_desc->unicast && vif_priv ++ && vif_priv->has_hw_encrypt)) { ++ if (!tx_desc->unicast ++ && !list_empty(&vif_priv->sta_list)) { ++ struct ssv_sta_priv_data *one_sta_priv; ++ int hw_wsid; ++ one_sta_priv = ++ list_first_entry(&vif_priv->sta_list, ++ struct ssv_sta_priv_data, ++ list); ++ hw_wsid = one_sta_priv->sta_info->hw_wsid; ++ if (hw_wsid != (-1)) { ++ tx_desc->wsid = hw_wsid; ++ } ++ } ++ tx_desc->fCmd = (tx_desc->fCmd << 4) | M_ENG_ENCRYPT; ++ } else if (ssv_sta_priv->need_sw_encrypt) { ++ } else { ++ } ++ } else { ++ } ++ tx_desc->fCmd = (tx_desc->fCmd << 4) | M_ENG_HWHCI; ++ if (tx_desc->aggregation == 1) { ++ struct ampdu_hdr_st *ampdu_hdr = ++ (struct ampdu_hdr_st *)skb->head; ++ memcpy(&tx_desc->rc_params[0], ampdu_hdr->rates, ++ sizeof(tx_desc->rc_params)); ++ nav = ++ ssv6xxx_set_frame_duration(info, &ssv_rate, ++ (skb->len + FCS_LEN), tx_desc, ++ &tx_desc->rc_params[0], sc); ++#ifdef FW_RC_RETRY_DEBUG ++ { ++ dev_dbg ++ (sc->dev, "[FW_RC]:param[0]: drate =%d, count =%d, crate=%d, dl_length =%d, frame_consume_time =%d, rts_cts_nav=%d\n", ++ tx_desc->rc_params[0].drate, ++ tx_desc->rc_params[0].count, ++ tx_desc->rc_params[0].crate, ++ tx_desc->rc_params[0].dl_length, ++ tx_desc->rc_params[0].frame_consume_time, ++ tx_desc->rc_params[0].rts_cts_nav); ++ dev_dbg ++ (sc->dev, "[FW_RC]:param[1]: drate =%d, count =%d, crate=%d, dl_length =%d, frame_consume_time =%d, rts_cts_nav=%d\n", ++ tx_desc->rc_params[1].drate, ++ tx_desc->rc_params[1].count, ++ tx_desc->rc_params[1].crate, ++ tx_desc->rc_params[1].dl_length, ++ tx_desc->rc_params[1].frame_consume_time, ++ tx_desc->rc_params[1].rts_cts_nav); ++ dev_dbg ++ (sc->dev, "[FW_RC]:param[2]: drate =%d, count =%d, crate=%d, dl_length =%d, frame_consume_time =%d, rts_cts_nav=%d\n", ++ tx_desc->rc_params[2].drate, ++ tx_desc->rc_params[2].count, ++ tx_desc->rc_params[2].crate, ++ tx_desc->rc_params[2].dl_length, ++ tx_desc->rc_params[2].frame_consume_time, ++ tx_desc->rc_params[2].rts_cts_nav); ++ } ++#endif ++ } else { ++ nav = ++ ssv6xxx_set_frame_duration(info, &ssv_rate, ++ (skb->len + FCS_LEN), tx_desc, ++ NULL, NULL); ++ } ++ if ((tx_desc->aggregation == 0)) { ++ if (tx_desc->tx_burst == 0) { ++ if (tx_desc->ack_policy != 0x01) ++ hdr->duration_id = nav; ++ } else { ++ } ++ } ++} ++ ++void ssv6xxx_add_txinfo(struct ssv_softc *sc, struct sk_buff *skb) ++{ ++ struct ssv6200_tx_desc *tx_desc; ++ skb_push(skb, sc->sh->tx_desc_len); ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ memset((void *)tx_desc, 0, sc->sh->tx_desc_len); ++ ssv6xxx_update_txinfo(sc, skb); ++} ++ ++int ssv6xxx_get_real_index(struct ssv_softc *sc, struct sk_buff *skb) ++{ ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ struct ieee80211_tx_rate *tx_drate; ++ struct ssv_rate_info ssv_rate; ++ tx_drate = &info->control.rates[0]; ++ ssv6xxx_rc_hw_rate_idx(sc, info, &ssv_rate); ++ return ssv_rate.drate_hw_idx; ++} ++ ++static void _ssv6xxx_tx(struct ieee80211_hw *hw, struct sk_buff *skb) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ struct ieee80211_vif *vif = info->control.vif; ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ++ struct ssv6200_tx_desc *tx_desc; ++ int ret; ++ unsigned long flags; ++ bool send_hci = false; ++ do { ++ if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { ++ if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) ++ sc->tx.seq_no += 0x10; ++ hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); ++ hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no); ++ } ++ if (info->flags & IEEE80211_TX_CTL_AMPDU) { ++ if (ssv6xxx_get_real_index(sc, skb) < ++ SSV62XX_RATE_MCS_INDEX) { ++ info->flags &= (~IEEE80211_TX_CTL_AMPDU); ++ goto tx_mpdu; ++ } ++ if (ssv6200_ampdu_tx_handler(hw, skb)) { ++ break; ++ } else { ++ info->flags &= (~IEEE80211_TX_CTL_AMPDU); ++ } ++ } ++ tx_mpdu: ++ ssv6xxx_add_txinfo(sc, skb); ++ if (vif && ++ vif->type == NL80211_IFTYPE_AP && ++ (sc->bq4_dtim) && ++ info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { ++ struct ssv_vif_priv_data *priv_vif = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ u8 buffered = 0; ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ if (priv_vif->sta_asleep_mask) { ++ buffered = ++ ssv6200_bcast_enqueue(sc, &sc->bcast_txq, ++ skb); ++ if (1 == buffered) { ++ dev_dbg(sc->dev, "ssv6200_tx:ssv6200_bcast_start\n"); ++ ssv6200_bcast_start(sc); ++ } ++ } ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ if (buffered) ++ break; ++ } ++ if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ dev_dbg(sc->dev, "vif[%d] sc->bq4_dtim[%d]\n", ++ vif_priv->vif_idx, sc->bq4_dtim); ++ } ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ ret = HCI_SEND(sc->sh, skb, tx_desc->txq_idx); ++ send_hci = true; ++ } while (0); ++ if ((skb_queue_len(&sc->tx_skb_q) < LOW_TX_Q_LEN) ++ ) { ++ if (sc->tx.flow_ctrl_status != 0) { ++ int ac; ++ for (ac = 0; ac < sc->hw->queues; ac++) { ++ if ((sc->tx.flow_ctrl_status & BIT(ac)) == 0) ++ ieee80211_wake_queue(sc->hw, ac); ++ } ++ } else { ++ ieee80211_wake_queues(sc->hw); ++ } ++ } ++} ++ ++static void ssv6200_tx(struct ieee80211_hw *hw, ++ struct ieee80211_tx_control *control, ++ struct sk_buff *skb) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)hw->priv; ++ struct SKB_info_st *skb_info = (struct SKB_info_st *)skb->head; ++ skb_info->sta = control ? control->sta : NULL; ++#ifdef CONFIG_DEBUG_SKB_TIMESTAMP ++ skb_info->timestamp = ktime_get(); ++#endif ++ skb_queue_tail(&sc->tx_skb_q, skb); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (sc->max_tx_skb_q_len < skb_queue_len(&sc->tx_skb_q)) ++ sc->max_tx_skb_q_len = skb_queue_len(&sc->tx_skb_q); ++#endif ++ wake_up_interruptible(&sc->tx_wait_q); ++ do { ++ if (skb_queue_len(&sc->tx_skb_q) >= MAX_TX_Q_LEN) ++ ieee80211_stop_queues(sc->hw); ++ } while (0); ++} ++ ++int ssv6xxx_tx_task(void *data) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)data; ++ u32 wait_period = SSV_AMPDU_timer_period / 2; ++ dev_info(sc->dev, "TX Task started\n"); ++ while (!kthread_should_stop()) { ++ u32 before_timeout = (-1); ++ set_current_state(TASK_INTERRUPTIBLE); ++ before_timeout = wait_event_interruptible_timeout(sc->tx_wait_q, ++ (skb_queue_len ++ (&sc-> ++ tx_skb_q) ++ || ++ kthread_should_stop ++ () ++ || sc-> ++ tx_q_empty), ++ msecs_to_jiffies ++ (wait_period)); ++ if (kthread_should_stop()) { ++ dev_dbg(sc->dev, "Quit TX task loop...\n"); ++ break; ++ } ++ set_current_state(TASK_RUNNING); ++ do { ++ struct sk_buff *tx_skb = skb_dequeue(&sc->tx_skb_q); ++ if (tx_skb == NULL) ++ break; ++ _ssv6xxx_tx(sc->hw, tx_skb); ++ } while (1); ++#ifdef CONFIG_DEBUG_SKB_TIMESTAMP ++ { ++ struct ssv_hw_txq *hw_txq = NULL; ++ struct ieee80211_tx_info *tx_info = NULL; ++ struct sk_buff *skb = NULL; ++ int txqid; ++ unsigned int timeout; ++ u32 status; ++ for (txqid = 0; txqid < SSV_HW_TXQ_NUM; txqid++) { ++ hw_txq = &ssv_dbg_ctrl_hci->hw_txq[txqid]; ++ skb = skb_peek(&hw_txq->qhead); ++ if (skb != NULL) { ++ tx_info = IEEE80211_SKB_CB(skb); ++ if (tx_info-> ++ flags & IEEE80211_TX_CTL_AMPDU) ++ timeout = ++ cal_duration_of_ampdu(skb, ++ SKB_DURATION_STAGE_IN_HWQ); ++ else ++ timeout = ++ cal_duration_of_mpdu(skb); ++ if (timeout > SKB_DURATION_TIMEOUT_MS) { ++ HCI_IRQ_STATUS(ssv_dbg_ctrl_hci, ++ &status); ++ dev_dbg(sc->dev, "hci int_mask: %08x\n", ++ ssv_dbg_ctrl_hci-> ++ int_mask); ++ dev_dbg(sc->dev, "sdio status: %08x\n", ++ status); ++ dev_dbg(sc->dev, "hwq%d len: %d\n", txqid, ++ skb_queue_len(&hw_txq-> ++ qhead)); ++ } ++ } ++ } ++ } ++#endif ++ if (sc->tx_q_empty || (before_timeout == 0)) { ++ u32 flused_ampdu = ssv6xxx_ampdu_flush(sc->hw); ++ sc->tx_q_empty = false; ++ if (flused_ampdu == 0 && before_timeout == 0) { ++ wait_period *= 2; ++ if (wait_period > 1000) ++ wait_period = 1000; ++ } ++ } else ++ wait_period = SSV_AMPDU_timer_period / 2; ++ } ++ return 0; ++} ++ ++int ssv6xxx_rx_task(void *data) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)data; ++ unsigned long wait_period = msecs_to_jiffies(200); ++ unsigned long last_timeout_check_jiffies = jiffies; ++ unsigned long cur_jiffies; ++ dev_info(sc->dev, "RX Task started\n"); ++ while (!kthread_should_stop()) { ++ u32 before_timeout = (-1); ++ set_current_state(TASK_INTERRUPTIBLE); ++ before_timeout = wait_event_interruptible_timeout(sc->rx_wait_q, ++ (skb_queue_len ++ (&sc-> ++ rx_skb_q) ++ || ++ skb_queue_len ++ (&sc-> ++ tx_done_q) ++ || ++ kthread_should_stop ++ ()), ++ wait_period); ++ if (kthread_should_stop()) { ++ dev_dbg(sc->dev, "Quit RX task loop...\n"); ++ break; ++ } ++ set_current_state(TASK_RUNNING); ++ cur_jiffies = jiffies; ++ if ((before_timeout == 0) ++ || time_before((last_timeout_check_jiffies + wait_period), ++ cur_jiffies)) { ++ ssv6xxx_ampdu_check_timeout(sc->hw); ++ last_timeout_check_jiffies = cur_jiffies; ++ } ++ if (skb_queue_len(&sc->rx_skb_q)) ++ _process_rx_q(sc, &sc->rx_skb_q, NULL); ++ if (skb_queue_len(&sc->tx_done_q)) ++ _process_tx_done(sc); ++ } ++ return 0; ++} ++ ++struct ssv6xxx_iqk_cfg init_iqk_cfg = { ++ SSV6XXX_IQK_CFG_XTAL_26M, ++#ifdef CONFIG_SSV_DPD ++ SSV6XXX_IQK_CFG_PA_LI_MPB, ++#else ++ SSV6XXX_IQK_CFG_PA_DEF, ++#endif ++ 0, ++ 0, ++ 26, ++ 3, ++ 0x75, ++ 0x75, ++ 0x80, ++ 0x80, ++ SSV6XXX_IQK_CMD_INIT_CALI, ++ {SSV6XXX_IQK_TEMPERATURE ++ + SSV6XXX_IQK_RXDC ++ + SSV6XXX_IQK_RXRC ++ + SSV6XXX_IQK_TXDC + SSV6XXX_IQK_TXIQ + SSV6XXX_IQK_RXIQ ++#ifdef CONFIG_SSV_DPD ++ + SSV6XXX_IQK_PAPD ++#endif ++ }, ++}; ++ ++static int ssv6200_start(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_hw *sh = sc->sh; ++ struct ieee80211_channel *chan; ++ int ret; ++ ++ mutex_lock(&sc->mutex); ++ ret = ssv6xxx_init_mac(sc->sh); ++ if (ret != 0) { ++ dev_err(sc->dev, "Failed to initialize mac, ret=%d\n", ret); ++ ssv6xxx_deinit_mac(sc); ++ mutex_unlock(&sc->mutex); ++ return -1; ++ } ++#ifdef CONFIG_P2P_NOA ++ ssv6xxx_noa_reset(sc); ++#endif ++ HCI_START(sh); ++ ieee80211_wake_queues(hw); ++ ssv6200_ampdu_init(hw); ++ sc->watchdog_flag = WD_KICKED; ++ mutex_unlock(&sc->mutex); ++ mod_timer(&sc->watchdog_timeout, jiffies + WATCHDOG_TIMEOUT); ++#ifdef CONFIG_SSV_SMARTLINK ++ { ++ extern int ksmartlink_init(void); ++ (void)ksmartlink_init(); ++ } ++#endif ++ ret = ssv6xxx_do_iq_calib(sc->sh, &init_iqk_cfg); ++ if (ret != 0) { ++ dev_err(sc->dev, "IQ Calibration failed, ret=%d\n", ret); ++ return ret; ++ } ++ ++ dev_info(sc->dev, "Calibration successful\n"); ++ ++ SMAC_REG_WRITE(sc->sh, ADR_PHY_EN_1, 0x217f); ++ if ((sh->cfg.chip_identity == SSV6051Z) ++ || (sc->sh->cfg.chip_identity == SSV6051P)) { ++ int i; ++ for (i = 0; i < sh->ch_cfg_size; i++) { ++ SMAC_REG_READ(sh, sh->p_ch_cfg[i].reg_addr, ++ &sh->p_ch_cfg[i].ch1_12_value); ++ } ++ } ++ chan = hw->conf.chandef.chan; ++ sc->cur_channel = chan; ++ dev_dbg(sc->dev, "%s(): current channel: %d,sc->ps_status=%d\n", __FUNCTION__, ++ sc->cur_channel->hw_value, sc->ps_status); ++ ssv6xxx_set_channel(sc, chan->hw_value); ++ ssv6xxx_rf_enable(sh); ++ return 0; ++} ++ ++static void ssv6200_stop(struct ieee80211_hw *hw) ++{ ++ struct ssv_softc *sc = hw->priv; ++ u32 count = 0; ++ struct rssi_res_st *rssi_tmp0, *rssi_tmp1; ++ dev_dbg(sc->dev, "%s(): sc->ps_status=%d\n", __FUNCTION__, ++ sc->ps_status); ++ mutex_lock(&sc->mutex); ++ list_for_each_entry_safe(rssi_tmp0, rssi_tmp1, &rssi_res.rssi_list, ++ rssi_list) { ++ list_del(&rssi_tmp0->rssi_list); ++ kfree(rssi_tmp0); ++ } ++ ssv6200_ampdu_deinit(hw); ++ ssv6xxx_rf_disable(sc->sh); ++ HCI_STOP(sc->sh); ++#ifndef NO_USE_RXQ_LOCK ++ while (0) { ++#else ++ while (skb_queue_len(&sc->rx.rxq_head)) { ++#endif ++ dev_dbg(sc->dev, "sc->rx.rxq_count=%d\n", sc->rx.rxq_count); ++ count++; ++ if (count > 90000000) { ++ dev_err(sc->dev, "Could not empty RX queue during shutdown\n"); ++ break; ++ } ++ } ++ HCI_TXQ_FLUSH(sc->sh, (TXQ_EDCA_0 | TXQ_EDCA_1 | TXQ_EDCA_2 | ++ TXQ_EDCA_3 | TXQ_MGMT)); ++ if ((sc->ps_status == PWRSV_PREPARE) || (sc->ps_status == PWRSV_ENABLE)) { ++ ssv6xxx_enable_ps(sc); ++ ssv6xxx_rf_enable(sc->sh); ++ } ++ sc->watchdog_flag = WD_SLEEP; ++ mutex_unlock(&sc->mutex); ++ del_timer_sync(&sc->watchdog_timeout); ++#ifdef CONFIG_SSV_SMARTLINK ++ { ++ extern void ksmartlink_exit(void); ++ ksmartlink_exit(); ++ } ++#endif ++ dev_dbg(sc->dev, "%s(): leave\n", __FUNCTION__); ++} ++ ++void inline ssv62xxx_set_bssid(struct ssv_softc *sc, u8 * bssid) ++{ ++ memcpy(sc->bssid, bssid, 6); ++ SMAC_REG_WRITE(sc->sh, ADR_BSSID_0, *((u32 *) & sc->bssid[0])); ++ SMAC_REG_WRITE(sc->sh, ADR_BSSID_1, *((u32 *) & sc->bssid[4])); ++} ++ ++struct ssv_vif_priv_data *ssv6xxx_config_vif_res(struct ssv_softc *sc, ++ struct ieee80211_vif *vif) ++{ ++ int i; ++ struct ssv_vif_priv_data *priv_vif; ++ struct ssv_vif_info *vif_info; ++ lockdep_assert_held(&sc->mutex); ++ for (i = 0; i < SSV6200_MAX_VIF; i++) { ++ if (sc->vif_info[i].vif == NULL) ++ break; ++ } ++ BUG_ON(i >= SSV6200_MAX_VIF); ++ dev_dbg(sc->dev, "ssv6xxx_config_vif_res id[%d].\n", i); ++ priv_vif = (struct ssv_vif_priv_data *)vif->drv_priv; ++ memset(priv_vif, 0, sizeof(struct ssv_vif_priv_data)); ++ priv_vif->vif_idx = i; ++ memset(&sc->vif_info[i], 0, sizeof(sc->vif_info[0])); ++ sc->vif_info[i].vif = vif; ++ sc->vif_info[i].vif_priv = priv_vif; ++ INIT_LIST_HEAD(&priv_vif->sta_list); ++ priv_vif->pair_cipher = SSV_CIPHER_NONE; ++ priv_vif->group_cipher = SSV_CIPHER_NONE; ++ priv_vif->has_hw_decrypt = false; ++ priv_vif->has_hw_encrypt = false; ++ priv_vif->need_sw_encrypt = false; ++ priv_vif->need_sw_decrypt = false; ++ priv_vif->use_mac80211_decrypt = false; ++ priv_vif->is_security_valid = false; ++ priv_vif->force_sw_encrypt = (vif->type == NL80211_IFTYPE_AP); ++ vif_info = &sc->vif_info[priv_vif->vif_idx]; ++ vif_info->if_type = vif->type; ++ vif_info->vif = vif; ++ return priv_vif; ++} ++ ++static int ssv6200_add_interface(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ struct ssv_softc *sc = hw->priv; ++ int ret = 0; ++ struct ssv_vif_priv_data *vif_priv = NULL; ++ dev_dbg(sc->dev, "[I] %s(): vif->type = %d, NL80211_IFTYPE_AP=%d\n", __FUNCTION__, ++ vif->type, NL80211_IFTYPE_AP); ++ if ((sc->nvif >= SSV6200_MAX_VIF) ++ || (((vif->type == NL80211_IFTYPE_AP) ++ || (vif->p2p)) ++ && (sc->ap_vif != NULL))) { ++ dev_err(sc->dev, "Add interface of type %d (p2p: %d) failed.\n", ++ vif->type, vif->p2p); ++ return -EOPNOTSUPP; ++ } ++ mutex_lock(&sc->mutex); ++ vif_priv = ssv6xxx_config_vif_res(sc, vif); ++ if ((vif_priv->vif_idx == 0) && (vif->p2p == 0) ++ && (vif->type == NL80211_IFTYPE_AP)) { ++ dev_dbg(sc->dev, "VIF[0] set bssid and config opmode to ap\n"); ++ ssv62xxx_set_bssid(sc, sc->sh->cfg.maddr[0]); ++ SMAC_REG_SET_BITS(sc->sh, ADR_GLBLE_SET, SSV6200_OPMODE_AP, ++ OP_MODE_MSK); ++ } ++ if (vif->type == NL80211_IFTYPE_AP) { ++ BUG_ON(sc->ap_vif != NULL); ++ sc->ap_vif = vif; ++ if (!vif->p2p && (vif_priv->vif_idx == 0)) { ++ dev_dbg(sc->dev, "Normal AP mode. Config Q4 to DTIM Q.\n"); ++ SMAC_REG_SET_BITS(sc->sh, ADR_MTX_BCN_EN_MISC, ++ MTX_HALT_MNG_UNTIL_DTIM_MSK, ++ MTX_HALT_MNG_UNTIL_DTIM_MSK); ++ sc->bq4_dtim = true; ++ } ++ } ++ sc->nvif++; ++ dev_dbg(sc->dev, ++ "VIF %02x:%02x:%02x:%02x:%02x:%02x of type %d is added.\n", ++ vif->addr[0], vif->addr[1], vif->addr[2], vif->addr[3], ++ vif->addr[4], vif->addr[5], vif->type); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ssv6xxx_debugfs_add_interface(sc, vif); ++#endif ++ mutex_unlock(&sc->mutex); ++ return ret; ++} ++ ++static void ssv6200_remove_interface(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ dev_err(sc->dev, ++ "Removing interface %02x:%02x:%02x:%02x:%02x:%02x. PS=%d\n", ++ vif->addr[0], vif->addr[1], vif->addr[2], vif->addr[3], ++ vif->addr[4], vif->addr[5], sc->ps_status); ++ mutex_lock(&sc->mutex); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ssv6xxx_debugfs_remove_interface(sc, vif); ++#endif ++ if (vif->type == NL80211_IFTYPE_AP) { ++ if (sc->bq4_dtim) { ++ sc->bq4_dtim = false; ++ ssv6200_release_bcast_frame_res(sc, vif); ++ SMAC_REG_SET_BITS(sc->sh, ADR_MTX_BCN_EN_MISC, ++ 0, MTX_HALT_MNG_UNTIL_DTIM_MSK); ++ dev_dbg(sc->dev, "Config Q4 to normal Q \n"); ++ } ++ ssv6xxx_beacon_release(sc); ++ sc->ap_vif = NULL; ++ } ++ memset(&sc->vif_info[vif_priv->vif_idx], 0, ++ sizeof(struct ssv_vif_info)); ++ sc->nvif--; ++ mutex_unlock(&sc->mutex); ++} ++ ++static int ssv6200_change_interface(struct ieee80211_hw *dev, ++ struct ieee80211_vif *vif, ++ enum nl80211_iftype new_type, bool p2p) ++{ ++ struct ssv_softc *sc = dev->priv; ++ int ret = 0; ++ ++ dev_dbg(sc->dev, "change_interface new: %d (%d), old: %d (%d)\n", new_type, ++ p2p, vif->type, vif->p2p); ++ ++ if (new_type != vif->type || vif->p2p != p2p) { ++ ssv6200_remove_interface(dev, vif); ++ vif->type = new_type; ++ vif->p2p = p2p; ++ ret = ssv6200_add_interface(dev, vif); ++ } ++ ++ return ret; ++} ++ ++void ssv6xxx_ps_callback_func(unsigned long data) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)data; ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ int retry_cnt = 20; ++#ifdef SSV_WAKEUP_HOST ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_MNG, ++ M_ENG_MACRX | (M_ENG_CPU << 4) | (M_ENG_HWHCI << 8)); ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_DATA, ++ M_ENG_MACRX | (M_ENG_CPU << 4) | (M_ENG_HWHCI << 8)); ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_TB0 + 6 * 4, ++ (sc->mac_deci_tbl[6] | 1)); ++#else ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_MNG, ++ M_ENG_MACRX | (M_ENG_TRASH_CAN << 4)); ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_DATA, ++ M_ENG_MACRX | (M_ENG_TRASH_CAN << 4)); ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_MNG, ++ M_ENG_MACRX | (M_ENG_TRASH_CAN << 4)); ++#endif ++ skb = ssv_skb_alloc(sizeof(struct cfg_host_cmd)); ++ skb->data_len = sizeof(struct cfg_host_cmd); ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->RSVD0 = 0; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_PS; ++ host_cmd->len = skb->data_len; ++#ifdef SSV_WAKEUP_HOST ++ host_cmd->dummy = sc->ps_aid; ++#else ++ host_cmd->dummy = 0; ++#endif ++ sc->ps_aid = 0; ++ while ((HCI_SEND_CMD(sc->sh, skb) != 0) && (retry_cnt)) { ++ dev_warn(sc->dev, "PS cmd retry=%d!!\n", retry_cnt); ++ retry_cnt--; ++ } ++ ssv_skb_free(skb); ++ dev_dbg(sc->dev, "SSV6XXX_HOST_CMD_PS,ps_aid = %d,len=%d,tabl=0x%x\n", ++ host_cmd->dummy, skb->len, (sc->mac_deci_tbl[6] | 1)); ++} ++ ++void ssv6xxx_enable_ps(struct ssv_softc *sc) ++{ ++ sc->ps_status = PWRSV_ENABLE; ++} ++ ++void ssv6xxx_disable_ps(struct ssv_softc *sc) ++{ ++ sc->ps_status = PWRSV_DISABLE; ++ dev_info(sc->dev, "Power saving disabled\n"); ++} ++ ++int ssv6xxx_watchdog_controller(struct ssv_hw *sh, u8 flag) ++{ ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ int ret = 0; ++ dev_dbg(sh->sc->dev, "ssv6xxx_watchdog_controller %d\n", flag); ++ skb = ssv_skb_alloc(HOST_CMD_HDR_LEN); ++ if (skb == NULL) { ++ dev_warn(sh->sc->dev, "init ssv6xxx_watchdog_controller fail!!!\n"); ++ return (-1); ++ } ++ skb->data_len = HOST_CMD_HDR_LEN; ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) flag; ++ host_cmd->len = skb->data_len; ++ sh->hci.hci_ops->hci_send_cmd(skb); ++ ssv_skb_free(skb); ++ return ret; ++} ++ ++static int ssv6200_config(struct ieee80211_hw *hw, u32 changed) ++{ ++ struct ssv_softc *sc = hw->priv; ++ int ret = 0; ++ mutex_lock(&sc->mutex); ++ if (changed & IEEE80211_CONF_CHANGE_PS) { ++ struct ieee80211_conf *conf = &hw->conf; ++ if (conf->flags & IEEE80211_CONF_PS) { ++ dev_dbg(sc->dev, "Enable IEEE80211_CONF_PS ps_aid=%d\n", ++ sc->ps_aid); ++ } else { ++ dev_dbg(sc->dev, "Disable IEEE80211_CONF_PS ps_aid=%d\n", ++ sc->ps_aid); ++ } ++ } ++ if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { ++ struct ieee80211_channel *chan; ++ chan = hw->conf.chandef.chan; ++#ifdef CONFIG_P2P_NOA ++ if (sc->p2p_noa.active_noa_vif) { ++ dev_dbg(sc->dev, "NOA operating-active vif[%02x] skip scan\n", ++ sc->p2p_noa.active_noa_vif); ++ goto out; ++ } ++#endif ++ if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) { ++ if ((sc->ap_vif == NULL) ++ || ++ list_empty(& ++ ((struct ssv_vif_priv_data *)sc->ap_vif-> ++ drv_priv)->sta_list)) { ++ HCI_PAUSE(sc->sh, ++ (TXQ_EDCA_0 | TXQ_EDCA_1 | TXQ_EDCA_2 ++ | TXQ_EDCA_3 | TXQ_MGMT)); ++ sc->sc_flags |= SC_OP_OFFCHAN; ++ ssv6xxx_set_channel(sc, chan->hw_value); ++ sc->hw_chan = chan->hw_value; ++ HCI_RESUME(sc->sh, TXQ_MGMT); ++ } else { ++ dev_dbg(sc->dev, ++ "Off-channel to %d is ignored when AP mode enabled.\n", ++ chan->hw_value); ++ } ++ } else { ++ if ((sc->cur_channel == NULL) ++ || (sc->sc_flags & SC_OP_OFFCHAN) ++ || (sc->hw_chan != chan->hw_value)) { ++ HCI_PAUSE(sc->sh, ++ (TXQ_EDCA_0 | TXQ_EDCA_1 | TXQ_EDCA_2 ++ | TXQ_EDCA_3 | TXQ_MGMT)); ++ ssv6xxx_set_channel(sc, chan->hw_value); ++ sc->cur_channel = chan; ++ HCI_RESUME(sc->sh, ++ (TXQ_EDCA_0 | TXQ_EDCA_1 | TXQ_EDCA_2 ++ | TXQ_EDCA_3 | TXQ_MGMT)); ++ sc->sc_flags &= ~SC_OP_OFFCHAN; ++ } else { ++ dev_dbg(sc->dev, ++ "Change to the same channel %d\n", ++ chan->hw_value); ++ } ++ } ++ } ++#ifdef CONFIG_P2P_NOA ++ out: ++#endif ++ mutex_unlock(&sc->mutex); ++ return ret; ++} ++ ++#define SUPPORTED_FILTERS \ ++ (FIF_ALLMULTI | \ ++ FIF_CONTROL | \ ++ FIF_PSPOLL | \ ++ FIF_OTHER_BSS | \ ++ FIF_BCN_PRBRESP_PROMISC | \ ++ FIF_PROBE_REQ | \ ++ FIF_FCSFAIL) ++static void ssv6200_config_filter(struct ieee80211_hw *hw, ++ unsigned int changed_flags, ++ unsigned int *total_flags, u64 multicast) ++{ ++ changed_flags &= SUPPORTED_FILTERS; ++ *total_flags &= SUPPORTED_FILTERS; ++} ++ ++static void ssv6200_bss_info_changed(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_bss_conf *info, ++ u64 changed) ++{ ++ struct ssv_vif_priv_data *priv_vif = (struct ssv_vif_priv_data *)vif->drv_priv; ++ struct ssv_softc *sc = hw->priv; ++#ifdef CONFIG_P2P_NOA ++ u8 null_address[6] = { 0 }; ++#endif ++ mutex_lock(&sc->mutex); ++ if (changed & BSS_CHANGED_ERP_PREAMBLE) { ++ dev_dbg(sc->dev, "BSS Changed use_short_preamble[%d]\n", ++ info->use_short_preamble); ++ if (info->use_short_preamble) ++ sc->sc_flags |= SC_OP_SHORT_PREAMBLE; ++ else ++ sc->sc_flags &= ~SC_OP_SHORT_PREAMBLE; ++ } ++ if (!priv_vif->vif_idx) { ++ if (changed & BSS_CHANGED_BSSID) { ++#ifdef CONFIG_P2P_NOA ++ struct ssv_vif_priv_data *vif_priv; ++ vif_priv = (struct ssv_vif_priv_data *)vif->drv_priv; ++#endif ++ ssv62xxx_set_bssid(sc, (u8 *) info->bssid); ++ dev_dbg(sc->dev, "BSS_CHANGED_BSSID: %02x:%02x:%02x:%02x:%02x:%02x\n", ++ info->bssid[0], info->bssid[1], info->bssid[2], ++ info->bssid[3], info->bssid[4], info->bssid[5]); ++#ifdef CONFIG_P2P_NOA ++ if (memcmp(info->bssid, null_address, 6)) ++ ssv6xxx_noa_hdl_bss_change(sc, ++ MONITOR_NOA_CONF_ADD, ++ vif_priv->vif_idx); ++ else ++ ssv6xxx_noa_hdl_bss_change(sc, ++ MONITOR_NOA_CONF_REMOVE, ++ vif_priv->vif_idx); ++#endif ++ } ++ if (changed & BSS_CHANGED_ERP_SLOT) { ++ u32 regval = 0; ++ dev_dbg(sc->dev, "BSS_CHANGED_ERP_SLOT: use_short_slot[%d]\n", ++ info->use_short_slot); ++ if (info->use_short_slot) { ++ SMAC_REG_READ(sc->sh, ADR_MTX_DUR_IFS, ®val); ++ regval = regval & MTX_DUR_SLOT_I_MSK; ++ regval |= 9 << MTX_DUR_SLOT_SFT; ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_DUR_IFS, regval); ++ SMAC_REG_READ(sc->sh, ADR_MTX_DUR_SIFS_G, ++ ®val); ++ regval = regval & MTX_DUR_BURST_SIFS_G_I_MSK; ++ regval |= 0xa << MTX_DUR_BURST_SIFS_G_SFT; ++ regval = regval & MTX_DUR_SLOT_G_I_MSK; ++ regval |= 9 << MTX_DUR_SLOT_G_SFT; ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_DUR_SIFS_G, ++ regval); ++ } else { ++ SMAC_REG_READ(sc->sh, ADR_MTX_DUR_IFS, ®val); ++ regval = regval & MTX_DUR_SLOT_I_MSK; ++ regval |= 20 << MTX_DUR_SLOT_SFT; ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_DUR_IFS, regval); ++ SMAC_REG_READ(sc->sh, ADR_MTX_DUR_SIFS_G, ++ ®val); ++ regval = regval & MTX_DUR_BURST_SIFS_G_I_MSK; ++ regval |= 0xa << MTX_DUR_BURST_SIFS_G_SFT; ++ regval = regval & MTX_DUR_SLOT_G_I_MSK; ++ regval |= 20 << MTX_DUR_SLOT_G_SFT; ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_DUR_SIFS_G, ++ regval); ++ } ++ } ++ } ++ if (changed & BSS_CHANGED_HT) { ++ dev_dbg(sc->dev, "BSS_CHANGED_HT: Untreated!!\n"); ++ } ++ if (changed & BSS_CHANGED_BASIC_RATES) { ++ dev_dbg(sc->dev, "ssv6xxx_rc_update_basic_rate!!\n"); ++ ssv6xxx_rc_update_basic_rate(sc, info->basic_rates); ++ } ++ if (vif->type == NL80211_IFTYPE_STATION) { ++ dev_dbg(sc->dev, "NL80211_IFTYPE_STATION!!\n"); ++ if ((changed & BSS_CHANGED_ASSOC) && (vif->p2p == 0)) { ++ sc->isAssoc = vif->cfg.assoc; ++ if (!sc->isAssoc) { ++ sc->channel_center_freq = 0; ++ sc->ps_aid = 0; ++#ifdef CONFIG_SSV_MRX_EN3_CTRL ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_EN3, 0x0400); ++#endif ++ SMAC_REG_WRITE(sc->sh, ADR_RX_11B_CCA_CONTROL, ++ 0x0); ++ } else { ++ struct ieee80211_channel *curchan; ++ curchan = hw->conf.chandef.chan; ++ sc->channel_center_freq = curchan->center_freq; ++ dev_dbg(sc->dev, "info->aid = %d\n", vif->cfg.aid); ++ sc->ps_aid = vif->cfg.aid; ++#ifdef CONFIG_SSV_MRX_EN3_CTRL ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_EN3, 0x1000); ++#endif ++ } ++ } ++#ifdef CONFIG_SSV_MRX_EN3_CTRL ++ else if ((changed & BSS_CHANGED_ASSOC) && vif->p2p == 1) { ++ if (info->assoc) ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_EN3, 0x0400); ++ else if (sc->ps_aid != 0) ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_EN3, 0x1000); ++ } ++#endif ++ } ++ if (vif->type == NL80211_IFTYPE_AP) { ++ if (changed & (BSS_CHANGED_BEACON ++ | BSS_CHANGED_SSID ++ | BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES)) { ++#ifdef BROADCAST_DEBUG ++ dev_dbg(sc->dev, "[A] ssv6200_bss_info_changed:beacon changed\n"); ++#endif ++ queue_work(sc->config_wq, &sc->set_tim_work); ++ } ++ if (changed & BSS_CHANGED_BEACON_INT) { ++ dev_dbg(sc->dev, "[A] BSS_CHANGED_BEACON_INT beacon_interval(%d)\n", ++ info->beacon_int); ++ if (sc->beacon_interval != info->beacon_int) { ++ sc->beacon_interval = info->beacon_int; ++ ssv6xxx_beacon_set_info(sc, sc->beacon_interval, ++ sc->beacon_dtim_cnt); ++ } ++ } ++ if (changed & BSS_CHANGED_BEACON_ENABLED) { ++#ifdef BEACON_DEBUG ++ dev_dbg(sc->dev, "[A] BSS_CHANGED_BEACON_ENABLED (0x%x)\n", ++ info->enable_beacon); ++#endif ++ if (0 != ssv6xxx_beacon_enable(sc, info->enable_beacon)) { ++ dev_err(sc->dev, "Beacon enable %d error.\n", ++ info->enable_beacon); ++ } ++ } ++ } ++ mutex_unlock(&sc->mutex); ++ dev_dbg(sc->dev, "[I] %s(): leave\n", __FUNCTION__); ++} ++ ++static int ssv6200_sta_add(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, struct ieee80211_sta *sta) ++{ ++ struct ssv_sta_priv_data *sta_priv_dat = NULL; ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_info *sta_info; ++ u32 reg_wsid[] = { ADR_WSID0, ADR_WSID1 }; ++ int s, i; ++ u32 reg_wsid_tid0[] = { ADR_WSID0_TID0_RX_SEQ, ADR_WSID1_TID0_RX_SEQ }; ++ u32 reg_wsid_tid7[] = { ADR_WSID0_TID7_RX_SEQ, ADR_WSID1_TID7_RX_SEQ }; ++ unsigned long flags; ++ int ret = 0; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ int fw_sec_caps = SSV6XXX_WSID_SEC_NONE; ++ bool tdls_use_sw_cipher = false, tdls_link = false; ++ dev_dbg(sc->dev, "[I] %s(): vif[%d] ", __FUNCTION__, vif_priv->vif_idx); ++ if (sc->force_triger_reset == true) { ++ vif_priv->sta_asleep_mask = 0; ++ do { ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ for (s = 0; s < SSV_NUM_STA; s++, sta_info++) { ++ sta_info = &sc->sta_info[s]; ++ if ((sta_info->s_flags & STA_FLAG_VALID)) { ++ if (sta_info->sta == sta) { ++ dev_dbg ++ (sc->dev, "search stat %02x:%02x:%02x:%02x:%02x:%02x to wsid=%d\n", ++ sta->addr[0], sta->addr[1], ++ sta->addr[2], sta->addr[3], ++ sta->addr[4], sta->addr[5], ++ sta_info->hw_wsid); ++ spin_unlock_irqrestore(&sc-> ++ ps_state_lock, ++ flags); ++ return ret; ++ } ++ } ++ } ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ if (s >= SSV_NUM_STA) { ++ break; ++ } ++ } while (0); ++ } ++ do { ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ if (!list_empty(&vif_priv->sta_list) ++ && vif->type == NL80211_IFTYPE_STATION) { ++ tdls_link = true; ++ } ++ if ((tdls_link) && (vif_priv->pair_cipher != SSV_CIPHER_NONE) ++ && (vif_priv->pair_cipher != SSV_CIPHER_CCMP) ++ && (sc->sh->cfg.use_wpa2_only == false)) { ++ tdls_use_sw_cipher = true; ++ } ++ if (((vif_priv->vif_idx == 0) && (tdls_use_sw_cipher == false)) ++ || sc->sh->cfg.use_wpa2_only) ++ s = 0; ++ else ++ s = 2; ++ for (; s < SSV_NUM_STA; s++) { ++ sta_info = &sc->sta_info[s]; ++ if ((sta_info->s_flags & STA_FLAG_VALID) == 0) { ++ sta_info->aid = sta->aid; ++ sta_info->sta = sta; ++ sta_info->vif = vif; ++ sta_info->s_flags = STA_FLAG_VALID; ++ sta_priv_dat = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ sta_priv_dat->sta_idx = s; ++ sta_priv_dat->sta_info = sta_info; ++ sta_priv_dat->has_hw_encrypt = false; ++ sta_priv_dat->has_hw_decrypt = false; ++ sta_priv_dat->need_sw_decrypt = false; ++ sta_priv_dat->need_sw_encrypt = false; ++ sta_priv_dat->use_mac80211_decrypt = false; ++ if ((vif_priv->pair_cipher == SSV_CIPHER_WEP40) ++ || (vif_priv->pair_cipher == ++ SSV_CIPHER_WEP104)) { ++ sta_priv_dat->has_hw_encrypt = ++ vif_priv->has_hw_encrypt; ++ sta_priv_dat->has_hw_decrypt = ++ vif_priv->has_hw_decrypt; ++ sta_priv_dat->need_sw_encrypt = ++ vif_priv->need_sw_encrypt; ++ sta_priv_dat->need_sw_decrypt = ++ vif_priv->need_sw_decrypt; ++ } ++ list_add_tail(&sta_priv_dat->list, ++ &vif_priv->sta_list); ++ break; ++ } ++ } ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ if (s >= SSV_NUM_STA) { ++ dev_err(sc->dev, ++ "Number of STA exceeds driver limitation %d\n.", ++ SSV_NUM_STA); ++ ret = -1; ++ break; ++ } ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ssv6xxx_debugfs_add_sta(sc, sta_info); ++#endif ++ sta_info->hw_wsid = -1; ++ if (sta_priv_dat->sta_idx < SSV_NUM_HW_STA) { ++ SMAC_REG_WRITE(sc->sh, reg_wsid[s] + 4, ++ *((u32 *) & sta->addr[0])); ++ SMAC_REG_WRITE(sc->sh, reg_wsid[s] + 8, ++ *((u32 *) & sta->addr[4])); ++ SMAC_REG_WRITE(sc->sh, reg_wsid[s], 1); ++ for (i = reg_wsid_tid0[s]; i <= reg_wsid_tid7[s]; ++ i += 4) ++ SMAC_REG_WRITE(sc->sh, i, 0); ++ ssv6xxx_rc_hw_reset(sc, sta_priv_dat->rc_idx, s); ++ sta_info->hw_wsid = sta_priv_dat->sta_idx; ++ } else if ((vif_priv->vif_idx == 0) ++ || sc->sh->cfg.use_wpa2_only) { ++ sta_info->hw_wsid = sta_priv_dat->sta_idx; ++ } ++ if ((sta_priv_dat->has_hw_encrypt ++ || sta_priv_dat->has_hw_decrypt) ++ && ((vif_priv->pair_cipher == SSV_CIPHER_WEP40) ++ || (vif_priv->pair_cipher == SSV_CIPHER_WEP104))) { ++ struct ssv_vif_info *vif_info = ++ &sc->vif_info[vif_priv->vif_idx]; ++ struct ssv6xxx_hw_sec *sramKey = &vif_info->sramKey; ++ _set_wep_hw_crypto_pair_key(sc, vif_info, sta_info, ++ (void *)sramKey); ++ if (sramKey->sta_key[0].pair_key_idx != 0) { ++ _set_wep_hw_crypto_group_key(sc, vif_info, ++ sta_info, ++ (void *)sramKey); ++ } ++ } ++ ssv6200_ampdu_tx_add_sta(hw, sta); ++ if (sta_info->hw_wsid >= SSV_NUM_HW_STA) { ++ if (sta_priv_dat->has_hw_decrypt) ++ fw_sec_caps = SSV6XXX_WSID_SEC_PAIRWISE; ++ if (vif_priv->has_hw_decrypt) ++ fw_sec_caps |= SSV6XXX_WSID_SEC_GROUP; ++ hw_update_watch_wsid(sc, sta, sta_info, ++ sta_priv_dat->sta_idx, fw_sec_caps, ++ SSV6XXX_WSID_OPS_ADD); ++ } else if (SSV6200_USE_HW_WSID(sta_priv_dat->sta_idx)) { ++ hw_update_watch_wsid(sc, sta, sta_info, ++ sta_priv_dat->sta_idx, ++ SSV6XXX_WSID_SEC_SW, ++ SSV6XXX_WSID_OPS_HWWSID_PAIRWISE_SET_TYPE); ++ hw_update_watch_wsid(sc, sta, sta_info, ++ sta_priv_dat->sta_idx, ++ SSV6XXX_WSID_SEC_SW, ++ SSV6XXX_WSID_OPS_HWWSID_GROUP_SET_TYPE); ++ } ++ dev_dbg ++ (sc->dev, "Add %02x:%02x:%02x:%02x:%02x:%02x to VIF %d sw_idx=%d, wsid=%d\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], sta->addr[3], ++ sta->addr[4], sta->addr[5], vif_priv->vif_idx, ++ sta_priv_dat->sta_idx, sta_info->hw_wsid); ++ } while (0); ++ return ret; ++} ++ ++void ssv6200_rx_flow_check(struct ssv_sta_priv_data *sta_priv_dat, ++ struct ssv_softc *sc) ++{ ++ if (SSV6200_USE_HW_WSID(sta_priv_dat->sta_idx) ++ && (sta_priv_dat->need_sw_decrypt)) { ++ int other_hw_wsid = (sta_priv_dat->sta_idx + 1) & 1; ++ struct ssv_sta_info *sta_info = &sc->sta_info[other_hw_wsid]; ++ struct ieee80211_sta *sta = sta_info->sta; ++ struct ssv_sta_priv_data *sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ mutex_lock(&sc->mutex); ++ if ((sta_info->s_flags == 0) ++ || ((sta_info->s_flags && STA_FLAG_VALID) ++ && (sta_priv->has_hw_decrypt))) { ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_DATA, ++ M_ENG_MACRX | (M_ENG_ENCRYPT_SEC << 4) | ++ (M_ENG_HWHCI << 8)); ++ dev_dbg(sc->dev, "redirect Rx flow for sta %d disconnect\n", ++ sta_priv_dat->sta_idx); ++ } ++ mutex_unlock(&sc->mutex); ++ } ++} ++ ++static int ssv6200_sta_remove(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta) ++{ ++ u32 reg_wsid[] = { ADR_WSID0, ADR_WSID1 }; ++ struct ssv_sta_priv_data *sta_priv_dat = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_info *sta_info = sta_priv_dat->sta_info; ++ unsigned long flags; ++ u32 bit; ++ struct ssv_vif_priv_data *priv_vif = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ u8 hw_wsid = -1; ++ BUG_ON(sta_priv_dat->sta_idx >= SSV_NUM_STA); ++ dev_notice(sc->dev, ++ "Removing STA %d (%02X:%02X:%02X:%02X:%02X:%02X) from VIF %d\n.", ++ sta_priv_dat->sta_idx, sta->addr[0], sta->addr[1], ++ sta->addr[2], sta->addr[3], sta->addr[4], sta->addr[5], ++ priv_vif->vif_idx); ++ ssv6200_rx_flow_check(sta_priv_dat, sc); ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ bit = BIT(sta_priv_dat->sta_idx); ++ priv_vif->sta_asleep_mask &= ~bit; ++ if (sta_info->hw_wsid != -1) { ++ hw_wsid = sta_info->hw_wsid; ++ } ++ if (sta_info->hw_wsid >= SSV_NUM_HW_STA) { ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ hw_update_watch_wsid(sc, sta, sta_info, sta_info->hw_wsid, 0, ++ SSV6XXX_WSID_OPS_DEL); ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ } ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ { ++ ssv6xxx_debugfs_remove_sta(sc, sta_info); ++ } ++#endif ++ memset(sta_info, 0, sizeof(*sta_info)); ++ sta_priv_dat->sta_idx = -1; ++ list_del(&sta_priv_dat->list); ++ if (list_empty(&priv_vif->sta_list) ++ && vif->type == NL80211_IFTYPE_STATION) { ++ priv_vif->pair_cipher = 0; ++ priv_vif->group_cipher = 0; ++ } ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++ if ((hw_wsid != -1) && (hw_wsid < SSV_NUM_HW_STA)) ++ SMAC_REG_WRITE(sc->sh, reg_wsid[hw_wsid], 0x00); ++ return 0; ++} ++ ++static void ssv6200_sta_notify(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ enum sta_notify_cmd cmd, ++ struct ieee80211_sta *sta) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_vif_priv_data *priv_vif = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ struct ssv_sta_priv_data *sta_priv_dat = ++ sta != NULL ? (struct ssv_sta_priv_data *)sta->drv_priv : NULL; ++ struct ssv_sta_info *sta_info; ++ u32 bit, prev; ++ unsigned long flags; ++ spin_lock_irqsave(&sc->ps_state_lock, flags); ++ if (sta_priv_dat != NULL) { ++ bit = BIT(sta_priv_dat->sta_idx); ++ prev = priv_vif->sta_asleep_mask & bit; ++ sta_info = sta_priv_dat->sta_info; ++ switch (cmd) { ++ case STA_NOTIFY_SLEEP: ++ if (!prev) { ++ sta_info->sleeping = true; ++ if ((vif->type == NL80211_IFTYPE_AP) ++ && sc->bq4_dtim ++ && !priv_vif->sta_asleep_mask ++ && ssv6200_bcast_queue_len(&sc-> ++ bcast_txq)) { ++ dev_dbg(sc->dev, "%s(): ssv6200_bcast_start\n", __FUNCTION__); ++ ssv6200_bcast_start(sc); ++ } ++ priv_vif->sta_asleep_mask |= bit; ++ } ++ break; ++ case STA_NOTIFY_AWAKE: ++ if (prev) { ++ sta_info->sleeping = false; ++ priv_vif->sta_asleep_mask &= ~bit; ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ spin_unlock_irqrestore(&sc->ps_state_lock, flags); ++} ++ ++static u64 ssv6200_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ++{ ++ return jiffies * 1000 * 1000 / HZ; ++} ++ ++static u64 ssv6200_get_systime_us(void) ++{ ++#if LINUX_VERSION_CODE > KERNEL_VERSION(4,19,0) ++ struct timespec64 ts; ++ ktime_get_boottime_ts64(&ts); ++#else ++ struct timespec ts; ++ get_monotonic_boottime(&ts); ++#endif ++ return ((u64) ts.tv_sec * 1000000) + ts.tv_nsec / 1000; ++} ++ ++static u32 pre_11b_cca_control; ++static u32 pre_11b_cca_1; ++static void ssv6200_sw_scan_start(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ const u8 * mac_addr) ++{ ++ ((struct ssv_softc *)(hw->priv))->bScanning = true; ++ SMAC_REG_READ(((struct ssv_softc *)(hw->priv))->sh, ++ ADR_RX_11B_CCA_CONTROL, &pre_11b_cca_control); ++ SMAC_REG_WRITE(((struct ssv_softc *)(hw->priv))->sh, ++ ADR_RX_11B_CCA_CONTROL, 0x0); ++ SMAC_REG_READ(((struct ssv_softc *)(hw->priv))->sh, ADR_RX_11B_CCA_1, ++ &pre_11b_cca_1); ++ SMAC_REG_WRITE(((struct ssv_softc *)(hw->priv))->sh, ADR_RX_11B_CCA_1, ++ RX_11B_CCA_IN_SCAN); ++#ifdef CONFIG_SSV_MRX_EN3_CTRL ++ SMAC_REG_WRITE(((struct ssv_softc *)(hw->priv))->sh, ADR_MRX_FLT_EN3, ++ 0x0400); ++#endif ++} ++ ++static void ssv6200_sw_scan_complete(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ ++#ifdef CONFIG_SSV_MRX_EN3_CTRL ++ bool is_p2p_assoc; ++#endif ++ ((struct ssv_softc *)(hw->priv))->bScanning = false; ++ SMAC_REG_WRITE(((struct ssv_softc *)(hw->priv))->sh, ++ ADR_RX_11B_CCA_CONTROL, pre_11b_cca_control); ++ SMAC_REG_WRITE(((struct ssv_softc *)(hw->priv))->sh, ADR_RX_11B_CCA_1, ++ pre_11b_cca_1); ++#ifdef CONFIG_SSV_MRX_EN3_CTRL ++ is_p2p_assoc = ++ ((struct ssv_softc *)(hw->priv))->vif_info[1].vif->bss_conf.assoc; ++ if (((struct ssv_softc *)(hw->priv))->ps_aid != 0 && (!is_p2p_assoc)) ++ SMAC_REG_WRITE(((struct ssv_softc *)(hw->priv))->sh, ++ ADR_MRX_FLT_EN3, 0x1000); ++#endif ++} ++ ++static int ssv6200_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, ++ bool set) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_sta_info *sta_info = sta ++ ? ((struct ssv_sta_priv_data *)sta->drv_priv)->sta_info : NULL; ++ if (sta_info && (sta_info->tim_set ^ set)) { ++ dev_dbg(sc->dev, "[I] [A] ssvcabrio_set_tim"); ++ sta_info->tim_set = set; ++ queue_work(sc->config_wq, &sc->set_tim_work); ++ } ++ return 0; ++} ++ ++static int ssv6200_conf_tx(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, u32 link_id, u16 queue, ++ const struct ieee80211_tx_queue_params *params) ++{ ++ struct ssv_softc *sc = hw->priv; ++ u32 cw; ++ u8 hw_txqid = sc->tx.hw_txqid[queue]; ++ struct ssv_vif_priv_data *priv_vif = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ dev_dbg ++ (sc->dev, "[I] sv6200_conf_tx vif[%d] qos[%d] queue[%d] aifsn[%d] cwmin[%d] cwmax[%d] txop[%d] \n", ++ priv_vif->vif_idx, vif->bss_conf.qos, queue, params->aifs, ++ params->cw_min, params->cw_max, params->txop); ++ if (queue > NL80211_TXQ_Q_BK) ++ return 1; ++ if (priv_vif->vif_idx != 0) { ++ dev_warn(sc->dev, ++ "WMM setting applicable to primary interface only.\n"); ++ return 1; ++ } ++ mutex_lock(&sc->mutex); ++ SMAC_REG_SET_BITS(sc->sh, ADR_GLBLE_SET, ++ (vif->bss_conf.qos << QOS_EN_SFT), QOS_EN_MSK); ++ cw = (params->aifs - 1) & 0xf; ++ cw |= ((ilog2(params->cw_min + 1)) & 0xf) << TXQ1_MTX_Q_ECWMIN_SFT; ++ cw |= ((ilog2(params->cw_max + 1)) & 0xf) << TXQ1_MTX_Q_ECWMAX_SFT; ++ cw |= ((params->txop) & 0xff) << TXQ1_MTX_Q_TXOP_LIMIT_SFT; ++ SMAC_REG_WRITE(sc->sh, ADR_TXQ0_MTX_Q_AIFSN + 0x100 * hw_txqid, cw); ++ mutex_unlock(&sc->mutex); ++ return 0; ++} ++ ++static int ssv6200_ampdu_action(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_ampdu_params *params) ++{ ++ struct ssv_softc *sc = hw->priv; ++ int ret = 0; ++ struct ieee80211_sta *sta = params->sta; ++ enum ieee80211_ampdu_mlme_action action = params->action; ++ u16 tid = params->tid; ++ u16 *ssn = &(params->ssn); ++ u8 buf_size = params->buf_size; ++ if (sta == NULL) ++ return ret; ++#if (!Enable_AMPDU_Rx) ++ if (action == IEEE80211_AMPDU_RX_START ++ || action == IEEE80211_AMPDU_RX_STOP) { ++ ampdu_db_log("Disable AMPDU_RX for test(1).\n"); ++ return -EOPNOTSUPP; ++ } ++#endif ++#if (!Enable_AMPDU_Tx) ++ if (action == IEEE80211_AMPDU_TX_START ++ || action == IEEE80211_AMPDU_TX_STOP ++ || action == IEEE80211_AMPDU_TX_OPERATIONAL) { ++ ampdu_db_log("Disable AMPDU_TX for test(1).\n"); ++ return -EOPNOTSUPP; ++ } ++#endif ++ if ((action == IEEE80211_AMPDU_RX_START ++ || action == IEEE80211_AMPDU_RX_STOP) ++ && (!(sc->sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_RX))) { ++ ampdu_db_log("Disable AMPDU_RX(2).\n"); ++ return -EOPNOTSUPP; ++ } ++ if ((action == IEEE80211_AMPDU_TX_START ++ || action == IEEE80211_AMPDU_TX_STOP_CONT ++ || action == IEEE80211_AMPDU_TX_STOP_FLUSH ++ || action == IEEE80211_AMPDU_TX_STOP_FLUSH_CONT ++ || action == IEEE80211_AMPDU_TX_OPERATIONAL) ++ && (!(sc->sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_TX))) { ++ ampdu_db_log("Disable AMPDU_TX(2).\n"); ++ return -EOPNOTSUPP; ++ } ++ switch (action) { ++ case IEEE80211_AMPDU_RX_START: ++#ifdef WIFI_CERTIFIED ++ if (sc->rx_ba_session_count >= SSV6200_RX_BA_MAX_SESSIONS) { ++ ieee80211_stop_rx_ba_session(vif, ++ (1 << (sc->ba_tid)), ++ sc->ba_ra_addr); ++ sc->rx_ba_session_count--; ++ } ++#else ++ if ((sc->rx_ba_session_count >= SSV6200_RX_BA_MAX_SESSIONS) ++ && (sc->rx_ba_sta != sta)) { ++ ret = -EBUSY; ++ break; ++ } else ++ if ((sc->rx_ba_session_count >= SSV6200_RX_BA_MAX_SESSIONS) ++ && (sc->rx_ba_sta == sta)) { ++ ieee80211_stop_rx_ba_session(vif, (1 << (sc->ba_tid)), ++ sc->ba_ra_addr); ++ sc->rx_ba_session_count--; ++ } ++#endif ++ dev_dbg(sc->dev, "IEEE80211_AMPDU_RX_START %02X:%02X:%02X:%02X:%02X:%02X %d.\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], sta->addr[3], ++ sta->addr[4], sta->addr[5], tid); ++ sc->rx_ba_session_count++; ++ sc->rx_ba_sta = sta; ++ sc->ba_tid = tid; ++ sc->ba_ssn = *ssn; ++ memcpy(sc->ba_ra_addr, sta->addr, ETH_ALEN); ++ queue_work(sc->config_wq, &sc->set_ampdu_rx_add_work); ++ break; ++ case IEEE80211_AMPDU_RX_STOP: ++ sc->rx_ba_session_count--; ++ if (sc->rx_ba_session_count == 0) ++ sc->rx_ba_sta = NULL; ++ queue_work(sc->config_wq, &sc->set_ampdu_rx_del_work); ++ break; ++ case IEEE80211_AMPDU_TX_START: ++ dev_dbg(sc->dev, "AMPDU_TX_START %02X:%02X:%02X:%02X:%02X:%02X %d.\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], sta->addr[3], ++ sta->addr[4], sta->addr[5], tid); ++ ssv6200_ampdu_tx_start(tid, sta, hw, ssn); ++ ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); ++ break; ++ case IEEE80211_AMPDU_TX_STOP_CONT: ++ case IEEE80211_AMPDU_TX_STOP_FLUSH: ++ case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: ++ dev_dbg(sc->dev, "AMPDU_TX_STOP %02X:%02X:%02X:%02X:%02X:%02X %d.\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], sta->addr[3], ++ sta->addr[4], sta->addr[5], tid); ++ ssv6200_ampdu_tx_stop(tid, sta, hw); ++ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); ++ break; ++ case IEEE80211_AMPDU_TX_OPERATIONAL: ++ dev_dbg(sc->dev, "AMPDU_TX_OPERATIONAL %02X:%02X:%02X:%02X:%02X:%02X %d.\n", ++ sta->addr[0], sta->addr[1], sta->addr[2], sta->addr[3], ++ sta->addr[4], sta->addr[5], tid); ++ ssv6200_ampdu_tx_operation(tid, sta, hw, buf_size); ++ break; ++ default: ++ ret = -EOPNOTSUPP; ++ break; ++ } ++ return ret; ++} ++ ++#ifdef CONFIG_PM ++int ssv6xxx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) ++{ ++ return 0; ++} ++ ++int ssv6xxx_resume(struct ieee80211_hw *hw) ++{ ++ return 0; ++} ++#endif ++struct ieee80211_ops ssv6200_ops = { ++ .tx = ssv6200_tx, ++ .start = ssv6200_start, ++ .stop = ssv6200_stop, ++ .add_interface = ssv6200_add_interface, ++ .remove_interface = ssv6200_remove_interface, ++ .change_interface = ssv6200_change_interface, ++ .config = ssv6200_config, ++ .configure_filter = ssv6200_config_filter, ++ .bss_info_changed = ssv6200_bss_info_changed, ++ .sta_add = ssv6200_sta_add, ++ .sta_remove = ssv6200_sta_remove, ++ .sta_notify = ssv6200_sta_notify, ++ .set_key = ssv6200_set_key, ++ .sw_scan_start = ssv6200_sw_scan_start, ++ .sw_scan_complete = ssv6200_sw_scan_complete, ++ .get_tsf = ssv6200_get_tsf, ++ .set_tim = ssv6200_set_tim, ++ .conf_tx = ssv6200_conf_tx, ++ .ampdu_action = ssv6200_ampdu_action, ++ .wake_tx_queue = ieee80211_handle_wake_tx_queue, ++#ifdef CONFIG_PM ++ .suspend = ssv6xxx_suspend, ++ .resume = ssv6xxx_resume, ++#endif ++}; ++ ++int ssv6200_tx_flow_control(void *dev, int hw_txqid, bool fc_en, int debug) ++{ ++ struct ssv_softc *sc = dev; ++ int ac; ++ BUG_ON(hw_txqid > 4); ++ if (hw_txqid == 4) ++ return 0; ++ ac = sc->tx.ac_txqid[hw_txqid]; ++ if (fc_en == false) { ++ if (sc->tx.flow_ctrl_status & (1 << ac)) { ++ ieee80211_wake_queue(sc->hw, ac); ++ sc->tx.flow_ctrl_status &= ~(1 << ac); ++ } else { ++ } ++ } else { ++ if ((sc->tx.flow_ctrl_status & (1 << ac)) == 0) { ++ ieee80211_stop_queue(sc->hw, ac); ++ sc->tx.flow_ctrl_status |= (1 << ac); ++ } else { ++ } ++ } ++ return 0; ++} ++ ++void ssv6xxx_tx_q_empty_cb(u32 txq_no, void *cb_data) ++{ ++ struct ssv_softc *sc = cb_data; ++ BUG_ON(sc == NULL); ++ sc->tx_q_empty = true; ++ smp_mb(); ++ wake_up_interruptible(&sc->tx_wait_q); ++} ++ ++struct ssv6xxx_b_cca_control { ++ u32 down_level; ++ u32 upper_level; ++ u32 adjust_cca_control; ++ u32 adjust_cca_1; ++}; ++struct ssv6xxx_b_cca_control adjust_cci[] = { ++ {0, 43, 0x00162000, 0x20380050}, ++ {40, 48, 0x00161000, 0x20380050}, ++ {45, 53, 0x00160800, 0x20380050}, ++ {50, 63, 0x00160400, 0x20380050}, ++ {60, 68, 0x00160200, 0x20380050}, ++ {65, 73, 0x00160100, 0x20380050}, ++ {70, 128, 0x00000000, 0x20300050}, ++}; ++ ++#define MAX_CCI_LEVEL 128 ++static unsigned long last_jiffies = INITIAL_JIFFIES; ++static s32 size = sizeof(adjust_cci) / sizeof(adjust_cci[0]); ++static u32 current_level = MAX_CCI_LEVEL; ++static u32 current_gate = (sizeof(adjust_cci) / sizeof(adjust_cci[0])) - 1; ++void mitigate_cci(struct ssv_softc *sc, u32 input_level) ++{ ++ s32 i; ++ if (input_level > MAX_CCI_LEVEL) { ++ dev_dbg(sc->dev, "mitigate_cci input error[%d]!!\n", input_level); ++ return; ++ } ++ if (time_after(jiffies, last_jiffies + msecs_to_jiffies(3000))) { ++ dev_dbg(sc->dev, "jiffies=%lu, input_level=%d\n", jiffies, input_level); ++ last_jiffies = jiffies; ++ if ((input_level >= adjust_cci[current_gate].down_level) ++ && (input_level <= adjust_cci[current_gate].upper_level)) { ++ current_level = input_level; ++#ifdef DEBUG_MITIGATE_CCI ++ dev_dbg(sc->dev, "Keep the 0xce0020a0[%x] 0xce002008[%x]!!\n", ++ adjust_cci[current_gate].adjust_cca_control, ++ adjust_cci[current_gate].adjust_cca_1); ++#endif ++ } else { ++ if (current_level < input_level) { ++ for (i = 0; i < size; i++) { ++ if (input_level <= ++ adjust_cci[i].upper_level) { ++#ifdef DEBUG_MITIGATE_CCI ++ dev_dbg(sc->dev, "gate=%d, input_level=%d, adjust_cci[%d].upper_level=%d, value=%08x\n", ++ current_gate, input_level, ++ i, ++ adjust_cci[i].upper_level, ++ adjust_cci[i]. ++ adjust_cca_control); ++#endif ++ current_level = input_level; ++ current_gate = i; ++ SMAC_REG_WRITE(sc->sh, ++ ADR_RX_11B_CCA_CONTROL, ++ adjust_cci[i]. ++ adjust_cca_control); ++ SMAC_REG_WRITE(sc->sh, ++ ADR_RX_11B_CCA_1, ++ adjust_cci[i]. ++ adjust_cca_1); ++#ifdef DEBUG_MITIGATE_CCI ++ dev_dbg(sc->dev, "##Set to the 0xce0020a0[%x] 0xce002008[%x]##!!\n", ++ adjust_cci[current_gate]. ++ adjust_cca_control, ++ adjust_cci[current_gate]. ++ adjust_cca_1); ++#endif ++ return; ++ } ++ } ++ } else { ++ for (i = (size - 1); i >= 0; i--) { ++ if (input_level >= ++ adjust_cci[i].down_level) { ++#ifdef DEBUG_MITIGATE_CCI ++ dev_dbg(sc->dev, "gate=%d, input_level=%d, adjust_cci[%d].down_level=%d, value=%08x\n", ++ current_gate, input_level, ++ i, ++ adjust_cci[i].down_level, ++ adjust_cci[i]. ++ adjust_cca_control); ++#endif ++ current_level = input_level; ++ current_gate = i; ++ SMAC_REG_WRITE(sc->sh, ++ ADR_RX_11B_CCA_CONTROL, ++ adjust_cci[i]. ++ adjust_cca_control); ++ SMAC_REG_WRITE(sc->sh, ++ ADR_RX_11B_CCA_1, ++ adjust_cci[i]. ++ adjust_cca_1); ++#ifdef DEBUG_MITIGATE_CCI ++ dev_dbg(sc->dev, "##Set to the 0xce0020a0[%x] 0xce002008[%x]##!!\n", ++ adjust_cci[current_gate]. ++ adjust_cca_control, ++ adjust_cci[current_gate]. ++ adjust_cca_1); ++#endif ++ return; ++ } ++ } ++ } ++ } ++ } ++} ++ ++#define RSSI_SMOOTHING_SHIFT 5 ++#define RSSI_DECIMAL_POINT_SHIFT 6 ++static void _proc_data_rx_skb(struct ssv_softc *sc, struct sk_buff *rx_skb) ++{ ++ struct ieee80211_rx_status *rxs; ++ struct ieee80211_hdr *hdr; ++ __le16 fc; ++ struct ssv6200_rx_desc *rxdesc; ++ struct ssv6200_rxphy_info_padding *rxphypad; ++ struct ssv6200_rxphy_info *rxphy; ++ struct ieee80211_channel *chan; ++ struct ieee80211_vif *vif = NULL; ++ struct ieee80211_sta *sta = NULL; ++ bool rx_hw_dec = false; ++ bool do_sw_dec = false; ++ struct ssv_sta_priv_data *sta_priv = NULL; ++ struct ssv_vif_priv_data *vif_priv = NULL; ++ SKB_info *skb_info = NULL; ++ u8 is_beacon; ++ u8 is_probe_resp; ++ s32 found = 0; ++#ifdef CONFIG_SSV_SMARTLINK ++ { ++ extern int ksmartlink_smartlink_started(void); ++ void smartlink_nl_send_msg(struct sk_buff *skb); ++ if (unlikely(ksmartlink_smartlink_started())) { ++ skb_pull(rx_skb, SSV6XXX_RX_DESC_LEN); ++ skb_trim(rx_skb, rx_skb->len - sc->sh->rx_pinfo_pad); ++ smartlink_nl_send_msg(rx_skb); ++ return; ++ } ++ } ++#endif ++ rxdesc = (struct ssv6200_rx_desc *)rx_skb->data; ++ rxphy = (struct ssv6200_rxphy_info *)(rx_skb->data + sizeof(*rxdesc)); ++ rxphypad = ++ (struct ssv6200_rxphy_info_padding *)(rx_skb->data + rx_skb->len - ++ sizeof(struct ++ ssv6200_rxphy_info_padding)); ++ hdr = (struct ieee80211_hdr *)(rx_skb->data + SSV6XXX_RX_DESC_LEN); ++ fc = hdr->frame_control; ++ skb_info = (SKB_info *) rx_skb->head; ++ if (rxdesc->wsid >= SSV_RC_MAX_HARDWARE_SUPPORT) { ++ if ((ieee80211_is_data(hdr->frame_control)) ++ && (!(ieee80211_is_nullfunc(hdr->frame_control)))) { ++ ssv6xxx_rc_rx_data_handler(sc->hw, rx_skb, ++ rxdesc->rate_idx); ++ } ++ } ++ rxs = IEEE80211_SKB_RXCB(rx_skb); ++ memset(rxs, 0, sizeof(struct ieee80211_rx_status)); ++ ssv6xxx_rc_mac8011_rate_idx(sc, rxdesc->rate_idx, rxs); ++ ++ rxs->mactime = *((u32 *) & rx_skb->data[28]); ++ chan = sc->hw->conf.chandef.chan; ++ rxs->band = chan->band; ++ rxs->freq = chan->center_freq; ++ rxs->antenna = 1; ++ is_beacon = ieee80211_is_beacon(hdr->frame_control); ++ is_probe_resp = ieee80211_is_probe_resp(hdr->frame_control); ++ if (is_beacon) //+++ ++ { ++ struct ieee80211_mgmt *mgmt_tmp = NULL; ++ mgmt_tmp = ++ (struct ieee80211_mgmt *)(rx_skb->data + ++ SSV6XXX_RX_DESC_LEN); ++ mgmt_tmp->u.beacon.timestamp = ++ cpu_to_le64(ssv6200_get_systime_us()); ++ } ++ if (is_probe_resp) { ++ struct ieee80211_mgmt *mgmt_tmp = NULL; ++ mgmt_tmp = ++ (struct ieee80211_mgmt *)(rx_skb->data + ++ SSV6XXX_RX_DESC_LEN); ++ mgmt_tmp->u.probe_resp.timestamp = ++ cpu_to_le64(ssv6200_get_systime_us()); ++ } ++ ++ if (rxdesc->rate_idx < SSV62XX_G_RATE_INDEX && rxphypad->RSVD == 0) { ++ if (is_beacon || is_probe_resp) { ++ sta = ssv6xxx_find_sta_by_rx_skb(sc, rx_skb); ++ if (sta) { ++ sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++#ifdef SSV_RSSI_DEBUG ++ dev_dbg(sc->dev, "b_beacon %02X:%02X:%02X:%02X:%02X:%02X rssi=%d, snr=%d\n", ++ hdr->addr2[0], hdr->addr2[1], ++ hdr->addr2[2], hdr->addr2[3], ++ hdr->addr2[4], hdr->addr2[5], ++ rxphypad->rpci, rxphypad->snr); ++#endif ++ if (sta_priv->beacon_rssi) { ++ sta_priv->beacon_rssi = ++ ((rxphypad-> ++ rpci << RSSI_DECIMAL_POINT_SHIFT) ++ + ++ ((sta_priv-> ++ beacon_rssi << ++ RSSI_SMOOTHING_SHIFT) - ++ sta_priv-> ++ beacon_rssi)) >> ++ RSSI_SMOOTHING_SHIFT; ++ rxphypad->rpci = ++ (sta_priv-> ++ beacon_rssi >> ++ RSSI_DECIMAL_POINT_SHIFT); ++ } else ++ sta_priv->beacon_rssi = ++ (rxphypad-> ++ rpci << RSSI_DECIMAL_POINT_SHIFT); ++#ifdef SSV_RSSI_DEBUG ++ dev_dbg(sc->dev, "Beacon smoothing RSSI %d\n", rxphypad->rpci); ++#endif ++ mitigate_cci(sc, rxphypad->rpci); ++ } else { ++ mutex_lock(&sc->mutex); ++ list_for_each_entry(p_rssi_res, ++ &rssi_res.rssi_list, ++ rssi_list) { ++ if (!memcmp ++ (p_rssi_res->bssid, hdr->addr2, ++ ETH_ALEN)) { ++ { ++ p_rssi_res->rssi = ++ ((rxphypad-> ++ rpci << ++ RSSI_DECIMAL_POINT_SHIFT) ++ + ++ ((p_rssi_res-> ++ rssi << ++ RSSI_SMOOTHING_SHIFT) ++ - ++ p_rssi_res-> ++ rssi)) >> ++ RSSI_SMOOTHING_SHIFT; ++ rxphypad->rpci = ++ (p_rssi_res-> ++ rssi >> ++ RSSI_DECIMAL_POINT_SHIFT); ++ } ++ p_rssi_res->cache_jiffies = ++ jiffies; ++ found = 1; ++ break; ++ } else { ++ if (p_rssi_res->rssi) { ++ if (time_after ++ (jiffies, ++ p_rssi_res-> ++ cache_jiffies + ++ msecs_to_jiffies ++ (40000))) { ++ p_rssi_res-> ++ timeout = 1; ++ } ++ } ++ } ++ } ++ if (!found) { ++ p_rssi_res = ++ kmalloc(sizeof(struct rssi_res_st), ++ GFP_KERNEL); ++ memcpy(p_rssi_res->bssid, hdr->addr2, ++ ETH_ALEN); ++ p_rssi_res->cache_jiffies = jiffies; ++ p_rssi_res->rssi = ++ (rxphypad-> ++ rpci << RSSI_DECIMAL_POINT_SHIFT); ++ p_rssi_res->timeout = 0; ++ INIT_LIST_HEAD(&p_rssi_res->rssi_list); ++ list_add_tail_rcu(& ++ (p_rssi_res-> ++ rssi_list), ++ &(rssi_res. ++ rssi_list)); ++ } ++ mutex_unlock(&sc->mutex); ++ } ++ if (rxphypad->rpci > 88) ++ rxphypad->rpci = 88; ++ } ++ if (sc->sh->cfg.rssi_ctl) { ++ rxs->signal = (-rxphypad->rpci) + sc->sh->cfg.rssi_ctl; ++ } else { ++ rxs->signal = (-rxphypad->rpci); ++ } ++ } else if (rxdesc->rate_idx >= SSV62XX_G_RATE_INDEX ++ && rxphy->service == 0) { ++ if (is_beacon || is_probe_resp) { ++ sta = ssv6xxx_find_sta_by_rx_skb(sc, rx_skb); ++ if (sta) { ++ sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++#ifdef SSV_RSSI_DEBUG ++ dev_dbg(sc->dev, "gn_beacon %02X:%02X:%02X:%02X:%02X:%02X rssi=%d, snr=%d\n", ++ hdr->addr2[0], hdr->addr2[1], ++ hdr->addr2[2], hdr->addr2[3], ++ hdr->addr2[4], hdr->addr2[5], rxphy->rpci, ++ rxphy->snr); ++#endif ++ if (sta_priv->beacon_rssi) { ++ sta_priv->beacon_rssi = ++ ((rxphy-> ++ rpci << RSSI_DECIMAL_POINT_SHIFT) ++ + ++ ((sta_priv-> ++ beacon_rssi << ++ RSSI_SMOOTHING_SHIFT) - ++ sta_priv-> ++ beacon_rssi)) >> ++ RSSI_SMOOTHING_SHIFT; ++ rxphy->rpci = ++ (sta_priv-> ++ beacon_rssi >> ++ RSSI_DECIMAL_POINT_SHIFT); ++ } else ++ sta_priv->beacon_rssi = ++ (rxphy-> ++ rpci << RSSI_DECIMAL_POINT_SHIFT); ++#ifdef SSV_RSSI_DEBUG ++ dev_dbg(sc->dev, "Beacon smoothing RSSI %d\n", rxphy->rpci); ++#endif ++ } ++ if (rxphy->rpci > 88) ++ rxphy->rpci = 88; ++ } ++ if (sc->sh->cfg.rssi_ctl) { ++ rxs->signal = (-rxphy->rpci) + sc->sh->cfg.rssi_ctl; ++ } else { ++ rxs->signal = (-rxphy->rpci); ++ } ++ } else { ++#ifdef SSV_RSSI_DEBUG ++ dev_dbg(sc->dev, "########unicast: %d, b_rssi/snr: %d/%d, gn_rssi/snr: %d/%d, rate:%d###############\n", ++ rxdesc->unicast, (-rxphy->rpci), rxphy->snr, ++ (-rxphypad->rpci), rxphypad->snr, rxdesc->rate_idx); ++ dev_dbg(sc->dev, "RSSI, %d, rate_idx, %d\n", rxs->signal, ++ rxdesc->rate_idx); ++ dev_dbg(sc->dev, "rxdesc->RxResult = %x,rxdesc->wsid = %d\n", ++ rxdesc->RxResult, rxdesc->wsid); ++#endif ++ sta = ssv6xxx_find_sta_by_rx_skb(sc, rx_skb); ++ if (sta) { ++ sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ rxs->signal = ++ -(sta_priv-> ++ beacon_rssi >> RSSI_DECIMAL_POINT_SHIFT); ++ } ++#ifdef SSV_RSSI_DEBUG ++ dev_dbg(sc->dev, "Others signal %d\n", rxs->signal); ++#endif ++ } ++// rxs->flag = RX_FLAG_MACTIME_START; //+++ ++ rxs->rx_flags = 0; ++ if (rxphy->aggregate) ++ rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; ++ sc->hw_mng_used = rxdesc->mng_used; ++ if ((ieee80211_is_data(fc) || ieee80211_is_data_qos(fc)) ++ && ieee80211_has_protected(fc)) { ++ sta = ssv6xxx_find_sta_by_rx_skb(sc, rx_skb); ++ if (sta == NULL) ++ goto drop_rx; ++ sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ vif = sta_priv->sta_info->vif; ++ if (vif == NULL) ++ goto drop_rx; ++ if (is_broadcast_ether_addr(hdr->addr1) || is_multicast_ether_addr(hdr->addr1)) { ++ vif_priv = (struct ssv_vif_priv_data *)vif->drv_priv; ++ rx_hw_dec = vif_priv->has_hw_decrypt; ++ do_sw_dec = vif_priv->need_sw_decrypt; ++ } else { ++ rx_hw_dec = sta_priv->has_hw_decrypt; ++ do_sw_dec = sta_priv->need_sw_decrypt; ++ } ++ } ++ skb_pull(rx_skb, SSV6XXX_RX_DESC_LEN); ++ skb_trim(rx_skb, rx_skb->len - sc->sh->rx_pinfo_pad); ++#ifdef CONFIG_P2P_NOA ++ if (is_beacon) ++ ssv6xxx_noa_detect(sc, hdr, rx_skb->len); ++#endif ++ if (rx_hw_dec || do_sw_dec) { ++ hdr = (struct ieee80211_hdr *)rx_skb->data; ++ rxs = IEEE80211_SKB_RXCB(rx_skb); ++ hdr->frame_control = ++ hdr-> ++ frame_control & ~(cpu_to_le16(IEEE80211_FCTL_PROTECTED)); ++ rxs->flag |= (RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED); ++ } ++#if defined(USE_THREAD_RX) && !defined(IRQ_PROC_RX_DATA) ++ local_bh_disable(); ++ ieee80211_rx(sc->hw, rx_skb); ++ local_bh_enable(); ++#else ++ ieee80211_rx_irqsafe(sc->hw, rx_skb); ++#endif ++ return; ++ drop_rx: ++ dev_kfree_skb_any(rx_skb); ++} ++ ++#ifdef IRQ_PROC_RX_DATA ++static struct sk_buff *_proc_rx_skb(struct ssv_softc *sc, ++ struct sk_buff *rx_skb) ++{ ++ struct ieee80211_hdr *hdr = ++ (struct ieee80211_hdr *)(rx_skb->data + SSV6XXX_RX_DESC_LEN); ++ struct ssv6200_rx_desc *rxdesc = (struct ssv6200_rx_desc *)rx_skb->data; ++ if (ieee80211_is_back(hdr->frame_control) ++ || (rxdesc->c_type == HOST_EVENT)) ++ return rx_skb; ++ _proc_data_rx_skb(sc, rx_skb); ++ return NULL; ++} ++#endif ++void _process_rx_q(struct ssv_softc *sc, struct sk_buff_head *rx_q, ++ spinlock_t * rx_q_lock) ++{ ++ struct sk_buff *skb; ++ struct ieee80211_hdr *hdr; ++ struct ssv6200_rx_desc *rxdesc; ++ unsigned long flags = 0; ++#ifdef USE_FLUSH_RETRY ++ bool has_ba_processed = false; ++#endif ++ while (1) { ++ if (rx_q_lock != NULL) { ++ spin_lock_irqsave(rx_q_lock, flags); ++ skb = __skb_dequeue(rx_q); ++ } else ++ skb = skb_dequeue(rx_q); ++ if (!skb) { ++ if (rx_q_lock != NULL) ++ spin_unlock_irqrestore(rx_q_lock, flags); ++ break; ++ } ++ sc->rx.rxq_count--; ++ if (rx_q_lock != NULL) ++ spin_unlock_irqrestore(rx_q_lock, flags); ++ rxdesc = (struct ssv6200_rx_desc *)skb->data; ++ if (rxdesc->c_type == HOST_EVENT) { ++ struct cfg_host_event *h_evt = ++ (struct cfg_host_event *)rxdesc; ++ if (h_evt->h_event == SOC_EVT_NO_BA) { ++ ssv6200_ampdu_no_BA_handler(sc->hw, skb); ++#ifdef USE_FLUSH_RETRY ++ has_ba_processed = true; ++#endif ++ } else if (h_evt->h_event == SOC_EVT_RC_MPDU_REPORT) { ++ skb_queue_tail(&sc->rc_report_queue, skb); ++ if (sc->rc_sample_sechedule == 0) ++ queue_work(sc->rc_sample_workqueue, ++ &sc->rc_sample_work); ++ } else if (h_evt->h_event == SOC_EVT_SDIO_TEST_COMMAND) { ++ if (h_evt->evt_seq_no == 0) { ++ dev_dbg(sc->dev, "SOC_EVT_SDIO_TEST_COMMAND\n"); ++ sc->sdio_rx_evt_size = h_evt->len; ++ sc->sdio_throughput_timestamp = jiffies; ++ } else { ++ sc->sdio_rx_evt_size += h_evt->len; ++ if (time_after ++ (jiffies, ++ sc->sdio_throughput_timestamp + ++ msecs_to_jiffies(1000))) { ++ dev_dbg(sc->dev, "data[%ld] SDIO RX throughput %ld Kbps\n", ++ sc->sdio_rx_evt_size, ++ (sc-> ++ sdio_rx_evt_size << 3) / ++ jiffies_to_msecs(jiffies - ++ sc-> ++ sdio_throughput_timestamp)); ++ sc->sdio_throughput_timestamp = ++ jiffies; ++ sc->sdio_rx_evt_size = 0; ++ } ++ } ++ dev_kfree_skb_any(skb); ++ } else if (h_evt->h_event == SOC_EVT_WATCHDOG_TRIGGER) { ++ dev_kfree_skb_any(skb); ++// if(sc->watchdog_flag != WD_SLEEP) //+++ ++ sc->watchdog_flag = WD_KICKED; ++ } else if (h_evt->h_event == SOC_EVT_RESET_HOST) { ++ dev_kfree_skb_any(skb); ++ if ((sc->ap_vif == NULL) ++ || !(sc->sh->cfg.ignore_reset_in_ap)) { ++ ssv6xxx_restart_hw(sc); ++ } else { ++ dev_warn(sc->dev, ++ "Reset event ignored.\n"); ++ } ++ } ++#ifdef CONFIG_P2P_NOA ++ else if (h_evt->h_event == SOC_EVT_NOA) { ++ ssv6xxx_process_noa_event(sc, skb); ++ dev_kfree_skb_any(skb); ++ } ++#endif ++ else if (h_evt->h_event == SOC_EVT_SDIO_TXTPUT_RESULT) { ++ dev_dbg(sc->dev, "data SDIO TX throughput %d Kbps\n", ++ h_evt->evt_seq_no); ++ dev_kfree_skb_any(skb); ++ } else if (h_evt->h_event == SOC_EVT_TXLOOPBK_RESULT) { ++ if (h_evt->evt_seq_no == SSV6XXX_STATE_OK) { ++ dev_dbg(sc->dev, "FW TX LOOPBACK OK\n"); ++ sc->iq_cali_done = IQ_CALI_OK; ++ } else { ++ dev_dbg(sc->dev, "FW TX LOOPBACK FAILED\n"); ++ sc->iq_cali_done = IQ_CALI_FAILED; ++ } ++ dev_kfree_skb_any(skb); ++ wake_up_interruptible(&sc->fw_wait_q); ++ } else { ++ dev_warn(sc->dev, "Unkown event %d received\n", ++ h_evt->h_event); ++ dev_kfree_skb_any(skb); ++ } ++ continue; ++ } ++ hdr = (struct ieee80211_hdr *)(skb->data + SSV6XXX_RX_DESC_LEN); ++ if (ieee80211_is_back(hdr->frame_control)) { ++ ssv6200_ampdu_BA_handler(sc->hw, skb); ++#ifdef USE_FLUSH_RETRY ++ has_ba_processed = true; ++#endif ++ continue; ++ } ++ _proc_data_rx_skb(sc, skb); ++ } ++#ifdef USE_FLUSH_RETRY ++ if (has_ba_processed) { ++ ssv6xxx_ampdu_postprocess_BA(sc->hw); ++ } ++#endif ++} ++ ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++int ssv6200_rx(struct sk_buff_head *rx_skb_q, void *args) ++#else ++int ssv6200_rx(struct sk_buff *rx_skb, void *args) ++#endif ++{ ++ struct ssv_softc *sc = args; ++#ifdef IRQ_PROC_RX_DATA ++ struct sk_buff *skb; ++ skb = _proc_rx_skb(sc, rx_skb); ++ if (skb == NULL) ++ return 0; ++#endif ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++ { ++ unsigned long flags; ++ spin_lock_irqsave(&sc->rx_skb_q.lock, flags); ++ while (skb_queue_len(rx_skb_q)) ++ __skb_queue_tail(&sc->rx_skb_q, ++ __skb_dequeue(rx_skb_q)); ++ spin_unlock_irqrestore(&sc->rx_skb_q.lock, flags); ++ } ++#else ++ skb_queue_tail(&sc->rx_skb_q, rx_skb); ++#endif ++ wake_up_interruptible(&sc->rx_wait_q); ++ return 0; ++} ++ ++struct ieee80211_sta *ssv6xxx_find_sta_by_rx_skb(struct ssv_softc *sc, ++ struct sk_buff *skb) ++{ ++ struct ieee80211_hdr *hdr = ++ (struct ieee80211_hdr *)(skb->data + SSV6XXX_RX_DESC_LEN); ++ struct ssv6200_rx_desc *rxdesc = (struct ssv6200_rx_desc *)skb->data;; ++ if ((rxdesc->wsid >= 0) && (rxdesc->wsid < SSV_NUM_STA)) ++ return sc->sta_info[rxdesc->wsid].sta; ++ else ++ return ssv6xxx_find_sta_by_addr(sc, hdr->addr2); ++} ++ ++struct ieee80211_sta *ssv6xxx_find_sta_by_addr(struct ssv_softc *sc, u8 addr[6]) ++{ ++ struct ieee80211_sta *sta; ++ int i; ++ for (i = 0; i < SSV6200_MAX_VIF; i++) { ++ if (sc->vif_info[i].vif == NULL) ++ continue; ++ sta = ieee80211_find_sta(sc->vif_info[i].vif, addr); ++ if (sta != NULL) ++ return sta; ++ } ++ return NULL; ++} ++ ++void ssv6xxx_foreach_sta(struct ssv_softc *sc, ++ void (*sta_func)(struct ssv_softc *, ++ struct ssv_sta_info *, void *), ++ void *param) ++{ ++ int i; ++ BUG_ON(sta_func == NULL); ++ for (i = 0; i < SSV_NUM_STA; i++) { ++ if ((sc->sta_info[i].s_flags & STA_FLAG_VALID) == 0) ++ continue; ++ (*sta_func) (sc, &sc->sta_info[i], param); ++ } ++} ++ ++void ssv6xxx_foreach_vif_sta(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ void (*sta_func)(struct ssv_softc *, ++ struct ssv_vif_info *, ++ struct ssv_sta_info *, ++ void *), void *param) ++{ ++ struct ssv_vif_priv_data *vif_priv; ++ struct ssv_sta_priv_data *sta_priv_iter; ++ BUG_ON(vif_info == NULL); ++ BUG_ON((size_t)vif_info < 0x30000); ++ vif_priv = (struct ssv_vif_priv_data *)vif_info->vif->drv_priv; ++ BUG_ON((size_t)vif_info->vif < 0x30000); ++ BUG_ON((size_t)vif_priv < 0x30000); ++ list_for_each_entry(sta_priv_iter, &vif_priv->sta_list, list) { ++ BUG_ON(sta_priv_iter == NULL); ++ BUG_ON((size_t)sta_priv_iter < 0x30000); ++ BUG_ON(sta_priv_iter->sta_info == NULL); ++ BUG_ON((size_t)sta_priv_iter->sta_info < 0x30000); ++ if ((sta_priv_iter->sta_info->s_flags & STA_FLAG_VALID) == 0) ++ continue; ++ (*sta_func) (sc, vif_info, sta_priv_iter->sta_info, param); ++ } ++} ++ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ssize_t ssv6xxx_tx_queue_status_dump(struct ssv_softc *sc, char *status_buf, ++ ssize_t length) ++{ ++ ssize_t buf_size = length; ++ ssize_t prt_size; ++ prt_size = ++ snprintf(status_buf, buf_size, "\nSMAC driver queue status:.\n"); ++ status_buf += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(status_buf, buf_size, "\tTX queue: %d\n", ++ skb_queue_len(&sc->tx_skb_q)); ++ status_buf += prt_size; ++ buf_size -= prt_size; ++ prt_size = snprintf(status_buf, buf_size, "\tMax TX queue: %d\n", ++ sc->max_tx_skb_q_len); ++ status_buf += prt_size; ++ buf_size -= prt_size; ++ return (length - buf_size); ++} ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/dev.h b/drivers/net/wireless/ssv6051/smac/dev.h +new file mode 100644 +index 000000000000..0a6357624b1c +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/dev.h +@@ -0,0 +1,445 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _DEV_H_ ++#define _DEV_H_ ++#include ++#include ++#include ++#include ++#include "ampdu.h" ++#include "ssv_rc_common.h" ++#include "drv_comm.h" ++#include "sec.h" ++#include "p2p.h" ++#include ++#define SSV6200_MAX_HW_MAC_ADDR 2 ++#define SSV6200_MAX_VIF 2 ++#define SSV6200_RX_BA_MAX_SESSIONS 1 ++#define SSV6200_OPMODE_STA 0 ++#define SSV6200_OPMODE_AP 1 ++#define SSV6200_OPMODE_IBSS 2 ++#define SSV6200_OPMODE_WDS 3 ++#define SSV6200_USE_HW_WSID(_sta_idx) ((_sta_idx == 0) || (_sta_idx == 1)) ++#define HW_MAX_RATE_TRIES 7 ++#define MAC_DECITBL1_SIZE 16 ++#define MAC_DECITBL2_SIZE 9 ++#define RX_11B_CCA_IN_SCAN 0x20230050 ++//#define WATCHDOG_TIMEOUT (10*HZ) ++#define WATCHDOG_TIMEOUT (99999*HZ) ++extern u16 generic_deci_tbl[]; ++#define ap_deci_tbl generic_deci_tbl ++#define sta_deci_tbl generic_deci_tbl ++#define HT_SIGNAL_EXT 6 ++#define HT_SIFS_TIME 10 ++#define BITS_PER_BYTE 8 ++#define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) ++#define ACK_LEN (14) ++#define BA_LEN (32) ++#define RTS_LEN (20) ++#define CTS_LEN (14) ++#define L_STF 8 ++#define L_LTF 8 ++#define L_SIG 4 ++#define HT_SIG 8 ++#define HT_STF 4 ++#define HT_LTF(_ns) (4 * (_ns)) ++#define SYMBOL_TIME(_ns) ((_ns) << 2) ++#define SYMBOL_TIME_HALFGI(_ns) (((_ns) * 18 + 4) / 5) ++#define CCK_SIFS_TIME 10 ++#define CCK_PREAMBLE_BITS 144 ++#define CCK_PLCP_BITS 48 ++#define OFDM_SIFS_TIME 16 ++#define OFDM_PREAMBLE_TIME 20 ++#define OFDM_PLCP_BITS 22 ++#define OFDM_SYMBOL_TIME 4 ++#define WMM_AC_VO 0 ++#define WMM_AC_VI 1 ++#define WMM_AC_BE 2 ++#define WMM_AC_BK 3 ++#define WMM_NUM_AC 4 ++#define WMM_TID_NUM 8 ++#define TXQ_EDCA_0 0x01 ++#define TXQ_EDCA_1 0x02 ++#define TXQ_EDCA_2 0x04 ++#define TXQ_EDCA_3 0x08 ++#define TXQ_MGMT 0x10 ++#define IS_SSV_HT(dsc) ((dsc)->rate_idx >= 15) ++#define IS_SSV_SHORT_GI(dsc) ((dsc)->rate_idx>=23 && (dsc)->rate_idx<=30) ++#define IS_SSV_HT_GF(dsc) ((dsc)->rate_idx >= 31) ++#define IS_SSV_SHORT_PRE(dsc) ((dsc)->rate_idx>=4 && (dsc)->rate_idx<=14) ++#define SMAC_REG_WRITE(_s,_r,_v) \ ++ (_s)->hci.hci_ops->hci_write_word(_r,_v) ++#define SMAC_REG_READ(_s,_r,_v) \ ++ (_s)->hci.hci_ops->hci_read_word(_r, _v) ++#define SMAC_LOAD_FW(_s,_r,_v) \ ++ (_s)->hci.hci_ops->hci_load_fw(_r, _v) ++#define SMAC_IFC_RESET(_s) (_s)->hci.hci_ops->hci_interface_reset() ++#define SMAC_REG_CONFIRM(_s,_r,_v) \ ++{ \ ++ u32 _regval; \ ++ SMAC_REG_READ(_s, _r, &_regval); \ ++ if (_regval != (_v)) { \ ++ printk("ERROR!!Please check interface!\n"); \ ++ printk("[0x%08x]: 0x%08x!=0x%08x\n", \ ++ (_r), (_v), _regval); \ ++ printk("SOS!SOS!\n"); \ ++ return -1; \ ++ } \ ++} ++#define SMAC_REG_SET_BITS(_sh,_reg,_set,_clr) \ ++({ \ ++ int ret; \ ++ u32 _regval; \ ++ ret = SMAC_REG_READ(_sh, _reg, &_regval); \ ++ _regval &= ~(_clr); \ ++ _regval |= (_set); \ ++ if (ret == 0) \ ++ ret = SMAC_REG_WRITE(_sh, _reg, _regval); \ ++ ret; \ ++}) ++#define HCI_START(_sh) \ ++ (_sh)->hci.hci_ops->hci_start() ++#define HCI_STOP(_sh) \ ++ (_sh)->hci.hci_ops->hci_stop() ++#define HCI_SEND(_sh,_sk,_q) \ ++ (_sh)->hci.hci_ops->hci_tx(_sk, _q, 0) ++#define HCI_PAUSE(_sh,_mk) \ ++ (_sh)->hci.hci_ops->hci_tx_pause(_mk) ++#define HCI_RESUME(_sh,_mk) \ ++ (_sh)->hci.hci_ops->hci_tx_resume(_mk) ++#define HCI_TXQ_FLUSH(_sh,_mk) \ ++ (_sh)->hci.hci_ops->hci_txq_flush(_mk) ++#define HCI_TXQ_FLUSH_BY_STA(_sh,_aid) \ ++ (_sh)->hci.hci_ops->hci_txq_flush_by_sta(_aid) ++#define HCI_TXQ_EMPTY(_sh,_txqid) \ ++ (_sh)->hci.hci_ops->hci_txq_empty(_txqid) ++#define HCI_WAKEUP_PMU(_sh) \ ++ (_sh)->hci.hci_ops->hci_pmu_wakeup() ++#define HCI_SEND_CMD(_sh,_sk) \ ++ (_sh)->hci.hci_ops->hci_send_cmd(_sk) ++#define SSV6XXX_SET_HW_TABLE(sh_,tbl_) \ ++({ \ ++ int ret = 0; \ ++ u32 i=0; \ ++ for(; ihas_hw_decrypt) ++#define SSV6XXX_USE_SW_DECRYPT(_priv) (SSV6XXX_USE_LOCAL_SW_DECRYPT(_priv) || SSV6XXX_USE_MAC80211_DECRYPT(_priv)) ++#define SSV6XXX_USE_LOCAL_SW_DECRYPT(_priv) (_priv->need_sw_decrypt) ++#define SSV6XXX_USE_MAC80211_DECRYPT(_priv) (_priv->use_mac80211_decrypt) ++struct ssv_softc; ++#ifdef CONFIG_P2P_NOA ++struct ssv_p2p_noa; ++#endif ++#define SSV6200_HT_TX_STREAMS 1 ++#define SSV6200_HT_RX_STREAMS 1 ++#define SSV6200_RX_HIGHEST_RATE 72 ++enum PWRSV_STATUS { ++ PWRSV_DISABLE, ++ PWRSV_ENABLE, ++ PWRSV_PREPARE, ++}; ++struct rssi_res_st { ++ struct list_head rssi_list; ++ unsigned long cache_jiffies; ++ s32 rssi; ++ s32 timeout; ++ u8 bssid[ETH_ALEN]; ++}; ++struct ssv_hw { ++ struct ssv_softc *sc; ++ struct ssv6xxx_platform_data *priv; ++ struct ssv6xxx_hci_info hci; ++ char chip_id[24]; ++ u64 chip_tag; ++ u32 tx_desc_len; ++ u32 rx_desc_len; ++ u32 rx_pinfo_pad; ++ u32 tx_page_available; ++ u32 ampdu_divider; ++ u8 page_count[SSV6200_ID_NUMBER]; ++ u32 hw_buf_ptr[SSV_RC_MAX_STA]; ++ u32 hw_sec_key[SSV_RC_MAX_STA]; ++ u32 hw_pinfo; ++ struct ssv6xxx_cfg cfg; ++ u32 n_addresses; ++ struct mac_address maddr[SSV6200_MAX_HW_MAC_ADDR]; ++ u8 ipd_channel_touch; ++ struct ssv6xxx_ch_cfg *p_ch_cfg; ++ u32 ch_cfg_size; ++}; ++struct ssv_tx { ++ u16 seq_no; ++ int hw_txqid[WMM_NUM_AC]; ++ int ac_txqid[WMM_NUM_AC]; ++ u32 flow_ctrl_status; ++ u32 tx_pkt[SSV_HW_TXQ_NUM]; ++ u32 tx_frag[SSV_HW_TXQ_NUM]; ++ struct list_head ampdu_tx_que; ++ spinlock_t ampdu_tx_que_lock; ++ u16 ampdu_tx_group_id; ++}; ++struct ssv_rx { ++ struct sk_buff *rx_buf; ++ spinlock_t rxq_lock; ++ struct sk_buff_head rxq_head; ++ u32 rxq_count; ++}; ++#define SSV6XXX_GET_STA_INFO(_sc,_s) \ ++ &(_sc)->sta_info[((struct ssv_sta_priv_data *)((_s)->drv_priv))->sta_idx] ++#define STA_FLAG_VALID 0x00001 ++#define STA_FLAG_QOS 0x00002 ++#define STA_FLAG_AMPDU 0x00004 ++#define STA_FLAG_ENCRYPT 0x00008 ++struct ssv_sta_info { ++ u16 aid; ++ u16 s_flags; ++ int hw_wsid; ++ struct ieee80211_sta *sta; ++ struct ieee80211_vif *vif; ++ bool sleeping; ++ bool tim_set; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct dentry *debugfs_dir; ++#endif ++}; ++struct ssv_vif_info { ++ struct ieee80211_vif *vif; ++ struct ssv_vif_priv_data *vif_priv; ++ enum nl80211_iftype if_type; ++ struct ssv6xxx_hw_sec sramKey; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct dentry *debugfs_dir; ++#endif ++}; ++struct ssv_sta_priv_data { ++ int sta_idx; ++ int rc_idx; ++ int rx_data_rate; ++ struct ssv_sta_info *sta_info; ++ struct list_head list; ++ u32 ampdu_mib_total_BA_counter; ++ AMPDU_TID ampdu_tid[WMM_TID_NUM]; ++ bool has_hw_encrypt; ++ bool need_sw_encrypt; ++ bool has_hw_decrypt; ++ bool need_sw_decrypt; ++ bool use_mac80211_decrypt; ++ u8 group_key_idx; ++ u32 beacon_rssi; ++}; ++struct ssv_vif_priv_data { ++ int vif_idx; ++ struct list_head sta_list; ++ u32 sta_asleep_mask; ++ u32 pair_cipher; ++ u32 group_cipher; ++ bool is_security_valid; ++ bool has_hw_encrypt; ++ bool need_sw_encrypt; ++ bool has_hw_decrypt; ++ bool need_sw_decrypt; ++ bool use_mac80211_decrypt; ++ bool force_sw_encrypt; ++ u8 group_key_idx; ++}; ++#define SC_OP_INVALID 0x00000001 ++#define SC_OP_HW_RESET 0x00000002 ++#define SC_OP_OFFCHAN 0x00000004 ++#define SC_OP_FIXED_RATE 0x00000008 ++#define SC_OP_SHORT_PREAMBLE 0x00000010 ++struct ssv6xxx_beacon_info { ++ u32 pubf_addr; ++ u16 len; ++ u8 tim_offset; ++ u8 tim_cnt; ++}; ++#define SSV6200_MAX_BCAST_QUEUE_LEN 16 ++struct ssv6xxx_bcast_txq { ++ spinlock_t txq_lock; ++ struct sk_buff_head qhead; ++ int cur_qsize; ++}; ++#ifdef DEBUG_AMPDU_FLUSH ++typedef struct AMPDU_TID_st AMPDU_TID; ++#define MAX_TID (24) ++#endif ++struct ssv_softc { ++ struct ieee80211_hw *hw; ++ struct device *dev; ++ u32 restart_counter; ++ bool force_triger_reset; ++ unsigned long sdio_throughput_timestamp; ++ unsigned long sdio_rx_evt_size; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) ++ struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; ++#else ++ struct ieee80211_supported_band sbands[NUM_NL80211_BANDS]; ++#endif ++ struct ieee80211_channel *cur_channel; ++ u16 hw_chan; ++ struct mutex mutex; ++ struct ssv_hw *sh; ++ struct ssv_tx tx; ++ struct ssv_rx rx; ++ struct ssv_vif_info vif_info[SSV_NUM_VIF]; ++ struct ssv_sta_info sta_info[SSV_NUM_STA]; ++ struct ieee80211_vif *ap_vif; ++ u8 nvif; ++ u32 sc_flags; ++ void *rc; ++ int max_rate_idx; ++ struct workqueue_struct *rc_sample_workqueue; ++ struct sk_buff_head rc_report_queue; ++ struct work_struct rc_sample_work; ++#ifdef DEBUG_AMPDU_FLUSH ++ struct AMPDU_TID_st *tid[MAX_TID]; ++#endif ++ u16 rc_sample_sechedule; ++ u16 *mac_deci_tbl; ++ struct workqueue_struct *config_wq; ++ bool bq4_dtim; ++ struct work_struct set_tim_work; ++ u8 enable_beacon; ++ u8 beacon_interval; ++ u8 beacon_dtim_cnt; ++ u8 beacon_usage; ++ struct ssv6xxx_beacon_info beacon_info[2]; ++ struct sk_buff *beacon_buf; ++ struct work_struct bcast_start_work; ++ struct delayed_work bcast_stop_work; ++ struct delayed_work bcast_tx_work; ++ struct delayed_work thermal_monitor_work; ++ struct workqueue_struct *thermal_wq; ++ int is_sar_enabled; ++ bool aid0_bit_set; ++ u8 hw_mng_used; ++ struct ssv6xxx_bcast_txq bcast_txq; ++ int bcast_interval; ++ u8 bssid[6]; ++ struct mutex mem_mutex; ++ spinlock_t ps_state_lock; ++ u8 hw_wsid_bit; ++ int rx_ba_session_count; ++ struct ieee80211_sta *rx_ba_sta; ++ u8 rx_ba_bitmap; ++ u8 ba_ra_addr[ETH_ALEN]; ++ u16 ba_tid; ++ u16 ba_ssn; ++ struct work_struct set_ampdu_rx_add_work; ++ struct work_struct set_ampdu_rx_del_work; ++ bool isAssoc; ++ u16 channel_center_freq; ++ bool bScanning; ++ int ps_status; ++ u16 ps_aid; ++ u16 tx_wait_q_woken; ++ wait_queue_head_t tx_wait_q; ++ struct sk_buff_head tx_skb_q; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ u32 max_tx_skb_q_len; ++#endif ++ struct task_struct *tx_task; ++ bool tx_q_empty; ++ struct sk_buff_head tx_done_q; ++ u16 rx_wait_q_woken; ++ wait_queue_head_t rx_wait_q; ++ struct sk_buff_head rx_skb_q; ++ struct task_struct *rx_task; ++ bool dbg_rx_frame; ++ bool dbg_tx_frame; ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct dentry *debugfs_dir; ++#endif ++#ifdef CONFIG_P2P_NOA ++ struct ssv_p2p_noa p2p_noa; ++#endif ++ struct timer_list watchdog_timeout; ++ u32 watchdog_flag; ++ wait_queue_head_t fw_wait_q; ++ u32 iq_cali_done; ++ u32 sr_bhvr; ++}; ++enum { ++ IQ_CALI_RUNNING, ++ IQ_CALI_OK, ++ IQ_CALI_FAILED ++}; ++enum { ++ WD_SLEEP, ++ WD_BARKING, ++ WD_KICKED, ++ WD_MAX ++}; ++void ssv6xxx_txbuf_free_skb(struct sk_buff *skb, void *args); ++void ssv6200_rx_process(struct work_struct *work); ++#if !defined(USE_THREAD_RX) || defined(USE_BATCH_RX) ++int ssv6200_rx(struct sk_buff_head *rx_skb_q, void *args); ++#else ++int ssv6200_rx(struct sk_buff *rx_skb, void *args); ++#endif ++void ssv6xxx_tx_cb(struct sk_buff_head *skb_head, void *args); ++void ssv6xxx_tx_rate_update(struct sk_buff *skb, void *args); ++int ssv6200_tx_flow_control(void *dev, int hw_txqid, bool fc_en, int debug); ++void ssv6xxx_tx_q_empty_cb(u32 txq_no, void *); ++int ssv6xxx_rf_disable(struct ssv_hw *sh); ++int ssv6xxx_rf_enable(struct ssv_hw *sh); ++int ssv6xxx_set_channel(struct ssv_softc *sc, int ch); ++#ifdef CONFIG_SSV_SMARTLINK ++int ssv6xxx_get_channel(struct ssv_softc *sc, int *pch); ++int ssv6xxx_set_promisc(struct ssv_softc *sc, int accept); ++int ssv6xxx_get_promisc(struct ssv_softc *sc, int *paccept); ++#endif ++int ssv6xxx_tx_task(void *data); ++int ssv6xxx_rx_task(void *data); ++u32 ssv6xxx_pbuf_alloc(struct ssv_softc *sc, int size, int type); ++bool ssv6xxx_pbuf_free(struct ssv_softc *sc, u32 pbuf_addr); ++void ssv6xxx_add_txinfo(struct ssv_softc *sc, struct sk_buff *skb); ++void ssv6xxx_update_txinfo(struct ssv_softc *sc, struct sk_buff *skb); ++int ssv6xxx_update_decision_table(struct ssv_softc *sc); ++void ssv6xxx_ps_callback_func(unsigned long data); ++void ssv6xxx_enable_ps(struct ssv_softc *sc); ++void ssv6xxx_disable_ps(struct ssv_softc *sc); ++int ssv6xxx_watchdog_controller(struct ssv_hw *sh, u8 flag); ++int ssv6xxx_skb_encrypt(struct sk_buff *mpdu, struct ssv_softc *sc); ++int ssv6xxx_skb_decrypt(struct sk_buff *mpdu, struct ieee80211_sta *sta, ++ struct ssv_softc *sc); ++void ssv6200_sync_hw_key_sequence(struct ssv_softc *sc, ++ struct ssv_sta_info *sta_info, bool bWrite); ++struct ieee80211_sta *ssv6xxx_find_sta_by_rx_skb(struct ssv_softc *sc, ++ struct sk_buff *skb); ++struct ieee80211_sta *ssv6xxx_find_sta_by_addr(struct ssv_softc *sc, ++ u8 addr[6]); ++void ssv6xxx_foreach_sta(struct ssv_softc *sc, ++ void (*sta_func)(struct ssv_softc *, ++ struct ssv_sta_info *, void *), ++ void *param); ++void ssv6xxx_foreach_vif_sta(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ void (*sta_func)(struct ssv_softc *, ++ struct ssv_vif_info *, ++ struct ssv_sta_info *, void *), ++ void *param); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ssize_t ssv6xxx_tx_queue_status_dump(struct ssv_softc *sc, char *status_buf, ++ ssize_t buf_size); ++#endif ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/dev_tbl.h b/drivers/net/wireless/ssv6051/smac/dev_tbl.h +new file mode 100644 +index 000000000000..5c49d0bde6a6 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/dev_tbl.h +@@ -0,0 +1,141 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _DEV_TBL_H_ ++#define _DEV_TBL_H_ ++#include "ssv6200_configuration.h" ++#include "drv_comm.h" ++struct ssv6xxx_dev_table { ++ u32 address; ++ u32 data; ++}; ++#define ssv6200_phy_tbl phy_setting ++#define ssv6200_rf_tbl asic_rf_setting ++#define ACTION_DO_NOTHING 0 ++#define ACTION_UPDATE_NAV 1 ++#define ACTION_RESET_NAV 2 ++#define ACTION_SIGNAL_ACK 3 ++#define FRAME_ACCEPT 0 ++#define FRAME_DROP 1 ++#define SET_DEC_TBL(_type,_mask,_action,_drop) \ ++ (_type<<9| \ ++ _mask <<3| \ ++ _action<<1| \ ++ _drop) ++u16 generic_deci_tbl[] = { ++ SET_DEC_TBL(0x1e, 0x3e, ACTION_RESET_NAV, FRAME_DROP), ++ SET_DEC_TBL(0x18, 0x3e, ACTION_SIGNAL_ACK, FRAME_ACCEPT), ++ SET_DEC_TBL(0x1a, 0x3f, ACTION_DO_NOTHING, FRAME_ACCEPT), ++ SET_DEC_TBL(0x10, 0x38, ACTION_DO_NOTHING, FRAME_DROP), ++ 0, ++ 0, ++ 0, ++ SET_DEC_TBL(0x05, 0x3f, ACTION_SIGNAL_ACK, FRAME_ACCEPT), ++ SET_DEC_TBL(0x0b, 0x3f, ACTION_SIGNAL_ACK, FRAME_ACCEPT), ++ SET_DEC_TBL(0x01, 0x3d, ACTION_SIGNAL_ACK, FRAME_ACCEPT), ++ SET_DEC_TBL(0x00, 0x00, ACTION_DO_NOTHING, FRAME_ACCEPT), ++ SET_DEC_TBL(0x00, 0x00, ACTION_SIGNAL_ACK, FRAME_ACCEPT), ++ SET_DEC_TBL(0x00, 0x00, ACTION_DO_NOTHING, FRAME_DROP), ++ SET_DEC_TBL(0x00, 0x00, ACTION_UPDATE_NAV, FRAME_DROP), ++ SET_DEC_TBL(0x00, 0x00, ACTION_RESET_NAV, FRAME_DROP), ++ SET_DEC_TBL(0x00, 0x00, ACTION_SIGNAL_ACK, FRAME_DROP), ++ 0x2008, ++ 0x1001, ++ 0x0400, ++ 0x0400, ++ 0x2000, ++ 0x800E, ++ 0x0800, ++ 0x0B88, ++ 0x0800, ++}; ++ ++#define SET_PHY_INFO(_ctsdur,_ba_rate_idx,_ack_rate_idx,_llength_idx,_llength_enable) \ ++ (_ctsdur<<16| \ ++ _ba_rate_idx <<10| \ ++ _ack_rate_idx<<4| \ ++ _llength_idx<<1| \ ++ _llength_enable) ++#define SET_PHY_L_LENGTH(_l_ba,_l_rts,_l_cts_ack) (_l_ba<<12|_l_rts<<6 |_l_cts_ack) ++static u32 phy_info_6051z[] = { ++ 0x18000000, 0x18000100, 0x18000200, 0x18000300, 0x18000140, ++ 0x18000240, 0x18000340, 0x0C000001, 0x0C000101, 0x0C000201, ++ 0x0C000301, 0x18000401, 0x18000501, 0x18000601, 0x18000701, ++ 0x0C030002, 0x0C030102, 0x0C030202, 0x18030302, 0x18030402, ++ 0x18030502, 0x18030602, 0x1C030702, 0x0C030082, 0x0C030182, ++ 0x0C030282, 0x18030382, 0x18030482, 0x18030582, 0x18030682, ++ 0x1C030782, 0x0C030042, 0x0C030142, 0x0C030242, 0x18030342, ++ 0x18030442, 0x18030542, 0x18030642, 0x1C030742 ++}; ++ ++static u32 phy_info_tbl[] = { ++ 0x0C000000, 0x0C000100, 0x0C000200, 0x0C000300, 0x0C000140, ++ 0x0C000240, 0x0C000340, 0x00000001, 0x00000101, 0x00000201, ++ 0x00000301, 0x0C000401, 0x0C000501, 0x0C000601, 0x0C000701, ++ 0x00030002, 0x00030102, 0x00030202, 0x0C030302, 0x0C030402, ++ 0x0C030502, 0x0C030602, 0x10030702, 0x00030082, 0x00030182, ++ 0x00030282, 0x0C030382, 0x0C030482, 0x0C030582, 0x0C030682, ++ 0x10030782, 0x00030042, 0x00030142, 0x00030242, 0x0C030342, ++ 0x0C030442, 0x0C030542, 0x0C030642, 0x10030742, ++ SET_PHY_INFO(314, 0, 0, 0, 0), ++ SET_PHY_INFO(258, 0, 1, 0, 0), ++ SET_PHY_INFO(223, 0, 1, 0, 0), ++ SET_PHY_INFO(213, 0, 1, 0, 0), ++ SET_PHY_INFO(162, 0, 4, 0, 0), ++ SET_PHY_INFO(127, 0, 4, 0, 0), ++ SET_PHY_INFO(117, 0, 4, 0, 0), ++ SET_PHY_INFO(60, 7, 7, 0, 0), ++ SET_PHY_INFO(52, 7, 7, 0, 0), ++ SET_PHY_INFO(48, 9, 9, 0, 0), ++ SET_PHY_INFO(44, 9, 9, 0, 0), ++ SET_PHY_INFO(44, 11, 11, 0, 0), ++ SET_PHY_INFO(40, 11, 11, 0, 0), ++ SET_PHY_INFO(40, 11, 11, 0, 0), ++ SET_PHY_INFO(40, 11, 11, 0, 0), ++ SET_PHY_INFO(76, 7, 7, 0, 1), ++ SET_PHY_INFO(64, 9, 9, 1, 1), ++ SET_PHY_INFO(60, 9, 9, 2, 1), ++ SET_PHY_INFO(60, 11, 11, 3, 1), ++ SET_PHY_INFO(56, 11, 11, 4, 1), ++ SET_PHY_INFO(56, 11, 11, 5, 1), ++ SET_PHY_INFO(56, 11, 11, 5, 1), ++ SET_PHY_INFO(56, 11, 11, 5, 1), ++ SET_PHY_INFO(76, 7, 7, 6, 1), ++ SET_PHY_INFO(64, 9, 9, 1, 1), ++ SET_PHY_INFO(60, 9, 9, 2, 1), ++ SET_PHY_INFO(60, 11, 11, 3, 1), ++ SET_PHY_INFO(56, 11, 11, 4, 1), ++ SET_PHY_INFO(56, 11, 11, 5, 1), ++ SET_PHY_INFO(56, 11, 11, 5, 1), ++ SET_PHY_INFO(56, 11, 11, 5, 1), ++ SET_PHY_INFO(64, 7, 7, 0, 0), ++ SET_PHY_INFO(52, 9, 9, 0, 0), ++ SET_PHY_INFO(48, 9, 9, 0, 0), ++ SET_PHY_INFO(48, 11, 11, 0, 0), ++ SET_PHY_INFO(44, 11, 11, 0, 0), ++ SET_PHY_INFO(44, 11, 11, 0, 0), ++ SET_PHY_INFO(44, 11, 11, 0, 0), ++ SET_PHY_INFO(44, 11, 11, 0, 0), ++ SET_PHY_L_LENGTH(50, 38, 35), ++ SET_PHY_L_LENGTH(35, 29, 26), ++ SET_PHY_L_LENGTH(29, 26, 23), ++ SET_PHY_L_LENGTH(26, 23, 23), ++ SET_PHY_L_LENGTH(23, 23, 20), ++ SET_PHY_L_LENGTH(23, 20, 20), ++ SET_PHY_L_LENGTH(47, 38, 35), ++ SET_PHY_L_LENGTH(0, 0, 0), ++}; ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/drv_comm.h b/drivers/net/wireless/ssv6051/smac/drv_comm.h +new file mode 100644 +index 000000000000..f04fbae004c3 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/drv_comm.h +@@ -0,0 +1,61 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _DRV_COMM_H_ ++#define _DRV_COMM_H_ ++#define PHY_INFO_TBL1_SIZE 39 ++#define PHY_INFO_TBL2_SIZE 39 ++#define PHY_INFO_TBL3_SIZE 8 ++#define ampdu_fw_rate_info_status_no_use BIT(0) ++#define ampdu_fw_rate_info_status_in_use BIT(1) ++#define ampdu_fw_rate_info_status_reset BIT(2) ++#define SSV_NUM_STA 8 ++#define SSV_NUM_VIF 2 ++#define SECURITY_KEY_LEN (32) ++enum SSV_CIPHER_E { ++ SSV_CIPHER_NONE, ++ SSV_CIPHER_WEP40, ++ SSV_CIPHER_WEP104, ++ SSV_CIPHER_TKIP, ++ SSV_CIPHER_CCMP, ++ SSV_CIPHER_SMS4, ++ SSV_CIPHER_INVALID = (-1) ++}; ++#define ME_NONE 0 ++#define ME_WEP40 1 ++#define ME_WEP104 2 ++#define ME_TKIP 3 ++#define ME_CCMP 4 ++#define ME_SMS4 5 ++struct ssv6xxx_hw_key { ++ u8 key[SECURITY_KEY_LEN]; ++ u32 tx_pn_l; ++ u32 tx_pn_h; ++ u32 rx_pn_l; ++ u32 rx_pn_h; ++} __attribute__((packed)); ++struct ssv6xxx_hw_sta_key { ++ u8 pair_key_idx:4; ++ u8 group_key_idx:4; ++ u8 valid; ++ u8 reserve[2]; ++ struct ssv6xxx_hw_key pair; ++} __attribute__((packed)); ++struct ssv6xxx_hw_sec { ++ struct ssv6xxx_hw_key group_key[3]; ++ struct ssv6xxx_hw_sta_key sta_key[8]; ++} __attribute__((packed)); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/efuse.c b/drivers/net/wireless/ssv6051/smac/efuse.c +new file mode 100644 +index 000000000000..9a1f3f5488f2 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/efuse.c +@@ -0,0 +1,334 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include "efuse.h" ++ ++struct file *openFile(char *path, int flag, int mode) ++{ ++ struct file *fp = NULL; ++ fp = filp_open(path, flag, 0); ++ if (IS_ERR(fp)) ++ return NULL; ++ else ++ return fp; ++} ++ ++int readFile(struct file *fp, char *buf, int readlen) ++{ ++ if (fp->f_op && fp->f_op->read) ++ return fp->f_op->read(fp, buf, readlen, &fp->f_pos); ++ else ++ return -1; ++} ++ ++int closeFile(struct file *fp) ++{ ++ filp_close(fp, NULL); ++ return 0; ++} ++ ++void initKernelEnv(void) ++{ ++} ++ ++void parseMac(char *mac, u_int8_t addr[]) ++{ ++ long b; ++ int i; ++ for (i = 0; i < 6; i++) { ++ b = simple_strtol(mac + (3 * i), (char **)NULL, 16); ++ addr[i] = (char)b; ++ } ++} ++ ++static int readfile_mac(u8 * path, u8 * mac_addr) ++{ ++ char buf[128]; ++ struct file *fp = NULL; ++ int ret = 0; ++ fp = openFile(path, O_RDONLY, 0); ++ if (fp != NULL) { ++ initKernelEnv(); ++ memset(buf, 0, 128); ++ if ((ret = readFile(fp, buf, 128)) > 0) { ++ parseMac(buf, (uint8_t *) mac_addr); ++ } else ++ pr_err("read file error %d=[%s]\n", ret, path); ++ closeFile(fp); ++ } else ++ pr_err("Read open File fail[%s]!!!! \n", path); ++ return ret; ++} ++ ++static int write_mac_to_file(u8 * mac_path, u8 * mac_addr) ++{ ++ char buf[128]; ++ struct file *fp = NULL; ++ int ret = 0, len; ++ fp = openFile(mac_path, O_WRONLY | O_CREAT, 0640); ++ if (fp != NULL) { ++ initKernelEnv(); ++ memset(buf, 0, 128); ++ sprintf(buf, "%x:%x:%x:%x:%x:%x", mac_addr[0], mac_addr[1], ++ mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); ++ len = strlen(buf) + 1; ++ fp->f_op->write(fp, (char *)buf, len, &fp->f_pos); ++ closeFile(fp); ++ } else ++ pr_err("Write open File fail!!!![%s] \n", mac_path); ++ return ret; ++} ++ ++static struct efuse_map SSV_EFUSE_ITEM_TABLE[] = { ++ {4, 0, 0}, ++ {4, 8, 0}, ++ {4, 8, 0}, ++ {4, 48, 0}, ++ {4, 8, 0}, ++ {4, 8, 0}, ++ {4, 8, 0}, ++}; ++ ++static u8 read_efuse(struct ssv_hw *sh, u8 * pbuf) ++{ ++ extern struct ssv6xxx_cfg ssv_cfg; ++ u32 val, i; ++ u32 *temp = (u32 *) pbuf; ++ SMAC_REG_WRITE(sh, 0xC0000328, 0x11); ++ SMAC_REG_WRITE(sh, SSV_EFUSE_ID_READ_SWITCH, 0x1); ++ SMAC_REG_READ(sh, SSV_EFUSE_ID_RAW_DATA_BASE, &val); ++ ssv_cfg.chip_identity = val; ++ SMAC_REG_WRITE(sh, SSV_EFUSE_READ_SWITCH, 0x1); ++ SMAC_REG_READ(sh, SSV_EFUSE_RAW_DATA_BASE, &val); ++ if (val == 0x00) { ++ return 0; ++ } ++ for (i = 0; i < (EFUSE_MAX_SECTION_MAP); i++) { ++ SMAC_REG_WRITE(sh, SSV_EFUSE_READ_SWITCH + i * 4, 0x1); ++ SMAC_REG_READ(sh, SSV_EFUSE_RAW_DATA_BASE + i * 4, &val); ++ *temp++ = val; ++ } ++ SMAC_REG_WRITE(sh, 0xC0000328, 0x1800000a); ++ return 1; ++} ++ ++static u16 parser_efuse(u8 * pbuf, u8 * mac_addr) ++{ ++ u8 *rtemp8, idx = 0; ++ u16 shift = 0, i; ++ u16 efuse_real_content_len = 0; ++ rtemp8 = pbuf; ++ if (*rtemp8 == 0x00) { ++ return efuse_real_content_len; ++ } ++ do { ++ idx = (*(rtemp8) >> shift) & 0xf; ++ switch (idx) { ++ case EFUSE_R_CALIBRATION_RESULT: ++ case EFUSE_CRYSTAL_FREQUENCY_OFFSET: ++ case EFUSE_TX_POWER_INDEX_1: ++ case EFUSE_TX_POWER_INDEX_2: ++ case EFUSE_SAR_RESULT: ++ if (shift) { ++ rtemp8++; ++ SSV_EFUSE_ITEM_TABLE[idx].value = ++ (u16) ((u8) (*((u16 *) rtemp8)) & ++ ((1 << ++ SSV_EFUSE_ITEM_TABLE ++ [idx].byte_cnts) - 1)); ++ } else { ++ SSV_EFUSE_ITEM_TABLE[idx].value = ++ (u16) ((u8) (*((u16 *) rtemp8) >> 4) & ++ ((1 << ++ SSV_EFUSE_ITEM_TABLE ++ [idx].byte_cnts) - 1)); ++ } ++ efuse_real_content_len += ++ (SSV_EFUSE_ITEM_TABLE[idx].offset + ++ SSV_EFUSE_ITEM_TABLE[idx].byte_cnts); ++ break; ++ case EFUSE_MAC: ++ if (shift) { ++ rtemp8++; ++ memcpy(mac_addr, rtemp8, 6); ++ } else { ++ for (i = 0; i < 6; i++) { ++ mac_addr[i] = ++ (u16) (*((u16 *) rtemp8) >> 4) & ++ 0xff; ++ rtemp8++; ++ } ++ } ++ efuse_real_content_len += ++ (SSV_EFUSE_ITEM_TABLE[idx].offset + ++ SSV_EFUSE_ITEM_TABLE[idx].byte_cnts); ++ break; ++ default: ++ idx = 0; ++ break; ++ } ++ shift = efuse_real_content_len % 8; ++ rtemp8 = &pbuf[efuse_real_content_len / 8]; ++ } while (idx != 0); ++ return efuse_real_content_len; ++} ++ ++void addr_increase_copy(u8 * dst, u8 * src) ++{ ++ u8 *a = (u8 *) dst; ++ const u8 *b = (const u8 *)src; ++ a[0] = b[0]; ++ a[1] = b[1]; ++ a[2] = b[2]; ++ a[3] = b[3]; ++ a[4] = b[4]; ++ if (b[5] & 0x1) ++ a[5] = b[5] - 1; ++ else ++ a[5] = b[5] + 1; ++} ++ ++static u8 key_char2num(u8 ch) ++{ ++ if ((ch >= '0') && (ch <= '9')) ++ return ch - '0'; ++ else if ((ch >= 'a') && (ch <= 'f')) ++ return ch - 'a' + 10; ++ else if ((ch >= 'A') && (ch <= 'F')) ++ return ch - 'A' + 10; ++ else ++ return 0xff; ++} ++ ++u8 key_2char2num(u8 hch, u8 lch) ++{ ++ return ((key_char2num(hch) << 4) | key_char2num(lch)); ++} ++ ++extern struct ssv6xxx_cfg ssv_cfg; ++extern char *ssv_initmac; ++void efuse_read_all_map(struct ssv_hw *sh) ++{ ++ u8 mac[ETH_ALEN] = { 0 }; ++ int jj, kk; ++ u8 efuse_mapping_table[EFUSE_HWSET_MAX_SIZE / 8]; ++#ifndef CONFIG_SSV_RANDOM_MAC ++ u8 pseudo_mac0[ETH_ALEN] = { 0x00, 0x33, 0x33, 0x33, 0x33, 0x33 }; ++#endif ++ u8 rom_mac0[ETH_ALEN]; ++ memset(rom_mac0, 0x00, ETH_ALEN); ++ memset(efuse_mapping_table, 0x00, EFUSE_HWSET_MAX_SIZE / 8); ++ read_efuse(sh, efuse_mapping_table); ++ parser_efuse(efuse_mapping_table, rom_mac0); ++ ssv_cfg.r_calbration_result = ++ (u8) SSV_EFUSE_ITEM_TABLE[EFUSE_R_CALIBRATION_RESULT].value; ++ ssv_cfg.sar_result = (u8) SSV_EFUSE_ITEM_TABLE[EFUSE_SAR_RESULT].value; ++ ssv_cfg.crystal_frequency_offset = ++ (u8) SSV_EFUSE_ITEM_TABLE[EFUSE_CRYSTAL_FREQUENCY_OFFSET].value; ++ ssv_cfg.tx_power_index_1 = ++ (u8) SSV_EFUSE_ITEM_TABLE[EFUSE_TX_POWER_INDEX_1].value; ++ ssv_cfg.tx_power_index_2 = ++ (u8) SSV_EFUSE_ITEM_TABLE[EFUSE_TX_POWER_INDEX_2].value; ++ if (!is_valid_ether_addr(&sh->cfg.maddr[0][0])) { ++ if (!sh->cfg.ignore_efuse_mac) { ++ if (is_valid_ether_addr(rom_mac0)) { ++ dev_info(sh->sc->dev, "Using MAC address from e-fuse\n"); ++ memcpy(&sh->cfg.maddr[0][0], rom_mac0, ++ ETH_ALEN); ++ addr_increase_copy(&sh->cfg.maddr[1][0], ++ rom_mac0); ++ goto Done; ++ } ++ } ++ if (ssv_initmac != NULL) { ++ for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3) { ++ mac[jj] = ++ key_2char2num(ssv_initmac[kk], ++ ssv_initmac[kk + 1]); ++ } ++ if (is_valid_ether_addr(mac)) { ++ dev_info(sh->sc->dev, "Using MAC address from module option\n"); ++ memcpy(&sh->cfg.maddr[0][0], mac, ETH_ALEN); ++ addr_increase_copy(&sh->cfg.maddr[1][0], mac); ++ goto Done; ++ } ++ } ++ if (sh->cfg.mac_address_path[0] != 0x00) { ++ if ((readfile_mac ++ (sh->cfg.mac_address_path, &sh->cfg.maddr[0][0])) ++ && (is_valid_ether_addr(&sh->cfg.maddr[0][0]))) { ++ dev_info ++ (sh->sc->dev, "Using MAC address from configuration file\n"); ++ addr_increase_copy(&sh->cfg.maddr[1][0], ++ &sh->cfg.maddr[0][0]); ++ goto Done; ++ } ++ } ++ switch (sh->cfg.mac_address_mode) { ++ case 1: ++ get_random_bytes(&sh->cfg.maddr[0][0], ETH_ALEN); ++ sh->cfg.maddr[0][0] = sh->cfg.maddr[0][0] & 0xF0; ++ addr_increase_copy(&sh->cfg.maddr[1][0], ++ &sh->cfg.maddr[0][0]); ++ break; ++ case 2: ++ if ((readfile_mac ++ (sh->cfg.mac_output_path, &sh->cfg.maddr[0][0])) ++ && (is_valid_ether_addr(&sh->cfg.maddr[0][0]))) { ++ addr_increase_copy(&sh->cfg.maddr[1][0], ++ &sh->cfg.maddr[0][0]); ++ } else { ++ { ++ get_random_bytes(&sh->cfg.maddr[0][0], ++ ETH_ALEN); ++ sh->cfg.maddr[0][0] = ++ sh->cfg.maddr[0][0] & 0xF0; ++ addr_increase_copy(&sh->cfg.maddr[1][0], ++ &sh-> ++ cfg.maddr[0][0]); ++ if (sh->cfg.mac_output_path[0] != 0x00) ++ write_mac_to_file(sh-> ++ cfg.mac_output_path, ++ &sh-> ++ cfg.maddr[0] ++ [0]); ++ } ++ } ++ break; ++ default: ++ memcpy(&sh->cfg.maddr[0][0], pseudo_mac0, ETH_ALEN); ++ addr_increase_copy(&sh->cfg.maddr[1][0], pseudo_mac0); ++ break; ++ } ++ dev_info(sh->sc->dev, "MAC address from Software MAC mode[%d]\n", ++ sh->cfg.mac_address_mode); ++ } ++ Done: ++ dev_info(sh->sc->dev, "Chip identity from efuse: %08x\n", ssv_cfg.chip_identity); ++ dev_dbg(sh->sc->dev, "r_calbration_result- %x\n", ssv_cfg.r_calbration_result); ++ dev_dbg(sh->sc->dev, "sar_result- %x\n", ssv_cfg.sar_result); ++ dev_dbg(sh->sc->dev, "crystal_frequency_offset- %x\n", ++ ssv_cfg.crystal_frequency_offset); ++ dev_dbg(sh->sc->dev, "tx_power_index_1- %x\n", ssv_cfg.tx_power_index_1); ++ dev_dbg(sh->sc->dev, "tx_power_index_2- %x\n", ssv_cfg.tx_power_index_2); ++ dev_dbg(sh->sc->dev, "MAC address - %pM\n", rom_mac0); ++ sh->cfg.crystal_frequency_offset = ssv_cfg.crystal_frequency_offset; ++ sh->cfg.tx_power_index_1 = ssv_cfg.tx_power_index_1; ++ sh->cfg.tx_power_index_2 = ssv_cfg.tx_power_index_2; ++ sh->cfg.chip_identity = ssv_cfg.chip_identity; ++} +diff --git a/drivers/net/wireless/ssv6051/smac/efuse.h b/drivers/net/wireless/ssv6051/smac/efuse.h +new file mode 100644 +index 000000000000..c25280c5abad +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/efuse.h +@@ -0,0 +1,40 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_EFUSE_H_ ++#define _SSV_EFUSE_H_ ++#include "dev.h" ++struct efuse_map { ++ u8 offset; ++ u8 byte_cnts; ++ u16 value; ++}; ++enum efuse_data_item { ++ EFUSE_R_CALIBRATION_RESULT = 1, ++ EFUSE_SAR_RESULT, ++ EFUSE_MAC, ++ EFUSE_CRYSTAL_FREQUENCY_OFFSET, ++ EFUSE_TX_POWER_INDEX_1, ++ EFUSE_TX_POWER_INDEX_2 ++}; ++#define EFUSE_HWSET_MAX_SIZE (256-32) ++#define EFUSE_MAX_SECTION_MAP (EFUSE_HWSET_MAX_SIZE>>5) ++#define SSV_EFUSE_ID_READ_SWITCH 0xC2000128 ++#define SSV_EFUSE_ID_RAW_DATA_BASE 0xC200014C ++#define SSV_EFUSE_READ_SWITCH 0xC200012C ++#define SSV_EFUSE_RAW_DATA_BASE 0xC2000150 ++void efuse_read_all_map(struct ssv_hw *sh); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/init.c b/drivers/net/wireless/ssv6051/smac/init.c +new file mode 100644 +index 000000000000..592c52a28381 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/init.c +@@ -0,0 +1,1347 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) ++#include ++#else ++#include ++#endif ++#include ++#include ++#include ++#include "dev_tbl.h" ++#include "dev.h" ++#include "lib.h" ++#include "ssv_rc.h" ++#include "ap.h" ++#include "efuse.h" ++#include "sar.h" ++#include "ssv_cfgvendor.h" ++ ++#include "linux_80211.h" ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++#include "ssv6xxx_debugfs.h" ++#endif ++ ++#define WIFI_FIRMWARE_NAME "ssv6051-sw.bin" ++static const struct ieee80211_iface_limit ssv6xxx_p2p_limits[] = { ++ { ++ .max = 2, ++ .types = BIT(NL80211_IFTYPE_STATION), ++ }, ++ { ++ .max = 1, ++ .types = BIT(NL80211_IFTYPE_P2P_GO) | ++ BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_AP), ++ }, ++}; ++ ++static const struct ieee80211_iface_combination ++ ssv6xxx_iface_combinations_p2p[] = { ++ {.num_different_channels = 1, ++ .max_interfaces = SSV6200_MAX_VIF, ++ .beacon_int_infra_match = true, ++ .limits = ssv6xxx_p2p_limits, ++ .n_limits = ARRAY_SIZE(ssv6xxx_p2p_limits), ++ }, ++}; ++ ++#define LBYTESWAP(a) ((((a) & 0x00ff00ff) << 8) | \ ++ (((a) & 0xff00ff00) >> 8)) ++#define LONGSWAP(a) ((LBYTESWAP(a) << 16) | (LBYTESWAP(a) >> 16)) ++#define CHAN2G(_freq,_idx) { \ ++ .band = INDEX_80211_BAND_2GHZ, \ ++ .center_freq = (_freq), \ ++ .hw_value = (_idx), \ ++ .max_power = 20, \ ++} ++#ifndef WLAN_CIPHER_SUITE_SMS4 ++#define WLAN_CIPHER_SUITE_SMS4 0x00147201 ++#endif ++#define SHPCHECK(__hw_rate,__flags) \ ++ ((__flags & IEEE80211_RATE_SHORT_PREAMBLE) ? (__hw_rate +3 ) : 0) ++#define RATE(_bitrate,_hw_rate,_flags) { \ ++ .bitrate = (_bitrate), \ ++ .flags = (_flags), \ ++ .hw_value = (_hw_rate), \ ++ .hw_value_short = SHPCHECK(_hw_rate,_flags) \ ++} ++extern struct ssv6xxx_cfg ssv_cfg; ++static const struct ieee80211_channel ssv6200_2ghz_chantable[] = { ++ CHAN2G(2412, 1), ++ CHAN2G(2417, 2), ++ CHAN2G(2422, 3), ++ CHAN2G(2427, 4), ++ CHAN2G(2432, 5), ++ CHAN2G(2437, 6), ++ CHAN2G(2442, 7), ++ CHAN2G(2447, 8), ++ CHAN2G(2452, 9), ++ CHAN2G(2457, 10), ++ CHAN2G(2462, 11), ++ CHAN2G(2467, 12), ++ CHAN2G(2472, 13), ++ CHAN2G(2484, 14), ++}; ++ ++static struct ieee80211_rate ssv6200_legacy_rates[] = { ++ RATE(10, 0x00, 0), ++ RATE(20, 0x01, IEEE80211_RATE_SHORT_PREAMBLE), ++ RATE(55, 0x02, IEEE80211_RATE_SHORT_PREAMBLE), ++ RATE(110, 0x03, IEEE80211_RATE_SHORT_PREAMBLE), ++ RATE(60, 0x07, 0), ++ RATE(90, 0x08, 0), ++ RATE(120, 0x09, 0), ++ RATE(180, 0x0a, 0), ++ RATE(240, 0x0b, 0), ++ RATE(360, 0x0c, 0), ++ RATE(480, 0x0d, 0), ++ RATE(540, 0x0e, 0), ++}; ++ ++struct ssv6xxx_ch_cfg ch_cfg_z[] = { ++ {ADR_ABB_REGISTER_1, 0, 0x151559fc}, ++ {ADR_LDO_REGISTER, 0, 0x00eb7c1c}, ++ {ADR_RX_ADC_REGISTER, 0, 0x20d000d2} ++}; ++ ++struct ssv6xxx_ch_cfg ch_cfg_p[] = { ++ {ADR_ABB_REGISTER_1, 0, 0x151559fc}, ++ {ADR_RX_ADC_REGISTER, 0, 0x20d000d2} ++}; ++ ++int ssv6xxx_do_iq_calib(struct ssv_hw *sh, struct ssv6xxx_iqk_cfg *p_cfg) ++{ ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ int ret = 0; ++ dev_dbg(sh->sc->dev, "# Do init_cali (iq)\n"); ++ skb = ++ ssv_skb_alloc(HOST_CMD_HDR_LEN + IQK_CFG_LEN + PHY_SETTING_SIZE + ++ RF_SETTING_SIZE); ++ if (skb == NULL) { ++ dev_err(sh->sc->dev, "init ssv6xxx_do_iq_calib failure\n"); ++ return (-1); ++ } ++ if ((PHY_SETTING_SIZE > MAX_PHY_SETTING_TABLE_SIZE) || ++ (RF_SETTING_SIZE > MAX_RF_SETTING_TABLE_SIZE)) { ++ dev_warn(sh->sc->dev, "wrong RF or PHY table size\n"); ++ WARN_ON(1); ++ return (-1); ++ } ++ skb->data_len = ++ HOST_CMD_HDR_LEN + IQK_CFG_LEN + PHY_SETTING_SIZE + RF_SETTING_SIZE; ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_INIT_CALI; ++ host_cmd->len = skb->data_len; ++ p_cfg->phy_tbl_size = PHY_SETTING_SIZE; ++ p_cfg->rf_tbl_size = RF_SETTING_SIZE; ++ memcpy(host_cmd->dat32, p_cfg, IQK_CFG_LEN); ++ memcpy(host_cmd->dat8 + IQK_CFG_LEN, phy_setting, PHY_SETTING_SIZE); ++ memcpy(host_cmd->dat8 + IQK_CFG_LEN + PHY_SETTING_SIZE, ssv6200_rf_tbl, ++ RF_SETTING_SIZE); ++ sh->hci.hci_ops->hci_send_cmd(skb); ++ ssv_skb_free(skb); ++ { ++ u32 timeout; ++ sh->sc->iq_cali_done = IQ_CALI_RUNNING; ++ set_current_state(TASK_INTERRUPTIBLE); ++ timeout = wait_event_interruptible_timeout(sh->sc->fw_wait_q, ++ sh->sc->iq_cali_done, ++ msecs_to_jiffies ++ (500)); ++ set_current_state(TASK_RUNNING); ++ if (timeout == 0) ++ return -ETIME; ++ if (sh->sc->iq_cali_done != IQ_CALI_OK) ++ return (-1); ++ } ++ return ret; ++} ++ ++#define HT_CAP_RX_STBC_ONE_STREAM 0x1 ++#if defined(CONFIG_PM) ++static const struct wiphy_wowlan_support wowlan_support = { ++#ifdef SSV_WAKEUP_HOST ++ .flags = WIPHY_WOWLAN_ANY, ++#else ++ .flags = WIPHY_WOWLAN_DISCONNECT, ++#endif ++ .n_patterns = 0, ++ .pattern_max_len = 0, ++ .pattern_min_len = 0, ++ .max_pkt_offset = 0, ++}; ++#endif ++static void ssv6xxx_set_80211_hw_capab(struct ssv_softc *sc) ++{ ++ struct ieee80211_hw *hw = sc->hw; ++ struct ssv_hw *sh = sc->sh; ++ struct ieee80211_sta_ht_cap *ht_info; ++ ieee80211_hw_set(hw, SIGNAL_DBM); ++ hw->rate_control_algorithm = "ssv6xxx_rate_control"; ++ //hw->rate_control_algorithm = NULL; // NULL selects default ++ ht_info = &sc->sbands[INDEX_80211_BAND_2GHZ].ht_cap; ++ ampdu_db_log("sh->cfg.hw_caps = 0x%x\n", sh->cfg.hw_caps); ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_HT) { ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_RX) { ++ ieee80211_hw_set(hw, AMPDU_AGGREGATION); ++ ampdu_db_log("set IEEE80211_HW_AMPDU_AGGREGATION(%d)\n", ++ ieee80211_hw_check(hw, AMPDU_AGGREGATION)); ++ } ++ ht_info->cap = IEEE80211_HT_CAP_SM_PS; ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_GF) { ++ ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; ++ ht_info->cap |= ++ HT_CAP_RX_STBC_ONE_STREAM << ++ IEEE80211_HT_CAP_RX_STBC_SHIFT; ++ } ++ if (sh->cfg.hw_caps & SSV6200_HT_CAP_SGI_20) ++ ht_info->cap |= IEEE80211_HT_CAP_SGI_20; ++ ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_32K; ++ ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_8; ++ memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); ++ ht_info->mcs.rx_mask[0] = 0xff; ++ ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; ++ ht_info->mcs.rx_highest = cpu_to_le16(SSV6200_RX_HIGHEST_RATE); ++ ht_info->ht_supported = true; ++ } ++ hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_P2P) { ++ hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT); ++ hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO); ++ hw->wiphy->iface_combinations = ssv6xxx_iface_combinations_p2p; ++ hw->wiphy->n_iface_combinations = ++ ARRAY_SIZE(ssv6xxx_iface_combinations_p2p); ++ } ++ hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_AP) { ++ hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP); ++ hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; ++ } ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_TDLS) { ++ hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; ++ hw->wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; ++ dev_info(sc->dev, "TDLS function enabled in sta.cfg\n"); ++ } ++ hw->queues = 4; ++ hw->max_rates = 4; ++ hw->max_listen_interval = 1; ++ hw->max_rate_tries = HW_MAX_RATE_TRIES; ++ hw->extra_tx_headroom = TXPB_OFFSET + AMPDU_DELIMITER_LEN; ++ if (sizeof(struct ampdu_hdr_st) > SSV_SKB_info_size) ++ hw->extra_tx_headroom += sizeof(struct ampdu_hdr_st); ++ else ++ hw->extra_tx_headroom += SSV_SKB_info_size; ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_2GHZ) { ++ hw->wiphy->bands[INDEX_80211_BAND_2GHZ] = ++ &sc->sbands[INDEX_80211_BAND_2GHZ]; ++ } ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_TX) ++#ifdef PREFER_RX ++ hw->max_rx_aggregation_subframes = 64; ++#else ++ hw->max_rx_aggregation_subframes = 16; ++#endif ++ else ++ hw->max_rx_aggregation_subframes = 12; ++ hw->max_tx_aggregation_subframes = 64; ++ hw->sta_data_size = sizeof(struct ssv_sta_priv_data); ++ hw->vif_data_size = sizeof(struct ssv_vif_priv_data); ++ memcpy(sh->maddr[0].addr, &sh->cfg.maddr[0][0], ETH_ALEN); ++ hw->wiphy->addresses = sh->maddr; ++ hw->wiphy->n_addresses = 1; ++ if (sh->cfg.hw_caps & SSV6200_HW_CAP_P2P) { ++ int i; ++ for (i = 1; i < SSV6200_MAX_HW_MAC_ADDR; i++) { ++ memcpy(sh->maddr[i].addr, sh->maddr[i - 1].addr, ++ ETH_ALEN); ++ sh->maddr[i].addr[5]++; ++ hw->wiphy->n_addresses++; ++ } ++ } ++ if (!is_zero_ether_addr(sh->cfg.maddr[1])) { ++ memcpy(sh->maddr[1].addr, sh->cfg.maddr[1], ETH_ALEN); ++ if (hw->wiphy->n_addresses < 2) ++ hw->wiphy->n_addresses = 2; ++ } ++#if defined(CONFIG_PM) ++ hw->wiphy->wowlan = &wowlan_support; ++#endif ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0)) && defined(CONFIG_SSV_VENDOR_EXT_SUPPORT) ++ { ++ int err = 0; ++ struct ssv_softc *softc = (struct ssv_softc *)hw->priv; ++ if (softc) ++ { ++ set_wiphy_dev(hw->wiphy, softc->dev); ++ *((struct ssv_softc **)wiphy_priv(hw->wiphy)) = softc; ++ } ++ dev_dbg(sc->dev, "Registering Vendor80211\n"); ++ err = ssv_cfgvendor_attach(hw->wiphy); ++ if (unlikely(err < 0)) { ++ dev_err(sc->dev, "Couldn not attach vendor commands (%d)\n", err); ++ } ++ } ++#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0)) || defined(WL_VENDOR_EXT_SUPPORT) */ ++} ++ ++void ssv6xxx_watchdog_restart_hw(struct ssv_softc *sc) ++{ ++ dev_dbg(sc->dev, "%s()\n", __FUNCTION__); ++ sc->restart_counter++; ++ sc->force_triger_reset = true; ++ sc->beacon_info[0].pubf_addr = 0x00; ++ sc->beacon_info[1].pubf_addr = 0x00; ++ ieee80211_restart_hw(sc->hw); ++} ++ ++extern struct rssi_res_st rssi_res; ++void ssv6200_watchdog_timeout(struct timer_list *t) ++{ ++ static u32 count = 0; ++ struct rssi_res_st *rssi_tmp0 = NULL, *rssi_tmp1 = NULL; ++ struct ssv_softc *sc = from_timer(sc, t, watchdog_timeout); ++ if (sc->watchdog_flag == WD_BARKING) { ++ ssv6xxx_watchdog_restart_hw(sc); ++ mod_timer(&sc->watchdog_timeout, jiffies + WATCHDOG_TIMEOUT); ++ return; ++ } ++ if (sc->watchdog_flag != WD_SLEEP) ++ sc->watchdog_flag = WD_BARKING; ++ count++; ++ if (count == 6) { ++ count = 0; ++ if (list_empty(&rssi_res.rssi_list)) { ++ return; ++ } ++ list_for_each_entry_safe(rssi_tmp0, rssi_tmp1, ++ &rssi_res.rssi_list, rssi_list) { ++ if (rssi_tmp0->timeout) { ++ list_del_rcu(&rssi_tmp0->rssi_list); ++ kfree(rssi_tmp0); ++ } ++ } ++ } ++ mod_timer(&sc->watchdog_timeout, jiffies + WATCHDOG_TIMEOUT); ++ return; ++} ++ ++static void ssv6xxx_preload_sw_cipher(void) ++{ ++} ++ ++static int ssv6xxx_init_softc(struct ssv_softc *sc) ++{ ++ void *channels; ++ int ret = 0; ++ sc->sc_flags = SC_OP_INVALID; ++ mutex_init(&sc->mutex); ++ mutex_init(&sc->mem_mutex); ++ sc->config_wq = create_singlethread_workqueue("ssv6xxx_cong_wq"); ++ sc->thermal_wq = create_singlethread_workqueue("ssv6xxx_thermal_wq"); ++ INIT_DELAYED_WORK(&sc->thermal_monitor_work, thermal_monitor); ++ INIT_WORK(&sc->set_tim_work, ssv6200_set_tim_work); ++ INIT_WORK(&sc->bcast_start_work, ssv6200_bcast_start_work); ++ INIT_DELAYED_WORK(&sc->bcast_stop_work, ssv6200_bcast_stop_work); ++ INIT_DELAYED_WORK(&sc->bcast_tx_work, ssv6200_bcast_tx_work); ++ INIT_WORK(&sc->set_ampdu_rx_add_work, ssv6xxx_set_ampdu_rx_add_work); ++ INIT_WORK(&sc->set_ampdu_rx_del_work, ssv6xxx_set_ampdu_rx_del_work); ++ sc->mac_deci_tbl = sta_deci_tbl; ++ memset((void *)&sc->tx, 0, sizeof(struct ssv_tx)); ++ sc->tx.hw_txqid[WMM_AC_VO] = 3; ++ sc->tx.ac_txqid[3] = WMM_AC_VO; ++ sc->tx.hw_txqid[WMM_AC_VI] = 2; ++ sc->tx.ac_txqid[2] = WMM_AC_VI; ++ sc->tx.hw_txqid[WMM_AC_BE] = 1; ++ sc->tx.ac_txqid[1] = WMM_AC_BE; ++ sc->tx.hw_txqid[WMM_AC_BK] = 0; ++ sc->tx.ac_txqid[0] = WMM_AC_BK; ++ INIT_LIST_HEAD(&sc->tx.ampdu_tx_que); ++ spin_lock_init(&sc->tx.ampdu_tx_que_lock); ++ memset((void *)&sc->rx, 0, sizeof(struct ssv_rx)); ++ spin_lock_init(&sc->rx.rxq_lock); ++ skb_queue_head_init(&sc->rx.rxq_head); ++ sc->rx.rx_buf = ssv_skb_alloc(MAX_FRAME_SIZE); ++ if (sc->rx.rx_buf == NULL) ++ return -ENOMEM; ++ memset(&sc->bcast_txq, 0, sizeof(struct ssv6xxx_bcast_txq)); ++ spin_lock_init(&sc->bcast_txq.txq_lock); ++ skb_queue_head_init(&sc->bcast_txq.qhead); ++ spin_lock_init(&sc->ps_state_lock); ++#ifdef CONFIG_P2P_NOA ++ spin_lock_init(&sc->p2p_noa.p2p_config_lock); ++#endif ++ if (sc->sh->cfg.hw_caps & SSV6200_HW_CAP_2GHZ) { ++ channels = kmemdup(ssv6200_2ghz_chantable, ++ sizeof(ssv6200_2ghz_chantable), GFP_KERNEL); ++ if (!channels) { ++ kfree(sc->rx.rx_buf); ++ return -ENOMEM; ++ } ++ sc->sbands[INDEX_80211_BAND_2GHZ].channels = channels; ++ sc->sbands[INDEX_80211_BAND_2GHZ].band = INDEX_80211_BAND_2GHZ; ++ sc->sbands[INDEX_80211_BAND_2GHZ].n_channels = ++ ARRAY_SIZE(ssv6200_2ghz_chantable); ++ sc->sbands[INDEX_80211_BAND_2GHZ].bitrates = ++ ssv6200_legacy_rates; ++ sc->sbands[INDEX_80211_BAND_2GHZ].n_bitrates = ++ ARRAY_SIZE(ssv6200_legacy_rates); ++ } ++ sc->cur_channel = NULL; ++ sc->hw_chan = (-1); ++ ssv6xxx_set_80211_hw_capab(sc); ++ ret = ssv6xxx_rate_control_register(); ++ if (ret != 0) { ++ dev_warn(sc->dev, "%s(): Failed to register rc algorithm.\n",__FUNCTION__); ++ } ++ init_waitqueue_head(&sc->tx_wait_q); ++ sc->tx_wait_q_woken = 0; ++ skb_queue_head_init(&sc->tx_skb_q); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ sc->max_tx_skb_q_len = 0; ++#endif ++ sc->tx_task = kthread_run(ssv6xxx_tx_task, sc, "ssv6xxx_tx_task"); ++ sc->tx_q_empty = false; ++ skb_queue_head_init(&sc->tx_done_q); ++ init_waitqueue_head(&sc->rx_wait_q); ++ sc->rx_wait_q_woken = 0; ++ skb_queue_head_init(&sc->rx_skb_q); ++ sc->rx_task = kthread_run(ssv6xxx_rx_task, sc, "ssv6xxx_rx_task"); ++ ssv6xxx_preload_sw_cipher(); ++ timer_setup(&sc->watchdog_timeout, ssv6200_watchdog_timeout, 0); ++ init_waitqueue_head(&sc->fw_wait_q); ++ INIT_LIST_HEAD(&rssi_res.rssi_list); ++ rssi_res.rssi = 0; ++ mod_timer(&sc->watchdog_timeout, jiffies + WATCHDOG_TIMEOUT); ++ //add_timer(&sc->watchdog_timeout); ++ //if(get_flash_info(sc) == 1) ++ sc->is_sar_enabled = get_flash_info(sc); ++ if (sc->is_sar_enabled) ++ queue_delayed_work(sc->thermal_wq, &sc->thermal_monitor_work, ++ THERMAL_MONITOR_TIME); ++ //schedule_delayed_work(&sc->thermal_monitor_work, THERMAL_MONITOR_TIME); ++ return ret; ++} ++ ++static int ssv6xxx_deinit_softc(struct ssv_softc *sc) ++{ ++ void *channels; ++ struct sk_buff *skb; ++ u8 remain_size; ++ dev_dbg(sc->dev, "%s():\n", __FUNCTION__); ++ if (sc->sh->cfg.hw_caps & SSV6200_HW_CAP_2GHZ) { ++ channels = sc->sbands[INDEX_80211_BAND_2GHZ].channels; ++ kfree(channels); ++ } ++ ssv_skb_free(sc->rx.rx_buf); ++ sc->rx.rx_buf = NULL; ++ ssv6xxx_rate_control_unregister(); ++ cancel_delayed_work_sync(&sc->bcast_tx_work); ++ //ssv6xxx_watchdog_controller(sc->sh ,(u8)SSV6XXX_HOST_CMD_WATCHDOG_STOP); ++ del_timer_sync(&sc->watchdog_timeout); ++ cancel_delayed_work(&sc->thermal_monitor_work); ++ sc->ps_status = PWRSV_PREPARE; ++ flush_workqueue(sc->thermal_wq); ++ destroy_workqueue(sc->thermal_wq); ++ do { ++ skb = ssv6200_bcast_dequeue(&sc->bcast_txq, &remain_size); ++ if (skb) ++ ssv6xxx_txbuf_free_skb(skb, (void *)sc); ++ else ++ break; ++ } while (remain_size); ++ if (sc->tx_task != NULL) { ++ dev_dbg(sc->dev, "Stopping TX task...\n"); ++ kthread_stop(sc->tx_task); ++ sc->tx_task = NULL; ++ dev_dbg(sc->dev, "Stopped TX task.\n"); ++ } ++ if (sc->rx_task != NULL) { ++ dev_dbg(sc->dev, "Stopping RX task...\n"); ++ kthread_stop(sc->rx_task); ++ sc->rx_task = NULL; ++ dev_dbg(sc->dev, "Stopped RX task.\n"); ++ } ++ destroy_workqueue(sc->config_wq); ++ return 0; ++} ++ ++static void ssv6xxx_hw_set_replay_ignore(struct ssv_hw *sh, u8 ignore) ++{ ++ u32 temp; ++ SMAC_REG_READ(sh, ADR_SCRT_SET, &temp); ++ temp = temp & SCRT_RPLY_IGNORE_I_MSK; ++ temp |= (ignore << SCRT_RPLY_IGNORE_SFT); ++ SMAC_REG_WRITE(sh, ADR_SCRT_SET, temp); ++} ++ ++int ssv6xxx_init_mac(struct ssv_hw *sh) ++{ ++ struct ssv_softc *sc = sh->sc; ++ int i = 0, ret = 0; ++ ++ u32 *ptr, id_len, regval, temp[0x8]; ++ char *chip_id = sh->chip_id; ++ SMAC_REG_READ(sh, ADR_IC_TIME_TAG_1, ®val); ++ sh->chip_tag = ((u64) regval << 32); ++ SMAC_REG_READ(sh, ADR_IC_TIME_TAG_0, ®val); ++ sh->chip_tag |= (regval); ++ SMAC_REG_READ(sh, ADR_CHIP_ID_3, ®val); ++ *((u32 *) & chip_id[0]) = (u32) LONGSWAP(regval); ++ SMAC_REG_READ(sh, ADR_CHIP_ID_2, ®val); ++ *((u32 *) & chip_id[4]) = (u32) LONGSWAP(regval); ++ SMAC_REG_READ(sh, ADR_CHIP_ID_1, ®val); ++ *((u32 *) & chip_id[8]) = (u32) LONGSWAP(regval); ++ SMAC_REG_READ(sh, ADR_CHIP_ID_0, ®val); ++ *((u32 *) & chip_id[12]) = (u32) LONGSWAP(regval); ++ chip_id[12 + sizeof(u32)] = 0; ++ dev_info(sh->sc->dev, "chip id: %s, tag: %llx\n", chip_id, sh->chip_tag); ++ if (sc->ps_status == PWRSV_ENABLE) { ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_DATA, ++ M_ENG_MACRX | (M_ENG_ENCRYPT_SEC << 4) | ++ (M_ENG_HWHCI << 8)); ++ SMAC_REG_WRITE(sc->sh, ADR_RX_FLOW_MNG, ++ M_ENG_MACRX | (M_ENG_HWHCI << 4)); ++#if Enable_AMPDU_FW_Retry ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_CTRL, ++ M_ENG_MACRX | (M_ENG_CPU << 4) | (M_ENG_HWHCI << ++ 8)); ++#else ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_CTRL, ++ M_ENG_MACRX | (M_ENG_HWHCI << 4)); ++#endif ++ SMAC_REG_WRITE(sc->sh, ADR_MRX_FLT_TB0 + 6 * 4, ++ (sc->mac_deci_tbl[6])); ++ return ret; ++ } ++ SMAC_REG_SET_BITS(sh, ADR_PHY_EN_1, (0 << RG_PHY_MD_EN_SFT), ++ RG_PHY_MD_EN_MSK); ++ SMAC_REG_WRITE(sh, ADR_BRG_SW_RST, 1 << MAC_SW_RST_SFT); ++ do { ++ SMAC_REG_READ(sh, ADR_BRG_SW_RST, ®val); ++ i++; ++ if (i > 10000) { ++ dev_err(sh->sc->dev, "MAC reset fail !!!!\n"); ++ WARN_ON(1); ++ ret = 1; ++ goto exit; ++ } ++ } while (regval != 0); ++ SMAC_REG_WRITE(sc->sh, ADR_TXQ4_MTX_Q_AIFSN, 0xffff2101); ++ SMAC_REG_SET_BITS(sc->sh, ADR_MTX_BCN_EN_MISC, 0, ++ MTX_HALT_MNG_UNTIL_DTIM_MSK); ++ SMAC_REG_WRITE(sh, ADR_CONTROL, 0x12000006); ++ SMAC_REG_WRITE(sh, ADR_RX_TIME_STAMP_CFG, ++ ((28 << MRX_STP_OFST_SFT) | 0x01)); ++ SMAC_REG_WRITE(sh, ADR_HCI_TX_RX_INFO_SIZE, ++ ((u32) (TXPB_OFFSET) << TX_PBOFFSET_SFT) | ++ ((u32) (sh->tx_desc_len) << TX_INFO_SIZE_SFT) | ++ ((u32) (sh->rx_desc_len) << RX_INFO_SIZE_SFT) | ++ ((u32) (sh->rx_pinfo_pad) << RX_LAST_PHY_SIZE_SFT) ++ ); ++ SMAC_REG_READ(sh, ADR_MMU_CTRL, ®val); ++ regval |= (0xff << MMU_SHARE_MCU_SFT); ++ SMAC_REG_WRITE(sh, ADR_MMU_CTRL, regval); ++ SMAC_REG_READ(sh, ADR_MRX_WATCH_DOG, ®val); ++ regval &= 0xfffffff0; ++ SMAC_REG_WRITE(sh, ADR_MRX_WATCH_DOG, regval); ++ SMAC_REG_READ(sh, ADR_TRX_ID_THRESHOLD, &id_len); ++ id_len = (id_len & 0xffff0000) | ++ (SSV6200_ID_TX_THRESHOLD << TX_ID_THOLD_SFT) | ++ (SSV6200_ID_RX_THRESHOLD << RX_ID_THOLD_SFT); ++ SMAC_REG_WRITE(sh, ADR_TRX_ID_THRESHOLD, id_len); ++ SMAC_REG_READ(sh, ADR_ID_LEN_THREADSHOLD1, &id_len); ++ id_len = (id_len & 0x0f) | ++ (SSV6200_PAGE_TX_THRESHOLD << ID_TX_LEN_THOLD_SFT) | ++ (SSV6200_PAGE_RX_THRESHOLD << ID_RX_LEN_THOLD_SFT); ++ SMAC_REG_WRITE(sh, ADR_ID_LEN_THREADSHOLD1, id_len); ++#ifdef CONFIG_SSV_CABRIO_MB_DEBUG ++ SMAC_REG_READ(sh, ADR_MB_DBG_CFG3, ®val); ++ regval |= (debug_buffer << 0); ++ SMAC_REG_WRITE(sh, ADR_MB_DBG_CFG3, regval); ++ SMAC_REG_READ(sh, ADR_MB_DBG_CFG2, ®val); ++ regval |= (DEBUG_SIZE << 16); ++ SMAC_REG_WRITE(sh, ADR_MB_DBG_CFG2, regval); ++ SMAC_REG_READ(sh, ADR_MB_DBG_CFG1, ®val); ++ regval |= (1 << MB_DBG_EN_SFT); ++ SMAC_REG_WRITE(sh, ADR_MB_DBG_CFG1, regval); ++ SMAC_REG_READ(sh, ADR_MBOX_HALT_CFG, ®val); ++ regval |= (1 << MB_ERR_AUTO_HALT_EN_SFT); ++ SMAC_REG_WRITE(sh, ADR_MBOX_HALT_CFG, regval); ++#endif ++ SMAC_REG_READ(sc->sh, ADR_MTX_BCN_EN_MISC, ®val); ++ regval |= (1 << MTX_TSF_TIMER_EN_SFT); ++ SMAC_REG_WRITE(sc->sh, ADR_MTX_BCN_EN_MISC, regval); ++ SMAC_REG_WRITE(sh, 0xcd010004, 0x1213); ++ for (i = 0; i < SSV_RC_MAX_STA; i++) { ++ if (i == 0) { ++ sh->hw_buf_ptr[i] = ++ ssv6xxx_pbuf_alloc(sc, ++ sizeof(phy_info_tbl) + ++ sizeof(struct ssv6xxx_hw_sec), ++ NOTYPE_BUF); ++ if ((sh->hw_buf_ptr[i] >> 28) != 8) { ++ dev_err(sh->sc->dev, "opps allocate pbuf error\n"); ++ WARN_ON(1); ++ ret = 1; ++ goto exit; ++ } ++ } else { ++ sh->hw_buf_ptr[i] = ++ ssv6xxx_pbuf_alloc(sc, ++ sizeof(struct ssv6xxx_hw_sec), ++ NOTYPE_BUF); ++ if ((sh->hw_buf_ptr[i] >> 28) != 8) { ++ dev_err(sh->sc->dev, "opps allocate pbuf error\n"); ++ WARN_ON(1); ++ ret = 1; ++ goto exit; ++ } ++ } ++ } ++ for (i = 0; i < 0x8; i++) { ++ temp[i] = 0; ++ temp[i] = ssv6xxx_pbuf_alloc(sc, 256, NOTYPE_BUF); ++ } ++ for (i = 0; i < 0x8; i++) { ++ if (temp[i] == 0x800e0000) ++ dev_dbg(sh->sc->dev, "Found 0x800e0000 at position %d\n", i); ++ else ++ ssv6xxx_pbuf_free(sc, temp[i]); ++ } ++ for (i = 0; i < SSV_RC_MAX_STA; i++) ++ sh->hw_sec_key[i] = sh->hw_buf_ptr[i]; ++ for (i = 0; i < SSV_RC_MAX_STA; i++) { ++ int x; ++ for (x = 0; x < sizeof(struct ssv6xxx_hw_sec); x += 4) { ++ SMAC_REG_WRITE(sh, sh->hw_sec_key[i] + x, 0); ++ } ++ } ++ SMAC_REG_READ(sh, ADR_SCRT_SET, ®val); ++ regval &= SCRT_PKT_ID_I_MSK; ++ regval |= ((sh->hw_sec_key[0] >> 16) << SCRT_PKT_ID_SFT); ++ SMAC_REG_WRITE(sh, ADR_SCRT_SET, regval); ++ sh->hw_pinfo = sh->hw_sec_key[0] + sizeof(struct ssv6xxx_hw_sec); ++ for (i = 0, ptr = phy_info_tbl; i < PHY_INFO_TBL1_SIZE; i++, ptr++) { ++ SMAC_REG_WRITE(sh, ADR_INFO0 + i * 4, *ptr); ++ SMAC_REG_CONFIRM(sh, ADR_INFO0 + i * 4, *ptr); ++ } ++ for (i = 0; i < PHY_INFO_TBL2_SIZE; i++, ptr++) { ++ SMAC_REG_WRITE(sh, sh->hw_pinfo + i * 4, *ptr); ++ SMAC_REG_CONFIRM(sh, sh->hw_pinfo + i * 4, *ptr); ++ } ++ for (i = 0; i < PHY_INFO_TBL3_SIZE; i++, ptr++) { ++ SMAC_REG_WRITE(sh, sh->hw_pinfo + ++ (PHY_INFO_TBL2_SIZE << 2) + i * 4, *ptr); ++ SMAC_REG_CONFIRM(sh, sh->hw_pinfo + ++ (PHY_INFO_TBL2_SIZE << 2) + i * 4, *ptr); ++ } ++ SMAC_REG_WRITE(sh, ADR_INFO_RATE_OFFSET, 0x00040000); ++ SMAC_REG_WRITE(sh, ADR_INFO_IDX_ADDR, sh->hw_pinfo); ++ SMAC_REG_WRITE(sh, ADR_INFO_LEN_ADDR, ++ sh->hw_pinfo + (PHY_INFO_TBL2_SIZE) * 4); ++ dev_dbg(sh->sc->dev, "ADR_INFO_IDX_ADDR[%08x] ADR_INFO_LEN_ADDR[%08x]\n", ++ sh->hw_pinfo, sh->hw_pinfo + (PHY_INFO_TBL2_SIZE) * 4); ++ SMAC_REG_WRITE(sh, ADR_GLBLE_SET, ++ (0 << OP_MODE_SFT) | (0 << SNIFFER_MODE_SFT) | (1 << ++ DUP_FLT_SFT) ++ | (SSV6200_TX_PKT_RSVD_SETTING << TX_PKT_RSVD_SFT) | ++ ((u32) (RXPB_OFFSET) << PB_OFFSET_SFT) ++ ); ++ SMAC_REG_WRITE(sh, ADR_STA_MAC_0, *((u32 *) & sh->cfg.maddr[0][0])); ++ SMAC_REG_WRITE(sh, ADR_STA_MAC_1, *((u32 *) & sh->cfg.maddr[0][4])); ++ SMAC_REG_WRITE(sh, ADR_BSSID_0, *((u32 *) & sc->bssid[0])); ++ SMAC_REG_WRITE(sh, ADR_BSSID_1, *((u32 *) & sc->bssid[4])); ++ SMAC_REG_WRITE(sh, ADR_TX_ETHER_TYPE_0, 0x00000000); ++ SMAC_REG_WRITE(sh, ADR_TX_ETHER_TYPE_1, 0x00000000); ++ SMAC_REG_WRITE(sh, ADR_RX_ETHER_TYPE_0, 0x00000000); ++ SMAC_REG_WRITE(sh, ADR_RX_ETHER_TYPE_1, 0x00000000); ++ SMAC_REG_WRITE(sh, ADR_REASON_TRAP0, 0x7FBC7F87); ++ SMAC_REG_WRITE(sh, ADR_REASON_TRAP1, 0x0000003F); ++ SMAC_REG_WRITE(sh, ADR_TRAP_HW_ID, M_ENG_CPU); ++ SMAC_REG_WRITE(sh, ADR_WSID0, 0x00000000); ++ SMAC_REG_WRITE(sh, ADR_WSID1, 0x00000000); ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_DATA, ++ M_ENG_MACRX | (M_ENG_ENCRYPT_SEC << 4) | (M_ENG_HWHCI << ++ 8)); ++#if defined(CONFIG_P2P_NOA) || defined(CONFIG_RX_MGMT_CHECK) ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_MNG, ++ M_ENG_MACRX | (M_ENG_CPU << 4) | (M_ENG_HWHCI << 8)); ++#else ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_MNG, M_ENG_MACRX | (M_ENG_HWHCI << 4)); ++#endif ++#if Enable_AMPDU_FW_Retry ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_CTRL, ++ M_ENG_MACRX | (M_ENG_CPU << 4) | (M_ENG_HWHCI << 8)); ++#else ++ SMAC_REG_WRITE(sh, ADR_RX_FLOW_CTRL, M_ENG_MACRX | (M_ENG_HWHCI << 4)); ++#endif ++ ssv6xxx_hw_set_replay_ignore(sh, 1); ++ ssv6xxx_update_decision_table(sc); ++ SMAC_REG_SET_BITS(sc->sh, ADR_GLBLE_SET, SSV6200_OPMODE_STA, ++ OP_MODE_MSK); ++ SMAC_REG_WRITE(sh, ADR_SDIO_MASK, 0xfffe1fff); ++ SMAC_REG_WRITE(sh, ADR_TX_LIMIT_INTR, 0x80000000 | ++ SSV6200_TX_LOWTHRESHOLD_ID_TRIGGER << 16 | ++ SSV6200_TX_LOWTHRESHOLD_PAGE_TRIGGER); ++#ifdef CONFIG_SSV_SUPPORT_BTCX ++ SMAC_REG_WRITE(sh, ADR_BTCX0, ++ COEXIST_EN_MSK | (WIRE_MODE_SZ << WIRE_MODE_SFT) ++ | WIFI_TX_SW_POL_MSK | BT_SW_POL_MSK); ++ SMAC_REG_WRITE(sh, ADR_BTCX1, ++ SSV6200_BT_PRI_SMP_TIME | (SSV6200_BT_STA_SMP_TIME << ++ BT_STA_SMP_TIME_SFT) ++ | (SSV6200_WLAN_REMAIN_TIME << WLAN_REMAIN_TIME_SFT)); ++ SMAC_REG_WRITE(sh, ADR_SWITCH_CTL, BT_2WIRE_EN_MSK); ++ SMAC_REG_WRITE(sh, ADR_PAD7, 1); ++ SMAC_REG_WRITE(sh, ADR_PAD8, 0); ++ SMAC_REG_WRITE(sh, ADR_PAD9, 1); ++ SMAC_REG_WRITE(sh, ADR_PAD25, 1); ++ SMAC_REG_WRITE(sh, ADR_PAD27, 8); ++ SMAC_REG_WRITE(sh, ADR_PAD28, 8); ++#endif ++ dev_info(sh->sc->dev, "attempt to load firmware %s\n", WIFI_FIRMWARE_NAME); ++ ret = SMAC_LOAD_FW(sh, WIFI_FIRMWARE_NAME, 0); ++ ++ SMAC_REG_READ(sh, FW_VERSION_REG, ®val); ++ if (regval == ssv_firmware_version) { ++ SMAC_REG_SET_BITS(sh, ADR_PHY_EN_1, (1 << RG_PHY_MD_EN_SFT), ++ RG_PHY_MD_EN_MSK); ++ dev_info(sh->sc->dev, "Firmware version %d\n", regval); ++ } else { ++ dev_err(sh->sc->dev, "Firmware version not mapping %d\n", regval); ++ ret = -1; ++ } ++ ssv6xxx_watchdog_controller(sh, (u8) SSV6XXX_HOST_CMD_WATCHDOG_START); ++ exit: ++ return ret; ++} ++ ++void ssv6xxx_deinit_mac(struct ssv_softc *sc) ++{ ++ int i; ++ for (i = 0; i < SSV_RC_MAX_STA; i++) { ++ if (sc->sh->hw_buf_ptr[i]) ++ ssv6xxx_pbuf_free(sc, sc->sh->hw_buf_ptr[i]); ++ } ++} ++ ++void inline ssv6xxx_deinit_hw(struct ssv_softc *sc) ++{ ++ dev_dbg(sc->dev, "%s(): \n", __FUNCTION__); ++ ssv6xxx_deinit_mac(sc); ++} ++ ++void ssv6xxx_restart_hw(struct ssv_softc *sc) ++{ ++ dev_info(sc->dev, "Software MAC reset\n"); ++ sc->restart_counter++; ++ sc->force_triger_reset = true; ++ HCI_STOP(sc->sh); ++ SMAC_REG_WRITE(sc->sh, 0xce000004, 0x0); ++ sc->beacon_info[0].pubf_addr = 0x00; ++ sc->beacon_info[1].pubf_addr = 0x00; ++ ieee80211_restart_hw(sc->hw); ++} ++ ++extern struct ssv6xxx_iqk_cfg init_iqk_cfg; ++static int ssv6xxx_init_hw(struct ssv_hw *sh) ++{ ++ int ret = 0, i = 0, x = 0; ++ u32 regval; ++ sh->tx_desc_len = SSV6XXX_TX_DESC_LEN; ++ sh->rx_desc_len = SSV6XXX_RX_DESC_LEN; ++ sh->rx_pinfo_pad = 0x04; ++ sh->tx_page_available = SSV6200_PAGE_TX_THRESHOLD; ++ sh->ampdu_divider = SSV6XXX_AMPDU_DIVIDER; ++ memset(sh->page_count, 0, sizeof(sh->page_count)); ++ if (sh->cfg.force_chip_identity) { ++ dev_info(sh->sc->dev, "Force use external RF setting [%08x]\n", ++ sh->cfg.force_chip_identity); ++ sh->cfg.chip_identity = sh->cfg.force_chip_identity; ++ } ++ if (sh->cfg.chip_identity == SSV6051Z) { ++ sh->p_ch_cfg = &ch_cfg_z[0]; ++ sh->ch_cfg_size = ++ sizeof(ch_cfg_z) / sizeof(struct ssv6xxx_ch_cfg); ++ memcpy(phy_info_tbl, phy_info_6051z, sizeof(phy_info_6051z)); ++ } else if (sh->cfg.chip_identity == SSV6051P) { ++ sh->p_ch_cfg = &ch_cfg_p[0]; ++ sh->ch_cfg_size = ++ sizeof(ch_cfg_p) / sizeof(struct ssv6xxx_ch_cfg); ++ } ++ switch (sh->cfg.chip_identity) { ++ case SSV6051Q_P1: ++ case SSV6051Q_P2: ++ case SSV6051Q: ++ dev_info(sh->sc->dev, "Using SSV6051Q setting\n"); ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == 0xCE010008) ++ ssv6200_rf_tbl[i].data = 0x008DF61B; ++ if (ssv6200_rf_tbl[i].address == 0xCE010014) ++ ssv6200_rf_tbl[i].data = 0x3D3E84FE; ++ if (ssv6200_rf_tbl[i].address == 0xCE010018) ++ ssv6200_rf_tbl[i].data = 0x01457D79; ++ if (ssv6200_rf_tbl[i].address == 0xCE01001C) ++ ssv6200_rf_tbl[i].data = 0x000103A7; ++ if (ssv6200_rf_tbl[i].address == 0xCE010020) ++ ssv6200_rf_tbl[i].data = 0x000103A6; ++ if (ssv6200_rf_tbl[i].address == 0xCE01002C) ++ ssv6200_rf_tbl[i].data = 0x00032CA8; ++ if (ssv6200_rf_tbl[i].address == 0xCE010048) ++ ssv6200_rf_tbl[i].data = 0xFCCCCF27; ++ if (ssv6200_rf_tbl[i].address == 0xCE010050) ++ ssv6200_rf_tbl[i].data = 0x0047C000; ++ } ++ break; ++ case SSV6051Z: ++ dev_info(sh->sc->dev, "Using SSV6051Z setting\n"); ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == 0xCE010008) ++ ssv6200_rf_tbl[i].data = 0x004D561C; ++ if (ssv6200_rf_tbl[i].address == 0xCE010014) ++ ssv6200_rf_tbl[i].data = 0x3D9E84FE; ++ if (ssv6200_rf_tbl[i].address == 0xCE010018) ++ ssv6200_rf_tbl[i].data = 0x00457D79; ++ if (ssv6200_rf_tbl[i].address == 0xCE01001C) ++ ssv6200_rf_tbl[i].data = 0x000103EB; ++ if (ssv6200_rf_tbl[i].address == 0xCE010020) ++ ssv6200_rf_tbl[i].data = 0x000103EA; ++ if (ssv6200_rf_tbl[i].address == 0xCE01002C) ++ ssv6200_rf_tbl[i].data = 0x00062CA8; ++ if (ssv6200_rf_tbl[i].address == 0xCE010048) ++ ssv6200_rf_tbl[i].data = 0xFCCCCF27; ++ if (ssv6200_rf_tbl[i].address == 0xCE010050) ++ ssv6200_rf_tbl[i].data = 0x0047C000; ++ } ++ break; ++ case SSV6051P: ++ dev_info(sh->sc->dev, "Using SSV6051P setting\n"); ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == 0xCE010008) ++ ssv6200_rf_tbl[i].data = 0x008B7C1C; ++ if (ssv6200_rf_tbl[i].address == 0xCE010014) ++ ssv6200_rf_tbl[i].data = 0x3D7E84FE; ++ if (ssv6200_rf_tbl[i].address == 0xCE010018) ++ ssv6200_rf_tbl[i].data = 0x01457D79; ++ if (ssv6200_rf_tbl[i].address == 0xCE01001C) ++ ssv6200_rf_tbl[i].data = 0x000103EB; ++ if (ssv6200_rf_tbl[i].address == 0xCE010020) ++ ssv6200_rf_tbl[i].data = 0x000103EA; ++ if (ssv6200_rf_tbl[i].address == 0xCE01002C) ++ ssv6200_rf_tbl[i].data = 0x00032CA8; ++ if (ssv6200_rf_tbl[i].address == 0xCE010048) ++ ssv6200_rf_tbl[i].data = 0xFCCCCC27; ++ if (ssv6200_rf_tbl[i].address == 0xCE010050) ++ ssv6200_rf_tbl[i].data = 0x0047C000; ++ if (ssv6200_rf_tbl[i].address == 0xC0001D00) ++ ssv6200_rf_tbl[i].data = 0x5E000040; ++ } ++ break; ++ default: ++ dev_err(sh->sc->dev, "No RF setting\n"); ++ break; ++ } ++ if (sh->cfg.crystal_type == SSV6XXX_IQK_CFG_XTAL_26M) { ++ init_iqk_cfg.cfg_xtal = SSV6XXX_IQK_CFG_XTAL_26M; ++ dev_info(sh->sc->dev, "Crystal frequency: 26 Mhz\n"); ++ } else if (sh->cfg.crystal_type == SSV6XXX_IQK_CFG_XTAL_40M) { ++ init_iqk_cfg.cfg_xtal = SSV6XXX_IQK_CFG_XTAL_40M; ++ dev_info(sh->sc->dev, "Crystal frequency: 40 Mhz\n"); ++ } else if (sh->cfg.crystal_type == SSV6XXX_IQK_CFG_XTAL_24M) { ++ init_iqk_cfg.cfg_xtal = SSV6XXX_IQK_CFG_XTAL_24M; ++ dev_info(sh->sc->dev, "Crystal frequency: 24 Mhz\n"); ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == ADR_SX_ENABLE_REGISTER) ++ ssv6200_rf_tbl[i].data = 0x0003E07C; ++ if (ssv6200_rf_tbl[i].address == ++ ADR_DPLL_DIVIDER_REGISTER) ++ ssv6200_rf_tbl[i].data = 0x00406000; ++ if (ssv6200_rf_tbl[i].address == ++ ADR_DPLL_FB_DIVIDER_REGISTERS_I) ++ ssv6200_rf_tbl[i].data = 0x00000028; ++ if (ssv6200_rf_tbl[i].address == ++ ADR_DPLL_FB_DIVIDER_REGISTERS_II) ++ ssv6200_rf_tbl[i].data = 0x00000000; ++ } ++ } else { ++ dev_warn(sh->sc->dev, "Illegal crystal setting, using default value of 26 Mhz\n"); ++ } ++ for (i = 0; ++ i < sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == ++ ADR_SYN_KVCO_XO_FINE_TUNE_CBANK) { ++ if (sh->cfg.crystal_frequency_offset) { ++ ssv6200_rf_tbl[i].data &= ++ RG_XOSC_CBANK_XO_I_MSK; ++ ssv6200_rf_tbl[i].data |= ++ (sh->cfg. ++ crystal_frequency_offset << ++ RG_XOSC_CBANK_XO_SFT); ++ } ++ } ++ } ++ for (i = 0; i < sizeof(phy_setting) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (phy_setting[i].address == ADR_TX_GAIN_FACTOR) { ++ switch (sh->cfg.chip_identity) { ++ case SSV6051Q_P1: ++ case SSV6051Q_P2: ++ case SSV6051Q: ++ dev_dbg(sh->sc->dev, "SSV6051Q setting [0x5B606C72]\n"); ++ phy_setting[i].data = 0x5B606C72; ++ break; ++ case SSV6051Z: ++ dev_dbg(sh->sc->dev, "SSV6051Z setting [0x60606060]\n"); ++ phy_setting[i].data = 0x60606060; ++ break; ++ case SSV6051P: ++ dev_dbg(sh->sc->dev, "SSV6051P setting [0x6C726C72]\n"); ++ phy_setting[i].data = 0x6C726C72; ++ break; ++ default: ++ dev_dbg(sh->sc->dev, "Use default power setting\n"); ++ break; ++ } ++ if (sh->cfg.wifi_tx_gain_level_b) { ++ phy_setting[i].data &= 0xffff0000; ++ phy_setting[i].data |= ++ wifi_tx_gain[sh->cfg. ++ wifi_tx_gain_level_b] & ++ 0x0000ffff; ++ } ++ if (sh->cfg.wifi_tx_gain_level_gn) { ++ phy_setting[i].data &= 0x0000ffff; ++ phy_setting[i].data |= ++ wifi_tx_gain[sh->cfg. ++ wifi_tx_gain_level_gn] & ++ 0xffff0000; ++ } ++ dev_dbg(sh->sc->dev, "TX power setting 0x%x\n", phy_setting[i].data); ++ init_iqk_cfg.cfg_def_tx_scale_11b = ++ (phy_setting[i].data >> 0) & 0xff; ++ init_iqk_cfg.cfg_def_tx_scale_11b_p0d5 = ++ (phy_setting[i].data >> 8) & 0xff; ++ init_iqk_cfg.cfg_def_tx_scale_11g = ++ (phy_setting[i].data >> 16) & 0xff; ++ init_iqk_cfg.cfg_def_tx_scale_11g_p0d5 = ++ (phy_setting[i].data >> 24) & 0xff; ++ break; ++ } ++ } ++ if (sh->cfg.volt_regulator == SSV6XXX_VOLT_LDO_CONVERT) { ++ dev_info(sh->sc->dev, "Using LDO voltage regulator\n"); ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == ADR_PMU_2) { ++ ssv6200_rf_tbl[i].data &= 0xFFFFFFFE; ++ ssv6200_rf_tbl[i].data |= 0x00000000; ++ } ++ } ++ } else if (sh->cfg.volt_regulator == SSV6XXX_VOLT_DCDC_CONVERT) { ++ dev_info(sh->sc->dev, "Using DCDC buck regulator\n"); ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == ADR_PMU_2) { ++ ssv6200_rf_tbl[i].data &= 0xFFFFFFFE; ++ ssv6200_rf_tbl[i].data |= 0x00000001; ++ } ++ } ++ } else { ++ dev_warn(sh->sc->dev, "Illegal regulator setting, using DCDC buck as default\n"); ++ } ++ while (ssv_cfg.configuration[x][0]) { ++ for (i = 0; ++ i < ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (ssv6200_rf_tbl[i].address == ++ ssv_cfg.configuration[x][0]) { ++ ssv6200_rf_tbl[i].data = ++ ssv_cfg.configuration[x][1]; ++ break; ++ } ++ } ++ for (i = 0; ++ i < sizeof(phy_setting) / sizeof(struct ssv6xxx_dev_table); ++ i++) { ++ if (phy_setting[i].address == ++ ssv_cfg.configuration[x][0]) { ++ phy_setting[i].data = ++ ssv_cfg.configuration[x][1]; ++ break; ++ } ++ } ++ x++; ++ }; ++ if (ret == 0) ++ ret = SSV6XXX_SET_HW_TABLE(sh, ssv6200_rf_tbl); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_PHY_EN_1, 0x00000000); ++ SMAC_REG_READ(sh, ADR_PHY_EN_0, ®val); ++ if (regval & (1 << RG_RF_BB_CLK_SEL_SFT)) { ++ dev_dbg(sh->sc->dev, "already do clock switch\n"); ++ } else { ++ dev_dbg(sh->sc->dev, "reset PLL\n"); ++ SMAC_REG_READ(sh, ADR_DPLL_CP_PFD_REGISTER, ®val); ++ regval |= ++ ((1 << RG_DP_BBPLL_PD_SFT) | ++ (1 << RG_DP_BBPLL_SDM_EDGE_SFT)); ++ SMAC_REG_WRITE(sh, ADR_DPLL_CP_PFD_REGISTER, regval); ++ regval &= ++ ~((1 << RG_DP_BBPLL_PD_SFT) | ++ (1 << RG_DP_BBPLL_SDM_EDGE_SFT)); ++ SMAC_REG_WRITE(sh, ADR_DPLL_CP_PFD_REGISTER, regval); ++ mdelay(10); ++ } ++ if (ret == 0) ++ ret = SSV6XXX_SET_HW_TABLE(sh, ssv6200_phy_tbl); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_TRX_DUMMY_REGISTER, 0xEAAAAAAA); ++ SMAC_REG_READ(sh, ADR_TRX_DUMMY_REGISTER, ®val); ++ if (regval != 0xEAAAAAAA) { ++ dev_warn(sh->sc->dev, "Unexpected register value\n"); ++ WARN_ON(1); ++ } ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_PAD53, 0x21); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_PAD54, 0x3000); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_PIN_SEL_0, 0x4000); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, 0xc0000304, 0x01); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, 0xc0000308, 0x01); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_CLOCK_SELECTION, 0x3); ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_TRX_DUMMY_REGISTER, 0xAAAAAAAA); ++ if ((ret = ssv6xxx_set_channel(sh->sc, sh->cfg.def_chan))) ++ return ret; ++ if (ret == 0) ++ ret = SMAC_REG_WRITE(sh, ADR_PHY_EN_1, ++ (RG_PHYRX_MD_EN_MSK | RG_PHYTX_MD_EN_MSK | ++ RG_PHY11GN_MD_EN_MSK | RG_PHY11B_MD_EN_MSK ++ | RG_PHYRXFIFO_MD_EN_MSK | ++ RG_PHYTXFIFO_MD_EN_MSK | ++ RG_PHY11BGN_MD_EN_MSK)); ++ return ret; ++} ++ ++static void ssv6xxx_check_mac2(struct ssv_hw *sh) ++{ ++ const u8 addr_mask[6] = { 0xfd, 0xff, 0xff, 0xff, 0xff, 0xfc }; ++ u8 i; ++ bool invalid = false; ++ for (i = 0; i < 6; i++) { ++ if ((ssv_cfg.maddr[0][i] & addr_mask[i]) != ++ (ssv_cfg.maddr[1][i] & addr_mask[i])) { ++ invalid = true; ++ dev_dbg(sh->sc->dev, " i %d , mac1[i] %x, mac2[i] %x, mask %x \n", i, ++ ssv_cfg.maddr[0][i], ssv_cfg.maddr[1][i], ++ addr_mask[i]); ++ break; ++ } ++ } ++ if (invalid) { ++ memcpy(&ssv_cfg.maddr[1][0], &ssv_cfg.maddr[0][0], 6); ++ ssv_cfg.maddr[1][5] ^= 0x01; ++ if (ssv_cfg.maddr[1][5] < ssv_cfg.maddr[0][5]) { ++ u8 temp; ++ temp = ssv_cfg.maddr[0][5]; ++ ssv_cfg.maddr[0][5] = ssv_cfg.maddr[1][5]; ++ ssv_cfg.maddr[1][5] = temp; ++ sh->cfg.maddr[0][5] = ssv_cfg.maddr[0][5]; ++ } ++ dev_warn(sh->sc->dev, "MAC 2 address invalid!!\n"); ++ dev_warn(sh->sc->dev, "After modification, MAC1 %pM, MAC2 %pM\n", ++ ssv_cfg.maddr[0], ssv_cfg.maddr[1]); ++ } ++} ++ ++static int ssv6xxx_read_configuration(struct ssv_hw *sh) ++{ ++ extern u32 sdio_sr_bhvr; ++ if (is_valid_ether_addr(&ssv_cfg.maddr[0][0])) ++ memcpy(&sh->cfg.maddr[0][0], &ssv_cfg.maddr[0][0], ETH_ALEN); ++ if (is_valid_ether_addr(&ssv_cfg.maddr[1][0])) { ++ ssv6xxx_check_mac2(sh); ++ memcpy(&sh->cfg.maddr[1][0], &ssv_cfg.maddr[1][0], ETH_ALEN); ++ } ++ if (ssv_cfg.hw_caps) ++ sh->cfg.hw_caps = ssv_cfg.hw_caps; ++ else ++ sh->cfg.hw_caps = SSV6200_HW_CAP_HT | ++ SSV6200_HW_CAP_2GHZ | ++ SSV6200_HW_CAP_SECURITY | ++ SSV6200_HW_CAP_P2P | ++ SSV6200_HT_CAP_SGI_20 | ++ SSV6200_HW_CAP_AMPDU_RX | ++ SSV6200_HW_CAP_AMPDU_TX | SSV6200_HW_CAP_AP; ++ if (ssv_cfg.def_chan) ++ sh->cfg.def_chan = ssv_cfg.def_chan; ++ else ++ sh->cfg.def_chan = 6; ++ sh->cfg.use_wpa2_only = ssv_cfg.use_wpa2_only; ++ if (ssv_cfg.crystal_type == 26) ++ sh->cfg.crystal_type = SSV6XXX_IQK_CFG_XTAL_26M; ++ else if (ssv_cfg.crystal_type == 40) ++ sh->cfg.crystal_type = SSV6XXX_IQK_CFG_XTAL_40M; ++ else if (ssv_cfg.crystal_type == 24) ++ sh->cfg.crystal_type = SSV6XXX_IQK_CFG_XTAL_24M; ++ else { ++ dev_warn(sh->sc->dev, "Please redefine xtal_clock(wifi.cfg)!!\n"); ++ WARN_ON(1); ++ return 1; ++ } ++ if (ssv_cfg.volt_regulator < 2) ++ sh->cfg.volt_regulator = ssv_cfg.volt_regulator; ++ else { ++ dev_warn(sh->sc->dev, "Please redefine volt_regulator(wifi.cfg)!!\n"); ++ WARN_ON(1); ++ return 1; ++ } ++ sh->cfg.wifi_tx_gain_level_gn = ssv_cfg.wifi_tx_gain_level_gn; ++ sh->cfg.wifi_tx_gain_level_b = ssv_cfg.wifi_tx_gain_level_b; ++ sh->cfg.rssi_ctl = ssv_cfg.rssi_ctl; ++ sh->cfg.sr_bhvr = ssv_cfg.sr_bhvr; ++ sdio_sr_bhvr = ssv_cfg.sr_bhvr; ++ sh->cfg.force_chip_identity = ssv_cfg.force_chip_identity; ++ strncpy(sh->cfg.firmware_path, ssv_cfg.firmware_path, ++ sizeof(sh->cfg.firmware_path) - 1); ++ strncpy(sh->cfg.flash_bin_path, ssv_cfg.flash_bin_path, ++ sizeof(sh->cfg.flash_bin_path) - 1); ++ strncpy(sh->cfg.mac_address_path, ssv_cfg.mac_address_path, ++ sizeof(sh->cfg.mac_address_path) - 1); ++ strncpy(sh->cfg.mac_output_path, ssv_cfg.mac_output_path, ++ sizeof(sh->cfg.mac_output_path) - 1); ++ sh->cfg.ignore_efuse_mac = ssv_cfg.ignore_efuse_mac; ++ sh->cfg.mac_address_mode = ssv_cfg.mac_address_mode; ++ return 0; ++} ++ ++static int ssv6xxx_read_hw_info(struct ssv_softc *sc) ++{ ++ struct ssv_hw *sh; ++ sh = kzalloc(sizeof(struct ssv_hw), GFP_KERNEL); ++ if (sh == NULL) ++ return -ENOMEM; ++ memset((void *)sh, 0, sizeof(struct ssv_hw)); ++ sc->sh = sh; ++ sh->sc = sc; ++ sh->priv = sc->dev->platform_data; ++ if (ssv6xxx_read_configuration(sh)) ++ return -ENOMEM; ++ sh->hci.dev = sc->dev; ++ sh->hci.hci_ops = NULL; ++ sh->hci.hci_rx_cb = ssv6200_rx; ++ sh->hci.rx_cb_args = (void *)sc; ++ sh->hci.hci_tx_cb = ssv6xxx_tx_cb; ++ sh->hci.tx_cb_args = (void *)sc; ++ sh->hci.hci_skb_update_cb = ssv6xxx_tx_rate_update; ++ sh->hci.skb_update_args = (void *)sc; ++ sh->hci.hci_tx_flow_ctrl_cb = ssv6200_tx_flow_control; ++ sh->hci.tx_fctrl_cb_args = (void *)sc; ++ sh->hci.hci_tx_q_empty_cb = ssv6xxx_tx_q_empty_cb; ++ sh->hci.tx_q_empty_args = (void *)sc; ++ sh->hci.if_ops = sh->priv->ops; ++ sh->hci.hci_tx_buf_free_cb = ssv6xxx_txbuf_free_skb; ++ sh->hci.tx_buf_free_args = (void *)sc; ++ return 0; ++} ++ ++static int ssv6xxx_init_device(struct ssv_softc *sc, const char *name) ++{ ++ struct ieee80211_hw *hw = sc->hw; ++ struct ssv_hw *sh; ++ int error = 0; ++ BUG_ON(!sc->dev->platform_data); ++ if ((error = ssv6xxx_read_hw_info(sc)) != 0) { ++ return error; ++ } ++ sh = sc->sh; ++ if (sh->cfg.hw_caps == 0) ++ return -1; ++ ssv6xxx_hci_register(&sh->hci); ++ efuse_read_all_map(sh); ++ if ((error = ssv6xxx_init_softc(sc)) != 0) { ++ ssv6xxx_deinit_softc(sc); ++ ssv6xxx_hci_deregister(); ++ kfree(sh); ++ return error; ++ } ++ if ((error = ssv6xxx_init_hw(sc->sh)) != 0) { ++ ssv6xxx_deinit_hw(sc); ++ ssv6xxx_deinit_softc(sc); ++ ssv6xxx_hci_deregister(); ++ kfree(sh); ++ return error; ++ } ++ if ((error = ieee80211_register_hw(hw)) != 0) { ++ dev_err(sc->dev, "Failed to register ieee80211 wireless device. ret=%d.\n", error); ++ ssv6xxx_deinit_hw(sc); ++ ssv6xxx_deinit_softc(sc); ++ ssv6xxx_hci_deregister(); ++ kfree(sh); ++ return error; ++ } ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ssv6xxx_init_debugfs(sc, name); ++#endif ++ return 0; ++} ++ ++static void ssv6xxx_deinit_device(struct ssv_softc *sc) ++{ ++ dev_dbg(sc->dev, "%s(): \n", __FUNCTION__); ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ ssv6xxx_deinit_debugfs(sc); ++#endif ++ ssv6xxx_rf_disable(sc->sh); ++ ieee80211_unregister_hw(sc->hw); ++ ssv6xxx_deinit_hw(sc); ++ ssv6xxx_deinit_softc(sc); ++ ssv6xxx_hci_deregister(); ++ kfree(sc->sh); ++} ++ ++extern struct ieee80211_ops ssv6200_ops; ++int ssv6xxx_dev_probe(struct platform_device *pdev) ++{ ++#ifdef CONFIG_SSV6200_CLI_ENABLE ++ extern struct ssv_softc *ssv_dbg_sc; ++#endif ++#ifdef CONFIG_SSV_SMARTLINK ++ extern struct ssv_softc *ssv_smartlink_sc; ++#endif ++ struct ssv_softc *softc; ++ struct ieee80211_hw *hw; ++ int ret; ++ if (!pdev->dev.platform_data) { ++ dev_err(&pdev->dev, "no platform data specified!\n"); ++ return -EINVAL; ++ } ++ hw = ieee80211_alloc_hw(sizeof(struct ssv_softc), &ssv6200_ops); ++ if (hw == NULL) { ++ dev_err(&pdev->dev, "Could not allocate memory for ieee80211 wireless device\n"); ++ return -ENOMEM; ++ } ++ SET_IEEE80211_DEV(hw, &pdev->dev); ++ dev_set_drvdata(&pdev->dev, hw); ++ memset((void *)hw->priv, 0, sizeof(struct ssv_softc)); ++ softc = hw->priv; ++ softc->hw = hw; ++ softc->dev = &pdev->dev; ++ //SET_IEEE80211_PERM_ADDR(hw, (const u8 *)&softc->sh->maddr[0]); ++ ret = ssv6xxx_init_device(softc, pdev->name); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to initialize device\n"); ++ ieee80211_free_hw(hw); ++ return ret; ++ } ++#ifdef CONFIG_SSV6200_CLI_ENABLE ++ ssv_dbg_sc = softc; ++#endif ++#ifdef CONFIG_SSV_SMARTLINK ++ ssv_smartlink_sc = softc; ++#endif ++ wiphy_info(hw->wiphy, "%s\n", "SSV6200 of South Silicon Valley"); ++ return 0; ++} ++ ++EXPORT_SYMBOL(ssv6xxx_dev_probe); ++int ssv6xxx_dev_remove(struct platform_device *pdev) ++{ ++ struct ieee80211_hw *hw = dev_get_drvdata(&pdev->dev); ++ struct ssv_softc *softc = hw->priv; ++ dev_dbg(&pdev->dev, "ssv6xxx_dev_remove(): pdev=%p, hw=%p\n", pdev, hw); ++ ssv6xxx_deinit_device(softc); ++ dev_dbg(&pdev->dev, "ieee80211_free_hw(): \n"); ++ ieee80211_free_hw(hw); ++ dev_info(&pdev->dev, "driver unloaded\n"); ++ return 0; ++} ++ ++EXPORT_SYMBOL(ssv6xxx_dev_remove); ++static const struct platform_device_id ssv6xxx_id_table[] = { ++ { ++ .name = "ssv6200", ++ .driver_data = 0x00, ++ }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(platform, ssv6xxx_id_table); ++static struct platform_driver ssv6xxx_driver = { ++ .probe = ssv6xxx_dev_probe, ++ .remove = ssv6xxx_dev_remove, ++ .id_table = ssv6xxx_id_table, ++ .driver = { ++ .name = "SSV WLAN driver", ++ .owner = THIS_MODULE, ++ } ++}; ++ ++int ssv6xxx_init(void) ++{ ++ extern void *ssv_dbg_phy_table; ++ extern u32 ssv_dbg_phy_len; ++ extern void *ssv_dbg_rf_table; ++ extern u32 ssv_dbg_rf_len; ++ ssv_dbg_phy_table = (void *)ssv6200_phy_tbl; ++ ssv_dbg_phy_len = ++ sizeof(ssv6200_phy_tbl) / sizeof(struct ssv6xxx_dev_table); ++ ssv_dbg_rf_table = (void *)ssv6200_rf_tbl; ++ ssv_dbg_rf_len = ++ sizeof(ssv6200_rf_tbl) / sizeof(struct ssv6xxx_dev_table); ++ return platform_driver_register(&ssv6xxx_driver); ++} ++ ++void ssv6xxx_exit(void) ++{ ++ platform_driver_unregister(&ssv6xxx_driver); ++} ++ ++EXPORT_SYMBOL(ssv6xxx_init); ++EXPORT_SYMBOL(ssv6xxx_exit); +diff --git a/drivers/net/wireless/ssv6051/smac/init.h b/drivers/net/wireless/ssv6051/smac/init.h +new file mode 100644 +index 000000000000..97994d00d4da +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/init.h +@@ -0,0 +1,23 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _INIT_H_ ++#define _INIT_H_ ++int ssv6xxx_init_mac(struct ssv_hw *sh); ++int ssv6xxx_do_iq_calib(struct ssv_hw *sh, struct ssv6xxx_iqk_cfg *p_cfg); ++void ssv6xxx_deinit_mac(struct ssv_softc *sc); ++void ssv6xxx_restart_hw(struct ssv_softc *sc); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/lib.c b/drivers/net/wireless/ssv6051/smac/lib.c +new file mode 100644 +index 000000000000..ccf0974b0f20 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/lib.c +@@ -0,0 +1,33 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include "lib.h" ++struct sk_buff *ssv_skb_alloc(s32 len) ++{ ++ struct sk_buff *skb; ++ skb = __dev_alloc_skb(len + 128, GFP_KERNEL); ++ if (skb != NULL) { ++ skb_put(skb, 0x20); ++ skb_pull(skb, 0x20); ++ } ++ return skb; ++} ++ ++void ssv_skb_free(struct sk_buff *skb) ++{ ++ dev_kfree_skb_any(skb); ++} +diff --git a/drivers/net/wireless/ssv6051/smac/lib.h b/drivers/net/wireless/ssv6051/smac/lib.h +new file mode 100644 +index 000000000000..266cf7afac95 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/lib.h +@@ -0,0 +1,23 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _LIB_H_ ++#define _LIB_H_ ++#include ++#include ++struct sk_buff *ssv_skb_alloc(s32 len); ++void ssv_skb_free(struct sk_buff *skb); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/linux_80211.h b/drivers/net/wireless/ssv6051/smac/linux_80211.h +new file mode 100644 +index 000000000000..e268808e3c93 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/linux_80211.h +@@ -0,0 +1,24 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _LINUX_80211_H_ ++#define _LINUX_80211_H_ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) ++#define INDEX_80211_BAND_2GHZ IEEE80211_BAND_2GHZ ++#else ++#define INDEX_80211_BAND_2GHZ NL80211_BAND_2GHZ ++#endif ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/p2p.c b/drivers/net/wireless/ssv6051/smac/p2p.c +new file mode 100644 +index 000000000000..60fd8effd6ec +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/p2p.c +@@ -0,0 +1,305 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "p2p.h" ++#include "dev.h" ++#include "lib.h" ++#ifdef CONFIG_P2P_NOA ++#define P2P_IE_VENDOR_TYPE 0x506f9a09 ++#define P2P_NOA_DETECT_INTERVAL (5 * HZ) ++#ifndef MAC2STR ++#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] ++#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" ++#define COMPACT_MACSTR "%02x%02x%02x%02x%02x%02x" ++#endif ++void ssv6xxx_send_noa_cmd(struct ssv_softc *sc, ++ struct ssv6xxx_p2p_noa_param *p2p_noa_param); ++static inline u32 WPA_GET_BE32(const u8 * a) ++{ ++ return (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]; ++} ++ ++static inline u16 WPA_GET_LE16(const u8 * a) ++{ ++ return (a[1] << 8) | a[0]; ++} ++ ++static inline u32 WPA_GET_LE32(const u8 * a) ++{ ++ return (a[3] << 24) | (a[2] << 16) | (a[1] << 8) | a[0]; ++} ++ ++#define IEEE80211_HDRLEN 24 ++enum p2p_attr_id { ++ P2P_ATTR_STATUS = 0, ++ P2P_ATTR_MINOR_REASON_CODE = 1, ++ P2P_ATTR_CAPABILITY = 2, ++ P2P_ATTR_DEVICE_ID = 3, ++ P2P_ATTR_GROUP_OWNER_INTENT = 4, ++ P2P_ATTR_CONFIGURATION_TIMEOUT = 5, ++ P2P_ATTR_LISTEN_CHANNEL = 6, ++ P2P_ATTR_GROUP_BSSID = 7, ++ P2P_ATTR_EXT_LISTEN_TIMING = 8, ++ P2P_ATTR_INTENDED_INTERFACE_ADDR = 9, ++ P2P_ATTR_MANAGEABILITY = 10, ++ P2P_ATTR_CHANNEL_LIST = 11, ++ P2P_ATTR_NOTICE_OF_ABSENCE = 12, ++ P2P_ATTR_DEVICE_INFO = 13, ++ P2P_ATTR_GROUP_INFO = 14, ++ P2P_ATTR_GROUP_ID = 15, ++ P2P_ATTR_INTERFACE = 16, ++ P2P_ATTR_OPERATING_CHANNEL = 17, ++ P2P_ATTR_INVITATION_FLAGS = 18, ++ P2P_ATTR_OOB_GO_NEG_CHANNEL = 19, ++ P2P_ATTR_VENDOR_SPECIFIC = 221 ++}; ++struct ssv6xxx_p2p_noa_attribute { ++ u8 index; ++ u16 ctwindows_oppps; ++ struct ssv6xxx_p2p_noa_param noa_param; ++}; ++extern void _ssv6xxx_hexdump(const char *title, const u8 * buf, size_t len); ++bool p2p_find_noa(const u8 * ies, struct ssv6xxx_p2p_noa_attribute *noa_attr) ++{ ++ const u8 *end, *pos, *ie; ++ u32 len; ++ len = ie[1] - 4; ++ pos = ie + 6; ++ end = pos + len; ++ while (pos < end) { ++ u16 attr_len; ++ if (pos + 2 >= end) { ++ return false; ++ } ++ attr_len = WPA_GET_LE16(pos + 1); ++ if (pos + 3 + attr_len > end) { ++ return false; ++ } ++ if (pos[0] != P2P_ATTR_NOTICE_OF_ABSENCE) { ++ pos += 3 + attr_len; ++ continue; ++ } ++ if (attr_len < 15) { ++ printk ++ ("*********************NOA descriptor does not exist len[%d]\n", ++ attr_len); ++ break; ++ } ++ if (attr_len > 15) ++ printk("More than one NOA descriptor\n"); ++ noa_attr->index = pos[3]; ++ noa_attr->ctwindows_oppps = pos[4]; ++ noa_attr->noa_param.count = pos[5]; ++ noa_attr->noa_param.duration = WPA_GET_LE32(&pos[6]); ++ noa_attr->noa_param.interval = WPA_GET_LE32(&pos[10]); ++ noa_attr->noa_param.start_time = WPA_GET_LE32(&pos[14]); ++ return true; ++ } ++ return false; ++} ++ ++bool p2p_get_attribute_noa(const u8 * ies, u32 oui_type, ++ struct ssv6xxx_p2p_noa_attribute *noa_attr) ++{ ++ const u8 *end, *pos, *ie; ++ u32 len; ++ pos = ies; ++ end = ies + ies_len; ++ ie = NULL; ++ while (pos + 1 < end) { ++ if (pos + 2 + pos[1] > end) ++ return false; ++ if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && ++ WPA_GET_BE32(&pos[2]) == oui_type) { ++ ie = pos; ++ if (p2p_find_noa(ie, 0, noa_attr) == true) ++ return true; ++ } ++ pos += 2 + pos[1]; ++ } ++ return false; ++} ++ ++void ssv6xxx_process_noa_event(struct ssv_softc *sc, struct sk_buff *skb) ++{ ++ struct cfg_host_event *host_event; ++ struct ssv62xx_noa_evt *noa_evt; ++ host_event = (struct cfg_host_event *)skb->data; ++ noa_evt = (struct ssv62xx_noa_evt *)&host_event->dat[0]; ++ switch (noa_evt->evt_id) { ++ case SSV6XXX_NOA_START: ++ sc->p2p_noa.active_noa_vif |= (1 << noa_evt->vif); ++ printk("SSV6XXX_NOA_START===>[%08x]\n", ++ sc->p2p_noa.active_noa_vif); ++ break; ++ case SSV6XXX_NOA_STOP: ++ sc->p2p_noa.active_noa_vif &= ~(1 << noa_evt->vif); ++ printk("SSV6XXX_NOA_STOP===>[%08x]\n", ++ sc->p2p_noa.active_noa_vif); ++ break; ++ default: ++ printk("--------->NOA wrong command<---------\n"); ++ break; ++ } ++} ++ ++void ssv6xxx_noa_reset(struct ssv_softc *sc) ++{ ++ unsigned long flags; ++ printk("Reset NOA param...\n"); ++ spin_lock_irqsave(&sc->p2p_noa.p2p_config_lock, flags); ++ memset(&sc->p2p_noa.noa_detect, 0, ++ sizeof(struct ssv_p2p_noa_detect) * SSV_NUM_VIF); ++ sc->p2p_noa.active_noa_vif = 0; ++ sc->p2p_noa.monitor_noa_vif = 0; ++ spin_unlock_irqrestore(&sc->p2p_noa.p2p_config_lock, flags); ++} ++ ++void ssv6xxx_noa_host_stop_noa(struct ssv_softc *sc, u8 vif_id) ++{ ++ struct ssv6xxx_p2p_noa_attribute noa_attr; ++ if (sc->p2p_noa.noa_detect[vif_id].p2p_noa_index >= 0) { ++ sc->p2p_noa.noa_detect[vif_id].p2p_noa_index = -1; ++ sc->p2p_noa.active_noa_vif &= ~(1 << vif_id); ++ memset(&sc->p2p_noa.noa_detect[vif_id].noa_param_cmd, 0, ++ sizeof(struct ssv6xxx_p2p_noa_param)); ++ printk("->remove NOA operating vif[%d]\n", vif_id); ++ noa_attr.noa_param.enable = 0; ++ noa_attr.noa_param.vif_id = vif_id; ++ ssv6xxx_send_noa_cmd(sc, &noa_attr.noa_param); ++ } ++} ++ ++void ssv6xxx_noa_detect(struct ssv_softc *sc, struct ieee80211_hdr *hdr, ++ u32 len) ++{ ++ int i; ++ unsigned long flags; ++ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)hdr; ++ struct ssv6xxx_p2p_noa_attribute noa_attr; ++ spin_lock_irqsave(&sc->p2p_noa.p2p_config_lock, flags); ++ if (sc->p2p_noa.monitor_noa_vif == 0) ++ goto out; ++ for (i = 0; i < SSV_NUM_VIF; i++) { ++ if (sc->p2p_noa.noa_detect[i].noa_addr == NULL) ++ continue; ++ if (memcmp(mgmt->bssid, sc->p2p_noa.noa_detect[i].noa_addr, 6) ++ != 0) ++ continue; ++ if (sc->p2p_noa.active_noa_vif && ++ ((sc->p2p_noa.active_noa_vif & 1 << i) == 0)) ++ continue; ++ sc->p2p_noa.noa_detect[i].last_rx = jiffies; ++ if (p2p_get_attribute_noa((const u8 *)mgmt->u.beacon.variable, ++ len - (IEEE80211_HDRLEN + ++ sizeof(mgmt->u.beacon)), ++ P2P_IE_VENDOR_TYPE, ++ &noa_attr) == false) { ++ continue; ++ } ++ if (sc->p2p_noa.noa_detect[i].p2p_noa_index == noa_attr.index) { ++ goto out; ++ } ++ printk(MACSTR "->set NOA element\n", MAC2STR(mgmt->bssid)); ++ sc->p2p_noa.active_noa_vif |= (1 << i); ++ sc->p2p_noa.noa_detect[i].p2p_noa_index = noa_attr.index; ++ memcpy(&sc->p2p_noa.noa_detect[i].noa_param_cmd, ++ &noa_attr.noa_param, ++ sizeof(struct ssv6xxx_p2p_noa_param)); ++ noa_attr.noa_param.enable = 1; ++ noa_attr.noa_param.vif_id = i; ++ memcpy(noa_attr.noa_param.addr, hdr->addr2, 6); ++ ssv6xxx_send_noa_cmd(sc, &noa_attr.noa_param); ++ } ++ out: ++ spin_unlock_irqrestore(&sc->p2p_noa.p2p_config_lock, flags); ++} ++ ++void ssv6xxx_noa_hdl_bss_change(struct ssv_softc *sc, ++ enum ssv6xxx_noa_conf conf, u8 vif_idx) ++{ ++ unsigned long flags; ++ if (sc->vif_info[vif_idx].vif->type != NL80211_IFTYPE_STATION || ++ sc->vif_info[vif_idx].vif->p2p != true) ++ return; ++ spin_lock_irqsave(&sc->p2p_noa.p2p_config_lock, flags); ++ printk("====>[NOA]ssv6xxx_noa_hdl_bss_change conf[%d] vif_idx[%d]\n", ++ conf, vif_idx); ++ switch (conf) { ++ case MONITOR_NOA_CONF_ADD: ++ memset(&sc->p2p_noa.noa_detect[vif_idx], 0, ++ sizeof(struct ssv_p2p_noa_detect)); ++ sc->p2p_noa.noa_detect[vif_idx].noa_addr = ++ sc->vif_info[vif_idx].vif->bss_conf.bssid; ++ sc->p2p_noa.noa_detect[vif_idx].p2p_noa_index = -1; ++ sc->p2p_noa.noa_detect[vif_idx].last_rx = jiffies; ++ sc->p2p_noa.monitor_noa_vif |= 1 << vif_idx; ++ break; ++ case MONITOR_NOA_CONF_REMOVE: ++ sc->p2p_noa.monitor_noa_vif &= ~(1 << vif_idx); ++ sc->p2p_noa.noa_detect[vif_idx].noa_addr = NULL; ++ ssv6xxx_noa_host_stop_noa(sc, vif_idx); ++ break; ++ default: ++ break; ++ } ++ spin_unlock_irqrestore(&sc->p2p_noa.p2p_config_lock, flags); ++} ++ ++void ssv6xxx_send_noa_cmd(struct ssv_softc *sc, ++ struct ssv6xxx_p2p_noa_param *p2p_noa_param) ++{ ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ int retry_cnt = 5; ++ skb = ++ ssv_skb_alloc(HOST_CMD_HDR_LEN + ++ sizeof(struct ssv6xxx_p2p_noa_param)); ++ skb->data_len = HOST_CMD_HDR_LEN + sizeof(struct ssv6xxx_p2p_noa_param); ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_SET_NOA; ++ host_cmd->len = skb->data_len; ++ memcpy(host_cmd->dat32, p2p_noa_param, ++ sizeof(struct ssv6xxx_p2p_noa_param)); ++ printk ++ ("Noa cmd NOA Parameter:\nEnable=%d\nInterval=%d\nDuration=%d\nStart_time=0x%08x\nCount=%d\nAddr=[%02x:%02x:%02x:%02x:%02x:%02x]vif[%d]\n\n", ++ p2p_noa_param->enable, p2p_noa_param->interval, ++ p2p_noa_param->duration, p2p_noa_param->start_time, ++ p2p_noa_param->count, p2p_noa_param->addr[0], ++ p2p_noa_param->addr[1], p2p_noa_param->addr[2], ++ p2p_noa_param->addr[3], p2p_noa_param->addr[4], ++ p2p_noa_param->addr[5], p2p_noa_param->vif_id); ++ while ((HCI_SEND_CMD(sc->sh, skb) != 0) && (retry_cnt)) { ++ printk(KERN_INFO "NOA cmd retry=%d!!\n", retry_cnt); ++ retry_cnt--; ++ } ++ ssv_skb_free(skb); ++} ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/p2p.h b/drivers/net/wireless/ssv6051/smac/p2p.h +new file mode 100644 +index 000000000000..a5bb99c61bb0 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/p2p.h +@@ -0,0 +1,58 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _P2P_H_ ++#define _P2P_H_ ++#include ++#include ++#include "drv_comm.h" ++#ifdef CONFIG_P2P_NOA ++#define P2P_MAX_NOA_INTERFACE 1 ++struct ssv_p2p_noa_detect { ++ const u8 *noa_addr; ++ s16 p2p_noa_index; ++ unsigned long last_rx; ++ struct ssv6xxx_p2p_noa_param noa_param_cmd; ++}; ++struct ssv_p2p_noa { ++ spinlock_t p2p_config_lock; ++ struct ssv_p2p_noa_detect noa_detect[SSV_NUM_VIF]; ++ u8 active_noa_vif; ++ u8 monitor_noa_vif; ++}; ++enum ssv_cmd_state { ++ SSC_CMD_STATE_IDLE, ++ SSC_CMD_STATE_WAIT_RSP, ++}; ++struct ssv_cmd_Info { ++ struct sk_buff_head cmd_que; ++ struct sk_buff_head evt_que; ++ enum ssv_cmd_state state; ++}; ++enum ssv6xxx_noa_conf { ++ MONITOR_NOA_CONF_ADD, ++ MONITOR_NOA_CONF_REMOVE, ++}; ++struct ssv_softc; ++void ssv6xxx_process_noa_event(struct ssv_softc *sc, struct sk_buff *skb); ++void ssv6xxx_noa_hdl_bss_change(struct ssv_softc *sc, ++ enum ssv6xxx_noa_conf conf, u8 vif_idx); ++void ssv6xxx_process_noa_event(struct ssv_softc *sc, struct sk_buff *skb); ++void ssv6xxx_noa_detect(struct ssv_softc *sc, struct ieee80211_hdr *hdr, ++ u32 len); ++void ssv6xxx_noa_reset(struct ssv_softc *sc); ++#endif ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/sar.c b/drivers/net/wireless/ssv6051/smac/sar.c +new file mode 100644 +index 000000000000..44a47a5c7a0f +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/sar.c +@@ -0,0 +1,208 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include "dev.h" ++#include "sar.h" ++ ++WIFI_FLASH_CCFG flash_cfg = { ++ //16bytes ++ 0x6051, 0x3009, 0x20170519, 0x1, 0x0, 0x0, ++ { //16bytes ++ {0x47c000, 0x47c000, 0x47c000, 0x9, 0x1d, 0x0}, ++ //16bytes ++ {0x79807980, 0x79807980, 0x79807980, 0x9, 0x1d, 0x0} ++ } ++}; ++ ++WIFI_FLASH_CCFG *pflash_cfg; ++ ++struct t_sar_info sar_info[] = { ++ {SAR_LVL_INVALID, 0x0047c000, NULL}, ++ {SAR_LVL_INVALID, 0x79807980, NULL} ++}; ++ ++int sar_info_size = sizeof(sar_info) / sizeof(sar_info[0]); ++ ++static u8 get_sar_lvl(u32 sar) ++{ ++ static u32 prev_sar = 0; ++ int i; ++ u8 changed = 0x0; ++ ++ if (sar == prev_sar) ++ return changed; ++ ++ pr_debug("[thermal_sar] %d\n", (int)sar); ++ ++ for (i = 0; i < sar_info_size; i++) { ++ if (sar_info[i].lvl == SAR_LVL_INVALID) { //if driver loaded under LT/HT env, it would cause wrong settings at this time. ++ sar_info[i].lvl = SAR_LVL_RT; ++ sar_info[i].value = sar_info[i].p->rt; ++ changed |= BIT(i); ++ } else if (sar_info[i].lvl == SAR_LVL_RT) { ++ if (sar < prev_sar) { ++ if (sar <= (u32) (sar_info[i].p->lt_ts - 2)) { //we need check if (g_tt_lt - 1) < SAR_MIN ++ sar_info[i].lvl = SAR_LVL_LT; ++ sar_info[i].value = sar_info[i].p->lt; ++ changed |= BIT(i); ++ } ++ } else if (sar > prev_sar) { ++ if (sar >= (u32) (sar_info[i].p->ht_ts + 2)) { //we need check if (g_tt_lt + 1) > SAR_MAX ++ sar_info[i].lvl = SAR_LVL_HT; ++ sar_info[i].value = sar_info[i].p->ht; ++ changed |= BIT(i); ++ } ++ } ++ } else if (sar_info[i].lvl == SAR_LVL_LT) { ++ if (sar >= (u32) (sar_info[i].p->lt_ts + 2)) { ++ sar_info[i].lvl = SAR_LVL_RT; ++ sar_info[i].value = sar_info[i].p->rt; ++ changed |= BIT(i); ++ } ++ } else if (sar_info[i].lvl == SAR_LVL_HT) { ++ if (sar <= (u32) (sar_info[i].p->ht_ts - 2)) { ++ sar_info[i].lvl = SAR_LVL_RT; ++ sar_info[i].value = sar_info[i].p->rt; ++ changed |= BIT(i); ++ } ++ } ++ } ++ if (changed) { ++ pr_debug("changed: 0x%x\n", changed); ++ } ++ prev_sar = sar; ++ return changed; ++} ++ ++void sar_monitor(u32 curr_sar, struct ssv_softc *sc) ++{ ++ //static u32 prev_sar_lvl = SAR_LVL_INVALID; //sar = 0, temparature < -25C ++ u8 changed; ++ changed = get_sar_lvl(curr_sar); ++ ++ if (changed & BIT(SAR_TXGAIN_INDEX)) { ++ dev_dbg(sc->dev, "TXGAIN: 0x%08x\n", sar_info[SAR_TXGAIN_INDEX].value); ++ SMAC_REG_WRITE(sc->sh, ADR_TX_GAIN_FACTOR, ++ sar_info[SAR_TXGAIN_INDEX].value); ++ } ++ if (changed & BIT(SAR_XTAL_INDEX)) { ++ dev_dbg(sc->dev, "XTAL: 0x%08x\n", sar_info[SAR_XTAL_INDEX].value); ++ SMAC_REG_WRITE(sc->sh, ADR_SYN_KVCO_XO_FINE_TUNE_CBANK, ++ sar_info[SAR_XTAL_INDEX].value); ++ } ++} ++ ++/* ++ SET_RG_SARADC_THERMAL(1); //ce010030[26] ++ SET_RG_EN_SARADC(1); //ce010030[30] ++ while(!GET_SAR_ADC_FSM_RDY); //ce010094[23] ++ sar_code = GET_RG_SARADC_BIT; //ce010094[21:16] ++ SET_RG_SARADC_THERMAL(0); ++ SET_RG_EN_SARADC(0); ++*/ ++void thermal_monitor(struct work_struct *work) ++{ ++ struct ssv_softc *sc = ++ container_of(work, struct ssv_softc, thermal_monitor_work.work); ++ u32 curr_sar; ++ ++ u32 temp; ++ if (sc->ps_status == PWRSV_PREPARE) { ++ dev_dbg(sc->dev, "sar PWRSV_PREPARE\n"); ++ return; ++ } ++ ++ mutex_lock(&sc->mutex); ++ SMAC_REG_READ(sc->sh, ADR_RX_11B_CCA_1, &temp); ++ if (temp == RX_11B_CCA_IN_SCAN) { ++ dev_dbg(sc->dev, "in scan\n"); ++ mutex_unlock(&sc->mutex); ++ queue_delayed_work(sc->thermal_wq, &sc->thermal_monitor_work, ++ THERMAL_MONITOR_TIME); ++ return; ++ } ++ SMAC_REG_READ(sc->sh, ADR_RX_ADC_REGISTER, &temp); ++ //printk("ori %08x:%08x\n", ADR_RX_ADC_REGISTER, temp); ++ SMAC_REG_SET_BITS(sc->sh, ADR_RX_ADC_REGISTER, ++ (1 << RG_SARADC_THERMAL_SFT), RG_SARADC_THERMAL_MSK); ++ SMAC_REG_SET_BITS(sc->sh, ADR_RX_ADC_REGISTER, (1 << RG_EN_SARADC_SFT), ++ RG_EN_SARADC_MSK); ++ ++ do { ++ msleep(1); ++ SMAC_REG_READ(sc->sh, ADR_READ_ONLY_FLAGS_1, &temp); ++ } while (((temp & SAR_ADC_FSM_RDY_MSK) >> SAR_ADC_FSM_RDY_SFT) != 1); ++ //printk("SAR_ADC_FSM_RDY_STAT %d\n", (temp & SAR_ADC_FSM_RDY_MSK) >> SAR_ADC_FSM_RDY_SFT); ++ curr_sar = (temp & RG_SARADC_BIT_MSK) >> RG_SARADC_BIT_SFT; ++ SMAC_REG_READ(sc->sh, ADR_RX_ADC_REGISTER, &temp); ++ ++ //printk("new %08x:%08x\n", ADR_RX_ADC_REGISTER, temp); ++ ++ SMAC_REG_SET_BITS(sc->sh, ADR_RX_ADC_REGISTER, ++ (0 << RG_SARADC_THERMAL_SFT), RG_SARADC_THERMAL_MSK); ++ SMAC_REG_SET_BITS(sc->sh, ADR_RX_ADC_REGISTER, (0 << RG_EN_SARADC_SFT), ++ RG_EN_SARADC_MSK); ++ sar_monitor(curr_sar, sc); ++ ++ mutex_unlock(&sc->mutex); ++ ++ queue_delayed_work(sc->thermal_wq, &sc->thermal_monitor_work, ++ THERMAL_MONITOR_TIME); ++} ++ ++int get_flash_info(struct ssv_softc *sc) ++{ ++ struct file *fp = (struct file *)NULL; ++ int i, ret; ++ ++ pflash_cfg = &flash_cfg; ++ ++ if (sc->sh->cfg.flash_bin_path[0] != 0x00) { ++ fp = filp_open(sc->sh->cfg.flash_bin_path, O_RDONLY, 0); ++ if (IS_ERR(fp) || fp == NULL) { ++ fp = filp_open(SEC_CFG_BIN_NAME, O_RDONLY, 0); ++ } ++ } else { ++ fp = filp_open(DEFAULT_CFG_BIN_NAME, O_RDONLY, 0); ++ if (IS_ERR(fp) || fp == NULL) { ++ fp = filp_open(SEC_CFG_BIN_NAME, O_RDONLY, 0); ++ } ++ } ++ if (IS_ERR(fp) || fp == NULL) { ++ dev_info(sc->dev, "flash_file %s not found, disable sar\n", ++ DEFAULT_CFG_BIN_NAME); ++ //WARN_ON(1); ++ ret = 0; ++ return ret; ++ } ++ ++ fp->f_op->read(fp, (char *)pflash_cfg, sizeof(flash_cfg), &fp->f_pos); ++ ++ filp_close(fp, NULL); ++ ret = 1; ++ ++ for (i = 0; i < sar_info_size; i++) { ++ sar_info[i].p = &flash_cfg.sar_rlh[i]; ++ dev_dbg(sc->dev, "rt = %x, lt = %x, ht = %x\n", sar_info[i].p->rt, ++ sar_info[i].p->lt, sar_info[i].p->ht); ++ dev_dbg(sc->dev, "lt_ts = %x, ht_ts = %x\n", sar_info[i].p->lt_ts, ++ sar_info[i].p->ht_ts); ++ } ++ return ret; ++} +diff --git a/drivers/net/wireless/ssv6051/smac/sar.h b/drivers/net/wireless/ssv6051/smac/sar.h +new file mode 100644 +index 000000000000..291d58f236eb +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/sar.h +@@ -0,0 +1,63 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _CFG_H_ ++#define _CFG_H_ ++#include ++ ++#define SAR_XTAL_INDEX (0) ++#define SAR_TXGAIN_INDEX (1) ++#define THERMAL_MONITOR_TIME (10 * HZ) ++#define DEFAULT_CFG_BIN_NAME "/lib/firmware/ssv6051_sar.bin" ++#define SEC_CFG_BIN_NAME "/lib/firmware/ssv6xxx_sar.bin" ++enum { ++ SAR_LVL_LT, ++ SAR_LVL_RT, ++ SAR_LVL_HT, ++ SAR_LVL_INVALID ++}; ++ ++struct flash_thermal_info { ++ u32 rt; ++ u32 lt; ++ u32 ht; ++ u8 lt_ts; ++ u8 ht_ts; ++ u16 reserve; ++}; ++typedef struct t_WIFI_FLASH_CCFG { ++ //16bytes ++ u16 chip_id; ++ u16 sid; ++ u32 date; ++ u16 version; ++ u16 reserve_1; ++ u32 reserve_2; ++ //16bytes ++ struct flash_thermal_info sar_rlh[2]; ++} WIFI_FLASH_CCFG; ++ ++struct t_sar_info { ++ u32 lvl; ++ u32 value; ++ struct flash_thermal_info *p; ++}; ++ ++void thermal_monitor(struct work_struct *work); ++int get_flash_info(struct ssv_softc *sc); ++void flash_hexdump(void); ++ ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/sec.h b/drivers/net/wireless/ssv6051/smac/sec.h +new file mode 100644 +index 000000000000..04a0f47c8ce2 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/sec.h +@@ -0,0 +1,52 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef SEC_H ++#define SEC_H ++#include ++#include ++#include ++#define CCMP_TK_LEN 16 ++#define TKIP_KEY_LEN 32 ++#define WEP_KEY_LEN 13 ++struct ssv_crypto_ops { ++ const char *name; ++ struct list_head list; ++ void *(*init)(int keyidx); ++ void (*deinit)(void *priv); ++ int (*encrypt_mpdu)(struct sk_buff * skb, int hdr_len, void *priv); ++ int (*decrypt_mpdu)(struct sk_buff * skb, int hdr_len, void *priv); ++ int (*encrypt_msdu)(struct sk_buff * skb, int hdr_len, void *priv); ++ int (*decrypt_msdu)(struct sk_buff * skb, int keyidx, int hdr_len, ++ void *priv); ++ int (*set_tx_pn)(u8 * seq, void *priv); ++ int (*set_key)(void *key, int len, u8 * seq, void *priv); ++ int (*get_key)(void *key, int len, u8 * seq, void *priv); ++ char *(*print_stats)(char *p, void *priv); ++ unsigned long (*get_flags)(void *priv); ++ unsigned long (*set_flags)(unsigned long flags, void *priv); ++ int extra_mpdu_prefix_len, extra_mpdu_postfix_len; ++ int extra_msdu_prefix_len, extra_msdu_postfix_len; ++}; ++struct ssv_crypto_data { ++ struct ssv_crypto_ops *ops; ++ void *priv; ++ rwlock_t lock; ++}; ++struct ssv_crypto_ops *get_crypto_ccmp_ops(void); ++struct ssv_crypto_ops *get_crypto_tkip_ops(void); ++struct ssv_crypto_ops *get_crypto_wep_ops(void); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/smartlink.c b/drivers/net/wireless/ssv6051/smac/smartlink.c +new file mode 100644 +index 000000000000..69e8d5118e09 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/smartlink.c +@@ -0,0 +1,340 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "lib.h" ++#include "dev.h" ++#define NETLINK_SMARTLINK (31) ++#define MAX_PAYLOAD (2048) ++static struct sock *nl_sk = NULL; ++struct ssv_softc *ssv_smartlink_sc = NULL; ++EXPORT_SYMBOL(ssv_smartlink_sc); ++u32 ssv_smartlink_status = 0; ++static int _ksmartlink_start_smartlink(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s\n", __FUNCTION__); ++#endif ++ ssv_smartlink_status = 1; ++ *pOutBufLen = 0; ++ return 0; ++} ++ ++int ksmartlink_smartlink_started(void) ++{ ++ return ssv_smartlink_status; ++} ++ ++EXPORT_SYMBOL(ksmartlink_smartlink_started); ++static int _ksmartlink_stop_smartlink(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s\n", __FUNCTION__); ++#endif ++ ssv_smartlink_status = 0; ++ *pOutBufLen = 0; ++ return 0; ++} ++ ++static int _ksmartlink_set_channel(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++ int ret = -10; ++ int ch = (int)(*pInBuf); ++ struct ssv_softc *sc = ssv_smartlink_sc; ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s %d\n", __FUNCTION__, ch); ++#endif ++ if (!sc) { ++ goto out; ++ } ++ mutex_lock(&sc->mutex); ++ ret = ssv6xxx_set_channel(sc, ch); ++ mutex_unlock(&sc->mutex); ++ *pOutBufLen = 0; ++ out: ++ return ret; ++} ++ ++static int _ksmartlink_get_channel(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++ int ret = -10; ++ int ch = 0; ++ struct ssv_softc *sc = ssv_smartlink_sc; ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s\n", __FUNCTION__); ++#endif ++ if (!sc) { ++ goto out; ++ } ++ mutex_lock(&sc->mutex); ++ ret = ssv6xxx_get_channel(sc, &ch); ++ mutex_unlock(&sc->mutex); ++ *pOutBuf = ch; ++ *pOutBufLen = 1; ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s %d\n", __FUNCTION__, ch); ++#endif ++ out: ++ return ret; ++} ++ ++static int _ksmartlink_set_promisc(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++ int ret = -10; ++ int accept = (int)(*pInBuf); ++ struct ssv_softc *sc = ssv_smartlink_sc; ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s %d\n", __FUNCTION__, accept); ++#endif ++ if (!sc) { ++ goto out; ++ } ++ mutex_lock(&sc->mutex); ++ ret = ssv6xxx_set_promisc(sc, accept); ++ mutex_unlock(&sc->mutex); ++ *pOutBufLen = 0; ++ out: ++ return ret; ++} ++ ++static int _ksmartlink_get_promisc(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++ int ret = -10; ++ int accept = (int)(*pInBuf); ++ struct ssv_softc *sc = ssv_smartlink_sc; ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s\n", __FUNCTION__); ++#endif ++ if (!sc) { ++ goto out; ++ } ++ mutex_lock(&sc->mutex); ++ ret = ssv6xxx_get_promisc(sc, &accept); ++ mutex_unlock(&sc->mutex); ++ *pOutBuf = accept; ++ *pOutBufLen = 1; ++#ifdef KSMARTLINK_DEBUG ++ printk(KERN_INFO "%s %d\n", __FUNCTION__, accept); ++#endif ++ out: ++ return ret; ++} ++ ++#define SMARTLINK_CMD_FIXED_LEN (10) ++#define SMARTLINK_CMD_FIXED_TOT_LEN (SMARTLINK_CMD_FIXED_LEN+1) ++#define SMARTLINK_RES_FIXED_LEN (SMARTLINK_CMD_FIXED_LEN) ++#define SMARTLINK_RES_FIXED_TOT_LEN (SMARTLINK_RES_FIXED_LEN+2) ++struct ksmartlink_cmd { ++ char *cmd; ++ int (*process_func)(u8 *, u32, u8 *, u32 *); ++}; ++static struct ksmartlink_cmd _ksmartlink_cmd_table[] = { ++ {"startairki", _ksmartlink_start_smartlink}, ++ {"stopairkis", _ksmartlink_stop_smartlink}, ++ {"setchannel", _ksmartlink_set_channel}, ++ {"getchannel", _ksmartlink_get_channel}, ++ {"setpromisc", _ksmartlink_set_promisc}, ++ {"getpromisc", _ksmartlink_get_promisc}, ++}; ++ ++static u32 _ksmartlink_cmd_table_size = ++ sizeof(_ksmartlink_cmd_table) / sizeof(struct ksmartlink_cmd); ++#ifdef KSMARTLINK_DEBUG ++static void _ksmartlink_hex_dump(u8 * pInBuf, u32 inBufLen) ++{ ++ u32 i = 0; ++ printk(KERN_INFO "\nKernel Hex Dump(len=%d):\n", inBufLen); ++ printk(KERN_INFO ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); ++ for (i = 0; i < inBufLen; i++) { ++ if ((i) && ((i & 0xf) == 0)) { ++ printk("\n"); ++ } ++ printk("%02x ", pInBuf[i]); ++ } ++ printk(KERN_INFO "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); ++} ++#endif ++static int _ksmartlink_process_msg(u8 * pInBuf, u32 inBufLen, u8 * pOutBuf, ++ u32 * pOutBufLen) ++{ ++ int ret = 0; ++ u32 i = 0; ++ struct ksmartlink_cmd *pCmd; ++ if (!pInBuf || !pOutBuf || !pOutBufLen) { ++ printk(KERN_ERR "NULL pointer\n"); ++ return -1; ++ } ++ for (i = 0; i < _ksmartlink_cmd_table_size; i++) { ++ if (!strncmp ++ (_ksmartlink_cmd_table[i].cmd, pInBuf, ++ SMARTLINK_CMD_FIXED_LEN)) { ++ break; ++ } ++ } ++ if (i < _ksmartlink_cmd_table_size) { ++ pCmd = &_ksmartlink_cmd_table[i]; ++ if (!pCmd->process_func) { ++ printk(KERN_ERR "CMD %s has NULL process_func\n", ++ pCmd->cmd); ++ return -3; ++ } ++ ret = ++ pCmd->process_func(pInBuf + SMARTLINK_CMD_FIXED_LEN, ++ inBufLen, pOutBuf, pOutBufLen); ++#ifdef CONFIG_SSV_NETLINK_RESPONSE ++ if (ret < 0) { ++ *pOutBufLen = SMARTLINK_RES_FIXED_TOT_LEN; ++ } else { ++ if (*pOutBufLen > 0) { ++ pOutBuf[SMARTLINK_RES_FIXED_LEN] = (u8) ret; ++ pOutBuf[SMARTLINK_RES_FIXED_LEN + 1] = *pOutBuf; ++ } else { ++ pOutBuf[SMARTLINK_RES_FIXED_LEN] = (u8) ret; ++ pOutBuf[SMARTLINK_RES_FIXED_LEN + 1] = 0; ++ } ++ *pOutBufLen = SMARTLINK_RES_FIXED_TOT_LEN; ++ } ++ memcpy(pOutBuf, pCmd->cmd, SMARTLINK_RES_FIXED_LEN); ++#else ++ (void)pOutBuf; ++ (void)pOutBufLen; ++#endif ++ return 0; ++ } else { ++ printk(KERN_INFO "Unknow CMD or Packet?\n"); ++ } ++ return 0; ++} ++static u8 gkBuf[MAX_PAYLOAD] = { 0 }; ++ ++static int ssv_usr_pid = 0; ++void smartlink_nl_recv_msg(struct sk_buff *skb) ++{ ++ struct nlmsghdr *nlh; ++#ifdef CONFIG_SSV_NETLINK_RESPONSE ++ struct sk_buff *skb_out; ++#endif ++ int ret = 0; ++ u8 *pInBuf = NULL; ++ u32 inBufLen = 0; ++ u32 outBufLen = 0; ++ nlh = (struct nlmsghdr *)skb->data; ++ ssv_usr_pid = nlh->nlmsg_pid; ++ pInBuf = (u8 *) nlmsg_data(nlh); ++ inBufLen = nlmsg_len(nlh); ++#ifdef KSMARTLINK_DEBUG ++ _ksmartlink_hex_dump(pInBuf, inBufLen); ++#endif ++ outBufLen = 0; ++ memset(gkBuf, 0, MAX_PAYLOAD); ++ ret = _ksmartlink_process_msg(pInBuf, inBufLen, gkBuf, &outBufLen); ++#ifdef CONFIG_SSV_NETLINK_RESPONSE ++ if (outBufLen == 0) { ++ memcpy(gkBuf, "Nothing", 8); ++ outBufLen = strlen(gkBuf); ++ } ++ skb_out = nlmsg_new(outBufLen, 0); ++ if (!skb_out) { ++ printk(KERN_ERR "Failed to allocate new skb\n"); ++ return; ++ } ++ nlh = nlmsg_put(skb_out, 0, 0, NLMSG_DONE, outBufLen, 0); ++ NETLINK_CB(skb_out).dst_group = 0; ++ memcpy(nlmsg_data(nlh), gkBuf, outBufLen); ++ ret = nlmsg_unicast(nl_sk, skb_out, ssv_usr_pid); ++ if (ret < 0) { ++ printk(KERN_ERR "Error while sending bak to user\n"); ++ } ++#endif ++ return; ++} ++ ++void smartlink_nl_send_msg(struct sk_buff *skb) ++{ ++ struct nlmsghdr *nlh; ++ struct sk_buff *skb_out; ++ int ret = 0; ++ u8 *pOutBuf = skb->data; ++ u32 outBufLen = skb->len; ++#ifdef KSMARTLINK_DEBUG ++#endif ++ skb_out = nlmsg_new(outBufLen, 0); ++ if (!skb_out) { ++ printk(KERN_ERR "Allocate new skb failed!\n"); ++ return; ++ } ++ nlh = nlmsg_put(skb_out, 0, 0, NLMSG_DONE, outBufLen, 0); ++ NETLINK_CB(skb_out).dst_group = 0; ++ memcpy(nlmsg_data(nlh), pOutBuf, outBufLen); ++ ret = nlmsg_unicast(nl_sk, skb_out, ssv_usr_pid); ++ if (ret < 0) { ++ printk(KERN_ERR "nlmsg_unicast failed!\n"); ++ } ++ kfree_skb(skb); ++ return; ++} ++ ++EXPORT_SYMBOL(smartlink_nl_send_msg); ++int ksmartlink_init(void) ++{ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) ++ nl_sk = netlink_kernel_create(&init_net, ++ NETLINK_SMARTLINK, ++ 0, ++ smartlink_nl_recv_msg, NULL, THIS_MODULE); ++#else ++ struct netlink_kernel_cfg cfg = { ++ .groups = 0, ++ .input = smartlink_nl_recv_msg, ++ }; ++ nl_sk = netlink_kernel_create(&init_net, NETLINK_SMARTLINK, &cfg); ++#endif ++ printk(KERN_INFO "***************SmartLink Init-S**************\n"); ++ if (!nl_sk) { ++ printk(KERN_ERR "Error creating socket.\n"); ++ return -10; ++ } ++ printk(KERN_INFO "***************SmartLink Init-E**************\n"); ++ return 0; ++} ++ ++void ksmartlink_exit(void) ++{ ++ printk(KERN_INFO "%s\n", __FUNCTION__); ++ if (nl_sk) { ++ netlink_kernel_release(nl_sk); ++ nl_sk = NULL; ++ } ++} ++ ++EXPORT_SYMBOL(ksmartlink_init); ++EXPORT_SYMBOL(ksmartlink_exit); +diff --git a/drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.c b/drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.c +new file mode 100644 +index 000000000000..9be5ea96e7f9 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.c +@@ -0,0 +1,223 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "dev.h" ++#include "ssv6xxx_debugfs.h" ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++#define QUEUE_STATUS_BUF_SIZE (4096) ++static ssize_t queue_status_read(struct file *file, ++ char __user * user_buf, size_t count, ++ loff_t * ppos) ++{ ++ struct ssv_softc *sc = (struct ssv_softc *)file->private_data; ++ char *status_buf = kzalloc(QUEUE_STATUS_BUF_SIZE, GFP_KERNEL); ++ ssize_t status_size; ++ ssize_t ret; ++ if (!status_buf) ++ return -ENOMEM; ++ status_size = ssv6xxx_tx_queue_status_dump(sc, status_buf, ++ QUEUE_STATUS_BUF_SIZE); ++ ret = simple_read_from_buffer(user_buf, count, ppos, status_buf, ++ status_size); ++ kfree(status_buf); ++ return ret; ++} ++ ++static int queue_status_open(struct inode *inode, struct file *file) ++{ ++ file->private_data = inode->i_private; ++ return 0; ++} ++ ++static const struct file_operations queue_status_fops ++ = {.read = queue_status_read, ++ .open = queue_status_open ++}; ++#endif ++int ssv6xxx_init_debugfs(struct ssv_softc *sc, const char *name) ++{ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct ieee80211_hw *hw = sc->hw; ++ struct dentry *phy_debugfs_dir = hw->wiphy->debugfsdir; ++ struct dentry *drv_debugfs_dir; ++ drv_debugfs_dir = debugfs_create_dir(name, phy_debugfs_dir); ++ if (!drv_debugfs_dir) { ++ dev_err(sc->dev, "Failed to create debugfs.\n"); ++ return -ENOMEM; ++ } ++ sc->debugfs_dir = drv_debugfs_dir; ++ sc->sh->hci.hci_ops->hci_init_debugfs(sc->debugfs_dir); ++ debugfs_create_file("queue_status", 00444, drv_debugfs_dir, ++ sc, &queue_status_fops); ++#endif ++ return 0; ++} ++ ++void ssv6xxx_deinit_debugfs(struct ssv_softc *sc) ++{ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ if (!sc->debugfs_dir) ++ return; ++ sc->sh->hci.hci_ops->hci_deinit_debugfs(); ++ debugfs_remove_recursive(sc->debugfs_dir); ++ sc->debugfs_dir = NULL; ++#endif ++} ++ ++int ssv6xxx_debugfs_add_interface(struct ssv_softc *sc, ++ struct ieee80211_vif *vif) ++{ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct dentry *drv_debugfs_dir = sc->debugfs_dir; ++ struct dentry *vif_debugfs_dir; ++ char vif_addr[18]; ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ snprintf(vif_addr, sizeof(vif_addr), "%02X-%02X-%02X-%02X-%02X-%02X", ++ vif->addr[0], vif->addr[1], vif->addr[2], ++ vif->addr[3], vif->addr[4], vif->addr[5]); ++ vif_debugfs_dir = debugfs_create_dir(vif_addr, drv_debugfs_dir); ++ if (!vif_debugfs_dir) { ++ dev_err(sc->dev, "Failed to create interface debugfs for %s.\n", ++ vif_addr); ++ return -ENOMEM; ++ } ++ sc->debugfs_dir = drv_debugfs_dir; ++ vif_info->debugfs_dir = vif_debugfs_dir; ++#endif ++ return 0; ++} ++ ++int ssv6xxx_debugfs_remove_interface(struct ssv_softc *sc, ++ struct ieee80211_vif *vif) ++{ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)vif->drv_priv; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ if ((vif_info->debugfs_dir == NULL) || (sc->debugfs_dir == NULL)) ++ return 0; ++ debugfs_remove_recursive(vif_info->debugfs_dir); ++ vif_info->debugfs_dir = NULL; ++#endif ++ return 0; ++} ++ ++int ssv6xxx_debugfs_remove_sta(struct ssv_softc *sc, struct ssv_sta_info *sta) ++{ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)sta->vif->drv_priv; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ if ((sc->debugfs_dir == NULL) || (vif_info->debugfs_dir == NULL) ++ || (sta->debugfs_dir == NULL)) ++ return 0; ++ debugfs_remove_recursive(sta->debugfs_dir); ++ sta->debugfs_dir = NULL; ++#endif ++ return 0; ++} ++ ++int ssv6xxx_debugfs_add_sta(struct ssv_softc *sc, struct ssv_sta_info *sta) ++{ ++#ifdef CONFIG_SSV6XXX_DEBUGFS ++ struct ssv_vif_priv_data *vif_priv = ++ (struct ssv_vif_priv_data *)sta->vif->drv_priv; ++ struct ssv_vif_info *vif_info = &sc->vif_info[vif_priv->vif_idx]; ++ struct dentry *vif_debugfs_dir = vif_info->debugfs_dir; ++ struct dentry *sta_debugfs_dir; ++ char sta_addr[18]; ++ if (vif_debugfs_dir == NULL) ++ return 0; ++ snprintf(sta_addr, sizeof(sta_addr), "%02X-%02X-%02X-%02X-%02X-%02X", ++ sta->sta->addr[0], sta->sta->addr[1], sta->sta->addr[2], ++ sta->sta->addr[3], sta->sta->addr[4], sta->sta->addr[5]); ++ sta_debugfs_dir = debugfs_create_dir(sta_addr, vif_debugfs_dir); ++ if (!sta_debugfs_dir) { ++ dev_err(sc->dev, "Failed to create interface debugfs for %s.\n", ++ sta_addr); ++ return -ENOMEM; ++ } ++ sta->debugfs_dir = sta_debugfs_dir; ++#endif ++ return 0; ++} ++ ++#define DEBUGFS_ADD_FILE(name,parent,mode) do { \ ++ if (!debugfs_create_file(#name, mode, parent, priv, \ ++ &ssv_dbgfs_##name##_ops)) \ ++ goto err; \ ++} while (0) ++#define DEBUGFS_ADD_BOOL(name,parent,ptr) do { \ ++ struct dentry *__tmp; \ ++ __tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \ ++ parent, ptr); \ ++ if (IS_ERR(__tmp) || !__tmp) \ ++ goto err; \ ++} while (0) ++#define DEBUGFS_ADD_X32(name,parent,ptr) do { \ ++ struct dentry *__tmp; \ ++ __tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \ ++ parent, ptr); \ ++ if (IS_ERR(__tmp) || !__tmp) \ ++ goto err; \ ++} while (0) ++#define DEBUGFS_ADD_U32(name,parent,ptr,mode) do { \ ++ struct dentry *__tmp; \ ++ __tmp = debugfs_create_u32(#name, mode, \ ++ parent, ptr); \ ++ if (IS_ERR(__tmp) || !__tmp) \ ++ goto err; \ ++} while (0) ++#define DEBUGFS_READ_FUNC(name) \ ++static ssize_t ssv_dbgfs_##name##_read(struct file *file, \ ++ char __user *user_buf, \ ++ size_t count, loff_t *ppos); ++#define DEBUGFS_WRITE_FUNC(name) \ ++static ssize_t ssv_dbgfs_##name##_write(struct file *file, \ ++ const char __user *user_buf, \ ++ size_t count, loff_t *ppos); ++#define DEBUGFS_READ_FILE_OPS(name) \ ++ DEBUGFS_READ_FUNC(name); \ ++static const struct file_operations ssv_dbgfs_##name##_ops = { \ ++ .read = ssv_dbgfs_##name##_read, \ ++ .open = ssv_dbgfs_open_file_generic, \ ++ .llseek = generic_file_llseek, \ ++}; ++#define DEBUGFS_WRITE_FILE_OPS(name) \ ++ DEBUGFS_WRITE_FUNC(name); \ ++static const struct file_operations ssv_dbgfs_##name##_ops = { \ ++ .write = ssv_dbgfs_##name##_write, \ ++ .open = ssv_dbgfs_open_file_generic, \ ++ .llseek = generic_file_llseek, \ ++}; ++#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ ++ DEBUGFS_READ_FUNC(name); \ ++ DEBUGFS_WRITE_FUNC(name); \ ++static const struct file_operations ssv_dbgfs_##name##_ops = { \ ++ .write = ssv_dbgfs_##name##_write, \ ++ .read = ssv_dbgfs_##name##_read, \ ++ .open = ssv_dbgfs_open_file_generic, \ ++ .llseek = generic_file_llseek, \ ++}; +diff --git a/drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.h b/drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.h +new file mode 100644 +index 000000000000..39caceadda4a +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv6xxx_debugfs.h +@@ -0,0 +1,27 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef __SSV6XXX_DBGFS_H__ ++#define __SSV6XXX_DBGFS_H__ ++int ssv6xxx_init_debugfs(struct ssv_softc *sc, const char *name); ++void ssv6xxx_deinit_debugfs(struct ssv_softc *sc); ++int ssv6xxx_debugfs_remove_interface(struct ssv_softc *sc, ++ struct ieee80211_vif *vif); ++int ssv6xxx_debugfs_add_interface(struct ssv_softc *sc, ++ struct ieee80211_vif *vif); ++int ssv6xxx_debugfs_remove_sta(struct ssv_softc *sc, struct ssv_sta_info *sta); ++int ssv6xxx_debugfs_add_sta(struct ssv_softc *sc, struct ssv_sta_info *sta); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.c b/drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.c +new file mode 100644 +index 000000000000..f0135447b1f3 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.c +@@ -0,0 +1,1384 @@ ++/****************************************************************************** ++ * ++ * Copyright(c) 2012 - 2018 icomm Corporation. All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of version 2 of the GNU General Public License as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * 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, USA ++ * ++ * ++ ******************************************************************************/ ++ ++#include "dev.h" ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(CONFIG_SSV_VENDOR_EXT_SUPPORT) ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "ssv_cfgvendor.h" ++ ++#define wiphy_to_softc(x) (*((struct ssv_softc**)wiphy_priv(x))) ++#define FUNC_NDEV_FMT "%s" ++#define FUNC_NDEV_ARG(ndev) __func__ ++ ++#define _drv_always_ 1 ++#define _drv_emerg_ 2 ++#define _drv_alert_ 3 ++#define _drv_crit_ 4 ++#define _drv_err_ 5 ++#define _drv_warning_ 6 ++#define _drv_notice_ 7 ++#define _drv_info_ 8 ++#define _drv_dump_ 9 ++#define _drv_debug_ 10 ++ ++struct sk_buff *ssv_cfg80211_vendor_event_alloc(struct wiphy *wiphy, int len, ++ int event_id, gfp_t gfp) ++{ ++ struct sk_buff *skb; ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) ++ skb = cfg80211_vendor_event_alloc(wiphy, len, event_id, gfp); ++#else ++ skb = cfg80211_vendor_event_alloc(wiphy, NULL, len, event_id, gfp); ++#endif ++ return skb; ++} ++ ++#define ssv_cfg80211_vendor_event(skb, gfp) \ ++ cfg80211_vendor_event(skb, gfp) ++ ++#define ssv_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len) \ ++ cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len) ++ ++#define ssv_cfg80211_vendor_cmd_reply(skb) \ ++ cfg80211_vendor_cmd_reply(skb) ++ ++/* ++ * This API is to be used for asynchronous vendor events. This ++ * shouldn't be used in response to a vendor command from its ++ * do_it handler context (instead ssv_cfgvendor_send_cmd_reply should ++ * be used). ++ */ ++int ssv_cfgvendor_send_async_event(struct wiphy *wiphy, ++ struct net_device *dev, int event_id, ++ const void *data, int len) ++{ ++ u16 kflags; ++ struct sk_buff *skb; ++ ++ kflags = in_atomic()? GFP_ATOMIC : GFP_KERNEL; ++ ++ /* Alloc the SKB for vendor_event */ ++ skb = ssv_cfg80211_vendor_event_alloc(wiphy, len, event_id, kflags); ++ if (!skb) { ++ dev_err(&wiphy->dev, "skb alloc failed\n"); ++ return -ENOMEM; ++ } ++ ++ /* Push the data to the skb */ ++ nla_put_nohdr(skb, len, data); ++ ++ ssv_cfg80211_vendor_event(skb, kflags); ++ ++ return 0; ++} ++ ++static int ssv_cfgvendor_send_cmd_reply(struct wiphy *wiphy, ++ struct net_device *dev, ++ const void *data, int len) ++{ ++ struct sk_buff *skb; ++ ++ /* Alloc the SKB for vendor_event */ ++ skb = ssv_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len); ++ if (unlikely(!skb)) { ++ dev_err(&wiphy->dev, "skb alloc failed"); ++ return -ENOMEM; ++ } ++ ++ /* Push the data to the skb */ ++ nla_put_nohdr(skb, len, data); ++ ++ return ssv_cfg80211_vendor_cmd_reply(skb); ++} ++ ++#define WIFI_FEATURE_INFRA 0x0001 /* Basic infrastructure mode */ ++#define WIFI_FEATURE_INFRA_5G 0x0002 /* Support for 5 GHz Band */ ++#define WIFI_FEATURE_HOTSPOT 0x0004 /* Support for GAS/ANQP */ ++#define WIFI_FEATURE_P2P 0x0008 /* Wifi-Direct */ ++#define WIFI_FEATURE_SOFT_AP 0x0010 /* Soft AP */ ++#define WIFI_FEATURE_GSCAN 0x0020 /* Google-Scan APIs */ ++#define WIFI_FEATURE_NAN 0x0040 /* Neighbor Awareness Networking */ ++#define WIFI_FEATURE_D2D_RTT 0x0080 /* Device-to-device RTT */ ++#define WIFI_FEATURE_D2AP_RTT 0x0100 /* Device-to-AP RTT */ ++#define WIFI_FEATURE_BATCH_SCAN 0x0200 /* Batched Scan (legacy) */ ++#define WIFI_FEATURE_PNO 0x0400 /* Preferred network offload */ ++#define WIFI_FEATURE_ADDITIONAL_STA 0x0800 /* Support for two STAs */ ++#define WIFI_FEATURE_TDLS 0x1000 /* Tunnel directed link setup */ ++#define WIFI_FEATURE_TDLS_OFFCHANNEL 0x2000 /* Support for TDLS off channel */ ++#define WIFI_FEATURE_EPR 0x4000 /* Enhanced power reporting */ ++#define WIFI_FEATURE_AP_STA 0x8000 /* Support for AP STA Concurrency */ ++ ++#define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3 ++ ++int ssv_dev_get_feature_set(struct net_device *dev) ++{ ++ int feature_set = 0; ++ ++ feature_set |= WIFI_FEATURE_INFRA; ++ ++ feature_set |= WIFI_FEATURE_P2P; ++ feature_set |= WIFI_FEATURE_SOFT_AP; ++ ++#if defined(GSCAN_SUPPORT) ++ feature_set |= WIFI_FEATURE_GSCAN; ++#endif ++ ++#if defined(RTT_SUPPORT) ++ feature_set |= WIFI_FEATURE_NAN; ++ feature_set |= WIFI_FEATURE_D2D_RTT; ++ feature_set |= WIFI_FEATURE_D2AP_RTT; ++#endif ++ ++ return feature_set; ++} ++ ++int *ssv_dev_get_feature_set_matrix(struct net_device *dev, int *num) ++{ ++ int feature_set_full, mem_needed; ++ int *ret; ++ ++ *num = 0; ++ mem_needed = sizeof(int) * MAX_FEATURE_SET_CONCURRRENT_GROUPS; ++ ret = ++ (int *)kmalloc(mem_needed, in_interrupt()? GFP_ATOMIC : GFP_KERNEL); ++ ++ if (!ret) { ++ dev_err(&dev->dev, "failed to allocate %d bytes\n", mem_needed); ++ return ret; ++ } ++ ++ feature_set_full = ssv_dev_get_feature_set(dev); ++ ++ ret[0] = (feature_set_full & WIFI_FEATURE_INFRA) | ++ (feature_set_full & WIFI_FEATURE_INFRA_5G) | ++ (feature_set_full & WIFI_FEATURE_NAN) | ++ (feature_set_full & WIFI_FEATURE_D2D_RTT) | ++ (feature_set_full & WIFI_FEATURE_D2AP_RTT) | ++ (feature_set_full & WIFI_FEATURE_PNO) | ++ (feature_set_full & WIFI_FEATURE_BATCH_SCAN) | ++ (feature_set_full & WIFI_FEATURE_GSCAN) | ++ (feature_set_full & WIFI_FEATURE_HOTSPOT) | ++ (feature_set_full & WIFI_FEATURE_ADDITIONAL_STA) | ++ (feature_set_full & WIFI_FEATURE_EPR); ++ ++ ret[1] = (feature_set_full & WIFI_FEATURE_INFRA) | ++ (feature_set_full & WIFI_FEATURE_INFRA_5G) | ++ /* Not yet verified NAN with P2P */ ++ /* (feature_set_full & WIFI_FEATURE_NAN) | */ ++ (feature_set_full & WIFI_FEATURE_P2P) | ++ (feature_set_full & WIFI_FEATURE_D2AP_RTT) | ++ (feature_set_full & WIFI_FEATURE_D2D_RTT) | ++ (feature_set_full & WIFI_FEATURE_EPR); ++ ++ ret[2] = (feature_set_full & WIFI_FEATURE_INFRA) | ++ (feature_set_full & WIFI_FEATURE_INFRA_5G) | ++ (feature_set_full & WIFI_FEATURE_NAN) | ++ (feature_set_full & WIFI_FEATURE_D2D_RTT) | ++ (feature_set_full & WIFI_FEATURE_D2AP_RTT) | ++ (feature_set_full & WIFI_FEATURE_TDLS) | ++ (feature_set_full & WIFI_FEATURE_TDLS_OFFCHANNEL) | ++ (feature_set_full & WIFI_FEATURE_EPR); ++ *num = MAX_FEATURE_SET_CONCURRRENT_GROUPS; ++ ++ return ret; ++} ++ ++#define wdev_to_ndev(wdev) NULL ++ ++static int ssv_cfgvendor_get_feature_set(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ int reply; ++ ++ reply = ssv_dev_get_feature_set(wdev_to_ndev(wdev)); ++ ++ err = ++ ssv_cfgvendor_send_cmd_reply(wiphy, wdev_to_ndev(wdev), &reply, ++ sizeof(int)); ++ ++ if (unlikely(err)) ++ dev_err(&wiphy->dev, "vendor Command reply failed, ret:%d\n", err); ++ ++ return err; ++} ++ ++static int ssv_cfgvendor_get_feature_set_matrix(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct sk_buff *skb; ++ int *reply; ++ int num, mem_needed, i; ++ ++ reply = ssv_dev_get_feature_set_matrix(wdev_to_ndev(wdev), &num); ++ ++ if (!reply) { ++ dev_err(&wiphy->dev, "could not get feature list matrix\n"); ++ err = -EINVAL; ++ return err; ++ } ++ ++ mem_needed = VENDOR_REPLY_OVERHEAD + (ATTRIBUTE_U32_LEN * num) + ++ ATTRIBUTE_U32_LEN; ++ ++ /* Alloc the SKB for vendor_event */ ++ skb = ssv_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed); ++ if (unlikely(!skb)) { ++ dev_err(&wiphy->dev, "skb alloc failed\n"); ++ err = -ENOMEM; ++ goto exit; ++ } ++ ++ nla_put_u32(skb, ANDR_WIFI_ATTRIBUTE_NUM_FEATURE_SET, num); ++ for (i = 0; i < num; i++) { ++ nla_put_u32(skb, ANDR_WIFI_ATTRIBUTE_FEATURE_SET, reply[i]); ++ } ++ ++ err = ssv_cfg80211_vendor_cmd_reply(skb); ++ ++ if (unlikely(err)) ++ dev_err(&wiphy->dev, "vendor Command reply failed, ret=%d\n", err); ++ exit: ++ kfree((void *)reply); ++ return err; ++} ++ ++#if defined(GSCAN_SUPPORT) && 0 ++int wl_cfgvendor_send_hotlist_event(struct wiphy *wiphy, ++ struct net_device *dev, void *data, int len, ++ wl_vendor_event_t event) ++{ ++ u16 kflags; ++ const void *ptr; ++ struct sk_buff *skb; ++ int malloc_len, total, iter_cnt_to_send, cnt; ++ gscan_results_cache_t *cache = (gscan_results_cache_t *) data; ++ ++ total = len / sizeof(wifi_gscan_result_t); ++ while (total > 0) { ++ malloc_len = ++ (total * sizeof(wifi_gscan_result_t)) + ++ VENDOR_DATA_OVERHEAD; ++ if (malloc_len > NLMSG_DEFAULT_SIZE) { ++ malloc_len = NLMSG_DEFAULT_SIZE; ++ } ++ iter_cnt_to_send = ++ (malloc_len - ++ VENDOR_DATA_OVERHEAD) / sizeof(wifi_gscan_result_t); ++ total = total - iter_cnt_to_send; ++ ++ kflags = in_atomic()? GFP_ATOMIC : GFP_KERNEL; ++ ++ /* Alloc the SKB for vendor_event */ ++ skb = ++ ssv_cfg80211_vendor_event_alloc(wiphy, malloc_len, event, ++ kflags); ++ if (!skb) { ++ WL_ERR(("skb alloc failed")); ++ return -ENOMEM; ++ } ++ ++ while (cache && iter_cnt_to_send) { ++ ptr = ++ (const void *)&cache->results[cache->tot_consumed]; ++ ++ if (iter_cnt_to_send < ++ (cache->tot_count - cache->tot_consumed)) ++ cnt = iter_cnt_to_send; ++ else ++ cnt = (cache->tot_count - cache->tot_consumed); ++ ++ iter_cnt_to_send -= cnt; ++ cache->tot_consumed += cnt; ++ /* Push the data to the skb */ ++ nla_append(skb, cnt * sizeof(wifi_gscan_result_t), ptr); ++ if (cache->tot_consumed == cache->tot_count) ++ cache = cache->next; ++ ++ } ++ ++ ssv_cfg80211_vendor_event(skb, kflags); ++ } ++ ++ return 0; ++} ++ ++static int wl_cfgvendor_gscan_get_capabilities(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ dhd_pno_gscan_capabilities_t *reply = NULL; ++ uint32 reply_len = 0; ++ ++ reply = dhd_dev_pno_get_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_GET_CAPABILITIES, NULL, ++ &reply_len); ++ if (!reply) { ++ WL_ERR(("Could not get capabilities\n")); ++ err = -EINVAL; ++ return err; ++ } ++ ++ err = ssv_cfgvendor_send_cmd_reply(wiphy, bcmcfg_to_prmry_ndev(cfg), ++ reply, reply_len); ++ ++ if (unlikely(err)) ++ WL_ERR(("Vendor Command reply failed ret:%d \n", err)); ++ ++ kfree(reply); ++ return err; ++} ++ ++static int wl_cfgvendor_gscan_get_channel_list(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0, type, band; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ uint16 *reply = NULL; ++ uint32 reply_len = 0, num_channels, mem_needed; ++ struct sk_buff *skb; ++ ++ type = nla_type(data); ++ ++ if (type == GSCAN_ATTRIBUTE_BAND) { ++ band = nla_get_u32(data); ++ } else { ++ return -1; ++ } ++ ++ reply = dhd_dev_pno_get_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_GET_CHANNEL_LIST, &band, ++ &reply_len); ++ ++ if (!reply) { ++ WL_ERR(("Could not get channel list\n")); ++ err = -EINVAL; ++ return err; ++ } ++ num_channels = reply_len / sizeof(uint32); ++ mem_needed = ++ reply_len + VENDOR_REPLY_OVERHEAD + (ATTRIBUTE_U32_LEN * 2); ++ ++ /* Alloc the SKB for vendor_event */ ++ skb = ssv_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed); ++ if (unlikely(!skb)) { ++ WL_ERR(("skb alloc failed")); ++ err = -ENOMEM; ++ goto exit; ++ } ++ ++ nla_put_u32(skb, GSCAN_ATTRIBUTE_NUM_CHANNELS, num_channels); ++ nla_put(skb, GSCAN_ATTRIBUTE_CHANNEL_LIST, reply_len, reply); ++ ++ err = ssv_cfg80211_vendor_cmd_reply(skb); ++ ++ if (unlikely(err)) ++ WL_ERR(("Vendor Command reply failed ret:%d \n", err)); ++ exit: ++ kfree(reply); ++ return err; ++} ++ ++static int wl_cfgvendor_gscan_get_batch_results(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ gscan_results_cache_t *results, *iter; ++ uint32 reply_len, complete = 0, num_results_iter; ++ int32 mem_needed; ++ wifi_gscan_result_t *ptr; ++ uint16 num_scan_ids, num_results; ++ struct sk_buff *skb; ++ struct nlattr *scan_hdr; ++ ++ dhd_dev_wait_batch_results_complete(bcmcfg_to_prmry_ndev(cfg)); ++ dhd_dev_pno_lock_access_batch_results(bcmcfg_to_prmry_ndev(cfg)); ++ results = dhd_dev_pno_get_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_GET_BATCH_RESULTS, NULL, ++ &reply_len); ++ ++ if (!results) { ++ WL_ERR(("No results to send %d\n", err)); ++ err = ++ ssv_cfgvendor_send_cmd_reply(wiphy, ++ bcmcfg_to_prmry_ndev(cfg), ++ results, 0); ++ ++ if (unlikely(err)) ++ WL_ERR(("Vendor Command reply failed ret:%d \n", err)); ++ dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev ++ (cfg)); ++ return err; ++ } ++ num_scan_ids = reply_len & 0xFFFF; ++ num_results = (reply_len & 0xFFFF0000) >> 16; ++ mem_needed = (num_results * sizeof(wifi_gscan_result_t)) + ++ (num_scan_ids * GSCAN_BATCH_RESULT_HDR_LEN) + ++ VENDOR_REPLY_OVERHEAD + SCAN_RESULTS_COMPLETE_FLAG_LEN; ++ ++ if (mem_needed > (int32) NLMSG_DEFAULT_SIZE) { ++ mem_needed = (int32) NLMSG_DEFAULT_SIZE; ++ complete = 0; ++ } else { ++ complete = 1; ++ } ++ ++ WL_TRACE(("complete %d mem_needed %d max_mem %d\n", complete, ++ mem_needed, (int)NLMSG_DEFAULT_SIZE)); ++ /* Alloc the SKB for vendor_event */ ++ skb = ssv_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed); ++ if (unlikely(!skb)) { ++ WL_ERR(("skb alloc failed")); ++ dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev ++ (cfg)); ++ return -ENOMEM; ++ } ++ iter = results; ++ ++ nla_put_u32(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE, complete); ++ ++ mem_needed = ++ mem_needed - (SCAN_RESULTS_COMPLETE_FLAG_LEN + ++ VENDOR_REPLY_OVERHEAD); ++ ++ while (iter && ((mem_needed - GSCAN_BATCH_RESULT_HDR_LEN) > 0)) { ++ scan_hdr = nla_nest_start(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS); ++ nla_put_u32(skb, GSCAN_ATTRIBUTE_SCAN_ID, iter->scan_id); ++ nla_put_u8(skb, GSCAN_ATTRIBUTE_SCAN_FLAGS, iter->flag); ++ num_results_iter = ++ (mem_needed - ++ GSCAN_BATCH_RESULT_HDR_LEN) / sizeof(wifi_gscan_result_t); ++ ++ if ((iter->tot_count - iter->tot_consumed) < num_results_iter) ++ num_results_iter = iter->tot_count - iter->tot_consumed; ++ ++ nla_put_u32(skb, GSCAN_ATTRIBUTE_NUM_OF_RESULTS, ++ num_results_iter); ++ if (num_results_iter) { ++ ptr = &iter->results[iter->tot_consumed]; ++ iter->tot_consumed += num_results_iter; ++ nla_put(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS, ++ num_results_iter * sizeof(wifi_gscan_result_t), ++ ptr); ++ } ++ nla_nest_end(skb, scan_hdr); ++ mem_needed -= GSCAN_BATCH_RESULT_HDR_LEN + ++ (num_results_iter * sizeof(wifi_gscan_result_t)); ++ iter = iter->next; ++ } ++ ++ dhd_dev_gscan_batch_cache_cleanup(bcmcfg_to_prmry_ndev(cfg)); ++ dhd_dev_pno_unlock_access_batch_results(bcmcfg_to_prmry_ndev(cfg)); ++ ++ return ssv_cfg80211_vendor_cmd_reply(skb); ++} ++ ++static int wl_cfgvendor_initiate_gscan(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ int type, tmp = len; ++ int run = 0xFF; ++ int flush = 0; ++ const struct nlattr *iter; ++ ++ nla_for_each_attr(iter, data, len, tmp) { ++ type = nla_type(iter); ++ if (type == GSCAN_ATTRIBUTE_ENABLE_FEATURE) ++ run = nla_get_u32(iter); ++ else if (type == GSCAN_ATTRIBUTE_FLUSH_FEATURE) ++ flush = nla_get_u32(iter); ++ } ++ ++ if (run != 0xFF) { ++ err = ++ dhd_dev_pno_run_gscan(bcmcfg_to_prmry_ndev(cfg), run, ++ flush); ++ ++ if (unlikely(err)) ++ WL_ERR(("Could not run gscan:%d \n", err)); ++ return err; ++ } else { ++ return -1; ++ } ++ ++} ++ ++static int wl_cfgvendor_enable_full_scan_result(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ int type; ++ bool real_time = FALSE; ++ ++ type = nla_type(data); ++ ++ if (type == GSCAN_ATTRIBUTE_ENABLE_FULL_SCAN_RESULTS) { ++ real_time = nla_get_u32(data); ++ ++ err = ++ dhd_dev_pno_enable_full_scan_result(bcmcfg_to_prmry_ndev ++ (cfg), real_time); ++ ++ if (unlikely(err)) ++ WL_ERR(("Could not run gscan:%d \n", err)); ++ ++ } else { ++ err = -1; ++ } ++ ++ return err; ++} ++ ++static int wl_cfgvendor_set_scan_cfg(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ gscan_scan_params_t *scan_param; ++ int j = 0; ++ int type, tmp, tmp1, tmp2, k = 0; ++ const struct nlattr *iter, *iter1, *iter2; ++ struct dhd_pno_gscan_channel_bucket *ch_bucket; ++ ++ scan_param = kzalloc(sizeof(gscan_scan_params_t), GFP_KERNEL); ++ if (!scan_param) { ++ WL_ERR(("Could not set GSCAN scan cfg, mem alloc failure\n")); ++ err = -EINVAL; ++ return err; ++ ++ } ++ ++ scan_param->scan_fr = PNO_SCAN_MIN_FW_SEC; ++ nla_for_each_attr(iter, data, len, tmp) { ++ type = nla_type(iter); ++ ++ if (j >= GSCAN_MAX_CH_BUCKETS) ++ break; ++ ++ switch (type) { ++ case GSCAN_ATTRIBUTE_BASE_PERIOD: ++ scan_param->scan_fr = nla_get_u32(iter) / 1000; ++ break; ++ case GSCAN_ATTRIBUTE_NUM_BUCKETS: ++ scan_param->nchannel_buckets = nla_get_u32(iter); ++ break; ++ case GSCAN_ATTRIBUTE_CH_BUCKET_1: ++ case GSCAN_ATTRIBUTE_CH_BUCKET_2: ++ case GSCAN_ATTRIBUTE_CH_BUCKET_3: ++ case GSCAN_ATTRIBUTE_CH_BUCKET_4: ++ case GSCAN_ATTRIBUTE_CH_BUCKET_5: ++ case GSCAN_ATTRIBUTE_CH_BUCKET_6: ++ case GSCAN_ATTRIBUTE_CH_BUCKET_7: ++ nla_for_each_nested(iter1, iter, tmp1) { ++ type = nla_type(iter1); ++ ch_bucket = scan_param->channel_bucket; ++ ++ switch (type) { ++ case GSCAN_ATTRIBUTE_BUCKET_ID: ++ break; ++ case GSCAN_ATTRIBUTE_BUCKET_PERIOD: ++ ch_bucket[j].bucket_freq_multiple = ++ nla_get_u32(iter1) / 1000; ++ break; ++ case GSCAN_ATTRIBUTE_BUCKET_NUM_CHANNELS: ++ ch_bucket[j].num_channels = ++ nla_get_u32(iter1); ++ break; ++ case GSCAN_ATTRIBUTE_BUCKET_CHANNELS: ++ nla_for_each_nested(iter2, iter1, tmp2) { ++ if (k >= ++ PFN_SWC_RSSI_WINDOW_MAX) ++ break; ++ ch_bucket[j].chan_list[k] = ++ nla_get_u32(iter2); ++ k++; ++ } ++ k = 0; ++ break; ++ case GSCAN_ATTRIBUTE_BUCKETS_BAND: ++ ch_bucket[j].band = (uint16) ++ nla_get_u32(iter1); ++ break; ++ case GSCAN_ATTRIBUTE_REPORT_EVENTS: ++ ch_bucket[j].report_flag = (uint8) ++ nla_get_u32(iter1); ++ break; ++ } ++ } ++ j++; ++ break; ++ } ++ } ++ ++ if (dhd_dev_pno_set_cfg_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_SCAN_CFG_ID, scan_param, 0) < 0) { ++ WL_ERR(("Could not set GSCAN scan cfg\n")); ++ err = -EINVAL; ++ } ++ ++ kfree(scan_param); ++ return err; ++ ++} ++ ++static int wl_cfgvendor_hotlist_cfg(struct wiphy *wiphy, ++ struct wireless_dev *wdev, const void *data, ++ int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ gscan_hotlist_scan_params_t *hotlist_params; ++ int tmp, tmp1, tmp2, type, j = 0, dummy; ++ const struct nlattr *outer, *inner, *iter; ++ uint8 flush = 0; ++ struct bssid_t *pbssid; ++ ++ hotlist_params = ++ (gscan_hotlist_scan_params_t *) kzalloc(len, GFP_KERNEL); ++ if (!hotlist_params) { ++ WL_ERR(("Cannot Malloc mem to parse config commands size - %d bytes \n", len)); ++ return -1; ++ } ++ ++ hotlist_params->lost_ap_window = GSCAN_LOST_AP_WINDOW_DEFAULT; ++ ++ nla_for_each_attr(iter, data, len, tmp2) { ++ type = nla_type(iter); ++ switch (type) { ++ case GSCAN_ATTRIBUTE_HOTLIST_BSSIDS: ++ pbssid = hotlist_params->bssid; ++ nla_for_each_nested(outer, iter, tmp) { ++ nla_for_each_nested(inner, outer, tmp1) { ++ type = nla_type(inner); ++ ++ switch (type) { ++ case GSCAN_ATTRIBUTE_BSSID: ++ memcpy(&(pbssid[j].macaddr), ++ nla_data(inner), ++ ETHER_ADDR_LEN); ++ break; ++ case GSCAN_ATTRIBUTE_RSSI_LOW: ++ pbssid[j]. ++ rssi_reporting_threshold = ++ (int8) nla_get_u8(inner); ++ break; ++ case GSCAN_ATTRIBUTE_RSSI_HIGH: ++ dummy = ++ (int8) nla_get_u8(inner); ++ break; ++ } ++ } ++ j++; ++ } ++ hotlist_params->nbssid = j; ++ break; ++ case GSCAN_ATTRIBUTE_HOTLIST_FLUSH: ++ flush = nla_get_u8(iter); ++ break; ++ case GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE: ++ hotlist_params->lost_ap_window = nla_get_u32(iter); ++ break; ++ } ++ ++ } ++ ++ if (dhd_dev_pno_set_cfg_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_GEOFENCE_SCAN_CFG_ID, ++ hotlist_params, flush) < 0) { ++ WL_ERR(("Could not set GSCAN HOTLIST cfg\n")); ++ err = -EINVAL; ++ goto exit; ++ } ++ exit: ++ kfree(hotlist_params); ++ return err; ++} ++ ++static int wl_cfgvendor_set_batch_scan_cfg(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0, tmp, type; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ gscan_batch_params_t batch_param; ++ const struct nlattr *iter; ++ ++ batch_param.mscan = batch_param.bestn = 0; ++ batch_param.buffer_threshold = GSCAN_BATCH_NO_THR_SET; ++ ++ nla_for_each_attr(iter, data, len, tmp) { ++ type = nla_type(iter); ++ ++ switch (type) { ++ case GSCAN_ATTRIBUTE_NUM_AP_PER_SCAN: ++ batch_param.bestn = nla_get_u32(iter); ++ break; ++ case GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE: ++ batch_param.mscan = nla_get_u32(iter); ++ break; ++ case GSCAN_ATTRIBUTE_REPORT_THRESHOLD: ++ batch_param.buffer_threshold = nla_get_u32(iter); ++ break; ++ } ++ } ++ ++ if (dhd_dev_pno_set_cfg_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_BATCH_SCAN_CFG_ID, &batch_param, ++ 0) < 0) { ++ WL_ERR(("Could not set batch cfg\n")); ++ err = -EINVAL; ++ return err; ++ } ++ ++ return err; ++} ++ ++static int wl_cfgvendor_significant_change_cfg(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ gscan_swc_params_t *significant_params; ++ int tmp, tmp1, tmp2, type, j = 0; ++ const struct nlattr *outer, *inner, *iter; ++ uint8 flush = 0; ++ wl_pfn_significant_bssid_t *pbssid; ++ ++ significant_params = (gscan_swc_params_t *) kzalloc(len, GFP_KERNEL); ++ if (!significant_params) { ++ WL_ERR(("Cannot Malloc mem to parse config commands size - %d bytes \n", len)); ++ return -1; ++ } ++ ++ nla_for_each_attr(iter, data, len, tmp2) { ++ type = nla_type(iter); ++ ++ switch (type) { ++ case GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_FLUSH: ++ flush = nla_get_u8(iter); ++ break; ++ case GSCAN_ATTRIBUTE_RSSI_SAMPLE_SIZE: ++ significant_params->rssi_window = nla_get_u16(iter); ++ break; ++ case GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE: ++ significant_params->lost_ap_window = nla_get_u16(iter); ++ break; ++ case GSCAN_ATTRIBUTE_MIN_BREACHING: ++ significant_params->swc_threshold = nla_get_u16(iter); ++ break; ++ case GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS: ++ pbssid = significant_params->bssid_elem_list; ++ nla_for_each_nested(outer, iter, tmp) { ++ nla_for_each_nested(inner, outer, tmp1) { ++ switch (nla_type(inner)) { ++ case GSCAN_ATTRIBUTE_BSSID: ++ memcpy(&(pbssid[j].macaddr), ++ nla_data(inner), ++ ETHER_ADDR_LEN); ++ break; ++ case GSCAN_ATTRIBUTE_RSSI_HIGH: ++ pbssid[j].rssi_high_threshold = ++ (int8) nla_get_u8(inner); ++ break; ++ case GSCAN_ATTRIBUTE_RSSI_LOW: ++ pbssid[j].rssi_low_threshold = ++ (int8) nla_get_u8(inner); ++ break; ++ } ++ } ++ j++; ++ } ++ break; ++ } ++ } ++ significant_params->nbssid = j; ++ ++ if (dhd_dev_pno_set_cfg_gscan(bcmcfg_to_prmry_ndev(cfg), ++ DHD_PNO_SIGNIFICANT_SCAN_CFG_ID, ++ significant_params, flush) < 0) { ++ WL_ERR(("Could not set GSCAN significant cfg\n")); ++ err = -EINVAL; ++ goto exit; ++ } ++ exit: ++ kfree(significant_params); ++ return err; ++} ++#endif /* GSCAN_SUPPORT */ ++ ++#if defined(RTT_SUPPORT) && 0 ++void wl_cfgvendor_rtt_evt(void *ctx, void *rtt_data) ++{ ++ struct wireless_dev *wdev = (struct wireless_dev *)ctx; ++ struct wiphy *wiphy; ++ struct sk_buff *skb; ++ uint32 tot_len = NLMSG_DEFAULT_SIZE, entry_len = 0; ++ gfp_t kflags; ++ rtt_report_t *rtt_report = NULL; ++ rtt_result_t *rtt_result = NULL; ++ struct list_head *rtt_list; ++ wiphy = wdev->wiphy; ++ ++ WL_DBG(("In\n")); ++ /* Push the data to the skb */ ++ if (!rtt_data) { ++ WL_ERR(("rtt_data is NULL\n")); ++ goto exit; ++ } ++ rtt_list = (struct list_head *)rtt_data; ++ kflags = in_atomic()? GFP_ATOMIC : GFP_KERNEL; ++ /* Alloc the SKB for vendor_event */ ++ skb = ++ ssv_cfg80211_vendor_event_alloc(wiphy, tot_len, ++ GOOGLE_RTT_COMPLETE_EVENT, kflags); ++ if (!skb) { ++ WL_ERR(("skb alloc failed")); ++ goto exit; ++ } ++ /* fill in the rtt results on each entry */ ++ list_for_each_entry(rtt_result, rtt_list, list) { ++ entry_len = 0; ++ if (rtt_result->TOF_type == TOF_TYPE_ONE_WAY) { ++ entry_len = sizeof(rtt_report_t); ++ rtt_report = kzalloc(entry_len, kflags); ++ if (!rtt_report) { ++ WL_ERR(("rtt_report alloc failed")); ++ goto exit; ++ } ++ rtt_report->addr = rtt_result->peer_mac; ++ rtt_report->num_measurement = 1; /* ONE SHOT */ ++ rtt_report->status = rtt_result->err_code; ++ rtt_report->type = ++ (rtt_result->TOF_type == ++ TOF_TYPE_ONE_WAY) ? RTT_ONE_WAY : RTT_TWO_WAY; ++ rtt_report->peer = rtt_result->target_info->peer; ++ rtt_report->channel = rtt_result->target_info->channel; ++ rtt_report->rssi = rtt_result->avg_rssi; ++ /* tx_rate */ ++ rtt_report->tx_rate = rtt_result->tx_rate; ++ /* RTT */ ++ rtt_report->rtt = rtt_result->meanrtt; ++ rtt_report->rtt_sd = rtt_result->sdrtt; ++ /* convert to centi meter */ ++ if (rtt_result->distance != 0xffffffff) ++ rtt_report->distance = ++ (rtt_result->distance >> 2) * 25; ++ else /* invalid distance */ ++ rtt_report->distance = -1; ++ ++ rtt_report->ts = rtt_result->ts; ++ nla_append(skb, entry_len, rtt_report); ++ kfree(rtt_report); ++ } ++ } ++ ssv_cfg80211_vendor_event(skb, kflags); ++ exit: ++ return; ++} ++ ++static int wl_cfgvendor_rtt_set_config(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0, rem, rem1, rem2, type; ++ rtt_config_params_t rtt_param; ++ rtt_target_info_t *rtt_target = NULL; ++ const struct nlattr *iter, *iter1, *iter2; ++ int8 eabuf[ETHER_ADDR_STR_LEN]; ++ int8 chanbuf[CHANSPEC_STR_LEN]; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ ++ WL_DBG(("In\n")); ++ err = ++ dhd_dev_rtt_register_noti_callback(wdev->netdev, wdev, ++ wl_cfgvendor_rtt_evt); ++ if (err < 0) { ++ WL_ERR(("failed to register rtt_noti_callback\n")); ++ goto exit; ++ } ++ memset(&rtt_param, 0, sizeof(rtt_param)); ++ nla_for_each_attr(iter, data, len, rem) { ++ type = nla_type(iter); ++ switch (type) { ++ case RTT_ATTRIBUTE_TARGET_CNT: ++ rtt_param.rtt_target_cnt = nla_get_u8(iter); ++ if (rtt_param.rtt_target_cnt > RTT_MAX_TARGET_CNT) { ++ WL_ERR(("exceed max target count : %d\n", ++ rtt_param.rtt_target_cnt)); ++ err = BCME_RANGE; ++ } ++ break; ++ case RTT_ATTRIBUTE_TARGET_INFO: ++ rtt_target = rtt_param.target_info; ++ nla_for_each_nested(iter1, iter, rem1) { ++ nla_for_each_nested(iter2, iter1, rem2) { ++ type = nla_type(iter2); ++ switch (type) { ++ case RTT_ATTRIBUTE_TARGET_MAC: ++ memcpy(&rtt_target->addr, ++ nla_data(iter2), ++ ETHER_ADDR_LEN); ++ break; ++ case RTT_ATTRIBUTE_TARGET_TYPE: ++ rtt_target->type = ++ nla_get_u8(iter2); ++ break; ++ case RTT_ATTRIBUTE_TARGET_PEER: ++ rtt_target->peer = ++ nla_get_u8(iter2); ++ break; ++ case RTT_ATTRIBUTE_TARGET_CHAN: ++ memcpy(&rtt_target->channel, ++ nla_data(iter2), ++ sizeof(rtt_target-> ++ channel)); ++ break; ++ case RTT_ATTRIBUTE_TARGET_MODE: ++ rtt_target->continuous = ++ nla_get_u8(iter2); ++ break; ++ case RTT_ATTRIBUTE_TARGET_INTERVAL: ++ rtt_target->interval = ++ nla_get_u32(iter2); ++ break; ++ case RTT_ATTRIBUTE_TARGET_NUM_MEASUREMENT: ++ rtt_target->measure_cnt = ++ nla_get_u32(iter2); ++ break; ++ case RTT_ATTRIBUTE_TARGET_NUM_PKT: ++ rtt_target->ftm_cnt = ++ nla_get_u32(iter2); ++ break; ++ case RTT_ATTRIBUTE_TARGET_NUM_RETRY: ++ rtt_target->retry_cnt = ++ nla_get_u32(iter2); ++ } ++ } ++ /* convert to chanspec value */ ++ rtt_target->chanspec = ++ dhd_rtt_convert_to_chspec(rtt_target-> ++ channel); ++ if (rtt_target->chanspec == 0) { ++ WL_ERR(("Channel is not valid \n")); ++ goto exit; ++ } ++ WL_INFORM(("Target addr %s, Channel : %s for RTT \n", bcm_ether_ntoa((const struct ether_addr *)&rtt_target->addr, eabuf), wf_chspec_ntoa(rtt_target->chanspec, chanbuf))); ++ rtt_target++; ++ } ++ break; ++ } ++ } ++ WL_DBG(("leave :target_cnt : %d\n", rtt_param.rtt_target_cnt)); ++ if (dhd_dev_rtt_set_cfg(bcmcfg_to_prmry_ndev(cfg), &rtt_param) < 0) { ++ WL_ERR(("Could not set RTT configuration\n")); ++ err = -EINVAL; ++ } ++ exit: ++ return err; ++} ++ ++static int wl_cfgvendor_rtt_cancel_config(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0, rem, type, target_cnt = 0; ++ const struct nlattr *iter; ++ struct ether_addr *mac_list = NULL, *mac_addr = NULL; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ ++ nla_for_each_attr(iter, data, len, rem) { ++ type = nla_type(iter); ++ switch (type) { ++ case RTT_ATTRIBUTE_TARGET_CNT: ++ target_cnt = nla_get_u8(iter); ++ mac_list = ++ (struct ether_addr *)kzalloc(target_cnt * ++ ETHER_ADDR_LEN, ++ GFP_KERNEL); ++ if (mac_list == NULL) { ++ WL_ERR(("failed to allocate mem for mac list\n")); ++ goto exit; ++ } ++ mac_addr = &mac_list[0]; ++ break; ++ case RTT_ATTRIBUTE_TARGET_MAC: ++ if (mac_addr) ++ memcpy(mac_addr++, nla_data(iter), ++ ETHER_ADDR_LEN); ++ else { ++ WL_ERR(("mac_list is NULL\n")); ++ goto exit; ++ } ++ break; ++ } ++ if (dhd_dev_rtt_cancel_cfg ++ (bcmcfg_to_prmry_ndev(cfg), mac_list, target_cnt) < 0) { ++ WL_ERR(("Could not cancel RTT configuration\n")); ++ err = -EINVAL; ++ goto exit; ++ } ++ } ++ exit: ++ if (mac_list) ++ kfree(mac_list); ++ return err; ++} ++ ++static int wl_cfgvendor_rtt_get_capability(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); ++ rtt_capabilities_t capability; ++ ++ err = dhd_dev_rtt_capability(bcmcfg_to_prmry_ndev(cfg), &capability); ++ if (unlikely(err)) { ++ WL_ERR(("Vendor Command reply failed ret:%d \n", err)); ++ goto exit; ++ } ++ err = ssv_cfgvendor_send_cmd_reply(wiphy, bcmcfg_to_prmry_ndev(cfg), ++ &capability, sizeof(capability)); ++ ++ if (unlikely(err)) { ++ WL_ERR(("Vendor Command reply failed ret:%d \n", err)); ++ } ++ exit: ++ return err; ++} ++ ++#endif /* RTT_SUPPORT */ ++static int wl_cfgvendor_priv_string_handler(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ const void *data, int len) ++{ ++ int err = 0; ++ u8 resp[1] = { '\0' }; ++ ++ dev_dbg(&wiphy->dev, "%s\n", (char *)data); ++ err = ssv_cfgvendor_send_cmd_reply(wiphy, wdev_to_ndev(wdev), resp, 1); ++ if (unlikely(err)) ++ dev_err(&wiphy->dev, "vendor Command reply failed, ret=:%d\n", err); ++ ++ return err; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) ++static const struct wiphy_vendor_command ssv_vendor_cmds[] = { ++ { ++ { ++ .vendor_id = OUI_SSV, ++ .subcmd = RTK_VENDOR_SCMD_PRIV_STR}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_priv_string_handler, ++ .policy = VENDOR_CMD_RAW_DATA}, ++#if defined(GSCAN_SUPPORT) && 0 ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_GET_CAPABILITIES}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_gscan_get_capabilities, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_set_scan_cfg, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_SCAN_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_set_batch_scan_cfg, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_ENABLE_GSCAN}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_initiate_gscan, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_enable_full_scan_result, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_HOTLIST}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_hotlist_cfg, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_significant_change_cfg, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_GET_SCAN_RESULTS}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_gscan_get_batch_results, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_GET_CHANNEL_LIST}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_gscan_get_channel_list, ++ .policy = VENDOR_CMD_RAW_DATA}, ++#endif /* GSCAN_SUPPORT */ ++#if defined(RTT_SUPPORT) && 0 ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = RTT_SUBCMD_SET_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_rtt_set_config, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = RTT_SUBCMD_CANCEL_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_rtt_cancel_config, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = RTT_SUBCMD_GETCAPABILITY}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_rtt_get_capability, ++ .policy = VENDOR_CMD_RAW_DATA}, ++#endif /* RTT_SUPPORT */ ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = ssv_cfgvendor_get_feature_set, ++ .policy = VENDOR_CMD_RAW_DATA}, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = ssv_cfgvendor_get_feature_set_matrix, ++ .policy = VENDOR_CMD_RAW_DATA} ++}; ++#else ++static const struct wiphy_vendor_command ssv_vendor_cmds[] = { ++ { ++ { ++ .vendor_id = OUI_SSV, ++ .subcmd = RTK_VENDOR_SCMD_PRIV_STR}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_priv_string_handler ++ }, ++#if defined(GSCAN_SUPPORT) && 0 ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_GET_CAPABILITIES}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_gscan_get_capabilities ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_set_scan_cfg ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_SCAN_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_set_batch_scan_cfg ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_ENABLE_GSCAN}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_initiate_gscan ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_enable_full_scan_result ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_HOTLIST}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_hotlist_cfg ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_significant_change_cfg ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_GET_SCAN_RESULTS}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_gscan_get_batch_results ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = GSCAN_SUBCMD_GET_CHANNEL_LIST}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_gscan_get_channel_list ++ }, ++#endif /* GSCAN_SUPPORT */ ++#if defined(RTT_SUPPORT) && 0 ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = RTT_SUBCMD_SET_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_rtt_set_config ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = RTT_SUBCMD_CANCEL_CONFIG}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_rtt_cancel_config ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = RTT_SUBCMD_GETCAPABILITY}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = wl_cfgvendor_rtt_get_capability ++ }, ++#endif /* RTT_SUPPORT */ ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = ssv_cfgvendor_get_feature_set ++ }, ++ { ++ { ++ .vendor_id = OUI_GOOGLE, ++ .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX}, ++ .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, ++ .doit = ssv_cfgvendor_get_feature_set_matrix ++ } ++}; ++#endif ++ ++static const struct nl80211_vendor_cmd_info ssv_vendor_events[] = { ++ {OUI_SSV, RTK_VENDOR_EVENT_UNSPEC}, ++ {OUI_SSV, RTK_VENDOR_EVENT_PRIV_STR}, ++#if defined(GSCAN_SUPPORT) && 0 ++ {OUI_GOOGLE, GOOGLE_GSCAN_SIGNIFICANT_EVENT}, ++ {OUI_GOOGLE, GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT}, ++ {OUI_GOOGLE, GOOGLE_GSCAN_BATCH_SCAN_EVENT}, ++ {OUI_GOOGLE, GOOGLE_SCAN_FULL_RESULTS_EVENT}, ++#endif /* GSCAN_SUPPORT */ ++#if defined(RTT_SUPPORT) && 0 ++ {OUI_GOOGLE, GOOGLE_RTT_COMPLETE_EVENT}, ++#endif /* RTT_SUPPORT */ ++#if defined(GSCAN_SUPPORT) && 0 ++ {OUI_GOOGLE, GOOGLE_SCAN_COMPLETE_EVENT}, ++ {OUI_GOOGLE, GOOGLE_GSCAN_GEOFENCE_LOST_EVENT} ++#endif /* GSCAN_SUPPORT */ ++}; ++ ++int ssv_cfgvendor_attach(struct wiphy *wiphy) ++{ ++ ++ dev_info(&wiphy->dev, "register SSV cfg80211 vendor cmd(0x%x) interface\n", ++ NL80211_CMD_VENDOR); ++ ++ wiphy->vendor_commands = ssv_vendor_cmds; ++ wiphy->n_vendor_commands = ARRAY_SIZE(ssv_vendor_cmds); ++ wiphy->vendor_events = ssv_vendor_events; ++ wiphy->n_vendor_events = ARRAY_SIZE(ssv_vendor_events); ++ ++ return 0; ++} ++ ++int ssv_cfgvendor_detach(struct wiphy *wiphy) ++{ ++ dev_info(&wiphy->dev, "unregister SSV cfg80211 vendor interface\n"); ++ ++ wiphy->vendor_commands = NULL; ++ wiphy->vendor_events = NULL; ++ wiphy->n_vendor_commands = 0; ++ wiphy->n_vendor_events = 0; ++ ++ return 0; ++} ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(SSV_VENDOR_EXT_SUPPORT) */ +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.h b/drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.h +new file mode 100644 +index 000000000000..6d8696fcd220 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_cfgvendor.h +@@ -0,0 +1,247 @@ ++/****************************************************************************** ++ * ++ * Copyright(c) 2007 - 2014 Realtek Corporation. All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of version 2 of the GNU General Public License as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * 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, USA ++ * ++ * ++ ******************************************************************************/ ++ ++#ifndef _RTW_CFGVENDOR_H_ ++#define _RTW_CFGVENDOR_H_ ++ ++#define OUI_SSV 0x00E04C ++#define OUI_GOOGLE 0x001A11 ++#define ATTRIBUTE_U32_LEN (NLA_HDRLEN + 4) ++#define VENDOR_ID_OVERHEAD ATTRIBUTE_U32_LEN ++#define VENDOR_SUBCMD_OVERHEAD ATTRIBUTE_U32_LEN ++#define VENDOR_DATA_OVERHEAD (NLA_HDRLEN) ++ ++#define SCAN_RESULTS_COMPLETE_FLAG_LEN ATTRIBUTE_U32_LEN ++#define SCAN_INDEX_HDR_LEN (NLA_HDRLEN) ++#define SCAN_ID_HDR_LEN ATTRIBUTE_U32_LEN ++#define SCAN_FLAGS_HDR_LEN ATTRIBUTE_U32_LEN ++#define GSCAN_NUM_RESULTS_HDR_LEN ATTRIBUTE_U32_LEN ++#define GSCAN_RESULTS_HDR_LEN (NLA_HDRLEN) ++#define GSCAN_BATCH_RESULT_HDR_LEN (SCAN_INDEX_HDR_LEN + SCAN_ID_HDR_LEN + \ ++ SCAN_FLAGS_HDR_LEN + \ ++ GSCAN_NUM_RESULTS_HDR_LEN + \ ++ GSCAN_RESULTS_HDR_LEN) ++ ++#define VENDOR_REPLY_OVERHEAD (VENDOR_ID_OVERHEAD + \ ++ VENDOR_SUBCMD_OVERHEAD + \ ++ VENDOR_DATA_OVERHEAD) ++typedef enum { ++ /* don't use 0 as a valid subcommand */ ++ VENDOR_NL80211_SUBCMD_UNSPECIFIED, ++ ++ /* define all vendor startup commands between 0x0 and 0x0FFF */ ++ VENDOR_NL80211_SUBCMD_RANGE_START = 0x0001, ++ VENDOR_NL80211_SUBCMD_RANGE_END = 0x0FFF, ++ ++ /* define all GScan related commands between 0x1000 and 0x10FF */ ++ ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START = 0x1000, ++ ANDROID_NL80211_SUBCMD_GSCAN_RANGE_END = 0x10FF, ++ ++ /* define all NearbyDiscovery related commands between 0x1100 and 0x11FF */ ++ ANDROID_NL80211_SUBCMD_NBD_RANGE_START = 0x1100, ++ ANDROID_NL80211_SUBCMD_NBD_RANGE_END = 0x11FF, ++ ++ /* define all RTT related commands between 0x1100 and 0x11FF */ ++ ANDROID_NL80211_SUBCMD_RTT_RANGE_START = 0x1100, ++ ANDROID_NL80211_SUBCMD_RTT_RANGE_END = 0x11FF, ++ ++ ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START = 0x1200, ++ ANDROID_NL80211_SUBCMD_LSTATS_RANGE_END = 0x12FF, ++ ++ ANDROID_NL80211_SUBCMD_TDLS_RANGE_START = 0x1300, ++ ANDROID_NL80211_SUBCMD_TDLS_RANGE_END = 0x13FF, ++ /* This is reserved for future usage */ ++ ++} ANDROID_VENDOR_SUB_COMMAND; ++ ++enum wl_vendor_subcmd { ++ RTK_VENDOR_SCMD_UNSPEC, ++ RTK_VENDOR_SCMD_PRIV_STR, ++ GSCAN_SUBCMD_GET_CAPABILITIES = ++ ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START, ++ GSCAN_SUBCMD_SET_CONFIG, ++ GSCAN_SUBCMD_SET_SCAN_CONFIG, ++ GSCAN_SUBCMD_ENABLE_GSCAN, ++ GSCAN_SUBCMD_GET_SCAN_RESULTS, ++ GSCAN_SUBCMD_SCAN_RESULTS, ++ GSCAN_SUBCMD_SET_HOTLIST, ++ GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG, ++ GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS, ++ GSCAN_SUBCMD_GET_CHANNEL_LIST, ++ ANDR_WIFI_SUBCMD_GET_FEATURE_SET, ++ ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX, ++ RTT_SUBCMD_SET_CONFIG = ANDROID_NL80211_SUBCMD_RTT_RANGE_START, ++ RTT_SUBCMD_CANCEL_CONFIG, ++ RTT_SUBCMD_GETCAPABILITY, ++ /* Add more sub commands here */ ++ VENDOR_SUBCMD_MAX ++}; ++ ++enum gscan_attributes { ++ GSCAN_ATTRIBUTE_NUM_BUCKETS = 10, ++ GSCAN_ATTRIBUTE_BASE_PERIOD, ++ GSCAN_ATTRIBUTE_BUCKETS_BAND, ++ GSCAN_ATTRIBUTE_BUCKET_ID, ++ GSCAN_ATTRIBUTE_BUCKET_PERIOD, ++ GSCAN_ATTRIBUTE_BUCKET_NUM_CHANNELS, ++ GSCAN_ATTRIBUTE_BUCKET_CHANNELS, ++ GSCAN_ATTRIBUTE_NUM_AP_PER_SCAN, ++ GSCAN_ATTRIBUTE_REPORT_THRESHOLD, ++ GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE, ++ GSCAN_ATTRIBUTE_BAND = GSCAN_ATTRIBUTE_BUCKETS_BAND, ++ ++ GSCAN_ATTRIBUTE_ENABLE_FEATURE = 20, ++ GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE, ++ GSCAN_ATTRIBUTE_FLUSH_FEATURE, ++ GSCAN_ATTRIBUTE_ENABLE_FULL_SCAN_RESULTS, ++ GSCAN_ATTRIBUTE_REPORT_EVENTS, ++ /* remaining reserved for additional attributes */ ++ GSCAN_ATTRIBUTE_NUM_OF_RESULTS = 30, ++ GSCAN_ATTRIBUTE_FLUSH_RESULTS, ++ GSCAN_ATTRIBUTE_SCAN_RESULTS, /* flat array of wifi_scan_result */ ++ GSCAN_ATTRIBUTE_SCAN_ID, /* indicates scan number */ ++ GSCAN_ATTRIBUTE_SCAN_FLAGS, /* indicates if scan was aborted */ ++ GSCAN_ATTRIBUTE_AP_FLAGS, /* flags on significant change event */ ++ GSCAN_ATTRIBUTE_NUM_CHANNELS, ++ GSCAN_ATTRIBUTE_CHANNEL_LIST, ++ ++ /* remaining reserved for additional attributes */ ++ ++ GSCAN_ATTRIBUTE_SSID = 40, ++ GSCAN_ATTRIBUTE_BSSID, ++ GSCAN_ATTRIBUTE_CHANNEL, ++ GSCAN_ATTRIBUTE_RSSI, ++ GSCAN_ATTRIBUTE_TIMESTAMP, ++ GSCAN_ATTRIBUTE_RTT, ++ GSCAN_ATTRIBUTE_RTTSD, ++ ++ /* remaining reserved for additional attributes */ ++ ++ GSCAN_ATTRIBUTE_HOTLIST_BSSIDS = 50, ++ GSCAN_ATTRIBUTE_RSSI_LOW, ++ GSCAN_ATTRIBUTE_RSSI_HIGH, ++ GSCAN_ATTRIBUTE_HOSTLIST_BSSID_ELEM, ++ GSCAN_ATTRIBUTE_HOTLIST_FLUSH, ++ ++ /* remaining reserved for additional attributes */ ++ GSCAN_ATTRIBUTE_RSSI_SAMPLE_SIZE = 60, ++ GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE, ++ GSCAN_ATTRIBUTE_MIN_BREACHING, ++ GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS, ++ GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_FLUSH, ++ GSCAN_ATTRIBUTE_MAX ++}; ++ ++enum gscan_bucket_attributes { ++ GSCAN_ATTRIBUTE_CH_BUCKET_1, ++ GSCAN_ATTRIBUTE_CH_BUCKET_2, ++ GSCAN_ATTRIBUTE_CH_BUCKET_3, ++ GSCAN_ATTRIBUTE_CH_BUCKET_4, ++ GSCAN_ATTRIBUTE_CH_BUCKET_5, ++ GSCAN_ATTRIBUTE_CH_BUCKET_6, ++ GSCAN_ATTRIBUTE_CH_BUCKET_7 ++}; ++ ++enum gscan_ch_attributes { ++ GSCAN_ATTRIBUTE_CH_ID_1, ++ GSCAN_ATTRIBUTE_CH_ID_2, ++ GSCAN_ATTRIBUTE_CH_ID_3, ++ GSCAN_ATTRIBUTE_CH_ID_4, ++ GSCAN_ATTRIBUTE_CH_ID_5, ++ GSCAN_ATTRIBUTE_CH_ID_6, ++ GSCAN_ATTRIBUTE_CH_ID_7 ++}; ++ ++enum rtt_attributes { ++ RTT_ATTRIBUTE_TARGET_CNT, ++ RTT_ATTRIBUTE_TARGET_INFO, ++ RTT_ATTRIBUTE_TARGET_MAC, ++ RTT_ATTRIBUTE_TARGET_TYPE, ++ RTT_ATTRIBUTE_TARGET_PEER, ++ RTT_ATTRIBUTE_TARGET_CHAN, ++ RTT_ATTRIBUTE_TARGET_MODE, ++ RTT_ATTRIBUTE_TARGET_INTERVAL, ++ RTT_ATTRIBUTE_TARGET_NUM_MEASUREMENT, ++ RTT_ATTRIBUTE_TARGET_NUM_PKT, ++ RTT_ATTRIBUTE_TARGET_NUM_RETRY ++}; ++ ++typedef enum wl_vendor_event { ++ RTK_VENDOR_EVENT_UNSPEC, ++ RTK_VENDOR_EVENT_PRIV_STR, ++ GOOGLE_GSCAN_SIGNIFICANT_EVENT, ++ GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT, ++ GOOGLE_GSCAN_BATCH_SCAN_EVENT, ++ GOOGLE_SCAN_FULL_RESULTS_EVENT, ++ GOOGLE_RTT_COMPLETE_EVENT, ++ GOOGLE_SCAN_COMPLETE_EVENT, ++ GOOGLE_GSCAN_GEOFENCE_LOST_EVENT ++} wl_vendor_event_t; ++ ++enum andr_wifi_feature_set_attr { ++ ANDR_WIFI_ATTRIBUTE_NUM_FEATURE_SET, ++ ANDR_WIFI_ATTRIBUTE_FEATURE_SET ++}; ++ ++typedef enum wl_vendor_gscan_attribute { ++ ATTR_START_GSCAN, ++ ATTR_STOP_GSCAN, ++ ATTR_SET_SCAN_BATCH_CFG_ID, /* set batch scan params */ ++ ATTR_SET_SCAN_GEOFENCE_CFG_ID, /* set list of bssids to track */ ++ ATTR_SET_SCAN_SIGNIFICANT_CFG_ID, /* set list of bssids, rssi threshold etc.. */ ++ ATTR_SET_SCAN_CFG_ID, /* set common scan config params here */ ++ ATTR_GET_GSCAN_CAPABILITIES_ID, ++ /* Add more sub commands here */ ++ ATTR_GSCAN_MAX ++} wl_vendor_gscan_attribute_t; ++ ++typedef enum gscan_batch_attribute { ++ ATTR_GSCAN_BATCH_BESTN, ++ ATTR_GSCAN_BATCH_MSCAN, ++ ATTR_GSCAN_BATCH_BUFFER_THRESHOLD ++} gscan_batch_attribute_t; ++ ++typedef enum gscan_geofence_attribute { ++ ATTR_GSCAN_NUM_HOTLIST_BSSID, ++ ATTR_GSCAN_HOTLIST_BSSID ++} gscan_geofence_attribute_t; ++ ++typedef enum gscan_complete_event { ++ WIFI_SCAN_BUFFER_FULL, ++ WIFI_SCAN_COMPLETE ++} gscan_complete_event_t; ++ ++/* Capture the RTK_VENDOR_SUBCMD_PRIV_STRINGS* here */ ++#define RTK_VENDOR_SCMD_CAPA "cap" ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(SSV_VENDOR_EXT_SUPPORT) ++extern int ssv_cfgvendor_attach(struct wiphy *wiphy); ++extern int ssv_cfgvendor_detach(struct wiphy *wiphy); ++extern int ssv_cfgvendor_send_async_event(struct wiphy *wiphy, ++ struct net_device *dev, int event_id, ++ const void *data, int len); ++#if defined(GSCAN_SUPPORT) && 0 ++extern int wl_cfgvendor_send_hotlist_event(struct wiphy *wiphy, ++ struct net_device *dev, void *data, ++ int len, wl_vendor_event_t event); ++#endif ++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) */ ++ ++#endif /* _RTW_CFGVENDOR_H_ */ +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_ht_rc.c b/drivers/net/wireless/ssv6051/smac/ssv_ht_rc.c +new file mode 100644 +index 000000000000..fae819c43400 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_ht_rc.c +@@ -0,0 +1,546 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include "dev.h" ++#include "ssv_ht_rc.h" ++#include "ssv_rc.h" ++#define SAMPLE_COUNT 4 ++#define HT_CW_MIN 15 ++#define HT_SEGMENT_SIZE 6000 ++#define AVG_PKT_SIZE 12000 ++#define SAMPLE_COLUMNS 10 ++#define EWMA_LEVEL 75 ++#define MCS_NBITS (AVG_PKT_SIZE << 3) ++#define MCS_NSYMS(bps) ((MCS_NBITS + (bps) - 1) / (bps)) ++#define MCS_SYMBOL_TIME(sgi,syms) \ ++ (sgi ? \ ++ ((syms) * 18 + 4) / 5 : \ ++ (syms) << 2 \ ++ ) ++#define MCS_DURATION(streams,sgi,bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) ++#define MCS_GROUP(_streams,_sgi,_ht40) { \ ++ .duration = { \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \ ++ } \ ++} ++const struct mcs_group minstrel_mcs_groups_ssv[] = { ++ MCS_GROUP(1, 0, 0), ++ MCS_GROUP(1, 1, 0), ++}; ++ ++const u16 ampdu_max_transmit_length[RATE_TABLE_SIZE] = { ++ 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, ++ 4600, 9200, 13800, 18500, 27700, 37000, 41600, 46200, ++ 5100, 10200, 15400, 20500, 30800, 41100, 46200, 51300, ++ 4600, 9200, 13800, 18500, 27700, 37000, 41600, 46200 ++}; ++ ++static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES]; ++static int minstrel_ewma(int old, int new, int weight) ++{ ++ return (new * (100 - weight) + old * weight) / 100; ++} ++ ++static inline struct minstrel_rate_stats *minstrel_get_ratestats(struct ++ ssv62xx_ht *mi, ++ int index) ++{ ++ return &mi->groups.rates[index % MCS_GROUP_RATES]; ++} ++ ++static void minstrel_calc_rate_ewma(struct minstrel_rate_stats *mr) ++{ ++ if (unlikely(mr->attempts > 0)) { ++ mr->sample_skipped = 0; ++ mr->cur_prob = MINSTREL_FRAC(mr->success, mr->attempts); ++ if (!mr->att_hist) ++ mr->probability = mr->cur_prob; ++ else ++ mr->probability = minstrel_ewma(mr->probability, ++ mr->cur_prob, ++ EWMA_LEVEL); ++ mr->att_hist += mr->attempts; ++ mr->succ_hist += mr->success; ++ } else { ++ mr->sample_skipped++; ++ } ++ mr->last_success = mr->success; ++ mr->last_attempts = mr->attempts; ++ mr->success = 0; ++ mr->attempts = 0; ++} ++ ++static void minstrel_ht_calc_tp(struct ssv62xx_ht *mi, ++ struct ssv_sta_rc_info *rc_sta, int rate) ++{ ++ struct minstrel_rate_stats *mr; ++ unsigned int usecs, group_id; ++ if (rc_sta->ht_rc_type == RC_TYPE_HT_LGI_20) ++ group_id = 0; ++ else ++ group_id = 1; ++ mr = &mi->groups.rates[rate]; ++ if (mr->probability < MINSTREL_FRAC(1, 10)) { ++ mr->cur_tp = 0; ++ return; ++ } ++ usecs = mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); ++ usecs += minstrel_mcs_groups_ssv[group_id].duration[rate]; ++ mr->cur_tp = MINSTREL_TRUNC((1000000 / usecs) * mr->probability); ++} ++ ++static void rate_control_ht_sample(struct ssv62xx_ht *mi, ++ struct ssv_sta_rc_info *rc_sta) ++{ ++ struct minstrel_mcs_group_data *mg; ++ struct minstrel_rate_stats *mr; ++ int cur_prob, cur_prob_tp, cur_tp, cur_tp2; ++ int i, index; ++ if (mi->ampdu_packets > 0) { ++ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, ++ MINSTREL_FRAC(mi->ampdu_len, ++ mi-> ++ ampdu_packets), ++ EWMA_LEVEL); ++ mi->ampdu_len = 0; ++ mi->ampdu_packets = 0; ++ } else ++ return; ++ mi->sample_slow = 0; ++ mi->sample_count = 0; ++ { ++ cur_prob = 0; ++ cur_prob_tp = 0; ++ cur_tp = 0; ++ cur_tp2 = 0; ++ mg = &mi->groups; ++ mg->max_tp_rate = 0; ++ mg->max_tp_rate2 = 0; ++ mg->max_prob_rate = 0; ++ for (i = 0; i < MCS_GROUP_RATES; i++) { ++ if (!(rc_sta->ht_supp_rates & BIT(i))) ++ continue; ++ mr = &mg->rates[i]; ++ index = i; ++ minstrel_calc_rate_ewma(mr); ++ minstrel_ht_calc_tp(mi, rc_sta, i); ++#ifdef RATE_CONTROL_HT_PARAMETER_DEBUG ++ if (mr->cur_prob) ++ pr_debug ++ ("rate[%d]probability[%08d]cur_prob[%08d]TP[%04d]\n", ++ i, mr->probability, mr->cur_prob, ++ mr->cur_tp); ++#endif ++#ifdef RATE_CONTROL_HT_STUPID_DEBUG ++ pr_debug ++ ("HT sample result max_tp_rate[%d]max_tp_rate2[%d]max_prob_rate[%d]\n", ++ mg->max_tp_rate, mg->max_tp_rate2, ++ mg->max_prob_rate); ++ pr_debug("rate[%d]probability[%08d]TP[%d]\n", i, ++ mr->probability, mr->cur_tp); ++#endif ++ if (!mr->cur_tp) ++ continue; ++#ifdef RATE_CONTROL_HT_STUPID_DEBUG ++ pr_debug("HT--1 mr->cur_tp[%d]cur_prob_tp[%d]\n", ++ mr->cur_tp, cur_prob_tp); ++#endif ++ if ((mr->cur_tp > cur_prob_tp && mr->probability > ++ MINSTREL_FRAC(3, 4)) ++ || mr->probability > cur_prob) { ++ mg->max_prob_rate = index; ++ cur_prob = mr->probability; ++ cur_prob_tp = mr->cur_tp; ++ } ++#ifdef RATE_CONTROL_HT_STUPID_DEBUG ++ pr_debug("HT--2 mr->cur_tp[%d]cur_tp[%d]\n", mr->cur_tp, ++ cur_tp); ++#endif ++ if (mr->cur_tp > cur_tp) { ++ swap(index, mg->max_tp_rate); ++ cur_tp = mr->cur_tp; ++ mr = minstrel_get_ratestats(mi, index); ++ } ++#ifdef RATE_CONTROL_HT_STUPID_DEBUG ++ if (index != i) ++ pr_debug ++ ("HT--3 index[%d]i[%d]mg->max_tp_rate[%d]\n", ++ index, i, mg->max_tp_rate); ++#endif ++ if (index >= mg->max_tp_rate) ++ continue; ++#ifdef RATE_CONTROL_HT_STUPID_DEBUG ++ if (index != i) ++ pr_debug("HT--4 mr->cur_tp[%d]cur_tp2[%d]\n", ++ mr->cur_tp, cur_tp2); ++#endif ++ if (mr->cur_tp > cur_tp2) { ++ mg->max_tp_rate2 = index; ++ cur_tp2 = mr->cur_tp; ++ } ++ } ++ } ++ mi->sample_count = SAMPLE_COUNT; ++ mi->max_tp_rate = mg->max_tp_rate; ++ mi->max_tp_rate2 = mg->max_tp_rate2; ++ mi->max_prob_rate = mg->max_prob_rate; ++#ifdef RATE_CONTROL_HT_STUPID_DEBUG ++ pr_debug ++ ("HT sample result max_tp_rate[%d]max_tp_rate2[%d]max_prob_rate[%d]\n", ++ mi->max_tp_rate, mi->max_tp_rate2, mi->max_prob_rate); ++#endif ++ mi->stats_update = jiffies; ++} ++ ++static void minstrel_ht_set_rate(struct ssv62xx_ht *mi, ++ struct fw_rc_retry_params *rate, int index, ++ bool sample, bool rtscts, ++ struct ssv_sta_rc_info *rc_sta, ++ struct ssv_rate_ctrl *ssv_rc) ++{ ++ struct minstrel_rate_stats *mr; ++ mr = minstrel_get_ratestats(mi, index); ++ rate->drate = ssv_rc->rc_table[mr->rc_index].hw_rate_idx; ++ rate->crate = ssv_rc->rc_table[mr->rc_index].ctrl_rate_idx; ++} ++ ++static inline int minstrel_get_duration(int index, ++ struct ssv_sta_rc_info *rc_sta) ++{ ++ unsigned int group_id; ++ const struct mcs_group *group; ++ if (rc_sta->ht_rc_type == RC_TYPE_HT_LGI_20) ++ group_id = 0; ++ else ++ group_id = 1; ++ group = &minstrel_mcs_groups_ssv[group_id]; ++ return group->duration[index % MCS_GROUP_RATES]; ++} ++ ++static void minstrel_next_sample_idx(struct ssv62xx_ht *mi) ++{ ++ struct minstrel_mcs_group_data *mg; ++ for (;;) { ++ mg = &mi->groups; ++ if (++mg->index >= MCS_GROUP_RATES) { ++ mg->index = 0; ++ if (++mg->column >= ARRAY_SIZE(sample_table)) ++ mg->column = 0; ++ } ++ break; ++ } ++} ++ ++static int minstrel_get_sample_rate(struct ssv62xx_ht *mi, ++ struct ssv_sta_rc_info *rc_sta) ++{ ++ struct minstrel_rate_stats *mr; ++ struct minstrel_mcs_group_data *mg; ++ int sample_idx = 0; ++ if (mi->sample_wait > 0) { ++ mi->sample_wait--; ++ return -1; ++ } ++ if (!mi->sample_tries) ++ return -1; ++ mi->sample_tries--; ++ mg = &mi->groups; ++ sample_idx = sample_table[mg->column][mg->index]; ++ mr = &mg->rates[sample_idx]; ++ minstrel_next_sample_idx(mi); ++ if (minstrel_get_duration(sample_idx, rc_sta) > ++ minstrel_get_duration(mi->max_tp_rate, rc_sta)) { ++ if (mr->sample_skipped < 20) { ++ return -1; ++ } ++ if (mi->sample_slow++ > 2) { ++ return -1; ++ } ++ } ++ return sample_idx; ++} ++ ++static void _fill_txinfo_rates(struct ssv_rate_ctrl *ssv_rc, ++ struct sk_buff *skb, ++ struct fw_rc_retry_params *ar) ++{ ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ info->control.rates[0].idx = ++ ssv_rc->rc_table[ar[0].drate].dot11_rate_idx; ++ info->control.rates[0].count = 1; ++ info->control.rates[SSV_DRATE_IDX].count = ar[0].drate; ++ info->control.rates[SSV_CRATE_IDX].count = ar[0].crate; ++} ++ ++extern const u16 ssv6xxx_rc_rate_set[RC_TYPE_MAX][13]; ++s32 ssv62xx_ht_rate_update(struct sk_buff *skb, struct ssv_softc *sc, ++ struct fw_rc_retry_params *ar) ++{ ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct SKB_info_st *skb_info = (struct SKB_info_st *)skb->head; ++ struct ieee80211_sta *sta = skb_info->sta; ++ struct ssv62xx_ht *mi = NULL; ++ int sample_idx; ++ bool sample = false; ++ struct ssv_sta_rc_info *rc_sta; ++ struct ssv_sta_priv_data *sta_priv; ++ struct rc_pid_sta_info *spinfo; ++ int ret = 0; ++ if (sc->sc_flags & SC_OP_FIXED_RATE) { ++ ar[0].count = 3; ++ ar[0].drate = ssv_rc->rc_table[sc->max_rate_idx].hw_rate_idx; ++ ar[0].crate = ssv_rc->rc_table[sc->max_rate_idx].ctrl_rate_idx; ++ ar[1].count = 2; ++ ar[1].drate = ssv_rc->rc_table[sc->max_rate_idx].hw_rate_idx; ++ ar[1].crate = ssv_rc->rc_table[sc->max_rate_idx].ctrl_rate_idx; ++ ar[2].count = 2; ++ ar[2].drate = ssv_rc->rc_table[sc->max_rate_idx].hw_rate_idx; ++ ar[2].crate = ssv_rc->rc_table[sc->max_rate_idx].ctrl_rate_idx; ++ _fill_txinfo_rates(ssv_rc, skb, ar); ++ return ssv_rc->rc_table[sc->max_rate_idx].hw_rate_idx; ++ } ++ if (sta == NULL) { ++ dev_err(sc->dev, "Station NULL\n"); ++ BUG_ON(1); ++ } ++ sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ rc_sta = &ssv_rc->sta_rc_info[sta_priv->rc_idx]; ++ spinfo = &rc_sta->spinfo; ++ if ((rc_sta->rc_wsid >= SSV_RC_MAX_HARDWARE_SUPPORT) ++ || (rc_sta->rc_wsid < 0)) { ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ int rateidx = 99; ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ { ++ if ((rc_sta->ht_rc_type >= RC_TYPE_HT_SGI_20) && ++ (ssv_sta_priv->rx_data_rate < ++ SSV62XX_RATE_MCS_INDEX)) { ++ if (ssv6xxx_rc_rate_set[rc_sta->ht_rc_type][0] ++ == 12) ++ rateidx = ++ (int)rc_sta->pinfo.rinfo[4]. ++ rc_index; ++ else ++ rateidx = ++ (int)rc_sta->pinfo.rinfo[0]. ++ rc_index; ++ } else { ++ rateidx = (int)ssv_sta_priv->rx_data_rate; ++ rateidx -= SSV62XX_RATE_MCS_INDEX; ++ rateidx %= 8; ++ if (rc_sta->ht_rc_type == RC_TYPE_HT_SGI_20) ++ rateidx += SSV62XX_RATE_MCS_SGI_INDEX; ++ else if (rc_sta->ht_rc_type == ++ RC_TYPE_HT_LGI_20) ++ rateidx += SSV62XX_RATE_MCS_LGI_INDEX; ++ else ++ rateidx += ++ SSV62XX_RATE_MCS_GREENFIELD_INDEX; ++ } ++ } ++ ar[0].count = 3; ++ ar[2].drate = ar[1].drate = ar[0].drate = ++ ssv_rc->rc_table[rateidx].hw_rate_idx; ++ ar[2].crate = ar[1].crate = ar[0].crate = ++ ssv_rc->rc_table[rateidx].ctrl_rate_idx; ++ ar[1].count = 2; ++ ar[2].count = 2; ++ _fill_txinfo_rates(ssv_rc, skb, ar); ++ return rateidx; ++ } ++ mi = &rc_sta->ht; ++ sample_idx = minstrel_get_sample_rate(mi, rc_sta); ++ if (sample_idx >= 0) { ++ sample = true; ++ minstrel_ht_set_rate(mi, &ar[0], sample_idx, ++ true, false, rc_sta, ssv_rc); ++ } else { ++ minstrel_ht_set_rate(mi, &ar[0], mi->max_tp_rate, ++ false, false, rc_sta, ssv_rc); ++ } ++ ar[0].count = mi->first_try_count; ++ ret = ar[0].drate; ++ { ++ if (sample_idx >= 0) ++ minstrel_ht_set_rate(mi, &ar[1], mi->max_tp_rate, ++ false, false, rc_sta, ssv_rc); ++ else ++ minstrel_ht_set_rate(mi, &ar[1], mi->max_tp_rate2, ++ false, true, rc_sta, ssv_rc); ++ ar[1].count = mi->second_try_count; ++ if (ret > ar[1].drate) ++ ret = ar[1].drate; ++ minstrel_ht_set_rate(mi, &ar[2], mi->max_prob_rate, ++ false, !sample, rc_sta, ssv_rc); ++ ar[2].count = mi->other_try_count; ++ if (ret > ar[2].drate) ++ ret = ar[2].drate; ++ } ++ mi->total_packets++; ++ if (mi->total_packets == ~0) { ++ mi->total_packets = 0; ++ mi->sample_packets = 0; ++ } ++ if (spinfo->real_hw_index < SSV62XX_RATE_MCS_INDEX) ++ return spinfo->real_hw_index; ++ _fill_txinfo_rates(ssv_rc, skb, ar); ++ return ret; ++} ++ ++static void init_sample_table(void) ++{ ++ int col, i, new_idx; ++ u8 rnd[MCS_GROUP_RATES]; ++ memset(sample_table, 0xff, sizeof(sample_table)); ++ for (col = 0; col < SAMPLE_COLUMNS; col++) { ++ for (i = 0; i < MCS_GROUP_RATES; i++) { ++ get_random_bytes(rnd, sizeof(rnd)); ++ new_idx = (i + rnd[i]) % MCS_GROUP_RATES; ++ while (sample_table[col][new_idx] != 0xff) ++ new_idx = (new_idx + 1) % MCS_GROUP_RATES; ++ sample_table[col][new_idx] = i; ++ } ++ } ++} ++ ++void ssv62xx_ht_rc_caps(const u16 ssv6xxx_rc_rate_set[RC_TYPE_MAX][13], ++ struct ssv_sta_rc_info *rc_sta) ++{ ++ struct ssv62xx_ht *mi = &rc_sta->ht; ++ int ack_dur; ++ int i; ++ unsigned int group_id; ++ if (rc_sta->ht_rc_type == RC_TYPE_HT_LGI_20) ++ group_id = 0; ++ else ++ group_id = 1; ++ for (i = 0; i < MCS_GROUP_RATES; i++) { ++ pr_debug("[RC]HT duration[%d][%d]\n", i, ++ minstrel_mcs_groups_ssv[group_id].duration[i]); ++ } ++ init_sample_table(); ++ memset(mi, 0, sizeof(*mi)); ++ mi->stats_update = jiffies; ++ ack_dur = pide_frame_duration(10, 60, 0, 0); ++ mi->overhead = pide_frame_duration(0, 60, 0, 0) + ack_dur; ++ mi->overhead_rtscts = mi->overhead + 2 * ack_dur; ++ mi->avg_ampdu_len = MINSTREL_FRAC(1, 1); ++ mi->sample_count = 16; ++ mi->sample_wait = 0; ++ mi->sample_tries = 4; ++#ifdef DISABLE_RATE_CONTROL_SAMPLE ++ mi->max_tp_rate = MCS_GROUP_RATES - 1; ++ mi->max_tp_rate2 = MCS_GROUP_RATES - 1; ++ mi->max_prob_rate = MCS_GROUP_RATES - 1; ++#endif ++#if (HW_MAX_RATE_TRIES == 7) ++ { ++ mi->first_try_count = 3; ++ mi->second_try_count = 2; ++ mi->other_try_count = 2; ++ } ++#else ++ { ++ mi->first_try_count = 2; ++ mi->second_try_count = 1; ++ mi->other_try_count = 1; ++ } ++#endif ++ for (i = 0; i < MCS_GROUP_RATES; i++) { ++ mi->groups.rates[i].rc_index = ++ ssv6xxx_rc_rate_set[rc_sta->ht_rc_type][i + 1]; ++ } ++} ++ ++static bool minstrel_ht_txstat_valid(struct ssv62xx_tx_rate *rate) ++{ ++ if (!rate->count) ++ return false; ++ if (rate->data_rate < 0) ++ return false; ++ return true; ++} ++ ++void ssv6xxx_ht_report_handler(struct ssv_softc *sc, struct sk_buff *skb, ++ struct ssv_sta_rc_info *rc_sta) ++{ ++ struct cfg_host_event *host_event; ++ struct firmware_rate_control_report_data *report_data; ++ struct ssv62xx_ht *mi; ++ struct minstrel_rate_stats *rate; ++ bool last = false; ++ int i = 0; ++ u16 report_ampdu_packets = 0; ++ unsigned long period; ++ host_event = (struct cfg_host_event *)skb->data; ++ report_data = ++ (struct firmware_rate_control_report_data *)&host_event->dat[0]; ++ if (host_event->h_event == SOC_EVT_RC_AMPDU_REPORT) { ++ report_ampdu_packets = 1; ++ } else if (host_event->h_event == SOC_EVT_RC_MPDU_REPORT) { ++ report_data->ampdu_len = 1; ++ report_ampdu_packets = report_data->ampdu_len; ++ } else { ++ dev_warn(sc->dev, "rate control report handler got garbage\n"); ++ return; ++ } ++ mi = &rc_sta->ht; ++ mi->ampdu_packets += report_ampdu_packets; ++ mi->ampdu_len += report_data->ampdu_len; ++ if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { ++ mi->sample_wait = 16 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); ++ mi->sample_tries = 2; ++ mi->sample_count--; ++ } ++ for (i = 0; !last; i++) { ++ last = (i == SSV62XX_TX_MAX_RATES - 1) || ++ !minstrel_ht_txstat_valid(&report_data->rates[i + 1]); ++ if (!minstrel_ht_txstat_valid(&report_data->rates[i])) ++ break; ++#ifdef RATE_CONTROL_DEBUG ++ if ((report_data->rates[i].data_rate < SSV62XX_RATE_MCS_INDEX) ++ || (report_data->rates[i].data_rate >= ++ SSV62XX_RATE_MCS_GREENFIELD_INDEX)) { ++ dev_dbg ++ (sc->dev, "[RC]ssv6xxx_ht_report_handler get error report rate[%d]\n", ++ report_data->rates[i].data_rate); ++ break; ++ } ++#endif ++ rate = ++ &mi->groups. ++ rates[(report_data->rates[i].data_rate - ++ SSV62XX_RATE_MCS_INDEX) % MCS_GROUP_RATES]; ++ if (last) ++ rate->success += report_data->ampdu_ack_len; ++ rate->attempts += ++ report_data->rates[i].count * report_data->ampdu_len; ++ } ++ period = msecs_to_jiffies(SSV_RC_HT_INTERVAL / 2); ++ if (time_after(jiffies, mi->stats_update + period)) { ++ rate_control_ht_sample(mi, rc_sta); ++ } ++} +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_ht_rc.h b/drivers/net/wireless/ssv6051/smac/ssv_ht_rc.h +new file mode 100644 +index 000000000000..275c3356e036 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_ht_rc.h +@@ -0,0 +1,31 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_RC_HT_H_ ++#define _SSV_RC_HT_H_ ++#include "ssv_rc_common.h" ++#define MINSTREL_SCALE 16 ++#define MINSTREL_FRAC(val,div) (((val) << MINSTREL_SCALE) / div) ++#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) ++#define SSV_RC_HT_INTERVAL 100 ++extern const u16 ampdu_max_transmit_length[]; ++s32 ssv62xx_ht_rate_update(struct sk_buff *skb, struct ssv_softc *sc, ++ struct fw_rc_retry_params *ar); ++void ssv62xx_ht_rc_caps(const u16 ssv6xxx_rc_rate_set[RC_TYPE_MAX][13], ++ struct ssv_sta_rc_info *rc_sta); ++void ssv6xxx_ht_report_handler(struct ssv_softc *sc, struct sk_buff *skb, ++ struct ssv_sta_rc_info *rc_sta); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_pm.c b/drivers/net/wireless/ssv6051/smac/ssv_pm.c +new file mode 100644 +index 000000000000..fc3be2013f61 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_pm.c +@@ -0,0 +1,19 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include "dev.h" ++#include "sar.h" +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_pm.h b/drivers/net/wireless/ssv6051/smac/ssv_pm.h +new file mode 100644 +index 000000000000..9be260dd904e +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_pm.h +@@ -0,0 +1,20 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_PM_H_ ++#define _SSV_PM_H_ ++#include ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_rc.c b/drivers/net/wireless/ssv6051/smac/ssv_rc.c +new file mode 100644 +index 000000000000..9c3574285364 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_rc.c +@@ -0,0 +1,1716 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include "dev.h" ++#include "ssv_ht_rc.h" ++#include "ssv_rc.h" ++#include "ssv_rc_common.h" ++static struct ssv_rc_rate ssv_11bgn_rate_table[] = { ++ [0] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 1000, ++ .dot11_rate_idx = 0, ++ .ctrl_rate_idx = 0, ++ .hw_rate_idx = 0, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [1] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 2000, ++ .dot11_rate_idx = 1, ++ .ctrl_rate_idx = 1, ++ .hw_rate_idx = 1, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [2] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 5500, ++ .dot11_rate_idx = 2, ++ .ctrl_rate_idx = 1, ++ .hw_rate_idx = 2, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [3] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 11000, ++ .dot11_rate_idx = 3, ++ .ctrl_rate_idx = 1, ++ .hw_rate_idx = 3, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [4] = {.rc_flags = RC_FLAG_LEGACY | RC_FLAG_SHORT_PREAMBLE, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 2000, ++ .dot11_rate_idx = 1, ++ .ctrl_rate_idx = 4, ++ .hw_rate_idx = 4, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [5] = {.rc_flags = RC_FLAG_LEGACY | RC_FLAG_SHORT_PREAMBLE, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 5500, ++ .dot11_rate_idx = 2, ++ .ctrl_rate_idx = 4, ++ .hw_rate_idx = 5, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [6] = {.rc_flags = RC_FLAG_LEGACY | RC_FLAG_SHORT_PREAMBLE, ++ .phy_type = WLAN_RC_PHY_CCK, ++ .rate_kbps = 11000, ++ .dot11_rate_idx = 3, ++ .ctrl_rate_idx = 4, ++ .hw_rate_idx = 6, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [7] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 6000, ++ .dot11_rate_idx = 4, ++ .ctrl_rate_idx = 7, ++ .hw_rate_idx = 7, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [8] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 9000, ++ .dot11_rate_idx = 5, ++ .ctrl_rate_idx = 7, ++ .hw_rate_idx = 8, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [9] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 12000, ++ .dot11_rate_idx = 6, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 9, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [10] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 18000, ++ .dot11_rate_idx = 7, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 10, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [11] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 24000, ++ .dot11_rate_idx = 8, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 11, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [12] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 36000, ++ .dot11_rate_idx = 9, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 12, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [13] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 48000, ++ .dot11_rate_idx = 10, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 13, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [14] = {.rc_flags = RC_FLAG_LEGACY, ++ .phy_type = WLAN_RC_PHY_OFDM, ++ .rate_kbps = 54000, ++ .dot11_rate_idx = 11, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 14, ++ .arith_shift = 8, ++ .target_pf = 8}, ++ [15] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 6500, ++ .dot11_rate_idx = 0, ++ .ctrl_rate_idx = 7, ++ .hw_rate_idx = 15, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [16] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 13000, ++ .dot11_rate_idx = 1, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 16, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [17] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 19500, ++ .dot11_rate_idx = 2, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 17, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [18] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 26000, ++ .dot11_rate_idx = 3, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 18, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [19] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 39000, ++ .dot11_rate_idx = 4, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 19, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [20] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 52000, ++ .dot11_rate_idx = 5, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 20, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [21] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 58500, ++ .dot11_rate_idx = 6, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 21, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [22] = {.rc_flags = RC_FLAG_HT, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_LGI, ++ .rate_kbps = 65000, ++ .dot11_rate_idx = 7, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 22, ++ .arith_shift = 8, ++ .target_pf = 8}, ++ [23] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 7200, ++ .dot11_rate_idx = 0, ++ .ctrl_rate_idx = 7, ++ .hw_rate_idx = 23, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [24] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 14400, ++ .dot11_rate_idx = 1, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 24, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [25] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 21700, ++ .dot11_rate_idx = 2, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 25, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [26] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 28900, ++ .dot11_rate_idx = 3, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 26, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [27] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 43300, ++ .dot11_rate_idx = 4, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 27, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [28] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 57800, ++ .dot11_rate_idx = 5, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 28, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [29] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 65000, ++ .dot11_rate_idx = 6, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 29, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [30] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_SGI, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_SGI, ++ .rate_kbps = 72200, ++ .dot11_rate_idx = 7, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 30, ++ .arith_shift = 8, ++ .target_pf = 8}, ++ [31] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 6500, ++ .dot11_rate_idx = 0, ++ .ctrl_rate_idx = 7, ++ .hw_rate_idx = 31, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [32] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 13000, ++ .dot11_rate_idx = 1, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 32, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [33] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 19500, ++ .dot11_rate_idx = 2, ++ .ctrl_rate_idx = 9, ++ .hw_rate_idx = 33, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [34] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 26000, ++ .dot11_rate_idx = 3, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 34, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [35] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 39000, ++ .dot11_rate_idx = 4, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 35, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [36] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 52000, ++ .dot11_rate_idx = 5, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 36, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [37] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 58500, ++ .dot11_rate_idx = 6, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 37, ++ .arith_shift = 8, ++ .target_pf = 26, ++ }, ++ [38] = {.rc_flags = RC_FLAG_HT | RC_FLAG_HT_GF, ++ .phy_type = WLAN_RC_PHY_HT_20_SS_GF, ++ .rate_kbps = 65000, ++ .dot11_rate_idx = 7, ++ .ctrl_rate_idx = 11, ++ .hw_rate_idx = 38, ++ .arith_shift = 8, ++ .target_pf = 8}, ++}; ++ ++const u16 ssv6xxx_rc_rate_set[RC_TYPE_MAX][13] = { ++ [RC_TYPE_B_ONLY] = {4, 0, 1, 2, 3}, ++ [RC_TYPE_LEGACY_GB] = {12, 0, 1, 2, 7, 8, 3, 9, 10, 11, 12, 13, 14}, ++ [RC_TYPE_SGI_20] = {8, 23, 24, 25, 26, 27, 28, 29, 30}, ++ [RC_TYPE_LGI_20] = {8, 15, 16, 17, 18, 19, 20, 21, 22}, ++ [RC_TYPE_HT_SGI_20] = {8, 23, 24, 25, 26, 27, 28, 29, 30}, ++ [RC_TYPE_HT_LGI_20] = {8, 15, 16, 17, 18, 19, 20, 21, 22}, ++ [RC_TYPE_HT_GF] = {8, 31, 32, 33, 34, 35, 36, 37, 38}, ++}; ++ ++static u32 ssv6xxx_rate_supported(struct ssv_sta_rc_info *rc_sta, u32 index) ++{ ++ return (rc_sta->rc_supp_rates & BIT(index)); ++} ++ ++static u8 ssv6xxx_rate_lowest_index(struct ssv_sta_rc_info *rc_sta) ++{ ++ int i; ++ for (i = 0; i < rc_sta->rc_num_rate; i++) ++ if (ssv6xxx_rate_supported(rc_sta, i)) ++ return i; ++ return 0; ++} ++ ++#ifdef DISABLE_RATE_CONTROL_SAMPLE ++static u8 ssv6xxx_rate_highest_index(struct ssv_sta_rc_info *rc_sta) ++{ ++ int i; ++ for (i = rc_sta->rc_num_rate - 1; i >= 0; i--) ++ if (ssv6xxx_rate_supported(rc_sta, i)) ++ return i; ++ return 0; ++} ++#endif ++static void rate_control_pid_adjust_rate(struct ssv_sta_rc_info *rc_sta, ++ struct rc_pid_sta_info *spinfo, ++ int adj, struct rc_pid_rateinfo *rinfo) ++{ ++ int cur_sorted, new_sorted, probe, tmp, n_bitrates; ++ int cur = spinfo->txrate_idx; ++ n_bitrates = rc_sta->rc_num_rate; ++ cur_sorted = rinfo[cur].index; ++ new_sorted = cur_sorted + adj; ++ if (new_sorted < 0) ++ new_sorted = rinfo[0].index; ++ else if (new_sorted >= n_bitrates) ++ new_sorted = rinfo[n_bitrates - 1].index; ++ tmp = new_sorted; ++ if (adj < 0) { ++ for (probe = cur_sorted; probe >= new_sorted; probe--) ++ if (rinfo[probe].diff <= rinfo[cur_sorted].diff && ++ ssv6xxx_rate_supported(rc_sta, rinfo[probe].index)) ++ tmp = probe; ++ } else { ++ for (probe = new_sorted + 1; probe < n_bitrates; probe++) ++ if (rinfo[probe].diff <= rinfo[new_sorted].diff && ++ ssv6xxx_rate_supported(rc_sta, rinfo[probe].index)) ++ tmp = probe; ++ } ++ BUG_ON(tmp < 0 || tmp >= n_bitrates); ++ do { ++ if (ssv6xxx_rate_supported(rc_sta, rinfo[tmp].index)) { ++ spinfo->tmp_rate_idx = rinfo[tmp].index; ++ break; ++ } ++ if (adj < 0) ++ tmp--; ++ else ++ tmp++; ++ } while (tmp < n_bitrates && tmp >= 0); ++ spinfo->oldrate = spinfo->txrate_idx; ++ if (spinfo->tmp_rate_idx != spinfo->txrate_idx) { ++ spinfo->monitoring = 1; ++#ifdef RATE_CONTROL_PARAMETER_DEBUG ++ pr_debug("Trigger monitor tmp_rate_idx=[%d]\n", ++ spinfo->tmp_rate_idx); ++#endif ++ spinfo->probe_cnt = MAXPROBES; ++ } ++} ++ ++static void rate_control_pid_normalize(struct rc_pid_info *pinfo, int l) ++{ ++ int i, norm_offset = RC_PID_NORM_OFFSET; ++ struct rc_pid_rateinfo *r = pinfo->rinfo; ++ if (r[0].diff > norm_offset) ++ r[0].diff -= norm_offset; ++ else if (r[0].diff < -norm_offset) ++ r[0].diff += norm_offset; ++ for (i = 0; i < l - 1; i++) ++ if (r[i + 1].diff > r[i].diff + norm_offset) ++ r[i + 1].diff -= norm_offset; ++ else if (r[i + 1].diff <= r[i].diff) ++ r[i + 1].diff += norm_offset; ++} ++ ++#ifdef RATE_CONTROL_DEBUG ++unsigned int txrate_dlr = 0; ++#endif ++static void rate_control_pid_sample(struct ssv_rate_ctrl *ssv_rc, ++ struct rc_pid_info *pinfo, ++ struct ssv_sta_rc_info *rc_sta, ++ struct rc_pid_sta_info *spinfo) ++{ ++ struct rc_pid_rateinfo *rinfo = pinfo->rinfo; ++ u8 pf; ++ s32 err_avg; ++ s32 err_prop; ++ s32 err_int; ++ s32 err_der; ++ int adj, i, j, tmp; ++ struct ssv_rc_rate *rc_table; ++ unsigned int dlr; ++ unsigned int perfect_time = 0; ++ unsigned int this_thp, ewma_thp; ++ struct rc_pid_rateinfo *rate; ++ if (!spinfo->monitoring) { ++ if (spinfo->tx_num_xmit == 0) ++ return; ++ spinfo->last_sample = jiffies; ++ pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit; ++ if (pinfo->rinfo[spinfo->txrate_idx].this_attempt > 0) { ++ rate = &pinfo->rinfo[spinfo->txrate_idx]; ++ rc_table = &ssv_rc->rc_table[spinfo->txrate_idx]; ++ dlr = 100 - rate->this_fail * 100 / rate->this_attempt; ++ perfect_time = rate->perfect_tx_time; ++ if (!perfect_time) ++ perfect_time = 1000000; ++ this_thp = dlr * (1000000 / perfect_time); ++ ewma_thp = rate->throughput; ++ if (ewma_thp == 0) ++ rate->throughput = this_thp; ++ else ++ rate->throughput = (ewma_thp + this_thp) >> 1; ++ rate->attempt += rate->this_attempt; ++ rate->success += rate->this_success; ++ rate->fail += rate->this_fail; ++ spinfo->tx_num_xmit = 0; ++ spinfo->tx_num_failed = 0; ++ rate->this_fail = 0; ++ rate->this_success = 0; ++ rate->this_attempt = 0; ++ if (pinfo->oldrate < 0 ++ || pinfo->oldrate >= rc_sta->rc_num_rate) { ++ WARN_ON(1); ++ } ++ if (spinfo->txrate_idx < 0 ++ || spinfo->txrate_idx >= rc_sta->rc_num_rate) { ++ WARN_ON(1); ++ } ++ if (pinfo->oldrate != spinfo->txrate_idx) { ++ i = rinfo[pinfo->oldrate].index; ++ j = rinfo[spinfo->txrate_idx].index; ++ tmp = (pf - spinfo->last_pf); ++ tmp = ++ RC_PID_DO_ARITH_RIGHT_SHIFT(tmp, ++ rc_table->arith_shift); ++ rinfo[j].diff = rinfo[i].diff + tmp; ++ pinfo->oldrate = spinfo->txrate_idx; ++ } ++ rate_control_pid_normalize(pinfo, rc_sta->rc_num_rate); ++ err_prop = ++ (rc_table->target_pf - pf) << rc_table->arith_shift; ++ err_avg = spinfo->err_avg_sc >> RC_PID_SMOOTHING_SHIFT; ++ spinfo->err_avg_sc = ++ spinfo->err_avg_sc - err_avg + err_prop; ++ err_int = spinfo->err_avg_sc >> RC_PID_SMOOTHING_SHIFT; ++ err_der = pf - spinfo->last_pf; ++ spinfo->last_pf = pf; ++ spinfo->last_dlr = dlr; ++ spinfo->oldrate = spinfo->txrate_idx; ++ adj = ++ (err_prop * RC_PID_COEFF_P + ++ err_int * RC_PID_COEFF_I + ++ err_der * RC_PID_COEFF_D); ++ adj = ++ RC_PID_DO_ARITH_RIGHT_SHIFT(adj, ++ rc_table->arith_shift << ++ 1); ++ if (adj) { ++#ifdef RATE_CONTROL_PARAMETER_DEBUG ++ if ((spinfo->txrate_idx != 11) ++ || ((spinfo->txrate_idx == 11) ++ && (adj < 0))) ++ pr_debug ++ ("[RC]Probe adjust[%d] dlr[%d%%] this_thp[%d] ewma_thp[%d] index[%d]\n", ++ adj, dlr, this_thp, ewma_thp, ++ spinfo->txrate_idx); ++#endif ++ rate_control_pid_adjust_rate(rc_sta, spinfo, ++ adj, rinfo); ++ } ++ } ++ } else { ++ if ((spinfo->feedback_probes >= MAXPROBES) ++ || (spinfo->feedback_probes && spinfo->probe_cnt)) { ++ rate = &pinfo->rinfo[spinfo->txrate_idx]; ++ spinfo->last_sample = jiffies; ++ if (rate->this_attempt > 0) { ++ dlr = ++ 100 - ++ rate->this_fail * 100 / rate->this_attempt; ++#ifdef RATE_CONTROL_DEBUG ++#ifdef PROBE ++ txrate_dlr = dlr; ++#endif ++#endif ++ spinfo->last_dlr = dlr; ++ perfect_time = rate->perfect_tx_time; ++ if (!perfect_time) ++ perfect_time = 1000000; ++ this_thp = dlr * (1000000 / perfect_time); ++ ewma_thp = rate->throughput; ++ if (ewma_thp == 0) ++ rate->throughput = this_thp; ++ else ++ rate->throughput = ++ (ewma_thp + this_thp) >> 1; ++ rate->attempt += rate->this_attempt; ++ rate->success += rate->this_success; ++ rinfo[spinfo->txrate_idx].fail += ++ rate->this_fail; ++ rate->this_fail = 0; ++ rate->this_success = 0; ++ rate->this_attempt = 0; ++ } else { ++#ifdef RATE_CONTROL_DEBUG ++#ifdef PROBE ++ txrate_dlr = 0; ++#endif ++#endif ++ } ++ rate = &pinfo->rinfo[spinfo->tmp_rate_idx]; ++ if (rate->this_attempt > 0) { ++ dlr = ++ 100 - ++ ((rate->this_fail * 100) / ++ rate->this_attempt); ++ { ++ perfect_time = rate->perfect_tx_time; ++ if (!perfect_time) ++ perfect_time = 1000000; ++ if (dlr) ++ this_thp = ++ dlr * (1000000 / ++ perfect_time); ++ else ++ this_thp = 0; ++ ewma_thp = rate->throughput; ++ if (ewma_thp == 0) ++ rate->throughput = this_thp; ++ else ++ rate->throughput = ++ (ewma_thp + this_thp) >> 1; ++ if (rate->throughput > ++ pinfo->rinfo[spinfo-> ++ txrate_idx].throughput) ++ { ++#ifdef RATE_CONTROL_PARAMETER_DEBUG ++ pr_debug ++ ("[RC]UPDATE probe rate idx[%d] [%d][%d%%] Old idx[%d] [%d][%d%%] feedback[%d] \n", ++ spinfo->tmp_rate_idx, ++ rate->throughput, dlr, ++ spinfo->txrate_idx, ++ pinfo-> ++ rinfo ++ [spinfo->txrate_idx].throughput, ++ txrate_dlr, ++ spinfo->feedback_probes); ++#endif ++ spinfo->txrate_idx = ++ spinfo->tmp_rate_idx; ++ } else { ++#ifdef RATE_CONTROL_PARAMETER_DEBUG ++ pr_debug ++ ("[RC]Fail probe rate idx[%d] [%d][%d%%] Old idx[%d] [%d][%d%%] feedback[%d] \n", ++ spinfo->tmp_rate_idx, ++ rate->throughput, dlr, ++ spinfo->txrate_idx, ++ pinfo-> ++ rinfo ++ [spinfo->txrate_idx].throughput, ++ txrate_dlr, ++ spinfo->feedback_probes); ++#endif ++ ; ++ } ++ rate->attempt += rate->this_attempt; ++ rate->success += rate->this_success; ++ rate->fail += rate->this_fail; ++ rate->this_fail = 0; ++ rate->this_success = 0; ++ rate->this_attempt = 0; ++ spinfo->oldrate = spinfo->txrate_idx; ++ } ++ } ++#ifdef RATE_CONTROL_DEBUG ++ else ++ pr_err("Unexpected error\n"); ++#endif ++ spinfo->feedback_probes = 0; ++ spinfo->tx_num_xmit = 0; ++ spinfo->tx_num_failed = 0; ++ spinfo->monitoring = 0; ++#ifdef RATE_CONTROL_PARAMETER_DEBUG ++ pr_debug("Disable monitor\n"); ++#endif ++ spinfo->probe_report_flag = 0; ++ spinfo->probe_wating_times = 0; ++ } else { ++ spinfo->probe_wating_times++; ++#ifdef RATE_CONTROL_DEBUG ++ if (spinfo->probe_wating_times > 3) { ++ pr_debug ++ ("[RC]@@@@@ PROBE LOSE @@@@@ feedback=[%d] need=[%d] probe_cnt=[%d] wating times[%d]\n", ++ spinfo->feedback_probes, MAXPROBES, ++ spinfo->probe_cnt, ++ spinfo->probe_wating_times); ++ spinfo->feedback_probes = 0; ++ spinfo->tx_num_xmit = 0; ++ spinfo->tx_num_failed = 0; ++ spinfo->monitoring = 0; ++ spinfo->probe_report_flag = 0; ++ spinfo->probe_wating_times = 0; ++ } ++#else ++ if (spinfo->probe_wating_times > 3) { ++ spinfo->feedback_probes = 0; ++ spinfo->tx_num_xmit = 0; ++ spinfo->tx_num_failed = 0; ++ spinfo->monitoring = 0; ++ spinfo->probe_report_flag = 0; ++ spinfo->probe_wating_times = 0; ++ } ++#endif ++ } ++ } ++} ++ ++#ifdef RATE_CONTROL_PERCENTAGE_TRACE ++int percentage = 0; ++int percentageCounter = 0; ++#endif ++void ssv6xxx_legacy_report_handler(struct ssv_softc *sc, struct sk_buff *skb, ++ struct ssv_sta_rc_info *rc_sta) ++{ ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct cfg_host_event *host_event; ++ struct firmware_rate_control_report_data *report_data; ++ struct rc_pid_info *pinfo; ++ struct rc_pid_sta_info *spinfo; ++ struct rc_pid_rateinfo *pidrate; ++ struct rc_pid_rateinfo *rate; ++ s32 report_data_index = 0; ++ unsigned long period; ++ host_event = (struct cfg_host_event *)skb->data; ++ report_data = ++ (struct firmware_rate_control_report_data *)&host_event->dat[0]; ++ if ((report_data->wsid != (-1)) ++ && sc->sta_info[report_data->wsid].sta == NULL) { ++ dev_warn(sc->dev, "RC report has no valid STA.(%d)\n", ++ report_data->wsid); ++ return; ++ } ++ pinfo = &rc_sta->pinfo; ++ spinfo = &rc_sta->spinfo; ++ pidrate = rc_sta->pinfo.rinfo; ++ if (host_event->h_event == SOC_EVT_RC_AMPDU_REPORT) { ++ period = msecs_to_jiffies(HT_RC_UPDATE_INTERVAL); ++ if (time_after(jiffies, spinfo->last_sample + period)) { ++ if (rc_sta->rc_num_rate == 12) ++ spinfo->txrate_idx = rc_sta->ht.max_tp_rate + 4; ++ else ++ spinfo->txrate_idx = rc_sta->ht.max_tp_rate; ++#ifdef RATE_CONTROL_DEBUG ++ pr_debug("MPDU rate update time txrate_idx[%d]!!\n", ++ spinfo->txrate_idx); ++#endif ++ spinfo->last_sample = jiffies; ++ } ++ return; ++ } else if (host_event->h_event == SOC_EVT_RC_MPDU_REPORT) { ++ ; ++ } else { ++ dev_warn(sc->dev, "RC report handler got garbage\n"); ++ return; ++ } ++ if (report_data->rates[0].data_rate < 7) { ++ if (report_data->rates[0].data_rate > 3) { ++ report_data->rates[0].data_rate -= 3; ++ } ++ } ++ if (ssv_rc-> ++ rc_table[rc_sta->pinfo.rinfo[spinfo->txrate_idx]. ++ rc_index].hw_rate_idx == report_data->rates[0].data_rate) { ++ report_data_index = ++ rc_sta->pinfo.rinfo[spinfo->txrate_idx].index; ++ } else ++ if (ssv_rc->rc_table ++ [rc_sta->pinfo.rinfo[spinfo->tmp_rate_idx]. ++ rc_index].hw_rate_idx == report_data->rates[0].data_rate) { ++ report_data_index = ++ rc_sta->pinfo.rinfo[spinfo->tmp_rate_idx].index; ++ } ++ if ((report_data_index != spinfo->tmp_rate_idx) ++ && (report_data_index != spinfo->txrate_idx)) { ++#ifdef RATE_CONTROL_DEBUG ++ dev_dbg ++ (sc->dev, "Rate control report mismatch report_rate_idx[%d] tmp_rate_idx[%d]rate[%d] txrate_idx[%d]rate[%d]!!\n", ++ report_data->rates[0].data_rate, spinfo->tmp_rate_idx, ++ ssv_rc->rc_table[rc_sta->pinfo. ++ rinfo[spinfo->tmp_rate_idx].rc_index]. ++ hw_rate_idx, spinfo->txrate_idx, ++ ssv_rc->rc_table[rc_sta->pinfo. ++ rinfo[spinfo->txrate_idx].rc_index]. ++ hw_rate_idx); ++#endif ++ return; ++ } ++ if (report_data_index == spinfo->txrate_idx) { ++ spinfo->tx_num_xmit += report_data->rates[0].count; ++ spinfo->tx_num_failed += ++ (report_data->rates[0].count - report_data->ampdu_ack_len); ++ rate = &pidrate[spinfo->txrate_idx]; ++ rate->this_fail += ++ (report_data->rates[0].count - report_data->ampdu_ack_len); ++ rate->this_attempt += report_data->rates[0].count; ++ rate->this_success += report_data->ampdu_ack_len; ++ } ++ if (report_data_index != spinfo->txrate_idx ++ && report_data_index == spinfo->tmp_rate_idx) { ++ spinfo->feedback_probes += report_data->ampdu_len; ++ rate = &pidrate[spinfo->tmp_rate_idx]; ++ rate->this_fail += ++ (report_data->rates[0].count - report_data->ampdu_ack_len); ++ rate->this_attempt += report_data->rates[0].count; ++ rate->this_success += report_data->ampdu_ack_len; ++ } ++ period = msecs_to_jiffies(RC_PID_INTERVAL); ++ if (time_after(jiffies, spinfo->last_sample + period)) { ++#ifdef RATE_CONTROL_PERCENTAGE_TRACE ++ rate = &pidrate[spinfo->txrate_idx]; ++ if (rate->this_success > rate->this_attempt) { ++ dev_dbg(sc->dev, "this_success[%ld] this_attempt[%ld]\n", ++ rate->this_success, rate->this_attempt); ++ } else { ++ if (percentage == 0) ++ percentage = ++ (int)((rate->this_success * 100) / ++ rate->this_attempt); ++ else ++ percentage = ++ (percentage + ++ (int)((rate->this_success * 100) / ++ rate->this_attempt)) / 2; ++ deb_dbg(sc->dev, "Percentage[%d]\n", percentage); ++ if ((percentageCounter % 16) == 1) ++ percentage = 0; ++ } ++#endif ++#ifdef RATE_CONTROL_STUPID_DEBUG ++ if (spinfo->txrate_idx != spinfo->tmp_rate_idx) { ++ rate = &pidrate[spinfo->tmp_rate_idx]; ++ if (spinfo->monitoring && ((rate->this_attempt == 0) ++ || (rate->this_attempt != ++ MAXPROBES))) { ++ dev_dbg(sc->dev, "Probe result a[%ld]s[%ld]f[%ld]", ++ rate->this_attempt, rate->this_success, ++ rate->this_fail); ++ } ++ rate = &pidrate[spinfo->txrate_idx]; ++ dev_dbg(sc->dev, "New a[%ld]s[%ld]f[%ld] \n", rate->this_attempt, ++ rate->this_success, rate->this_fail); ++ } else { ++ rate = &pidrate[spinfo->txrate_idx]; ++ dev_dbg(sc->dev, "New a[%ld]s[%ld]f[%ld] \n", rate->this_attempt, ++ rate->this_success, rate->this_fail); ++ } ++ dev_dbg(sc->dev, "w[%d]x%03d-f%03d\n", rc_sta->rc_wsid, ++ spinfo->tx_num_xmit, spinfo->tx_num_failed); ++#endif ++ rate_control_pid_sample(sc->rc, pinfo, rc_sta, spinfo); ++ } ++} ++ ++void ssv6xxx_sample_work(struct work_struct *work) ++{ ++ struct ssv_softc *sc = ++ container_of(work, struct ssv_softc, rc_sample_work); ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct sk_buff *skb; ++ struct cfg_host_event *host_event; ++ struct ssv_sta_rc_info *rc_sta = NULL; ++ struct firmware_rate_control_report_data *report_data; ++ struct ssv_sta_info *ssv_sta; ++ u8 hw_wsid = 0; ++ sc->rc_sample_sechedule = 1; ++ while (1) { ++ skb = skb_dequeue(&sc->rc_report_queue); ++ if (skb == NULL) ++ break; ++#ifdef DISABLE_RATE_CONTROL_SAMPLE ++ { ++ dev_kfree_skb_any(skb); ++ continue; ++ } ++#endif ++ host_event = (struct cfg_host_event *)skb->data; ++ if ((host_event->h_event == SOC_EVT_RC_AMPDU_REPORT) ++ || (host_event->h_event == SOC_EVT_RC_MPDU_REPORT)) { ++ report_data = ++ (struct firmware_rate_control_report_data *) ++ &host_event->dat[0]; ++ hw_wsid = report_data->wsid; ++ } else { ++ dev_warn(sc->dev, "rate control sampling got garbage\n"); ++ dev_kfree_skb_any(skb); ++ continue; ++ } ++ if (hw_wsid >= SSV_RC_MAX_HARDWARE_SUPPORT) { ++#ifdef RATE_CONTROL_DEBUG ++ dev_dbg(sc->dev, "[RC]rc_sta is NULL pointer Check-0!!\n"); ++#endif ++ dev_kfree_skb_any(skb); ++ continue; ++ } ++ ssv_sta = &sc->sta_info[hw_wsid]; ++ if (ssv_sta->sta == NULL) { ++ dev_err(sc->dev, "Null STA %d for RC report.\n", ++ hw_wsid); ++ rc_sta = NULL; ++ } else { ++ struct ssv_sta_priv_data *ssv_sta_priv = ++ (struct ssv_sta_priv_data *)ssv_sta->sta->drv_priv; ++ rc_sta = &ssv_rc->sta_rc_info[ssv_sta_priv->rc_idx]; ++ if (rc_sta->rc_wsid != hw_wsid) { ++ rc_sta = NULL; ++ } ++ } ++ if (rc_sta == NULL) { ++ dev_err(sc->dev, ++ "[RC]rc_sta is NULL pointer Check-1!!\n"); ++ dev_kfree_skb_any(skb); ++ continue; ++ } ++ if (rc_sta == NULL) { ++#ifdef RATE_CONTROL_DEBUG ++ dev_dbg(sc->dev, "[RC]rc_sta is NULL pointer Check-2!!\n"); ++#endif ++ dev_kfree_skb_any(skb); ++ continue; ++ } ++ if (rc_sta->is_ht) { ++ ssv6xxx_legacy_report_handler(sc, skb, rc_sta); ++ ssv6xxx_ht_report_handler(sc, skb, rc_sta); ++ } else ++ ssv6xxx_legacy_report_handler(sc, skb, rc_sta); ++ dev_kfree_skb_any(skb); ++ } ++ sc->rc_sample_sechedule = 0; ++} ++ ++static void ssv6xxx_tx_status(void *priv, ++ struct ieee80211_supported_band *sband, ++ struct ieee80211_sta *sta, void *priv_sta, ++ struct sk_buff *skb) ++{ ++ struct ssv_softc *sc; ++ struct ieee80211_hdr *hdr; ++ __le16 fc; ++ hdr = (struct ieee80211_hdr *)skb->data; ++ fc = hdr->frame_control; ++ if (!priv_sta || !ieee80211_is_data_qos(fc)) ++ return; ++ sc = (struct ssv_softc *)priv; ++ if (conf_is_ht(&sc->hw->conf) ++ && (!(skb->protocol == cpu_to_be16(ETH_P_PAE)))) { ++ if (skb_get_queue_mapping(skb) != IEEE80211_AC_VO) ++ ssv6200_ampdu_tx_update_state(priv, sta, skb); ++ } ++ return; ++} ++ ++static void rateControlGetRate(u8 rateIndex, char *pointer) ++{ ++ switch (rateIndex) { ++ case 0: ++ sprintf(pointer, "1Mbps"); ++ return; ++ case 1: ++ case 4: ++ sprintf(pointer, "2Mbps"); ++ return; ++ case 2: ++ case 5: ++ sprintf(pointer, "5.5Mbps"); ++ return; ++ case 3: ++ case 6: ++ sprintf(pointer, "11Mbps"); ++ return; ++ case 7: ++ sprintf(pointer, "6Mbps"); ++ return; ++ case 8: ++ sprintf(pointer, "9Mbps"); ++ return; ++ case 9: ++ sprintf(pointer, "12Mbps"); ++ return; ++ case 10: ++ sprintf(pointer, "18Mbps"); ++ return; ++ case 11: ++ sprintf(pointer, "24Mbps"); ++ return; ++ case 12: ++ sprintf(pointer, "36Mbps"); ++ return; ++ case 13: ++ sprintf(pointer, "48Mbps"); ++ return; ++ case 14: ++ sprintf(pointer, "54Mbps"); ++ return; ++ case 15: ++ case 31: ++ sprintf(pointer, "MCS0-l"); ++ return; ++ case 16: ++ case 32: ++ sprintf(pointer, "MCS1-l"); ++ return; ++ case 17: ++ case 33: ++ sprintf(pointer, "MCS2-l"); ++ return; ++ case 18: ++ case 34: ++ sprintf(pointer, "MCS3-l"); ++ return; ++ case 19: ++ case 35: ++ sprintf(pointer, "MCS4-l"); ++ return; ++ case 20: ++ case 36: ++ sprintf(pointer, "MCS5-l"); ++ return; ++ case 21: ++ case 37: ++ sprintf(pointer, "MCS6-l"); ++ return; ++ case 22: ++ case 38: ++ sprintf(pointer, "MCS7-l"); ++ return; ++ case 23: ++ sprintf(pointer, "MCS0-s"); ++ return; ++ case 24: ++ sprintf(pointer, "MCS1-s"); ++ return; ++ case 25: ++ sprintf(pointer, "MCS2-s"); ++ return; ++ case 26: ++ sprintf(pointer, "MCS3-s"); ++ return; ++ case 27: ++ sprintf(pointer, "MCS4-s"); ++ return; ++ case 28: ++ sprintf(pointer, "MCS5-s"); ++ return; ++ case 29: ++ sprintf(pointer, "MCS6-s"); ++ return; ++ case 30: ++ sprintf(pointer, "MCS7-s"); ++ return; ++ default: ++ sprintf(pointer, "Unknow"); ++ return; ++ }; ++} ++ ++static void ssv6xxx_get_rate(void *priv, struct ieee80211_sta *sta, ++ void *priv_sta, ++ struct ieee80211_tx_rate_control *txrc) ++{ ++ struct ssv_softc *sc = priv; ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct ssv_sta_rc_info *rc_sta = priv_sta; ++ struct sk_buff *skb = txrc->skb; ++ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); ++ struct ieee80211_tx_rate *rates = tx_info->control.rates; ++ struct rc_pid_sta_info *spinfo = &rc_sta->spinfo; ++ struct ssv_rc_rate *rc_rate = NULL; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ int rateidx = 99; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) ++ if (rate_control_send_low(sta, priv_sta, txrc)) { ++ int i = 0; ++ int total_rates = ++ (sizeof(ssv_11bgn_rate_table) / ++ sizeof(ssv_11bgn_rate_table[0])); ++#if 1 ++ if ((txrc->rate_idx_mask & (1 << rates[0].idx)) == 0) { ++ u32 rate_idx = rates[0].idx + 1; ++ u32 rate_idx_mask = txrc->rate_idx_mask >> rate_idx; ++ while (rate_idx_mask && (rate_idx_mask & 1) == 0) { ++ rate_idx_mask >>= 1; ++ rate_idx++; ++ } ++ if (rate_idx_mask) ++ rates[0].idx = rate_idx; ++ else { ++ WARN_ON(rate_idx_mask == 0); ++ } ++ } ++#endif ++ for (i = 0; i < total_rates; i++) { ++ if (rates[0].idx == ++ ssv_11bgn_rate_table[i].dot11_rate_idx) { ++ break; ++ } ++ } ++ if (i < total_rates) ++ rc_rate = &ssv_rc->rc_table[i]; ++ else { ++ WARN_ON("Failed to find matching low rate."); ++ } ++ } ++#endif ++ if (rc_rate == NULL) { ++ if (conf_is_ht(&sc->hw->conf) && ++ (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) ++ tx_info->flags |= IEEE80211_TX_CTL_LDPC; ++ if (conf_is_ht(&sc->hw->conf) && ++ (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)) ++ tx_info->flags |= (1 << IEEE80211_TX_CTL_STBC_SHIFT); ++ if (sc->sc_flags & SC_OP_FIXED_RATE) { ++ rateidx = sc->max_rate_idx; ++ } else { ++ if (rc_sta->rc_valid == false) { ++ rateidx = 0; ++ } else { ++ if ((rc_sta->rc_wsid >= ++ SSV_RC_MAX_HARDWARE_SUPPORT) ++ || (rc_sta->rc_wsid < 0)) { ++ ssv_sta_priv = ++ (struct ssv_sta_priv_data *) ++ sta->drv_priv; ++ { ++ if ((rc_sta->ht_rc_type >= ++ RC_TYPE_HT_SGI_20) ++ && ++ (ssv_sta_priv->rx_data_rate ++ < ++ SSV62XX_RATE_MCS_INDEX)) { ++ rateidx = ++ rc_sta-> ++ pinfo.rinfo ++ [spinfo->txrate_idx].rc_index; ++ } else { ++ rateidx = ++ ssv_sta_priv->rx_data_rate; ++ } ++ } ++ } else { ++ if (rc_sta->is_ht) { ++#ifdef DISABLE_RATE_CONTROL_SAMPLE ++ rateidx = ++ rc_sta->ht. ++ groups.rates[MCS_GROUP_RATES ++ - 1].rc_index; ++#else ++ rateidx = ++ rc_sta->pinfo. ++ rinfo ++ [spinfo->txrate_idx].rc_index; ++#endif ++ } else { ++ { ++ BUG_ON ++ (spinfo->txrate_idx ++ >= ++ rc_sta->rc_num_rate); ++ rateidx = ++ rc_sta-> ++ pinfo.rinfo ++ [spinfo->txrate_idx].rc_index; ++ } ++ if (rateidx < 4) { ++ if (rateidx) { ++ if ((sc->sc_flags & SC_OP_SHORT_PREAMBLE) ++ || ++ (txrc->short_preamble)) ++ { ++ rateidx ++ += ++ 3; ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ rc_rate = &ssv_rc->rc_table[rateidx]; ++ if (spinfo->real_hw_index != rc_rate->hw_rate_idx) { ++ char string[24]; ++ rateControlGetRate(rc_rate->hw_rate_idx, string); ++ } ++ spinfo->real_hw_index = rc_rate->hw_rate_idx; ++ rates[0].count = 4; ++ rates[0].idx = rc_rate->dot11_rate_idx; ++ tx_info->control.rts_cts_rate_idx = ++ ssv_rc->rc_table[rc_rate->ctrl_rate_idx].dot11_rate_idx; ++ if (rc_rate->rc_flags & RC_FLAG_SHORT_PREAMBLE) ++ rates[0].flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE; ++ if (rc_rate->rc_flags & RC_FLAG_HT) { ++ rates[0].flags |= IEEE80211_TX_RC_MCS; ++ if (rc_rate->rc_flags & RC_FLAG_HT_SGI) ++ rates[0].flags |= IEEE80211_TX_RC_SHORT_GI; ++ if (rc_rate->rc_flags & RC_FLAG_HT_GF) ++ rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; ++ } ++ } ++ rates[1].count = 0; ++ rates[1].idx = -1; ++ rates[SSV_DRATE_IDX].count = rc_rate->hw_rate_idx; ++ rc_rate = &ssv_rc->rc_table[rc_rate->ctrl_rate_idx]; ++ rates[SSV_CRATE_IDX].count = rc_rate->hw_rate_idx; ++} ++ ++int pide_frame_duration(size_t len, int rate, int short_preamble, int flags) ++{ ++ int dur = 0; ++ if (flags == WLAN_RC_PHY_CCK) { ++ dur = 10; ++ dur += short_preamble ? (72 + 24) : (144 + 48); ++ dur += DIV_ROUND_UP(8 * (len + 4) * 10, rate); ++ } else { ++ dur = 16; ++ dur += 16; ++ dur += 4; ++ dur += 4 * DIV_ROUND_UP((16 + 8 * (len + 4) + 6) * 10, ++ 4 * rate); ++ } ++ return dur; ++} ++ ++static void ssv62xx_rc_caps(struct ssv_sta_rc_info *rc_sta) ++{ ++ struct rc_pid_sta_info *spinfo; ++ struct rc_pid_info *pinfo; ++ struct rc_pid_rateinfo *rinfo; ++ int i; ++ spinfo = &rc_sta->spinfo; ++ pinfo = &rc_sta->pinfo; ++ memset(spinfo, 0, sizeof(struct rc_pid_sta_info)); ++ memset(pinfo, 0, sizeof(struct rc_pid_info)); ++ rinfo = rc_sta->pinfo.rinfo; ++ for (i = 0; i < rc_sta->rc_num_rate; i++) { ++ rinfo[i].rc_index = ssv6xxx_rc_rate_set[rc_sta->rc_type][i + 1]; ++ rinfo[i].diff = i * RC_PID_NORM_OFFSET; ++ rinfo[i].index = (u16) i; ++ rinfo[i].perfect_tx_time = ++ TDIFS + (TSLOT * 15 >> 1) + pide_frame_duration(1530, ++ ssv_11bgn_rate_table ++ [rinfo ++ [i].rc_index].rate_kbps ++ / 100, 1, ++ ssv_11bgn_rate_table ++ [rinfo ++ [i].rc_index].phy_type) ++ + pide_frame_duration(10, ++ ssv_11bgn_rate_table[rinfo[i]. ++ rc_index].rate_kbps ++ / 100, 1, ++ ssv_11bgn_rate_table[rinfo[i]. ++ rc_index].phy_type); ++ pr_debug("[RC]Init perfect_tx_time[%d][%d]\n", i, ++ rinfo[i].perfect_tx_time); ++ rinfo[i].throughput = 0; ++ } ++ if (rc_sta->is_ht) { ++ if (ssv6xxx_rc_rate_set[rc_sta->ht_rc_type][0] == 12) ++ spinfo->txrate_idx = 4; ++ else ++ spinfo->txrate_idx = 0; ++ } else { ++ spinfo->txrate_idx = ssv6xxx_rate_lowest_index(rc_sta); ++#ifdef DISABLE_RATE_CONTROL_SAMPLE ++ spinfo->txrate_idx = ssv6xxx_rate_highest_index(rc_sta); ++#endif ++ } ++ spinfo->real_hw_index = 0; ++ spinfo->probe_cnt = MAXPROBES; ++ spinfo->tmp_rate_idx = spinfo->txrate_idx; ++ spinfo->oldrate = spinfo->txrate_idx; ++ spinfo->last_sample = jiffies; ++ spinfo->last_report = jiffies; ++} ++ ++static void ssv6xxx_rate_update_rc_type(void *priv, ++ struct ieee80211_supported_band *sband, ++ struct ieee80211_sta *sta, ++ void *priv_sta) ++{ ++ struct ssv_softc *sc = priv; ++ struct ssv_hw *sh = sc->sh; ++ struct ssv_sta_rc_info *rc_sta = priv_sta; ++ int i; ++ u32 ht_supp_rates = 0; ++ BUG_ON(rc_sta->rc_valid == false); ++ dev_dbg(sc->dev, "[I] %s(): \n", __FUNCTION__); ++ rc_sta->ht_supp_rates = 0; ++ rc_sta->rc_supp_rates = 0; ++ rc_sta->is_ht = 0; ++#ifndef CONFIG_CH14_SUPPORT_GN_MODE ++ if (sc->cur_channel->hw_value == 14) { ++ dev_dbg(sc->dev, "[RC init ]Channel 14 support\n"); ++ if ((sta->deflink.supp_rates[sband->band] & (~0xfL)) == 0x0) { ++ dev_dbg(sc->dev, "[RC init ]B only mode\n"); ++ rc_sta->rc_type = RC_TYPE_B_ONLY; ++ } else { ++ dev_dbg(sc->dev, "[RC init ]GB mode\n"); ++ rc_sta->rc_type = RC_TYPE_LEGACY_GB; ++ } ++ } else ++#endif ++ if (sta->deflink.ht_cap.ht_supported == true) { ++ dev_dbg(sc->dev, "[RC init ]HT support wsid\n"); ++ for (i = 0; i < SSV_HT_RATE_MAX; i++) { ++ if (sta->deflink.ht_cap.mcs.rx_mask[i / ++ MCS_GROUP_RATES] & (1 << (i ++ % ++ MCS_GROUP_RATES))) ++ ht_supp_rates |= BIT(i); ++ } ++ rc_sta->ht_supp_rates = ht_supp_rates; ++ if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) { ++ rc_sta->rc_type = RC_TYPE_HT_GF; ++ rc_sta->ht_rc_type = RC_TYPE_HT_GF; ++ } else if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) { ++ rc_sta->rc_type = RC_TYPE_SGI_20; ++ rc_sta->ht_rc_type = RC_TYPE_HT_SGI_20; ++ } else { ++ rc_sta->rc_type = RC_TYPE_LGI_20; ++ rc_sta->ht_rc_type = RC_TYPE_HT_LGI_20; ++ } ++ } else { ++ if ((sta->deflink.supp_rates[sband->band] & (~0xfL)) == 0x0) { ++ rc_sta->rc_type = RC_TYPE_B_ONLY; ++ dev_dbg(sc->dev, "[RC init ]B only mode\n"); ++ } else { ++ rc_sta->rc_type = RC_TYPE_LEGACY_GB; ++ dev_dbg(sc->dev, "[RC init ]legacy G mode\n"); ++ } ++ } ++#ifdef CONFIG_SSV_DPD ++ if (rc_sta->rc_type == RC_TYPE_B_ONLY) { ++ SMAC_REG_WRITE(sh, ADR_TX_FE_REGISTER, 0x3D3E84FE); ++ SMAC_REG_WRITE(sh, ADR_RX_FE_REGISTER_1, 0x1457D79); ++ SMAC_REG_WRITE(sh, ADR_DPD_CONTROL, 0x0); ++ } else { ++ SMAC_REG_WRITE(sh, ADR_TX_FE_REGISTER, 0x3CBE84FE); ++ SMAC_REG_WRITE(sh, ADR_RX_FE_REGISTER_1, 0x4507F9); ++ SMAC_REG_WRITE(sh, ADR_DPD_CONTROL, 0x3); ++ } ++#endif ++ if ((rc_sta->rc_type != RC_TYPE_B_ONLY) ++ && (rc_sta->rc_type != RC_TYPE_LEGACY_GB)) { ++ if ((sta->deflink.ht_cap.ht_supported) ++ && (sh->cfg.hw_caps & SSV6200_HW_CAP_AMPDU_TX)) { ++ rc_sta->is_ht = 1; ++ ssv62xx_ht_rc_caps(ssv6xxx_rc_rate_set, rc_sta); ++ } ++ } ++ { ++ rc_sta->rc_num_rate = ++ (u8) ssv6xxx_rc_rate_set[rc_sta->rc_type][0]; ++ if ((rc_sta->rc_type == RC_TYPE_HT_GF) ++ || (rc_sta->rc_type == RC_TYPE_LGI_20) ++ || (rc_sta->rc_type == RC_TYPE_SGI_20)) { ++ if (rc_sta->rc_num_rate == 12) { ++ rc_sta->rc_supp_rates = ++ sta->deflink.supp_rates[sband->band] & 0xfL; ++ rc_sta->rc_supp_rates |= (ht_supp_rates << 4); ++ } else ++ rc_sta->rc_supp_rates = ht_supp_rates; ++ } else if (rc_sta->rc_type == RC_TYPE_LEGACY_GB) ++ rc_sta->rc_supp_rates = sta->deflink.supp_rates[sband->band]; ++ else if (rc_sta->rc_type == RC_TYPE_B_ONLY) ++ rc_sta->rc_supp_rates = ++ sta->deflink.supp_rates[sband->band] & 0xfL; ++ ssv62xx_rc_caps(rc_sta); ++ } ++} ++ ++static void ssv6xxx_rate_update(void *priv, ++ struct ieee80211_supported_band *sband, ++ struct cfg80211_chan_def *chandef, ++ struct ieee80211_sta *sta, void *priv_sta, ++ u32 changed) ++{ ++ pr_debug("%s: changed=%d\n", __FUNCTION__, changed); ++ return; ++} ++ ++static void ssv6xxx_rate_init(void *priv, ++ struct ieee80211_supported_band *sband, ++ struct cfg80211_chan_def *chandef, ++ struct ieee80211_sta *sta, void *priv_sta) ++{ ++ ssv6xxx_rate_update_rc_type(priv, sband, sta, priv_sta); ++} ++ ++static void *ssv6xxx_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, ++ gfp_t gfp) ++{ ++ struct ssv_sta_priv_data *sta_priv = ++ (struct ssv_sta_priv_data *)sta->drv_priv; ++#ifndef RC_STA_DIRECT_MAP ++ struct ssv_softc *sc = priv; ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ int s; ++ sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ for (s = 0; s < SSV_RC_MAX_STA; s++) { ++ if (ssv_rc->sta_rc_info[s].rc_valid == false) { ++ dev_dbg(sc->dev, "%s(): use index %d\n", __FUNCTION__, s); ++ memset(&ssv_rc->sta_rc_info[s], 0, ++ sizeof(struct ssv_sta_rc_info)); ++ ssv_rc->sta_rc_info[s].rc_valid = true; ++ ssv_rc->sta_rc_info[s].rc_wsid = -1; ++ sta_priv->rc_idx = s; ++ return &ssv_rc->sta_rc_info[s]; ++ } ++ } ++ return NULL; ++#else ++ sta_priv->rc_idx = (-1); ++ return sta_priv; ++#endif ++} ++ ++static void ssv6xxx_rate_free_sta(void *priv, struct ieee80211_sta *sta, ++ void *priv_sta) ++{ ++ struct ssv_sta_rc_info *rc_sta = priv_sta; ++ rc_sta->rc_valid = false; ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) ++static void *ssv6xxx_rate_alloc(struct ieee80211_hw *hw) ++#else ++static void *ssv6xxx_rate_alloc(struct ieee80211_hw *hw, ++ struct dentry *debugfsdir) ++#endif ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ssv_rate_ctrl *ssv_rc; ++ sc->rc = kzalloc(sizeof(struct ssv_rate_ctrl), GFP_KERNEL); ++ if (!sc->rc) { ++ pr_err("%s(): Unable to allocate RC structure !\n", ++ __FUNCTION__); ++ return NULL; ++ } ++ memset(sc->rc, 0, sizeof(struct ssv_rate_ctrl)); ++ ssv_rc = (struct ssv_rate_ctrl *)sc->rc; ++ ssv_rc->rc_table = ssv_11bgn_rate_table; ++ skb_queue_head_init(&sc->rc_report_queue); ++ INIT_WORK(&sc->rc_sample_work, ssv6xxx_sample_work); ++ sc->rc_sample_workqueue = create_workqueue("ssv6xxx_rc_sample"); ++ sc->rc_sample_sechedule = 0; ++ return hw->priv; ++} ++ ++static void ssv6xxx_rate_free(void *priv) ++{ ++ struct ssv_softc *sc = priv; ++ if (sc->rc) { ++ kfree(sc->rc); ++ sc->rc = NULL; ++ } ++ sc->rc_sample_sechedule = 0; ++ cancel_work_sync(&sc->rc_sample_work); ++ flush_workqueue(sc->rc_sample_workqueue); ++ destroy_workqueue(sc->rc_sample_workqueue); ++} ++ ++static struct rate_control_ops ssv_rate_ops = { ++ .name = "ssv6xxx_rate_control", ++ .tx_status = ssv6xxx_tx_status, ++ .get_rate = ssv6xxx_get_rate, ++ .rate_init = ssv6xxx_rate_init, ++ .rate_update = ssv6xxx_rate_update, ++ .alloc = ssv6xxx_rate_alloc, ++ .free = ssv6xxx_rate_free, ++ .alloc_sta = ssv6xxx_rate_alloc_sta, ++ .free_sta = ssv6xxx_rate_free_sta, ++}; ++ ++void ssv6xxx_rc_mac8011_rate_idx(struct ssv_softc *sc, ++ int hw_rate_idx, ++ struct ieee80211_rx_status *rxs) ++{ ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct ssv_rc_rate *rc_rate; ++ BUG_ON(hw_rate_idx >= RATE_TABLE_SIZE && hw_rate_idx < 0); ++ rc_rate = &ssv_rc->rc_table[hw_rate_idx]; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) ++ if (rc_rate->rc_flags & RC_FLAG_HT) { ++ // rxs->flag |= RC_FLAG_HT; ++ if (rc_rate->rc_flags & RC_FLAG_HT_SGI) ++ rxs->enc_flags |= RX_ENC_FLAG_SHORT_GI; ++ } else { ++ if (rc_rate->rc_flags & RC_FLAG_SHORT_PREAMBLE) ++ rxs->enc_flags |= RX_ENC_FLAG_SHORTPRE; ++ } ++#else ++ if (rc_rate->rc_flags & RC_FLAG_HT) { ++ rxs->flag |= RC_FLAG_HT; ++ if (rc_rate->rc_flags & RC_FLAG_HT_SGI) ++ rxs->flag |= RX_FLAG_SHORT_GI; ++ } else { ++ if (rc_rate->rc_flags & RC_FLAG_SHORT_PREAMBLE) ++ rxs->flag |= RX_FLAG_SHORTPRE; ++ } ++#endif ++ rxs->rate_idx = rc_rate->dot11_rate_idx; ++} ++ ++void ssv6xxx_rc_hw_rate_idx(struct ssv_softc *sc, ++ struct ieee80211_tx_info *info, ++ struct ssv_rate_info *sr) ++{ ++ struct ieee80211_tx_rate *tx_rate; ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ tx_rate = &info->control.rates[0]; ++ sr->d_flags = ++ (ssv_rc->rc_table[tx_rate[SSV_DRATE_IDX].count].phy_type == ++ WLAN_RC_PHY_OFDM) ? IEEE80211_RATE_ERP_G : 0; ++ sr->d_flags |= ++ (ssv_rc-> ++ rc_table[tx_rate[SSV_DRATE_IDX]. ++ count].rc_flags & RC_FLAG_SHORT_PREAMBLE) ? ++ IEEE80211_RATE_SHORT_PREAMBLE : 0; ++ sr->c_flags = ++ (ssv_rc->rc_table[tx_rate[SSV_CRATE_IDX].count].phy_type == ++ WLAN_RC_PHY_OFDM) ? IEEE80211_RATE_ERP_G : 0; ++ sr->c_flags |= ++ (ssv_rc-> ++ rc_table[tx_rate[SSV_CRATE_IDX]. ++ count].rc_flags & RC_FLAG_SHORT_PREAMBLE) ? ++ IEEE80211_RATE_SHORT_PREAMBLE : 0; ++ sr->drate_kbps = ++ ssv_rc->rc_table[tx_rate[SSV_DRATE_IDX].count].rate_kbps; ++ sr->drate_hw_idx = tx_rate[SSV_DRATE_IDX].count; ++ sr->crate_kbps = ++ ssv_rc->rc_table[tx_rate[SSV_CRATE_IDX].count].rate_kbps; ++ sr->crate_hw_idx = tx_rate[SSV_CRATE_IDX].count; ++} ++ ++u8 ssv6xxx_rc_hw_rate_update_check(struct sk_buff *skb, struct ssv_softc *sc, ++ u32 do_rts_cts) ++{ ++ int ret = 0; ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); ++ struct SKB_info_st *skb_info = (struct SKB_info_st *)skb->head; ++ struct ieee80211_sta *sta = skb_info->sta; ++ struct ieee80211_tx_rate *rates = &tx_info->control.rates[0]; ++ struct ssv_rc_rate *rc_rate = NULL; ++ u8 rateidx = 0; ++ struct ssv_sta_rc_info *rc_sta = NULL; ++ struct rc_pid_sta_info *spinfo; ++ struct ssv_sta_priv_data *sta_priv = NULL; ++ unsigned long period = 0; ++ if (sc->sc_flags & SC_OP_FIXED_RATE) ++ return ret; ++ if (sta == NULL) ++ return ret; ++ sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ if (sta_priv == NULL) { ++#ifdef RATE_CONTROL_DEBUG ++ dev_dbg(rc->dev, "%s sta_priv == NULL \n\r", __FUNCTION__); ++#endif ++ return ret; ++ } ++ if ((sta_priv->rc_idx < 0) || (sta_priv->rc_idx >= SSV_RC_MAX_STA)) { ++#ifdef RATE_CONTROL_DEBUG ++ dev_dbg(sc->dev, "%s rc_idx %x illegal \n\r", __FUNCTION__, ++ sta_priv->rc_idx); ++#endif ++ return ret; ++ } ++ rc_sta = &ssv_rc->sta_rc_info[sta_priv->rc_idx]; ++ if (rc_sta->rc_valid == false) { ++#ifdef RATE_CONTROL_DEBUG ++ dev_dbg(sc->dev, "%s rc_valid false \n\r", __FUNCTION__); ++#endif ++ return ret; ++ } ++ spinfo = &rc_sta->spinfo; ++ period = msecs_to_jiffies(RC_PID_REPORT_INTERVAL); ++ if (time_after(jiffies, spinfo->last_report + period)) { ++ ret |= RC_FIRMWARE_REPORT_FLAG; ++ spinfo->last_report = jiffies; ++ } ++ { ++ if (spinfo->monitoring) { ++ if (spinfo->probe_report_flag == 0) { ++ ret |= RC_FIRMWARE_REPORT_FLAG; ++ spinfo->last_report = jiffies; ++ spinfo->probe_report_flag = 1; ++ rateidx = spinfo->real_hw_index; ++ } else if (spinfo->probe_cnt > 0 ++ && spinfo->probe_report_flag) { ++ rateidx = ++ rc_sta->pinfo.rinfo[spinfo-> ++ tmp_rate_idx].rc_index; ++ spinfo->probe_cnt--; ++ if (spinfo->probe_cnt == 0) { ++ ret |= RC_FIRMWARE_REPORT_FLAG; ++ spinfo->last_report = jiffies; ++ } ++ } else ++ rateidx = spinfo->real_hw_index; ++ } else ++ rateidx = spinfo->real_hw_index; ++ } ++ if (rateidx >= RATE_TABLE_SIZE) { ++ dev_err(sc->dev, "rateidx over range\n"); ++ return 0; ++ } ++ rc_rate = &ssv_rc->rc_table[rateidx]; ++#ifdef RATE_CONTROL_STUPID_DEBUG ++ if (spinfo->monitoring && (spinfo->probe_cnt)) { ++ char string[24]; ++ rateControlGetRate(rc_rate->hw_rate_idx, string); ++ dev_dbg(sc->dev, "[RC]Probe rate[%s]\n", string); ++ } ++#endif ++ if (rc_rate == NULL) ++ return ret; ++ if (rc_rate->hw_rate_idx != rates[SSV_DRATE_IDX].count) { ++ rates[0].flags = 0; ++ if (rc_rate->rc_flags & RC_FLAG_SHORT_PREAMBLE) ++ rates[0].flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE; ++ if (rc_rate->rc_flags & RC_FLAG_HT) { ++ rates[0].flags |= IEEE80211_TX_RC_MCS; ++ if (rc_rate->rc_flags & RC_FLAG_HT_SGI) ++ rates[0].flags |= IEEE80211_TX_RC_SHORT_GI; ++ if (rc_rate->rc_flags & RC_FLAG_HT_GF) ++ rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; ++ } ++ rates[SSV_DRATE_IDX].count = rc_rate->hw_rate_idx; ++ if (do_rts_cts & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ rates[SSV_CRATE_IDX].count = 0; ++ } else { ++ rc_rate = &ssv_rc->rc_table[rc_rate->ctrl_rate_idx]; ++ rates[SSV_CRATE_IDX].count = rc_rate->hw_rate_idx; ++ } ++ ret |= 0x1; ++ } ++ return ret; ++} ++ ++void ssv6xxx_rc_hw_reset(struct ssv_softc *sc, int rc_idx, int hwidx) ++{ ++ struct ssv_rate_ctrl *ssv_rc = sc->rc; ++ struct ssv_sta_rc_info *rc_sta; ++ u32 rc_hw_reg[] = { ADR_MTX_MIB_WSID0, ADR_MTX_MIB_WSID1 }; ++ BUG_ON(rc_idx >= SSV_RC_MAX_STA); ++ rc_sta = &ssv_rc->sta_rc_info[rc_idx]; ++ if (hwidx >= 0 && hwidx < SSV_NUM_HW_STA) { ++ rc_sta->rc_wsid = hwidx; ++ dev_dbg(sc->dev, "rc_wsid[%d] rc_idx[%d]\n", rc_sta[rc_idx].rc_wsid, ++ rc_idx); ++ SMAC_REG_WRITE(sc->sh, rc_hw_reg[hwidx], 0x40000000); ++ } else { ++ rc_sta->rc_wsid = -1; ++ } ++} ++ ++#define UPDATE_PHY_INFO_ACK_RATE(_phy_info,_ack_rate_idx) ( _phy_info = (_phy_info&0xfffffc0f)|(_ack_rate_idx<<4)) ++int ssv6xxx_rc_update_bmode_ctrl_rate(struct ssv_softc *sc, int rate_tbl_idx, ++ int ctrl_rate_idx) ++{ ++ u32 temp32; ++ struct ssv_hw *sh = sc->sh; ++ u32 addr; ++ addr = sh->hw_pinfo + rate_tbl_idx * 4; ++ ssv_11bgn_rate_table[rate_tbl_idx].ctrl_rate_idx = ctrl_rate_idx; ++ SMAC_REG_READ(sh, addr, &temp32); ++ UPDATE_PHY_INFO_ACK_RATE(temp32, ctrl_rate_idx); ++ SMAC_REG_WRITE(sh, addr, temp32); ++ SMAC_REG_CONFIRM(sh, addr, temp32); ++ return 0; ++} ++ ++void ssv6xxx_rc_update_basic_rate(struct ssv_softc *sc, u32 basic_rates) ++{ ++ int i; ++ int rate_idx, pre_rate_idx = 0; ++ for (i = 0; i < 4; i++) { ++ if (((basic_rates >> i) & 0x01)) { ++ rate_idx = i; ++ pre_rate_idx = i; ++ } else ++ rate_idx = pre_rate_idx; ++ ssv6xxx_rc_update_bmode_ctrl_rate(sc, i, rate_idx); ++ if (i) ++ ssv6xxx_rc_update_bmode_ctrl_rate(sc, i + 3, rate_idx); ++ } ++} ++ ++int ssv6xxx_rate_control_register(void) ++{ ++ return ieee80211_rate_control_register(&ssv_rate_ops); ++} ++ ++void ssv6xxx_rate_control_unregister(void) ++{ ++ ieee80211_rate_control_unregister(&ssv_rate_ops); ++} ++ ++void ssv6xxx_rc_rx_data_handler(struct ieee80211_hw *hw, struct sk_buff *skb, ++ u32 rate_index) ++{ ++ struct ssv_softc *sc = hw->priv; ++ struct ieee80211_sta *sta; ++ struct ssv_sta_priv_data *ssv_sta_priv; ++ sta = ssv6xxx_find_sta_by_rx_skb(sc, skb); ++ if (sta == NULL) { ++ return; ++ } ++ ssv_sta_priv = (struct ssv_sta_priv_data *)sta->drv_priv; ++ ssv_sta_priv->rx_data_rate = rate_index; ++} +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_rc.h b/drivers/net/wireless/ssv6051/smac/ssv_rc.h +new file mode 100644 +index 000000000000..911c182897fa +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_rc.h +@@ -0,0 +1,50 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_RC_H_ ++#define _SSV_RC_H_ ++#include "ssv_rc_common.h" ++#define RC_PID_REPORT_INTERVAL 40 ++#define RC_PID_INTERVAL 125 ++#define RC_PID_DO_ARITH_RIGHT_SHIFT(x,y) \ ++ ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y)) ++#define RC_PID_NORM_OFFSET 3 ++#define RC_PID_SMOOTHING_SHIFT 1 ++#define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT) ++#define RC_PID_COEFF_P 15 ++#define RC_PID_COEFF_I 15 ++#define RC_PID_COEFF_D 5 ++#define MAXPROBES 3 ++#define SSV_DRATE_IDX (2) ++#define SSV_CRATE_IDX (3) ++ ++struct ssv_softc; ++struct ssv_rc_rate *ssv6xxx_rc_get_rate(int rc_index); ++void ssv6xxx_rc_hw_rate_idx(struct ssv_softc *sc, ++ struct ieee80211_tx_info *info, ++ struct ssv_rate_info *sr); ++u8 ssv6xxx_rc_hw_rate_update_check(struct sk_buff *skb, struct ssv_softc *sc, ++ u32 do_rts_cts); ++void ssv6xxx_rc_mac8011_rate_idx(struct ssv_softc *sc, int hw_rate_idx, ++ struct ieee80211_rx_status *rxs); ++void ssv6xxx_rc_hw_reset(struct ssv_softc *sc, int rc_idx, int hwidx); ++void ssv6xxx_rc_update_basic_rate(struct ssv_softc *sc, u32 basic_rates); ++int ssv6xxx_rate_control_register(void); ++void ssv6xxx_rate_control_unregister(void); ++void ssv6xxx_rc_rx_data_handler(struct ieee80211_hw *hw, struct sk_buff *skb, ++ u32 rate_index); ++int pide_frame_duration(size_t len, int rate, int short_preamble, int flags); ++#endif +diff --git a/drivers/net/wireless/ssv6051/smac/ssv_rc_common.h b/drivers/net/wireless/ssv6051/smac/ssv_rc_common.h +new file mode 100644 +index 000000000000..13f3fdd8072b +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/smac/ssv_rc_common.h +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_RC_COM_H_ ++#define _SSV_RC_COM_H_ ++#define SSV_RC_MAX_STA 8 ++#define MCS_GROUP_RATES 8 ++#define SSV_HT_RATE_MAX 8 ++#define TDIFS 34 ++#define TSLOT 9 ++#define SSV_RC_MAX_HARDWARE_SUPPORT 2 ++#define RC_FIRMWARE_REPORT_FLAG 0x80 ++#define RC_FLAG_INVALID 0x00000001 ++#define RC_FLAG_LEGACY 0x00000002 ++#define RC_FLAG_HT 0x00000004 ++#define RC_FLAG_HT_SGI 0x00000008 ++#define RC_FLAG_HT_GF 0x00000010 ++#define RC_FLAG_SHORT_PREAMBLE 0x00000020 ++enum ssv6xxx_rc_phy_type { ++ WLAN_RC_PHY_CCK, ++ WLAN_RC_PHY_OFDM, ++ WLAN_RC_PHY_HT_20_SS_LGI, ++ WLAN_RC_PHY_HT_20_SS_SGI, ++ WLAN_RC_PHY_HT_20_SS_GF, ++}; ++#define RATE_TABLE_SIZE 39 ++#define RC_STA_VALID 0x00000001 ++#define RC_STA_CAP_HT 0x00000002 ++#define RC_STA_CAP_GF 0x00000004 ++#define RC_STA_CAP_SGI_20 0x00000008 ++#define RC_STA_CAP_SHORT_PREAMBLE 0x00000010 ++#define SSV62XX_G_RATE_INDEX 7 ++#define SSV62XX_RATE_MCS_INDEX 15 ++#define SSV62XX_RATE_MCS_LGI_INDEX 15 ++#define SSV62XX_RATE_MCS_SGI_INDEX 23 ++#define SSV62XX_RATE_MCS_GREENFIELD_INDEX 31 ++enum ssv_rc_rate_type { ++ RC_TYPE_B_ONLY = 0, ++ RC_TYPE_LEGACY_GB, ++ RC_TYPE_SGI_20, ++ RC_TYPE_LGI_20, ++ RC_TYPE_HT_SGI_20, ++ RC_TYPE_HT_LGI_20, ++ RC_TYPE_HT_GF, ++ RC_TYPE_MAX, ++}; ++struct ssv_rate_info { ++ int crate_kbps; ++ int crate_hw_idx; ++ int drate_kbps; ++ int drate_hw_idx; ++ u32 d_flags; ++ u32 c_flags; ++}; ++struct ssv_rc_rate { ++ u32 rc_flags; ++ u16 phy_type; ++ u32 rate_kbps; ++ u8 dot11_rate_idx; ++ u8 ctrl_rate_idx; ++ u8 hw_rate_idx; ++ u8 arith_shift; ++ u8 target_pf; ++}; ++struct rc_pid_sta_info { ++ unsigned long last_sample; ++ unsigned long last_report; ++ u16 tx_num_failed; ++ u16 tx_num_xmit; ++ u8 probe_report_flag; ++ u8 probe_wating_times; ++ u8 real_hw_index; ++ int txrate_idx; ++ u8 last_pf; ++ s32 err_avg_sc; ++ int last_dlr; ++ u8 feedback_probes; ++ u8 monitoring; ++ u8 oldrate; ++ u8 tmp_rate_idx; ++ u8 probe_cnt; ++}; ++struct rc_pid_rateinfo { ++ u16 rc_index; ++ u16 index; ++ s32 diff; ++ u16 perfect_tx_time; ++ u32 throughput; ++ unsigned long this_attempt; ++ unsigned long this_success; ++ unsigned long this_fail; ++ u64 attempt; ++ u64 success; ++ u64 fail; ++}; ++struct rc_pid_info { ++ unsigned int target; ++ int oldrate; ++ struct rc_pid_rateinfo rinfo[12]; ++}; ++struct mcs_group { ++ unsigned int duration[MCS_GROUP_RATES]; ++}; ++struct minstrel_rate_stats { ++ u16 rc_index; ++ unsigned int attempts, last_attempts; ++ unsigned int success, last_success; ++ u64 att_hist, succ_hist; ++ unsigned int cur_tp; ++ unsigned int cur_prob, probability; ++ unsigned int retry_count; ++ unsigned int retry_count_rtscts; ++ u8 sample_skipped; ++}; ++struct minstrel_mcs_group_data { ++ u8 index; ++ u8 column; ++ unsigned int max_tp_rate; ++ unsigned int max_tp_rate2; ++ unsigned int max_prob_rate; ++ struct minstrel_rate_stats rates[MCS_GROUP_RATES]; ++}; ++struct ssv62xx_ht { ++ unsigned int ampdu_len; ++ unsigned int ampdu_packets; ++ unsigned int avg_ampdu_len; ++ unsigned int max_tp_rate; ++ unsigned int max_tp_rate2; ++ unsigned int max_prob_rate; ++ int first_try_count; ++ int second_try_count; ++ int other_try_count; ++ unsigned long stats_update; ++ unsigned int overhead; ++ unsigned int overhead_rtscts; ++ unsigned int total_packets; ++ unsigned int sample_packets; ++ u8 sample_wait; ++ u8 sample_tries; ++ u8 sample_count; ++ u8 sample_slow; ++ struct minstrel_mcs_group_data groups; ++}; ++struct ssv_sta_rc_info { ++ u8 rc_valid; ++ u8 rc_type; ++ u8 rc_num_rate; ++ s8 rc_wsid; ++ u8 ht_rc_type; ++ u8 is_ht; ++ u32 rc_supp_rates; ++ u32 ht_supp_rates; ++ struct rc_pid_info pinfo; ++ struct rc_pid_sta_info spinfo; ++ struct ssv62xx_ht ht; ++}; ++struct ssv_rate_ctrl { ++ struct ssv_rc_rate *rc_table; ++ struct ssv_sta_rc_info sta_rc_info[SSV_RC_MAX_STA]; ++}; ++#define HT_RC_UPDATE_INTERVAL 1000 ++#endif +diff --git a/drivers/net/wireless/ssv6051/ssv6051-generic-wlan.c b/drivers/net/wireless/ssv6051/ssv6051-generic-wlan.c +new file mode 100644 +index 000000000000..10a9a77081db +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/ssv6051-generic-wlan.c +@@ -0,0 +1,76 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int g_wifidev_registered = 0; ++extern int ssvdevice_init(void); ++extern void ssvdevice_exit(void); ++extern int ssv6xxx_get_dev_status(void); ++ ++static __init int ssv_init_module(void) ++{ ++ int ret = 0; ++ int time = 5; ++ ++ msleep(120); ++ ++ g_wifidev_registered = 1; ++ ret = ssvdevice_init(); ++ ++ while(time-- > 0){ ++ msleep(500); ++ if(ssv6xxx_get_dev_status() == 1) ++ break; ++ pr_info("%s : Retry to carddetect\n",__func__); ++ } ++ ++ return ret; ++ ++} ++static __exit void ssv_exit_module(void) ++{ ++ ++ if (g_wifidev_registered) ++ { ++ ssvdevice_exit(); ++ msleep(50); ++ g_wifidev_registered = 0; ++ } ++ ++ return; ++ ++} ++ ++module_init(ssv_init_module); ++module_exit(ssv_exit_module); ++ ++MODULE_AUTHOR("iComm Semiconductor Co., Ltd"); ++MODULE_FIRMWARE("ssv*-sw.bin"); ++MODULE_FIRMWARE("ssv*-wifi.cfg"); ++MODULE_DESCRIPTION("Shared library for SSV wireless LAN cards."); ++MODULE_LICENSE("Dual BSD/GPL"); ++ +diff --git a/drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.c b/drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.c +new file mode 100644 +index 000000000000..503df1ea6dc3 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.c +@@ -0,0 +1,1765 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "ssv_cmd.h" ++#include ++#include ++#define SSV_CMD_PRINTF() ++struct ssv6xxx_dev_table { ++ u32 address; ++ u32 val; ++}; ++struct ssv6xxx_debug { ++ struct device *dev; ++ struct platform_device *pdev; ++ struct ssv6xxx_hwif_ops *ifops; ++}; ++static struct ssv6xxx_debug *ssv6xxx_debug_ifops; ++static char sg_cmd_buffer[CLI_BUFFER_SIZE + 1]; ++static char *sg_argv[CLI_ARG_SIZE]; ++static u32 sg_argc; ++extern char *ssv6xxx_result_buf; ++#if defined (CONFIG_ARM64) || defined (__x86_64__) ++u64 ssv6xxx_ifdebug_info[3] = { 0, 0, 0 }; ++#else ++u32 ssv6xxx_ifdebug_info[3] = { 0, 0, 0 }; ++#endif ++EXPORT_SYMBOL(ssv6xxx_ifdebug_info); ++struct sk_buff *ssvdevice_skb_alloc(s32 len) ++{ ++ struct sk_buff *skb; ++ skb = __dev_alloc_skb(len + SSV6200_ALLOC_RSVD, GFP_KERNEL); ++ if (skb != NULL) { ++ skb_put(skb, 0x20); ++ skb_pull(skb, 0x20); ++ } ++ return skb; ++} ++ ++void ssvdevice_skb_free(struct sk_buff *skb) ++{ ++ dev_kfree_skb_any(skb); ++} ++ ++static int ssv_cmd_help(int argc, char *argv[]) ++{ ++ extern struct ssv_cmd_table cmd_table[]; ++ struct ssv_cmd_table *sc_tbl; ++ char tmpbf[161]; ++ int total_cmd = 0; ++ { ++ sprintf(ssv6xxx_result_buf, "Usage:\n"); ++ for (sc_tbl = &cmd_table[3]; sc_tbl->cmd; sc_tbl++) { ++ sprintf(tmpbf, "%-20s\t\t%s\n", sc_tbl->cmd, ++ sc_tbl->usage); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ total_cmd++; ++ } ++ sprintf(tmpbf, ++ "Total CMDs: %d\n\nType cli help [CMD] for more detail command.\n\n", ++ total_cmd); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ return 0; ++} ++ ++static int ssv_cmd_reg(int argc, char *argv[]) ++{ ++ u32 addr, value, count; ++ char tmpbf[64], *endp; ++ int s; ++ if (argc == 4 && strcmp(argv[1], "w") == 0) { ++ addr = simple_strtoul(argv[2], &endp, 16); ++ value = simple_strtoul(argv[3], &endp, 16); ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, addr, value)) ; ++ sprintf(ssv6xxx_result_buf, " => write [0x%08x]: 0x%08x\n", ++ addr, value); ++ return 0; ++ } else if ((argc == 4 || argc == 3) && strcmp(argv[1], "r") == 0) { ++ count = (argc == 3) ? 1 : simple_strtoul(argv[3], &endp, 10); ++ addr = simple_strtoul(argv[2], &endp, 16); ++ sprintf(ssv6xxx_result_buf, "ADDRESS: 0x%08x\n", addr); ++ for (s = 0; s < count; s++, addr += 4) { ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value)) ; ++ sprintf(tmpbf, "%08x ", value); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ if (((s + 1) & 0x07) == 0) ++ strcat(ssv6xxx_result_buf, "\n"); ++ } ++ strcat(ssv6xxx_result_buf, "\n"); ++ return 0; ++ } else { ++ sprintf(tmpbf, "reg [r|w] [address] [value|word-count]\n\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ return 0; ++ } ++ return -1; ++} ++ ++struct ssv6xxx_cfg ssv_cfg; ++EXPORT_SYMBOL(ssv_cfg); ++static int __string2u32(u8 * u8str, void *val, u32 arg) ++{ ++ char *endp; ++ int base = 10; ++ if (u8str[0] == '0' && ((u8str[1] == 'x') || (u8str[1] == 'X'))) ++ base = 16; ++ *(u32 *) val = simple_strtoul(u8str, &endp, base); ++ return 0; ++} ++ ++static int __string2flag32(u8 * flag_str, void *flag, u32 arg) ++{ ++ u32 *val = (u32 *) flag; ++ if (arg >= (sizeof(u32) << 3)) ++ return -1; ++ if (strcmp(flag_str, "on") == 0) { ++ *val |= (1 << arg); ++ return 0; ++ } ++ if (strcmp(flag_str, "off") == 0) { ++ *val &= ~(1 << arg); ++ return 0; ++ } ++ return -1; ++} ++ ++static int __string2mac(u8 * mac_str, void *val, u32 arg) ++{ ++ int s, macaddr[6]; ++ u8 *mac = (u8 *) val; ++ s = sscanf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x", ++ &macaddr[0], &macaddr[1], &macaddr[2], ++ &macaddr[3], &macaddr[4], &macaddr[5]); ++ if (s != 6) ++ return -1; ++ mac[0] = (u8) macaddr[0], mac[1] = (u8) macaddr[1]; ++ mac[2] = (u8) macaddr[2], mac[3] = (u8) macaddr[3]; ++ mac[4] = (u8) macaddr[4], mac[5] = (u8) macaddr[5]; ++ return 0; ++} ++ ++static int __string2str(u8 * path, void *val, u32 arg) ++{ ++ u8 *temp = (u8 *) val; ++ sprintf(temp, "%s", path); ++ return 0; ++} ++ ++static int __string2configuration(u8 * mac_str, void *val, u32 arg) ++{ ++ unsigned int address, value; ++ int i; ++ i = sscanf(mac_str, "%08x:%08x", &address, &value); ++ if (i != 2) ++ return -1; ++ for (i = 0; i < EXTERNEL_CONFIG_SUPPORT; i++) { ++ if (ssv_cfg.configuration[i][0] == 0x0) { ++ ssv_cfg.configuration[i][0] = address; ++ ssv_cfg.configuration[i][1] = value; ++ return 0; ++ } ++ } ++ return 0; ++} ++ ++struct ssv6xxx_cfg_cmd_table cfg_cmds[] = { ++ {"hw_mac", (void *)&ssv_cfg.maddr[0][0], 0, __string2mac}, ++ {"hw_mac_2", (void *)&ssv_cfg.maddr[1][0], 0, __string2mac}, ++ {"def_chan", (void *)&ssv_cfg.def_chan, 0, __string2u32}, ++ {"hw_cap_ht", (void *)&ssv_cfg.hw_caps, 0, __string2flag32}, ++ {"hw_cap_gf", (void *)&ssv_cfg.hw_caps, 1, __string2flag32}, ++ {"hw_cap_2ghz", (void *)&ssv_cfg.hw_caps, 2, __string2flag32}, ++ {"hw_cap_5ghz", (void *)&ssv_cfg.hw_caps, 3, __string2flag32}, ++ {"hw_cap_security", (void *)&ssv_cfg.hw_caps, 4, __string2flag32}, ++ {"hw_cap_sgi_20", (void *)&ssv_cfg.hw_caps, 5, __string2flag32}, ++ {"hw_cap_sgi_40", (void *)&ssv_cfg.hw_caps, 6, __string2flag32}, ++ {"hw_cap_ap", (void *)&ssv_cfg.hw_caps, 7, __string2flag32}, ++ {"hw_cap_p2p", (void *)&ssv_cfg.hw_caps, 8, __string2flag32}, ++ {"hw_cap_ampdu_rx", (void *)&ssv_cfg.hw_caps, 9, __string2flag32}, ++ {"hw_cap_ampdu_tx", (void *)&ssv_cfg.hw_caps, 10, __string2flag32}, ++ {"hw_cap_tdls", (void *)&ssv_cfg.hw_caps, 11, __string2flag32}, ++ {"use_wpa2_only", (void *)&ssv_cfg.use_wpa2_only, 0, __string2u32}, ++ {"wifi_tx_gain_level_gn", (void *)&ssv_cfg.wifi_tx_gain_level_gn, 0, ++ __string2u32}, ++ {"wifi_tx_gain_level_b", (void *)&ssv_cfg.wifi_tx_gain_level_b, 0, ++ __string2u32}, ++ {"rssi_ctl", (void *)&ssv_cfg.rssi_ctl, 0, __string2u32}, ++ {"xtal_clock", (void *)&ssv_cfg.crystal_type, 0, __string2u32}, ++ {"volt_regulator", (void *)&ssv_cfg.volt_regulator, 0, __string2u32}, ++ {"force_chip_identity", (void *)&ssv_cfg.force_chip_identity, 0, ++ __string2u32}, ++ {"firmware_path", (void *)&ssv_cfg.firmware_path[0], 0, __string2str}, ++ {"flash_bin_path", (void *)&ssv_cfg.flash_bin_path[0], 0, __string2str}, ++ {"mac_address_path", (void *)&ssv_cfg.mac_address_path[0], 0, ++ __string2str}, ++ {"mac_output_path", (void *)&ssv_cfg.mac_output_path[0], 0, ++ __string2str}, ++ {"ignore_efuse_mac", (void *)&ssv_cfg.ignore_efuse_mac, 0, ++ __string2u32}, ++ {"mac_address_mode", (void *)&ssv_cfg.mac_address_mode, 0, ++ __string2u32}, ++ {"sr_bhvr", (void *)&ssv_cfg.sr_bhvr, 0, __string2u32}, ++ {"register", NULL, 0, __string2configuration}, ++ {NULL, NULL, 0, NULL}, ++}; ++ ++EXPORT_SYMBOL(cfg_cmds); ++static int ssv_cmd_cfg(int argc, char *argv[]) ++{ ++ char temp_buf[64]; ++ int s; ++ if (argc == 2 && strcmp(argv[1], "reset") == 0) { ++ memset(&ssv_cfg, 0, sizeof(ssv_cfg)); ++ return 0; ++ } else if (argc == 2 && strcmp(argv[1], "show") == 0) { ++ strcpy(ssv6xxx_result_buf, ">> ssv6xxx config:\n"); ++ sprintf(temp_buf, " hw_caps = 0x%08x\n", ssv_cfg.hw_caps); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ sprintf(temp_buf, " def_chan = %d\n", ssv_cfg.def_chan); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ sprintf(temp_buf, " wifi_tx_gain_level_gn = %d\n", ++ ssv_cfg.wifi_tx_gain_level_gn); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ sprintf(temp_buf, " wifi_tx_gain_level_b = %d\n", ++ ssv_cfg.wifi_tx_gain_level_b); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ sprintf(temp_buf, " rssi_ctl = %d\n", ssv_cfg.rssi_ctl); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ sprintf(temp_buf, " sr_bhvr = %d\n", ssv_cfg.sr_bhvr); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ sprintf(temp_buf, " sta-mac = %02x:%02x:%02x:%02x:%02x:%02x", ++ ssv_cfg.maddr[0][0], ssv_cfg.maddr[0][1], ++ ssv_cfg.maddr[0][2], ssv_cfg.maddr[0][3], ++ ssv_cfg.maddr[0][4], ssv_cfg.maddr[0][5]); ++ strcat(ssv6xxx_result_buf, temp_buf); ++ strcat(ssv6xxx_result_buf, "\n"); ++ return 0; ++ } ++ if (argc != 4) ++ return -1; ++ for (s = 0; cfg_cmds[s].cfg_cmd != NULL; s++) { ++ if (strcmp(cfg_cmds[s].cfg_cmd, argv[1]) == 0) { ++ cfg_cmds[s].translate_func(argv[3], ++ cfg_cmds[s].var, ++ cfg_cmds[s].arg); ++ strcpy(ssv6xxx_result_buf, ""); ++ return 0; ++ } ++ } ++ return -1; ++} ++ ++void *ssv_dbg_phy_table = NULL; ++EXPORT_SYMBOL(ssv_dbg_phy_table); ++u32 ssv_dbg_phy_len = 0; ++EXPORT_SYMBOL(ssv_dbg_phy_len); ++void *ssv_dbg_rf_table = NULL; ++EXPORT_SYMBOL(ssv_dbg_rf_table); ++u32 ssv_dbg_rf_len = 0; ++EXPORT_SYMBOL(ssv_dbg_rf_len); ++struct ssv_softc *ssv_dbg_sc = NULL; ++EXPORT_SYMBOL(ssv_dbg_sc); ++struct ssv6xxx_hci_ctrl *ssv_dbg_ctrl_hci = NULL; ++EXPORT_SYMBOL(ssv_dbg_ctrl_hci); ++struct Dump_Sta_Info { ++ char *dump_buf; ++ int sta_idx; ++}; ++static void _dump_sta_info(struct ssv_softc *sc, ++ struct ssv_vif_info *vif_info, ++ struct ssv_sta_info *sta_info, void *param) ++{ ++ char tmpbf[128]; ++ struct Dump_Sta_Info *dump_sta_info = (struct Dump_Sta_Info *)param; ++ struct ssv_sta_priv_data *priv_sta = ++ (struct ssv_sta_priv_data *)sta_info->sta->drv_priv; ++ if ((sta_info->s_flags & STA_FLAG_VALID) == 0) ++ sprintf(tmpbf, ++ " Station %d: %d is not valid\n", ++ dump_sta_info->sta_idx, priv_sta->sta_idx); ++ else ++ sprintf(tmpbf, ++ " Station %d: %d\n" ++ " Address: %02X:%02X:%02X:%02X:%02X:%02X\n" ++ " WISD: %d\n" ++ " AID: %d\n" ++ " Sleep: %d\n", ++ dump_sta_info->sta_idx, priv_sta->sta_idx, ++ sta_info->sta->addr[0], sta_info->sta->addr[1], ++ sta_info->sta->addr[2], sta_info->sta->addr[3], ++ sta_info->sta->addr[4], sta_info->sta->addr[5], ++ sta_info->hw_wsid, sta_info->aid, sta_info->sleeping); ++ dump_sta_info->sta_idx++; ++ strcat(dump_sta_info->dump_buf, tmpbf); ++} ++ ++void ssv6xxx_dump_sta_info(struct ssv_softc *sc, char *target_buf) ++{ ++ int j; ++ char tmpbf[128]; ++ struct Dump_Sta_Info dump_sta_info = { target_buf, 0 }; ++ sprintf(tmpbf, " >>>> bcast queue len[%d]\n", sc->bcast_txq.cur_qsize); ++ strcat(target_buf, tmpbf); ++ for (j = 0; j < SSV6200_MAX_VIF; j++) { ++ struct ieee80211_vif *vif = sc->vif_info[j].vif; ++ struct ssv_vif_priv_data *priv_vif; ++ struct ssv_sta_priv_data *sta_priv_iter; ++ if (vif == NULL) { ++ sprintf(tmpbf, " VIF: %d is not used.\n", j); ++ strcat(target_buf, tmpbf); ++ continue; ++ } ++ sprintf(tmpbf, ++ " VIF: %d - [%02X:%02X:%02X:%02X:%02X:%02X] type[%d] p2p[%d]\n", ++ j, vif->addr[0], vif->addr[1], vif->addr[2], ++ vif->addr[3], vif->addr[4], vif->addr[5], vif->type, ++ vif->p2p); ++ strcat(target_buf, tmpbf); ++ priv_vif = (struct ssv_vif_priv_data *)(vif->drv_priv); ++ list_for_each_entry(sta_priv_iter, &priv_vif->sta_list, list) { ++ if ((sta_priv_iter->sta_info-> ++ s_flags & STA_FLAG_VALID) == 0) { ++ sprintf(tmpbf, " VIF: %d is not valid.\n", ++ j); ++ strcat(target_buf, tmpbf); ++ continue; ++ } ++ _dump_sta_info(sc, &sc->vif_info[priv_vif->vif_idx], ++ sta_priv_iter->sta_info, &dump_sta_info); ++ } ++ } ++} ++ ++static int ssv_cmd_sta(int argc, char *argv[]) ++{ ++ if (argc >= 2 && strcmp(argv[1], "show") == 0) ++ ssv6xxx_dump_sta_info(ssv_dbg_sc, ssv6xxx_result_buf); ++ else ++ strcat(ssv6xxx_result_buf, "sta show\n\n"); ++ return 0; ++} ++ ++static int ssv_cmd_dump(int argc, char *argv[]) ++{ ++ u32 addr, regval; ++ char tmpbf[64]; ++ int s; ++ if (!ssv6xxx_result_buf) { ++ pr_warn("ssv6xxx_result_buf = NULL!!\n"); ++ return -1; ++ } ++ if (argc != 2) { ++ sprintf(tmpbf, ++ "dump [wsid|decision|phy-info|phy-reg|rf-reg]\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ return 0; ++ } ++ if (strcmp(argv[1], "wsid") == 0) { ++ const u32 reg_wsid[] = { ADR_WSID0, ADR_WSID1 }; ++ const u32 reg_wsid_tid0[] = ++ { ADR_WSID0_TID0_RX_SEQ, ADR_WSID1_TID0_RX_SEQ }; ++ const u32 reg_wsid_tid7[] = ++ { ADR_WSID0_TID7_RX_SEQ, ADR_WSID1_TID7_RX_SEQ }; ++ const u8 *op_mode_str[] = { "STA", "AP", "AD-HOC", "WDS" }; ++ const u8 *ht_mode_str[] = ++ { "Non-HT", "HT-MF", "HT-GF", "RSVD" }; ++ for (s = 0; s < SSV_NUM_HW_STA; s++) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, reg_wsid[s], ®val)) ; ++ sprintf(tmpbf, ++ "==>WSID[%d]\n\tvalid[%d] qos[%d] op_mode[%s] ht_mode[%s]\n", ++ s, regval & 0x1, (regval >> 1) & 0x1, ++ op_mode_str[((regval >> 2) & 3)], ++ ht_mode_str[((regval >> 4) & 3)]); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, reg_wsid[s] + 4, ®val)) ; ++ sprintf(tmpbf, "\tMAC[%02x:%02x:%02x:%02x:", ++ (regval & 0xff), ((regval >> 8) & 0xff), ++ ((regval >> 16) & 0xff), ++ ((regval >> 24) & 0xff)); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, reg_wsid[s] + 8, ®val)) ; ++ sprintf(tmpbf, "%02x:%02x]\n", (regval & 0xff), ++ ((regval >> 8) & 0xff)); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ for (addr = reg_wsid_tid0[s]; addr <= reg_wsid_tid7[s]; ++ addr += 4) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, addr, ®val)) ; ++ sprintf(tmpbf, "\trx_seq%d[%d]\n", ++ ((addr - reg_wsid_tid0[s]) >> 2), ++ ((regval) & 0xffff)); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ } ++ return 0; ++ } ++ if (strcmp(argv[1], "decision") == 0) { ++ strcpy(ssv6xxx_result_buf, ">> Decision Table:\n"); ++ for (s = 0, addr = ADR_MRX_FLT_TB0; s < 16; s++, addr += 4) { ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, ®val)) ; ++ sprintf(tmpbf, " [%d]: ADDR[0x%08x] = 0x%08x\n", ++ s, addr, regval); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ strcat(ssv6xxx_result_buf, "\n\n>> Decision Mask:\n"); ++ for (s = 0, addr = ADR_MRX_FLT_EN0; s < 9; s++, addr += 4) { ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, ®val)) ; ++ sprintf(tmpbf, " [%d]: ADDR[0x%08x] = 0x%08x\n", ++ s, addr, regval); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ strcat(ssv6xxx_result_buf, "\n\n"); ++ return 0; ++ } ++ if (strcmp(argv[1], "phy-info") == 0) { ++ return 0; ++ } ++ if (strcmp(argv[1], "phy-reg") == 0) { ++ struct ssv6xxx_dev_table *raw; ++ raw = (struct ssv6xxx_dev_table *)ssv_dbg_phy_table; ++ strcpy(ssv6xxx_result_buf, ">> PHY Register Table:\n"); ++ for (s = 0; s < ssv_dbg_phy_len; s++, raw++) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, raw->address, ®val)) ; ++ sprintf(tmpbf, " ADDR[0x%08x] = 0x%08x\n", ++ raw->address, regval); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ strcat(ssv6xxx_result_buf, "\n\n"); ++ return 0; ++ } ++ if (strcmp(argv[1], "rf-reg") == 0) { ++ struct ssv6xxx_dev_table *raw; ++ raw = (struct ssv6xxx_dev_table *)ssv_dbg_rf_table; ++ strcpy(ssv6xxx_result_buf, ">> RF Register Table:\n"); ++ for (s = 0; s < ssv_dbg_rf_len; s++, raw++) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, raw->address, ®val)) ; ++ sprintf(tmpbf, " ADDR[0x%08x] = 0x%08x\n", ++ raw->address, regval); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ strcat(ssv6xxx_result_buf, "\n\n"); ++ return 0; ++ } ++ return -1; ++} ++ ++static int ssv_cmd_irq(int argc, char *argv[]) ++{ ++ char *endp; ++ u32 irq_sts; ++ if (argc >= 3 && strcmp(argv[1], "set") == 0) { ++ if (strcmp(argv[2], "mask") == 0 && argc == 4) { ++ irq_sts = simple_strtoul(argv[3], &endp, 16); ++ if (!ssv6xxx_debug_ifops->ifops->irq_setmask) { ++ sprintf(ssv6xxx_result_buf, ++ "The interface doesn't provide irq_setmask operation.\n"); ++ return 0; ++ } ++ ssv6xxx_debug_ifops->ifops-> ++ irq_setmask(ssv6xxx_debug_ifops->dev, irq_sts); ++ sprintf(ssv6xxx_result_buf, ++ "set sdio irq mask to 0x%08x\n", irq_sts); ++ return 0; ++ } ++ if (strcmp(argv[2], "enable") == 0) { ++ if (!ssv6xxx_debug_ifops->ifops->irq_enable) { ++ sprintf(ssv6xxx_result_buf, ++ "The interface doesn't provide irq_enable operation.\n"); ++ return 0; ++ } ++ ssv6xxx_debug_ifops->ifops-> ++ irq_enable(ssv6xxx_debug_ifops->dev); ++ strcpy(ssv6xxx_result_buf, "enable sdio irq.\n"); ++ return 0; ++ } ++ if (strcmp(argv[2], "disable") == 0) { ++ if (!ssv6xxx_debug_ifops->ifops->irq_disable) { ++ sprintf(ssv6xxx_result_buf, ++ "The interface doesn't provide irq_disable operation.\n"); ++ return 0; ++ } ++ ssv6xxx_debug_ifops->ifops-> ++ irq_disable(ssv6xxx_debug_ifops->dev, false); ++ strcpy(ssv6xxx_result_buf, "disable sdio irq.\n"); ++ return 0; ++ } ++ return -1; ++ } else if (argc == 3 && strcmp(argv[1], "get") == 0) { ++ if (strcmp(argv[2], "mask") == 0) { ++ if (!ssv6xxx_debug_ifops->ifops->irq_getmask) { ++ sprintf(ssv6xxx_result_buf, ++ "The interface doesn't provide irq_getmask operation.\n"); ++ return 0; ++ } ++ ssv6xxx_debug_ifops->ifops-> ++ irq_getmask(ssv6xxx_debug_ifops->dev, &irq_sts); ++ sprintf(ssv6xxx_result_buf, ++ "sdio irq mask: 0x%08x, int_mask=0x%08x\n", ++ irq_sts, ssv_dbg_ctrl_hci->int_mask); ++ return 0; ++ } ++ if (strcmp(argv[2], "status") == 0) { ++ if (!ssv6xxx_debug_ifops->ifops->irq_getstatus) { ++ sprintf(ssv6xxx_result_buf, ++ "The interface doesn't provide irq_getstatus operation.\n"); ++ return 0; ++ } ++ ssv6xxx_debug_ifops->ifops-> ++ irq_getstatus(ssv6xxx_debug_ifops->dev, &irq_sts); ++ sprintf(ssv6xxx_result_buf, "sdio irq status: 0x%08x\n", ++ irq_sts); ++ return 0; ++ } ++ return -1; ++ } else { ++ sprintf(ssv6xxx_result_buf, ++ "irq [set|get] [mask|enable|disable|status]\n"); ++ } ++ return 0; ++} ++ ++static int ssv_cmd_mac(int argc, char *argv[]) ++{ ++ char temp_str[128], *endp; ++ u32 s; ++ int i; ++ if (argc == 3 && !strcmp(argv[1], "wsid") && !strcmp(argv[2], "show")) { ++ for (s = 0; s < SSV_NUM_HW_STA; s++) { ++ } ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "rx")) { ++ if (!strcmp(argv[2], "enable")) { ++ ssv_dbg_sc->dbg_rx_frame = 1; ++ } else { ++ ssv_dbg_sc->dbg_rx_frame = 0; ++ } ++ sprintf(temp_str, " dbg_rx_frame %d\n", ++ ssv_dbg_sc->dbg_rx_frame); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "tx")) { ++ if (!strcmp(argv[2], "enable")) { ++ ssv_dbg_sc->dbg_tx_frame = 1; ++ } else { ++ ssv_dbg_sc->dbg_tx_frame = 0; ++ } ++ sprintf(temp_str, " dbg_tx_frame %d\n", ++ ssv_dbg_sc->dbg_tx_frame); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "rxq") ++ && !strcmp(argv[2], "show")) { ++ sprintf(temp_str, ">> MAC RXQ: (%s)\n cur_qsize=%d\n", ++ ((ssv_dbg_sc-> ++ sc_flags & SC_OP_OFFCHAN) ? "off channel" : ++ "on channel"), ssv_dbg_sc->rx.rxq_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if (argc == 4 && !strcmp(argv[1], "set") ++ && !strcmp(argv[2], "rate")) { ++ if (strcmp(argv[3], "auto") == 0) { ++ ssv_dbg_sc->sc_flags &= ~SC_OP_FIXED_RATE; ++ return 0; ++ } ++ i = simple_strtoul(argv[3], &endp, 10); ++ if (i < 0 || i > 38) { ++ strcpy(ssv6xxx_result_buf, " Invalid rat index !!\n"); ++ return -1; ++ } ++ ssv_dbg_sc->max_rate_idx = i; ++ ssv_dbg_sc->sc_flags |= SC_OP_FIXED_RATE; ++ sprintf(temp_str, " Set rate to index %d\n", i); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "get") ++ && !strcmp(argv[2], "rate")) { ++ if (ssv_dbg_sc->sc_flags & SC_OP_FIXED_RATE) ++ sprintf(temp_str, " Current Rate Index: %d\n", ++ ssv_dbg_sc->max_rate_idx); ++ else ++ sprintf(temp_str, " Current Rate Index: auto\n"); ++ strcpy(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else { ++ sprintf(temp_str, "mac [security|wsid|rxq] [show]\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "mac [set|get] [rate] [auto|idx]\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "mac [rx|tx] [eable|disable]\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ return 0; ++} ++ ++#ifdef CONFIG_IRQ_DEBUG_COUNT ++void print_irq_count(void) ++{ ++ char temp_str[512]; ++ sprintf(temp_str, "irq debug (%s)\n", ++ ssv_dbg_ctrl_hci->irq_enable ? "enable" : "disable"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "total irq (%d)\n", ssv_dbg_ctrl_hci->irq_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "invalid irq (%d)\n", ++ ssv_dbg_ctrl_hci->invalid_irq_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "rx irq (%d)\n", ssv_dbg_ctrl_hci->rx_irq_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "tx irq (%d)\n", ssv_dbg_ctrl_hci->tx_irq_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "real tx count irq (%d)\n", ++ ssv_dbg_ctrl_hci->real_tx_irq_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "tx packet count (%d)\n", ++ ssv_dbg_ctrl_hci->irq_tx_pkt_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "rx packet (%d)\n", ++ ssv_dbg_ctrl_hci->irq_rx_pkt_count); ++ strcat(ssv6xxx_result_buf, temp_str); ++} ++#endif ++void print_isr_info(void) ++{ ++ char temp_str[512]; ++ sprintf(temp_str, ">>>> HCI Calculate ISR TIME(%s) unit:us\n", ++ ((ssv_dbg_ctrl_hci->isr_summary_eable) ? "enable" : "disable")); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "isr_routine_time(%d)\n", ++ jiffies_to_usecs(ssv_dbg_ctrl_hci->isr_routine_time)); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "isr_tx_time(%d)\n", ++ jiffies_to_usecs(ssv_dbg_ctrl_hci->isr_tx_time)); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "isr_rx_time(%d)\n", ++ jiffies_to_usecs(ssv_dbg_ctrl_hci->isr_rx_time)); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "isr_idle_time(%d)\n", ++ jiffies_to_usecs(ssv_dbg_ctrl_hci->isr_idle_time)); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "isr_rx_idle_time(%d)\n", ++ jiffies_to_usecs(ssv_dbg_ctrl_hci->isr_rx_idle_time)); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "isr_miss_cnt(%d)\n", ssv_dbg_ctrl_hci->isr_miss_cnt); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "prev_isr_jiffes(%lu)\n", ++ ssv_dbg_ctrl_hci->prev_isr_jiffes); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "prev_rx_isr_jiffes(%lu)\n", ++ ssv_dbg_ctrl_hci->prev_rx_isr_jiffes); ++ strcat(ssv6xxx_result_buf, temp_str); ++} ++ ++static int ssv_cmd_hci(int argc, char *argv[]) ++{ ++ struct ssv_hw_txq *txq; ++ char temp_str[512]; ++ int s, ac = 0; ++ if (argc == 3 && !strcmp(argv[1], "txq") && !strcmp(argv[2], "show")) { ++ for (s = 0; s < WMM_NUM_AC; s++) { ++ if (ssv_dbg_sc != NULL) ++ ac = ssv_dbg_sc->tx.ac_txqid[s]; ++ txq = &ssv_dbg_ctrl_hci->hw_txq[s]; ++ sprintf(temp_str, ">> txq[%d]", txq->txq_no); ++ if (ssv_dbg_sc != NULL) ++ sprintf(temp_str, "(%s): ", ++ ((ssv_dbg_sc-> ++ sc_flags & SC_OP_OFFCHAN) ? ++ "off channel" : "on channel")); ++ sprintf(temp_str, "cur_qsize=%d\n", ++ skb_queue_len(&txq->qhead)); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, ++ " max_qsize=%d, pause=%d, resume_thres=%d", ++ txq->max_qsize, txq->paused, txq->resum_thres); ++ if (ssv_dbg_sc != NULL) ++ sprintf(temp_str, " flow_control[%d]\n", ++ !!(ssv_dbg_sc->tx. ++ flow_ctrl_status & (1 << ac))); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " Total %d frame sent\n", ++ txq->tx_pkt); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ sprintf(temp_str, ++ ">> HCI Debug Counters:\n read_rs0_info_fail=%d, read_rs1_info_fail=%d\n", ++ ssv_dbg_ctrl_hci->read_rs0_info_fail, ++ ssv_dbg_ctrl_hci->read_rs1_info_fail); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, ++ " rx_work_running=%d, isr_running=%d, xmit_running=%d\n", ++ ssv_dbg_ctrl_hci->rx_work_running, ++ ssv_dbg_ctrl_hci->isr_running, ++ ssv_dbg_ctrl_hci->xmit_running); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if (ssv_dbg_sc != NULL) ++ sprintf(temp_str, " flow_ctrl_status=%08x\n", ++ ssv_dbg_sc->tx.flow_ctrl_status); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "rxq") ++ && !strcmp(argv[2], "show")) { ++ sprintf(temp_str, ">> HCI RX Queue (%s): cur_qsize=%d\n", ++ ((ssv_dbg_sc-> ++ sc_flags & SC_OP_OFFCHAN) ? "off channel" : ++ "on channel"), ssv_dbg_ctrl_hci->rx_pkt); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "isr_time") ++ && !strcmp(argv[2], "start")) { ++ ssv_dbg_ctrl_hci->isr_summary_eable = 1; ++ ssv_dbg_ctrl_hci->isr_routine_time = 0; ++ ssv_dbg_ctrl_hci->isr_tx_time = 0; ++ ssv_dbg_ctrl_hci->isr_rx_time = 0; ++ ssv_dbg_ctrl_hci->isr_idle_time = 0; ++ ssv_dbg_ctrl_hci->isr_rx_idle_time = 0; ++ ssv_dbg_ctrl_hci->isr_miss_cnt = 0; ++ ssv_dbg_ctrl_hci->prev_isr_jiffes = 0; ++ ssv_dbg_ctrl_hci->prev_rx_isr_jiffes = 0; ++ print_isr_info(); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "isr_time") ++ && !strcmp(argv[2], "stop")) { ++ ssv_dbg_ctrl_hci->isr_summary_eable = 0; ++ print_isr_info(); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "isr_time") ++ && !strcmp(argv[2], "show")) { ++ print_isr_info(); ++ return 0; ++ } ++#ifdef CONFIG_IRQ_DEBUG_COUNT ++ else if (argc == 3 && !strcmp(argv[1], "isr_debug") ++ && !strcmp(argv[2], "reset")) { ++ ssv_dbg_ctrl_hci->irq_enable = 0; ++ ssv_dbg_ctrl_hci->irq_count = 0; ++ ssv_dbg_ctrl_hci->invalid_irq_count = 0; ++ ssv_dbg_ctrl_hci->tx_irq_count = 0; ++ ssv_dbg_ctrl_hci->real_tx_irq_count = 0; ++ ssv_dbg_ctrl_hci->rx_irq_count = 0; ++ ssv_dbg_ctrl_hci->isr_rx_idle_time = 0; ++ ssv_dbg_ctrl_hci->irq_rx_pkt_count = 0; ++ ssv_dbg_ctrl_hci->irq_tx_pkt_count = 0; ++ strcat(ssv6xxx_result_buf, "irq debug reset count\n"); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "isr_debug") ++ && !strcmp(argv[2], "show")) { ++ print_irq_count(); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "isr_debug") ++ && !strcmp(argv[2], "stop")) { ++ ssv_dbg_ctrl_hci->irq_enable = 0; ++ strcat(ssv6xxx_result_buf, "irq debug stop\n"); ++ return 0; ++ } else if (argc == 3 && !strcmp(argv[1], "isr_debug") ++ && !strcmp(argv[2], "start")) { ++ ssv_dbg_ctrl_hci->irq_enable = 1; ++ strcat(ssv6xxx_result_buf, "irq debug start\n"); ++ return 0; ++ } ++#endif ++ else { ++ strcat(ssv6xxx_result_buf, ++ "hci [txq|rxq] [show]\nhci [isr_time] [start|stop|show]\n\n"); ++ return 0; ++ } ++ return -1; ++} ++ ++static int ssv_cmd_hwq(int argc, char *argv[]) ++{ ++#undef GET_FFO0_CNT ++#undef GET_FFO1_CNT ++#undef GET_FFO2_CNT ++#undef GET_FFO3_CNT ++#undef GET_FFO4_CNT ++#undef GET_FFO5_CNT ++#undef GET_FFO6_CNT ++#undef GET_FFO7_CNT ++#undef GET_FFO8_CNT ++#undef GET_FFO9_CNT ++#undef GET_FFO10_CNT ++#undef GET_FFO11_CNT ++#undef GET_FFO12_CNT ++#undef GET_FFO13_CNT ++#undef GET_FFO14_CNT ++#undef GET_FFO15_CNT ++#undef GET_FF0_CNT ++#undef GET_FF1_CNT ++#undef GET_FF3_CNT ++#undef GET_FF5_CNT ++#undef GET_FF6_CNT ++#undef GET_FF7_CNT ++#undef GET_FF8_CNT ++#undef GET_FF9_CNT ++#undef GET_FF10_CNT ++#undef GET_FF11_CNT ++#undef GET_FF12_CNT ++#undef GET_FF13_CNT ++#undef GET_FF14_CNT ++#undef GET_FF15_CNT ++#undef GET_FF4_CNT ++#undef GET_FF2_CNT ++#undef GET_TX_ID_ALC_LEN ++#undef GET_RX_ID_ALC_LEN ++#undef GET_AVA_TAG ++#define GET_FFO0_CNT ((value & 0x0000001f ) >> 0) ++#define GET_FFO1_CNT ((value & 0x000003e0 ) >> 5) ++#define GET_FFO2_CNT ((value & 0x00000c00 ) >> 10) ++#define GET_FFO3_CNT ((value & 0x000f8000 ) >> 15) ++#define GET_FFO4_CNT ((value & 0x00300000 ) >> 20) ++#define GET_FFO5_CNT ((value & 0x0e000000 ) >> 25) ++#define GET_FFO6_CNT ((value1 & 0x0000000f ) >> 0) ++#define GET_FFO7_CNT ((value1 & 0x000003e0 ) >> 5) ++#define GET_FFO8_CNT ((value1 & 0x00007c00 ) >> 10) ++#define GET_FFO9_CNT ((value1 & 0x000f8000 ) >> 15) ++#define GET_FFO10_CNT ((value1 & 0x00f00000 ) >> 20) ++#define GET_FFO11_CNT ((value1 & 0x3e000000 ) >> 25) ++#define GET_FFO12_CNT ((value2 & 0x00000007 ) >> 0) ++#define GET_FFO13_CNT ((value2 & 0x00000060 ) >> 5) ++#define GET_FFO14_CNT ((value2 & 0x00000c00 ) >> 10) ++#define GET_FFO15_CNT ((value2 & 0x001f8000 ) >> 15) ++#define GET_FF0_CNT ((value & 0x0000001f ) >> 0) ++#define GET_FF1_CNT ((value & 0x000001e0 ) >> 5) ++#define GET_FF3_CNT ((value & 0x00003800 ) >> 11) ++#define GET_FF5_CNT ((value & 0x000e0000 ) >> 17) ++#define GET_FF6_CNT ((value & 0x00700000 ) >> 20) ++#define GET_FF7_CNT ((value & 0x03800000 ) >> 23) ++#define GET_FF8_CNT ((value & 0x1c000000 ) >> 26) ++#define GET_FF9_CNT ((value & 0xe0000000 ) >> 29) ++#define GET_FF10_CNT ((value1 & 0x00000007 ) >> 0) ++#define GET_FF11_CNT ((value1 & 0x00000038 ) >> 3) ++#define GET_FF12_CNT ((value1 & 0x000001c0 ) >> 6) ++#define GET_FF13_CNT ((value1 & 0x00000600 ) >> 9) ++#define GET_FF14_CNT ((value1 & 0x00001800 ) >> 11) ++#define GET_FF15_CNT ((value1 & 0x00006000 ) >> 13) ++#define GET_FF4_CNT ((value1 & 0x000f8000 ) >> 15) ++#define GET_FF2_CNT ((value1 & 0x00700000 ) >> 20) ++#define GET_TX_ID_ALC_LEN ((value & 0x0003fe00 ) >> 9) ++#define GET_RX_ID_ALC_LEN ((value & 0x07fc0000 ) >> 18) ++#define GET_AVA_TAG ((value1 & 0x01ff0000 ) >> 16) ++ u32 addr, value, value1, value2; ++ char temp_str[512]; ++ addr = ADR_RD_FFOUT_CNT1; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value)) ; ++ addr = ADR_RD_FFOUT_CNT2; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value1)) ; ++ addr = ADR_RD_FFOUT_CNT3; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value2)) ; ++ sprintf(temp_str, ++ "\n[TAG] MCU - HCI - SEC - RX - MIC - TX0 - TX1 - TX2 - TX3 - TX4 - SEC - MIC - TSH\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, ++ "OUTPUT %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d\n", ++ GET_FFO0_CNT, GET_FFO1_CNT, GET_FFO3_CNT, GET_FFO4_CNT, ++ GET_FFO5_CNT, GET_FFO6_CNT, GET_FFO7_CNT, GET_FFO8_CNT, ++ GET_FFO9_CNT, GET_FFO10_CNT, GET_FFO11_CNT, GET_FFO12_CNT, ++ GET_FFO15_CNT); ++ strcat(ssv6xxx_result_buf, temp_str); ++ addr = ADR_RD_IN_FFCNT1; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value)) ; ++ addr = ADR_RD_IN_FFCNT2; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value1)) ; ++ sprintf(temp_str, ++ "INPUT %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d - %3d\n", ++ GET_FF0_CNT, GET_FF1_CNT, GET_FF3_CNT, GET_FF4_CNT, GET_FF5_CNT, ++ GET_FF6_CNT, GET_FF7_CNT, GET_FF8_CNT, GET_FF9_CNT, ++ GET_FF10_CNT, GET_FF11_CNT, GET_FF12_CNT, GET_FF15_CNT); ++ strcat(ssv6xxx_result_buf, temp_str); ++ addr = ADR_ID_LEN_THREADSHOLD2; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value)) ; ++ addr = ADR_TAG_STATUS; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value1)) ; ++ sprintf(temp_str, "TX[%d]RX[%d]AVA[%d]\n", GET_TX_ID_ALC_LEN, ++ GET_RX_ID_ALC_LEN, GET_AVA_TAG); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++} ++ ++#ifdef CONFIG_P2P_NOA ++static struct ssv6xxx_p2p_noa_param cmd_noa_param = { ++ 50, ++ 100, ++ 0x12345678, ++ 1, ++ 255, ++ {0x4c, 0xe6, 0x76, 0xa2, 0x4e, 0x7c} ++}; ++ ++void noa_dump(char *temp_str) ++{ ++ sprintf(temp_str, ++ "NOA Parameter:\nEnable=%d\nInterval=%d\nDuration=%d\nStart_time=0x%08x\nCount=%d\nAddr=[%02x:%02x:%02x:%02x:%02x:%02x]\n", ++ cmd_noa_param.enable, cmd_noa_param.interval, ++ cmd_noa_param.duration, cmd_noa_param.start_time, ++ cmd_noa_param.count, cmd_noa_param.addr[0], ++ cmd_noa_param.addr[1], cmd_noa_param.addr[2], ++ cmd_noa_param.addr[3], cmd_noa_param.addr[4], ++ cmd_noa_param.addr[5]); ++ strcat(ssv6xxx_result_buf, temp_str); ++} ++ ++void ssv6xxx_send_noa_cmd(struct ssv_softc *sc, ++ struct ssv6xxx_p2p_noa_param *p2p_noa_param) ++{ ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ int retry_cnt = 5; ++ skb = ++ ssvdevice_skb_alloc(HOST_CMD_HDR_LEN + ++ sizeof(struct ssv6xxx_p2p_noa_param)); ++ skb->data_len = HOST_CMD_HDR_LEN + sizeof(struct ssv6xxx_p2p_noa_param); ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_SET_NOA; ++ host_cmd->len = skb->data_len; ++ memcpy(host_cmd->dat32, p2p_noa_param, ++ sizeof(struct ssv6xxx_p2p_noa_param)); ++ while ((HCI_SEND_CMD(sc->sh, skb) != 0) && (retry_cnt)) { ++ pr_debug("NOA cmd retry=%d\n", retry_cnt); ++ retry_cnt--; ++ } ++ ssvdevice_skb_free(skb); ++} ++ ++static int ssv_cmd_noa(int argc, char *argv[]) ++{ ++ char temp_str[512]; ++ char *endp; ++ if (argc == 2 && !strcmp(argv[1], "show")) { ++ ; ++ } else if (argc == 3 && !strcmp(argv[1], "duration")) { ++ cmd_noa_param.duration = simple_strtoul(argv[2], &endp, 0); ++ } else if (argc == 3 && !strcmp(argv[1], "interval")) { ++ cmd_noa_param.interval = simple_strtoul(argv[2], &endp, 0); ++ } else if (argc == 3 && !strcmp(argv[1], "start")) { ++ cmd_noa_param.start_time = simple_strtoul(argv[2], &endp, 0); ++ } else if (argc == 3 && !strcmp(argv[1], "enable")) { ++ cmd_noa_param.enable = simple_strtoul(argv[2], &endp, 0); ++ } else if (argc == 3 && !strcmp(argv[1], "count")) { ++ cmd_noa_param.count = simple_strtoul(argv[2], &endp, 0); ++ } else if (argc == 8 && !strcmp(argv[1], "addr")) { ++ cmd_noa_param.addr[0] = simple_strtoul(argv[2], &endp, 16); ++ cmd_noa_param.addr[1] = simple_strtoul(argv[3], &endp, 16); ++ cmd_noa_param.addr[2] = simple_strtoul(argv[4], &endp, 16); ++ cmd_noa_param.addr[3] = simple_strtoul(argv[5], &endp, 16); ++ cmd_noa_param.addr[4] = simple_strtoul(argv[6], &endp, 16); ++ cmd_noa_param.addr[5] = simple_strtoul(argv[7], &endp, 16); ++ } else if (argc == 2 && !strcmp(argv[1], "send")) { ++ ssv6xxx_send_noa_cmd(ssv_dbg_sc, &cmd_noa_param); ++ } else { ++ sprintf(temp_str, "## wrong command\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } ++ noa_dump(temp_str); ++ return 0; ++} ++#endif ++static int ssv_cmd_mib(int argc, char *argv[]) ++{ ++ u32 addr, value; ++ char temp_str[512]; ++ int i; ++ if (argc == 2 && !strcmp(argv[1], "reset")) { ++ addr = MIB_REG_BASE; ++ value = 0x0; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, MIB_REG_BASE, value)) ; ++ value = 0xffffffff; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, MIB_REG_BASE, value)) ; ++ value = 0x0; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, 0xCE0023F8, value)) ; ++ value = 0x100000; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, 0xCE0023F8, value)) ; ++ value = 0x0; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, 0xCE0043F8, value)) ; ++ value = 0x100000; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, 0xCE0043F8, value)) ; ++ value = 0x0; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, 0xCE000088, value)) ; ++ value = 0x80000000; ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, 0xCE000088, value)) ; ++ sprintf(temp_str, " => MIB reseted\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if (argc == 2 && !strcmp(argv[1], "list")) { ++ addr = MIB_REG_BASE; ++ for (i = 0; i < 120; i++, addr += 4) { ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value)) ; ++ sprintf(temp_str, "%08x ", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if (((i + 1) & 0x07) == 0) ++ strcat(ssv6xxx_result_buf, "\n"); ++ } ++ strcat(ssv6xxx_result_buf, "\n"); ++ } else if (argc == 2 && strcmp(argv[1], "rx") == 0) { ++ sprintf(temp_str, "%-10s\t\t%-10s\t\t%-10s\t\t%-10s\n", ++ "MRX_FCS_SUCC", "MRX_FCS_ERR", "MRX_ALC_FAIL", ++ "MRX_MISS"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_MRX_FCS_SUCC, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_MRX_FCS_ERR, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_MRX_ALC_FAIL, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_MRX_MISS, &value)) { ++ sprintf(temp_str, "[%08x]\n", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "%-10s\t\t%-10s\t\t%-10s\t%-10s\n", ++ "MRX_MB_MISS", "MRX_NIDLE_MISS", ++ "DBG_LEN_ALC_FAIL", "DBG_LEN_CRC_FAIL"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_MRX_MB_MISS, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_MRX_NIDLE_MISS, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_DBG_LEN_ALC_FAIL, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_DBG_LEN_CRC_FAIL, &value)) { ++ sprintf(temp_str, "[%08x]\n\n", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_DBG_AMPDU_PASS, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_DBG_AMPDU_FAIL, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_ID_ALC_FAIL1, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ADR_ID_ALC_FAIL2, &value)) { ++ sprintf(temp_str, "[%08x]\n\n", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "PHY B mode:\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "%-10s\t\t%-10s\t\t%-10s\n", ++ "CRC error", "CCA", "counter"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, 0xCE0023E8, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value & 0xffff); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, 0xCE0023EC, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", (value >> 16) & 0xffff); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "[%08x]\t\t\n\n", value & 0xffff); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "PHY G/N mode:\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "%-10s\t\t%-10s\t\t%-10s\n", ++ "CRC error", "CCA", "counter"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, 0xCE0043E8, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", value & 0xffff); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, 0xCE0043EC, &value)) { ++ sprintf(temp_str, "[%08x]\t\t", (value >> 16) & 0xffff); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "[%08x]\t\t\n\n", value & 0xffff); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ } else { ++ sprintf(temp_str, "mib [reset|list|rx]\n\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ return 0; ++} ++ ++static int ssv_cmd_sdio(int argc, char *argv[]) ++{ ++ u32 addr, value; ++ char temp_str[512], *endp; ++ int ret = 0; ++ if (argc == 4 && !strcmp(argv[1], "reg") && !strcmp(argv[2], "r")) { ++ addr = simple_strtoul(argv[3], &endp, 16); ++ if (!ssv6xxx_debug_ifops->ifops->cmd52_read) { ++ sprintf(temp_str, ++ "The interface doesn't provide cmd52 read\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } ++ ret = ++ ssv6xxx_debug_ifops->ifops->cmd52_read(ssv6xxx_debug_ifops-> ++ dev, addr, &value); ++ if (ret >= 0) { ++ sprintf(temp_str, " ==> %x\n", value); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } ++ } else if (argc == 5 && !strcmp(argv[1], "reg") ++ && !strcmp(argv[2], "w")) { ++ addr = simple_strtoul(argv[3], &endp, 16); ++ value = simple_strtoul(argv[4], &endp, 16); ++ if (!ssv6xxx_debug_ifops->ifops->cmd52_write) { ++ sprintf(temp_str, ++ "The interface doesn't provide cmd52 write\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } ++ ret = ++ ssv6xxx_debug_ifops->ifops-> ++ cmd52_write(ssv6xxx_debug_ifops->dev, addr, value); ++ if (ret >= 0) { ++ sprintf(temp_str, " ==> write odne.\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } ++ } ++ sprintf(temp_str, "sdio cmd52 fail: %d\n", ret); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++} ++ ++static struct ssv6xxx_iqk_cfg cmd_iqk_cfg = { ++ SSV6XXX_IQK_CFG_XTAL_26M, ++ SSV6XXX_IQK_CFG_PA_DEF, ++ 0, ++ 0, ++ 26, ++ 3, ++ 0x75, ++ 0x75, ++ 0x80, ++ 0x80, ++ SSV6XXX_IQK_CMD_INIT_CALI, ++ {SSV6XXX_IQK_TEMPERATURE ++ + SSV6XXX_IQK_RXDC ++ + SSV6XXX_IQK_RXRC ++ + SSV6XXX_IQK_TXDC + SSV6XXX_IQK_TXIQ + SSV6XXX_IQK_RXIQ}, ++}; ++ ++static int ssv_cmd_iqk(int argc, char *argv[]) ++{ ++ char temp_str[512], *endp; ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ u32 rxcnt_total, rxcnt_error; ++ sprintf(temp_str, "# got iqk command\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if ((argc == 3) && (strcmp(argv[1], "cfg-pa") == 0)) { ++ cmd_iqk_cfg.cfg_pa = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## set cfg_pa as %d\n", cmd_iqk_cfg.cfg_pa); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if ((argc == 3) && (strcmp(argv[1], "cfg-tssi-trgt") == 0)) { ++ cmd_iqk_cfg.cfg_tssi_trgt = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## set cfg_tssi_trgt as %d\n", ++ cmd_iqk_cfg.cfg_tssi_trgt); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else if ((argc == 3) && (strcmp(argv[1], "init-cali") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_INIT_CALI; ++ cmd_iqk_cfg.fx_sel = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do init-cali\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "rtbl-load") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_RTBL_LOAD; ++ cmd_iqk_cfg.fx_sel = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do rtbl-load\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "rtbl-load-def") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_RTBL_LOAD_DEF; ++ cmd_iqk_cfg.fx_sel = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do rtbl-load\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "rtbl-reset") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_RTBL_RESET; ++ cmd_iqk_cfg.fx_sel = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do rtbl-reset\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "rtbl-set") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_RTBL_SET; ++ cmd_iqk_cfg.fx_sel = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do rtbl-set\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "rtbl-export") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_RTBL_EXPORT; ++ cmd_iqk_cfg.fx_sel = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do rtbl-export\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "tk-evm") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_TK_EVM; ++ cmd_iqk_cfg.argv = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do tk-evm\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "tk-tone") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_TK_TONE; ++ cmd_iqk_cfg.argv = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do tk-tone\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 3) && (strcmp(argv[1], "channel") == 0)) { ++ cmd_iqk_cfg.cmd_sel = SSV6XXX_IQK_CMD_TK_CHCH; ++ cmd_iqk_cfg.argv = simple_strtoul(argv[2], &endp, 0); ++ sprintf(temp_str, "## do change channel\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else if ((argc == 2) && (strcmp(argv[1], "tk-rxcnt-report") == 0)) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, 0xCE0043E8, &rxcnt_error)) ; ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, 0xCE0043EC, &rxcnt_total)) ; ++ sprintf(temp_str, "## GN Rx error rate = (%06d/%06d)\n", ++ rxcnt_error, rxcnt_total); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, 0xCE0023E8, &rxcnt_error)) ; ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, 0xCE0023EC, &rxcnt_total)) ; ++ sprintf(temp_str, "## B Rx error rate = (%06d/%06d)\n", ++ rxcnt_error, rxcnt_total); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } else { ++ sprintf(temp_str, "## invalid iqk command\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "## cmd: cfg-pa/cfg-tssi-trgt\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, ++ "## cmd: init-cali/rtbl-load/rtbl-load-def/rtbl-reset/rtbl-set/rtbl-export/tk-evm/tk-tone/tk-channel\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "## fx_sel: 0x0008: RXDC\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " 0x0010: RXRC\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " 0x0020: TXDC\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " 0x0040: TXIQ\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " 0x0080: RXIQ\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " 0x0100: TSSI\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, " 0x0200: PAPD\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++ } ++ skb = ++ ssvdevice_skb_alloc(HOST_CMD_HDR_LEN + IQK_CFG_LEN + ++ PHY_SETTING_SIZE + RF_SETTING_SIZE); ++ if (skb == NULL) { ++ pr_err("ssv command ssvdevice_skb_alloc failure\n"); ++ return 0; ++ } ++ if ((PHY_SETTING_SIZE > MAX_PHY_SETTING_TABLE_SIZE) || ++ (RF_SETTING_SIZE > MAX_RF_SETTING_TABLE_SIZE)) { ++ pr_err("Please check RF or PHY table size\n"); ++ BUG_ON(1); ++ return 0; ++ } ++ skb->data_len = ++ HOST_CMD_HDR_LEN + IQK_CFG_LEN + PHY_SETTING_SIZE + RF_SETTING_SIZE; ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_INIT_CALI; ++ host_cmd->len = skb->data_len; ++ cmd_iqk_cfg.phy_tbl_size = PHY_SETTING_SIZE; ++ cmd_iqk_cfg.rf_tbl_size = RF_SETTING_SIZE; ++ memcpy(host_cmd->dat32, &cmd_iqk_cfg, IQK_CFG_LEN); ++ memcpy(host_cmd->dat8 + IQK_CFG_LEN, phy_setting, PHY_SETTING_SIZE); ++ memcpy(host_cmd->dat8 + IQK_CFG_LEN + PHY_SETTING_SIZE, asic_rf_setting, ++ RF_SETTING_SIZE); ++ if (ssv_dbg_ctrl_hci->shi->hci_ops->hci_send_cmd(skb) == 0) { ++ sprintf(temp_str, "## hci send cmd success\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } else { ++ sprintf(temp_str, "## hci send cmd fail\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ } ++ ssvdevice_skb_free(skb); ++ return 0; ++} ++ ++#define LBYTESWAP(a) ((((a) & 0x00ff00ff) << 8) | \ ++ (((a) & 0xff00ff00) >> 8)) ++#define LONGSWAP(a) ((LBYTESWAP(a) << 16) | (LBYTESWAP(a) >> 16)) ++static int ssv_cmd_version(int argc, char *argv[]) ++{ ++ char temp_str[256]; ++ u32 regval; ++ u64 chip_tag = 0; ++ char chip_id[24] = ""; ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_IC_TIME_TAG_1, ®val)) ; ++ chip_tag = ((u64) regval << 32); ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_IC_TIME_TAG_0, ®val)) ; ++ chip_tag |= (regval); ++ sprintf(temp_str, "CHIP TAG: %llx \n", chip_tag); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_CHIP_ID_3, ®val)) ; ++ *((u32 *) & chip_id[0]) = (u32) LONGSWAP(regval); ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_CHIP_ID_2, ®val)) ; ++ *((u32 *) & chip_id[4]) = (u32) LONGSWAP(regval); ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_CHIP_ID_1, ®val)) ; ++ *((u32 *) & chip_id[8]) = (u32) LONGSWAP(regval); ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_CHIP_ID_0, ®val)) ; ++ *((u32 *) & chip_id[12]) = (u32) LONGSWAP(regval); ++ sprintf(temp_str, "CHIP ID: %s \n", chip_id); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "# current Software mac version: %d\n", ++ ssv_root_version); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "SVN ROOT URL %s \n", SSV_ROOT_URl); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "COMPILER HOST %s \n", COMPILERHOST); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "COMPILER DATE %s \n", COMPILERDATE); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "COMPILER OS %s \n", COMPILEROS); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "COMPILER OS ARCH %s \n", COMPILEROSARCH); ++ strcat(ssv6xxx_result_buf, temp_str); ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, FW_VERSION_REG, ®val)) ; ++ sprintf(temp_str, "Firmware image version: %d\n", regval); ++ strcat(ssv6xxx_result_buf, temp_str); ++ sprintf(temp_str, "\n[Compiler Option!!]\n"); ++ strcat(ssv6xxx_result_buf, temp_str); ++ return 0; ++} ++ ++static int ssv_cmd_tool(int argc, char *argv[]) ++{ ++ u32 addr, value, count; ++ char tmpbf[12], *endp; ++ int s; ++ if (argc == 4 && strcmp(argv[1], "w") == 0) { ++ addr = simple_strtoul(argv[2], &endp, 16); ++ value = simple_strtoul(argv[3], &endp, 16); ++ if (SSV_REG_WRITE1(ssv6xxx_debug_ifops, addr, value)) ; ++ sprintf(ssv6xxx_result_buf, "ok"); ++ return 0; ++ } ++ if ((argc == 4 || argc == 3) && strcmp(argv[1], "r") == 0) { ++ count = (argc == 3) ? 1 : simple_strtoul(argv[3], &endp, 10); ++ addr = simple_strtoul(argv[2], &endp, 16); ++ for (s = 0; s < count; s++, addr += 4) { ++ if (SSV_REG_READ1(ssv6xxx_debug_ifops, addr, &value)) ; ++ sprintf(tmpbf, "%08x\n", value); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ } ++ return 0; ++ } ++ return -1; ++} ++ ++struct _ssv6xxx_txtput { ++ struct task_struct *txtput_tsk; ++ struct sk_buff *skb; ++ u32 size_per_frame; ++ u32 loop_times; ++ u32 occupied_tx_pages; ++}; ++struct _ssv6xxx_txtput *ssv6xxx_txtput; ++struct _ssv6xxx_txtput ssv_txtput = { NULL, NULL, 0, 0, 0 }; ++ ++static int txtput_thread_m2(void *data) ++{ ++#define Q_DELAY_MS 20 ++ struct sk_buff *skb = NULL; ++ struct ssv6200_tx_desc *tx_desc; ++ int qlen = 0, max_qlen, q_delay_urange[2]; ++ max_qlen = ++ (200 * 1000 / 8 * Q_DELAY_MS) / ssv6xxx_txtput->size_per_frame; ++ q_delay_urange[0] = Q_DELAY_MS * 1000; ++ q_delay_urange[1] = q_delay_urange[0] + 1000; ++ pr_debug("max_qlen: %d\n", max_qlen); ++ while (!kthread_should_stop() && ssv6xxx_txtput->loop_times > 0) { ++ ssv6xxx_txtput->loop_times--; ++ skb = ssvdevice_skb_alloc(ssv6xxx_txtput->size_per_frame); ++ if (skb == NULL) { ++ pr_debug("ssv command txtput_generate_m2 " ++ "ssvdevice_skb_alloc fail!!!\n"); ++ goto end; ++ } ++ skb->data_len = ssv6xxx_txtput->size_per_frame; ++ skb->len = ssv6xxx_txtput->size_per_frame; ++ tx_desc = (struct ssv6200_tx_desc *)skb->data; ++ memset((void *)tx_desc, 0xff, SSV6XXX_TX_DESC_LEN); ++ tx_desc->len = skb->len; ++ tx_desc->c_type = M2_TXREQ; ++ tx_desc->fCmd = (M_ENG_CPU << 4) | M_ENG_HWHCI; ++ tx_desc->reason = ID_TRAP_SW_TXTPUT; ++ qlen = ssv_dbg_ctrl_hci->shi->hci_ops->hci_tx(skb, 0, 0); ++ if (qlen >= max_qlen) { ++ usleep_range(q_delay_urange[0], q_delay_urange[1]); ++ } ++ } ++ end: ++ ssv6xxx_txtput->txtput_tsk = NULL; ++ return 0; ++} ++ ++static int txtput_thread(void *data) ++{ ++ struct sk_buff *skb = ssv6xxx_txtput->skb; ++ struct ssv6xxx_hci_txq_info2 txq_info2; ++ u32 ret = 0, free_tx_page; ++ int send_cnt; ++ unsigned long start_time, end_time, throughput, time_elapse; ++ throughput = ++ ssv6xxx_txtput->loop_times * ssv6xxx_txtput->size_per_frame * 8; ++ start_time = jiffies; ++ while (!kthread_should_stop() && ssv6xxx_txtput->loop_times > 0) { ++ ret = ++ SSV_REG_READ1(ssv6xxx_debug_ifops, ADR_TX_ID_ALL_INFO2, ++ (u32 *) & txq_info2); ++ if (ret < 0) { ++ pr_debug("%s, read ADR_TX_ID_ALL_INFO2 failed\n", ++ __func__); ++ goto end; ++ } ++ free_tx_page = ++ SSV6200_PAGE_TX_THRESHOLD - txq_info2.tx_use_page; ++ send_cnt = free_tx_page / ssv6xxx_txtput->occupied_tx_pages; ++ while (send_cnt > 0 && ssv6xxx_txtput->loop_times > 0) { ++ send_cnt--; ++ ssv6xxx_txtput->loop_times--; ++ ssv_dbg_ctrl_hci->shi->hci_ops->hci_send_cmd(skb); ++ } ++ } ++ end_time = jiffies; ++ ssvdevice_skb_free(skb); ++ time_elapse = ((end_time - start_time) * 1000) / HZ; ++ if (time_elapse > 0) { ++ throughput = throughput / time_elapse; ++ pr_debug("duration %ldms, avg. throughput %d Kbps\n", time_elapse, ++ (int)throughput); ++ } ++ end: ++ ssv6xxx_txtput->txtput_tsk = NULL; ++ return 0; ++} ++ ++int txtput_generate_m2(u32 size_per_frame, u32 loop_times) ++{ ++ ssv6xxx_txtput->size_per_frame = size_per_frame; ++ ssv6xxx_txtput->loop_times = loop_times; ++ ssv6xxx_txtput->txtput_tsk = ++ kthread_run(txtput_thread_m2, NULL, "txtput_thread_m2"); ++ return 0; ++} ++ ++int txtput_generate_host_cmd(u32 size_per_frame, u32 loop_times) ++{ ++#define PAGESIZE 256 ++ struct cfg_host_cmd *host_cmd; ++ struct sk_buff *skb; ++ skb = ssvdevice_skb_alloc(size_per_frame); ++ if (skb == NULL) { ++ pr_debug ++ ("ssv command txtput_generate_host_cmd ssvdevice_skb_alloc fail!!!\n"); ++ return 0; ++ } ++ skb->data_len = size_per_frame; ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = TEST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_TX_TPUT; ++ host_cmd->len = skb->data_len; ++ memcpy(host_cmd->dat32, skb->data, size_per_frame); ++ ssv6xxx_txtput->occupied_tx_pages = ++ (size_per_frame / PAGESIZE) + ((size_per_frame % PAGESIZE) != 0); ++ ssv6xxx_txtput->size_per_frame = size_per_frame; ++ ssv6xxx_txtput->loop_times = loop_times; ++ ssv6xxx_txtput->skb = skb; ++ ssv6xxx_txtput->txtput_tsk = ++ kthread_run(txtput_thread, NULL, "txtput_thread"); ++ return 0; ++} ++ ++int txtput_tsk_cleanup(void) ++{ ++ int ret = 0; ++ if (ssv6xxx_txtput->txtput_tsk) { ++ ret = kthread_stop(ssv6xxx_txtput->txtput_tsk); ++ ssv6xxx_txtput->txtput_tsk = NULL; ++ } ++ return ret; ++} ++ ++int watchdog_controller(struct ssv_hw *sh, u8 flag) ++{ ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ int ret = 0; ++ pr_debug("watchdog_controller %d\n", flag); ++ skb = ssvdevice_skb_alloc(HOST_CMD_HDR_LEN); ++ if (skb == NULL) { ++ pr_err("init watchdog_controller failure\n"); ++ return (-1); ++ } ++ skb->data_len = HOST_CMD_HDR_LEN; ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) flag; ++ host_cmd->len = skb->data_len; ++ sh->hci.hci_ops->hci_send_cmd(skb); ++ ssvdevice_skb_free(skb); ++ return ret; ++} ++ ++static int ssv_cmd_txtput(int argc, char *argv[]) ++{ ++ char tmpbf[64], *endp; ++ u32 size_per_frame, loop_times, pkt_type; ++ ssv6xxx_txtput = &ssv_txtput; ++ if (argc == 2 && !strcmp(argv[1], "stop")) { ++ txtput_tsk_cleanup(); ++ return 0; ++ } ++ if (argc != 4) { ++ sprintf(tmpbf, "* txtput stop\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ sprintf(tmpbf, "* txtput [type] [size] [frames]\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ sprintf(tmpbf, " type(packet type):\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ sprintf(tmpbf, " 0 = host_cmd\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ sprintf(tmpbf, " 1 = m2_type \n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ sprintf(tmpbf, " EX: txtput 1 14000 9999 \n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ return 0; ++ } ++ pkt_type = simple_strtoul(argv[1], &endp, 10); ++ size_per_frame = simple_strtoul(argv[2], &endp, 10); ++ loop_times = simple_strtoul(argv[3], &endp, 10); ++ sprintf(tmpbf, "type&size&frames:%d&%d&%d\n", pkt_type, size_per_frame, ++ loop_times); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ if (ssv6xxx_txtput->txtput_tsk) { ++ sprintf(tmpbf, "txtput already in progress\n"); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ return 0; ++ } ++ watchdog_controller(((struct ssv_softc *)ssv_dbg_sc)->sh, ++ (u8) SSV6XXX_HOST_CMD_WATCHDOG_STOP); ++ ((struct ssv_softc *)ssv_dbg_sc)->watchdog_flag = WD_SLEEP; ++ if (pkt_type) ++ txtput_generate_m2(size_per_frame + SSV6XXX_TX_DESC_LEN, ++ loop_times); ++ else ++ txtput_generate_host_cmd(size_per_frame + HOST_CMD_HDR_LEN, ++ loop_times); ++ return 0; ++} ++ ++static int ssv_cmd_rxtput(int argc, char *argv[]) ++{ ++ struct sk_buff *skb; ++ struct cfg_host_cmd *host_cmd; ++ struct sdio_rxtput_cfg cmd_rxtput_cfg; ++ char tmpbf[32], *endp; ++ if (argc != 3) { ++ sprintf(ssv6xxx_result_buf, "rxtput [size] [frames]\n"); ++ return 0; ++ } ++ skb = ++ ssvdevice_skb_alloc(HOST_CMD_HDR_LEN + ++ sizeof(struct sdio_rxtput_cfg)); ++ if (skb == NULL) { ++ pr_err("ssv command ssvdevice_skb_alloc fail\n"); ++ return 0; ++ } ++ watchdog_controller(((struct ssv_softc *)ssv_dbg_sc)->sh, ++ (u8) SSV6XXX_HOST_CMD_WATCHDOG_STOP); ++ ((struct ssv_softc *)ssv_dbg_sc)->watchdog_flag = WD_SLEEP; ++ cmd_rxtput_cfg.size_per_frame = simple_strtoul(argv[1], &endp, 10); ++ cmd_rxtput_cfg.total_frames = simple_strtoul(argv[2], &endp, 10); ++ sprintf(tmpbf, "size&frames:%d&%d\n", cmd_rxtput_cfg.size_per_frame, ++ cmd_rxtput_cfg.total_frames); ++ strcat(ssv6xxx_result_buf, tmpbf); ++ skb->data_len = HOST_CMD_HDR_LEN + sizeof(struct sdio_rxtput_cfg); ++ skb->len = skb->data_len; ++ host_cmd = (struct cfg_host_cmd *)skb->data; ++ host_cmd->c_type = HOST_CMD; ++ host_cmd->h_cmd = (u8) SSV6XXX_HOST_CMD_RX_TPUT; ++ host_cmd->len = skb->data_len; ++ memcpy(host_cmd->dat32, &cmd_rxtput_cfg, ++ sizeof(struct sdio_rxtput_cfg)); ++ if (ssv_dbg_ctrl_hci->shi->hci_ops->hci_send_cmd(skb) == 0) { ++ strcat(ssv6xxx_result_buf, ++ "## hci cmd was sent successfully\n"); ++ } else { ++ strcat(ssv6xxx_result_buf, "## hci cmd was sent failed\n"); ++ } ++ ssvdevice_skb_free(skb); ++ return 0; ++} ++ ++static int ssv_cmd_check(int argc, char *argv[]) ++{ ++ u32 size, i, j, x, y, id, value, address, id_value; ++ char *endp; ++ u32 id_base_address[4]; ++ id_base_address[0] = 0xcd010008; ++ id_base_address[1] = 0xcd01000c; ++ id_base_address[2] = 0xcd010054; ++ id_base_address[3] = 0xcd010058; ++ if (argc != 2) { ++ sprintf(ssv6xxx_result_buf, "check [packet size]\n"); ++ return 0; ++ } ++ size = simple_strtoul(argv[1], &endp, 10); ++ size = size >> 2; ++ for (x = 0; x < 4; x++) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, id_base_address[x], &id_value)) ; ++ for (y = 0; y < 32 && id_value; y++, id_value >>= 1) { ++ if (id_value & 0x1) { ++ id = 32 * x + y; ++ address = 0x80000000 + (id << 16); ++ { ++ for (i = 0; i < size; i += 8) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ++ address, &value)) ; ++ address += 4; ++ for (j = 1; j < 8; j++) { ++ if (SSV_REG_READ1 ++ (ssv6xxx_debug_ifops, ++ address, &value)) ; ++ address += 4; ++ } ++ } ++ } ++ } ++ } ++ } ++ return 0; ++} ++ ++struct ssv_cmd_table cmd_table[] = { ++ {"help", ssv_cmd_help, "ssv6200 command usage."}, ++ {"-h", ssv_cmd_help, "ssv6200 command usage."}, ++ {"--help", ssv_cmd_help, "ssv6200 command usage."}, ++ {"reg", ssv_cmd_reg, "ssv6200 register read/write."}, ++ {"cfg", ssv_cmd_cfg, "ssv6200 configuration."}, ++ {"sta", ssv_cmd_sta, "svv6200 station info."}, ++ {"dump", ssv_cmd_dump, "dump ssv6200 tables."}, ++ {"hwq", ssv_cmd_hwq, "hardware queue staus"}, ++#ifdef CONFIG_P2P_NOA ++ {"noa", ssv_cmd_noa, "config noa param"}, ++#endif ++ {"irq", ssv_cmd_irq, "get sdio irq status."}, ++ {"mac", ssv_cmd_mac, "ieee80211 swmac."}, ++ {"hci", ssv_cmd_hci, "HCI command."}, ++ {"sdio", ssv_cmd_sdio, "SDIO command."}, ++ {"iqk", ssv_cmd_iqk, "iqk command"}, ++ {"version", ssv_cmd_version, "version information"}, ++ {"mib", ssv_cmd_mib, "mib counter related"}, ++ {"tool", ssv_cmd_tool, "ssv6200 tool register read/write."}, ++ {"rxtput", ssv_cmd_rxtput, "test rx sdio throughput"}, ++ {"txtput", ssv_cmd_txtput, "test tx sdio throughput"}, ++ {"check", ssv_cmd_check, "dump all allocate packet buffer"}, ++ {NULL, NULL, NULL}, ++}; ++ ++int ssv_cmd_submit(char *cmd) ++{ ++ struct ssv_cmd_table *sc_tbl; ++ char *pch, ch; ++ int ret; ++ ssv6xxx_debug_ifops = (void *)ssv6xxx_ifdebug_info; ++ strcpy(sg_cmd_buffer, cmd); ++ for (sg_argc = 0, ch = 0, pch = sg_cmd_buffer; ++ (*pch != 0x00) && (sg_argc < CLI_ARG_SIZE); pch++) { ++ if ((ch == 0) && (*pch != ' ')) { ++ ch = 1; ++ sg_argv[sg_argc] = pch; ++ } ++ if ((ch == 1) && (*pch == ' ')) { ++ *pch = 0x00; ++ ch = 0; ++ sg_argc++; ++ } ++ } ++ if (ch == 1) { ++ sg_argc++; ++ } else if (sg_argc > 0) { ++ *(pch - 1) = ' '; ++ } ++ if (sg_argc > 0) { ++ for (sc_tbl = cmd_table; sc_tbl->cmd; sc_tbl++) { ++ if (!strcmp(sg_argv[0], sc_tbl->cmd)) { ++ if ((sc_tbl->cmd_func_ptr != ssv_cmd_cfg) && ++ (!ssv6xxx_debug_ifops->dev || ++ !ssv6xxx_debug_ifops->ifops || ++ !ssv6xxx_debug_ifops->pdev)) { ++ strcpy(ssv6xxx_result_buf, ++ "Member of ssv6xxx_ifdebug_info is NULL !\n"); ++ return -1; ++ } ++ ssv6xxx_result_buf[0] = 0x00; ++ ret = sc_tbl->cmd_func_ptr(sg_argc, sg_argv); ++ if (ret < 0) { ++ strcpy(ssv6xxx_result_buf, ++ "Invalid command !\n"); ++ } ++ return 0; ++ } ++ } ++ strcpy(ssv6xxx_result_buf, "Command not found !\n"); ++ } else { ++ strcpy(ssv6xxx_result_buf, "./cli -h\n"); ++ } ++ return 0; ++} +diff --git a/drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.h b/drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.h +new file mode 100644 +index 000000000000..d96bfcc54954 +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/ssvdevice/ssv_cmd.h +@@ -0,0 +1,50 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#ifndef _SSV_CMD_H_ ++#define _SSV_CMD_H_ ++#define CLI_BUFFER_SIZE 256 ++#define CLI_ARG_SIZE 10 ++#define CLI_RESULT_BUF_SIZE (4096) ++#define DEBUG_DIR_ENTRY "ssv" ++#define DEBUG_DEVICETYPE_ENTRY "ssv_devicetype" ++#define DEBUG_CMD_ENTRY "ssv_cmd" ++#define MAX_CHARS_PER_LINE 256 ++struct ssv_cmd_table { ++ const char *cmd; ++ int (*cmd_func_ptr)(int, char **); ++ const char *usage; ++}; ++struct ssv6xxx_cfg_cmd_table { ++ u8 *cfg_cmd; ++ void *var; ++ u32 arg; ++ int (*translate_func)(u8 *, void *, u32); ++}; ++#define SSV_REG_READ1(ops,reg,val) \ ++ (ops)->ifops->readreg((ops)->dev, reg, val) ++#define SSV_REG_WRITE1(ops,reg,val) \ ++ (ops)->ifops->writereg((ops)->dev, reg, val) ++#define SSV_REG_SET_BITS1(ops,reg,set,clr) \ ++ { \ ++ u32 reg_val; \ ++ SSV_REG_READ(ops, reg, ®_val); \ ++ reg_val &= ~(clr); \ ++ reg_val |= (set); \ ++ SSV_REG_WRITE(ops, reg, reg_val); \ ++ } ++int ssv_cmd_submit(char *cmd); ++#endif +diff --git a/drivers/net/wireless/ssv6051/ssvdevice/ssvdevice.c b/drivers/net/wireless/ssv6051/ssvdevice/ssvdevice.c +new file mode 100644 +index 000000000000..eb848553798f +--- /dev/null ++++ b/drivers/net/wireless/ssv6051/ssvdevice/ssvdevice.c +@@ -0,0 +1,256 @@ ++/* ++ * Copyright (c) 2015 South Silicon Valley Microelectronics Inc. ++ * Copyright (c) 2015 iComm 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 3 of the License, or ++ * (at your option) any later version. ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "ssv_cmd.h" ++#include "ssv_cfg.h" ++#include ++#include ++#include ++#include ++ ++#ifdef CONFIG_DEBUG_FS ++#include ++#endif ++ ++char *ssv_initmac = NULL; ++EXPORT_SYMBOL(ssv_initmac); ++module_param(ssv_initmac, charp, 0644); ++MODULE_PARM_DESC(ssv_initmac, "Wi-Fi MAC address"); ++ ++u32 ssv_devicetype = 0; ++EXPORT_SYMBOL(ssv_devicetype); ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *debugfs; ++#endif ++ ++struct proc_dir_entry *procfs; ++static char *ssv6xxx_cmd_buf; ++char *ssv6xxx_result_buf; ++extern struct ssv6xxx_cfg_cmd_table cfg_cmds[]; ++extern struct ssv6xxx_cfg ssv_cfg; ++char DEFAULT_CFG_PATH[] = "/lib/firmware/ssv6051-wifi.cfg"; ++static int ssv6xxx_dbg_open(struct inode *inode, struct file *filp) ++{ ++ filp->private_data = inode->i_private; ++ return 0; ++} ++ ++static ssize_t ssv6xxx_dbg_read(struct file *filp, char __user * buffer, ++ size_t count, loff_t * ppos) ++{ ++ int len; ++ if (*ppos != 0) ++ return 0; ++ len = strlen(ssv6xxx_result_buf) + 1; ++ if (len == 1) ++ return 0; ++ if (copy_to_user(buffer, ssv6xxx_result_buf, len)) ++ return -EFAULT; ++ ssv6xxx_result_buf[0] = 0x00; ++ return len; ++} ++ ++static ssize_t ssv6xxx_dbg_write(struct file *filp, const char __user * buffer, ++ size_t count, loff_t * ppos) ++{ ++ if (*ppos != 0 || count > 255) ++ return 0; ++ if (copy_from_user(ssv6xxx_cmd_buf, buffer, count)) ++ return -EFAULT; ++ ssv6xxx_cmd_buf[count - 1] = 0x00; ++ ssv_cmd_submit(ssv6xxx_cmd_buf); ++ return count; ++} ++ ++size_t read_line(struct file * fp, char *buf, size_t size) ++{ ++ size_t num_read = 0; ++ size_t total_read = 0; ++ char *buffer; ++ char ch; ++ size_t start_ignore = 0; ++ if (size <= 0 || buf == NULL) { ++ total_read = -EINVAL; ++ return -EINVAL; ++ } ++ buffer = buf; ++ for (;;) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) ++ num_read = kernel_read(fp, &ch, 1, &fp->f_pos); ++#else ++ mm_segment_t fs; ++ fs = get_fs(); ++ set_fs(KERNEL_DS); ++ num_read = vfs_read(fp, &ch, 1, &fp->f_pos); ++ set_fs(fs); ++#endif ++ if (num_read < 0) { ++ if (num_read == EINTR) ++ continue; ++ else ++ return -1; ++ } else if (num_read == 0) { ++ if (total_read == 0) ++ return 0; ++ else ++ break; ++ } else { ++ if (ch == '#') ++ start_ignore = 1; ++ if (total_read < size - 1) { ++ total_read++; ++ if (start_ignore) ++ *buffer++ = '\0'; ++ else ++ *buffer++ = ch; ++ } ++ if (ch == '\n') ++ break; ++ } ++ } ++ *buffer = '\0'; ++ return total_read; ++} ++ ++int ischar(char *c) ++{ ++ int is_char = 1; ++ while (*c) { ++ if (isalpha(*c) || isdigit(*c) || *c == '_' || *c == ':' ++ || *c == '/' || *c == '.' || *c == '-') ++ c++; ++ else { ++ is_char = 0; ++ break; ++ } ++ } ++ return is_char; ++} ++ ++void sta_cfg_set(void) ++{ ++ struct file *fp = (struct file *)NULL; ++ char buf[MAX_CHARS_PER_LINE], cfg_cmd[32], cfg_value[32]; ++ size_t s, read_len = 0, is_cmd_support = 0; ++ ++ memset(&ssv_cfg, 0, sizeof(ssv_cfg)); ++ memset(buf, 0, sizeof(buf)); ++ fp = filp_open(DEFAULT_CFG_PATH, O_RDONLY, 0); ++ if (IS_ERR(fp) || fp == NULL) { ++ WARN_ON(1); ++ return; ++ } ++ if (fp->f_path.dentry == NULL) { ++ WARN_ON(1); ++ return; ++ } ++ do { ++ memset(cfg_cmd, '\0', sizeof(cfg_cmd)); ++ memset(cfg_value, '\0', sizeof(cfg_value)); ++ read_len = read_line(fp, buf, MAX_CHARS_PER_LINE); ++ sscanf(buf, "%s = %s", cfg_cmd, cfg_value); ++ if (!ischar(cfg_cmd) || !ischar(cfg_value)) { ++ pr_warn("Invalid configuration parameter: %s\n", buf); ++ continue; ++ } ++ is_cmd_support = 0; ++ for (s = 0; cfg_cmds[s].cfg_cmd != NULL; s++) { ++ if (strcmp(cfg_cmds[s].cfg_cmd, cfg_cmd) == 0) { ++ cfg_cmds[s].translate_func(cfg_value, ++ cfg_cmds[s].var, ++ cfg_cmds[s].arg); ++ is_cmd_support = 1; ++ break; ++ } ++ } ++ if (!is_cmd_support && strlen(cfg_cmd) > 0) { ++ pr_warn("Unsupported configuration command: %s", cfg_cmd); ++ } ++ } while (read_len > 0); ++ filp_close(fp, NULL); ++} ++ ++static const struct file_operations ssv6xxx_dbg_fops = { ++ .owner = THIS_MODULE, ++ .open = ssv6xxx_dbg_open, ++ .read = ssv6xxx_dbg_read, ++ .write = ssv6xxx_dbg_write, ++}; ++ ++extern int ssv6xxx_hci_init(void); ++extern void ssv6xxx_hci_exit(void); ++extern int ssv6xxx_init(void); ++extern void ssv6xxx_exit(void); ++extern int ssv6xxx_sdio_init(void); ++extern void ssv6xxx_sdio_exit(void); ++ ++int ssvdevice_init(void) ++{ ++ ssv6xxx_cmd_buf = ++ (char *)kzalloc(CLI_BUFFER_SIZE + CLI_RESULT_BUF_SIZE, GFP_KERNEL); ++ if (!ssv6xxx_cmd_buf) ++ return -ENOMEM; ++ ssv6xxx_result_buf = ssv6xxx_cmd_buf + CLI_BUFFER_SIZE; ++ ssv6xxx_cmd_buf[0] = 0x00; ++ ssv6xxx_result_buf[0] = 0x00; ++#ifdef CONFIG_DEBUG_FS ++ debugfs = debugfs_create_dir(DEBUG_DIR_ENTRY, NULL); ++ if (!debugfs) ++ return -ENOMEM; ++ debugfs_create_u32(DEBUG_DEVICETYPE_ENTRY, S_IRUGO | S_IWUSR, debugfs, ++ &ssv_devicetype); ++ debugfs_create_file(DEBUG_CMD_ENTRY, S_IRUGO | S_IWUSR, debugfs, NULL, ++ &ssv6xxx_dbg_fops); ++#endif ++ sta_cfg_set(); ++ { ++ int ret; ++ ret = ssv6xxx_hci_init(); ++ if (!ret) { ++ ret = ssv6xxx_init(); ++ } ++ if (!ret) { ++ ret = ssv6xxx_sdio_init(); ++ } ++ return ret; ++ } ++ ++ return 0; ++} ++ ++void ssvdevice_exit(void) ++{ ++ ++ ssv6xxx_exit(); ++ ssv6xxx_hci_exit(); ++ ssv6xxx_sdio_exit(); ++ ++#ifdef CONFIG_DEBUG_FS ++ debugfs_remove_recursive(debugfs); ++#endif ++ kfree(ssv6xxx_cmd_buf); ++} ++ ++EXPORT_SYMBOL(ssvdevice_init); ++EXPORT_SYMBOL(ssvdevice_exit); +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0002-rockchip-from-list.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0002-rockchip-from-list.patch new file mode 100644 index 000000000000..517eaf53c059 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0002-rockchip-from-list.patch @@ -0,0 +1,131 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 17 Feb 2019 22:14:38 +0000 +Subject: [PATCH] mmc: core: set initial signal voltage on power off + +Some boards have SD card connectors where the power rail cannot be switched +off by the driver. If the card has not been power cycled, it may still be +using 1.8V signaling after a warm re-boot. Bootroms expecting 3.3V signaling +will fail to boot from a UHS card that continue to use 1.8V signaling. + +Set initial signal voltage in mmc_power_off() to allow re-boot to function. + +This fixes re-boot with UHS cards on Asus Tinker Board (Rockchip RK3288), +same issue have been seen on some Rockchip RK3399 boards. + +I am sending this as a RFC because I have no insights into SD/MMC subsystem, +this change fix a re-boot issue on my boards and does not break emmc/sdio. +Is this an acceptable workaround? Any advice is appreciated. + +Signed-off-by: Jonas Karlman +--- + drivers/mmc/core/core.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index ef53a2578824..d4c53074154a 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1358,6 +1358,14 @@ void mmc_power_off(struct mmc_host *host) + if (host->ios.power_mode == MMC_POWER_OFF) + return; + ++ mmc_set_initial_signal_voltage(host); ++ ++ /* ++ * This delay should be sufficient to allow the power supply ++ * to reach the minimum voltage. ++ */ ++ mmc_delay(host->ios.power_delay_ms); ++ + mmc_pwrseq_power_off(host); + + host->ios.clock = 0; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 23 Jun 2021 16:59:18 +0200 +Subject: [PATCH] arm64: dts: rockchip: Add sdmmc_ext for RK3328 + +RK3328 SoC has a fourth mmc controller called SDMMC_EXT. Some +boards have sdio wifi connected to it. In order to use it +one would have to add the pinctrls from sdmmc0ext group which +is done on board level. + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 49ae15708a0b..60348d517efb 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -993,6 +993,20 @@ usb_host0_ohci: usb@ff5d0000 { + status = "disabled"; + }; + ++ sdmmc_ext: mmc@ff5f0000 { ++ compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; ++ reg = <0x0 0xff5f0000 0x0 0x4000>; ++ interrupts = ; ++ clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>, ++ <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>; ++ clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; ++ fifo-depth = <0x100>; ++ max-frequency = <150000000>; ++ resets = <&cru SRST_SDMMCEXT>; ++ reset-names = "reset"; ++ status = "disabled"; ++ }; ++ + usbdrd3: usb@ff600000 { + compatible = "rockchip,rk3328-dwc3", "snps,dwc3"; + reg = <0x0 0xff600000 0x0 0x100000>; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 23 Jun 2021 17:02:08 +0200 +Subject: [PATCH] arm64: dts: rockchip: Add sdmmc/sdio/emmc reset controls for + RK3328 + +The DW MCI controller driver will use them to reset the IP block before +initialisation. + +Fixes: d717f7352ec6 ("arm64: dts: rockchip: add sdmmc/sdio/emmc nodes for RK3328 SoCs") +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 60348d517efb..d7e44d174d7b 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -871,6 +871,8 @@ sdmmc: mmc@ff500000 { + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + max-frequency = <150000000>; ++ resets = <&cru SRST_MMC0>; ++ reset-names = "reset"; + status = "disabled"; + }; + +@@ -883,6 +885,8 @@ sdio: mmc@ff510000 { + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + max-frequency = <150000000>; ++ resets = <&cru SRST_SDIO>; ++ reset-names = "reset"; + status = "disabled"; + }; + +@@ -895,6 +899,8 @@ emmc: mmc@ff520000 { + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + max-frequency = <150000000>; ++ resets = <&cru SRST_EMMC>; ++ reset-names = "reset"; + status = "disabled"; + }; + diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0011-v4l2-from-list.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0011-v4l2-from-list.patch new file mode 100644 index 000000000000..ed0c61c2cb9c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-0011-v4l2-from-list.patch @@ -0,0 +1,659 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Jul 2020 21:54:35 +0000 +Subject: [PATCH] media: v4l2-common: Add helpers to calculate bytesperline and + sizeimage + +Add helper functions to calculate plane bytesperline and sizeimage, these +new helpers consider block width and height when calculating plane +bytesperline and sizeimage. + +This prepare support for new pixel formats added in next patch that make +use of block width and height. + +Signed-off-by: Jonas Karlman +--- + drivers/media/v4l2-core/v4l2-common.c | 77 +++++++++++++-------------- + 1 file changed, 38 insertions(+), 39 deletions(-) + +diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c +index e0fbe6ba4b6c..cb2f1acab7cf 100644 +--- a/drivers/media/v4l2-core/v4l2-common.c ++++ b/drivers/media/v4l2-core/v4l2-common.c +@@ -338,6 +338,33 @@ static inline unsigned int v4l2_format_block_height(const struct v4l2_format_inf + return info->block_h[plane]; + } + ++static inline unsigned int v4l2_format_plane_width(const struct v4l2_format_info *info, int plane, ++ unsigned int width) ++{ ++ unsigned int hdiv = plane ? info->hdiv : 1; ++ unsigned int bytes = DIV_ROUND_UP(width * info->bpp[plane], ++ v4l2_format_block_width(info, plane) * ++ v4l2_format_block_height(info, plane)); ++ ++ return DIV_ROUND_UP(bytes, hdiv); ++} ++ ++static inline unsigned int v4l2_format_plane_height(const struct v4l2_format_info *info, int plane, ++ unsigned int height) ++{ ++ unsigned int vdiv = plane ? info->vdiv : 1; ++ unsigned int lines = ALIGN(height, v4l2_format_block_height(info, plane)); ++ ++ return DIV_ROUND_UP(lines, vdiv); ++} ++ ++static inline unsigned int v4l2_format_plane_size(const struct v4l2_format_info *info, int plane, ++ unsigned int width, unsigned int height) ++{ ++ return v4l2_format_plane_width(info, plane, width) * ++ v4l2_format_plane_height(info, plane, height); ++} ++ + void v4l2_apply_frmsize_constraints(u32 *width, u32 *height, + const struct v4l2_frmsize_stepwise *frmsize) + { +@@ -373,37 +400,19 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane *pixfmt, + + if (info->mem_planes == 1) { + plane = &pixfmt->plane_fmt[0]; +- plane->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_div[0]; ++ plane->bytesperline = v4l2_format_plane_width(info, 0, width); + plane->sizeimage = 0; + +- for (i = 0; i < info->comp_planes; i++) { +- unsigned int hdiv = (i == 0) ? 1 : info->hdiv; +- unsigned int vdiv = (i == 0) ? 1 : info->vdiv; +- unsigned int aligned_width; +- unsigned int aligned_height; +- +- aligned_width = ALIGN(width, v4l2_format_block_width(info, i)); +- aligned_height = ALIGN(height, v4l2_format_block_height(info, i)); +- +- plane->sizeimage += info->bpp[i] * +- DIV_ROUND_UP(aligned_width, hdiv) * +- DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i]; +- } ++ for (i = 0; i < info->comp_planes; i++) ++ plane->sizeimage += ++ v4l2_format_plane_size(info, i, width, height); + } else { + for (i = 0; i < info->comp_planes; i++) { +- unsigned int hdiv = (i == 0) ? 1 : info->hdiv; +- unsigned int vdiv = (i == 0) ? 1 : info->vdiv; +- unsigned int aligned_width; +- unsigned int aligned_height; +- +- aligned_width = ALIGN(width, v4l2_format_block_width(info, i)); +- aligned_height = ALIGN(height, v4l2_format_block_height(info, i)); +- + plane = &pixfmt->plane_fmt[i]; + plane->bytesperline = +- info->bpp[i] * DIV_ROUND_UP(aligned_width, hdiv) / info->bpp_div[i]; +- plane->sizeimage = +- plane->bytesperline * DIV_ROUND_UP(aligned_height, vdiv); ++ v4l2_format_plane_width(info, i, width); ++ plane->sizeimage = plane->bytesperline * ++ v4l2_format_plane_height(info, i, height); + } + } + return 0; +@@ -427,22 +436,12 @@ int v4l2_fill_pixfmt(struct v4l2_pix_format *pixfmt, u32 pixelformat, + pixfmt->width = width; + pixfmt->height = height; + pixfmt->pixelformat = pixelformat; +- pixfmt->bytesperline = ALIGN(width, v4l2_format_block_width(info, 0)) * info->bpp[0] / info->bpp_div[0]; ++ pixfmt->bytesperline = v4l2_format_plane_width(info, 0, width); + pixfmt->sizeimage = 0; + +- for (i = 0; i < info->comp_planes; i++) { +- unsigned int hdiv = (i == 0) ? 1 : info->hdiv; +- unsigned int vdiv = (i == 0) ? 1 : info->vdiv; +- unsigned int aligned_width; +- unsigned int aligned_height; +- +- aligned_width = ALIGN(width, v4l2_format_block_width(info, i)); +- aligned_height = ALIGN(height, v4l2_format_block_height(info, i)); +- +- pixfmt->sizeimage += info->bpp[i] * +- DIV_ROUND_UP(aligned_width, hdiv) * +- DIV_ROUND_UP(aligned_height, vdiv) / info->bpp_div[i]; +- } ++ for (i = 0; i < info->comp_planes; i++) ++ pixfmt->sizeimage += ++ v4l2_format_plane_size(info, i, width, height); + return 0; + } + EXPORT_SYMBOL_GPL(v4l2_fill_pixfmt); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Jul 2020 21:54:36 +0000 +Subject: [PATCH] media: v4l2: Add NV15 and NV20 pixel formats + +Add NV15 and NV20 pixel formats used by the Rockchip Video Decoder for +10-bit buffers. + +NV15 and NV20 is a packed 10-bit 4:2:0/4:2:2 semi-planar Y/UV format +similar to P010 and P210 but has no padding between components. Instead, +luminance and chrominance samples are grouped into 4s so that each group is +packed into an integer number of bytes: + +YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes + +The '15' and '20' suffix refers to the optimum effective bits per pixel +which is achieved when the total number of luminance samples is a multiple +of 8 for NV15 and 4 for NV20. + +Signed-off-by: Jonas Karlman +--- + drivers/media/v4l2-core/v4l2-common.c | 3 +++ + drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ + include/uapi/linux/videodev2.h | 3 +++ + 3 files changed, 8 insertions(+) + +diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c +index cb2f1acab7cf..8446a1deffd8 100644 +--- a/drivers/media/v4l2-core/v4l2-common.c ++++ b/drivers/media/v4l2-core/v4l2-common.c +@@ -268,6 +268,9 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) + { .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1 }, + ++ { .format = V4L2_PIX_FMT_NV15, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 2, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } }, ++ { .format = V4L2_PIX_FMT_NV20, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 2, .vdiv = 1, .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } }, ++ + { .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 }, + { .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 4 }, + { .format = V4L2_PIX_FMT_YUV411P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 4, .vdiv = 1 }, +diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c +index e6fd355a2e92..24771edaa4f2 100644 +--- a/drivers/media/v4l2-core/v4l2-ioctl.c ++++ b/drivers/media/v4l2-core/v4l2-ioctl.c +@@ -1354,6 +1354,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) + case V4L2_PIX_FMT_NV42: descr = "Y/VU 4:4:4"; break; + case V4L2_PIX_FMT_P010: descr = "10-bit Y/UV 4:2:0"; break; + case V4L2_PIX_FMT_P012: descr = "12-bit Y/UV 4:2:0"; break; ++ case V4L2_PIX_FMT_NV15: descr = "10-bit Y/UV 4:2:0 (Packed)"; break; ++ case V4L2_PIX_FMT_NV20: descr = "10-bit Y/UV 4:2:2 (Packed)"; break; + case V4L2_PIX_FMT_NV12_4L4: descr = "Y/UV 4:2:0 (4x4 Linear)"; break; + case V4L2_PIX_FMT_NV12_16L16: descr = "Y/UV 4:2:0 (16x16 Linear)"; break; + case V4L2_PIX_FMT_NV12_32L32: descr = "Y/UV 4:2:0 (32x32 Linear)"; break; +diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h +index 01e630f2ec78..cea44992aea3 100644 +--- a/include/uapi/linux/videodev2.h ++++ b/include/uapi/linux/videodev2.h +@@ -628,6 +628,9 @@ struct v4l2_pix_format { + #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/VU 4:4:4 */ + #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/UV 4:2:0 10-bit per component */ + ++#define V4L2_PIX_FMT_NV15 v4l2_fourcc('N', 'V', '1', '5') /* 15 Y/UV 4:2:0 10-bit packed */ ++#define V4L2_PIX_FMT_NV20 v4l2_fourcc('N', 'V', '2', '0') /* 20 Y/UV 4:2:2 10-bit packed */ ++ + /* two non contiguous planes - one Y, one Cr + Cb interleaved */ + #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/UV 4:2:0 */ + #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/VU 4:2:0 */ + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Jul 2020 21:54:36 +0000 +Subject: [PATCH] media: rkvdec: h264: Use bytesperline and buffer height to + calculate stride + +Use bytesperline and buffer height to calculate the strides configured. + +This does not really change anything other than ensuring the bytesperline +that is signaled to userspace matches what is configured in HW. + +Signed-off-by: Jonas Karlman +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index 4fc167b42cf0..a8635105e387 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -896,9 +896,9 @@ static void config_registers(struct rkvdec_ctx *ctx, + dma_addr_t rlc_addr; + dma_addr_t refer_addr; + u32 rlc_len; +- u32 hor_virstride = 0; +- u32 ver_virstride = 0; +- u32 y_virstride = 0; ++ u32 hor_virstride; ++ u32 ver_virstride; ++ u32 y_virstride; + u32 yuv_virstride = 0; + u32 offset; + dma_addr_t dst_addr; +@@ -909,8 +909,8 @@ static void config_registers(struct rkvdec_ctx *ctx, + + f = &ctx->decoded_fmt; + dst_fmt = &f->fmt.pix_mp; +- hor_virstride = (sps->bit_depth_luma_minus8 + 8) * dst_fmt->width / 8; +- ver_virstride = round_up(dst_fmt->height, 16); ++ hor_virstride = dst_fmt->plane_fmt[0].bytesperline; ++ ver_virstride = dst_fmt->height; + y_virstride = hor_virstride * ver_virstride; + + if (sps->chroma_format_idc == 0) + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Jul 2020 21:54:37 +0000 +Subject: [PATCH] media: rkvdec: Extract rkvdec_fill_decoded_pixfmt helper + method + +This extract setting decoded pixfmt into a helper method, current code is +replaced with a call to the new helper method. + +The helper method is also called from a new function in next patch. + +Signed-off-by: Jonas Karlman +--- + drivers/staging/media/rkvdec/rkvdec.c | 29 ++++++++++++++------------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 7bab7586918c..40cc791aef26 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -27,6 +27,17 @@ + #include "rkvdec.h" + #include "rkvdec-regs.h" + ++static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, ++ struct v4l2_pix_format_mplane *pix_mp) ++{ ++ v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, ++ pix_mp->width, pix_mp->height); ++ pix_mp->plane_fmt[0].sizeimage += 128 * ++ DIV_ROUND_UP(pix_mp->width, 16) * ++ DIV_ROUND_UP(pix_mp->height, 16); ++ pix_mp->field = V4L2_FIELD_NONE; ++} ++ + static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) + { + struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); +@@ -192,13 +203,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) + + rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; +- v4l2_fill_pixfmt_mp(&f->fmt.pix_mp, +- ctx->coded_fmt_desc->decoded_fmts[0], +- ctx->coded_fmt.fmt.pix_mp.width, +- ctx->coded_fmt.fmt.pix_mp.height); +- f->fmt.pix_mp.plane_fmt[0].sizeimage += 128 * +- DIV_ROUND_UP(f->fmt.pix_mp.width, 16) * +- DIV_ROUND_UP(f->fmt.pix_mp.height, 16); ++ f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width; ++ f->fmt.pix_mp.height = ctx->coded_fmt.fmt.pix_mp.height; ++ rkvdec_fill_decoded_pixfmt(ctx, &f->fmt.pix_mp); + } + + static int rkvdec_enum_framesizes(struct file *file, void *priv, +@@ -264,13 +271,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, + &pix_mp->height, + &coded_desc->frmsize); + +- v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, +- pix_mp->width, pix_mp->height); +- pix_mp->plane_fmt[0].sizeimage += +- 128 * +- DIV_ROUND_UP(pix_mp->width, 16) * +- DIV_ROUND_UP(pix_mp->height, 16); +- pix_mp->field = V4L2_FIELD_NONE; ++ rkvdec_fill_decoded_pixfmt(ctx, pix_mp); + + return 0; + } + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Jul 2020 21:54:37 +0000 +Subject: [PATCH] media: rkvdec: Lock capture pixel format in s_ctrl and s_fmt + +Add an optional valid_fmt operation that should return the valid +pixelformat of CAPTURE buffers. + +This is used in next patch to ensure correct pixelformat is used for 10-bit +and 4:2:2 content. + +Signed-off-by: Jonas Karlman +--- + drivers/staging/media/rkvdec/rkvdec.c | 67 +++++++++++++++++++++++---- + drivers/staging/media/rkvdec/rkvdec.h | 2 + + 2 files changed, 61 insertions(+), 8 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 40cc791aef26..e93e1cb0f829 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -38,19 +38,56 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, + pix_mp->field = V4L2_FIELD_NONE; + } + ++static u32 rkvdec_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) ++{ ++ const struct rkvdec_coded_fmt_desc *coded_desc = ctx->coded_fmt_desc; ++ ++ if (coded_desc->ops->valid_fmt) ++ return coded_desc->ops->valid_fmt(ctx, ctrl); ++ ++ return ctx->valid_fmt; ++} ++ + static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) + { + struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); + const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; + +- if (desc->ops->try_ctrl) +- return desc->ops->try_ctrl(ctx, ctrl); ++ if (desc->ops->try_ctrl) { ++ int ret; ++ ret = desc->ops->try_ctrl(ctx, ctrl); ++ if (ret) ++ return ret; ++ } ++ ++ if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl)) ++ /* Only current valid format */ ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) ++{ ++ struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); ++ ++ if (ctrl->id == V4L2_CID_STATELESS_H264_SPS && !ctx->valid_fmt) { ++ ctx->valid_fmt = rkvdec_valid_fmt(ctx, ctrl); ++ if (ctx->valid_fmt) { ++ struct v4l2_pix_format_mplane *pix_mp; ++ ++ pix_mp = &ctx->decoded_fmt.fmt.pix_mp; ++ pix_mp->pixelformat = ctx->valid_fmt; ++ rkvdec_fill_decoded_pixfmt(ctx, pix_mp); ++ } ++ } + + return 0; + } + + static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = { + .try_ctrl = rkvdec_try_ctrl, ++ .s_ctrl = rkvdec_s_ctrl, + }; + + static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { +@@ -201,6 +238,7 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) + { + struct v4l2_format *f = &ctx->decoded_fmt; + ++ ctx->valid_fmt = 0; + rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width; +@@ -256,13 +294,17 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, + if (WARN_ON(!coded_desc)) + return -EINVAL; + +- for (i = 0; i < coded_desc->num_decoded_fmts; i++) { +- if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat) +- break; +- } ++ if (ctx->valid_fmt) { ++ pix_mp->pixelformat = ctx->valid_fmt; ++ } else { ++ for (i = 0; i < coded_desc->num_decoded_fmts; i++) { ++ if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat) ++ break; ++ } + +- if (i == coded_desc->num_decoded_fmts) +- pix_mp->pixelformat = coded_desc->decoded_fmts[0]; ++ if (i == coded_desc->num_decoded_fmts) ++ pix_mp->pixelformat = coded_desc->decoded_fmts[0]; ++ } + + /* Always apply the frmsize constraint of the coded end. */ + pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width); +@@ -326,6 +368,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void *priv, + return ret; + + ctx->decoded_fmt = *f; ++ ctx->valid_fmt = f->fmt.pix_mp.pixelformat; + return 0; + } + +@@ -429,6 +472,14 @@ static int rkvdec_enum_capture_fmt(struct file *file, void *priv, + if (WARN_ON(!ctx->coded_fmt_desc)) + return -EINVAL; + ++ if (ctx->valid_fmt) { ++ if (f->index) ++ return -EINVAL; ++ ++ f->pixelformat = ctx->valid_fmt; ++ return 0; ++ } ++ + if (f->index >= ctx->coded_fmt_desc->num_decoded_fmts) + return -EINVAL; + +diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h +index 633335ebb9c4..b9e219438bc9 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.h ++++ b/drivers/staging/media/rkvdec/rkvdec.h +@@ -66,6 +66,7 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf) + struct rkvdec_coded_fmt_ops { + int (*adjust_fmt)(struct rkvdec_ctx *ctx, + struct v4l2_format *f); ++ u32 (*valid_fmt)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl); + int (*start)(struct rkvdec_ctx *ctx); + void (*stop)(struct rkvdec_ctx *ctx); + int (*run)(struct rkvdec_ctx *ctx); +@@ -101,6 +102,7 @@ struct rkvdec_ctx { + struct v4l2_fh fh; + struct v4l2_format coded_fmt; + struct v4l2_format decoded_fmt; ++ u32 valid_fmt; + const struct rkvdec_coded_fmt_desc *coded_fmt_desc; + struct v4l2_ctrl_handler ctrl_hdl; + struct rkvdec_dev *dev; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 6 Jul 2020 21:54:37 +0000 +Subject: [PATCH] media: rkvdec: h264: Support High 10 and 4:2:2 profiles + +Add support and enable decoding of H264 High 10 and 4:2:2 profiles. + +Decoded CAPTURE buffer width is aligned to 64 pixels to accommodate HW +requirement on 10-bit format buffers. + +The new valid_fmt operation is implemented and return a valid pixelformat +for the provided SPS control. + +Signed-off-by: Jonas Karlman +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 33 ++++++++++++++++------ + drivers/staging/media/rkvdec/rkvdec.c | 19 +++++++++---- + 2 files changed, 37 insertions(+), 15 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index a8635105e387..0069d3d198db 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -1031,19 +1031,14 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx, + { + unsigned int width, height; + +- /* +- * TODO: The hardware supports 10-bit and 4:2:2 profiles, +- * but it's currently broken in the driver. +- * Reject them for now, until it's fixed. +- */ +- if (sps->chroma_format_idc > 1) +- /* Only 4:0:0 and 4:2:0 are supported */ ++ if (sps->chroma_format_idc > 2) ++ /* Only 4:0:0, 4:2:0 and 4:2:2 are supported */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; +- if (sps->bit_depth_luma_minus8 != 0) +- /* Only 8-bit is supported */ ++ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) ++ /* Only 8-bit and 10-bit is supported */ + return -EINVAL; + + width = (sps->pic_width_in_mbs_minus1 + 1) * 16; +@@ -1064,6 +1059,25 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx, + return 0; + } + ++static u32 rkvdec_h264_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) ++{ ++ const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; ++ ++ if (sps->bit_depth_luma_minus8 == 0) { ++ if (sps->chroma_format_idc == 2) ++ return V4L2_PIX_FMT_NV16; ++ else ++ return V4L2_PIX_FMT_NV12; ++ } else if (sps->bit_depth_luma_minus8 == 2) { ++ if (sps->chroma_format_idc == 2) ++ return V4L2_PIX_FMT_NV20; ++ else ++ return V4L2_PIX_FMT_NV15; ++ } ++ ++ return 0; ++} ++ + static int rkvdec_h264_start(struct rkvdec_ctx *ctx) + { + struct rkvdec_dev *rkvdec = ctx->dev; +@@ -1185,6 +1199,7 @@ static int rkvdec_h264_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) + + const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops = { + .adjust_fmt = rkvdec_h264_adjust_fmt, ++ .valid_fmt = rkvdec_h264_valid_fmt, + .start = rkvdec_h264_start, + .stop = rkvdec_h264_stop, + .run = rkvdec_h264_run, +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index e93e1cb0f829..4f5436c89e08 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -31,7 +31,7 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, + struct v4l2_pix_format_mplane *pix_mp) + { + v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, +- pix_mp->width, pix_mp->height); ++ ALIGN(pix_mp->width, 64), pix_mp->height); + pix_mp->plane_fmt[0].sizeimage += 128 * + DIV_ROUND_UP(pix_mp->width, 16) * + DIV_ROUND_UP(pix_mp->height, 16); +@@ -136,8 +136,11 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = { + .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), + }; + +-static const u32 rkvdec_h264_vp9_decoded_fmts[] = { ++static const u32 rkvdec_h264_decoded_fmts[] = { + V4L2_PIX_FMT_NV12, ++ V4L2_PIX_FMT_NV15, ++ V4L2_PIX_FMT_NV16, ++ V4L2_PIX_FMT_NV20, + }; + + static const struct rkvdec_ctrl_desc rkvdec_vp9_ctrl_descs[] = { +@@ -160,6 +163,10 @@ static const struct rkvdec_ctrls rkvdec_vp9_ctrls = { + .num_ctrls = ARRAY_SIZE(rkvdec_vp9_ctrl_descs), + }; + ++static const u32 rkvdec_vp9_decoded_fmts[] = { ++ V4L2_PIX_FMT_NV12, ++}; ++ + static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, +@@ -173,8 +180,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + }, + .ctrls = &rkvdec_h264_ctrls, + .ops = &rkvdec_h264_fmt_ops, +- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), +- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), ++ .decoded_fmts = rkvdec_h264_decoded_fmts, + .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, + }, + { +@@ -189,8 +196,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + }, + .ctrls = &rkvdec_vp9_ctrls, + .ops = &rkvdec_vp9_fmt_ops, +- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), +- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts), ++ .decoded_fmts = rkvdec_vp9_decoded_fmts, + } + }; + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 27 Mar 2022 14:18:07 +0200 +Subject: [PATCH] media: rkvdec-h264: Don't hardcode SPS/PPS parameters + +Some SPS/PPS parameters are currently hardcoded in the driver +even though so do exist in the uapi which is stable by now. + +Use them instead of hardcoding them. + +Signed-off-by: Alex Bee +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index 0069d3d198db..2c27acaba85e 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -655,13 +655,14 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, + + #define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value) + /* write sps */ +- WRITE_PPS(0xf, SEQ_PARAMETER_SET_ID); +- WRITE_PPS(0xff, PROFILE_IDC); +- WRITE_PPS(1, CONSTRAINT_SET3_FLAG); ++ WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID); ++ WRITE_PPS(sps->profile_idc, PROFILE_IDC); ++ WRITE_PPS((sps->constraint_set_flags & 1 << 3) ? 1 : 0, CONSTRAINT_SET3_FLAG); + WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC); + WRITE_PPS(sps->bit_depth_luma_minus8, BIT_DEPTH_LUMA); + WRITE_PPS(sps->bit_depth_chroma_minus8, BIT_DEPTH_CHROMA); +- WRITE_PPS(0, QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG); ++ WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS), ++ QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG); + WRITE_PPS(sps->log2_max_frame_num_minus4, LOG2_MAX_FRAME_NUM_MINUS4); + WRITE_PPS(sps->max_num_ref_frames, MAX_NUM_REF_FRAMES); + WRITE_PPS(sps->pic_order_cnt_type, PIC_ORDER_CNT_TYPE); +@@ -688,8 +689,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, + DIRECT_8X8_INFERENCE_FLAG); + + /* write pps */ +- WRITE_PPS(0xff, PIC_PARAMETER_SET_ID); +- WRITE_PPS(0x1f, PPS_SEQ_PARAMETER_SET_ID); ++ WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID); ++ WRITE_PPS(pps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID); + WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE), + ENTROPY_CODING_MODE_FLAG); + WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT), diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1000-drm-rockchip.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1000-drm-rockchip.patch new file mode 100644 index 000000000000..c7796aaafe7c --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1000-drm-rockchip.patch @@ -0,0 +1,2956 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 3 May 2020 16:51:31 +0000 +Subject: [PATCH] drm/rockchip: vop: filter modes outside 0.5% pixel clock + tolerance + +Filter modes that require a pixel clock that differ more then 0.5% +from the requested pixel clock. + +This filter is only applied to tmds only connector and/or encoders. + +Signed-off-by: Jonas Karlman +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 54 +++++++++++++++++++++ + 1 file changed, 54 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index dbe4d411b30f..fac23d370ee0 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1206,6 +1206,59 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc) + spin_unlock_irqrestore(&vop->irq_lock, flags); + } + ++static bool vop_crtc_is_tmds(struct drm_crtc *crtc) ++{ ++ struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state); ++ struct drm_encoder *encoder; ++ ++ switch (s->output_type) { ++ case DRM_MODE_CONNECTOR_LVDS: ++ case DRM_MODE_CONNECTOR_DSI: ++ return false; ++ case DRM_MODE_CONNECTOR_eDP: ++ case DRM_MODE_CONNECTOR_HDMIA: ++ case DRM_MODE_CONNECTOR_DisplayPort: ++ return true; ++ } ++ ++ drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) ++ if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) ++ return true; ++ ++ return false; ++} ++ ++/* ++ * The VESA DMT standard specifies a 0.5% pixel clock frequency tolerance. ++ * The CVT spec reuses that tolerance in its examples. ++ */ ++#define CLOCK_TOLERANCE_PER_MILLE 5 ++ ++static enum drm_mode_status vop_crtc_mode_valid5(struct drm_crtc *crtc, ++ const struct drm_display_mode *mode) ++{ ++ struct vop *vop = to_vop(crtc); ++ long rounded_rate; ++ long lowest, highest; ++ ++ if (!vop_crtc_is_tmds(crtc)) ++ return MODE_OK; ++ ++ rounded_rate = clk_round_rate(vop->dclk, mode->clock * 1000 + 999); ++ if (rounded_rate < 0) ++ return MODE_NOCLOCK; ++ ++ lowest = mode->clock * (1000 - CLOCK_TOLERANCE_PER_MILLE); ++ if (rounded_rate < lowest) ++ return MODE_CLOCK_LOW; ++ ++ highest = mode->clock * (1000 + CLOCK_TOLERANCE_PER_MILLE); ++ if (rounded_rate > highest) ++ return MODE_CLOCK_HIGH; ++ ++ return MODE_OK; ++} ++ + static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Jul 2020 15:15:50 +0000 +Subject: [PATCH] drm/rockchip: vop: filter interlaced modes + +The current version of the driver does not support interlaced modes, +lets filter any interlaced mode. + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index fac23d370ee0..9f7326c5b1f5 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1244,6 +1244,9 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, + if (!vop_crtc_is_tmds(crtc)) + return MODE_OK; + ++ if (mode->flags & DRM_MODE_FLAG_INTERLACE) ++ return MODE_NO_INTERLACE; ++ + rounded_rate = clk_round_rate(vop->dclk, mode->clock * 1000 + 999); + if (rounded_rate < 0) + return MODE_NOCLOCK; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Jul 2020 11:46:16 +0000 +Subject: [PATCH] drm/rockchip: vop: filter modes above max output supported + +Filter any mode with a resolution not supported by the VOP. + +Signed-off-by: Jonas Karlman +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 48 +++++++++++++++------ + 1 file changed, 34 insertions(+), 14 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 9f7326c5b1f5..30e252ba7184 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1228,6 +1228,24 @@ static bool vop_crtc_is_tmds(struct drm_crtc *crtc) + return false; + } + ++static enum drm_mode_status vop_crtc_size_valid(struct drm_crtc *crtc, ++ const struct drm_display_mode *mode) ++{ ++ struct vop *vop = to_vop(crtc); ++ const struct vop_rect *max_output = &vop->data->max_output; ++ ++ if (max_output->width && max_output->height) { ++ /* only the size of the resulting rect matters */ ++ if(drm_mode_validate_size(mode, max_output->width, ++ max_output->height) != MODE_OK) { ++ return drm_mode_validate_size(mode, max_output->height, ++ max_output->width); ++ } ++ } ++ ++ return MODE_OK; ++} ++ + /* + * The VESA DMT standard specifies a 0.5% pixel clock frequency tolerance. + * The CVT spec reuses that tolerance in its examples. +@@ -1241,25 +1259,24 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, + long rounded_rate; + long lowest, highest; + +- if (!vop_crtc_is_tmds(crtc)) +- return MODE_OK; +- + if (mode->flags & DRM_MODE_FLAG_INTERLACE) +- return MODE_NO_INTERLACE; ++ return MODE_NO_INTERLACE; + +- rounded_rate = clk_round_rate(vop->dclk, mode->clock * 1000 + 999); +- if (rounded_rate < 0) +- return MODE_NOCLOCK; ++ if (vop_crtc_is_tmds(crtc)) { ++ rounded_rate = clk_round_rate(vop->dclk, mode->clock * 1000 + 999); ++ if (rounded_rate < 0) ++ return MODE_NOCLOCK; + +- lowest = mode->clock * (1000 - CLOCK_TOLERANCE_PER_MILLE); +- if (rounded_rate < lowest) +- return MODE_CLOCK_LOW; ++ lowest = mode->clock * (1000 - CLOCK_TOLERANCE_PER_MILLE); ++ if (rounded_rate < lowest) ++ return MODE_CLOCK_LOW; + +- highest = mode->clock * (1000 + CLOCK_TOLERANCE_PER_MILLE); +- if (rounded_rate > highest) +- return MODE_CLOCK_HIGH; ++ highest = mode->clock * (1000 + CLOCK_TOLERANCE_PER_MILLE); ++ if (rounded_rate > highest) ++ return MODE_CLOCK_HIGH; ++ } + +- return MODE_OK; ++ return vop_crtc_size_valid(crtc, mode); + } + + static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, +@@ -1269,6 +1286,9 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, + struct vop *vop = to_vop(crtc); + unsigned long rate; + ++ if (vop_crtc_size_valid(crtc, adjusted_mode) != MODE_OK) ++ return false; ++ + /* + * Clock craziness. + * + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yakir Yang +Date: Mon, 11 Jul 2016 19:05:39 +0800 +Subject: [PATCH] drm/rockchip: dw_hdmi: adjust cklvl & txlvl for RF/EMI + +Dut to the high HDMI signal voltage driver, Mickey have meet +a serious RF/EMI problem, so we decided to reduce HDMI signal +voltage to a proper value. + +The default params for phy is cklvl = 20 & txlvl = 13 (RF/EMI failed) + ck: lvl = 13, term=100, vlo = 2.71, vhi=3.14, vswing = 0.43 + tx: lvl = 20, term=100, vlo = 2.81, vhi=3.16, vswing = 0.35 + +1. We decided to reduce voltage value to lower, but VSwing still +keep high, RF/EMI have been improved but still failed. + ck: lvl = 6, term=100, vlo = 2.61, vhi=3.11, vswing = 0.50 + tx: lvl = 6, term=100, vlo = 2.61, vhi=3.11, vswing = 0.50 + +2. We try to keep voltage value and vswing both lower, then RF/EMI +test all passed ;) + ck: lvl = 11, term= 66, vlo = 2.68, vhi=3.09, vswing = 0.40 + tx: lvl = 11, term= 66, vlo = 2.68, vhi=3.09, vswing = 0.40 +When we back to run HDMI different test and single-end test, we see +different test passed, but signle-end test failed. The oscilloscope +show that simgle-end clock's VL value is 1.78v (which remind LowLimit +should not lower then 2.6v). + +3. That's to say there are some different between PHY document and +measure value. And according to experiment 2 results, we need to +higher clock voltage and lower data voltage, then we can keep RF/EMI +satisfied and single-end & differen test passed. + ck: lvl = 9, term=100, vlo = 2.65, vhi=3.12, vswing = 0.47 + tx: lvl = 16, term=100, vlo = 2.75, vhi=3.15, vswing = 0.39 + +Signed-off-by: Yakir Yang +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index c14f88893868..4411ca8fd7ed 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -193,7 +193,7 @@ static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { + static const struct dw_hdmi_phy_config rockchip_phy_config[] = { + /*pixelclk symbol term vlev*/ + { 74250000, 0x8009, 0x0004, 0x0272}, +- { 148500000, 0x802b, 0x0004, 0x028d}, ++ { 165000000, 0x802b, 0x0004, 0x0209}, + { 297000000, 0x8039, 0x0005, 0x028d}, + { ~0UL, 0x0000, 0x0000, 0x0000} + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nickey Yang +Date: Mon, 13 Feb 2017 15:40:29 +0800 +Subject: [PATCH] drm/rockchip: dw_hdmi: add phy_config for 594Mhz pixel clock + +Add phy_config for 594Mhz pixel clock used for 4K@60hz + +Signed-off-by: Nickey Yang +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 4411ca8fd7ed..bec381cde0bc 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -195,6 +195,7 @@ static const struct dw_hdmi_phy_config rockchip_phy_config[] = { + { 74250000, 0x8009, 0x0004, 0x0272}, + { 165000000, 0x802b, 0x0004, 0x0209}, + { 297000000, 0x8039, 0x0005, 0x028d}, ++ { 594000000, 0x8039, 0x0000, 0x019d}, + { ~0UL, 0x0000, 0x0000, 0x0000} + }; + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Mon, 11 Jul 2016 19:05:36 +0800 +Subject: [PATCH] drm/rockchip: dw_hdmi: Set cur_ctr to 0 always + +Jitter was improved by lowering the MPLL bandwidth to account for high +frequency noise in the rk3288 PLL. In each case MPLL bandwidth was +lowered only enough to get us a comfortable margin. We believe that +lowering the bandwidth like this is safe given sufficient testing. + +Signed-off-by: Douglas Anderson +Signed-off-by: Yakir Yang +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 ++-------------- + 1 file changed, 2 insertions(+), 14 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index bec381cde0bc..72c1d65c7b75 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -172,20 +172,6 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { + static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { + /* pixelclk bpp8 bpp10 bpp12 */ + { +- 40000000, { 0x0018, 0x0018, 0x0018 }, +- }, { +- 65000000, { 0x0028, 0x0028, 0x0028 }, +- }, { +- 66000000, { 0x0038, 0x0038, 0x0038 }, +- }, { +- 74250000, { 0x0028, 0x0038, 0x0038 }, +- }, { +- 83500000, { 0x0028, 0x0038, 0x0038 }, +- }, { +- 146250000, { 0x0038, 0x0038, 0x0038 }, +- }, { +- 148500000, { 0x0000, 0x0038, 0x0038 }, +- }, { + 600000000, { 0x0000, 0x0000, 0x0000 }, + }, { + ~0UL, { 0x0000, 0x0000, 0x0000}, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Mon, 11 Jul 2016 19:05:42 +0800 +Subject: [PATCH] drm/rockchip: dw_hdmi: Use auto-generated tables + +The previous tables for mpll_cfg and curr_ctrl were created using the +20-pages of example settings provided by the PHY vendor. Those +example settings weren't particularly dense, so there were places +where we were guessing what the settings would be for 10-bit and +12-bit (not that we use those anyway). It was also always a lot of +extra work every time we wanted to add a new clock rate since we had +to cross-reference several tables. + +In I've gone through the work to figure +out how to generate this table automatically. Let's now use the +automatically generated table and then we'll never need to look at it +again. + +We only support 8-bit mode right now and only support a small number +of clock rates and and I've verified that the only 8-bit rate that was +affected was 148.5. That mode appears to have been wrong in the old +table. + +Signed-off-by: Douglas Anderson +Signed-off-by: Yakir Yang +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 130 +++++++++++--------- + 1 file changed, 69 insertions(+), 61 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 72c1d65c7b75..0370bb247fcb 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -95,86 +95,88 @@ + + static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { + { +- 27000000, { +- { 0x00b3, 0x0000}, +- { 0x2153, 0x0000}, +- { 0x40f3, 0x0000} +- }, +- }, { +- 36000000, { +- { 0x00b3, 0x0000}, +- { 0x2153, 0x0000}, +- { 0x40f3, 0x0000} +- }, +- }, { +- 40000000, { +- { 0x00b3, 0x0000}, +- { 0x2153, 0x0000}, +- { 0x40f3, 0x0000} +- }, +- }, { +- 54000000, { +- { 0x0072, 0x0001}, +- { 0x2142, 0x0001}, +- { 0x40a2, 0x0001}, +- }, +- }, { +- 65000000, { +- { 0x0072, 0x0001}, +- { 0x2142, 0x0001}, +- { 0x40a2, 0x0001}, +- }, +- }, { +- 66000000, { +- { 0x013e, 0x0003}, +- { 0x217e, 0x0002}, +- { 0x4061, 0x0002} +- }, +- }, { +- 74250000, { +- { 0x0072, 0x0001}, +- { 0x2145, 0x0002}, +- { 0x4061, 0x0002} +- }, +- }, { +- 83500000, { +- { 0x0072, 0x0001}, +- }, +- }, { +- 108000000, { +- { 0x0051, 0x0002}, +- { 0x2145, 0x0002}, +- { 0x4061, 0x0002} +- }, +- }, { +- 106500000, { +- { 0x0051, 0x0002}, +- { 0x2145, 0x0002}, +- { 0x4061, 0x0002} +- }, +- }, { +- 146250000, { +- { 0x0051, 0x0002}, +- { 0x2145, 0x0002}, +- { 0x4061, 0x0002} +- }, +- }, { +- 148500000, { +- { 0x0051, 0x0003}, +- { 0x214c, 0x0003}, +- { 0x4064, 0x0003} ++ 30666000, { ++ { 0x00b3, 0x0000 }, ++ { 0x2153, 0x0000 }, ++ { 0x40f3, 0x0000 }, ++ }, ++ }, { ++ 36800000, { ++ { 0x00b3, 0x0000 }, ++ { 0x2153, 0x0000 }, ++ { 0x40a2, 0x0001 }, ++ }, ++ }, { ++ 46000000, { ++ { 0x00b3, 0x0000 }, ++ { 0x2142, 0x0001 }, ++ { 0x40a2, 0x0001 }, ++ }, ++ }, { ++ 61333000, { ++ { 0x0072, 0x0001 }, ++ { 0x2142, 0x0001 }, ++ { 0x40a2, 0x0001 }, ++ }, ++ }, { ++ 73600000, { ++ { 0x0072, 0x0001 }, ++ { 0x2142, 0x0001 }, ++ { 0x4061, 0x0002 }, ++ }, ++ }, { ++ 92000000, { ++ { 0x0072, 0x0001 }, ++ { 0x2145, 0x0002 }, ++ { 0x4061, 0x0002 }, ++ }, ++ }, { ++ 122666000, { ++ { 0x0051, 0x0002 }, ++ { 0x2145, 0x0002 }, ++ { 0x4061, 0x0002 }, ++ }, ++ }, { ++ 147200000, { ++ { 0x0051, 0x0002 }, ++ { 0x2145, 0x0002 }, ++ { 0x4064, 0x0003 }, ++ }, ++ }, { ++ 184000000, { ++ { 0x0051, 0x0002 }, ++ { 0x214c, 0x0003 }, ++ { 0x4064, 0x0003 }, + }, +- }, { ++ }, { ++ 226666000, { ++ { 0x0040, 0x0003 }, ++ { 0x214c, 0x0003 }, ++ { 0x4064, 0x0003 }, ++ }, ++ }, { ++ 272000000, { ++ { 0x0040, 0x0003 }, ++ { 0x214c, 0x0003 }, ++ { 0x5a64, 0x0003 }, ++ }, ++ }, { + 340000000, { + { 0x0040, 0x0003 }, + { 0x3b4c, 0x0003 }, + { 0x5a64, 0x0003 }, + }, +- }, { ++ }, { ++ 600000000, { ++ { 0x1a40, 0x0003 }, ++ { 0x3b4c, 0x0003 }, ++ { 0x5a64, 0x0003 }, ++ }, ++ }, { + ~0UL, { +- { 0x00a0, 0x000a }, +- { 0x2001, 0x000f }, +- { 0x4002, 0x000f }, ++ { 0x0000, 0x0000 }, ++ { 0x0000, 0x0000 }, ++ { 0x0000, 0x0000 }, + }, + } + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 8 Jan 2020 21:07:49 +0000 +Subject: [PATCH] drm/rockchip: dw-hdmi: allow high tmds bit rates + +Prepare support for High TMDS Bit Rates used by HDMI2.0 display modes. + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 55c0b8dddad5..15ecb257b902 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -327,6 +327,8 @@ static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, + { + struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data; + ++ dw_hdmi_set_high_tmds_clock_ratio(dw_hdmi, display); ++ + return phy_power_on(hdmi->phy); + } + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 8 Jan 2020 21:07:52 +0000 +Subject: [PATCH] drm/rockchip: dw-hdmi: remove unused plat_data on + rk3228/rk3328 + +mpll_cfg/cur_ctr/phy_config is not used when phy_force_vendor is true, +lets remove them. + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 15ecb257b902..38dded2baaf7 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -417,9 +417,6 @@ static struct rockchip_hdmi_chip_data rk3228_chip_data = { + + static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { + .mode_valid = dw_hdmi_rockchip_mode_valid, +- .mpll_cfg = rockchip_mpll_cfg, +- .cur_ctr = rockchip_cur_ctr, +- .phy_config = rockchip_phy_config, + .phy_data = &rk3228_chip_data, + .phy_ops = &rk3228_hdmi_phy_ops, + .phy_name = "inno_dw_hdmi_phy2", +@@ -454,9 +451,6 @@ static struct rockchip_hdmi_chip_data rk3328_chip_data = { + + static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { + .mode_valid = dw_hdmi_rockchip_mode_valid, +- .mpll_cfg = rockchip_mpll_cfg, +- .cur_ctr = rockchip_cur_ctr, +- .phy_config = rockchip_phy_config, + .phy_data = &rk3328_chip_data, + .phy_ops = &rk3328_hdmi_phy_ops, + .phy_name = "inno_dw_hdmi_phy2", + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 10 Oct 2020 10:16:32 +0000 +Subject: [PATCH] drm/rockchip: dw-hdmi: encoder error handling + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 38dded2baaf7..9e460b7e14a4 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -558,7 +558,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + if (IS_ERR(hdmi->phy)) { + ret = PTR_ERR(hdmi->phy); + if (ret != -EPROBE_DEFER) +- DRM_DEV_ERROR(hdmi->dev, "failed to get phy\n"); ++ DRM_DEV_ERROR(hdmi->dev, "Failed to get phy: %d\n", ret); + return ret; + } + +@@ -590,7 +590,12 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + } + + drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); +- drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); ++ ++ ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); ++ if (ret) { ++ DRM_DEV_ERROR(hdmi->dev, "Failed to init encoder: %d\n", ret); ++ goto err_disable_clk; ++ } + + platform_set_drvdata(pdev, hdmi); + +@@ -609,6 +614,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + + err_bind: + drm_encoder_cleanup(encoder); ++err_disable_clk: + clk_disable_unprepare(hdmi->ref_clk); + err_clk: + regulator_disable(hdmi->avdd_1v8); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 8 Jan 2020 21:07:50 +0000 +Subject: [PATCH] clk: rockchip: set parent rate for DCLK_VOP clock on rk3228 + +Signed-off-by: Jonas Karlman +--- + drivers/clk/rockchip/clk-rk3228.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c +index a24a35553e13..7343d2d7676b 100644 +--- a/drivers/clk/rockchip/clk-rk3228.c ++++ b/drivers/clk/rockchip/clk-rk3228.c +@@ -409,7 +409,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { + RK2928_CLKSEL_CON(29), 0, 3, DFLAGS), + DIV(0, "sclk_vop_pre", "sclk_vop_src", 0, + RK2928_CLKSEL_CON(27), 8, 8, DFLAGS), +- MUX(DCLK_VOP, "dclk_vop", mux_dclk_vop_p, 0, ++ MUX(DCLK_VOP, "dclk_vop", mux_dclk_vop_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, + RK2928_CLKSEL_CON(27), 1, 1, MFLAGS), + + FACTOR(0, "xin12m", "xin24m", 0, 1, 2), + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 10 Oct 2020 14:32:21 +0000 +Subject: [PATCH] drm/rockchip: vop: split rk3288 vop + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index 9b25b8ffd0ce..a2b281e290e0 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -740,7 +740,7 @@ static const struct vop_intr rk3288_vop_intr = { + .clear = VOP_REG(RK3288_INTR_CTRL0, 0xf, 8), + }; + +-static const struct vop_data rk3288_vop = { ++static const struct vop_data rk3288_vop_big = { + .version = VOP_VERSION(3, 1), + .feature = VOP_FEATURE_OUTPUT_RGB10, + .max_output = { 3840, 2160 }, +@@ -753,6 +753,19 @@ static const struct vop_data rk3288_vop = { + .lut_size = 1024, + }; + ++static const struct vop_data rk3288_vop_lit = { ++ .version = VOP_VERSION(3, 1), ++ .feature = VOP_FEATURE_OUTPUT_RGB10, ++ .max_output = { 2560, 1600 }, ++ .intr = &rk3288_vop_intr, ++ .common = &rk3288_common, ++ .modeset = &rk3288_modeset, ++ .output = &rk3288_output, ++ .win = rk3288_vop_win_data, ++ .win_size = ARRAY_SIZE(rk3288_vop_win_data), ++ .lut_size = 1024, ++}; ++ + static const int rk3368_vop_intrs[] = { + FS_INTR, + 0, 0, +@@ -1142,8 +1155,10 @@ static const struct of_device_id vop_driver_dt_match[] = { + .data = &rk3066_vop }, + { .compatible = "rockchip,rk3188-vop", + .data = &rk3188_vop }, +- { .compatible = "rockchip,rk3288-vop", +- .data = &rk3288_vop }, ++ { .compatible = "rockchip,rk3288-vop-big", ++ .data = &rk3288_vop_big }, ++ { .compatible = "rockchip,rk3288-vop-lit", ++ .data = &rk3288_vop_lit }, + { .compatible = "rockchip,rk3368-vop", + .data = &rk3368_vop }, + { .compatible = "rockchip,rk3366-vop", + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 10 Oct 2020 14:33:30 +0000 +Subject: [PATCH] ARM: dts: rockchip: split rk3288 vop + +Signed-off-by: Jonas Karlman +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index 487b0e03d4b4..c60eacab8a79 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -1017,7 +1017,7 @@ rga: rga@ff920000 { + }; + + vopb: vop@ff930000 { +- compatible = "rockchip,rk3288-vop"; ++ compatible = "rockchip,rk3288-vop-big"; + reg = <0x0 0xff930000 0x0 0x19c>, <0x0 0xff931000 0x0 0x1000>; + interrupts = ; + clocks = <&cru ACLK_VOP0>, <&cru DCLK_VOP0>, <&cru HCLK_VOP0>; +@@ -1066,7 +1066,7 @@ vopb_mmu: iommu@ff930300 { + }; + + vopl: vop@ff940000 { +- compatible = "rockchip,rk3288-vop"; ++ compatible = "rockchip,rk3288-vop-lit"; + reg = <0x0 0xff940000 0x0 0x19c>, <0x0 0xff941000 0x0 0x1000>; + interrupts = ; + clocks = <&cru ACLK_VOP1>, <&cru DCLK_VOP1>, <&cru HCLK_VOP1>; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Jul 2020 18:00:44 +0000 +Subject: [PATCH] drm/bridge: dw-hdmi: add mtmdsclock parameter to phy + configure ops + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 ++++++---- + drivers/gpu/drm/renesas/rcar-du/rcar_dw_hdmi.c | 3 ++- + include/drm/bridge/dw_hdmi.h | 3 ++- + 3 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 40d8ca37f5bc..22af42a08980 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -138,7 +138,8 @@ struct dw_hdmi_phy_data { + bool has_svsret; + int (*configure)(struct dw_hdmi *hdmi, + const struct dw_hdmi_plat_data *pdata, +- unsigned long mpixelclock); ++ unsigned long mpixelclock, ++ unsigned long mtmdsclock); + }; + + struct dw_hdmi { +@@ -1585,7 +1586,8 @@ static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi) + */ + static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, + const struct dw_hdmi_plat_data *pdata, +- unsigned long mpixelclock) ++ unsigned long mpixelclock, ++ unsigned long mtmdsclock) + { + const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg; + const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr; +@@ -1660,9 +1662,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, + + /* Write to the PHY as configured by the platform */ + if (pdata->configure_phy) +- ret = pdata->configure_phy(hdmi, pdata->priv_data, mpixelclock); ++ ret = pdata->configure_phy(hdmi, pdata->priv_data, mpixelclock, mtmdsclock); + else +- ret = phy->configure(hdmi, pdata, mpixelclock); ++ ret = phy->configure(hdmi, pdata, mpixelclock, mtmdsclock); + if (ret) { + dev_err(hdmi->dev, "PHY configuration failed (clock %lu)\n", + mpixelclock); +diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/renesas/rcar-du/rcar_dw_hdmi.c +index 18ed14911b98..9c75095a25c5 100644 +--- a/drivers/gpu/drm/renesas/rcar-du/rcar_dw_hdmi.c ++++ b/drivers/gpu/drm/renesas/rcar-du/rcar_dw_hdmi.c +@@ -53,7 +53,8 @@ rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, + } + + static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, void *data, +- unsigned long mpixelclock) ++ unsigned long mpixelclock, ++ unsigned long mtmdsclock) + { + const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params; + +diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h +index f668e75fbabe..48fb72f9614f 100644 +--- a/include/drm/bridge/dw_hdmi.h ++++ b/include/drm/bridge/dw_hdmi.h +@@ -159,7 +159,8 @@ struct dw_hdmi_plat_data { + const struct dw_hdmi_curr_ctrl *cur_ctr; + const struct dw_hdmi_phy_config *phy_config; + int (*configure_phy)(struct dw_hdmi *hdmi, void *data, +- unsigned long mpixelclock); ++ unsigned long mpixelclock, ++ unsigned long mtmdsclock); + + unsigned int disable_cec : 1; + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Jul 2020 21:34:48 +0000 +Subject: [PATCH] drm/bridge: dw-hdmi: support configuring phy for deep color + +Q: Should we rename dw_hdmi_curr_ctrl and dw_hdmi_phy_config mpixelclock to mtmdsclock ? + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 22af42a08980..7fd45a7006b1 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1592,6 +1592,7 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, + const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg; + const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr; + const struct dw_hdmi_phy_config *phy_config = pdata->phy_config; ++ int depth; + + /* TOFIX Will need 420 specific PHY configuration tables */ + +@@ -1601,11 +1602,11 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, + break; + + for (; curr_ctrl->mpixelclock != ~0UL; curr_ctrl++) +- if (mpixelclock <= curr_ctrl->mpixelclock) ++ if (mtmdsclock <= curr_ctrl->mpixelclock) + break; + + for (; phy_config->mpixelclock != ~0UL; phy_config++) +- if (mpixelclock <= phy_config->mpixelclock) ++ if (mtmdsclock <= phy_config->mpixelclock) + break; + + if (mpll_config->mpixelclock == ~0UL || +@@ -1613,11 +1614,17 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, + phy_config->mpixelclock == ~0UL) + return -EINVAL; + +- dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[0].cpce, ++ depth = hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format); ++ if (depth > 8 && mpixelclock != mtmdsclock) ++ depth = fls(depth - 8) - 1; ++ else ++ depth = 0; ++ ++ dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].cpce, + HDMI_3D_TX_PHY_CPCE_CTRL); +- dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[0].gmp, ++ dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].gmp, + HDMI_3D_TX_PHY_GMPCTRL); +- dw_hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[0], ++ dw_hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[depth], + HDMI_3D_TX_PHY_CURRCTRL); + + dw_hdmi_phy_i2c_write(hdmi, 0, HDMI_3D_TX_PHY_PLLPHBYCTRL); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Jul 2020 22:25:15 +0000 +Subject: [PATCH] drm/bridge: dw-hdmi: add mpll_cfg_420 for ycbcr420 mode + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- + include/drm/bridge/dw_hdmi.h | 1 + + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 7fd45a7006b1..a2d101ebf7a7 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1594,7 +1594,9 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, + const struct dw_hdmi_phy_config *phy_config = pdata->phy_config; + int depth; + +- /* TOFIX Will need 420 specific PHY configuration tables */ ++ if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format) && ++ pdata->mpll_cfg_420) ++ mpll_config = pdata->mpll_cfg_420; + + /* PLL/MPLL Cfg - always match on final entry */ + for (; mpll_config->mpixelclock != ~0UL; mpll_config++) +diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h +index 48fb72f9614f..02554d324b4b 100644 +--- a/include/drm/bridge/dw_hdmi.h ++++ b/include/drm/bridge/dw_hdmi.h +@@ -156,6 +156,7 @@ struct dw_hdmi_plat_data { + + /* Synopsys PHY support */ + const struct dw_hdmi_mpll_config *mpll_cfg; ++ const struct dw_hdmi_mpll_config *mpll_cfg_420; + const struct dw_hdmi_curr_ctrl *cur_ctr; + const struct dw_hdmi_phy_config *phy_config; + int (*configure_phy)(struct dw_hdmi *hdmi, void *data, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 20 Jul 2020 22:26:19 +0000 +Subject: [PATCH] drm/rockchip: dw-hdmi: add YCbCr420 mpll cfg for rk3399 + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 41 +++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index d42ac9fa3246..a37565649c13 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -177,6 +177,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { + } + }; + ++static const struct dw_hdmi_mpll_config rockchip_mpll_cfg_420[] = { ++ { ++ 30666000, { ++ { 0x00b7, 0x0000 }, ++ { 0x2157, 0x0000 }, ++ { 0x40f7, 0x0000 }, ++ }, ++ }, { ++ 92000000, { ++ { 0x00b7, 0x0000 }, ++ { 0x2143, 0x0001 }, ++ { 0x40a3, 0x0001 }, ++ }, ++ }, { ++ 184000000, { ++ { 0x0073, 0x0001 }, ++ { 0x2146, 0x0002 }, ++ { 0x4062, 0x0002 }, ++ }, ++ }, { ++ 340000000, { ++ { 0x0052, 0x0003 }, ++ { 0x214d, 0x0003 }, ++ { 0x4065, 0x0003 }, ++ }, ++ }, { ++ 600000000, { ++ { 0x0041, 0x0003 }, ++ { 0x3b4d, 0x0003 }, ++ { 0x5a65, 0x0003 }, ++ }, ++ }, { ++ ~0UL, { ++ { 0x0000, 0x0000 }, ++ { 0x0000, 0x0000 }, ++ { 0x0000, 0x0000 }, ++ }, ++ } ++}; ++ + static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { + /* pixelclk bpp8 bpp10 bpp12 */ + { +@@ -474,6 +514,7 @@ static struct rockchip_hdmi_chip_data rk3399_chip_data = { + static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { + .mode_valid = dw_hdmi_rockchip_mode_valid, + .mpll_cfg = rockchip_mpll_cfg, ++ .mpll_cfg_420 = rockchip_mpll_cfg_420, + .cur_ctr = rockchip_cur_ctr, + .phy_config = rockchip_phy_config, + .phy_data = &rk3399_chip_data, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shunqing Chen +Date: Wed, 15 Jul 2020 15:19:11 +0800 +Subject: [PATCH] drm/rockchip: dw-hdmi: add YCbCr420 mpll cfg for rk3288w + +Signed-off-by: Shunqing Chen +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 41 +++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index a37565649c13..66fee351f4a7 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -217,6 +217,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg_420[] = { + } + }; + ++static const struct dw_hdmi_mpll_config rockchip_rk3288w_mpll_cfg_420[] = { ++ { ++ 30666000, { ++ { 0x00b7, 0x0000 }, ++ { 0x2157, 0x0000 }, ++ { 0x40f7, 0x0000 }, ++ }, ++ }, { ++ 92000000, { ++ { 0x00b7, 0x0000 }, ++ { 0x2143, 0x0001 }, ++ { 0x40a3, 0x0001 }, ++ }, ++ }, { ++ 184000000, { ++ { 0x0073, 0x0001 }, ++ { 0x2146, 0x0002 }, ++ { 0x4062, 0x0002 }, ++ }, ++ }, { ++ 340000000, { ++ { 0x0052, 0x0003 }, ++ { 0x214d, 0x0003 }, ++ { 0x4065, 0x0003 }, ++ }, ++ }, { ++ 600000000, { ++ { 0x0040, 0x0003 }, ++ { 0x3b4c, 0x0003 }, ++ { 0x5a65, 0x0003 }, ++ }, ++ }, { ++ ~0UL, { ++ { 0x0000, 0x0000 }, ++ { 0x0000, 0x0000 }, ++ { 0x0000, 0x0000 }, ++ }, ++ } ++}; ++ + static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { + /* pixelclk bpp8 bpp10 bpp12 */ + { +@@ -479,6 +519,7 @@ static struct rockchip_hdmi_chip_data rk3288_chip_data = { + static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = { + .mode_valid = dw_hdmi_rockchip_mode_valid, + .mpll_cfg = rockchip_mpll_cfg, ++ .mpll_cfg_420 = rockchip_rk3288w_mpll_cfg_420, + .cur_ctr = rockchip_cur_ctr, + .phy_config = rockchip_phy_config, + .phy_data = &rk3288_chip_data, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 20 Dec 2019 08:12:42 +0000 +Subject: [PATCH] drm/rockchip: dw-hdmi: add bridge and switch to + drm_bridge_funcs + +Switch the dw-hdmi driver to drm_bridge_funcs by implementing +a new local bridge, connecting it to the dw-hdmi bridge. + +Also enable bridge format negotiation by implementing +atomic_get_input_bus_fmts and support for 8-bit RGB 4:4:4. + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 118 ++++++++++++++------ + 1 file changed, 81 insertions(+), 37 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 66fee351f4a7..d6d8f3335813 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -5,6 +5,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -72,6 +73,7 @@ struct rockchip_hdmi_chip_data { + struct rockchip_hdmi { + struct device *dev; + struct regmap *regmap; ++ struct drm_bridge bridge; + struct rockchip_encoder encoder; + const struct rockchip_hdmi_chip_data *chip_data; + struct clk *ref_clk; +@@ -82,11 +84,9 @@ struct rockchip_hdmi { + struct phy *phy; + }; + +-static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_encoder *encoder) ++static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_bridge *bridge) + { +- struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder); +- +- return container_of(rkencoder, struct rockchip_hdmi, encoder); ++ return container_of(bridge, struct rockchip_hdmi, bridge); + } + + static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { +@@ -335,31 +335,21 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, + + return MODE_OK; + } +- +-static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder) ++static void ++dw_hdmi_rockchip_bridge_mode_set(struct drm_bridge *bridge, ++ const struct drm_display_mode *mode, ++ const struct drm_display_mode *adjusted_mode) + { +-} ++ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); + +-static bool +-dw_hdmi_rockchip_encoder_mode_fixup(struct drm_encoder *encoder, +- const struct drm_display_mode *mode, +- struct drm_display_mode *adj_mode) +-{ +- return true; ++ clk_set_rate(hdmi->ref_clk, adjusted_mode->clock * 1000); + } + +-static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder, +- struct drm_display_mode *mode, +- struct drm_display_mode *adj_mode) ++static void dw_hdmi_rockchip_bridge_enable(struct drm_bridge *bridge) + { +- struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder); ++ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); ++ struct drm_encoder *encoder = bridge->encoder; + +- clk_set_rate(hdmi->ref_clk, adj_mode->clock * 1000); +-} +- +-static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder) +-{ +- struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder); + u32 val; + int ret; + +@@ -387,10 +377,21 @@ static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder) + ret ? "LIT" : "BIG"); + } + ++static bool is_rgb(u32 format) ++{ ++ switch (format) { ++ case MEDIA_BUS_FMT_RGB888_1X24: ++ return true; ++ default: ++ return false; ++ } ++} ++ + static int +-dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder, +- struct drm_crtc_state *crtc_state, +- struct drm_connector_state *conn_state) ++dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) + { + struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); + +@@ -400,12 +401,38 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder, + return 0; + } + +-static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = { +- .mode_fixup = dw_hdmi_rockchip_encoder_mode_fixup, +- .mode_set = dw_hdmi_rockchip_encoder_mode_set, +- .enable = dw_hdmi_rockchip_encoder_enable, +- .disable = dw_hdmi_rockchip_encoder_disable, +- .atomic_check = dw_hdmi_rockchip_encoder_atomic_check, ++static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state, ++ u32 output_fmt, ++ unsigned int *num_input_fmts) ++{ ++ u32 *input_fmt; ++ ++ *num_input_fmts = 0; ++ ++ if (!is_rgb(output_fmt)) ++ return NULL; ++ ++ input_fmt = kzalloc(sizeof(*input_fmt), GFP_KERNEL); ++ if (!input_fmt) ++ return NULL; ++ ++ *num_input_fmts = 1; ++ *input_fmt = output_fmt; ++ ++ return input_fmt; ++} ++ ++static const struct drm_bridge_funcs dw_hdmi_rockchip_bridge_funcs = { ++ .mode_set = dw_hdmi_rockchip_bridge_mode_set, ++ .enable = dw_hdmi_rockchip_bridge_enable, ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_get_input_bus_fmts = dw_hdmi_rockchip_get_input_bus_fmts, ++ .atomic_check = dw_hdmi_rockchip_bridge_atomic_check, ++ .atomic_reset = drm_atomic_helper_bridge_reset, + }; + + static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, +@@ -602,6 +629,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + struct dw_hdmi_plat_data *plat_data; + const struct of_device_id *match; + struct drm_device *drm = data; ++ struct drm_bridge *next_bridge; + struct drm_encoder *encoder; + struct rockchip_hdmi *hdmi; + int ret; +@@ -679,20 +707,21 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + RK3568_HDMI_SCLIN_MSK)); + } + +- drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); +- + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); + if (ret) { + DRM_DEV_ERROR(hdmi->dev, "Failed to init encoder: %d\n", ret); + goto err_disable_clk; + } + ++ hdmi->bridge.funcs = &dw_hdmi_rockchip_bridge_funcs; ++ drm_bridge_attach(encoder, &hdmi->bridge, NULL, 0); ++ + platform_set_drvdata(pdev, hdmi); + +- hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); ++ hdmi->hdmi = dw_hdmi_probe(pdev, plat_data); + + /* +- * If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(), ++ * If dw_hdmi_probe() fails we'll never call dw_hdmi_unbind(), + * which would have called the encoder cleanup. Do it manually. + */ + if (IS_ERR(hdmi->hdmi)) { +@@ -700,8 +729,23 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + goto err_bind; + } + ++ next_bridge = of_drm_find_bridge(pdev->dev.of_node); ++ if (!next_bridge) { ++ ret = -EPROBE_DEFER; ++ goto err_dw_hdmi_remove; ++ } ++ ++ ret = drm_bridge_attach(encoder, next_bridge, &hdmi->bridge, 0); ++ if (ret) { ++ if (ret != -EPROBE_DEFER) ++ DRM_DEV_ERROR(hdmi->dev, "Failed to attach dw-hdmi bridge: %d\n", ret); ++ goto err_dw_hdmi_remove; ++ } ++ + return 0; + ++err_dw_hdmi_remove: ++ dw_hdmi_remove(hdmi->hdmi); + err_bind: + drm_encoder_cleanup(encoder); + err_disable_clk: +@@ -719,7 +763,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, + { + struct rockchip_hdmi *hdmi = dev_get_drvdata(dev); + +- dw_hdmi_unbind(hdmi->hdmi); ++ dw_hdmi_remove(hdmi->hdmi); + drm_encoder_cleanup(&hdmi->encoder.encoder); + clk_disable_unprepare(hdmi->ref_clk); + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 9 Oct 2020 15:29:27 +0000 +Subject: [PATCH] drm/rockchip: vop: add immutable zpos property + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 2 ++ + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ++++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +index 092bf863110b..e2ee0d6a8d55 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +@@ -133,6 +133,8 @@ void rockchip_drm_mode_config_init(struct drm_device *dev) + dev->mode_config.max_width = 4096; + dev->mode_config.max_height = 4096; + ++ dev->mode_config.normalize_zpos = true; ++ + dev->mode_config.funcs = &rockchip_drm_mode_config_funcs; + dev->mode_config.helper_private = &rockchip_mode_config_helpers; + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 30e252ba7184..897f7980ee5d 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1917,7 +1917,7 @@ static irqreturn_t vop_isr(int irq, void *data) + return ret; + } + +-static void vop_plane_add_properties(struct drm_plane *plane, ++static void vop_plane_add_properties(struct drm_plane *plane, int zpos, + const struct vop_win_data *win_data) + { + unsigned int flags = 0; +@@ -1927,6 +1927,8 @@ static void vop_plane_add_properties(struct drm_plane *plane, + if (flags) + drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0, + DRM_MODE_ROTATE_0 | flags); ++ ++ drm_plane_create_zpos_immutable_property(plane, zpos); + } + + static int vop_create_crtc(struct vop *vop) +@@ -1967,7 +1969,7 @@ static int vop_create_crtc(struct vop *vop) + + plane = &vop_win->base; + drm_plane_helper_add(plane, &plane_helper_funcs); +- vop_plane_add_properties(plane, win_data); ++ vop_plane_add_properties(plane, i, win_data); + if (plane->type == DRM_PLANE_TYPE_PRIMARY) + primary = plane; + else if (plane->type == DRM_PLANE_TYPE_CURSOR) + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 10 Oct 2020 09:20:44 +0000 +Subject: [PATCH] drm/rockchip: vop: add plane color properties + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 32 +++++++++++++++++++-- + 1 file changed, 30 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 897f7980ee5d..eadf1b0f1704 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1917,8 +1917,23 @@ static irqreturn_t vop_isr(int irq, void *data) + return ret; + } + ++static bool plane_supports_yuv_format(const struct drm_plane *plane) ++{ ++ const struct drm_format_info *info; ++ int i; ++ ++ for (i = 0; i < plane->format_count; i++) { ++ info = drm_format_info(plane->format_types[i]); ++ if (info->is_yuv) ++ return true; ++ } ++ ++ return false; ++} ++ + static void vop_plane_add_properties(struct drm_plane *plane, int zpos, +- const struct vop_win_data *win_data) ++ const struct vop_win_data *win_data, ++ const struct vop_data *vop_data) + { + unsigned int flags = 0; + +@@ -1929,6 +1944,19 @@ static void vop_plane_add_properties(struct drm_plane *plane, int zpos, + DRM_MODE_ROTATE_0 | flags); + + drm_plane_create_zpos_immutable_property(plane, zpos); ++ ++ if (!plane_supports_yuv_format(plane)) ++ return; ++ ++ flags = BIT(DRM_COLOR_YCBCR_BT601) | BIT(DRM_COLOR_YCBCR_BT709); ++ if (vop_data->feature & VOP_FEATURE_OUTPUT_RGB10) ++ flags |= BIT(DRM_COLOR_YCBCR_BT2020); ++ ++ drm_plane_create_color_properties(plane, flags, ++ BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) | ++ BIT(DRM_COLOR_YCBCR_FULL_RANGE), ++ DRM_COLOR_YCBCR_BT601, ++ DRM_COLOR_YCBCR_LIMITED_RANGE); + } + + static int vop_create_crtc(struct vop *vop) +@@ -1969,7 +1997,7 @@ static int vop_create_crtc(struct vop *vop) + + plane = &vop_win->base; + drm_plane_helper_add(plane, &plane_helper_funcs); +- vop_plane_add_properties(plane, i, win_data); ++ vop_plane_add_properties(plane, i, win_data, vop_data); + if (plane->type == DRM_PLANE_TYPE_PRIMARY) + primary = plane; + else if (plane->type == DRM_PLANE_TYPE_CURSOR) + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nickey Yang +Date: Mon, 17 Jul 2017 16:35:34 +0800 +Subject: [PATCH] HACK: clk: rockchip: rk3288: dedicate npll for vopb and hdmi + use + +MINIARM: set npll be used for hdmi only + +Signed-off-by: Nickey Yang +Signed-off-by: Jonas Karlman +Signed-off-by: Alex Bee +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 2 ++ + drivers/clk/rockchip/clk-rk3288.c | 9 +++++---- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index c60eacab8a79..d1ae42757242 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -1026,6 +1026,8 @@ vopb: vop@ff930000 { + resets = <&cru SRST_LCDC0_AXI>, <&cru SRST_LCDC0_AHB>, <&cru SRST_LCDC0_DCLK>; + reset-names = "axi", "ahb", "dclk"; + iommus = <&vopb_mmu>; ++ assigned-clocks = <&cru DCLK_VOP0>; ++ assigned-clock-parents = <&cru PLL_NPLL>; + status = "disabled"; + + vopb_out: port { +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index baa5aebd3277..5cfcbaaa154e 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -195,8 +195,9 @@ PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" }; + PNAME(mux_aclk_cpu_src_p) = { "cpll_aclk_cpu", "gpll_aclk_cpu" }; + + PNAME(mux_pll_src_cpll_gpll_p) = { "cpll", "gpll" }; +-PNAME(mux_pll_src_npll_cpll_gpll_p) = { "npll", "cpll", "gpll" }; +-PNAME(mux_pll_src_cpll_gpll_npll_p) = { "cpll", "gpll", "npll" }; ++PNAME(mux_pll_src_npll_cpll_gpll_p) = { "prevent:npll", "cpll", "gpll" }; ++PNAME(mux_pll_src_cpll_gpll_npll_p) = { "cpll", "gpll", "prevent:npll" }; ++PNAME(vop0_mux_pll_src_cpll_gpll_npll_p) = { "prevent:cpll", "prevent:gpll", "npll" }; + PNAME(mux_pll_src_cpll_gpll_usb480m_p) = { "cpll", "gpll", "unstable:usbphy480m_src" }; + PNAME(mux_pll_src_cpll_gll_usb_npll_p) = { "cpll", "gpll", "unstable:usbphy480m_src", "npll" }; + +@@ -232,7 +233,7 @@ static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = { + [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12), + RK3288_MODE_CON, 12, 8, ROCKCHIP_PLL_SYNC_RATE, rk3288_pll_rates), + [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16), +- RK3288_MODE_CON, 14, 9, ROCKCHIP_PLL_SYNC_RATE, rk3288_pll_rates), ++ RK3288_MODE_CON, 14, 9, 0, rk3288_pll_rates), + }; + + static struct clk_div_table div_hclk_cpu_t[] = { +@@ -442,7 +443,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + RK3288_CLKSEL_CON(30), 14, 2, MFLAGS, 8, 5, DFLAGS, + RK3288_CLKGATE_CON(3), 4, GFLAGS), + +- COMPOSITE(DCLK_VOP0, "dclk_vop0", mux_pll_src_cpll_gpll_npll_p, 0, ++ COMPOSITE(DCLK_VOP0, "dclk_vop0", vop0_mux_pll_src_cpll_gpll_npll_p, CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, + RK3288_CLKSEL_CON(27), 0, 2, MFLAGS, 8, 8, DFLAGS, + RK3288_CLKGATE_CON(3), 1, GFLAGS), + COMPOSITE(DCLK_VOP1, "dclk_vop1", mux_pll_src_cpll_gpll_npll_p, 0, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 4 Aug 2018 14:51:14 +0200 +Subject: [PATCH] HACK: clk: rockchip: rk3288: use npll table to to improve + HDMI compatibility + +Based on https://github.com/TinkerBoard/debian_kernel/commit/3d90870530b8a2901681f7b7fa598ee7381e49f3 + +Signed-off-by: Jonas Karlman +Signed-off-by: Alex Bee +--- + drivers/clk/rockchip/clk-rk3288.c | 39 ++++++++++++++++++++++++++++++- + 1 file changed, 38 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index 5cfcbaaa154e..fa1c6e646bdf 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -121,6 +121,43 @@ static struct rockchip_pll_rate_table rk3288_pll_rates[] = { + { /* sentinel */ }, + }; + ++static struct rockchip_pll_rate_table rk3288_npll_rates[] = { ++ RK3066_PLL_RATE_NB(594000000, 1, 198, 8, 1), ++ RK3066_PLL_RATE_NB(585000000, 6, 585, 4, 32), ++ RK3066_PLL_RATE_NB(432000000, 3, 216, 4, 32), ++ RK3066_PLL_RATE_NB(426000000, 3, 213, 4, 32), ++ RK3066_PLL_RATE_NB(400000000, 1, 100, 6, 32), ++ RK3066_PLL_RATE(348500000, 8, 697, 6), ++ RK3066_PLL_RATE_NB(342000000, 3, 171, 4, 32), ++ RK3066_PLL_RATE_NB(297000000, 2, 198, 8, 16), ++ RK3066_PLL_RATE_NB(270000000, 1, 135, 12, 32), ++ RK3066_PLL_RATE_NB(260000000, 1, 130, 12, 32), ++ RK3066_PLL_RATE(241500000, 2, 161, 8), ++ RK3066_PLL_RATE(162000000, 1, 81, 12), ++ RK3066_PLL_RATE(154000000, 6, 539, 14), ++ RK3066_PLL_RATE_NB(148500000, 1, 99, 16, 32), ++ RK3066_PLL_RATE(148352000, 13, 1125, 14), ++ RK3066_PLL_RATE_NB(146250000, 6, 585, 16, 32), ++ RK3066_PLL_RATE(121750000, 6, 487, 16), ++ RK3066_PLL_RATE(119000000, 3, 238, 16), ++ RK3066_PLL_RATE_NB(108000000, 1, 54, 12, 32), ++ RK3066_PLL_RATE_NB(106500000, 4, 213, 12, 32), ++ RK3066_PLL_RATE(101000000, 3, 202, 16), ++ RK3066_PLL_RATE(88750000, 6, 355, 16), ++ RK3066_PLL_RATE_NB(85500000, 4, 171, 12, 32), ++ RK3066_PLL_RATE(83500000, 3, 167, 16), ++ RK3066_PLL_RATE(79500000, 1, 53, 16), ++ RK3066_PLL_RATE_NB(74250000, 4, 198, 16, 32), ++ RK3066_PLL_RATE(74176000, 26, 1125, 14), ++ RK3066_PLL_RATE(72000000, 1, 48, 16), ++ RK3066_PLL_RATE(71000000, 3, 142, 16), ++ RK3066_PLL_RATE(68250000, 2, 91, 16), ++ RK3066_PLL_RATE(65000000, 3, 130, 16), ++ RK3066_PLL_RATE(40000000, 3, 80, 16), ++ RK3066_PLL_RATE(33750000, 2, 45, 16), ++ { /* sentinel */ }, ++}; ++ + #define RK3288_DIV_ACLK_CORE_M0_MASK 0xf + #define RK3288_DIV_ACLK_CORE_M0_SHIFT 0 + #define RK3288_DIV_ACLK_CORE_MP_MASK 0xf +@@ -233,7 +270,7 @@ static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = { + [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12), + RK3288_MODE_CON, 12, 8, ROCKCHIP_PLL_SYNC_RATE, rk3288_pll_rates), + [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16), +- RK3288_MODE_CON, 14, 9, 0, rk3288_pll_rates), ++ RK3288_MODE_CON, 14, 9, 0, rk3288_npll_rates), + }; + + static struct clk_div_table div_hclk_cpu_t[] = { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Mon, 25 May 2020 20:36:45 +0000 +Subject: [PATCH] HACK: clk: rockchip: rk3399: dedicate vpll for vopb and hdmi + use + +Rockchip PLLs are kown provide the least jitter for +vco rates between 800 MHz and 2 GHz. I added the +rates for VPLL which are used for VOPs dclk and there- +fore HDMI phy in that manner and used the rates which +require the lowest frac divs. +Additionally I added some rates which are useful to +provide additional VESA and non-VESA rates for HDMI +output. + +Signed-off-by: Jonas Karlman +Signed-off-by: Alex Bee +--- + drivers/clk/rockchip/clk-rk3399.c | 49 ++++++++++++++++++++++++++----- + 1 file changed, 42 insertions(+), 7 deletions(-) + +diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c +index 306910a3a0d3..436d2789611c 100644 +--- a/drivers/clk/rockchip/clk-rk3399.c ++++ b/drivers/clk/rockchip/clk-rk3399.c +@@ -105,6 +105,39 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = { + { /* sentinel */ }, + }; + ++static struct rockchip_pll_rate_table rk3399_vpll_rates[] = { ++ /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ ++ RK3036_PLL_RATE( 594000000, 1, 74, 3, 1, 0, 4194304), /* vco = 1782000000 fout = 594000000 */ ++ RK3036_PLL_RATE( 593406592, 1, 74, 3, 1, 0, 2949838), /* vco = 1780219777 fout = 593406592.36908 */ ++ RK3036_PLL_RATE( 319750000, 1, 79, 6, 1, 0, 15728640), /* vco = 1918500000 fout = 319750000 */ ++ RK3036_PLL_RATE( 297000000, 1, 74, 6, 1, 0, 4194304), /* vco = 1782000000 fout = 297000000 */ ++ RK3036_PLL_RATE( 296703296, 1, 74, 6, 1, 0, 2949838), /* vco = 1780219777 fout = 296703296.18454 */ ++ RK3036_PLL_RATE( 241500000, 1, 60, 6, 1, 0, 6291456), /* vco = 1449000000 fout = 241500000 */ ++ RK3036_PLL_RATE( 162000000, 1, 67, 5, 2, 0, 8388608), /* vco = 1620000000 fout = 162000000 */ ++ RK3036_PLL_RATE( 148500000, 1, 74, 6, 2, 0, 4194304), /* vco = 1782000000 fout = 148500000*/ ++ RK3036_PLL_RATE( 148351648, 1, 74, 6, 2, 0, 2949838), /* vco = 1780219777 fout = 148351648.09227 */ ++ RK3036_PLL_RATE( 136750000, 1, 68, 2, 6, 0, 6291456), /* vco = 1641000000 fout = 136750000 */ ++ RK3036_PLL_RATE( 135000000, 1, 56, 5, 2, 0, 4194304), /* vco = 1350000000 fout = 135000000 */ ++ RK3036_PLL_RATE( 119000000, 1, 59, 6, 2, 0, 8388608), /* vco = 1428000000 fout = 119000000 */ ++ RK3036_PLL_RATE( 108000000, 1, 63, 7, 2, 1, 0), /* vco = 1512000000 fout = 108000000 */ ++ RK3036_PLL_RATE( 106500000, 1, 62, 7, 2, 0, 2097152), /* vco = 1491000000 fout = 106500000 */ ++ RK3036_PLL_RATE( 88750000, 1, 55, 5, 3, 0, 7864320), /* vco = 1331250000 fout = 88750000 */ ++ RK3036_PLL_RATE( 85500000, 1, 57, 4, 4, 1, 0), /* vco = 1368000000 fout = 85500000 */ ++ RK3036_PLL_RATE( 78750000, 1, 59, 6, 3, 0, 1048576), /* vco = 1417500000 fout = 78750000 */ ++ RK3036_PLL_RATE( 74250000, 1, 74, 6, 4, 0, 4194304), /* vco = 1782000000 fout = 74250000 */ ++ RK3036_PLL_RATE( 74175824, 1, 74, 6, 4, 0, 2949838), /* vco = 1780219777 fout = 74175824.046135 */ ++ RK3036_PLL_RATE( 71000000, 1, 71, 6, 4, 1, 0), /* vco = 1704000000 fout = 71000000 */ ++ RK3036_PLL_RATE( 65000000, 1, 65, 6, 4, 0, 0), /* vco = 1560000000 fout = 65000000 */ ++ RK3036_PLL_RATE( 59340659, 1, 59, 6, 4, 0, 5715310), /* vco = 1424175816 fout = 59340659.022331 */ ++ RK3036_PLL_RATE( 54000000, 1, 63, 7, 4, 1, 0), /* vco = 1512000000 fout = 54000000 */ ++ RK3036_PLL_RATE( 49500000, 1, 72, 5, 7, 0, 3145728), /* vco = 1732500000 fout = 49500000 */ ++ RK3036_PLL_RATE( 40000000, 1, 70, 7, 6, 1, 0), /* vco = 1680000000 fout = 40000000 */ ++ RK3036_PLL_RATE( 31500000, 1, 55, 7, 6, 0, 2097152), /* vco = 1323000000 fout = 31500000 */ ++ RK3036_PLL_RATE( 27000000, 1, 55, 7, 7, 0, 2097152), /* vco = 1323000000 fout = 27000000 */ ++ RK3036_PLL_RATE( 26973026, 1, 55, 7, 7, 0, 1173214), /* vco = 1321678296 fout = 26973026.450799 */ ++ { /* sentinel */ }, ++}; ++ + /* CRU parents */ + PNAME(mux_pll_p) = { "xin24m", "xin32k" }; + +@@ -123,7 +156,7 @@ PNAME(mux_ddrclk_p) = { "clk_ddrc_lpll_src", + PNAME(mux_aclk_cci_p) = { "cpll_aclk_cci_src", + "gpll_aclk_cci_src", + "npll_aclk_cci_src", +- "vpll_aclk_cci_src" }; ++ "prevent:vpll" }; + PNAME(mux_cci_trace_p) = { "cpll_cci_trace", + "gpll_cci_trace" }; + PNAME(mux_cs_p) = { "cpll_cs", "gpll_cs", +@@ -149,10 +182,12 @@ PNAME(mux_pll_src_cpll_gpll_npll_upll_24m_p) = { "cpll", "gpll", "npll", + PNAME(mux_pll_src_cpll_gpll_npll_ppll_upll_24m_p) = { "cpll", "gpll", "npll", + "ppll", "upll", "xin24m" }; + +-PNAME(mux_pll_src_vpll_cpll_gpll_p) = { "vpll", "cpll", "gpll" }; +-PNAME(mux_pll_src_vpll_cpll_gpll_npll_p) = { "vpll", "cpll", "gpll", ++PNAME(mux_pll_src_vpll_cpll_gpll_p) = { "prevent:vpll", "cpll", "gpll" }; ++PNAME(vop0_mux_pll_src_vpll_cpll_gpll_p) = { "vpll", "prevent:cpll", "prevent:gpll" }; ++ ++PNAME(mux_pll_src_vpll_cpll_gpll_npll_p) = { "prevent:vpll", "cpll", "gpll", + "npll" }; +-PNAME(mux_pll_src_vpll_cpll_gpll_24m_p) = { "vpll", "cpll", "gpll", ++PNAME(mux_pll_src_vpll_cpll_gpll_24m_p) = { "prevent:vpll", "cpll", "gpll", + "xin24m" }; + + PNAME(mux_dclk_vop0_p) = { "dclk_vop0_div", +@@ -229,7 +264,7 @@ static struct rockchip_pll_clock rk3399_pll_clks[] __initdata = { + [npll] = PLL(pll_rk3399, PLL_NPLL, "npll", mux_pll_p, 0, RK3399_PLL_CON(40), + RK3399_PLL_CON(43), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates), + [vpll] = PLL(pll_rk3399, PLL_VPLL, "vpll", mux_pll_p, 0, RK3399_PLL_CON(48), +- RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_pll_rates), ++ RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, rk3399_vpll_rates), + }; + + static struct rockchip_pll_clock rk3399_pmu_pll_clks[] __initdata = { +@@ -279,7 +314,7 @@ static struct rockchip_clk_branch rk3399_uart4_pmu_fracmux __initdata = + RK3399_PMU_CLKSEL_CON(5), 8, 2, MFLAGS); + + static struct rockchip_clk_branch rk3399_dclk_vop0_fracmux __initdata = +- MUX(DCLK_VOP0, "dclk_vop0", mux_dclk_vop0_p, CLK_SET_RATE_PARENT, ++ MUX(DCLK_VOP0, "dclk_vop0", mux_dclk_vop0_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, + RK3399_CLKSEL_CON(49), 11, 1, MFLAGS); + + static struct rockchip_clk_branch rk3399_dclk_vop1_fracmux __initdata = +@@ -1162,7 +1197,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { + GATE(HCLK_VOP0_NOC, "hclk_vop0_noc", "hclk_vop0_pre", CLK_IGNORE_UNUSED, + RK3399_CLKGATE_CON(28), 0, GFLAGS), + +- COMPOSITE(DCLK_VOP0_DIV, "dclk_vop0_div", mux_pll_src_vpll_cpll_gpll_p, 0, ++ COMPOSITE(DCLK_VOP0_DIV, "dclk_vop0_div", vop0_mux_pll_src_vpll_cpll_gpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, + RK3399_CLKSEL_CON(49), 8, 2, MFLAGS, 0, 8, DFLAGS, + RK3399_CLKGATE_CON(10), 12, GFLAGS), + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 19 Jul 2020 16:35:11 +0000 +Subject: [PATCH] HACK: dts: rockchip: do not use vopl for hdmi + +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 9 --------- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 9 --------- + 2 files changed, 18 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index d1ae42757242..7b2cde230b87 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -1090,11 +1090,6 @@ + #address-cells = <1>; + #size-cells = <0>; + +- vopl_out_hdmi: endpoint@0 { +- reg = <0>; +- remote-endpoint = <&hdmi_in_vopl>; +- }; +- + vopl_out_edp: endpoint@1 { + reg = <1>; + remote-endpoint = <&edp_in_vopl>; +@@ -1257,10 +1262,6 @@ + remote-endpoint = <&vopb_out_hdmi>; + }; + +- hdmi_in_vopl: endpoint@1 { +- reg = <1>; +- remote-endpoint = <&vopl_out_hdmi>; +- }; + }; + + hdmi_out: port@1 { +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 92c2207e686c..980b12cb0a49 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -1728,11 +1728,6 @@ vopl_out_edp: endpoint@1 { + remote-endpoint = <&edp_in_vopl>; + }; + +- vopl_out_hdmi: endpoint@2 { +- reg = <2>; +- remote-endpoint = <&hdmi_in_vopl>; +- }; +- + vopl_out_mipi1: endpoint@3 { + reg = <3>; + remote-endpoint = <&mipi1_in_vopl>; +@@ -1926,10 +1921,6 @@ hdmi_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <&vopb_out_hdmi>; + }; +- hdmi_in_vopl: endpoint@1 { +- reg = <1>; +- remote-endpoint = <&vopl_out_hdmi>; +- }; + }; + }; + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 20 Dec 2019 08:12:43 +0000 +Subject: [PATCH] WIP: drm/bridge: dw-hdmi: limit mode and bus format to + max_tmds_clock + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 120 ++++++++++++++-------- + 1 file changed, 76 insertions(+), 44 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index a2d101ebf7a7..7f6ffbc3e7b2 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -2003,6 +2003,21 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi, + HDMI_FC_PACKET_TX_EN_DRM_MASK, HDMI_FC_PACKET_TX_EN); + } + ++static unsigned int ++hdmi_get_tmdsclock(unsigned int bus_format, unsigned int pixelclock) ++{ ++ int color_depth = hdmi_bus_fmt_color_depth(bus_format); ++ unsigned int tmdsclock = pixelclock; ++ ++ if (!hdmi_bus_fmt_is_yuv422(bus_format) && color_depth > 8) ++ tmdsclock = (u64)pixelclock * color_depth / 8; ++ ++ if (hdmi_bus_fmt_is_yuv420(bus_format)) ++ tmdsclock /= 2; ++ ++ return tmdsclock; ++} ++ + static void hdmi_av_composer(struct dw_hdmi *hdmi, + const struct drm_display_info *display, + const struct drm_display_mode *mode) +@@ -2014,29 +2029,11 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, + unsigned int vdisplay, hdisplay; + + vmode->mpixelclock = mode->clock * 1000; ++ vmode->mtmdsclock = ++ hdmi_get_tmdsclock(hdmi->hdmi_data.enc_out_bus_format, ++ vmode->mpixelclock); + + dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock); +- +- vmode->mtmdsclock = vmode->mpixelclock; +- +- if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) { +- switch (hdmi_bus_fmt_color_depth( +- hdmi->hdmi_data.enc_out_bus_format)) { +- case 16: +- vmode->mtmdsclock = vmode->mpixelclock * 2; +- break; +- case 12: +- vmode->mtmdsclock = vmode->mpixelclock * 3 / 2; +- break; +- case 10: +- vmode->mtmdsclock = vmode->mpixelclock * 5 / 4; +- break; +- } +- } +- +- if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format)) +- vmode->mtmdsclock /= 2; +- + dev_dbg(hdmi->dev, "final tmdsclock = %d\n", vmode->mtmdsclock); + + /* Set up HDMI_FC_INVIDCONF */ +@@ -2663,8 +2660,21 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) + * - MEDIA_BUS_FMT_RGB888_1X24, + */ + +-/* Can return a maximum of 11 possible output formats for a mode/connector */ +-#define MAX_OUTPUT_SEL_FORMATS 11 ++/* Can return a maximum of 15 possible output formats for a mode/connector */ ++#define MAX_OUTPUT_SEL_FORMATS 15 ++ ++static bool is_tmds_allowed(struct drm_display_info *info, ++ struct drm_display_mode *mode, ++ u32 bus_format) ++{ ++ unsigned long tmdsclock = hdmi_get_tmdsclock(bus_format, mode->clock); ++ int max_tmds_clock = info->max_tmds_clock ? info->max_tmds_clock : 340000; ++ ++ if (max_tmds_clock >= tmdsclock) ++ return true; ++ ++ return false; ++} + + static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, +@@ -2676,8 +2686,6 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, + struct drm_display_info *info = &conn->display_info; + struct drm_display_mode *mode = &crtc_state->mode; + u8 max_bpc = conn_state->max_requested_bpc; +- bool is_hdmi2_sink = info->hdmi.scdc.supported || +- (info->color_formats & DRM_COLOR_FORMAT_YCBCR420); + u32 *output_fmts; + unsigned int i = 0; + +@@ -2701,25 +2709,28 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, + * If the current mode enforces 4:2:0, force the output but format + * to 4:2:0 and do not add the YUV422/444/RGB formats + */ +- if (conn->ycbcr_420_allowed && +- (drm_mode_is_420_only(info, mode) || +- (is_hdmi2_sink && drm_mode_is_420_also(info, mode)))) { ++ if (conn->ycbcr_420_allowed && drm_mode_is_420(info, mode) && ++ (info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) { + + /* Order bus formats from 16bit to 8bit if supported */ + if (max_bpc >= 16 && info->bpc == 16 && +- (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48)) ++ (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYYVYY16_0_5X48)) + output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY16_0_5X48; + + if (max_bpc >= 12 && info->bpc >= 12 && +- (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_36)) ++ (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_36) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYYVYY12_0_5X36)) + output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY12_0_5X36; + + if (max_bpc >= 10 && info->bpc >= 10 && +- (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_30)) ++ (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_30) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYYVYY10_0_5X30)) + output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY10_0_5X30; + + /* Default 8bit fallback */ +- output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY8_0_5X24; ++ if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYYVYY8_0_5X24)) ++ output_fmts[i++] = MEDIA_BUS_FMT_UYYVYY8_0_5X24; + + if (drm_mode_is_420_only(info, mode)) + *num_output_fmts = i; +@@ -2732,40 +2744,51 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, + */ + + /* Default 8bit RGB fallback */ +- output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; ++ if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_RGB888_1X24)) ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24; + + if (max_bpc >= 16 && info->bpc == 16) { +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR444) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_YUV16_1X48)) + output_fmts[i++] = MEDIA_BUS_FMT_YUV16_1X48; + +- output_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; ++ if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_RGB161616_1X48)) ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB161616_1X48; + } + + if (max_bpc >= 12 && info->bpc >= 12) { +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR422) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYVY12_1X24)) + output_fmts[i++] = MEDIA_BUS_FMT_UYVY12_1X24; + +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR444) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_YUV12_1X36)) + output_fmts[i++] = MEDIA_BUS_FMT_YUV12_1X36; + +- output_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; ++ if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_RGB121212_1X36)) ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB121212_1X36; + } + + if (max_bpc >= 10 && info->bpc >= 10) { +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR422) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYVY10_1X20)) + output_fmts[i++] = MEDIA_BUS_FMT_UYVY10_1X20; + +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR444) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_YUV10_1X30)) + output_fmts[i++] = MEDIA_BUS_FMT_YUV10_1X30; + +- output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; ++ if (is_tmds_allowed(info, mode, MEDIA_BUS_FMT_RGB101010_1X30)) ++ output_fmts[i++] = MEDIA_BUS_FMT_RGB101010_1X30; + } + +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR422) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR422) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_UYVY8_1X16)) + output_fmts[i++] = MEDIA_BUS_FMT_UYVY8_1X16; + +- if (info->color_formats & DRM_COLOR_FORMAT_YCBCR444) ++ if ((info->color_formats & DRM_COLOR_FORMAT_YCBCR444) && ++ is_tmds_allowed(info, mode, MEDIA_BUS_FMT_YUV8_1X24)) + output_fmts[i++] = MEDIA_BUS_FMT_YUV8_1X24; + + *num_output_fmts = i; + +@@ -2946,11 +2969,20 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, + struct dw_hdmi *hdmi = bridge->driver_private; + const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; + enum drm_mode_status mode_status = MODE_OK; ++ int max_tmds_clock = info->max_tmds_clock ? info->max_tmds_clock : 340000; ++ int clock = mode->clock; + + /* We don't support double-clocked modes */ + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + return MODE_BAD; + ++ if (pdata->ycbcr_420_allowed && drm_mode_is_420(info, mode) && ++ (info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) ++ clock /= 2; ++ ++ if (clock > max_tmds_clock) ++ return MODE_CLOCK_HIGH; ++ + if (pdata->mode_valid) + mode_status = pdata->mode_valid(hdmi, pdata->priv_data, info, + mode); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 20 Dec 2019 08:12:42 +0000 +Subject: [PATCH] WIP: drm/rockchip: dw_hdmi: add 10-bit rgb bus format + +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 42 +++++++++++++++++++++ + drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + + 2 files changed, 43 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index d6d8f3335813..89424c5bc24a 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -84,6 +84,8 @@ struct rockchip_hdmi { + struct phy *phy; + }; + ++#define to_crtc_state(x) container_of(x, struct drm_crtc_state, x) ++ + static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_bridge *bridge) + { + return container_of(bridge, struct rockchip_hdmi, bridge); +@@ -341,6 +343,11 @@ dw_hdmi_rockchip_bridge_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *adjusted_mode) + { + struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); ++ struct drm_crtc_state *crtc_state = to_crtc_state(adjusted_mode); ++ struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); ++ ++ if (hdmi->phy) ++ phy_set_bus_width(hdmi->phy, s->bus_width); + + clk_set_rate(hdmi->ref_clk, adjusted_mode->clock * 1000); + } +@@ -381,6 +388,17 @@ static bool is_rgb(u32 format) + { + switch (format) { + case MEDIA_BUS_FMT_RGB888_1X24: ++ case MEDIA_BUS_FMT_RGB101010_1X30: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static bool is_10bit(u32 format) ++{ ++ switch (format) { ++ case MEDIA_BUS_FMT_RGB101010_1X30: + return true; + default: + return false; +@@ -394,9 +412,24 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_connector_state *conn_state) + { + struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); ++ struct drm_atomic_state *state = bridge_state->base.state; ++ struct drm_crtc_state *old_crtc_state; ++ struct rockchip_crtc_state *old_state; ++ u32 format = bridge_state->output_bus_cfg.format; + + s->output_mode = ROCKCHIP_OUT_MODE_AAAA; + s->output_type = DRM_MODE_CONNECTOR_HDMIA; ++ s->output_bpc = 10; ++ s->bus_format = format; ++ s->bus_width = is_10bit(format) ? 10 : 8; ++ ++ old_crtc_state = drm_atomic_get_old_crtc_state(state, conn_state->crtc); ++ if (old_crtc_state && !crtc_state->mode_changed) { ++ old_state = to_rockchip_crtc_state(old_crtc_state); ++ if (s->bus_format != old_state->bus_format || ++ s->bus_width != old_state->bus_width) ++ crtc_state->mode_changed = true; ++ } + + return 0; + } +@@ -408,10 +441,19 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, + u32 output_fmt, + unsigned int *num_input_fmts) + { ++ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); ++ struct drm_encoder *encoder = bridge->encoder; + u32 *input_fmt; ++ bool has_10bit = true; + + *num_input_fmts = 0; + ++ if (drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder)) ++ has_10bit = false; ++ ++ if (!has_10bit && is_10bit(output_fmt)) ++ return NULL; ++ + if (!is_rgb(output_fmt)) + return NULL; + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +index 1641440837af..381e5ccab5f3 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +@@ -34,6 +34,7 @@ struct rockchip_crtc_state { + u32 bus_format; + u32 bus_flags; + int color_space; ++ int bus_width; + }; + #define to_rockchip_crtc_state(s) \ + container_of(s, struct rockchip_crtc_state, base) + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 8 Dec 2019 23:42:44 +0000 +Subject: [PATCH] WIP: drm: dw-hdmi: add content type connector property + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 7f6ffbc3e7b2..ae4c49e84470 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1790,6 +1790,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, + const struct drm_connector *connector, + const struct drm_display_mode *mode) + { ++ const struct drm_connector_state *conn_state = connector->state; + struct hdmi_avi_infoframe frame; + u8 val; + +@@ -1847,6 +1848,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, + HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; + } + ++ drm_hdmi_avi_infoframe_content_type(&frame, conn_state); ++ + /* + * The Designware IP uses a different byte format from standard + * AVI info frames, though generally the bits are in the correct +@@ -2551,7 +2554,8 @@ static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, + if (!crtc) + return 0; + +- if (!drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) { ++ if (!drm_connector_atomic_hdr_metadata_equal(old_state, new_state) || ++ old_state->content_type != new_state->content_type) { + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); +@@ -2619,6 +2623,8 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) + + drm_connector_attach_max_bpc_property(connector, 8, 16); + ++ drm_connector_attach_content_type_property(connector); ++ + if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) + drm_connector_attach_hdr_output_metadata_property(connector); + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 20 Dec 2019 08:12:43 +0000 +Subject: [PATCH] WIP: drm/rockchip: add yuv444 support + +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 29 ++++++++++++++++++++- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 29 +++++++++++++++++++++ + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 6 +++++ + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 19 ++++++++++++++ + 4 files changed, 82 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 89424c5bc24a..05de2052d95d 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -68,6 +68,7 @@ struct rockchip_hdmi_chip_data { + int lcdsel_grf_reg; + u32 lcdsel_big; + u32 lcdsel_lit; ++ bool ycbcr_444_allowed; + }; + + struct rockchip_hdmi { +@@ -395,10 +396,22 @@ static bool is_rgb(u32 format) + } + } + ++static bool is_yuv444(u32 format) ++{ ++ switch (format) { ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ return true; ++ default: ++ return false; ++ } ++} ++ + static bool is_10bit(u32 format) + { + switch (format) { + case MEDIA_BUS_FMT_RGB101010_1X30: ++ case MEDIA_BUS_FMT_YUV10_1X30: + return true; + default: + return false; +@@ -415,12 +428,22 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_atomic_state *state = bridge_state->base.state; + struct drm_crtc_state *old_crtc_state; + struct rockchip_crtc_state *old_state; ++ struct drm_bridge *next_bridge; ++ struct drm_bridge_state *next_bridge_state; + u32 format = bridge_state->output_bus_cfg.format; + + s->output_mode = ROCKCHIP_OUT_MODE_AAAA; + s->output_type = DRM_MODE_CONNECTOR_HDMIA; + s->output_bpc = 10; + s->bus_format = format; ++ ++ next_bridge = drm_bridge_get_next_bridge(bridge); ++ if (next_bridge) { ++ next_bridge_state = drm_atomic_get_new_bridge_state(state, ++ next_bridge); ++ format = next_bridge_state->output_bus_cfg.format; ++ } ++ + s->bus_width = is_10bit(format) ? 10 : 8; + + old_crtc_state = drm_atomic_get_old_crtc_state(state, conn_state->crtc); +@@ -454,7 +477,10 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, + if (!has_10bit && is_10bit(output_fmt)) + return NULL; + +- if (!is_rgb(output_fmt)) ++ if (is_yuv444(output_fmt)) { ++ if (!hdmi->chip_data->ycbcr_444_allowed) ++ return NULL; ++ } else if (!is_rgb(output_fmt)) + return NULL; + + input_fmt = kzalloc(sizeof(*input_fmt), GFP_KERNEL); +@@ -604,6 +630,7 @@ static const struct dw_hdmi_phy_ops rk3328_hdmi_phy_ops = { + + static struct rockchip_hdmi_chip_data rk3328_chip_data = { + .lcdsel_grf_reg = -1, ++ .ycbcr_444_allowed = true, + }; + + static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index eadf1b0f1704..0e4eca0d5121 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -347,6 +347,17 @@ static int vop_convert_afbc_format(uint32_t format) + return -EINVAL; + } + ++static bool is_yuv_output(uint32_t bus_format) ++{ ++ switch (bus_format) { ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ return true; ++ default: ++ return false; ++ } ++} ++ + static uint16_t scl_vop_cal_scale(enum scale_mode mode, uint32_t src, + uint32_t dst, bool is_horizontal, + int vsu_mode, int *vskiplines) +@@ -1455,6 +1466,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, + u16 vact_end = vact_st + vdisplay; + uint32_t pin_pol, val; + int dither_bpc = s->output_bpc ? s->output_bpc : 10; ++ bool yuv_output = is_yuv_output(s->bus_format); + int ret; + + if (old_state && old_state->self_refresh_active) { +@@ -1520,6 +1532,8 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, + !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) + s->output_mode = ROCKCHIP_OUT_MODE_P888; + ++ VOP_REG_SET(vop, common, dsp_data_swap, yuv_output ? 2 : 0); ++ + if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && dither_bpc <= 8) + VOP_REG_SET(vop, common, pre_dither_down, 1); + else +@@ -1535,6 +1549,21 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, + + VOP_REG_SET(vop, common, out_mode, s->output_mode); + ++ VOP_REG_SET(vop, common, overlay_mode, yuv_output); ++ VOP_REG_SET(vop, common, dsp_out_yuv, yuv_output); ++ ++ /* ++ * Background color is 10bit depth if vop version >= 3.5 ++ */ ++ if (!yuv_output) ++ val = 0; ++ else if (VOP_MAJOR(vop_data->version) == 3 && ++ VOP_MINOR(vop_data->version) >= 5) ++ val = 0x20010200; ++ else ++ val = 0x801080; ++ VOP_REG_SET(vop, common, dsp_background, val); ++ + VOP_REG_SET(vop, modeset, htotal_pw, (htotal << 16) | hsync_len); + val = hact_st << 16; + val |= hact_end; +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +index ca4e2b7415fe..47ad74ef1afb 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +@@ -119,10 +119,16 @@ struct vop_common { + struct vop_reg mmu_en; + struct vop_reg out_mode; + struct vop_reg standby; ++ ++ struct vop_reg overlay_mode; ++ struct vop_reg dsp_data_swap; ++ struct vop_reg dsp_out_yuv; ++ struct vop_reg dsp_background; + }; + + struct vop_misc { + struct vop_reg global_regdone_en; ++ struct vop_reg win_channel[4]; + }; + + struct vop_intr { +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index a2b281e290e0..b16a4c42773c 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -705,6 +705,11 @@ static const struct vop_common rk3288_common = { + .dsp_blank = VOP_REG(RK3288_DSP_CTRL0, 0x3, 18), + .out_mode = VOP_REG(RK3288_DSP_CTRL0, 0xf, 0), + .cfg_done = VOP_REG_SYNC(RK3288_REG_CFG_DONE, 0x1, 0), ++ ++ .overlay_mode = VOP_REG(RK3288_SYS_CTRL, 0x1, 16), ++ .dsp_data_swap = VOP_REG(RK3288_DSP_CTRL0, 0x1f, 12), ++ .dsp_out_yuv = VOP_REG(RK3288_POST_SCL_CTRL, 0x1, 2), ++ .dsp_background = VOP_REG(RK3288_DSP_BG, 0xffffffff, 0), + }; + + /* +@@ -926,6 +931,11 @@ static const struct vop_common rk3399_common = { + .dsp_blank = VOP_REG(RK3399_DSP_CTRL0, 0x3, 18), + .out_mode = VOP_REG(RK3399_DSP_CTRL0, 0xf, 0), + .cfg_done = VOP_REG_SYNC(RK3399_REG_CFG_DONE, 0x1, 0), ++ ++ .overlay_mode = VOP_REG(RK3399_SYS_CTRL, 0x1, 16), ++ .dsp_data_swap = VOP_REG(RK3399_DSP_CTRL0, 0x1f, 12), ++ .dsp_out_yuv = VOP_REG(RK3288_POST_SCL_CTRL, 0x1, 2), ++ .dsp_background = VOP_REG(RK3288_DSP_BG, 0xffffffff, 0), + }; + + static const struct vop_yuv2yuv_phy rk3399_yuv2yuv_win01_data = { +@@ -1096,6 +1106,10 @@ static const struct vop_output rk3328_output = { + + static const struct vop_misc rk3328_misc = { + .global_regdone_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 11), ++ ++ .win_channel[0] = VOP_REG(RK3328_WIN0_CTRL2, 0xff, 0), ++ .win_channel[1] = VOP_REG(RK3328_WIN1_CTRL2, 0xff, 0), ++ .win_channel[2] = VOP_REG(RK3328_WIN2_CTRL2, 0xff, 0), + }; + + static const struct vop_common rk3328_common = { +@@ -1108,6 +1122,11 @@ static const struct vop_common rk3328_common = { + .dsp_blank = VOP_REG(RK3328_DSP_CTRL0, 0x3, 18), + .out_mode = VOP_REG(RK3328_DSP_CTRL0, 0xf, 0), + .cfg_done = VOP_REG_SYNC(RK3328_REG_CFG_DONE, 0x1, 0), ++ ++ .overlay_mode = VOP_REG(RK3328_SYS_CTRL, 0x1, 16), ++ .dsp_data_swap = VOP_REG(RK3328_DSP_CTRL0, 0x1f, 12), ++ .dsp_out_yuv = VOP_REG(RK3328_POST_SCL_CTRL, 0x1, 2), ++ .dsp_background = VOP_REG(RK3328_DSP_BG, 0xffffffff, 0), + }; + + static const struct vop_intr rk3328_vop_intr = { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 20 Dec 2019 08:12:43 +0000 +Subject: [PATCH] WIP: drm/rockchip: add yuv420 support + +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 22 +++++++++++++++++++++ + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 19 +++++++++++++++++- + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 10 ++++++---- + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 2 ++ + 4 files changed, 48 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 05de2052d95d..cb201612199f 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -407,9 +407,21 @@ static bool is_yuv444(u32 format) + } + } + ++static bool is_yuv420(u32 format) ++{ ++ switch (format) { ++ case MEDIA_BUS_FMT_UYYVYY10_0_5X30: ++ case MEDIA_BUS_FMT_UYYVYY8_0_5X24: ++ return true; ++ default: ++ return false; ++ } ++} ++ + static bool is_10bit(u32 format) + { + switch (format) { ++ case MEDIA_BUS_FMT_UYYVYY10_0_5X30: + case MEDIA_BUS_FMT_RGB101010_1X30: + case MEDIA_BUS_FMT_YUV10_1X30: + return true; +@@ -446,6 +458,11 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, + + s->bus_width = is_10bit(format) ? 10 : 8; + ++ if (is_yuv420(format)) { ++ s->output_mode = ROCKCHIP_OUT_MODE_YUV420; ++ s->bus_width /= 2; ++ } ++ + old_crtc_state = drm_atomic_get_old_crtc_state(state, conn_state->crtc); + if (old_crtc_state && !crtc_state->mode_changed) { + old_state = to_rockchip_crtc_state(old_crtc_state); +@@ -466,6 +483,7 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, + { + struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); + struct drm_encoder *encoder = bridge->encoder; ++ struct drm_connector *connector = conn_state->connector; + u32 *input_fmt; + bool has_10bit = true; + +@@ -480,6 +498,9 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, + if (is_yuv444(output_fmt)) { + if (!hdmi->chip_data->ycbcr_444_allowed) + return NULL; ++ } else if (is_yuv420(output_fmt)) { ++ if (!connector->ycbcr_420_allowed) ++ return NULL; + } else if (!is_rgb(output_fmt)) + return NULL; + +@@ -640,6 +661,7 @@ static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { + .phy_name = "inno_dw_hdmi_phy2", + .phy_force_vendor = true, + .use_drm_infoframe = true, ++ .ycbcr_420_allowed = true, + }; + + static struct rockchip_hdmi_chip_data rk3399_chip_data = { +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 0e4eca0d5121..e50f71ad3ceb 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -348,6 +349,19 @@ static int vop_convert_afbc_format(uint32_t format) + } + + static bool is_yuv_output(uint32_t bus_format) ++{ ++ switch (bus_format) { ++ case MEDIA_BUS_FMT_YUV8_1X24: ++ case MEDIA_BUS_FMT_YUV10_1X30: ++ case MEDIA_BUS_FMT_UYYVYY8_0_5X24: ++ case MEDIA_BUS_FMT_UYYVYY10_0_5X30: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static bool bus_fmt_has_uv_swapped(uint32_t bus_format) + { + switch (bus_format) { + case MEDIA_BUS_FMT_YUV8_1X24: +@@ -1532,7 +1546,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, + !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) + s->output_mode = ROCKCHIP_OUT_MODE_P888; + +- VOP_REG_SET(vop, common, dsp_data_swap, yuv_output ? 2 : 0); ++ VOP_REG_SET(vop, common, dsp_data_swap, bus_fmt_has_uv_swapped(s->bus_format) ? 2 : 0); + + if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && dither_bpc <= 8) + VOP_REG_SET(vop, common, pre_dither_down, 1); +@@ -1549,6 +1563,9 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, + + VOP_REG_SET(vop, common, out_mode, s->output_mode); + ++ VOP_REG_SET(vop, common, dclk_ddr, ++ s->output_mode == ROCKCHIP_OUT_MODE_YUV420 ? 1 : 0); ++ + VOP_REG_SET(vop, common, overlay_mode, yuv_output); + VOP_REG_SET(vop, common, dsp_out_yuv, yuv_output); + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +index 47ad74ef1afb..94a615dca672 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +@@ -121,6 +121,7 @@ struct vop_common { + struct vop_reg standby; + + struct vop_reg overlay_mode; ++ struct vop_reg dclk_ddr; + struct vop_reg dsp_data_swap; + struct vop_reg dsp_out_yuv; + struct vop_reg dsp_background; +diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +index b16a4c42773c..5463b04240f7 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c ++++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +@@ -707,6 +707,7 @@ static const struct vop_common rk3288_common = { + .cfg_done = VOP_REG_SYNC(RK3288_REG_CFG_DONE, 0x1, 0), + + .overlay_mode = VOP_REG(RK3288_SYS_CTRL, 0x1, 16), ++ .dclk_ddr = VOP_REG(RK3288_DSP_CTRL0, 0x1, 8), + .dsp_data_swap = VOP_REG(RK3288_DSP_CTRL0, 0x1f, 12), + .dsp_out_yuv = VOP_REG(RK3288_POST_SCL_CTRL, 0x1, 2), + .dsp_background = VOP_REG(RK3288_DSP_BG, 0xffffffff, 0), +@@ -1124,6 +1125,7 @@ static const struct vop_common rk3328_common = { + .cfg_done = VOP_REG_SYNC(RK3328_REG_CFG_DONE, 0x1, 0), + + .overlay_mode = VOP_REG(RK3328_SYS_CTRL, 0x1, 16), ++ .dclk_ddr = VOP_REG(RK3328_DSP_CTRL0, 0x1, 8), + .dsp_data_swap = VOP_REG(RK3328_DSP_CTRL0, 0x1f, 12), + .dsp_out_yuv = VOP_REG(RK3328_POST_SCL_CTRL, 0x1, 2), + .dsp_background = VOP_REG(RK3328_DSP_BG, 0xffffffff, 0), + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 15 Aug 2020 23:20:34 +0200 +Subject: [PATCH] drm/rockchip: enable ycbcr_420_allowed and ycbcr_444_allowed + for RK3228 + +--- + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index cb201612199f..8627f6826bfe 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -616,6 +616,7 @@ static const struct dw_hdmi_phy_ops rk3228_hdmi_phy_ops = { + + static struct rockchip_hdmi_chip_data rk3228_chip_data = { + .lcdsel_grf_reg = -1, ++ .ycbcr_444_allowed = true, + }; + + static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { +@@ -624,6 +625,7 @@ static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { + .phy_ops = &rk3228_hdmi_phy_ops, + .phy_name = "inno_dw_hdmi_phy2", + .phy_force_vendor = true, ++ .ycbcr_420_allowed = true, + }; + + static struct rockchip_hdmi_chip_data rk3288_chip_data = { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 18 Nov 2017 11:09:39 +0100 +Subject: [PATCH] rockchip: vop: force skip lines if image too big + +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index e50f71ad3ceb..ef0a078c22f4 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -965,6 +965,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + int format; + int is_yuv = fb->format->is_yuv; + int i; ++ int skiplines = 0; + + /* + * can't update plane when vop is disabled. +@@ -983,8 +984,14 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + obj = fb->obj[0]; + rk_obj = to_rockchip_obj(obj); + ++ /* ++ * Force skip lines when image is yuv and 3840 width, ++ * fixes a "jumping" green lines issue on RK3328. ++ */ + actual_w = drm_rect_width(src) >> 16; +- actual_h = drm_rect_height(src) >> 16; ++ if (actual_w == 3840 && is_yuv) ++ skiplines = 1; ++ actual_h = drm_rect_height(src) >> (16 + skiplines); + act_info = (actual_h - 1) << 16 | ((actual_w - 1) & 0xffff); + + dsp_info = (drm_rect_height(dest) - 1) << 16; +@@ -1026,7 +1033,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + + VOP_WIN_SET(vop, win, format, format); + VOP_WIN_SET(vop, win, fmt_10, is_fmt_10(fb->format->format)); +- VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4)); ++ VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4 >> skiplines)); + VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); + VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv); + VOP_WIN_SET(vop, win, y_mir_en, +@@ -1050,7 +1057,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, + offset += (src->y1 >> 16) * fb->pitches[1] / vsub; + + dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1]; +- VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4)); ++ VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4 >> skiplines)); + VOP_WIN_SET(vop, win, uv_mst, dma_addr); + + for (i = 0; i < NUM_YUV2YUV_COEFFICIENTS; i++) { + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 10 Apr 2021 16:54:26 +0200 +Subject: [PATCH] drm/bridge: dw-hdmi: fix RGB to YUV color space conversion + +We are currently providing color space conversion coefficents +for RGB to YUV conversion for full range to full range. +This is wrong, since we are hardcoding YCC quantization range +limited in the AVI infoframe (which is correct according to +HDMI specs). This results in to dark colors if this conversion +is used. +I verfied this by setting YCC quantization range to full in +AVI infoframe which resulted in correct colors. Doing this, +however, will be ignored by some (most) sinks. + +This patch fixes this, by providing CSC coefficents which +convert RGB full range to YUV limited range for both BT601 +and BT709 colorspaces. + +Fixes: 9aaf880ed4ee ("imx-drm: Add mx6 hdmi transmitter support") +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index ae4c49e84470..92e621f2714f 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -82,15 +82,15 @@ static const u16 csc_coeff_rgb_out_eitu709[3][4] = { + }; + + static const u16 csc_coeff_rgb_in_eitu601[3][4] = { +- { 0x2591, 0x1322, 0x074b, 0x0000 }, +- { 0x6535, 0x2000, 0x7acc, 0x0200 }, +- { 0x6acd, 0x7534, 0x2000, 0x0200 } ++ { 0x2040, 0x1080, 0x0640, 0x0040 }, ++ { 0xe880, 0x1c00, 0xfb80, 0x0200 }, ++ { 0xed80, 0xf680, 0x1c00, 0x0200 } + }; + + static const u16 csc_coeff_rgb_in_eitu709[3][4] = { +- { 0x2dc5, 0x0d9b, 0x049e, 0x0000 }, +- { 0x62f0, 0x2000, 0x7d11, 0x0200 }, +- { 0x6756, 0x78ab, 0x2000, 0x0200 } ++ { 0x2740, 0x0bc0, 0x0400, 0x0040 }, ++ { 0xe680, 0x1c00, 0xfd80, 0x0200 }, ++ { 0xea40, 0xf980, 0x1c00, 0x0200 } + }; + + static const u16 csc_coeff_rgb_full_to_rgb_limited[3][4] = { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Tue, 1 Jun 2021 19:24:37 +0200 +Subject: [PATCH] drm/rockchip: allow 4096px width modes + +There is not reason to limit vop output to 3840px width modes. +Also drop the limitation from dw_hdmi_rockchip_mode_valid, since +the max dimenstions of the actual vop version is validated in +vop_crtc_mode_valid anyways. + +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index ef0a078c22f4..49619f794061 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -424,8 +424,8 @@ static void scl_vop_cal_scl_fac(struct vop *vop, const struct vop_win_data *win, + if (info->is_yuv) + is_yuv = true; + +- if (dst_w > 3840) { +- DRM_DEV_ERROR(vop->dev, "Maximum dst width (3840) exceeded\n"); ++ if (dst_w > 4096) { ++ DRM_DEV_ERROR(vop->dev, "Maximum dst width (4096) exceeded\n"); + return; + } + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 1 Oct 2019 20:52:42 +0000 +Subject: [PATCH] media: cec-adap: add debounce support when setting an invalid + phys addr + +When EDID is refreshed, HDMI cable is unplugged/replugged or +an AVR is power cycled the CEC phys addr gets invalidated. + +This can cause some disruption of CEC communication when +adapter is being reconfigured. + +Add a debounce_ms module option that can be used to debounce setting +an invalid phys addr. Default is not to use debouncing. + +Using a configured debounce_ms of e.g. 5000 ms, cec reconfiguring +could be avoided when AVR was power cycled on my setup. + +Power off AVR (default cec.debounce_ms=0): +[ 101.536866] cec-dw_hdmi: new physical address f.f.f.f +[ 102.495686] cec-dw_hdmi: new physical address 2.1.0.0 +[ 102.495913] cec-dw_hdmi: physical address: 2.1.0.0, claim 1 logical addresses +[ 102.628574] cec-dw_hdmi: config: la 1 pa 2.1.0.0 +[ 105.130115] cec-dw_hdmi: new physical address f.f.f.f +[ 106.979705] cec-dw_hdmi: new physical address 2.1.0.0 +[ 106.979872] cec-dw_hdmi: physical address: 2.1.0.0, claim 1 logical addresses +[ 107.112399] cec-dw_hdmi: config: la 1 pa 2.1.0.0 +[ 108.979408] cec-dw_hdmi: reported physical address 2.0.0.0 for logical address 5 +[ 109.205386] cec-dw_hdmi: reported physical address 2.0.0.0 for logical address 11 + +Power on AVR (default cec.debounce_ms=0): +[ 158.398447] cec-dw_hdmi: new physical address f.f.f.f +[ 161.977714] cec-dw_hdmi: new physical address 2.1.0.0 +[ 161.978766] cec-dw_hdmi: physical address: 2.1.0.0, claim 1 logical addresses +[ 162.115624] cec-dw_hdmi: config: la 1 pa 2.1.0.0 +[ 162.402750] cec-dw_hdmi: new physical address f.f.f.f +[ 162.403389] cec-dw_hdmi: cec_transmit_msg_fh: adapter is unconfigured +[ 162.886757] cec-dw_hdmi: new physical address 2.1.0.0 +[ 162.886964] cec-dw_hdmi: physical address: 2.1.0.0, claim 1 logical addresses +[ 163.510725] cec-dw_hdmi: config: la 1 pa 2.1.0.0 +[ 173.034200] cec-dw_hdmi: message 10 89 02 05 timed out + +Power off AVR (cec.debounce_ms=5000): +[ 251.720471] cec-dw_hdmi: reported physical address 2.0.0.0 for logical address 5 +[ 251.922432] cec-dw_hdmi: reported physical address 2.0.0.0 for logical address 11 + +Power on AVR (cec.debounce_ms=5000): +[ 291.154262] cec-dw_hdmi: reported physical address 2.0.0.0 for logical address 5 +[ 291.296199] cec-dw_hdmi: reported physical address 2.0.0.0 for logical address 11 + +Signed-off-by: Jonas Karlman +--- + drivers/media/cec/core/cec-adap.c | 9 ++++++++- + drivers/media/cec/core/cec-core.c | 18 ++++++++++++++++++ + drivers/media/cec/core/cec-priv.h | 1 + + include/media/cec.h | 2 ++ + 4 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c +index 41a79293ee02..542ab1425339 100644 +--- a/drivers/media/cec/core/cec-adap.c ++++ b/drivers/media/cec/core/cec-adap.c +@@ -1674,8 +1674,15 @@ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) + if (IS_ERR_OR_NULL(adap)) + return; + ++ cancel_delayed_work_sync(&adap->debounce_work); ++ + mutex_lock(&adap->lock); +- __cec_s_phys_addr(adap, phys_addr, block); ++ if (cec_debounce_ms > 0 && !block && phys_addr == CEC_PHYS_ADDR_INVALID && ++ adap->phys_addr != phys_addr) ++ schedule_delayed_work(&adap->debounce_work, ++ msecs_to_jiffies(cec_debounce_ms)); ++ else ++ __cec_s_phys_addr(adap, phys_addr, block); + mutex_unlock(&adap->lock); + } + EXPORT_SYMBOL_GPL(cec_s_phys_addr); +diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c +index af358e901b5f..bece8c56e5af 100644 +--- a/drivers/media/cec/core/cec-core.c ++++ b/drivers/media/cec/core/cec-core.c +@@ -40,6 +40,10 @@ static bool debug_phys_addr; + module_param(debug_phys_addr, bool, 0644); + MODULE_PARM_DESC(debug_phys_addr, "add CEC_CAP_PHYS_ADDR if set"); + ++int cec_debounce_ms; ++module_param_named(debounce_ms, cec_debounce_ms, int, 0644); ++MODULE_PARM_DESC(debounce_ms, "debounce invalid phys addr"); ++ + static dev_t cec_dev_t; + + /* Active devices */ +@@ -188,6 +192,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap) + + mutex_unlock(&devnode->lock); + ++ cancel_delayed_work_sync(&adap->debounce_work); ++ + mutex_lock(&adap->lock); + __cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false); + __cec_s_log_addrs(adap, NULL, false); +@@ -246,6 +252,17 @@ static const struct file_operations cec_error_inj_fops = { + }; + #endif + ++static void cec_s_phys_addr_debounce(struct work_struct *work) ++{ ++ struct delayed_work *delayed_work = to_delayed_work(work); ++ struct cec_adapter *adap = ++ container_of(delayed_work, struct cec_adapter, debounce_work); ++ ++ mutex_lock(&adap->lock); ++ __cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false); ++ mutex_unlock(&adap->lock); ++} ++ + struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, + void *priv, const char *name, u32 caps, + u8 available_las) +@@ -283,6 +300,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, + INIT_LIST_HEAD(&adap->transmit_queue); + INIT_LIST_HEAD(&adap->wait_queue); + init_waitqueue_head(&adap->kthread_waitq); ++ INIT_DELAYED_WORK(&adap->debounce_work, cec_s_phys_addr_debounce); + + /* adap->devnode initialization */ + INIT_LIST_HEAD(&adap->devnode.fhs); +diff --git a/drivers/media/cec/core/cec-priv.h b/drivers/media/cec/core/cec-priv.h +index b78df931aa74..ebbea63ea9de 100644 +--- a/drivers/media/cec/core/cec-priv.h ++++ b/drivers/media/cec/core/cec-priv.h +@@ -37,6 +37,7 @@ static inline bool msg_is_raw(const struct cec_msg *msg) + + /* cec-core.c */ + extern int cec_debug; ++extern int cec_debounce_ms; + int cec_get_device(struct cec_devnode *devnode); + void cec_put_device(struct cec_devnode *devnode); + +diff --git a/include/media/cec.h b/include/media/cec.h +index abee41ae02d0..544eedb5d671 100644 +--- a/include/media/cec.h ++++ b/include/media/cec.h +@@ -236,6 +236,8 @@ struct cec_adapter { + struct task_struct *kthread; + wait_queue_head_t kthread_waitq; + ++ struct delayed_work debounce_work; ++ + const struct cec_adap_ops *ops; + void *priv; + u32 capabilities; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Fri, 22 Oct 2021 11:17:30 +0200 +Subject: [PATCH] WIP: drm/bridge: synopsys: Fix CEC not working after + power-cyclying + +This fixes standby -> power-on on Rockchip platform for, at least, +RK3288/RK3328/RK3399 where CEC wasn't working after powering on again. +It might differ for other phy implementations: +The whole HPD-detection part shoud be reworked and we should in general +avoid to rely in RX_SENSE phy status (at least for HDMI), since it differs +depending on sink's implementation. + +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index 92e621f2714f..7551e3ab77d6 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -3179,12 +3179,6 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) + phy_stat & HDMI_PHY_HPD, + phy_stat & HDMI_PHY_RX_SENSE); + +- if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) { +- mutex_lock(&hdmi->cec_notifier_mutex); +- cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); +- mutex_unlock(&hdmi->cec_notifier_mutex); +- } +- + if (phy_stat & HDMI_PHY_HPD) + status = connector_status_connected; + +@@ -3201,6 +3195,14 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) + drm_helper_hpd_irq_event(hdmi->bridge.dev); + drm_bridge_hpd_notify(&hdmi->bridge, status); + } ++ ++ if (status == connector_status_disconnected && ++ (phy_stat & HDMI_PHY_RX_SENSE) && ++ (phy_int_pol & HDMI_PHY_RX_SENSE)) { ++ mutex_lock(&hdmi->cec_notifier_mutex); ++ cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); ++ mutex_unlock(&hdmi->cec_notifier_mutex); ++ } + } + + hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Fri, 9 Oct 2020 15:24:53 +0000 +Subject: [PATCH] drm/rockchip: vop: create planes in window order + +Signed-off-by: Jonas Karlman +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 36 +++------------------ + 1 file changed, 4 insertions(+), 32 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 49619f794061..9915bf124374 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -2023,19 +2023,10 @@ static int vop_create_crtc(struct vop *vop) + int ret; + int i; + +- /* +- * Create drm_plane for primary and cursor planes first, since we need +- * to pass them to drm_crtc_init_with_planes, which sets the +- * "possible_crtcs" to the newly initialized crtc. +- */ + for (i = 0; i < vop_data->win_size; i++) { + struct vop_win *vop_win = &vop->win[i]; + const struct vop_win_data *win_data = vop_win->data; + +- if (win_data->type != DRM_PLANE_TYPE_PRIMARY && +- win_data->type != DRM_PLANE_TYPE_CURSOR) +- continue; +- + ret = drm_universal_plane_init(vop->drm_dev, &vop_win->base, + 0, &vop_plane_funcs, + win_data->phy->data_formats, +@@ -2068,32 +2059,13 @@ static int vop_create_crtc(struct vop *vop) + drm_crtc_enable_color_mgmt(crtc, 0, false, vop_data->lut_size); + } + +- /* +- * Create drm_planes for overlay windows with possible_crtcs restricted +- * to the newly created crtc. +- */ ++ /* Set possible_crtcs to the newly created crtc for overlay windows */ + for (i = 0; i < vop_data->win_size; i++) { + struct vop_win *vop_win = &vop->win[i]; +- const struct vop_win_data *win_data = vop_win->data; +- unsigned long possible_crtcs = drm_crtc_mask(crtc); +- +- if (win_data->type != DRM_PLANE_TYPE_OVERLAY) +- continue; + +- ret = drm_universal_plane_init(vop->drm_dev, &vop_win->base, +- possible_crtcs, +- &vop_plane_funcs, +- win_data->phy->data_formats, +- win_data->phy->nformats, +- win_data->phy->format_modifiers, +- win_data->type, NULL); +- if (ret) { +- DRM_DEV_ERROR(vop->dev, "failed to init overlay %d\n", +- ret); +- goto err_cleanup_crtc; +- } +- drm_plane_helper_add(&vop_win->base, &plane_helper_funcs); +- vop_plane_add_properties(&vop_win->base, win_data); ++ plane = &vop_win->base; ++ if (plane->type == DRM_PLANE_TYPE_OVERLAY) ++ plane->possible_crtcs = drm_crtc_mask(crtc); + } + + port = of_get_child_by_name(dev->of_node, "port"); diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1001-v4l2-rockchip.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1001-v4l2-rockchip.patch new file mode 100644 index 000000000000..d705909546c6 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1001-v4l2-rockchip.patch @@ -0,0 +1,506 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 23 May 2020 10:16:01 +0000 +Subject: [PATCH] WIP: media: rkvdec: pm runtime dont use autosuspend before + disable and cleanup + +Signed-off-by: Jonas Karlman +--- + drivers/staging/media/rkvdec/rkvdec.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 4f5436c89e08..eaf2f133a264 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -1125,9 +1125,9 @@ static int rkvdec_remove(struct platform_device *pdev) + + cancel_delayed_work_sync(&rkvdec->watchdog_work); + +- rkvdec_v4l2_cleanup(rkvdec); +- pm_runtime_disable(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); ++ pm_runtime_disable(&pdev->dev); ++ rkvdec_v4l2_cleanup(rkvdec); + } + + #ifdef CONFIG_PM + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Randy Li +Date: Sun, 6 Jan 2019 01:48:37 +0800 +Subject: [PATCH] soc: rockchip: power-domain: export idle request + +We need to put the power status of HEVC IP into IDLE unless +we can't reset that IP or the SoC would crash down. +rockchip_pmu_idle_request(dev, true)---> enter idle +rockchip_pmu_idle_request(dev, false)---> exit idle + +Signed-off-by: Caesar Wang +Signed-off-by: Jeffy Chen +Signed-off-by: Randy Li +--- + drivers/pmdomain/rockchip/pm-domains.c | 23 +++++++++++++++++++++++ + include/linux/rockchip_pmu.h | 15 +++++++++++++++ + include/soc/rockchip/pm_domains.h | 6 ++++++ + 3 files changed, 44 insertions(+) + create mode 100644 include/linux/rockchip_pmu.h + +diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c +index 89795abac951..ffb5d62c9d52 100644 +--- a/drivers/pmdomain/rockchip/pm-domains.c ++++ b/drivers/pmdomain/rockchip/pm-domains.c +@@ -309,6 +309,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, + return 0; + } + ++int rockchip_pmu_idle_request(struct device *dev, bool idle) ++{ ++ struct generic_pm_domain *genpd; ++ struct rockchip_pm_domain *pd; ++ int ret; ++ ++ if (IS_ERR_OR_NULL(dev)) ++ return -EINVAL; ++ ++ if (IS_ERR_OR_NULL(dev->pm_domain)) ++ return -EINVAL; ++ ++ genpd = pd_to_genpd(dev->pm_domain); ++ pd = to_rockchip_pd(genpd); ++ ++ mutex_lock(&pd->pmu->mutex); ++ ret = rockchip_pmu_set_idle_request(pd, idle); ++ mutex_unlock(&pd->pmu->mutex); ++ ++ return ret; ++} ++EXPORT_SYMBOL(rockchip_pmu_idle_request); ++ + static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd) + { + int i; +diff --git a/include/linux/rockchip_pmu.h b/include/linux/rockchip_pmu.h +new file mode 100644 +index 000000000000..720b3314e71a +--- /dev/null ++++ b/include/linux/rockchip_pmu.h +@@ -0,0 +1,15 @@ ++/* ++ * pm_domain.h - Definitions and headers related to device power domains. ++ * ++ * Copyright (C) 2017 Randy Li . ++ * ++ * This file is released under the GPLv2. ++ */ ++ ++#ifndef _LINUX_ROCKCHIP_PM_H ++#define _LINUX_ROCKCHIP_PM_H ++#include ++ ++int rockchip_pmu_idle_request(struct device *dev, bool idle); ++ ++#endif /* _LINUX_ROCKCHIP_PM_H */ +diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h +index 7dbd941fc937..c5a59dd71754 100644 +--- a/include/soc/rockchip/pm_domains.h ++++ b/include/soc/rockchip/pm_domains.h +@@ -10,6 +10,7 @@ + + int rockchip_pmu_block(void); + void rockchip_pmu_unblock(void); ++int rockchip_pmu_idle_request(struct device *dev, bool idle); + + #else /* CONFIG_ROCKCHIP_PM_DOMAINS */ + +@@ -20,6 +21,11 @@ static inline int rockchip_pmu_block(void) + + static inline void rockchip_pmu_unblock(void) { } + ++static inline int rockchip_pmu_idle_request(struct device *dev, bool idle) ++{ ++ return -ENOTSUPP; ++} ++ + #endif /* CONFIG_ROCKCHIP_PM_DOMAINS */ + + #endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */ + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 20 May 2020 17:04:47 +0200 +Subject: [PATCH] WIP: media: rkvdec: implement reset controls + +--- + .../bindings/media/rockchip,vdec.yaml | 19 +++++++ + drivers/staging/media/rkvdec/rkvdec-regs.h | 5 ++ + drivers/staging/media/rkvdec/rkvdec.c | 53 +++++++++++++++++++ + drivers/staging/media/rkvdec/rkvdec.h | 11 +++- + 4 files changed, 87 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml +index 3bcfb8e12333..dd6958df1de8 100644 +--- a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml ++++ b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml +@@ -53,6 +53,18 @@ properties: + iommus: + maxItems: 1 + ++ resets: ++ maxItems: 6 ++ ++ reset-names: ++ items: ++ - const: video_h ++ - const: video_a ++ - const: video_core ++ - const: video_cabac ++ - const: niu_a ++ - const: niu_h ++ + required: + - compatible + - reg +@@ -60,6 +72,8 @@ required: + - clocks + - clock-names + - power-domains ++ - resets ++ - reset-names + + additionalProperties: false + +@@ -78,6 +92,11 @@ examples: + clock-names = "axi", "ahb", "cabac", "core"; + power-domains = <&power RK3399_PD_VDU>; + iommus = <&vdec_mmu>; ++ resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>, ++ <&cru SRST_VDU_CORE>, <&cru SRST_VDU_CA>, ++ <&cru SRST_A_VDU_NOC>, <&cru SRST_H_VDU_NOC>; ++ reset-names = "video_h", "video_a", "video_core", "video_cabac", ++ "niu_a", "niu_h"; + }; + + ... +diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h +index 15b9bee92016..3acc914888f6 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-regs.h ++++ b/drivers/staging/media/rkvdec/rkvdec-regs.h +@@ -28,6 +28,11 @@ + #define RKVDEC_SOFTRST_EN_P BIT(20) + #define RKVDEC_FORCE_SOFTRESET_VALID BIT(21) + #define RKVDEC_SOFTRESET_RDY BIT(22) ++#define RKVDEC_ERR_MASK (RKVDEC_BUS_STA \ ++ | RKVDEC_ERR_STA \ ++ | RKVDEC_TIMEOUT_STA \ ++ | RKVDEC_BUF_EMPTY_STA \ ++ | RKVDEC_COLMV_REF_ERR_STA ) + + #define RKVDEC_REG_SYSCTRL 0x008 + #define RKVDEC_IN_ENDIAN BIT(0) +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index eaf2f133a264..f55abb7c377f 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -10,12 +10,15 @@ + */ + + #include ++#include + #include + #include + #include + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -717,6 +720,11 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx, + + pm_runtime_mark_last_busy(rkvdec->dev); + pm_runtime_put_autosuspend(rkvdec->dev); ++ ++ if (result == VB2_BUF_STATE_ERROR && ++ rkvdec->reset_mask == RESET_NONE) ++ rkvdec->reset_mask |= RESET_SOFT; ++ + rkvdec_job_finish_no_pm(ctx, result); + } + +@@ -754,6 +762,33 @@ static void rkvdec_device_run(void *priv) + + if (WARN_ON(!desc)) + return; ++ if (rkvdec->reset_mask != RESET_NONE) { ++ ++ if (rkvdec->reset_mask & RESET_SOFT) { ++ writel(RKVDEC_SOFTRST_EN_P, ++ rkvdec->regs + RKVDEC_REG_INTERRUPT); ++ udelay(RKVDEC_RESET_DELAY); ++ if (readl(rkvdec->regs + RKVDEC_REG_INTERRUPT) ++ & RKVDEC_SOFTRESET_RDY) ++ dev_info_ratelimited(rkvdec->dev, ++ "softreset failed\n"); ++ } ++ ++ if (rkvdec->reset_mask & RESET_HARD) { ++ rockchip_pmu_idle_request(rkvdec->dev, true); ++ ret = reset_control_assert(rkvdec->rstc); ++ if (!ret) { ++ udelay(RKVDEC_RESET_DELAY); ++ ret = reset_control_deassert(rkvdec->rstc); ++ } ++ rockchip_pmu_idle_request(rkvdec->dev, false); ++ if (ret) ++ dev_notice_ratelimited(rkvdec->dev, ++ "hardreset failed\n"); ++ } ++ rkvdec->reset_mask = RESET_NONE; ++ pm_runtime_suspend(rkvdec->dev); ++ } + + ret = pm_runtime_resume_and_get(rkvdec->dev); + if (ret < 0) { +@@ -1020,6 +1055,11 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv) + if (cancel_delayed_work(&rkvdec->watchdog_work)) { + struct rkvdec_ctx *ctx; + ++ if (state == VB2_BUF_STATE_ERROR) { ++ rkvdec->reset_mask |= (status & RKVDEC_ERR_MASK) ? ++ RESET_HARD : RESET_SOFT; ++ } ++ + ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); + rkvdec_job_finish(ctx, state); + } +@@ -1037,6 +1077,7 @@ static void rkvdec_watchdog_func(struct work_struct *work) + ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); + if (ctx) { + dev_err(rkvdec->dev, "Frame processing timed out!\n"); ++ rkvdec->reset_mask |= RESET_HARD; + writel(RKVDEC_IRQ_DIS, rkvdec->regs + RKVDEC_REG_INTERRUPT); + writel(0, rkvdec->regs + RKVDEC_REG_SYSCTRL); + rkvdec_job_finish(ctx, VB2_BUF_STATE_ERROR); +@@ -1105,6 +1146,18 @@ static int rkvdec_probe(struct platform_device *pdev) + return ret; + } + ++ ++ rkvdec->rstc = devm_reset_control_array_get(&pdev->dev, false, true); ++ if (IS_ERR(rkvdec->rstc)) { ++ dev_err(&pdev->dev, ++ "get resets failed %ld\n", PTR_ERR(rkvdec->rstc)); ++ return PTR_ERR(rkvdec->rstc); ++ } else { ++ dev_dbg(&pdev->dev, ++ "requested %d resets\n", ++ reset_control_get_count(&pdev->dev)); ++ } ++ + pm_runtime_set_autosuspend_delay(&pdev->dev, 100); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(&pdev->dev); +diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h +index b9e219438bc9..f02f79c405f0 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.h ++++ b/drivers/staging/media/rkvdec/rkvdec.h +@@ -11,10 +11,11 @@ + #ifndef RKVDEC_H_ + #define RKVDEC_H_ + ++#include + #include ++#include + #include + #include +-#include + + #include + #include +@@ -22,6 +23,12 @@ + #include + #include + ++#define RESET_NONE 0 ++#define RESET_SOFT BIT(0) ++#define RESET_HARD BIT(1) ++ ++#define RKVDEC_RESET_DELAY 5 ++ + struct rkvdec_ctx; + + struct rkvdec_ctrl_desc { +@@ -96,6 +103,8 @@ struct rkvdec_dev { + void __iomem *regs; + struct mutex vdev_lock; /* serializes ioctls */ + struct delayed_work watchdog_work; ++ struct reset_control *rstc; ++ u8 reset_mask; + }; + + struct rkvdec_ctx { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Tue, 18 Aug 2020 11:38:04 +0200 +Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3399 + +--- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 980b12cb0a49..6e3149e587c5 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -1345,6 +1348,11 @@ vdec: video-codec@ff660000 { + clock-names = "axi", "ahb", "cabac", "core"; + iommus = <&vdec_mmu>; + power-domains = <&power RK3399_PD_VDU>; ++ resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>, ++ <&cru SRST_VDU_CORE>, <&cru SRST_VDU_CA>, ++ <&cru SRST_A_VDU_NOC>, <&cru SRST_H_VDU_NOC>; ++ reset-names = "video_h", "video_a", "video_core", "video_cabac", ++ "niu_a", "niu_h"; + }; + + vdec_mmu: iommu@ff660480 { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 21 Aug 2021 16:12:36 +0200 +Subject: [PATCH] media: hantro: rockchip: Increase RK3288's max ACLK + +Required to proper decode H.264@4K + +Signed-off-by: Alex Bee +--- + drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c +index 8de6fd2e8eef..002b1a600f93 100644 +--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c ++++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c +@@ -15,7 +15,8 @@ + #include "rockchip_vpu2_regs.h" + + #define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000) +-#define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000) ++#define RK3288_ACLK_MAX_FREQ (600 * 1000 * 1000) ++#define RK3399_ACLK_MAX_FREQ (400 * 1000 * 1000) + #define RK3588_ACLK_MAX_FREQ (300 * 1000 * 1000) + + #define ROCKCHIP_VPU981_MIN_SIZE 64 +@@ -346,13 +347,20 @@ static int rk3066_vpu_hw_init(struct hantro_dev *vpu) + return 0; + } + +-static int rockchip_vpu_hw_init(struct hantro_dev *vpu) ++static int rk3288_vpu_hw_init(struct hantro_dev *vpu) + { + /* Bump ACLK to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3288_ACLK_MAX_FREQ); + return 0; + } + ++static int rockchip_vpu_hw_init(struct hantro_dev *vpu) ++{ ++ /* Bump ACLK to max. possible freq. to improve performance. */ ++ clk_set_rate(vpu->clocks[0].clk, RK3399_ACLK_MAX_FREQ); ++ return 0; ++} ++ + static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx) + { + struct hantro_dev *vpu = ctx->dev; +@@ -592,7 +600,7 @@ const struct hantro_variant rk3288_vpu_variant = { + .codec_ops = rk3288_vpu_codec_ops, + .irqs = rockchip_vpu1_irqs, + .num_irqs = ARRAY_SIZE(rockchip_vpu1_irqs), +- .init = rockchip_vpu_hw_init, ++ .init = rk3288_vpu_hw_init, + .clk_names = rockchip_vpu_clk_names, + .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names) + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 4 Jul 2021 15:19:44 +0200 +Subject: [PATCH] media: rkvdec: disable QoS for VP9 (corruptions on RK3328 + otherwise) + +Signed-off-by: Alex Bee +--- + drivers/staging/media/rkvdec/rkvdec-regs.h | 2 ++ + drivers/staging/media/rkvdec/rkvdec-vp9.c | 8 ++++++++ + 2 files changed, 10 insertions(+) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h +index 3acc914888f6..265f5234f4eb 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-regs.h ++++ b/drivers/staging/media/rkvdec/rkvdec-regs.h +@@ -222,6 +222,8 @@ + #define RKVDEC_REG_H264_ERR_E 0x134 + #define RKVDEC_H264_ERR_EN_HIGHBITS(x) ((x) & 0x3fffffff) + ++#define RKVDEC_QOS_CTRL 0x18C ++ + #define RKVDEC_REG_PREF_LUMA_CACHE_COMMAND 0x410 + #define RKVDEC_REG_PREF_CHR_CACHE_COMMAND 0x450 + +diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c +index d8c1c0db15c7..a289bc968e91 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-vp9.c ++++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c +@@ -802,6 +802,7 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx) + struct rkvdec_dev *rkvdec = ctx->dev; + struct rkvdec_vp9_run run = { }; + int ret; ++ u32 reg; + + ret = rkvdec_vp9_run_preamble(ctx, &run); + if (ret) { +@@ -823,6 +824,13 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx) + writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND); + + writel(0xe, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); ++ ++ /* disable QOS for RK3328 - no effect on other SoCs */ ++ reg = readl(rkvdec->regs + RKVDEC_QOS_CTRL); ++ reg |= 0xFFFF; ++ reg &= (~BIT(12)); ++ writel(reg, rkvdec->regs + RKVDEC_QOS_CTRL); ++ + /* Start decoding! */ + writel(RKVDEC_INTERRUPT_DEC_E | RKVDEC_CONFIG_DEC_CLK_GATE_E | + RKVDEC_TIMEOUT_E | RKVDEC_BUF_EMPTY_E, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Thu, 16 Jun 2022 13:18:22 +0200 +Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3328 + +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 5519347232f6..431c4ec198be 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -674,6 +674,11 @@ vdec: video-codec@ff360000 { + assigned-clocks = <&cru ACLK_RKVDEC>, <&cru SCLK_VDEC_CABAC>, + <&cru SCLK_VDEC_CORE>; + assigned-clock-rates = <400000000>, <400000000>, <300000000>; ++ resets = <&cru SRST_VDEC_H>, <&cru SRST_VDEC_A>, ++ <&cru SRST_VDEC_CORE>, <&cru SRST_VDEC_CABAC>, ++ <&cru SRST_VDEC_NIU_A>, <&cru SRST_VDEC_NIU_H>; ++ reset-names = "video_h", "video_a", "video_core", "video_cabac", ++ "niu_a", "niu_h"; + iommus = <&vdec_mmu>; + power-domains = <&power RK3328_PD_VIDEO>; + }; diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1002-for-libreelec.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1002-for-libreelec.patch new file mode 100644 index 000000000000..1143681e4d09 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1002-for-libreelec.patch @@ -0,0 +1,688 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 2 Sep 2020 19:52:02 +0200 +Subject: [PATCH] arm64: dts: rockchip: add gpu powerdomain, gpu opp-table and + cooling cell for RK3328 + +Note: since the regulator that supplies the GPU usually also supplies +other SoC components, we have to make sure voltage is never lower then +1075 mV - also disable 500 MHz for now, since it will crash if rkvdec +is running at the same time (voltage to high) + +Signed-off-by: Alex Bee +--- + .../arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 4 +++ + .../arm64/boot/dts/rockchip/rk3328-rock64.dts | 4 +++ + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 35 +++++++++++++++++++ + 3 files changed, 43 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index aa22a0c22265..51c7723d6762 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -166,6 +166,10 @@ &gmac2io { + status = "okay"; + }; + ++&gpu { ++ mali-supply = <&vdd_logic>; ++}; ++ + &hdmi { + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +index f69a38f42d2d..c198a8a7f95a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +@@ -162,6 +162,10 @@ &gmac2io { + status = "okay"; + }; + ++&gpu { ++ mali-supply = <&vdd_logic>; ++}; ++ + &hdmi { + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 431c4ec198be..eec03adf0902 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -300,6 +300,11 @@ power: power-controller { + #address-cells = <1>; + #size-cells = <0>; + ++ power-domain@RK3328_PD_GPU { ++ reg = ; ++ clocks = <&cru ACLK_GPU>; ++ #power-domain-cells = <0>; ++ }; + power-domain@RK3328_PD_HEVC { + reg = ; + #power-domain-cells = <0>; +@@ -539,6 +544,11 @@ map0 { + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + contribution = <4096>; + }; ++ map1 { ++ trip = <&target>; ++ cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ contribution = <4096>; ++ }; + }; + }; + +@@ -620,7 +630,32 @@ gpu: gpu@ff300000 { + "ppmmu1"; + clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>; + clock-names = "bus", "core"; ++ operating-points-v2 = <&gpu_opp_table>; ++ power-domains = <&power RK3328_PD_GPU>; + resets = <&cru SRST_GPU_A>; ++ #cooling-cells = <2>; ++ }; ++ ++ gpu_opp_table: gpu-opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-200000000 { ++ opp-hz = /bits/ 64 <200000000>; ++ opp-microvolt = <1075000>; ++ }; ++ opp-300000000 { ++ opp-hz = /bits/ 64 <300000000>; ++ opp-microvolt = <1075000>; ++ }; ++ opp-400000000 { ++ opp-hz = /bits/ 64 <400000000>; ++ opp-microvolt = <1075000>; ++ }; ++ opp-500000000 { ++ opp-hz = /bits/ 64 <500000000>; ++ opp-microvolt = <1150000>; ++ status = "disabled"; ++ }; + }; + + h265e_mmu: iommu@ff330200 { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Tue, 2 Feb 2021 17:22:21 +0200 +Subject: [PATCH] ARM: dts: RK3288 miqi add hdmi sound nodes + +Signed-off-by: Alex Bee +--- + arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +index 713f55e143c6..8d30c49f406e 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +@@ -78,6 +78,21 @@ vcc_sys: vsys-regulator { + regulator-always-on; + regulator-boot-on; + }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "HDMI"; ++ simple-audio-card,mclk-fs = <512>; ++ ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s>; ++ }; ++ }; + }; + + &cpu0 { +@@ -284,6 +299,11 @@ &i2c5 { + status = "okay"; + }; + ++&i2s { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ + &io_domains { + status = "okay"; + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Fri, 2 Apr 2021 17:54:22 +0200 +Subject: [PATCH] ARM/arm64: dts: rockchip: align sound card names + +Signed-off-by: Alex Bee +--- + arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi | 2 +- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +index 09618bb7d872..db9106a3dd22 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288-tinker.dtsi +@@ -73,7 +73,7 @@ sdio_pwrseq: sdio-pwrseq { + sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; +- simple-audio-card,name = "rockchip,tinker-codec"; ++ simple-audio-card,name = "HDMI"; + simple-audio-card,mclk-fs = <512>; + + simple-audio-card,codec { +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 093ebe070775..a10fe60b7680 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -1893,7 +1893,7 @@ hdmi_sound: hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; +- simple-audio-card,name = "hdmi-sound"; ++ simple-audio-card,name = "HDMI"; + status = "disabled"; + + simple-audio-card,cpu { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 25 Mar 2018 22:17:06 +0200 +Subject: [PATCH] ASoC: hdmi-codec: fix channel allocation + +--- + sound/soc/codecs/hdmi-codec.c | 113 ++++++++++++++++------------------ + 1 file changed, 52 insertions(+), 61 deletions(-) + +diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c +index 5679102de91f..f0cd183f7873 100644 +--- a/sound/soc/codecs/hdmi-codec.c ++++ b/sound/soc/codecs/hdmi-codec.c +@@ -194,78 +194,69 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { + */ + static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { + { .ca_id = 0x00, .n_ch = 2, +- .mask = FL | FR}, +- /* 2.1 */ +- { .ca_id = 0x01, .n_ch = 4, +- .mask = FL | FR | LFE}, +- /* Dolby Surround */ ++ .mask = FL | FR }, ++ { .ca_id = 0x03, .n_ch = 4, ++ .mask = FL | FR | LFE | FC }, + { .ca_id = 0x02, .n_ch = 4, + .mask = FL | FR | FC }, +- /* surround51 */ ++ { .ca_id = 0x01, .n_ch = 4, ++ .mask = FL | FR | LFE }, + { .ca_id = 0x0b, .n_ch = 6, +- .mask = FL | FR | LFE | FC | RL | RR}, +- /* surround40 */ +- { .ca_id = 0x08, .n_ch = 6, +- .mask = FL | FR | RL | RR }, +- /* surround41 */ +- { .ca_id = 0x09, .n_ch = 6, +- .mask = FL | FR | LFE | RL | RR }, +- /* surround50 */ ++ .mask = FL | FR | LFE | FC | RL | RR }, + { .ca_id = 0x0a, .n_ch = 6, + .mask = FL | FR | FC | RL | RR }, +- /* 6.1 */ +- { .ca_id = 0x0f, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RL | RR | RC }, +- /* surround71 */ ++ { .ca_id = 0x09, .n_ch = 6, ++ .mask = FL | FR | LFE | RL | RR }, ++ { .ca_id = 0x08, .n_ch = 6, ++ .mask = FL | FR | RL | RR }, ++ { .ca_id = 0x07, .n_ch = 6, ++ .mask = FL | FR | LFE | FC | RC }, ++ { .ca_id = 0x06, .n_ch = 6, ++ .mask = FL | FR | FC | RC }, ++ { .ca_id = 0x05, .n_ch = 6, ++ .mask = FL | FR | LFE | RC }, ++ { .ca_id = 0x04, .n_ch = 6, ++ .mask = FL | FR | RC }, + { .ca_id = 0x13, .n_ch = 8, + .mask = FL | FR | LFE | FC | RL | RR | RLC | RRC }, +- /* others */ +- { .ca_id = 0x03, .n_ch = 8, +- .mask = FL | FR | LFE | FC }, +- { .ca_id = 0x04, .n_ch = 8, +- .mask = FL | FR | RC}, +- { .ca_id = 0x05, .n_ch = 8, +- .mask = FL | FR | LFE | RC }, +- { .ca_id = 0x06, .n_ch = 8, +- .mask = FL | FR | FC | RC }, +- { .ca_id = 0x07, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RC }, +- { .ca_id = 0x0c, .n_ch = 8, +- .mask = FL | FR | RC | RL | RR }, +- { .ca_id = 0x0d, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | RC }, +- { .ca_id = 0x0e, .n_ch = 8, +- .mask = FL | FR | FC | RL | RR | RC }, +- { .ca_id = 0x10, .n_ch = 8, +- .mask = FL | FR | RL | RR | RLC | RRC }, +- { .ca_id = 0x11, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, + { .ca_id = 0x12, .n_ch = 8, + .mask = FL | FR | FC | RL | RR | RLC | RRC }, +- { .ca_id = 0x14, .n_ch = 8, +- .mask = FL | FR | FLC | FRC }, +- { .ca_id = 0x15, .n_ch = 8, +- .mask = FL | FR | LFE | FLC | FRC }, +- { .ca_id = 0x16, .n_ch = 8, +- .mask = FL | FR | FC | FLC | FRC }, +- { .ca_id = 0x17, .n_ch = 8, +- .mask = FL | FR | LFE | FC | FLC | FRC }, +- { .ca_id = 0x18, .n_ch = 8, +- .mask = FL | FR | RC | FLC | FRC }, +- { .ca_id = 0x19, .n_ch = 8, +- .mask = FL | FR | LFE | RC | FLC | FRC }, +- { .ca_id = 0x1a, .n_ch = 8, +- .mask = FL | FR | RC | FC | FLC | FRC }, +- { .ca_id = 0x1b, .n_ch = 8, +- .mask = FL | FR | LFE | RC | FC | FLC | FRC }, +- { .ca_id = 0x1c, .n_ch = 8, +- .mask = FL | FR | RL | RR | FLC | FRC }, +- { .ca_id = 0x1d, .n_ch = 8, +- .mask = FL | FR | LFE | RL | RR | FLC | FRC }, + { .ca_id = 0x1e, .n_ch = 8, + .mask = FL | FR | FC | RL | RR | FLC | FRC }, +- { .ca_id = 0x1f, .n_ch = 8, +- .mask = FL | FR | LFE | FC | RL | RR | FLC | FRC }, ++ { .ca_id = 0x11, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | FLC | FRC }, ++ { .ca_id = 0x10, .n_ch = 8, ++ .mask = FL | FR | RL | RR | RLC | RRC }, ++ { .ca_id = 0x1c, .n_ch = 8, ++ .mask = FL | FR | RL | RR | FLC | FRC }, ++ { .ca_id = 0x0f, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | RL | RR | RC }, ++ { .ca_id = 0x1b, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FC | FLC | FRC }, ++ { .ca_id = 0x0e, .n_ch = 8, ++ .mask = FL | FR | FC | RL | RR | RC }, ++ { .ca_id = 0x1a, .n_ch = 8, ++ .mask = FL | FR | RC | FC | FLC | FRC }, ++ { .ca_id = 0x0d, .n_ch = 8, ++ .mask = FL | FR | LFE | RL | RR | RC }, ++ { .ca_id = 0x19, .n_ch = 8, ++ .mask = FL | FR | LFE | RC | FLC | FRC }, ++ { .ca_id = 0x0c, .n_ch = 8, ++ .mask = FL | FR | RC | RL | RR }, ++ { .ca_id = 0x18, .n_ch = 8, ++ .mask = FL | FR | RC | FLC | FRC }, ++ { .ca_id = 0x17, .n_ch = 8, ++ .mask = FL | FR | LFE | FC | FLC | FRC }, ++ { .ca_id = 0x16, .n_ch = 8, ++ .mask = FL | FR | FC | FLC | FRC }, ++ { .ca_id = 0x15, .n_ch = 8, ++ .mask = FL | FR | LFE | FLC | FRC }, ++ { .ca_id = 0x14, .n_ch = 8, ++ .mask = FL | FR | FLC | FRC }, + }; + + struct hdmi_codec_priv { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 27 Feb 2021 17:52:02 +0100 +Subject: [PATCH] arm64: dts: rockchip: add SPDIF nodes for RK3328 A1 board + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 23 ++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +index 40bf808642b9..27a1799027c2 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +@@ -57,6 +57,24 @@ ir-receiver { + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + linux,rc-map-name = "rc-beelink-gs1"; + }; ++ ++ spdif_sound: spdif-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "SPDIF"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&spdif_dit>; ++ }; ++ }; ++ ++ spdif_dit: spdif-dit { ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; + }; + + &analog_sound { +@@ -325,6 +343,11 @@ &sdmmc { + status = "okay"; + }; + ++&spdif { ++ pinctrl-0 = <&spdifm0_tx>; ++ status = "okay"; ++}; ++ + &tsadc { + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 27 Feb 2021 18:01:13 +0100 +Subject: [PATCH] arm64: dts: rockchip: Add ir-receiver node for RK3328 ROC CC + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index 51c7723d6762..cf321302daec 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -88,6 +88,13 @@ vcc_phy: vcc-phy-regulator { + regulator-boot-on; + }; + ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&ir_int>; ++ pinctrl-names = "default"; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -312,6 +319,13 @@ &io_domains { + }; + + &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 = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Mon, 1 Mar 2021 21:24:15 +0100 +Subject: [PATCH] ARM: dts: add cec pinctrl for RK3288 miqi board + +--- + arch/arm/boot/dts/rockchip/rk3288-miqi.dts | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +index 8d30c49f406e..6d90db5a3b75 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288-miqi.dts ++++ b/arch/arm/boot/dts/rockchip/rk3288-miqi.dts +@@ -145,6 +145,8 @@ &gpu { + + &hdmi { + ddc-i2c-bus = <&i2c5>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmi_cec_c0>; + status = "okay"; + }; + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Mon, 1 Mar 2021 19:22:15 +0100 +Subject: [PATCH] HACK: arm64: dts: enable FE phy for Beelink A1 also + +--- + arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +index 27a1799027c2..7de9dfa71d89 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +@@ -147,6 +147,14 @@ rtl8211f: ethernet-phy@0 { + }; + }; + ++&gmac2phy { ++ clock_in_out = "output"; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ status = "okay"; ++}; ++ + &gpu { + mali-supply = <&vdd_logic>; + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Tue, 26 Feb 2019 20:45:14 +0000 +Subject: [PATCH] WIP: dw-hdmi-cec: sleep 100ms on error + +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +index c8f44bcb298a..d4280ce4542c 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +@@ -4,6 +4,7 @@ + * + * Copyright (C) 2015-2017 Russell King. + */ ++#include + #include + #include + #include +@@ -129,8 +130,15 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data) + + dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0); + +- if (stat & CEC_STAT_ERROR_INIT) { +- cec->tx_status = CEC_TX_STATUS_ERROR; ++ /* Status with both done and error_initiator bits have been seen ++ * on Rockchip RK3328 devices, transmit attempt seems to have failed ++ * when this happens, report as low drive and block cec-framework ++ * 100ms before core retransmits the failed message, this seems to ++ * mitigate the issue with failed transmit attempts. ++ */ ++ if ((stat & (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) == (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) { ++ pr_debug("dw_hdmi_cec_hardirq: stat=%02x LOW_DRIVE\n", stat); ++ cec->tx_status = CEC_TX_STATUS_LOW_DRIVE; + cec->tx_done = true; + ret = IRQ_WAKE_THREAD; + } else if (stat & CEC_STAT_DONE) { +@@ -141,6 +149,10 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data) + cec->tx_status = CEC_TX_STATUS_NACK; + cec->tx_done = true; + ret = IRQ_WAKE_THREAD; ++ } else if (stat & CEC_STAT_ERROR_INIT) { ++ cec->tx_status = CEC_TX_STATUS_ERROR; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; + } + + if (stat & CEC_STAT_EOM) { +@@ -173,6 +185,8 @@ static irqreturn_t dw_hdmi_cec_thread(int irq, void *data) + + if (cec->tx_done) { + cec->tx_done = false; ++ if (cec->tx_status == CEC_TX_STATUS_LOW_DRIVE) ++ msleep(100); + cec_transmit_attempt_done(adap, cec->tx_status); + } + if (cec->rx_done) { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 5 May 2021 19:11:12 +0200 +Subject: [PATCH] arm64: boot: dts: Increase ACLK_PERILP0 clock rate for RK3399 + +As per vendor kernel. Leaving this clock at the lower rate will +result in poor DMA controller performance + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index a10fe60b7680..dbe6a9cb98a5 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -1477,7 +1477,7 @@ cru: clock-controller@ff760000 { + <1000000000>, + <150000000>, <75000000>, + <37500000>, +- <100000000>, <100000000>, ++ <300000000>, <100000000>, + <50000000>, <600000000>, + <100000000>, <50000000>, + <400000000>, <400000000>, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 21 Aug 2021 17:04:46 +0200 +Subject: [PATCH] arm64: dts: rockchip: Enable USB3 for rk3328 Beelink A1 + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3328-a1.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +index 7de9dfa71d89..e857e5a727f4 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +@@ -389,6 +389,11 @@ &usb_host0_ehci { + status = "okay"; + }; + ++&usbdrd3 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ + &vop { + status = "okay"; + }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 30 Oct 2021 12:19:19 +0200 +Subject: [PATCH] WIP: drm: bridge: dw-hdmi: switch from .hw_parmas to .prepare + for i2s + +Seems to be the only way to get AES bits correctly as set by +userspace. +TODO: check other consequences. + +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index a2f0860b20bb..8961f9c7885d 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -34,9 +34,9 @@ static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset) + return audio->read(hdmi, offset); + } + +-static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, +- struct hdmi_codec_daifmt *fmt, +- struct hdmi_codec_params *hparms) ++static int dw_hdmi_i2s_prepare(struct device *dev, void *data, ++ struct hdmi_codec_daifmt *fmt, ++ struct hdmi_codec_params *hparms) + { + struct dw_hdmi_i2s_audio_data *audio = data; + struct dw_hdmi *hdmi = audio->hdmi; +@@ -178,7 +178,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data, + } + + static const struct hdmi_codec_ops dw_hdmi_i2s_ops = { +- .hw_params = dw_hdmi_i2s_hw_params, ++ .prepare = dw_hdmi_i2s_prepare, + .audio_startup = dw_hdmi_i2s_audio_startup, + .audio_shutdown = dw_hdmi_i2s_audio_shutdown, + .get_eld = dw_hdmi_i2s_get_eld, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 18 Sep 2022 10:35:52 +0200 +Subject: [PATCH] arm64: dts: rockchip: Disbake fusb for rk3399-roc-pc + +As it will lead to an unbootable device in case one if those ports +is used to power up the device. +See https://lkml.org/lkml/2022/6/20/413 +--- + arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +index 2f4b1b2e3ac7..7217ead94d39 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +@@ -215,7 +215,7 @@ vdd_log: vdd-log { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <450000>; ++ regulator-min-microvolt = <430000>; + regulator-max-microvolt = <1400000>; + pwm-supply = <&vcc3v3_sys>; + }; +@@ -536,7 +536,7 @@ fusb1: usb-typec@22 { + pinctrl-names = "default"; + pinctrl-0 = <&fusb1_int>; + vbus-supply = <&vcc_vbus_typec1>; +- status = "okay"; ++ status = "disabled"; + }; + }; + +@@ -553,7 +553,7 @@ fusb0: usb-typec@22 { + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + vbus-supply = <&vcc_vbus_typec0>; +- status = "okay"; ++ status = "disabled"; + }; + + mp8859: regulator@66 { diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1003-temp-dw_hdmi-rockchip.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1003-temp-dw_hdmi-rockchip.patch new file mode 100644 index 000000000000..649732ddbedd --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-1003-temp-dw_hdmi-rockchip.patch @@ -0,0 +1,63 @@ +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 0370bb247fcb..55c0b8dddad5 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 2023-06-25 03:23:55.724209412 +0000 ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 2023-06-25 04:16:27.469899470 +0000 +@@ -254,35 +245,31 @@ + const struct drm_display_info *info, + const struct drm_display_mode *mode) + { +- struct rockchip_hdmi *hdmi = data; +- const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg; +- int pclk = mode->clock * 1000; +- bool exact_match = hdmi->plat_data->phy_force_vendor; +- int i; +- +- if (hdmi->ref_clk) { +- int rpclk = clk_round_rate(hdmi->ref_clk, pclk); +- +- if (abs(rpclk - pclk) > pclk / 1000) +- return MODE_NOCLOCK; +- } +- +- for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) { +- /* +- * For vendor specific phys force an exact match of the pixelclock +- * to preserve the original behaviour of the driver. +- */ +- if (exact_match && pclk == mpll_cfg[i].mpixelclock) +- return MODE_OK; +- /* +- * The Synopsys phy can work with pixelclocks up to the value given +- * in the corresponding mpll_cfg entry. +- */ +- if (!exact_match && pclk <= mpll_cfg[i].mpixelclock) +- return MODE_OK; ++ struct dw_hdmi_plat_data *pdata = (struct dw_hdmi_plat_data *)data; ++ const struct dw_hdmi_mpll_config *mpll_cfg = pdata->mpll_cfg; ++ int clock = mode->clock; ++ unsigned int i = 0; ++ ++ if (pdata->ycbcr_420_allowed && drm_mode_is_420(info, mode) && ++ (info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) { ++ clock /= 2; ++ mpll_cfg = pdata->mpll_cfg_420; ++ } ++ ++ if ((!mpll_cfg && clock > 340000) || ++ (info->max_tmds_clock && clock > info->max_tmds_clock)) ++ return MODE_CLOCK_HIGH; ++ ++ if (mpll_cfg) { ++ while ((clock * 1000) < mpll_cfg[i].mpixelclock && ++ mpll_cfg[i].mpixelclock != (~0UL)) ++ i++; ++ ++ if (mpll_cfg[i].mpixelclock == (~0UL)) ++ return MODE_CLOCK_HIGH; + } + +- return MODE_BAD; ++ return MODE_OK; + } + + static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder) diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2000-v4l2-wip-rkvdec-hevc.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2000-v4l2-wip-rkvdec-hevc.patch new file mode 100644 index 000000000000..58b3e72e5a27 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2000-v4l2-wip-rkvdec-hevc.patch @@ -0,0 +1,3226 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sat, 23 May 2020 15:17:45 +0000 +Subject: [PATCH] WIP: media: rkvdec: add HEVC backend + +NOTE: cabac table and scailing list code is copied 1:1 from mpp +TODO: fix lowdelay flag and rework the scaling list part + +Signed-off-by: Jonas Karlman +Signed-off-by: Alex Bee +--- + drivers/staging/media/rkvdec/Makefile | 2 +- + drivers/staging/media/rkvdec/rkvdec-hevc.c | 2572 ++++++++++++++++++++ + drivers/staging/media/rkvdec/rkvdec-regs.h | 1 + + drivers/staging/media/rkvdec/rkvdec.c | 73 +- + drivers/staging/media/rkvdec/rkvdec.h | 1 + + 5 files changed, 2647 insertions(+), 2 deletions(-) + create mode 100644 drivers/staging/media/rkvdec/rkvdec-hevc.c + +diff --git a/drivers/staging/media/rkvdec/Makefile b/drivers/staging/media/rkvdec/Makefile +index cb86b429cfaa..a77122641d14 100644 +--- a/drivers/staging/media/rkvdec/Makefile ++++ b/drivers/staging/media/rkvdec/Makefile +@@ -1,3 +1,3 @@ + obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC) += rockchip-vdec.o + +-rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-vp9.o ++rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-hevc.o rkvdec-vp9.o +diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c +new file mode 100644 +index 000000000000..7a375a23eaf1 +--- /dev/null ++++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c +@@ -0,0 +1,2572 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Rockchip Video Decoder HEVC backend ++ * ++ * Copyright (C) 2019 Collabora, Ltd. ++ * Boris Brezillon ++ * ++ * Copyright (C) 2016 Rockchip Electronics Co., Ltd. ++ * Jeffy Chen ++ */ ++ ++#include ++ ++#include "rkvdec.h" ++#include "rkvdec-regs.h" ++ ++/* Size in u8/u32 units. */ ++#define RKV_CABAC_TABLE_SIZE 27456 ++#define RKV_SCALING_LIST_SIZE 1360 ++#define RKV_PPS_SIZE (80 / 4) ++#define RKV_PPS_LEN 64 ++#define RKV_RPS_SIZE (32 / 4) ++#define RKV_RPS_LEN 600 ++ ++struct rkvdec_sps_pps_packet { ++ u32 info[RKV_PPS_SIZE]; ++}; ++ ++struct rkvdec_rps_packet { ++ u32 info[RKV_RPS_SIZE]; ++}; ++ ++struct rkvdec_ps_field { ++ u16 offset; ++ u8 len; ++}; ++ ++#define PS_FIELD(_offset, _len) \ ++ ((struct rkvdec_ps_field){ _offset, _len }) ++ ++/* SPS */ ++#define VIDEO_PARAMETER_SET_ID PS_FIELD(0, 4) ++#define SEQ_PARAMETER_SET_ID PS_FIELD(4, 4) ++#define CHROMA_FORMAT_IDC PS_FIELD(8, 2) ++#define PIC_WIDTH_IN_LUMA_SAMPLES PS_FIELD(10, 13) ++#define PIC_HEIGHT_IN_LUMA_SAMPLES PS_FIELD(23, 13) ++#define BIT_DEPTH_LUMA PS_FIELD(36, 4) ++#define BIT_DEPTH_CHROMA PS_FIELD(40, 4) ++#define LOG2_MAX_PIC_ORDER_CNT_LSB PS_FIELD(44, 5) ++#define LOG2_DIFF_MAX_MIN_LUMA_CODING_BLOCK_SIZE PS_FIELD(49, 2) ++#define LOG2_MIN_LUMA_CODING_BLOCK_SIZE PS_FIELD(51, 3) ++#define LOG2_MIN_TRANSFORM_BLOCK_SIZE PS_FIELD(54, 3) ++#define LOG2_DIFF_MAX_MIN_LUMA_TRANSFORM_BLOCK_SIZE PS_FIELD(57, 2) ++#define MAX_TRANSFORM_HIERARCHY_DEPTH_INTER PS_FIELD(59, 3) ++#define MAX_TRANSFORM_HIERARCHY_DEPTH_INTRA PS_FIELD(62, 3) ++#define SCALING_LIST_ENABLED_FLAG PS_FIELD(65, 1) ++#define AMP_ENABLED_FLAG PS_FIELD(66, 1) ++#define SAMPLE_ADAPTIVE_OFFSET_ENABLED_FLAG PS_FIELD(67, 1) ++#define PCM_ENABLED_FLAG PS_FIELD(68, 1) ++#define PCM_SAMPLE_BIT_DEPTH_LUMA PS_FIELD(69, 4) ++#define PCM_SAMPLE_BIT_DEPTH_CHROMA PS_FIELD(73, 4) ++#define PCM_LOOP_FILTER_DISABLED_FLAG PS_FIELD(77, 1) ++#define LOG2_DIFF_MAX_MIN_PCM_LUMA_CODING_BLOCK_SIZE PS_FIELD(78, 3) ++#define LOG2_MIN_PCM_LUMA_CODING_BLOCK_SIZE PS_FIELD(81, 3) ++#define NUM_SHORT_TERM_REF_PIC_SETS PS_FIELD(84, 7) ++#define LONG_TERM_REF_PICS_PRESENT_FLAG PS_FIELD(91, 1) ++#define NUM_LONG_TERM_REF_PICS_SPS PS_FIELD(92, 6) ++#define SPS_TEMPORAL_MVP_ENABLED_FLAG PS_FIELD(98, 1) ++#define STRONG_INTRA_SMOOTHING_ENABLED_FLAG PS_FIELD(99, 1) ++/* PPS */ ++#define PIC_PARAMETER_SET_ID PS_FIELD(128, 6) ++#define PPS_SEQ_PARAMETER_SET_ID PS_FIELD(134, 4) ++#define DEPENDENT_SLICE_SEGMENTS_ENABLED_FLAG PS_FIELD(138, 1) ++#define OUTPUT_FLAG_PRESENT_FLAG PS_FIELD(139, 1) ++#define NUM_EXTRA_SLICE_HEADER_BITS PS_FIELD(140, 13) ++#define SIGN_DATA_HIDING_ENABLED_FLAG PS_FIELD(153, 1) ++#define CABAC_INIT_PRESENT_FLAG PS_FIELD(154, 1) ++#define NUM_REF_IDX_L0_DEFAULT_ACTIVE PS_FIELD(155, 4) ++#define NUM_REF_IDX_L1_DEFAULT_ACTIVE PS_FIELD(159, 4) ++#define INIT_QP_MINUS26 PS_FIELD(163, 7) ++#define CONSTRAINED_INTRA_PRED_FLAG PS_FIELD(170, 1) ++#define TRANSFORM_SKIP_ENABLED_FLAG PS_FIELD(171, 1) ++#define CU_QP_DELTA_ENABLED_FLAG PS_FIELD(172, 1) ++#define LOG2_MIN_CU_QP_DELTA_SIZE PS_FIELD(173, 3) ++#define PPS_CB_QP_OFFSET PS_FIELD(176, 5) ++#define PPS_CR_QP_OFFSET PS_FIELD(181, 5) ++#define PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_FLAG PS_FIELD(186, 1) ++#define WEIGHTED_PRED_FLAG PS_FIELD(187, 1) ++#define WEIGHTED_BIPRED_FLAG PS_FIELD(188, 1) ++#define TRANSQUANT_BYPASS_ENABLED_FLAG PS_FIELD(189, 1) ++#define TILES_ENABLED_FLAG PS_FIELD(190, 1) ++#define ENTROPY_CODING_SYNC_ENABLED_FLAG PS_FIELD(191, 1) ++#define PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG PS_FIELD(192, 1) ++#define LOOP_FILTER_ACROSS_TILES_ENABLED_FLAG PS_FIELD(193, 1) ++#define DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG PS_FIELD(194, 1) ++#define PPS_DEBLOCKING_FILTER_DISABLED_FLAG PS_FIELD(195, 1) ++#define PPS_BETA_OFFSET_DIV2 PS_FIELD(196, 4) ++#define PPS_TC_OFFSET_DIV2 PS_FIELD(200, 4) ++#define LISTS_MODIFICATION_PRESENT_FLAG PS_FIELD(204, 1) ++#define LOG2_PARALLEL_MERGE_LEVEL PS_FIELD(205, 3) ++#define SLICE_SEGMENT_HEADER_EXTENSION_PRESENT_FLAG PS_FIELD(208, 1) ++#define NUM_TILE_COLUMNS PS_FIELD(212, 5) ++#define NUM_TILE_ROWS PS_FIELD(217, 5) ++#define COLUMN_WIDTH(i) PS_FIELD(256 + (i * 8), 8) ++#define ROW_HEIGHT(i) PS_FIELD(416 + (i * 8), 8) ++#define SCALING_LIST_ADDRESS PS_FIELD(592, 32) ++ ++/* Data structure describing auxiliary buffer format. */ ++struct rkvdec_hevc_priv_tbl { ++ u8 cabac_table[RKV_CABAC_TABLE_SIZE]; ++ u8 scaling_list[RKV_SCALING_LIST_SIZE]; ++ struct rkvdec_sps_pps_packet param_set[RKV_PPS_LEN]; ++ struct rkvdec_rps_packet rps[RKV_RPS_LEN]; ++}; ++ ++struct rkvdec_hevc_run { ++ struct rkvdec_run base; ++ const struct v4l2_ctrl_hevc_slice_params *slices_params; ++ const struct v4l2_ctrl_hevc_decode_params *decode_params; ++ const struct v4l2_ctrl_hevc_sps *sps; ++ const struct v4l2_ctrl_hevc_pps *pps; ++ const struct v4l2_ctrl_hevc_scaling_matrix *scaling_matrix; ++ int num_slices; ++}; ++ ++struct rkvdec_hevc_ctx { ++ struct rkvdec_aux_buf priv_tbl; ++ struct v4l2_ctrl_hevc_scaling_matrix scaling_matrix_cache; ++}; ++ ++// TODO: refactor scaling list code, was copied 1:1 from mpp ++ ++typedef struct ScalingList { ++ /* This is a little wasteful, since sizeID 0 only needs 8 coeffs, ++ * and size ID 3 only has 2 arrays, not 6. */ ++ u8 sl[4][6][64]; ++ u8 sl_dc[2][6]; ++} scalingList_t; ++ ++typedef struct ScalingFactor_Model { ++ u8 scalingfactor0[1248]; ++ u8 scalingfactor1[96]; /*4X4 TU Rotate, total 16X4*/ ++ u8 scalingdc[12]; /*N1005 Vienna Meeting*/ ++ u8 reserverd[4]; /*16Bytes align*/ ++} scalingFactor_t; ++ ++#define SCALING_LIST_SIZE_NUM 4 ++ ++static void ++hal_record_scaling_list(scalingFactor_t *pScalingFactor_out, ++ scalingList_t *pScalingList) ++{ ++ int i; ++ u32 g_scalingListNum_model[SCALING_LIST_SIZE_NUM] = {6, 6, 6, 2}; // from C Model ++ u32 nIndex = 0; ++ u32 sizeId, matrixId, listId; ++ u8 *p = pScalingFactor_out->scalingfactor0; ++ u8 tmpBuf[8 * 8]; ++ ++ //output non-default scalingFactor Table (1248 BYTES) ++ for (sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) { ++ for (listId = 0; listId < g_scalingListNum_model[sizeId]; listId++) { ++ if (sizeId < 3) { ++ for (i = 0; i < (sizeId == 0 ? 16 : 64); i++) { ++ pScalingFactor_out->scalingfactor0[nIndex++] = (u8)pScalingList->sl[sizeId][listId][i]; ++ } ++ } else { ++ for (i = 0; i < 64; i ++) { ++ pScalingFactor_out->scalingfactor0[nIndex++] = (u8)pScalingList->sl[sizeId][listId][i]; ++ } ++ for (i = 0; i < 128; i ++) { ++ pScalingFactor_out->scalingfactor0[nIndex++] = 0; ++ } ++ } ++ } ++ } ++ //output non-default scalingFactor Table Rotation(96 Bytes) ++ nIndex = 0; ++ for (listId = 0; listId < g_scalingListNum_model[0]; listId++) { ++ u8 temp16[16] = {0}; ++ for (i = 0; i < 16; i ++) { ++ temp16[i] = (u8)pScalingList->sl[0][listId][i]; ++ } ++ for (i = 0; i < 4; i ++) { ++ pScalingFactor_out->scalingfactor1[nIndex++] = temp16[i]; ++ pScalingFactor_out->scalingfactor1[nIndex++] = temp16[i + 4]; ++ pScalingFactor_out->scalingfactor1[nIndex++] = temp16[i + 8]; ++ pScalingFactor_out->scalingfactor1[nIndex++] = temp16[i + 12]; ++ } ++ } ++ //output non-default ScalingList_DC_Coeff (12 BYTES) ++ nIndex = 0; ++ for (listId = 0; listId < g_scalingListNum_model[2]; listId++) { //sizeId = 2 ++ pScalingFactor_out->scalingdc[nIndex++] = (u8)pScalingList->sl_dc[0][listId];// zrh warning: sl_dc differed from scalingList->getScalingListDC ++ } ++ for (listId = 0; listId < g_scalingListNum_model[3]; listId++) { //sizeId = 3 ++ pScalingFactor_out->scalingdc[nIndex++] = (u8)pScalingList->sl_dc[1][listId];// zrh warning: sl_dc differed from scalingList->getScalingListDC ++ pScalingFactor_out->scalingdc[nIndex++] = 0; ++ pScalingFactor_out->scalingdc[nIndex++] = 0; ++ } ++ ++ //align 16X address ++ nIndex = 0; ++ for (i = 0; i < 4; i ++) { ++ pScalingFactor_out->reserverd[nIndex++] = 0; ++ } ++ ++ //----------------------All above code show the normal store way in HM-------------------------- ++ //--------from now on, the scalingfactor0 is rotated 90', the scalingfactor1 is also rotated 90' ++ ++ //sizeId == 0 ++ for (matrixId = 0; matrixId < 6; matrixId++) { ++ p = pScalingFactor_out->scalingfactor0 + matrixId * 16; ++ ++ for (i = 0; i < 4; i++) { ++ tmpBuf[4 * 0 + i] = p[i * 4 + 0]; ++ tmpBuf[4 * 1 + i] = p[i * 4 + 1]; ++ tmpBuf[4 * 2 + i] = p[i * 4 + 2]; ++ tmpBuf[4 * 3 + i] = p[i * 4 + 3]; ++ } ++ memcpy(p, tmpBuf, 4 * 4 * sizeof(u8)); ++ } ++ //sizeId == 1 ++ for (matrixId = 0; matrixId < 6; matrixId++) { ++ p = pScalingFactor_out->scalingfactor0 + 6 * 16 + matrixId * 64; ++ ++ for (i = 0; i < 8; i++) { ++ tmpBuf[8 * 0 + i] = p[i * 8 + 0]; ++ tmpBuf[8 * 1 + i] = p[i * 8 + 1]; ++ tmpBuf[8 * 2 + i] = p[i * 8 + 2]; ++ tmpBuf[8 * 3 + i] = p[i * 8 + 3]; ++ tmpBuf[8 * 4 + i] = p[i * 8 + 4]; ++ tmpBuf[8 * 5 + i] = p[i * 8 + 5]; ++ tmpBuf[8 * 6 + i] = p[i * 8 + 6]; ++ tmpBuf[8 * 7 + i] = p[i * 8 + 7]; ++ } ++ memcpy(p, tmpBuf, 8 * 8 * sizeof(u8)); ++ } ++ //sizeId == 2 ++ for (matrixId = 0; matrixId < 6; matrixId++) { ++ p = pScalingFactor_out->scalingfactor0 + 6 * 16 + 6 * 64 + matrixId * 64; ++ ++ for (i = 0; i < 8; i++) { ++ tmpBuf[8 * 0 + i] = p[i * 8 + 0]; ++ tmpBuf[8 * 1 + i] = p[i * 8 + 1]; ++ tmpBuf[8 * 2 + i] = p[i * 8 + 2]; ++ tmpBuf[8 * 3 + i] = p[i * 8 + 3]; ++ tmpBuf[8 * 4 + i] = p[i * 8 + 4]; ++ tmpBuf[8 * 5 + i] = p[i * 8 + 5]; ++ tmpBuf[8 * 6 + i] = p[i * 8 + 6]; ++ tmpBuf[8 * 7 + i] = p[i * 8 + 7]; ++ } ++ memcpy(p, tmpBuf, 8 * 8 * sizeof(u8)); ++ } ++ //sizeId == 3 ++ for (matrixId = 0; matrixId < 6; matrixId++) { ++ p = pScalingFactor_out->scalingfactor0 + 6 * 16 + 6 * 64 + 6 * 64 + matrixId * 64; ++ ++ for (i = 0; i < 8; i++) { ++ tmpBuf[8 * 0 + i] = p[i * 8 + 0]; ++ tmpBuf[8 * 1 + i] = p[i * 8 + 1]; ++ tmpBuf[8 * 2 + i] = p[i * 8 + 2]; ++ tmpBuf[8 * 3 + i] = p[i * 8 + 3]; ++ tmpBuf[8 * 4 + i] = p[i * 8 + 4]; ++ tmpBuf[8 * 5 + i] = p[i * 8 + 5]; ++ tmpBuf[8 * 6 + i] = p[i * 8 + 6]; ++ tmpBuf[8 * 7 + i] = p[i * 8 + 7]; ++ } ++ memcpy(p, tmpBuf, 8 * 8 * sizeof(u8)); ++ } ++ ++ //sizeId == 0 ++ for (matrixId = 0; matrixId < 6; matrixId++) { ++ p = pScalingFactor_out->scalingfactor1 + matrixId * 16; ++ ++ for (i = 0; i < 4; i++) { ++ tmpBuf[4 * 0 + i] = p[i * 4 + 0]; ++ tmpBuf[4 * 1 + i] = p[i * 4 + 1]; ++ tmpBuf[4 * 2 + i] = p[i * 4 + 2]; ++ tmpBuf[4 * 3 + i] = p[i * 4 + 3]; ++ } ++ memcpy(p, tmpBuf, 4 * 4 * sizeof(u8)); ++ } ++} ++ ++static const u8 rkvdec_hevc_cabac_table[RKV_CABAC_TABLE_SIZE] = { ++ 0x07, 0x0f, 0x48, 0x58, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0f, 0x40, 0x40, 0x40, 0x0f, 0x68, ++ 0x48, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x40, 0x40, 0x68, ++ 0x58, 0x60, 0x40, 0x1f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x48, 0x48, 0x60, 0x60, 0x50, 0x58, ++ 0x50, 0x07, 0x58, 0x68, 0x50, 0x58, 0x68, 0x68, 0x68, 0x68, 0x68, 0x50, 0x48, 0x68, 0x60, 0x60, ++ 0x50, 0x58, 0x50, 0x07, 0x58, 0x68, 0x50, 0x58, 0x68, 0x68, 0x68, 0x68, 0x68, 0x50, 0x48, 0x68, ++ 0x48, 0x48, 0x1f, 0x58, 0x68, 0x68, 0x58, 0x60, 0x60, 0x60, 0x50, 0x50, 0x50, 0x48, 0x58, 0x58, ++ 0x37, 0x07, 0x58, 0x48, 0x58, 0x58, 0x37, 0x07, 0x58, 0x48, 0x58, 0x58, 0x37, 0x07, 0x58, 0x50, ++ 0x48, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x0f, 0x48, 0x68, 0x0f, 0x48, 0x68, 0x40, 0x40, ++ 0x50, 0x50, 0x07, 0x40, 0x50, 0x0f, 0x40, 0x48, 0x07, 0x40, 0x27, 0x50, 0x48, 0x48, 0x40, 0x0f, ++ 0x50, 0x37, 0x1f, 0x1f, 0x50, 0x37, 0x40, 0x27, 0x40, 0x07, 0x0f, 0x17, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x0f, 0x47, 0x57, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0f, 0x40, 0x40, 0x40, 0x0f, 0x66, ++ 0x47, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x00, 0x00, 0x67, ++ 0x57, 0x5e, 0x00, 0x1f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x47, 0x47, 0x5f, 0x5f, 0x4f, 0x57, ++ 0x4f, 0x07, 0x57, 0x67, 0x4f, 0x57, 0x67, 0x67, 0x67, 0x67, 0x66, 0x4f, 0x47, 0x66, 0x5f, 0x5f, ++ 0x4f, 0x57, 0x4f, 0x07, 0x57, 0x67, 0x4f, 0x57, 0x67, 0x67, 0x67, 0x67, 0x66, 0x4f, 0x47, 0x66, ++ 0x46, 0x48, 0x20, 0x57, 0x67, 0x67, 0x57, 0x5f, 0x5f, 0x5e, 0x4f, 0x4f, 0x4f, 0x47, 0x57, 0x57, ++ 0x37, 0x07, 0x57, 0x47, 0x57, 0x57, 0x37, 0x07, 0x57, 0x47, 0x57, 0x57, 0x37, 0x07, 0x57, 0x4f, ++ 0x47, 0x1f, 0x1f, 0x0f, 0x10, 0x0f, 0x10, 0x07, 0x10, 0x47, 0x67, 0x10, 0x47, 0x67, 0x40, 0x40, ++ 0x4f, 0x4e, 0x08, 0x00, 0x4f, 0x0f, 0x00, 0x47, 0x07, 0x01, 0x27, 0x4e, 0x47, 0x47, 0x00, 0x0f, ++ 0x4f, 0x37, 0x1f, 0x1f, 0x4f, 0x36, 0x00, 0x27, 0x00, 0x07, 0x10, 0x17, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x0e, 0x47, 0x57, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0e, 0x40, 0x40, 0x40, 0x0e, 0x64, ++ 0x47, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x00, 0x00, 0x66, ++ 0x57, 0x5d, 0x00, 0x1e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x47, 0x47, 0x5e, 0x5e, 0x4e, 0x56, ++ 0x4f, 0x07, 0x56, 0x66, 0x4f, 0x56, 0x66, 0x67, 0x66, 0x66, 0x64, 0x4e, 0x46, 0x64, 0x5e, 0x5e, ++ 0x4e, 0x56, 0x4f, 0x07, 0x56, 0x66, 0x4f, 0x56, 0x66, 0x67, 0x66, 0x66, 0x64, 0x4e, 0x46, 0x64, ++ 0x45, 0x48, 0x20, 0x57, 0x66, 0x66, 0x56, 0x5e, 0x5e, 0x5d, 0x4e, 0x4e, 0x4e, 0x46, 0x56, 0x57, ++ 0x36, 0x07, 0x56, 0x46, 0x56, 0x57, 0x36, 0x07, 0x56, 0x46, 0x56, 0x57, 0x36, 0x07, 0x56, 0x4f, ++ 0x47, 0x1e, 0x1e, 0x0f, 0x10, 0x0f, 0x10, 0x07, 0x10, 0x47, 0x66, 0x10, 0x47, 0x66, 0x40, 0x40, ++ 0x4f, 0x4d, 0x08, 0x00, 0x4f, 0x0f, 0x00, 0x47, 0x07, 0x03, 0x27, 0x4d, 0x47, 0x46, 0x01, 0x0f, ++ 0x4f, 0x36, 0x1f, 0x1e, 0x4f, 0x34, 0x01, 0x26, 0x00, 0x07, 0x10, 0x17, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x0d, 0x47, 0x57, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0e, 0x40, 0x40, 0x40, 0x0e, 0x62, ++ 0x47, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x00, 0x00, 0x65, ++ 0x57, 0x5c, 0x00, 0x1e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x47, 0x47, 0x5d, 0x5d, 0x4e, 0x56, ++ 0x4f, 0x07, 0x56, 0x66, 0x4f, 0x55, 0x65, 0x67, 0x66, 0x65, 0x63, 0x4d, 0x46, 0x62, 0x5d, 0x5d, ++ 0x4e, 0x56, 0x4f, 0x07, 0x56, 0x66, 0x4f, 0x55, 0x65, 0x67, 0x66, 0x65, 0x63, 0x4d, 0x46, 0x62, ++ 0x44, 0x48, 0x20, 0x57, 0x65, 0x65, 0x56, 0x5d, 0x5d, 0x5c, 0x4e, 0x4d, 0x4e, 0x45, 0x56, 0x57, ++ 0x36, 0x07, 0x56, 0x45, 0x56, 0x57, 0x36, 0x07, 0x56, 0x45, 0x56, 0x57, 0x36, 0x07, 0x56, 0x4f, ++ 0x47, 0x1e, 0x1e, 0x0f, 0x10, 0x0f, 0x10, 0x07, 0x10, 0x47, 0x65, 0x10, 0x47, 0x65, 0x40, 0x40, ++ 0x4f, 0x4c, 0x08, 0x00, 0x4f, 0x0f, 0x00, 0x47, 0x07, 0x04, 0x27, 0x4c, 0x47, 0x45, 0x01, 0x0f, ++ 0x4f, 0x36, 0x1f, 0x1e, 0x4f, 0x33, 0x01, 0x25, 0x00, 0x07, 0x10, 0x17, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x0c, 0x46, 0x56, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0d, 0x40, 0x40, 0x40, 0x0d, 0x60, ++ 0x46, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x01, 0x01, 0x64, ++ 0x56, 0x5b, 0x01, 0x1d, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x46, 0x46, 0x5c, 0x5c, 0x4d, 0x55, ++ 0x4e, 0x07, 0x55, 0x65, 0x4e, 0x54, 0x64, 0x66, 0x65, 0x64, 0x61, 0x4c, 0x45, 0x60, 0x5c, 0x5c, ++ 0x4d, 0x55, 0x4e, 0x07, 0x55, 0x65, 0x4e, 0x54, 0x64, 0x66, 0x65, 0x64, 0x61, 0x4c, 0x45, 0x60, ++ 0x43, 0x49, 0x21, 0x56, 0x64, 0x64, 0x55, 0x5c, 0x5c, 0x5b, 0x4d, 0x4c, 0x4d, 0x44, 0x55, 0x56, ++ 0x35, 0x07, 0x55, 0x44, 0x55, 0x56, 0x35, 0x07, 0x55, 0x44, 0x55, 0x56, 0x35, 0x07, 0x55, 0x4e, ++ 0x46, 0x1d, 0x1d, 0x0f, 0x11, 0x0f, 0x11, 0x07, 0x11, 0x46, 0x64, 0x11, 0x46, 0x64, 0x40, 0x40, ++ 0x4e, 0x4b, 0x09, 0x01, 0x4e, 0x0f, 0x01, 0x46, 0x07, 0x06, 0x27, 0x4b, 0x46, 0x44, 0x02, 0x0f, ++ 0x4e, 0x35, 0x1e, 0x1d, 0x4e, 0x31, 0x02, 0x24, 0x01, 0x07, 0x11, 0x16, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x0b, 0x46, 0x56, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0c, 0x40, 0x40, 0x40, 0x0c, 0x5e, ++ 0x46, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x01, 0x01, 0x63, ++ 0x56, 0x59, 0x01, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x46, 0x46, 0x5b, 0x5b, 0x4c, 0x54, ++ 0x4e, 0x07, 0x54, 0x64, 0x4e, 0x53, 0x63, 0x66, 0x64, 0x63, 0x60, 0x4b, 0x44, 0x5e, 0x5b, 0x5b, ++ 0x4c, 0x54, 0x4e, 0x07, 0x54, 0x64, 0x4e, 0x53, 0x63, 0x66, 0x64, 0x63, 0x60, 0x4b, 0x44, 0x5e, ++ 0x41, 0x49, 0x21, 0x56, 0x63, 0x63, 0x54, 0x5b, 0x5b, 0x59, 0x4c, 0x4b, 0x4c, 0x43, 0x54, 0x56, ++ 0x34, 0x07, 0x54, 0x43, 0x54, 0x56, 0x34, 0x07, 0x54, 0x43, 0x54, 0x56, 0x34, 0x07, 0x54, 0x4e, ++ 0x46, 0x1c, 0x1c, 0x0f, 0x11, 0x0f, 0x11, 0x07, 0x11, 0x46, 0x63, 0x11, 0x46, 0x63, 0x40, 0x40, ++ 0x4e, 0x49, 0x09, 0x01, 0x4e, 0x0f, 0x01, 0x46, 0x07, 0x07, 0x27, 0x49, 0x46, 0x43, 0x03, 0x0f, ++ 0x4e, 0x34, 0x1e, 0x1c, 0x4e, 0x30, 0x03, 0x23, 0x01, 0x07, 0x11, 0x16, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x0a, 0x46, 0x56, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0c, 0x40, 0x40, 0x40, 0x0c, 0x5c, ++ 0x46, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x01, 0x01, 0x62, ++ 0x56, 0x58, 0x01, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x46, 0x46, 0x5a, 0x5a, 0x4c, 0x54, ++ 0x4e, 0x07, 0x54, 0x64, 0x4e, 0x52, 0x62, 0x66, 0x64, 0x62, 0x5e, 0x4a, 0x44, 0x5c, 0x5a, 0x5a, ++ 0x4c, 0x54, 0x4e, 0x07, 0x54, 0x64, 0x4e, 0x52, 0x62, 0x66, 0x64, 0x62, 0x5e, 0x4a, 0x44, 0x5c, ++ 0x40, 0x49, 0x21, 0x56, 0x62, 0x62, 0x54, 0x5a, 0x5a, 0x58, 0x4c, 0x4a, 0x4c, 0x42, 0x54, 0x56, ++ 0x34, 0x07, 0x54, 0x42, 0x54, 0x56, 0x34, 0x07, 0x54, 0x42, 0x54, 0x56, 0x34, 0x07, 0x54, 0x4e, ++ 0x46, 0x1c, 0x1c, 0x0f, 0x11, 0x0f, 0x11, 0x07, 0x11, 0x46, 0x62, 0x11, 0x46, 0x62, 0x40, 0x40, ++ 0x4e, 0x48, 0x09, 0x01, 0x4e, 0x0f, 0x01, 0x46, 0x07, 0x09, 0x27, 0x48, 0x46, 0x42, 0x03, 0x0f, ++ 0x4e, 0x34, 0x1e, 0x1c, 0x4e, 0x2e, 0x03, 0x22, 0x01, 0x07, 0x11, 0x16, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x09, 0x45, 0x55, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0b, 0x40, 0x40, 0x40, 0x0b, 0x5a, ++ 0x45, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x02, 0x02, 0x61, ++ 0x55, 0x57, 0x02, 0x1b, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x45, 0x45, 0x59, 0x59, 0x4b, 0x53, ++ 0x4d, 0x07, 0x53, 0x63, 0x4d, 0x51, 0x61, 0x65, 0x63, 0x61, 0x5d, 0x49, 0x43, 0x5a, 0x59, 0x59, ++ 0x4b, 0x53, 0x4d, 0x07, 0x53, 0x63, 0x4d, 0x51, 0x61, 0x65, 0x63, 0x61, 0x5d, 0x49, 0x43, 0x5a, ++ 0x00, 0x4a, 0x22, 0x55, 0x61, 0x61, 0x53, 0x59, 0x59, 0x57, 0x4b, 0x49, 0x4b, 0x41, 0x53, 0x55, ++ 0x33, 0x07, 0x53, 0x41, 0x53, 0x55, 0x33, 0x07, 0x53, 0x41, 0x53, 0x55, 0x33, 0x07, 0x53, 0x4d, ++ 0x45, 0x1b, 0x1b, 0x0f, 0x12, 0x0f, 0x12, 0x07, 0x12, 0x45, 0x61, 0x12, 0x45, 0x61, 0x40, 0x40, ++ 0x4d, 0x47, 0x0a, 0x02, 0x4d, 0x0f, 0x02, 0x45, 0x07, 0x0a, 0x27, 0x47, 0x45, 0x41, 0x04, 0x0f, ++ 0x4d, 0x33, 0x1d, 0x1b, 0x4d, 0x2d, 0x04, 0x21, 0x02, 0x07, 0x12, 0x15, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x08, 0x45, 0x55, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0a, 0x40, 0x40, 0x40, 0x0a, 0x59, ++ 0x45, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x02, 0x02, 0x60, ++ 0x55, 0x56, 0x02, 0x1a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x45, 0x45, 0x58, 0x58, 0x4b, 0x53, ++ 0x4d, 0x07, 0x53, 0x63, 0x4d, 0x50, 0x60, 0x65, 0x63, 0x60, 0x5b, 0x48, 0x43, 0x59, 0x58, 0x58, ++ 0x4b, 0x53, 0x4d, 0x07, 0x53, 0x63, 0x4d, 0x50, 0x60, 0x65, 0x63, 0x60, 0x5b, 0x48, 0x43, 0x59, ++ 0x01, 0x4a, 0x22, 0x55, 0x60, 0x60, 0x53, 0x58, 0x58, 0x56, 0x4b, 0x48, 0x4b, 0x40, 0x53, 0x55, ++ 0x32, 0x07, 0x53, 0x40, 0x53, 0x55, 0x32, 0x07, 0x53, 0x40, 0x53, 0x55, 0x32, 0x07, 0x53, 0x4d, ++ 0x45, 0x1a, 0x1a, 0x0f, 0x12, 0x0f, 0x12, 0x07, 0x12, 0x45, 0x60, 0x12, 0x45, 0x60, 0x40, 0x40, ++ 0x4d, 0x46, 0x0a, 0x02, 0x4d, 0x0f, 0x02, 0x45, 0x07, 0x0c, 0x27, 0x46, 0x45, 0x40, 0x04, 0x0f, ++ 0x4d, 0x32, 0x1d, 0x1a, 0x4d, 0x2b, 0x04, 0x20, 0x02, 0x07, 0x12, 0x15, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x07, 0x45, 0x55, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0a, 0x40, 0x40, 0x40, 0x0a, 0x57, ++ 0x45, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x02, 0x02, 0x5f, ++ 0x55, 0x54, 0x02, 0x1a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x45, 0x45, 0x57, 0x57, 0x4a, 0x52, ++ 0x4d, 0x07, 0x52, 0x62, 0x4d, 0x4f, 0x5f, 0x65, 0x62, 0x5f, 0x59, 0x47, 0x42, 0x57, 0x57, 0x57, ++ 0x4a, 0x52, 0x4d, 0x07, 0x52, 0x62, 0x4d, 0x4f, 0x5f, 0x65, 0x62, 0x5f, 0x59, 0x47, 0x42, 0x57, ++ 0x03, 0x4a, 0x22, 0x55, 0x5f, 0x5f, 0x52, 0x57, 0x57, 0x54, 0x4a, 0x47, 0x4a, 0x00, 0x52, 0x55, ++ 0x32, 0x07, 0x52, 0x00, 0x52, 0x55, 0x32, 0x07, 0x52, 0x00, 0x52, 0x55, 0x32, 0x07, 0x52, 0x4d, ++ 0x45, 0x1a, 0x1a, 0x0f, 0x12, 0x0f, 0x12, 0x07, 0x12, 0x45, 0x5f, 0x12, 0x45, 0x5f, 0x40, 0x40, ++ 0x4d, 0x44, 0x0a, 0x02, 0x4d, 0x0f, 0x02, 0x45, 0x07, 0x0e, 0x27, 0x44, 0x45, 0x00, 0x05, 0x0f, ++ 0x4d, 0x32, 0x1d, 0x1a, 0x4d, 0x29, 0x05, 0x1f, 0x02, 0x07, 0x12, 0x15, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x06, 0x44, 0x54, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x09, 0x40, 0x40, 0x40, 0x09, 0x55, ++ 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x03, 0x03, 0x5e, ++ 0x54, 0x53, 0x03, 0x19, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x44, 0x56, 0x56, 0x49, 0x51, ++ 0x4c, 0x07, 0x51, 0x61, 0x4c, 0x4e, 0x5e, 0x64, 0x61, 0x5e, 0x58, 0x46, 0x41, 0x55, 0x56, 0x56, ++ 0x49, 0x51, 0x4c, 0x07, 0x51, 0x61, 0x4c, 0x4e, 0x5e, 0x64, 0x61, 0x5e, 0x58, 0x46, 0x41, 0x55, ++ 0x04, 0x4b, 0x23, 0x54, 0x5e, 0x5e, 0x51, 0x56, 0x56, 0x53, 0x49, 0x46, 0x49, 0x01, 0x51, 0x54, ++ 0x31, 0x07, 0x51, 0x01, 0x51, 0x54, 0x31, 0x07, 0x51, 0x01, 0x51, 0x54, 0x31, 0x07, 0x51, 0x4c, ++ 0x44, 0x19, 0x19, 0x0f, 0x13, 0x0f, 0x13, 0x07, 0x13, 0x44, 0x5e, 0x13, 0x44, 0x5e, 0x40, 0x40, ++ 0x4c, 0x43, 0x0b, 0x03, 0x4c, 0x0f, 0x03, 0x44, 0x07, 0x0f, 0x27, 0x43, 0x44, 0x01, 0x06, 0x0f, ++ 0x4c, 0x31, 0x1c, 0x19, 0x4c, 0x28, 0x06, 0x1e, 0x03, 0x07, 0x13, 0x14, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x05, 0x44, 0x54, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x09, 0x40, 0x40, 0x40, 0x09, 0x53, ++ 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x03, 0x03, 0x5d, ++ 0x54, 0x52, 0x03, 0x19, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x44, 0x55, 0x55, 0x49, 0x51, ++ 0x4c, 0x07, 0x51, 0x61, 0x4c, 0x4d, 0x5d, 0x64, 0x61, 0x5d, 0x56, 0x45, 0x41, 0x53, 0x55, 0x55, ++ 0x49, 0x51, 0x4c, 0x07, 0x51, 0x61, 0x4c, 0x4d, 0x5d, 0x64, 0x61, 0x5d, 0x56, 0x45, 0x41, 0x53, ++ 0x05, 0x4b, 0x23, 0x54, 0x5d, 0x5d, 0x51, 0x55, 0x55, 0x52, 0x49, 0x45, 0x49, 0x02, 0x51, 0x54, ++ 0x31, 0x07, 0x51, 0x02, 0x51, 0x54, 0x31, 0x07, 0x51, 0x02, 0x51, 0x54, 0x31, 0x07, 0x51, 0x4c, ++ 0x44, 0x19, 0x19, 0x0f, 0x13, 0x0f, 0x13, 0x07, 0x13, 0x44, 0x5d, 0x13, 0x44, 0x5d, 0x40, 0x40, ++ 0x4c, 0x42, 0x0b, 0x03, 0x4c, 0x0f, 0x03, 0x44, 0x07, 0x11, 0x27, 0x42, 0x44, 0x02, 0x06, 0x0f, ++ 0x4c, 0x31, 0x1c, 0x19, 0x4c, 0x26, 0x06, 0x1d, 0x03, 0x07, 0x13, 0x14, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x04, 0x44, 0x54, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x08, 0x40, 0x40, 0x40, 0x08, 0x51, ++ 0x44, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x03, 0x03, 0x5c, ++ 0x54, 0x51, 0x03, 0x18, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x44, 0x54, 0x54, 0x48, 0x50, ++ 0x4c, 0x07, 0x50, 0x60, 0x4c, 0x4c, 0x5c, 0x64, 0x60, 0x5c, 0x55, 0x44, 0x40, 0x51, 0x54, 0x54, ++ 0x48, 0x50, 0x4c, 0x07, 0x50, 0x60, 0x4c, 0x4c, 0x5c, 0x64, 0x60, 0x5c, 0x55, 0x44, 0x40, 0x51, ++ 0x06, 0x4b, 0x23, 0x54, 0x5c, 0x5c, 0x50, 0x54, 0x54, 0x51, 0x48, 0x44, 0x48, 0x03, 0x50, 0x54, ++ 0x30, 0x07, 0x50, 0x03, 0x50, 0x54, 0x30, 0x07, 0x50, 0x03, 0x50, 0x54, 0x30, 0x07, 0x50, 0x4c, ++ 0x44, 0x18, 0x18, 0x0f, 0x13, 0x0f, 0x13, 0x07, 0x13, 0x44, 0x5c, 0x13, 0x44, 0x5c, 0x40, 0x40, ++ 0x4c, 0x41, 0x0b, 0x03, 0x4c, 0x0f, 0x03, 0x44, 0x07, 0x12, 0x27, 0x41, 0x44, 0x03, 0x07, 0x0f, ++ 0x4c, 0x30, 0x1c, 0x18, 0x4c, 0x25, 0x07, 0x1c, 0x03, 0x07, 0x13, 0x14, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x03, 0x43, 0x53, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x40, 0x40, 0x40, 0x07, 0x4f, ++ 0x43, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x04, 0x04, 0x5b, ++ 0x53, 0x4f, 0x04, 0x17, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, 0x43, 0x53, 0x53, 0x47, 0x4f, ++ 0x4b, 0x07, 0x4f, 0x5f, 0x4b, 0x4b, 0x5b, 0x63, 0x5f, 0x5b, 0x53, 0x43, 0x00, 0x4f, 0x53, 0x53, ++ 0x47, 0x4f, 0x4b, 0x07, 0x4f, 0x5f, 0x4b, 0x4b, 0x5b, 0x63, 0x5f, 0x5b, 0x53, 0x43, 0x00, 0x4f, ++ 0x08, 0x4c, 0x24, 0x53, 0x5b, 0x5b, 0x4f, 0x53, 0x53, 0x4f, 0x47, 0x43, 0x47, 0x04, 0x4f, 0x53, ++ 0x2f, 0x07, 0x4f, 0x04, 0x4f, 0x53, 0x2f, 0x07, 0x4f, 0x04, 0x4f, 0x53, 0x2f, 0x07, 0x4f, 0x4b, ++ 0x43, 0x17, 0x17, 0x0f, 0x14, 0x0f, 0x14, 0x07, 0x14, 0x43, 0x5b, 0x14, 0x43, 0x5b, 0x40, 0x40, ++ 0x4b, 0x00, 0x0c, 0x04, 0x4b, 0x0f, 0x04, 0x43, 0x07, 0x14, 0x27, 0x00, 0x43, 0x04, 0x08, 0x0f, ++ 0x4b, 0x2f, 0x1b, 0x17, 0x4b, 0x23, 0x08, 0x1b, 0x04, 0x07, 0x14, 0x13, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x02, 0x43, 0x53, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x40, 0x40, 0x40, 0x07, 0x4d, ++ 0x43, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x04, 0x04, 0x5a, ++ 0x53, 0x4e, 0x04, 0x17, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, 0x43, 0x52, 0x52, 0x47, 0x4f, ++ 0x4b, 0x07, 0x4f, 0x5f, 0x4b, 0x4a, 0x5a, 0x63, 0x5f, 0x5a, 0x52, 0x42, 0x00, 0x4d, 0x52, 0x52, ++ 0x47, 0x4f, 0x4b, 0x07, 0x4f, 0x5f, 0x4b, 0x4a, 0x5a, 0x63, 0x5f, 0x5a, 0x52, 0x42, 0x00, 0x4d, ++ 0x09, 0x4c, 0x24, 0x53, 0x5a, 0x5a, 0x4f, 0x52, 0x52, 0x4e, 0x47, 0x42, 0x47, 0x05, 0x4f, 0x53, ++ 0x2f, 0x07, 0x4f, 0x05, 0x4f, 0x53, 0x2f, 0x07, 0x4f, 0x05, 0x4f, 0x53, 0x2f, 0x07, 0x4f, 0x4b, ++ 0x43, 0x17, 0x17, 0x0f, 0x14, 0x0f, 0x14, 0x07, 0x14, 0x43, 0x5a, 0x14, 0x43, 0x5a, 0x40, 0x40, ++ 0x4b, 0x01, 0x0c, 0x04, 0x4b, 0x0f, 0x04, 0x43, 0x07, 0x15, 0x27, 0x01, 0x43, 0x05, 0x08, 0x0f, ++ 0x4b, 0x2f, 0x1b, 0x17, 0x4b, 0x22, 0x08, 0x1a, 0x04, 0x07, 0x14, 0x13, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x01, 0x43, 0x53, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x06, 0x40, 0x40, 0x40, 0x06, 0x4b, ++ 0x43, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x04, 0x04, 0x59, ++ 0x53, 0x4d, 0x04, 0x16, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, 0x43, 0x51, 0x51, 0x46, 0x4e, ++ 0x4b, 0x07, 0x4e, 0x5e, 0x4b, 0x49, 0x59, 0x63, 0x5e, 0x59, 0x50, 0x41, 0x01, 0x4b, 0x51, 0x51, ++ 0x46, 0x4e, 0x4b, 0x07, 0x4e, 0x5e, 0x4b, 0x49, 0x59, 0x63, 0x5e, 0x59, 0x50, 0x41, 0x01, 0x4b, ++ 0x0a, 0x4c, 0x24, 0x53, 0x59, 0x59, 0x4e, 0x51, 0x51, 0x4d, 0x46, 0x41, 0x46, 0x06, 0x4e, 0x53, ++ 0x2e, 0x07, 0x4e, 0x06, 0x4e, 0x53, 0x2e, 0x07, 0x4e, 0x06, 0x4e, 0x53, 0x2e, 0x07, 0x4e, 0x4b, ++ 0x43, 0x16, 0x16, 0x0f, 0x14, 0x0f, 0x14, 0x07, 0x14, 0x43, 0x59, 0x14, 0x43, 0x59, 0x40, 0x40, ++ 0x4b, 0x02, 0x0c, 0x04, 0x4b, 0x0f, 0x04, 0x43, 0x07, 0x17, 0x27, 0x02, 0x43, 0x06, 0x09, 0x0f, ++ 0x4b, 0x2e, 0x1b, 0x16, 0x4b, 0x20, 0x09, 0x19, 0x04, 0x07, 0x14, 0x13, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x00, 0x43, 0x53, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x05, 0x40, 0x40, 0x40, 0x05, 0x4a, ++ 0x43, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x04, 0x04, 0x59, ++ 0x53, 0x4c, 0x04, 0x15, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, 0x43, 0x51, 0x51, 0x46, 0x4e, ++ 0x4b, 0x07, 0x4e, 0x5e, 0x4b, 0x49, 0x59, 0x63, 0x5e, 0x59, 0x4f, 0x41, 0x01, 0x4a, 0x51, 0x51, ++ 0x46, 0x4e, 0x4b, 0x07, 0x4e, 0x5e, 0x4b, 0x49, 0x59, 0x63, 0x5e, 0x59, 0x4f, 0x41, 0x01, 0x4a, ++ 0x0b, 0x4d, 0x24, 0x53, 0x59, 0x59, 0x4e, 0x51, 0x51, 0x4c, 0x46, 0x41, 0x46, 0x06, 0x4e, 0x53, ++ 0x2d, 0x07, 0x4e, 0x06, 0x4e, 0x53, 0x2d, 0x07, 0x4e, 0x06, 0x4e, 0x53, 0x2d, 0x07, 0x4e, 0x4b, ++ 0x43, 0x15, 0x15, 0x0f, 0x14, 0x0f, 0x14, 0x07, 0x14, 0x43, 0x59, 0x14, 0x43, 0x59, 0x40, 0x40, ++ 0x4b, 0x03, 0x0c, 0x04, 0x4b, 0x0f, 0x04, 0x43, 0x07, 0x18, 0x27, 0x03, 0x43, 0x06, 0x09, 0x0f, ++ 0x4b, 0x2d, 0x1a, 0x15, 0x4b, 0x1e, 0x09, 0x18, 0x04, 0x07, 0x14, 0x12, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x00, 0x42, 0x52, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x05, 0x40, 0x40, 0x40, 0x05, 0x48, ++ 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x05, 0x05, 0x58, ++ 0x52, 0x4a, 0x05, 0x15, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x50, 0x50, 0x45, 0x4d, ++ 0x4a, 0x07, 0x4d, 0x5d, 0x4a, 0x48, 0x58, 0x62, 0x5d, 0x58, 0x4d, 0x40, 0x02, 0x48, 0x50, 0x50, ++ 0x45, 0x4d, 0x4a, 0x07, 0x4d, 0x5d, 0x4a, 0x48, 0x58, 0x62, 0x5d, 0x58, 0x4d, 0x40, 0x02, 0x48, ++ 0x0d, 0x4d, 0x25, 0x52, 0x58, 0x58, 0x4d, 0x50, 0x50, 0x4a, 0x45, 0x40, 0x45, 0x07, 0x4d, 0x52, ++ 0x2d, 0x07, 0x4d, 0x07, 0x4d, 0x52, 0x2d, 0x07, 0x4d, 0x07, 0x4d, 0x52, 0x2d, 0x07, 0x4d, 0x4a, ++ 0x42, 0x15, 0x15, 0x0f, 0x15, 0x0f, 0x15, 0x07, 0x15, 0x42, 0x58, 0x15, 0x42, 0x58, 0x40, 0x40, ++ 0x4a, 0x05, 0x0d, 0x05, 0x4a, 0x0f, 0x05, 0x42, 0x07, 0x1a, 0x27, 0x05, 0x42, 0x07, 0x0a, 0x0f, ++ 0x4a, 0x2d, 0x1a, 0x15, 0x4a, 0x1d, 0x0a, 0x18, 0x05, 0x07, 0x15, 0x12, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x40, 0x42, 0x52, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x04, 0x40, 0x40, 0x40, 0x04, 0x46, ++ 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x05, 0x05, 0x57, ++ 0x52, 0x49, 0x05, 0x14, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4f, 0x4f, 0x44, 0x4c, ++ 0x4a, 0x07, 0x4c, 0x5c, 0x4a, 0x47, 0x57, 0x62, 0x5c, 0x57, 0x4b, 0x00, 0x03, 0x46, 0x4f, 0x4f, ++ 0x44, 0x4c, 0x4a, 0x07, 0x4c, 0x5c, 0x4a, 0x47, 0x57, 0x62, 0x5c, 0x57, 0x4b, 0x00, 0x03, 0x46, ++ 0x0e, 0x4d, 0x25, 0x52, 0x57, 0x57, 0x4c, 0x4f, 0x4f, 0x49, 0x44, 0x00, 0x44, 0x08, 0x4c, 0x52, ++ 0x2c, 0x07, 0x4c, 0x08, 0x4c, 0x52, 0x2c, 0x07, 0x4c, 0x08, 0x4c, 0x52, 0x2c, 0x07, 0x4c, 0x4a, ++ 0x42, 0x14, 0x14, 0x0f, 0x15, 0x0f, 0x15, 0x07, 0x15, 0x42, 0x57, 0x15, 0x42, 0x57, 0x40, 0x40, ++ 0x4a, 0x06, 0x0d, 0x05, 0x4a, 0x0f, 0x05, 0x42, 0x07, 0x1c, 0x27, 0x06, 0x42, 0x08, 0x0b, 0x0f, ++ 0x4a, 0x2c, 0x1a, 0x14, 0x4a, 0x1b, 0x0b, 0x17, 0x05, 0x07, 0x15, 0x12, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x41, 0x42, 0x52, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x04, 0x40, 0x40, 0x40, 0x04, 0x44, ++ 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x05, 0x05, 0x56, ++ 0x52, 0x48, 0x05, 0x14, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4e, 0x4e, 0x44, 0x4c, ++ 0x4a, 0x07, 0x4c, 0x5c, 0x4a, 0x46, 0x56, 0x62, 0x5c, 0x56, 0x4a, 0x01, 0x03, 0x44, 0x4e, 0x4e, ++ 0x44, 0x4c, 0x4a, 0x07, 0x4c, 0x5c, 0x4a, 0x46, 0x56, 0x62, 0x5c, 0x56, 0x4a, 0x01, 0x03, 0x44, ++ 0x0f, 0x4d, 0x25, 0x52, 0x56, 0x56, 0x4c, 0x4e, 0x4e, 0x48, 0x44, 0x01, 0x44, 0x09, 0x4c, 0x52, ++ 0x2c, 0x07, 0x4c, 0x09, 0x4c, 0x52, 0x2c, 0x07, 0x4c, 0x09, 0x4c, 0x52, 0x2c, 0x07, 0x4c, 0x4a, ++ 0x42, 0x14, 0x14, 0x0f, 0x15, 0x0f, 0x15, 0x07, 0x15, 0x42, 0x56, 0x15, 0x42, 0x56, 0x40, 0x40, ++ 0x4a, 0x07, 0x0d, 0x05, 0x4a, 0x0f, 0x05, 0x42, 0x07, 0x1d, 0x27, 0x07, 0x42, 0x09, 0x0b, 0x0f, ++ 0x4a, 0x2c, 0x1a, 0x14, 0x4a, 0x1a, 0x0b, 0x16, 0x05, 0x07, 0x15, 0x12, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x42, 0x41, 0x51, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x03, 0x40, 0x40, 0x40, 0x03, 0x42, ++ 0x41, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x06, 0x06, 0x55, ++ 0x51, 0x47, 0x06, 0x13, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4d, 0x4d, 0x43, 0x4b, ++ 0x49, 0x07, 0x4b, 0x5b, 0x49, 0x45, 0x55, 0x61, 0x5b, 0x55, 0x48, 0x02, 0x04, 0x42, 0x4d, 0x4d, ++ 0x43, 0x4b, 0x49, 0x07, 0x4b, 0x5b, 0x49, 0x45, 0x55, 0x61, 0x5b, 0x55, 0x48, 0x02, 0x04, 0x42, ++ 0x10, 0x4e, 0x26, 0x51, 0x55, 0x55, 0x4b, 0x4d, 0x4d, 0x47, 0x43, 0x02, 0x43, 0x0a, 0x4b, 0x51, ++ 0x2b, 0x07, 0x4b, 0x0a, 0x4b, 0x51, 0x2b, 0x07, 0x4b, 0x0a, 0x4b, 0x51, 0x2b, 0x07, 0x4b, 0x49, ++ 0x41, 0x13, 0x13, 0x0f, 0x16, 0x0f, 0x16, 0x07, 0x16, 0x41, 0x55, 0x16, 0x41, 0x55, 0x40, 0x40, ++ 0x49, 0x08, 0x0e, 0x06, 0x49, 0x0f, 0x06, 0x41, 0x07, 0x1f, 0x27, 0x08, 0x41, 0x0a, 0x0c, 0x0f, ++ 0x49, 0x2b, 0x19, 0x13, 0x49, 0x18, 0x0c, 0x15, 0x06, 0x07, 0x16, 0x11, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x43, 0x41, 0x51, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x40, 0x40, 0x40, 0x02, 0x40, ++ 0x41, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x06, 0x06, 0x54, ++ 0x51, 0x45, 0x06, 0x12, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4c, 0x4c, 0x42, 0x4a, ++ 0x49, 0x07, 0x4a, 0x5a, 0x49, 0x44, 0x54, 0x61, 0x5a, 0x54, 0x47, 0x03, 0x05, 0x40, 0x4c, 0x4c, ++ 0x42, 0x4a, 0x49, 0x07, 0x4a, 0x5a, 0x49, 0x44, 0x54, 0x61, 0x5a, 0x54, 0x47, 0x03, 0x05, 0x40, ++ 0x12, 0x4e, 0x26, 0x51, 0x54, 0x54, 0x4a, 0x4c, 0x4c, 0x45, 0x42, 0x03, 0x42, 0x0b, 0x4a, 0x51, ++ 0x2a, 0x07, 0x4a, 0x0b, 0x4a, 0x51, 0x2a, 0x07, 0x4a, 0x0b, 0x4a, 0x51, 0x2a, 0x07, 0x4a, 0x49, ++ 0x41, 0x12, 0x12, 0x0f, 0x16, 0x0f, 0x16, 0x07, 0x16, 0x41, 0x54, 0x16, 0x41, 0x54, 0x40, 0x40, ++ 0x49, 0x0a, 0x0e, 0x06, 0x49, 0x0f, 0x06, 0x41, 0x07, 0x20, 0x27, 0x0a, 0x41, 0x0b, 0x0d, 0x0f, ++ 0x49, 0x2a, 0x19, 0x12, 0x49, 0x17, 0x0d, 0x14, 0x06, 0x07, 0x16, 0x11, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x44, 0x41, 0x51, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x40, 0x40, 0x40, 0x02, 0x01, ++ 0x41, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x06, 0x06, 0x53, ++ 0x51, 0x44, 0x06, 0x12, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4b, 0x4b, 0x42, 0x4a, ++ 0x49, 0x07, 0x4a, 0x5a, 0x49, 0x43, 0x53, 0x61, 0x5a, 0x53, 0x45, 0x04, 0x05, 0x01, 0x4b, 0x4b, ++ 0x42, 0x4a, 0x49, 0x07, 0x4a, 0x5a, 0x49, 0x43, 0x53, 0x61, 0x5a, 0x53, 0x45, 0x04, 0x05, 0x01, ++ 0x13, 0x4e, 0x26, 0x51, 0x53, 0x53, 0x4a, 0x4b, 0x4b, 0x44, 0x42, 0x04, 0x42, 0x0c, 0x4a, 0x51, ++ 0x2a, 0x07, 0x4a, 0x0c, 0x4a, 0x51, 0x2a, 0x07, 0x4a, 0x0c, 0x4a, 0x51, 0x2a, 0x07, 0x4a, 0x49, ++ 0x41, 0x12, 0x12, 0x0f, 0x16, 0x0f, 0x16, 0x07, 0x16, 0x41, 0x53, 0x16, 0x41, 0x53, 0x40, 0x40, ++ 0x49, 0x0b, 0x0e, 0x06, 0x49, 0x0f, 0x06, 0x41, 0x07, 0x22, 0x27, 0x0b, 0x41, 0x0c, 0x0d, 0x0f, ++ 0x49, 0x2a, 0x19, 0x12, 0x49, 0x15, 0x0d, 0x13, 0x06, 0x07, 0x16, 0x11, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x45, 0x40, 0x50, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x40, 0x40, 0x40, 0x01, 0x03, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x52, ++ 0x50, 0x43, 0x07, 0x11, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4a, 0x4a, 0x41, 0x49, ++ 0x48, 0x07, 0x49, 0x59, 0x48, 0x42, 0x52, 0x60, 0x59, 0x52, 0x44, 0x05, 0x06, 0x03, 0x4a, 0x4a, ++ 0x41, 0x49, 0x48, 0x07, 0x49, 0x59, 0x48, 0x42, 0x52, 0x60, 0x59, 0x52, 0x44, 0x05, 0x06, 0x03, ++ 0x14, 0x4f, 0x27, 0x50, 0x52, 0x52, 0x49, 0x4a, 0x4a, 0x43, 0x41, 0x05, 0x41, 0x0d, 0x49, 0x50, ++ 0x29, 0x07, 0x49, 0x0d, 0x49, 0x50, 0x29, 0x07, 0x49, 0x0d, 0x49, 0x50, 0x29, 0x07, 0x49, 0x48, ++ 0x40, 0x11, 0x11, 0x0f, 0x17, 0x0f, 0x17, 0x07, 0x17, 0x40, 0x52, 0x17, 0x40, 0x52, 0x40, 0x40, ++ 0x48, 0x0c, 0x0f, 0x07, 0x48, 0x0f, 0x07, 0x40, 0x07, 0x23, 0x27, 0x0c, 0x40, 0x0d, 0x0e, 0x0f, ++ 0x48, 0x29, 0x18, 0x11, 0x48, 0x14, 0x0e, 0x12, 0x07, 0x07, 0x17, 0x10, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x46, 0x40, 0x50, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, 0x00, 0x04, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x51, ++ 0x50, 0x42, 0x07, 0x10, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x49, 0x41, 0x49, ++ 0x48, 0x07, 0x49, 0x59, 0x48, 0x41, 0x51, 0x60, 0x59, 0x51, 0x42, 0x06, 0x06, 0x04, 0x49, 0x49, ++ 0x41, 0x49, 0x48, 0x07, 0x49, 0x59, 0x48, 0x41, 0x51, 0x60, 0x59, 0x51, 0x42, 0x06, 0x06, 0x04, ++ 0x15, 0x4f, 0x27, 0x50, 0x51, 0x51, 0x49, 0x49, 0x49, 0x42, 0x41, 0x06, 0x41, 0x0e, 0x49, 0x50, ++ 0x28, 0x07, 0x49, 0x0e, 0x49, 0x50, 0x28, 0x07, 0x49, 0x0e, 0x49, 0x50, 0x28, 0x07, 0x49, 0x48, ++ 0x40, 0x10, 0x10, 0x0f, 0x17, 0x0f, 0x17, 0x07, 0x17, 0x40, 0x51, 0x17, 0x40, 0x51, 0x40, 0x40, ++ 0x48, 0x0d, 0x0f, 0x07, 0x48, 0x0f, 0x07, 0x40, 0x07, 0x25, 0x27, 0x0d, 0x40, 0x0e, 0x0e, 0x0f, ++ 0x48, 0x28, 0x18, 0x10, 0x48, 0x12, 0x0e, 0x11, 0x07, 0x07, 0x17, 0x10, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x47, 0x40, 0x50, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, 0x00, 0x06, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x50, ++ 0x50, 0x40, 0x07, 0x10, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x48, 0x48, 0x40, 0x48, ++ 0x48, 0x07, 0x48, 0x58, 0x48, 0x40, 0x50, 0x60, 0x58, 0x50, 0x40, 0x07, 0x07, 0x06, 0x48, 0x48, ++ 0x40, 0x48, 0x48, 0x07, 0x48, 0x58, 0x48, 0x40, 0x50, 0x60, 0x58, 0x50, 0x40, 0x07, 0x07, 0x06, ++ 0x17, 0x4f, 0x27, 0x50, 0x50, 0x50, 0x48, 0x48, 0x48, 0x40, 0x40, 0x07, 0x40, 0x0f, 0x48, 0x50, ++ 0x28, 0x07, 0x48, 0x0f, 0x48, 0x50, 0x28, 0x07, 0x48, 0x0f, 0x48, 0x50, 0x28, 0x07, 0x48, 0x48, ++ 0x40, 0x10, 0x10, 0x0f, 0x17, 0x0f, 0x17, 0x07, 0x17, 0x40, 0x50, 0x17, 0x40, 0x50, 0x40, 0x40, ++ 0x48, 0x0f, 0x0f, 0x07, 0x48, 0x0f, 0x07, 0x40, 0x07, 0x27, 0x27, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, ++ 0x48, 0x28, 0x18, 0x10, 0x48, 0x10, 0x0f, 0x10, 0x07, 0x07, 0x17, 0x10, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x48, 0x00, 0x4f, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x08, ++ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x08, 0x08, 0x4f, ++ 0x4f, 0x00, 0x08, 0x0f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x47, 0x47, 0x00, 0x47, ++ 0x47, 0x07, 0x47, 0x57, 0x47, 0x00, 0x4f, 0x5f, 0x57, 0x4f, 0x00, 0x08, 0x08, 0x08, 0x47, 0x47, ++ 0x00, 0x47, 0x47, 0x07, 0x47, 0x57, 0x47, 0x00, 0x4f, 0x5f, 0x57, 0x4f, 0x00, 0x08, 0x08, 0x08, ++ 0x18, 0x50, 0x28, 0x4f, 0x4f, 0x4f, 0x47, 0x47, 0x47, 0x00, 0x00, 0x08, 0x00, 0x10, 0x47, 0x4f, ++ 0x27, 0x07, 0x47, 0x10, 0x47, 0x4f, 0x27, 0x07, 0x47, 0x10, 0x47, 0x4f, 0x27, 0x07, 0x47, 0x47, ++ 0x00, 0x0f, 0x0f, 0x0f, 0x18, 0x0f, 0x18, 0x07, 0x18, 0x00, 0x4f, 0x18, 0x00, 0x4f, 0x40, 0x40, ++ 0x47, 0x10, 0x10, 0x08, 0x47, 0x0f, 0x08, 0x00, 0x07, 0x28, 0x27, 0x10, 0x00, 0x10, 0x10, 0x0f, ++ 0x47, 0x27, 0x17, 0x0f, 0x47, 0x0f, 0x10, 0x0f, 0x08, 0x07, 0x18, 0x0f, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x49, 0x00, 0x4f, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0a, ++ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x08, 0x08, 0x4e, ++ 0x4f, 0x01, 0x08, 0x0f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x46, 0x46, 0x00, 0x47, ++ 0x47, 0x07, 0x47, 0x57, 0x47, 0x01, 0x4e, 0x5f, 0x57, 0x4e, 0x02, 0x09, 0x08, 0x0a, 0x46, 0x46, ++ 0x00, 0x47, 0x47, 0x07, 0x47, 0x57, 0x47, 0x01, 0x4e, 0x5f, 0x57, 0x4e, 0x02, 0x09, 0x08, 0x0a, ++ 0x19, 0x50, 0x28, 0x4f, 0x4e, 0x4e, 0x47, 0x46, 0x46, 0x01, 0x00, 0x09, 0x00, 0x11, 0x47, 0x4f, ++ 0x27, 0x07, 0x47, 0x11, 0x47, 0x4f, 0x27, 0x07, 0x47, 0x11, 0x47, 0x4f, 0x27, 0x07, 0x47, 0x47, ++ 0x00, 0x0f, 0x0f, 0x0f, 0x18, 0x0f, 0x18, 0x07, 0x18, 0x00, 0x4e, 0x18, 0x00, 0x4e, 0x40, 0x40, ++ 0x47, 0x11, 0x10, 0x08, 0x47, 0x0f, 0x08, 0x00, 0x07, 0x2a, 0x27, 0x11, 0x00, 0x11, 0x10, 0x0f, ++ 0x47, 0x27, 0x17, 0x0f, 0x47, 0x0d, 0x10, 0x0e, 0x08, 0x07, 0x18, 0x0f, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4a, 0x00, 0x4f, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x41, 0x40, 0x40, 0x40, 0x41, 0x0c, ++ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x08, 0x08, 0x4d, ++ 0x4f, 0x02, 0x08, 0x0e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x45, 0x45, 0x01, 0x46, ++ 0x47, 0x07, 0x46, 0x56, 0x47, 0x02, 0x4d, 0x5f, 0x56, 0x4d, 0x03, 0x0a, 0x09, 0x0c, 0x45, 0x45, ++ 0x01, 0x46, 0x47, 0x07, 0x46, 0x56, 0x47, 0x02, 0x4d, 0x5f, 0x56, 0x4d, 0x03, 0x0a, 0x09, 0x0c, ++ 0x1a, 0x50, 0x28, 0x4f, 0x4d, 0x4d, 0x46, 0x45, 0x45, 0x02, 0x01, 0x0a, 0x01, 0x12, 0x46, 0x4f, ++ 0x26, 0x07, 0x46, 0x12, 0x46, 0x4f, 0x26, 0x07, 0x46, 0x12, 0x46, 0x4f, 0x26, 0x07, 0x46, 0x47, ++ 0x00, 0x0e, 0x0e, 0x0f, 0x18, 0x0f, 0x18, 0x07, 0x18, 0x00, 0x4d, 0x18, 0x00, 0x4d, 0x40, 0x40, ++ 0x47, 0x12, 0x10, 0x08, 0x47, 0x0f, 0x08, 0x00, 0x07, 0x2b, 0x27, 0x12, 0x00, 0x12, 0x11, 0x0f, ++ 0x47, 0x26, 0x17, 0x0e, 0x47, 0x0c, 0x11, 0x0d, 0x08, 0x07, 0x18, 0x0f, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4b, 0x01, 0x4e, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x40, 0x40, 0x40, 0x42, 0x0e, ++ 0x01, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x09, 0x09, 0x4c, ++ 0x4e, 0x04, 0x09, 0x0d, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x01, 0x44, 0x44, 0x02, 0x45, ++ 0x46, 0x07, 0x45, 0x55, 0x46, 0x03, 0x4c, 0x5e, 0x55, 0x4c, 0x05, 0x0b, 0x0a, 0x0e, 0x44, 0x44, ++ 0x02, 0x45, 0x46, 0x07, 0x45, 0x55, 0x46, 0x03, 0x4c, 0x5e, 0x55, 0x4c, 0x05, 0x0b, 0x0a, 0x0e, ++ 0x1c, 0x51, 0x29, 0x4e, 0x4c, 0x4c, 0x45, 0x44, 0x44, 0x04, 0x02, 0x0b, 0x02, 0x13, 0x45, 0x4e, ++ 0x25, 0x07, 0x45, 0x13, 0x45, 0x4e, 0x25, 0x07, 0x45, 0x13, 0x45, 0x4e, 0x25, 0x07, 0x45, 0x46, ++ 0x01, 0x0d, 0x0d, 0x0f, 0x19, 0x0f, 0x19, 0x07, 0x19, 0x01, 0x4c, 0x19, 0x01, 0x4c, 0x40, 0x40, ++ 0x46, 0x14, 0x11, 0x09, 0x46, 0x0f, 0x09, 0x01, 0x07, 0x2d, 0x27, 0x14, 0x01, 0x13, 0x12, 0x0f, ++ 0x46, 0x25, 0x16, 0x0d, 0x46, 0x0a, 0x12, 0x0c, 0x09, 0x07, 0x19, 0x0e, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4c, 0x01, 0x4e, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x40, 0x40, 0x40, 0x42, 0x10, ++ 0x01, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x09, 0x09, 0x4b, ++ 0x4e, 0x05, 0x09, 0x0d, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x01, 0x43, 0x43, 0x02, 0x45, ++ 0x46, 0x07, 0x45, 0x55, 0x46, 0x04, 0x4b, 0x5e, 0x55, 0x4b, 0x06, 0x0c, 0x0a, 0x10, 0x43, 0x43, ++ 0x02, 0x45, 0x46, 0x07, 0x45, 0x55, 0x46, 0x04, 0x4b, 0x5e, 0x55, 0x4b, 0x06, 0x0c, 0x0a, 0x10, ++ 0x1d, 0x51, 0x29, 0x4e, 0x4b, 0x4b, 0x45, 0x43, 0x43, 0x05, 0x02, 0x0c, 0x02, 0x14, 0x45, 0x4e, ++ 0x25, 0x07, 0x45, 0x14, 0x45, 0x4e, 0x25, 0x07, 0x45, 0x14, 0x45, 0x4e, 0x25, 0x07, 0x45, 0x46, ++ 0x01, 0x0d, 0x0d, 0x0f, 0x19, 0x0f, 0x19, 0x07, 0x19, 0x01, 0x4b, 0x19, 0x01, 0x4b, 0x40, 0x40, ++ 0x46, 0x15, 0x11, 0x09, 0x46, 0x0f, 0x09, 0x01, 0x07, 0x2e, 0x27, 0x15, 0x01, 0x14, 0x12, 0x0f, ++ 0x46, 0x25, 0x16, 0x0d, 0x46, 0x09, 0x12, 0x0b, 0x09, 0x07, 0x19, 0x0e, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4d, 0x01, 0x4e, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x43, 0x40, 0x40, 0x40, 0x43, 0x12, ++ 0x01, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x09, 0x09, 0x4a, ++ 0x4e, 0x06, 0x09, 0x0c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x01, 0x42, 0x42, 0x03, 0x44, ++ 0x46, 0x07, 0x44, 0x54, 0x46, 0x05, 0x4a, 0x5e, 0x54, 0x4a, 0x08, 0x0d, 0x0b, 0x12, 0x42, 0x42, ++ 0x03, 0x44, 0x46, 0x07, 0x44, 0x54, 0x46, 0x05, 0x4a, 0x5e, 0x54, 0x4a, 0x08, 0x0d, 0x0b, 0x12, ++ 0x1e, 0x51, 0x29, 0x4e, 0x4a, 0x4a, 0x44, 0x42, 0x42, 0x06, 0x03, 0x0d, 0x03, 0x15, 0x44, 0x4e, ++ 0x24, 0x07, 0x44, 0x15, 0x44, 0x4e, 0x24, 0x07, 0x44, 0x15, 0x44, 0x4e, 0x24, 0x07, 0x44, 0x46, ++ 0x01, 0x0c, 0x0c, 0x0f, 0x19, 0x0f, 0x19, 0x07, 0x19, 0x01, 0x4a, 0x19, 0x01, 0x4a, 0x40, 0x40, ++ 0x46, 0x16, 0x11, 0x09, 0x46, 0x0f, 0x09, 0x01, 0x07, 0x30, 0x27, 0x16, 0x01, 0x15, 0x13, 0x0f, ++ 0x46, 0x24, 0x16, 0x0c, 0x46, 0x07, 0x13, 0x0a, 0x09, 0x07, 0x19, 0x0e, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4e, 0x01, 0x4e, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x40, 0x40, 0x40, 0x44, 0x13, ++ 0x01, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x09, 0x09, 0x4a, ++ 0x4e, 0x07, 0x09, 0x0b, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x01, 0x42, 0x42, 0x03, 0x44, ++ 0x46, 0x07, 0x44, 0x54, 0x46, 0x05, 0x4a, 0x5e, 0x54, 0x4a, 0x09, 0x0d, 0x0b, 0x13, 0x42, 0x42, ++ 0x03, 0x44, 0x46, 0x07, 0x44, 0x54, 0x46, 0x05, 0x4a, 0x5e, 0x54, 0x4a, 0x09, 0x0d, 0x0b, 0x13, ++ 0x1f, 0x52, 0x29, 0x4e, 0x4a, 0x4a, 0x44, 0x42, 0x42, 0x07, 0x03, 0x0d, 0x03, 0x15, 0x44, 0x4e, ++ 0x23, 0x07, 0x44, 0x15, 0x44, 0x4e, 0x23, 0x07, 0x44, 0x15, 0x44, 0x4e, 0x23, 0x07, 0x44, 0x46, ++ 0x01, 0x0b, 0x0b, 0x0f, 0x19, 0x0f, 0x19, 0x07, 0x19, 0x01, 0x4a, 0x19, 0x01, 0x4a, 0x40, 0x40, ++ 0x46, 0x17, 0x11, 0x09, 0x46, 0x0f, 0x09, 0x01, 0x07, 0x31, 0x27, 0x17, 0x01, 0x15, 0x13, 0x0f, ++ 0x46, 0x23, 0x15, 0x0b, 0x46, 0x05, 0x13, 0x09, 0x09, 0x07, 0x19, 0x0d, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4e, 0x02, 0x4d, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x44, 0x40, 0x40, 0x40, 0x44, 0x15, ++ 0x02, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0a, 0x0a, 0x49, ++ 0x4d, 0x09, 0x0a, 0x0b, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x41, 0x41, 0x04, 0x43, ++ 0x45, 0x07, 0x43, 0x53, 0x45, 0x06, 0x49, 0x5d, 0x53, 0x49, 0x0b, 0x0e, 0x0c, 0x15, 0x41, 0x41, ++ 0x04, 0x43, 0x45, 0x07, 0x43, 0x53, 0x45, 0x06, 0x49, 0x5d, 0x53, 0x49, 0x0b, 0x0e, 0x0c, 0x15, ++ 0x21, 0x52, 0x2a, 0x4d, 0x49, 0x49, 0x43, 0x41, 0x41, 0x09, 0x04, 0x0e, 0x04, 0x16, 0x43, 0x4d, ++ 0x23, 0x07, 0x43, 0x16, 0x43, 0x4d, 0x23, 0x07, 0x43, 0x16, 0x43, 0x4d, 0x23, 0x07, 0x43, 0x45, ++ 0x02, 0x0b, 0x0b, 0x0f, 0x1a, 0x0f, 0x1a, 0x07, 0x1a, 0x02, 0x49, 0x1a, 0x02, 0x49, 0x40, 0x40, ++ 0x45, 0x19, 0x12, 0x0a, 0x45, 0x0f, 0x0a, 0x02, 0x07, 0x33, 0x27, 0x19, 0x02, 0x16, 0x14, 0x0f, ++ 0x45, 0x23, 0x15, 0x0b, 0x45, 0x04, 0x14, 0x09, 0x0a, 0x07, 0x1a, 0x0d, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4f, 0x02, 0x4d, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x45, 0x40, 0x40, 0x40, 0x45, 0x17, ++ 0x02, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0a, 0x0a, 0x48, ++ 0x4d, 0x0a, 0x0a, 0x0a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x40, 0x40, 0x05, 0x42, ++ 0x45, 0x07, 0x42, 0x52, 0x45, 0x07, 0x48, 0x5d, 0x52, 0x48, 0x0d, 0x0f, 0x0d, 0x17, 0x40, 0x40, ++ 0x05, 0x42, 0x45, 0x07, 0x42, 0x52, 0x45, 0x07, 0x48, 0x5d, 0x52, 0x48, 0x0d, 0x0f, 0x0d, 0x17, ++ 0x22, 0x52, 0x2a, 0x4d, 0x48, 0x48, 0x42, 0x40, 0x40, 0x0a, 0x05, 0x0f, 0x05, 0x17, 0x42, 0x4d, ++ 0x22, 0x07, 0x42, 0x17, 0x42, 0x4d, 0x22, 0x07, 0x42, 0x17, 0x42, 0x4d, 0x22, 0x07, 0x42, 0x45, ++ 0x02, 0x0a, 0x0a, 0x0f, 0x1a, 0x0f, 0x1a, 0x07, 0x1a, 0x02, 0x48, 0x1a, 0x02, 0x48, 0x40, 0x40, ++ 0x45, 0x1a, 0x12, 0x0a, 0x45, 0x0f, 0x0a, 0x02, 0x07, 0x35, 0x27, 0x1a, 0x02, 0x17, 0x15, 0x0f, ++ 0x45, 0x22, 0x15, 0x0a, 0x45, 0x02, 0x15, 0x08, 0x0a, 0x07, 0x1a, 0x0d, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x50, 0x02, 0x4d, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x45, 0x40, 0x40, 0x40, 0x45, 0x19, ++ 0x02, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0a, 0x0a, 0x47, ++ 0x4d, 0x0b, 0x0a, 0x0a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x00, 0x00, 0x05, 0x42, ++ 0x45, 0x07, 0x42, 0x52, 0x45, 0x08, 0x47, 0x5d, 0x52, 0x47, 0x0e, 0x10, 0x0d, 0x19, 0x00, 0x00, ++ 0x05, 0x42, 0x45, 0x07, 0x42, 0x52, 0x45, 0x08, 0x47, 0x5d, 0x52, 0x47, 0x0e, 0x10, 0x0d, 0x19, ++ 0x23, 0x52, 0x2a, 0x4d, 0x47, 0x47, 0x42, 0x00, 0x00, 0x0b, 0x05, 0x10, 0x05, 0x18, 0x42, 0x4d, ++ 0x22, 0x07, 0x42, 0x18, 0x42, 0x4d, 0x22, 0x07, 0x42, 0x18, 0x42, 0x4d, 0x22, 0x07, 0x42, 0x45, ++ 0x02, 0x0a, 0x0a, 0x0f, 0x1a, 0x0f, 0x1a, 0x07, 0x1a, 0x02, 0x47, 0x1a, 0x02, 0x47, 0x40, 0x40, ++ 0x45, 0x1b, 0x12, 0x0a, 0x45, 0x0f, 0x0a, 0x02, 0x07, 0x36, 0x27, 0x1b, 0x02, 0x18, 0x15, 0x0f, ++ 0x45, 0x22, 0x15, 0x0a, 0x45, 0x01, 0x15, 0x07, 0x0a, 0x07, 0x1a, 0x0d, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x51, 0x03, 0x4c, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x46, 0x40, 0x40, 0x40, 0x46, 0x1b, ++ 0x03, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0b, 0x0b, 0x46, ++ 0x4c, 0x0c, 0x0b, 0x09, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x03, 0x03, 0x01, 0x01, 0x06, 0x41, ++ 0x44, 0x07, 0x41, 0x51, 0x44, 0x09, 0x46, 0x5c, 0x51, 0x46, 0x10, 0x11, 0x0e, 0x1b, 0x01, 0x01, ++ 0x06, 0x41, 0x44, 0x07, 0x41, 0x51, 0x44, 0x09, 0x46, 0x5c, 0x51, 0x46, 0x10, 0x11, 0x0e, 0x1b, ++ 0x24, 0x53, 0x2b, 0x4c, 0x46, 0x46, 0x41, 0x01, 0x01, 0x0c, 0x06, 0x11, 0x06, 0x19, 0x41, 0x4c, ++ 0x21, 0x07, 0x41, 0x19, 0x41, 0x4c, 0x21, 0x07, 0x41, 0x19, 0x41, 0x4c, 0x21, 0x07, 0x41, 0x44, ++ 0x03, 0x09, 0x09, 0x0f, 0x1b, 0x0f, 0x1b, 0x07, 0x1b, 0x03, 0x46, 0x1b, 0x03, 0x46, 0x40, 0x40, ++ 0x44, 0x1c, 0x13, 0x0b, 0x44, 0x0f, 0x0b, 0x03, 0x07, 0x38, 0x27, 0x1c, 0x03, 0x19, 0x16, 0x0f, ++ 0x44, 0x21, 0x14, 0x09, 0x44, 0x40, 0x16, 0x06, 0x0b, 0x07, 0x1b, 0x0c, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x52, 0x03, 0x4c, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x47, 0x40, 0x40, 0x40, 0x47, 0x1d, ++ 0x03, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0b, 0x0b, 0x45, ++ 0x4c, 0x0e, 0x0b, 0x08, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x03, 0x03, 0x02, 0x02, 0x07, 0x40, ++ 0x44, 0x07, 0x40, 0x50, 0x44, 0x0a, 0x45, 0x5c, 0x50, 0x45, 0x11, 0x12, 0x0f, 0x1d, 0x02, 0x02, ++ 0x07, 0x40, 0x44, 0x07, 0x40, 0x50, 0x44, 0x0a, 0x45, 0x5c, 0x50, 0x45, 0x11, 0x12, 0x0f, 0x1d, ++ 0x26, 0x53, 0x2b, 0x4c, 0x45, 0x45, 0x40, 0x02, 0x02, 0x0e, 0x07, 0x12, 0x07, 0x1a, 0x40, 0x4c, ++ 0x20, 0x07, 0x40, 0x1a, 0x40, 0x4c, 0x20, 0x07, 0x40, 0x1a, 0x40, 0x4c, 0x20, 0x07, 0x40, 0x44, ++ 0x03, 0x08, 0x08, 0x0f, 0x1b, 0x0f, 0x1b, 0x07, 0x1b, 0x03, 0x45, 0x1b, 0x03, 0x45, 0x40, 0x40, ++ 0x44, 0x1e, 0x13, 0x0b, 0x44, 0x0f, 0x0b, 0x03, 0x07, 0x39, 0x27, 0x1e, 0x03, 0x1a, 0x17, 0x0f, ++ 0x44, 0x20, 0x14, 0x08, 0x44, 0x41, 0x17, 0x05, 0x0b, 0x07, 0x1b, 0x0c, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x53, 0x03, 0x4c, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x47, 0x40, 0x40, 0x40, 0x47, 0x1f, ++ 0x03, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0b, 0x0b, 0x44, ++ 0x4c, 0x0f, 0x0b, 0x08, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x03, 0x03, 0x03, 0x03, 0x07, 0x40, ++ 0x44, 0x07, 0x40, 0x50, 0x44, 0x0b, 0x44, 0x5c, 0x50, 0x44, 0x13, 0x13, 0x0f, 0x1f, 0x03, 0x03, ++ 0x07, 0x40, 0x44, 0x07, 0x40, 0x50, 0x44, 0x0b, 0x44, 0x5c, 0x50, 0x44, 0x13, 0x13, 0x0f, 0x1f, ++ 0x27, 0x53, 0x2b, 0x4c, 0x44, 0x44, 0x40, 0x03, 0x03, 0x0f, 0x07, 0x13, 0x07, 0x1b, 0x40, 0x4c, ++ 0x20, 0x07, 0x40, 0x1b, 0x40, 0x4c, 0x20, 0x07, 0x40, 0x1b, 0x40, 0x4c, 0x20, 0x07, 0x40, 0x44, ++ 0x03, 0x08, 0x08, 0x0f, 0x1b, 0x0f, 0x1b, 0x07, 0x1b, 0x03, 0x44, 0x1b, 0x03, 0x44, 0x40, 0x40, ++ 0x44, 0x1f, 0x13, 0x0b, 0x44, 0x0f, 0x0b, 0x03, 0x07, 0x3b, 0x27, 0x1f, 0x03, 0x1b, 0x17, 0x0f, ++ 0x44, 0x20, 0x14, 0x08, 0x44, 0x43, 0x17, 0x04, 0x0b, 0x07, 0x1b, 0x0c, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x54, 0x04, 0x4b, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x48, 0x40, 0x40, 0x40, 0x48, 0x21, ++ 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0c, 0x0c, 0x43, ++ 0x4b, 0x10, 0x0c, 0x07, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x04, 0x04, 0x04, 0x04, 0x08, 0x00, ++ 0x43, 0x07, 0x00, 0x4f, 0x43, 0x0c, 0x43, 0x5b, 0x4f, 0x43, 0x14, 0x14, 0x10, 0x21, 0x04, 0x04, ++ 0x08, 0x00, 0x43, 0x07, 0x00, 0x4f, 0x43, 0x0c, 0x43, 0x5b, 0x4f, 0x43, 0x14, 0x14, 0x10, 0x21, ++ 0x28, 0x54, 0x2c, 0x4b, 0x43, 0x43, 0x00, 0x04, 0x04, 0x10, 0x08, 0x14, 0x08, 0x1c, 0x00, 0x4b, ++ 0x1f, 0x07, 0x00, 0x1c, 0x00, 0x4b, 0x1f, 0x07, 0x00, 0x1c, 0x00, 0x4b, 0x1f, 0x07, 0x00, 0x43, ++ 0x04, 0x07, 0x07, 0x0f, 0x1c, 0x0f, 0x1c, 0x07, 0x1c, 0x04, 0x43, 0x1c, 0x04, 0x43, 0x40, 0x40, ++ 0x43, 0x20, 0x14, 0x0c, 0x43, 0x0f, 0x0c, 0x04, 0x07, 0x3c, 0x27, 0x20, 0x04, 0x1c, 0x18, 0x0f, ++ 0x43, 0x1f, 0x13, 0x07, 0x43, 0x44, 0x18, 0x03, 0x0c, 0x07, 0x1c, 0x0b, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x55, 0x04, 0x4b, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x40, 0x40, 0x40, 0x49, 0x22, ++ 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0c, 0x0c, 0x42, ++ 0x4b, 0x11, 0x0c, 0x06, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x04, 0x04, 0x05, 0x05, 0x08, 0x00, ++ 0x43, 0x07, 0x00, 0x4f, 0x43, 0x0d, 0x42, 0x5b, 0x4f, 0x42, 0x16, 0x15, 0x10, 0x22, 0x05, 0x05, ++ 0x08, 0x00, 0x43, 0x07, 0x00, 0x4f, 0x43, 0x0d, 0x42, 0x5b, 0x4f, 0x42, 0x16, 0x15, 0x10, 0x22, ++ 0x29, 0x54, 0x2c, 0x4b, 0x42, 0x42, 0x00, 0x05, 0x05, 0x11, 0x08, 0x15, 0x08, 0x1d, 0x00, 0x4b, ++ 0x1e, 0x07, 0x00, 0x1d, 0x00, 0x4b, 0x1e, 0x07, 0x00, 0x1d, 0x00, 0x4b, 0x1e, 0x07, 0x00, 0x43, ++ 0x04, 0x06, 0x06, 0x0f, 0x1c, 0x0f, 0x1c, 0x07, 0x1c, 0x04, 0x42, 0x1c, 0x04, 0x42, 0x40, 0x40, ++ 0x43, 0x21, 0x14, 0x0c, 0x43, 0x0f, 0x0c, 0x04, 0x07, 0x3e, 0x27, 0x21, 0x04, 0x1d, 0x18, 0x0f, ++ 0x43, 0x1e, 0x13, 0x06, 0x43, 0x46, 0x18, 0x02, 0x0c, 0x07, 0x1c, 0x0b, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x56, 0x04, 0x4b, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x40, 0x40, 0x40, 0x49, 0x24, ++ 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0c, 0x0c, 0x41, ++ 0x4b, 0x13, 0x0c, 0x06, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x04, 0x04, 0x06, 0x06, 0x09, 0x01, ++ 0x43, 0x07, 0x01, 0x4e, 0x43, 0x0e, 0x41, 0x5b, 0x4e, 0x41, 0x18, 0x16, 0x11, 0x24, 0x06, 0x06, ++ 0x09, 0x01, 0x43, 0x07, 0x01, 0x4e, 0x43, 0x0e, 0x41, 0x5b, 0x4e, 0x41, 0x18, 0x16, 0x11, 0x24, ++ 0x2b, 0x54, 0x2c, 0x4b, 0x41, 0x41, 0x01, 0x06, 0x06, 0x13, 0x09, 0x16, 0x09, 0x1e, 0x01, 0x4b, ++ 0x1e, 0x07, 0x01, 0x1e, 0x01, 0x4b, 0x1e, 0x07, 0x01, 0x1e, 0x01, 0x4b, 0x1e, 0x07, 0x01, 0x43, ++ 0x04, 0x06, 0x06, 0x0f, 0x1c, 0x0f, 0x1c, 0x07, 0x1c, 0x04, 0x41, 0x1c, 0x04, 0x41, 0x40, 0x40, ++ 0x43, 0x23, 0x14, 0x0c, 0x43, 0x0f, 0x0c, 0x04, 0x07, 0x3e, 0x27, 0x23, 0x04, 0x1e, 0x19, 0x0f, ++ 0x43, 0x1e, 0x13, 0x06, 0x43, 0x48, 0x19, 0x01, 0x0c, 0x07, 0x1c, 0x0b, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x57, 0x05, 0x4a, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4a, 0x40, 0x40, 0x40, 0x4a, 0x26, ++ 0x05, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0d, 0x0d, 0x40, ++ 0x4a, 0x14, 0x0d, 0x05, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x05, 0x05, 0x07, 0x07, 0x0a, 0x02, ++ 0x42, 0x07, 0x02, 0x4d, 0x42, 0x0f, 0x40, 0x5a, 0x4d, 0x40, 0x19, 0x17, 0x12, 0x26, 0x07, 0x07, ++ 0x0a, 0x02, 0x42, 0x07, 0x02, 0x4d, 0x42, 0x0f, 0x40, 0x5a, 0x4d, 0x40, 0x19, 0x17, 0x12, 0x26, ++ 0x2c, 0x55, 0x2d, 0x4a, 0x40, 0x40, 0x02, 0x07, 0x07, 0x14, 0x0a, 0x17, 0x0a, 0x1f, 0x02, 0x4a, ++ 0x1d, 0x07, 0x02, 0x1f, 0x02, 0x4a, 0x1d, 0x07, 0x02, 0x1f, 0x02, 0x4a, 0x1d, 0x07, 0x02, 0x42, ++ 0x05, 0x05, 0x05, 0x0f, 0x1d, 0x0f, 0x1d, 0x07, 0x1d, 0x05, 0x40, 0x1d, 0x05, 0x40, 0x40, 0x40, ++ 0x42, 0x24, 0x15, 0x0d, 0x42, 0x0f, 0x0d, 0x05, 0x07, 0x3e, 0x27, 0x24, 0x05, 0x1f, 0x1a, 0x0f, ++ 0x42, 0x1d, 0x12, 0x05, 0x42, 0x49, 0x1a, 0x00, 0x0d, 0x07, 0x1d, 0x0a, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x58, 0x05, 0x4a, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4a, 0x40, 0x40, 0x40, 0x4a, 0x28, ++ 0x05, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0d, 0x0d, 0x00, ++ 0x4a, 0x15, 0x0d, 0x05, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x05, 0x05, 0x08, 0x08, 0x0a, 0x02, ++ 0x42, 0x07, 0x02, 0x4d, 0x42, 0x10, 0x00, 0x5a, 0x4d, 0x00, 0x1b, 0x18, 0x12, 0x28, 0x08, 0x08, ++ 0x0a, 0x02, 0x42, 0x07, 0x02, 0x4d, 0x42, 0x10, 0x00, 0x5a, 0x4d, 0x00, 0x1b, 0x18, 0x12, 0x28, ++ 0x2d, 0x55, 0x2d, 0x4a, 0x00, 0x00, 0x02, 0x08, 0x08, 0x15, 0x0a, 0x18, 0x0a, 0x20, 0x02, 0x4a, ++ 0x1d, 0x07, 0x02, 0x20, 0x02, 0x4a, 0x1d, 0x07, 0x02, 0x20, 0x02, 0x4a, 0x1d, 0x07, 0x02, 0x42, ++ 0x05, 0x05, 0x05, 0x0f, 0x1d, 0x0f, 0x1d, 0x07, 0x1d, 0x05, 0x00, 0x1d, 0x05, 0x00, 0x40, 0x40, ++ 0x42, 0x25, 0x15, 0x0d, 0x42, 0x0f, 0x0d, 0x05, 0x07, 0x3e, 0x27, 0x25, 0x05, 0x20, 0x1a, 0x0f, ++ 0x42, 0x1d, 0x12, 0x05, 0x42, 0x4b, 0x1a, 0x40, 0x0d, 0x07, 0x1d, 0x0a, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x59, 0x05, 0x4a, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4b, 0x40, 0x40, 0x40, 0x4b, 0x2a, ++ 0x05, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0d, 0x0d, 0x01, ++ 0x4a, 0x16, 0x0d, 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x05, 0x05, 0x09, 0x09, 0x0b, 0x03, ++ 0x42, 0x07, 0x03, 0x4c, 0x42, 0x11, 0x01, 0x5a, 0x4c, 0x01, 0x1c, 0x19, 0x13, 0x2a, 0x09, 0x09, ++ 0x0b, 0x03, 0x42, 0x07, 0x03, 0x4c, 0x42, 0x11, 0x01, 0x5a, 0x4c, 0x01, 0x1c, 0x19, 0x13, 0x2a, ++ 0x2e, 0x55, 0x2d, 0x4a, 0x01, 0x01, 0x03, 0x09, 0x09, 0x16, 0x0b, 0x19, 0x0b, 0x21, 0x03, 0x4a, ++ 0x1c, 0x07, 0x03, 0x21, 0x03, 0x4a, 0x1c, 0x07, 0x03, 0x21, 0x03, 0x4a, 0x1c, 0x07, 0x03, 0x42, ++ 0x05, 0x04, 0x04, 0x0f, 0x1d, 0x0f, 0x1d, 0x07, 0x1d, 0x05, 0x01, 0x1d, 0x05, 0x01, 0x40, 0x40, ++ 0x42, 0x26, 0x15, 0x0d, 0x42, 0x0f, 0x0d, 0x05, 0x07, 0x3e, 0x27, 0x26, 0x05, 0x21, 0x1b, 0x0f, ++ 0x42, 0x1c, 0x12, 0x04, 0x42, 0x4c, 0x1b, 0x41, 0x0d, 0x07, 0x1d, 0x0a, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5a, 0x06, 0x49, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4c, 0x40, 0x40, 0x40, 0x4c, 0x2c, ++ 0x06, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0e, 0x0e, 0x02, ++ 0x49, 0x18, 0x0e, 0x03, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x06, 0x06, 0x0a, 0x0a, 0x0c, 0x04, ++ 0x41, 0x07, 0x04, 0x4b, 0x41, 0x12, 0x02, 0x59, 0x4b, 0x02, 0x1e, 0x1a, 0x14, 0x2c, 0x0a, 0x0a, ++ 0x0c, 0x04, 0x41, 0x07, 0x04, 0x4b, 0x41, 0x12, 0x02, 0x59, 0x4b, 0x02, 0x1e, 0x1a, 0x14, 0x2c, ++ 0x30, 0x56, 0x2e, 0x49, 0x02, 0x02, 0x04, 0x0a, 0x0a, 0x18, 0x0c, 0x1a, 0x0c, 0x22, 0x04, 0x49, ++ 0x1b, 0x07, 0x04, 0x22, 0x04, 0x49, 0x1b, 0x07, 0x04, 0x22, 0x04, 0x49, 0x1b, 0x07, 0x04, 0x41, ++ 0x06, 0x03, 0x03, 0x0f, 0x1e, 0x0f, 0x1e, 0x07, 0x1e, 0x06, 0x02, 0x1e, 0x06, 0x02, 0x40, 0x40, ++ 0x41, 0x28, 0x16, 0x0e, 0x41, 0x0f, 0x0e, 0x06, 0x07, 0x3e, 0x27, 0x28, 0x06, 0x22, 0x1c, 0x0f, ++ 0x41, 0x1b, 0x11, 0x03, 0x41, 0x4e, 0x1c, 0x42, 0x0e, 0x07, 0x1e, 0x09, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5b, 0x06, 0x49, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4c, 0x40, 0x40, 0x40, 0x4c, 0x2e, ++ 0x06, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0e, 0x0e, 0x03, ++ 0x49, 0x19, 0x0e, 0x03, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x06, 0x06, 0x0b, 0x0b, 0x0c, 0x04, ++ 0x41, 0x07, 0x04, 0x4b, 0x41, 0x13, 0x03, 0x59, 0x4b, 0x03, 0x1f, 0x1b, 0x14, 0x2e, 0x0b, 0x0b, ++ 0x0c, 0x04, 0x41, 0x07, 0x04, 0x4b, 0x41, 0x13, 0x03, 0x59, 0x4b, 0x03, 0x1f, 0x1b, 0x14, 0x2e, ++ 0x31, 0x56, 0x2e, 0x49, 0x03, 0x03, 0x04, 0x0b, 0x0b, 0x19, 0x0c, 0x1b, 0x0c, 0x23, 0x04, 0x49, ++ 0x1b, 0x07, 0x04, 0x23, 0x04, 0x49, 0x1b, 0x07, 0x04, 0x23, 0x04, 0x49, 0x1b, 0x07, 0x04, 0x41, ++ 0x06, 0x03, 0x03, 0x0f, 0x1e, 0x0f, 0x1e, 0x07, 0x1e, 0x06, 0x03, 0x1e, 0x06, 0x03, 0x40, 0x40, ++ 0x41, 0x29, 0x16, 0x0e, 0x41, 0x0f, 0x0e, 0x06, 0x07, 0x3e, 0x27, 0x29, 0x06, 0x23, 0x1c, 0x0f, ++ 0x41, 0x1b, 0x11, 0x03, 0x41, 0x4f, 0x1c, 0x43, 0x0e, 0x07, 0x1e, 0x09, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5c, 0x06, 0x49, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4d, 0x40, 0x40, 0x40, 0x4d, 0x30, ++ 0x06, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0e, 0x0e, 0x04, ++ 0x49, 0x1a, 0x0e, 0x02, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x06, 0x06, 0x0c, 0x0c, 0x0d, 0x05, ++ 0x41, 0x07, 0x05, 0x4a, 0x41, 0x14, 0x04, 0x59, 0x4a, 0x04, 0x21, 0x1c, 0x15, 0x30, 0x0c, 0x0c, ++ 0x0d, 0x05, 0x41, 0x07, 0x05, 0x4a, 0x41, 0x14, 0x04, 0x59, 0x4a, 0x04, 0x21, 0x1c, 0x15, 0x30, ++ 0x32, 0x56, 0x2e, 0x49, 0x04, 0x04, 0x05, 0x0c, 0x0c, 0x1a, 0x0d, 0x1c, 0x0d, 0x24, 0x05, 0x49, ++ 0x1a, 0x07, 0x05, 0x24, 0x05, 0x49, 0x1a, 0x07, 0x05, 0x24, 0x05, 0x49, 0x1a, 0x07, 0x05, 0x41, ++ 0x06, 0x02, 0x02, 0x0f, 0x1e, 0x0f, 0x1e, 0x07, 0x1e, 0x06, 0x04, 0x1e, 0x06, 0x04, 0x40, 0x40, ++ 0x41, 0x2a, 0x16, 0x0e, 0x41, 0x0f, 0x0e, 0x06, 0x07, 0x3e, 0x27, 0x2a, 0x06, 0x24, 0x1d, 0x0f, ++ 0x41, 0x1a, 0x11, 0x02, 0x41, 0x51, 0x1d, 0x44, 0x0e, 0x07, 0x1e, 0x09, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5d, 0x06, 0x49, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4e, 0x40, 0x40, 0x40, 0x4e, 0x31, ++ 0x06, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0e, 0x0e, 0x04, ++ 0x49, 0x1b, 0x0e, 0x01, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x06, 0x06, 0x0c, 0x0c, 0x0d, 0x05, ++ 0x41, 0x07, 0x05, 0x4a, 0x41, 0x14, 0x04, 0x59, 0x4a, 0x04, 0x22, 0x1c, 0x15, 0x31, 0x0c, 0x0c, ++ 0x0d, 0x05, 0x41, 0x07, 0x05, 0x4a, 0x41, 0x14, 0x04, 0x59, 0x4a, 0x04, 0x22, 0x1c, 0x15, 0x31, ++ 0x33, 0x57, 0x2e, 0x49, 0x04, 0x04, 0x05, 0x0c, 0x0c, 0x1b, 0x0d, 0x1c, 0x0d, 0x24, 0x05, 0x49, ++ 0x19, 0x07, 0x05, 0x24, 0x05, 0x49, 0x19, 0x07, 0x05, 0x24, 0x05, 0x49, 0x19, 0x07, 0x05, 0x41, ++ 0x06, 0x01, 0x01, 0x0f, 0x1e, 0x0f, 0x1e, 0x07, 0x1e, 0x06, 0x04, 0x1e, 0x06, 0x04, 0x40, 0x40, ++ 0x41, 0x2b, 0x16, 0x0e, 0x41, 0x0f, 0x0e, 0x06, 0x07, 0x3e, 0x27, 0x2b, 0x06, 0x24, 0x1d, 0x0f, ++ 0x41, 0x19, 0x10, 0x01, 0x41, 0x53, 0x1d, 0x45, 0x0e, 0x07, 0x1e, 0x08, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5d, 0x07, 0x48, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4e, 0x40, 0x40, 0x40, 0x4e, 0x33, ++ 0x07, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0f, 0x0f, 0x05, ++ 0x48, 0x1d, 0x0f, 0x01, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x07, 0x0d, 0x0d, 0x0e, 0x06, ++ 0x40, 0x07, 0x06, 0x49, 0x40, 0x15, 0x05, 0x58, 0x49, 0x05, 0x24, 0x1d, 0x16, 0x33, 0x0d, 0x0d, ++ 0x0e, 0x06, 0x40, 0x07, 0x06, 0x49, 0x40, 0x15, 0x05, 0x58, 0x49, 0x05, 0x24, 0x1d, 0x16, 0x33, ++ 0x35, 0x57, 0x2f, 0x48, 0x05, 0x05, 0x06, 0x0d, 0x0d, 0x1d, 0x0e, 0x1d, 0x0e, 0x25, 0x06, 0x48, ++ 0x19, 0x07, 0x06, 0x25, 0x06, 0x48, 0x19, 0x07, 0x06, 0x25, 0x06, 0x48, 0x19, 0x07, 0x06, 0x40, ++ 0x07, 0x01, 0x01, 0x0f, 0x1f, 0x0f, 0x1f, 0x07, 0x1f, 0x07, 0x05, 0x1f, 0x07, 0x05, 0x40, 0x40, ++ 0x40, 0x2d, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x07, 0x07, 0x3e, 0x27, 0x2d, 0x07, 0x25, 0x1e, 0x0f, ++ 0x40, 0x19, 0x10, 0x01, 0x40, 0x54, 0x1e, 0x45, 0x0f, 0x07, 0x1f, 0x08, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5e, 0x07, 0x48, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4f, 0x40, 0x40, 0x40, 0x4f, 0x35, ++ 0x07, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0f, 0x0f, 0x06, ++ 0x48, 0x1e, 0x0f, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x07, 0x0e, 0x0e, 0x0f, 0x07, ++ 0x40, 0x07, 0x07, 0x48, 0x40, 0x16, 0x06, 0x58, 0x48, 0x06, 0x26, 0x1e, 0x17, 0x35, 0x0e, 0x0e, ++ 0x0f, 0x07, 0x40, 0x07, 0x07, 0x48, 0x40, 0x16, 0x06, 0x58, 0x48, 0x06, 0x26, 0x1e, 0x17, 0x35, ++ 0x36, 0x57, 0x2f, 0x48, 0x06, 0x06, 0x07, 0x0e, 0x0e, 0x1e, 0x0f, 0x1e, 0x0f, 0x26, 0x07, 0x48, ++ 0x18, 0x07, 0x07, 0x26, 0x07, 0x48, 0x18, 0x07, 0x07, 0x26, 0x07, 0x48, 0x18, 0x07, 0x07, 0x40, ++ 0x07, 0x00, 0x00, 0x0f, 0x1f, 0x0f, 0x1f, 0x07, 0x1f, 0x07, 0x06, 0x1f, 0x07, 0x06, 0x40, 0x40, ++ 0x40, 0x2e, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x07, 0x07, 0x3e, 0x27, 0x2e, 0x07, 0x26, 0x1f, 0x0f, ++ 0x40, 0x18, 0x10, 0x00, 0x40, 0x56, 0x1f, 0x46, 0x0f, 0x07, 0x1f, 0x08, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x5f, 0x07, 0x48, 0x58, 0x40, 0x40, 0x40, 0x40, 0x40, 0x4f, 0x40, 0x40, 0x40, 0x4f, 0x37, ++ 0x07, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x0f, 0x0f, 0x07, ++ 0x48, 0x1f, 0x0f, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x07, 0x0f, 0x0f, 0x0f, 0x07, ++ 0x40, 0x07, 0x07, 0x48, 0x40, 0x17, 0x07, 0x58, 0x48, 0x07, 0x27, 0x1f, 0x17, 0x37, 0x0f, 0x0f, ++ 0x0f, 0x07, 0x40, 0x07, 0x07, 0x48, 0x40, 0x17, 0x07, 0x58, 0x48, 0x07, 0x27, 0x1f, 0x17, 0x37, ++ 0x37, 0x57, 0x2f, 0x48, 0x07, 0x07, 0x07, 0x0f, 0x0f, 0x1f, 0x0f, 0x1f, 0x0f, 0x27, 0x07, 0x48, ++ 0x18, 0x07, 0x07, 0x27, 0x07, 0x48, 0x18, 0x07, 0x07, 0x27, 0x07, 0x48, 0x18, 0x07, 0x07, 0x40, ++ 0x07, 0x00, 0x00, 0x0f, 0x1f, 0x0f, 0x1f, 0x07, 0x1f, 0x07, 0x07, 0x1f, 0x07, 0x07, 0x40, 0x40, ++ 0x40, 0x2f, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x07, 0x07, 0x3e, 0x27, 0x2f, 0x07, 0x27, 0x1f, 0x0f, ++ 0x40, 0x18, 0x10, 0x00, 0x40, 0x57, 0x1f, 0x47, 0x0f, 0x07, 0x1f, 0x08, 0x0f, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x07, 0x48, 0x48, 0x60, 0x40, 0x27, 0x07, 0x07, 0x27, 0x40, 0x48, 0x40, 0x40, 0x40, 0x0f, ++ 0x48, 0x68, 0x60, 0x40, 0x68, 0x68, 0x68, 0x68, 0x68, 0x07, 0x07, 0x0f, 0x50, 0x40, 0x60, 0x07, ++ 0x68, 0x27, 0x48, 0x17, 0x40, 0x50, 0x1f, 0x40, 0x40, 0x40, 0x48, 0x48, 0x58, 0x60, 0x60, 0x60, ++ 0x68, 0x68, 0x58, 0x68, 0x60, 0x60, 0x60, 0x68, 0x68, 0x68, 0x60, 0x50, 0x48, 0x50, 0x58, 0x60, ++ 0x60, 0x60, 0x68, 0x68, 0x58, 0x68, 0x60, 0x60, 0x60, 0x68, 0x68, 0x68, 0x60, 0x50, 0x48, 0x50, ++ 0x07, 0x50, 0x58, 0x40, 0x48, 0x40, 0x48, 0x07, 0x48, 0x48, 0x48, 0x68, 0x07, 0x1f, 0x17, 0x50, ++ 0x0f, 0x07, 0x40, 0x1f, 0x17, 0x50, 0x0f, 0x07, 0x40, 0x1f, 0x17, 0x50, 0x0f, 0x07, 0x40, 0x40, ++ 0x07, 0x48, 0x48, 0x48, 0x07, 0x48, 0x07, 0x17, 0x17, 0x17, 0x50, 0x17, 0x17, 0x50, 0x40, 0x40, ++ 0x40, 0x2f, 0x2f, 0x17, 0x40, 0x0f, 0x17, 0x1f, 0x1f, 0x1f, 0x27, 0x0f, 0x07, 0x07, 0x0f, 0x07, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x17, 0x07, 0x1f, 0x48, 0x17, 0x48, 0x40, 0x48, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x07, 0x47, 0x47, 0x5f, 0x40, 0x27, 0x07, 0x07, 0x27, 0x40, 0x47, 0x40, 0x40, 0x40, 0x0f, ++ 0x47, 0x66, 0x5f, 0x00, 0x66, 0x66, 0x66, 0x65, 0x65, 0x07, 0x07, 0x0f, 0x4f, 0x00, 0x5e, 0x07, ++ 0x67, 0x27, 0x47, 0x17, 0x40, 0x4f, 0x1f, 0x40, 0x40, 0x40, 0x47, 0x47, 0x57, 0x5f, 0x5e, 0x5f, ++ 0x66, 0x66, 0x57, 0x67, 0x5f, 0x5e, 0x5f, 0x67, 0x67, 0x66, 0x5e, 0x4f, 0x47, 0x4f, 0x57, 0x5f, ++ 0x5e, 0x5f, 0x66, 0x66, 0x57, 0x67, 0x5f, 0x5e, 0x5f, 0x67, 0x67, 0x66, 0x5e, 0x4f, 0x47, 0x4f, ++ 0x08, 0x4f, 0x56, 0x40, 0x48, 0x40, 0x47, 0x07, 0x47, 0x47, 0x47, 0x66, 0x07, 0x1f, 0x17, 0x4f, ++ 0x10, 0x07, 0x40, 0x1f, 0x17, 0x4f, 0x10, 0x07, 0x40, 0x1f, 0x17, 0x4f, 0x10, 0x07, 0x40, 0x40, ++ 0x07, 0x47, 0x47, 0x47, 0x08, 0x47, 0x08, 0x17, 0x17, 0x17, 0x4f, 0x17, 0x17, 0x4f, 0x40, 0x40, ++ 0x40, 0x2f, 0x2f, 0x17, 0x40, 0x0f, 0x17, 0x1f, 0x1f, 0x20, 0x27, 0x10, 0x07, 0x08, 0x10, 0x08, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x17, 0x08, 0x1f, 0x47, 0x17, 0x46, 0x00, 0x47, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x06, 0x46, 0x47, 0x5e, 0x40, 0x26, 0x06, 0x06, 0x27, 0x40, 0x47, 0x40, 0x40, 0x40, 0x0f, ++ 0x47, 0x64, 0x5e, 0x01, 0x65, 0x64, 0x64, 0x63, 0x63, 0x07, 0x07, 0x0f, 0x4e, 0x00, 0x5d, 0x07, ++ 0x66, 0x27, 0x46, 0x17, 0x40, 0x4f, 0x1e, 0x40, 0x40, 0x40, 0x47, 0x47, 0x56, 0x5e, 0x5d, 0x5e, ++ 0x65, 0x64, 0x56, 0x66, 0x5e, 0x5c, 0x5e, 0x66, 0x66, 0x65, 0x5d, 0x4e, 0x46, 0x4e, 0x56, 0x5e, ++ 0x5d, 0x5e, 0x65, 0x64, 0x56, 0x66, 0x5e, 0x5c, 0x5e, 0x66, 0x66, 0x65, 0x5d, 0x4e, 0x46, 0x4e, ++ 0x09, 0x4f, 0x54, 0x40, 0x48, 0x40, 0x47, 0x07, 0x47, 0x46, 0x46, 0x64, 0x07, 0x1f, 0x16, 0x4f, ++ 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x40, ++ 0x07, 0x46, 0x46, 0x46, 0x09, 0x46, 0x09, 0x17, 0x17, 0x16, 0x4f, 0x17, 0x16, 0x4f, 0x40, 0x40, ++ 0x40, 0x2e, 0x2e, 0x17, 0x40, 0x0f, 0x17, 0x1e, 0x1e, 0x20, 0x27, 0x10, 0x07, 0x09, 0x10, 0x08, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x17, 0x08, 0x1e, 0x46, 0x17, 0x45, 0x01, 0x46, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x06, 0x45, 0x47, 0x5e, 0x40, 0x25, 0x06, 0x05, 0x27, 0x40, 0x47, 0x40, 0x40, 0x40, 0x0f, ++ 0x47, 0x63, 0x5d, 0x01, 0x64, 0x63, 0x62, 0x60, 0x60, 0x07, 0x07, 0x0f, 0x4e, 0x00, 0x5c, 0x07, ++ 0x65, 0x27, 0x45, 0x17, 0x40, 0x4f, 0x1d, 0x40, 0x40, 0x40, 0x47, 0x47, 0x56, 0x5d, 0x5c, 0x5d, ++ 0x64, 0x63, 0x56, 0x65, 0x5d, 0x5b, 0x5d, 0x65, 0x65, 0x64, 0x5c, 0x4d, 0x46, 0x4d, 0x56, 0x5d, ++ 0x5c, 0x5d, 0x64, 0x63, 0x56, 0x65, 0x5d, 0x5b, 0x5d, 0x65, 0x65, 0x64, 0x5c, 0x4d, 0x46, 0x4d, ++ 0x09, 0x4f, 0x52, 0x40, 0x48, 0x40, 0x47, 0x07, 0x47, 0x46, 0x46, 0x62, 0x07, 0x1f, 0x16, 0x4f, ++ 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x40, ++ 0x07, 0x46, 0x46, 0x45, 0x09, 0x45, 0x09, 0x17, 0x17, 0x16, 0x4f, 0x17, 0x16, 0x4f, 0x40, 0x40, ++ 0x40, 0x2d, 0x2d, 0x17, 0x40, 0x0f, 0x17, 0x1e, 0x1e, 0x20, 0x27, 0x10, 0x07, 0x09, 0x10, 0x08, ++ 0x07, 0x3d, 0x1f, 0x17, 0x40, 0x17, 0x08, 0x1e, 0x45, 0x17, 0x44, 0x01, 0x45, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x05, 0x44, 0x46, 0x5d, 0x40, 0x24, 0x05, 0x04, 0x27, 0x40, 0x46, 0x40, 0x40, 0x40, 0x0f, ++ 0x46, 0x61, 0x5c, 0x02, 0x63, 0x61, 0x60, 0x5e, 0x5e, 0x07, 0x07, 0x0e, 0x4d, 0x01, 0x5b, 0x07, ++ 0x64, 0x27, 0x44, 0x16, 0x40, 0x4e, 0x1c, 0x40, 0x40, 0x40, 0x46, 0x46, 0x55, 0x5c, 0x5b, 0x5c, ++ 0x63, 0x61, 0x55, 0x64, 0x5c, 0x59, 0x5c, 0x64, 0x64, 0x63, 0x5b, 0x4c, 0x45, 0x4c, 0x55, 0x5c, ++ 0x5b, 0x5c, 0x63, 0x61, 0x55, 0x64, 0x5c, 0x59, 0x5c, 0x64, 0x64, 0x63, 0x5b, 0x4c, 0x45, 0x4c, ++ 0x0a, 0x4e, 0x50, 0x40, 0x48, 0x40, 0x46, 0x07, 0x46, 0x45, 0x45, 0x60, 0x07, 0x1e, 0x15, 0x4e, ++ 0x11, 0x07, 0x40, 0x1e, 0x15, 0x4e, 0x11, 0x07, 0x40, 0x1e, 0x15, 0x4e, 0x11, 0x07, 0x40, 0x41, ++ 0x07, 0x45, 0x45, 0x44, 0x0a, 0x44, 0x0a, 0x16, 0x17, 0x15, 0x4e, 0x17, 0x15, 0x4e, 0x40, 0x40, ++ 0x40, 0x2c, 0x2c, 0x16, 0x40, 0x0f, 0x16, 0x1d, 0x1d, 0x21, 0x27, 0x11, 0x07, 0x0a, 0x11, 0x09, ++ 0x06, 0x3c, 0x1e, 0x16, 0x40, 0x16, 0x09, 0x1d, 0x44, 0x16, 0x43, 0x02, 0x44, 0x16, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x04, 0x43, 0x46, 0x5c, 0x40, 0x23, 0x04, 0x03, 0x27, 0x40, 0x46, 0x40, 0x40, 0x40, 0x0f, ++ 0x46, 0x60, 0x5b, 0x03, 0x61, 0x60, 0x5e, 0x5b, 0x5b, 0x07, 0x07, 0x0e, 0x4c, 0x01, 0x59, 0x07, ++ 0x63, 0x27, 0x43, 0x16, 0x40, 0x4e, 0x1b, 0x40, 0x40, 0x40, 0x46, 0x46, 0x54, 0x5b, 0x59, 0x5b, ++ 0x61, 0x60, 0x54, 0x63, 0x5b, 0x58, 0x5b, 0x63, 0x63, 0x61, 0x59, 0x4b, 0x44, 0x4b, 0x54, 0x5b, ++ 0x59, 0x5b, 0x61, 0x60, 0x54, 0x63, 0x5b, 0x58, 0x5b, 0x63, 0x63, 0x61, 0x59, 0x4b, 0x44, 0x4b, ++ 0x0b, 0x4e, 0x4e, 0x40, 0x48, 0x40, 0x46, 0x07, 0x46, 0x44, 0x44, 0x5e, 0x07, 0x1e, 0x14, 0x4e, ++ 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x41, ++ 0x07, 0x44, 0x44, 0x43, 0x0b, 0x43, 0x0b, 0x16, 0x17, 0x14, 0x4e, 0x17, 0x14, 0x4e, 0x40, 0x40, ++ 0x40, 0x2b, 0x2b, 0x16, 0x40, 0x0f, 0x16, 0x1c, 0x1c, 0x21, 0x27, 0x11, 0x07, 0x0b, 0x11, 0x09, ++ 0x06, 0x3b, 0x1e, 0x16, 0x40, 0x16, 0x09, 0x1c, 0x43, 0x16, 0x41, 0x03, 0x43, 0x16, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x04, 0x42, 0x46, 0x5c, 0x40, 0x22, 0x04, 0x02, 0x27, 0x40, 0x46, 0x40, 0x40, 0x40, 0x0f, ++ 0x46, 0x5e, 0x5a, 0x03, 0x60, 0x5e, 0x5c, 0x59, 0x59, 0x07, 0x07, 0x0e, 0x4c, 0x01, 0x58, 0x07, ++ 0x62, 0x27, 0x42, 0x16, 0x40, 0x4e, 0x1a, 0x40, 0x40, 0x40, 0x46, 0x46, 0x54, 0x5a, 0x58, 0x5a, ++ 0x60, 0x5e, 0x54, 0x62, 0x5a, 0x56, 0x5a, 0x62, 0x62, 0x60, 0x58, 0x4a, 0x44, 0x4a, 0x54, 0x5a, ++ 0x58, 0x5a, 0x60, 0x5e, 0x54, 0x62, 0x5a, 0x56, 0x5a, 0x62, 0x62, 0x60, 0x58, 0x4a, 0x44, 0x4a, ++ 0x0b, 0x4e, 0x4c, 0x40, 0x48, 0x40, 0x46, 0x07, 0x46, 0x44, 0x44, 0x5c, 0x07, 0x1e, 0x14, 0x4e, ++ 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x41, ++ 0x07, 0x44, 0x44, 0x42, 0x0b, 0x42, 0x0b, 0x16, 0x17, 0x14, 0x4e, 0x17, 0x14, 0x4e, 0x40, 0x40, ++ 0x40, 0x2a, 0x2a, 0x16, 0x40, 0x0f, 0x16, 0x1c, 0x1c, 0x21, 0x27, 0x11, 0x07, 0x0b, 0x11, 0x09, ++ 0x06, 0x3a, 0x1e, 0x16, 0x40, 0x16, 0x09, 0x1c, 0x42, 0x16, 0x40, 0x03, 0x42, 0x16, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x03, 0x41, 0x45, 0x5b, 0x40, 0x21, 0x03, 0x01, 0x27, 0x40, 0x45, 0x40, 0x40, 0x40, 0x0f, ++ 0x45, 0x5d, 0x59, 0x04, 0x5f, 0x5d, 0x5a, 0x56, 0x56, 0x07, 0x07, 0x0d, 0x4b, 0x02, 0x57, 0x07, ++ 0x61, 0x27, 0x41, 0x15, 0x40, 0x4d, 0x19, 0x40, 0x40, 0x40, 0x45, 0x45, 0x53, 0x59, 0x57, 0x59, ++ 0x5f, 0x5d, 0x53, 0x61, 0x59, 0x55, 0x59, 0x61, 0x61, 0x5f, 0x57, 0x49, 0x43, 0x49, 0x53, 0x59, ++ 0x57, 0x59, 0x5f, 0x5d, 0x53, 0x61, 0x59, 0x55, 0x59, 0x61, 0x61, 0x5f, 0x57, 0x49, 0x43, 0x49, ++ 0x0c, 0x4d, 0x4a, 0x40, 0x48, 0x40, 0x45, 0x07, 0x45, 0x43, 0x43, 0x5a, 0x07, 0x1d, 0x13, 0x4d, ++ 0x12, 0x07, 0x40, 0x1d, 0x13, 0x4d, 0x12, 0x07, 0x40, 0x1d, 0x13, 0x4d, 0x12, 0x07, 0x40, 0x42, ++ 0x07, 0x43, 0x43, 0x41, 0x0c, 0x41, 0x0c, 0x15, 0x17, 0x13, 0x4d, 0x17, 0x13, 0x4d, 0x40, 0x40, ++ 0x40, 0x29, 0x29, 0x15, 0x40, 0x0f, 0x15, 0x1b, 0x1b, 0x22, 0x27, 0x12, 0x07, 0x0c, 0x12, 0x0a, ++ 0x05, 0x39, 0x1d, 0x15, 0x40, 0x15, 0x0a, 0x1b, 0x41, 0x15, 0x00, 0x04, 0x41, 0x15, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x02, 0x40, 0x45, 0x5b, 0x40, 0x20, 0x02, 0x00, 0x27, 0x40, 0x45, 0x40, 0x40, 0x40, 0x0f, ++ 0x45, 0x5b, 0x58, 0x04, 0x5e, 0x5b, 0x59, 0x54, 0x54, 0x07, 0x07, 0x0d, 0x4b, 0x02, 0x56, 0x07, ++ 0x60, 0x27, 0x40, 0x15, 0x40, 0x4d, 0x18, 0x40, 0x40, 0x40, 0x45, 0x45, 0x53, 0x58, 0x56, 0x58, ++ 0x5e, 0x5b, 0x53, 0x60, 0x58, 0x53, 0x58, 0x60, 0x60, 0x5e, 0x56, 0x48, 0x43, 0x48, 0x53, 0x58, ++ 0x56, 0x58, 0x5e, 0x5b, 0x53, 0x60, 0x58, 0x53, 0x58, 0x60, 0x60, 0x5e, 0x56, 0x48, 0x43, 0x48, ++ 0x0c, 0x4d, 0x49, 0x40, 0x48, 0x40, 0x45, 0x07, 0x45, 0x43, 0x43, 0x59, 0x07, 0x1d, 0x12, 0x4d, ++ 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x42, ++ 0x07, 0x43, 0x43, 0x40, 0x0c, 0x40, 0x0c, 0x15, 0x17, 0x12, 0x4d, 0x17, 0x12, 0x4d, 0x40, 0x40, ++ 0x40, 0x28, 0x28, 0x15, 0x40, 0x0f, 0x15, 0x1a, 0x1a, 0x22, 0x27, 0x12, 0x07, 0x0c, 0x12, 0x0a, ++ 0x05, 0x38, 0x1d, 0x15, 0x40, 0x15, 0x0a, 0x1a, 0x40, 0x15, 0x01, 0x04, 0x40, 0x15, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x02, 0x00, 0x45, 0x5a, 0x40, 0x1f, 0x02, 0x40, 0x27, 0x40, 0x45, 0x40, 0x40, 0x40, 0x0f, ++ 0x45, 0x59, 0x57, 0x05, 0x5c, 0x59, 0x57, 0x51, 0x51, 0x07, 0x07, 0x0d, 0x4a, 0x02, 0x54, 0x07, ++ 0x5f, 0x27, 0x00, 0x15, 0x40, 0x4d, 0x17, 0x40, 0x40, 0x40, 0x45, 0x45, 0x52, 0x57, 0x54, 0x57, ++ 0x5c, 0x59, 0x52, 0x5f, 0x57, 0x51, 0x57, 0x5f, 0x5f, 0x5c, 0x54, 0x47, 0x42, 0x47, 0x52, 0x57, ++ 0x54, 0x57, 0x5c, 0x59, 0x52, 0x5f, 0x57, 0x51, 0x57, 0x5f, 0x5f, 0x5c, 0x54, 0x47, 0x42, 0x47, ++ 0x0d, 0x4d, 0x47, 0x40, 0x48, 0x40, 0x45, 0x07, 0x45, 0x42, 0x42, 0x57, 0x07, 0x1d, 0x12, 0x4d, ++ 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x42, ++ 0x07, 0x42, 0x42, 0x00, 0x0d, 0x00, 0x0d, 0x15, 0x17, 0x12, 0x4d, 0x17, 0x12, 0x4d, 0x40, 0x40, ++ 0x40, 0x27, 0x27, 0x15, 0x40, 0x0f, 0x15, 0x1a, 0x1a, 0x22, 0x27, 0x12, 0x07, 0x0d, 0x12, 0x0a, ++ 0x05, 0x37, 0x1d, 0x15, 0x40, 0x15, 0x0a, 0x1a, 0x00, 0x15, 0x03, 0x05, 0x00, 0x15, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x01, 0x01, 0x44, 0x59, 0x40, 0x1e, 0x01, 0x41, 0x27, 0x40, 0x44, 0x40, 0x40, 0x40, 0x0f, ++ 0x44, 0x58, 0x56, 0x06, 0x5b, 0x58, 0x55, 0x4f, 0x4f, 0x07, 0x07, 0x0c, 0x49, 0x03, 0x53, 0x07, ++ 0x5e, 0x27, 0x01, 0x14, 0x40, 0x4c, 0x16, 0x40, 0x40, 0x40, 0x44, 0x44, 0x51, 0x56, 0x53, 0x56, ++ 0x5b, 0x58, 0x51, 0x5e, 0x56, 0x50, 0x56, 0x5e, 0x5e, 0x5b, 0x53, 0x46, 0x41, 0x46, 0x51, 0x56, ++ 0x53, 0x56, 0x5b, 0x58, 0x51, 0x5e, 0x56, 0x50, 0x56, 0x5e, 0x5e, 0x5b, 0x53, 0x46, 0x41, 0x46, ++ 0x0e, 0x4c, 0x45, 0x40, 0x48, 0x40, 0x44, 0x07, 0x44, 0x41, 0x41, 0x55, 0x07, 0x1c, 0x11, 0x4c, ++ 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x43, ++ 0x07, 0x41, 0x41, 0x01, 0x0e, 0x01, 0x0e, 0x14, 0x17, 0x11, 0x4c, 0x17, 0x11, 0x4c, 0x40, 0x40, ++ 0x40, 0x26, 0x26, 0x14, 0x40, 0x0f, 0x14, 0x19, 0x19, 0x23, 0x27, 0x13, 0x07, 0x0e, 0x13, 0x0b, ++ 0x04, 0x36, 0x1c, 0x14, 0x40, 0x14, 0x0b, 0x19, 0x01, 0x14, 0x04, 0x06, 0x01, 0x14, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x01, 0x02, 0x44, 0x59, 0x40, 0x1d, 0x01, 0x42, 0x27, 0x40, 0x44, 0x40, 0x40, 0x40, 0x0f, ++ 0x44, 0x56, 0x55, 0x06, 0x5a, 0x56, 0x53, 0x4c, 0x4c, 0x07, 0x07, 0x0c, 0x49, 0x03, 0x52, 0x07, ++ 0x5d, 0x27, 0x02, 0x14, 0x40, 0x4c, 0x15, 0x40, 0x40, 0x40, 0x44, 0x44, 0x51, 0x55, 0x52, 0x55, ++ 0x5a, 0x56, 0x51, 0x5d, 0x55, 0x4e, 0x55, 0x5d, 0x5d, 0x5a, 0x52, 0x45, 0x41, 0x45, 0x51, 0x55, ++ 0x52, 0x55, 0x5a, 0x56, 0x51, 0x5d, 0x55, 0x4e, 0x55, 0x5d, 0x5d, 0x5a, 0x52, 0x45, 0x41, 0x45, ++ 0x0e, 0x4c, 0x43, 0x40, 0x48, 0x40, 0x44, 0x07, 0x44, 0x41, 0x41, 0x53, 0x07, 0x1c, 0x11, 0x4c, ++ 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x43, ++ 0x07, 0x41, 0x41, 0x02, 0x0e, 0x02, 0x0e, 0x14, 0x17, 0x11, 0x4c, 0x17, 0x11, 0x4c, 0x40, 0x40, ++ 0x40, 0x25, 0x25, 0x14, 0x40, 0x0f, 0x14, 0x19, 0x19, 0x23, 0x27, 0x13, 0x07, 0x0e, 0x13, 0x0b, ++ 0x04, 0x35, 0x1c, 0x14, 0x40, 0x14, 0x0b, 0x19, 0x02, 0x14, 0x05, 0x06, 0x02, 0x14, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x00, 0x03, 0x44, 0x58, 0x40, 0x1c, 0x00, 0x43, 0x27, 0x40, 0x44, 0x40, 0x40, 0x40, 0x0f, ++ 0x44, 0x55, 0x54, 0x07, 0x59, 0x55, 0x51, 0x4a, 0x4a, 0x07, 0x07, 0x0c, 0x48, 0x03, 0x51, 0x07, ++ 0x5c, 0x27, 0x03, 0x14, 0x40, 0x4c, 0x14, 0x40, 0x40, 0x40, 0x44, 0x44, 0x50, 0x54, 0x51, 0x54, ++ 0x59, 0x55, 0x50, 0x5c, 0x54, 0x4d, 0x54, 0x5c, 0x5c, 0x59, 0x51, 0x44, 0x40, 0x44, 0x50, 0x54, ++ 0x51, 0x54, 0x59, 0x55, 0x50, 0x5c, 0x54, 0x4d, 0x54, 0x5c, 0x5c, 0x59, 0x51, 0x44, 0x40, 0x44, ++ 0x0f, 0x4c, 0x41, 0x40, 0x48, 0x40, 0x44, 0x07, 0x44, 0x40, 0x40, 0x51, 0x07, 0x1c, 0x10, 0x4c, ++ 0x13, 0x07, 0x40, 0x1c, 0x10, 0x4c, 0x13, 0x07, 0x40, 0x1c, 0x10, 0x4c, 0x13, 0x07, 0x40, 0x43, ++ 0x07, 0x40, 0x40, 0x03, 0x0f, 0x03, 0x0f, 0x14, 0x17, 0x10, 0x4c, 0x17, 0x10, 0x4c, 0x40, 0x40, ++ 0x40, 0x24, 0x24, 0x14, 0x40, 0x0f, 0x14, 0x18, 0x18, 0x23, 0x27, 0x13, 0x07, 0x0f, 0x13, 0x0b, ++ 0x04, 0x34, 0x1c, 0x14, 0x40, 0x14, 0x0b, 0x18, 0x03, 0x14, 0x06, 0x07, 0x03, 0x14, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x40, 0x04, 0x43, 0x57, 0x40, 0x1b, 0x40, 0x44, 0x27, 0x40, 0x43, 0x40, 0x40, 0x40, 0x0f, ++ 0x43, 0x53, 0x53, 0x08, 0x57, 0x53, 0x4f, 0x47, 0x47, 0x07, 0x07, 0x0b, 0x47, 0x04, 0x4f, 0x07, ++ 0x5b, 0x27, 0x04, 0x13, 0x40, 0x4b, 0x13, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4f, 0x53, 0x4f, 0x53, ++ 0x57, 0x53, 0x4f, 0x5b, 0x53, 0x4b, 0x53, 0x5b, 0x5b, 0x57, 0x4f, 0x43, 0x00, 0x43, 0x4f, 0x53, ++ 0x4f, 0x53, 0x57, 0x53, 0x4f, 0x5b, 0x53, 0x4b, 0x53, 0x5b, 0x5b, 0x57, 0x4f, 0x43, 0x00, 0x43, ++ 0x10, 0x4b, 0x00, 0x40, 0x48, 0x40, 0x43, 0x07, 0x43, 0x00, 0x00, 0x4f, 0x07, 0x1b, 0x0f, 0x4b, ++ 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x44, ++ 0x07, 0x00, 0x00, 0x04, 0x10, 0x04, 0x10, 0x13, 0x17, 0x0f, 0x4b, 0x17, 0x0f, 0x4b, 0x40, 0x40, ++ 0x40, 0x23, 0x23, 0x13, 0x40, 0x0f, 0x13, 0x17, 0x17, 0x24, 0x27, 0x14, 0x07, 0x10, 0x14, 0x0c, ++ 0x03, 0x33, 0x1b, 0x13, 0x40, 0x13, 0x0c, 0x17, 0x04, 0x13, 0x08, 0x08, 0x04, 0x13, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x40, 0x05, 0x43, 0x57, 0x40, 0x1a, 0x40, 0x45, 0x27, 0x40, 0x43, 0x40, 0x40, 0x40, 0x0f, ++ 0x43, 0x52, 0x52, 0x08, 0x56, 0x52, 0x4d, 0x45, 0x45, 0x07, 0x07, 0x0b, 0x47, 0x04, 0x4e, 0x07, ++ 0x5a, 0x27, 0x05, 0x13, 0x40, 0x4b, 0x12, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4f, 0x52, 0x4e, 0x52, ++ 0x56, 0x52, 0x4f, 0x5a, 0x52, 0x4a, 0x52, 0x5a, 0x5a, 0x56, 0x4e, 0x42, 0x00, 0x42, 0x4f, 0x52, ++ 0x4e, 0x52, 0x56, 0x52, 0x4f, 0x5a, 0x52, 0x4a, 0x52, 0x5a, 0x5a, 0x56, 0x4e, 0x42, 0x00, 0x42, ++ 0x10, 0x4b, 0x02, 0x40, 0x48, 0x40, 0x43, 0x07, 0x43, 0x00, 0x00, 0x4d, 0x07, 0x1b, 0x0f, 0x4b, ++ 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x44, ++ 0x07, 0x00, 0x00, 0x05, 0x10, 0x05, 0x10, 0x13, 0x17, 0x0f, 0x4b, 0x17, 0x0f, 0x4b, 0x40, 0x40, ++ 0x40, 0x22, 0x22, 0x13, 0x40, 0x0f, 0x13, 0x17, 0x17, 0x24, 0x27, 0x14, 0x07, 0x10, 0x14, 0x0c, ++ 0x03, 0x32, 0x1b, 0x13, 0x40, 0x13, 0x0c, 0x17, 0x05, 0x13, 0x09, 0x08, 0x05, 0x13, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x41, 0x06, 0x43, 0x56, 0x40, 0x19, 0x41, 0x46, 0x27, 0x40, 0x43, 0x40, 0x40, 0x40, 0x0f, ++ 0x43, 0x50, 0x51, 0x09, 0x55, 0x50, 0x4b, 0x42, 0x42, 0x07, 0x07, 0x0b, 0x46, 0x04, 0x4d, 0x07, ++ 0x59, 0x27, 0x06, 0x13, 0x40, 0x4b, 0x11, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4e, 0x51, 0x4d, 0x51, ++ 0x55, 0x50, 0x4e, 0x59, 0x51, 0x48, 0x51, 0x59, 0x59, 0x55, 0x4d, 0x41, 0x01, 0x41, 0x4e, 0x51, ++ 0x4d, 0x51, 0x55, 0x50, 0x4e, 0x59, 0x51, 0x48, 0x51, 0x59, 0x59, 0x55, 0x4d, 0x41, 0x01, 0x41, ++ 0x11, 0x4b, 0x04, 0x40, 0x48, 0x40, 0x43, 0x07, 0x43, 0x01, 0x01, 0x4b, 0x07, 0x1b, 0x0e, 0x4b, ++ 0x14, 0x07, 0x40, 0x1b, 0x0e, 0x4b, 0x14, 0x07, 0x40, 0x1b, 0x0e, 0x4b, 0x14, 0x07, 0x40, 0x44, ++ 0x07, 0x01, 0x01, 0x06, 0x11, 0x06, 0x11, 0x13, 0x17, 0x0e, 0x4b, 0x17, 0x0e, 0x4b, 0x40, 0x40, ++ 0x40, 0x21, 0x21, 0x13, 0x40, 0x0f, 0x13, 0x16, 0x16, 0x24, 0x27, 0x14, 0x07, 0x11, 0x14, 0x0c, ++ 0x03, 0x31, 0x1b, 0x13, 0x40, 0x13, 0x0c, 0x16, 0x06, 0x13, 0x0a, 0x09, 0x06, 0x13, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x42, 0x06, 0x43, 0x56, 0x40, 0x18, 0x42, 0x47, 0x27, 0x40, 0x43, 0x40, 0x40, 0x40, 0x0f, ++ 0x43, 0x4f, 0x51, 0x09, 0x54, 0x4f, 0x4a, 0x40, 0x40, 0x07, 0x07, 0x0a, 0x46, 0x04, 0x4c, 0x07, ++ 0x59, 0x27, 0x06, 0x12, 0x40, 0x4b, 0x10, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4e, 0x51, 0x4c, 0x51, ++ 0x54, 0x4f, 0x4e, 0x59, 0x51, 0x47, 0x51, 0x59, 0x59, 0x54, 0x4c, 0x41, 0x01, 0x41, 0x4e, 0x51, ++ 0x4c, 0x51, 0x54, 0x4f, 0x4e, 0x59, 0x51, 0x47, 0x51, 0x59, 0x59, 0x54, 0x4c, 0x41, 0x01, 0x41, ++ 0x11, 0x4b, 0x05, 0x40, 0x48, 0x40, 0x43, 0x07, 0x43, 0x01, 0x01, 0x4a, 0x07, 0x1a, 0x0d, 0x4b, ++ 0x14, 0x07, 0x40, 0x1a, 0x0d, 0x4b, 0x14, 0x07, 0x40, 0x1a, 0x0d, 0x4b, 0x14, 0x07, 0x40, 0x45, ++ 0x07, 0x01, 0x01, 0x06, 0x11, 0x06, 0x11, 0x12, 0x17, 0x0d, 0x4b, 0x17, 0x0d, 0x4b, 0x40, 0x40, ++ 0x40, 0x20, 0x20, 0x12, 0x40, 0x0f, 0x12, 0x15, 0x15, 0x24, 0x27, 0x14, 0x07, 0x11, 0x14, 0x0c, ++ 0x02, 0x30, 0x1a, 0x12, 0x40, 0x12, 0x0c, 0x15, 0x06, 0x12, 0x0b, 0x09, 0x06, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x42, 0x07, 0x42, 0x55, 0x40, 0x18, 0x42, 0x47, 0x27, 0x40, 0x42, 0x40, 0x40, 0x40, 0x0f, ++ 0x42, 0x4d, 0x50, 0x0a, 0x52, 0x4d, 0x48, 0x02, 0x02, 0x07, 0x07, 0x0a, 0x45, 0x05, 0x4a, 0x07, ++ 0x58, 0x27, 0x07, 0x12, 0x40, 0x4a, 0x10, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4d, 0x50, 0x4a, 0x50, ++ 0x52, 0x4d, 0x4d, 0x58, 0x50, 0x45, 0x50, 0x58, 0x58, 0x52, 0x4a, 0x40, 0x02, 0x40, 0x4d, 0x50, ++ 0x4a, 0x50, 0x52, 0x4d, 0x4d, 0x58, 0x50, 0x45, 0x50, 0x58, 0x58, 0x52, 0x4a, 0x40, 0x02, 0x40, ++ 0x12, 0x4a, 0x07, 0x40, 0x48, 0x40, 0x42, 0x07, 0x42, 0x02, 0x02, 0x48, 0x07, 0x1a, 0x0d, 0x4a, ++ 0x15, 0x07, 0x40, 0x1a, 0x0d, 0x4a, 0x15, 0x07, 0x40, 0x1a, 0x0d, 0x4a, 0x15, 0x07, 0x40, 0x45, ++ 0x07, 0x02, 0x02, 0x07, 0x12, 0x07, 0x12, 0x12, 0x17, 0x0d, 0x4a, 0x17, 0x0d, 0x4a, 0x40, 0x40, ++ 0x40, 0x20, 0x20, 0x12, 0x40, 0x0f, 0x12, 0x15, 0x15, 0x25, 0x27, 0x15, 0x07, 0x12, 0x15, 0x0d, ++ 0x02, 0x30, 0x1a, 0x12, 0x40, 0x12, 0x0d, 0x15, 0x07, 0x12, 0x0d, 0x0a, 0x07, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x43, 0x08, 0x42, 0x54, 0x40, 0x17, 0x43, 0x48, 0x27, 0x40, 0x42, 0x40, 0x40, 0x40, 0x0f, ++ 0x42, 0x4b, 0x4f, 0x0b, 0x51, 0x4b, 0x46, 0x04, 0x04, 0x07, 0x07, 0x0a, 0x44, 0x05, 0x49, 0x07, ++ 0x57, 0x27, 0x08, 0x12, 0x40, 0x4a, 0x0f, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4c, 0x4f, 0x49, 0x4f, ++ 0x51, 0x4b, 0x4c, 0x57, 0x4f, 0x43, 0x4f, 0x57, 0x57, 0x51, 0x49, 0x00, 0x03, 0x00, 0x4c, 0x4f, ++ 0x49, 0x4f, 0x51, 0x4b, 0x4c, 0x57, 0x4f, 0x43, 0x4f, 0x57, 0x57, 0x51, 0x49, 0x00, 0x03, 0x00, ++ 0x13, 0x4a, 0x09, 0x40, 0x48, 0x40, 0x42, 0x07, 0x42, 0x03, 0x03, 0x46, 0x07, 0x1a, 0x0c, 0x4a, ++ 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x45, ++ 0x07, 0x03, 0x03, 0x08, 0x13, 0x08, 0x13, 0x12, 0x17, 0x0c, 0x4a, 0x17, 0x0c, 0x4a, 0x40, 0x40, ++ 0x40, 0x1f, 0x1f, 0x12, 0x40, 0x0f, 0x12, 0x14, 0x14, 0x25, 0x27, 0x15, 0x07, 0x13, 0x15, 0x0d, ++ 0x02, 0x2f, 0x1a, 0x12, 0x40, 0x12, 0x0d, 0x14, 0x08, 0x12, 0x0e, 0x0b, 0x08, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x43, 0x09, 0x42, 0x54, 0x40, 0x16, 0x43, 0x49, 0x27, 0x40, 0x42, 0x40, 0x40, 0x40, 0x0f, ++ 0x42, 0x4a, 0x4e, 0x0b, 0x50, 0x4a, 0x44, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x44, 0x05, 0x48, 0x07, ++ 0x56, 0x27, 0x09, 0x12, 0x40, 0x4a, 0x0e, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4c, 0x4e, 0x48, 0x4e, ++ 0x50, 0x4a, 0x4c, 0x56, 0x4e, 0x42, 0x4e, 0x56, 0x56, 0x50, 0x48, 0x01, 0x03, 0x01, 0x4c, 0x4e, ++ 0x48, 0x4e, 0x50, 0x4a, 0x4c, 0x56, 0x4e, 0x42, 0x4e, 0x56, 0x56, 0x50, 0x48, 0x01, 0x03, 0x01, ++ 0x13, 0x4a, 0x0b, 0x40, 0x48, 0x40, 0x42, 0x07, 0x42, 0x03, 0x03, 0x44, 0x07, 0x1a, 0x0c, 0x4a, ++ 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x45, ++ 0x07, 0x03, 0x03, 0x09, 0x13, 0x09, 0x13, 0x12, 0x17, 0x0c, 0x4a, 0x17, 0x0c, 0x4a, 0x40, 0x40, ++ 0x40, 0x1e, 0x1e, 0x12, 0x40, 0x0f, 0x12, 0x14, 0x14, 0x25, 0x27, 0x15, 0x07, 0x13, 0x15, 0x0d, ++ 0x02, 0x2e, 0x1a, 0x12, 0x40, 0x12, 0x0d, 0x14, 0x09, 0x12, 0x0f, 0x0b, 0x09, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x44, 0x0a, 0x41, 0x53, 0x40, 0x15, 0x44, 0x4a, 0x27, 0x40, 0x41, 0x40, 0x40, 0x40, 0x0f, ++ 0x41, 0x48, 0x4d, 0x0c, 0x4f, 0x48, 0x42, 0x09, 0x09, 0x07, 0x07, 0x09, 0x43, 0x06, 0x47, 0x07, ++ 0x55, 0x27, 0x0a, 0x11, 0x40, 0x49, 0x0d, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4b, 0x4d, 0x47, 0x4d, ++ 0x4f, 0x48, 0x4b, 0x55, 0x4d, 0x40, 0x4d, 0x55, 0x55, 0x4f, 0x47, 0x02, 0x04, 0x02, 0x4b, 0x4d, ++ 0x47, 0x4d, 0x4f, 0x48, 0x4b, 0x55, 0x4d, 0x40, 0x4d, 0x55, 0x55, 0x4f, 0x47, 0x02, 0x04, 0x02, ++ 0x14, 0x49, 0x0d, 0x40, 0x48, 0x40, 0x41, 0x07, 0x41, 0x04, 0x04, 0x42, 0x07, 0x19, 0x0b, 0x49, ++ 0x16, 0x07, 0x40, 0x19, 0x0b, 0x49, 0x16, 0x07, 0x40, 0x19, 0x0b, 0x49, 0x16, 0x07, 0x40, 0x46, ++ 0x07, 0x04, 0x04, 0x0a, 0x14, 0x0a, 0x14, 0x11, 0x17, 0x0b, 0x49, 0x17, 0x0b, 0x49, 0x40, 0x40, ++ 0x40, 0x1d, 0x1d, 0x11, 0x40, 0x0f, 0x11, 0x13, 0x13, 0x26, 0x27, 0x16, 0x07, 0x14, 0x16, 0x0e, ++ 0x01, 0x2d, 0x19, 0x11, 0x40, 0x11, 0x0e, 0x13, 0x0a, 0x11, 0x10, 0x0c, 0x0a, 0x11, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x45, 0x0b, 0x41, 0x52, 0x40, 0x14, 0x45, 0x4b, 0x27, 0x40, 0x41, 0x40, 0x40, 0x40, 0x0f, ++ 0x41, 0x47, 0x4c, 0x0d, 0x4d, 0x47, 0x40, 0x0c, 0x0c, 0x07, 0x07, 0x09, 0x42, 0x06, 0x45, 0x07, ++ 0x54, 0x27, 0x0b, 0x11, 0x40, 0x49, 0x0c, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4a, 0x4c, 0x45, 0x4c, ++ 0x4d, 0x47, 0x4a, 0x54, 0x4c, 0x00, 0x4c, 0x54, 0x54, 0x4d, 0x45, 0x03, 0x05, 0x03, 0x4a, 0x4c, ++ 0x45, 0x4c, 0x4d, 0x47, 0x4a, 0x54, 0x4c, 0x00, 0x4c, 0x54, 0x54, 0x4d, 0x45, 0x03, 0x05, 0x03, ++ 0x15, 0x49, 0x0f, 0x40, 0x48, 0x40, 0x41, 0x07, 0x41, 0x05, 0x05, 0x40, 0x07, 0x19, 0x0a, 0x49, ++ 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x46, ++ 0x07, 0x05, 0x05, 0x0b, 0x15, 0x0b, 0x15, 0x11, 0x17, 0x0a, 0x49, 0x17, 0x0a, 0x49, 0x40, 0x40, ++ 0x40, 0x1c, 0x1c, 0x11, 0x40, 0x0f, 0x11, 0x12, 0x12, 0x26, 0x27, 0x16, 0x07, 0x15, 0x16, 0x0e, ++ 0x01, 0x2c, 0x19, 0x11, 0x40, 0x11, 0x0e, 0x12, 0x0b, 0x11, 0x12, 0x0d, 0x0b, 0x11, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x45, 0x0c, 0x41, 0x52, 0x40, 0x13, 0x45, 0x4c, 0x27, 0x40, 0x41, 0x40, 0x40, 0x40, 0x0f, ++ 0x41, 0x45, 0x4b, 0x0d, 0x4c, 0x45, 0x01, 0x0e, 0x0e, 0x07, 0x07, 0x09, 0x42, 0x06, 0x44, 0x07, ++ 0x53, 0x27, 0x0c, 0x11, 0x40, 0x49, 0x0b, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4a, 0x4b, 0x44, 0x4b, ++ 0x4c, 0x45, 0x4a, 0x53, 0x4b, 0x02, 0x4b, 0x53, 0x53, 0x4c, 0x44, 0x04, 0x05, 0x04, 0x4a, 0x4b, ++ 0x44, 0x4b, 0x4c, 0x45, 0x4a, 0x53, 0x4b, 0x02, 0x4b, 0x53, 0x53, 0x4c, 0x44, 0x04, 0x05, 0x04, ++ 0x15, 0x49, 0x11, 0x40, 0x48, 0x40, 0x41, 0x07, 0x41, 0x05, 0x05, 0x01, 0x07, 0x19, 0x0a, 0x49, ++ 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x46, ++ 0x07, 0x05, 0x05, 0x0c, 0x15, 0x0c, 0x15, 0x11, 0x17, 0x0a, 0x49, 0x17, 0x0a, 0x49, 0x40, 0x40, ++ 0x40, 0x1b, 0x1b, 0x11, 0x40, 0x0f, 0x11, 0x12, 0x12, 0x26, 0x27, 0x16, 0x07, 0x15, 0x16, 0x0e, ++ 0x01, 0x2b, 0x19, 0x11, 0x40, 0x11, 0x0e, 0x12, 0x0c, 0x11, 0x13, 0x0d, 0x0c, 0x11, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x46, 0x0d, 0x40, 0x51, 0x40, 0x12, 0x46, 0x4d, 0x27, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0f, ++ 0x40, 0x44, 0x4a, 0x0e, 0x4b, 0x44, 0x03, 0x11, 0x11, 0x07, 0x07, 0x08, 0x41, 0x07, 0x43, 0x07, ++ 0x52, 0x27, 0x0d, 0x10, 0x40, 0x48, 0x0a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x4a, 0x43, 0x4a, ++ 0x4b, 0x44, 0x49, 0x52, 0x4a, 0x03, 0x4a, 0x52, 0x52, 0x4b, 0x43, 0x05, 0x06, 0x05, 0x49, 0x4a, ++ 0x43, 0x4a, 0x4b, 0x44, 0x49, 0x52, 0x4a, 0x03, 0x4a, 0x52, 0x52, 0x4b, 0x43, 0x05, 0x06, 0x05, ++ 0x16, 0x48, 0x13, 0x40, 0x48, 0x40, 0x40, 0x07, 0x40, 0x06, 0x06, 0x03, 0x07, 0x18, 0x09, 0x48, ++ 0x17, 0x07, 0x40, 0x18, 0x09, 0x48, 0x17, 0x07, 0x40, 0x18, 0x09, 0x48, 0x17, 0x07, 0x40, 0x47, ++ 0x07, 0x06, 0x06, 0x0d, 0x16, 0x0d, 0x16, 0x10, 0x17, 0x09, 0x48, 0x17, 0x09, 0x48, 0x40, 0x40, ++ 0x40, 0x1a, 0x1a, 0x10, 0x40, 0x0f, 0x10, 0x11, 0x11, 0x27, 0x27, 0x17, 0x07, 0x16, 0x17, 0x0f, ++ 0x00, 0x2a, 0x18, 0x10, 0x40, 0x10, 0x0f, 0x11, 0x0d, 0x10, 0x14, 0x0e, 0x0d, 0x10, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x47, 0x0e, 0x40, 0x51, 0x40, 0x11, 0x47, 0x4e, 0x27, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0f, ++ 0x40, 0x42, 0x49, 0x0e, 0x4a, 0x42, 0x04, 0x13, 0x13, 0x07, 0x07, 0x08, 0x41, 0x07, 0x42, 0x07, ++ 0x51, 0x27, 0x0e, 0x10, 0x40, 0x48, 0x09, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x49, 0x42, 0x49, ++ 0x4a, 0x42, 0x49, 0x51, 0x49, 0x05, 0x49, 0x51, 0x51, 0x4a, 0x42, 0x06, 0x06, 0x06, 0x49, 0x49, ++ 0x42, 0x49, 0x4a, 0x42, 0x49, 0x51, 0x49, 0x05, 0x49, 0x51, 0x51, 0x4a, 0x42, 0x06, 0x06, 0x06, ++ 0x16, 0x48, 0x14, 0x40, 0x48, 0x40, 0x40, 0x07, 0x40, 0x06, 0x06, 0x04, 0x07, 0x18, 0x08, 0x48, ++ 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x47, ++ 0x07, 0x06, 0x06, 0x0e, 0x16, 0x0e, 0x16, 0x10, 0x17, 0x08, 0x48, 0x17, 0x08, 0x48, 0x40, 0x40, ++ 0x40, 0x19, 0x19, 0x10, 0x40, 0x0f, 0x10, 0x10, 0x10, 0x27, 0x27, 0x17, 0x07, 0x16, 0x17, 0x0f, ++ 0x00, 0x29, 0x18, 0x10, 0x40, 0x10, 0x0f, 0x10, 0x0e, 0x10, 0x15, 0x0e, 0x0e, 0x10, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x47, 0x0f, 0x40, 0x50, 0x40, 0x10, 0x47, 0x4f, 0x27, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0f, ++ 0x40, 0x40, 0x48, 0x0f, 0x48, 0x40, 0x06, 0x16, 0x16, 0x07, 0x07, 0x08, 0x40, 0x07, 0x40, 0x07, ++ 0x50, 0x27, 0x0f, 0x10, 0x40, 0x48, 0x08, 0x40, 0x40, 0x40, 0x40, 0x40, 0x48, 0x48, 0x40, 0x48, ++ 0x48, 0x40, 0x48, 0x50, 0x48, 0x07, 0x48, 0x50, 0x50, 0x48, 0x40, 0x07, 0x07, 0x07, 0x48, 0x48, ++ 0x40, 0x48, 0x48, 0x40, 0x48, 0x50, 0x48, 0x07, 0x48, 0x50, 0x50, 0x48, 0x40, 0x07, 0x07, 0x07, ++ 0x17, 0x48, 0x16, 0x40, 0x48, 0x40, 0x40, 0x07, 0x40, 0x07, 0x07, 0x06, 0x07, 0x18, 0x08, 0x48, ++ 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x47, ++ 0x07, 0x07, 0x07, 0x0f, 0x17, 0x0f, 0x17, 0x10, 0x17, 0x08, 0x48, 0x17, 0x08, 0x48, 0x40, 0x40, ++ 0x40, 0x18, 0x18, 0x10, 0x40, 0x0f, 0x10, 0x10, 0x10, 0x27, 0x27, 0x17, 0x07, 0x17, 0x17, 0x0f, ++ 0x00, 0x28, 0x18, 0x10, 0x40, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x17, 0x0f, 0x0f, 0x10, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x48, 0x10, 0x00, 0x4f, 0x40, 0x0f, 0x48, 0x50, 0x27, 0x40, 0x00, 0x40, 0x40, 0x40, 0x0f, ++ 0x00, 0x00, 0x47, 0x10, 0x47, 0x00, 0x08, 0x18, 0x18, 0x07, 0x07, 0x07, 0x00, 0x08, 0x00, 0x07, ++ 0x4f, 0x27, 0x10, 0x0f, 0x40, 0x47, 0x07, 0x40, 0x40, 0x40, 0x00, 0x00, 0x47, 0x47, 0x00, 0x47, ++ 0x47, 0x00, 0x47, 0x4f, 0x47, 0x08, 0x47, 0x4f, 0x4f, 0x47, 0x00, 0x08, 0x08, 0x08, 0x47, 0x47, ++ 0x00, 0x47, 0x47, 0x00, 0x47, 0x4f, 0x47, 0x08, 0x47, 0x4f, 0x4f, 0x47, 0x00, 0x08, 0x08, 0x08, ++ 0x18, 0x47, 0x18, 0x40, 0x48, 0x40, 0x00, 0x07, 0x00, 0x08, 0x08, 0x08, 0x07, 0x17, 0x07, 0x47, ++ 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x48, ++ 0x07, 0x08, 0x08, 0x10, 0x18, 0x10, 0x18, 0x0f, 0x17, 0x07, 0x47, 0x17, 0x07, 0x47, 0x40, 0x40, ++ 0x40, 0x17, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, 0x0f, 0x28, 0x27, 0x18, 0x07, 0x18, 0x18, 0x10, ++ 0x40, 0x27, 0x17, 0x0f, 0x40, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x18, 0x10, 0x10, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x48, 0x11, 0x00, 0x4f, 0x40, 0x0e, 0x48, 0x51, 0x27, 0x40, 0x00, 0x40, 0x40, 0x40, 0x0f, ++ 0x00, 0x02, 0x46, 0x10, 0x46, 0x02, 0x0a, 0x1b, 0x1b, 0x07, 0x07, 0x07, 0x00, 0x08, 0x01, 0x07, ++ 0x4e, 0x27, 0x11, 0x0f, 0x40, 0x47, 0x06, 0x40, 0x40, 0x40, 0x00, 0x00, 0x47, 0x46, 0x01, 0x46, ++ 0x46, 0x02, 0x47, 0x4e, 0x46, 0x0a, 0x46, 0x4e, 0x4e, 0x46, 0x01, 0x09, 0x08, 0x09, 0x47, 0x46, ++ 0x01, 0x46, 0x46, 0x02, 0x47, 0x4e, 0x46, 0x0a, 0x46, 0x4e, 0x4e, 0x46, 0x01, 0x09, 0x08, 0x09, ++ 0x18, 0x47, 0x1a, 0x40, 0x48, 0x40, 0x00, 0x07, 0x00, 0x08, 0x08, 0x0a, 0x07, 0x17, 0x07, 0x47, ++ 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x48, ++ 0x07, 0x08, 0x08, 0x11, 0x18, 0x11, 0x18, 0x0f, 0x17, 0x07, 0x47, 0x17, 0x07, 0x47, 0x40, 0x40, ++ 0x40, 0x16, 0x16, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, 0x0f, 0x28, 0x27, 0x18, 0x07, 0x18, 0x18, 0x10, ++ 0x40, 0x26, 0x17, 0x0f, 0x40, 0x0f, 0x10, 0x0f, 0x11, 0x0f, 0x19, 0x10, 0x11, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x49, 0x12, 0x00, 0x4e, 0x40, 0x0d, 0x49, 0x52, 0x27, 0x40, 0x00, 0x40, 0x40, 0x40, 0x0f, ++ 0x00, 0x03, 0x45, 0x11, 0x45, 0x03, 0x0c, 0x1d, 0x1d, 0x07, 0x07, 0x07, 0x01, 0x08, 0x02, 0x07, ++ 0x4d, 0x27, 0x12, 0x0f, 0x40, 0x47, 0x05, 0x40, 0x40, 0x40, 0x00, 0x00, 0x46, 0x45, 0x02, 0x45, ++ 0x45, 0x03, 0x46, 0x4d, 0x45, 0x0b, 0x45, 0x4d, 0x4d, 0x45, 0x02, 0x0a, 0x09, 0x0a, 0x46, 0x45, ++ 0x02, 0x45, 0x45, 0x03, 0x46, 0x4d, 0x45, 0x0b, 0x45, 0x4d, 0x4d, 0x45, 0x02, 0x0a, 0x09, 0x0a, ++ 0x19, 0x47, 0x1c, 0x40, 0x48, 0x40, 0x00, 0x07, 0x00, 0x09, 0x09, 0x0c, 0x07, 0x17, 0x06, 0x47, ++ 0x18, 0x07, 0x40, 0x17, 0x06, 0x47, 0x18, 0x07, 0x40, 0x17, 0x06, 0x47, 0x18, 0x07, 0x40, 0x48, ++ 0x07, 0x09, 0x09, 0x12, 0x19, 0x12, 0x19, 0x0f, 0x17, 0x06, 0x47, 0x17, 0x06, 0x47, 0x40, 0x40, ++ 0x40, 0x15, 0x15, 0x0f, 0x40, 0x0f, 0x0f, 0x0e, 0x0e, 0x28, 0x27, 0x18, 0x07, 0x19, 0x18, 0x10, ++ 0x40, 0x25, 0x17, 0x0f, 0x40, 0x0f, 0x10, 0x0e, 0x12, 0x0f, 0x1a, 0x11, 0x12, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4a, 0x13, 0x01, 0x4d, 0x40, 0x0c, 0x4a, 0x53, 0x27, 0x40, 0x01, 0x40, 0x40, 0x40, 0x0f, ++ 0x01, 0x05, 0x44, 0x12, 0x43, 0x05, 0x0e, 0x20, 0x20, 0x07, 0x07, 0x06, 0x02, 0x09, 0x04, 0x07, ++ 0x4c, 0x27, 0x13, 0x0e, 0x40, 0x46, 0x04, 0x40, 0x40, 0x40, 0x01, 0x01, 0x45, 0x44, 0x04, 0x44, ++ 0x43, 0x05, 0x45, 0x4c, 0x44, 0x0d, 0x44, 0x4c, 0x4c, 0x43, 0x04, 0x0b, 0x0a, 0x0b, 0x45, 0x44, ++ 0x04, 0x44, 0x43, 0x05, 0x45, 0x4c, 0x44, 0x0d, 0x44, 0x4c, 0x4c, 0x43, 0x04, 0x0b, 0x0a, 0x0b, ++ 0x1a, 0x46, 0x1e, 0x40, 0x48, 0x40, 0x01, 0x07, 0x01, 0x0a, 0x0a, 0x0e, 0x07, 0x16, 0x05, 0x46, ++ 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x49, ++ 0x07, 0x0a, 0x0a, 0x13, 0x1a, 0x13, 0x1a, 0x0e, 0x17, 0x05, 0x46, 0x17, 0x05, 0x46, 0x40, 0x40, ++ 0x40, 0x14, 0x14, 0x0e, 0x40, 0x0f, 0x0e, 0x0d, 0x0d, 0x29, 0x27, 0x19, 0x07, 0x1a, 0x19, 0x11, ++ 0x41, 0x24, 0x16, 0x0e, 0x40, 0x0e, 0x11, 0x0d, 0x13, 0x0e, 0x1c, 0x12, 0x13, 0x0e, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4a, 0x14, 0x01, 0x4d, 0x40, 0x0b, 0x4a, 0x54, 0x27, 0x40, 0x01, 0x40, 0x40, 0x40, 0x0f, ++ 0x01, 0x06, 0x43, 0x12, 0x42, 0x06, 0x10, 0x22, 0x22, 0x07, 0x07, 0x06, 0x02, 0x09, 0x05, 0x07, ++ 0x4b, 0x27, 0x14, 0x0e, 0x40, 0x46, 0x03, 0x40, 0x40, 0x40, 0x01, 0x01, 0x45, 0x43, 0x05, 0x43, ++ 0x42, 0x06, 0x45, 0x4b, 0x43, 0x0e, 0x43, 0x4b, 0x4b, 0x42, 0x05, 0x0c, 0x0a, 0x0c, 0x45, 0x43, ++ 0x05, 0x43, 0x42, 0x06, 0x45, 0x4b, 0x43, 0x0e, 0x43, 0x4b, 0x4b, 0x42, 0x05, 0x0c, 0x0a, 0x0c, ++ 0x1a, 0x46, 0x20, 0x40, 0x48, 0x40, 0x01, 0x07, 0x01, 0x0a, 0x0a, 0x10, 0x07, 0x16, 0x05, 0x46, ++ 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x49, ++ 0x07, 0x0a, 0x0a, 0x14, 0x1a, 0x14, 0x1a, 0x0e, 0x17, 0x05, 0x46, 0x17, 0x05, 0x46, 0x40, 0x40, ++ 0x40, 0x13, 0x13, 0x0e, 0x40, 0x0f, 0x0e, 0x0d, 0x0d, 0x29, 0x27, 0x19, 0x07, 0x1a, 0x19, 0x11, ++ 0x41, 0x23, 0x16, 0x0e, 0x40, 0x0e, 0x11, 0x0d, 0x14, 0x0e, 0x1d, 0x12, 0x14, 0x0e, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4b, 0x15, 0x01, 0x4c, 0x40, 0x0a, 0x4b, 0x55, 0x27, 0x40, 0x01, 0x40, 0x40, 0x40, 0x0f, ++ 0x01, 0x08, 0x42, 0x13, 0x41, 0x08, 0x12, 0x25, 0x25, 0x07, 0x07, 0x06, 0x03, 0x09, 0x06, 0x07, ++ 0x4a, 0x27, 0x15, 0x0e, 0x40, 0x46, 0x02, 0x40, 0x40, 0x40, 0x01, 0x01, 0x44, 0x42, 0x06, 0x42, ++ 0x41, 0x08, 0x44, 0x4a, 0x42, 0x10, 0x42, 0x4a, 0x4a, 0x41, 0x06, 0x0d, 0x0b, 0x0d, 0x44, 0x42, ++ 0x06, 0x42, 0x41, 0x08, 0x44, 0x4a, 0x42, 0x10, 0x42, 0x4a, 0x4a, 0x41, 0x06, 0x0d, 0x0b, 0x0d, ++ 0x1b, 0x46, 0x22, 0x40, 0x48, 0x40, 0x01, 0x07, 0x01, 0x0b, 0x0b, 0x12, 0x07, 0x16, 0x04, 0x46, ++ 0x19, 0x07, 0x40, 0x16, 0x04, 0x46, 0x19, 0x07, 0x40, 0x16, 0x04, 0x46, 0x19, 0x07, 0x40, 0x49, ++ 0x07, 0x0b, 0x0b, 0x15, 0x1b, 0x15, 0x1b, 0x0e, 0x17, 0x04, 0x46, 0x17, 0x04, 0x46, 0x40, 0x40, ++ 0x40, 0x12, 0x12, 0x0e, 0x40, 0x0f, 0x0e, 0x0c, 0x0c, 0x29, 0x27, 0x19, 0x07, 0x1b, 0x19, 0x11, ++ 0x41, 0x22, 0x16, 0x0e, 0x40, 0x0e, 0x11, 0x0c, 0x15, 0x0e, 0x1e, 0x13, 0x15, 0x0e, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4c, 0x15, 0x01, 0x4c, 0x40, 0x09, 0x4c, 0x56, 0x27, 0x40, 0x01, 0x40, 0x40, 0x40, 0x0f, ++ 0x01, 0x09, 0x42, 0x13, 0x40, 0x09, 0x13, 0x27, 0x27, 0x07, 0x07, 0x05, 0x03, 0x09, 0x07, 0x07, ++ 0x4a, 0x27, 0x15, 0x0d, 0x40, 0x46, 0x01, 0x40, 0x40, 0x40, 0x01, 0x01, 0x44, 0x42, 0x07, 0x42, ++ 0x40, 0x09, 0x44, 0x4a, 0x42, 0x11, 0x42, 0x4a, 0x4a, 0x40, 0x07, 0x0d, 0x0b, 0x0d, 0x44, 0x42, ++ 0x07, 0x42, 0x40, 0x09, 0x44, 0x4a, 0x42, 0x11, 0x42, 0x4a, 0x4a, 0x40, 0x07, 0x0d, 0x0b, 0x0d, ++ 0x1b, 0x46, 0x23, 0x40, 0x48, 0x40, 0x01, 0x07, 0x01, 0x0b, 0x0b, 0x13, 0x07, 0x15, 0x03, 0x46, ++ 0x19, 0x07, 0x40, 0x15, 0x03, 0x46, 0x19, 0x07, 0x40, 0x15, 0x03, 0x46, 0x19, 0x07, 0x40, 0x4a, ++ 0x07, 0x0b, 0x0b, 0x15, 0x1b, 0x15, 0x1b, 0x0d, 0x17, 0x03, 0x46, 0x17, 0x03, 0x46, 0x40, 0x40, ++ 0x40, 0x11, 0x11, 0x0d, 0x40, 0x0f, 0x0d, 0x0b, 0x0b, 0x29, 0x27, 0x19, 0x07, 0x1b, 0x19, 0x11, ++ 0x42, 0x21, 0x15, 0x0d, 0x40, 0x0d, 0x11, 0x0b, 0x15, 0x0d, 0x1f, 0x13, 0x15, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4c, 0x16, 0x02, 0x4b, 0x40, 0x09, 0x4c, 0x56, 0x27, 0x40, 0x02, 0x40, 0x40, 0x40, 0x0f, ++ 0x02, 0x0b, 0x41, 0x14, 0x01, 0x0b, 0x15, 0x2a, 0x2a, 0x07, 0x07, 0x05, 0x04, 0x0a, 0x09, 0x07, ++ 0x49, 0x27, 0x16, 0x0d, 0x40, 0x45, 0x01, 0x40, 0x40, 0x40, 0x02, 0x02, 0x43, 0x41, 0x09, 0x41, ++ 0x01, 0x0b, 0x43, 0x49, 0x41, 0x13, 0x41, 0x49, 0x49, 0x01, 0x09, 0x0e, 0x0c, 0x0e, 0x43, 0x41, ++ 0x09, 0x41, 0x01, 0x0b, 0x43, 0x49, 0x41, 0x13, 0x41, 0x49, 0x49, 0x01, 0x09, 0x0e, 0x0c, 0x0e, ++ 0x1c, 0x45, 0x25, 0x40, 0x48, 0x40, 0x02, 0x07, 0x02, 0x0c, 0x0c, 0x15, 0x07, 0x15, 0x03, 0x45, ++ 0x1a, 0x07, 0x40, 0x15, 0x03, 0x45, 0x1a, 0x07, 0x40, 0x15, 0x03, 0x45, 0x1a, 0x07, 0x40, 0x4a, ++ 0x07, 0x0c, 0x0c, 0x16, 0x1c, 0x16, 0x1c, 0x0d, 0x17, 0x03, 0x45, 0x17, 0x03, 0x45, 0x40, 0x40, ++ 0x40, 0x11, 0x11, 0x0d, 0x40, 0x0f, 0x0d, 0x0b, 0x0b, 0x2a, 0x27, 0x1a, 0x07, 0x1c, 0x1a, 0x12, ++ 0x42, 0x21, 0x15, 0x0d, 0x40, 0x0d, 0x12, 0x0b, 0x16, 0x0d, 0x21, 0x14, 0x16, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4d, 0x17, 0x02, 0x4a, 0x40, 0x08, 0x4d, 0x57, 0x27, 0x40, 0x02, 0x40, 0x40, 0x40, 0x0f, ++ 0x02, 0x0d, 0x40, 0x15, 0x02, 0x0d, 0x17, 0x2c, 0x2c, 0x07, 0x07, 0x05, 0x05, 0x0a, 0x0a, 0x07, ++ 0x48, 0x27, 0x17, 0x0d, 0x40, 0x45, 0x00, 0x40, 0x40, 0x40, 0x02, 0x02, 0x42, 0x40, 0x0a, 0x40, ++ 0x02, 0x0d, 0x42, 0x48, 0x40, 0x15, 0x40, 0x48, 0x48, 0x02, 0x0a, 0x0f, 0x0d, 0x0f, 0x42, 0x40, ++ 0x0a, 0x40, 0x02, 0x0d, 0x42, 0x48, 0x40, 0x15, 0x40, 0x48, 0x48, 0x02, 0x0a, 0x0f, 0x0d, 0x0f, ++ 0x1d, 0x45, 0x27, 0x40, 0x48, 0x40, 0x02, 0x07, 0x02, 0x0d, 0x0d, 0x17, 0x07, 0x15, 0x02, 0x45, ++ 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x4a, ++ 0x07, 0x0d, 0x0d, 0x17, 0x1d, 0x17, 0x1d, 0x0d, 0x17, 0x02, 0x45, 0x17, 0x02, 0x45, 0x40, 0x40, ++ 0x40, 0x10, 0x10, 0x0d, 0x40, 0x0f, 0x0d, 0x0a, 0x0a, 0x2a, 0x27, 0x1a, 0x07, 0x1d, 0x1a, 0x12, ++ 0x42, 0x20, 0x15, 0x0d, 0x40, 0x0d, 0x12, 0x0a, 0x17, 0x0d, 0x22, 0x15, 0x17, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4d, 0x18, 0x02, 0x4a, 0x40, 0x07, 0x4d, 0x58, 0x27, 0x40, 0x02, 0x40, 0x40, 0x40, 0x0f, ++ 0x02, 0x0e, 0x00, 0x15, 0x03, 0x0e, 0x19, 0x2f, 0x2f, 0x07, 0x07, 0x05, 0x05, 0x0a, 0x0b, 0x07, ++ 0x47, 0x27, 0x18, 0x0d, 0x40, 0x45, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x42, 0x00, 0x0b, 0x00, ++ 0x03, 0x0e, 0x42, 0x47, 0x00, 0x16, 0x00, 0x47, 0x47, 0x03, 0x0b, 0x10, 0x0d, 0x10, 0x42, 0x00, ++ 0x0b, 0x00, 0x03, 0x0e, 0x42, 0x47, 0x00, 0x16, 0x00, 0x47, 0x47, 0x03, 0x0b, 0x10, 0x0d, 0x10, ++ 0x1d, 0x45, 0x29, 0x40, 0x48, 0x40, 0x02, 0x07, 0x02, 0x0d, 0x0d, 0x19, 0x07, 0x15, 0x02, 0x45, ++ 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x4a, ++ 0x07, 0x0d, 0x0d, 0x18, 0x1d, 0x18, 0x1d, 0x0d, 0x17, 0x02, 0x45, 0x17, 0x02, 0x45, 0x40, 0x40, ++ 0x40, 0x0f, 0x0f, 0x0d, 0x40, 0x0f, 0x0d, 0x0a, 0x0a, 0x2a, 0x27, 0x1a, 0x07, 0x1d, 0x1a, 0x12, ++ 0x42, 0x1f, 0x15, 0x0d, 0x40, 0x0d, 0x12, 0x0a, 0x18, 0x0d, 0x23, 0x15, 0x18, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4e, 0x19, 0x03, 0x49, 0x40, 0x06, 0x4e, 0x59, 0x27, 0x40, 0x03, 0x40, 0x40, 0x40, 0x0f, ++ 0x03, 0x10, 0x01, 0x16, 0x04, 0x10, 0x1b, 0x31, 0x31, 0x07, 0x07, 0x04, 0x06, 0x0b, 0x0c, 0x07, ++ 0x46, 0x27, 0x19, 0x0c, 0x40, 0x44, 0x41, 0x40, 0x40, 0x40, 0x03, 0x03, 0x41, 0x01, 0x0c, 0x01, ++ 0x04, 0x10, 0x41, 0x46, 0x01, 0x18, 0x01, 0x46, 0x46, 0x04, 0x0c, 0x11, 0x0e, 0x11, 0x41, 0x01, ++ 0x0c, 0x01, 0x04, 0x10, 0x41, 0x46, 0x01, 0x18, 0x01, 0x46, 0x46, 0x04, 0x0c, 0x11, 0x0e, 0x11, ++ 0x1e, 0x44, 0x2b, 0x40, 0x48, 0x40, 0x03, 0x07, 0x03, 0x0e, 0x0e, 0x1b, 0x07, 0x14, 0x01, 0x44, ++ 0x1b, 0x07, 0x40, 0x14, 0x01, 0x44, 0x1b, 0x07, 0x40, 0x14, 0x01, 0x44, 0x1b, 0x07, 0x40, 0x4b, ++ 0x07, 0x0e, 0x0e, 0x19, 0x1e, 0x19, 0x1e, 0x0c, 0x17, 0x01, 0x44, 0x17, 0x01, 0x44, 0x40, 0x40, ++ 0x40, 0x0e, 0x0e, 0x0c, 0x40, 0x0f, 0x0c, 0x09, 0x09, 0x2b, 0x27, 0x1b, 0x07, 0x1e, 0x1b, 0x13, ++ 0x43, 0x1e, 0x14, 0x0c, 0x40, 0x0c, 0x13, 0x09, 0x19, 0x0c, 0x24, 0x16, 0x19, 0x0c, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4f, 0x1a, 0x03, 0x48, 0x40, 0x05, 0x4f, 0x5a, 0x27, 0x40, 0x03, 0x40, 0x40, 0x40, 0x0f, ++ 0x03, 0x11, 0x02, 0x17, 0x06, 0x11, 0x1d, 0x34, 0x34, 0x07, 0x07, 0x04, 0x07, 0x0b, 0x0e, 0x07, ++ 0x45, 0x27, 0x1a, 0x0c, 0x40, 0x44, 0x42, 0x40, 0x40, 0x40, 0x03, 0x03, 0x40, 0x02, 0x0e, 0x02, ++ 0x06, 0x11, 0x40, 0x45, 0x02, 0x19, 0x02, 0x45, 0x45, 0x06, 0x0e, 0x12, 0x0f, 0x12, 0x40, 0x02, ++ 0x0e, 0x02, 0x06, 0x11, 0x40, 0x45, 0x02, 0x19, 0x02, 0x45, 0x45, 0x06, 0x0e, 0x12, 0x0f, 0x12, ++ 0x1f, 0x44, 0x2d, 0x40, 0x48, 0x40, 0x03, 0x07, 0x03, 0x0f, 0x0f, 0x1d, 0x07, 0x14, 0x00, 0x44, ++ 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x4b, ++ 0x07, 0x0f, 0x0f, 0x1a, 0x1f, 0x1a, 0x1f, 0x0c, 0x17, 0x00, 0x44, 0x17, 0x00, 0x44, 0x40, 0x40, ++ 0x40, 0x0d, 0x0d, 0x0c, 0x40, 0x0f, 0x0c, 0x08, 0x08, 0x2b, 0x27, 0x1b, 0x07, 0x1f, 0x1b, 0x13, ++ 0x43, 0x1d, 0x14, 0x0c, 0x40, 0x0c, 0x13, 0x08, 0x1a, 0x0c, 0x26, 0x17, 0x1a, 0x0c, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x4f, 0x1b, 0x03, 0x48, 0x40, 0x04, 0x4f, 0x5b, 0x27, 0x40, 0x03, 0x40, 0x40, 0x40, 0x0f, ++ 0x03, 0x13, 0x03, 0x17, 0x07, 0x13, 0x1f, 0x36, 0x36, 0x07, 0x07, 0x04, 0x07, 0x0b, 0x0f, 0x07, ++ 0x44, 0x27, 0x1b, 0x0c, 0x40, 0x44, 0x43, 0x40, 0x40, 0x40, 0x03, 0x03, 0x40, 0x03, 0x0f, 0x03, ++ 0x07, 0x13, 0x40, 0x44, 0x03, 0x1b, 0x03, 0x44, 0x44, 0x07, 0x0f, 0x13, 0x0f, 0x13, 0x40, 0x03, ++ 0x0f, 0x03, 0x07, 0x13, 0x40, 0x44, 0x03, 0x1b, 0x03, 0x44, 0x44, 0x07, 0x0f, 0x13, 0x0f, 0x13, ++ 0x1f, 0x44, 0x2f, 0x40, 0x48, 0x40, 0x03, 0x07, 0x03, 0x0f, 0x0f, 0x1f, 0x07, 0x14, 0x00, 0x44, ++ 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x4b, ++ 0x07, 0x0f, 0x0f, 0x1b, 0x1f, 0x1b, 0x1f, 0x0c, 0x17, 0x00, 0x44, 0x17, 0x00, 0x44, 0x40, 0x40, ++ 0x40, 0x0c, 0x0c, 0x0c, 0x40, 0x0f, 0x0c, 0x08, 0x08, 0x2b, 0x27, 0x1b, 0x07, 0x1f, 0x1b, 0x13, ++ 0x43, 0x1c, 0x14, 0x0c, 0x40, 0x0c, 0x13, 0x08, 0x1b, 0x0c, 0x27, 0x17, 0x1b, 0x0c, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x50, 0x1c, 0x04, 0x47, 0x40, 0x03, 0x50, 0x5c, 0x27, 0x40, 0x04, 0x40, 0x40, 0x40, 0x0f, ++ 0x04, 0x14, 0x04, 0x18, 0x08, 0x14, 0x21, 0x39, 0x39, 0x07, 0x07, 0x03, 0x08, 0x0c, 0x10, 0x07, ++ 0x43, 0x27, 0x1c, 0x0b, 0x40, 0x43, 0x44, 0x40, 0x40, 0x40, 0x04, 0x04, 0x00, 0x04, 0x10, 0x04, ++ 0x08, 0x14, 0x00, 0x43, 0x04, 0x1c, 0x04, 0x43, 0x43, 0x08, 0x10, 0x14, 0x10, 0x14, 0x00, 0x04, ++ 0x10, 0x04, 0x08, 0x14, 0x00, 0x43, 0x04, 0x1c, 0x04, 0x43, 0x43, 0x08, 0x10, 0x14, 0x10, 0x14, ++ 0x20, 0x43, 0x31, 0x40, 0x48, 0x40, 0x04, 0x07, 0x04, 0x10, 0x10, 0x21, 0x07, 0x13, 0x40, 0x43, ++ 0x1c, 0x07, 0x40, 0x13, 0x40, 0x43, 0x1c, 0x07, 0x40, 0x13, 0x40, 0x43, 0x1c, 0x07, 0x40, 0x4c, ++ 0x07, 0x10, 0x10, 0x1c, 0x20, 0x1c, 0x20, 0x0b, 0x17, 0x40, 0x43, 0x17, 0x40, 0x43, 0x40, 0x40, ++ 0x40, 0x0b, 0x0b, 0x0b, 0x40, 0x0f, 0x0b, 0x07, 0x07, 0x2c, 0x27, 0x1c, 0x07, 0x20, 0x1c, 0x14, ++ 0x44, 0x1b, 0x13, 0x0b, 0x40, 0x0b, 0x14, 0x07, 0x1c, 0x0b, 0x28, 0x18, 0x1c, 0x0b, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x51, 0x1d, 0x04, 0x47, 0x40, 0x02, 0x51, 0x5d, 0x27, 0x40, 0x04, 0x40, 0x40, 0x40, 0x0f, ++ 0x04, 0x16, 0x05, 0x18, 0x09, 0x16, 0x22, 0x3b, 0x3b, 0x07, 0x07, 0x03, 0x08, 0x0c, 0x11, 0x07, ++ 0x42, 0x27, 0x1d, 0x0b, 0x40, 0x43, 0x45, 0x40, 0x40, 0x40, 0x04, 0x04, 0x00, 0x05, 0x11, 0x05, ++ 0x09, 0x16, 0x00, 0x42, 0x05, 0x1e, 0x05, 0x42, 0x42, 0x09, 0x11, 0x15, 0x10, 0x15, 0x00, 0x05, ++ 0x11, 0x05, 0x09, 0x16, 0x00, 0x42, 0x05, 0x1e, 0x05, 0x42, 0x42, 0x09, 0x11, 0x15, 0x10, 0x15, ++ 0x20, 0x43, 0x32, 0x40, 0x48, 0x40, 0x04, 0x07, 0x04, 0x10, 0x10, 0x22, 0x07, 0x13, 0x41, 0x43, ++ 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x4c, ++ 0x07, 0x10, 0x10, 0x1d, 0x20, 0x1d, 0x20, 0x0b, 0x17, 0x41, 0x43, 0x17, 0x41, 0x43, 0x40, 0x40, ++ 0x40, 0x0a, 0x0a, 0x0b, 0x40, 0x0f, 0x0b, 0x06, 0x06, 0x2c, 0x27, 0x1c, 0x07, 0x20, 0x1c, 0x14, ++ 0x44, 0x1a, 0x13, 0x0b, 0x40, 0x0b, 0x14, 0x06, 0x1d, 0x0b, 0x29, 0x18, 0x1d, 0x0b, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x51, 0x1e, 0x04, 0x46, 0x40, 0x01, 0x51, 0x5e, 0x27, 0x40, 0x04, 0x40, 0x40, 0x40, 0x0f, ++ 0x04, 0x18, 0x06, 0x19, 0x0b, 0x18, 0x24, 0x3e, 0x3e, 0x07, 0x07, 0x03, 0x09, 0x0c, 0x13, 0x07, ++ 0x41, 0x27, 0x1e, 0x0b, 0x40, 0x43, 0x46, 0x40, 0x40, 0x40, 0x04, 0x04, 0x01, 0x06, 0x13, 0x06, ++ 0x0b, 0x18, 0x01, 0x41, 0x06, 0x20, 0x06, 0x41, 0x41, 0x0b, 0x13, 0x16, 0x11, 0x16, 0x01, 0x06, ++ 0x13, 0x06, 0x0b, 0x18, 0x01, 0x41, 0x06, 0x20, 0x06, 0x41, 0x41, 0x0b, 0x13, 0x16, 0x11, 0x16, ++ 0x21, 0x43, 0x34, 0x40, 0x48, 0x40, 0x04, 0x07, 0x04, 0x11, 0x11, 0x24, 0x07, 0x13, 0x41, 0x43, ++ 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x4c, ++ 0x07, 0x11, 0x11, 0x1e, 0x21, 0x1e, 0x21, 0x0b, 0x17, 0x41, 0x43, 0x17, 0x41, 0x43, 0x40, 0x40, ++ 0x40, 0x09, 0x09, 0x0b, 0x40, 0x0f, 0x0b, 0x06, 0x06, 0x2c, 0x27, 0x1c, 0x07, 0x21, 0x1c, 0x14, ++ 0x44, 0x19, 0x13, 0x0b, 0x40, 0x0b, 0x14, 0x06, 0x1e, 0x0b, 0x2b, 0x19, 0x1e, 0x0b, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x52, 0x1f, 0x05, 0x45, 0x40, 0x00, 0x52, 0x5f, 0x27, 0x40, 0x05, 0x40, 0x40, 0x40, 0x0f, ++ 0x05, 0x19, 0x07, 0x1a, 0x0c, 0x19, 0x26, 0x3e, 0x3e, 0x07, 0x07, 0x02, 0x0a, 0x0d, 0x14, 0x07, ++ 0x40, 0x27, 0x1f, 0x0a, 0x40, 0x42, 0x47, 0x40, 0x40, 0x40, 0x05, 0x05, 0x02, 0x07, 0x14, 0x07, ++ 0x0c, 0x19, 0x02, 0x40, 0x07, 0x21, 0x07, 0x40, 0x40, 0x0c, 0x14, 0x17, 0x12, 0x17, 0x02, 0x07, ++ 0x14, 0x07, 0x0c, 0x19, 0x02, 0x40, 0x07, 0x21, 0x07, 0x40, 0x40, 0x0c, 0x14, 0x17, 0x12, 0x17, ++ 0x22, 0x42, 0x36, 0x40, 0x48, 0x40, 0x05, 0x07, 0x05, 0x12, 0x12, 0x26, 0x07, 0x12, 0x42, 0x42, ++ 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x4d, ++ 0x07, 0x12, 0x12, 0x1f, 0x22, 0x1f, 0x22, 0x0a, 0x17, 0x42, 0x42, 0x17, 0x42, 0x42, 0x40, 0x40, ++ 0x40, 0x08, 0x08, 0x0a, 0x40, 0x0f, 0x0a, 0x05, 0x05, 0x2d, 0x27, 0x1d, 0x07, 0x22, 0x1d, 0x15, ++ 0x45, 0x18, 0x12, 0x0a, 0x40, 0x0a, 0x15, 0x05, 0x1f, 0x0a, 0x2c, 0x1a, 0x1f, 0x0a, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x52, 0x20, 0x05, 0x45, 0x40, 0x40, 0x52, 0x60, 0x27, 0x40, 0x05, 0x40, 0x40, 0x40, 0x0f, ++ 0x05, 0x1b, 0x08, 0x1a, 0x0d, 0x1b, 0x28, 0x3e, 0x3e, 0x07, 0x07, 0x02, 0x0a, 0x0d, 0x15, 0x07, ++ 0x00, 0x27, 0x20, 0x0a, 0x40, 0x42, 0x48, 0x40, 0x40, 0x40, 0x05, 0x05, 0x02, 0x08, 0x15, 0x08, ++ 0x0d, 0x1b, 0x02, 0x00, 0x08, 0x23, 0x08, 0x00, 0x00, 0x0d, 0x15, 0x18, 0x12, 0x18, 0x02, 0x08, ++ 0x15, 0x08, 0x0d, 0x1b, 0x02, 0x00, 0x08, 0x23, 0x08, 0x00, 0x00, 0x0d, 0x15, 0x18, 0x12, 0x18, ++ 0x22, 0x42, 0x38, 0x40, 0x48, 0x40, 0x05, 0x07, 0x05, 0x12, 0x12, 0x28, 0x07, 0x12, 0x42, 0x42, ++ 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x4d, ++ 0x07, 0x12, 0x12, 0x20, 0x22, 0x20, 0x22, 0x0a, 0x17, 0x42, 0x42, 0x17, 0x42, 0x42, 0x40, 0x40, ++ 0x40, 0x07, 0x07, 0x0a, 0x40, 0x0f, 0x0a, 0x05, 0x05, 0x2d, 0x27, 0x1d, 0x07, 0x22, 0x1d, 0x15, ++ 0x45, 0x17, 0x12, 0x0a, 0x40, 0x0a, 0x15, 0x05, 0x20, 0x0a, 0x2d, 0x1a, 0x20, 0x0a, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x53, 0x21, 0x05, 0x44, 0x40, 0x41, 0x53, 0x61, 0x27, 0x40, 0x05, 0x40, 0x40, 0x40, 0x0f, ++ 0x05, 0x1c, 0x09, 0x1b, 0x0e, 0x1c, 0x2a, 0x3e, 0x3e, 0x07, 0x07, 0x02, 0x0b, 0x0d, 0x16, 0x07, ++ 0x01, 0x27, 0x21, 0x0a, 0x40, 0x42, 0x49, 0x40, 0x40, 0x40, 0x05, 0x05, 0x03, 0x09, 0x16, 0x09, ++ 0x0e, 0x1c, 0x03, 0x01, 0x09, 0x24, 0x09, 0x01, 0x01, 0x0e, 0x16, 0x19, 0x13, 0x19, 0x03, 0x09, ++ 0x16, 0x09, 0x0e, 0x1c, 0x03, 0x01, 0x09, 0x24, 0x09, 0x01, 0x01, 0x0e, 0x16, 0x19, 0x13, 0x19, ++ 0x23, 0x42, 0x3a, 0x40, 0x48, 0x40, 0x05, 0x07, 0x05, 0x13, 0x13, 0x2a, 0x07, 0x12, 0x43, 0x42, ++ 0x1d, 0x07, 0x40, 0x12, 0x43, 0x42, 0x1d, 0x07, 0x40, 0x12, 0x43, 0x42, 0x1d, 0x07, 0x40, 0x4d, ++ 0x07, 0x13, 0x13, 0x21, 0x23, 0x21, 0x23, 0x0a, 0x17, 0x43, 0x42, 0x17, 0x43, 0x42, 0x40, 0x40, ++ 0x40, 0x06, 0x06, 0x0a, 0x40, 0x0f, 0x0a, 0x04, 0x04, 0x2d, 0x27, 0x1d, 0x07, 0x23, 0x1d, 0x15, ++ 0x45, 0x16, 0x12, 0x0a, 0x40, 0x0a, 0x15, 0x04, 0x21, 0x0a, 0x2e, 0x1b, 0x21, 0x0a, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x54, 0x22, 0x06, 0x43, 0x40, 0x42, 0x54, 0x62, 0x27, 0x40, 0x06, 0x40, 0x40, 0x40, 0x0f, ++ 0x06, 0x1e, 0x0a, 0x1c, 0x10, 0x1e, 0x2c, 0x3e, 0x3e, 0x07, 0x07, 0x01, 0x0c, 0x0e, 0x18, 0x07, ++ 0x02, 0x27, 0x22, 0x09, 0x40, 0x41, 0x4a, 0x40, 0x40, 0x40, 0x06, 0x06, 0x04, 0x0a, 0x18, 0x0a, ++ 0x10, 0x1e, 0x04, 0x02, 0x0a, 0x26, 0x0a, 0x02, 0x02, 0x10, 0x18, 0x1a, 0x14, 0x1a, 0x04, 0x0a, ++ 0x18, 0x0a, 0x10, 0x1e, 0x04, 0x02, 0x0a, 0x26, 0x0a, 0x02, 0x02, 0x10, 0x18, 0x1a, 0x14, 0x1a, ++ 0x24, 0x41, 0x3c, 0x40, 0x48, 0x40, 0x06, 0x07, 0x06, 0x14, 0x14, 0x2c, 0x07, 0x11, 0x44, 0x41, ++ 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x4e, ++ 0x07, 0x14, 0x14, 0x22, 0x24, 0x22, 0x24, 0x09, 0x17, 0x44, 0x41, 0x17, 0x44, 0x41, 0x40, 0x40, ++ 0x40, 0x05, 0x05, 0x09, 0x40, 0x0f, 0x09, 0x03, 0x03, 0x2e, 0x27, 0x1e, 0x07, 0x24, 0x1e, 0x16, ++ 0x46, 0x15, 0x11, 0x09, 0x40, 0x09, 0x16, 0x03, 0x22, 0x09, 0x30, 0x1c, 0x22, 0x09, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x54, 0x23, 0x06, 0x43, 0x40, 0x43, 0x54, 0x63, 0x27, 0x40, 0x06, 0x40, 0x40, 0x40, 0x0f, ++ 0x06, 0x1f, 0x0b, 0x1c, 0x11, 0x1f, 0x2e, 0x3e, 0x3e, 0x07, 0x07, 0x01, 0x0c, 0x0e, 0x19, 0x07, ++ 0x03, 0x27, 0x23, 0x09, 0x40, 0x41, 0x4b, 0x40, 0x40, 0x40, 0x06, 0x06, 0x04, 0x0b, 0x19, 0x0b, ++ 0x11, 0x1f, 0x04, 0x03, 0x0b, 0x27, 0x0b, 0x03, 0x03, 0x11, 0x19, 0x1b, 0x14, 0x1b, 0x04, 0x0b, ++ 0x19, 0x0b, 0x11, 0x1f, 0x04, 0x03, 0x0b, 0x27, 0x0b, 0x03, 0x03, 0x11, 0x19, 0x1b, 0x14, 0x1b, ++ 0x24, 0x41, 0x3e, 0x40, 0x48, 0x40, 0x06, 0x07, 0x06, 0x14, 0x14, 0x2e, 0x07, 0x11, 0x44, 0x41, ++ 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x4e, ++ 0x07, 0x14, 0x14, 0x23, 0x24, 0x23, 0x24, 0x09, 0x17, 0x44, 0x41, 0x17, 0x44, 0x41, 0x40, 0x40, ++ 0x40, 0x04, 0x04, 0x09, 0x40, 0x0f, 0x09, 0x03, 0x03, 0x2e, 0x27, 0x1e, 0x07, 0x24, 0x1e, 0x16, ++ 0x46, 0x14, 0x11, 0x09, 0x40, 0x09, 0x16, 0x03, 0x23, 0x09, 0x31, 0x1c, 0x23, 0x09, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x55, 0x24, 0x06, 0x42, 0x40, 0x44, 0x55, 0x64, 0x27, 0x40, 0x06, 0x40, 0x40, 0x40, 0x0f, ++ 0x06, 0x21, 0x0c, 0x1d, 0x12, 0x21, 0x30, 0x3e, 0x3e, 0x07, 0x07, 0x01, 0x0d, 0x0e, 0x1a, 0x07, ++ 0x04, 0x27, 0x24, 0x09, 0x40, 0x41, 0x4c, 0x40, 0x40, 0x40, 0x06, 0x06, 0x05, 0x0c, 0x1a, 0x0c, ++ 0x12, 0x21, 0x05, 0x04, 0x0c, 0x29, 0x0c, 0x04, 0x04, 0x12, 0x1a, 0x1c, 0x15, 0x1c, 0x05, 0x0c, ++ 0x1a, 0x0c, 0x12, 0x21, 0x05, 0x04, 0x0c, 0x29, 0x0c, 0x04, 0x04, 0x12, 0x1a, 0x1c, 0x15, 0x1c, ++ 0x25, 0x41, 0x3e, 0x40, 0x48, 0x40, 0x06, 0x07, 0x06, 0x15, 0x15, 0x30, 0x07, 0x11, 0x45, 0x41, ++ 0x1e, 0x07, 0x40, 0x11, 0x45, 0x41, 0x1e, 0x07, 0x40, 0x11, 0x45, 0x41, 0x1e, 0x07, 0x40, 0x4e, ++ 0x07, 0x15, 0x15, 0x24, 0x25, 0x24, 0x25, 0x09, 0x17, 0x45, 0x41, 0x17, 0x45, 0x41, 0x40, 0x40, ++ 0x40, 0x03, 0x03, 0x09, 0x40, 0x0f, 0x09, 0x02, 0x02, 0x2e, 0x27, 0x1e, 0x07, 0x25, 0x1e, 0x16, ++ 0x46, 0x13, 0x11, 0x09, 0x40, 0x09, 0x16, 0x02, 0x24, 0x09, 0x32, 0x1d, 0x24, 0x09, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x56, 0x24, 0x06, 0x42, 0x40, 0x45, 0x56, 0x65, 0x27, 0x40, 0x06, 0x40, 0x40, 0x40, 0x0f, ++ 0x06, 0x22, 0x0c, 0x1d, 0x13, 0x22, 0x31, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x0d, 0x0e, 0x1b, 0x07, ++ 0x04, 0x27, 0x24, 0x08, 0x40, 0x41, 0x4d, 0x40, 0x40, 0x40, 0x06, 0x06, 0x05, 0x0c, 0x1b, 0x0c, ++ 0x13, 0x22, 0x05, 0x04, 0x0c, 0x2a, 0x0c, 0x04, 0x04, 0x13, 0x1b, 0x1c, 0x15, 0x1c, 0x05, 0x0c, ++ 0x1b, 0x0c, 0x13, 0x22, 0x05, 0x04, 0x0c, 0x2a, 0x0c, 0x04, 0x04, 0x13, 0x1b, 0x1c, 0x15, 0x1c, ++ 0x25, 0x41, 0x3e, 0x40, 0x48, 0x40, 0x06, 0x07, 0x06, 0x15, 0x15, 0x31, 0x07, 0x10, 0x46, 0x41, ++ 0x1e, 0x07, 0x40, 0x10, 0x46, 0x41, 0x1e, 0x07, 0x40, 0x10, 0x46, 0x41, 0x1e, 0x07, 0x40, 0x4f, ++ 0x07, 0x15, 0x15, 0x24, 0x25, 0x24, 0x25, 0x08, 0x17, 0x46, 0x41, 0x17, 0x46, 0x41, 0x40, 0x40, ++ 0x40, 0x02, 0x02, 0x08, 0x40, 0x0f, 0x08, 0x01, 0x01, 0x2e, 0x27, 0x1e, 0x07, 0x25, 0x1e, 0x16, ++ 0x47, 0x12, 0x10, 0x08, 0x40, 0x08, 0x16, 0x01, 0x24, 0x08, 0x33, 0x1d, 0x24, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x56, 0x25, 0x07, 0x41, 0x40, 0x45, 0x56, 0x65, 0x27, 0x40, 0x07, 0x40, 0x40, 0x40, 0x0f, ++ 0x07, 0x24, 0x0d, 0x1e, 0x15, 0x24, 0x33, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x0e, 0x0f, 0x1d, 0x07, ++ 0x05, 0x27, 0x25, 0x08, 0x40, 0x40, 0x4d, 0x40, 0x40, 0x40, 0x07, 0x07, 0x06, 0x0d, 0x1d, 0x0d, ++ 0x15, 0x24, 0x06, 0x05, 0x0d, 0x2c, 0x0d, 0x05, 0x05, 0x15, 0x1d, 0x1d, 0x16, 0x1d, 0x06, 0x0d, ++ 0x1d, 0x0d, 0x15, 0x24, 0x06, 0x05, 0x0d, 0x2c, 0x0d, 0x05, 0x05, 0x15, 0x1d, 0x1d, 0x16, 0x1d, ++ 0x26, 0x40, 0x3e, 0x40, 0x48, 0x40, 0x07, 0x07, 0x07, 0x16, 0x16, 0x33, 0x07, 0x10, 0x46, 0x40, ++ 0x1f, 0x07, 0x40, 0x10, 0x46, 0x40, 0x1f, 0x07, 0x40, 0x10, 0x46, 0x40, 0x1f, 0x07, 0x40, 0x4f, ++ 0x07, 0x16, 0x16, 0x25, 0x26, 0x25, 0x26, 0x08, 0x17, 0x46, 0x40, 0x17, 0x46, 0x40, 0x40, 0x40, ++ 0x40, 0x02, 0x02, 0x08, 0x40, 0x0f, 0x08, 0x01, 0x01, 0x2f, 0x27, 0x1f, 0x07, 0x26, 0x1f, 0x17, ++ 0x47, 0x12, 0x10, 0x08, 0x40, 0x08, 0x17, 0x01, 0x25, 0x08, 0x35, 0x1e, 0x25, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x57, 0x26, 0x07, 0x40, 0x40, 0x46, 0x57, 0x66, 0x27, 0x40, 0x07, 0x40, 0x40, 0x40, 0x0f, ++ 0x07, 0x26, 0x0e, 0x1f, 0x16, 0x26, 0x35, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x0f, 0x0f, 0x1e, 0x07, ++ 0x06, 0x27, 0x26, 0x08, 0x40, 0x40, 0x4e, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x0e, 0x1e, 0x0e, ++ 0x16, 0x26, 0x07, 0x06, 0x0e, 0x2e, 0x0e, 0x06, 0x06, 0x16, 0x1e, 0x1e, 0x17, 0x1e, 0x07, 0x0e, ++ 0x1e, 0x0e, 0x16, 0x26, 0x07, 0x06, 0x0e, 0x2e, 0x0e, 0x06, 0x06, 0x16, 0x1e, 0x1e, 0x17, 0x1e, ++ 0x27, 0x40, 0x3e, 0x40, 0x48, 0x40, 0x07, 0x07, 0x07, 0x17, 0x17, 0x35, 0x07, 0x10, 0x47, 0x40, ++ 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x4f, ++ 0x07, 0x17, 0x17, 0x26, 0x27, 0x26, 0x27, 0x08, 0x17, 0x47, 0x40, 0x17, 0x47, 0x40, 0x40, 0x40, ++ 0x40, 0x01, 0x01, 0x08, 0x40, 0x0f, 0x08, 0x00, 0x00, 0x2f, 0x27, 0x1f, 0x07, 0x27, 0x1f, 0x17, ++ 0x47, 0x11, 0x10, 0x08, 0x40, 0x08, 0x17, 0x00, 0x26, 0x08, 0x36, 0x1f, 0x26, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x57, 0x27, 0x07, 0x40, 0x40, 0x47, 0x57, 0x67, 0x27, 0x40, 0x07, 0x40, 0x40, 0x40, 0x0f, ++ 0x07, 0x27, 0x0f, 0x1f, 0x17, 0x27, 0x37, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x0f, 0x0f, 0x1f, 0x07, ++ 0x07, 0x27, 0x27, 0x08, 0x40, 0x40, 0x4f, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x0f, 0x1f, 0x0f, ++ 0x17, 0x27, 0x07, 0x07, 0x0f, 0x2f, 0x0f, 0x07, 0x07, 0x17, 0x1f, 0x1f, 0x17, 0x1f, 0x07, 0x0f, ++ 0x1f, 0x0f, 0x17, 0x27, 0x07, 0x07, 0x0f, 0x2f, 0x0f, 0x07, 0x07, 0x17, 0x1f, 0x1f, 0x17, 0x1f, ++ 0x27, 0x40, 0x3e, 0x40, 0x48, 0x40, 0x07, 0x07, 0x07, 0x17, 0x17, 0x37, 0x07, 0x10, 0x47, 0x40, ++ 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x4f, ++ 0x07, 0x17, 0x17, 0x27, 0x27, 0x27, 0x27, 0x08, 0x17, 0x47, 0x40, 0x17, 0x47, 0x40, 0x40, 0x40, ++ 0x40, 0x00, 0x00, 0x08, 0x40, 0x0f, 0x08, 0x00, 0x00, 0x2f, 0x27, 0x1f, 0x07, 0x27, 0x1f, 0x17, ++ 0x47, 0x10, 0x10, 0x08, 0x40, 0x08, 0x17, 0x00, 0x27, 0x08, 0x37, 0x1f, 0x27, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x48, 0x48, 0x60, 0x40, 0x27, 0x07, 0x07, 0x1f, 0x40, 0x48, 0x40, 0x40, 0x17, 0x0f, ++ 0x48, 0x68, 0x40, 0x07, 0x68, 0x68, 0x68, 0x68, 0x68, 0x07, 0x07, 0x0f, 0x3e, 0x17, 0x40, 0x07, ++ 0x68, 0x27, 0x50, 0x17, 0x40, 0x07, 0x1f, 0x40, 0x40, 0x40, 0x48, 0x48, 0x58, 0x60, 0x50, 0x60, ++ 0x68, 0x60, 0x58, 0x68, 0x68, 0x68, 0x58, 0x60, 0x68, 0x68, 0x68, 0x50, 0x48, 0x58, 0x58, 0x60, ++ 0x50, 0x60, 0x68, 0x60, 0x58, 0x68, 0x68, 0x68, 0x58, 0x60, 0x68, 0x68, 0x68, 0x50, 0x48, 0x58, ++ 0x07, 0x50, 0x58, 0x40, 0x40, 0x40, 0x48, 0x07, 0x48, 0x48, 0x48, 0x68, 0x50, 0x1f, 0x17, 0x50, ++ 0x0f, 0x07, 0x40, 0x1f, 0x17, 0x50, 0x0f, 0x07, 0x40, 0x1f, 0x17, 0x50, 0x0f, 0x07, 0x40, 0x40, ++ 0x07, 0x40, 0x40, 0x40, 0x07, 0x40, 0x07, 0x17, 0x17, 0x17, 0x50, 0x17, 0x17, 0x50, 0x40, 0x40, ++ 0x40, 0x2f, 0x17, 0x17, 0x40, 0x0f, 0x17, 0x1f, 0x1f, 0x1f, 0x27, 0x0f, 0x07, 0x07, 0x0f, 0x40, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x0f, 0x17, 0x1f, 0x48, 0x17, 0x48, 0x48, 0x48, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x47, 0x47, 0x5f, 0x40, 0x27, 0x07, 0x07, 0x20, 0x40, 0x47, 0x40, 0x40, 0x17, 0x0f, ++ 0x47, 0x66, 0x40, 0x08, 0x66, 0x66, 0x66, 0x65, 0x65, 0x07, 0x07, 0x0f, 0x3e, 0x17, 0x00, 0x07, ++ 0x67, 0x27, 0x4e, 0x17, 0x40, 0x07, 0x1f, 0x40, 0x40, 0x40, 0x47, 0x47, 0x57, 0x5f, 0x4f, 0x5f, ++ 0x66, 0x5e, 0x57, 0x67, 0x67, 0x66, 0x57, 0x5f, 0x67, 0x67, 0x66, 0x4f, 0x47, 0x56, 0x57, 0x5f, ++ 0x4f, 0x5f, 0x66, 0x5e, 0x57, 0x67, 0x67, 0x66, 0x57, 0x5f, 0x67, 0x67, 0x66, 0x4f, 0x47, 0x56, ++ 0x08, 0x4f, 0x56, 0x40, 0x40, 0x40, 0x47, 0x07, 0x47, 0x47, 0x47, 0x66, 0x4f, 0x1f, 0x17, 0x4f, ++ 0x10, 0x07, 0x40, 0x1f, 0x17, 0x4f, 0x10, 0x07, 0x40, 0x1f, 0x17, 0x4f, 0x10, 0x07, 0x40, 0x40, ++ 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x17, 0x17, 0x17, 0x4f, 0x17, 0x17, 0x4f, 0x40, 0x40, ++ 0x40, 0x2f, 0x17, 0x17, 0x40, 0x0f, 0x17, 0x1f, 0x1f, 0x20, 0x27, 0x10, 0x07, 0x08, 0x10, 0x00, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x0f, 0x17, 0x1f, 0x47, 0x17, 0x46, 0x47, 0x47, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x46, 0x47, 0x5e, 0x40, 0x26, 0x06, 0x06, 0x20, 0x40, 0x47, 0x40, 0x40, 0x16, 0x0f, ++ 0x47, 0x64, 0x40, 0x08, 0x65, 0x64, 0x64, 0x63, 0x63, 0x07, 0x07, 0x0f, 0x3e, 0x17, 0x01, 0x07, ++ 0x66, 0x27, 0x4d, 0x17, 0x40, 0x07, 0x1e, 0x40, 0x40, 0x40, 0x47, 0x47, 0x56, 0x5e, 0x4e, 0x5e, ++ 0x65, 0x5d, 0x56, 0x66, 0x66, 0x64, 0x56, 0x5e, 0x66, 0x66, 0x64, 0x4e, 0x46, 0x55, 0x56, 0x5e, ++ 0x4e, 0x5e, 0x65, 0x5d, 0x56, 0x66, 0x66, 0x64, 0x56, 0x5e, 0x66, 0x66, 0x64, 0x4e, 0x46, 0x55, ++ 0x09, 0x4f, 0x54, 0x40, 0x40, 0x40, 0x47, 0x07, 0x47, 0x46, 0x46, 0x64, 0x4e, 0x1f, 0x16, 0x4f, ++ 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x40, ++ 0x07, 0x00, 0x00, 0x01, 0x09, 0x01, 0x09, 0x17, 0x17, 0x16, 0x4f, 0x17, 0x16, 0x4f, 0x40, 0x40, ++ 0x40, 0x2e, 0x17, 0x17, 0x40, 0x0f, 0x17, 0x1e, 0x1e, 0x20, 0x27, 0x10, 0x07, 0x09, 0x10, 0x01, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x0f, 0x17, 0x1e, 0x46, 0x17, 0x45, 0x46, 0x46, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x45, 0x47, 0x5e, 0x40, 0x25, 0x06, 0x05, 0x20, 0x40, 0x47, 0x40, 0x40, 0x16, 0x0f, ++ 0x47, 0x63, 0x40, 0x08, 0x64, 0x63, 0x62, 0x60, 0x60, 0x07, 0x07, 0x0f, 0x3e, 0x17, 0x01, 0x07, ++ 0x65, 0x27, 0x4c, 0x17, 0x40, 0x07, 0x1d, 0x40, 0x40, 0x40, 0x47, 0x47, 0x56, 0x5d, 0x4e, 0x5d, ++ 0x64, 0x5c, 0x56, 0x65, 0x65, 0x63, 0x56, 0x5e, 0x65, 0x65, 0x63, 0x4d, 0x46, 0x54, 0x56, 0x5d, ++ 0x4e, 0x5d, 0x64, 0x5c, 0x56, 0x65, 0x65, 0x63, 0x56, 0x5e, 0x65, 0x65, 0x63, 0x4d, 0x46, 0x54, ++ 0x09, 0x4f, 0x52, 0x40, 0x40, 0x40, 0x47, 0x07, 0x47, 0x46, 0x46, 0x62, 0x4e, 0x1f, 0x16, 0x4f, ++ 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x1f, 0x16, 0x4f, 0x10, 0x07, 0x40, 0x40, ++ 0x07, 0x00, 0x00, 0x01, 0x09, 0x01, 0x09, 0x17, 0x17, 0x16, 0x4f, 0x17, 0x16, 0x4f, 0x40, 0x40, ++ 0x40, 0x2d, 0x17, 0x17, 0x40, 0x0f, 0x17, 0x1e, 0x1e, 0x20, 0x27, 0x10, 0x07, 0x09, 0x10, 0x01, ++ 0x07, 0x3e, 0x1f, 0x17, 0x40, 0x0f, 0x17, 0x1e, 0x45, 0x17, 0x44, 0x45, 0x45, 0x17, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x44, 0x46, 0x5d, 0x40, 0x24, 0x05, 0x04, 0x21, 0x40, 0x46, 0x40, 0x40, 0x15, 0x0f, ++ 0x46, 0x61, 0x40, 0x09, 0x63, 0x61, 0x60, 0x5e, 0x5e, 0x07, 0x07, 0x0e, 0x3e, 0x16, 0x02, 0x07, ++ 0x64, 0x27, 0x4b, 0x16, 0x40, 0x06, 0x1c, 0x40, 0x40, 0x40, 0x46, 0x46, 0x55, 0x5c, 0x4d, 0x5c, ++ 0x63, 0x5b, 0x55, 0x64, 0x64, 0x61, 0x55, 0x5d, 0x64, 0x64, 0x61, 0x4c, 0x45, 0x53, 0x55, 0x5c, ++ 0x4d, 0x5c, 0x63, 0x5b, 0x55, 0x64, 0x64, 0x61, 0x55, 0x5d, 0x64, 0x64, 0x61, 0x4c, 0x45, 0x53, ++ 0x0a, 0x4e, 0x50, 0x40, 0x41, 0x40, 0x46, 0x07, 0x46, 0x45, 0x45, 0x60, 0x4d, 0x1e, 0x15, 0x4e, ++ 0x11, 0x07, 0x40, 0x1e, 0x15, 0x4e, 0x11, 0x07, 0x40, 0x1e, 0x15, 0x4e, 0x11, 0x07, 0x40, 0x41, ++ 0x07, 0x01, 0x01, 0x02, 0x0a, 0x02, 0x0a, 0x16, 0x17, 0x15, 0x4e, 0x17, 0x15, 0x4e, 0x40, 0x40, ++ 0x40, 0x2c, 0x16, 0x16, 0x40, 0x0f, 0x16, 0x1d, 0x1d, 0x21, 0x27, 0x11, 0x07, 0x0a, 0x11, 0x02, ++ 0x06, 0x3e, 0x1e, 0x16, 0x40, 0x0f, 0x16, 0x1d, 0x44, 0x16, 0x43, 0x44, 0x44, 0x16, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x43, 0x46, 0x5c, 0x40, 0x23, 0x04, 0x03, 0x21, 0x40, 0x46, 0x40, 0x40, 0x14, 0x0f, ++ 0x46, 0x60, 0x40, 0x09, 0x61, 0x60, 0x5e, 0x5b, 0x5b, 0x07, 0x07, 0x0e, 0x3e, 0x16, 0x03, 0x07, ++ 0x63, 0x27, 0x49, 0x16, 0x40, 0x06, 0x1b, 0x40, 0x40, 0x40, 0x46, 0x46, 0x54, 0x5b, 0x4c, 0x5b, ++ 0x61, 0x59, 0x54, 0x63, 0x63, 0x60, 0x54, 0x5c, 0x63, 0x63, 0x60, 0x4b, 0x44, 0x51, 0x54, 0x5b, ++ 0x4c, 0x5b, 0x61, 0x59, 0x54, 0x63, 0x63, 0x60, 0x54, 0x5c, 0x63, 0x63, 0x60, 0x4b, 0x44, 0x51, ++ 0x0b, 0x4e, 0x4e, 0x40, 0x41, 0x40, 0x46, 0x07, 0x46, 0x44, 0x44, 0x5e, 0x4c, 0x1e, 0x14, 0x4e, ++ 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x41, ++ 0x07, 0x01, 0x01, 0x03, 0x0b, 0x03, 0x0b, 0x16, 0x17, 0x14, 0x4e, 0x17, 0x14, 0x4e, 0x40, 0x40, ++ 0x40, 0x2b, 0x16, 0x16, 0x40, 0x0f, 0x16, 0x1c, 0x1c, 0x21, 0x27, 0x11, 0x07, 0x0b, 0x11, 0x03, ++ 0x06, 0x3e, 0x1e, 0x16, 0x40, 0x0f, 0x16, 0x1c, 0x43, 0x16, 0x41, 0x43, 0x43, 0x16, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x42, 0x46, 0x5c, 0x40, 0x22, 0x04, 0x02, 0x21, 0x40, 0x46, 0x40, 0x40, 0x14, 0x0f, ++ 0x46, 0x5e, 0x40, 0x09, 0x60, 0x5e, 0x5c, 0x59, 0x59, 0x07, 0x07, 0x0e, 0x3e, 0x16, 0x03, 0x07, ++ 0x62, 0x27, 0x48, 0x16, 0x40, 0x06, 0x1a, 0x40, 0x40, 0x40, 0x46, 0x46, 0x54, 0x5a, 0x4c, 0x5a, ++ 0x60, 0x58, 0x54, 0x62, 0x62, 0x5e, 0x54, 0x5c, 0x62, 0x62, 0x5e, 0x4a, 0x44, 0x50, 0x54, 0x5a, ++ 0x4c, 0x5a, 0x60, 0x58, 0x54, 0x62, 0x62, 0x5e, 0x54, 0x5c, 0x62, 0x62, 0x5e, 0x4a, 0x44, 0x50, ++ 0x0b, 0x4e, 0x4c, 0x40, 0x41, 0x40, 0x46, 0x07, 0x46, 0x44, 0x44, 0x5c, 0x4c, 0x1e, 0x14, 0x4e, ++ 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x1e, 0x14, 0x4e, 0x11, 0x07, 0x40, 0x41, ++ 0x07, 0x01, 0x01, 0x03, 0x0b, 0x03, 0x0b, 0x16, 0x17, 0x14, 0x4e, 0x17, 0x14, 0x4e, 0x40, 0x40, ++ 0x40, 0x2a, 0x16, 0x16, 0x40, 0x0f, 0x16, 0x1c, 0x1c, 0x21, 0x27, 0x11, 0x07, 0x0b, 0x11, 0x03, ++ 0x06, 0x3e, 0x1e, 0x16, 0x40, 0x0f, 0x16, 0x1c, 0x42, 0x16, 0x40, 0x42, 0x42, 0x16, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x41, 0x45, 0x5b, 0x40, 0x21, 0x03, 0x01, 0x22, 0x40, 0x45, 0x40, 0x40, 0x13, 0x0f, ++ 0x45, 0x5d, 0x40, 0x0a, 0x5f, 0x5d, 0x5a, 0x56, 0x56, 0x07, 0x07, 0x0d, 0x3e, 0x15, 0x04, 0x07, ++ 0x61, 0x27, 0x47, 0x15, 0x40, 0x05, 0x19, 0x40, 0x40, 0x40, 0x45, 0x45, 0x53, 0x59, 0x4b, 0x59, ++ 0x5f, 0x57, 0x53, 0x61, 0x61, 0x5d, 0x53, 0x5b, 0x61, 0x61, 0x5d, 0x49, 0x43, 0x4f, 0x53, 0x59, ++ 0x4b, 0x59, 0x5f, 0x57, 0x53, 0x61, 0x61, 0x5d, 0x53, 0x5b, 0x61, 0x61, 0x5d, 0x49, 0x43, 0x4f, ++ 0x0c, 0x4d, 0x4a, 0x40, 0x42, 0x40, 0x45, 0x07, 0x45, 0x43, 0x43, 0x5a, 0x4b, 0x1d, 0x13, 0x4d, ++ 0x12, 0x07, 0x40, 0x1d, 0x13, 0x4d, 0x12, 0x07, 0x40, 0x1d, 0x13, 0x4d, 0x12, 0x07, 0x40, 0x42, ++ 0x07, 0x02, 0x02, 0x04, 0x0c, 0x04, 0x0c, 0x15, 0x17, 0x13, 0x4d, 0x17, 0x13, 0x4d, 0x40, 0x40, ++ 0x40, 0x29, 0x15, 0x15, 0x40, 0x0f, 0x15, 0x1b, 0x1b, 0x22, 0x27, 0x12, 0x07, 0x0c, 0x12, 0x04, ++ 0x05, 0x3e, 0x1d, 0x15, 0x40, 0x0f, 0x15, 0x1b, 0x41, 0x15, 0x00, 0x41, 0x41, 0x15, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x40, 0x45, 0x5b, 0x40, 0x20, 0x02, 0x00, 0x22, 0x40, 0x45, 0x40, 0x40, 0x12, 0x0f, ++ 0x45, 0x5b, 0x40, 0x0a, 0x5e, 0x5b, 0x59, 0x54, 0x54, 0x07, 0x07, 0x0d, 0x3e, 0x15, 0x04, 0x07, ++ 0x60, 0x27, 0x46, 0x15, 0x40, 0x05, 0x18, 0x40, 0x40, 0x40, 0x45, 0x45, 0x53, 0x58, 0x4b, 0x58, ++ 0x5e, 0x56, 0x53, 0x60, 0x60, 0x5b, 0x53, 0x5b, 0x60, 0x60, 0x5b, 0x48, 0x43, 0x4e, 0x53, 0x58, ++ 0x4b, 0x58, 0x5e, 0x56, 0x53, 0x60, 0x60, 0x5b, 0x53, 0x5b, 0x60, 0x60, 0x5b, 0x48, 0x43, 0x4e, ++ 0x0c, 0x4d, 0x49, 0x40, 0x42, 0x40, 0x45, 0x07, 0x45, 0x43, 0x43, 0x59, 0x4b, 0x1d, 0x12, 0x4d, ++ 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x42, ++ 0x07, 0x02, 0x02, 0x04, 0x0c, 0x04, 0x0c, 0x15, 0x17, 0x12, 0x4d, 0x17, 0x12, 0x4d, 0x40, 0x40, ++ 0x40, 0x28, 0x15, 0x15, 0x40, 0x0f, 0x15, 0x1a, 0x1a, 0x22, 0x27, 0x12, 0x07, 0x0c, 0x12, 0x04, ++ 0x05, 0x3e, 0x1d, 0x15, 0x40, 0x0f, 0x15, 0x1a, 0x40, 0x15, 0x01, 0x40, 0x40, 0x15, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x00, 0x45, 0x5a, 0x40, 0x1f, 0x02, 0x40, 0x22, 0x40, 0x45, 0x40, 0x40, 0x12, 0x0f, ++ 0x45, 0x59, 0x40, 0x0a, 0x5c, 0x59, 0x57, 0x51, 0x51, 0x07, 0x07, 0x0d, 0x3e, 0x15, 0x05, 0x07, ++ 0x5f, 0x27, 0x44, 0x15, 0x40, 0x05, 0x17, 0x40, 0x40, 0x40, 0x45, 0x45, 0x52, 0x57, 0x4a, 0x57, ++ 0x5c, 0x54, 0x52, 0x5f, 0x5f, 0x59, 0x52, 0x5a, 0x5f, 0x5f, 0x59, 0x47, 0x42, 0x4c, 0x52, 0x57, ++ 0x4a, 0x57, 0x5c, 0x54, 0x52, 0x5f, 0x5f, 0x59, 0x52, 0x5a, 0x5f, 0x5f, 0x59, 0x47, 0x42, 0x4c, ++ 0x0d, 0x4d, 0x47, 0x40, 0x42, 0x40, 0x45, 0x07, 0x45, 0x42, 0x42, 0x57, 0x4a, 0x1d, 0x12, 0x4d, ++ 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x1d, 0x12, 0x4d, 0x12, 0x07, 0x40, 0x42, ++ 0x07, 0x02, 0x02, 0x05, 0x0d, 0x05, 0x0d, 0x15, 0x17, 0x12, 0x4d, 0x17, 0x12, 0x4d, 0x40, 0x40, ++ 0x40, 0x27, 0x15, 0x15, 0x40, 0x0f, 0x15, 0x1a, 0x1a, 0x22, 0x27, 0x12, 0x07, 0x0d, 0x12, 0x05, ++ 0x05, 0x3e, 0x1d, 0x15, 0x40, 0x0f, 0x15, 0x1a, 0x00, 0x15, 0x03, 0x00, 0x00, 0x15, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x01, 0x44, 0x59, 0x40, 0x1e, 0x01, 0x41, 0x23, 0x40, 0x44, 0x40, 0x40, 0x11, 0x0f, ++ 0x44, 0x58, 0x40, 0x0b, 0x5b, 0x58, 0x55, 0x4f, 0x4f, 0x07, 0x07, 0x0c, 0x3e, 0x14, 0x06, 0x07, ++ 0x5e, 0x27, 0x43, 0x14, 0x40, 0x04, 0x16, 0x40, 0x40, 0x40, 0x44, 0x44, 0x51, 0x56, 0x49, 0x56, ++ 0x5b, 0x53, 0x51, 0x5e, 0x5e, 0x58, 0x51, 0x59, 0x5e, 0x5e, 0x58, 0x46, 0x41, 0x4b, 0x51, 0x56, ++ 0x49, 0x56, 0x5b, 0x53, 0x51, 0x5e, 0x5e, 0x58, 0x51, 0x59, 0x5e, 0x5e, 0x58, 0x46, 0x41, 0x4b, ++ 0x0e, 0x4c, 0x45, 0x40, 0x43, 0x40, 0x44, 0x07, 0x44, 0x41, 0x41, 0x55, 0x49, 0x1c, 0x11, 0x4c, ++ 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x43, ++ 0x07, 0x03, 0x03, 0x06, 0x0e, 0x06, 0x0e, 0x14, 0x17, 0x11, 0x4c, 0x17, 0x11, 0x4c, 0x40, 0x40, ++ 0x40, 0x26, 0x14, 0x14, 0x40, 0x0f, 0x14, 0x19, 0x19, 0x23, 0x27, 0x13, 0x07, 0x0e, 0x13, 0x06, ++ 0x04, 0x3e, 0x1c, 0x14, 0x40, 0x0f, 0x14, 0x19, 0x01, 0x14, 0x04, 0x01, 0x01, 0x14, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x02, 0x44, 0x59, 0x40, 0x1d, 0x01, 0x42, 0x23, 0x40, 0x44, 0x40, 0x40, 0x11, 0x0f, ++ 0x44, 0x56, 0x40, 0x0b, 0x5a, 0x56, 0x53, 0x4c, 0x4c, 0x07, 0x07, 0x0c, 0x3e, 0x14, 0x06, 0x07, ++ 0x5d, 0x27, 0x42, 0x14, 0x40, 0x04, 0x15, 0x40, 0x40, 0x40, 0x44, 0x44, 0x51, 0x55, 0x49, 0x55, ++ 0x5a, 0x52, 0x51, 0x5d, 0x5d, 0x56, 0x51, 0x59, 0x5d, 0x5d, 0x56, 0x45, 0x41, 0x4a, 0x51, 0x55, ++ 0x49, 0x55, 0x5a, 0x52, 0x51, 0x5d, 0x5d, 0x56, 0x51, 0x59, 0x5d, 0x5d, 0x56, 0x45, 0x41, 0x4a, ++ 0x0e, 0x4c, 0x43, 0x40, 0x43, 0x40, 0x44, 0x07, 0x44, 0x41, 0x41, 0x53, 0x49, 0x1c, 0x11, 0x4c, ++ 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x1c, 0x11, 0x4c, 0x13, 0x07, 0x40, 0x43, ++ 0x07, 0x03, 0x03, 0x06, 0x0e, 0x06, 0x0e, 0x14, 0x17, 0x11, 0x4c, 0x17, 0x11, 0x4c, 0x40, 0x40, ++ 0x40, 0x25, 0x14, 0x14, 0x40, 0x0f, 0x14, 0x19, 0x19, 0x23, 0x27, 0x13, 0x07, 0x0e, 0x13, 0x06, ++ 0x04, 0x3e, 0x1c, 0x14, 0x40, 0x0f, 0x14, 0x19, 0x02, 0x14, 0x05, 0x02, 0x02, 0x14, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x03, 0x44, 0x58, 0x40, 0x1c, 0x00, 0x43, 0x23, 0x40, 0x44, 0x40, 0x40, 0x10, 0x0f, ++ 0x44, 0x55, 0x40, 0x0b, 0x59, 0x55, 0x51, 0x4a, 0x4a, 0x07, 0x07, 0x0c, 0x3d, 0x14, 0x07, 0x07, ++ 0x5c, 0x27, 0x41, 0x14, 0x40, 0x04, 0x14, 0x40, 0x40, 0x40, 0x44, 0x44, 0x50, 0x54, 0x48, 0x54, ++ 0x59, 0x51, 0x50, 0x5c, 0x5c, 0x55, 0x50, 0x58, 0x5c, 0x5c, 0x55, 0x44, 0x40, 0x49, 0x50, 0x54, ++ 0x48, 0x54, 0x59, 0x51, 0x50, 0x5c, 0x5c, 0x55, 0x50, 0x58, 0x5c, 0x5c, 0x55, 0x44, 0x40, 0x49, ++ 0x0f, 0x4c, 0x41, 0x40, 0x43, 0x40, 0x44, 0x07, 0x44, 0x40, 0x40, 0x51, 0x48, 0x1c, 0x10, 0x4c, ++ 0x13, 0x07, 0x40, 0x1c, 0x10, 0x4c, 0x13, 0x07, 0x40, 0x1c, 0x10, 0x4c, 0x13, 0x07, 0x40, 0x43, ++ 0x07, 0x03, 0x03, 0x07, 0x0f, 0x07, 0x0f, 0x14, 0x17, 0x10, 0x4c, 0x17, 0x10, 0x4c, 0x40, 0x40, ++ 0x40, 0x24, 0x14, 0x14, 0x40, 0x0f, 0x14, 0x18, 0x18, 0x23, 0x27, 0x13, 0x07, 0x0f, 0x13, 0x07, ++ 0x04, 0x3e, 0x1c, 0x14, 0x40, 0x0f, 0x14, 0x18, 0x03, 0x14, 0x06, 0x03, 0x03, 0x14, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x04, 0x43, 0x57, 0x40, 0x1b, 0x40, 0x44, 0x24, 0x40, 0x43, 0x40, 0x40, 0x0f, 0x0f, ++ 0x43, 0x53, 0x40, 0x0c, 0x57, 0x53, 0x4f, 0x47, 0x47, 0x07, 0x07, 0x0b, 0x3b, 0x13, 0x08, 0x07, ++ 0x5b, 0x27, 0x00, 0x13, 0x40, 0x03, 0x13, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4f, 0x53, 0x47, 0x53, ++ 0x57, 0x4f, 0x4f, 0x5b, 0x5b, 0x53, 0x4f, 0x57, 0x5b, 0x5b, 0x53, 0x43, 0x00, 0x47, 0x4f, 0x53, ++ 0x47, 0x53, 0x57, 0x4f, 0x4f, 0x5b, 0x5b, 0x53, 0x4f, 0x57, 0x5b, 0x5b, 0x53, 0x43, 0x00, 0x47, ++ 0x10, 0x4b, 0x00, 0x40, 0x44, 0x40, 0x43, 0x07, 0x43, 0x00, 0x00, 0x4f, 0x47, 0x1b, 0x0f, 0x4b, ++ 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x44, ++ 0x07, 0x04, 0x04, 0x08, 0x10, 0x08, 0x10, 0x13, 0x17, 0x0f, 0x4b, 0x17, 0x0f, 0x4b, 0x40, 0x40, ++ 0x40, 0x23, 0x13, 0x13, 0x40, 0x0f, 0x13, 0x17, 0x17, 0x24, 0x27, 0x14, 0x07, 0x10, 0x14, 0x08, ++ 0x03, 0x3e, 0x1b, 0x13, 0x40, 0x0f, 0x13, 0x17, 0x04, 0x13, 0x08, 0x04, 0x04, 0x13, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x05, 0x43, 0x57, 0x40, 0x1a, 0x40, 0x45, 0x24, 0x40, 0x43, 0x40, 0x40, 0x0f, 0x0f, ++ 0x43, 0x52, 0x40, 0x0c, 0x56, 0x52, 0x4d, 0x45, 0x45, 0x07, 0x07, 0x0b, 0x3a, 0x13, 0x08, 0x07, ++ 0x5a, 0x27, 0x01, 0x13, 0x40, 0x03, 0x12, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4f, 0x52, 0x47, 0x52, ++ 0x56, 0x4e, 0x4f, 0x5a, 0x5a, 0x52, 0x4f, 0x57, 0x5a, 0x5a, 0x52, 0x42, 0x00, 0x46, 0x4f, 0x52, ++ 0x47, 0x52, 0x56, 0x4e, 0x4f, 0x5a, 0x5a, 0x52, 0x4f, 0x57, 0x5a, 0x5a, 0x52, 0x42, 0x00, 0x46, ++ 0x10, 0x4b, 0x02, 0x40, 0x44, 0x40, 0x43, 0x07, 0x43, 0x00, 0x00, 0x4d, 0x47, 0x1b, 0x0f, 0x4b, ++ 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x1b, 0x0f, 0x4b, 0x14, 0x07, 0x40, 0x44, ++ 0x07, 0x04, 0x04, 0x08, 0x10, 0x08, 0x10, 0x13, 0x17, 0x0f, 0x4b, 0x17, 0x0f, 0x4b, 0x40, 0x40, ++ 0x40, 0x22, 0x13, 0x13, 0x40, 0x0f, 0x13, 0x17, 0x17, 0x24, 0x27, 0x14, 0x07, 0x10, 0x14, 0x08, ++ 0x03, 0x3e, 0x1b, 0x13, 0x40, 0x0f, 0x13, 0x17, 0x05, 0x13, 0x09, 0x05, 0x05, 0x13, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x06, 0x43, 0x56, 0x40, 0x19, 0x41, 0x46, 0x24, 0x40, 0x43, 0x40, 0x40, 0x0e, 0x0f, ++ 0x43, 0x50, 0x40, 0x0c, 0x55, 0x50, 0x4b, 0x42, 0x42, 0x07, 0x07, 0x0b, 0x38, 0x13, 0x09, 0x07, ++ 0x59, 0x27, 0x02, 0x13, 0x40, 0x03, 0x11, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4e, 0x51, 0x46, 0x51, ++ 0x55, 0x4d, 0x4e, 0x59, 0x59, 0x50, 0x4e, 0x56, 0x59, 0x59, 0x50, 0x41, 0x01, 0x45, 0x4e, 0x51, ++ 0x46, 0x51, 0x55, 0x4d, 0x4e, 0x59, 0x59, 0x50, 0x4e, 0x56, 0x59, 0x59, 0x50, 0x41, 0x01, 0x45, ++ 0x11, 0x4b, 0x04, 0x40, 0x44, 0x40, 0x43, 0x07, 0x43, 0x01, 0x01, 0x4b, 0x46, 0x1b, 0x0e, 0x4b, ++ 0x14, 0x07, 0x40, 0x1b, 0x0e, 0x4b, 0x14, 0x07, 0x40, 0x1b, 0x0e, 0x4b, 0x14, 0x07, 0x40, 0x44, ++ 0x07, 0x04, 0x04, 0x09, 0x11, 0x09, 0x11, 0x13, 0x17, 0x0e, 0x4b, 0x17, 0x0e, 0x4b, 0x40, 0x40, ++ 0x40, 0x21, 0x13, 0x13, 0x40, 0x0f, 0x13, 0x16, 0x16, 0x24, 0x27, 0x14, 0x07, 0x11, 0x14, 0x09, ++ 0x03, 0x3d, 0x1b, 0x13, 0x40, 0x0f, 0x13, 0x16, 0x06, 0x13, 0x0a, 0x06, 0x06, 0x13, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x06, 0x43, 0x56, 0x40, 0x18, 0x42, 0x47, 0x24, 0x40, 0x43, 0x40, 0x40, 0x0d, 0x0f, ++ 0x43, 0x4f, 0x40, 0x0c, 0x54, 0x4f, 0x4a, 0x40, 0x40, 0x07, 0x07, 0x0a, 0x36, 0x12, 0x09, 0x07, ++ 0x59, 0x27, 0x03, 0x12, 0x40, 0x02, 0x10, 0x40, 0x40, 0x40, 0x43, 0x43, 0x4e, 0x51, 0x46, 0x51, ++ 0x54, 0x4c, 0x4e, 0x59, 0x59, 0x4f, 0x4e, 0x56, 0x59, 0x59, 0x4f, 0x41, 0x01, 0x44, 0x4e, 0x51, ++ 0x46, 0x51, 0x54, 0x4c, 0x4e, 0x59, 0x59, 0x4f, 0x4e, 0x56, 0x59, 0x59, 0x4f, 0x41, 0x01, 0x44, ++ 0x11, 0x4b, 0x05, 0x40, 0x45, 0x40, 0x43, 0x07, 0x43, 0x01, 0x01, 0x4a, 0x46, 0x1a, 0x0d, 0x4b, ++ 0x14, 0x07, 0x40, 0x1a, 0x0d, 0x4b, 0x14, 0x07, 0x40, 0x1a, 0x0d, 0x4b, 0x14, 0x07, 0x40, 0x45, ++ 0x07, 0x04, 0x04, 0x09, 0x11, 0x09, 0x11, 0x12, 0x17, 0x0d, 0x4b, 0x17, 0x0d, 0x4b, 0x40, 0x40, ++ 0x40, 0x20, 0x12, 0x12, 0x40, 0x0f, 0x12, 0x15, 0x15, 0x24, 0x27, 0x14, 0x07, 0x11, 0x14, 0x09, ++ 0x02, 0x3b, 0x1a, 0x12, 0x40, 0x0f, 0x12, 0x15, 0x06, 0x12, 0x0b, 0x06, 0x06, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x07, 0x42, 0x55, 0x40, 0x18, 0x42, 0x47, 0x25, 0x40, 0x42, 0x40, 0x40, 0x0d, 0x0f, ++ 0x42, 0x4d, 0x40, 0x0d, 0x52, 0x4d, 0x48, 0x02, 0x02, 0x07, 0x07, 0x0a, 0x35, 0x12, 0x0a, 0x07, ++ 0x58, 0x27, 0x05, 0x12, 0x40, 0x02, 0x10, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4d, 0x50, 0x45, 0x50, ++ 0x52, 0x4a, 0x4d, 0x58, 0x58, 0x4d, 0x4d, 0x55, 0x58, 0x58, 0x4d, 0x40, 0x02, 0x42, 0x4d, 0x50, ++ 0x45, 0x50, 0x52, 0x4a, 0x4d, 0x58, 0x58, 0x4d, 0x4d, 0x55, 0x58, 0x58, 0x4d, 0x40, 0x02, 0x42, ++ 0x12, 0x4a, 0x07, 0x40, 0x45, 0x40, 0x42, 0x07, 0x42, 0x02, 0x02, 0x48, 0x45, 0x1a, 0x0d, 0x4a, ++ 0x15, 0x07, 0x40, 0x1a, 0x0d, 0x4a, 0x15, 0x07, 0x40, 0x1a, 0x0d, 0x4a, 0x15, 0x07, 0x40, 0x45, ++ 0x07, 0x05, 0x05, 0x0a, 0x12, 0x0a, 0x12, 0x12, 0x17, 0x0d, 0x4a, 0x17, 0x0d, 0x4a, 0x40, 0x40, ++ 0x40, 0x20, 0x12, 0x12, 0x40, 0x0f, 0x12, 0x15, 0x15, 0x25, 0x27, 0x15, 0x07, 0x12, 0x15, 0x0a, ++ 0x02, 0x3a, 0x1a, 0x12, 0x40, 0x0f, 0x12, 0x15, 0x07, 0x12, 0x0d, 0x07, 0x07, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x08, 0x42, 0x54, 0x40, 0x17, 0x43, 0x48, 0x25, 0x40, 0x42, 0x40, 0x40, 0x0c, 0x0f, ++ 0x42, 0x4b, 0x40, 0x0d, 0x51, 0x4b, 0x46, 0x04, 0x04, 0x07, 0x07, 0x0a, 0x33, 0x12, 0x0b, 0x07, ++ 0x57, 0x27, 0x06, 0x12, 0x40, 0x02, 0x0f, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4c, 0x4f, 0x44, 0x4f, ++ 0x51, 0x49, 0x4c, 0x57, 0x57, 0x4b, 0x4c, 0x54, 0x57, 0x57, 0x4b, 0x00, 0x03, 0x41, 0x4c, 0x4f, ++ 0x44, 0x4f, 0x51, 0x49, 0x4c, 0x57, 0x57, 0x4b, 0x4c, 0x54, 0x57, 0x57, 0x4b, 0x00, 0x03, 0x41, ++ 0x13, 0x4a, 0x09, 0x40, 0x45, 0x40, 0x42, 0x07, 0x42, 0x03, 0x03, 0x46, 0x44, 0x1a, 0x0c, 0x4a, ++ 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x45, ++ 0x07, 0x05, 0x05, 0x0b, 0x13, 0x0b, 0x13, 0x12, 0x17, 0x0c, 0x4a, 0x17, 0x0c, 0x4a, 0x40, 0x40, ++ 0x40, 0x1f, 0x12, 0x12, 0x40, 0x0f, 0x12, 0x14, 0x14, 0x25, 0x27, 0x15, 0x07, 0x13, 0x15, 0x0b, ++ 0x02, 0x39, 0x1a, 0x12, 0x40, 0x0f, 0x12, 0x14, 0x08, 0x12, 0x0e, 0x08, 0x08, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x09, 0x42, 0x54, 0x40, 0x16, 0x43, 0x49, 0x25, 0x40, 0x42, 0x40, 0x40, 0x0c, 0x0f, ++ 0x42, 0x4a, 0x40, 0x0d, 0x50, 0x4a, 0x44, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x32, 0x12, 0x0b, 0x07, ++ 0x56, 0x27, 0x07, 0x12, 0x40, 0x02, 0x0e, 0x40, 0x40, 0x40, 0x42, 0x42, 0x4c, 0x4e, 0x44, 0x4e, ++ 0x50, 0x48, 0x4c, 0x56, 0x56, 0x4a, 0x4c, 0x54, 0x56, 0x56, 0x4a, 0x01, 0x03, 0x40, 0x4c, 0x4e, ++ 0x44, 0x4e, 0x50, 0x48, 0x4c, 0x56, 0x56, 0x4a, 0x4c, 0x54, 0x56, 0x56, 0x4a, 0x01, 0x03, 0x40, ++ 0x13, 0x4a, 0x0b, 0x40, 0x45, 0x40, 0x42, 0x07, 0x42, 0x03, 0x03, 0x44, 0x44, 0x1a, 0x0c, 0x4a, ++ 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x1a, 0x0c, 0x4a, 0x15, 0x07, 0x40, 0x45, ++ 0x07, 0x05, 0x05, 0x0b, 0x13, 0x0b, 0x13, 0x12, 0x17, 0x0c, 0x4a, 0x17, 0x0c, 0x4a, 0x40, 0x40, ++ 0x40, 0x1e, 0x12, 0x12, 0x40, 0x0f, 0x12, 0x14, 0x14, 0x25, 0x27, 0x15, 0x07, 0x13, 0x15, 0x0b, ++ 0x02, 0x38, 0x1a, 0x12, 0x40, 0x0f, 0x12, 0x14, 0x09, 0x12, 0x0f, 0x09, 0x09, 0x12, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x0a, 0x41, 0x53, 0x40, 0x15, 0x44, 0x4a, 0x26, 0x40, 0x41, 0x40, 0x40, 0x0b, 0x0f, ++ 0x41, 0x48, 0x40, 0x0e, 0x4f, 0x48, 0x42, 0x09, 0x09, 0x07, 0x07, 0x09, 0x30, 0x11, 0x0c, 0x07, ++ 0x55, 0x27, 0x08, 0x11, 0x40, 0x01, 0x0d, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4b, 0x4d, 0x43, 0x4d, ++ 0x4f, 0x47, 0x4b, 0x55, 0x55, 0x48, 0x4b, 0x53, 0x55, 0x55, 0x48, 0x02, 0x04, 0x00, 0x4b, 0x4d, ++ 0x43, 0x4d, 0x4f, 0x47, 0x4b, 0x55, 0x55, 0x48, 0x4b, 0x53, 0x55, 0x55, 0x48, 0x02, 0x04, 0x00, ++ 0x14, 0x49, 0x0d, 0x40, 0x46, 0x40, 0x41, 0x07, 0x41, 0x04, 0x04, 0x42, 0x43, 0x19, 0x0b, 0x49, ++ 0x16, 0x07, 0x40, 0x19, 0x0b, 0x49, 0x16, 0x07, 0x40, 0x19, 0x0b, 0x49, 0x16, 0x07, 0x40, 0x46, ++ 0x07, 0x06, 0x06, 0x0c, 0x14, 0x0c, 0x14, 0x11, 0x17, 0x0b, 0x49, 0x17, 0x0b, 0x49, 0x40, 0x40, ++ 0x40, 0x1d, 0x11, 0x11, 0x40, 0x0f, 0x11, 0x13, 0x13, 0x26, 0x27, 0x16, 0x07, 0x14, 0x16, 0x0c, ++ 0x01, 0x36, 0x19, 0x11, 0x40, 0x0f, 0x11, 0x13, 0x0a, 0x11, 0x10, 0x0a, 0x0a, 0x11, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x0b, 0x41, 0x52, 0x40, 0x14, 0x45, 0x4b, 0x26, 0x40, 0x41, 0x40, 0x40, 0x0a, 0x0f, ++ 0x41, 0x47, 0x40, 0x0e, 0x4d, 0x47, 0x40, 0x0c, 0x0c, 0x07, 0x07, 0x09, 0x2f, 0x11, 0x0d, 0x07, ++ 0x54, 0x27, 0x0a, 0x11, 0x40, 0x01, 0x0c, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4a, 0x4c, 0x42, 0x4c, ++ 0x4d, 0x45, 0x4a, 0x54, 0x54, 0x47, 0x4a, 0x52, 0x54, 0x54, 0x47, 0x03, 0x05, 0x02, 0x4a, 0x4c, ++ 0x42, 0x4c, 0x4d, 0x45, 0x4a, 0x54, 0x54, 0x47, 0x4a, 0x52, 0x54, 0x54, 0x47, 0x03, 0x05, 0x02, ++ 0x15, 0x49, 0x0f, 0x40, 0x46, 0x40, 0x41, 0x07, 0x41, 0x05, 0x05, 0x40, 0x42, 0x19, 0x0a, 0x49, ++ 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x46, ++ 0x07, 0x06, 0x06, 0x0d, 0x15, 0x0d, 0x15, 0x11, 0x17, 0x0a, 0x49, 0x17, 0x0a, 0x49, 0x40, 0x40, ++ 0x40, 0x1c, 0x11, 0x11, 0x40, 0x0f, 0x11, 0x12, 0x12, 0x26, 0x27, 0x16, 0x07, 0x15, 0x16, 0x0d, ++ 0x01, 0x35, 0x19, 0x11, 0x40, 0x0f, 0x11, 0x12, 0x0b, 0x11, 0x12, 0x0b, 0x0b, 0x11, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x0c, 0x41, 0x52, 0x40, 0x13, 0x45, 0x4c, 0x26, 0x40, 0x41, 0x40, 0x40, 0x0a, 0x0f, ++ 0x41, 0x45, 0x40, 0x0e, 0x4c, 0x45, 0x01, 0x0e, 0x0e, 0x07, 0x07, 0x09, 0x2d, 0x11, 0x0d, 0x07, ++ 0x53, 0x27, 0x0b, 0x11, 0x40, 0x01, 0x0b, 0x40, 0x40, 0x40, 0x41, 0x41, 0x4a, 0x4b, 0x42, 0x4b, ++ 0x4c, 0x44, 0x4a, 0x53, 0x53, 0x45, 0x4a, 0x52, 0x53, 0x53, 0x45, 0x04, 0x05, 0x03, 0x4a, 0x4b, ++ 0x42, 0x4b, 0x4c, 0x44, 0x4a, 0x53, 0x53, 0x45, 0x4a, 0x52, 0x53, 0x53, 0x45, 0x04, 0x05, 0x03, ++ 0x15, 0x49, 0x11, 0x40, 0x46, 0x40, 0x41, 0x07, 0x41, 0x05, 0x05, 0x01, 0x42, 0x19, 0x0a, 0x49, ++ 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x19, 0x0a, 0x49, 0x16, 0x07, 0x40, 0x46, ++ 0x07, 0x06, 0x06, 0x0d, 0x15, 0x0d, 0x15, 0x11, 0x17, 0x0a, 0x49, 0x17, 0x0a, 0x49, 0x40, 0x40, ++ 0x40, 0x1b, 0x11, 0x11, 0x40, 0x0f, 0x11, 0x12, 0x12, 0x26, 0x27, 0x16, 0x07, 0x15, 0x16, 0x0d, ++ 0x01, 0x34, 0x19, 0x11, 0x40, 0x0f, 0x11, 0x12, 0x0c, 0x11, 0x13, 0x0c, 0x0c, 0x11, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x0d, 0x40, 0x51, 0x40, 0x12, 0x46, 0x4d, 0x27, 0x40, 0x40, 0x40, 0x40, 0x09, 0x0f, ++ 0x40, 0x44, 0x40, 0x0f, 0x4b, 0x44, 0x03, 0x11, 0x11, 0x07, 0x07, 0x08, 0x2c, 0x10, 0x0e, 0x07, ++ 0x52, 0x27, 0x0c, 0x10, 0x40, 0x00, 0x0a, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x4a, 0x41, 0x4a, ++ 0x4b, 0x43, 0x49, 0x52, 0x52, 0x44, 0x49, 0x51, 0x52, 0x52, 0x44, 0x05, 0x06, 0x04, 0x49, 0x4a, ++ 0x41, 0x4a, 0x4b, 0x43, 0x49, 0x52, 0x52, 0x44, 0x49, 0x51, 0x52, 0x52, 0x44, 0x05, 0x06, 0x04, ++ 0x16, 0x48, 0x13, 0x40, 0x47, 0x40, 0x40, 0x07, 0x40, 0x06, 0x06, 0x03, 0x41, 0x18, 0x09, 0x48, ++ 0x17, 0x07, 0x40, 0x18, 0x09, 0x48, 0x17, 0x07, 0x40, 0x18, 0x09, 0x48, 0x17, 0x07, 0x40, 0x47, ++ 0x07, 0x07, 0x07, 0x0e, 0x16, 0x0e, 0x16, 0x10, 0x17, 0x09, 0x48, 0x17, 0x09, 0x48, 0x40, 0x40, ++ 0x40, 0x1a, 0x10, 0x10, 0x40, 0x0f, 0x10, 0x11, 0x11, 0x27, 0x27, 0x17, 0x07, 0x16, 0x17, 0x0e, ++ 0x00, 0x33, 0x18, 0x10, 0x40, 0x0f, 0x10, 0x11, 0x0d, 0x10, 0x14, 0x0d, 0x0d, 0x10, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x0e, 0x40, 0x51, 0x40, 0x11, 0x47, 0x4e, 0x27, 0x40, 0x40, 0x40, 0x40, 0x08, 0x0f, ++ 0x40, 0x42, 0x40, 0x0f, 0x4a, 0x42, 0x04, 0x13, 0x13, 0x07, 0x07, 0x08, 0x2a, 0x10, 0x0e, 0x07, ++ 0x51, 0x27, 0x0d, 0x10, 0x40, 0x00, 0x09, 0x40, 0x40, 0x40, 0x40, 0x40, 0x49, 0x49, 0x41, 0x49, ++ 0x4a, 0x42, 0x49, 0x51, 0x51, 0x42, 0x49, 0x51, 0x51, 0x51, 0x42, 0x06, 0x06, 0x05, 0x49, 0x49, ++ 0x41, 0x49, 0x4a, 0x42, 0x49, 0x51, 0x51, 0x42, 0x49, 0x51, 0x51, 0x51, 0x42, 0x06, 0x06, 0x05, ++ 0x16, 0x48, 0x14, 0x40, 0x47, 0x40, 0x40, 0x07, 0x40, 0x06, 0x06, 0x04, 0x41, 0x18, 0x08, 0x48, ++ 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x47, ++ 0x07, 0x07, 0x07, 0x0e, 0x16, 0x0e, 0x16, 0x10, 0x17, 0x08, 0x48, 0x17, 0x08, 0x48, 0x40, 0x40, ++ 0x40, 0x19, 0x10, 0x10, 0x40, 0x0f, 0x10, 0x10, 0x10, 0x27, 0x27, 0x17, 0x07, 0x16, 0x17, 0x0e, ++ 0x00, 0x31, 0x18, 0x10, 0x40, 0x0f, 0x10, 0x10, 0x0e, 0x10, 0x15, 0x0e, 0x0e, 0x10, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x0f, 0x40, 0x50, 0x40, 0x10, 0x47, 0x4f, 0x27, 0x40, 0x40, 0x40, 0x40, 0x08, 0x0f, ++ 0x40, 0x40, 0x40, 0x0f, 0x48, 0x40, 0x06, 0x16, 0x16, 0x07, 0x07, 0x08, 0x28, 0x10, 0x0f, 0x07, ++ 0x50, 0x27, 0x0f, 0x10, 0x40, 0x00, 0x08, 0x40, 0x40, 0x40, 0x40, 0x40, 0x48, 0x48, 0x40, 0x48, ++ 0x48, 0x40, 0x48, 0x50, 0x50, 0x40, 0x48, 0x50, 0x50, 0x50, 0x40, 0x07, 0x07, 0x07, 0x48, 0x48, ++ 0x40, 0x48, 0x48, 0x40, 0x48, 0x50, 0x50, 0x40, 0x48, 0x50, 0x50, 0x50, 0x40, 0x07, 0x07, 0x07, ++ 0x17, 0x48, 0x16, 0x40, 0x47, 0x40, 0x40, 0x07, 0x40, 0x07, 0x07, 0x06, 0x40, 0x18, 0x08, 0x48, ++ 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x18, 0x08, 0x48, 0x17, 0x07, 0x40, 0x47, ++ 0x07, 0x07, 0x07, 0x0f, 0x17, 0x0f, 0x17, 0x10, 0x17, 0x08, 0x48, 0x17, 0x08, 0x48, 0x40, 0x40, ++ 0x40, 0x18, 0x10, 0x10, 0x40, 0x0f, 0x10, 0x10, 0x10, 0x27, 0x27, 0x17, 0x07, 0x17, 0x17, 0x0f, ++ 0x00, 0x30, 0x18, 0x10, 0x40, 0x0f, 0x10, 0x10, 0x0f, 0x10, 0x17, 0x0f, 0x0f, 0x10, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x10, 0x00, 0x4f, 0x40, 0x0f, 0x48, 0x50, 0x28, 0x40, 0x00, 0x40, 0x40, 0x07, 0x0f, ++ 0x00, 0x00, 0x40, 0x10, 0x47, 0x00, 0x08, 0x18, 0x18, 0x07, 0x07, 0x07, 0x27, 0x0f, 0x10, 0x07, ++ 0x4f, 0x27, 0x10, 0x0f, 0x40, 0x40, 0x07, 0x40, 0x40, 0x40, 0x00, 0x00, 0x47, 0x47, 0x00, 0x47, ++ 0x47, 0x00, 0x47, 0x4f, 0x4f, 0x00, 0x47, 0x4f, 0x4f, 0x4f, 0x00, 0x08, 0x08, 0x08, 0x47, 0x47, ++ 0x00, 0x47, 0x47, 0x00, 0x47, 0x4f, 0x4f, 0x00, 0x47, 0x4f, 0x4f, 0x4f, 0x00, 0x08, 0x08, 0x08, ++ 0x18, 0x47, 0x18, 0x40, 0x48, 0x40, 0x00, 0x07, 0x00, 0x08, 0x08, 0x08, 0x00, 0x17, 0x07, 0x47, ++ 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x48, ++ 0x07, 0x08, 0x08, 0x10, 0x18, 0x10, 0x18, 0x0f, 0x17, 0x07, 0x47, 0x17, 0x07, 0x47, 0x40, 0x40, ++ 0x40, 0x17, 0x0f, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, 0x0f, 0x28, 0x27, 0x18, 0x07, 0x18, 0x18, 0x10, ++ 0x40, 0x2f, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, 0x10, 0x0f, 0x18, 0x10, 0x10, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x11, 0x00, 0x4f, 0x40, 0x0e, 0x48, 0x51, 0x28, 0x40, 0x00, 0x40, 0x40, 0x07, 0x0f, ++ 0x00, 0x02, 0x40, 0x10, 0x46, 0x02, 0x0a, 0x1b, 0x1b, 0x07, 0x07, 0x07, 0x25, 0x0f, 0x10, 0x07, ++ 0x4e, 0x27, 0x11, 0x0f, 0x40, 0x40, 0x06, 0x40, 0x40, 0x40, 0x00, 0x00, 0x47, 0x46, 0x00, 0x46, ++ 0x46, 0x01, 0x47, 0x4e, 0x4e, 0x02, 0x47, 0x4f, 0x4e, 0x4e, 0x02, 0x09, 0x08, 0x09, 0x47, 0x46, ++ 0x00, 0x46, 0x46, 0x01, 0x47, 0x4e, 0x4e, 0x02, 0x47, 0x4f, 0x4e, 0x4e, 0x02, 0x09, 0x08, 0x09, ++ 0x18, 0x47, 0x1a, 0x40, 0x48, 0x40, 0x00, 0x07, 0x00, 0x08, 0x08, 0x0a, 0x00, 0x17, 0x07, 0x47, ++ 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x17, 0x07, 0x47, 0x18, 0x07, 0x40, 0x48, ++ 0x07, 0x08, 0x08, 0x10, 0x18, 0x10, 0x18, 0x0f, 0x17, 0x07, 0x47, 0x17, 0x07, 0x47, 0x40, 0x40, ++ 0x40, 0x16, 0x0f, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, 0x0f, 0x28, 0x27, 0x18, 0x07, 0x18, 0x18, 0x10, ++ 0x40, 0x2e, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x0f, 0x11, 0x0f, 0x19, 0x11, 0x11, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x12, 0x00, 0x4e, 0x40, 0x0d, 0x49, 0x52, 0x28, 0x40, 0x00, 0x40, 0x40, 0x06, 0x0f, ++ 0x00, 0x03, 0x40, 0x10, 0x45, 0x03, 0x0c, 0x1d, 0x1d, 0x07, 0x07, 0x07, 0x24, 0x0f, 0x11, 0x07, ++ 0x4d, 0x27, 0x12, 0x0f, 0x40, 0x40, 0x05, 0x40, 0x40, 0x40, 0x00, 0x00, 0x46, 0x45, 0x01, 0x45, ++ 0x45, 0x02, 0x46, 0x4d, 0x4d, 0x03, 0x46, 0x4e, 0x4d, 0x4d, 0x03, 0x0a, 0x09, 0x0a, 0x46, 0x45, ++ 0x01, 0x45, 0x45, 0x02, 0x46, 0x4d, 0x4d, 0x03, 0x46, 0x4e, 0x4d, 0x4d, 0x03, 0x0a, 0x09, 0x0a, ++ 0x19, 0x47, 0x1c, 0x40, 0x48, 0x40, 0x00, 0x07, 0x00, 0x09, 0x09, 0x0c, 0x01, 0x17, 0x06, 0x47, ++ 0x18, 0x07, 0x40, 0x17, 0x06, 0x47, 0x18, 0x07, 0x40, 0x17, 0x06, 0x47, 0x18, 0x07, 0x40, 0x48, ++ 0x07, 0x08, 0x08, 0x11, 0x19, 0x11, 0x19, 0x0f, 0x17, 0x06, 0x47, 0x17, 0x06, 0x47, 0x40, 0x40, ++ 0x40, 0x15, 0x0f, 0x0f, 0x40, 0x0f, 0x0f, 0x0e, 0x0e, 0x28, 0x27, 0x18, 0x07, 0x19, 0x18, 0x11, ++ 0x40, 0x2c, 0x17, 0x0f, 0x40, 0x0f, 0x0f, 0x0e, 0x12, 0x0f, 0x1a, 0x12, 0x12, 0x0f, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x13, 0x01, 0x4d, 0x40, 0x0c, 0x4a, 0x53, 0x29, 0x40, 0x01, 0x40, 0x40, 0x05, 0x0f, ++ 0x01, 0x05, 0x40, 0x11, 0x43, 0x05, 0x0e, 0x20, 0x20, 0x07, 0x07, 0x06, 0x22, 0x0e, 0x12, 0x07, ++ 0x4c, 0x27, 0x14, 0x0e, 0x40, 0x41, 0x04, 0x40, 0x40, 0x40, 0x01, 0x01, 0x45, 0x44, 0x02, 0x44, ++ 0x43, 0x04, 0x45, 0x4c, 0x4c, 0x05, 0x45, 0x4d, 0x4c, 0x4c, 0x05, 0x0b, 0x0a, 0x0c, 0x45, 0x44, ++ 0x02, 0x44, 0x43, 0x04, 0x45, 0x4c, 0x4c, 0x05, 0x45, 0x4d, 0x4c, 0x4c, 0x05, 0x0b, 0x0a, 0x0c, ++ 0x1a, 0x46, 0x1e, 0x40, 0x49, 0x40, 0x01, 0x07, 0x01, 0x0a, 0x0a, 0x0e, 0x02, 0x16, 0x05, 0x46, ++ 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x49, ++ 0x07, 0x09, 0x09, 0x12, 0x1a, 0x12, 0x1a, 0x0e, 0x17, 0x05, 0x46, 0x17, 0x05, 0x46, 0x40, 0x40, ++ 0x40, 0x14, 0x0e, 0x0e, 0x40, 0x0f, 0x0e, 0x0d, 0x0d, 0x29, 0x27, 0x19, 0x07, 0x1a, 0x19, 0x12, ++ 0x41, 0x2b, 0x16, 0x0e, 0x40, 0x0f, 0x0e, 0x0d, 0x13, 0x0e, 0x1c, 0x13, 0x13, 0x0e, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x14, 0x01, 0x4d, 0x40, 0x0b, 0x4a, 0x54, 0x29, 0x40, 0x01, 0x40, 0x40, 0x05, 0x0f, ++ 0x01, 0x06, 0x40, 0x11, 0x42, 0x06, 0x10, 0x22, 0x22, 0x07, 0x07, 0x06, 0x21, 0x0e, 0x12, 0x07, ++ 0x4b, 0x27, 0x15, 0x0e, 0x40, 0x41, 0x03, 0x40, 0x40, 0x40, 0x01, 0x01, 0x45, 0x43, 0x02, 0x43, ++ 0x42, 0x05, 0x45, 0x4b, 0x4b, 0x06, 0x45, 0x4d, 0x4b, 0x4b, 0x06, 0x0c, 0x0a, 0x0d, 0x45, 0x43, ++ 0x02, 0x43, 0x42, 0x05, 0x45, 0x4b, 0x4b, 0x06, 0x45, 0x4d, 0x4b, 0x4b, 0x06, 0x0c, 0x0a, 0x0d, ++ 0x1a, 0x46, 0x20, 0x40, 0x49, 0x40, 0x01, 0x07, 0x01, 0x0a, 0x0a, 0x10, 0x02, 0x16, 0x05, 0x46, ++ 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x16, 0x05, 0x46, 0x19, 0x07, 0x40, 0x49, ++ 0x07, 0x09, 0x09, 0x12, 0x1a, 0x12, 0x1a, 0x0e, 0x17, 0x05, 0x46, 0x17, 0x05, 0x46, 0x40, 0x40, ++ 0x40, 0x13, 0x0e, 0x0e, 0x40, 0x0f, 0x0e, 0x0d, 0x0d, 0x29, 0x27, 0x19, 0x07, 0x1a, 0x19, 0x12, ++ 0x41, 0x2a, 0x16, 0x0e, 0x40, 0x0f, 0x0e, 0x0d, 0x14, 0x0e, 0x1d, 0x14, 0x14, 0x0e, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x15, 0x01, 0x4c, 0x40, 0x0a, 0x4b, 0x55, 0x29, 0x40, 0x01, 0x40, 0x40, 0x04, 0x0f, ++ 0x01, 0x08, 0x40, 0x11, 0x41, 0x08, 0x12, 0x25, 0x25, 0x07, 0x07, 0x06, 0x1f, 0x0e, 0x13, 0x07, ++ 0x4a, 0x27, 0x16, 0x0e, 0x40, 0x41, 0x02, 0x40, 0x40, 0x40, 0x01, 0x01, 0x44, 0x42, 0x03, 0x42, ++ 0x41, 0x06, 0x44, 0x4a, 0x4a, 0x08, 0x44, 0x4c, 0x4a, 0x4a, 0x08, 0x0d, 0x0b, 0x0e, 0x44, 0x42, ++ 0x03, 0x42, 0x41, 0x06, 0x44, 0x4a, 0x4a, 0x08, 0x44, 0x4c, 0x4a, 0x4a, 0x08, 0x0d, 0x0b, 0x0e, ++ 0x1b, 0x46, 0x22, 0x40, 0x49, 0x40, 0x01, 0x07, 0x01, 0x0b, 0x0b, 0x12, 0x03, 0x16, 0x04, 0x46, ++ 0x19, 0x07, 0x40, 0x16, 0x04, 0x46, 0x19, 0x07, 0x40, 0x16, 0x04, 0x46, 0x19, 0x07, 0x40, 0x49, ++ 0x07, 0x09, 0x09, 0x13, 0x1b, 0x13, 0x1b, 0x0e, 0x17, 0x04, 0x46, 0x17, 0x04, 0x46, 0x40, 0x40, ++ 0x40, 0x12, 0x0e, 0x0e, 0x40, 0x0f, 0x0e, 0x0c, 0x0c, 0x29, 0x27, 0x19, 0x07, 0x1b, 0x19, 0x13, ++ 0x41, 0x29, 0x16, 0x0e, 0x40, 0x0f, 0x0e, 0x0c, 0x15, 0x0e, 0x1e, 0x15, 0x15, 0x0e, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x15, 0x01, 0x4c, 0x40, 0x09, 0x4c, 0x56, 0x29, 0x40, 0x01, 0x40, 0x40, 0x03, 0x0f, ++ 0x01, 0x09, 0x40, 0x11, 0x40, 0x09, 0x13, 0x27, 0x27, 0x07, 0x07, 0x05, 0x1d, 0x0d, 0x13, 0x07, ++ 0x4a, 0x27, 0x17, 0x0d, 0x40, 0x42, 0x01, 0x40, 0x40, 0x40, 0x01, 0x01, 0x44, 0x42, 0x03, 0x42, ++ 0x40, 0x07, 0x44, 0x4a, 0x4a, 0x09, 0x44, 0x4c, 0x4a, 0x4a, 0x09, 0x0d, 0x0b, 0x0f, 0x44, 0x42, ++ 0x03, 0x42, 0x40, 0x07, 0x44, 0x4a, 0x4a, 0x09, 0x44, 0x4c, 0x4a, 0x4a, 0x09, 0x0d, 0x0b, 0x0f, ++ 0x1b, 0x46, 0x23, 0x40, 0x4a, 0x40, 0x01, 0x07, 0x01, 0x0b, 0x0b, 0x13, 0x03, 0x15, 0x03, 0x46, ++ 0x19, 0x07, 0x40, 0x15, 0x03, 0x46, 0x19, 0x07, 0x40, 0x15, 0x03, 0x46, 0x19, 0x07, 0x40, 0x4a, ++ 0x07, 0x09, 0x09, 0x13, 0x1b, 0x13, 0x1b, 0x0d, 0x17, 0x03, 0x46, 0x17, 0x03, 0x46, 0x40, 0x40, ++ 0x40, 0x11, 0x0d, 0x0d, 0x40, 0x0f, 0x0d, 0x0b, 0x0b, 0x29, 0x27, 0x19, 0x07, 0x1b, 0x19, 0x13, ++ 0x42, 0x27, 0x15, 0x0d, 0x40, 0x0f, 0x0d, 0x0b, 0x15, 0x0d, 0x1f, 0x15, 0x15, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x16, 0x02, 0x4b, 0x40, 0x09, 0x4c, 0x56, 0x2a, 0x40, 0x02, 0x40, 0x40, 0x03, 0x0f, ++ 0x02, 0x0b, 0x40, 0x12, 0x01, 0x0b, 0x15, 0x2a, 0x2a, 0x07, 0x07, 0x05, 0x1c, 0x0d, 0x14, 0x07, ++ 0x49, 0x27, 0x19, 0x0d, 0x40, 0x42, 0x01, 0x40, 0x40, 0x40, 0x02, 0x02, 0x43, 0x41, 0x04, 0x41, ++ 0x01, 0x09, 0x43, 0x49, 0x49, 0x0b, 0x43, 0x4b, 0x49, 0x49, 0x0b, 0x0e, 0x0c, 0x11, 0x43, 0x41, ++ 0x04, 0x41, 0x01, 0x09, 0x43, 0x49, 0x49, 0x0b, 0x43, 0x4b, 0x49, 0x49, 0x0b, 0x0e, 0x0c, 0x11, ++ 0x1c, 0x45, 0x25, 0x40, 0x4a, 0x40, 0x02, 0x07, 0x02, 0x0c, 0x0c, 0x15, 0x04, 0x15, 0x03, 0x45, ++ 0x1a, 0x07, 0x40, 0x15, 0x03, 0x45, 0x1a, 0x07, 0x40, 0x15, 0x03, 0x45, 0x1a, 0x07, 0x40, 0x4a, ++ 0x07, 0x0a, 0x0a, 0x14, 0x1c, 0x14, 0x1c, 0x0d, 0x17, 0x03, 0x45, 0x17, 0x03, 0x45, 0x40, 0x40, ++ 0x40, 0x11, 0x0d, 0x0d, 0x40, 0x0f, 0x0d, 0x0b, 0x0b, 0x2a, 0x27, 0x1a, 0x07, 0x1c, 0x1a, 0x14, ++ 0x42, 0x26, 0x15, 0x0d, 0x40, 0x0f, 0x0d, 0x0b, 0x16, 0x0d, 0x21, 0x16, 0x16, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x17, 0x02, 0x4a, 0x40, 0x08, 0x4d, 0x57, 0x2a, 0x40, 0x02, 0x40, 0x40, 0x02, 0x0f, ++ 0x02, 0x0d, 0x40, 0x12, 0x02, 0x0d, 0x17, 0x2c, 0x2c, 0x07, 0x07, 0x05, 0x1a, 0x0d, 0x15, 0x07, ++ 0x48, 0x27, 0x1a, 0x0d, 0x40, 0x42, 0x00, 0x40, 0x40, 0x40, 0x02, 0x02, 0x42, 0x40, 0x05, 0x40, ++ 0x02, 0x0a, 0x42, 0x48, 0x48, 0x0d, 0x42, 0x4a, 0x48, 0x48, 0x0d, 0x0f, 0x0d, 0x12, 0x42, 0x40, ++ 0x05, 0x40, 0x02, 0x0a, 0x42, 0x48, 0x48, 0x0d, 0x42, 0x4a, 0x48, 0x48, 0x0d, 0x0f, 0x0d, 0x12, ++ 0x1d, 0x45, 0x27, 0x40, 0x4a, 0x40, 0x02, 0x07, 0x02, 0x0d, 0x0d, 0x17, 0x05, 0x15, 0x02, 0x45, ++ 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x4a, ++ 0x07, 0x0a, 0x0a, 0x15, 0x1d, 0x15, 0x1d, 0x0d, 0x17, 0x02, 0x45, 0x17, 0x02, 0x45, 0x40, 0x40, ++ 0x40, 0x10, 0x0d, 0x0d, 0x40, 0x0f, 0x0d, 0x0a, 0x0a, 0x2a, 0x27, 0x1a, 0x07, 0x1d, 0x1a, 0x15, ++ 0x42, 0x25, 0x15, 0x0d, 0x40, 0x0f, 0x0d, 0x0a, 0x17, 0x0d, 0x22, 0x17, 0x17, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x18, 0x02, 0x4a, 0x40, 0x07, 0x4d, 0x58, 0x2a, 0x40, 0x02, 0x40, 0x40, 0x02, 0x0f, ++ 0x02, 0x0e, 0x40, 0x12, 0x03, 0x0e, 0x19, 0x2f, 0x2f, 0x07, 0x07, 0x05, 0x19, 0x0d, 0x15, 0x07, ++ 0x47, 0x27, 0x1b, 0x0d, 0x40, 0x42, 0x40, 0x40, 0x40, 0x40, 0x02, 0x02, 0x42, 0x00, 0x05, 0x00, ++ 0x03, 0x0b, 0x42, 0x47, 0x47, 0x0e, 0x42, 0x4a, 0x47, 0x47, 0x0e, 0x10, 0x0d, 0x13, 0x42, 0x00, ++ 0x05, 0x00, 0x03, 0x0b, 0x42, 0x47, 0x47, 0x0e, 0x42, 0x4a, 0x47, 0x47, 0x0e, 0x10, 0x0d, 0x13, ++ 0x1d, 0x45, 0x29, 0x40, 0x4a, 0x40, 0x02, 0x07, 0x02, 0x0d, 0x0d, 0x19, 0x05, 0x15, 0x02, 0x45, ++ 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x15, 0x02, 0x45, 0x1a, 0x07, 0x40, 0x4a, ++ 0x07, 0x0a, 0x0a, 0x15, 0x1d, 0x15, 0x1d, 0x0d, 0x17, 0x02, 0x45, 0x17, 0x02, 0x45, 0x40, 0x40, ++ 0x40, 0x0f, 0x0d, 0x0d, 0x40, 0x0f, 0x0d, 0x0a, 0x0a, 0x2a, 0x27, 0x1a, 0x07, 0x1d, 0x1a, 0x15, ++ 0x42, 0x24, 0x15, 0x0d, 0x40, 0x0f, 0x0d, 0x0a, 0x18, 0x0d, 0x23, 0x18, 0x18, 0x0d, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x19, 0x03, 0x49, 0x40, 0x06, 0x4e, 0x59, 0x2b, 0x40, 0x03, 0x40, 0x40, 0x01, 0x0f, ++ 0x03, 0x10, 0x40, 0x13, 0x04, 0x10, 0x1b, 0x31, 0x31, 0x07, 0x07, 0x04, 0x17, 0x0c, 0x16, 0x07, ++ 0x46, 0x27, 0x1c, 0x0c, 0x40, 0x43, 0x41, 0x40, 0x40, 0x40, 0x03, 0x03, 0x41, 0x01, 0x06, 0x01, ++ 0x04, 0x0c, 0x41, 0x46, 0x46, 0x10, 0x41, 0x49, 0x46, 0x46, 0x10, 0x11, 0x0e, 0x14, 0x41, 0x01, ++ 0x06, 0x01, 0x04, 0x0c, 0x41, 0x46, 0x46, 0x10, 0x41, 0x49, 0x46, 0x46, 0x10, 0x11, 0x0e, 0x14, ++ 0x1e, 0x44, 0x2b, 0x40, 0x4b, 0x40, 0x03, 0x07, 0x03, 0x0e, 0x0e, 0x1b, 0x06, 0x14, 0x01, 0x44, ++ 0x1b, 0x07, 0x40, 0x14, 0x01, 0x44, 0x1b, 0x07, 0x40, 0x14, 0x01, 0x44, 0x1b, 0x07, 0x40, 0x4b, ++ 0x07, 0x0b, 0x0b, 0x16, 0x1e, 0x16, 0x1e, 0x0c, 0x17, 0x01, 0x44, 0x17, 0x01, 0x44, 0x40, 0x40, ++ 0x40, 0x0e, 0x0c, 0x0c, 0x40, 0x0f, 0x0c, 0x09, 0x09, 0x2b, 0x27, 0x1b, 0x07, 0x1e, 0x1b, 0x16, ++ 0x43, 0x22, 0x14, 0x0c, 0x40, 0x0f, 0x0c, 0x09, 0x19, 0x0c, 0x24, 0x19, 0x19, 0x0c, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x1a, 0x03, 0x48, 0x40, 0x05, 0x4f, 0x5a, 0x2b, 0x40, 0x03, 0x40, 0x40, 0x00, 0x0f, ++ 0x03, 0x11, 0x40, 0x13, 0x06, 0x11, 0x1d, 0x34, 0x34, 0x07, 0x07, 0x04, 0x16, 0x0c, 0x17, 0x07, ++ 0x45, 0x27, 0x1e, 0x0c, 0x40, 0x43, 0x42, 0x40, 0x40, 0x40, 0x03, 0x03, 0x40, 0x02, 0x07, 0x02, ++ 0x06, 0x0e, 0x40, 0x45, 0x45, 0x11, 0x40, 0x48, 0x45, 0x45, 0x11, 0x12, 0x0f, 0x16, 0x40, 0x02, ++ 0x07, 0x02, 0x06, 0x0e, 0x40, 0x45, 0x45, 0x11, 0x40, 0x48, 0x45, 0x45, 0x11, 0x12, 0x0f, 0x16, ++ 0x1f, 0x44, 0x2d, 0x40, 0x4b, 0x40, 0x03, 0x07, 0x03, 0x0f, 0x0f, 0x1d, 0x07, 0x14, 0x00, 0x44, ++ 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x4b, ++ 0x07, 0x0b, 0x0b, 0x17, 0x1f, 0x17, 0x1f, 0x0c, 0x17, 0x00, 0x44, 0x17, 0x00, 0x44, 0x40, 0x40, ++ 0x40, 0x0d, 0x0c, 0x0c, 0x40, 0x0f, 0x0c, 0x08, 0x08, 0x2b, 0x27, 0x1b, 0x07, 0x1f, 0x1b, 0x17, ++ 0x43, 0x21, 0x14, 0x0c, 0x40, 0x0f, 0x0c, 0x08, 0x1a, 0x0c, 0x26, 0x1a, 0x1a, 0x0c, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x1b, 0x03, 0x48, 0x40, 0x04, 0x4f, 0x5b, 0x2b, 0x40, 0x03, 0x40, 0x40, 0x00, 0x0f, ++ 0x03, 0x13, 0x40, 0x13, 0x07, 0x13, 0x1f, 0x36, 0x36, 0x07, 0x07, 0x04, 0x14, 0x0c, 0x17, 0x07, ++ 0x44, 0x27, 0x1f, 0x0c, 0x40, 0x43, 0x43, 0x40, 0x40, 0x40, 0x03, 0x03, 0x40, 0x03, 0x07, 0x03, ++ 0x07, 0x0f, 0x40, 0x44, 0x44, 0x13, 0x40, 0x48, 0x44, 0x44, 0x13, 0x13, 0x0f, 0x17, 0x40, 0x03, ++ 0x07, 0x03, 0x07, 0x0f, 0x40, 0x44, 0x44, 0x13, 0x40, 0x48, 0x44, 0x44, 0x13, 0x13, 0x0f, 0x17, ++ 0x1f, 0x44, 0x2f, 0x40, 0x4b, 0x40, 0x03, 0x07, 0x03, 0x0f, 0x0f, 0x1f, 0x07, 0x14, 0x00, 0x44, ++ 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x14, 0x00, 0x44, 0x1b, 0x07, 0x40, 0x4b, ++ 0x07, 0x0b, 0x0b, 0x17, 0x1f, 0x17, 0x1f, 0x0c, 0x17, 0x00, 0x44, 0x17, 0x00, 0x44, 0x40, 0x40, ++ 0x40, 0x0c, 0x0c, 0x0c, 0x40, 0x0f, 0x0c, 0x08, 0x08, 0x2b, 0x27, 0x1b, 0x07, 0x1f, 0x1b, 0x17, ++ 0x43, 0x20, 0x14, 0x0c, 0x40, 0x0f, 0x0c, 0x08, 0x1b, 0x0c, 0x27, 0x1b, 0x1b, 0x0c, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x1c, 0x04, 0x47, 0x40, 0x03, 0x50, 0x5c, 0x2c, 0x40, 0x04, 0x40, 0x40, 0x40, 0x0f, ++ 0x04, 0x14, 0x40, 0x14, 0x08, 0x14, 0x21, 0x39, 0x39, 0x07, 0x07, 0x03, 0x13, 0x0b, 0x18, 0x07, ++ 0x43, 0x27, 0x20, 0x0b, 0x40, 0x44, 0x44, 0x40, 0x40, 0x40, 0x04, 0x04, 0x00, 0x04, 0x08, 0x04, ++ 0x08, 0x10, 0x00, 0x43, 0x43, 0x14, 0x00, 0x47, 0x43, 0x43, 0x14, 0x14, 0x10, 0x18, 0x00, 0x04, ++ 0x08, 0x04, 0x08, 0x10, 0x00, 0x43, 0x43, 0x14, 0x00, 0x47, 0x43, 0x43, 0x14, 0x14, 0x10, 0x18, ++ 0x20, 0x43, 0x31, 0x40, 0x4c, 0x40, 0x04, 0x07, 0x04, 0x10, 0x10, 0x21, 0x08, 0x13, 0x40, 0x43, ++ 0x1c, 0x07, 0x40, 0x13, 0x40, 0x43, 0x1c, 0x07, 0x40, 0x13, 0x40, 0x43, 0x1c, 0x07, 0x40, 0x4c, ++ 0x07, 0x0c, 0x0c, 0x18, 0x20, 0x18, 0x20, 0x0b, 0x17, 0x40, 0x43, 0x17, 0x40, 0x43, 0x40, 0x40, ++ 0x40, 0x0b, 0x0b, 0x0b, 0x40, 0x0f, 0x0b, 0x07, 0x07, 0x2c, 0x27, 0x1c, 0x07, 0x20, 0x1c, 0x18, ++ 0x44, 0x1f, 0x13, 0x0b, 0x40, 0x0f, 0x0b, 0x07, 0x1c, 0x0b, 0x28, 0x1c, 0x1c, 0x0b, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x1d, 0x04, 0x47, 0x40, 0x02, 0x51, 0x5d, 0x2c, 0x40, 0x04, 0x40, 0x40, 0x41, 0x0f, ++ 0x04, 0x16, 0x40, 0x14, 0x09, 0x16, 0x22, 0x3b, 0x3b, 0x07, 0x07, 0x03, 0x11, 0x0b, 0x18, 0x07, ++ 0x42, 0x27, 0x21, 0x0b, 0x40, 0x44, 0x45, 0x40, 0x40, 0x40, 0x04, 0x04, 0x00, 0x05, 0x08, 0x05, ++ 0x09, 0x11, 0x00, 0x42, 0x42, 0x16, 0x00, 0x47, 0x42, 0x42, 0x16, 0x15, 0x10, 0x19, 0x00, 0x05, ++ 0x08, 0x05, 0x09, 0x11, 0x00, 0x42, 0x42, 0x16, 0x00, 0x47, 0x42, 0x42, 0x16, 0x15, 0x10, 0x19, ++ 0x20, 0x43, 0x32, 0x40, 0x4c, 0x40, 0x04, 0x07, 0x04, 0x10, 0x10, 0x22, 0x08, 0x13, 0x41, 0x43, ++ 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x4c, ++ 0x07, 0x0c, 0x0c, 0x18, 0x20, 0x18, 0x20, 0x0b, 0x17, 0x41, 0x43, 0x17, 0x41, 0x43, 0x40, 0x40, ++ 0x40, 0x0a, 0x0b, 0x0b, 0x40, 0x0f, 0x0b, 0x06, 0x06, 0x2c, 0x27, 0x1c, 0x07, 0x20, 0x1c, 0x18, ++ 0x44, 0x1d, 0x13, 0x0b, 0x40, 0x0f, 0x0b, 0x06, 0x1d, 0x0b, 0x29, 0x1d, 0x1d, 0x0b, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x1e, 0x04, 0x46, 0x40, 0x01, 0x51, 0x5e, 0x2c, 0x40, 0x04, 0x40, 0x40, 0x41, 0x0f, ++ 0x04, 0x18, 0x40, 0x14, 0x0b, 0x18, 0x24, 0x3e, 0x3e, 0x07, 0x07, 0x03, 0x0f, 0x0b, 0x19, 0x07, ++ 0x41, 0x27, 0x23, 0x0b, 0x40, 0x44, 0x46, 0x40, 0x40, 0x40, 0x04, 0x04, 0x01, 0x06, 0x09, 0x06, ++ 0x0b, 0x13, 0x01, 0x41, 0x41, 0x18, 0x01, 0x46, 0x41, 0x41, 0x18, 0x16, 0x11, 0x1b, 0x01, 0x06, ++ 0x09, 0x06, 0x0b, 0x13, 0x01, 0x41, 0x41, 0x18, 0x01, 0x46, 0x41, 0x41, 0x18, 0x16, 0x11, 0x1b, ++ 0x21, 0x43, 0x34, 0x40, 0x4c, 0x40, 0x04, 0x07, 0x04, 0x11, 0x11, 0x24, 0x09, 0x13, 0x41, 0x43, ++ 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x13, 0x41, 0x43, 0x1c, 0x07, 0x40, 0x4c, ++ 0x07, 0x0c, 0x0c, 0x19, 0x21, 0x19, 0x21, 0x0b, 0x17, 0x41, 0x43, 0x17, 0x41, 0x43, 0x40, 0x40, ++ 0x40, 0x09, 0x0b, 0x0b, 0x40, 0x0f, 0x0b, 0x06, 0x06, 0x2c, 0x27, 0x1c, 0x07, 0x21, 0x1c, 0x19, ++ 0x44, 0x1c, 0x13, 0x0b, 0x40, 0x0f, 0x0b, 0x06, 0x1e, 0x0b, 0x2b, 0x1e, 0x1e, 0x0b, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x1f, 0x05, 0x45, 0x40, 0x00, 0x52, 0x5f, 0x2d, 0x40, 0x05, 0x40, 0x40, 0x42, 0x0f, ++ 0x05, 0x19, 0x40, 0x15, 0x0c, 0x19, 0x26, 0x3e, 0x3e, 0x07, 0x07, 0x02, 0x0e, 0x0a, 0x1a, 0x07, ++ 0x40, 0x27, 0x24, 0x0a, 0x40, 0x45, 0x47, 0x40, 0x40, 0x40, 0x05, 0x05, 0x02, 0x07, 0x0a, 0x07, ++ 0x0c, 0x14, 0x02, 0x40, 0x40, 0x19, 0x02, 0x45, 0x40, 0x40, 0x19, 0x17, 0x12, 0x1c, 0x02, 0x07, ++ 0x0a, 0x07, 0x0c, 0x14, 0x02, 0x40, 0x40, 0x19, 0x02, 0x45, 0x40, 0x40, 0x19, 0x17, 0x12, 0x1c, ++ 0x22, 0x42, 0x36, 0x40, 0x4d, 0x40, 0x05, 0x07, 0x05, 0x12, 0x12, 0x26, 0x0a, 0x12, 0x42, 0x42, ++ 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x4d, ++ 0x07, 0x0d, 0x0d, 0x1a, 0x22, 0x1a, 0x22, 0x0a, 0x17, 0x42, 0x42, 0x17, 0x42, 0x42, 0x40, 0x40, ++ 0x40, 0x08, 0x0a, 0x0a, 0x40, 0x0f, 0x0a, 0x05, 0x05, 0x2d, 0x27, 0x1d, 0x07, 0x22, 0x1d, 0x1a, ++ 0x45, 0x1b, 0x12, 0x0a, 0x40, 0x0f, 0x0a, 0x05, 0x1f, 0x0a, 0x2c, 0x1f, 0x1f, 0x0a, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x20, 0x05, 0x45, 0x40, 0x40, 0x52, 0x60, 0x2d, 0x40, 0x05, 0x40, 0x40, 0x42, 0x0f, ++ 0x05, 0x1b, 0x40, 0x15, 0x0d, 0x1b, 0x28, 0x3e, 0x3e, 0x07, 0x07, 0x02, 0x0c, 0x0a, 0x1a, 0x07, ++ 0x00, 0x27, 0x25, 0x0a, 0x40, 0x45, 0x48, 0x40, 0x40, 0x40, 0x05, 0x05, 0x02, 0x08, 0x0a, 0x08, ++ 0x0d, 0x15, 0x02, 0x00, 0x00, 0x1b, 0x02, 0x45, 0x00, 0x00, 0x1b, 0x18, 0x12, 0x1d, 0x02, 0x08, ++ 0x0a, 0x08, 0x0d, 0x15, 0x02, 0x00, 0x00, 0x1b, 0x02, 0x45, 0x00, 0x00, 0x1b, 0x18, 0x12, 0x1d, ++ 0x22, 0x42, 0x38, 0x40, 0x4d, 0x40, 0x05, 0x07, 0x05, 0x12, 0x12, 0x28, 0x0a, 0x12, 0x42, 0x42, ++ 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x12, 0x42, 0x42, 0x1d, 0x07, 0x40, 0x4d, ++ 0x07, 0x0d, 0x0d, 0x1a, 0x22, 0x1a, 0x22, 0x0a, 0x17, 0x42, 0x42, 0x17, 0x42, 0x42, 0x40, 0x40, ++ 0x40, 0x07, 0x0a, 0x0a, 0x40, 0x0f, 0x0a, 0x05, 0x05, 0x2d, 0x27, 0x1d, 0x07, 0x22, 0x1d, 0x1a, ++ 0x45, 0x1a, 0x12, 0x0a, 0x40, 0x0f, 0x0a, 0x05, 0x20, 0x0a, 0x2d, 0x20, 0x20, 0x0a, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x21, 0x05, 0x44, 0x40, 0x41, 0x53, 0x61, 0x2d, 0x40, 0x05, 0x40, 0x40, 0x43, 0x0f, ++ 0x05, 0x1c, 0x40, 0x15, 0x0e, 0x1c, 0x2a, 0x3e, 0x3e, 0x07, 0x07, 0x02, 0x0b, 0x0a, 0x1b, 0x07, ++ 0x01, 0x27, 0x26, 0x0a, 0x40, 0x45, 0x49, 0x40, 0x40, 0x40, 0x05, 0x05, 0x03, 0x09, 0x0b, 0x09, ++ 0x0e, 0x16, 0x03, 0x01, 0x01, 0x1c, 0x03, 0x44, 0x01, 0x01, 0x1c, 0x19, 0x13, 0x1e, 0x03, 0x09, ++ 0x0b, 0x09, 0x0e, 0x16, 0x03, 0x01, 0x01, 0x1c, 0x03, 0x44, 0x01, 0x01, 0x1c, 0x19, 0x13, 0x1e, ++ 0x23, 0x42, 0x3a, 0x40, 0x4d, 0x40, 0x05, 0x07, 0x05, 0x13, 0x13, 0x2a, 0x0b, 0x12, 0x43, 0x42, ++ 0x1d, 0x07, 0x40, 0x12, 0x43, 0x42, 0x1d, 0x07, 0x40, 0x12, 0x43, 0x42, 0x1d, 0x07, 0x40, 0x4d, ++ 0x07, 0x0d, 0x0d, 0x1b, 0x23, 0x1b, 0x23, 0x0a, 0x17, 0x43, 0x42, 0x17, 0x43, 0x42, 0x40, 0x40, ++ 0x40, 0x06, 0x0a, 0x0a, 0x40, 0x0f, 0x0a, 0x04, 0x04, 0x2d, 0x27, 0x1d, 0x07, 0x23, 0x1d, 0x1b, ++ 0x45, 0x18, 0x12, 0x0a, 0x40, 0x0f, 0x0a, 0x04, 0x21, 0x0a, 0x2e, 0x21, 0x21, 0x0a, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x22, 0x06, 0x43, 0x40, 0x42, 0x54, 0x62, 0x2e, 0x40, 0x06, 0x40, 0x40, 0x44, 0x0f, ++ 0x06, 0x1e, 0x40, 0x16, 0x10, 0x1e, 0x2c, 0x3e, 0x3e, 0x07, 0x07, 0x01, 0x09, 0x09, 0x1c, 0x07, ++ 0x02, 0x27, 0x28, 0x09, 0x40, 0x46, 0x4a, 0x40, 0x40, 0x40, 0x06, 0x06, 0x04, 0x0a, 0x0c, 0x0a, ++ 0x10, 0x18, 0x04, 0x02, 0x02, 0x1e, 0x04, 0x43, 0x02, 0x02, 0x1e, 0x1a, 0x14, 0x20, 0x04, 0x0a, ++ 0x0c, 0x0a, 0x10, 0x18, 0x04, 0x02, 0x02, 0x1e, 0x04, 0x43, 0x02, 0x02, 0x1e, 0x1a, 0x14, 0x20, ++ 0x24, 0x41, 0x3c, 0x40, 0x4e, 0x40, 0x06, 0x07, 0x06, 0x14, 0x14, 0x2c, 0x0c, 0x11, 0x44, 0x41, ++ 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x4e, ++ 0x07, 0x0e, 0x0e, 0x1c, 0x24, 0x1c, 0x24, 0x09, 0x17, 0x44, 0x41, 0x17, 0x44, 0x41, 0x40, 0x40, ++ 0x40, 0x05, 0x09, 0x09, 0x40, 0x0f, 0x09, 0x03, 0x03, 0x2e, 0x27, 0x1e, 0x07, 0x24, 0x1e, 0x1c, ++ 0x46, 0x17, 0x11, 0x09, 0x40, 0x0f, 0x09, 0x03, 0x22, 0x09, 0x30, 0x22, 0x22, 0x09, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x23, 0x06, 0x43, 0x40, 0x43, 0x54, 0x63, 0x2e, 0x40, 0x06, 0x40, 0x40, 0x44, 0x0f, ++ 0x06, 0x1f, 0x40, 0x16, 0x11, 0x1f, 0x2e, 0x3e, 0x3e, 0x07, 0x07, 0x01, 0x08, 0x09, 0x1c, 0x07, ++ 0x03, 0x27, 0x29, 0x09, 0x40, 0x46, 0x4b, 0x40, 0x40, 0x40, 0x06, 0x06, 0x04, 0x0b, 0x0c, 0x0b, ++ 0x11, 0x19, 0x04, 0x03, 0x03, 0x1f, 0x04, 0x43, 0x03, 0x03, 0x1f, 0x1b, 0x14, 0x21, 0x04, 0x0b, ++ 0x0c, 0x0b, 0x11, 0x19, 0x04, 0x03, 0x03, 0x1f, 0x04, 0x43, 0x03, 0x03, 0x1f, 0x1b, 0x14, 0x21, ++ 0x24, 0x41, 0x3e, 0x40, 0x4e, 0x40, 0x06, 0x07, 0x06, 0x14, 0x14, 0x2e, 0x0c, 0x11, 0x44, 0x41, ++ 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x11, 0x44, 0x41, 0x1e, 0x07, 0x40, 0x4e, ++ 0x07, 0x0e, 0x0e, 0x1c, 0x24, 0x1c, 0x24, 0x09, 0x17, 0x44, 0x41, 0x17, 0x44, 0x41, 0x40, 0x40, ++ 0x40, 0x04, 0x09, 0x09, 0x40, 0x0f, 0x09, 0x03, 0x03, 0x2e, 0x27, 0x1e, 0x07, 0x24, 0x1e, 0x1c, ++ 0x46, 0x16, 0x11, 0x09, 0x40, 0x0f, 0x09, 0x03, 0x23, 0x09, 0x31, 0x23, 0x23, 0x09, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x24, 0x06, 0x42, 0x40, 0x44, 0x55, 0x64, 0x2e, 0x40, 0x06, 0x40, 0x40, 0x45, 0x0f, ++ 0x06, 0x21, 0x40, 0x16, 0x12, 0x21, 0x30, 0x3e, 0x3e, 0x07, 0x07, 0x01, 0x06, 0x09, 0x1d, 0x07, ++ 0x04, 0x27, 0x2a, 0x09, 0x40, 0x46, 0x4c, 0x40, 0x40, 0x40, 0x06, 0x06, 0x05, 0x0c, 0x0d, 0x0c, ++ 0x12, 0x1a, 0x05, 0x04, 0x04, 0x21, 0x05, 0x42, 0x04, 0x04, 0x21, 0x1c, 0x15, 0x22, 0x05, 0x0c, ++ 0x0d, 0x0c, 0x12, 0x1a, 0x05, 0x04, 0x04, 0x21, 0x05, 0x42, 0x04, 0x04, 0x21, 0x1c, 0x15, 0x22, ++ 0x25, 0x41, 0x3e, 0x40, 0x4e, 0x40, 0x06, 0x07, 0x06, 0x15, 0x15, 0x30, 0x0d, 0x11, 0x45, 0x41, ++ 0x1e, 0x07, 0x40, 0x11, 0x45, 0x41, 0x1e, 0x07, 0x40, 0x11, 0x45, 0x41, 0x1e, 0x07, 0x40, 0x4e, ++ 0x07, 0x0e, 0x0e, 0x1d, 0x25, 0x1d, 0x25, 0x09, 0x17, 0x45, 0x41, 0x17, 0x45, 0x41, 0x40, 0x40, ++ 0x40, 0x03, 0x09, 0x09, 0x40, 0x0f, 0x09, 0x02, 0x02, 0x2e, 0x27, 0x1e, 0x07, 0x25, 0x1e, 0x1d, ++ 0x46, 0x15, 0x11, 0x09, 0x40, 0x0f, 0x09, 0x02, 0x24, 0x09, 0x32, 0x24, 0x24, 0x09, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x24, 0x06, 0x42, 0x40, 0x45, 0x56, 0x65, 0x2e, 0x40, 0x06, 0x40, 0x40, 0x46, 0x0f, ++ 0x06, 0x22, 0x40, 0x16, 0x13, 0x22, 0x31, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x04, 0x08, 0x1d, 0x07, ++ 0x04, 0x27, 0x2b, 0x08, 0x40, 0x47, 0x4d, 0x40, 0x40, 0x40, 0x06, 0x06, 0x05, 0x0c, 0x0d, 0x0c, ++ 0x13, 0x1b, 0x05, 0x04, 0x04, 0x22, 0x05, 0x42, 0x04, 0x04, 0x22, 0x1c, 0x15, 0x23, 0x05, 0x0c, ++ 0x0d, 0x0c, 0x13, 0x1b, 0x05, 0x04, 0x04, 0x22, 0x05, 0x42, 0x04, 0x04, 0x22, 0x1c, 0x15, 0x23, ++ 0x25, 0x41, 0x3e, 0x40, 0x4f, 0x40, 0x06, 0x07, 0x06, 0x15, 0x15, 0x31, 0x0d, 0x10, 0x46, 0x41, ++ 0x1e, 0x07, 0x40, 0x10, 0x46, 0x41, 0x1e, 0x07, 0x40, 0x10, 0x46, 0x41, 0x1e, 0x07, 0x40, 0x4f, ++ 0x07, 0x0e, 0x0e, 0x1d, 0x25, 0x1d, 0x25, 0x08, 0x17, 0x46, 0x41, 0x17, 0x46, 0x41, 0x40, 0x40, ++ 0x40, 0x02, 0x08, 0x08, 0x40, 0x0f, 0x08, 0x01, 0x01, 0x2e, 0x27, 0x1e, 0x07, 0x25, 0x1e, 0x1d, ++ 0x47, 0x13, 0x10, 0x08, 0x40, 0x0f, 0x08, 0x01, 0x24, 0x08, 0x33, 0x24, 0x24, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x25, 0x07, 0x41, 0x40, 0x45, 0x56, 0x65, 0x2f, 0x40, 0x07, 0x40, 0x40, 0x46, 0x0f, ++ 0x07, 0x24, 0x40, 0x17, 0x15, 0x24, 0x33, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x03, 0x08, 0x1e, 0x07, ++ 0x05, 0x27, 0x2d, 0x08, 0x40, 0x47, 0x4d, 0x40, 0x40, 0x40, 0x07, 0x07, 0x06, 0x0d, 0x0e, 0x0d, ++ 0x15, 0x1d, 0x06, 0x05, 0x05, 0x24, 0x06, 0x41, 0x05, 0x05, 0x24, 0x1d, 0x16, 0x25, 0x06, 0x0d, ++ 0x0e, 0x0d, 0x15, 0x1d, 0x06, 0x05, 0x05, 0x24, 0x06, 0x41, 0x05, 0x05, 0x24, 0x1d, 0x16, 0x25, ++ 0x26, 0x40, 0x3e, 0x40, 0x4f, 0x40, 0x07, 0x07, 0x07, 0x16, 0x16, 0x33, 0x0e, 0x10, 0x46, 0x40, ++ 0x1f, 0x07, 0x40, 0x10, 0x46, 0x40, 0x1f, 0x07, 0x40, 0x10, 0x46, 0x40, 0x1f, 0x07, 0x40, 0x4f, ++ 0x07, 0x0f, 0x0f, 0x1e, 0x26, 0x1e, 0x26, 0x08, 0x17, 0x46, 0x40, 0x17, 0x46, 0x40, 0x40, 0x40, ++ 0x40, 0x02, 0x08, 0x08, 0x40, 0x0f, 0x08, 0x01, 0x01, 0x2f, 0x27, 0x1f, 0x07, 0x26, 0x1f, 0x1e, ++ 0x47, 0x12, 0x10, 0x08, 0x40, 0x0f, 0x08, 0x01, 0x25, 0x08, 0x35, 0x25, 0x25, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x26, 0x07, 0x40, 0x40, 0x46, 0x57, 0x66, 0x2f, 0x40, 0x07, 0x40, 0x40, 0x47, 0x0f, ++ 0x07, 0x26, 0x40, 0x17, 0x16, 0x26, 0x35, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x01, 0x08, 0x1f, 0x07, ++ 0x06, 0x27, 0x2e, 0x08, 0x40, 0x47, 0x4e, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x0e, 0x0f, 0x0e, ++ 0x16, 0x1e, 0x07, 0x06, 0x06, 0x26, 0x07, 0x40, 0x06, 0x06, 0x26, 0x1e, 0x17, 0x26, 0x07, 0x0e, ++ 0x0f, 0x0e, 0x16, 0x1e, 0x07, 0x06, 0x06, 0x26, 0x07, 0x40, 0x06, 0x06, 0x26, 0x1e, 0x17, 0x26, ++ 0x27, 0x40, 0x3e, 0x40, 0x4f, 0x40, 0x07, 0x07, 0x07, 0x17, 0x17, 0x35, 0x0f, 0x10, 0x47, 0x40, ++ 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x4f, ++ 0x07, 0x0f, 0x0f, 0x1f, 0x27, 0x1f, 0x27, 0x08, 0x17, 0x47, 0x40, 0x17, 0x47, 0x40, 0x40, 0x40, ++ 0x40, 0x01, 0x08, 0x08, 0x40, 0x0f, 0x08, 0x00, 0x00, 0x2f, 0x27, 0x1f, 0x07, 0x27, 0x1f, 0x1f, ++ 0x47, 0x11, 0x10, 0x08, 0x40, 0x0f, 0x08, 0x00, 0x26, 0x08, 0x36, 0x26, 0x26, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x07, 0x3e, 0x27, 0x07, 0x40, 0x40, 0x47, 0x57, 0x67, 0x2f, 0x40, 0x07, 0x40, 0x40, 0x47, 0x0f, ++ 0x07, 0x27, 0x40, 0x17, 0x17, 0x27, 0x37, 0x3e, 0x3e, 0x07, 0x07, 0x00, 0x00, 0x08, 0x1f, 0x07, ++ 0x07, 0x27, 0x2f, 0x08, 0x40, 0x47, 0x4f, 0x40, 0x40, 0x40, 0x07, 0x07, 0x07, 0x0f, 0x0f, 0x0f, ++ 0x17, 0x1f, 0x07, 0x07, 0x07, 0x27, 0x07, 0x40, 0x07, 0x07, 0x27, 0x1f, 0x17, 0x27, 0x07, 0x0f, ++ 0x0f, 0x0f, 0x17, 0x1f, 0x07, 0x07, 0x07, 0x27, 0x07, 0x40, 0x07, 0x07, 0x27, 0x1f, 0x17, 0x27, ++ 0x27, 0x40, 0x3e, 0x40, 0x4f, 0x40, 0x07, 0x07, 0x07, 0x17, 0x17, 0x37, 0x0f, 0x10, 0x47, 0x40, ++ 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x10, 0x47, 0x40, 0x1f, 0x07, 0x40, 0x4f, ++ 0x07, 0x0f, 0x0f, 0x1f, 0x27, 0x1f, 0x27, 0x08, 0x17, 0x47, 0x40, 0x17, 0x47, 0x40, 0x40, 0x40, ++ 0x40, 0x00, 0x08, 0x08, 0x40, 0x0f, 0x08, 0x00, 0x00, 0x2f, 0x27, 0x1f, 0x07, 0x27, 0x1f, 0x1f, ++ 0x47, 0x10, 0x10, 0x08, 0x40, 0x0f, 0x08, 0x00, 0x27, 0x08, 0x37, 0x27, 0x27, 0x08, 0x40, 0x40, ++ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++}; ++ ++static void set_ps_field(u32 *buf, struct rkvdec_ps_field field, u32 value) ++{ ++ u8 bit = field.offset % 32, word = field.offset / 32; ++ u64 mask = GENMASK_ULL(bit + field.len - 1, bit); ++ u64 val = ((u64)value << bit) & mask; ++ ++ buf[word] &= ~mask; ++ buf[word] |= val; ++ if (bit + field.len > 32) { ++ buf[word + 1] &= ~(mask >> 32); ++ buf[word + 1] |= val >> 32; ++ } ++} ++ ++static void assemble_hw_pps(struct rkvdec_ctx *ctx, ++ struct rkvdec_hevc_run *run) ++{ ++ struct rkvdec_hevc_ctx *hevc_ctx = ctx->priv; ++ const struct v4l2_ctrl_hevc_sps *sps = run->sps; ++ const struct v4l2_ctrl_hevc_pps *pps = run->pps; ++ struct rkvdec_hevc_priv_tbl *priv_tbl = hevc_ctx->priv_tbl.cpu; ++ struct rkvdec_sps_pps_packet *hw_ps; ++ u32 min_cb_log2_size_y, ctb_log2_size_y, ctb_size_y; ++ u32 log2_min_cu_qp_delta_size; ++ dma_addr_t scaling_list_address; ++ u32 scaling_distance; ++ int i; ++ ++ /* ++ * HW read the SPS/PPS information from PPS packet index by PPS id. ++ * offset from the base can be calculated by PPS_id * 80 (size per PPS ++ * packet unit). so the driver copy SPS/PPS information to the exact PPS ++ * packet unit for HW accessing. ++ */ ++ hw_ps = &priv_tbl->param_set[pps->pic_parameter_set_id]; ++ memset(hw_ps, 0, sizeof(*hw_ps)); ++ ++ min_cb_log2_size_y = sps->log2_min_luma_coding_block_size_minus3 + 3; ++ ctb_log2_size_y = min_cb_log2_size_y + ++ sps->log2_diff_max_min_luma_coding_block_size; ++ ctb_size_y = 1 << ctb_log2_size_y; ++ ++#define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value) ++ /* write sps */ ++ WRITE_PPS(sps->video_parameter_set_id, VIDEO_PARAMETER_SET_ID); ++ WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID); ++ WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC); ++ WRITE_PPS(sps->pic_width_in_luma_samples, PIC_WIDTH_IN_LUMA_SAMPLES); ++ WRITE_PPS(sps->pic_height_in_luma_samples, PIC_HEIGHT_IN_LUMA_SAMPLES); ++ WRITE_PPS(sps->bit_depth_luma_minus8 + 8, BIT_DEPTH_LUMA); ++ WRITE_PPS(sps->bit_depth_chroma_minus8 + 8, BIT_DEPTH_CHROMA); ++ WRITE_PPS(sps->log2_max_pic_order_cnt_lsb_minus4 + 4, ++ LOG2_MAX_PIC_ORDER_CNT_LSB); ++ WRITE_PPS(sps->log2_diff_max_min_luma_coding_block_size, ++ LOG2_DIFF_MAX_MIN_LUMA_CODING_BLOCK_SIZE); ++ WRITE_PPS(sps->log2_min_luma_coding_block_size_minus3 + 3, ++ LOG2_MIN_LUMA_CODING_BLOCK_SIZE); ++ WRITE_PPS(sps->log2_min_luma_transform_block_size_minus2 + 2, ++ LOG2_MIN_TRANSFORM_BLOCK_SIZE); ++ WRITE_PPS(sps->log2_diff_max_min_luma_transform_block_size, ++ LOG2_DIFF_MAX_MIN_LUMA_TRANSFORM_BLOCK_SIZE); ++ WRITE_PPS(sps->max_transform_hierarchy_depth_inter, ++ MAX_TRANSFORM_HIERARCHY_DEPTH_INTER); ++ WRITE_PPS(sps->max_transform_hierarchy_depth_intra, ++ MAX_TRANSFORM_HIERARCHY_DEPTH_INTRA); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED), ++ SCALING_LIST_ENABLED_FLAG); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_AMP_ENABLED), ++ AMP_ENABLED_FLAG); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET), ++ SAMPLE_ADAPTIVE_OFFSET_ENABLED_FLAG); ++ if (sps->flags & V4L2_HEVC_SPS_FLAG_PCM_ENABLED) { ++ WRITE_PPS(1, PCM_ENABLED_FLAG); ++ WRITE_PPS(sps->pcm_sample_bit_depth_luma_minus1 + 1, ++ PCM_SAMPLE_BIT_DEPTH_LUMA); ++ WRITE_PPS(sps->pcm_sample_bit_depth_chroma_minus1 + 1, ++ PCM_SAMPLE_BIT_DEPTH_CHROMA); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED), ++ PCM_LOOP_FILTER_DISABLED_FLAG); ++ WRITE_PPS(sps->log2_diff_max_min_pcm_luma_coding_block_size, ++ LOG2_DIFF_MAX_MIN_PCM_LUMA_CODING_BLOCK_SIZE); ++ WRITE_PPS(sps->log2_min_pcm_luma_coding_block_size_minus3 + 3, ++ LOG2_MIN_PCM_LUMA_CODING_BLOCK_SIZE); ++ } ++ WRITE_PPS(sps->num_short_term_ref_pic_sets, NUM_SHORT_TERM_REF_PIC_SETS); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT), ++ LONG_TERM_REF_PICS_PRESENT_FLAG); ++ WRITE_PPS(sps->num_long_term_ref_pics_sps, NUM_LONG_TERM_REF_PICS_SPS); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED), ++ SPS_TEMPORAL_MVP_ENABLED_FLAG); ++ WRITE_PPS(!!(sps->flags & V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED), ++ STRONG_INTRA_SMOOTHING_ENABLED_FLAG); ++ ++ /* write pps */ ++ WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID); ++ WRITE_PPS(sps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED), ++ DEPENDENT_SLICE_SEGMENTS_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT), ++ OUTPUT_FLAG_PRESENT_FLAG); ++ WRITE_PPS(pps->num_extra_slice_header_bits, NUM_EXTRA_SLICE_HEADER_BITS); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED), ++ SIGN_DATA_HIDING_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT), ++ CABAC_INIT_PRESENT_FLAG); ++ WRITE_PPS(pps->num_ref_idx_l0_default_active_minus1 + 1, ++ NUM_REF_IDX_L0_DEFAULT_ACTIVE); ++ WRITE_PPS(pps->num_ref_idx_l1_default_active_minus1 + 1, ++ NUM_REF_IDX_L1_DEFAULT_ACTIVE); ++ WRITE_PPS(pps->init_qp_minus26, INIT_QP_MINUS26); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED), ++ CONSTRAINED_INTRA_PRED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED), ++ TRANSFORM_SKIP_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED), ++ CU_QP_DELTA_ENABLED_FLAG); ++ ++ log2_min_cu_qp_delta_size = ctb_log2_size_y - pps->diff_cu_qp_delta_depth; ++ WRITE_PPS(log2_min_cu_qp_delta_size, LOG2_MIN_CU_QP_DELTA_SIZE); ++ ++ WRITE_PPS(pps->pps_cb_qp_offset, PPS_CB_QP_OFFSET); ++ WRITE_PPS(pps->pps_cr_qp_offset, PPS_CR_QP_OFFSET); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT), ++ PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED), ++ WEIGHTED_PRED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED), ++ WEIGHTED_BIPRED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED), ++ TRANSQUANT_BYPASS_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_TILES_ENABLED), ++ TILES_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED), ++ ENTROPY_CODING_SYNC_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED), ++ PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED), ++ LOOP_FILTER_ACROSS_TILES_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED), ++ DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER), ++ PPS_DEBLOCKING_FILTER_DISABLED_FLAG); ++ WRITE_PPS(pps->pps_beta_offset_div2, PPS_BETA_OFFSET_DIV2); ++ WRITE_PPS(pps->pps_tc_offset_div2, PPS_TC_OFFSET_DIV2); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT), ++ LISTS_MODIFICATION_PRESENT_FLAG); ++ WRITE_PPS(pps->log2_parallel_merge_level_minus2 + 2, LOG2_PARALLEL_MERGE_LEVEL); ++ WRITE_PPS(!!(pps->flags & V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT), ++ SLICE_SEGMENT_HEADER_EXTENSION_PRESENT_FLAG); ++ WRITE_PPS(pps->num_tile_columns_minus1 + 1, NUM_TILE_COLUMNS); ++ WRITE_PPS(pps->num_tile_rows_minus1 + 1, NUM_TILE_ROWS); ++ ++ if (pps->flags & V4L2_HEVC_PPS_FLAG_TILES_ENABLED) { ++ for (i = 0; i <= pps->num_tile_columns_minus1; i++) ++ WRITE_PPS(pps->column_width_minus1[i], COLUMN_WIDTH(i)); ++ for (i = 0; i <= pps->num_tile_rows_minus1; i++) ++ WRITE_PPS(pps->row_height_minus1[i], ROW_HEIGHT(i)); ++ } else { ++ WRITE_PPS(((sps->pic_width_in_luma_samples + ctb_size_y - 1) / ctb_size_y) - 1, ++ COLUMN_WIDTH(0)); ++ WRITE_PPS(((sps->pic_height_in_luma_samples + ctb_size_y - 1) / ctb_size_y) - 1, ++ ROW_HEIGHT(0)); ++ } ++ ++ scaling_distance = offsetof(struct rkvdec_hevc_priv_tbl, scaling_list); ++ scaling_list_address = hevc_ctx->priv_tbl.dma + scaling_distance; ++ WRITE_PPS(scaling_list_address, SCALING_LIST_ADDRESS); ++} ++ ++static void assemble_hw_rps(struct rkvdec_ctx *ctx, ++ struct rkvdec_hevc_run *run) ++{ ++ const struct v4l2_ctrl_hevc_decode_params *decode_params = run->decode_params; ++ const struct v4l2_ctrl_hevc_slice_params *sl_params; ++ const struct v4l2_hevc_dpb_entry *dpb; ++ struct rkvdec_hevc_ctx *hevc_ctx = ctx->priv; ++ struct rkvdec_hevc_priv_tbl *priv_tbl = hevc_ctx->priv_tbl.cpu; ++ struct rkvdec_rps_packet *hw_ps; ++ int i, j; ++ unsigned int lowdelay; ++ ++#define WRITE_RPS(value, field) set_ps_field(hw_ps->info, field, value) ++ ++#define REF_PIC_LONG_TERM_L0(i) PS_FIELD(i * 5, 1) ++#define REF_PIC_IDX_L0(i) PS_FIELD(1 + (i * 5), 4) ++#define REF_PIC_LONG_TERM_L1(i) PS_FIELD((i < 5 ? 75 : 132) + (i * 5), 1) ++#define REF_PIC_IDX_L1(i) PS_FIELD((i < 4 ? 76 : 128) + (i * 5), 4) ++ ++#define LOWDELAY PS_FIELD(182, 1) ++#define LONG_TERM_RPS_BIT_OFFSET PS_FIELD(183, 10) ++#define SHORT_TERM_RPS_BIT_OFFSET PS_FIELD(193, 9) ++#define NUM_RPS_POC PS_FIELD(202, 4) ++ ++ for (j = 0; j < run->num_slices; j++) { ++ sl_params = &run->slices_params[j]; ++ dpb = decode_params->dpb; ++ lowdelay = (sl_params->slice_type == V4L2_HEVC_SLICE_TYPE_I) ? 0 : 1; ++ ++ hw_ps = &priv_tbl->rps[j]; ++ memset(hw_ps, 0, sizeof(*hw_ps)); ++ ++ for (i = 0; i <= sl_params->num_ref_idx_l0_active_minus1; i++) { ++ WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), ++ REF_PIC_LONG_TERM_L0(i)); ++ WRITE_RPS(sl_params->ref_idx_l0[i], REF_PIC_IDX_L0(i)); ++ ++ if (dpb[sl_params->ref_idx_l0[i]].pic_order_cnt_val > sl_params->slice_pic_order_cnt) ++ lowdelay = 0; ++ ++ } ++ ++ for (i = 0; i <= sl_params->num_ref_idx_l1_active_minus1; i++) { ++ WRITE_RPS(!!(dpb[sl_params->ref_idx_l1[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), ++ REF_PIC_LONG_TERM_L1(i)); ++ WRITE_RPS(sl_params->ref_idx_l1[i], REF_PIC_IDX_L1(i)); ++ ++ if (dpb[sl_params->ref_idx_l1[i]].pic_order_cnt_val > sl_params->slice_pic_order_cnt) ++ lowdelay = 0; ++ } ++ ++ WRITE_RPS(lowdelay, LOWDELAY); ++ ++ WRITE_RPS(sl_params->long_term_ref_pic_set_size + ++ sl_params->short_term_ref_pic_set_size, ++ LONG_TERM_RPS_BIT_OFFSET); ++ WRITE_RPS(sl_params->short_term_ref_pic_set_size, ++ SHORT_TERM_RPS_BIT_OFFSET); ++ ++ WRITE_RPS(decode_params->num_poc_st_curr_before + ++ decode_params->num_poc_st_curr_after + ++ decode_params->num_poc_lt_curr, ++ NUM_RPS_POC); ++ } ++} ++ ++static void assemble_hw_scaling_list(struct rkvdec_ctx *ctx, ++ struct rkvdec_hevc_run *run) ++{ ++ const struct v4l2_ctrl_hevc_scaling_matrix *scaling = run->scaling_matrix; ++ struct rkvdec_hevc_ctx *hevc_ctx = ctx->priv; ++ struct rkvdec_hevc_priv_tbl *tbl = hevc_ctx->priv_tbl.cpu; ++ u8 *dst; ++ scalingList_t sl; ++ int i, j; ++ ++ if (!memcmp((void*)&hevc_ctx->scaling_matrix_cache, scaling, ++ sizeof(struct v4l2_ctrl_hevc_scaling_matrix))) ++ return; ++ ++ memset(&sl, 0, sizeof(scalingList_t)); ++ ++ for (i = 0; i < 6; i++) { ++ for (j = 0; j < 16; j++) ++ sl.sl[0][i][j] = scaling->scaling_list_4x4[i][j]; ++ for (j = 0; j < 64; j++) { ++ sl.sl[1][i][j] = scaling->scaling_list_8x8[i][j]; ++ sl.sl[2][i][j] = scaling->scaling_list_16x16[i][j]; ++ if (i < 2) ++ sl.sl[3][i][j] = scaling->scaling_list_32x32[i][j]; ++ } ++ sl.sl_dc[0][i] = scaling->scaling_list_dc_coef_16x16[i]; ++ if (i < 2) ++ sl.sl_dc[1][i] = scaling->scaling_list_dc_coef_32x32[i]; ++ } ++ ++ dst = tbl->scaling_list; ++ hal_record_scaling_list((scalingFactor_t *)dst, &sl); ++ ++ memcpy((void*)&hevc_ctx->scaling_matrix_cache, scaling, ++ sizeof(struct v4l2_ctrl_hevc_scaling_matrix)); ++} ++ ++static struct vb2_buffer * ++get_ref_buf(struct rkvdec_ctx *ctx, struct rkvdec_hevc_run *run, ++ unsigned int dpb_idx) ++{ ++ struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; ++ const struct v4l2_ctrl_hevc_decode_params *decode_params = run->decode_params; ++ const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb; ++ struct vb2_queue *cap_q = &m2m_ctx->cap_q_ctx.q; ++ struct vb2_buffer *vb2_buf = NULL; ++ ++ if (dpb_idx < decode_params->num_active_dpb_entries) ++ vb2_buf = vb2_find_buffer(cap_q, dpb[dpb_idx].timestamp); ++ ++ /* ++ * If a DPB entry is unused or invalid, address of current destination ++ * buffer is returned. ++ */ ++ if (!vb2_buf) ++ return &run->base.bufs.dst->vb2_buf; ++ ++ return vb2_buf; ++} ++ ++static void config_registers(struct rkvdec_ctx *ctx, ++ struct rkvdec_hevc_run *run) ++{ ++ struct rkvdec_dev *rkvdec = ctx->dev; ++ const struct v4l2_ctrl_hevc_decode_params *decode_params = run->decode_params; ++ const struct v4l2_ctrl_hevc_slice_params *sl_params = &run->slices_params[0]; ++ const struct v4l2_hevc_dpb_entry *dpb = decode_params->dpb; ++ struct rkvdec_hevc_ctx *hevc_ctx = ctx->priv; ++ dma_addr_t priv_start_addr = hevc_ctx->priv_tbl.dma; ++ const struct v4l2_pix_format_mplane *dst_fmt; ++ struct vb2_v4l2_buffer *src_buf = run->base.bufs.src; ++ struct vb2_v4l2_buffer *dst_buf = run->base.bufs.dst; ++ const struct v4l2_format *f; ++ dma_addr_t rlc_addr; ++ dma_addr_t refer_addr; ++ u32 rlc_len; ++ u32 hor_virstride; ++ u32 ver_virstride; ++ u32 y_virstride; ++ u32 uv_virstride; ++ u32 yuv_virstride; ++ u32 offset; ++ dma_addr_t dst_addr; ++ u32 reg, i; ++ ++ reg = RKVDEC_MODE(RKVDEC_MODE_HEVC); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_SYSCTRL); ++ ++ f = &ctx->decoded_fmt; ++ dst_fmt = &f->fmt.pix_mp; ++ hor_virstride = dst_fmt->plane_fmt[0].bytesperline; ++ ver_virstride = dst_fmt->height; ++ y_virstride = hor_virstride * ver_virstride; ++ uv_virstride = y_virstride / 2; ++ yuv_virstride = y_virstride + uv_virstride; ++ ++ reg = RKVDEC_Y_HOR_VIRSTRIDE(hor_virstride / 16) | ++ RKVDEC_UV_HOR_VIRSTRIDE(hor_virstride / 16) | ++ RKVDEC_SLICE_NUM_LOWBITS(run->num_slices); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_PICPAR); ++ ++ /* config rlc base address */ ++ rlc_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); ++ writel_relaxed(rlc_addr, rkvdec->regs + RKVDEC_REG_STRM_RLC_BASE); ++ ++ rlc_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); ++ reg = RKVDEC_STRM_LEN(round_up(rlc_len, 16) + 64); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_STRM_LEN); ++ ++ /* config cabac table */ ++ offset = offsetof(struct rkvdec_hevc_priv_tbl, cabac_table); ++ writel_relaxed(priv_start_addr + offset, ++ rkvdec->regs + RKVDEC_REG_CABACTBL_PROB_BASE); ++ ++ /* config output base address */ ++ dst_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); ++ writel_relaxed(dst_addr, rkvdec->regs + RKVDEC_REG_DECOUT_BASE); ++ ++ reg = RKVDEC_Y_VIRSTRIDE(y_virstride / 16); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_Y_VIRSTRIDE); ++ ++ reg = RKVDEC_YUV_VIRSTRIDE(yuv_virstride / 16); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_YUV_VIRSTRIDE); ++ ++ /* config ref pic address */ ++ for (i = 0; i < 15; i++) { ++ struct vb2_buffer *vb_buf = get_ref_buf(ctx, run, i); ++ ++ if (i < 4 && decode_params->num_active_dpb_entries) { ++ reg = GENMASK(decode_params->num_active_dpb_entries - 1, 0); ++ reg = (reg >> (i * 4)) & 0xf; ++ } else ++ reg = 0; ++ ++ refer_addr = vb2_dma_contig_plane_dma_addr(vb_buf, 0); ++ writel_relaxed(refer_addr | reg, ++ rkvdec->regs + RKVDEC_REG_H264_BASE_REFER(i)); ++ ++ reg = RKVDEC_POC_REFER(i < decode_params->num_active_dpb_entries ? dpb[i].pic_order_cnt_val : 0); ++ writel_relaxed(reg, ++ rkvdec->regs + RKVDEC_REG_H264_POC_REFER0(i)); ++ } ++ ++ reg = RKVDEC_CUR_POC(sl_params->slice_pic_order_cnt); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_CUR_POC0); ++ ++ /* config hw pps address */ ++ offset = offsetof(struct rkvdec_hevc_priv_tbl, param_set); ++ writel_relaxed(priv_start_addr + offset, ++ rkvdec->regs + RKVDEC_REG_PPS_BASE); ++ ++ /* config hw rps address */ ++ offset = offsetof(struct rkvdec_hevc_priv_tbl, rps); ++ writel_relaxed(priv_start_addr + offset, ++ rkvdec->regs + RKVDEC_REG_RPS_BASE); ++ ++ reg = RKVDEC_AXI_DDR_RDATA(0); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_AXI_DDR_RDATA); ++ ++ reg = RKVDEC_AXI_DDR_WDATA(0); ++ writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_AXI_DDR_WDATA); ++} ++ ++#define RKVDEC_HEVC_MAX_DEPTH_IN_BYTES 2 ++ ++static int rkvdec_hevc_adjust_fmt(struct rkvdec_ctx *ctx, ++ struct v4l2_format *f) ++{ ++ struct v4l2_pix_format_mplane *fmt = &f->fmt.pix_mp; ++ ++ fmt->num_planes = 1; ++ if (!fmt->plane_fmt[0].sizeimage) ++ fmt->plane_fmt[0].sizeimage = fmt->width * fmt->height * ++ RKVDEC_HEVC_MAX_DEPTH_IN_BYTES; ++ return 0; ++} ++ ++static int rkvdec_hevc_validate_sps(struct rkvdec_ctx *ctx, ++ const struct v4l2_ctrl_hevc_sps *sps) ++{ ++ if (sps->chroma_format_idc > 1) ++ /* Only 4:0:0 and 4:2:0 are supported */ ++ return -EINVAL; ++ if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) ++ /* Luma and chroma bit depth mismatch */ ++ return -EINVAL; ++ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) ++ /* Only 8-bit and 10-bit is supported */ ++ return -EINVAL; ++ ++ if (sps->pic_width_in_luma_samples > ctx->coded_fmt.fmt.pix_mp.width || ++ sps->pic_height_in_luma_samples > ctx->coded_fmt.fmt.pix_mp.height) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static u32 rkvdec_hevc_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) ++{ ++ const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; ++ ++ if (sps->bit_depth_luma_minus8 == 2) ++ return V4L2_PIX_FMT_NV15; ++ else ++ return V4L2_PIX_FMT_NV12; ++} ++ ++static int rkvdec_hevc_start(struct rkvdec_ctx *ctx) ++{ ++ struct rkvdec_dev *rkvdec = ctx->dev; ++ struct rkvdec_hevc_priv_tbl *priv_tbl; ++ struct rkvdec_hevc_ctx *hevc_ctx; ++ struct v4l2_ctrl *ctrl; ++ int ret; ++ ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_HEVC_SPS); ++ if (!ctrl) ++ return -EINVAL; ++ ++ ret = rkvdec_hevc_validate_sps(ctx, ctrl->p_new.p_hevc_sps); ++ if (ret) ++ return ret; ++ ++ hevc_ctx = kzalloc(sizeof(*hevc_ctx), GFP_KERNEL); ++ if (!hevc_ctx) ++ return -ENOMEM; ++ ++ ++ priv_tbl = dma_alloc_coherent(rkvdec->dev, sizeof(*priv_tbl), ++ &hevc_ctx->priv_tbl.dma, GFP_KERNEL); ++ if (!priv_tbl) { ++ ret = -ENOMEM; ++ goto err_free_ctx; ++ } ++ ++ hevc_ctx->priv_tbl.size = sizeof(*priv_tbl); ++ hevc_ctx->priv_tbl.cpu = priv_tbl; ++ memset(priv_tbl, 0, sizeof(*priv_tbl)); ++ memcpy(priv_tbl->cabac_table, rkvdec_hevc_cabac_table, ++ sizeof(rkvdec_hevc_cabac_table)); ++ ++ ctx->priv = hevc_ctx; ++ return 0; ++ ++err_free_ctx: ++ kfree(hevc_ctx); ++ return ret; ++} ++ ++static void rkvdec_hevc_stop(struct rkvdec_ctx *ctx) ++{ ++ struct rkvdec_hevc_ctx *hevc_ctx = ctx->priv; ++ struct rkvdec_dev *rkvdec = ctx->dev; ++ ++ dma_free_coherent(rkvdec->dev, hevc_ctx->priv_tbl.size, ++ hevc_ctx->priv_tbl.cpu, hevc_ctx->priv_tbl.dma); ++ kfree(hevc_ctx); ++} ++ ++static void rkvdec_hevc_run_preamble(struct rkvdec_ctx *ctx, ++ struct rkvdec_hevc_run *run) ++{ ++ struct v4l2_ctrl *ctrl; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_HEVC_DECODE_PARAMS); ++ run->decode_params = ctrl ? ctrl->p_cur.p : NULL; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_HEVC_SLICE_PARAMS); ++ run->slices_params = ctrl ? ctrl->p_cur.p : NULL; ++ run->num_slices = ctrl->new_elems; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_HEVC_SPS); ++ run->sps = ctrl ? ctrl->p_cur.p : NULL; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_HEVC_PPS); ++ run->pps = ctrl ? ctrl->p_cur.p : NULL; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_HEVC_SCALING_MATRIX); ++ run->scaling_matrix = ctrl ? ctrl->p_cur.p : NULL; ++ ++ rkvdec_run_preamble(ctx, &run->base); ++} ++ ++static int rkvdec_hevc_run(struct rkvdec_ctx *ctx) ++{ ++ struct rkvdec_dev *rkvdec = ctx->dev; ++ struct rkvdec_hevc_run run; ++ ++ rkvdec_hevc_run_preamble(ctx, &run); ++ ++ assemble_hw_scaling_list(ctx, &run); ++ assemble_hw_pps(ctx, &run); ++ assemble_hw_rps(ctx, &run); ++ config_registers(ctx, &run); ++ ++ rkvdec_run_postamble(ctx, &run.base); ++ ++ // sw_cabac_error_e - cabac error enable ++ writel_relaxed(0xfdfffffd, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); ++ // slice end error enable = BIT(28) ++ // frame end error enable = BIT(29) ++ writel_relaxed(0x30000000, rkvdec->regs + RKVDEC_REG_H264_ERR_E); ++ ++ schedule_delayed_work(&rkvdec->watchdog_work, msecs_to_jiffies(2000)); ++ ++ writel(1, rkvdec->regs + RKVDEC_REG_PREF_LUMA_CACHE_COMMAND); ++ writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND); ++ ++ /* Start decoding! */ ++ writel(RKVDEC_INTERRUPT_DEC_E | RKVDEC_CONFIG_DEC_CLK_GATE_E | ++ RKVDEC_TIMEOUT_E | RKVDEC_BUF_EMPTY_E, ++ rkvdec->regs + RKVDEC_REG_INTERRUPT); ++ ++ return 0; ++} ++ ++static int rkvdec_hevc_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) ++{ ++ if (ctrl->id == V4L2_CID_STATELESS_HEVC_SPS) ++ return rkvdec_hevc_validate_sps(ctx, ctrl->p_new.p_hevc_sps); ++ ++ return 0; ++} ++ ++const struct rkvdec_coded_fmt_ops rkvdec_hevc_fmt_ops = { ++ .adjust_fmt = rkvdec_hevc_adjust_fmt, ++ .start = rkvdec_hevc_start, ++ .stop = rkvdec_hevc_stop, ++ .run = rkvdec_hevc_run, ++ .try_ctrl = rkvdec_hevc_try_ctrl, ++ .valid_fmt = rkvdec_hevc_valid_fmt, ++}; +diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h +index 265f5234f4eb..4319ee3ccbbc 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-regs.h ++++ b/drivers/staging/media/rkvdec/rkvdec-regs.h +@@ -48,6 +48,7 @@ + #define RKVDEC_RLC_MODE BIT(11) + #define RKVDEC_STRM_START_BIT(x) (((x) & 0x7f) << 12) + #define RKVDEC_MODE(x) (((x) & 0x03) << 20) ++#define RKVDEC_MODE_HEVC 0 + #define RKVDEC_MODE_H264 1 + #define RKVDEC_MODE_VP9 2 + #define RKVDEC_RPS_MODE BIT(24) +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index f55abb7c377f..00a9bf583596 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -74,7 +74,7 @@ static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) + { + struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); + +- if (ctrl->id == V4L2_CID_STATELESS_H264_SPS && !ctx->valid_fmt) { ++ if (!ctx->valid_fmt) { + ctx->valid_fmt = rkvdec_valid_fmt(ctx, ctrl); + if (ctx->valid_fmt) { + struct v4l2_pix_format_mplane *pix_mp; +@@ -134,6 +134,62 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { + }, + }; + ++static const struct rkvdec_ctrl_desc rkvdec_hevc_ctrl_descs[] = { ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_SLICE_PARAMS, ++ .cfg.flags = V4L2_CTRL_FLAG_DYNAMIC_ARRAY, ++ .cfg.type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS, ++ .cfg.dims = { 600 }, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_SPS, ++ .cfg.ops = &rkvdec_ctrl_ops, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_PPS, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_SCALING_MATRIX, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_PARAMS, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_MODE, ++ .cfg.min = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED, ++ .cfg.max = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED, ++ .cfg.def = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_HEVC_START_CODE, ++ .cfg.min = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B, ++ .cfg.def = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B, ++ .cfg.max = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B, ++ }, ++ { ++ .cfg.id = V4L2_CID_MPEG_VIDEO_HEVC_PROFILE, ++ .cfg.min = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, ++ .cfg.max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10, ++ .cfg.def = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN, ++ }, ++ { ++ .cfg.id = V4L2_CID_MPEG_VIDEO_HEVC_LEVEL, ++ .cfg.min = V4L2_MPEG_VIDEO_HEVC_LEVEL_1, ++ .cfg.max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1, ++ }, ++}; ++ ++static const struct rkvdec_ctrls rkvdec_hevc_ctrls = { ++ .ctrls = rkvdec_hevc_ctrl_descs, ++ .num_ctrls = ARRAY_SIZE(rkvdec_hevc_ctrl_descs), ++}; ++ ++static const u32 rkvdec_hevc_decoded_fmts[] = { ++ V4L2_PIX_FMT_NV12, ++ V4L2_PIX_FMT_NV15, ++}; ++ ++ + static const struct rkvdec_ctrls rkvdec_h264_ctrls = { + .ctrls = rkvdec_h264_ctrl_descs, + .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), +@@ -187,6 +243,21 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + .decoded_fmts = rkvdec_h264_decoded_fmts, + .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, + }, ++ { ++ .fourcc = V4L2_PIX_FMT_HEVC_SLICE, ++ .frmsize = { ++ .min_width = 64, ++ .max_width = 4096, ++ .step_width = 64, ++ .min_height = 64, ++ .max_height = 2304, ++ .step_height = 16, ++ }, ++ .ctrls = &rkvdec_hevc_ctrls, ++ .ops = &rkvdec_hevc_fmt_ops, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts), ++ .decoded_fmts = rkvdec_hevc_decoded_fmts, ++ }, + { + .fourcc = V4L2_PIX_FMT_VP9_FRAME, + .frmsize = { +diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h +index f02f79c405f0..d6222a2588be 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.h ++++ b/drivers/staging/media/rkvdec/rkvdec.h +@@ -133,6 +133,7 @@ void rkvdec_run_preamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run); + void rkvdec_run_postamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run); + + extern const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops; ++extern const struct rkvdec_coded_fmt_ops rkvdec_hevc_fmt_ops; + extern const struct rkvdec_coded_fmt_ops rkvdec_vp9_fmt_ops; + + #endif /* RKVDEC_H_ */ + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 30 Jan 2021 18:16:39 +0100 +Subject: [PATCH] media: rkvdec: add variants support + +rkvdec IP has different versions which among others differ in +the supported decoding formats. +This adds an variant implementation in order support other +than the currently supported RK3399 version. + +Note: Since matching of supported codecs is index-based the +available codec options have been reordered here: from +supported by all versions to not commonly supported. This seems +the better soultion than duplicatiing code for every newly added IP. + +Signed-off-by: Alex Bee +--- + drivers/staging/media/rkvdec/rkvdec.c | 105 ++++++++++++++++++-------- + drivers/staging/media/rkvdec/rkvdec.h | 10 +++ + 2 files changed, 85 insertions(+), 30 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 00a9bf583596..955c53afe20f 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -227,6 +228,22 @@ static const u32 rkvdec_vp9_decoded_fmts[] = { + }; + + static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { ++ { ++ .fourcc = V4L2_PIX_FMT_HEVC_SLICE, ++ .frmsize = { ++ .min_width = 64, ++ .max_width = 4096, ++ .step_width = 64, ++ .min_height = 64, ++ .max_height = 2304, ++ .step_height = 16, ++ }, ++ .ctrls = &rkvdec_hevc_ctrls, ++ .ops = &rkvdec_hevc_fmt_ops, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts), ++ .decoded_fmts = rkvdec_hevc_decoded_fmts, ++ .capability = RKVDEC_CAPABILITY_HEVC, ++ }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .frmsize = { +@@ -242,21 +259,7 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), + .decoded_fmts = rkvdec_h264_decoded_fmts, + .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, +- }, +- { +- .fourcc = V4L2_PIX_FMT_HEVC_SLICE, +- .frmsize = { +- .min_width = 64, +- .max_width = 4096, +- .step_width = 64, +- .min_height = 64, +- .max_height = 2304, +- .step_height = 16, +- }, +- .ctrls = &rkvdec_hevc_ctrls, +- .ops = &rkvdec_hevc_fmt_ops, +- .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts), +- .decoded_fmts = rkvdec_hevc_decoded_fmts, ++ .capability = RKVDEC_CAPABILITY_H264, + }, + { + .fourcc = V4L2_PIX_FMT_VP9_FRAME, +@@ -272,16 +275,31 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + .ops = &rkvdec_vp9_fmt_ops, + .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts), + .decoded_fmts = rkvdec_vp9_decoded_fmts, +- } ++ .capability = RKVDEC_CAPABILITY_VP9, ++ }, + }; + + static const struct rkvdec_coded_fmt_desc * +-rkvdec_find_coded_fmt_desc(u32 fourcc) ++rkvdec_default_coded_fmt_desc(unsigned int capabilities) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) { ++ if (rkvdec_coded_fmts[i].capability & capabilities) ++ return &rkvdec_coded_fmts[i]; ++ } ++ ++ return NULL; ++} ++ ++static const struct rkvdec_coded_fmt_desc * ++rkvdec_find_coded_fmt_desc(u32 fourcc, unsigned int capabilities) + { + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) { +- if (rkvdec_coded_fmts[i].fourcc == fourcc) ++ if (rkvdec_coded_fmts[i].fourcc == fourcc && ++ (rkvdec_coded_fmts[i].capability & capabilities)) + return &rkvdec_coded_fmts[i]; + } + +@@ -304,7 +322,7 @@ static void rkvdec_reset_coded_fmt(struct rkvdec_ctx *ctx) + { + struct v4l2_format *f = &ctx->coded_fmt; + +- ctx->coded_fmt_desc = &rkvdec_coded_fmts[0]; ++ ctx->coded_fmt_desc = rkvdec_default_coded_fmt_desc(ctx->dev->capabilities); + rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->fourcc); + + f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; +@@ -331,11 +349,13 @@ static int rkvdec_enum_framesizes(struct file *file, void *priv, + struct v4l2_frmsizeenum *fsize) + { + const struct rkvdec_coded_fmt_desc *fmt; ++ struct rkvdec_dev *rkvdec = video_drvdata(file); + + if (fsize->index != 0) + return -EINVAL; + +- fmt = rkvdec_find_coded_fmt_desc(fsize->pixel_format); ++ fmt = rkvdec_find_coded_fmt_desc(fsize->pixel_format, ++ rkvdec->capabilities); + if (!fmt) + return -EINVAL; + +@@ -406,10 +426,11 @@ static int rkvdec_try_output_fmt(struct file *file, void *priv, + struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); + const struct rkvdec_coded_fmt_desc *desc; + +- desc = rkvdec_find_coded_fmt_desc(pix_mp->pixelformat); ++ desc = rkvdec_find_coded_fmt_desc(pix_mp->pixelformat, ++ ctx->dev->capabilities); + if (!desc) { +- pix_mp->pixelformat = rkvdec_coded_fmts[0].fourcc; +- desc = &rkvdec_coded_fmts[0]; ++ desc = rkvdec_default_coded_fmt_desc(ctx->dev->capabilities); ++ pix_mp->pixelformat = desc->fourcc; + } + + v4l2_apply_frmsize_constraints(&pix_mp->width, +@@ -487,7 +508,8 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv, + if (ret) + return ret; + +- desc = rkvdec_find_coded_fmt_desc(f->fmt.pix_mp.pixelformat); ++ desc = rkvdec_find_coded_fmt_desc(f->fmt.pix_mp.pixelformat, ++ ctx->dev->capabilities); + if (!desc) + return -EINVAL; + ctx->coded_fmt_desc = desc; +@@ -538,7 +560,10 @@ static int rkvdec_g_capture_fmt(struct file *file, void *priv, + static int rkvdec_enum_output_fmt(struct file *file, void *priv, + struct v4l2_fmtdesc *f) + { +- if (f->index >= ARRAY_SIZE(rkvdec_coded_fmts)) ++ struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); ++ ++ if (f->index >= ARRAY_SIZE(rkvdec_coded_fmts) || ++ !(ctx->dev->capabilities & rkvdec_coded_fmts[f->index].capability)) + return -EINVAL; + + f->pixelformat = rkvdec_coded_fmts[f->index].fourcc; +@@ -946,14 +971,17 @@ static int rkvdec_init_ctrls(struct rkvdec_ctx *ctx) + int ret; + + for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) +- nctrls += rkvdec_coded_fmts[i].ctrls->num_ctrls; ++ if (rkvdec_coded_fmts[i].capability & ctx->dev->capabilities) ++ nctrls += rkvdec_coded_fmts[i].ctrls->num_ctrls; + + v4l2_ctrl_handler_init(&ctx->ctrl_hdl, nctrls); + + for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) { +- ret = rkvdec_add_ctrls(ctx, rkvdec_coded_fmts[i].ctrls); +- if (ret) +- goto err_free_handler; ++ if (rkvdec_coded_fmts[i].capability & ctx->dev->capabilities) { ++ ret = rkvdec_add_ctrls(ctx, rkvdec_coded_fmts[i].ctrls); ++ if (ret) ++ goto err_free_handler; ++ } + } + + ret = v4l2_ctrl_handler_setup(&ctx->ctrl_hdl); +@@ -1155,8 +1183,17 @@ static void rkvdec_watchdog_func(struct work_struct *work) + } + } + ++static const struct rkvdec_variant rk3399_rkvdec_variant = { ++ .capabilities = RKVDEC_CAPABILITY_H264 | ++ RKVDEC_CAPABILITY_HEVC | ++ RKVDEC_CAPABILITY_VP9 ++}; ++ + static const struct of_device_id of_rkvdec_match[] = { +- { .compatible = "rockchip,rk3399-vdec" }, ++ { ++ .compatible = "rockchip,rk3399-vdec", ++ .data = &rk3399_rkvdec_variant, ++ }, + { /* sentinel */ } + }; + MODULE_DEVICE_TABLE(of, of_rkvdec_match); +@@ -1168,6 +1205,7 @@ static const char * const rkvdec_clk_names[] = { + static int rkvdec_probe(struct platform_device *pdev) + { + struct rkvdec_dev *rkvdec; ++ const struct rkvdec_variant *variant; + unsigned int i; + int ret, irq; + +@@ -1193,6 +1231,13 @@ static int rkvdec_probe(struct platform_device *pdev) + if (ret) + return ret; + ++ variant = of_device_get_match_data(rkvdec->dev); ++ if (!variant) ++ return -EINVAL; ++ ++ rkvdec->capabilities = variant->capabilities; ++ ++ + rkvdec->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(rkvdec->regs)) + return PTR_ERR(rkvdec->regs); +diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h +index d6222a2588be..ad8e83884121 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.h ++++ b/drivers/staging/media/rkvdec/rkvdec.h +@@ -29,6 +29,10 @@ + + #define RKVDEC_RESET_DELAY 5 + ++#define RKVDEC_CAPABILITY_H264 BIT(0) ++#define RKVDEC_CAPABILITY_HEVC BIT(1) ++#define RKVDEC_CAPABILITY_VP9 BIT(2) ++ + struct rkvdec_ctx; + + struct rkvdec_ctrl_desc { +@@ -70,6 +74,10 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf) + base.vb.vb2_buf); + } + ++struct rkvdec_variant { ++ unsigned int capabilities; ++}; ++ + struct rkvdec_coded_fmt_ops { + int (*adjust_fmt)(struct rkvdec_ctx *ctx, + struct v4l2_format *f); +@@ -91,6 +99,7 @@ struct rkvdec_coded_fmt_desc { + unsigned int num_decoded_fmts; + const u32 *decoded_fmts; + u32 subsystem_flags; ++ unsigned int capability; + }; + + struct rkvdec_dev { +@@ -105,6 +114,7 @@ struct rkvdec_dev { + struct delayed_work watchdog_work; + struct reset_control *rstc; + u8 reset_mask; ++ unsigned int capabilities; + }; + + struct rkvdec_ctx { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 30 Jan 2021 18:21:59 +0100 +Subject: [PATCH] media: rkvdec: add RK3288 variant + +This adds RK3288 variant to rkvdec driver. In this earlier version +of the IP only HEVC decoding is supported. + +Signed-off-by: Alex Bee +--- + drivers/staging/media/rkvdec/rkvdec.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c +index 955c53afe20f..4e228cd82f21 100644 +--- a/drivers/staging/media/rkvdec/rkvdec.c ++++ b/drivers/staging/media/rkvdec/rkvdec.c +@@ -1189,11 +1189,19 @@ static const struct rkvdec_variant rk3399_rkvdec_variant = { + RKVDEC_CAPABILITY_VP9 + }; + ++static const struct rkvdec_variant rk3288_hevc_variant = { ++ .capabilities = RKVDEC_CAPABILITY_HEVC ++}; ++ + static const struct of_device_id of_rkvdec_match[] = { + { + .compatible = "rockchip,rk3399-vdec", + .data = &rk3399_rkvdec_variant, + }, ++ { ++ .compatible = "rockchip,rk3288-hevc", ++ .data = &rk3288_hevc_variant, ++ }, + { /* sentinel */ } + }; + MODULE_DEVICE_TABLE(of, of_rkvdec_match); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 30 Jan 2021 18:27:30 +0100 +Subject: [PATCH] ARM: dts: RK3288: add hevc node + +Signed-off-by: Alex Bee +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index 7b2cde230b87..59fba3ac6aae 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -1248,6 +1248,25 @@ vpu_mmu: iommu@ff9a0800 { + power-domains = <&power RK3288_PD_VIDEO>; + }; + ++ hevc: hevc@ff9c0000 { ++ compatible = "rockchip,rk3288-hevc"; ++ reg = <0x0 0xff9c0000 0x0 0x400>; ++ interrupts = ; ++ interrupt-names = "irq_dec"; ++ clocks = <&cru ACLK_HEVC>, <&cru HCLK_HEVC>, <&cru SCLK_HEVC_CABAC>, ++ <&cru SCLK_HEVC_CORE>; ++ clock-names = "axi", "ahb", "cabac", "core"; ++ assigned-clocks = <&cru ACLK_HEVC>, <&cru HCLK_HEVC>, ++ <&cru SCLK_HEVC_CORE>, ++ <&cru SCLK_HEVC_CABAC>; ++ assigned-clock-rates = <400000000>, <100000000>, ++ <300000000>, <300000000>; ++ iommus = <&hevc_mmu>; ++ power-domains = <&power RK3288_PD_HEVC>; ++ resets = <&cru SRST_HEVC>; ++ reset-names = "video_core"; ++ }; ++ + hevc_mmu: iommu@ff9c0440 { + compatible = "rockchip,iommu"; + reg = <0x0 0xff9c0440 0x0 0x40>, <0x0 0xff9c0480 0x0 0x40>; +@@ -1255,7 +1274,7 @@ hevc_mmu: iommu@ff9c0440 { + clocks = <&cru ACLK_HEVC>, <&cru HCLK_HEVC>; + clock-names = "aclk", "iface"; + #iommu-cells = <0>; +- status = "disabled"; ++ power-domains = <&power RK3288_PD_HEVC>; + }; + + gpu: gpu@ffa30000 { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Dufresne +Date: Tue, 10 May 2022 14:37:29 -0400 +Subject: [PATCH] media: rkvdec: Fix HEVC RPS bit offsets + +The offsets from the uAPI need to be extended to include some bits +that can be calculated from the parameters. This has been compared +to match with the vendor bit sizes (which simply parse again the +data to calcualte it). + +Fixed by this change: +- LTRPSPS_A_Qualcomm_1 +- RPS_C_ericsson_5 +- RPS_D_ericsson_6 +- RPS_E_qualcomm_5 + +Signed-off-by: Nicolas Dufresne +--- + drivers/staging/media/rkvdec/rkvdec-hevc.c | 26 +++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c +index 7a375a23eaf1..580073d49b6a 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-hevc.c ++++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c +@@ -10,6 +10,7 @@ + */ + + #include ++#include + + #include "rkvdec.h" + #include "rkvdec-regs.h" +@@ -2175,6 +2176,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + struct rkvdec_hevc_run *run) + { + const struct v4l2_ctrl_hevc_decode_params *decode_params = run->decode_params; ++ const struct v4l2_ctrl_hevc_sps *sps = run->sps; + const struct v4l2_ctrl_hevc_slice_params *sl_params; + const struct v4l2_hevc_dpb_entry *dpb; + struct rkvdec_hevc_ctx *hevc_ctx = ctx->priv; +@@ -2196,9 +2198,21 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + #define NUM_RPS_POC PS_FIELD(202, 4) + + for (j = 0; j < run->num_slices; j++) { ++ uint st_bit_offset = 0; ++ + sl_params = &run->slices_params[j]; + dpb = decode_params->dpb; +- lowdelay = (sl_params->slice_type == V4L2_HEVC_SLICE_TYPE_I) ? 0 : 1; ++ ++ if (sl_params->slice_type != V4L2_HEVC_SLICE_TYPE_I) { ++ num_l0_refs = sl_params->num_ref_idx_l0_active_minus1 + 1; ++ ++ if (sl_params->slice_type == V4L2_HEVC_SLICE_TYPE_B) ++ num_l1_refs = sl_params->num_ref_idx_l1_active_minus1 + 1; ++ ++ lowdelay = 1; ++ } else { ++ lowdelay = 0; ++ } + + hw_ps = &priv_tbl->rps[j]; + memset(hw_ps, 0, sizeof(*hw_ps)); +@@ -2224,8 +2238,14 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + + WRITE_RPS(lowdelay, LOWDELAY); + +- WRITE_RPS(sl_params->long_term_ref_pic_set_size + +- sl_params->short_term_ref_pic_set_size, ++ if (!(decode_params->flags & V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC)) { ++ if (sl_params->short_term_ref_pic_set_size) ++ st_bit_offset = sl_params->short_term_ref_pic_set_size; ++ else if (sps->num_short_term_ref_pic_sets > 1) ++ st_bit_offset = fls(sps->num_short_term_ref_pic_sets - 1); ++ } ++ ++ WRITE_RPS(st_bit_offset + sl_params->long_term_ref_pic_set_size, + LONG_TERM_RPS_BIT_OFFSET); + WRITE_RPS(sl_params->short_term_ref_pic_set_size, + SHORT_TERM_RPS_BIT_OFFSET); + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nicolas Dufresne +Date: Tue, 10 May 2022 15:12:03 -0400 +Subject: [PATCH] media: rkvdec: Fix number of HEVC references being set in RPS + +The numbers from the bitstream are values between 1 - 16 (as they are +the number - 1). The difference between 0 and 1 needs to be determined +base on the slice type. I frames have no reference, P frames only have +L0 reference, and B frames have both. + +Signed-off-by: Nicolas Dufresne +--- + drivers/staging/media/rkvdec/rkvdec-hevc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c +index 580073d49b6a..ce15028918b2 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-hevc.c ++++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c +@@ -2199,6 +2199,8 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + + for (j = 0; j < run->num_slices; j++) { + uint st_bit_offset = 0; ++ uint num_l0_refs = 0; ++ uint num_l1_refs = 0; + + sl_params = &run->slices_params[j]; + dpb = decode_params->dpb; +@@ -2217,7 +2219,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + hw_ps = &priv_tbl->rps[j]; + memset(hw_ps, 0, sizeof(*hw_ps)); + +- for (i = 0; i <= sl_params->num_ref_idx_l0_active_minus1; i++) { ++ for (i = 0; i < num_l0_refs; i++) { + WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), + REF_PIC_LONG_TERM_L0(i)); + WRITE_RPS(sl_params->ref_idx_l0[i], REF_PIC_IDX_L0(i)); +@@ -2227,7 +2229,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + + } + +- for (i = 0; i <= sl_params->num_ref_idx_l1_active_minus1; i++) { ++ for (i = 0; i < num_l1_refs; i++) { + WRITE_RPS(!!(dpb[sl_params->ref_idx_l1[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), + REF_PIC_LONG_TERM_L1(i)); + WRITE_RPS(sl_params->ref_idx_l1[i], REF_PIC_IDX_L1(i)); diff --git a/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2001-v4l2-wip-iep-driver.patch b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2001-v4l2-wip-iep-driver.patch new file mode 100644 index 000000000000..e69f13a6a6e1 --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/patches.libreelec/linux-2001-v4l2-wip-iep-driver.patch @@ -0,0 +1,1805 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 11 Oct 2020 17:03:12 +0200 +Subject: [PATCH] dt-bindings: media: Add Rockchip IEP binding + +Signed-off-by: Alex Bee +--- + .../bindings/media/rockchip-iep.yaml | 73 +++++++++++++++++++ + 1 file changed, 73 insertions(+) + create mode 100644 Documentation/devicetree/bindings/media/rockchip-iep.yaml + +diff --git a/Documentation/devicetree/bindings/media/rockchip-iep.yaml b/Documentation/devicetree/bindings/media/rockchip-iep.yaml +new file mode 100644 +index 000000000000..a9efcda13fc1 +--- /dev/null ++++ b/Documentation/devicetree/bindings/media/rockchip-iep.yaml +@@ -0,0 +1,73 @@ ++# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/media/rockchip-iep.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Rockchip Image Enhancement Processor (IEP) ++ ++description: ++ Rockchip IEP supports various image enhancement operations for YUV and RGB domains. ++ Deinterlacing, spatial and temporal sampling noise reduction are supported by the ++ YUV block. Gamma adjustment, edge enhancement, detail enhancement are supported in ++ the RGB block. Brightness, Saturation, Contrast, Hue adjustment is supported for ++ both domains. Furthermore it supports converting RGB to YUV / YUV to RGB. ++ ++maintainers: ++ - Heiko Stuebner ++ ++properties: ++ compatible: ++ oneOf: ++ - const: rockchip,rk3228-iep ++ - items: ++ - enum: ++ - rockchip,rk3288-iep ++ - rockchip,rk3328-iep ++ - rockchip,rk3368-iep ++ - rockchip,rk3399-iep ++ - const: rockchip,rk3228-iep ++ ++ reg: ++ maxItems: 1 ++ ++ interrupts: ++ maxItems: 1 ++ ++ clocks: ++ maxItems: 2 ++ ++ clock-names: ++ items: ++ - const: axi ++ - const: ahb ++ ++ power-domains: ++ maxItems: 1 ++ ++ iommus: ++ maxItems: 1 ++ ++required: ++ - compatible ++ - reg ++ - interrupts ++ - clocks ++ - clock-names ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ iep: iep@20070000 { ++ compatible = "rockchip,rk3228-iep"; ++ reg = <0x20070000 0x800>; ++ interrupts = ; ++ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; ++ clock-names = "axi", "ahb"; ++ iommus = <&iep_mmu>; ++ power-domains = <&power RK3228_PD_VIO>; ++ }; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 11 Oct 2020 21:24:10 +0200 +Subject: [PATCH] media: rockchip: Add Rockchip IEP driver + +Signed-off-by: Alex Bee +--- + drivers/media/platform/rockchip/Kconfig | 1 + + drivers/media/platform/rockchip/Makefile | 1 + + drivers/media/platform/rockchip/iep/Kconfig | 16 + + drivers/media/platform/rockchip/iep/Makefile | 5 + + .../media/platform/rockchip/iep/iep-regs.h | 291 +++++ + drivers/media/platform/rockchip/iep/iep.c | 1089 +++++++++++++++++ + drivers/media/platform/rockchip/iep/iep.h | 112 ++ + 7 files changed, 1515 insertions(+) + create mode 100644 drivers/media/platform/rockchip/iep/Kconfig + create mode 100644 drivers/media/platform/rockchip/iep/Makefile + create mode 100644 drivers/media/platform/rockchip/iep/iep-regs.h + create mode 100644 drivers/media/platform/rockchip/iep/iep.c + create mode 100644 drivers/media/platform/rockchip/iep/iep.h + +diff --git a/drivers/media/platform/rockchip/Kconfig b/drivers/media/platform/rockchip/Kconfig +index b41d3960c1b4..9ff362805ded 100644 +--- a/drivers/media/platform/rockchip/Kconfig ++++ b/drivers/media/platform/rockchip/Kconfig +@@ -2,5 +2,6 @@ + + comment "Rockchip media platform drivers" + ++source "drivers/media/platform/rockchip/iep/Kconfig" + source "drivers/media/platform/rockchip/rga/Kconfig" + source "drivers/media/platform/rockchip/rkisp1/Kconfig" +diff --git a/drivers/media/platform/rockchip/Makefile b/drivers/media/platform/rockchip/Makefile +index 4f782b876ac9..c075ecc2fa14 100644 +--- a/drivers/media/platform/rockchip/Makefile ++++ b/drivers/media/platform/rockchip/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0-only ++obj-y += iep/ + obj-y += rga/ + obj-y += rkisp1/ +diff --git a/drivers/media/platform/rockchip/iep/Kconfig b/drivers/media/platform/rockchip/iep/Kconfig +new file mode 100644 +index 000000000000..d95155a95133 +--- /dev/null ++++ b/drivers/media/platform/rockchip/iep/Kconfig +@@ -0,0 +1,16 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++ ++config VIDEO_ROCKCHIP_IEP ++ tristate "Rockchip Image Enhancement Processor" ++ depends on V4L_MEM2MEM_DRIVERS ++ depends on VIDEO_DEV ++ depends on ARCH_ROCKCHIP || COMPILE_TEST ++ select VIDEOBUF2_DMA_CONTIG ++ select V4L2_MEM2MEM_DEV ++ help ++ This is a v4l2 driver for Rockchip Image Enhancement Processor (IEP) ++ found in most Rockchip RK3xxx SoCs. ++ Rockchip IEP supports various enhancement operations for RGB and YUV ++ images. The driver currently implements YUV deinterlacing only. ++ To compile this driver as a module, choose M here: the module ++ will be called rockchip-iep +diff --git a/drivers/media/platform/rockchip/iep/Makefile b/drivers/media/platform/rockchip/iep/Makefile +new file mode 100644 +index 000000000000..5c89b3277469 +--- /dev/null ++++ b/drivers/media/platform/rockchip/iep/Makefile +@@ -0,0 +1,5 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++ ++rockchip-iep-objs := iep.o ++ ++obj-$(CONFIG_VIDEO_ROCKCHIP_IEP) += rockchip-iep.o +diff --git a/drivers/media/platform/rockchip/iep/iep-regs.h b/drivers/media/platform/rockchip/iep/iep-regs.h +new file mode 100644 +index 000000000000..a68685ef3604 +--- /dev/null ++++ b/drivers/media/platform/rockchip/iep/iep-regs.h +@@ -0,0 +1,291 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Rockchip Image Enhancement Processor (IEP) driver ++ * ++ * Copyright (C) 2020 Alex Bee ++ * ++ */ ++ ++#ifndef __IEP_REGS_H__ ++#define __IEP_REGS_H__ ++ ++/* IEP Registers addresses */ ++#define IEP_CONFIG0 0x000 /* Configuration register0 */ ++#define IEP_VOP_DIRECT_PATH BIT(0) ++#define IEP_DEIN_HIGH_FREQ_SHFT 1 ++#define IEP_DEIN_HIGH_FREQ_MASK (0x7f << IEP_DEIN_HIGH_FREQ_SHFT) ++#define IEP_DEIN_MODE_SHFT 8 ++#define IEP_DEIN_MODE_MASK (7 << IEP_DEIN_MODE_SHFT) ++#define IEP_DEIN_HIGH_FREQ_EN BIT(11) ++#define IEP_DEIN_EDGE_INTPOL_EN BIT(12) ++#define IEP_YUV_DENOISE_EN BIT(13) ++#define IEP_YUV_ENHNC_EN BIT(14) ++#define IEP_DEIN_EDGE_INTPOL_SMTH_EN BIT(15) ++#define IEP_RGB_CLR_ENHNC_EN BIT(16) ++#define IEP_RGB_CNTRST_ENHNC_EN BIT(17) ++#define IEP_RGB_ENHNC_MODE_BYPASS (0 << 18) ++#define IEP_RGB_ENHNC_MODE_DNS BIT(18) ++#define IEP_RGB_ENHNC_MODE_DTL (2 << 18) ++#define IEP_RGB_ENHNC_MODE_EDG (3 << 18) ++#define IEP_RGB_ENHNC_MODE_MASK (3 << 18) ++#define IEP_RGB_CNTRST_ENHNC_DDE_FRST BIT(20) ++#define IEP_DEIN_EDGE_INTPOL_RADIUS_SHFT 21 ++#define IEP_DEIN_EDGE_INTPOL_RADIUS_MASK (3 << IEP_DEIN_EDGE_INTPOL_RADIUS_SHFT) ++#define IEP_DEIN_EDGE_INTPOL_SELECT BIT(23) ++ ++#define IEP_CONFIG1 0x004 /* Configuration register1 */ ++#define IEP_SRC_FMT_SHFT 0 ++#define IEP_SRC_FMT_MASK (3 << IEP_SRC_FMT_SHFT) ++#define IEP_SRC_RGB_SWP_SHFT 2 ++#define IEP_SRC_RGB_SWP_MASK (2 << IEP_SRC_RGB_SWP_SHFT) ++#define IEP_SRC_YUV_SWP_SHFT 4 ++#define IEP_SRC_YUV_SWP_MASK (3 << IEP_SRC_YUV_SWP_SHFT) ++#define IEP_DST_FMT_SHFT 8 ++#define IEP_DST_FMT_MASK (3 << IEP_DST_FMT_SHFT) ++#define IEP_DST_RGB_SWP_SHFT 10 ++#define IEP_DST_RGB_SWP_MASK (2 << IEP_DST_RGB_SWP_SHFT) ++#define IEP_DST_YUV_SWP_SHFT 12 ++#define IEP_DST_YUV_SWP_MASK (3 << IEP_DST_YUV_SWP_SHFT) ++#define IEP_DTH_UP_EN BIT(14) ++#define IEP_DTH_DWN_EN BIT(15) ++#define IEP_YUV2RGB_COE_BT601_1 (0 << 16) ++#define IEP_YUV2RGB_COE_BT601_F BIT(16) ++#define IEP_YUV2RGB_COE_BT709_1 (2 << 16) ++#define IEP_YUV2RGB_COE_BT709_F (3 << 16) ++#define IEP_YUV2RGB_COE_MASK (3 << 16) ++#define IEP_RGB2YUV_COE_BT601_1 (0 << 18) ++#define IEP_RGB2YUV_COE_BT601_F BIT(18) ++#define IEP_RGB2YUV_COE_BT709_1 (2 << 18) ++#define IEP_RGB2YUV_COE_BT709_F (3 << 18) ++#define IEP_RGB2YUV_COE_MASK (3 << 18) ++#define IEP_YUV2RGB_EN BIT(20) ++#define IEP_RGB2YUV_EN BIT(21) ++#define IEP_YUV2RGB_CLIP_EN BIT(22) ++#define IEP_RGB2YUV_CLIP_EN BIT(23) ++#define IEP_GLB_ALPHA_SHFT 24 ++#define IEP_GLB_ALPHA_MASK (0x7f << IEP_GLB_ALPHA_SHFT) ++ ++#define IEP_STATUS 0x008 /* Status register */ ++#define IEP_STATUS_YUV_DNS BIT(0) ++#define IEP_STATUS_SCL BIT(1) ++#define IEP_STATUS_DIL BIT(2) ++#define IEP_STATUS_DDE BIT(3) ++#define IEP_STATUS_DMA_WR_YUV BIT(4) ++#define IEP_STATUS_DMA_RE_YUV BIT(5) ++#define IEP_STATUS_DMA_WR_RGB BIT(6) ++#define IEP_STATUS_DMA_RE_RGB BIT(7) ++#define IEP_STATUS_VOP_DIRECT_PATH BIT(8) ++#define IEP_STATUS_DMA_IA_WR_YUV BIT(16) ++#define IEP_STATUS_DMA_IA_RE_YUV BIT(17) ++#define IEP_STATUS_DMA_IA_WR_RGB BIT(18) ++#define IEP_STATUS_DMA_IA_RE_RGB BIT(19) ++ ++#define IEP_INT 0x00c /* Interrupt register*/ ++#define IEP_INT_FRAME_DONE BIT(0) /* Frame process done interrupt */ ++#define IEP_INT_FRAME_DONE_EN BIT(8) /* Frame process done interrupt enable */ ++#define IEP_INT_FRAME_DONE_CLR BIT(16) /* Frame process done interrupt clear */ ++ ++#define IEP_FRM_START 0x010 /* Frame start */ ++#define IEP_SRST 0x014 /* Soft reset */ ++#define IEP_CONFIG_DONE 0x018 /* Configuration done */ ++#define IEP_FRM_CNT 0x01c /* Frame counter */ ++ ++#define IEP_VIR_IMG_WIDTH 0x020 /* Image virtual width */ ++#define IEP_IMG_SCL_FCT 0x024 /* Scaling factor */ ++#define IEP_SRC_IMG_SIZE 0x028 /* src image width/height */ ++#define IEP_DST_IMG_SIZE 0x02c /* dst image width/height */ ++#define IEP_DST_IMG_WIDTH_TILE0 0x030 /* dst image tile0 width */ ++#define IEP_DST_IMG_WIDTH_TILE1 0x034 /* dst image tile1 width */ ++#define IEP_DST_IMG_WIDTH_TILE2 0x038 /* dst image tile2 width */ ++#define IEP_DST_IMG_WIDTH_TILE3 0x03c /* dst image tile3 width */ ++ ++#define IEP_ENH_YUV_CNFG_0 0x040 /* Brightness, contrast, saturation adjustment */ ++#define IEP_YUV_BRIGHTNESS_SHFT 0 ++#define IEP_YUV_BRIGHTNESS_MASK (0x3f << IEP_YUV_BRIGHTNESS_SHFT) ++#define IEP_YUV_CONTRAST_SHFT 8 ++#define IEP_YUV_CONTRAST_MASK (0xff << IEP_YUV_CONTRAST_SHFT) ++#define IEP_YUV_SATURATION_SHFT 16 ++#define IEP_YUV_SATURATION_MASK (0x1ff << IEP_YUV_SATURATION_SHFT) ++ ++#define IEP_ENH_YUV_CNFG_1 0x044 /* Hue configuration */ ++#define IEP_YUV_COS_HUE_SHFT 0 ++#define IEP_YUV_COS_HUE_MASK (0xff << IEP_YUV_COS_HUE_SHFT) ++#define IEP_YUV_SIN_HUE_SHFT 8 ++#define IEP_YUV_SIN_HUE_MASK (0xff << IEP_YUV_SIN_HUE_SHFT) ++ ++#define IEP_ENH_YUV_CNFG_2 0x048 /* Color bar configuration */ ++#define IEP_YUV_COLOR_BAR_Y_SHFT 0 ++#define IEP_YUV_COLOR_BAR_Y_MASK (0xff << IEP_YUV_COLOR_BAR_Y_SHFT) ++#define IEP_YUV_COLOR_BAR_U_SHFT 8 ++#define IEP_YUV_COLOR_BAR_U_MASK (0xff << IEP_YUV_COLOR_BAR_U_SHFT) ++#define IEP_YUV_COLOR_BAR_V_SHFT 16 ++#define IEP_YUV_COLOR_BAR_V_MASK (0xff << IEP_YUV_COLOR_BAR_V_SHFT) ++#define IEP_YUV_VIDEO_MODE_SHFT 24 ++#define IEP_YUV_VIDEO_MODE_MASK (3 << IEP_YUV_VIDEO_MODE_SHFT) ++ ++#define IEP_ENH_RGB_CNFG 0x04c /* RGB enhancement configuration */ ++#define IEP_ENH_RGB_C_COE 0x050 /* RGB color enhancement coefficient */ ++ ++#define IEP_RAW_CONFIG0 0x058 /* Raw configuration register0 */ ++#define IEP_RAW_CONFIG1 0x05c /* Raw configuration register1 */ ++#define IEP_RAW_VIR_IMG_WIDTH 0x060 /* Raw image virtual width */ ++#define IEP_RAW_IMG_SCL_FCT 0x064 /* Raw scaling factor */ ++#define IEP_RAW_SRC_IMG_SIZE 0x068 /* Raw src image width/height */ ++#define IEP_RAW_DST_IMG_SIZE 0x06c /* Raw src image width/height */ ++#define IEP_RAW_ENH_YUV_CNFG_0 0x070 /* Raw brightness,contrast,saturation adjustment */ ++#define IEP_RAW_ENH_YUV_CNFG_1 0x074 /* Raw hue configuration */ ++#define IEP_RAW_ENH_YUV_CNFG_2 0x078 /* Raw color bar configuration */ ++#define IEP_RAW_ENH_RGB_CNFG 0x07c /* Raw RGB enhancement configuration */ ++ ++#define IEP_SRC_ADDR_Y_RGB 0x080 /* Start addr. of src image 0 (Y/RGB) */ ++#define IEP_SRC_ADDR_CBCR 0x084 /* Start addr. of src image 0 (Cb/Cr) */ ++#define IEP_SRC_ADDR_CR 0x088 /* Start addr. of src image 0 (Cr) */ ++#define IEP_SRC_ADDR_Y1 0x08c /* Start addr. of src image 1 (Y) */ ++#define IEP_SRC_ADDR_CBCR1 0x090 /* Start addr. of src image 1 (Cb/Cr) */ ++#define IEP_SRC_ADDR_CR1 0x094 /* Start addr. of src image 1 (Cr) */ ++#define IEP_SRC_ADDR_Y_ITEMP 0x098 /* Start addr. of src image(Y int part) */ ++#define IEP_SRC_ADDR_CBCR_ITEMP 0x09c /* Start addr. of src image(CBCR int part) */ ++#define IEP_SRC_ADDR_CR_ITEMP 0x0a0 /* Start addr. of src image(CR int part) */ ++#define IEP_SRC_ADDR_Y_FTEMP 0x0a4 /* Start addr. of src image(Y frac part) */ ++#define IEP_SRC_ADDR_CBCR_FTEMP 0x0a8 /* Start addr. of src image(CBCR frac part) */ ++#define IEP_SRC_ADDR_CR_FTEMP 0x0ac /* Start addr. of src image(CR frac part) */ ++ ++#define IEP_DST_ADDR_Y_RGB 0x0b0 /* Start addr. of dst image 0 (Y/RGB) */ ++#define IEP_DST_ADDR_CBCR 0x0b4 /* Start addr. of dst image 0 (Cb/Cr) */ ++#define IEP_DST_ADDR_CR 0x0b8 /* Start addr. of dst image 0 (Cr) */ ++#define IEP_DST_ADDR_Y1 0x0bc /* Start addr. of dst image 1 (Y) */ ++#define IEP_DST_ADDR_CBCR1 0x0c0 /* Start addr. of dst image 1 (Cb/Cr) */ ++#define IEP_DST_ADDR_CR1 0x0c4 /* Start addr. of dst image 1 (Cr) */ ++#define IEP_DST_ADDR_Y_ITEMP 0x0c8 /* Start addr. of dst image(Y int part) */ ++#define IEP_DST_ADDR_CBCR_ITEMP 0x0cc /* Start addr. of dst image(CBCR int part)*/ ++#define IEP_DST_ADDR_CR_ITEMP 0x0d0 /* Start addr. of dst image(CR int part) */ ++#define IEP_DST_ADDR_Y_FTEMP 0x0d4 /* Start addr. of dst image(Y frac part) */ ++#define IEP_DST_ADDR_CBCR_FTEMP 0x0d8 /* Start addr. of dst image(CBCR frac part) */ ++#define IEP_DST_ADDR_CR_FTEMP 0x0dc /* Start addr. of dst image(CR frac part)*/ ++ ++#define IEP_DEIN_MTN_TAB0 0x0e0 /* Deinterlace motion table0 */ ++#define IEP_DEIN_MTN_TAB1 0x0e4 /* Deinterlace motion table1 */ ++#define IEP_DEIN_MTN_TAB2 0x0e8 /* Deinterlace motion table2 */ ++#define IEP_DEIN_MTN_TAB3 0x0ec /* Deinterlace motion table3 */ ++#define IEP_DEIN_MTN_TAB4 0x0f0 /* Deinterlace motion table4 */ ++#define IEP_DEIN_MTN_TAB5 0x0f4 /* Deinterlace motion table5 */ ++#define IEP_DEIN_MTN_TAB6 0x0f8 /* Deinterlace motion table6 */ ++#define IEP_DEIN_MTN_TAB7 0x0fc /* Deinterlace motion table7 */ ++ ++#define IEP_ENH_CG_TAB 0x100 /* Contrast and gamma enhancement table */ ++#define IEP_ENH_DDE_COE0 0x400 /* Denoise,detail and edge enhancement coefficient */ ++#define IEP_ENH_DDE_COE1 0x500 /* Denoise,detail and edge enhancement coefficient1 */ ++ ++#define IEP_INT_MASK (IEP_INT_FRAME_DONE) ++ ++/* IEP colorformats */ ++#define IEP_COLOR_FMT_XRGB 0U ++#define IEP_COLOR_FMT_RGB565 1U ++#define IEP_COLOR_FMT_YUV422 2U ++#define IEP_COLOR_FMT_YUV420 3U ++ ++/* IEP YUV color swaps */ ++#define IEP_YUV_SWP_SP_UV 0U ++#define IEP_YUV_SWP_SP_VU 1U ++#define IEP_YUV_SWP_P 2U ++ ++/* IEP XRGB color swaps */ ++#define XRGB_SWP_XRGB 0U ++#define XRGB_SWP_XBGR 1U ++#define XRGB_SWP_BGRX 2U ++ ++/* IEP RGB565 color swaps */ ++#define RGB565_SWP_RGB 0U ++#define RGB565_SWP_BGR 1U ++ ++#define FMT_IS_YUV(fmt) (fmt == IEP_COLOR_FMT_XRGB || fmt == IEP_COLOR_FMT_RGB565 ? 0 : 1) ++ ++#define IEP_IMG_SIZE(w, h) (((w - 1) & 0x1fff) << 0 | \ ++ ((h - 1) & 0x1fff) << 16) ++ ++#define IEP_VIR_WIDTH(src_w, dst_w) (((src_w / 4) & 0x1fff) << 0 | \ ++ ((dst_w / 4) & 0x1fff) << 16) ++ ++#define IEP_Y_STRIDE(w, h) (w * h) ++#define IEP_UV_STRIDE(w, h, fac) (w * h + w * h / fac) ++ ++#define IEP_SRC_FMT_SWP_MASK(f) (FMT_IS_YUV(f) ? IEP_SRC_YUV_SWP_MASK : IEP_SRC_RGB_SWP_MASK) ++#define IEP_DST_FMT_SWP_MASK(f) (FMT_IS_YUV(f) ? IEP_DST_YUV_SWP_MASK : IEP_DST_RGB_SWP_MASK) ++ ++#define IEP_SRC_FMT(f, swp) (f << IEP_SRC_FMT_SHFT | \ ++ (swp << (FMT_IS_YUV(f) ? IEP_SRC_YUV_SWP_SHFT : IEP_SRC_RGB_SWP_SHFT))) ++#define IEP_DST_FMT(f, swp) (f << IEP_DST_FMT_SHFT | \ ++ (swp << (FMT_IS_YUV(f) ? IEP_DST_YUV_SWP_SHFT : IEP_DST_RGB_SWP_SHFT))) ++ ++/* IEP DEINTERLACE MODES */ ++#define IEP_DEIN_MODE_YUV 0U ++#define IEP_DEIN_MODE_I4O2 1U ++#define IEP_DEIN_MODE_I4O1B 2U ++#define IEP_DEIN_MODE_I4O1T 3U ++#define IEP_DEIN_MODE_I2O1B 4U ++#define IEP_DEIN_MODE_I2O1T 5U ++#define IEP_DEIN_MODE_BYPASS 6U ++ ++#define IEP_DEIN_IN_FIELDS_2 2U ++#define IEP_DEIN_IN_FIELDS_4 4U ++ ++#define IEP_DEIN_OUT_FRAMES_1 1U ++#define IEP_DEIN_OUT_FRAMES_2 2U ++ ++/* values taken from BSP driver */ ++static const u32 default_dein_motion_tbl[][2] = { ++ { IEP_DEIN_MTN_TAB0, 0x40404040 }, ++ { IEP_DEIN_MTN_TAB1, 0x3c3e3f3f }, ++ { IEP_DEIN_MTN_TAB2, 0x3336393b }, ++ { IEP_DEIN_MTN_TAB3, 0x272a2d31 }, ++ { IEP_DEIN_MTN_TAB4, 0x181c2023 }, ++ { IEP_DEIN_MTN_TAB5, 0x0c0e1215 }, ++ { IEP_DEIN_MTN_TAB6, 0x03040609 }, ++ { IEP_DEIN_MTN_TAB7, 0x00000001 }, ++ ++}; ++ ++#define IEP_DEIN_IN_IMG0_Y(bff) (bff ? IEP_SRC_ADDR_Y_RGB : IEP_SRC_ADDR_Y1) ++#define IEP_DEIN_IN_IMG0_CBCR(bff) (bff ? IEP_SRC_ADDR_CBCR : IEP_SRC_ADDR_CBCR1) ++#define IEP_DEIN_IN_IMG0_CR(bff) (bff ? IEP_SRC_ADDR_CR : IEP_SRC_ADDR_CR1) ++#define IEP_DEIN_IN_IMG1_Y(bff) (IEP_DEIN_IN_IMG0_Y(!bff)) ++#define IEP_DEIN_IN_IMG1_CBCR(bff) (IEP_DEIN_IN_IMG0_CBCR(!bff)) ++#define IEP_DEIN_IN_IMG1_CR(bff) (IEP_DEIN_IN_IMG0_CR(!bff)) ++ ++#define IEP_DEIN_OUT_IMG0_Y(bff) (bff ? IEP_DST_ADDR_Y1 : IEP_DST_ADDR_Y_RGB) ++#define IEP_DEIN_OUT_IMG0_CBCR(bff) (bff ? IEP_DST_ADDR_CBCR1 : IEP_DST_ADDR_CBCR) ++#define IEP_DEIN_OUT_IMG0_CR(bff) (bff ? IEP_DST_ADDR_CR1 : IEP_DST_ADDR_CR) ++#define IEP_DEIN_OUT_IMG1_Y(bff) (IEP_DEIN_OUT_IMG0_Y(!bff)) ++#define IEP_DEIN_OUT_IMG1_CBCR(bff) (IEP_DEIN_OUT_IMG0_CBCR(!bff)) ++#define IEP_DEIN_OUT_IMG1_CR(bff) (IEP_DEIN_OUT_IMG0_CR(!bff)) ++ ++#define IEP_DEIN_MODE(m) (m << IEP_DEIN_MODE_SHFT) ++ ++#define IEP_DEIN_IN_MODE_FIELDS(m) ((m == IEP_DEIN_MODE_I4O1T || m == IEP_DEIN_MODE_I4O1B \ ++ || m == IEP_DEIN_MODE_I4O2) \ ++ ? IEP_DEIN_IN_FIELDS_4 : IEP_DEIN_IN_FIELDS_2) ++ ++#define IEP_DEIN_OUT_MODE_FRAMES(m) (m == IEP_DEIN_MODE_I4O2 \ ++ ? IEP_DEIN_OUT_FRAMES_2 : IEP_DEIN_OUT_FRAMES_1) ++ ++#define IEP_DEIN_OUT_MODE_1FRM_TOP_FIELD(m) (m == IEP_DEIN_MODE_I4O1T || IEP_DEIN_MODE_I2O1T \ ++ ? 1 : 0) ++ ++#define IEP_DEIN_EDGE_INTPOL_RADIUS(r) (r << IEP_DEIN_EDGE_INTPOL_RADIUS_SHFT) ++ ++#define IEP_DEIN_HIGH_FREQ(f) (f << IEP_DEIN_HIGH_FREQ_SHFT) ++ ++/* YUV Enhance video modes */ ++#define VIDEO_MODE_BLACK_SCREEN 0U ++#define VIDEO_MODE_BLUE_SCREEN 1U ++#define VIDEO_MODE_COLOR_BARS 2U ++#define VIDEO_MODE_NORMAL_VIDEO 3U ++ ++#define YUV_VIDEO_MODE(m) ((m << IEP_YUV_VIDEO_MODE_SHFT) & IEP_YUV_VIDEO_MODE_MASK) ++#define YUV_BRIGHTNESS(v) ((v << IEP_YUV_BRIGHTNESS_SHFT) & IEP_YUV_BRIGHTNESS_MASK) ++#define YUV_CONTRAST(v) ((v << IEP_YUV_CONTRAST_SHFT) & IEP_YUV_CONTRAST_MASK) ++#define YUV_SATURATION(v) ((v << IEP_YUV_SATURATION_SHFT) & IEP_YUV_SATURATION_MASK) ++#define YUV_COS_HUE(v) ((v << IEP_YUV_COS_HUE_SHFT) & IEP_YUV_COS_HUE_MASK) ++#define YUV_SIN_HUE(v) ((v << IEP_YUV_SIN_HUE_SHFT) & IEP_YUV_SIN_HUE_MASK) ++ ++#endif +diff --git a/drivers/media/platform/rockchip/iep/iep.c b/drivers/media/platform/rockchip/iep/iep.c +new file mode 100644 +index 000000000000..f4b9320733be +--- /dev/null ++++ b/drivers/media/platform/rockchip/iep/iep.c +@@ -0,0 +1,1089 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Rockchip Image Enhancement Processor (IEP) driver ++ * ++ * Copyright (C) 2020 Alex Bee ++ * ++ * Based on Allwinner sun8i deinterlacer with scaler driver ++ * Copyright (C) 2019 Jernej Skrabec ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "iep-regs.h" ++#include "iep.h" ++ ++static struct iep_fmt formats[] = { ++ { ++ .fourcc = V4L2_PIX_FMT_NV12, ++ .color_swap = IEP_YUV_SWP_SP_UV, ++ .hw_format = IEP_COLOR_FMT_YUV420, ++ .depth = 12, ++ .uv_factor = 4, ++ }, ++ { ++ .fourcc = V4L2_PIX_FMT_NV21, ++ .color_swap = IEP_YUV_SWP_SP_VU, ++ .hw_format = IEP_COLOR_FMT_YUV420, ++ .depth = 12, ++ .uv_factor = 4, ++ }, ++ { ++ .fourcc = V4L2_PIX_FMT_NV16, ++ .color_swap = IEP_YUV_SWP_SP_UV, ++ .hw_format = IEP_COLOR_FMT_YUV422, ++ .depth = 16, ++ .uv_factor = 2, ++ }, ++ { ++ .fourcc = V4L2_PIX_FMT_NV61, ++ .color_swap = IEP_YUV_SWP_SP_VU, ++ .hw_format = IEP_COLOR_FMT_YUV422, ++ .depth = 16, ++ .uv_factor = 2, ++ }, ++ { ++ .fourcc = V4L2_PIX_FMT_YUV420, ++ .color_swap = IEP_YUV_SWP_P, ++ .hw_format = IEP_COLOR_FMT_YUV420, ++ .depth = 12, ++ .uv_factor = 4, ++ }, ++ { ++ .fourcc = V4L2_PIX_FMT_YUV422P, ++ .color_swap = IEP_YUV_SWP_P, ++ .hw_format = IEP_COLOR_FMT_YUV422, ++ .depth = 16, ++ .uv_factor = 2, ++ }, ++}; ++ ++static struct iep_fmt *iep_fmt_find(struct v4l2_pix_format *pix_fmt) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(formats); i++) { ++ if (formats[i].fourcc == pix_fmt->pixelformat) ++ return &formats[i]; ++ } ++ ++ return NULL; ++} ++ ++static bool iep_check_pix_format(u32 pixelformat) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(formats); i++) ++ if (formats[i].fourcc == pixelformat) ++ return true; ++ ++ return false; ++} ++ ++static struct vb2_v4l2_buffer *iep_m2m_next_dst_buf(struct iep_ctx *ctx) ++{ ++ struct vb2_v4l2_buffer *dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); ++ ++ /* application has set a dst sequence: take it as start point */ ++ if (ctx->dst_sequence == 0 && dst_buf->sequence > 0) ++ ctx->dst_sequence = dst_buf->sequence; ++ ++ dst_buf->sequence = ctx->dst_sequence++; ++ ++ return dst_buf; ++} ++ ++static void iep_m2m_dst_bufs_done(struct iep_ctx *ctx, enum vb2_buffer_state state) ++{ ++ if (ctx->dst0_buf) { ++ v4l2_m2m_buf_done(ctx->dst0_buf, state); ++ ctx->dst_buffs_done++; ++ ctx->dst0_buf = NULL; ++ } ++ ++ if (ctx->dst1_buf) { ++ v4l2_m2m_buf_done(ctx->dst1_buf, state); ++ ctx->dst_buffs_done++; ++ ctx->dst1_buf = NULL; ++ } ++} ++ ++static void iep_setup_formats(struct iep_ctx *ctx) ++{ ++ /* setup src dimensions */ ++ iep_write(ctx->iep, IEP_SRC_IMG_SIZE, ++ IEP_IMG_SIZE(ctx->src_fmt.pix.width, ctx->src_fmt.pix.height)); ++ ++ /* setup dst dimensions */ ++ iep_write(ctx->iep, IEP_DST_IMG_SIZE, ++ IEP_IMG_SIZE(ctx->dst_fmt.pix.width, ctx->dst_fmt.pix.height)); ++ ++ /* setup virtual width */ ++ iep_write(ctx->iep, IEP_VIR_IMG_WIDTH, ++ IEP_VIR_WIDTH(ctx->src_fmt.pix.width, ctx->dst_fmt.pix.width)); ++ ++ /* setup src format */ ++ iep_shadow_mod(ctx->iep, IEP_CONFIG1, IEP_RAW_CONFIG1, ++ IEP_SRC_FMT_MASK | IEP_SRC_FMT_SWP_MASK(ctx->src_fmt.hw_fmt->hw_format), ++ IEP_SRC_FMT(ctx->src_fmt.hw_fmt->hw_format, ++ ctx->src_fmt.hw_fmt->color_swap)); ++ /* setup dst format */ ++ iep_shadow_mod(ctx->iep, IEP_CONFIG1, IEP_RAW_CONFIG1, ++ IEP_DST_FMT_MASK | IEP_DST_FMT_SWP_MASK(ctx->dst_fmt.hw_fmt->hw_format), ++ IEP_DST_FMT(ctx->dst_fmt.hw_fmt->hw_format, ++ ctx->dst_fmt.hw_fmt->color_swap)); ++ ++ ctx->fmt_changed = false; ++} ++ ++static void iep_dein_init(struct rockchip_iep *iep) ++{ ++ unsigned int i; ++ ++ /* values taken from BSP driver */ ++ iep_shadow_mod(iep, IEP_CONFIG0, IEP_RAW_CONFIG0, ++ (IEP_DEIN_EDGE_INTPOL_SMTH_EN | ++ IEP_DEIN_EDGE_INTPOL_RADIUS_MASK | ++ IEP_DEIN_HIGH_FREQ_EN | ++ IEP_DEIN_HIGH_FREQ_MASK), ++ (IEP_DEIN_EDGE_INTPOL_SMTH_EN | ++ IEP_DEIN_EDGE_INTPOL_RADIUS(3) | ++ IEP_DEIN_HIGH_FREQ_EN | ++ IEP_DEIN_HIGH_FREQ(64))); ++ ++ for (i = 0; i < ARRAY_SIZE(default_dein_motion_tbl); i++) ++ iep_write(iep, default_dein_motion_tbl[i][0], ++ default_dein_motion_tbl[i][1]); ++} ++ ++static void iep_init(struct rockchip_iep *iep) ++{ ++ iep_write(iep, IEP_CONFIG0, ++ IEP_DEIN_MODE(IEP_DEIN_MODE_BYPASS) // | ++ //IEP_YUV_ENHNC_EN ++ ); ++ ++ /* TODO: B/S/C/H works ++ * only in 1-frame-out modes ++ iep_write(iep, IEP_ENH_YUV_CNFG_0, ++ YUV_BRIGHTNESS(0) | ++ YUV_CONTRAST(128) | ++ YUV_SATURATION(128)); ++ ++ iep_write(iep, IEP_ENH_YUV_CNFG_1, ++ YUV_COS_HUE(255) | ++ YUV_SIN_HUE(255)); ++ ++ iep_write(iep, IEP_ENH_YUV_CNFG_2, ++ YUV_VIDEO_MODE(VIDEO_MODE_NORMAL_VIDEO)); ++ ++ */ ++ ++ /* reset frame counter */ ++ iep_write(iep, IEP_FRM_CNT, 0); ++} ++ ++static void iep_device_run(void *priv) ++{ ++ struct iep_ctx *ctx = priv; ++ struct rockchip_iep *iep = ctx->iep; ++ struct vb2_v4l2_buffer *src, *dst; ++ unsigned int dein_mode; ++ dma_addr_t addr; ++ ++ if (ctx->fmt_changed) ++ iep_setup_formats(ctx); ++ ++ if (ctx->prev_src_buf) ++ dein_mode = IEP_DEIN_MODE_I4O2; ++ else ++ dein_mode = ctx->field_bff ? IEP_DEIN_MODE_I2O1B : IEP_DEIN_MODE_I2O1T; ++ ++ iep_shadow_mod(iep, IEP_CONFIG0, IEP_RAW_CONFIG0, ++ IEP_DEIN_MODE_MASK, IEP_DEIN_MODE(dein_mode)); ++ ++ /* sync RAW_xxx registers with actual used */ ++ iep_write(iep, IEP_CONFIG_DONE, 1); ++ ++ /* setup src buff(s)/addresses */ ++ src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); ++ addr = vb2_dma_contig_plane_dma_addr(&src->vb2_buf, 0); ++ ++ iep_write(iep, IEP_DEIN_IN_IMG0_Y(ctx->field_bff), addr); ++ ++ iep_write(iep, IEP_DEIN_IN_IMG0_CBCR(ctx->field_bff), ++ addr + ctx->src_fmt.y_stride); ++ ++ iep_write(iep, IEP_DEIN_IN_IMG0_CR(ctx->field_bff), ++ addr + ctx->src_fmt.uv_stride); ++ ++ if (IEP_DEIN_IN_MODE_FIELDS(dein_mode) == IEP_DEIN_IN_FIELDS_4) ++ addr = vb2_dma_contig_plane_dma_addr(&ctx->prev_src_buf->vb2_buf, 0); ++ ++ iep_write(iep, IEP_DEIN_IN_IMG1_Y(ctx->field_bff), addr); ++ ++ iep_write(iep, IEP_DEIN_IN_IMG1_CBCR(ctx->field_bff), ++ addr + ctx->src_fmt.y_stride); ++ ++ iep_write(iep, IEP_DEIN_IN_IMG1_CR(ctx->field_bff), ++ addr + ctx->src_fmt.uv_stride); ++ ++ /* setup dst buff(s)/addresses */ ++ dst = iep_m2m_next_dst_buf(ctx); ++ addr = vb2_dma_contig_plane_dma_addr(&dst->vb2_buf, 0); ++ ++ if (IEP_DEIN_OUT_MODE_FRAMES(dein_mode) == IEP_DEIN_OUT_FRAMES_2) { ++ v4l2_m2m_buf_copy_metadata(ctx->prev_src_buf, dst, true); ++ ++ iep_write(iep, IEP_DEIN_OUT_IMG0_Y(ctx->field_bff), addr); ++ ++ iep_write(iep, IEP_DEIN_OUT_IMG0_CBCR(ctx->field_bff), ++ addr + ctx->dst_fmt.y_stride); ++ ++ iep_write(iep, IEP_DEIN_OUT_IMG0_CR(ctx->field_bff), ++ addr + ctx->dst_fmt.uv_stride); ++ ++ ctx->dst0_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); ++ ++ dst = iep_m2m_next_dst_buf(ctx); ++ addr = vb2_dma_contig_plane_dma_addr(&dst->vb2_buf, 0); ++ } ++ ++ v4l2_m2m_buf_copy_metadata(src, dst, true); ++ ++ iep_write(iep, IEP_DEIN_OUT_IMG1_Y(ctx->field_bff), addr); ++ ++ iep_write(iep, IEP_DEIN_OUT_IMG1_CBCR(ctx->field_bff), ++ addr + ctx->dst_fmt.y_stride); ++ ++ iep_write(iep, IEP_DEIN_OUT_IMG1_CR(ctx->field_bff), ++ addr + ctx->dst_fmt.uv_stride); ++ ++ ctx->dst1_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); ++ ++ iep_mod(ctx->iep, IEP_INT, IEP_INT_FRAME_DONE_EN, ++ IEP_INT_FRAME_DONE_EN); ++ ++ /* start HW */ ++ iep_write(iep, IEP_FRM_START, 1); ++} ++ ++static int iep_job_ready(void *priv) ++{ ++ struct iep_ctx *ctx = priv; ++ ++ return v4l2_m2m_num_dst_bufs_ready(ctx->fh.m2m_ctx) >= 2 && ++ v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) >= 1; ++} ++ ++static void iep_job_abort(void *priv) ++{ ++ struct iep_ctx *ctx = priv; ++ ++ /* Will cancel the transaction in the next interrupt handler */ ++ ctx->job_abort = true; ++} ++ ++static const struct v4l2_m2m_ops iep_m2m_ops = { ++ .device_run = iep_device_run, ++ .job_ready = iep_job_ready, ++ .job_abort = iep_job_abort, ++}; ++ ++static int iep_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, ++ unsigned int *nplanes, unsigned int sizes[], ++ struct device *alloc_devs[]) ++{ ++ struct iep_ctx *ctx = vb2_get_drv_priv(vq); ++ struct v4l2_pix_format *pix_fmt; ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) ++ pix_fmt = &ctx->src_fmt.pix; ++ else ++ pix_fmt = &ctx->dst_fmt.pix; ++ ++ if (*nplanes) { ++ if (sizes[0] < pix_fmt->sizeimage) ++ return -EINVAL; ++ } else { ++ sizes[0] = pix_fmt->sizeimage; ++ *nplanes = 1; ++ } ++ ++ return 0; ++} ++ ++static int iep_buf_prepare(struct vb2_buffer *vb) ++{ ++ struct vb2_queue *vq = vb->vb2_queue; ++ struct iep_ctx *ctx = vb2_get_drv_priv(vq); ++ struct v4l2_pix_format *pix_fmt; ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) ++ pix_fmt = &ctx->src_fmt.pix; ++ else ++ pix_fmt = &ctx->dst_fmt.pix; ++ ++ if (vb2_plane_size(vb, 0) < pix_fmt->sizeimage) ++ return -EINVAL; ++ ++ /* set bytesused for capture buffers */ ++ if (!V4L2_TYPE_IS_OUTPUT(vq->type)) ++ vb2_set_plane_payload(vb, 0, pix_fmt->sizeimage); ++ ++ return 0; ++} ++ ++static void iep_buf_queue(struct vb2_buffer *vb) ++{ ++ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); ++ struct iep_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); ++ ++ v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); ++} ++ ++static void iep_queue_cleanup(struct vb2_queue *vq, u32 state) ++{ ++ struct iep_ctx *ctx = vb2_get_drv_priv(vq); ++ struct vb2_v4l2_buffer *vbuf; ++ ++ do { ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) ++ vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); ++ else ++ vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); ++ ++ if (vbuf) ++ v4l2_m2m_buf_done(vbuf, state); ++ } while (vbuf); ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type) && ctx->prev_src_buf) ++ v4l2_m2m_buf_done(ctx->prev_src_buf, state); ++ else ++ iep_m2m_dst_bufs_done(ctx, state); ++} ++ ++static int iep_start_streaming(struct vb2_queue *vq, unsigned int count) ++{ ++ struct iep_ctx *ctx = vb2_get_drv_priv(vq); ++ struct device *dev = ctx->iep->dev; ++ int ret; ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) { ++ ret = pm_runtime_get_sync(dev); ++ if (ret < 0) { ++ dev_err(dev, "Failed to enable module\n"); ++ goto err_runtime_get; ++ } ++ ++ ctx->field_order_bff = ++ ctx->src_fmt.pix.field == V4L2_FIELD_INTERLACED_BT; ++ ctx->field_bff = ctx->field_order_bff; ++ ++ ctx->src_sequence = 0; ++ ctx->dst_sequence = 0; ++ ++ ctx->prev_src_buf = NULL; ++ ++ ctx->dst0_buf = NULL; ++ ctx->dst1_buf = NULL; ++ ctx->dst_buffs_done = 0; ++ ++ ctx->job_abort = false; ++ ++ iep_init(ctx->iep); ++ //if (ctx->src_fmt.pix.field != ctx->dst_fmt.pix.field) ++ iep_dein_init(ctx->iep); ++ } ++ ++ return 0; ++ ++err_runtime_get: ++ iep_queue_cleanup(vq, VB2_BUF_STATE_QUEUED); ++ ++ return ret; ++} ++ ++static void iep_stop_streaming(struct vb2_queue *vq) ++{ ++ struct iep_ctx *ctx = vb2_get_drv_priv(vq); ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) { ++ pm_runtime_mark_last_busy(ctx->iep->dev); ++ pm_runtime_put_autosuspend(ctx->iep->dev); ++ } ++ ++ iep_queue_cleanup(vq, VB2_BUF_STATE_ERROR); ++} ++ ++static const struct vb2_ops iep_qops = { ++ .queue_setup = iep_queue_setup, ++ .buf_prepare = iep_buf_prepare, ++ .buf_queue = iep_buf_queue, ++ .start_streaming = iep_start_streaming, ++ .stop_streaming = iep_stop_streaming, ++ .wait_prepare = vb2_ops_wait_prepare, ++ .wait_finish = vb2_ops_wait_finish, ++}; ++ ++static int iep_queue_init(void *priv, struct vb2_queue *src_vq, ++ struct vb2_queue *dst_vq) ++{ ++ struct iep_ctx *ctx = priv; ++ int ret; ++ ++ src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ src_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | ++ DMA_ATTR_NO_KERNEL_MAPPING; ++ src_vq->io_modes = VB2_MMAP | VB2_DMABUF; ++ src_vq->drv_priv = ctx; ++ src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); ++ src_vq->min_queued_buffers = 1; ++ src_vq->ops = &iep_qops; ++ src_vq->mem_ops = &vb2_dma_contig_memops; ++ src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ++ src_vq->lock = &ctx->iep->mutex; ++ src_vq->dev = ctx->iep->v4l2_dev.dev; ++ ++ ret = vb2_queue_init(src_vq); ++ if (ret) ++ return ret; ++ ++ dst_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | ++ DMA_ATTR_NO_KERNEL_MAPPING; ++ dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ dst_vq->io_modes = VB2_MMAP | VB2_DMABUF; ++ dst_vq->drv_priv = ctx; ++ dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); ++ dst_vq->min_queued_buffers = 2; ++ dst_vq->ops = &iep_qops; ++ dst_vq->mem_ops = &vb2_dma_contig_memops; ++ dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ++ dst_vq->lock = &ctx->iep->mutex; ++ dst_vq->dev = ctx->iep->v4l2_dev.dev; ++ ++ ret = vb2_queue_init(dst_vq); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++static void iep_prepare_format(struct v4l2_pix_format *pix_fmt) ++{ ++ unsigned int height = pix_fmt->height; ++ unsigned int width = pix_fmt->width; ++ unsigned int sizeimage, bytesperline; ++ ++ struct iep_fmt *hw_fmt = iep_fmt_find(pix_fmt); ++ ++ if (!hw_fmt) { ++ hw_fmt = &formats[0]; ++ pix_fmt->pixelformat = hw_fmt->fourcc; ++ } ++ ++ width = ALIGN(clamp(width, IEP_MIN_WIDTH, ++ IEP_MAX_WIDTH), 16); ++ height = ALIGN(clamp(height, IEP_MIN_HEIGHT, ++ IEP_MAX_HEIGHT), 16); ++ ++ bytesperline = FMT_IS_YUV(hw_fmt->hw_format) ++ ? width : (width * hw_fmt->depth) >> 3; ++ ++ sizeimage = height * (width * hw_fmt->depth) >> 3; ++ ++ pix_fmt->width = width; ++ pix_fmt->height = height; ++ pix_fmt->bytesperline = bytesperline; ++ pix_fmt->sizeimage = sizeimage; ++} ++ ++static int iep_open(struct file *file) ++{ ++ struct rockchip_iep *iep = video_drvdata(file); ++ struct iep_ctx *ctx = NULL; ++ ++ int ret; ++ ++ if (mutex_lock_interruptible(&iep->mutex)) ++ return -ERESTARTSYS; ++ ++ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ++ if (!ctx) { ++ mutex_unlock(&iep->mutex); ++ return -ENOMEM; ++ } ++ ++ /* default output format */ ++ ctx->src_fmt.pix.pixelformat = formats[0].fourcc; ++ ctx->src_fmt.pix.field = V4L2_FIELD_INTERLACED; ++ ctx->src_fmt.pix.width = IEP_DEFAULT_WIDTH; ++ ctx->src_fmt.pix.height = IEP_DEFAULT_HEIGHT; ++ iep_prepare_format(&ctx->src_fmt.pix); ++ ctx->src_fmt.hw_fmt = &formats[0]; ++ ctx->dst_fmt.y_stride = IEP_Y_STRIDE(ctx->src_fmt.pix.width, ctx->src_fmt.pix.height); ++ ctx->dst_fmt.uv_stride = IEP_UV_STRIDE(ctx->src_fmt.pix.width, ctx->src_fmt.pix.height, ++ ctx->src_fmt.hw_fmt->uv_factor); ++ ++ /* default capture format */ ++ ctx->dst_fmt.pix.pixelformat = formats[0].fourcc; ++ ctx->dst_fmt.pix.field = V4L2_FIELD_NONE; ++ ctx->dst_fmt.pix.width = IEP_DEFAULT_WIDTH; ++ ctx->dst_fmt.pix.height = IEP_DEFAULT_HEIGHT; ++ iep_prepare_format(&ctx->dst_fmt.pix); ++ ctx->dst_fmt.hw_fmt = &formats[0]; ++ ctx->dst_fmt.y_stride = IEP_Y_STRIDE(ctx->dst_fmt.pix.width, ctx->dst_fmt.pix.height); ++ ctx->dst_fmt.uv_stride = IEP_UV_STRIDE(ctx->dst_fmt.pix.width, ctx->dst_fmt.pix.height, ++ ctx->dst_fmt.hw_fmt->uv_factor); ++ /* ensure fmts are written to HW */ ++ ctx->fmt_changed = true; ++ ++ v4l2_fh_init(&ctx->fh, video_devdata(file)); ++ file->private_data = &ctx->fh; ++ ctx->iep = iep; ++ ++ ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(iep->m2m_dev, ctx, ++ &iep_queue_init); ++ ++ if (IS_ERR(ctx->fh.m2m_ctx)) { ++ ret = PTR_ERR(ctx->fh.m2m_ctx); ++ goto err_free; ++ } ++ ++ v4l2_fh_add(&ctx->fh); ++ ++ mutex_unlock(&iep->mutex); ++ ++ return 0; ++ ++err_free: ++ kfree(ctx); ++ mutex_unlock(&iep->mutex); ++ ++ return ret; ++} ++ ++static int iep_release(struct file *file) ++{ ++ struct rockchip_iep *iep = video_drvdata(file); ++ struct iep_ctx *ctx = container_of(file->private_data, ++ struct iep_ctx, fh); ++ ++ mutex_lock(&iep->mutex); ++ ++ v4l2_fh_del(&ctx->fh); ++ v4l2_fh_exit(&ctx->fh); ++ v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); ++ kfree(ctx); ++ ++ mutex_unlock(&iep->mutex); ++ return 0; ++} ++ ++static const struct v4l2_file_operations iep_fops = { ++ .owner = THIS_MODULE, ++ .open = iep_open, ++ .release = iep_release, ++ .poll = v4l2_m2m_fop_poll, ++ .unlocked_ioctl = video_ioctl2, ++ .mmap = v4l2_m2m_fop_mmap, ++}; ++ ++static int iep_querycap(struct file *file, void *priv, ++ struct v4l2_capability *cap) ++{ ++ strscpy(cap->driver, IEP_NAME, sizeof(cap->driver)); ++ strscpy(cap->card, IEP_NAME, sizeof(cap->card)); ++ snprintf(cap->bus_info, sizeof(cap->bus_info), ++ "platform:%s", IEP_NAME); ++ ++ return 0; ++} ++ ++static int iep_enum_fmt(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct iep_fmt *fmt; ++ ++ if (f->index < ARRAY_SIZE(formats)) { ++ fmt = &formats[f->index]; ++ f->pixelformat = fmt->fourcc; ++ ++ return 0; ++ } ++ ++ return -EINVAL; ++} ++ ++static int iep_enum_framesizes(struct file *file, void *priv, ++ struct v4l2_frmsizeenum *fsize) ++{ ++ if (fsize->index != 0) ++ return -EINVAL; ++ ++ if (!iep_check_pix_format(fsize->pixel_format)) ++ return -EINVAL; ++ ++ fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; ++ ++ fsize->stepwise.min_width = IEP_MIN_WIDTH; ++ fsize->stepwise.max_width = IEP_MAX_WIDTH; ++ fsize->stepwise.step_width = 16; ++ ++ fsize->stepwise.min_height = IEP_MIN_HEIGHT; ++ fsize->stepwise.max_height = IEP_MAX_HEIGHT; ++ fsize->stepwise.step_height = 16; ++ ++ return 0; ++} ++ ++static inline struct iep_ctx *iep_file2ctx(struct file *file) ++{ ++ return container_of(file->private_data, struct iep_ctx, fh); ++} ++ ++static int iep_g_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct iep_ctx *ctx = iep_file2ctx(file); ++ ++ f->fmt.pix = ctx->dst_fmt.pix; ++ ++ return 0; ++} ++ ++static int iep_g_fmt_vid_out(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct iep_ctx *ctx = iep_file2ctx(file); ++ ++ f->fmt.pix = ctx->src_fmt.pix; ++ ++ return 0; ++} ++ ++static int iep_try_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ f->fmt.pix.field = V4L2_FIELD_NONE; ++ iep_prepare_format(&f->fmt.pix); ++ ++ return 0; ++} ++ ++static int iep_try_fmt_vid_out(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ if (f->fmt.pix.field != V4L2_FIELD_INTERLACED_TB && ++ f->fmt.pix.field != V4L2_FIELD_INTERLACED_BT && ++ f->fmt.pix.field != V4L2_FIELD_INTERLACED) ++ f->fmt.pix.field = V4L2_FIELD_INTERLACED; ++ ++ iep_prepare_format(&f->fmt.pix); ++ ++ return 0; ++} ++ ++static int iep_s_fmt_vid_out(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct iep_ctx *ctx = iep_file2ctx(file); ++ struct vb2_queue *vq; ++ ++ int ret; ++ ++ ret = iep_try_fmt_vid_out(file, priv, f); ++ if (ret) ++ return ret; ++ ++ vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); ++ if (vb2_is_busy(vq)) ++ return -EBUSY; ++ ++ ctx->src_fmt.pix = f->fmt.pix; ++ ctx->src_fmt.hw_fmt = iep_fmt_find(&f->fmt.pix); ++ ctx->src_fmt.y_stride = IEP_Y_STRIDE(f->fmt.pix.width, f->fmt.pix.height); ++ ctx->src_fmt.uv_stride = IEP_UV_STRIDE(f->fmt.pix.width, f->fmt.pix.height, ++ ctx->src_fmt.hw_fmt->uv_factor); ++ ++ /* Propagate colorspace information to capture. */ ++ ctx->dst_fmt.pix.colorspace = f->fmt.pix.colorspace; ++ ctx->dst_fmt.pix.xfer_func = f->fmt.pix.xfer_func; ++ ctx->dst_fmt.pix.ycbcr_enc = f->fmt.pix.ycbcr_enc; ++ ctx->dst_fmt.pix.quantization = f->fmt.pix.quantization; ++ ++ /* scaling is not supported */ ++ ctx->dst_fmt.pix.width = f->fmt.pix.width; ++ ctx->dst_fmt.pix.height = f->fmt.pix.height; ++ ctx->dst_fmt.y_stride = IEP_Y_STRIDE(f->fmt.pix.width, f->fmt.pix.height); ++ ctx->dst_fmt.uv_stride = IEP_UV_STRIDE(f->fmt.pix.width, f->fmt.pix.height, ++ ctx->dst_fmt.hw_fmt->uv_factor); ++ ++ ctx->fmt_changed = true; ++ ++ return 0; ++} ++ ++static int iep_s_fmt_vid_cap(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct iep_ctx *ctx = iep_file2ctx(file); ++ struct vb2_queue *vq; ++ int ret; ++ ++ ret = iep_try_fmt_vid_cap(file, priv, f); ++ if (ret) ++ return ret; ++ ++ vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); ++ if (vb2_is_busy(vq)) ++ return -EBUSY; ++ ++ /* scaling is not supported */ ++ f->fmt.pix.width = ctx->src_fmt.pix.width; ++ f->fmt.pix.height = ctx->src_fmt.pix.height; ++ ++ ctx->dst_fmt.pix = f->fmt.pix; ++ ctx->dst_fmt.hw_fmt = iep_fmt_find(&f->fmt.pix); ++ ++ ctx->dst_fmt.y_stride = IEP_Y_STRIDE(f->fmt.pix.width, f->fmt.pix.height); ++ ctx->dst_fmt.uv_stride = IEP_UV_STRIDE(f->fmt.pix.width, f->fmt.pix.height, ++ ctx->dst_fmt.hw_fmt->uv_factor); ++ ++ ctx->fmt_changed = true; ++ ++ return 0; ++} ++ ++static const struct v4l2_ioctl_ops iep_ioctl_ops = { ++ .vidioc_querycap = iep_querycap, ++ ++ .vidioc_enum_framesizes = iep_enum_framesizes, ++ ++ .vidioc_enum_fmt_vid_cap = iep_enum_fmt, ++ .vidioc_g_fmt_vid_cap = iep_g_fmt_vid_cap, ++ .vidioc_try_fmt_vid_cap = iep_try_fmt_vid_cap, ++ .vidioc_s_fmt_vid_cap = iep_s_fmt_vid_cap, ++ ++ .vidioc_enum_fmt_vid_out = iep_enum_fmt, ++ .vidioc_g_fmt_vid_out = iep_g_fmt_vid_out, ++ .vidioc_try_fmt_vid_out = iep_try_fmt_vid_out, ++ .vidioc_s_fmt_vid_out = iep_s_fmt_vid_out, ++ ++ .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs, ++ .vidioc_querybuf = v4l2_m2m_ioctl_querybuf, ++ .vidioc_qbuf = v4l2_m2m_ioctl_qbuf, ++ .vidioc_dqbuf = v4l2_m2m_ioctl_dqbuf, ++ .vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf, ++ .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, ++ .vidioc_expbuf = v4l2_m2m_ioctl_expbuf, ++ ++ .vidioc_streamon = v4l2_m2m_ioctl_streamon, ++ .vidioc_streamoff = v4l2_m2m_ioctl_streamoff, ++}; ++ ++static const struct video_device iep_video_device = { ++ .name = IEP_NAME, ++ .vfl_dir = VFL_DIR_M2M, ++ .fops = &iep_fops, ++ .ioctl_ops = &iep_ioctl_ops, ++ .minor = -1, ++ .release = video_device_release_empty, ++ .device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING, ++}; ++ ++static int iep_parse_dt(struct rockchip_iep *iep) ++{ ++ int ret = 0; ++ ++ iep->axi_clk = devm_clk_get(iep->dev, "axi"); ++ if (IS_ERR(iep->axi_clk)) { ++ dev_err(iep->dev, "failed to get aclk clock\n"); ++ return PTR_ERR(iep->axi_clk); ++ } ++ ++ iep->ahb_clk = devm_clk_get(iep->dev, "ahb"); ++ if (IS_ERR(iep->ahb_clk)) { ++ dev_err(iep->dev, "failed to get hclk clock\n"); ++ return PTR_ERR(iep->ahb_clk); ++ } ++ ++ ret = clk_set_rate(iep->axi_clk, 300000000); ++ ++ if (ret) ++ dev_err(iep->dev, "failed to set axi clock rate to 300 MHz\n"); ++ ++ return ret; ++} ++ ++static irqreturn_t iep_isr(int irq, void *prv) ++{ ++ struct rockchip_iep *iep = prv; ++ struct iep_ctx *ctx; ++ u32 val; ++ enum vb2_buffer_state state = VB2_BUF_STATE_DONE; ++ ++ ctx = v4l2_m2m_get_curr_priv(iep->m2m_dev); ++ if (!ctx) { ++ v4l2_err(&iep->v4l2_dev, ++ "Instance released before the end of transaction\n"); ++ return IRQ_NONE; ++ } ++ ++ /* ++ * The irq is shared with the iommu. If the runtime-pm state of the ++ * iep-device is disabled or the interrupt status doesn't match the ++ * expeceted mask the irq has been targeted to the iommu. ++ */ ++ ++ if (!pm_runtime_active(iep->dev) || ++ !(iep_read(iep, IEP_INT) & IEP_INT_MASK)) ++ return IRQ_NONE; ++ ++ /* disable interrupt - will be re-enabled at next iep_device_run */ ++ iep_mod(ctx->iep, IEP_INT, ++ IEP_INT_FRAME_DONE_EN, 0); ++ ++ iep_mod(iep, IEP_INT, IEP_INT_FRAME_DONE_CLR, ++ IEP_INT_FRAME_DONE_CLR); ++ ++ /* wait for all status regs to show "idle" */ ++ val = readl_poll_timeout(iep->regs + IEP_STATUS, val, ++ (val == 0), 100, IEP_TIMEOUT); ++ ++ if (val) { ++ dev_err(iep->dev, ++ "Failed to wait for job to finish: status: %u\n", val); ++ state = VB2_BUF_STATE_ERROR; ++ ctx->job_abort = true; ++ } ++ ++ iep_m2m_dst_bufs_done(ctx, state); ++ ++ ctx->field_bff = (ctx->dst_buffs_done % 2 == 0) ++ ? ctx->field_order_bff : !ctx->field_order_bff; ++ ++ if (ctx->dst_buffs_done == 2 || ctx->job_abort) { ++ if (ctx->prev_src_buf) ++ v4l2_m2m_buf_done(ctx->prev_src_buf, state); ++ ++ /* current src buff will be next prev */ ++ ctx->prev_src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); ++ ++ v4l2_m2m_job_finish(ctx->iep->m2m_dev, ctx->fh.m2m_ctx); ++ ctx->dst_buffs_done = 0; ++ ++ } else { ++ iep_device_run(ctx); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int iep_probe(struct platform_device *pdev) ++{ ++ struct rockchip_iep *iep; ++ struct video_device *vfd; ++ struct resource *res; ++ int ret = 0; ++ int irq; ++ ++ if (!pdev->dev.of_node) ++ return -ENODEV; ++ ++ iep = devm_kzalloc(&pdev->dev, sizeof(*iep), GFP_KERNEL); ++ if (!iep) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, iep); ++ iep->dev = &pdev->dev; ++ iep->vfd = iep_video_device; ++ ++ ret = iep_parse_dt(iep); ++ if (ret) ++ dev_err(&pdev->dev, "Unable to parse OF data\n"); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ ++ iep->regs = devm_ioremap_resource(iep->dev, res); ++ if (IS_ERR(iep->regs)) { ++ ret = PTR_ERR(iep->regs); ++ goto err_put_clk; ++ } ++ ++ ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set DMA coherent mask.\n"); ++ goto err_put_clk; ++ } ++ ++ vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq < 0) { ++ ret = irq; ++ goto err_put_clk; ++ } ++ ++ /* IRQ is shared with IOMMU */ ++ ret = devm_request_irq(iep->dev, irq, iep_isr, IRQF_SHARED, ++ dev_name(iep->dev), iep); ++ if (ret < 0) { ++ dev_err(iep->dev, "failed to request irq\n"); ++ goto err_put_clk; ++ } ++ ++ mutex_init(&iep->mutex); ++ ++ ret = v4l2_device_register(&pdev->dev, &iep->v4l2_dev); ++ if (ret) { ++ dev_err(iep->dev, "Failed to register V4L2 device\n"); ++ ++ return ret; ++ } ++ ++ vfd = &iep->vfd; ++ vfd->lock = &iep->mutex; ++ vfd->v4l2_dev = &iep->v4l2_dev; ++ ++ snprintf(vfd->name, sizeof(vfd->name), "%s", ++ iep_video_device.name); ++ ++ video_set_drvdata(vfd, iep); ++ ++ ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0); ++ if (ret) { ++ v4l2_err(&iep->v4l2_dev, "Failed to register video device\n"); ++ ++ goto err_v4l2; ++ } ++ ++ v4l2_info(&iep->v4l2_dev, ++ "Device %s registered as /dev/video%d\n", vfd->name, vfd->num); ++ ++ iep->m2m_dev = v4l2_m2m_init(&iep_m2m_ops); ++ if (IS_ERR(iep->m2m_dev)) { ++ v4l2_err(&iep->v4l2_dev, ++ "Failed to initialize V4L2 M2M device\n"); ++ ret = PTR_ERR(iep->m2m_dev); ++ ++ goto err_video; ++ } ++ ++ pm_runtime_set_autosuspend_delay(iep->dev, 100); ++ pm_runtime_use_autosuspend(iep->dev); ++ pm_runtime_enable(iep->dev); ++ ++ return ret; ++ ++err_video: ++ video_unregister_device(&iep->vfd); ++err_v4l2: ++ v4l2_device_unregister(&iep->v4l2_dev); ++err_put_clk: ++ pm_runtime_dont_use_autosuspend(iep->dev); ++ pm_runtime_disable(iep->dev); ++ ++return ret; ++} ++ ++static int iep_remove(struct platform_device *pdev) ++{ ++ struct rockchip_iep *iep = platform_get_drvdata(pdev); ++ ++ pm_runtime_dont_use_autosuspend(iep->dev); ++ pm_runtime_disable(iep->dev); ++ ++ v4l2_m2m_release(iep->m2m_dev); ++ video_unregister_device(&iep->vfd); ++ v4l2_device_unregister(&iep->v4l2_dev); ++ ++ return 0; ++} ++ ++static int __maybe_unused iep_runtime_suspend(struct device *dev) ++{ ++ struct rockchip_iep *iep = dev_get_drvdata(dev); ++ ++ clk_disable_unprepare(iep->ahb_clk); ++ clk_disable_unprepare(iep->axi_clk); ++ ++ return 0; ++} ++ ++static int __maybe_unused iep_runtime_resume(struct device *dev) ++{ ++ struct rockchip_iep *iep; ++ int ret = 0; ++ ++ iep = dev_get_drvdata(dev); ++ ++ ret = clk_prepare_enable(iep->axi_clk); ++ if (ret) { ++ dev_err(iep->dev, "Cannot enable axi clock: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(iep->ahb_clk); ++ if (ret) { ++ dev_err(iep->dev, "Cannot enable ahb clock: %d\n", ret); ++ goto err_disable_axi_clk; ++ } ++ ++ return ret; ++ ++err_disable_axi_clk: ++ clk_disable_unprepare(iep->axi_clk); ++ return ret; ++} ++ ++static const struct dev_pm_ops iep_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ++ pm_runtime_force_resume) ++ SET_RUNTIME_PM_OPS(iep_runtime_suspend, ++ iep_runtime_resume, NULL) ++}; ++ ++static const struct of_device_id rockchip_iep_match[] = { ++ { ++ .compatible = "rockchip,rk3228-iep", ++ }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, rockchip_iep_match); ++ ++static struct platform_driver iep_pdrv = { ++ .probe = iep_probe, ++ .remove = iep_remove, ++ .driver = { ++ .name = IEP_NAME, ++ .pm = &iep_pm_ops, ++ .of_match_table = rockchip_iep_match, ++ }, ++}; ++ ++module_platform_driver(iep_pdrv); ++ ++MODULE_AUTHOR("Alex Bee "); ++MODULE_DESCRIPTION("Rockchip Image Enhancement Processor"); ++MODULE_LICENSE("GPL v2"); +diff --git a/drivers/media/platform/rockchip/iep/iep.h b/drivers/media/platform/rockchip/iep/iep.h +new file mode 100644 +index 000000000000..7d9fc61624b6 +--- /dev/null ++++ b/drivers/media/platform/rockchip/iep/iep.h +@@ -0,0 +1,112 @@ ++/* SPDX-License-Identifier: GPL-2.0-only */ ++/* ++ * Rockchip Image Enhancement Processor (IEP) driver ++ * ++ * Copyright (C) 2020 Alex Bee ++ * ++ */ ++#ifndef __IEP_H__ ++#define __IEP_H__ ++ ++#include ++#include ++#include ++#include ++ ++#define IEP_NAME "rockchip-iep" ++ ++/* Hardware limits */ ++#define IEP_MIN_WIDTH 320U ++#define IEP_MAX_WIDTH 1920U ++ ++#define IEP_MIN_HEIGHT 240U ++#define IEP_MAX_HEIGHT 1088U ++ ++/* Hardware defaults */ ++#define IEP_DEFAULT_WIDTH 320U ++#define IEP_DEFAULT_HEIGHT 240U ++ ++//ns ++#define IEP_TIMEOUT 250000 ++ ++struct iep_fmt { ++ u32 fourcc; ++ u8 depth; ++ u8 uv_factor; ++ u8 color_swap; ++ u8 hw_format; ++}; ++ ++struct iep_frm_fmt { ++ struct iep_fmt *hw_fmt; ++ struct v4l2_pix_format pix; ++ ++ unsigned int y_stride; ++ unsigned int uv_stride; ++}; ++ ++struct iep_ctx { ++ struct v4l2_fh fh; ++ struct rockchip_iep *iep; ++ ++ struct iep_frm_fmt src_fmt; ++ struct iep_frm_fmt dst_fmt; ++ ++ struct vb2_v4l2_buffer *prev_src_buf; ++ struct vb2_v4l2_buffer *dst0_buf; ++ struct vb2_v4l2_buffer *dst1_buf; ++ ++ u32 dst_sequence; ++ u32 src_sequence; ++ ++ /* bff = bottom field first */ ++ bool field_order_bff; ++ bool field_bff; ++ ++ unsigned int dst_buffs_done; ++ ++ bool fmt_changed; ++ bool job_abort; ++}; ++ ++struct rockchip_iep { ++ struct v4l2_device v4l2_dev; ++ struct v4l2_m2m_dev *m2m_dev; ++ struct video_device vfd; ++ ++ struct device *dev; ++ ++ void __iomem *regs; ++ ++ struct clk *axi_clk; ++ struct clk *ahb_clk; ++ ++ /* vfd lock */ ++ struct mutex mutex; ++}; ++ ++static inline void iep_write(struct rockchip_iep *iep, u32 reg, u32 value) ++{ ++ writel(value, iep->regs + reg); ++}; ++ ++static inline u32 iep_read(struct rockchip_iep *iep, u32 reg) ++{ ++ return readl(iep->regs + reg); ++}; ++ ++static inline void iep_shadow_mod(struct rockchip_iep *iep, u32 reg, ++ u32 shadow_reg, u32 mask, u32 val) ++{ ++ u32 temp = iep_read(iep, shadow_reg) & ~(mask); ++ ++ temp |= val & mask; ++ iep_write(iep, reg, temp); ++}; ++ ++static inline void iep_mod(struct rockchip_iep *iep, u32 reg, u32 mask, u32 val) ++{ ++ iep_shadow_mod(iep, reg, reg, mask, val); ++}; ++ ++#endif + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 14 Oct 2020 20:22:38 +0200 +Subject: [PATCH] ARM64: dts: rockchip: Add IEP node for RK3328 + +while at that also add the mmu required + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index eec03adf0902..5455a46c9a6b 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -760,6 +760,28 @@ vop_mmu: iommu@ff373f00 { + status = "disabled"; + }; + ++ iep: iep@ff3a0000 { ++ compatible = "rockchip,rk3328-iep", "rockchip,rk3228-iep"; ++ reg = <0x0 0xff3a0000 0x0 0x800>; ++ interrupts = ; ++ interrupt-names = "iep"; ++ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; ++ clock-names = "axi", "ahb"; ++ power-domains = <&power RK3328_PD_VIDEO>; ++ iommus = <&iep_mmu>; ++ }; ++ ++ iep_mmu: iommu@ff3a0800 { ++ compatible = "rockchip,iommu"; ++ reg = <0x0 0xff3a0800 0x0 0x40>; ++ interrupts = ; ++ interrupt-names = "iep_mmu"; ++ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; ++ clock-names = "aclk", "iface"; ++ power-domains = <&power RK3328_PD_VIDEO>; ++ #iommu-cells = <0>; ++ }; ++ + hdmi: hdmi@ff3c0000 { + compatible = "rockchip,rk3328-dw-hdmi"; + reg = <0x0 0xff3c0000 0x0 0x20000>; + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 14 Oct 2020 20:43:12 +0200 +Subject: [PATCH] ARM64: dts: rockchip: Add IEP node for RK3399 + +Signed-off-by: Alex Bee +--- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index dbe6a9cb98a5..f0629b7a81c6 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -1365,14 +1365,25 @@ vdec_mmu: iommu@ff660480 { + #iommu-cells = <0>; + }; + ++ iep: iep@ff670000 { ++ compatible = "rockchip,rk3399-iep", "rockchip,rk3228-iep"; ++ reg = <0x0 0xff670000 0x0 0x800>; ++ interrupts = ; ++ interrupt-names = "iep"; ++ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; ++ clock-names = "axi", "ahb"; ++ power-domains = <&power RK3399_PD_IEP>; ++ iommus = <&iep_mmu>; ++ }; ++ + iep_mmu: iommu@ff670800 { + compatible = "rockchip,iommu"; + reg = <0x0 0xff670800 0x0 0x40>; + interrupts = ; + clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; + clock-names = "aclk", "iface"; ++ power-domains = <&power RK3399_PD_IEP>; + #iommu-cells = <0>; +- status = "disabled"; + }; + + rga: rga@ff680000 { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Wed, 14 Oct 2020 20:53:56 +0200 +Subject: [PATCH] ARM: dts: rockchip: Add IEP node for RK3288 + +Signed-off-by: Alex Bee +--- + arch/arm/boot/dts/rockchip/rk3288.dtsi | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi +index 59fba3ac6aae..06545f423de2 100644 +--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi ++++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi +@@ -984,14 +984,25 @@ crypto: crypto@ff8a0000 { + reset-names = "crypto-rst"; + }; + ++ iep: iep@ff90000 { ++ compatible = "rockchip,rk3288-iep", "rockchip,rk3228-iep"; ++ reg = <0x0 0xff900000 0x0 0x800>; ++ interrupts = ; ++ interrupt-names = "iep"; ++ clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; ++ clock-names = "axi", "ahb"; ++ power-domains = <&power RK3288_PD_VIO>; ++ iommus = <&iep_mmu>; ++ }; ++ + iep_mmu: iommu@ff900800 { + compatible = "rockchip,iommu"; + reg = <0x0 0xff900800 0x0 0x40>; + interrupts = ; + clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; + clock-names = "aclk", "iface"; ++ power-domains = <&power RK3288_PD_VIO>; + #iommu-cells = <0>; +- status = "disabled"; + }; + + isp_mmu: iommu@ff914000 { diff --git a/patch/kernel/archive/rockchip-6.10/series.conf b/patch/kernel/archive/rockchip-6.10/series.conf new file mode 100644 index 000000000000..530f1fbbb0cf --- /dev/null +++ b/patch/kernel/archive/rockchip-6.10/series.conf @@ -0,0 +1,62 @@ +# Series from patches.libreelec/ + patches.libreelec/linux-0002-rockchip-from-list.patch + patches.libreelec/linux-0011-v4l2-from-list.patch + patches.libreelec/linux-1000-drm-rockchip.patch + patches.libreelec/linux-1001-v4l2-rockchip.patch + patches.libreelec/linux-1002-for-libreelec.patch + patches.libreelec/linux-1003-temp-dw_hdmi-rockchip.patch + patches.libreelec/linux-2000-v4l2-wip-rkvdec-hevc.patch + patches.libreelec/linux-2001-v4l2-wip-iep-driver.patch +# Series from patches.armbian/ + patches.armbian/bt-broadcom-serdev-workaround.patch + patches.armbian/clk-rk322x-composite-mmc-clk.patch + patches.armbian/clk-rockchip-max-frac-divider.patch + patches.armbian/driver-rk322x-audio-codec.patch + patches.armbian/driver-rk3288-gpiomem.patch + patches.armbian/driver-tinkerboard-alc4040-codec.patch + patches.armbian/drm-rk322x-plane-overlay.patch + patches.armbian/drm-rk322x-yuv-10bit-modes.patch + patches.armbian/drm-rockchip-hardware-cursor.patch + patches.armbian/dts-miqi-fan.patch + patches.armbian/dts-miqi-hevc-rga.patch + patches.armbian/dts-miqi-mali-gpu.patch + patches.armbian/dts-miqi-regulator-fix.patch + patches.armbian/dts-rk322x-iep-node.patch + patches.armbian/dts-rk322x-pinctrl-nand.patch + patches.armbian/dts-rk3288-disable-serial-dma.patch + patches.armbian/dts-rk3288-fix-mmc-aliases.patch + patches.armbian/dts-rk3288-gpu-500mhz-opp.patch + patches.armbian/dts-rk3288-pinctrl-spi2.patch + patches.armbian/dts-rk3288-thermal-rearrange-zones.patch + patches.armbian/dts-tinkerboard-bt-rtl8723bs.patch + patches.armbian/dts-tinkerboard-bt-uart-pins.patch + patches.armbian/dts-tinkerboard-hevc-rga.patch + patches.armbian/dts-tinkerboard-sdio-wifi.patch + patches.armbian/dts-tinkerboard-sdmmc-properties.patch + patches.armbian/dts-tinkerboard-spi-interface.patch + patches.armbian/dts-veyron-flag-cache-flush.patch + patches.armbian/general-add-overlay-compilation-support.patch + patches.armbian/general-add-overlay-configfs.patch + patches.armbian/general-add-restart-handler-for-act8846.patch + patches.armbian/general-dwc2-fix-wait-peripheral.patch + patches.armbian/general-dwc2-fix-wait-time.patch + patches.armbian/general-dwc2-nak-gadget.patch + patches.armbian/general-fix-reboot-from-kwiboo.patch + patches.armbian/general-linux-export-mm-trace-rss-stats.patch + patches.armbian/general-rk322x-gpio-ir-driver.patch + patches.armbian/general-rockchip-various-fixes.patch + patches.armbian/ir-keymap-rk322x-box.patch + patches.armbian/ir-keymap-xt-q8l-v10.patch + patches.armbian/misc-tinkerboard-spi-interface.patch + patches.armbian/mmc-tinkerboard-sdmmc-reboot-fix.patch + patches.armbian/rk322x-dmc-driver-01-sipv2-calls.patch + patches.armbian/rk322x-dmc-driver-02-sip-constants.patch + patches.armbian/rk322x-dmc-driver-03-dfi-driver.patch + patches.armbian/rk322x-dmc-driver-04-driver.patch + patches.armbian/rk322x-dwc2-no-clock-gating.patch + patches.armbian/rk322x-usb-reset-props.patch + patches.armbian/wifi-ath9k-no-bulk-EP3-EP4.patch + patches.armbian/wifi-brcmfmac-add-bcm43342.patch + patches.armbian/wifi-brcmfmac-ap6330-firmware.patch + patches.armbian/wifi-driver-esp8089.patch + patches.armbian/wifi-driver-ssv6051.patch diff --git a/patch/kernel/archive/rockchip-rk3588-6.10/0113-add-synopsys-designware-hdmi-rx-controller.patch b/patch/kernel/archive/rockchip-rk3588-6.10/0113-add-synopsys-designware-hdmi-rx-controller.patch new file mode 100644 index 000000000000..e436902d4d5e --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.10/0113-add-synopsys-designware-hdmi-rx-controller.patch @@ -0,0 +1,3770 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shreeya Patel +Date: Wed, 7 Aug 2024 11:33:46 +0000 +Subject: arm64: dts: rockchip: Add device tree support for HDMI RX Controller + +--- + arch/arm64/boot/dts/rockchip/rk3588-pinctrl.dtsi | 42 + + arch/arm64/boot/dts/rockchip/rk3588.dtsi | 57 + + drivers/media/platform/Kconfig | 1 + + drivers/media/platform/Makefile | 1 + + drivers/media/platform/synopsys/Kconfig | 3 + + drivers/media/platform/synopsys/Makefile | 2 + + drivers/media/platform/synopsys/hdmirx/Kconfig | 27 + + drivers/media/platform/synopsys/hdmirx/Makefile | 4 + + drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2763 ++++++++++ + drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h | 394 ++ + drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c | 285 + + drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h | 44 + + 12 files changed, 3623 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-pinctrl.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-pinctrl.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-pinctrl.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-pinctrl.dtsi +@@ -169,6 +169,48 @@ hdmim0_tx1_sda: hdmim0-tx1-sda { + /* hdmim0_tx1_sda */ + <2 RK_PB4 4 &pcfg_pull_none>; + }; ++ ++ /omit-if-no-ref/ ++ hdmim1_rx: hdmim1-rx { ++ rockchip,pins = ++ /* hdmim1_rx_cec */ ++ <3 RK_PD1 5 &pcfg_pull_none>, ++ /* hdmim1_rx_scl */ ++ <3 RK_PD2 5 &pcfg_pull_none_smt>, ++ /* hdmim1_rx_sda */ ++ <3 RK_PD3 5 &pcfg_pull_none_smt>, ++ /* hdmim1_rx_hpdin */ ++ <3 RK_PD4 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ hdmim1_rx_cec: hdmim1-rx-cec { ++ rockchip,pins = ++ /* hdmim1_rx_cec */ ++ <3 RK_PD1 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ hdmim1_rx_hpdin: hdmim1-rx-hpdin { ++ rockchip,pins = ++ /* hdmim1_rx_hpdin */ ++ <3 RK_PD4 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ hdmim1_rx_scl: hdmim1-rx-scl { ++ rockchip,pins = ++ /* hdmim1_rx_scl */ ++ <3 RK_PD2 5 &pcfg_pull_none>; ++ }; ++ ++ /omit-if-no-ref/ ++ hdmim1_rx_sda: hdmim1-rx-sda { ++ rockchip,pins = ++ /* hdmim1_rx_sda */ ++ <3 RK_PD3 5 &pcfg_pull_none>; ++ }; ++ + }; + + i2c0 { +diff --git a/arch/arm64/boot/dts/rockchip/rk3588.dtsi b/arch/arm64/boot/dts/rockchip/rk3588.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588.dtsi +@@ -7,6 +7,29 @@ + #include "rk3588-pinctrl.dtsi" + + / { ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ /* ++ * The 4k HDMI capture controller works only with 32bit ++ * phys addresses and doesn't support IOMMU. HDMI RX CMA ++ * must be reserved below 4GB. ++ * The size of 160MB was determined as follows: ++ * (3840 * 2160 pixels) * (4 bytes/pixel) * (2 frames/buffer) / 10^6 = 66MB ++ * To ensure sufficient support for practical use-cases, ++ * we doubled the 66MB value. ++ */ ++ hdmi_receiver_cma: hdmi-receiver-cma { ++ compatible = "shared-dma-pool"; ++ alloc-ranges = <0x0 0x0 0x0 0xffffffff>; ++ size = <0x0 (160 * 0x100000)>; /* 160MiB */ ++ no-map; ++ status = "disabled"; ++ }; ++ }; ++ + usb_host1_xhci: usb@fc400000 { + compatible = "rockchip,rk3588-dwc3", "snps,dwc3"; + reg = <0x0 0xfc400000 0x0 0x400000>; +@@ -27,6 +50,40 @@ usb_host1_xhci: usb@fc400000 { + status = "disabled"; + }; + ++ hdmi_receiver: hdmi_receiver@fdee0000 { ++ compatible = "rockchip,rk3588-hdmirx-ctrler", "snps,dw-hdmi-rx"; ++ reg = <0x0 0xfdee0000 0x0 0x6000>; ++ power-domains = <&power RK3588_PD_VO1>; ++ rockchip,grf = <&sys_grf>; ++ rockchip,vo1-grf = <&vo1_grf>; ++ interrupts = , ++ , ++ ; ++ interrupt-names = "cec", "hdmi", "dma"; ++ clocks = <&cru ACLK_HDMIRX>, ++ <&cru CLK_HDMIRX_AUD>, ++ <&cru CLK_CR_PARA>, ++ <&cru PCLK_HDMIRX>, ++ <&cru CLK_HDMIRX_REF>, ++ <&cru PCLK_S_HDMIRX>, ++ <&cru HCLK_VO1>; ++ clock-names = "aclk", ++ "audio", ++ "cr_para", ++ "pclk", ++ "ref", ++ "hclk_s_hdmirx", ++ "hclk_vo1"; ++ resets = <&cru SRST_A_HDMIRX>, <&cru SRST_P_HDMIRX>, ++ <&cru SRST_HDMIRX_REF>, <&cru SRST_A_HDMIRX_BIU>; ++ reset-names = "axi", "apb", "ref", "biu"; ++ memory-region = <&hdmi_receiver_cma>; ++ pinctrl-0 = <&hdmim1_rx>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ ++ + pcie30_phy_grf: syscon@fd5b8000 { + compatible = "rockchip,rk3588-pcie3-phy-grf", "syscon"; + reg = <0x0 0xfd5b8000 0x0 0x10000>; +diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/Kconfig ++++ b/drivers/media/platform/Kconfig +@@ -83,6 +83,7 @@ source "drivers/media/platform/rockchip/Kconfig" + source "drivers/media/platform/samsung/Kconfig" + source "drivers/media/platform/st/Kconfig" + source "drivers/media/platform/sunxi/Kconfig" ++source "drivers/media/platform/synopsys/Kconfig" + source "drivers/media/platform/ti/Kconfig" + source "drivers/media/platform/verisilicon/Kconfig" + source "drivers/media/platform/via/Kconfig" +diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/Makefile ++++ b/drivers/media/platform/Makefile +@@ -26,6 +26,7 @@ obj-y += rockchip/ + obj-y += samsung/ + obj-y += st/ + obj-y += sunxi/ ++obj-y += synopsys/ + obj-y += ti/ + obj-y += verisilicon/ + obj-y += via/ +diff --git a/drivers/media/platform/synopsys/Kconfig b/drivers/media/platform/synopsys/Kconfig +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/Kconfig +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++ ++source "drivers/media/platform/synopsys/hdmirx/Kconfig" +diff --git a/drivers/media/platform/synopsys/Makefile b/drivers/media/platform/synopsys/Makefile +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/Makefile +@@ -0,0 +1,2 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++obj-y += hdmirx/ +diff --git a/drivers/media/platform/synopsys/hdmirx/Kconfig b/drivers/media/platform/synopsys/hdmirx/Kconfig +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/Kconfig +@@ -0,0 +1,27 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++config VIDEO_SYNOPSYS_HDMIRX ++ tristate "Synopsys DesignWare HDMI Receiver driver" ++ depends on VIDEO_DEV ++ depends on ARCH_ROCKCHIP ++ select MEDIA_CONTROLLER ++ select VIDEO_V4L2_SUBDEV_API ++ select VIDEOBUF2_DMA_CONTIG ++ select CEC_CORE ++ select CEC_NOTIFIER ++ select HDMI ++ help ++ Support for Synopsys HDMI HDMI RX Controller. ++ This driver supports HDMI 2.0 version. ++ ++ To compile this driver as a module, choose M here. The module ++ will be called synopsys_hdmirx. ++ ++config HDMIRX_LOAD_DEFAULT_EDID ++ bool "Load default EDID" ++ depends on VIDEO_SYNOPSYS_HDMIRX ++ default "y" ++ help ++ Preload the default EDID (Extended Display Identification Data). ++ EDID contains information about the capabilities of the display, ++ such as supported resolutions, refresh rates, and audio formats. +diff --git a/drivers/media/platform/synopsys/hdmirx/Makefile b/drivers/media/platform/synopsys/hdmirx/Makefile +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/Makefile +@@ -0,0 +1,4 @@ ++# SPDX-License-Identifier: GPL-2.0 ++synopsys-hdmirx-objs := snps_hdmirx.o snps_hdmirx_cec.o ++ ++obj-$(CONFIG_VIDEO_SYNOPSYS_HDMIRX) += synopsys-hdmirx.o +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +@@ -0,0 +1,2763 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2024 Collabora, Ltd. ++ * Author: Shreeya Patel ++ * ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * Author: Dingxian Wen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "snps_hdmirx.h" ++#include "snps_hdmirx_cec.h" ++ ++static int debug; ++module_param(debug, int, 0644); ++MODULE_PARM_DESC(debug, "debug level (0-3)"); ++ ++#define EDID_NUM_BLOCKS_MAX 2 ++#define EDID_BLOCK_SIZE 128 ++#define HDMIRX_STORED_BIT_WIDTH 8 ++#define IREF_CLK_FREQ_HZ 428571429 ++#define MEMORY_ALIGN_ROUND_UP_BYTES 64 ++#define HDMIRX_PLANE_Y 0 ++#define HDMIRX_PLANE_CBCR 1 ++#define RK_IRQ_HDMIRX_HDMI 210 ++#define FILTER_FRAME_CNT 6 ++#define RK_SIP_FIQ_CTRL 0x82000024 ++#define SIP_WDT_CFG 0x82000026 ++#define DETECTION_THRESHOLD 7 ++ ++/* fiq control sub func */ ++enum { ++ RK_SIP_FIQ_CTRL_FIQ_EN = 1, ++ RK_SIP_FIQ_CTRL_FIQ_DIS, ++ RK_SIP_FIQ_CTRL_SET_AFF ++}; ++ ++/* SIP_WDT_CONFIG call types */ ++enum { ++ WDT_START = 0, ++ WDT_STOP = 1, ++ WDT_PING = 2, ++}; ++ ++enum hdmirx_pix_fmt { ++ HDMIRX_RGB888 = 0, ++ HDMIRX_YUV422 = 1, ++ HDMIRX_YUV444 = 2, ++ HDMIRX_YUV420 = 3, ++}; ++ ++enum ddr_store_fmt { ++ STORE_RGB888 = 0, ++ STORE_RGBA_ARGB, ++ STORE_YUV420_8BIT, ++ STORE_YUV420_10BIT, ++ STORE_YUV422_8BIT, ++ STORE_YUV422_10BIT, ++ STORE_YUV444_8BIT, ++ STORE_YUV420_16BIT = 8, ++ STORE_YUV422_16BIT = 9, ++}; ++ ++enum hdmirx_reg_attr { ++ HDMIRX_ATTR_RW = 0, ++ HDMIRX_ATTR_RO = 1, ++ HDMIRX_ATTR_WO = 2, ++ HDMIRX_ATTR_RE = 3, ++}; ++ ++enum { ++ HDMIRX_RST_A, ++ HDMIRX_RST_P, ++ HDMIRX_RST_REF, ++ HDMIRX_RST_BIU, ++ HDMIRX_NUM_RST, ++}; ++ ++static const char * const pix_fmt_str[] = { ++ "RGB888", ++ "YUV422", ++ "YUV444", ++ "YUV420", ++}; ++ ++struct hdmirx_buffer { ++ struct vb2_v4l2_buffer vb; ++ struct list_head queue; ++ u32 buff_addr[VIDEO_MAX_PLANES]; ++}; ++ ++struct hdmirx_stream { ++ struct snps_hdmirx_dev *hdmirx_dev; ++ struct video_device vdev; ++ struct vb2_queue buf_queue; ++ struct list_head buf_head; ++ struct hdmirx_buffer *curr_buf; ++ struct hdmirx_buffer *next_buf; ++ struct v4l2_pix_format_mplane pixm; ++ const struct v4l2_format_info *out_finfo; ++ struct mutex vlock; /* to lock resources associated with video buffer and video device */ ++ spinlock_t vbq_lock; /* to lock video buffer queue */ ++ bool stopping; ++ wait_queue_head_t wq_stopped; ++ u32 frame_idx; ++ u32 line_flag_int_cnt; ++ u32 irq_stat; ++}; ++ ++struct snps_hdmirx_dev { ++ struct device *dev; ++ struct device *codec_dev; ++ struct hdmirx_stream stream; ++ struct v4l2_device v4l2_dev; ++ struct v4l2_ctrl_handler hdl; ++ struct v4l2_ctrl *detect_tx_5v_ctrl; ++ struct v4l2_ctrl *rgb_range; ++ struct v4l2_dv_timings timings; ++ struct gpio_desc *detect_5v_gpio; ++ struct work_struct work_wdt_config; ++ struct delayed_work delayed_work_hotplug; ++ struct delayed_work delayed_work_res_change; ++ struct delayed_work delayed_work_heartbeat; ++ struct cec_notifier *cec_notifier; ++ struct hdmirx_cec *cec; ++ struct mutex stream_lock; /* to lock video stream capture */ ++ struct mutex work_lock; /* to lock the critical section of hotplug event */ ++ struct reset_control_bulk_data resets[HDMIRX_NUM_RST]; ++ struct clk_bulk_data *clks; ++ struct regmap *grf; ++ struct regmap *vo1_grf; ++ struct completion cr_write_done; ++ struct completion timer_base_lock; ++ struct completion avi_pkt_rcv; ++ enum hdmirx_pix_fmt pix_fmt; ++ void __iomem *regs; ++ int hdmi_irq; ++ int dma_irq; ++ int det_irq; ++ bool hpd_trigger_level; ++ bool tmds_clk_ratio; ++ bool is_dvi_mode; ++ bool got_timing; ++ u32 num_clks; ++ u32 edid_blocks_written; ++ u32 cur_vic; ++ u32 cur_fmt_fourcc; ++ u32 color_depth; ++ u8 edid[EDID_BLOCK_SIZE * 2]; ++ hdmi_codec_plugged_cb plugged_cb; ++ spinlock_t rst_lock; /* to lock register access */ ++}; ++ ++static u8 edid_init_data_340M[] = { ++ 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, ++ 0x49, 0x70, 0x88, 0x35, 0x01, 0x00, 0x00, 0x00, ++ 0x2D, 0x1F, 0x01, 0x03, 0x80, 0x78, 0x44, 0x78, ++ 0x0A, 0xCF, 0x74, 0xA3, 0x57, 0x4C, 0xB0, 0x23, ++ 0x09, 0x48, 0x4C, 0x21, 0x08, 0x00, 0x61, 0x40, ++ 0x01, 0x01, 0x81, 0x00, 0x95, 0x00, 0xA9, 0xC0, ++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, ++ 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, ++ 0x45, 0x00, 0x20, 0xC2, 0x31, 0x00, 0x00, 0x1E, ++ 0x01, 0x1D, 0x00, 0x72, 0x51, 0xD0, 0x1E, 0x20, ++ 0x6E, 0x28, 0x55, 0x00, 0x20, 0xC2, 0x31, 0x00, ++ 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x52, ++ 0x4B, 0x2D, 0x55, 0x48, 0x44, 0x0A, 0x20, 0x20, ++ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFD, ++ 0x00, 0x3B, 0x46, 0x1F, 0x8C, 0x3C, 0x00, 0x0A, ++ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0xA7, ++ ++ 0x02, 0x03, 0x2F, 0xD1, 0x51, 0x07, 0x16, 0x14, ++ 0x05, 0x01, 0x03, 0x12, 0x13, 0x84, 0x22, 0x1F, ++ 0x90, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x23, 0x09, ++ 0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x67, 0x03, ++ 0x0C, 0x00, 0x30, 0x00, 0x10, 0x44, 0xE3, 0x05, ++ 0x03, 0x01, 0xE4, 0x0F, 0x00, 0x80, 0x01, 0x02, ++ 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, ++ 0x2C, 0x45, 0x00, 0x20, 0xC2, 0x31, 0x00, 0x00, ++ 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, ++}; ++ ++static const struct v4l2_dv_timings cea640x480 = V4L2_DV_BT_CEA_640X480P59_94; ++ ++static const struct v4l2_dv_timings_cap hdmirx_timings_cap = { ++ .type = V4L2_DV_BT_656_1120, ++ .reserved = { 0 }, ++ V4L2_INIT_BT_TIMINGS(640, 4096, /* min/max width */ ++ 480, 2160, /* min/max height */ ++ 20000000, 600000000, /* min/max pixelclock */ ++ /* standards */ ++ V4L2_DV_BT_STD_CEA861, ++ /* capabilities */ ++ V4L2_DV_BT_CAP_PROGRESSIVE | ++ V4L2_DV_BT_CAP_INTERLACED) ++}; ++ ++static void hdmirx_writel(struct snps_hdmirx_dev *hdmirx_dev, int reg, u32 val) ++{ ++ unsigned long lock_flags = 0; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ writel(val, hdmirx_dev->regs + reg); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++} ++ ++static u32 hdmirx_readl(struct snps_hdmirx_dev *hdmirx_dev, int reg) ++{ ++ unsigned long lock_flags = 0; ++ u32 val; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ val = readl(hdmirx_dev->regs + reg); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++ return val; ++} ++ ++static void hdmirx_reset_dma(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ unsigned long lock_flags = 0; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ reset_control_reset(hdmirx_dev->resets[0].rstc); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++} ++ ++static void hdmirx_update_bits(struct snps_hdmirx_dev *hdmirx_dev, int reg, ++ u32 mask, u32 data) ++{ ++ unsigned long lock_flags = 0; ++ u32 val; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ val = readl(hdmirx_dev->regs + reg) & ~mask; ++ val |= (data & mask); ++ writel(val, hdmirx_dev->regs + reg); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++} ++ ++static int hdmirx_subscribe_event(struct v4l2_fh *fh, ++ const struct v4l2_event_subscription *sub) ++{ ++ switch (sub->type) { ++ case V4L2_EVENT_SOURCE_CHANGE: ++ if (fh->vdev->vfl_dir == VFL_DIR_RX) ++ return v4l2_src_change_event_subscribe(fh, sub); ++ break; ++ case V4L2_EVENT_CTRL: ++ return v4l2_ctrl_subscribe_event(fh, sub); ++ default: ++ break; ++ } ++ ++ return -EINVAL; ++} ++ ++static bool tx_5v_power_present(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ bool ret; ++ int val, i, cnt; ++ ++ cnt = 0; ++ for (i = 0; i < 10; i++) { ++ usleep_range(1000, 1100); ++ val = gpiod_get_value(hdmirx_dev->detect_5v_gpio); ++ if (val > 0) ++ cnt++; ++ if (cnt >= DETECTION_THRESHOLD) ++ break; ++ } ++ ++ ret = (cnt >= DETECTION_THRESHOLD) ? true : false; ++ v4l2_dbg(3, debug, &hdmirx_dev->v4l2_dev, "%s: %d\n", __func__, ret); ++ ++ return ret; ++} ++ ++static bool signal_not_lock(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ u32 mu_status, dma_st10, cmu_st; ++ ++ mu_status = hdmirx_readl(hdmirx_dev, MAINUNIT_STATUS); ++ dma_st10 = hdmirx_readl(hdmirx_dev, DMA_STATUS10); ++ cmu_st = hdmirx_readl(hdmirx_dev, CMU_STATUS); ++ ++ if ((mu_status & TMDSVALID_STABLE_ST) && ++ (dma_st10 & HDMIRX_LOCK) && ++ (cmu_st & TMDSQPCLK_LOCKED_ST)) ++ return false; ++ ++ return true; ++} ++ ++static void hdmirx_get_colordepth(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 val, color_depth_reg; ++ ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS11); ++ color_depth_reg = (val & HDMIRX_COLOR_DEPTH_MASK) >> 3; ++ ++ switch (color_depth_reg) { ++ case 0x4: ++ hdmirx_dev->color_depth = 24; ++ break; ++ case 0x5: ++ hdmirx_dev->color_depth = 30; ++ break; ++ case 0x6: ++ hdmirx_dev->color_depth = 36; ++ break; ++ case 0x7: ++ hdmirx_dev->color_depth = 48; ++ break; ++ default: ++ hdmirx_dev->color_depth = 24; ++ break; ++ } ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: color_depth: %d, reg_val:%d\n", ++ __func__, hdmirx_dev->color_depth, color_depth_reg); ++} ++ ++static void hdmirx_get_pix_fmt(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 val; ++ ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS11); ++ hdmirx_dev->pix_fmt = val & HDMIRX_FORMAT_MASK; ++ ++ switch (hdmirx_dev->pix_fmt) { ++ case HDMIRX_RGB888: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_BGR24; ++ break; ++ case HDMIRX_YUV422: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_NV16; ++ break; ++ case HDMIRX_YUV444: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_NV24; ++ break; ++ case HDMIRX_YUV420: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_NV12; ++ break; ++ default: ++ v4l2_err(v4l2_dev, ++ "%s: err pix_fmt: %d, set RGB888 as default\n", ++ __func__, hdmirx_dev->pix_fmt); ++ hdmirx_dev->pix_fmt = HDMIRX_RGB888; ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_BGR24; ++ break; ++ } ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: pix_fmt: %s\n", __func__, ++ pix_fmt_str[hdmirx_dev->pix_fmt]); ++} ++ ++static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_bt_timings *bt, bool from_dma) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 hact, vact, htotal, vtotal, fps; ++ u32 hfp, hs, hbp, vfp, vs, vbp; ++ u32 val; ++ ++ if (from_dma) { ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS2); ++ hact = (val >> 16) & 0xffff; ++ vact = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS3); ++ htotal = (val >> 16) & 0xffff; ++ vtotal = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS4); ++ hs = (val >> 16) & 0xffff; ++ vs = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS5); ++ hbp = (val >> 16) & 0xffff; ++ vbp = val & 0xffff; ++ hfp = htotal - hact - hs - hbp; ++ vfp = vtotal - vact - vs - vbp; ++ } else { ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS1); ++ hs = (val >> 16) & 0xffff; ++ hfp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS2); ++ hbp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS3); ++ htotal = (val >> 16) & 0xffff; ++ hact = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS4); ++ vs = (val >> 16) & 0xffff; ++ vfp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS5); ++ vbp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS6); ++ vtotal = (val >> 16) & 0xffff; ++ vact = val & 0xffff; ++ if (hdmirx_dev->pix_fmt == HDMIRX_YUV420) ++ hact *= 2; ++ } ++ if (hdmirx_dev->pix_fmt == HDMIRX_YUV420) ++ htotal *= 2; ++ fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal); ++ if (hdmirx_dev->pix_fmt == HDMIRX_YUV420) ++ fps *= 2; ++ bt->width = hact; ++ bt->height = vact; ++ bt->hfrontporch = hfp; ++ bt->hsync = hs; ++ bt->hbackporch = hbp; ++ bt->vfrontporch = vfp; ++ bt->vsync = vs; ++ bt->vbackporch = vbp; ++ ++ v4l2_dbg(1, debug, v4l2_dev, "get timings from %s\n", from_dma ? "dma" : "ctrl"); ++ v4l2_dbg(1, debug, v4l2_dev, "act:%ux%u, total:%ux%u, fps:%u, pixclk:%llu\n", ++ bt->width, bt->height, htotal, vtotal, fps, bt->pixelclock); ++ ++ v4l2_dbg(2, debug, v4l2_dev, "hfp:%u, hs:%u, hbp:%u, vfp:%u, vs:%u, vbp:%u\n", ++ bt->hfrontporch, bt->hsync, bt->hbackporch, ++ bt->vfrontporch, bt->vsync, bt->vbackporch); ++} ++ ++static bool hdmirx_check_timing_valid(struct v4l2_bt_timings *bt) ++{ ++ if (bt->width < 100 || bt->width > 5000 || ++ bt->height < 100 || bt->height > 5000) ++ return false; ++ ++ if (!bt->hsync || bt->hsync > 200 || ++ !bt->vsync || bt->vsync > 100) ++ return false; ++ ++ if (!bt->hbackporch || bt->hbackporch > 2000 || ++ !bt->vbackporch || bt->vbackporch > 2000) ++ return false; ++ ++ if (!bt->hfrontporch || bt->hfrontporch > 2000 || ++ !bt->vfrontporch || bt->vfrontporch > 2000) ++ return false; ++ ++ return true; ++} ++ ++static void hdmirx_get_avi_infoframe(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ union hdmi_infoframe frame = {}; ++ int err, i, b, itr = 0; ++ u8 aviif[3 + 7 * 4]; ++ u32 val; ++ ++ aviif[itr++] = HDMI_INFOFRAME_TYPE_AVI; ++ val = hdmirx_readl(hdmirx_dev, PKTDEC_AVIIF_PH2_1); ++ aviif[itr++] = val & 0xff; ++ aviif[itr++] = (val >> 8) & 0xff; ++ ++ for (i = 0; i < 7; i++) { ++ val = hdmirx_readl(hdmirx_dev, PKTDEC_AVIIF_PB3_0 + 4 * i); ++ ++ for (b = 0; b < 4; b++) ++ aviif[itr++] = (val >> (8 * b)) & 0xff; ++ } ++ ++ err = hdmi_infoframe_unpack(&frame, aviif, sizeof(aviif)); ++ if (err) { ++ v4l2_err(v4l2_dev, "failed to unpack AVI infoframe\n"); ++ return; ++ } ++ ++ v4l2_ctrl_s_ctrl(hdmirx_dev->rgb_range, frame.avi.quantization_range); ++} ++ ++/* ++ * When querying DV timings during preview, if the DMA's timing is stable, ++ * we retrieve the timings directly from the DMA. However, if the current ++ * resolution is negative, obtaining the timing from CTRL may require a ++ * change in the sync polarity, potentially leading to DMA errors. ++ */ ++static int hdmirx_get_detected_timings(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_dv_timings *timings, ++ bool from_dma) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_bt_timings *bt = &timings->bt; ++ u32 field_type, color_depth, deframer_st; ++ u32 val, tmdsqpclk_freq, pix_clk; ++ u64 tmp_data, tmds_clk; ++ ++ memset(timings, 0, sizeof(struct v4l2_dv_timings)); ++ timings->type = V4L2_DV_BT_656_1120; ++ ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS11); ++ field_type = (val & HDMIRX_TYPE_MASK) >> 7; ++ hdmirx_get_pix_fmt(hdmirx_dev); ++ bt->interlaced = field_type & BIT(0) ? V4L2_DV_INTERLACED : V4L2_DV_PROGRESSIVE; ++ val = hdmirx_readl(hdmirx_dev, PKTDEC_AVIIF_PB7_4); ++ hdmirx_dev->cur_vic = val | VIC_VAL_MASK; ++ hdmirx_get_colordepth(hdmirx_dev); ++ color_depth = hdmirx_dev->color_depth; ++ deframer_st = hdmirx_readl(hdmirx_dev, DEFRAMER_STATUS); ++ hdmirx_dev->is_dvi_mode = deframer_st & OPMODE_STS_MASK ? false : true; ++ tmdsqpclk_freq = hdmirx_readl(hdmirx_dev, CMU_TMDSQPCLK_FREQ); ++ tmds_clk = tmdsqpclk_freq * 4 * 1000; ++ tmp_data = tmds_clk * 24; ++ do_div(tmp_data, color_depth); ++ pix_clk = tmp_data; ++ bt->pixelclock = pix_clk; ++ ++ hdmirx_get_avi_infoframe(hdmirx_dev); ++ ++ hdmirx_get_timings(hdmirx_dev, bt, from_dma); ++ if (bt->interlaced == V4L2_DV_INTERLACED) { ++ bt->height *= 2; ++ bt->il_vsync = bt->vsync + 1; ++ } ++ ++ v4l2_dbg(2, debug, v4l2_dev, "tmds_clk:%llu\n", tmds_clk); ++ v4l2_dbg(1, debug, v4l2_dev, "interlace:%d, fmt:%d, vic:%d, color:%d, mode:%s\n", ++ bt->interlaced, hdmirx_dev->pix_fmt, ++ hdmirx_dev->cur_vic, hdmirx_dev->color_depth, ++ hdmirx_dev->is_dvi_mode ? "dvi" : "hdmi"); ++ v4l2_dbg(2, debug, v4l2_dev, "deframer_st:%#x\n", deframer_st); ++ ++ if (!hdmirx_check_timing_valid(bt)) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static bool port_no_link(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ return !tx_5v_power_present(hdmirx_dev); ++} ++ ++static int hdmirx_query_dv_timings(struct file *file, void *_fh, ++ struct v4l2_dv_timings *timings) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int ret; ++ ++ if (port_no_link(hdmirx_dev)) { ++ v4l2_err(v4l2_dev, "%s: port has no link\n", __func__); ++ return -ENOLINK; ++ } ++ ++ if (signal_not_lock(hdmirx_dev)) { ++ v4l2_err(v4l2_dev, "%s: signal is not locked\n", __func__); ++ return -ENOLCK; ++ } ++ ++ ret = hdmirx_get_detected_timings(hdmirx_dev, timings, true); ++ if (ret) ++ return ret; ++ ++ if (debug) ++ v4l2_print_dv_timings(hdmirx_dev->v4l2_dev.name, ++ "query_dv_timings: ", timings, false); ++ ++ if (!v4l2_valid_dv_timings(timings, &hdmirx_timings_cap, NULL, NULL)) { ++ v4l2_dbg(1, debug, v4l2_dev, "%s: timings out of range\n", __func__); ++ return -ERANGE; ++ } ++ ++ return 0; ++} ++ ++static void hdmirx_hpd_ctrl(struct snps_hdmirx_dev *hdmirx_dev, bool en) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: %sable, hpd_trigger_level:%d\n", ++ __func__, en ? "en" : "dis", ++ hdmirx_dev->hpd_trigger_level); ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, HPDLOW, en ? 0 : HPDLOW); ++ en = hdmirx_dev->hpd_trigger_level ? en : !en; ++ hdmirx_writel(hdmirx_dev, CORE_CONFIG, en); ++} ++ ++static int hdmirx_write_edid(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_edid *edid, bool hpd_up) ++{ ++ u32 edid_len = edid->blocks * EDID_BLOCK_SIZE; ++ char data[300]; ++ u32 i; ++ ++ memset(edid->reserved, 0, sizeof(edid->reserved)); ++ if (edid->pad) ++ return -EINVAL; ++ ++ if (edid->start_block) ++ return -EINVAL; ++ ++ if (edid->blocks > EDID_NUM_BLOCKS_MAX) { ++ edid->blocks = EDID_NUM_BLOCKS_MAX; ++ return -E2BIG; ++ } ++ ++ if (!edid->blocks) { ++ hdmirx_dev->edid_blocks_written = 0; ++ return 0; ++ } ++ ++ cec_s_phys_addr_from_edid(hdmirx_dev->cec->adap, ++ (const struct edid *)edid->edid); ++ ++ memset(&hdmirx_dev->edid, 0, sizeof(hdmirx_dev->edid)); ++ hdmirx_hpd_ctrl(hdmirx_dev, false); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG11, ++ EDID_READ_EN_MASK | ++ EDID_WRITE_EN_MASK | ++ EDID_SLAVE_ADDR_MASK, ++ EDID_READ_EN(0) | ++ EDID_WRITE_EN(1) | ++ EDID_SLAVE_ADDR(0x50)); ++ for (i = 0; i < edid_len; i++) ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG10, edid->edid[i]); ++ ++ /* read out for debug */ ++ if (debug >= 2) { ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG11, ++ EDID_READ_EN_MASK | ++ EDID_WRITE_EN_MASK, ++ EDID_READ_EN(1) | ++ EDID_WRITE_EN(0)); ++ edid_len = edid_len > sizeof(data) ? sizeof(data) : edid_len; ++ memset(data, 0, sizeof(data)); ++ for (i = 0; i < edid_len; i++) ++ data[i] = hdmirx_readl(hdmirx_dev, DMA_STATUS14); ++ ++ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, data, ++ edid_len, false); ++ } ++ ++ /* ++ * You must set EDID_READ_EN & EDID_WRITE_EN bit to 0, ++ * when the read/write edid operation is completed.Otherwise, it ++ * will affect the reading and writing of other registers ++ */ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG11, ++ EDID_READ_EN_MASK | EDID_WRITE_EN_MASK, ++ EDID_READ_EN(0) | EDID_WRITE_EN(0)); ++ ++ hdmirx_dev->edid_blocks_written = edid->blocks; ++ memcpy(&hdmirx_dev->edid, edid->edid, edid->blocks * EDID_BLOCK_SIZE); ++ if (hpd_up) { ++ if (tx_5v_power_present(hdmirx_dev)) { ++ /* Add 100ms delay after updating the EDID as per HDMI specs */ ++ msleep(100); ++ hdmirx_hpd_ctrl(hdmirx_dev, true); ++ } ++ } ++ ++ return 0; ++} ++ ++/* ++ * Before clearing interrupt, we need to read the interrupt status. ++ */ ++static inline void hdmirx_clear_interrupt(struct snps_hdmirx_dev *hdmirx_dev, ++ u32 reg, u32 val) ++{ ++ /* (interrupt status register) = (interrupt clear register) - 0x8 */ ++ hdmirx_readl(hdmirx_dev, reg - 0x8); ++ hdmirx_writel(hdmirx_dev, reg, val); ++} ++ ++static void hdmirx_interrupts_setup(struct snps_hdmirx_dev *hdmirx_dev, bool en) ++{ ++ v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: %sable\n", ++ __func__, en ? "en" : "dis"); ++ ++ /* Note: In DVI mode, it needs to be written twice to take effect. */ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_0_INT_CLEAR, 0xffffffff); ++ ++ if (en) { ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_0_INT_MASK_N, ++ TMDSQPCLK_OFF_CHG | TMDSQPCLK_LOCKED_CHG, ++ TMDSQPCLK_OFF_CHG | TMDSQPCLK_LOCKED_CHG); ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_2_INT_MASK_N, ++ TMDSVALID_STABLE_CHG, TMDSVALID_STABLE_CHG); ++ hdmirx_update_bits(hdmirx_dev, AVPUNIT_0_INT_MASK_N, ++ CED_DYN_CNT_CH2_IRQ | ++ CED_DYN_CNT_CH1_IRQ | ++ CED_DYN_CNT_CH0_IRQ, ++ CED_DYN_CNT_CH2_IRQ | ++ CED_DYN_CNT_CH1_IRQ | ++ CED_DYN_CNT_CH0_IRQ); ++ } else { ++ hdmirx_writel(hdmirx_dev, MAINUNIT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_2_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_0_INT_MASK_N, 0); ++ } ++} ++ ++static void hdmirx_plugout(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct arm_smccc_res res; ++ ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, 0); ++ hdmirx_interrupts_setup(hdmirx_dev, false); ++ hdmirx_hpd_ctrl(hdmirx_dev, false); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, 0); ++ hdmirx_reset_dma(hdmirx_dev); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, HDMI_DISABLE | PHY_RESET | ++ PHY_PDDQ, HDMI_DISABLE); ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG0, 0x0); ++ cancel_delayed_work(&hdmirx_dev->delayed_work_res_change); ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_heartbeat); ++ flush_work(&hdmirx_dev->work_wdt_config); ++ arm_smccc_smc(SIP_WDT_CFG, WDT_STOP, 0, 0, 0, 0, 0, 0, &res); ++} ++ ++static int hdmirx_set_edid(struct file *file, void *fh, struct v4l2_edid *edid) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct arm_smccc_res res; ++ int ret; ++ ++ disable_irq(hdmirx_dev->hdmi_irq); ++ disable_irq(hdmirx_dev->dma_irq); ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_DIS, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ if (tx_5v_power_present(hdmirx_dev)) ++ hdmirx_plugout(hdmirx_dev); ++ ret = hdmirx_write_edid(hdmirx_dev, edid, false); ++ if (ret) ++ return ret; ++ ++ enable_irq(hdmirx_dev->hdmi_irq); ++ enable_irq(hdmirx_dev->dma_irq); ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_EN, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(500)); ++ return 0; ++} ++ ++static int hdmirx_get_edid(struct file *file, void *fh, struct v4l2_edid *edid) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ memset(edid->reserved, 0, sizeof(edid->reserved)); ++ ++ if (edid->pad) ++ return -EINVAL; ++ ++ if (!edid->start_block && !edid->blocks) { ++ edid->blocks = hdmirx_dev->edid_blocks_written; ++ return 0; ++ } ++ ++ if (!hdmirx_dev->edid_blocks_written) ++ return -ENODATA; ++ ++ if (edid->start_block >= hdmirx_dev->edid_blocks_written || !edid->blocks) ++ return -EINVAL; ++ ++ if (edid->start_block + edid->blocks > hdmirx_dev->edid_blocks_written) ++ edid->blocks = hdmirx_dev->edid_blocks_written - edid->start_block; ++ ++ memcpy(edid->edid, &hdmirx_dev->edid, edid->blocks * EDID_BLOCK_SIZE); ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: read EDID:\n", __func__); ++ if (debug > 0) ++ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, ++ edid->edid, edid->blocks * EDID_BLOCK_SIZE, false); ++ ++ return 0; ++} ++ ++static int hdmirx_g_parm(struct file *file, void *priv, ++ struct v4l2_streamparm *parm) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_fract fps; ++ ++ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) ++ return -EINVAL; ++ ++ fps = v4l2_calc_timeperframe(&hdmirx_dev->timings); ++ parm->parm.capture.timeperframe.numerator = fps.numerator; ++ parm->parm.capture.timeperframe.denominator = fps.denominator; ++ ++ return 0; ++} ++ ++static int hdmirx_dv_timings_cap(struct file *file, void *fh, ++ struct v4l2_dv_timings_cap *cap) ++{ ++ *cap = hdmirx_timings_cap; ++ return 0; ++} ++ ++static int hdmirx_enum_dv_timings(struct file *file, void *_fh, ++ struct v4l2_enum_dv_timings *timings) ++{ ++ return v4l2_enum_dv_timings_cap(timings, &hdmirx_timings_cap, NULL, NULL); ++} ++ ++static void hdmirx_scdc_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_update_bits(hdmirx_dev, I2C_SLAVE_CONFIG1, ++ I2C_SDA_OUT_HOLD_VALUE_QST_MASK | ++ I2C_SDA_IN_HOLD_VALUE_QST_MASK, ++ I2C_SDA_OUT_HOLD_VALUE_QST(0x80) | ++ I2C_SDA_IN_HOLD_VALUE_QST(0x15)); ++ hdmirx_update_bits(hdmirx_dev, SCDC_REGBANK_CONFIG0, ++ SCDC_SINKVERSION_QST_MASK, ++ SCDC_SINKVERSION_QST(1)); ++} ++ ++static int wait_reg_bit_status(struct snps_hdmirx_dev *hdmirx_dev, u32 reg, ++ u32 bit_mask, u32 expect_val, bool is_grf, ++ u32 ms) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 i, val; ++ ++ for (i = 0; i < ms; i++) { ++ if (is_grf) ++ regmap_read(hdmirx_dev->grf, reg, &val); ++ else ++ val = hdmirx_readl(hdmirx_dev, reg); ++ ++ if ((val & bit_mask) == expect_val) { ++ v4l2_dbg(2, debug, v4l2_dev, ++ "%s: i:%d, time: %dms\n", __func__, i, ms); ++ break; ++ } ++ usleep_range(1000, 1010); ++ } ++ ++ if (i == ms) ++ return -1; ++ ++ return 0; ++} ++ ++static int hdmirx_phy_register_write(struct snps_hdmirx_dev *hdmirx_dev, ++ u32 phy_reg, u32 val) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ ++ reinit_completion(&hdmirx_dev->cr_write_done); ++ /* clear irq status */ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ /* en irq */ ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_2_INT_MASK_N, ++ PHYCREG_CR_WRITE_DONE, PHYCREG_CR_WRITE_DONE); ++ /* write phy reg addr */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG1, phy_reg); ++ /* write phy reg val */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG2, val); ++ /* config write enable */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONTROL, PHYCREG_CR_PARA_WRITE_P); ++ ++ if (!wait_for_completion_timeout(&hdmirx_dev->cr_write_done, ++ msecs_to_jiffies(20))) { ++ dev_err(dev, "%s wait cr write done failed\n", __func__); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++static void hdmirx_tmds_clk_ratio_config(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 val; ++ ++ val = hdmirx_readl(hdmirx_dev, SCDC_REGBANK_STATUS1); ++ v4l2_dbg(3, debug, v4l2_dev, "%s: scdc_regbank_st:%#x\n", __func__, val); ++ hdmirx_dev->tmds_clk_ratio = (val & SCDC_TMDSBITCLKRATIO) > 0; ++ ++ if (hdmirx_dev->tmds_clk_ratio) { ++ v4l2_dbg(3, debug, v4l2_dev, "%s: HDMITX greater than 3.4Gbps\n", __func__); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, ++ TMDS_CLOCK_RATIO, TMDS_CLOCK_RATIO); ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, "%s: HDMITX less than 3.4Gbps\n", __func__); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, ++ TMDS_CLOCK_RATIO, 0); ++ } ++} ++ ++static void hdmirx_phy_config(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ ++ hdmirx_clear_interrupt(hdmirx_dev, SCDC_INT_CLEAR, 0xffffffff); ++ hdmirx_update_bits(hdmirx_dev, SCDC_INT_MASK_N, SCDCTMDSCCFG_CHG, ++ SCDCTMDSCCFG_CHG); ++ /* cr_para_clk 24M */ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, REFFREQ_SEL_MASK, REFFREQ_SEL(0)); ++ /* rx data width 40bit valid */ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, RXDATA_WIDTH, RXDATA_WIDTH); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_RESET, PHY_RESET); ++ usleep_range(100, 110); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_RESET, 0); ++ usleep_range(100, 110); ++ /* select cr para interface */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG0, 0x3); ++ ++ if (wait_reg_bit_status(hdmirx_dev, SYS_GRF_SOC_STATUS1, ++ HDMIRXPHY_SRAM_INIT_DONE, ++ HDMIRXPHY_SRAM_INIT_DONE, true, 10)) ++ dev_err(dev, "%s: phy SRAM init failed\n", __func__); ++ ++ regmap_write(hdmirx_dev->grf, SYS_GRF_SOC_CON1, ++ (HDMIRXPHY_SRAM_EXT_LD_DONE << 16) | ++ HDMIRXPHY_SRAM_EXT_LD_DONE); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 3); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 3); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 0); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 1); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 0); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 0); ++ ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_3_REG, ++ CDR_SETTING_BOUNDARY_3_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_4_REG, ++ CDR_SETTING_BOUNDARY_4_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_5_REG, ++ CDR_SETTING_BOUNDARY_5_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_6_REG, ++ CDR_SETTING_BOUNDARY_6_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_7_REG, ++ CDR_SETTING_BOUNDARY_7_DEFAULT); ++ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_PDDQ, 0); ++ if (wait_reg_bit_status(hdmirx_dev, PHY_STATUS, PDDQ_ACK, 0, false, 10)) ++ dev_err(dev, "%s: wait pddq ack failed\n", __func__); ++ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, HDMI_DISABLE, 0); ++ if (wait_reg_bit_status(hdmirx_dev, PHY_STATUS, HDMI_DISABLE_ACK, 0, ++ false, 50)) ++ dev_err(dev, "%s: wait hdmi disable ack failed\n", __func__); ++ ++ hdmirx_tmds_clk_ratio_config(hdmirx_dev); ++} ++ ++static void hdmirx_controller_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ ++ reinit_completion(&hdmirx_dev->timer_base_lock); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ /* en irq */ ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_0_INT_MASK_N, ++ TIMER_BASE_LOCKED_IRQ, TIMER_BASE_LOCKED_IRQ); ++ /* write irefclk freq */ ++ hdmirx_writel(hdmirx_dev, GLOBAL_TIMER_REF_BASE, IREF_CLK_FREQ_HZ); ++ ++ if (!wait_for_completion_timeout(&hdmirx_dev->timer_base_lock, ++ msecs_to_jiffies(20))) ++ dev_err(dev, "%s wait timer base lock failed\n", __func__); ++ ++ hdmirx_update_bits(hdmirx_dev, CMU_CONFIG0, ++ TMDSQPCLK_STABLE_FREQ_MARGIN_MASK | ++ AUDCLK_STABLE_FREQ_MARGIN_MASK, ++ TMDSQPCLK_STABLE_FREQ_MARGIN(2) | ++ AUDCLK_STABLE_FREQ_MARGIN(1)); ++ hdmirx_update_bits(hdmirx_dev, DESCRAND_EN_CONTROL, ++ SCRAMB_EN_SEL_QST_MASK, SCRAMB_EN_SEL_QST(1)); ++ hdmirx_update_bits(hdmirx_dev, CED_CONFIG, ++ CED_VIDDATACHECKEN_QST | ++ CED_DATAISCHECKEN_QST | ++ CED_GBCHECKEN_QST | ++ CED_CTRLCHECKEN_QST | ++ CED_CHLOCKMAXER_QST_MASK, ++ CED_VIDDATACHECKEN_QST | ++ CED_GBCHECKEN_QST | ++ CED_CTRLCHECKEN_QST | ++ CED_CHLOCKMAXER_QST(0x10)); ++ hdmirx_update_bits(hdmirx_dev, DEFRAMER_CONFIG0, ++ VS_REMAPFILTER_EN_QST | VS_FILTER_ORDER_QST_MASK, ++ VS_REMAPFILTER_EN_QST | VS_FILTER_ORDER_QST(0x3)); ++} ++ ++static void hdmirx_set_negative_pol(struct snps_hdmirx_dev *hdmirx_dev, bool en) ++{ ++ if (en) { ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, ++ VSYNC_TOGGLE_EN | HSYNC_TOGGLE_EN, ++ VSYNC_TOGGLE_EN | HSYNC_TOGGLE_EN); ++ hdmirx_update_bits(hdmirx_dev, VIDEO_CONFIG2, ++ VPROC_VSYNC_POL_OVR_VALUE | ++ VPROC_VSYNC_POL_OVR_EN | ++ VPROC_HSYNC_POL_OVR_VALUE | ++ VPROC_HSYNC_POL_OVR_EN, ++ VPROC_VSYNC_POL_OVR_EN | ++ VPROC_HSYNC_POL_OVR_EN); ++ return; ++ } ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, ++ VSYNC_TOGGLE_EN | HSYNC_TOGGLE_EN, 0); ++ ++ hdmirx_update_bits(hdmirx_dev, VIDEO_CONFIG2, ++ VPROC_VSYNC_POL_OVR_VALUE | ++ VPROC_VSYNC_POL_OVR_EN | ++ VPROC_HSYNC_POL_OVR_VALUE | ++ VPROC_HSYNC_POL_OVR_EN, 0); ++} ++ ++static int hdmirx_try_to_get_timings(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_dv_timings *timings, ++ int try_cnt) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int i, cnt = 0, fail_cnt = 0, ret = 0; ++ bool from_dma = false; ++ ++ hdmirx_set_negative_pol(hdmirx_dev, false); ++ for (i = 0; i < try_cnt; i++) { ++ ret = hdmirx_get_detected_timings(hdmirx_dev, timings, from_dma); ++ if (ret) { ++ cnt = 0; ++ fail_cnt++; ++ if (fail_cnt > 3) { ++ hdmirx_set_negative_pol(hdmirx_dev, true); ++ from_dma = true; ++ } ++ } else { ++ cnt++; ++ } ++ if (cnt >= 5) ++ break; ++ ++ usleep_range(10 * 1000, 10 * 1100); ++ } ++ ++ if (try_cnt > 8 && cnt < 5) ++ v4l2_dbg(1, debug, v4l2_dev, "%s: res not stable\n", __func__); ++ ++ return ret; ++} ++ ++static void hdmirx_format_change(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_dv_timings timings; ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ const struct v4l2_event ev_src_chg = { ++ .type = V4L2_EVENT_SOURCE_CHANGE, ++ .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, ++ }; ++ ++ if (hdmirx_try_to_get_timings(hdmirx_dev, &timings, 20)) { ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(20)); ++ return; ++ } ++ ++ hdmirx_dev->got_timing = true; ++ v4l2_dbg(1, debug, v4l2_dev, "%s: queue res_chg_event\n", __func__); ++ v4l2_event_queue(&stream->vdev, &ev_src_chg); ++} ++ ++static void hdmirx_set_ddr_store_fmt(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ enum ddr_store_fmt store_fmt; ++ u32 dma_cfg1; ++ ++ switch (hdmirx_dev->pix_fmt) { ++ case HDMIRX_RGB888: ++ store_fmt = STORE_RGB888; ++ break; ++ case HDMIRX_YUV444: ++ store_fmt = STORE_YUV444_8BIT; ++ break; ++ case HDMIRX_YUV422: ++ store_fmt = STORE_YUV422_8BIT; ++ break; ++ case HDMIRX_YUV420: ++ store_fmt = STORE_YUV420_8BIT; ++ break; ++ default: ++ store_fmt = STORE_RGB888; ++ break; ++ } ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG1, ++ DDR_STORE_FORMAT_MASK, DDR_STORE_FORMAT(store_fmt)); ++ dma_cfg1 = hdmirx_readl(hdmirx_dev, DMA_CONFIG1); ++ v4l2_dbg(1, debug, v4l2_dev, "%s: pix_fmt: %s, DMA_CONFIG1:%#x\n", ++ __func__, pix_fmt_str[hdmirx_dev->pix_fmt], dma_cfg1); ++} ++ ++static int hdmirx_wait_lock_and_get_timing(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 mu_status, scdc_status, dma_st10, cmu_st; ++ u32 i; ++ ++ for (i = 0; i < 300; i++) { ++ mu_status = hdmirx_readl(hdmirx_dev, MAINUNIT_STATUS); ++ scdc_status = hdmirx_readl(hdmirx_dev, SCDC_REGBANK_STATUS3); ++ dma_st10 = hdmirx_readl(hdmirx_dev, DMA_STATUS10); ++ cmu_st = hdmirx_readl(hdmirx_dev, CMU_STATUS); ++ ++ if ((mu_status & TMDSVALID_STABLE_ST) && ++ (dma_st10 & HDMIRX_LOCK) && ++ (cmu_st & TMDSQPCLK_LOCKED_ST)) ++ break; ++ ++ if (!tx_5v_power_present(hdmirx_dev)) { ++ v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__); ++ return -1; ++ } ++ ++ hdmirx_tmds_clk_ratio_config(hdmirx_dev); ++ } ++ ++ if (i == 300) { ++ v4l2_err(v4l2_dev, "%s: signal not lock, tmds_clk_ratio:%d\n", ++ __func__, hdmirx_dev->tmds_clk_ratio); ++ v4l2_err(v4l2_dev, "%s: mu_st:%#x, scdc_st:%#x, dma_st10:%#x\n", ++ __func__, mu_status, scdc_status, dma_st10); ++ return -1; ++ } ++ ++ v4l2_info(v4l2_dev, "%s: signal lock ok, i:%d\n", __func__, i); ++ hdmirx_writel(hdmirx_dev, GLOBAL_SWRESET_REQUEST, DATAPATH_SWRESETREQ); ++ ++ reinit_completion(&hdmirx_dev->avi_pkt_rcv); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_update_bits(hdmirx_dev, PKT_2_INT_MASK_N, ++ PKTDEC_AVIIF_RCV_IRQ, PKTDEC_AVIIF_RCV_IRQ); ++ ++ if (!wait_for_completion_timeout(&hdmirx_dev->avi_pkt_rcv, ++ msecs_to_jiffies(300))) { ++ v4l2_err(v4l2_dev, "%s wait avi_pkt_rcv failed\n", __func__); ++ hdmirx_update_bits(hdmirx_dev, PKT_2_INT_MASK_N, ++ PKTDEC_AVIIF_RCV_IRQ, 0); ++ } ++ ++ usleep_range(50 * 1000, 50 * 1010); ++ hdmirx_format_change(hdmirx_dev); ++ ++ return 0; ++} ++ ++static void hdmirx_dma_config(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_set_ddr_store_fmt(hdmirx_dev); ++ ++ /* Note: uv_swap, rb can not swap, doc err*/ ++ if (hdmirx_dev->cur_fmt_fourcc != V4L2_PIX_FMT_NV16) ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, RB_SWAP_EN, RB_SWAP_EN); ++ else ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, RB_SWAP_EN, 0); ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG7, ++ LOCK_FRAME_NUM_MASK, ++ LOCK_FRAME_NUM(2)); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG1, ++ UV_WID_MASK | Y_WID_MASK | ABANDON_EN, ++ UV_WID(1) | Y_WID(2) | ABANDON_EN); ++} ++ ++static void hdmirx_submodule_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ /* Note: if not config HDCP2_CONFIG, there will be some errors; */ ++ hdmirx_update_bits(hdmirx_dev, HDCP2_CONFIG, ++ HDCP2_SWITCH_OVR_VALUE | ++ HDCP2_SWITCH_OVR_EN, ++ HDCP2_SWITCH_OVR_EN); ++ hdmirx_scdc_init(hdmirx_dev); ++ hdmirx_controller_init(hdmirx_dev); ++} ++ ++static int hdmirx_enum_input(struct file *file, void *priv, ++ struct v4l2_input *input) ++{ ++ if (input->index > 0) ++ return -EINVAL; ++ ++ input->type = V4L2_INPUT_TYPE_CAMERA; ++ input->std = 0; ++ strscpy(input->name, "HDMI IN", sizeof(input->name)); ++ input->capabilities = V4L2_IN_CAP_DV_TIMINGS; ++ ++ return 0; ++} ++ ++static int hdmirx_get_input(struct file *file, void *priv, unsigned int *i) ++{ ++ *i = 0; ++ return 0; ++} ++ ++static int hdmirx_set_input(struct file *file, void *priv, unsigned int i) ++{ ++ if (i) ++ return -EINVAL; ++ return 0; ++} ++ ++static void hdmirx_set_fmt(struct hdmirx_stream *stream, ++ struct v4l2_pix_format_mplane *pixm, bool try) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_bt_timings *bt = &hdmirx_dev->timings.bt; ++ const struct v4l2_format_info *finfo; ++ unsigned int imagesize = 0; ++ int i; ++ ++ memset(&pixm->plane_fmt[0], 0, sizeof(struct v4l2_plane_pix_format)); ++ finfo = v4l2_format_info(pixm->pixelformat); ++ if (!finfo) { ++ finfo = v4l2_format_info(V4L2_PIX_FMT_BGR24); ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: set_fmt:%#x not supported, use def_fmt:%x\n", ++ __func__, pixm->pixelformat, finfo->format); ++ } ++ ++ if (!bt->width || !bt->height) ++ v4l2_dbg(1, debug, v4l2_dev, "%s: invalid resolution:%#xx%#x\n", ++ __func__, bt->width, bt->height); ++ ++ pixm->pixelformat = finfo->format; ++ pixm->width = bt->width; ++ pixm->height = bt->height; ++ pixm->num_planes = finfo->mem_planes; ++ pixm->quantization = V4L2_QUANTIZATION_DEFAULT; ++ pixm->colorspace = V4L2_COLORSPACE_SRGB; ++ pixm->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; ++ ++ if (bt->interlaced == V4L2_DV_INTERLACED) ++ pixm->field = V4L2_FIELD_INTERLACED_TB; ++ else ++ pixm->field = V4L2_FIELD_NONE; ++ ++ memset(pixm->reserved, 0, sizeof(pixm->reserved)); ++ ++ v4l2_fill_pixfmt_mp(pixm, finfo->format, pixm->width, pixm->height); ++ ++ for (i = 0; i < pixm->num_planes; i++) { ++ struct v4l2_plane_pix_format *plane_fmt; ++ int width, height, bpl, size, bpp = 0; ++ ++ if (!i) { ++ width = pixm->width; ++ height = pixm->height; ++ } else { ++ width = pixm->width / finfo->hdiv; ++ height = pixm->height / finfo->vdiv; ++ } ++ ++ switch (finfo->format) { ++ case V4L2_PIX_FMT_NV24: ++ case V4L2_PIX_FMT_NV16: ++ case V4L2_PIX_FMT_NV12: ++ case V4L2_PIX_FMT_BGR24: ++ bpp = finfo->bpp[i]; ++ break; ++ default: ++ v4l2_dbg(1, debug, v4l2_dev, ++ "fourcc: %#x is not supported\n", ++ finfo->format); ++ break; ++ } ++ ++ bpl = ALIGN(width * bpp, MEMORY_ALIGN_ROUND_UP_BYTES); ++ size = bpl * height; ++ imagesize += size; ++ ++ if (finfo->mem_planes > i) { ++ /* Set bpl and size for each mplane */ ++ plane_fmt = pixm->plane_fmt + i; ++ plane_fmt->bytesperline = bpl; ++ plane_fmt->sizeimage = size; ++ } ++ ++ v4l2_dbg(1, debug, v4l2_dev, ++ "C-Plane %i size: %d, Total imagesize: %d\n", ++ i, size, imagesize); ++ } ++ ++ /* Convert to non-MPLANE format as we want to unify non-MPLANE and MPLANE */ ++ if (finfo->mem_planes == 1) ++ pixm->plane_fmt[0].sizeimage = imagesize; ++ ++ if (!try) { ++ stream->out_finfo = finfo; ++ stream->pixm = *pixm; ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: req(%d, %d), out(%d, %d), fmt:%#x\n", __func__, ++ pixm->width, pixm->height, stream->pixm.width, ++ stream->pixm.height, finfo->format); ++ } ++} ++ ++static int hdmirx_enum_fmt_vid_cap_mplane(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ ++ if (f->index >= 1) ++ return -EINVAL; ++ ++ f->pixelformat = hdmirx_dev->cur_fmt_fourcc; ++ ++ return 0; ++} ++ ++static int hdmirx_s_fmt_vid_cap_mplane(struct file *file, ++ void *priv, struct v4l2_format *f) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (vb2_is_busy(&stream->buf_queue)) { ++ v4l2_err(v4l2_dev, "%s: queue busy\n", __func__); ++ return -EBUSY; ++ } ++ ++ hdmirx_set_fmt(stream, &f->fmt.pix_mp, false); ++ ++ return 0; ++} ++ ++static int hdmirx_g_fmt_vid_cap_mplane(struct file *file, void *fh, ++ struct v4l2_format *f) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_pix_format_mplane pixm = {}; ++ ++ pixm.pixelformat = hdmirx_dev->cur_fmt_fourcc; ++ hdmirx_set_fmt(stream, &pixm, true); ++ f->fmt.pix_mp = pixm; ++ ++ return 0; ++} ++ ++static int hdmirx_g_dv_timings(struct file *file, void *_fh, ++ struct v4l2_dv_timings *timings) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 dma_cfg1; ++ ++ *timings = hdmirx_dev->timings; ++ dma_cfg1 = hdmirx_readl(hdmirx_dev, DMA_CONFIG1); ++ v4l2_dbg(1, debug, v4l2_dev, "%s: pix_fmt: %s, DMA_CONFIG1:%#x\n", ++ __func__, pix_fmt_str[hdmirx_dev->pix_fmt], dma_cfg1); ++ ++ return 0; ++} ++ ++static int hdmirx_s_dv_timings(struct file *file, void *_fh, ++ struct v4l2_dv_timings *timings) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (!timings) ++ return -EINVAL; ++ ++ if (debug) ++ v4l2_print_dv_timings(hdmirx_dev->v4l2_dev.name, ++ "s_dv_timings: ", timings, false); ++ ++ if (!v4l2_valid_dv_timings(timings, &hdmirx_timings_cap, NULL, NULL)) { ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: timings out of range\n", __func__); ++ return -ERANGE; ++ } ++ ++ /* Check if the timings are part of the CEA-861 timings. */ ++ v4l2_find_dv_timings_cap(timings, &hdmirx_timings_cap, 0, NULL, NULL); ++ ++ if (v4l2_match_dv_timings(&hdmirx_dev->timings, timings, 0, false)) { ++ v4l2_dbg(1, debug, v4l2_dev, "%s: no change\n", __func__); ++ return 0; ++ } ++ ++ /* ++ * Changing the timings implies a format change, which is not allowed ++ * while buffers for use with streaming have already been allocated. ++ */ ++ if (vb2_is_busy(&stream->buf_queue)) ++ return -EBUSY; ++ ++ hdmirx_dev->timings = *timings; ++ /* Update the internal format */ ++ hdmirx_set_fmt(stream, &stream->pixm, false); ++ ++ return 0; ++} ++ ++static int hdmirx_querycap(struct file *file, void *priv, ++ struct v4l2_capability *cap) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct device *dev = stream->hdmirx_dev->dev; ++ ++ strscpy(cap->driver, dev->driver->name, sizeof(cap->driver)); ++ strscpy(cap->card, dev->driver->name, sizeof(cap->card)); ++ ++ return 0; ++} ++ ++static int hdmirx_queue_setup(struct vb2_queue *queue, ++ unsigned int *num_buffers, ++ unsigned int *num_planes, ++ unsigned int sizes[], ++ struct device *alloc_ctxs[]) ++{ ++ struct hdmirx_stream *stream = vb2_get_drv_priv(queue); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ const struct v4l2_pix_format_mplane *pixm = NULL; ++ const struct v4l2_format_info *out_finfo; ++ u32 i, height; ++ ++ pixm = &stream->pixm; ++ out_finfo = stream->out_finfo; ++ ++ if (!num_planes || !out_finfo) { ++ v4l2_err(v4l2_dev, "%s: out_fmt not set\n", __func__); ++ return -EINVAL; ++ } ++ ++ if (*num_planes) { ++ if (*num_planes != pixm->num_planes) ++ return -EINVAL; ++ ++ for (i = 0; i < *num_planes; i++) ++ if (sizes[i] < pixm->plane_fmt[i].sizeimage) ++ return -EINVAL; ++ return 0; ++ } ++ ++ *num_planes = out_finfo->mem_planes; ++ height = pixm->height; ++ ++ for (i = 0; i < out_finfo->mem_planes; i++) ++ sizes[i] = pixm->plane_fmt[i].sizeimage; ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: count %d, size %d\n", ++ v4l2_type_names[queue->type], *num_buffers, sizes[0]); ++ ++ return 0; ++} ++ ++/* ++ * The vb2_buffer are stored in hdmirx_buffer, in order to unify ++ * mplane buffer and none-mplane buffer. ++ */ ++static void hdmirx_buf_queue(struct vb2_buffer *vb) ++{ ++ const struct v4l2_format_info *out_finfo; ++ struct vb2_v4l2_buffer *vbuf; ++ struct hdmirx_buffer *hdmirx_buf; ++ struct vb2_queue *queue; ++ struct hdmirx_stream *stream; ++ const struct v4l2_pix_format_mplane *pixm; ++ unsigned long lock_flags = 0; ++ int i; ++ ++ vbuf = to_vb2_v4l2_buffer(vb); ++ hdmirx_buf = container_of(vbuf, struct hdmirx_buffer, vb); ++ queue = vb->vb2_queue; ++ stream = vb2_get_drv_priv(queue); ++ pixm = &stream->pixm; ++ out_finfo = stream->out_finfo; ++ ++ memset(hdmirx_buf->buff_addr, 0, sizeof(hdmirx_buf->buff_addr)); ++ ++ /* ++ * If mplanes > 1, every c-plane has its own m-plane, ++ * otherwise, multiple c-planes are in the same m-plane ++ */ ++ for (i = 0; i < out_finfo->mem_planes; i++) ++ hdmirx_buf->buff_addr[i] = vb2_dma_contig_plane_dma_addr(vb, i); ++ ++ if (out_finfo->mem_planes == 1) { ++ if (out_finfo->comp_planes == 1) { ++ hdmirx_buf->buff_addr[HDMIRX_PLANE_CBCR] = ++ hdmirx_buf->buff_addr[HDMIRX_PLANE_Y]; ++ } else { ++ for (i = 0; i < out_finfo->comp_planes - 1; i++) ++ hdmirx_buf->buff_addr[i + 1] = ++ hdmirx_buf->buff_addr[i] + ++ pixm->plane_fmt[i].bytesperline * ++ pixm->height; ++ } ++ } ++ ++ spin_lock_irqsave(&stream->vbq_lock, lock_flags); ++ list_add_tail(&hdmirx_buf->queue, &stream->buf_head); ++ spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); ++} ++ ++static void return_all_buffers(struct hdmirx_stream *stream, ++ enum vb2_buffer_state state) ++{ ++ struct hdmirx_buffer *buf; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&stream->vbq_lock, flags); ++ if (stream->curr_buf) ++ list_add_tail(&stream->curr_buf->queue, &stream->buf_head); ++ if (stream->next_buf && stream->next_buf != stream->curr_buf) ++ list_add_tail(&stream->next_buf->queue, &stream->buf_head); ++ stream->curr_buf = NULL; ++ stream->next_buf = NULL; ++ ++ while (!list_empty(&stream->buf_head)) { ++ buf = list_first_entry(&stream->buf_head, ++ struct hdmirx_buffer, queue); ++ list_del(&buf->queue); ++ spin_unlock_irqrestore(&stream->vbq_lock, flags); ++ vb2_buffer_done(&buf->vb.vb2_buf, state); ++ spin_lock_irqsave(&stream->vbq_lock, flags); ++ } ++ spin_unlock_irqrestore(&stream->vbq_lock, flags); ++} ++ ++static void hdmirx_stop_streaming(struct vb2_queue *queue) ++{ ++ struct hdmirx_stream *stream = vb2_get_drv_priv(queue); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int ret; ++ ++ v4l2_info(v4l2_dev, "stream start stopping\n"); ++ mutex_lock(&hdmirx_dev->stream_lock); ++ WRITE_ONCE(stream->stopping, true); ++ ++ /* wait last irq to return the buffer */ ++ ret = wait_event_timeout(stream->wq_stopped, !stream->stopping, ++ msecs_to_jiffies(500)); ++ if (!ret) { ++ v4l2_err(v4l2_dev, "%s: timeout waiting last irq\n", ++ __func__); ++ WRITE_ONCE(stream->stopping, false); ++ } ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0); ++ return_all_buffers(stream, VB2_BUF_STATE_ERROR); ++ mutex_unlock(&hdmirx_dev->stream_lock); ++ v4l2_info(v4l2_dev, "stream stopping finished\n"); ++} ++ ++static int hdmirx_start_streaming(struct vb2_queue *queue, unsigned int count) ++{ ++ struct hdmirx_stream *stream = vb2_get_drv_priv(queue); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_dv_timings timings = hdmirx_dev->timings; ++ struct v4l2_bt_timings *bt = &timings.bt; ++ unsigned long lock_flags = 0; ++ int line_flag; ++ ++ if (!hdmirx_dev->got_timing) { ++ v4l2_dbg(1, debug, v4l2_dev, "timing is invalid\n"); ++ return 0; ++ } ++ ++ mutex_lock(&hdmirx_dev->stream_lock); ++ stream->frame_idx = 0; ++ stream->line_flag_int_cnt = 0; ++ stream->curr_buf = NULL; ++ stream->next_buf = NULL; ++ stream->irq_stat = 0; ++ queue->min_queued_buffers = 1; ++ ++ WRITE_ONCE(stream->stopping, false); ++ ++ spin_lock_irqsave(&stream->vbq_lock, lock_flags); ++ if (!stream->curr_buf) { ++ if (!list_empty(&stream->buf_head)) { ++ stream->curr_buf = list_first_entry(&stream->buf_head, ++ struct hdmirx_buffer, ++ queue); ++ list_del(&stream->curr_buf->queue); ++ } else { ++ stream->curr_buf = NULL; ++ } ++ } ++ spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); ++ ++ v4l2_dbg(2, debug, v4l2_dev, ++ "%s: start_stream cur_buf y_addr:%#x, uv_addr:%#x\n", ++ __func__, stream->curr_buf->buff_addr[HDMIRX_PLANE_Y], ++ stream->curr_buf->buff_addr[HDMIRX_PLANE_CBCR]); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG2, ++ stream->curr_buf->buff_addr[HDMIRX_PLANE_Y]); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG3, ++ stream->curr_buf->buff_addr[HDMIRX_PLANE_CBCR]); ++ ++ if (bt->height) { ++ if (bt->interlaced == V4L2_DV_INTERLACED) ++ line_flag = bt->height / 4; ++ else ++ line_flag = bt->height / 2; ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG7, ++ LINE_FLAG_NUM_MASK, ++ LINE_FLAG_NUM(line_flag)); ++ } else { ++ v4l2_err(v4l2_dev, "height err: %d\n", bt->height); ++ } ++ ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG5, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, CED_DYN_CONTROL, 0x1); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, HDMIRX_DMA_EN); ++ v4l2_dbg(1, debug, v4l2_dev, "%s: enable dma", __func__); ++ mutex_unlock(&hdmirx_dev->stream_lock); ++ ++ return 0; ++} ++ ++/* vb2 queue */ ++static const struct vb2_ops hdmirx_vb2_ops = { ++ .queue_setup = hdmirx_queue_setup, ++ .buf_queue = hdmirx_buf_queue, ++ .wait_prepare = vb2_ops_wait_prepare, ++ .wait_finish = vb2_ops_wait_finish, ++ .stop_streaming = hdmirx_stop_streaming, ++ .start_streaming = hdmirx_start_streaming, ++}; ++ ++static int hdmirx_init_vb2_queue(struct vb2_queue *q, ++ struct hdmirx_stream *stream, ++ enum v4l2_buf_type buf_type) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ ++ q->type = buf_type; ++ q->io_modes = VB2_MMAP | VB2_DMABUF; ++ q->drv_priv = stream; ++ q->ops = &hdmirx_vb2_ops; ++ q->mem_ops = &vb2_dma_contig_memops; ++ q->buf_struct_size = sizeof(struct hdmirx_buffer); ++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ++ q->lock = &stream->vlock; ++ q->dev = hdmirx_dev->dev; ++ /* ++ * rk3588 doesn't use iommu and works only with dma buffers ++ * that are physically contiguous in memory. ++ */ ++ q->dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS; ++ return vb2_queue_init(q); ++} ++ ++/* video device */ ++static const struct v4l2_ioctl_ops hdmirx_v4l2_ioctl_ops = { ++ .vidioc_querycap = hdmirx_querycap, ++ .vidioc_try_fmt_vid_cap_mplane = hdmirx_g_fmt_vid_cap_mplane, ++ .vidioc_s_fmt_vid_cap_mplane = hdmirx_s_fmt_vid_cap_mplane, ++ .vidioc_g_fmt_vid_cap_mplane = hdmirx_g_fmt_vid_cap_mplane, ++ .vidioc_enum_fmt_vid_cap = hdmirx_enum_fmt_vid_cap_mplane, ++ ++ .vidioc_s_dv_timings = hdmirx_s_dv_timings, ++ .vidioc_g_dv_timings = hdmirx_g_dv_timings, ++ .vidioc_enum_dv_timings = hdmirx_enum_dv_timings, ++ .vidioc_query_dv_timings = hdmirx_query_dv_timings, ++ .vidioc_dv_timings_cap = hdmirx_dv_timings_cap, ++ .vidioc_enum_input = hdmirx_enum_input, ++ .vidioc_g_input = hdmirx_get_input, ++ .vidioc_s_input = hdmirx_set_input, ++ .vidioc_g_edid = hdmirx_get_edid, ++ .vidioc_s_edid = hdmirx_set_edid, ++ .vidioc_g_parm = hdmirx_g_parm, ++ ++ .vidioc_reqbufs = vb2_ioctl_reqbufs, ++ .vidioc_querybuf = vb2_ioctl_querybuf, ++ .vidioc_create_bufs = vb2_ioctl_create_bufs, ++ .vidioc_qbuf = vb2_ioctl_qbuf, ++ .vidioc_expbuf = vb2_ioctl_expbuf, ++ .vidioc_dqbuf = vb2_ioctl_dqbuf, ++ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, ++ .vidioc_streamon = vb2_ioctl_streamon, ++ .vidioc_streamoff = vb2_ioctl_streamoff, ++ ++ .vidioc_log_status = v4l2_ctrl_log_status, ++ .vidioc_subscribe_event = hdmirx_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++}; ++ ++static const struct v4l2_file_operations hdmirx_fops = { ++ .owner = THIS_MODULE, ++ .open = v4l2_fh_open, ++ .release = vb2_fop_release, ++ .unlocked_ioctl = video_ioctl2, ++ .poll = vb2_fop_poll, ++ .mmap = vb2_fop_mmap, ++}; ++ ++static int hdmirx_register_stream_vdev(struct hdmirx_stream *stream) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct video_device *vdev = &stream->vdev; ++ int ret = 0; ++ ++ strscpy(vdev->name, "stream_hdmirx", sizeof(vdev->name)); ++ INIT_LIST_HEAD(&stream->buf_head); ++ spin_lock_init(&stream->vbq_lock); ++ mutex_init(&stream->vlock); ++ init_waitqueue_head(&stream->wq_stopped); ++ stream->curr_buf = NULL; ++ stream->next_buf = NULL; ++ ++ vdev->ioctl_ops = &hdmirx_v4l2_ioctl_ops; ++ vdev->release = video_device_release_empty; ++ vdev->fops = &hdmirx_fops; ++ vdev->minor = -1; ++ vdev->v4l2_dev = v4l2_dev; ++ vdev->lock = &stream->vlock; ++ vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | ++ V4L2_CAP_STREAMING; ++ video_set_drvdata(vdev, stream); ++ vdev->vfl_dir = VFL_DIR_RX; ++ ++ hdmirx_init_vb2_queue(&stream->buf_queue, stream, ++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ vdev->queue = &stream->buf_queue; ++ ++ ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); ++ if (ret < 0) { ++ v4l2_err(v4l2_dev, "video_register_device failed: %d\n", ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static void process_signal_change(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, 0); ++ hdmirx_reset_dma(hdmirx_dev); ++ hdmirx_dev->got_timing = false; ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_res_change, ++ msecs_to_jiffies(50)); ++} ++ ++static void avpunit_0_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (status & (CED_DYN_CNT_CH2_IRQ | ++ CED_DYN_CNT_CH1_IRQ | ++ CED_DYN_CNT_CH0_IRQ)) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: avp0_st:%#x\n", ++ __func__, status); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_0_INT_FORCE, 0x0); ++} ++ ++static void avpunit_1_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (status & DEFRAMER_VSYNC_THR_REACHED_IRQ) { ++ v4l2_info(v4l2_dev, "Vertical Sync threshold reached interrupt %#x", status); ++ hdmirx_update_bits(hdmirx_dev, AVPUNIT_1_INT_MASK_N, ++ DEFRAMER_VSYNC_THR_REACHED_MASK_N, 0); ++ *handled = true; ++ } ++} ++ ++static void mainunit_0_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "mu0_st:%#x\n", status); ++ if (status & TIMER_BASE_LOCKED_IRQ) { ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_0_INT_MASK_N, ++ TIMER_BASE_LOCKED_IRQ, 0); ++ complete(&hdmirx_dev->timer_base_lock); ++ *handled = true; ++ } ++ ++ if (status & TMDSQPCLK_OFF_CHG) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: TMDSQPCLK_OFF_CHG\n", __func__); ++ *handled = true; ++ } ++ ++ if (status & TMDSQPCLK_LOCKED_CHG) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: TMDSQPCLK_LOCKED_CHG\n", __func__); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_0_INT_FORCE, 0x0); ++} ++ ++static void mainunit_2_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "mu2_st:%#x\n", status); ++ if (status & PHYCREG_CR_WRITE_DONE) { ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_2_INT_MASK_N, ++ PHYCREG_CR_WRITE_DONE, 0); ++ complete(&hdmirx_dev->cr_write_done); ++ *handled = true; ++ } ++ ++ if (status & TMDSVALID_STABLE_CHG) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: TMDSVALID_STABLE_CHG\n", __func__); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_2_INT_FORCE, 0x0); ++} ++ ++static void pkt_2_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: pk2_st:%#x\n", __func__, status); ++ if (status & PKTDEC_AVIIF_RCV_IRQ) { ++ hdmirx_update_bits(hdmirx_dev, PKT_2_INT_MASK_N, ++ PKTDEC_AVIIF_RCV_IRQ, 0); ++ complete(&hdmirx_dev->avi_pkt_rcv); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: AVIIF_RCV_IRQ\n", __func__); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_2_INT_CLEAR, 0xffffffff); ++} ++ ++static void scdc_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: scdc_st:%#x\n", __func__, status); ++ if (status & SCDCTMDSCCFG_CHG) { ++ hdmirx_tmds_clk_ratio_config(hdmirx_dev); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, SCDC_INT_CLEAR, 0xffffffff); ++} ++ ++static irqreturn_t hdmirx_hdmi_irq_handler(int irq, void *dev_id) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_id; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct arm_smccc_res res; ++ u32 mu0_st, mu2_st, pk2_st, scdc_st, avp1_st, avp0_st; ++ u32 mu0_mask, mu2_mask, pk2_mask, scdc_mask, avp1_msk, avp0_msk; ++ bool handled = false; ++ ++ mu0_mask = hdmirx_readl(hdmirx_dev, MAINUNIT_0_INT_MASK_N); ++ mu2_mask = hdmirx_readl(hdmirx_dev, MAINUNIT_2_INT_MASK_N); ++ pk2_mask = hdmirx_readl(hdmirx_dev, PKT_2_INT_MASK_N); ++ scdc_mask = hdmirx_readl(hdmirx_dev, SCDC_INT_MASK_N); ++ mu0_st = hdmirx_readl(hdmirx_dev, MAINUNIT_0_INT_STATUS); ++ mu2_st = hdmirx_readl(hdmirx_dev, MAINUNIT_2_INT_STATUS); ++ pk2_st = hdmirx_readl(hdmirx_dev, PKT_2_INT_STATUS); ++ scdc_st = hdmirx_readl(hdmirx_dev, SCDC_INT_STATUS); ++ avp0_st = hdmirx_readl(hdmirx_dev, AVPUNIT_0_INT_STATUS); ++ avp1_st = hdmirx_readl(hdmirx_dev, AVPUNIT_1_INT_STATUS); ++ avp0_msk = hdmirx_readl(hdmirx_dev, AVPUNIT_0_INT_MASK_N); ++ avp1_msk = hdmirx_readl(hdmirx_dev, AVPUNIT_1_INT_MASK_N); ++ mu0_st &= mu0_mask; ++ mu2_st &= mu2_mask; ++ pk2_st &= pk2_mask; ++ avp1_st &= avp1_msk; ++ avp0_st &= avp0_msk; ++ scdc_st &= scdc_mask; ++ ++ if (avp0_st) ++ avpunit_0_int_handler(hdmirx_dev, avp0_st, &handled); ++ if (avp1_st) ++ avpunit_1_int_handler(hdmirx_dev, avp1_st, &handled); ++ if (mu0_st) ++ mainunit_0_int_handler(hdmirx_dev, mu0_st, &handled); ++ if (mu2_st) ++ mainunit_2_int_handler(hdmirx_dev, mu2_st, &handled); ++ if (pk2_st) ++ pkt_2_int_handler(hdmirx_dev, pk2_st, &handled); ++ if (scdc_st) ++ scdc_int_handler(hdmirx_dev, scdc_st, &handled); ++ ++ if (!handled) { ++ v4l2_dbg(2, debug, v4l2_dev, "%s: hdmi irq not handled", __func__); ++ v4l2_dbg(2, debug, v4l2_dev, ++ "avp0:%#x, avp1:%#x, mu0:%#x, mu2:%#x, pk2:%#x, scdc:%#x\n", ++ avp0_st, avp1_st, mu0_st, mu2_st, pk2_st, scdc_st); ++ } ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: en_fiq", __func__); ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_EN, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ return handled ? IRQ_HANDLED : IRQ_NONE; ++} ++ ++static void hdmirx_vb_done(struct hdmirx_stream *stream, ++ struct vb2_v4l2_buffer *vb_done) ++{ ++ const struct v4l2_format_info *finfo = stream->out_finfo; ++ u32 i; ++ ++ /* Dequeue a filled buffer */ ++ for (i = 0; i < finfo->mem_planes; i++) { ++ vb2_set_plane_payload(&vb_done->vb2_buf, i, ++ stream->pixm.plane_fmt[i].sizeimage); ++ } ++ ++ vb_done->vb2_buf.timestamp = ktime_get_ns(); ++ vb2_buffer_done(&vb_done->vb2_buf, VB2_BUF_STATE_DONE); ++} ++ ++static void dma_idle_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ bool *handled) ++{ ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_dv_timings timings = hdmirx_dev->timings; ++ struct v4l2_bt_timings *bt = &timings.bt; ++ struct vb2_v4l2_buffer *vb_done = NULL; ++ ++ if (!(stream->irq_stat) && !(stream->irq_stat & LINE_FLAG_INT_EN)) ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: last time have no line_flag_irq\n", __func__); ++ ++ if (stream->line_flag_int_cnt <= FILTER_FRAME_CNT) ++ goto DMA_IDLE_OUT; ++ ++ if (bt->interlaced != V4L2_DV_INTERLACED || ++ !(stream->line_flag_int_cnt % 2)) { ++ if (stream->next_buf) { ++ if (stream->curr_buf) ++ vb_done = &stream->curr_buf->vb; ++ ++ if (vb_done) { ++ vb_done->vb2_buf.timestamp = ktime_get_ns(); ++ vb_done->sequence = stream->frame_idx; ++ hdmirx_vb_done(stream, vb_done); ++ stream->frame_idx++; ++ if (stream->frame_idx == 30) ++ v4l2_info(v4l2_dev, "rcv frames\n"); ++ } ++ ++ stream->curr_buf = NULL; ++ if (stream->next_buf) { ++ stream->curr_buf = stream->next_buf; ++ stream->next_buf = NULL; ++ } ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, ++ "%s: next_buf NULL, skip vb_done\n", __func__); ++ } ++ } ++ ++DMA_IDLE_OUT: ++ *handled = true; ++} ++ ++static void line_flag_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ bool *handled) ++{ ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_dv_timings timings = hdmirx_dev->timings; ++ struct v4l2_bt_timings *bt = &timings.bt; ++ u32 dma_cfg6; ++ ++ stream->line_flag_int_cnt++; ++ if (!(stream->irq_stat) && !(stream->irq_stat & HDMIRX_DMA_IDLE_INT)) ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: last have no dma_idle_irq\n", __func__); ++ dma_cfg6 = hdmirx_readl(hdmirx_dev, DMA_CONFIG6); ++ if (!(dma_cfg6 & HDMIRX_DMA_EN)) { ++ v4l2_dbg(2, debug, v4l2_dev, "%s: dma not on\n", __func__); ++ goto LINE_FLAG_OUT; ++ } ++ ++ if (stream->line_flag_int_cnt <= FILTER_FRAME_CNT) ++ goto LINE_FLAG_OUT; ++ ++ if (bt->interlaced != V4L2_DV_INTERLACED || ++ !(stream->line_flag_int_cnt % 2)) { ++ if (!stream->next_buf) { ++ spin_lock(&stream->vbq_lock); ++ if (!list_empty(&stream->buf_head)) { ++ stream->next_buf = list_first_entry(&stream->buf_head, ++ struct hdmirx_buffer, ++ queue); ++ list_del(&stream->next_buf->queue); ++ } else { ++ stream->next_buf = NULL; ++ } ++ spin_unlock(&stream->vbq_lock); ++ ++ if (stream->next_buf) { ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG2, ++ stream->next_buf->buff_addr[HDMIRX_PLANE_Y]); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG3, ++ stream->next_buf->buff_addr[HDMIRX_PLANE_CBCR]); ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, ++ "%s: no buffer is available\n", __func__); ++ } ++ } ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, "%s: interlace:%d, line_flag_int_cnt:%d\n", ++ __func__, bt->interlaced, stream->line_flag_int_cnt); ++ } ++ ++LINE_FLAG_OUT: ++ *handled = true; ++} ++ ++static irqreturn_t hdmirx_dma_irq_handler(int irq, void *dev_id) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_id; ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 dma_stat1, dma_stat13; ++ bool handled = false; ++ ++ dma_stat1 = hdmirx_readl(hdmirx_dev, DMA_STATUS1); ++ dma_stat13 = hdmirx_readl(hdmirx_dev, DMA_STATUS13); ++ v4l2_dbg(3, debug, v4l2_dev, "dma_irq st1:%#x, st13:%d\n", ++ dma_stat1, dma_stat13); ++ ++ if (READ_ONCE(stream->stopping)) { ++ v4l2_dbg(1, debug, v4l2_dev, "%s: stop stream\n", __func__); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG5, 0xffffffff); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, 0); ++ WRITE_ONCE(stream->stopping, false); ++ wake_up(&stream->wq_stopped); ++ return IRQ_HANDLED; ++ } ++ ++ if (dma_stat1 & HDMIRX_DMA_IDLE_INT) ++ dma_idle_int_handler(hdmirx_dev, &handled); ++ ++ if (dma_stat1 & LINE_FLAG_INT_EN) ++ line_flag_int_handler(hdmirx_dev, &handled); ++ ++ if (!handled) ++ v4l2_dbg(3, debug, v4l2_dev, ++ "%s: dma irq not handled, dma_stat1:%#x\n", ++ __func__, dma_stat1); ++ ++ stream->irq_stat = dma_stat1; ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG5, 0xffffffff); ++ ++ return IRQ_HANDLED; ++} ++ ++static void hdmirx_plugin(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct arm_smccc_res res; ++ int ret; ++ ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_heartbeat, ++ msecs_to_jiffies(10)); ++ arm_smccc_smc(SIP_WDT_CFG, WDT_START, 0, 0, 0, 0, 0, 0, &res); ++ hdmirx_submodule_init(hdmirx_dev); ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, ++ POWERPROVIDED); ++ hdmirx_hpd_ctrl(hdmirx_dev, true); ++ hdmirx_phy_config(hdmirx_dev); ++ ret = hdmirx_wait_lock_and_get_timing(hdmirx_dev); ++ if (ret) { ++ hdmirx_plugout(hdmirx_dev); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(200)); ++ return; ++ } ++ hdmirx_dma_config(hdmirx_dev); ++ hdmirx_interrupts_setup(hdmirx_dev, true); ++} ++ ++static void hdmirx_delayed_work_hotplug(struct work_struct *work) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev; ++ bool plugin; ++ ++ hdmirx_dev = container_of(work, struct snps_hdmirx_dev, ++ delayed_work_hotplug.work); ++ ++ mutex_lock(&hdmirx_dev->work_lock); ++ hdmirx_dev->got_timing = false; ++ plugin = tx_5v_power_present(hdmirx_dev); ++ v4l2_ctrl_s_ctrl(hdmirx_dev->detect_tx_5v_ctrl, plugin); ++ v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: plugin:%d\n", ++ __func__, plugin); ++ ++ if (plugin) ++ hdmirx_plugin(hdmirx_dev); ++ else ++ hdmirx_plugout(hdmirx_dev); ++ ++ mutex_unlock(&hdmirx_dev->work_lock); ++} ++ ++static void hdmirx_delayed_work_res_change(struct work_struct *work) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev; ++ bool plugin; ++ ++ hdmirx_dev = container_of(work, struct snps_hdmirx_dev, ++ delayed_work_res_change.work); ++ ++ mutex_lock(&hdmirx_dev->work_lock); ++ plugin = tx_5v_power_present(hdmirx_dev); ++ v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: plugin:%d\n", ++ __func__, plugin); ++ if (plugin) { ++ hdmirx_interrupts_setup(hdmirx_dev, false); ++ hdmirx_submodule_init(hdmirx_dev); ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, ++ POWERPROVIDED); ++ hdmirx_hpd_ctrl(hdmirx_dev, true); ++ hdmirx_phy_config(hdmirx_dev); ++ ++ if (hdmirx_wait_lock_and_get_timing(hdmirx_dev)) { ++ hdmirx_plugout(hdmirx_dev); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(200)); ++ } else { ++ hdmirx_dma_config(hdmirx_dev); ++ hdmirx_interrupts_setup(hdmirx_dev, true); ++ } ++ } ++ mutex_unlock(&hdmirx_dev->work_lock); ++} ++ ++static void hdmirx_delayed_work_heartbeat(struct work_struct *work) ++{ ++ struct delayed_work *dwork = to_delayed_work(work); ++ struct snps_hdmirx_dev *hdmirx_dev = container_of(dwork, ++ struct snps_hdmirx_dev, ++ delayed_work_heartbeat); ++ ++ queue_work(system_highpri_wq, &hdmirx_dev->work_wdt_config); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_heartbeat, HZ); ++} ++ ++static void hdmirx_work_wdt_config(struct work_struct *work) ++{ ++ struct arm_smccc_res res; ++ struct snps_hdmirx_dev *hdmirx_dev = container_of(work, ++ struct snps_hdmirx_dev, ++ work_wdt_config); ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ arm_smccc_smc(SIP_WDT_CFG, WDT_PING, 0, 0, 0, 0, 0, 0, &res); ++ v4l2_dbg(3, debug, v4l2_dev, "hb\n"); ++} ++ ++static irqreturn_t hdmirx_5v_det_irq_handler(int irq, void *dev_id) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_id; ++ u32 val; ++ ++ val = gpiod_get_value(hdmirx_dev->detect_5v_gpio); ++ v4l2_dbg(3, debug, &hdmirx_dev->v4l2_dev, "%s: 5v:%d\n", __func__, val); ++ ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(10)); ++ ++ return IRQ_HANDLED; ++} ++ ++static const struct hdmirx_cec_ops hdmirx_cec_ops = { ++ .write = hdmirx_writel, ++ .read = hdmirx_readl, ++}; ++ ++static int hdmirx_parse_dt(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ int ret; ++ ++ hdmirx_dev->num_clks = devm_clk_bulk_get_all(dev, &hdmirx_dev->clks); ++ if (hdmirx_dev->num_clks < 1) ++ return -ENODEV; ++ ++ hdmirx_dev->resets[HDMIRX_RST_A].id = "axi"; ++ hdmirx_dev->resets[HDMIRX_RST_P].id = "apb"; ++ hdmirx_dev->resets[HDMIRX_RST_REF].id = "ref"; ++ hdmirx_dev->resets[HDMIRX_RST_BIU].id = "biu"; ++ ++ ret = devm_reset_control_bulk_get_exclusive(dev, HDMIRX_NUM_RST, ++ hdmirx_dev->resets); ++ if (ret < 0) { ++ dev_err(dev, "failed to get reset controls\n"); ++ return ret; ++ } ++ ++ hdmirx_dev->detect_5v_gpio = ++ devm_gpiod_get_optional(dev, "hpd", GPIOD_IN); ++ ++ if (IS_ERR(hdmirx_dev->detect_5v_gpio)) { ++ dev_err(dev, "failed to get hdmirx hot plug detection gpio\n"); ++ return PTR_ERR(hdmirx_dev->detect_5v_gpio); ++ } ++ ++ hdmirx_dev->grf = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "rockchip,grf"); ++ if (IS_ERR(hdmirx_dev->grf)) { ++ dev_err(dev, "failed to get rockchip,grf\n"); ++ return PTR_ERR(hdmirx_dev->grf); ++ } ++ ++ hdmirx_dev->vo1_grf = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "rockchip,vo1-grf"); ++ if (IS_ERR(hdmirx_dev->vo1_grf)) { ++ dev_err(dev, "failed to get rockchip,vo1-grf\n"); ++ return PTR_ERR(hdmirx_dev->vo1_grf); ++ } ++ ++ hdmirx_dev->hpd_trigger_level = !device_property_read_bool(dev, "hpd-is-active-low"); ++ ++ ret = of_reserved_mem_device_init(dev); ++ if (ret) ++ dev_warn(dev, "No reserved memory for HDMIRX, use default CMA\n"); ++ ++ return 0; ++} ++ ++static void hdmirx_disable_all_interrupts(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_writel(hdmirx_dev, MAINUNIT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_1_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_2_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_1_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, PKT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, PKT_1_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, PKT_2_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, SCDC_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, CEC_INT_MASK_N, 0); ++ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, SCDC_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, HDCP_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, HDCP_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, CEC_INT_CLEAR, 0xffffffff); ++} ++ ++static int hdmirx_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_RESET | PHY_PDDQ, 0); ++ ++ regmap_write(hdmirx_dev->vo1_grf, VO1_GRF_VO1_CON2, ++ (HDMIRX_SDAIN_MSK | HDMIRX_SCLIN_MSK) | ++ ((HDMIRX_SDAIN_MSK | HDMIRX_SCLIN_MSK) << 16)); ++ /* ++ * Some interrupts are enabled by default, so we disable ++ * all interrupts and clear interrupts status first. ++ */ ++ hdmirx_disable_all_interrupts(hdmirx_dev); ++ ++ return 0; ++} ++ ++static void hdmirx_load_default_edid(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ int ret; ++ struct v4l2_edid def_edid; ++ ++ hdmirx_hpd_ctrl(hdmirx_dev, false); ++ ++ /* disable hpd and write edid */ ++ def_edid.pad = 0; ++ def_edid.start_block = 0; ++ def_edid.blocks = EDID_NUM_BLOCKS_MAX; ++ ++ if (IS_ENABLED(CONFIG_HDMIRX_LOAD_DEFAULT_EDID)) ++ def_edid.edid = edid_init_data_340M; ++ else ++ def_edid.edid = hdmirx_dev->edid; ++ ++ ret = hdmirx_write_edid(hdmirx_dev, &def_edid, true); ++ if (ret) ++ dev_err(hdmirx_dev->dev, "%s: write edid failed\n", __func__); ++} ++ ++static void hdmirx_disable_irq(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct arm_smccc_res res; ++ ++ disable_irq(hdmirx_dev->hdmi_irq); ++ disable_irq(hdmirx_dev->dma_irq); ++ disable_irq(hdmirx_dev->det_irq); ++ ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_DIS, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_hotplug); ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_res_change); ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_heartbeat); ++ flush_work(&hdmirx_dev->work_wdt_config); ++ ++ arm_smccc_smc(SIP_WDT_CFG, WDT_STOP, 0, 0, 0, 0, 0, 0, &res); ++} ++ ++static int hdmirx_disable(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ clk_bulk_disable_unprepare(hdmirx_dev->num_clks, hdmirx_dev->clks); ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: suspend\n", __func__); ++ ++ return pinctrl_pm_select_sleep_state(dev); ++} ++ ++static void hdmirx_enable_irq(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct arm_smccc_res res; ++ ++ enable_irq(hdmirx_dev->hdmi_irq); ++ enable_irq(hdmirx_dev->dma_irq); ++ enable_irq(hdmirx_dev->det_irq); ++ ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_EN, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ queue_delayed_work(system_unbound_wq, &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(20)); ++} ++ ++static int hdmirx_enable(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int ret; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: resume\n", __func__); ++ ret = pinctrl_pm_select_default_state(dev); ++ if (ret < 0) ++ return ret; ++ ++ ret = clk_bulk_prepare_enable(hdmirx_dev->num_clks, hdmirx_dev->clks); ++ if (ret) { ++ dev_err(dev, "failed to enable hdmirx bulk clks: %d\n", ret); ++ return ret; ++ } ++ ++ reset_control_bulk_assert(HDMIRX_NUM_RST, hdmirx_dev->resets); ++ usleep_range(150, 160); ++ reset_control_bulk_deassert(HDMIRX_NUM_RST, hdmirx_dev->resets); ++ usleep_range(150, 160); ++ ++ return 0; ++} ++ ++static int hdmirx_suspend(struct device *dev) ++{ ++ hdmirx_disable_irq(dev); ++ ++ return hdmirx_disable(dev); ++} ++ ++static int hdmirx_resume(struct device *dev) ++{ ++ int ret = hdmirx_enable(dev); ++ ++ if (ret) ++ return ret; ++ ++ hdmirx_enable_irq(dev); ++ ++ return 0; ++} ++ ++static const struct dev_pm_ops snps_hdmirx_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(hdmirx_suspend, hdmirx_resume) ++}; ++ ++static int hdmirx_setup_irq(struct snps_hdmirx_dev *hdmirx_dev, ++ struct platform_device *pdev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ int ret, irq; ++ ++ irq = platform_get_irq_byname(pdev, "hdmi"); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get hdmi irq\n"); ++ return irq; ++ } ++ ++ irq_set_status_flags(irq, IRQ_NOAUTOEN); ++ ++ hdmirx_dev->hdmi_irq = irq; ++ ret = devm_request_irq(dev, irq, hdmirx_hdmi_irq_handler, 0, ++ "rk_hdmirx-hdmi", hdmirx_dev); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to request hdmi irq\n"); ++ return ret; ++ } ++ ++ irq = platform_get_irq_byname(pdev, "dma"); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get dma irq\n"); ++ return irq; ++ } ++ ++ irq_set_status_flags(irq, IRQ_NOAUTOEN); ++ ++ hdmirx_dev->dma_irq = irq; ++ ret = devm_request_threaded_irq(dev, irq, NULL, hdmirx_dma_irq_handler, ++ IRQF_ONESHOT, "rk_hdmirx-dma", ++ hdmirx_dev); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to request dma irq\n"); ++ return ret; ++ } ++ ++ irq = gpiod_to_irq(hdmirx_dev->detect_5v_gpio); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get hdmirx-5v irq\n"); ++ return irq; ++ } ++ ++ irq_set_status_flags(irq, IRQ_NOAUTOEN); ++ ++ hdmirx_dev->det_irq = irq; ++ ret = devm_request_irq(dev, irq, hdmirx_5v_det_irq_handler, ++ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, ++ "rk_hdmirx-5v", hdmirx_dev); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to request hdmirx-5v irq\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int hdmirx_register_cec(struct snps_hdmirx_dev *hdmirx_dev, ++ struct platform_device *pdev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ struct hdmirx_cec_data cec_data; ++ int irq; ++ ++ irq = platform_get_irq_byname(pdev, "cec"); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get cec irq\n"); ++ return irq; ++ } ++ ++ hdmirx_dev->cec_notifier = cec_notifier_conn_register(dev, NULL, NULL); ++ if (!hdmirx_dev->cec_notifier) ++ return -EINVAL; ++ ++ cec_data.hdmirx = hdmirx_dev; ++ cec_data.dev = hdmirx_dev->dev; ++ cec_data.ops = &hdmirx_cec_ops; ++ cec_data.irq = irq; ++ ++ hdmirx_dev->cec = snps_hdmirx_cec_register(&cec_data); ++ if (!hdmirx_dev->cec) { ++ cec_notifier_conn_unregister(hdmirx_dev->cec_notifier); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int hdmirx_probe(struct platform_device *pdev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev; ++ struct device *dev = &pdev->dev; ++ struct v4l2_ctrl_handler *hdl; ++ struct hdmirx_stream *stream; ++ struct v4l2_device *v4l2_dev; ++ int ret; ++ ++ hdmirx_dev = devm_kzalloc(dev, sizeof(*hdmirx_dev), GFP_KERNEL); ++ if (!hdmirx_dev) ++ return -ENOMEM; ++ ++ ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); ++ if (ret) ++ return ret; ++ ++ hdmirx_dev->dev = dev; ++ dev_set_drvdata(dev, hdmirx_dev); ++ ++ ret = hdmirx_parse_dt(hdmirx_dev); ++ if (ret) ++ return ret; ++ ++ ret = hdmirx_setup_irq(hdmirx_dev, pdev); ++ if (ret) ++ return ret; ++ ++ hdmirx_dev->regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(hdmirx_dev->regs)) ++ return dev_err_probe(dev, PTR_ERR(hdmirx_dev->regs), ++ "failed to remap regs resource\n"); ++ ++ mutex_init(&hdmirx_dev->stream_lock); ++ mutex_init(&hdmirx_dev->work_lock); ++ spin_lock_init(&hdmirx_dev->rst_lock); ++ ++ init_completion(&hdmirx_dev->cr_write_done); ++ init_completion(&hdmirx_dev->timer_base_lock); ++ init_completion(&hdmirx_dev->avi_pkt_rcv); ++ ++ INIT_WORK(&hdmirx_dev->work_wdt_config, hdmirx_work_wdt_config); ++ INIT_DELAYED_WORK(&hdmirx_dev->delayed_work_hotplug, ++ hdmirx_delayed_work_hotplug); ++ INIT_DELAYED_WORK(&hdmirx_dev->delayed_work_res_change, ++ hdmirx_delayed_work_res_change); ++ INIT_DELAYED_WORK(&hdmirx_dev->delayed_work_heartbeat, ++ hdmirx_delayed_work_heartbeat); ++ ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_BGR24; ++ hdmirx_dev->timings = cea640x480; ++ ++ hdmirx_enable(dev); ++ hdmirx_init(hdmirx_dev); ++ ++ v4l2_dev = &hdmirx_dev->v4l2_dev; ++ strscpy(v4l2_dev->name, dev_name(dev), sizeof(v4l2_dev->name)); ++ ++ hdl = &hdmirx_dev->hdl; ++ v4l2_ctrl_handler_init(hdl, 1); ++ ++ hdmirx_dev->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL, ++ V4L2_CID_DV_RX_POWER_PRESENT, ++ 0, 1, 0, 0); ++ ++ hdmirx_dev->rgb_range = v4l2_ctrl_new_std_menu(hdl, 0, ++ V4L2_CID_DV_RX_RGB_RANGE, ++ V4L2_DV_RGB_RANGE_FULL, 0, ++ V4L2_DV_RGB_RANGE_AUTO); ++ ++ hdmirx_dev->rgb_range->flags |= V4L2_CTRL_FLAG_READ_ONLY; ++ ++ if (hdl->error) { ++ dev_err(dev, "v4l2 ctrl handler init failed\n"); ++ ret = hdl->error; ++ goto err_pm; ++ } ++ hdmirx_dev->v4l2_dev.ctrl_handler = hdl; ++ ++ ret = v4l2_device_register(dev, &hdmirx_dev->v4l2_dev); ++ if (ret < 0) { ++ dev_err(dev, "register v4l2 device failed\n"); ++ goto err_hdl; ++ } ++ ++ stream = &hdmirx_dev->stream; ++ stream->hdmirx_dev = hdmirx_dev; ++ ret = hdmirx_register_stream_vdev(stream); ++ if (ret < 0) { ++ dev_err(dev, "register video device failed\n"); ++ goto err_unreg_v4l2_dev; ++ } ++ ++ ret = hdmirx_register_cec(hdmirx_dev, pdev); ++ if (ret) ++ goto err_unreg_video_dev; ++ ++ hdmirx_load_default_edid(hdmirx_dev); ++ ++ hdmirx_enable_irq(dev); ++ ++ return 0; ++ ++err_unreg_video_dev: ++ video_unregister_device(&hdmirx_dev->stream.vdev); ++err_unreg_v4l2_dev: ++ v4l2_device_unregister(&hdmirx_dev->v4l2_dev); ++err_hdl: ++ v4l2_ctrl_handler_free(&hdmirx_dev->hdl); ++err_pm: ++ hdmirx_disable(dev); ++ ++ return ret; ++} ++ ++static void hdmirx_remove(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ ++ snps_hdmirx_cec_unregister(hdmirx_dev->cec); ++ cec_notifier_conn_unregister(hdmirx_dev->cec_notifier); ++ ++ hdmirx_disable_irq(dev); ++ ++ video_unregister_device(&hdmirx_dev->stream.vdev); ++ v4l2_ctrl_handler_free(&hdmirx_dev->hdl); ++ v4l2_device_unregister(&hdmirx_dev->v4l2_dev); ++ ++ hdmirx_disable(dev); ++ ++ reset_control_bulk_assert(HDMIRX_NUM_RST, hdmirx_dev->resets); ++ ++ of_reserved_mem_device_release(dev); ++} ++ ++static const struct of_device_id hdmirx_id[] = { ++ { .compatible = "rockchip,rk3588-hdmirx-ctrler" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, hdmirx_id); ++ ++static struct platform_driver hdmirx_driver = { ++ .probe = hdmirx_probe, ++ .remove_new = hdmirx_remove, ++ .driver = { ++ .name = "snps_hdmirx", ++ .of_match_table = hdmirx_id, ++ .pm = &snps_hdmirx_pm_ops, ++ } ++}; ++module_platform_driver(hdmirx_driver); ++ ++MODULE_DESCRIPTION("Rockchip HDMI Receiver Driver"); ++MODULE_AUTHOR("Dingxian Wen "); ++MODULE_AUTHOR("Shreeya Patel "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h +@@ -0,0 +1,394 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * ++ * Author: Dingxian Wen ++ */ ++ ++#ifndef DW_HDMIRX_H ++#define DW_HDMIRX_H ++ ++#include ++ ++#define UPDATE(x, h, l) (((x) << (l)) & GENMASK((h), (l))) ++#define HIWORD_UPDATE(v, h, l) (((v) << (l)) | (GENMASK((h), (l)) << 16)) ++ ++/* SYS_GRF */ ++#define SYS_GRF_SOC_CON1 0x0304 ++#define HDMIRXPHY_SRAM_EXT_LD_DONE BIT(1) ++#define HDMIRXPHY_SRAM_BYPASS BIT(0) ++#define SYS_GRF_SOC_STATUS1 0x0384 ++#define HDMIRXPHY_SRAM_INIT_DONE BIT(10) ++#define SYS_GRF_CHIP_ID 0x0600 ++ ++/* VO1_GRF */ ++#define VO1_GRF_VO1_CON2 0x0008 ++#define HDMIRX_SDAIN_MSK BIT(2) ++#define HDMIRX_SCLIN_MSK BIT(1) ++ ++/* HDMIRX PHY */ ++#define SUP_DIG_ANA_CREGS_SUP_ANA_NC 0x004f ++ ++#define LANE0_DIG_ASIC_RX_OVRD_OUT_0 0x100f ++#define LANE1_DIG_ASIC_RX_OVRD_OUT_0 0x110f ++#define LANE2_DIG_ASIC_RX_OVRD_OUT_0 0x120f ++#define LANE3_DIG_ASIC_RX_OVRD_OUT_0 0x130f ++#define ASIC_ACK_OVRD_EN BIT(1) ++#define ASIC_ACK BIT(0) ++ ++#define LANE0_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x104a ++#define LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x114a ++#define LANE2_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x124a ++#define LANE3_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x134a ++#define FREQ_TUNE_START_VAL_MASK GENMASK(9, 0) ++#define FREQ_TUNE_START_VAL(x) UPDATE(x, 9, 0) ++ ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_FSM_CONFIG 0x20c4 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_ADAPT_REF_FOM 0x20c7 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_3_REG 0x20e9 ++#define CDR_SETTING_BOUNDARY_3_DEFAULT 0x52da ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_4_REG 0x20ea ++#define CDR_SETTING_BOUNDARY_4_DEFAULT 0x43cd ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_5_REG 0x20eb ++#define CDR_SETTING_BOUNDARY_5_DEFAULT 0x35b3 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_6_REG 0x20fb ++#define CDR_SETTING_BOUNDARY_6_DEFAULT 0x2799 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_7_REG 0x20fc ++#define CDR_SETTING_BOUNDARY_7_DEFAULT 0x1b65 ++ ++#define RAWLANE0_DIG_PCS_XF_RX_OVRD_OUT 0x300e ++#define RAWLANE1_DIG_PCS_XF_RX_OVRD_OUT 0x310e ++#define RAWLANE2_DIG_PCS_XF_RX_OVRD_OUT 0x320e ++#define RAWLANE3_DIG_PCS_XF_RX_OVRD_OUT 0x330e ++#define PCS_ACK_WRITE_SELECT BIT(14) ++#define PCS_EN_CTL BIT(1) ++#define PCS_ACK BIT(0) ++ ++#define RAWLANE0_DIG_AON_FAST_FLAGS 0x305c ++#define RAWLANE1_DIG_AON_FAST_FLAGS 0x315c ++#define RAWLANE2_DIG_AON_FAST_FLAGS 0x325c ++#define RAWLANE3_DIG_AON_FAST_FLAGS 0x335c ++ ++/* HDMIRX Ctrler */ ++#define GLOBAL_SWRESET_REQUEST 0x0020 ++#define DATAPATH_SWRESETREQ BIT(12) ++#define GLOBAL_SWENABLE 0x0024 ++#define PHYCTRL_ENABLE BIT(21) ++#define CEC_ENABLE BIT(16) ++#define TMDS_ENABLE BIT(13) ++#define DATAPATH_ENABLE BIT(12) ++#define PKTFIFO_ENABLE BIT(11) ++#define AVPUNIT_ENABLE BIT(8) ++#define MAIN_ENABLE BIT(0) ++#define GLOBAL_TIMER_REF_BASE 0x0028 ++#define CORE_CONFIG 0x0050 ++#define CMU_CONFIG0 0x0060 ++#define TMDSQPCLK_STABLE_FREQ_MARGIN_MASK GENMASK(30, 16) ++#define TMDSQPCLK_STABLE_FREQ_MARGIN(x) UPDATE(x, 30, 16) ++#define AUDCLK_STABLE_FREQ_MARGIN_MASK GENMASK(11, 9) ++#define AUDCLK_STABLE_FREQ_MARGIN(x) UPDATE(x, 11, 9) ++#define CMU_STATUS 0x007c ++#define TMDSQPCLK_LOCKED_ST BIT(4) ++#define CMU_TMDSQPCLK_FREQ 0x0084 ++#define PHY_CONFIG 0x00c0 ++#define LDO_AFE_PROG_MASK GENMASK(24, 23) ++#define LDO_AFE_PROG(x) UPDATE(x, 24, 23) ++#define LDO_PWRDN BIT(21) ++#define TMDS_CLOCK_RATIO BIT(16) ++#define RXDATA_WIDTH BIT(15) ++#define REFFREQ_SEL_MASK GENMASK(11, 9) ++#define REFFREQ_SEL(x) UPDATE(x, 11, 9) ++#define HDMI_DISABLE BIT(8) ++#define PHY_PDDQ BIT(1) ++#define PHY_RESET BIT(0) ++#define PHY_STATUS 0x00c8 ++#define HDMI_DISABLE_ACK BIT(1) ++#define PDDQ_ACK BIT(0) ++#define PHYCREG_CONFIG0 0x00e0 ++#define PHYCREG_CR_PARA_SELECTION_MODE_MASK GENMASK(1, 0) ++#define PHYCREG_CR_PARA_SELECTION_MODE(x) UPDATE(x, 1, 0) ++#define PHYCREG_CONFIG1 0x00e4 ++#define PHYCREG_CONFIG2 0x00e8 ++#define PHYCREG_CONFIG3 0x00ec ++#define PHYCREG_CONTROL 0x00f0 ++#define PHYCREG_CR_PARA_WRITE_P BIT(1) ++#define PHYCREG_CR_PARA_READ_P BIT(0) ++#define PHYCREG_STATUS 0x00f4 ++ ++#define MAINUNIT_STATUS 0x0150 ++#define TMDSVALID_STABLE_ST BIT(1) ++#define DESCRAND_EN_CONTROL 0x0210 ++#define SCRAMB_EN_SEL_QST_MASK GENMASK(1, 0) ++#define SCRAMB_EN_SEL_QST(x) UPDATE(x, 1, 0) ++#define DESCRAND_SYNC_CONTROL 0x0214 ++#define RECOVER_UNSYNC_STREAM_QST BIT(0) ++#define DESCRAND_SYNC_SEQ_CONFIG 0x022c ++#define DESCRAND_SYNC_SEQ_ERR_CNT_EN BIT(0) ++#define DESCRAND_SYNC_SEQ_STATUS 0x0234 ++#define DEFRAMER_CONFIG0 0x0270 ++#define VS_CNT_THR_QST_MASK GENMASK(27, 20) ++#define VS_CNT_THR_QST(x) UPDATE(x, 27, 20) ++#define HS_POL_QST_MASK GENMASK(19, 18) ++#define HS_POL_QST(x) UPDATE(x, 19, 18) ++#define VS_POL_QST_MASK GENMASK(17, 16) ++#define VS_POL_QST(x) UPDATE(x, 17, 16) ++#define VS_REMAPFILTER_EN_QST BIT(8) ++#define VS_FILTER_ORDER_QST_MASK GENMASK(1, 0) ++#define VS_FILTER_ORDER_QST(x) UPDATE(x, 1, 0) ++#define DEFRAMER_VSYNC_CNT_CLEAR 0x0278 ++#define VSYNC_CNT_CLR_P BIT(0) ++#define DEFRAMER_STATUS 0x027c ++#define OPMODE_STS_MASK GENMASK(6, 4) ++#define I2C_SLAVE_CONFIG1 0x0164 ++#define I2C_SDA_OUT_HOLD_VALUE_QST_MASK GENMASK(15, 8) ++#define I2C_SDA_OUT_HOLD_VALUE_QST(x) UPDATE(x, 15, 8) ++#define I2C_SDA_IN_HOLD_VALUE_QST_MASK GENMASK(7, 0) ++#define I2C_SDA_IN_HOLD_VALUE_QST(x) UPDATE(x, 7, 0) ++#define OPMODE_STS_MASK GENMASK(6, 4) ++#define REPEATER_QST BIT(28) ++#define FASTREAUTH_QST BIT(27) ++#define FEATURES_1DOT1_QST BIT(26) ++#define FASTI2C_QST BIT(25) ++#define EESS_CTL_THR_QST_MASK GENMASK(19, 16) ++#define EESS_CTL_THR_QST(x) UPDATE(x, 19, 16) ++#define OESS_CTL3_THR_QST_MASK GENMASK(11, 8) ++#define OESS_CTL3_THR_QST(x) UPDATE(x, 11, 8) ++#define EESS_OESS_SEL_QST_MASK GENMASK(5, 4) ++#define EESS_OESS_SEL_QST(x) UPDATE(x, 5, 4) ++#define KEY_DECRYPT_EN_QST BIT(0) ++#define KEY_DECRYPT_SEED_QST_MASK GENMASK(15, 0) ++#define KEY_DECRYPT_SEED_QST(x) UPDATE(x, 15, 0) ++#define HDCP_INT_CLEAR 0x50d8 ++#define HDCP_1_INT_CLEAR 0x50e8 ++#define HDCP2_CONFIG 0x02f0 ++#define HDCP2_SWITCH_OVR_VALUE BIT(2) ++#define HDCP2_SWITCH_OVR_EN BIT(1) ++ ++#define VIDEO_CONFIG2 0x042c ++#define VPROC_VSYNC_POL_OVR_VALUE BIT(19) ++#define VPROC_VSYNC_POL_OVR_EN BIT(18) ++#define VPROC_HSYNC_POL_OVR_VALUE BIT(17) ++#define VPROC_HSYNC_POL_OVR_EN BIT(16) ++#define VPROC_FMT_OVR_VALUE_MASK GENMASK(6, 4) ++#define VPROC_FMT_OVR_VALUE(x) UPDATE(x, 6, 4) ++#define VPROC_FMT_OVR_EN BIT(0) ++ ++#define AFIFO_FILL_RESTART BIT(0) ++#define AFIFO_INIT_P BIT(0) ++#define AFIFO_THR_LOW_QST_MASK GENMASK(25, 16) ++#define AFIFO_THR_LOW_QST(x) UPDATE(x, 25, 16) ++#define AFIFO_THR_HIGH_QST_MASK GENMASK(9, 0) ++#define AFIFO_THR_HIGH_QST(x) UPDATE(x, 9, 0) ++#define AFIFO_THR_MUTE_LOW_QST_MASK GENMASK(25, 16) ++#define AFIFO_THR_MUTE_LOW_QST(x) UPDATE(x, 25, 16) ++#define AFIFO_THR_MUTE_HIGH_QST_MASK GENMASK(9, 0) ++#define AFIFO_THR_MUTE_HIGH_QST(x) UPDATE(x, 9, 0) ++ ++#define AFIFO_UNDERFLOW_ST BIT(25) ++#define AFIFO_OVERFLOW_ST BIT(24) ++ ++#define SPEAKER_ALLOC_OVR_EN BIT(16) ++#define I2S_BPCUV_EN BIT(4) ++#define SPDIF_EN BIT(2) ++#define I2S_EN BIT(1) ++#define AFIFO_THR_PASS_DEMUTEMASK_N BIT(24) ++#define AVMUTE_DEMUTEMASK_N BIT(16) ++#define AFIFO_THR_MUTE_LOW_MUTEMASK_N BIT(9) ++#define AFIFO_THR_MUTE_HIGH_MUTEMASK_N BIT(8) ++#define AVMUTE_MUTEMASK_N BIT(0) ++#define SCDC_CONFIG 0x0580 ++#define HPDLOW BIT(1) ++#define POWERPROVIDED BIT(0) ++#define SCDC_REGBANK_STATUS1 0x058c ++#define SCDC_TMDSBITCLKRATIO BIT(1) ++#define SCDC_REGBANK_STATUS3 0x0594 ++#define SCDC_REGBANK_CONFIG0 0x05c0 ++#define SCDC_SINKVERSION_QST_MASK GENMASK(7, 0) ++#define SCDC_SINKVERSION_QST(x) UPDATE(x, 7, 0) ++#define AGEN_LAYOUT BIT(4) ++#define AGEN_SPEAKER_ALLOC GENMASK(15, 8) ++ ++#define CED_CONFIG 0x0760 ++#define CED_VIDDATACHECKEN_QST BIT(27) ++#define CED_DATAISCHECKEN_QST BIT(26) ++#define CED_GBCHECKEN_QST BIT(25) ++#define CED_CTRLCHECKEN_QST BIT(24) ++#define CED_CHLOCKMAXER_QST_MASK GENMASK(14, 0) ++#define CED_CHLOCKMAXER_QST(x) UPDATE(x, 14, 0) ++#define CED_DYN_CONFIG 0x0768 ++#define CED_DYN_CONTROL 0x076c ++#define PKTEX_BCH_ERRFILT_CONFIG 0x07c4 ++#define PKTEX_CHKSUM_ERRFILT_CONFIG 0x07c8 ++ ++#define PKTDEC_ACR_PH2_1 0x1100 ++#define PKTDEC_ACR_PB3_0 0x1104 ++#define PKTDEC_ACR_PB7_4 0x1108 ++#define PKTDEC_AVIIF_PH2_1 0x1200 ++#define PKTDEC_AVIIF_PB3_0 0x1204 ++#define PKTDEC_AVIIF_PB7_4 0x1208 ++#define VIC_VAL_MASK GENMASK(6, 0) ++#define PKTDEC_AVIIF_PB11_8 0x120c ++#define PKTDEC_AVIIF_PB15_12 0x1210 ++#define PKTDEC_AVIIF_PB19_16 0x1214 ++#define PKTDEC_AVIIF_PB23_20 0x1218 ++#define PKTDEC_AVIIF_PB27_24 0x121c ++ ++#define PKTFIFO_CONFIG 0x1500 ++#define PKTFIFO_STORE_FILT_CONFIG 0x1504 ++#define PKTFIFO_THR_CONFIG0 0x1508 ++#define PKTFIFO_THR_CONFIG1 0x150c ++#define PKTFIFO_CONTROL 0x1510 ++ ++#define VMON_STATUS1 0x1580 ++#define VMON_STATUS2 0x1584 ++#define VMON_STATUS3 0x1588 ++#define VMON_STATUS4 0x158c ++#define VMON_STATUS5 0x1590 ++#define VMON_STATUS6 0x1594 ++#define VMON_STATUS7 0x1598 ++#define VMON_ILACE_DETECT BIT(4) ++ ++#define CEC_TX_CONTROL 0x2000 ++#define CEC_STATUS 0x2004 ++#define CEC_CONFIG 0x2008 ++#define RX_AUTO_DRIVE_ACKNOWLEDGE BIT(9) ++#define CEC_ADDR 0x200c ++#define CEC_TX_COUNT 0x2020 ++#define CEC_TX_DATA3_0 0x2024 ++#define CEC_RX_COUNT_STATUS 0x2040 ++#define CEC_RX_DATA3_0 0x2044 ++#define CEC_LOCK_CONTROL 0x2054 ++#define CEC_RXQUAL_BITTIME_CONFIG 0x2060 ++#define CEC_RX_BITTIME_CONFIG 0x2064 ++#define CEC_TX_BITTIME_CONFIG 0x2068 ++ ++#define DMA_CONFIG1 0x4400 ++#define UV_WID_MASK GENMASK(31, 28) ++#define UV_WID(x) UPDATE(x, 31, 28) ++#define Y_WID_MASK GENMASK(27, 24) ++#define Y_WID(x) UPDATE(x, 27, 24) ++#define DDR_STORE_FORMAT_MASK GENMASK(15, 12) ++#define DDR_STORE_FORMAT(x) UPDATE(x, 15, 12) ++#define ABANDON_EN BIT(0) ++#define DMA_CONFIG2 0x4404 ++#define DMA_CONFIG3 0x4408 ++#define DMA_CONFIG4 0x440c // dma irq en ++#define DMA_CONFIG5 0x4410 // dma irq clear status ++#define LINE_FLAG_INT_EN BIT(8) ++#define HDMIRX_DMA_IDLE_INT BIT(7) ++#define HDMIRX_LOCK_DISABLE_INT BIT(6) ++#define LAST_FRAME_AXI_UNFINISH_INT_EN BIT(5) ++#define FIFO_OVERFLOW_INT_EN BIT(2) ++#define FIFO_UNDERFLOW_INT_EN BIT(1) ++#define HDMIRX_AXI_ERROR_INT_EN BIT(0) ++#define DMA_CONFIG6 0x4414 ++#define RB_SWAP_EN BIT(9) ++#define HSYNC_TOGGLE_EN BIT(5) ++#define VSYNC_TOGGLE_EN BIT(4) ++#define HDMIRX_DMA_EN BIT(1) ++#define DMA_CONFIG7 0x4418 ++#define LINE_FLAG_NUM_MASK GENMASK(31, 16) ++#define LINE_FLAG_NUM(x) UPDATE(x, 31, 16) ++#define LOCK_FRAME_NUM_MASK GENMASK(11, 0) ++#define LOCK_FRAME_NUM(x) UPDATE(x, 11, 0) ++#define DMA_CONFIG8 0x441c ++#define REG_MIRROR_EN BIT(0) ++#define DMA_CONFIG9 0x4420 ++#define DMA_CONFIG10 0x4424 ++#define DMA_CONFIG11 0x4428 ++#define EDID_READ_EN_MASK BIT(8) ++#define EDID_READ_EN(x) UPDATE(x, 8, 8) ++#define EDID_WRITE_EN_MASK BIT(7) ++#define EDID_WRITE_EN(x) UPDATE(x, 7, 7) ++#define EDID_SLAVE_ADDR_MASK GENMASK(6, 0) ++#define EDID_SLAVE_ADDR(x) UPDATE(x, 6, 0) ++#define DMA_STATUS1 0x4430 // dma irq status ++#define DMA_STATUS2 0x4434 ++#define DMA_STATUS3 0x4438 ++#define DMA_STATUS4 0x443c ++#define DMA_STATUS5 0x4440 ++#define DMA_STATUS6 0x4444 ++#define DMA_STATUS7 0x4448 ++#define DMA_STATUS8 0x444c ++#define DMA_STATUS9 0x4450 ++#define DMA_STATUS10 0x4454 ++#define HDMIRX_LOCK BIT(3) ++#define DMA_STATUS11 0x4458 ++#define HDMIRX_TYPE_MASK GENMASK(8, 7) ++#define HDMIRX_COLOR_DEPTH_MASK GENMASK(6, 3) ++#define HDMIRX_FORMAT_MASK GENMASK(2, 0) ++#define DMA_STATUS12 0x445c ++#define DMA_STATUS13 0x4460 ++#define DMA_STATUS14 0x4464 ++ ++#define MAINUNIT_INTVEC_INDEX 0x5000 ++#define MAINUNIT_0_INT_STATUS 0x5010 ++#define CECRX_NOTIFY_ERR BIT(12) ++#define CECRX_EOM BIT(11) ++#define CECTX_DRIVE_ERR BIT(10) ++#define CECRX_BUSY BIT(9) ++#define CECTX_BUSY BIT(8) ++#define CECTX_FRAME_DISCARDED BIT(5) ++#define CECTX_NRETRANSMIT_FAIL BIT(4) ++#define CECTX_LINE_ERR BIT(3) ++#define CECTX_ARBLOST BIT(2) ++#define CECTX_NACK BIT(1) ++#define CECTX_DONE BIT(0) ++#define MAINUNIT_0_INT_MASK_N 0x5014 ++#define MAINUNIT_0_INT_CLEAR 0x5018 ++#define MAINUNIT_0_INT_FORCE 0x501c ++#define TIMER_BASE_LOCKED_IRQ BIT(26) ++#define TMDSQPCLK_OFF_CHG BIT(5) ++#define TMDSQPCLK_LOCKED_CHG BIT(4) ++#define MAINUNIT_1_INT_STATUS 0x5020 ++#define MAINUNIT_1_INT_MASK_N 0x5024 ++#define MAINUNIT_1_INT_CLEAR 0x5028 ++#define MAINUNIT_1_INT_FORCE 0x502c ++#define MAINUNIT_2_INT_STATUS 0x5030 ++#define MAINUNIT_2_INT_MASK_N 0x5034 ++#define MAINUNIT_2_INT_CLEAR 0x5038 ++#define MAINUNIT_2_INT_FORCE 0x503c ++#define PHYCREG_CR_READ_DONE BIT(11) ++#define PHYCREG_CR_WRITE_DONE BIT(10) ++#define TMDSVALID_STABLE_CHG BIT(1) ++ ++#define AVPUNIT_0_INT_STATUS 0x5040 ++#define AVPUNIT_0_INT_MASK_N 0x5044 ++#define AVPUNIT_0_INT_CLEAR 0x5048 ++#define AVPUNIT_0_INT_FORCE 0x504c ++#define CED_DYN_CNT_CH2_IRQ BIT(22) ++#define CED_DYN_CNT_CH1_IRQ BIT(21) ++#define CED_DYN_CNT_CH0_IRQ BIT(20) ++#define AVPUNIT_1_INT_STATUS 0x5050 ++#define DEFRAMER_VSYNC_THR_REACHED_IRQ BIT(1) ++#define AVPUNIT_1_INT_MASK_N 0x5054 ++#define DEFRAMER_VSYNC_THR_REACHED_MASK_N BIT(1) ++#define DEFRAMER_VSYNC_MASK_N BIT(0) ++#define AVPUNIT_1_INT_CLEAR 0x5058 ++#define DEFRAMER_VSYNC_THR_REACHED_CLEAR BIT(1) ++#define PKT_0_INT_STATUS 0x5080 ++#define PKTDEC_ACR_CHG_IRQ BIT(3) ++#define PKT_0_INT_MASK_N 0x5084 ++#define PKTDEC_ACR_CHG_MASK_N BIT(3) ++#define PKT_0_INT_CLEAR 0x5088 ++#define PKT_1_INT_STATUS 0x5090 ++#define PKT_1_INT_MASK_N 0x5094 ++#define PKT_1_INT_CLEAR 0x5098 ++#define PKT_2_INT_STATUS 0x50a0 ++#define PKTDEC_ACR_RCV_IRQ BIT(3) ++#define PKT_2_INT_MASK_N 0x50a4 ++#define PKTDEC_AVIIF_RCV_IRQ BIT(11) ++#define PKTDEC_ACR_RCV_MASK_N BIT(3) ++#define PKT_2_INT_CLEAR 0x50a8 ++#define PKTDEC_AVIIF_RCV_CLEAR BIT(11) ++#define PKTDEC_ACR_RCV_CLEAR BIT(3) ++#define SCDC_INT_STATUS 0x50c0 ++#define SCDC_INT_MASK_N 0x50c4 ++#define SCDC_INT_CLEAR 0x50c8 ++#define SCDCTMDSCCFG_CHG BIT(2) ++ ++#define CEC_INT_STATUS 0x5100 ++#define CEC_INT_MASK_N 0x5104 ++#define CEC_INT_CLEAR 0x5108 ++ ++#endif +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c +@@ -0,0 +1,285 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * ++ * Author: Shunqing Chen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "snps_hdmirx.h" ++#include "snps_hdmirx_cec.h" ++ ++static void hdmirx_cec_write(struct hdmirx_cec *cec, int reg, u32 val) ++{ ++ cec->ops->write(cec->hdmirx, reg, val); ++} ++ ++static u32 hdmirx_cec_read(struct hdmirx_cec *cec, int reg) ++{ ++ return cec->ops->read(cec->hdmirx, reg); ++} ++ ++static void hdmirx_cec_update_bits(struct hdmirx_cec *cec, int reg, u32 mask, ++ u32 data) ++{ ++ u32 val = hdmirx_cec_read(cec, reg) & ~mask; ++ ++ val |= (data & mask); ++ hdmirx_cec_write(cec, reg, val); ++} ++ ++static int hdmirx_cec_log_addr(struct cec_adapter *adap, u8 logical_addr) ++{ ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ ++ if (logical_addr == CEC_LOG_ADDR_INVALID) ++ cec->addresses = 0; ++ else ++ cec->addresses |= BIT(logical_addr) | BIT(15); ++ ++ hdmirx_cec_write(cec, CEC_ADDR, cec->addresses); ++ ++ return 0; ++} ++ ++/* signal_free_time is handled by the Synopsys Designware ++ * HDMIRX Controller hardware. ++ */ ++static int hdmirx_cec_transmit(struct cec_adapter *adap, u8 attempts, ++ u32 signal_free_time, struct cec_msg *msg) ++{ ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ u32 data[4] = {0}; ++ int i, data_len, msg_len; ++ ++ msg_len = msg->len; ++ ++ hdmirx_cec_write(cec, CEC_TX_COUNT, msg_len - 1); ++ for (i = 0; i < msg_len; i++) ++ data[i / 4] |= msg->msg[i] << (i % 4) * 8; ++ ++ data_len = DIV_ROUND_UP(msg_len, 4); ++ ++ for (i = 0; i < data_len; i++) ++ hdmirx_cec_write(cec, CEC_TX_DATA3_0 + i * 4, data[i]); ++ ++ hdmirx_cec_write(cec, CEC_TX_CONTROL, 0x1); ++ ++ return 0; ++} ++ ++static irqreturn_t hdmirx_cec_hardirq(int irq, void *data) ++{ ++ struct cec_adapter *adap = data; ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ u32 stat = hdmirx_cec_read(cec, CEC_INT_STATUS); ++ irqreturn_t ret = IRQ_HANDLED; ++ u32 val; ++ ++ if (!stat) ++ return IRQ_NONE; ++ ++ hdmirx_cec_write(cec, CEC_INT_CLEAR, stat); ++ ++ if (stat & CECTX_LINE_ERR) { ++ cec->tx_status = CEC_TX_STATUS_ERROR; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } else if (stat & CECTX_DONE) { ++ cec->tx_status = CEC_TX_STATUS_OK; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } else if (stat & CECTX_NACK) { ++ cec->tx_status = CEC_TX_STATUS_NACK; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } else if (stat & CECTX_ARBLOST) { ++ cec->tx_status = CEC_TX_STATUS_ARB_LOST; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } ++ ++ if (stat & CECRX_EOM) { ++ unsigned int len, i; ++ ++ val = hdmirx_cec_read(cec, CEC_RX_COUNT_STATUS); ++ /* rxbuffer locked status */ ++ if ((val & 0x80)) ++ return ret; ++ ++ len = (val & 0xf) + 1; ++ if (len > sizeof(cec->rx_msg.msg)) ++ len = sizeof(cec->rx_msg.msg); ++ ++ for (i = 0; i < len; i++) { ++ if (!(i % 4)) ++ val = hdmirx_cec_read(cec, CEC_RX_DATA3_0 + i / 4 * 4); ++ cec->rx_msg.msg[i] = (val >> ((i % 4) * 8)) & 0xff; ++ } ++ ++ cec->rx_msg.len = len; ++ smp_wmb(); /* receive RX msg */ ++ cec->rx_done = true; ++ hdmirx_cec_write(cec, CEC_LOCK_CONTROL, 0x1); ++ ++ ret = IRQ_WAKE_THREAD; ++ } ++ ++ return ret; ++} ++ ++static irqreturn_t hdmirx_cec_thread(int irq, void *data) ++{ ++ struct cec_adapter *adap = data; ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ ++ if (cec->tx_done) { ++ cec->tx_done = false; ++ cec_transmit_attempt_done(adap, cec->tx_status); ++ } ++ if (cec->rx_done) { ++ cec->rx_done = false; ++ smp_rmb(); /* RX msg has been received */ ++ cec_received_msg(adap, &cec->rx_msg); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int hdmirx_cec_enable(struct cec_adapter *adap, bool enable) ++{ ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ ++ if (!enable) { ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, 0); ++ hdmirx_cec_write(cec, CEC_INT_CLEAR, 0); ++ if (cec->ops->disable) ++ cec->ops->disable(cec->hdmirx); ++ } else { ++ unsigned int irqs; ++ ++ hdmirx_cec_log_addr(cec->adap, CEC_LOG_ADDR_INVALID); ++ if (cec->ops->enable) ++ cec->ops->enable(cec->hdmirx); ++ hdmirx_cec_update_bits(cec, GLOBAL_SWENABLE, CEC_ENABLE, CEC_ENABLE); ++ ++ irqs = CECTX_LINE_ERR | CECTX_NACK | CECRX_EOM | CECTX_DONE; ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, irqs); ++ } ++ ++ return 0; ++} ++ ++static const struct cec_adap_ops hdmirx_cec_ops = { ++ .adap_enable = hdmirx_cec_enable, ++ .adap_log_addr = hdmirx_cec_log_addr, ++ .adap_transmit = hdmirx_cec_transmit, ++}; ++ ++static void hdmirx_cec_del(void *data) ++{ ++ struct hdmirx_cec *cec = data; ++ ++ cec_delete_adapter(cec->adap); ++} ++ ++struct hdmirx_cec *snps_hdmirx_cec_register(struct hdmirx_cec_data *data) ++{ ++ struct hdmirx_cec *cec; ++ unsigned int irqs; ++ int ret; ++ ++ /* ++ * Our device is just a convenience - we want to link to the real ++ * hardware device here, so that userspace can see the association ++ * between the HDMI hardware and its associated CEC chardev. ++ */ ++ cec = devm_kzalloc(data->dev, sizeof(*cec), GFP_KERNEL); ++ if (!cec) ++ return NULL; ++ ++ cec->dev = data->dev; ++ cec->irq = data->irq; ++ cec->ops = data->ops; ++ cec->hdmirx = data->hdmirx; ++ ++ hdmirx_cec_update_bits(cec, GLOBAL_SWENABLE, CEC_ENABLE, CEC_ENABLE); ++ hdmirx_cec_update_bits(cec, CEC_CONFIG, RX_AUTO_DRIVE_ACKNOWLEDGE, ++ RX_AUTO_DRIVE_ACKNOWLEDGE); ++ ++ hdmirx_cec_write(cec, CEC_TX_COUNT, 0); ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, 0); ++ hdmirx_cec_write(cec, CEC_INT_CLEAR, ~0); ++ ++ cec->adap = cec_allocate_adapter(&hdmirx_cec_ops, cec, "snps-hdmirx", ++ CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | ++ CEC_CAP_RC | CEC_CAP_PASSTHROUGH | ++ CEC_CAP_MONITOR_ALL, ++ CEC_MAX_LOG_ADDRS); ++ if (IS_ERR(cec->adap)) { ++ dev_err(cec->dev, "cec adap allocate failed\n"); ++ return NULL; ++ } ++ ++ /* override the module pointer */ ++ cec->adap->owner = THIS_MODULE; ++ ++ ret = devm_add_action(cec->dev, hdmirx_cec_del, cec); ++ if (ret) { ++ cec_delete_adapter(cec->adap); ++ return NULL; ++ } ++ ++ irq_set_status_flags(cec->irq, IRQ_NOAUTOEN); ++ ++ ret = devm_request_threaded_irq(cec->dev, cec->irq, ++ hdmirx_cec_hardirq, ++ hdmirx_cec_thread, IRQF_ONESHOT, ++ "rk_hdmirx_cec", cec->adap); ++ if (ret) { ++ dev_err(cec->dev, "cec irq request failed\n"); ++ return NULL; ++ } ++ ++ cec->notify = cec_notifier_cec_adap_register(cec->dev, ++ NULL, cec->adap); ++ if (!cec->notify) { ++ dev_err(cec->dev, "cec notify register failed\n"); ++ return NULL; ++ } ++ ++ ret = cec_register_adapter(cec->adap, cec->dev); ++ if (ret < 0) { ++ dev_err(cec->dev, "cec register adapter failed\n"); ++ cec_unregister_adapter(cec->adap); ++ return NULL; ++ } ++ ++ irqs = CECTX_LINE_ERR | CECTX_NACK | CECRX_EOM | CECTX_DONE; ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, irqs); ++ ++ /* ++ * CEC documentation says we must not call cec_delete_adapter ++ * after a successful call to cec_register_adapter(). ++ */ ++ devm_remove_action(cec->dev, hdmirx_cec_del, cec); ++ ++ enable_irq(cec->irq); ++ ++ return cec; ++} ++ ++void snps_hdmirx_cec_unregister(struct hdmirx_cec *cec) ++{ ++ disable_irq(cec->irq); ++ ++ cec_unregister_adapter(cec->adap); ++} +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h +@@ -0,0 +1,44 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * ++ * Author: Shunqing Chen ++ */ ++ ++#ifndef DW_HDMI_RX_CEC_H ++#define DW_HDMI_RX_CEC_H ++ ++struct snps_hdmirx_dev; ++ ++struct hdmirx_cec_ops { ++ void (*write)(struct snps_hdmirx_dev *hdmirx_dev, int reg, u32 val); ++ u32 (*read)(struct snps_hdmirx_dev *hdmirx_dev, int reg); ++ void (*enable)(struct snps_hdmirx_dev *hdmirx); ++ void (*disable)(struct snps_hdmirx_dev *hdmirx); ++}; ++ ++struct hdmirx_cec_data { ++ struct snps_hdmirx_dev *hdmirx; ++ const struct hdmirx_cec_ops *ops; ++ struct device *dev; ++ int irq; ++}; ++ ++struct hdmirx_cec { ++ struct snps_hdmirx_dev *hdmirx; ++ struct device *dev; ++ const struct hdmirx_cec_ops *ops; ++ u32 addresses; ++ struct cec_adapter *adap; ++ struct cec_msg rx_msg; ++ unsigned int tx_status; ++ bool tx_done; ++ bool rx_done; ++ struct cec_notifier *notify; ++ int irq; ++}; ++ ++struct hdmirx_cec *snps_hdmirx_cec_register(struct hdmirx_cec_data *data); ++void snps_hdmirx_cec_unregister(struct hdmirx_cec *cec); ++ ++#endif /* DW_HDMI_RX_CEC_H */ +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Thu, 1 Aug 2024 16:47:35 +0300 +Subject: comment v4l2 error on hdmirx + +--- + drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +@@ -1180,7 +1180,7 @@ static int hdmirx_wait_lock_and_get_timing(struct snps_hdmirx_dev *hdmirx_dev) + break; + + if (!tx_5v_power_present(hdmirx_dev)) { +- v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__); ++ //v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__); + return -1; + } + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.10/overlay/rockchip-rk3588-hdmirx.dtso b/patch/kernel/archive/rockchip-rk3588-6.10/overlay/rockchip-rk3588-hdmirx.dtso new file mode 100644 index 000000000000..b61eff3047be --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.10/overlay/rockchip-rk3588-hdmirx.dtso @@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&hdmi_receiver_cma>; + + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&hdmi_receiver>; + + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.10/rk3588-rock-5b_dts_add_rfkill-bt.patch b/patch/kernel/archive/rockchip-rk3588-6.10/rk3588-rock-5b_dts_add_rfkill-bt.patch new file mode 100644 index 000000000000..3a5c5919abc6 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.10/rk3588-rock-5b_dts_add_rfkill-bt.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Doe +Date: Tue, 20 Aug 2024 22:47:51 +0000 +Subject: rk3588-rock-5b.dts: add rfkill-bt node to Radxa Rock5B board DT + +Signed-off-by: John Doe +--- + arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +@@ -66,6 +66,13 @@ rfkill { + shutdown-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; + }; + ++ rfkill-bt { ++ compatible = "rfkill-gpio"; ++ label = "rfkill-m2-bt"; ++ radio-type = "bluetooth"; ++ shutdown-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; ++ }; ++ + vcc3v3_pcie2x1l0: vcc3v3-pcie2x1l0-regulator { + compatible = "regulator-fixed"; + enable-active-high; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0000.patching_config.yaml b/patch/kernel/archive/rockchip-rk3588-6.11/0000.patching_config.yaml new file mode 100644 index 000000000000..2a2b52cbc6ca --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0000.patching_config.yaml @@ -0,0 +1,47 @@ +config: # This is file 'patch/kernel/rockchip-rk3588-edge/0000.patching_config.yaml' + + # PATCH NUMBERING INFO + # + # Patches should be ordered in such a way that general kernel patches are applied first, then SoC-related patches and at last board-specific patches + # + # Patch numbers in this folder are sorted by category: + # + # 000* for general patches + # 01** for GPU/HDMI related patches + # 08** for wireless patches + # 1*** for board specific patches: + # 101* for Rock-5B, 102* for Rock-5A and so on + + # Just some info stuff; not used by the patching scripts + name: rockchip-rk3588-edge + kind: kernel + type: mainline # or: vendor + branch: linux-6.11.y + last-known-good-tag: v6.11-rc1 + maintainers: + - { github: rpardini, name: Ricardo Pardini, email: ricardo@pardini.net, armbian-forum: rpardini } + + # .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones. + # This is meant to provide a way to "add a board DTS" without having to null-patch them in. + dts-directories: + - { source: "dt", target: "arch/arm64/boot/dts/rockchip" } + + # every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones + # This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in. + # @TODO need a solution to auto-Makefile the overlays as well + overlay-directories: + - { source: "overlay", target: "arch/arm64/boot/dts/rockchip/overlay" } + + # the Makefile in each of these directories will be magically patched to include the dts files copied + # or patched-in; overlay subdir will be included "-y" if it exists. + # No more Makefile patching needed, yay! + auto-patch-dt-makefile: + - { directory: "arch/arm64/boot/dts/rockchip", config-var: "CONFIG_ARCH_ROCKCHIP" } + + # configuration for when applying patches to git / auto-rewriting patches (development cycle helpers) + patches-to-git: + do-not-commit-files: + - "MAINTAINERS" # constant churn, drop them. sorry. + - "Documentation/devicetree/bindings/arm/rockchip.yaml" # constant churn, conflicts on every bump, drop it. sorry. + do-not-commit-regexes: # Python-style regexes + - "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0001-general-add-overlay-support.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0001-general-add-overlay-support.patch new file mode 100644 index 000000000000..1b42e27aaab9 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0001-general-add-overlay-support.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sun, 2 Jun 2024 21:53:01 +0200 +Subject: compile .scr and install overlays in right path + +--- + scripts/Makefile.dtbinst | 13 +++++++++- + scripts/Makefile.lib | 8 +++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index 111111111111..222222222222 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -33,7 +33,18 @@ endef + + $(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) + +-dtbs := $(notdir $(dtbs)) ++# Very convoluted way to flatten all the device tree ++# directories, but keep the "/overlay/" directory ++ ++# topmost directory (ie: from rockchip/overlay/rk322x-emmc.dtbo extracts rockchip) ++topmost_dir = $(firstword $(subst /, ,$(dtbs))) ++# collect dtbs entries which starts with "$topmost_dir/overlay/", then remove "$topmost_dir" ++dtbs_overlays = $(subst $(topmost_dir)/,,$(filter $(topmost_dir)/overlay/%, $(dtbs))) ++# collect the non-overlay dtbs ++dtbs_regular = $(filter-out $(topmost_dir)/overlay/%, $(dtbs)) ++# compose the dtbs variable flattening all the non-overlays entries ++# and appending the overlays entries ++dtbs := $(notdir $(dtbs_regular)) $(dtbs_overlays) + + endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 111111111111..222222222222 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -402,7 +402,7 @@ $(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE + + quiet_cmd_dtc = DTC $@ + cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(DTC) -o $@ -b 0 \ ++ $(DTC) -@ -o $@ -b 0 \ + $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) +@@ -438,12 +438,18 @@ quiet_cmd_dtb = $(quiet_cmd_dtc) + cmd_dtb = $(cmd_dtc) + endif + ++quiet_cmd_scr = MKIMAGE $@ ++cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ ++ + $(obj)/%.dtb: $(obj)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE + $(call if_changed_dep,dtb) + + $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE + $(call if_changed_dep,dtc) + ++$(obj)/%.scr: $(src)/%.scr-cmd FORCE ++ $(call if_changed,scr) ++ + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + + # Bzip2 +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0010-fix-clk-divisions.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0010-fix-clk-divisions.patch new file mode 100644 index 000000000000..25c4a67db09b --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0010-fix-clk-divisions.patch @@ -0,0 +1,142 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Tue, 24 Oct 2023 16:09:35 +0200 +Subject: math.h: add DIV_ROUND_UP_NO_OVERFLOW + +Add a new DIV_ROUND_UP helper, which cannot overflow when +big numbers are being used. + +Signed-off-by: Sebastian Reichel +--- + include/linux/math.h | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/linux/math.h b/include/linux/math.h +index 111111111111..222222222222 100644 +--- a/include/linux/math.h ++++ b/include/linux/math.h +@@ -36,6 +36,17 @@ + + #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP + ++/** ++ * DIV_ROUND_UP_NO_OVERFLOW - divide two numbers and always round up ++ * @n: numerator / dividend ++ * @d: denominator / divisor ++ * ++ * This functions does the same as DIV_ROUND_UP, but internally uses a ++ * division and a modulo operation instead of math tricks. This way it ++ * avoids overflowing when handling big numbers. ++ */ ++#define DIV_ROUND_UP_NO_OVERFLOW(n, d) (((n) / (d)) + !!((n) % (d))) ++ + #define DIV_ROUND_DOWN_ULL(ll, d) \ + ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; }) + +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Tue, 24 Oct 2023 16:13:50 +0200 +Subject: clk: divider: Fix divisor masking on 64 bit platforms + +The clock framework handles clock rates as "unsigned long", so u32 on +32-bit architectures and u64 on 64-bit architectures. + +The current code casts the dividend to u64 on 32-bit to avoid a +potential overflow. For example DIV_ROUND_UP(3000000000, 1500000000) += (3.0G + 1.5G - 1) / 1.5G = = OVERFLOW / 1.5G, which has been +introduced in commit 9556f9dad8f5 ("clk: divider: handle integer overflow +when dividing large clock rates"). + +On 64 bit platforms this masks the divisor, so that only the lower +32 bit are used. Thus requesting a frequency >= 4.3GHz results +in incorrect values. For example requesting 4300000000 (4.3 GHz) will +effectively request ca. 5 MHz. Requesting clk_round_rate(clk, ULONG_MAX) +is a bit of a special case, since that still returns correct values as +long as the parent clock is below 8.5 GHz. + +Fix this by switching to DIV_ROUND_UP_NO_OVERFLOW, which cannot +overflow. This avoids any requirements on the arguments (except +that divisor should not be 0 obviously). + +Signed-off-by: Sebastian Reichel +--- + drivers/clk/clk-divider.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c +index 111111111111..222222222222 100644 +--- a/drivers/clk/clk-divider.c ++++ b/drivers/clk/clk-divider.c +@@ -220,7 +220,7 @@ static int _div_round_up(const struct clk_div_table *table, + unsigned long parent_rate, unsigned long rate, + unsigned long flags) + { +- int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); ++ int div = DIV_ROUND_UP_NO_OVERFLOW(parent_rate, rate); + + if (flags & CLK_DIVIDER_POWER_OF_TWO) + div = __roundup_pow_of_two(div); +@@ -237,7 +237,7 @@ static int _div_round_closest(const struct clk_div_table *table, + int up, down; + unsigned long up_rate, down_rate; + +- up = DIV_ROUND_UP_ULL((u64)parent_rate, rate); ++ up = DIV_ROUND_UP_NO_OVERFLOW(parent_rate, rate); + down = parent_rate / rate; + + if (flags & CLK_DIVIDER_POWER_OF_TWO) { +@@ -473,7 +473,7 @@ int divider_get_val(unsigned long rate, unsigned long parent_rate, + { + unsigned int div, value; + +- div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); ++ div = DIV_ROUND_UP_NO_OVERFLOW(parent_rate, rate); + + if (!_is_valid_div(table, div, flags)) + return -EINVAL; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Tue, 24 Oct 2023 18:09:57 +0200 +Subject: clk: composite: replace open-coded abs_diff() + +Replace the open coded abs_diff() with the existing helper function. + +Suggested-by: Andy Shevchenko +Signed-off-by: Sebastian Reichel +--- + drivers/clk/clk-composite.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c +index 111111111111..222222222222 100644 +--- a/drivers/clk/clk-composite.c ++++ b/drivers/clk/clk-composite.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + + static u8 clk_composite_get_parent(struct clk_hw *hw) +@@ -119,10 +120,7 @@ static int clk_composite_determine_rate(struct clk_hw *hw, + if (ret) + continue; + +- if (req->rate >= tmp_req.rate) +- rate_diff = req->rate - tmp_req.rate; +- else +- rate_diff = tmp_req.rate - req->rate; ++ rate_diff = abs_diff(req->rate, tmp_req.rate); + + if (!rate_diff || !req->best_parent_hw + || best_rate_diff > rate_diff) { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0011-irqchip-fix-its-timeout-issue.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0011-irqchip-fix-its-timeout-issue.patch new file mode 100644 index 000000000000..bcea28c349cb --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0011-irqchip-fix-its-timeout-issue.patch @@ -0,0 +1,214 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Fri, 11 Aug 2023 17:56:00 +0300 +Subject: irqchip/irq-gic-v3-its: fix its timeout issue for rk35xx boards + +--- + drivers/irqchip/irq-gic-v3-its.c | 79 +++++++++- + 1 file changed, 72 insertions(+), 7 deletions(-) + +diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c +index 111111111111..222222222222 100644 +--- a/drivers/irqchip/irq-gic-v3-its.c ++++ b/drivers/irqchip/irq-gic-v3-its.c +@@ -164,6 +164,7 @@ struct its_device { + struct its_node *its; + struct event_lpi_map event_map; + void *itt; ++ u32 itt_sz; + u32 nr_ites; + u32 device_id; + bool shared; +@@ -2186,6 +2187,9 @@ static void gic_reset_prop_table(void *va) + static struct page *its_allocate_prop_table(gfp_t gfp_flags) + { + struct page *prop_page; ++ ++ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ gfp_flags |= GFP_DMA32; + + prop_page = alloc_pages(gfp_flags, get_order(LPI_PROPBASE_SZ)); + if (!prop_page) +@@ -2310,6 +2314,7 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser, + u32 alloc_pages, psz; + struct page *page; + void *base; ++ gfp_t gfp_flags; + + psz = baser->psz; + alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz); +@@ -2321,7 +2326,11 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser, + order = get_order(GITS_BASER_PAGES_MAX * psz); + } + +- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, order); ++ gfp_flags = GFP_KERNEL | __GFP_ZERO; ++ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ gfp_flags |= GFP_DMA32; ++ ++ page = alloc_pages_node(its->numa_node, gfp_flags, order); + if (!page) + return -ENOMEM; + +@@ -2371,6 +2380,15 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser, + its_write_baser(its, baser, val); + tmp = baser->val; + ++ if (of_machine_is_compatible("rockchip,rk3568") || ++ of_machine_is_compatible("rockchip,rk3566") || ++ of_machine_is_compatible("rockchip,rk3588")) { ++ if (tmp & GITS_BASER_SHAREABILITY_MASK) ++ tmp &= ~GITS_BASER_SHAREABILITY_MASK; ++ else ++ gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order)); ++ } ++ + if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) { + /* + * Shareability didn't stick. Just use +@@ -2960,7 +2978,9 @@ static int its_alloc_collections(struct its_node *its) + static struct page *its_allocate_pending_table(gfp_t gfp_flags) + { + struct page *pend_page; +- ++ ++ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ gfp_flags |= GFP_DMA32; + pend_page = alloc_pages(gfp_flags | __GFP_ZERO, + get_order(LPI_PENDBASE_SZ)); + if (!pend_page) +@@ -3119,6 +3139,11 @@ static void its_cpu_init_lpis(void) + if (!rdists_support_shareable()) + tmp &= ~GICR_PROPBASER_SHAREABILITY_MASK; + ++ if (of_machine_is_compatible("rockchip,rk3568") || ++ of_machine_is_compatible("rockchip,rk3566") || ++ of_machine_is_compatible("rockchip,rk3588")) ++ tmp &= ~GICR_PROPBASER_SHAREABILITY_MASK; ++ + if ((tmp ^ val) & GICR_PROPBASER_SHAREABILITY_MASK) { + if (!(tmp & GICR_PROPBASER_SHAREABILITY_MASK)) { + /* +@@ -3146,6 +3171,11 @@ static void its_cpu_init_lpis(void) + if (!rdists_support_shareable()) + tmp &= ~GICR_PENDBASER_SHAREABILITY_MASK; + ++ if (of_machine_is_compatible("rockchip,rk3568") || ++ of_machine_is_compatible("rockchip,rk3566") || ++ of_machine_is_compatible("rockchip,rk3588")) ++ tmp &= ~GICR_PENDBASER_SHAREABILITY_MASK; ++ + if (!(tmp & GICR_PENDBASER_SHAREABILITY_MASK)) { + /* + * The HW reports non-shareable, we must remove the +@@ -3309,7 +3339,11 @@ static bool its_alloc_table_entry(struct its_node *its, + + /* Allocate memory for 2nd level table */ + if (!table[idx]) { +- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, ++ gfp_t gfp_flags = GFP_KERNEL | __GFP_ZERO; ++ ++ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ gfp_flags |= GFP_DMA32; ++ page = alloc_pages_node(its->numa_node, gfp_flags, + get_order(baser->psz)); + if (!page) + return false; +@@ -3398,6 +3432,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, + int nr_lpis; + int nr_ites; + int sz; ++ gfp_t gfp_flags; + + if (!its_alloc_device_table(its, dev_id)) + return NULL; +@@ -3413,7 +3448,15 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, + nr_ites = max(2, nvecs); + sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1); + sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; +- itt = kzalloc_node(sz, GFP_KERNEL, its->numa_node); ++ gfp_flags = GFP_KERNEL; ++ ++ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) { ++ gfp_flags |= GFP_DMA32; ++ itt = (void *)__get_free_pages(gfp_flags, get_order(sz)); ++ } else { ++ itt = kzalloc_node(sz, gfp_flags, its->numa_node); ++ } ++ + if (alloc_lpis) { + lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis); + if (lpi_map) +@@ -3427,7 +3470,13 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, + + if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) { + kfree(dev); +- kfree(itt); ++ ++ if (of_machine_is_compatible("rockchip,rk3568") || ++ of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ free_pages((unsigned long)itt, get_order(sz)); ++ else ++ kfree(itt); ++ + bitmap_free(lpi_map); + kfree(col_map); + return NULL; +@@ -3437,6 +3486,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, + + dev->its = its; + dev->itt = itt; ++ dev->itt_sz = sz; + dev->nr_ites = nr_ites; + dev->event_map.lpi_map = lpi_map; + dev->event_map.col_map = col_map; +@@ -3464,7 +3514,13 @@ static void its_free_device(struct its_device *its_dev) + list_del(&its_dev->entry); + raw_spin_unlock_irqrestore(&its_dev->its->lock, flags); + kfree(its_dev->event_map.col_map); +- kfree(its_dev->itt); ++ ++ if (of_machine_is_compatible("rockchip,rk3568") || ++ of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ free_pages((unsigned long)its_dev->itt, get_order(its_dev->itt_sz)); ++ else ++ kfree(its_dev->itt); ++ + kfree(its_dev); + } + +@@ -5079,6 +5135,7 @@ static int __init its_probe_one(struct its_node *its) + struct page *page; + u32 ctlr; + int err; ++ gfp_t gfp_flags; + + its_enable_quirks(its); + +@@ -5112,7 +5169,10 @@ static int __init its_probe_one(struct its_node *its) + } + } + +- page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, ++ gfp_flags = GFP_KERNEL | __GFP_ZERO; ++ if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566") || of_machine_is_compatible("rockchip,rk3588")) ++ gfp_flags |= GFP_DMA32; ++ page = alloc_pages_node(its->numa_node, gfp_flags, + get_order(ITS_CMD_QUEUE_SZ)); + if (!page) { + err = -ENOMEM; +@@ -5141,6 +5201,11 @@ static int __init its_probe_one(struct its_node *its) + if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE) + tmp &= ~GITS_CBASER_SHAREABILITY_MASK; + ++ if (of_machine_is_compatible("rockchip,rk3568") || ++ of_machine_is_compatible("rockchip,rk3566") || ++ of_machine_is_compatible("rockchip,rk3588")) ++ tmp &= ~GITS_CBASER_SHAREABILITY_MASK; ++ + if ((tmp ^ baser) & GITS_CBASER_SHAREABILITY_MASK) { + if (!(tmp & GITS_CBASER_SHAREABILITY_MASK)) { + /* +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0024-RK3588-Add-Crypto-Support.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0024-RK3588-Add-Crypto-Support.patch new file mode 100644 index 000000000000..636d11ec130f --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0024-RK3588-Add-Crypto-Support.patch @@ -0,0 +1,2322 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Corentin Labbe +Date: Tue, 7 Nov 2023 15:55:27 +0000 +Subject: dt-bindings: crypto: add support for rockchip,crypto-rk3588 + +Add device tree binding documentation for the Rockchip cryptographic +offloader V2. + +Signed-off-by: Corentin Labbe +--- + Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml | 65 ++++++++++ + 1 file changed, 65 insertions(+) + +diff --git a/Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml b/Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml +@@ -0,0 +1,65 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/crypto/rockchip,rk3588-crypto.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Rockchip cryptographic offloader V2 ++ ++maintainers: ++ - Corentin Labbe ++ ++properties: ++ compatible: ++ enum: ++ - rockchip,rk3568-crypto ++ - rockchip,rk3588-crypto ++ ++ reg: ++ maxItems: 1 ++ ++ interrupts: ++ maxItems: 1 ++ ++ clocks: ++ minItems: 3 ++ ++ clock-names: ++ items: ++ - const: core ++ - const: a ++ - const: h ++ ++ resets: ++ minItems: 1 ++ ++ reset-names: ++ items: ++ - const: core ++ ++required: ++ - compatible ++ - reg ++ - interrupts ++ - clocks ++ - clock-names ++ - resets ++ - reset-names ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ crypto@fe370000 { ++ compatible = "rockchip,rk3588-crypto"; ++ reg = <0xfe370000 0x4000>; ++ interrupts = ; ++ clocks = <&scmi_clk SCMI_CRYPTO_CORE>, <&scmi_clk SCMI_ACLK_SECURE_NS>, ++ <&scmi_clk SCMI_HCLK_SECURE_NS>; ++ clock-names = "core", "a", "h"; ++ resets = <&scmi_reset SRST_CRYPTO_CORE>; ++ reset-names = "core"; ++ }; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Corentin Labbe +Date: Tue, 7 Nov 2023 15:55:30 +0000 +Subject: ARM64: dts: rk356x: add crypto node + +Both RK3566 and RK3568 have a crypto IP handled by the rk3588 crypto driver so adds a +node for it. + +Tested-by: Ricardo Pardini +Signed-off-by: Corentin Labbe +--- + arch/arm64/boot/dts/rockchip/rk356x.dtsi | 12 ++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi +@@ -1113,6 +1113,18 @@ sdhci: mmc@fe310000 { + status = "disabled"; + }; + ++ crypto: crypto@fe380000 { ++ compatible = "rockchip,rk3568-crypto"; ++ reg = <0x0 0xfe380000 0x0 0x2000>; ++ interrupts = ; ++ clocks = <&cru ACLK_CRYPTO_NS>, <&cru HCLK_CRYPTO_NS>, ++ <&cru CLK_CRYPTO_NS_CORE>; ++ clock-names = "aclk", "hclk", "core"; ++ resets = <&cru SRST_CRYPTO_NS_CORE>; ++ reset-names = "core"; ++ status = "okay"; ++ }; ++ + i2s0_8ch: i2s@fe400000 { + compatible = "rockchip,rk3568-i2s-tdm"; + reg = <0x0 0xfe400000 0x0 0x1000>; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Fri, 2 Aug 2024 00:05:59 +0300 +Subject: arm64: dts: rockchip: rk3588: enable crypto node + +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1763,6 +1763,17 @@ sdhci: mmc@fe2e0000 { + status = "disabled"; + }; + ++ crypto: crypto@fe370000 { ++ compatible = "rockchip,rk3588-crypto"; ++ reg = <0x0 0xfe370000 0x0 0x2000>; ++ interrupts = ; ++ clocks = <&scmi_clk SCMI_CRYPTO_CORE>, <&scmi_clk SCMI_ACLK_SECURE_NS>, ++ <&scmi_clk SCMI_HCLK_SECURE_NS>; ++ clock-names = "core", "aclk", "hclk"; ++ resets = <&scmi_reset SRST_CRYPTO_CORE>; ++ reset-names = "core"; ++ }; ++ + i2s0_8ch: i2s@fe470000 { + compatible = "rockchip,rk3588-i2s-tdm"; + reg = <0x0 0xfe470000 0x0 0x1000>; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Corentin Labbe +Date: Tue, 7 Nov 2023 15:55:31 +0000 +Subject: reset: rockchip: secure reset must be used by SCMI + +While working on the rk3588 crypto driver, I loose lot of time +understanding why resetting the IP failed. +This is due to RK3588_SECURECRU_RESET_OFFSET being in the secure world, +so impossible to operate on it from the kernel. +All resets in this block must be handled via SCMI call. + +Signed-off-by: Corentin Labbe +--- + drivers/clk/rockchip/rst-rk3588.c | 42 ------ + include/dt-bindings/reset/rockchip,rk3588-cru.h | 68 +++++----- + 2 files changed, 34 insertions(+), 76 deletions(-) + +diff --git a/drivers/clk/rockchip/rst-rk3588.c b/drivers/clk/rockchip/rst-rk3588.c +index 111111111111..222222222222 100644 +--- a/drivers/clk/rockchip/rst-rk3588.c ++++ b/drivers/clk/rockchip/rst-rk3588.c +@@ -16,9 +16,6 @@ + /* 0xFD7C8000 + 0x0A00 */ + #define RK3588_PHPTOPCRU_RESET_OFFSET(id, reg, bit) [id] = (0x8000*4 + reg * 16 + bit) + +-/* 0xFD7D0000 + 0x0A00 */ +-#define RK3588_SECURECRU_RESET_OFFSET(id, reg, bit) [id] = (0x10000*4 + reg * 16 + bit) +- + /* 0xFD7F0000 + 0x0A00 */ + #define RK3588_PMU1CRU_RESET_OFFSET(id, reg, bit) [id] = (0x30000*4 + reg * 16 + bit) + +@@ -807,45 +804,6 @@ static const int rk3588_register_offset[] = { + RK3588_PMU1CRU_RESET_OFFSET(SRST_P_PMU0IOC, 5, 4), + RK3588_PMU1CRU_RESET_OFFSET(SRST_P_GPIO0, 5, 5), + RK3588_PMU1CRU_RESET_OFFSET(SRST_GPIO0, 5, 6), +- +- /* SECURECRU_SOFTRST_CON00 */ +- RK3588_SECURECRU_RESET_OFFSET(SRST_A_SECURE_NS_BIU, 0, 10), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_SECURE_NS_BIU, 0, 11), +- RK3588_SECURECRU_RESET_OFFSET(SRST_A_SECURE_S_BIU, 0, 12), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_SECURE_S_BIU, 0, 13), +- RK3588_SECURECRU_RESET_OFFSET(SRST_P_SECURE_S_BIU, 0, 14), +- RK3588_SECURECRU_RESET_OFFSET(SRST_CRYPTO_CORE, 0, 15), +- +- /* SECURECRU_SOFTRST_CON01 */ +- RK3588_SECURECRU_RESET_OFFSET(SRST_CRYPTO_PKA, 1, 0), +- RK3588_SECURECRU_RESET_OFFSET(SRST_CRYPTO_RNG, 1, 1), +- RK3588_SECURECRU_RESET_OFFSET(SRST_A_CRYPTO, 1, 2), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_CRYPTO, 1, 3), +- RK3588_SECURECRU_RESET_OFFSET(SRST_KEYLADDER_CORE, 1, 9), +- RK3588_SECURECRU_RESET_OFFSET(SRST_KEYLADDER_RNG, 1, 10), +- RK3588_SECURECRU_RESET_OFFSET(SRST_A_KEYLADDER, 1, 11), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_KEYLADDER, 1, 12), +- RK3588_SECURECRU_RESET_OFFSET(SRST_P_OTPC_S, 1, 13), +- RK3588_SECURECRU_RESET_OFFSET(SRST_OTPC_S, 1, 14), +- RK3588_SECURECRU_RESET_OFFSET(SRST_WDT_S, 1, 15), +- +- /* SECURECRU_SOFTRST_CON02 */ +- RK3588_SECURECRU_RESET_OFFSET(SRST_T_WDT_S, 2, 0), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_BOOTROM, 2, 1), +- RK3588_SECURECRU_RESET_OFFSET(SRST_A_DCF, 2, 2), +- RK3588_SECURECRU_RESET_OFFSET(SRST_P_DCF, 2, 3), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_BOOTROM_NS, 2, 5), +- RK3588_SECURECRU_RESET_OFFSET(SRST_P_KEYLADDER, 2, 14), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_TRNG_S, 2, 15), +- +- /* SECURECRU_SOFTRST_CON03 */ +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_TRNG_NS, 3, 0), +- RK3588_SECURECRU_RESET_OFFSET(SRST_D_SDMMC_BUFFER, 3, 1), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_SDMMC, 3, 2), +- RK3588_SECURECRU_RESET_OFFSET(SRST_H_SDMMC_BUFFER, 3, 3), +- RK3588_SECURECRU_RESET_OFFSET(SRST_SDMMC, 3, 4), +- RK3588_SECURECRU_RESET_OFFSET(SRST_P_TRNG_CHK, 3, 5), +- RK3588_SECURECRU_RESET_OFFSET(SRST_TRNG_S, 3, 6), + }; + + void rk3588_rst_init(struct device_node *np, void __iomem *reg_base) +diff --git a/include/dt-bindings/reset/rockchip,rk3588-cru.h b/include/dt-bindings/reset/rockchip,rk3588-cru.h +index 111111111111..222222222222 100644 +--- a/include/dt-bindings/reset/rockchip,rk3588-cru.h ++++ b/include/dt-bindings/reset/rockchip,rk3588-cru.h +@@ -716,40 +716,40 @@ + #define SRST_P_GPIO0 627 + #define SRST_GPIO0 628 + +-#define SRST_A_SECURE_NS_BIU 629 +-#define SRST_H_SECURE_NS_BIU 630 +-#define SRST_A_SECURE_S_BIU 631 +-#define SRST_H_SECURE_S_BIU 632 +-#define SRST_P_SECURE_S_BIU 633 +-#define SRST_CRYPTO_CORE 634 +- +-#define SRST_CRYPTO_PKA 635 +-#define SRST_CRYPTO_RNG 636 +-#define SRST_A_CRYPTO 637 +-#define SRST_H_CRYPTO 638 +-#define SRST_KEYLADDER_CORE 639 +-#define SRST_KEYLADDER_RNG 640 +-#define SRST_A_KEYLADDER 641 +-#define SRST_H_KEYLADDER 642 +-#define SRST_P_OTPC_S 643 +-#define SRST_OTPC_S 644 +-#define SRST_WDT_S 645 +- +-#define SRST_T_WDT_S 646 +-#define SRST_H_BOOTROM 647 +-#define SRST_A_DCF 648 +-#define SRST_P_DCF 649 +-#define SRST_H_BOOTROM_NS 650 +-#define SRST_P_KEYLADDER 651 +-#define SRST_H_TRNG_S 652 +- +-#define SRST_H_TRNG_NS 653 +-#define SRST_D_SDMMC_BUFFER 654 +-#define SRST_H_SDMMC 655 +-#define SRST_H_SDMMC_BUFFER 656 +-#define SRST_SDMMC 657 +-#define SRST_P_TRNG_CHK 658 +-#define SRST_TRNG_S 659 ++#define SRST_A_SECURE_NS_BIU 10 ++#define SRST_H_SECURE_NS_BIU 11 ++#define SRST_A_SECURE_S_BIU 12 ++#define SRST_H_SECURE_S_BIU 13 ++#define SRST_P_SECURE_S_BIU 14 ++#define SRST_CRYPTO_CORE 15 ++ ++#define SRST_CRYPTO_PKA 16 ++#define SRST_CRYPTO_RNG 17 ++#define SRST_A_CRYPTO 18 ++#define SRST_H_CRYPTO 19 ++#define SRST_KEYLADDER_CORE 25 ++#define SRST_KEYLADDER_RNG 26 ++#define SRST_A_KEYLADDER 27 ++#define SRST_H_KEYLADDER 28 ++#define SRST_P_OTPC_S 29 ++#define SRST_OTPC_S 30 ++#define SRST_WDT_S 31 ++ ++#define SRST_T_WDT_S 32 ++#define SRST_H_BOOTROM 33 ++#define SRST_A_DCF 34 ++#define SRST_P_DCF 35 ++#define SRST_H_BOOTROM_NS 37 ++#define SRST_P_KEYLADDER 46 ++#define SRST_H_TRNG_S 47 ++ ++#define SRST_H_TRNG_NS 48 ++#define SRST_D_SDMMC_BUFFER 49 ++#define SRST_H_SDMMC 50 ++#define SRST_H_SDMMC_BUFFER 51 ++#define SRST_SDMMC 52 ++#define SRST_P_TRNG_CHK 53 ++#define SRST_TRNG_S 54 + + #define SRST_A_HDMIRX_BIU 660 + +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Corentin Labbe +Date: Tue, 7 Nov 2023 15:55:32 +0000 +Subject: crypto: rockchip: add rk3588 driver + +RK3588 have a new crypto IP, this patch adds basic support for it. +Only hashes and cipher are handled for the moment. + +Signed-off-by: Corentin Labbe +--- + drivers/crypto/Kconfig | 29 + + drivers/crypto/rockchip/Makefile | 5 + + drivers/crypto/rockchip/rk2_crypto.c | 738 ++++++++++ + drivers/crypto/rockchip/rk2_crypto.h | 246 ++++ + drivers/crypto/rockchip/rk2_crypto_ahash.c | 344 +++++ + drivers/crypto/rockchip/rk2_crypto_skcipher.c | 576 ++++++++ + 6 files changed, 1938 insertions(+) + +diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/crypto/Kconfig ++++ b/drivers/crypto/Kconfig +@@ -653,6 +653,35 @@ config CRYPTO_DEV_TEGRA + Select this to enable Tegra Security Engine which accelerates various + AES encryption/decryption and HASH algorithms. + ++config CRYPTO_DEV_ROCKCHIP2 ++ tristate "Rockchip's cryptographic offloader V2" ++ depends on OF && ARCH_ROCKCHIP ++ depends on PM ++ select CRYPTO_ECB ++ select CRYPTO_CBC ++ select CRYPTO_AES ++ select CRYPTO_MD5 ++ select CRYPTO_SHA1 ++ select CRYPTO_SHA256 ++ select CRYPTO_SHA512 ++ select CRYPTO_SM3_GENERIC ++ select CRYPTO_HASH ++ select CRYPTO_SKCIPHER ++ select CRYPTO_ENGINE ++ ++ help ++ This driver interfaces with the hardware crypto offloader present ++ on RK3566, RK3568 and RK3588. ++ ++config CRYPTO_DEV_ROCKCHIP2_DEBUG ++ bool "Enable Rockchip V2 crypto stats" ++ depends on CRYPTO_DEV_ROCKCHIP2 ++ depends on DEBUG_FS ++ help ++ Say y to enable Rockchip crypto debug stats. ++ This will create /sys/kernel/debug/rk3588_crypto/stats for displaying ++ the number of requests per algorithm and other internal stats. ++ + config CRYPTO_DEV_ZYNQMP_AES + tristate "Support for Xilinx ZynqMP AES hw accelerator" + depends on ZYNQMP_FIRMWARE || COMPILE_TEST +diff --git a/drivers/crypto/rockchip/Makefile b/drivers/crypto/rockchip/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/crypto/rockchip/Makefile ++++ b/drivers/crypto/rockchip/Makefile +@@ -3,3 +3,8 @@ obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o + rk_crypto-objs := rk3288_crypto.o \ + rk3288_crypto_skcipher.o \ + rk3288_crypto_ahash.o ++ ++obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP2) += rk_crypto2.o ++rk_crypto2-objs := rk2_crypto.o \ ++ rk2_crypto_skcipher.o \ ++ rk2_crypto_ahash.o +diff --git a/drivers/crypto/rockchip/rk2_crypto.c b/drivers/crypto/rockchip/rk2_crypto.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/crypto/rockchip/rk2_crypto.c +@@ -0,0 +1,738 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * hardware cryptographic offloader for RK3568/RK3588 SoC ++ * ++ * Copyright (c) 2022-2023, Corentin Labbe ++ */ ++ ++#include "rk2_crypto.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct rockchip_ip rocklist = { ++ .dev_list = LIST_HEAD_INIT(rocklist.dev_list), ++ .lock = __SPIN_LOCK_UNLOCKED(rocklist.lock), ++}; ++ ++struct rk2_crypto_dev *get_rk2_crypto(void) ++{ ++ struct rk2_crypto_dev *first; ++ ++ spin_lock(&rocklist.lock); ++ first = list_first_entry_or_null(&rocklist.dev_list, ++ struct rk2_crypto_dev, list); ++ list_rotate_left(&rocklist.dev_list); ++ spin_unlock(&rocklist.lock); ++ return first; ++} ++ ++static const struct rk2_variant rk3568_variant = { ++ .num_clks = 3, ++}; ++ ++static const struct rk2_variant rk3588_variant = { ++ .num_clks = 3, ++}; ++ ++static int rk2_crypto_get_clks(struct rk2_crypto_dev *dev) ++{ ++ int i, j, err; ++ unsigned long cr; ++ ++ dev->num_clks = devm_clk_bulk_get_all(dev->dev, &dev->clks); ++ if (dev->num_clks < dev->variant->num_clks) { ++ dev_err(dev->dev, "Missing clocks, got %d instead of %d\n", ++ dev->num_clks, dev->variant->num_clks); ++ return -EINVAL; ++ } ++ ++ for (i = 0; i < dev->num_clks; i++) { ++ cr = clk_get_rate(dev->clks[i].clk); ++ for (j = 0; j < ARRAY_SIZE(dev->variant->rkclks); j++) { ++ if (dev->variant->rkclks[j].max == 0) ++ continue; ++ if (strcmp(dev->variant->rkclks[j].name, dev->clks[i].id)) ++ continue; ++ if (cr > dev->variant->rkclks[j].max) { ++ err = clk_set_rate(dev->clks[i].clk, ++ dev->variant->rkclks[j].max); ++ if (err) ++ dev_err(dev->dev, "Fail downclocking %s from %lu to %lu\n", ++ dev->variant->rkclks[j].name, cr, ++ dev->variant->rkclks[j].max); ++ else ++ dev_info(dev->dev, "Downclocking %s from %lu to %lu\n", ++ dev->variant->rkclks[j].name, cr, ++ dev->variant->rkclks[j].max); ++ } ++ } ++ } ++ return 0; ++} ++ ++static int rk2_crypto_enable_clk(struct rk2_crypto_dev *dev) ++{ ++ int err; ++ ++ err = clk_bulk_prepare_enable(dev->num_clks, dev->clks); ++ if (err) ++ dev_err(dev->dev, "Could not enable clock clks\n"); ++ ++ return err; ++} ++ ++static void rk2_crypto_disable_clk(struct rk2_crypto_dev *dev) ++{ ++ clk_bulk_disable_unprepare(dev->num_clks, dev->clks); ++} ++ ++/* ++ * Power management strategy: The device is suspended until a request ++ * is handled. For avoiding suspend/resume yoyo, the autosuspend is set to 2s. ++ */ ++static int rk2_crypto_pm_suspend(struct device *dev) ++{ ++ struct rk2_crypto_dev *rkdev = dev_get_drvdata(dev); ++ ++ rk2_crypto_disable_clk(rkdev); ++ reset_control_assert(rkdev->rst); ++ ++ return 0; ++} ++ ++static int rk2_crypto_pm_resume(struct device *dev) ++{ ++ struct rk2_crypto_dev *rkdev = dev_get_drvdata(dev); ++ int ret; ++ ++ ret = rk2_crypto_enable_clk(rkdev); ++ if (ret) ++ return ret; ++ ++ reset_control_deassert(rkdev->rst); ++ return 0; ++} ++ ++static const struct dev_pm_ops rk2_crypto_pm_ops = { ++ SET_RUNTIME_PM_OPS(rk2_crypto_pm_suspend, rk2_crypto_pm_resume, NULL) ++}; ++ ++static int rk2_crypto_pm_init(struct rk2_crypto_dev *rkdev) ++{ ++ int err; ++ ++ pm_runtime_use_autosuspend(rkdev->dev); ++ pm_runtime_set_autosuspend_delay(rkdev->dev, 2000); ++ ++ err = pm_runtime_set_suspended(rkdev->dev); ++ if (err) ++ return err; ++ pm_runtime_enable(rkdev->dev); ++ return err; ++} ++ ++static void rk2_crypto_pm_exit(struct rk2_crypto_dev *rkdev) ++{ ++ pm_runtime_disable(rkdev->dev); ++} ++ ++static irqreturn_t rk2_crypto_irq_handle(int irq, void *dev_id) ++{ ++ struct rk2_crypto_dev *rkc = platform_get_drvdata(dev_id); ++ u32 v; ++ ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_INT_ST); ++ writel(v, rkc->reg + RK2_CRYPTO_DMA_INT_ST); ++ ++ rkc->status = 1; ++ if (v & 0xF8) { ++ dev_warn(rkc->dev, "DMA Error\n"); ++ rkc->status = 0; ++ } ++ complete(&rkc->complete); ++ ++ return IRQ_HANDLED; ++} ++ ++static struct rk2_crypto_template rk2_crypto_algs[] = { ++ { ++ .type = CRYPTO_ALG_TYPE_SKCIPHER, ++ .rk2_mode = RK2_CRYPTO_AES_ECB, ++ .alg.skcipher.base = { ++ .base.cra_name = "ecb(aes)", ++ .base.cra_driver_name = "ecb-aes-rk2", ++ .base.cra_priority = 300, ++ .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct rk2_cipher_ctx), ++ .base.cra_alignmask = 0x0f, ++ .base.cra_module = THIS_MODULE, ++ ++ .init = rk2_cipher_tfm_init, ++ .exit = rk2_cipher_tfm_exit, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .setkey = rk2_aes_setkey, ++ .encrypt = rk2_skcipher_encrypt, ++ .decrypt = rk2_skcipher_decrypt, ++ }, ++ .alg.skcipher.op = { ++ .do_one_request = rk2_cipher_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_SKCIPHER, ++ .rk2_mode = RK2_CRYPTO_AES_CBC, ++ .alg.skcipher.base = { ++ .base.cra_name = "cbc(aes)", ++ .base.cra_driver_name = "cbc-aes-rk2", ++ .base.cra_priority = 300, ++ .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct rk2_cipher_ctx), ++ .base.cra_alignmask = 0x0f, ++ .base.cra_module = THIS_MODULE, ++ ++ .init = rk2_cipher_tfm_init, ++ .exit = rk2_cipher_tfm_exit, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_BLOCK_SIZE, ++ .setkey = rk2_aes_setkey, ++ .encrypt = rk2_skcipher_encrypt, ++ .decrypt = rk2_skcipher_decrypt, ++ }, ++ .alg.skcipher.op = { ++ .do_one_request = rk2_cipher_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_SKCIPHER, ++ .rk2_mode = RK2_CRYPTO_AES_XTS, ++ .is_xts = true, ++ .alg.skcipher.base = { ++ .base.cra_name = "xts(aes)", ++ .base.cra_driver_name = "xts-aes-rk2", ++ .base.cra_priority = 300, ++ .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct rk2_cipher_ctx), ++ .base.cra_alignmask = 0x0f, ++ .base.cra_module = THIS_MODULE, ++ ++ .init = rk2_cipher_tfm_init, ++ .exit = rk2_cipher_tfm_exit, ++ .min_keysize = AES_MIN_KEY_SIZE * 2, ++ .max_keysize = AES_MAX_KEY_SIZE * 2, ++ .ivsize = AES_BLOCK_SIZE, ++ .setkey = rk2_aes_xts_setkey, ++ .encrypt = rk2_skcipher_encrypt, ++ .decrypt = rk2_skcipher_decrypt, ++ }, ++ .alg.skcipher.op = { ++ .do_one_request = rk2_cipher_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_AHASH, ++ .rk2_mode = RK2_CRYPTO_MD5, ++ .alg.hash.base = { ++ .init = rk2_ahash_init, ++ .update = rk2_ahash_update, ++ .final = rk2_ahash_final, ++ .finup = rk2_ahash_finup, ++ .export = rk2_ahash_export, ++ .import = rk2_ahash_import, ++ .digest = rk2_ahash_digest, ++ .init_tfm = rk2_hash_init_tfm, ++ .exit_tfm = rk2_hash_exit_tfm, ++ .halg = { ++ .digestsize = MD5_DIGEST_SIZE, ++ .statesize = sizeof(struct md5_state), ++ .base = { ++ .cra_name = "md5", ++ .cra_driver_name = "rk2-md5", ++ .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .cra_blocksize = MD5_HMAC_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct rk2_ahash_ctx), ++ .cra_module = THIS_MODULE, ++ } ++ } ++ }, ++ .alg.hash.op = { ++ .do_one_request = rk2_hash_run, ++ }, ++ ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_AHASH, ++ .rk2_mode = RK2_CRYPTO_SHA1, ++ .alg.hash.base = { ++ .init = rk2_ahash_init, ++ .update = rk2_ahash_update, ++ .final = rk2_ahash_final, ++ .finup = rk2_ahash_finup, ++ .export = rk2_ahash_export, ++ .import = rk2_ahash_import, ++ .digest = rk2_ahash_digest, ++ .init_tfm = rk2_hash_init_tfm, ++ .exit_tfm = rk2_hash_exit_tfm, ++ .halg = { ++ .digestsize = SHA1_DIGEST_SIZE, ++ .statesize = sizeof(struct sha1_state), ++ .base = { ++ .cra_name = "sha1", ++ .cra_driver_name = "rk2-sha1", ++ .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .cra_blocksize = SHA1_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct rk2_ahash_ctx), ++ .cra_module = THIS_MODULE, ++ } ++ } ++ }, ++ .alg.hash.op = { ++ .do_one_request = rk2_hash_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_AHASH, ++ .rk2_mode = RK2_CRYPTO_SHA256, ++ .alg.hash.base = { ++ .init = rk2_ahash_init, ++ .update = rk2_ahash_update, ++ .final = rk2_ahash_final, ++ .finup = rk2_ahash_finup, ++ .export = rk2_ahash_export, ++ .import = rk2_ahash_import, ++ .digest = rk2_ahash_digest, ++ .init_tfm = rk2_hash_init_tfm, ++ .exit_tfm = rk2_hash_exit_tfm, ++ .halg = { ++ .digestsize = SHA256_DIGEST_SIZE, ++ .statesize = sizeof(struct sha256_state), ++ .base = { ++ .cra_name = "sha256", ++ .cra_driver_name = "rk2-sha256", ++ .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .cra_blocksize = SHA256_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct rk2_ahash_ctx), ++ .cra_module = THIS_MODULE, ++ } ++ } ++ }, ++ .alg.hash.op = { ++ .do_one_request = rk2_hash_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_AHASH, ++ .rk2_mode = RK2_CRYPTO_SHA384, ++ .alg.hash.base = { ++ .init = rk2_ahash_init, ++ .update = rk2_ahash_update, ++ .final = rk2_ahash_final, ++ .finup = rk2_ahash_finup, ++ .export = rk2_ahash_export, ++ .import = rk2_ahash_import, ++ .digest = rk2_ahash_digest, ++ .init_tfm = rk2_hash_init_tfm, ++ .exit_tfm = rk2_hash_exit_tfm, ++ .halg = { ++ .digestsize = SHA384_DIGEST_SIZE, ++ .statesize = sizeof(struct sha512_state), ++ .base = { ++ .cra_name = "sha384", ++ .cra_driver_name = "rk2-sha384", ++ .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .cra_blocksize = SHA384_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct rk2_ahash_ctx), ++ .cra_module = THIS_MODULE, ++ } ++ } ++ }, ++ .alg.hash.op = { ++ .do_one_request = rk2_hash_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_AHASH, ++ .rk2_mode = RK2_CRYPTO_SHA512, ++ .alg.hash.base = { ++ .init = rk2_ahash_init, ++ .update = rk2_ahash_update, ++ .final = rk2_ahash_final, ++ .finup = rk2_ahash_finup, ++ .export = rk2_ahash_export, ++ .import = rk2_ahash_import, ++ .digest = rk2_ahash_digest, ++ .init_tfm = rk2_hash_init_tfm, ++ .exit_tfm = rk2_hash_exit_tfm, ++ .halg = { ++ .digestsize = SHA512_DIGEST_SIZE, ++ .statesize = sizeof(struct sha512_state), ++ .base = { ++ .cra_name = "sha512", ++ .cra_driver_name = "rk2-sha512", ++ .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .cra_blocksize = SHA512_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct rk2_ahash_ctx), ++ .cra_module = THIS_MODULE, ++ } ++ } ++ }, ++ .alg.hash.op = { ++ .do_one_request = rk2_hash_run, ++ }, ++ }, ++ { ++ .type = CRYPTO_ALG_TYPE_AHASH, ++ .rk2_mode = RK2_CRYPTO_SM3, ++ .alg.hash.base = { ++ .init = rk2_ahash_init, ++ .update = rk2_ahash_update, ++ .final = rk2_ahash_final, ++ .finup = rk2_ahash_finup, ++ .export = rk2_ahash_export, ++ .import = rk2_ahash_import, ++ .digest = rk2_ahash_digest, ++ .init_tfm = rk2_hash_init_tfm, ++ .exit_tfm = rk2_hash_exit_tfm, ++ .halg = { ++ .digestsize = SM3_DIGEST_SIZE, ++ .statesize = sizeof(struct sm3_state), ++ .base = { ++ .cra_name = "sm3", ++ .cra_driver_name = "rk2-sm3", ++ .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .cra_blocksize = SM3_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct rk2_ahash_ctx), ++ .cra_module = THIS_MODULE, ++ } ++ } ++ }, ++ .alg.hash.op = { ++ .do_one_request = rk2_hash_run, ++ }, ++ }, ++}; ++ ++#ifdef CONFIG_CRYPTO_DEV_ROCKCHIP2_DEBUG ++static int rk2_crypto_debugfs_stats_show(struct seq_file *seq, void *v) ++{ ++ struct rk2_crypto_dev *rkc; ++ unsigned int i; ++ ++ spin_lock(&rocklist.lock); ++ list_for_each_entry(rkc, &rocklist.dev_list, list) { ++ seq_printf(seq, "%s %s requests: %lu\n", ++ dev_driver_string(rkc->dev), dev_name(rkc->dev), ++ rkc->nreq); ++ } ++ spin_unlock(&rocklist.lock); ++ ++ for (i = 0; i < ARRAY_SIZE(rk2_crypto_algs); i++) { ++ if (!rk2_crypto_algs[i].dev) ++ continue; ++ switch (rk2_crypto_algs[i].type) { ++ case CRYPTO_ALG_TYPE_SKCIPHER: ++ seq_printf(seq, "%s %s reqs=%lu fallback=%lu\n", ++ rk2_crypto_algs[i].alg.skcipher.base.base.cra_driver_name, ++ rk2_crypto_algs[i].alg.skcipher.base.base.cra_name, ++ rk2_crypto_algs[i].stat_req, rk2_crypto_algs[i].stat_fb); ++ seq_printf(seq, "\tfallback due to length: %lu\n", ++ rk2_crypto_algs[i].stat_fb_len); ++ seq_printf(seq, "\tfallback due to alignment: %lu\n", ++ rk2_crypto_algs[i].stat_fb_align); ++ seq_printf(seq, "\tfallback due to SGs: %lu\n", ++ rk2_crypto_algs[i].stat_fb_sgdiff); ++ break; ++ case CRYPTO_ALG_TYPE_AHASH: ++ seq_printf(seq, "%s %s reqs=%lu fallback=%lu\n", ++ rk2_crypto_algs[i].alg.hash.base.halg.base.cra_driver_name, ++ rk2_crypto_algs[i].alg.hash.base.halg.base.cra_name, ++ rk2_crypto_algs[i].stat_req, rk2_crypto_algs[i].stat_fb); ++ break; ++ } ++ } ++ return 0; ++} ++ ++static int rk2_crypto_debugfs_info_show(struct seq_file *seq, void *d) ++{ ++ struct rk2_crypto_dev *rkc; ++ u32 v; ++ ++ spin_lock(&rocklist.lock); ++ list_for_each_entry(rkc, &rocklist.dev_list, list) { ++ v = readl(rkc->reg + RK2_CRYPTO_CLK_CTL); ++ seq_printf(seq, "CRYPTO_CLK_CTL %x\n", v); ++ v = readl(rkc->reg + RK2_CRYPTO_RST_CTL); ++ seq_printf(seq, "CRYPTO_RST_CTL %x\n", v); ++ ++ v = readl(rkc->reg + CRYPTO_AES_VERSION); ++ seq_printf(seq, "CRYPTO_AES_VERSION %x\n", v); ++ if (v & BIT(17)) ++ seq_puts(seq, "AES 192\n"); ++ ++ v = readl(rkc->reg + CRYPTO_DES_VERSION); ++ seq_printf(seq, "CRYPTO_DES_VERSION %x\n", v); ++ v = readl(rkc->reg + CRYPTO_SM4_VERSION); ++ seq_printf(seq, "CRYPTO_SM4_VERSION %x\n", v); ++ v = readl(rkc->reg + CRYPTO_HASH_VERSION); ++ seq_printf(seq, "CRYPTO_HASH_VERSION %x\n", v); ++ v = readl(rkc->reg + CRYPTO_HMAC_VERSION); ++ seq_printf(seq, "CRYPTO_HMAC_VERSION %x\n", v); ++ v = readl(rkc->reg + CRYPTO_RNG_VERSION); ++ seq_printf(seq, "CRYPTO_RNG_VERSION %x\n", v); ++ v = readl(rkc->reg + CRYPTO_PKA_VERSION); ++ seq_printf(seq, "CRYPTO_PKA_VERSION %x\n", v); ++ v = readl(rkc->reg + CRYPTO_CRYPTO_VERSION); ++ seq_printf(seq, "CRYPTO_CRYPTO_VERSION %x\n", v); ++ } ++ spin_unlock(&rocklist.lock); ++ ++ return 0; ++} ++ ++DEFINE_SHOW_ATTRIBUTE(rk2_crypto_debugfs_stats); ++DEFINE_SHOW_ATTRIBUTE(rk2_crypto_debugfs_info); ++ ++#endif ++ ++static void register_debugfs(struct rk2_crypto_dev *crypto_dev) ++{ ++#ifdef CONFIG_CRYPTO_DEV_ROCKCHIP2_DEBUG ++ /* Ignore error of debugfs */ ++ rocklist.dbgfs_dir = debugfs_create_dir("rk2_crypto", NULL); ++ rocklist.dbgfs_stats = debugfs_create_file("stats", 0440, ++ rocklist.dbgfs_dir, ++ &rocklist, ++ &rk2_crypto_debugfs_stats_fops); ++ rocklist.dbgfs_stats = debugfs_create_file("info", 0440, ++ rocklist.dbgfs_dir, ++ &rocklist, ++ &rk2_crypto_debugfs_info_fops); ++#endif ++} ++ ++static int rk2_crypto_register(struct rk2_crypto_dev *rkc) ++{ ++ unsigned int i, k; ++ int err = 0; ++ ++ for (i = 0; i < ARRAY_SIZE(rk2_crypto_algs); i++) { ++ rk2_crypto_algs[i].dev = rkc; ++ switch (rk2_crypto_algs[i].type) { ++ case CRYPTO_ALG_TYPE_SKCIPHER: ++ dev_info(rkc->dev, "Register %s as %s\n", ++ rk2_crypto_algs[i].alg.skcipher.base.base.cra_name, ++ rk2_crypto_algs[i].alg.skcipher.base.base.cra_driver_name); ++ err = crypto_engine_register_skcipher(&rk2_crypto_algs[i].alg.skcipher); ++ break; ++ case CRYPTO_ALG_TYPE_AHASH: ++ dev_info(rkc->dev, "Register %s as %s %d\n", ++ rk2_crypto_algs[i].alg.hash.base.halg.base.cra_name, ++ rk2_crypto_algs[i].alg.hash.base.halg.base.cra_driver_name, i); ++ err = crypto_engine_register_ahash(&rk2_crypto_algs[i].alg.hash); ++ break; ++ default: ++ dev_err(rkc->dev, "unknown algorithm\n"); ++ } ++ if (err) ++ goto err_cipher_algs; ++ } ++ return 0; ++ ++err_cipher_algs: ++ for (k = 0; k < i; k++) { ++ if (rk2_crypto_algs[k].type == CRYPTO_ALG_TYPE_SKCIPHER) ++ crypto_engine_unregister_skcipher(&rk2_crypto_algs[k].alg.skcipher); ++ else ++ crypto_engine_unregister_ahash(&rk2_crypto_algs[k].alg.hash); ++ } ++ return err; ++} ++ ++static void rk2_crypto_unregister(void) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(rk2_crypto_algs); i++) { ++ if (rk2_crypto_algs[i].type == CRYPTO_ALG_TYPE_SKCIPHER) ++ crypto_engine_unregister_skcipher(&rk2_crypto_algs[i].alg.skcipher); ++ else ++ crypto_engine_unregister_ahash(&rk2_crypto_algs[i].alg.hash); ++ } ++} ++ ++static const struct of_device_id crypto_of_id_table[] = { ++ { .compatible = "rockchip,rk3568-crypto", ++ .data = &rk3568_variant, ++ }, ++ { .compatible = "rockchip,rk3588-crypto", ++ .data = &rk3588_variant, ++ }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, crypto_of_id_table); ++ ++static int rk2_crypto_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct rk2_crypto_dev *rkc, *first; ++ int err = 0; ++ ++ rkc = devm_kzalloc(&pdev->dev, sizeof(*rkc), GFP_KERNEL); ++ if (!rkc) { ++ err = -ENOMEM; ++ goto err_crypto; ++ } ++ ++ rkc->dev = &pdev->dev; ++ platform_set_drvdata(pdev, rkc); ++ ++ rkc->variant = of_device_get_match_data(&pdev->dev); ++ if (!rkc->variant) { ++ dev_err(&pdev->dev, "Missing variant\n"); ++ return -EINVAL; ++ } ++ ++ rkc->rst = devm_reset_control_array_get_exclusive(dev); ++ if (IS_ERR(rkc->rst)) { ++ err = PTR_ERR(rkc->rst); ++ dev_err(&pdev->dev, "Fail to get resets err=%d\n", err); ++ goto err_crypto; ++ } ++ ++ rkc->tl = dma_alloc_coherent(rkc->dev, ++ sizeof(struct rk2_crypto_lli) * MAX_LLI, ++ &rkc->t_phy, GFP_KERNEL); ++ if (!rkc->tl) { ++ dev_err(rkc->dev, "Cannot get DMA memory for task\n"); ++ err = -ENOMEM; ++ goto err_crypto; ++ } ++ ++ reset_control_assert(rkc->rst); ++ usleep_range(10, 20); ++ reset_control_deassert(rkc->rst); ++ ++ rkc->reg = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(rkc->reg)) { ++ err = PTR_ERR(rkc->reg); ++ dev_err(&pdev->dev, "Fail to get resources\n"); ++ goto err_crypto; ++ } ++ ++ err = rk2_crypto_get_clks(rkc); ++ if (err) ++ goto err_crypto; ++ ++ rkc->irq = platform_get_irq(pdev, 0); ++ if (rkc->irq < 0) { ++ dev_err(&pdev->dev, "control Interrupt is not available.\n"); ++ err = rkc->irq; ++ goto err_crypto; ++ } ++ ++ err = devm_request_irq(&pdev->dev, rkc->irq, ++ rk2_crypto_irq_handle, IRQF_SHARED, ++ "rk-crypto", pdev); ++ ++ if (err) { ++ dev_err(&pdev->dev, "irq request failed.\n"); ++ goto err_crypto; ++ } ++ ++ rkc->engine = crypto_engine_alloc_init(&pdev->dev, true); ++ crypto_engine_start(rkc->engine); ++ init_completion(&rkc->complete); ++ ++ err = rk2_crypto_pm_init(rkc); ++ if (err) ++ goto err_pm; ++ ++ err = pm_runtime_resume_and_get(&pdev->dev); ++ ++ spin_lock(&rocklist.lock); ++ first = list_first_entry_or_null(&rocklist.dev_list, ++ struct rk2_crypto_dev, list); ++ list_add_tail(&rkc->list, &rocklist.dev_list); ++ spin_unlock(&rocklist.lock); ++ ++ if (!first) { ++ dev_info(dev, "Registers crypto algos\n"); ++ err = rk2_crypto_register(rkc); ++ if (err) { ++ dev_err(dev, "Fail to register crypto algorithms"); ++ goto err_register_alg; ++ } ++ ++ register_debugfs(rkc); ++ } ++ ++ return 0; ++ ++err_register_alg: ++ rk2_crypto_pm_exit(rkc); ++err_pm: ++ crypto_engine_exit(rkc->engine); ++err_crypto: ++ dev_err(dev, "Crypto Accelerator not successfully registered\n"); ++ return err; ++} ++ ++static void rk2_crypto_remove(struct platform_device *pdev) ++{ ++ struct rk2_crypto_dev *rkc = platform_get_drvdata(pdev); ++ struct rk2_crypto_dev *first; ++ ++ spin_lock_bh(&rocklist.lock); ++ list_del(&rkc->list); ++ first = list_first_entry_or_null(&rocklist.dev_list, ++ struct rk2_crypto_dev, list); ++ spin_unlock_bh(&rocklist.lock); ++ ++ if (!first) { ++#ifdef CONFIG_CRYPTO_DEV_ROCKCHIP2_DEBUG ++ debugfs_remove_recursive(rocklist.dbgfs_dir); ++#endif ++ rk2_crypto_unregister(); ++ } ++ rk2_crypto_pm_exit(rkc); ++ crypto_engine_exit(rkc->engine); ++} ++ ++static struct platform_driver crypto_driver = { ++ .probe = rk2_crypto_probe, ++ .remove = rk2_crypto_remove, ++ .driver = { ++ .name = "rk2-crypto", ++ .pm = &rk2_crypto_pm_ops, ++ .of_match_table = crypto_of_id_table, ++ }, ++}; ++ ++module_platform_driver(crypto_driver); ++ ++MODULE_DESCRIPTION("Rockchip Crypto Engine cryptographic offloader"); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Corentin Labbe "); +diff --git a/drivers/crypto/rockchip/rk2_crypto.h b/drivers/crypto/rockchip/rk2_crypto.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/crypto/rockchip/rk2_crypto.h +@@ -0,0 +1,246 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define RK2_CRYPTO_CLK_CTL 0x0000 ++#define RK2_CRYPTO_RST_CTL 0x0004 ++ ++#define RK2_CRYPTO_DMA_INT_EN 0x0008 ++/* values for RK2_CRYPTO_DMA_INT_EN */ ++#define RK2_CRYPTO_DMA_INT_LISTDONE BIT(0) ++ ++#define RK2_CRYPTO_DMA_INT_ST 0x000C ++/* values in RK2_CRYPTO_DMA_INT_ST are the same than in RK2_CRYPTO_DMA_INT_EN */ ++ ++#define RK2_CRYPTO_DMA_CTL 0x0010 ++#define RK2_CRYPTO_DMA_CTL_START BIT(0) ++ ++#define RK2_CRYPTO_DMA_LLI_ADDR 0x0014 ++#define RK2_CRYPTO_DMA_ST 0x0018 ++#define RK2_CRYPTO_DMA_STATE 0x001C ++#define RK2_CRYPTO_DMA_LLI_RADDR 0x0020 ++#define RK2_CRYPTO_DMA_SRC_RADDR 0x0024 ++#define RK2_CRYPTO_DMA_DST_WADDR 0x0028 ++#define RK2_CRYPTO_DMA_ITEM_ID 0x002C ++ ++#define RK2_CRYPTO_FIFO_CTL 0x0040 ++ ++#define RK2_CRYPTO_BC_CTL 0x0044 ++#define RK2_CRYPTO_AES (0 << 8) ++#define RK2_CRYPTO_MODE_ECB (0 << 4) ++#define RK2_CRYPTO_MODE_CBC (1 << 4) ++#define RK2_CRYPTO_XTS (6 << 4) ++ ++#define RK2_CRYPTO_HASH_CTL 0x0048 ++#define RK2_CRYPTO_HW_PAD BIT(2) ++#define RK2_CRYPTO_SHA1 (0 << 4) ++#define RK2_CRYPTO_MD5 (1 << 4) ++#define RK2_CRYPTO_SHA224 (3 << 4) ++#define RK2_CRYPTO_SHA256 (2 << 4) ++#define RK2_CRYPTO_SHA384 (9 << 4) ++#define RK2_CRYPTO_SHA512 (8 << 4) ++#define RK2_CRYPTO_SM3 (4 << 4) ++ ++#define RK2_CRYPTO_AES_ECB (RK2_CRYPTO_AES | RK2_CRYPTO_MODE_ECB) ++#define RK2_CRYPTO_AES_CBC (RK2_CRYPTO_AES | RK2_CRYPTO_MODE_CBC) ++#define RK2_CRYPTO_AES_XTS (RK2_CRYPTO_AES | RK2_CRYPTO_XTS) ++#define RK2_CRYPTO_AES_CTR_MODE 3 ++#define RK2_CRYPTO_AES_128BIT_key (0 << 2) ++#define RK2_CRYPTO_AES_192BIT_key (1 << 2) ++#define RK2_CRYPTO_AES_256BIT_key (2 << 2) ++ ++#define RK2_CRYPTO_DEC BIT(1) ++#define RK2_CRYPTO_ENABLE BIT(0) ++ ++#define RK2_CRYPTO_CIPHER_ST 0x004C ++#define RK2_CRYPTO_CIPHER_STATE 0x0050 ++ ++#define RK2_CRYPTO_CH0_IV_0 0x0100 ++ ++#define RK2_CRYPTO_KEY0 0x0180 ++#define RK2_CRYPTO_KEY1 0x0184 ++#define RK2_CRYPTO_KEY2 0x0188 ++#define RK2_CRYPTO_KEY3 0x018C ++#define RK2_CRYPTO_KEY4 0x0190 ++#define RK2_CRYPTO_KEY5 0x0194 ++#define RK2_CRYPTO_KEY6 0x0198 ++#define RK2_CRYPTO_KEY7 0x019C ++#define RK2_CRYPTO_CH4_KEY0 0x01c0 ++ ++#define RK2_CRYPTO_CH0_PC_LEN_0 0x0280 ++ ++#define RK2_CRYPTO_CH0_IV_LEN 0x0300 ++ ++#define RK2_CRYPTO_HASH_DOUT_0 0x03A0 ++#define RK2_CRYPTO_HASH_VALID 0x03E4 ++ ++#define RK2_CRYPTO_TRNG_CTL 0x0400 ++#define RK2_CRYPTO_TRNG_START BIT(0) ++#define RK2_CRYPTO_TRNG_ENABLE BIT(1) ++#define RK2_CRYPTO_TRNG_256 (0x3 << 4) ++#define RK2_CRYPTO_TRNG_SAMPLE_CNT 0x0404 ++#define RK2_CRYPTO_TRNG_DOUT 0x0410 ++ ++#define CRYPTO_AES_VERSION 0x0680 ++#define CRYPTO_DES_VERSION 0x0684 ++#define CRYPTO_SM4_VERSION 0x0688 ++#define CRYPTO_HASH_VERSION 0x068C ++#define CRYPTO_HMAC_VERSION 0x0690 ++#define CRYPTO_RNG_VERSION 0x0694 ++#define CRYPTO_PKA_VERSION 0x0698 ++#define CRYPTO_CRYPTO_VERSION 0x06F0 ++ ++#define RK2_LLI_DMA_CTRL_SRC_INT BIT(10) ++#define RK2_LLI_DMA_CTRL_DST_INT BIT(9) ++#define RK2_LLI_DMA_CTRL_LIST_INT BIT(8) ++#define RK2_LLI_DMA_CTRL_LAST BIT(0) ++ ++#define RK2_LLI_STRING_LAST BIT(2) ++#define RK2_LLI_STRING_FIRST BIT(1) ++#define RK2_LLI_CIPHER_START BIT(0) ++ ++#define RK2_MAX_CLKS 4 ++ ++#define MAX_LLI 20 ++ ++struct rk2_crypto_lli { ++ __le32 src_addr; ++ __le32 src_len; ++ __le32 dst_addr; ++ __le32 dst_len; ++ __le32 user; ++ __le32 iv; ++ __le32 dma_ctrl; ++ __le32 next; ++}; ++ ++/* ++ * struct rockchip_ip - struct for managing a list of RK crypto instance ++ * @dev_list: Used for doing a list of rk2_crypto_dev ++ * @lock: Control access to dev_list ++ * @dbgfs_dir: Debugfs dentry for statistic directory ++ * @dbgfs_stats: Debugfs dentry for statistic counters ++ */ ++struct rockchip_ip { ++ struct list_head dev_list; ++ spinlock_t lock; /* Control access to dev_list */ ++ struct dentry *dbgfs_dir; ++ struct dentry *dbgfs_stats; ++}; ++ ++struct rk2_clks { ++ const char *name; ++ unsigned long max; ++}; ++ ++struct rk2_variant { ++ int num_clks; ++ struct rk2_clks rkclks[RK2_MAX_CLKS]; ++}; ++ ++struct rk2_crypto_dev { ++ struct list_head list; ++ struct device *dev; ++ struct clk_bulk_data *clks; ++ int num_clks; ++ struct reset_control *rst; ++ void __iomem *reg; ++ int irq; ++ const struct rk2_variant *variant; ++ unsigned long nreq; ++ struct crypto_engine *engine; ++ struct completion complete; ++ int status; ++ struct rk2_crypto_lli *tl; ++ dma_addr_t t_phy; ++}; ++ ++/* the private variable of hash */ ++struct rk2_ahash_ctx { ++ /* for fallback */ ++ struct crypto_ahash *fallback_tfm; ++}; ++ ++/* the private variable of hash for fallback */ ++struct rk2_ahash_rctx { ++ struct rk2_crypto_dev *dev; ++ struct ahash_request fallback_req; ++ u32 mode; ++ int nrsgs; ++}; ++ ++/* the private variable of cipher */ ++struct rk2_cipher_ctx { ++ unsigned int keylen; ++ u8 key[AES_MAX_KEY_SIZE * 2]; ++ u8 iv[AES_BLOCK_SIZE]; ++ struct crypto_skcipher *fallback_tfm; ++}; ++ ++struct rk2_cipher_rctx { ++ struct rk2_crypto_dev *dev; ++ u8 backup_iv[AES_BLOCK_SIZE]; ++ u32 mode; ++ struct skcipher_request fallback_req; // keep at the end ++}; ++ ++struct rk2_crypto_template { ++ u32 type; ++ u32 rk2_mode; ++ bool is_xts; ++ struct rk2_crypto_dev *dev; ++ union { ++ struct skcipher_engine_alg skcipher; ++ struct ahash_engine_alg hash; ++ } alg; ++ unsigned long stat_req; ++ unsigned long stat_fb; ++ unsigned long stat_fb_len; ++ unsigned long stat_fb_sglen; ++ unsigned long stat_fb_align; ++ unsigned long stat_fb_sgdiff; ++}; ++ ++struct rk2_crypto_dev *get_rk2_crypto(void); ++int rk2_cipher_run(struct crypto_engine *engine, void *async_req); ++int rk2_hash_run(struct crypto_engine *engine, void *breq); ++ ++int rk2_cipher_tfm_init(struct crypto_skcipher *tfm); ++void rk2_cipher_tfm_exit(struct crypto_skcipher *tfm); ++int rk2_aes_setkey(struct crypto_skcipher *cipher, const u8 *key, ++ unsigned int keylen); ++int rk2_aes_xts_setkey(struct crypto_skcipher *cipher, const u8 *key, ++ unsigned int keylen); ++int rk2_skcipher_encrypt(struct skcipher_request *req); ++int rk2_skcipher_decrypt(struct skcipher_request *req); ++int rk2_aes_ecb_encrypt(struct skcipher_request *req); ++int rk2_aes_ecb_decrypt(struct skcipher_request *req); ++int rk2_aes_cbc_encrypt(struct skcipher_request *req); ++int rk2_aes_cbc_decrypt(struct skcipher_request *req); ++ ++int rk2_ahash_init(struct ahash_request *req); ++int rk2_ahash_update(struct ahash_request *req); ++int rk2_ahash_final(struct ahash_request *req); ++int rk2_ahash_finup(struct ahash_request *req); ++int rk2_ahash_import(struct ahash_request *req, const void *in); ++int rk2_ahash_export(struct ahash_request *req, void *out); ++int rk2_ahash_digest(struct ahash_request *req); ++int rk2_hash_init_tfm(struct crypto_ahash *tfm); ++void rk2_hash_exit_tfm(struct crypto_ahash *tfm); +diff --git a/drivers/crypto/rockchip/rk2_crypto_ahash.c b/drivers/crypto/rockchip/rk2_crypto_ahash.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/crypto/rockchip/rk2_crypto_ahash.c +@@ -0,0 +1,344 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Crypto offloader support for Rockchip RK3568/RK3588 ++ * ++ * Copyright (c) 2022-2023 Corentin Labbe ++ */ ++#include ++#include ++#include "rk2_crypto.h" ++ ++static bool rk2_ahash_need_fallback(struct ahash_request *areq) ++{ ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); ++ struct ahash_alg *alg = crypto_ahash_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.hash.base); ++ struct scatterlist *sg; ++ ++ sg = areq->src; ++ while (sg) { ++ if (!IS_ALIGNED(sg->offset, sizeof(u32))) { ++ algt->stat_fb_align++; ++ return true; ++ } ++ if (sg->length % 4) { ++ algt->stat_fb_sglen++; ++ return true; ++ } ++ sg = sg_next(sg); ++ } ++ return false; ++} ++ ++static int rk2_ahash_digest_fb(struct ahash_request *areq) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(areq); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); ++ struct rk2_ahash_ctx *tfmctx = crypto_ahash_ctx(tfm); ++ struct ahash_alg *alg = crypto_ahash_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.hash.base); ++ ++ algt->stat_fb++; ++ ++ ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); ++ rctx->fallback_req.base.flags = areq->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ ++ rctx->fallback_req.nbytes = areq->nbytes; ++ rctx->fallback_req.src = areq->src; ++ rctx->fallback_req.result = areq->result; ++ ++ return crypto_ahash_digest(&rctx->fallback_req); ++} ++ ++static int zero_message_process(struct ahash_request *req) ++{ ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct ahash_alg *alg = crypto_ahash_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.hash.base); ++ int digestsize = crypto_ahash_digestsize(tfm); ++ ++ switch (algt->rk2_mode) { ++ case RK2_CRYPTO_SHA1: ++ memcpy(req->result, sha1_zero_message_hash, digestsize); ++ break; ++ case RK2_CRYPTO_SHA256: ++ memcpy(req->result, sha256_zero_message_hash, digestsize); ++ break; ++ case RK2_CRYPTO_SHA384: ++ memcpy(req->result, sha384_zero_message_hash, digestsize); ++ break; ++ case RK2_CRYPTO_SHA512: ++ memcpy(req->result, sha512_zero_message_hash, digestsize); ++ break; ++ case RK2_CRYPTO_MD5: ++ memcpy(req->result, md5_zero_message_hash, digestsize); ++ break; ++ case RK2_CRYPTO_SM3: ++ memcpy(req->result, sm3_zero_message_hash, digestsize); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++int rk2_ahash_init(struct ahash_request *req) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct rk2_ahash_ctx *ctx = crypto_ahash_ctx(tfm); ++ ++ ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm); ++ rctx->fallback_req.base.flags = req->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ ++ return crypto_ahash_init(&rctx->fallback_req); ++} ++ ++int rk2_ahash_update(struct ahash_request *req) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct rk2_ahash_ctx *ctx = crypto_ahash_ctx(tfm); ++ ++ ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm); ++ rctx->fallback_req.base.flags = req->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ rctx->fallback_req.nbytes = req->nbytes; ++ rctx->fallback_req.src = req->src; ++ ++ return crypto_ahash_update(&rctx->fallback_req); ++} ++ ++int rk2_ahash_final(struct ahash_request *req) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct rk2_ahash_ctx *ctx = crypto_ahash_ctx(tfm); ++ ++ ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm); ++ rctx->fallback_req.base.flags = req->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ rctx->fallback_req.result = req->result; ++ ++ return crypto_ahash_final(&rctx->fallback_req); ++} ++ ++int rk2_ahash_finup(struct ahash_request *req) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct rk2_ahash_ctx *ctx = crypto_ahash_ctx(tfm); ++ ++ ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm); ++ rctx->fallback_req.base.flags = req->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ ++ rctx->fallback_req.nbytes = req->nbytes; ++ rctx->fallback_req.src = req->src; ++ rctx->fallback_req.result = req->result; ++ ++ return crypto_ahash_finup(&rctx->fallback_req); ++} ++ ++int rk2_ahash_import(struct ahash_request *req, const void *in) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct rk2_ahash_ctx *ctx = crypto_ahash_ctx(tfm); ++ ++ ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm); ++ rctx->fallback_req.base.flags = req->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ ++ return crypto_ahash_import(&rctx->fallback_req, in); ++} ++ ++int rk2_ahash_export(struct ahash_request *req, void *out) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ struct rk2_ahash_ctx *ctx = crypto_ahash_ctx(tfm); ++ ++ ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback_tfm); ++ rctx->fallback_req.base.flags = req->base.flags & ++ CRYPTO_TFM_REQ_MAY_SLEEP; ++ ++ return crypto_ahash_export(&rctx->fallback_req, out); ++} ++ ++int rk2_ahash_digest(struct ahash_request *req) ++{ ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(req); ++ struct rk2_crypto_dev *dev; ++ struct crypto_engine *engine; ++ ++ if (rk2_ahash_need_fallback(req)) ++ return rk2_ahash_digest_fb(req); ++ ++ if (!req->nbytes) ++ return zero_message_process(req); ++ ++ dev = get_rk2_crypto(); ++ ++ rctx->dev = dev; ++ engine = dev->engine; ++ ++ return crypto_transfer_hash_request_to_engine(engine, req); ++} ++ ++static int rk2_hash_prepare(struct crypto_engine *engine, void *breq) ++{ ++ struct ahash_request *areq = container_of(breq, struct ahash_request, base); ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(areq); ++ struct rk2_crypto_dev *rkc = rctx->dev; ++ int ret; ++ ++ ret = dma_map_sg(rkc->dev, areq->src, sg_nents(areq->src), DMA_TO_DEVICE); ++ if (ret <= 0) ++ return -EINVAL; ++ ++ rctx->nrsgs = ret; ++ ++ return 0; ++} ++ ++static void rk2_hash_unprepare(struct crypto_engine *engine, void *breq) ++{ ++ struct ahash_request *areq = container_of(breq, struct ahash_request, base); ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(areq); ++ struct rk2_crypto_dev *rkc = rctx->dev; ++ ++ dma_unmap_sg(rkc->dev, areq->src, rctx->nrsgs, DMA_TO_DEVICE); ++} ++ ++int rk2_hash_run(struct crypto_engine *engine, void *breq) ++{ ++ struct ahash_request *areq = container_of(breq, struct ahash_request, base); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); ++ struct rk2_ahash_rctx *rctx = ahash_request_ctx(areq); ++ struct ahash_alg *alg = crypto_ahash_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.hash.base); ++ struct scatterlist *sgs = areq->src; ++ struct rk2_crypto_dev *rkc = rctx->dev; ++ struct rk2_crypto_lli *dd = &rkc->tl[0]; ++ int ddi = 0; ++ int err = 0; ++ unsigned int len = areq->nbytes; ++ unsigned int todo; ++ u32 v; ++ int i; ++ ++ err = rk2_hash_prepare(engine, breq); ++ ++ err = pm_runtime_resume_and_get(rkc->dev); ++ if (err) ++ return err; ++ ++ dev_dbg(rkc->dev, "%s %s len=%d\n", __func__, ++ crypto_tfm_alg_name(areq->base.tfm), areq->nbytes); ++ ++ algt->stat_req++; ++ rkc->nreq++; ++ ++ rctx->mode = algt->rk2_mode; ++ rctx->mode |= 0xffff0000; ++ rctx->mode |= RK2_CRYPTO_ENABLE | RK2_CRYPTO_HW_PAD; ++ writel(rctx->mode, rkc->reg + RK2_CRYPTO_HASH_CTL); ++ ++ while (sgs && len > 0) { ++ dd = &rkc->tl[ddi]; ++ ++ todo = min(sg_dma_len(sgs), len); ++ dd->src_addr = sg_dma_address(sgs); ++ dd->src_len = todo; ++ dd->dst_addr = 0; ++ dd->dst_len = 0; ++ dd->dma_ctrl = ddi << 24; ++ dd->iv = 0; ++ dd->next = rkc->t_phy + sizeof(struct rk2_crypto_lli) * (ddi + 1); ++ ++ if (ddi == 0) ++ dd->user = RK2_LLI_CIPHER_START | RK2_LLI_STRING_FIRST; ++ else ++ dd->user = 0; ++ ++ len -= todo; ++ dd->dma_ctrl |= RK2_LLI_DMA_CTRL_SRC_INT; ++ if (len == 0) { ++ dd->user |= RK2_LLI_STRING_LAST; ++ dd->dma_ctrl |= RK2_LLI_DMA_CTRL_LAST; ++ } ++ dev_dbg(rkc->dev, "HASH SG %d sglen=%d user=%x dma=%x mode=%x len=%d todo=%d phy=%llx\n", ++ ddi, sgs->length, dd->user, dd->dma_ctrl, rctx->mode, len, todo, rkc->t_phy); ++ ++ sgs = sg_next(sgs); ++ ddi++; ++ } ++ dd->next = 1; ++ writel(RK2_CRYPTO_DMA_INT_LISTDONE | 0x7F, rkc->reg + RK2_CRYPTO_DMA_INT_EN); ++ ++ writel(rkc->t_phy, rkc->reg + RK2_CRYPTO_DMA_LLI_ADDR); ++ ++ reinit_completion(&rkc->complete); ++ rkc->status = 0; ++ ++ writel(RK2_CRYPTO_DMA_CTL_START | RK2_CRYPTO_DMA_CTL_START << 16, rkc->reg + RK2_CRYPTO_DMA_CTL); ++ ++ wait_for_completion_interruptible_timeout(&rkc->complete, ++ msecs_to_jiffies(2000)); ++ if (!rkc->status) { ++ dev_err(rkc->dev, "DMA timeout\n"); ++ err = -EFAULT; ++ goto theend; ++ } ++ ++ readl_poll_timeout_atomic(rkc->reg + RK2_CRYPTO_HASH_VALID, v, v == 1, ++ 10, 1000); ++ ++ for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++) { ++ v = readl(rkc->reg + RK2_CRYPTO_HASH_DOUT_0 + i * 4); ++ put_unaligned_le32(be32_to_cpu(v), areq->result + i * 4); ++ } ++ ++theend: ++ pm_runtime_put_autosuspend(rkc->dev); ++ ++ rk2_hash_unprepare(engine, breq); ++ ++ local_bh_disable(); ++ crypto_finalize_hash_request(engine, breq, err); ++ local_bh_enable(); ++ ++ return 0; ++} ++ ++int rk2_hash_init_tfm(struct crypto_ahash *tfm) ++{ ++ struct rk2_ahash_ctx *tctx = crypto_ahash_ctx(tfm); ++ const char *alg_name = crypto_ahash_alg_name(tfm); ++ struct ahash_alg *alg = crypto_ahash_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.hash.base); ++ ++ /* for fallback */ ++ tctx->fallback_tfm = crypto_alloc_ahash(alg_name, 0, ++ CRYPTO_ALG_NEED_FALLBACK); ++ if (IS_ERR(tctx->fallback_tfm)) { ++ dev_err(algt->dev->dev, "Could not load fallback driver.\n"); ++ return PTR_ERR(tctx->fallback_tfm); ++ } ++ ++ crypto_ahash_set_reqsize(tfm, ++ sizeof(struct rk2_ahash_rctx) + ++ crypto_ahash_reqsize(tctx->fallback_tfm)); ++ return 0; ++} ++ ++void rk2_hash_exit_tfm(struct crypto_ahash *tfm) ++{ ++ struct rk2_ahash_ctx *tctx = crypto_ahash_ctx(tfm); ++ ++ crypto_free_ahash(tctx->fallback_tfm); ++} +diff --git a/drivers/crypto/rockchip/rk2_crypto_skcipher.c b/drivers/crypto/rockchip/rk2_crypto_skcipher.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/crypto/rockchip/rk2_crypto_skcipher.c +@@ -0,0 +1,576 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * hardware cryptographic offloader for RK3568/RK3588 SoC ++ * ++ * Copyright (c) 2022-2023 Corentin Labbe ++ */ ++#include ++#include "rk2_crypto.h" ++ ++static void rk2_print(struct rk2_crypto_dev *rkc) ++{ ++ u32 v; ++ ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_ST); ++ dev_info(rkc->dev, "DMA_ST %x\n", v); ++ switch (v) { ++ case 0: ++ dev_info(rkc->dev, "DMA_ST: DMA IDLE\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "DMA_ST: DMA BUSY\n"); ++ break; ++ default: ++ dev_err(rkc->dev, "DMA_ST: invalid value\n"); ++ } ++ ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_STATE); ++ dev_info(rkc->dev, "DMA_STATE %x\n", v); ++ ++ switch (v & 0x3) { ++ case 0: ++ dev_info(rkc->dev, "DMA_STATE: DMA DST IDLE\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "DMA_STATE: DMA DST LOAD\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "DMA_STATE: DMA DST WORK\n"); ++ break; ++ default: ++ dev_err(rkc->dev, "DMA DST invalid\n"); ++ break; ++ } ++ switch (v & 0xC) { ++ case 0: ++ dev_info(rkc->dev, "DMA_STATE: DMA SRC IDLE\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "DMA_STATE: DMA SRC LOAD\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "DMA_STATE: DMA SRC WORK\n"); ++ break; ++ default: ++ dev_err(rkc->dev, "DMA_STATE: DMA SRC invalid\n"); ++ break; ++ } ++ switch (v & 0x30) { ++ case 0: ++ dev_info(rkc->dev, "DMA_STATE: DMA LLI IDLE\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "DMA_STATE: DMA LLI LOAD\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "DMA LLI WORK\n"); ++ break; ++ default: ++ dev_err(rkc->dev, "DMA LLI invalid\n"); ++ break; ++ } ++ ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_LLI_RADDR); ++ dev_info(rkc->dev, "DMA_LLI_RADDR %x\n", v); ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_SRC_RADDR); ++ dev_info(rkc->dev, "DMA_SRC_RADDR %x\n", v); ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_DST_WADDR); ++ dev_info(rkc->dev, "DMA_LLI_WADDR %x\n", v); ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_ITEM_ID); ++ dev_info(rkc->dev, "DMA_LLI_ITEMID %x\n", v); ++ ++ v = readl(rkc->reg + RK2_CRYPTO_CIPHER_ST); ++ dev_info(rkc->dev, "CIPHER_ST %x\n", v); ++ if (v & BIT(0)) ++ dev_info(rkc->dev, "CIPHER_ST: BLOCK CIPHER BUSY\n"); ++ else ++ dev_info(rkc->dev, "CIPHER_ST: BLOCK CIPHER IDLE\n"); ++ if (v & BIT(2)) ++ dev_info(rkc->dev, "CIPHER_ST: HASH BUSY\n"); ++ else ++ dev_info(rkc->dev, "CIPHER_ST: HASH IDLE\n"); ++ if (v & BIT(2)) ++ dev_info(rkc->dev, "CIPHER_ST: OTP KEY VALID\n"); ++ else ++ dev_info(rkc->dev, "CIPHER_ST: OTP KEY INVALID\n"); ++ ++ v = readl(rkc->reg + RK2_CRYPTO_CIPHER_STATE); ++ dev_info(rkc->dev, "CIPHER_STATE %x\n", v); ++ switch (v & 0x3) { ++ case 0: ++ dev_info(rkc->dev, "serial: IDLE state\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "serial: PRE state\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "serial: BULK state\n"); ++ break; ++ default: ++ dev_info(rkc->dev, "serial: reserved state\n"); ++ break; ++ } ++ switch (v & 0xC) { ++ case 0: ++ dev_info(rkc->dev, "mac_state: IDLE state\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "mac_state: PRE state\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "mac_state: BULK state\n"); ++ break; ++ default: ++ dev_info(rkc->dev, "mac_state: reserved state\n"); ++ break; ++ } ++ switch (v & 0x30) { ++ case 0: ++ dev_info(rkc->dev, "parallel_state: IDLE state\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "parallel_state: PRE state\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "parallel_state: BULK state\n"); ++ break; ++ default: ++ dev_info(rkc->dev, "parallel_state: reserved state\n"); ++ break; ++ } ++ switch (v & 0xC0) { ++ case 0: ++ dev_info(rkc->dev, "ccm_state: IDLE state\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "ccm_state: PRE state\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "ccm_state: NA state\n"); ++ break; ++ default: ++ dev_info(rkc->dev, "ccm_state: reserved state\n"); ++ break; ++ } ++ switch (v & 0xF00) { ++ case 0: ++ dev_info(rkc->dev, "gcm_state: IDLE state\n"); ++ break; ++ case 1: ++ dev_info(rkc->dev, "gcm_state: PRE state\n"); ++ break; ++ case 2: ++ dev_info(rkc->dev, "gcm_state: NA state\n"); ++ break; ++ case 3: ++ dev_info(rkc->dev, "gcm_state: PC state\n"); ++ break; ++ } ++ switch (v & 0xC00) { ++ case 0x1: ++ dev_info(rkc->dev, "hash_state: IDLE state\n"); ++ break; ++ case 0x2: ++ dev_info(rkc->dev, "hash_state: IPAD state\n"); ++ break; ++ case 0x4: ++ dev_info(rkc->dev, "hash_state: TEXT state\n"); ++ break; ++ case 0x8: ++ dev_info(rkc->dev, "hash_state: OPAD state\n"); ++ break; ++ case 0x10: ++ dev_info(rkc->dev, "hash_state: OPAD EXT state\n"); ++ break; ++ default: ++ dev_info(rkc->dev, "hash_state: invalid state\n"); ++ break; ++ } ++ ++ v = readl(rkc->reg + RK2_CRYPTO_DMA_INT_ST); ++ dev_info(rkc->dev, "RK2_CRYPTO_DMA_INT_ST %x\n", v); ++} ++ ++static int rk2_cipher_need_fallback(struct skcipher_request *req) ++{ ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); ++ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.skcipher.base); ++ struct scatterlist *sgs, *sgd; ++ unsigned int stodo, dtodo, len; ++ unsigned int bs = crypto_skcipher_blocksize(tfm); ++ ++ if (!req->cryptlen) ++ return true; ++ ++ if (algt->is_xts) { ++ if (sg_nents_for_len(req->src, req->cryptlen) > 1) ++ return true; ++ if (sg_nents_for_len(req->dst, req->cryptlen) > 1) ++ return true; ++ } ++ ++ len = req->cryptlen; ++ sgs = req->src; ++ sgd = req->dst; ++ while (sgs && sgd) { ++ if (!IS_ALIGNED(sgs->offset, sizeof(u32))) { ++ algt->stat_fb_align++; ++ return true; ++ } ++ if (!IS_ALIGNED(sgd->offset, sizeof(u32))) { ++ algt->stat_fb_align++; ++ return true; ++ } ++ stodo = min(len, sgs->length); ++ if (stodo % bs) { ++ algt->stat_fb_len++; ++ return true; ++ } ++ dtodo = min(len, sgd->length); ++ if (dtodo % bs) { ++ algt->stat_fb_len++; ++ return true; ++ } ++ if (stodo != dtodo) { ++ algt->stat_fb_sgdiff++; ++ return true; ++ } ++ len -= stodo; ++ sgs = sg_next(sgs); ++ sgd = sg_next(sgd); ++ } ++ return false; ++} ++ ++static int rk2_cipher_fallback(struct skcipher_request *areq) ++{ ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); ++ struct rk2_cipher_ctx *op = crypto_skcipher_ctx(tfm); ++ struct rk2_cipher_rctx *rctx = skcipher_request_ctx(areq); ++ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.skcipher.base); ++ int err; ++ ++ algt->stat_fb++; ++ ++ skcipher_request_set_tfm(&rctx->fallback_req, op->fallback_tfm); ++ skcipher_request_set_callback(&rctx->fallback_req, areq->base.flags, ++ areq->base.complete, areq->base.data); ++ skcipher_request_set_crypt(&rctx->fallback_req, areq->src, areq->dst, ++ areq->cryptlen, areq->iv); ++ if (rctx->mode & RK2_CRYPTO_DEC) ++ err = crypto_skcipher_decrypt(&rctx->fallback_req); ++ else ++ err = crypto_skcipher_encrypt(&rctx->fallback_req); ++ return err; ++} ++ ++static int rk2_cipher_handle_req(struct skcipher_request *req) ++{ ++ struct rk2_cipher_rctx *rctx = skcipher_request_ctx(req); ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); ++ struct rk2_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); ++ struct rk2_crypto_dev *rkc; ++ struct crypto_engine *engine; ++ ++ if (ctx->keylen == AES_KEYSIZE_192 * 2) ++ return rk2_cipher_fallback(req); ++ ++ if (rk2_cipher_need_fallback(req)) ++ return rk2_cipher_fallback(req); ++ ++ rkc = get_rk2_crypto(); ++ ++ engine = rkc->engine; ++ rctx->dev = rkc; ++ ++ return crypto_transfer_skcipher_request_to_engine(engine, req); ++} ++ ++int rk2_aes_xts_setkey(struct crypto_skcipher *cipher, const u8 *key, ++ unsigned int keylen) ++{ ++ struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher); ++ struct rk2_cipher_ctx *ctx = crypto_tfm_ctx(tfm); ++ int err; ++ ++ err = xts_verify_key(cipher, key, keylen); ++ if (err) ++ return err; ++ ++ ctx->keylen = keylen; ++ memcpy(ctx->key, key, keylen); ++ ++ return crypto_skcipher_setkey(ctx->fallback_tfm, key, keylen); ++} ++ ++int rk2_aes_setkey(struct crypto_skcipher *cipher, const u8 *key, ++ unsigned int keylen) ++{ ++ struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher); ++ struct rk2_cipher_ctx *ctx = crypto_tfm_ctx(tfm); ++ ++ if (keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_192 && ++ keylen != AES_KEYSIZE_256) ++ return -EINVAL; ++ ctx->keylen = keylen; ++ memcpy(ctx->key, key, keylen); ++ ++ return crypto_skcipher_setkey(ctx->fallback_tfm, key, keylen); ++} ++ ++int rk2_skcipher_encrypt(struct skcipher_request *req) ++{ ++ struct rk2_cipher_rctx *rctx = skcipher_request_ctx(req); ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); ++ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.skcipher.base); ++ ++ rctx->mode = algt->rk2_mode; ++ return rk2_cipher_handle_req(req); ++} ++ ++int rk2_skcipher_decrypt(struct skcipher_request *req) ++{ ++ struct rk2_cipher_rctx *rctx = skcipher_request_ctx(req); ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); ++ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.skcipher.base); ++ ++ rctx->mode = algt->rk2_mode | RK2_CRYPTO_DEC; ++ return rk2_cipher_handle_req(req); ++} ++ ++int rk2_cipher_run(struct crypto_engine *engine, void *async_req) ++{ ++ struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base); ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); ++ struct rk2_cipher_rctx *rctx = skcipher_request_ctx(areq); ++ struct rk2_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); ++ struct scatterlist *sgs, *sgd; ++ int err = 0; ++ int ivsize = crypto_skcipher_ivsize(tfm); ++ unsigned int len = areq->cryptlen; ++ unsigned int todo; ++ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.skcipher.base); ++ struct rk2_crypto_dev *rkc = rctx->dev; ++ struct rk2_crypto_lli *dd = &rkc->tl[0]; ++ u32 m, v; ++ u32 *rkey = (u32 *)ctx->key; ++ u32 *riv = (u32 *)areq->iv; ++ int i; ++ unsigned int offset; ++ ++ algt->stat_req++; ++ rkc->nreq++; ++ ++ m = rctx->mode | RK2_CRYPTO_ENABLE; ++ if (algt->is_xts) { ++ switch (ctx->keylen) { ++ case AES_KEYSIZE_128 * 2: ++ m |= RK2_CRYPTO_AES_128BIT_key; ++ break; ++ case AES_KEYSIZE_256 * 2: ++ m |= RK2_CRYPTO_AES_256BIT_key; ++ break; ++ default: ++ dev_err(rkc->dev, "Invalid key length %u\n", ctx->keylen); ++ return -EINVAL; ++ } ++ } else { ++ switch (ctx->keylen) { ++ case AES_KEYSIZE_128: ++ m |= RK2_CRYPTO_AES_128BIT_key; ++ break; ++ case AES_KEYSIZE_192: ++ m |= RK2_CRYPTO_AES_192BIT_key; ++ break; ++ case AES_KEYSIZE_256: ++ m |= RK2_CRYPTO_AES_256BIT_key; ++ break; ++ default: ++ dev_err(rkc->dev, "Invalid key length %u\n", ctx->keylen); ++ return -EINVAL; ++ } ++ } ++ ++ err = pm_runtime_resume_and_get(rkc->dev); ++ if (err) ++ return err; ++ ++ /* the upper bits are a write enable mask, so we need to write 1 to all ++ * upper 16 bits to allow write to the 16 lower bits ++ */ ++ m |= 0xffff0000; ++ ++ dev_dbg(rkc->dev, "%s %s len=%u keylen=%u mode=%x\n", __func__, ++ crypto_tfm_alg_name(areq->base.tfm), ++ areq->cryptlen, ctx->keylen, m); ++ sgs = areq->src; ++ sgd = areq->dst; ++ ++ while (sgs && sgd && len) { ++ ivsize = crypto_skcipher_ivsize(tfm); ++ if (areq->iv && crypto_skcipher_ivsize(tfm) > 0) { ++ if (rctx->mode & RK2_CRYPTO_DEC) { ++ offset = sgs->length - ivsize; ++ scatterwalk_map_and_copy(rctx->backup_iv, sgs, ++ offset, ivsize, 0); ++ } ++ } ++ ++ dev_dbg(rkc->dev, "SG len=%u mode=%x ivsize=%u\n", sgs->length, m, ivsize); ++ ++ if (sgs == sgd) { ++ err = dma_map_sg(rkc->dev, sgs, 1, DMA_BIDIRECTIONAL); ++ if (err != 1) { ++ dev_err(rkc->dev, "Invalid sg number %d\n", err); ++ err = -EINVAL; ++ goto theend; ++ } ++ } else { ++ err = dma_map_sg(rkc->dev, sgs, 1, DMA_TO_DEVICE); ++ if (err != 1) { ++ dev_err(rkc->dev, "Invalid sg number %d\n", err); ++ err = -EINVAL; ++ goto theend; ++ } ++ err = dma_map_sg(rkc->dev, sgd, 1, DMA_FROM_DEVICE); ++ if (err != 1) { ++ dev_err(rkc->dev, "Invalid sg number %d\n", err); ++ err = -EINVAL; ++ dma_unmap_sg(rkc->dev, sgs, 1, DMA_TO_DEVICE); ++ goto theend; ++ } ++ } ++ err = 0; ++ writel(m, rkc->reg + RK2_CRYPTO_BC_CTL); ++ ++ if (algt->is_xts) { ++ for (i = 0; i < ctx->keylen / 8; i++) { ++ v = cpu_to_be32(rkey[i]); ++ writel(v, rkc->reg + RK2_CRYPTO_KEY0 + i * 4); ++ } ++ for (i = 0; i < (ctx->keylen / 8); i++) { ++ v = cpu_to_be32(rkey[i + ctx->keylen / 8]); ++ writel(v, rkc->reg + RK2_CRYPTO_CH4_KEY0 + i * 4); ++ } ++ } else { ++ for (i = 0; i < ctx->keylen / 4; i++) { ++ v = cpu_to_be32(rkey[i]); ++ writel(v, rkc->reg + RK2_CRYPTO_KEY0 + i * 4); ++ } ++ } ++ ++ if (ivsize) { ++ for (i = 0; i < ivsize / 4; i++) ++ writel(cpu_to_be32(riv[i]), ++ rkc->reg + RK2_CRYPTO_CH0_IV_0 + i * 4); ++ writel(ivsize, rkc->reg + RK2_CRYPTO_CH0_IV_LEN); ++ } ++ if (!sgs->length) { ++ sgs = sg_next(sgs); ++ sgd = sg_next(sgd); ++ continue; ++ } ++ ++ /* The hw support multiple descriptor, so why this driver use ++ * only one descriptor ? ++ * Using one descriptor per SG seems the way to do and it works ++ * but only when doing encryption. ++ * With decryption it always fail on second descriptor. ++ * Probably the HW dont know how to use IV. ++ */ ++ todo = min(sg_dma_len(sgs), len); ++ len -= todo; ++ dd->src_addr = sg_dma_address(sgs); ++ dd->src_len = todo; ++ dd->dst_addr = sg_dma_address(sgd); ++ dd->dst_len = todo; ++ dd->iv = 0; ++ dd->next = 1; ++ ++ dd->user = RK2_LLI_CIPHER_START | RK2_LLI_STRING_FIRST | RK2_LLI_STRING_LAST; ++ dd->dma_ctrl |= RK2_LLI_DMA_CTRL_DST_INT | RK2_LLI_DMA_CTRL_LAST; ++ ++ writel(RK2_CRYPTO_DMA_INT_LISTDONE | 0x7F, rkc->reg + RK2_CRYPTO_DMA_INT_EN); ++ ++ /*writel(0x00030000, rkc->reg + RK2_CRYPTO_FIFO_CTL);*/ ++ writel(rkc->t_phy, rkc->reg + RK2_CRYPTO_DMA_LLI_ADDR); ++ ++ reinit_completion(&rkc->complete); ++ rkc->status = 0; ++ ++ writel(RK2_CRYPTO_DMA_CTL_START | 1 << 16, rkc->reg + RK2_CRYPTO_DMA_CTL); ++ ++ wait_for_completion_interruptible_timeout(&rkc->complete, ++ msecs_to_jiffies(10000)); ++ if (sgs == sgd) { ++ dma_unmap_sg(rkc->dev, sgs, 1, DMA_BIDIRECTIONAL); ++ } else { ++ dma_unmap_sg(rkc->dev, sgs, 1, DMA_TO_DEVICE); ++ dma_unmap_sg(rkc->dev, sgd, 1, DMA_FROM_DEVICE); ++ } ++ ++ if (!rkc->status) { ++ dev_err(rkc->dev, "DMA timeout\n"); ++ rk2_print(rkc); ++ err = -EFAULT; ++ goto theend; ++ } ++ if (areq->iv && ivsize > 0) { ++ offset = sgd->length - ivsize; ++ if (rctx->mode & RK2_CRYPTO_DEC) { ++ memcpy(areq->iv, rctx->backup_iv, ivsize); ++ memzero_explicit(rctx->backup_iv, ivsize); ++ } else { ++ scatterwalk_map_and_copy(areq->iv, sgd, offset, ++ ivsize, 0); ++ } ++ } ++ sgs = sg_next(sgs); ++ sgd = sg_next(sgd); ++ } ++theend: ++ writel(0xffff0000, rkc->reg + RK2_CRYPTO_BC_CTL); ++ pm_runtime_put_autosuspend(rkc->dev); ++ ++ local_bh_disable(); ++ crypto_finalize_skcipher_request(engine, areq, err); ++ local_bh_enable(); ++ return 0; ++} ++ ++int rk2_cipher_tfm_init(struct crypto_skcipher *tfm) ++{ ++ struct rk2_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); ++ const char *name = crypto_tfm_alg_name(&tfm->base); ++ struct skcipher_alg *alg = crypto_skcipher_alg(tfm); ++ struct rk2_crypto_template *algt = container_of(alg, struct rk2_crypto_template, alg.skcipher.base); ++ ++ ctx->fallback_tfm = crypto_alloc_skcipher(name, 0, CRYPTO_ALG_NEED_FALLBACK); ++ if (IS_ERR(ctx->fallback_tfm)) { ++ dev_err(algt->dev->dev, "ERROR: Cannot allocate fallback for %s %ld\n", ++ name, PTR_ERR(ctx->fallback_tfm)); ++ return PTR_ERR(ctx->fallback_tfm); ++ } ++ ++ dev_info(algt->dev->dev, "Fallback for %s is %s\n", ++ crypto_tfm_alg_driver_name(&tfm->base), ++ crypto_tfm_alg_driver_name(crypto_skcipher_tfm(ctx->fallback_tfm))); ++ ++ tfm->reqsize = sizeof(struct rk2_cipher_rctx) + ++ crypto_skcipher_reqsize(ctx->fallback_tfm); ++ ++ return 0; ++} ++ ++void rk2_cipher_tfm_exit(struct crypto_skcipher *tfm) ++{ ++ struct rk2_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); ++ ++ memzero_explicit(ctx->key, ctx->keylen); ++ crypto_free_skcipher(ctx->fallback_tfm); ++} +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0025-RK3588-Add-HW-RNG-Support.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0025-RK3588-Add-HW-RNG-Support.patch new file mode 100644 index 000000000000..ef9b7791121b --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0025-RK3588-Add-HW-RNG-Support.patch @@ -0,0 +1,663 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Thu, 16 Nov 2023 17:49:42 +0300 +Subject: hwrng: rockchip: Add support for Rockchip HW RNG + +--- + drivers/char/hw_random/Kconfig | 13 + + drivers/char/hw_random/Makefile | 1 + + drivers/char/hw_random/rockchip-rng.c | 574 ++++++++++ + 3 files changed, 588 insertions(+) + +diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -538,6 +538,19 @@ config HW_RANDOM_XIPHERA + To compile this driver as a module, choose M here: the + module will be called xiphera-trng. + ++config HW_RANDOM_ROCKCHIP ++ tristate "Rockchip Random Number Generator support" ++ depends on ARCH_ROCKCHIP ++ default HW_RANDOM ++ help ++ This driver provides kernel-side support for the Random Number ++ Generator hardware found on Rockchip cpus. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called rockchip-rng. ++ ++ If unsure, say Y. ++ + config HW_RANDOM_ARM_SMCCC_TRNG + tristate "Arm SMCCC TRNG firmware interface support" + depends on HAVE_ARM_SMCCC_DISCOVERY +diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/char/hw_random/Makefile ++++ b/drivers/char/hw_random/Makefile +@@ -35,6 +35,7 @@ obj-$(CONFIG_HW_RANDOM_IPROC_RNG200) += iproc-rng200.o + obj-$(CONFIG_HW_RANDOM_ST) += st-rng.o + obj-$(CONFIG_HW_RANDOM_XGENE) += xgene-rng.o + obj-$(CONFIG_HW_RANDOM_STM32) += stm32-rng.o ++obj-$(CONFIG_HW_RANDOM_ROCKCHIP) += rockchip-rng.o + obj-$(CONFIG_HW_RANDOM_PIC32) += pic32-rng.o + obj-$(CONFIG_HW_RANDOM_MESON) += meson-rng.o + obj-$(CONFIG_HW_RANDOM_CAVIUM) += cavium-rng.o cavium-rng-vf.o +diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/char/hw_random/rockchip-rng.c +@@ -0,0 +1,574 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * rockchip-rng.c Random Number Generator driver for the Rockchip ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd. ++ * Author: Lin Jinhan ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define _SBF(s, v) ((v) << (s)) ++#define HIWORD_UPDATE(val, mask, shift) \ ++ ((val) << (shift) | (mask) << ((shift) + 16)) ++ ++#define ROCKCHIP_AUTOSUSPEND_DELAY 100 ++#define ROCKCHIP_POLL_PERIOD_US 100 ++#define ROCKCHIP_POLL_TIMEOUT_US 50000 ++#define RK_MAX_RNG_BYTE (32) ++ ++/* start of CRYPTO V1 register define */ ++#define CRYPTO_V1_CTRL 0x0008 ++#define CRYPTO_V1_RNG_START BIT(8) ++#define CRYPTO_V1_RNG_FLUSH BIT(9) ++ ++#define CRYPTO_V1_TRNG_CTRL 0x0200 ++#define CRYPTO_V1_OSC_ENABLE BIT(16) ++#define CRYPTO_V1_TRNG_SAMPLE_PERIOD(x) (x) ++ ++#define CRYPTO_V1_TRNG_DOUT_0 0x0204 ++/* end of CRYPTO V1 register define */ ++ ++/* start of CRYPTO V2 register define */ ++#define CRYPTO_V2_RNG_DEFAULT_OFFSET 0x0400 ++#define CRYPTO_V2_RNG_CTL 0x0 ++#define CRYPTO_V2_RNG_64_BIT_LEN _SBF(4, 0x00) ++#define CRYPTO_V2_RNG_128_BIT_LEN _SBF(4, 0x01) ++#define CRYPTO_V2_RNG_192_BIT_LEN _SBF(4, 0x02) ++#define CRYPTO_V2_RNG_256_BIT_LEN _SBF(4, 0x03) ++#define CRYPTO_V2_RNG_FATESY_SOC_RING _SBF(2, 0x00) ++#define CRYPTO_V2_RNG_SLOWER_SOC_RING_0 _SBF(2, 0x01) ++#define CRYPTO_V2_RNG_SLOWER_SOC_RING_1 _SBF(2, 0x02) ++#define CRYPTO_V2_RNG_SLOWEST_SOC_RING _SBF(2, 0x03) ++#define CRYPTO_V2_RNG_ENABLE BIT(1) ++#define CRYPTO_V2_RNG_START BIT(0) ++#define CRYPTO_V2_RNG_SAMPLE_CNT 0x0004 ++#define CRYPTO_V2_RNG_DOUT_0 0x0010 ++/* end of CRYPTO V2 register define */ ++ ++/* start of TRNG_V1 register define */ ++/* TRNG is no longer subordinate to the Crypto module */ ++#define TRNG_V1_CTRL 0x0000 ++#define TRNG_V1_CTRL_NOP _SBF(0, 0x00) ++#define TRNG_V1_CTRL_RAND _SBF(0, 0x01) ++#define TRNG_V1_CTRL_SEED _SBF(0, 0x02) ++ ++#define TRNG_V1_STAT 0x0004 ++#define TRNG_V1_STAT_SEEDED BIT(9) ++#define TRNG_V1_STAT_GENERATING BIT(30) ++#define TRNG_V1_STAT_RESEEDING BIT(31) ++ ++#define TRNG_V1_MODE 0x0008 ++#define TRNG_V1_MODE_128_BIT _SBF(3, 0x00) ++#define TRNG_V1_MODE_256_BIT _SBF(3, 0x01) ++ ++#define TRNG_V1_IE 0x0010 ++#define TRNG_V1_IE_GLBL_EN BIT(31) ++#define TRNG_V1_IE_SEED_DONE_EN BIT(1) ++#define TRNG_V1_IE_RAND_RDY_EN BIT(0) ++ ++#define TRNG_V1_ISTAT 0x0014 ++#define TRNG_V1_ISTAT_RAND_RDY BIT(0) ++ ++/* RAND0 ~ RAND7 */ ++#define TRNG_V1_RAND0 0x0020 ++#define TRNG_V1_RAND7 0x003C ++ ++#define TRNG_V1_AUTO_RQSTS 0x0060 ++ ++#define TRNG_V1_VERSION 0x00F0 ++#define TRNG_v1_VERSION_CODE 0x46bc ++/* end of TRNG_V1 register define */ ++ ++/* start of RKRNG register define */ ++#define RKRNG_CTRL 0x0010 ++#define RKRNG_CTRL_INST_REQ BIT(0) ++#define RKRNG_CTRL_RESEED_REQ BIT(1) ++#define RKRNG_CTRL_TEST_REQ BIT(2) ++#define RKRNG_CTRL_SW_DRNG_REQ BIT(3) ++#define RKRNG_CTRL_SW_TRNG_REQ BIT(4) ++ ++#define RKRNG_STATE 0x0014 ++#define RKRNG_STATE_INST_ACK BIT(0) ++#define RKRNG_STATE_RESEED_ACK BIT(1) ++#define RKRNG_STATE_TEST_ACK BIT(2) ++#define RKRNG_STATE_SW_DRNG_ACK BIT(3) ++#define RKRNG_STATE_SW_TRNG_ACK BIT(4) ++ ++/* DRNG_DATA_0 ~ DNG_DATA_7 */ ++#define RKRNG_DRNG_DATA_0 0x0070 ++#define RKRNG_DRNG_DATA_7 0x008C ++ ++/* end of RKRNG register define */ ++ ++struct rk_rng_soc_data { ++ u32 default_offset; ++ ++ int (*rk_rng_init)(struct hwrng *rng); ++ int (*rk_rng_read)(struct hwrng *rng, void *buf, size_t max, bool wait); ++}; ++ ++struct rk_rng { ++ struct device *dev; ++ struct hwrng rng; ++ void __iomem *mem; ++ struct rk_rng_soc_data *soc_data; ++ int clk_num; ++ struct clk_bulk_data *clk_bulks; ++}; ++ ++static void rk_rng_writel(struct rk_rng *rng, u32 val, u32 offset) ++{ ++ __raw_writel(val, rng->mem + offset); ++} ++ ++static u32 rk_rng_readl(struct rk_rng *rng, u32 offset) ++{ ++ return __raw_readl(rng->mem + offset); ++} ++ ++static int rk_rng_init(struct hwrng *rng) ++{ ++ int ret; ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ dev_dbg(rk_rng->dev, "clk_bulk_prepare_enable.\n"); ++ ++ ret = clk_bulk_prepare_enable(rk_rng->clk_num, rk_rng->clk_bulks); ++ if (ret < 0) { ++ dev_err(rk_rng->dev, "failed to enable clks %d\n", ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static void rk_rng_cleanup(struct hwrng *rng) ++{ ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ dev_dbg(rk_rng->dev, "clk_bulk_disable_unprepare.\n"); ++ clk_bulk_disable_unprepare(rk_rng->clk_num, rk_rng->clk_bulks); ++} ++ ++static int rk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) ++{ ++ int ret; ++ int read_len = 0; ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ if (!rk_rng->soc_data->rk_rng_read) ++ return -EFAULT; ++ ++ ret = pm_runtime_get_sync(rk_rng->dev); ++ if (ret < 0) { ++ pm_runtime_put_noidle(rk_rng->dev); ++ return ret; ++ } ++ ++ ret = 0; ++ while (max > ret) { ++ read_len = rk_rng->soc_data->rk_rng_read(rng, buf + ret, ++ max - ret, wait); ++ if (read_len < 0) { ++ ret = read_len; ++ break; ++ } ++ ret += read_len; ++ } ++ ++ pm_runtime_mark_last_busy(rk_rng->dev); ++ pm_runtime_put_sync_autosuspend(rk_rng->dev); ++ ++ return ret; ++} ++ ++static void rk_rng_read_regs(struct rk_rng *rng, u32 offset, void *buf, ++ size_t size) ++{ ++ u32 i; ++ ++ for (i = 0; i < size; i += 4) ++ *(u32 *)(buf + i) = be32_to_cpu(rk_rng_readl(rng, offset + i)); ++} ++ ++static int crypto_v1_read(struct hwrng *rng, void *buf, size_t max, bool wait) ++{ ++ int ret = 0; ++ u32 reg_ctrl = 0; ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ /* enable osc_ring to get entropy, sample period is set as 100 */ ++ reg_ctrl = CRYPTO_V1_OSC_ENABLE | CRYPTO_V1_TRNG_SAMPLE_PERIOD(100); ++ rk_rng_writel(rk_rng, reg_ctrl, CRYPTO_V1_TRNG_CTRL); ++ ++ reg_ctrl = HIWORD_UPDATE(CRYPTO_V1_RNG_START, CRYPTO_V1_RNG_START, 0); ++ ++ rk_rng_writel(rk_rng, reg_ctrl, CRYPTO_V1_CTRL); ++ ++ ret = read_poll_timeout(rk_rng_readl, reg_ctrl, ++ !(reg_ctrl & CRYPTO_V1_RNG_START), ++ ROCKCHIP_POLL_PERIOD_US, ++ ROCKCHIP_POLL_TIMEOUT_US, false, ++ rk_rng, CRYPTO_V1_CTRL); ++ ++ if (ret < 0) ++ goto out; ++ ++ ret = min_t(size_t, max, RK_MAX_RNG_BYTE); ++ ++ rk_rng_read_regs(rk_rng, CRYPTO_V1_TRNG_DOUT_0, buf, ret); ++ ++out: ++ /* close TRNG */ ++ rk_rng_writel(rk_rng, HIWORD_UPDATE(0, CRYPTO_V1_RNG_START, 0), ++ CRYPTO_V1_CTRL); ++ ++ return ret; ++} ++ ++static int crypto_v2_read(struct hwrng *rng, void *buf, size_t max, bool wait) ++{ ++ int ret = 0; ++ u32 reg_ctrl = 0; ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ /* enable osc_ring to get entropy, sample period is set as 100 */ ++ rk_rng_writel(rk_rng, 100, CRYPTO_V2_RNG_SAMPLE_CNT); ++ ++ reg_ctrl |= CRYPTO_V2_RNG_256_BIT_LEN; ++ reg_ctrl |= CRYPTO_V2_RNG_SLOWER_SOC_RING_0; ++ reg_ctrl |= CRYPTO_V2_RNG_ENABLE; ++ reg_ctrl |= CRYPTO_V2_RNG_START; ++ ++ rk_rng_writel(rk_rng, HIWORD_UPDATE(reg_ctrl, 0xffff, 0), ++ CRYPTO_V2_RNG_CTL); ++ ++ ret = read_poll_timeout(rk_rng_readl, reg_ctrl, ++ !(reg_ctrl & CRYPTO_V2_RNG_START), ++ ROCKCHIP_POLL_PERIOD_US, ++ ROCKCHIP_POLL_TIMEOUT_US, false, ++ rk_rng, CRYPTO_V2_RNG_CTL); ++ if (ret < 0) ++ goto out; ++ ++ ret = min_t(size_t, max, RK_MAX_RNG_BYTE); ++ ++ rk_rng_read_regs(rk_rng, CRYPTO_V2_RNG_DOUT_0, buf, ret); ++ ++out: ++ /* close TRNG */ ++ rk_rng_writel(rk_rng, HIWORD_UPDATE(0, 0xffff, 0), CRYPTO_V2_RNG_CTL); ++ ++ return ret; ++} ++ ++static int trng_v1_init(struct hwrng *rng) ++{ ++ int ret; ++ uint32_t auto_reseed_cnt = 1000; ++ uint32_t reg_ctrl, status, version; ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ version = rk_rng_readl(rk_rng, TRNG_V1_VERSION); ++ if (version != TRNG_v1_VERSION_CODE) { ++ dev_err(rk_rng->dev, ++ "wrong trng version, expected = %08x, actual = %08x\n", ++ TRNG_V1_VERSION, version); ++ ret = -EFAULT; ++ goto exit; ++ } ++ ++ status = rk_rng_readl(rk_rng, TRNG_V1_STAT); ++ ++ /* TRNG should wait RAND_RDY triggered if it is busy or not seeded */ ++ if (!(status & TRNG_V1_STAT_SEEDED) || ++ (status & TRNG_V1_STAT_GENERATING) || ++ (status & TRNG_V1_STAT_RESEEDING)) { ++ uint32_t mask = TRNG_V1_STAT_SEEDED | ++ TRNG_V1_STAT_GENERATING | ++ TRNG_V1_STAT_RESEEDING; ++ ++ udelay(10); ++ ++ /* wait for GENERATING and RESEEDING flag to clear */ ++ read_poll_timeout(rk_rng_readl, reg_ctrl, ++ (reg_ctrl & mask) == TRNG_V1_STAT_SEEDED, ++ ROCKCHIP_POLL_PERIOD_US, ++ ROCKCHIP_POLL_TIMEOUT_US, false, ++ rk_rng, TRNG_V1_STAT); ++ } ++ ++ /* clear ISTAT flag because trng may auto reseeding when power on */ ++ reg_ctrl = rk_rng_readl(rk_rng, TRNG_V1_ISTAT); ++ rk_rng_writel(rk_rng, reg_ctrl, TRNG_V1_ISTAT); ++ ++ /* auto reseed after (auto_reseed_cnt * 16) byte rand generate */ ++ rk_rng_writel(rk_rng, auto_reseed_cnt, TRNG_V1_AUTO_RQSTS); ++ ++ ret = 0; ++exit: ++ ++ return ret; ++} ++ ++static int trng_v1_read(struct hwrng *rng, void *buf, size_t max, bool wait) ++{ ++ int ret = 0; ++ u32 reg_ctrl = 0; ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ ++ /* clear ISTAT anyway */ ++ reg_ctrl = rk_rng_readl(rk_rng, TRNG_V1_ISTAT); ++ rk_rng_writel(rk_rng, reg_ctrl, TRNG_V1_ISTAT); ++ ++ /* generate 256bit random */ ++ rk_rng_writel(rk_rng, TRNG_V1_MODE_256_BIT, TRNG_V1_MODE); ++ rk_rng_writel(rk_rng, TRNG_V1_CTRL_RAND, TRNG_V1_CTRL); ++ ++ /* ++ * Generate2 56 bit random data will cost 1024 clock cycles. ++ * Estimated at 150M RNG module frequency, it takes 6.7 microseconds. ++ */ ++ udelay(10); ++ reg_ctrl = rk_rng_readl(rk_rng, TRNG_V1_ISTAT); ++ if (!(reg_ctrl & TRNG_V1_ISTAT_RAND_RDY)) { ++ /* wait RAND_RDY triggered */ ++ ret = read_poll_timeout(rk_rng_readl, reg_ctrl, ++ (reg_ctrl & TRNG_V1_ISTAT_RAND_RDY), ++ ROCKCHIP_POLL_PERIOD_US, ++ ROCKCHIP_POLL_TIMEOUT_US, false, ++ rk_rng, TRNG_V1_ISTAT); ++ if (ret < 0) ++ goto out; ++ } ++ ++ ret = min_t(size_t, max, RK_MAX_RNG_BYTE); ++ ++ rk_rng_read_regs(rk_rng, TRNG_V1_RAND0, buf, ret); ++ ++ /* clear all status flag */ ++ rk_rng_writel(rk_rng, reg_ctrl, TRNG_V1_ISTAT); ++out: ++ /* close TRNG */ ++ rk_rng_writel(rk_rng, TRNG_V1_CTRL_NOP, TRNG_V1_CTRL); ++ ++ return ret; ++} ++ ++static int rkrng_init(struct hwrng *rng) ++{ ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ u32 reg = 0; ++ ++ rk_rng_writel(rk_rng, HIWORD_UPDATE(0, 0xffff, 0), RKRNG_CTRL); ++ ++ reg = rk_rng_readl(rk_rng, RKRNG_STATE); ++ rk_rng_writel(rk_rng, reg, RKRNG_STATE); ++ ++ return 0; ++} ++ ++static int rkrng_read(struct hwrng *rng, void *buf, size_t max, bool wait) ++{ ++ struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); ++ u32 reg_ctrl = 0; ++ int ret; ++ ++ reg_ctrl = RKRNG_CTRL_SW_DRNG_REQ; ++ ++ rk_rng_writel(rk_rng, HIWORD_UPDATE(reg_ctrl, 0xffff, 0), RKRNG_CTRL); ++ ++ ret = readl_poll_timeout(rk_rng->mem + RKRNG_STATE, reg_ctrl, ++ (reg_ctrl & RKRNG_STATE_SW_DRNG_ACK), ++ ROCKCHIP_POLL_PERIOD_US, ++ ROCKCHIP_POLL_TIMEOUT_US); ++ ++ if (ret) ++ goto exit; ++ ++ rk_rng_writel(rk_rng, reg_ctrl, RKRNG_STATE); ++ ++ ret = min_t(size_t, max, RK_MAX_RNG_BYTE); ++ ++ rk_rng_read_regs(rk_rng, RKRNG_DRNG_DATA_0, buf, ret); ++ ++exit: ++ /* close TRNG */ ++ rk_rng_writel(rk_rng, HIWORD_UPDATE(0, 0xffff, 0), RKRNG_CTRL); ++ ++ return ret; ++} ++ ++static const struct rk_rng_soc_data crypto_v1_soc_data = { ++ .default_offset = 0, ++ ++ .rk_rng_read = crypto_v1_read, ++}; ++ ++static const struct rk_rng_soc_data crypto_v2_soc_data = { ++ .default_offset = CRYPTO_V2_RNG_DEFAULT_OFFSET, ++ ++ .rk_rng_read = crypto_v2_read, ++}; ++ ++static const struct rk_rng_soc_data trng_v1_soc_data = { ++ .default_offset = 0, ++ ++ .rk_rng_init = trng_v1_init, ++ .rk_rng_read = trng_v1_read, ++}; ++ ++static const struct rk_rng_soc_data rkrng_soc_data = { ++ .default_offset = 0, ++ ++ .rk_rng_init = rkrng_init, ++ .rk_rng_read = rkrng_read, ++}; ++ ++static const struct of_device_id rk_rng_dt_match[] = { ++ { ++ .compatible = "rockchip,cryptov1-rng", ++ .data = (void *)&crypto_v1_soc_data, ++ }, ++ { ++ .compatible = "rockchip,cryptov2-rng", ++ .data = (void *)&crypto_v2_soc_data, ++ }, ++ { ++ .compatible = "rockchip,trngv1", ++ .data = (void *)&trng_v1_soc_data, ++ }, ++ { ++ .compatible = "rockchip,rkrng", ++ .data = (void *)&rkrng_soc_data, ++ }, ++ { }, ++}; ++ ++MODULE_DEVICE_TABLE(of, rk_rng_dt_match); ++ ++static int rk_rng_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct rk_rng *rk_rng; ++ struct device_node *np = pdev->dev.of_node; ++ const struct of_device_id *match; ++ resource_size_t map_size; ++ ++ dev_dbg(&pdev->dev, "probing...\n"); ++ rk_rng = devm_kzalloc(&pdev->dev, sizeof(struct rk_rng), GFP_KERNEL); ++ if (!rk_rng) ++ return -ENOMEM; ++ ++ match = of_match_node(rk_rng_dt_match, np); ++ rk_rng->soc_data = (struct rk_rng_soc_data *)match->data; ++ ++ rk_rng->dev = &pdev->dev; ++ rk_rng->rng.name = "rockchip"; ++#ifndef CONFIG_PM ++ rk_rng->rng.init = rk_rng_init; ++ rk_rng->rng.cleanup = rk_rng_cleanup, ++#endif ++ rk_rng->rng.read = rk_rng_read; ++ rk_rng->rng.quality = 999; ++ ++ rk_rng->mem = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, &map_size); ++ if (IS_ERR(rk_rng->mem)) ++ return PTR_ERR(rk_rng->mem); ++ ++ /* compatible with crypto v2 module */ ++ /* ++ * With old dtsi configurations, the RNG base was equal to the crypto ++ * base, so both drivers could not be enabled at the same time. ++ * RNG base = CRYPTO base + RNG offset ++ * (Since RK356X, RNG module is no longer belongs to CRYPTO module) ++ * ++ * With new dtsi configurations, CRYPTO regs is divided into two parts ++ * |---cipher---|---rng---|---pka---|, and RNG base is real RNG base. ++ * RNG driver and CRYPTO driver could be enabled at the same time. ++ */ ++ if (map_size > rk_rng->soc_data->default_offset) ++ rk_rng->mem += rk_rng->soc_data->default_offset; ++ ++ rk_rng->clk_num = devm_clk_bulk_get_all(&pdev->dev, &rk_rng->clk_bulks); ++ if (rk_rng->clk_num < 0) { ++ dev_err(&pdev->dev, "failed to get clks property\n"); ++ return -ENODEV; ++ } ++ ++ platform_set_drvdata(pdev, rk_rng); ++ ++ pm_runtime_set_autosuspend_delay(&pdev->dev, ++ ROCKCHIP_AUTOSUSPEND_DELAY); ++ pm_runtime_use_autosuspend(&pdev->dev); ++ pm_runtime_enable(&pdev->dev); ++ ++ ret = devm_hwrng_register(&pdev->dev, &rk_rng->rng); ++ if (ret) { ++ pm_runtime_dont_use_autosuspend(&pdev->dev); ++ pm_runtime_disable(&pdev->dev); ++ } ++ ++ /* for some platform need hardware operation when probe */ ++ if (rk_rng->soc_data->rk_rng_init) { ++ pm_runtime_get_sync(rk_rng->dev); ++ ++ ret = rk_rng->soc_data->rk_rng_init(&rk_rng->rng); ++ ++ pm_runtime_mark_last_busy(rk_rng->dev); ++ pm_runtime_put_sync_autosuspend(rk_rng->dev); ++ } ++ ++ return ret; ++} ++ ++#ifdef CONFIG_PM ++static int rk_rng_runtime_suspend(struct device *dev) ++{ ++ struct rk_rng *rk_rng = dev_get_drvdata(dev); ++ ++ rk_rng_cleanup(&rk_rng->rng); ++ ++ return 0; ++} ++ ++static int rk_rng_runtime_resume(struct device *dev) ++{ ++ struct rk_rng *rk_rng = dev_get_drvdata(dev); ++ ++ return rk_rng_init(&rk_rng->rng); ++} ++ ++static const struct dev_pm_ops rk_rng_pm_ops = { ++ SET_RUNTIME_PM_OPS(rk_rng_runtime_suspend, ++ rk_rng_runtime_resume, NULL) ++ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ++ pm_runtime_force_resume) ++}; ++ ++#endif ++ ++static struct platform_driver rk_rng_driver = { ++ .driver = { ++ .name = "rockchip-rng", ++#ifdef CONFIG_PM ++ .pm = &rk_rng_pm_ops, ++#endif ++ .of_match_table = rk_rng_dt_match, ++ }, ++ .probe = rk_rng_probe, ++}; ++ ++module_platform_driver(rk_rng_driver); ++ ++MODULE_DESCRIPTION("ROCKCHIP H/W Random Number Generator driver"); ++MODULE_AUTHOR("Lin Jinhan "); ++MODULE_LICENSE("GPL v2"); +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Fri, 2 Aug 2024 00:10:39 +0300 +Subject: arm64: dts: rockchip: rk3588: enable RNG node + +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1774,6 +1774,16 @@ crypto: crypto@fe370000 { + reset-names = "core"; + }; + ++ rng: rng@fe378000 { ++ compatible = "rockchip,trngv1"; ++ reg = <0x0 0xfe378000 0x0 0x200>; ++ interrupts = ; ++ clocks = <&scmi_clk SCMI_HCLK_SECURE_NS>; ++ clock-names = "hclk_trng"; ++ resets = <&scmi_reset SRST_H_TRNG_NS>; ++ reset-names = "reset"; ++ }; ++ + i2s0_8ch: i2s@fe470000 { + compatible = "rockchip,rk3588-i2s-tdm"; + reg = <0x0 0xfe470000 0x0 0x1000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0026-RK3588-Add-VPU121-H.264-Decoder-Support.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0026-RK3588-Add-VPU121-H.264-Decoder-Support.patch new file mode 100644 index 000000000000..35298c4c4663 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0026-RK3588-Add-VPU121-H.264-Decoder-Support.patch @@ -0,0 +1,395 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Emmanuel Gil Peyrot +Date: Thu, 18 Apr 2024 16:15:05 +0200 +Subject: media: dt-bindings: rk3568-vepu: Add RK3588 VEPU121 + +This encoder-only device is present four times on this SoC, and should +support everything the rk3568 vepu supports (so JPEG, H.264 and VP8 +encoding). No fallback compatible has been added, since the operating +systems might already support RK3568 VEPU and want to avoid registering +four of them separately considering they can be used as a cluster. + +Signed-off-by: Emmanuel Gil Peyrot +Acked-by: Conor Dooley +Signed-off-by: Sebastian Reichel +--- + Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml ++++ b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml +@@ -17,6 +17,7 @@ properties: + compatible: + enum: + - rockchip,rk3568-vepu ++ - rockchip,rk3588-vepu121 + + reg: + maxItems: 1 +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Tue, 30 Apr 2024 10:40:01 +0800 +Subject: media: dt-bindings: rockchip-vpu: Add RK3588 VPU121 + +RK3588 has four Hantro H1 VEPUs (encoder-only) modules and one combined +Hantro H1/G1 VPU (decoder and encoder). These are not described as +separate IP, since they are sharing an internal cache. This adds the +RK3588 specific compatible string for the combined VPU, which seems to +be identical to the version found in the RK3568. + +Signed-off-by: Jianfeng Liu +Acked-by: Conor Dooley +Signed-off-by: Sebastian Reichel +--- + Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml ++++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml +@@ -31,6 +31,9 @@ properties: + - items: + - const: rockchip,rk3228-vpu + - const: rockchip,rk3399-vpu ++ - items: ++ - const: rockchip,rk3588-vpu121 ++ - const: rockchip,rk3568-vpu + + reg: + maxItems: 1 +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Thu, 13 Jun 2024 14:29:55 +0200 +Subject: media: hantro: Disable multicore support + +Avoid exposing equal Hantro video codecs to userspace. Equal video +codecs allow scheduling work between the cores. For that kernel support +is required, which does not yet exist. Until that is implemented avoid +exposing each core separately to userspace so that multicore can be +added in the future without breaking userspace ABI. + +This was written with Rockchip RK3588 in mind (which has 4 Hantro H1 +cores), but applies to all SoCs. + +Signed-off-by: Sebastian Reichel +--- + drivers/media/platform/verisilicon/hantro_drv.c | 47 ++++++++++ + 1 file changed, 47 insertions(+) + +diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/verisilicon/hantro_drv.c ++++ b/drivers/media/platform/verisilicon/hantro_drv.c +@@ -992,6 +992,49 @@ static const struct media_device_ops hantro_m2m_media_ops = { + .req_queue = v4l2_m2m_request_queue, + }; + ++/* ++ * Some SoCs, like RK3588 have multiple identical Hantro cores, but the ++ * kernel is currently missing support for multi-core handling. Exposing ++ * separate devices for each core to userspace is bad, since that does ++ * not allow scheduling tasks properly (and creates ABI). With this workaround ++ * the driver will only probe for the first core and early exit for the other ++ * cores. Once the driver gains multi-core support, the same technique ++ * for detecting the main core can be used to cluster all cores together. ++ */ ++static int hantro_disable_multicore(struct hantro_dev *vpu) ++{ ++ struct device_node *node = NULL; ++ const char *compatible; ++ bool is_main_core; ++ int ret; ++ ++ /* Intentionally ignores the fallback strings */ ++ ret = of_property_read_string(vpu->dev->of_node, "compatible", &compatible); ++ if (ret) ++ return ret; ++ ++ /* The first compatible and available node found is considered the main core */ ++ do { ++ node = of_find_compatible_node(node, NULL, compatible); ++ if (of_device_is_available(node)) ++ break; ++ } while (node); ++ ++ if (!node) ++ return -EINVAL; ++ ++ is_main_core = (vpu->dev->of_node == node); ++ ++ of_node_put(node); ++ ++ if (!is_main_core) { ++ dev_info(vpu->dev, "missing multi-core support, ignoring this instance\n"); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ + static int hantro_probe(struct platform_device *pdev) + { + const struct of_device_id *match; +@@ -1011,6 +1054,10 @@ static int hantro_probe(struct platform_device *pdev) + match = of_match_node(of_hantro_match, pdev->dev.of_node); + vpu->variant = match->data; + ++ ret = hantro_disable_multicore(vpu); ++ if (ret) ++ return ret; ++ + /* + * Support for nxp,imx8mq-vpu is kept for backwards compatibility + * but it's deprecated. Please update your DTS file to use +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Thu, 13 Jun 2024 14:48:43 +0200 +Subject: media: hantro: Add RK3588 VEPU121 + +RK3588 handling is exactly the same as RK3568. This is not +handled using fallback compatibles to avoid exposing multiple +video devices on kernels not having the multicore disable +patch. + +Signed-off-by: Sebastian Reichel +--- + drivers/media/platform/verisilicon/hantro_drv.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/verisilicon/hantro_drv.c ++++ b/drivers/media/platform/verisilicon/hantro_drv.c +@@ -722,6 +722,7 @@ static const struct of_device_id of_hantro_match[] = { + { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, + { .compatible = "rockchip,rk3568-vepu", .data = &rk3568_vepu_variant, }, + { .compatible = "rockchip,rk3568-vpu", .data = &rk3568_vpu_variant, }, ++ { .compatible = "rockchip,rk3588-vepu121", .data = &rk3568_vepu_variant, }, + { .compatible = "rockchip,rk3588-av1-vpu", .data = &rk3588_vpu981_variant, }, + #endif + #ifdef CONFIG_VIDEO_HANTRO_IMX8M +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Emmanuel Gil Peyrot +Date: Wed, 5 Jun 2024 15:28:33 +0200 +Subject: arm64: dts: rockchip: Add VEPU121 to RK3588 + +RK3588 has 4 Hantro G1 encoder-only cores. They are all independent IP, +but can be used as a cluster (i.e. sharing work between the cores). +These cores are called VEPU121 in the TRM. The TRM describes one more +VEPU121, but that is combined with a Hantro H1. That one will be handled +using the VPU binding instead. + +Signed-off-by: Emmanuel Gil Peyrot +Signed-off-by: Sebastian Reichel +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 80 ++++++++++ + 1 file changed, 80 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1122,6 +1122,86 @@ power-domain@RK3588_PD_SDMMC { + }; + }; + ++ vepu121_0: video-codec@fdba0000 { ++ compatible = "rockchip,rk3588-vepu121"; ++ reg = <0x0 0xfdba0000 0x0 0x800>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER0>, <&cru HCLK_JPEG_ENCODER0>; ++ clock-names = "aclk", "hclk"; ++ iommus = <&vepu121_0_mmu>; ++ power-domains = <&power RK3588_PD_VDPU>; ++ }; ++ ++ vepu121_0_mmu: iommu@fdba0800 { ++ compatible = "rockchip,rk3588-iommu", "rockchip,rk3568-iommu"; ++ reg = <0x0 0xfdba0800 0x0 0x40>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER0>, <&cru HCLK_JPEG_ENCODER0>; ++ clock-names = "aclk", "iface"; ++ power-domains = <&power RK3588_PD_VDPU>; ++ #iommu-cells = <0>; ++ }; ++ ++ vepu121_1: video-codec@fdba4000 { ++ compatible = "rockchip,rk3588-vepu121"; ++ reg = <0x0 0xfdba4000 0x0 0x800>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER1>, <&cru HCLK_JPEG_ENCODER1>; ++ clock-names = "aclk", "hclk"; ++ iommus = <&vepu121_1_mmu>; ++ power-domains = <&power RK3588_PD_VDPU>; ++ }; ++ ++ vepu121_1_mmu: iommu@fdba4800 { ++ compatible = "rockchip,rk3588-iommu", "rockchip,rk3568-iommu"; ++ reg = <0x0 0xfdba4800 0x0 0x40>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER1>, <&cru HCLK_JPEG_ENCODER1>; ++ clock-names = "aclk", "iface"; ++ power-domains = <&power RK3588_PD_VDPU>; ++ #iommu-cells = <0>; ++ }; ++ ++ vepu121_2: video-codec@fdba8000 { ++ compatible = "rockchip,rk3588-vepu121"; ++ reg = <0x0 0xfdba8000 0x0 0x800>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER2>, <&cru HCLK_JPEG_ENCODER2>; ++ clock-names = "aclk", "hclk"; ++ iommus = <&vepu121_2_mmu>; ++ power-domains = <&power RK3588_PD_VDPU>; ++ }; ++ ++ vepu121_2_mmu: iommu@fdba8800 { ++ compatible = "rockchip,rk3588-iommu", "rockchip,rk3568-iommu"; ++ reg = <0x0 0xfdba8800 0x0 0x40>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER2>, <&cru HCLK_JPEG_ENCODER2>; ++ clock-names = "aclk", "iface"; ++ power-domains = <&power RK3588_PD_VDPU>; ++ #iommu-cells = <0>; ++ }; ++ ++ vepu121_3: video-codec@fdbac000 { ++ compatible = "rockchip,rk3588-vepu121"; ++ reg = <0x0 0xfdbac000 0x0 0x800>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER3>, <&cru HCLK_JPEG_ENCODER3>; ++ clock-names = "aclk", "hclk"; ++ iommus = <&vepu121_3_mmu>; ++ power-domains = <&power RK3588_PD_VDPU>; ++ }; ++ ++ vepu121_3_mmu: iommu@fdbac800 { ++ compatible = "rockchip,rk3588-iommu", "rockchip,rk3568-iommu"; ++ reg = <0x0 0xfdbac800 0x0 0x40>; ++ interrupts = ; ++ clocks = <&cru ACLK_JPEG_ENCODER3>, <&cru HCLK_JPEG_ENCODER3>; ++ clock-names = "aclk", "iface"; ++ power-domains = <&power RK3588_PD_VDPU>; ++ #iommu-cells = <0>; ++ }; ++ + av1d: video-codec@fdc70000 { + compatible = "rockchip,rk3588-av1-vpu"; + reg = <0x0 0xfdc70000 0x0 0x800>; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Tue, 30 Apr 2024 10:40:02 +0800 +Subject: arm64: dts: rockchip: Add VPU121 support for RK3588 + +Enable Hantro G1 video decoder in RK3588's devicetree. + +Tested with FFmpeg v4l2_request code taken from [1] +with MPEG2, H.264 and VP8 samples. + +[1] https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/multimedia/ffmpeg/patches/v4l2-request/ffmpeg-001-v4l2-request.patch + +Signed-off-by: Jianfeng Liu +Tested-by: Hugh Cole-Baker +Signed-off-by: Sebastian Reichel +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 21 ++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1122,6 +1122,27 @@ power-domain@RK3588_PD_SDMMC { + }; + }; + ++ vpu121: video-codec@fdb50000 { ++ compatible = "rockchip,rk3588-vpu121", "rockchip,rk3568-vpu"; ++ reg = <0x0 0xfdb50000 0x0 0x800>; ++ interrupts = ; ++ interrupt-names = "vdpu"; ++ clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; ++ clock-names = "aclk", "hclk"; ++ iommus = <&vpu121_mmu>; ++ power-domains = <&power RK3588_PD_VDPU>; ++ }; ++ ++ vpu121_mmu: iommu@fdb50800 { ++ compatible = "rockchip,rk3588-iommu", "rockchip,rk3568-iommu"; ++ reg = <0x0 0xfdb50800 0x0 0x40>; ++ interrupts = ; ++ clock-names = "aclk", "iface"; ++ clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; ++ power-domains = <&power RK3588_PD_VDPU>; ++ #iommu-cells = <0>; ++ }; ++ + vepu121_0: video-codec@fdba0000 { + compatible = "rockchip,rk3588-vepu121"; + reg = <0x0 0xfdba0000 0x0 0x800>; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Mon, 29 Jul 2024 23:21:19 +0300 +Subject: arm64: dts: rockchip: rk3588: disable H264 decoding on Hantro decoder + +--- + Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 2 +- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 7 ++++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml ++++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml +@@ -33,7 +33,7 @@ properties: + - const: rockchip,rk3399-vpu + - items: + - const: rockchip,rk3588-vpu121 +- - const: rockchip,rk3568-vpu ++ - const: rockchip,rk3399-vpu + + reg: + maxItems: 1 +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1123,10 +1123,11 @@ power-domain@RK3588_PD_SDMMC { + }; + + vpu121: video-codec@fdb50000 { +- compatible = "rockchip,rk3588-vpu121", "rockchip,rk3568-vpu"; ++ compatible = "rockchip,rk3588-vpu121", "rockchip,rk3399-vpu"; + reg = <0x0 0xfdb50000 0x0 0x800>; +- interrupts = ; +- interrupt-names = "vdpu"; ++ interrupts = , ++ ; ++ interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; + clock-names = "aclk", "hclk"; + iommus = <&vpu121_mmu>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0027-RK3588-Add-rkvdec2-Support-v3.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0027-RK3588-Add-rkvdec2-Support-v3.patch new file mode 100644 index 000000000000..5687b1fb8a1a --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0027-RK3588-Add-rkvdec2-Support-v3.patch @@ -0,0 +1,3887 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Tue, 18 Jun 2024 12:41:51 -0400 +Subject: media: rockchip: Move H264 CABAC table to header file + +The table will be shared with the rkvdec2 driver in following commits. + +As HW formatted CABAC tables can be shared between drivers, it makes sense +to group them in an include folder. + +Each driver can include the tables they need so that all tables are not +built in the kernel, but rather in each driver, if the driver is enabled. + +Signed-off-by: Detlev Casanova +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 500 +-------- + include/media/v4l2-cabac/rkvdec-cabac.h | 509 ++++++++++ + 2 files changed, 510 insertions(+), 499 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index 111111111111..222222222222 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -11,6 +11,7 @@ + + #include + #include ++#include + + #include "rkvdec.h" + #include "rkvdec-regs.h" +@@ -117,505 +118,6 @@ struct rkvdec_h264_ctx { + struct rkvdec_h264_reflists reflists; + }; + +-#define CABAC_ENTRY(ctxidx, idc0_m, idc0_n, idc1_m, idc1_n, \ +- idc2_m, idc2_n, intra_m, intra_n) \ +- [0][(ctxidx)] = {idc0_m, idc0_n}, \ +- [1][(ctxidx)] = {idc1_m, idc1_n}, \ +- [2][(ctxidx)] = {idc2_m, idc2_n}, \ +- [3][(ctxidx)] = {intra_m, intra_n} +- +-/* +- * Constant CABAC table. +- * Built from the tables described in section '9.3.1.1 Initialisation process +- * for context variables' of the H264 spec. +- */ +-static const s8 rkvdec_h264_cabac_table[4][464][2] = { +- /* Table 9-12 – Values of variables m and n for ctxIdx from 0 to 10 */ +- CABAC_ENTRY(0, 20, -15, 20, -15, 20, -15, 20, -15), +- CABAC_ENTRY(1, 2, 54, 2, 54, 2, 54, 2, 54), +- CABAC_ENTRY(2, 3, 74, 3, 74, 3, 74, 3, 74), +- CABAC_ENTRY(3, 20, -15, 20, -15, 20, -15, 20, -15), +- CABAC_ENTRY(4, 2, 54, 2, 54, 2, 54, 2, 54), +- CABAC_ENTRY(5, 3, 74, 3, 74, 3, 74, 3, 74), +- CABAC_ENTRY(6, -28, 127, -28, 127, -28, 127, -28, 127), +- CABAC_ENTRY(7, -23, 104, -23, 104, -23, 104, -23, 104), +- CABAC_ENTRY(8, -6, 53, -6, 53, -6, 53, -6, 53), +- CABAC_ENTRY(9, -1, 54, -1, 54, -1, 54, -1, 54), +- CABAC_ENTRY(10, 7, 51, 7, 51, 7, 51, 7, 51), +- +- /* Table 9-13 – Values of variables m and n for ctxIdx from 11 to 23 */ +- CABAC_ENTRY(11, 23, 33, 22, 25, 29, 16, 0, 0), +- CABAC_ENTRY(12, 23, 2, 34, 0, 25, 0, 0, 0), +- CABAC_ENTRY(13, 21, 0, 16, 0, 14, 0, 0, 0), +- CABAC_ENTRY(14, 1, 9, -2, 9, -10, 51, 0, 0), +- CABAC_ENTRY(15, 0, 49, 4, 41, -3, 62, 0, 0), +- CABAC_ENTRY(16, -37, 118, -29, 118, -27, 99, 0, 0), +- CABAC_ENTRY(17, 5, 57, 2, 65, 26, 16, 0, 0), +- CABAC_ENTRY(18, -13, 78, -6, 71, -4, 85, 0, 0), +- CABAC_ENTRY(19, -11, 65, -13, 79, -24, 102, 0, 0), +- CABAC_ENTRY(20, 1, 62, 5, 52, 5, 57, 0, 0), +- CABAC_ENTRY(21, 12, 49, 9, 50, 6, 57, 0, 0), +- CABAC_ENTRY(22, -4, 73, -3, 70, -17, 73, 0, 0), +- CABAC_ENTRY(23, 17, 50, 10, 54, 14, 57, 0, 0), +- +- /* Table 9-14 – Values of variables m and n for ctxIdx from 24 to 39 */ +- CABAC_ENTRY(24, 18, 64, 26, 34, 20, 40, 0, 0), +- CABAC_ENTRY(25, 9, 43, 19, 22, 20, 10, 0, 0), +- CABAC_ENTRY(26, 29, 0, 40, 0, 29, 0, 0, 0), +- CABAC_ENTRY(27, 26, 67, 57, 2, 54, 0, 0, 0), +- CABAC_ENTRY(28, 16, 90, 41, 36, 37, 42, 0, 0), +- CABAC_ENTRY(29, 9, 104, 26, 69, 12, 97, 0, 0), +- CABAC_ENTRY(30, -46, 127, -45, 127, -32, 127, 0, 0), +- CABAC_ENTRY(31, -20, 104, -15, 101, -22, 117, 0, 0), +- CABAC_ENTRY(32, 1, 67, -4, 76, -2, 74, 0, 0), +- CABAC_ENTRY(33, -13, 78, -6, 71, -4, 85, 0, 0), +- CABAC_ENTRY(34, -11, 65, -13, 79, -24, 102, 0, 0), +- CABAC_ENTRY(35, 1, 62, 5, 52, 5, 57, 0, 0), +- CABAC_ENTRY(36, -6, 86, 6, 69, -6, 93, 0, 0), +- CABAC_ENTRY(37, -17, 95, -13, 90, -14, 88, 0, 0), +- CABAC_ENTRY(38, -6, 61, 0, 52, -6, 44, 0, 0), +- CABAC_ENTRY(39, 9, 45, 8, 43, 4, 55, 0, 0), +- +- /* Table 9-15 – Values of variables m and n for ctxIdx from 40 to 53 */ +- CABAC_ENTRY(40, -3, 69, -2, 69, -11, 89, 0, 0), +- CABAC_ENTRY(41, -6, 81, -5, 82, -15, 103, 0, 0), +- CABAC_ENTRY(42, -11, 96, -10, 96, -21, 116, 0, 0), +- CABAC_ENTRY(43, 6, 55, 2, 59, 19, 57, 0, 0), +- CABAC_ENTRY(44, 7, 67, 2, 75, 20, 58, 0, 0), +- CABAC_ENTRY(45, -5, 86, -3, 87, 4, 84, 0, 0), +- CABAC_ENTRY(46, 2, 88, -3, 100, 6, 96, 0, 0), +- CABAC_ENTRY(47, 0, 58, 1, 56, 1, 63, 0, 0), +- CABAC_ENTRY(48, -3, 76, -3, 74, -5, 85, 0, 0), +- CABAC_ENTRY(49, -10, 94, -6, 85, -13, 106, 0, 0), +- CABAC_ENTRY(50, 5, 54, 0, 59, 5, 63, 0, 0), +- CABAC_ENTRY(51, 4, 69, -3, 81, 6, 75, 0, 0), +- CABAC_ENTRY(52, -3, 81, -7, 86, -3, 90, 0, 0), +- CABAC_ENTRY(53, 0, 88, -5, 95, -1, 101, 0, 0), +- +- /* Table 9-16 – Values of variables m and n for ctxIdx from 54 to 59 */ +- CABAC_ENTRY(54, -7, 67, -1, 66, 3, 55, 0, 0), +- CABAC_ENTRY(55, -5, 74, -1, 77, -4, 79, 0, 0), +- CABAC_ENTRY(56, -4, 74, 1, 70, -2, 75, 0, 0), +- CABAC_ENTRY(57, -5, 80, -2, 86, -12, 97, 0, 0), +- CABAC_ENTRY(58, -7, 72, -5, 72, -7, 50, 0, 0), +- CABAC_ENTRY(59, 1, 58, 0, 61, 1, 60, 0, 0), +- +- /* Table 9-17 – Values of variables m and n for ctxIdx from 60 to 69 */ +- CABAC_ENTRY(60, 0, 41, 0, 41, 0, 41, 0, 41), +- CABAC_ENTRY(61, 0, 63, 0, 63, 0, 63, 0, 63), +- CABAC_ENTRY(62, 0, 63, 0, 63, 0, 63, 0, 63), +- CABAC_ENTRY(63, 0, 63, 0, 63, 0, 63, 0, 63), +- CABAC_ENTRY(64, -9, 83, -9, 83, -9, 83, -9, 83), +- CABAC_ENTRY(65, 4, 86, 4, 86, 4, 86, 4, 86), +- CABAC_ENTRY(66, 0, 97, 0, 97, 0, 97, 0, 97), +- CABAC_ENTRY(67, -7, 72, -7, 72, -7, 72, -7, 72), +- CABAC_ENTRY(68, 13, 41, 13, 41, 13, 41, 13, 41), +- CABAC_ENTRY(69, 3, 62, 3, 62, 3, 62, 3, 62), +- +- /* Table 9-18 – Values of variables m and n for ctxIdx from 70 to 104 */ +- CABAC_ENTRY(70, 0, 45, 13, 15, 7, 34, 0, 11), +- CABAC_ENTRY(71, -4, 78, 7, 51, -9, 88, 1, 55), +- CABAC_ENTRY(72, -3, 96, 2, 80, -20, 127, 0, 69), +- CABAC_ENTRY(73, -27, 126, -39, 127, -36, 127, -17, 127), +- CABAC_ENTRY(74, -28, 98, -18, 91, -17, 91, -13, 102), +- CABAC_ENTRY(75, -25, 101, -17, 96, -14, 95, 0, 82), +- CABAC_ENTRY(76, -23, 67, -26, 81, -25, 84, -7, 74), +- CABAC_ENTRY(77, -28, 82, -35, 98, -25, 86, -21, 107), +- CABAC_ENTRY(78, -20, 94, -24, 102, -12, 89, -27, 127), +- CABAC_ENTRY(79, -16, 83, -23, 97, -17, 91, -31, 127), +- CABAC_ENTRY(80, -22, 110, -27, 119, -31, 127, -24, 127), +- CABAC_ENTRY(81, -21, 91, -24, 99, -14, 76, -18, 95), +- CABAC_ENTRY(82, -18, 102, -21, 110, -18, 103, -27, 127), +- CABAC_ENTRY(83, -13, 93, -18, 102, -13, 90, -21, 114), +- CABAC_ENTRY(84, -29, 127, -36, 127, -37, 127, -30, 127), +- CABAC_ENTRY(85, -7, 92, 0, 80, 11, 80, -17, 123), +- CABAC_ENTRY(86, -5, 89, -5, 89, 5, 76, -12, 115), +- CABAC_ENTRY(87, -7, 96, -7, 94, 2, 84, -16, 122), +- CABAC_ENTRY(88, -13, 108, -4, 92, 5, 78, -11, 115), +- CABAC_ENTRY(89, -3, 46, 0, 39, -6, 55, -12, 63), +- CABAC_ENTRY(90, -1, 65, 0, 65, 4, 61, -2, 68), +- CABAC_ENTRY(91, -1, 57, -15, 84, -14, 83, -15, 84), +- CABAC_ENTRY(92, -9, 93, -35, 127, -37, 127, -13, 104), +- CABAC_ENTRY(93, -3, 74, -2, 73, -5, 79, -3, 70), +- CABAC_ENTRY(94, -9, 92, -12, 104, -11, 104, -8, 93), +- CABAC_ENTRY(95, -8, 87, -9, 91, -11, 91, -10, 90), +- CABAC_ENTRY(96, -23, 126, -31, 127, -30, 127, -30, 127), +- CABAC_ENTRY(97, 5, 54, 3, 55, 0, 65, -1, 74), +- CABAC_ENTRY(98, 6, 60, 7, 56, -2, 79, -6, 97), +- CABAC_ENTRY(99, 6, 59, 7, 55, 0, 72, -7, 91), +- CABAC_ENTRY(100, 6, 69, 8, 61, -4, 92, -20, 127), +- CABAC_ENTRY(101, -1, 48, -3, 53, -6, 56, -4, 56), +- CABAC_ENTRY(102, 0, 68, 0, 68, 3, 68, -5, 82), +- CABAC_ENTRY(103, -4, 69, -7, 74, -8, 71, -7, 76), +- CABAC_ENTRY(104, -8, 88, -9, 88, -13, 98, -22, 125), +- +- /* Table 9-19 – Values of variables m and n for ctxIdx from 105 to 165 */ +- CABAC_ENTRY(105, -2, 85, -13, 103, -4, 86, -7, 93), +- CABAC_ENTRY(106, -6, 78, -13, 91, -12, 88, -11, 87), +- CABAC_ENTRY(107, -1, 75, -9, 89, -5, 82, -3, 77), +- CABAC_ENTRY(108, -7, 77, -14, 92, -3, 72, -5, 71), +- CABAC_ENTRY(109, 2, 54, -8, 76, -4, 67, -4, 63), +- CABAC_ENTRY(110, 5, 50, -12, 87, -8, 72, -4, 68), +- CABAC_ENTRY(111, -3, 68, -23, 110, -16, 89, -12, 84), +- CABAC_ENTRY(112, 1, 50, -24, 105, -9, 69, -7, 62), +- CABAC_ENTRY(113, 6, 42, -10, 78, -1, 59, -7, 65), +- CABAC_ENTRY(114, -4, 81, -20, 112, 5, 66, 8, 61), +- CABAC_ENTRY(115, 1, 63, -17, 99, 4, 57, 5, 56), +- CABAC_ENTRY(116, -4, 70, -78, 127, -4, 71, -2, 66), +- CABAC_ENTRY(117, 0, 67, -70, 127, -2, 71, 1, 64), +- CABAC_ENTRY(118, 2, 57, -50, 127, 2, 58, 0, 61), +- CABAC_ENTRY(119, -2, 76, -46, 127, -1, 74, -2, 78), +- CABAC_ENTRY(120, 11, 35, -4, 66, -4, 44, 1, 50), +- CABAC_ENTRY(121, 4, 64, -5, 78, -1, 69, 7, 52), +- CABAC_ENTRY(122, 1, 61, -4, 71, 0, 62, 10, 35), +- CABAC_ENTRY(123, 11, 35, -8, 72, -7, 51, 0, 44), +- CABAC_ENTRY(124, 18, 25, 2, 59, -4, 47, 11, 38), +- CABAC_ENTRY(125, 12, 24, -1, 55, -6, 42, 1, 45), +- CABAC_ENTRY(126, 13, 29, -7, 70, -3, 41, 0, 46), +- CABAC_ENTRY(127, 13, 36, -6, 75, -6, 53, 5, 44), +- CABAC_ENTRY(128, -10, 93, -8, 89, 8, 76, 31, 17), +- CABAC_ENTRY(129, -7, 73, -34, 119, -9, 78, 1, 51), +- CABAC_ENTRY(130, -2, 73, -3, 75, -11, 83, 7, 50), +- CABAC_ENTRY(131, 13, 46, 32, 20, 9, 52, 28, 19), +- CABAC_ENTRY(132, 9, 49, 30, 22, 0, 67, 16, 33), +- CABAC_ENTRY(133, -7, 100, -44, 127, -5, 90, 14, 62), +- CABAC_ENTRY(134, 9, 53, 0, 54, 1, 67, -13, 108), +- CABAC_ENTRY(135, 2, 53, -5, 61, -15, 72, -15, 100), +- CABAC_ENTRY(136, 5, 53, 0, 58, -5, 75, -13, 101), +- CABAC_ENTRY(137, -2, 61, -1, 60, -8, 80, -13, 91), +- CABAC_ENTRY(138, 0, 56, -3, 61, -21, 83, -12, 94), +- CABAC_ENTRY(139, 0, 56, -8, 67, -21, 64, -10, 88), +- CABAC_ENTRY(140, -13, 63, -25, 84, -13, 31, -16, 84), +- CABAC_ENTRY(141, -5, 60, -14, 74, -25, 64, -10, 86), +- CABAC_ENTRY(142, -1, 62, -5, 65, -29, 94, -7, 83), +- CABAC_ENTRY(143, 4, 57, 5, 52, 9, 75, -13, 87), +- CABAC_ENTRY(144, -6, 69, 2, 57, 17, 63, -19, 94), +- CABAC_ENTRY(145, 4, 57, 0, 61, -8, 74, 1, 70), +- CABAC_ENTRY(146, 14, 39, -9, 69, -5, 35, 0, 72), +- CABAC_ENTRY(147, 4, 51, -11, 70, -2, 27, -5, 74), +- CABAC_ENTRY(148, 13, 68, 18, 55, 13, 91, 18, 59), +- CABAC_ENTRY(149, 3, 64, -4, 71, 3, 65, -8, 102), +- CABAC_ENTRY(150, 1, 61, 0, 58, -7, 69, -15, 100), +- CABAC_ENTRY(151, 9, 63, 7, 61, 8, 77, 0, 95), +- CABAC_ENTRY(152, 7, 50, 9, 41, -10, 66, -4, 75), +- CABAC_ENTRY(153, 16, 39, 18, 25, 3, 62, 2, 72), +- CABAC_ENTRY(154, 5, 44, 9, 32, -3, 68, -11, 75), +- CABAC_ENTRY(155, 4, 52, 5, 43, -20, 81, -3, 71), +- CABAC_ENTRY(156, 11, 48, 9, 47, 0, 30, 15, 46), +- CABAC_ENTRY(157, -5, 60, 0, 44, 1, 7, -13, 69), +- CABAC_ENTRY(158, -1, 59, 0, 51, -3, 23, 0, 62), +- CABAC_ENTRY(159, 0, 59, 2, 46, -21, 74, 0, 65), +- CABAC_ENTRY(160, 22, 33, 19, 38, 16, 66, 21, 37), +- CABAC_ENTRY(161, 5, 44, -4, 66, -23, 124, -15, 72), +- CABAC_ENTRY(162, 14, 43, 15, 38, 17, 37, 9, 57), +- CABAC_ENTRY(163, -1, 78, 12, 42, 44, -18, 16, 54), +- CABAC_ENTRY(164, 0, 60, 9, 34, 50, -34, 0, 62), +- CABAC_ENTRY(165, 9, 69, 0, 89, -22, 127, 12, 72), +- +- /* Table 9-20 – Values of variables m and n for ctxIdx from 166 to 226 */ +- CABAC_ENTRY(166, 11, 28, 4, 45, 4, 39, 24, 0), +- CABAC_ENTRY(167, 2, 40, 10, 28, 0, 42, 15, 9), +- CABAC_ENTRY(168, 3, 44, 10, 31, 7, 34, 8, 25), +- CABAC_ENTRY(169, 0, 49, 33, -11, 11, 29, 13, 18), +- CABAC_ENTRY(170, 0, 46, 52, -43, 8, 31, 15, 9), +- CABAC_ENTRY(171, 2, 44, 18, 15, 6, 37, 13, 19), +- CABAC_ENTRY(172, 2, 51, 28, 0, 7, 42, 10, 37), +- CABAC_ENTRY(173, 0, 47, 35, -22, 3, 40, 12, 18), +- CABAC_ENTRY(174, 4, 39, 38, -25, 8, 33, 6, 29), +- CABAC_ENTRY(175, 2, 62, 34, 0, 13, 43, 20, 33), +- CABAC_ENTRY(176, 6, 46, 39, -18, 13, 36, 15, 30), +- CABAC_ENTRY(177, 0, 54, 32, -12, 4, 47, 4, 45), +- CABAC_ENTRY(178, 3, 54, 102, -94, 3, 55, 1, 58), +- CABAC_ENTRY(179, 2, 58, 0, 0, 2, 58, 0, 62), +- CABAC_ENTRY(180, 4, 63, 56, -15, 6, 60, 7, 61), +- CABAC_ENTRY(181, 6, 51, 33, -4, 8, 44, 12, 38), +- CABAC_ENTRY(182, 6, 57, 29, 10, 11, 44, 11, 45), +- CABAC_ENTRY(183, 7, 53, 37, -5, 14, 42, 15, 39), +- CABAC_ENTRY(184, 6, 52, 51, -29, 7, 48, 11, 42), +- CABAC_ENTRY(185, 6, 55, 39, -9, 4, 56, 13, 44), +- CABAC_ENTRY(186, 11, 45, 52, -34, 4, 52, 16, 45), +- CABAC_ENTRY(187, 14, 36, 69, -58, 13, 37, 12, 41), +- CABAC_ENTRY(188, 8, 53, 67, -63, 9, 49, 10, 49), +- CABAC_ENTRY(189, -1, 82, 44, -5, 19, 58, 30, 34), +- CABAC_ENTRY(190, 7, 55, 32, 7, 10, 48, 18, 42), +- CABAC_ENTRY(191, -3, 78, 55, -29, 12, 45, 10, 55), +- CABAC_ENTRY(192, 15, 46, 32, 1, 0, 69, 17, 51), +- CABAC_ENTRY(193, 22, 31, 0, 0, 20, 33, 17, 46), +- CABAC_ENTRY(194, -1, 84, 27, 36, 8, 63, 0, 89), +- CABAC_ENTRY(195, 25, 7, 33, -25, 35, -18, 26, -19), +- CABAC_ENTRY(196, 30, -7, 34, -30, 33, -25, 22, -17), +- CABAC_ENTRY(197, 28, 3, 36, -28, 28, -3, 26, -17), +- CABAC_ENTRY(198, 28, 4, 38, -28, 24, 10, 30, -25), +- CABAC_ENTRY(199, 32, 0, 38, -27, 27, 0, 28, -20), +- CABAC_ENTRY(200, 34, -1, 34, -18, 34, -14, 33, -23), +- CABAC_ENTRY(201, 30, 6, 35, -16, 52, -44, 37, -27), +- CABAC_ENTRY(202, 30, 6, 34, -14, 39, -24, 33, -23), +- CABAC_ENTRY(203, 32, 9, 32, -8, 19, 17, 40, -28), +- CABAC_ENTRY(204, 31, 19, 37, -6, 31, 25, 38, -17), +- CABAC_ENTRY(205, 26, 27, 35, 0, 36, 29, 33, -11), +- CABAC_ENTRY(206, 26, 30, 30, 10, 24, 33, 40, -15), +- CABAC_ENTRY(207, 37, 20, 28, 18, 34, 15, 41, -6), +- CABAC_ENTRY(208, 28, 34, 26, 25, 30, 20, 38, 1), +- CABAC_ENTRY(209, 17, 70, 29, 41, 22, 73, 41, 17), +- CABAC_ENTRY(210, 1, 67, 0, 75, 20, 34, 30, -6), +- CABAC_ENTRY(211, 5, 59, 2, 72, 19, 31, 27, 3), +- CABAC_ENTRY(212, 9, 67, 8, 77, 27, 44, 26, 22), +- CABAC_ENTRY(213, 16, 30, 14, 35, 19, 16, 37, -16), +- CABAC_ENTRY(214, 18, 32, 18, 31, 15, 36, 35, -4), +- CABAC_ENTRY(215, 18, 35, 17, 35, 15, 36, 38, -8), +- CABAC_ENTRY(216, 22, 29, 21, 30, 21, 28, 38, -3), +- CABAC_ENTRY(217, 24, 31, 17, 45, 25, 21, 37, 3), +- CABAC_ENTRY(218, 23, 38, 20, 42, 30, 20, 38, 5), +- CABAC_ENTRY(219, 18, 43, 18, 45, 31, 12, 42, 0), +- CABAC_ENTRY(220, 20, 41, 27, 26, 27, 16, 35, 16), +- CABAC_ENTRY(221, 11, 63, 16, 54, 24, 42, 39, 22), +- CABAC_ENTRY(222, 9, 59, 7, 66, 0, 93, 14, 48), +- CABAC_ENTRY(223, 9, 64, 16, 56, 14, 56, 27, 37), +- CABAC_ENTRY(224, -1, 94, 11, 73, 15, 57, 21, 60), +- CABAC_ENTRY(225, -2, 89, 10, 67, 26, 38, 12, 68), +- CABAC_ENTRY(226, -9, 108, -10, 116, -24, 127, 2, 97), +- +- /* Table 9-21 – Values of variables m and n for ctxIdx from 227 to 275 */ +- CABAC_ENTRY(227, -6, 76, -23, 112, -24, 115, -3, 71), +- CABAC_ENTRY(228, -2, 44, -15, 71, -22, 82, -6, 42), +- CABAC_ENTRY(229, 0, 45, -7, 61, -9, 62, -5, 50), +- CABAC_ENTRY(230, 0, 52, 0, 53, 0, 53, -3, 54), +- CABAC_ENTRY(231, -3, 64, -5, 66, 0, 59, -2, 62), +- CABAC_ENTRY(232, -2, 59, -11, 77, -14, 85, 0, 58), +- CABAC_ENTRY(233, -4, 70, -9, 80, -13, 89, 1, 63), +- CABAC_ENTRY(234, -4, 75, -9, 84, -13, 94, -2, 72), +- CABAC_ENTRY(235, -8, 82, -10, 87, -11, 92, -1, 74), +- CABAC_ENTRY(236, -17, 102, -34, 127, -29, 127, -9, 91), +- CABAC_ENTRY(237, -9, 77, -21, 101, -21, 100, -5, 67), +- CABAC_ENTRY(238, 3, 24, -3, 39, -14, 57, -5, 27), +- CABAC_ENTRY(239, 0, 42, -5, 53, -12, 67, -3, 39), +- CABAC_ENTRY(240, 0, 48, -7, 61, -11, 71, -2, 44), +- CABAC_ENTRY(241, 0, 55, -11, 75, -10, 77, 0, 46), +- CABAC_ENTRY(242, -6, 59, -15, 77, -21, 85, -16, 64), +- CABAC_ENTRY(243, -7, 71, -17, 91, -16, 88, -8, 68), +- CABAC_ENTRY(244, -12, 83, -25, 107, -23, 104, -10, 78), +- CABAC_ENTRY(245, -11, 87, -25, 111, -15, 98, -6, 77), +- CABAC_ENTRY(246, -30, 119, -28, 122, -37, 127, -10, 86), +- CABAC_ENTRY(247, 1, 58, -11, 76, -10, 82, -12, 92), +- CABAC_ENTRY(248, -3, 29, -10, 44, -8, 48, -15, 55), +- CABAC_ENTRY(249, -1, 36, -10, 52, -8, 61, -10, 60), +- CABAC_ENTRY(250, 1, 38, -10, 57, -8, 66, -6, 62), +- CABAC_ENTRY(251, 2, 43, -9, 58, -7, 70, -4, 65), +- CABAC_ENTRY(252, -6, 55, -16, 72, -14, 75, -12, 73), +- CABAC_ENTRY(253, 0, 58, -7, 69, -10, 79, -8, 76), +- CABAC_ENTRY(254, 0, 64, -4, 69, -9, 83, -7, 80), +- CABAC_ENTRY(255, -3, 74, -5, 74, -12, 92, -9, 88), +- CABAC_ENTRY(256, -10, 90, -9, 86, -18, 108, -17, 110), +- CABAC_ENTRY(257, 0, 70, 2, 66, -4, 79, -11, 97), +- CABAC_ENTRY(258, -4, 29, -9, 34, -22, 69, -20, 84), +- CABAC_ENTRY(259, 5, 31, 1, 32, -16, 75, -11, 79), +- CABAC_ENTRY(260, 7, 42, 11, 31, -2, 58, -6, 73), +- CABAC_ENTRY(261, 1, 59, 5, 52, 1, 58, -4, 74), +- CABAC_ENTRY(262, -2, 58, -2, 55, -13, 78, -13, 86), +- CABAC_ENTRY(263, -3, 72, -2, 67, -9, 83, -13, 96), +- CABAC_ENTRY(264, -3, 81, 0, 73, -4, 81, -11, 97), +- CABAC_ENTRY(265, -11, 97, -8, 89, -13, 99, -19, 117), +- CABAC_ENTRY(266, 0, 58, 3, 52, -13, 81, -8, 78), +- CABAC_ENTRY(267, 8, 5, 7, 4, -6, 38, -5, 33), +- CABAC_ENTRY(268, 10, 14, 10, 8, -13, 62, -4, 48), +- CABAC_ENTRY(269, 14, 18, 17, 8, -6, 58, -2, 53), +- CABAC_ENTRY(270, 13, 27, 16, 19, -2, 59, -3, 62), +- CABAC_ENTRY(271, 2, 40, 3, 37, -16, 73, -13, 71), +- CABAC_ENTRY(272, 0, 58, -1, 61, -10, 76, -10, 79), +- CABAC_ENTRY(273, -3, 70, -5, 73, -13, 86, -12, 86), +- CABAC_ENTRY(274, -6, 79, -1, 70, -9, 83, -13, 90), +- CABAC_ENTRY(275, -8, 85, -4, 78, -10, 87, -14, 97), +- +- /* Table 9-22 – Values of variables m and n for ctxIdx from 277 to 337 */ +- CABAC_ENTRY(277, -13, 106, -21, 126, -22, 127, -6, 93), +- CABAC_ENTRY(278, -16, 106, -23, 124, -25, 127, -6, 84), +- CABAC_ENTRY(279, -10, 87, -20, 110, -25, 120, -8, 79), +- CABAC_ENTRY(280, -21, 114, -26, 126, -27, 127, 0, 66), +- CABAC_ENTRY(281, -18, 110, -25, 124, -19, 114, -1, 71), +- CABAC_ENTRY(282, -14, 98, -17, 105, -23, 117, 0, 62), +- CABAC_ENTRY(283, -22, 110, -27, 121, -25, 118, -2, 60), +- CABAC_ENTRY(284, -21, 106, -27, 117, -26, 117, -2, 59), +- CABAC_ENTRY(285, -18, 103, -17, 102, -24, 113, -5, 75), +- CABAC_ENTRY(286, -21, 107, -26, 117, -28, 118, -3, 62), +- CABAC_ENTRY(287, -23, 108, -27, 116, -31, 120, -4, 58), +- CABAC_ENTRY(288, -26, 112, -33, 122, -37, 124, -9, 66), +- CABAC_ENTRY(289, -10, 96, -10, 95, -10, 94, -1, 79), +- CABAC_ENTRY(290, -12, 95, -14, 100, -15, 102, 0, 71), +- CABAC_ENTRY(291, -5, 91, -8, 95, -10, 99, 3, 68), +- CABAC_ENTRY(292, -9, 93, -17, 111, -13, 106, 10, 44), +- CABAC_ENTRY(293, -22, 94, -28, 114, -50, 127, -7, 62), +- CABAC_ENTRY(294, -5, 86, -6, 89, -5, 92, 15, 36), +- CABAC_ENTRY(295, 9, 67, -2, 80, 17, 57, 14, 40), +- CABAC_ENTRY(296, -4, 80, -4, 82, -5, 86, 16, 27), +- CABAC_ENTRY(297, -10, 85, -9, 85, -13, 94, 12, 29), +- CABAC_ENTRY(298, -1, 70, -8, 81, -12, 91, 1, 44), +- CABAC_ENTRY(299, 7, 60, -1, 72, -2, 77, 20, 36), +- CABAC_ENTRY(300, 9, 58, 5, 64, 0, 71, 18, 32), +- CABAC_ENTRY(301, 5, 61, 1, 67, -1, 73, 5, 42), +- CABAC_ENTRY(302, 12, 50, 9, 56, 4, 64, 1, 48), +- CABAC_ENTRY(303, 15, 50, 0, 69, -7, 81, 10, 62), +- CABAC_ENTRY(304, 18, 49, 1, 69, 5, 64, 17, 46), +- CABAC_ENTRY(305, 17, 54, 7, 69, 15, 57, 9, 64), +- CABAC_ENTRY(306, 10, 41, -7, 69, 1, 67, -12, 104), +- CABAC_ENTRY(307, 7, 46, -6, 67, 0, 68, -11, 97), +- CABAC_ENTRY(308, -1, 51, -16, 77, -10, 67, -16, 96), +- CABAC_ENTRY(309, 7, 49, -2, 64, 1, 68, -7, 88), +- CABAC_ENTRY(310, 8, 52, 2, 61, 0, 77, -8, 85), +- CABAC_ENTRY(311, 9, 41, -6, 67, 2, 64, -7, 85), +- CABAC_ENTRY(312, 6, 47, -3, 64, 0, 68, -9, 85), +- CABAC_ENTRY(313, 2, 55, 2, 57, -5, 78, -13, 88), +- CABAC_ENTRY(314, 13, 41, -3, 65, 7, 55, 4, 66), +- CABAC_ENTRY(315, 10, 44, -3, 66, 5, 59, -3, 77), +- CABAC_ENTRY(316, 6, 50, 0, 62, 2, 65, -3, 76), +- CABAC_ENTRY(317, 5, 53, 9, 51, 14, 54, -6, 76), +- CABAC_ENTRY(318, 13, 49, -1, 66, 15, 44, 10, 58), +- CABAC_ENTRY(319, 4, 63, -2, 71, 5, 60, -1, 76), +- CABAC_ENTRY(320, 6, 64, -2, 75, 2, 70, -1, 83), +- CABAC_ENTRY(321, -2, 69, -1, 70, -2, 76, -7, 99), +- CABAC_ENTRY(322, -2, 59, -9, 72, -18, 86, -14, 95), +- CABAC_ENTRY(323, 6, 70, 14, 60, 12, 70, 2, 95), +- CABAC_ENTRY(324, 10, 44, 16, 37, 5, 64, 0, 76), +- CABAC_ENTRY(325, 9, 31, 0, 47, -12, 70, -5, 74), +- CABAC_ENTRY(326, 12, 43, 18, 35, 11, 55, 0, 70), +- CABAC_ENTRY(327, 3, 53, 11, 37, 5, 56, -11, 75), +- CABAC_ENTRY(328, 14, 34, 12, 41, 0, 69, 1, 68), +- CABAC_ENTRY(329, 10, 38, 10, 41, 2, 65, 0, 65), +- CABAC_ENTRY(330, -3, 52, 2, 48, -6, 74, -14, 73), +- CABAC_ENTRY(331, 13, 40, 12, 41, 5, 54, 3, 62), +- CABAC_ENTRY(332, 17, 32, 13, 41, 7, 54, 4, 62), +- CABAC_ENTRY(333, 7, 44, 0, 59, -6, 76, -1, 68), +- CABAC_ENTRY(334, 7, 38, 3, 50, -11, 82, -13, 75), +- CABAC_ENTRY(335, 13, 50, 19, 40, -2, 77, 11, 55), +- CABAC_ENTRY(336, 10, 57, 3, 66, -2, 77, 5, 64), +- CABAC_ENTRY(337, 26, 43, 18, 50, 25, 42, 12, 70), +- +- /* Table 9-23 – Values of variables m and n for ctxIdx from 338 to 398 */ +- CABAC_ENTRY(338, 14, 11, 19, -6, 17, -13, 15, 6), +- CABAC_ENTRY(339, 11, 14, 18, -6, 16, -9, 6, 19), +- CABAC_ENTRY(340, 9, 11, 14, 0, 17, -12, 7, 16), +- CABAC_ENTRY(341, 18, 11, 26, -12, 27, -21, 12, 14), +- CABAC_ENTRY(342, 21, 9, 31, -16, 37, -30, 18, 13), +- CABAC_ENTRY(343, 23, -2, 33, -25, 41, -40, 13, 11), +- CABAC_ENTRY(344, 32, -15, 33, -22, 42, -41, 13, 15), +- CABAC_ENTRY(345, 32, -15, 37, -28, 48, -47, 15, 16), +- CABAC_ENTRY(346, 34, -21, 39, -30, 39, -32, 12, 23), +- CABAC_ENTRY(347, 39, -23, 42, -30, 46, -40, 13, 23), +- CABAC_ENTRY(348, 42, -33, 47, -42, 52, -51, 15, 20), +- CABAC_ENTRY(349, 41, -31, 45, -36, 46, -41, 14, 26), +- CABAC_ENTRY(350, 46, -28, 49, -34, 52, -39, 14, 44), +- CABAC_ENTRY(351, 38, -12, 41, -17, 43, -19, 17, 40), +- CABAC_ENTRY(352, 21, 29, 32, 9, 32, 11, 17, 47), +- CABAC_ENTRY(353, 45, -24, 69, -71, 61, -55, 24, 17), +- CABAC_ENTRY(354, 53, -45, 63, -63, 56, -46, 21, 21), +- CABAC_ENTRY(355, 48, -26, 66, -64, 62, -50, 25, 22), +- CABAC_ENTRY(356, 65, -43, 77, -74, 81, -67, 31, 27), +- CABAC_ENTRY(357, 43, -19, 54, -39, 45, -20, 22, 29), +- CABAC_ENTRY(358, 39, -10, 52, -35, 35, -2, 19, 35), +- CABAC_ENTRY(359, 30, 9, 41, -10, 28, 15, 14, 50), +- CABAC_ENTRY(360, 18, 26, 36, 0, 34, 1, 10, 57), +- CABAC_ENTRY(361, 20, 27, 40, -1, 39, 1, 7, 63), +- CABAC_ENTRY(362, 0, 57, 30, 14, 30, 17, -2, 77), +- CABAC_ENTRY(363, -14, 82, 28, 26, 20, 38, -4, 82), +- CABAC_ENTRY(364, -5, 75, 23, 37, 18, 45, -3, 94), +- CABAC_ENTRY(365, -19, 97, 12, 55, 15, 54, 9, 69), +- CABAC_ENTRY(366, -35, 125, 11, 65, 0, 79, -12, 109), +- CABAC_ENTRY(367, 27, 0, 37, -33, 36, -16, 36, -35), +- CABAC_ENTRY(368, 28, 0, 39, -36, 37, -14, 36, -34), +- CABAC_ENTRY(369, 31, -4, 40, -37, 37, -17, 32, -26), +- CABAC_ENTRY(370, 27, 6, 38, -30, 32, 1, 37, -30), +- CABAC_ENTRY(371, 34, 8, 46, -33, 34, 15, 44, -32), +- CABAC_ENTRY(372, 30, 10, 42, -30, 29, 15, 34, -18), +- CABAC_ENTRY(373, 24, 22, 40, -24, 24, 25, 34, -15), +- CABAC_ENTRY(374, 33, 19, 49, -29, 34, 22, 40, -15), +- CABAC_ENTRY(375, 22, 32, 38, -12, 31, 16, 33, -7), +- CABAC_ENTRY(376, 26, 31, 40, -10, 35, 18, 35, -5), +- CABAC_ENTRY(377, 21, 41, 38, -3, 31, 28, 33, 0), +- CABAC_ENTRY(378, 26, 44, 46, -5, 33, 41, 38, 2), +- CABAC_ENTRY(379, 23, 47, 31, 20, 36, 28, 33, 13), +- CABAC_ENTRY(380, 16, 65, 29, 30, 27, 47, 23, 35), +- CABAC_ENTRY(381, 14, 71, 25, 44, 21, 62, 13, 58), +- CABAC_ENTRY(382, 8, 60, 12, 48, 18, 31, 29, -3), +- CABAC_ENTRY(383, 6, 63, 11, 49, 19, 26, 26, 0), +- CABAC_ENTRY(384, 17, 65, 26, 45, 36, 24, 22, 30), +- CABAC_ENTRY(385, 21, 24, 22, 22, 24, 23, 31, -7), +- CABAC_ENTRY(386, 23, 20, 23, 22, 27, 16, 35, -15), +- CABAC_ENTRY(387, 26, 23, 27, 21, 24, 30, 34, -3), +- CABAC_ENTRY(388, 27, 32, 33, 20, 31, 29, 34, 3), +- CABAC_ENTRY(389, 28, 23, 26, 28, 22, 41, 36, -1), +- CABAC_ENTRY(390, 28, 24, 30, 24, 22, 42, 34, 5), +- CABAC_ENTRY(391, 23, 40, 27, 34, 16, 60, 32, 11), +- CABAC_ENTRY(392, 24, 32, 18, 42, 15, 52, 35, 5), +- CABAC_ENTRY(393, 28, 29, 25, 39, 14, 60, 34, 12), +- CABAC_ENTRY(394, 23, 42, 18, 50, 3, 78, 39, 11), +- CABAC_ENTRY(395, 19, 57, 12, 70, -16, 123, 30, 29), +- CABAC_ENTRY(396, 22, 53, 21, 54, 21, 53, 34, 26), +- CABAC_ENTRY(397, 22, 61, 14, 71, 22, 56, 29, 39), +- CABAC_ENTRY(398, 11, 86, 11, 83, 25, 61, 19, 66), +- +- /* Values of variables m and n for ctxIdx from 399 to 463 (not documented) */ +- CABAC_ENTRY(399, 12, 40, 25, 32, 21, 33, 31, 21), +- CABAC_ENTRY(400, 11, 51, 21, 49, 19, 50, 31, 31), +- CABAC_ENTRY(401, 14, 59, 21, 54, 17, 61, 25, 50), +- CABAC_ENTRY(402, -4, 79, -5, 85, -3, 78, -17, 120), +- CABAC_ENTRY(403, -7, 71, -6, 81, -8, 74, -20, 112), +- CABAC_ENTRY(404, -5, 69, -10, 77, -9, 72, -18, 114), +- CABAC_ENTRY(405, -9, 70, -7, 81, -10, 72, -11, 85), +- CABAC_ENTRY(406, -8, 66, -17, 80, -18, 75, -15, 92), +- CABAC_ENTRY(407, -10, 68, -18, 73, -12, 71, -14, 89), +- CABAC_ENTRY(408, -19, 73, -4, 74, -11, 63, -26, 71), +- CABAC_ENTRY(409, -12, 69, -10, 83, -5, 70, -15, 81), +- CABAC_ENTRY(410, -16, 70, -9, 71, -17, 75, -14, 80), +- CABAC_ENTRY(411, -15, 67, -9, 67, -14, 72, 0, 68), +- CABAC_ENTRY(412, -20, 62, -1, 61, -16, 67, -14, 70), +- CABAC_ENTRY(413, -19, 70, -8, 66, -8, 53, -24, 56), +- CABAC_ENTRY(414, -16, 66, -14, 66, -14, 59, -23, 68), +- CABAC_ENTRY(415, -22, 65, 0, 59, -9, 52, -24, 50), +- CABAC_ENTRY(416, -20, 63, 2, 59, -11, 68, -11, 74), +- CABAC_ENTRY(417, 9, -2, 17, -10, 9, -2, 23, -13), +- CABAC_ENTRY(418, 26, -9, 32, -13, 30, -10, 26, -13), +- CABAC_ENTRY(419, 33, -9, 42, -9, 31, -4, 40, -15), +- CABAC_ENTRY(420, 39, -7, 49, -5, 33, -1, 49, -14), +- CABAC_ENTRY(421, 41, -2, 53, 0, 33, 7, 44, 3), +- CABAC_ENTRY(422, 45, 3, 64, 3, 31, 12, 45, 6), +- CABAC_ENTRY(423, 49, 9, 68, 10, 37, 23, 44, 34), +- CABAC_ENTRY(424, 45, 27, 66, 27, 31, 38, 33, 54), +- CABAC_ENTRY(425, 36, 59, 47, 57, 20, 64, 19, 82), +- CABAC_ENTRY(426, -6, 66, -5, 71, -9, 71, -3, 75), +- CABAC_ENTRY(427, -7, 35, 0, 24, -7, 37, -1, 23), +- CABAC_ENTRY(428, -7, 42, -1, 36, -8, 44, 1, 34), +- CABAC_ENTRY(429, -8, 45, -2, 42, -11, 49, 1, 43), +- CABAC_ENTRY(430, -5, 48, -2, 52, -10, 56, 0, 54), +- CABAC_ENTRY(431, -12, 56, -9, 57, -12, 59, -2, 55), +- CABAC_ENTRY(432, -6, 60, -6, 63, -8, 63, 0, 61), +- CABAC_ENTRY(433, -5, 62, -4, 65, -9, 67, 1, 64), +- CABAC_ENTRY(434, -8, 66, -4, 67, -6, 68, 0, 68), +- CABAC_ENTRY(435, -8, 76, -7, 82, -10, 79, -9, 92), +- CABAC_ENTRY(436, -5, 85, -3, 81, -3, 78, -14, 106), +- CABAC_ENTRY(437, -6, 81, -3, 76, -8, 74, -13, 97), +- CABAC_ENTRY(438, -10, 77, -7, 72, -9, 72, -15, 90), +- CABAC_ENTRY(439, -7, 81, -6, 78, -10, 72, -12, 90), +- CABAC_ENTRY(440, -17, 80, -12, 72, -18, 75, -18, 88), +- CABAC_ENTRY(441, -18, 73, -14, 68, -12, 71, -10, 73), +- CABAC_ENTRY(442, -4, 74, -3, 70, -11, 63, -9, 79), +- CABAC_ENTRY(443, -10, 83, -6, 76, -5, 70, -14, 86), +- CABAC_ENTRY(444, -9, 71, -5, 66, -17, 75, -10, 73), +- CABAC_ENTRY(445, -9, 67, -5, 62, -14, 72, -10, 70), +- CABAC_ENTRY(446, -1, 61, 0, 57, -16, 67, -10, 69), +- CABAC_ENTRY(447, -8, 66, -4, 61, -8, 53, -5, 66), +- CABAC_ENTRY(448, -14, 66, -9, 60, -14, 59, -9, 64), +- CABAC_ENTRY(449, 0, 59, 1, 54, -9, 52, -5, 58), +- CABAC_ENTRY(450, 2, 59, 2, 58, -11, 68, 2, 59), +- CABAC_ENTRY(451, 21, -13, 17, -10, 9, -2, 21, -10), +- CABAC_ENTRY(452, 33, -14, 32, -13, 30, -10, 24, -11), +- CABAC_ENTRY(453, 39, -7, 42, -9, 31, -4, 28, -8), +- CABAC_ENTRY(454, 46, -2, 49, -5, 33, -1, 28, -1), +- CABAC_ENTRY(455, 51, 2, 53, 0, 33, 7, 29, 3), +- CABAC_ENTRY(456, 60, 6, 64, 3, 31, 12, 29, 9), +- CABAC_ENTRY(457, 61, 17, 68, 10, 37, 23, 35, 20), +- CABAC_ENTRY(458, 55, 34, 66, 27, 31, 38, 29, 36), +- CABAC_ENTRY(459, 42, 62, 47, 57, 20, 64, 14, 67), +-}; +- + static void set_ps_field(u32 *buf, struct rkvdec_ps_field field, u32 value) + { + u8 bit = field.offset % 32, word = field.offset / 32; +diff --git a/include/media/v4l2-cabac/rkvdec-cabac.h b/include/media/v4l2-cabac/rkvdec-cabac.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/include/media/v4l2-cabac/rkvdec-cabac.h +@@ -0,0 +1,509 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++ ++/* ++ * Define the H264 CABAC table common to rkvdec and rkvdec2 drivers. ++ */ ++ ++#ifndef RKVDEC_H264_CABAC_H_ ++#define RKVDEC_H264_CABAC_H_ ++ ++#define CABAC_ENTRY(ctxidx, idc0_m, idc0_n, idc1_m, idc1_n, \ ++ idc2_m, idc2_n, intra_m, intra_n) \ ++ [0][(ctxidx)] = {idc0_m, idc0_n}, \ ++ [1][(ctxidx)] = {idc1_m, idc1_n}, \ ++ [2][(ctxidx)] = {idc2_m, idc2_n}, \ ++ [3][(ctxidx)] = {intra_m, intra_n} ++ ++/* ++ * Constant CABAC table. ++ * Built from the tables described in section '9.3.1.1 Initialisation process ++ * for context variables' of the H264 spec. ++ */ ++static const s8 rkvdec_h264_cabac_table[4][464][2] = { ++ /* Table 9-12 – Values of variables m and n for ctxIdx from 0 to 10 */ ++ CABAC_ENTRY(0, 20, -15, 20, -15, 20, -15, 20, -15), ++ CABAC_ENTRY(1, 2, 54, 2, 54, 2, 54, 2, 54), ++ CABAC_ENTRY(2, 3, 74, 3, 74, 3, 74, 3, 74), ++ CABAC_ENTRY(3, 20, -15, 20, -15, 20, -15, 20, -15), ++ CABAC_ENTRY(4, 2, 54, 2, 54, 2, 54, 2, 54), ++ CABAC_ENTRY(5, 3, 74, 3, 74, 3, 74, 3, 74), ++ CABAC_ENTRY(6, -28, 127, -28, 127, -28, 127, -28, 127), ++ CABAC_ENTRY(7, -23, 104, -23, 104, -23, 104, -23, 104), ++ CABAC_ENTRY(8, -6, 53, -6, 53, -6, 53, -6, 53), ++ CABAC_ENTRY(9, -1, 54, -1, 54, -1, 54, -1, 54), ++ CABAC_ENTRY(10, 7, 51, 7, 51, 7, 51, 7, 51), ++ ++ /* Table 9-13 – Values of variables m and n for ctxIdx from 11 to 23 */ ++ CABAC_ENTRY(11, 23, 33, 22, 25, 29, 16, 0, 0), ++ CABAC_ENTRY(12, 23, 2, 34, 0, 25, 0, 0, 0), ++ CABAC_ENTRY(13, 21, 0, 16, 0, 14, 0, 0, 0), ++ CABAC_ENTRY(14, 1, 9, -2, 9, -10, 51, 0, 0), ++ CABAC_ENTRY(15, 0, 49, 4, 41, -3, 62, 0, 0), ++ CABAC_ENTRY(16, -37, 118, -29, 118, -27, 99, 0, 0), ++ CABAC_ENTRY(17, 5, 57, 2, 65, 26, 16, 0, 0), ++ CABAC_ENTRY(18, -13, 78, -6, 71, -4, 85, 0, 0), ++ CABAC_ENTRY(19, -11, 65, -13, 79, -24, 102, 0, 0), ++ CABAC_ENTRY(20, 1, 62, 5, 52, 5, 57, 0, 0), ++ CABAC_ENTRY(21, 12, 49, 9, 50, 6, 57, 0, 0), ++ CABAC_ENTRY(22, -4, 73, -3, 70, -17, 73, 0, 0), ++ CABAC_ENTRY(23, 17, 50, 10, 54, 14, 57, 0, 0), ++ ++ /* Table 9-14 – Values of variables m and n for ctxIdx from 24 to 39 */ ++ CABAC_ENTRY(24, 18, 64, 26, 34, 20, 40, 0, 0), ++ CABAC_ENTRY(25, 9, 43, 19, 22, 20, 10, 0, 0), ++ CABAC_ENTRY(26, 29, 0, 40, 0, 29, 0, 0, 0), ++ CABAC_ENTRY(27, 26, 67, 57, 2, 54, 0, 0, 0), ++ CABAC_ENTRY(28, 16, 90, 41, 36, 37, 42, 0, 0), ++ CABAC_ENTRY(29, 9, 104, 26, 69, 12, 97, 0, 0), ++ CABAC_ENTRY(30, -46, 127, -45, 127, -32, 127, 0, 0), ++ CABAC_ENTRY(31, -20, 104, -15, 101, -22, 117, 0, 0), ++ CABAC_ENTRY(32, 1, 67, -4, 76, -2, 74, 0, 0), ++ CABAC_ENTRY(33, -13, 78, -6, 71, -4, 85, 0, 0), ++ CABAC_ENTRY(34, -11, 65, -13, 79, -24, 102, 0, 0), ++ CABAC_ENTRY(35, 1, 62, 5, 52, 5, 57, 0, 0), ++ CABAC_ENTRY(36, -6, 86, 6, 69, -6, 93, 0, 0), ++ CABAC_ENTRY(37, -17, 95, -13, 90, -14, 88, 0, 0), ++ CABAC_ENTRY(38, -6, 61, 0, 52, -6, 44, 0, 0), ++ CABAC_ENTRY(39, 9, 45, 8, 43, 4, 55, 0, 0), ++ ++ /* Table 9-15 – Values of variables m and n for ctxIdx from 40 to 53 */ ++ CABAC_ENTRY(40, -3, 69, -2, 69, -11, 89, 0, 0), ++ CABAC_ENTRY(41, -6, 81, -5, 82, -15, 103, 0, 0), ++ CABAC_ENTRY(42, -11, 96, -10, 96, -21, 116, 0, 0), ++ CABAC_ENTRY(43, 6, 55, 2, 59, 19, 57, 0, 0), ++ CABAC_ENTRY(44, 7, 67, 2, 75, 20, 58, 0, 0), ++ CABAC_ENTRY(45, -5, 86, -3, 87, 4, 84, 0, 0), ++ CABAC_ENTRY(46, 2, 88, -3, 100, 6, 96, 0, 0), ++ CABAC_ENTRY(47, 0, 58, 1, 56, 1, 63, 0, 0), ++ CABAC_ENTRY(48, -3, 76, -3, 74, -5, 85, 0, 0), ++ CABAC_ENTRY(49, -10, 94, -6, 85, -13, 106, 0, 0), ++ CABAC_ENTRY(50, 5, 54, 0, 59, 5, 63, 0, 0), ++ CABAC_ENTRY(51, 4, 69, -3, 81, 6, 75, 0, 0), ++ CABAC_ENTRY(52, -3, 81, -7, 86, -3, 90, 0, 0), ++ CABAC_ENTRY(53, 0, 88, -5, 95, -1, 101, 0, 0), ++ ++ /* Table 9-16 – Values of variables m and n for ctxIdx from 54 to 59 */ ++ CABAC_ENTRY(54, -7, 67, -1, 66, 3, 55, 0, 0), ++ CABAC_ENTRY(55, -5, 74, -1, 77, -4, 79, 0, 0), ++ CABAC_ENTRY(56, -4, 74, 1, 70, -2, 75, 0, 0), ++ CABAC_ENTRY(57, -5, 80, -2, 86, -12, 97, 0, 0), ++ CABAC_ENTRY(58, -7, 72, -5, 72, -7, 50, 0, 0), ++ CABAC_ENTRY(59, 1, 58, 0, 61, 1, 60, 0, 0), ++ ++ /* Table 9-17 – Values of variables m and n for ctxIdx from 60 to 69 */ ++ CABAC_ENTRY(60, 0, 41, 0, 41, 0, 41, 0, 41), ++ CABAC_ENTRY(61, 0, 63, 0, 63, 0, 63, 0, 63), ++ CABAC_ENTRY(62, 0, 63, 0, 63, 0, 63, 0, 63), ++ CABAC_ENTRY(63, 0, 63, 0, 63, 0, 63, 0, 63), ++ CABAC_ENTRY(64, -9, 83, -9, 83, -9, 83, -9, 83), ++ CABAC_ENTRY(65, 4, 86, 4, 86, 4, 86, 4, 86), ++ CABAC_ENTRY(66, 0, 97, 0, 97, 0, 97, 0, 97), ++ CABAC_ENTRY(67, -7, 72, -7, 72, -7, 72, -7, 72), ++ CABAC_ENTRY(68, 13, 41, 13, 41, 13, 41, 13, 41), ++ CABAC_ENTRY(69, 3, 62, 3, 62, 3, 62, 3, 62), ++ ++ /* Table 9-18 – Values of variables m and n for ctxIdx from 70 to 104 */ ++ CABAC_ENTRY(70, 0, 45, 13, 15, 7, 34, 0, 11), ++ CABAC_ENTRY(71, -4, 78, 7, 51, -9, 88, 1, 55), ++ CABAC_ENTRY(72, -3, 96, 2, 80, -20, 127, 0, 69), ++ CABAC_ENTRY(73, -27, 126, -39, 127, -36, 127, -17, 127), ++ CABAC_ENTRY(74, -28, 98, -18, 91, -17, 91, -13, 102), ++ CABAC_ENTRY(75, -25, 101, -17, 96, -14, 95, 0, 82), ++ CABAC_ENTRY(76, -23, 67, -26, 81, -25, 84, -7, 74), ++ CABAC_ENTRY(77, -28, 82, -35, 98, -25, 86, -21, 107), ++ CABAC_ENTRY(78, -20, 94, -24, 102, -12, 89, -27, 127), ++ CABAC_ENTRY(79, -16, 83, -23, 97, -17, 91, -31, 127), ++ CABAC_ENTRY(80, -22, 110, -27, 119, -31, 127, -24, 127), ++ CABAC_ENTRY(81, -21, 91, -24, 99, -14, 76, -18, 95), ++ CABAC_ENTRY(82, -18, 102, -21, 110, -18, 103, -27, 127), ++ CABAC_ENTRY(83, -13, 93, -18, 102, -13, 90, -21, 114), ++ CABAC_ENTRY(84, -29, 127, -36, 127, -37, 127, -30, 127), ++ CABAC_ENTRY(85, -7, 92, 0, 80, 11, 80, -17, 123), ++ CABAC_ENTRY(86, -5, 89, -5, 89, 5, 76, -12, 115), ++ CABAC_ENTRY(87, -7, 96, -7, 94, 2, 84, -16, 122), ++ CABAC_ENTRY(88, -13, 108, -4, 92, 5, 78, -11, 115), ++ CABAC_ENTRY(89, -3, 46, 0, 39, -6, 55, -12, 63), ++ CABAC_ENTRY(90, -1, 65, 0, 65, 4, 61, -2, 68), ++ CABAC_ENTRY(91, -1, 57, -15, 84, -14, 83, -15, 84), ++ CABAC_ENTRY(92, -9, 93, -35, 127, -37, 127, -13, 104), ++ CABAC_ENTRY(93, -3, 74, -2, 73, -5, 79, -3, 70), ++ CABAC_ENTRY(94, -9, 92, -12, 104, -11, 104, -8, 93), ++ CABAC_ENTRY(95, -8, 87, -9, 91, -11, 91, -10, 90), ++ CABAC_ENTRY(96, -23, 126, -31, 127, -30, 127, -30, 127), ++ CABAC_ENTRY(97, 5, 54, 3, 55, 0, 65, -1, 74), ++ CABAC_ENTRY(98, 6, 60, 7, 56, -2, 79, -6, 97), ++ CABAC_ENTRY(99, 6, 59, 7, 55, 0, 72, -7, 91), ++ CABAC_ENTRY(100, 6, 69, 8, 61, -4, 92, -20, 127), ++ CABAC_ENTRY(101, -1, 48, -3, 53, -6, 56, -4, 56), ++ CABAC_ENTRY(102, 0, 68, 0, 68, 3, 68, -5, 82), ++ CABAC_ENTRY(103, -4, 69, -7, 74, -8, 71, -7, 76), ++ CABAC_ENTRY(104, -8, 88, -9, 88, -13, 98, -22, 125), ++ ++ /* Table 9-19 – Values of variables m and n for ctxIdx from 105 to 165 */ ++ CABAC_ENTRY(105, -2, 85, -13, 103, -4, 86, -7, 93), ++ CABAC_ENTRY(106, -6, 78, -13, 91, -12, 88, -11, 87), ++ CABAC_ENTRY(107, -1, 75, -9, 89, -5, 82, -3, 77), ++ CABAC_ENTRY(108, -7, 77, -14, 92, -3, 72, -5, 71), ++ CABAC_ENTRY(109, 2, 54, -8, 76, -4, 67, -4, 63), ++ CABAC_ENTRY(110, 5, 50, -12, 87, -8, 72, -4, 68), ++ CABAC_ENTRY(111, -3, 68, -23, 110, -16, 89, -12, 84), ++ CABAC_ENTRY(112, 1, 50, -24, 105, -9, 69, -7, 62), ++ CABAC_ENTRY(113, 6, 42, -10, 78, -1, 59, -7, 65), ++ CABAC_ENTRY(114, -4, 81, -20, 112, 5, 66, 8, 61), ++ CABAC_ENTRY(115, 1, 63, -17, 99, 4, 57, 5, 56), ++ CABAC_ENTRY(116, -4, 70, -78, 127, -4, 71, -2, 66), ++ CABAC_ENTRY(117, 0, 67, -70, 127, -2, 71, 1, 64), ++ CABAC_ENTRY(118, 2, 57, -50, 127, 2, 58, 0, 61), ++ CABAC_ENTRY(119, -2, 76, -46, 127, -1, 74, -2, 78), ++ CABAC_ENTRY(120, 11, 35, -4, 66, -4, 44, 1, 50), ++ CABAC_ENTRY(121, 4, 64, -5, 78, -1, 69, 7, 52), ++ CABAC_ENTRY(122, 1, 61, -4, 71, 0, 62, 10, 35), ++ CABAC_ENTRY(123, 11, 35, -8, 72, -7, 51, 0, 44), ++ CABAC_ENTRY(124, 18, 25, 2, 59, -4, 47, 11, 38), ++ CABAC_ENTRY(125, 12, 24, -1, 55, -6, 42, 1, 45), ++ CABAC_ENTRY(126, 13, 29, -7, 70, -3, 41, 0, 46), ++ CABAC_ENTRY(127, 13, 36, -6, 75, -6, 53, 5, 44), ++ CABAC_ENTRY(128, -10, 93, -8, 89, 8, 76, 31, 17), ++ CABAC_ENTRY(129, -7, 73, -34, 119, -9, 78, 1, 51), ++ CABAC_ENTRY(130, -2, 73, -3, 75, -11, 83, 7, 50), ++ CABAC_ENTRY(131, 13, 46, 32, 20, 9, 52, 28, 19), ++ CABAC_ENTRY(132, 9, 49, 30, 22, 0, 67, 16, 33), ++ CABAC_ENTRY(133, -7, 100, -44, 127, -5, 90, 14, 62), ++ CABAC_ENTRY(134, 9, 53, 0, 54, 1, 67, -13, 108), ++ CABAC_ENTRY(135, 2, 53, -5, 61, -15, 72, -15, 100), ++ CABAC_ENTRY(136, 5, 53, 0, 58, -5, 75, -13, 101), ++ CABAC_ENTRY(137, -2, 61, -1, 60, -8, 80, -13, 91), ++ CABAC_ENTRY(138, 0, 56, -3, 61, -21, 83, -12, 94), ++ CABAC_ENTRY(139, 0, 56, -8, 67, -21, 64, -10, 88), ++ CABAC_ENTRY(140, -13, 63, -25, 84, -13, 31, -16, 84), ++ CABAC_ENTRY(141, -5, 60, -14, 74, -25, 64, -10, 86), ++ CABAC_ENTRY(142, -1, 62, -5, 65, -29, 94, -7, 83), ++ CABAC_ENTRY(143, 4, 57, 5, 52, 9, 75, -13, 87), ++ CABAC_ENTRY(144, -6, 69, 2, 57, 17, 63, -19, 94), ++ CABAC_ENTRY(145, 4, 57, 0, 61, -8, 74, 1, 70), ++ CABAC_ENTRY(146, 14, 39, -9, 69, -5, 35, 0, 72), ++ CABAC_ENTRY(147, 4, 51, -11, 70, -2, 27, -5, 74), ++ CABAC_ENTRY(148, 13, 68, 18, 55, 13, 91, 18, 59), ++ CABAC_ENTRY(149, 3, 64, -4, 71, 3, 65, -8, 102), ++ CABAC_ENTRY(150, 1, 61, 0, 58, -7, 69, -15, 100), ++ CABAC_ENTRY(151, 9, 63, 7, 61, 8, 77, 0, 95), ++ CABAC_ENTRY(152, 7, 50, 9, 41, -10, 66, -4, 75), ++ CABAC_ENTRY(153, 16, 39, 18, 25, 3, 62, 2, 72), ++ CABAC_ENTRY(154, 5, 44, 9, 32, -3, 68, -11, 75), ++ CABAC_ENTRY(155, 4, 52, 5, 43, -20, 81, -3, 71), ++ CABAC_ENTRY(156, 11, 48, 9, 47, 0, 30, 15, 46), ++ CABAC_ENTRY(157, -5, 60, 0, 44, 1, 7, -13, 69), ++ CABAC_ENTRY(158, -1, 59, 0, 51, -3, 23, 0, 62), ++ CABAC_ENTRY(159, 0, 59, 2, 46, -21, 74, 0, 65), ++ CABAC_ENTRY(160, 22, 33, 19, 38, 16, 66, 21, 37), ++ CABAC_ENTRY(161, 5, 44, -4, 66, -23, 124, -15, 72), ++ CABAC_ENTRY(162, 14, 43, 15, 38, 17, 37, 9, 57), ++ CABAC_ENTRY(163, -1, 78, 12, 42, 44, -18, 16, 54), ++ CABAC_ENTRY(164, 0, 60, 9, 34, 50, -34, 0, 62), ++ CABAC_ENTRY(165, 9, 69, 0, 89, -22, 127, 12, 72), ++ ++ /* Table 9-20 – Values of variables m and n for ctxIdx from 166 to 226 */ ++ CABAC_ENTRY(166, 11, 28, 4, 45, 4, 39, 24, 0), ++ CABAC_ENTRY(167, 2, 40, 10, 28, 0, 42, 15, 9), ++ CABAC_ENTRY(168, 3, 44, 10, 31, 7, 34, 8, 25), ++ CABAC_ENTRY(169, 0, 49, 33, -11, 11, 29, 13, 18), ++ CABAC_ENTRY(170, 0, 46, 52, -43, 8, 31, 15, 9), ++ CABAC_ENTRY(171, 2, 44, 18, 15, 6, 37, 13, 19), ++ CABAC_ENTRY(172, 2, 51, 28, 0, 7, 42, 10, 37), ++ CABAC_ENTRY(173, 0, 47, 35, -22, 3, 40, 12, 18), ++ CABAC_ENTRY(174, 4, 39, 38, -25, 8, 33, 6, 29), ++ CABAC_ENTRY(175, 2, 62, 34, 0, 13, 43, 20, 33), ++ CABAC_ENTRY(176, 6, 46, 39, -18, 13, 36, 15, 30), ++ CABAC_ENTRY(177, 0, 54, 32, -12, 4, 47, 4, 45), ++ CABAC_ENTRY(178, 3, 54, 102, -94, 3, 55, 1, 58), ++ CABAC_ENTRY(179, 2, 58, 0, 0, 2, 58, 0, 62), ++ CABAC_ENTRY(180, 4, 63, 56, -15, 6, 60, 7, 61), ++ CABAC_ENTRY(181, 6, 51, 33, -4, 8, 44, 12, 38), ++ CABAC_ENTRY(182, 6, 57, 29, 10, 11, 44, 11, 45), ++ CABAC_ENTRY(183, 7, 53, 37, -5, 14, 42, 15, 39), ++ CABAC_ENTRY(184, 6, 52, 51, -29, 7, 48, 11, 42), ++ CABAC_ENTRY(185, 6, 55, 39, -9, 4, 56, 13, 44), ++ CABAC_ENTRY(186, 11, 45, 52, -34, 4, 52, 16, 45), ++ CABAC_ENTRY(187, 14, 36, 69, -58, 13, 37, 12, 41), ++ CABAC_ENTRY(188, 8, 53, 67, -63, 9, 49, 10, 49), ++ CABAC_ENTRY(189, -1, 82, 44, -5, 19, 58, 30, 34), ++ CABAC_ENTRY(190, 7, 55, 32, 7, 10, 48, 18, 42), ++ CABAC_ENTRY(191, -3, 78, 55, -29, 12, 45, 10, 55), ++ CABAC_ENTRY(192, 15, 46, 32, 1, 0, 69, 17, 51), ++ CABAC_ENTRY(193, 22, 31, 0, 0, 20, 33, 17, 46), ++ CABAC_ENTRY(194, -1, 84, 27, 36, 8, 63, 0, 89), ++ CABAC_ENTRY(195, 25, 7, 33, -25, 35, -18, 26, -19), ++ CABAC_ENTRY(196, 30, -7, 34, -30, 33, -25, 22, -17), ++ CABAC_ENTRY(197, 28, 3, 36, -28, 28, -3, 26, -17), ++ CABAC_ENTRY(198, 28, 4, 38, -28, 24, 10, 30, -25), ++ CABAC_ENTRY(199, 32, 0, 38, -27, 27, 0, 28, -20), ++ CABAC_ENTRY(200, 34, -1, 34, -18, 34, -14, 33, -23), ++ CABAC_ENTRY(201, 30, 6, 35, -16, 52, -44, 37, -27), ++ CABAC_ENTRY(202, 30, 6, 34, -14, 39, -24, 33, -23), ++ CABAC_ENTRY(203, 32, 9, 32, -8, 19, 17, 40, -28), ++ CABAC_ENTRY(204, 31, 19, 37, -6, 31, 25, 38, -17), ++ CABAC_ENTRY(205, 26, 27, 35, 0, 36, 29, 33, -11), ++ CABAC_ENTRY(206, 26, 30, 30, 10, 24, 33, 40, -15), ++ CABAC_ENTRY(207, 37, 20, 28, 18, 34, 15, 41, -6), ++ CABAC_ENTRY(208, 28, 34, 26, 25, 30, 20, 38, 1), ++ CABAC_ENTRY(209, 17, 70, 29, 41, 22, 73, 41, 17), ++ CABAC_ENTRY(210, 1, 67, 0, 75, 20, 34, 30, -6), ++ CABAC_ENTRY(211, 5, 59, 2, 72, 19, 31, 27, 3), ++ CABAC_ENTRY(212, 9, 67, 8, 77, 27, 44, 26, 22), ++ CABAC_ENTRY(213, 16, 30, 14, 35, 19, 16, 37, -16), ++ CABAC_ENTRY(214, 18, 32, 18, 31, 15, 36, 35, -4), ++ CABAC_ENTRY(215, 18, 35, 17, 35, 15, 36, 38, -8), ++ CABAC_ENTRY(216, 22, 29, 21, 30, 21, 28, 38, -3), ++ CABAC_ENTRY(217, 24, 31, 17, 45, 25, 21, 37, 3), ++ CABAC_ENTRY(218, 23, 38, 20, 42, 30, 20, 38, 5), ++ CABAC_ENTRY(219, 18, 43, 18, 45, 31, 12, 42, 0), ++ CABAC_ENTRY(220, 20, 41, 27, 26, 27, 16, 35, 16), ++ CABAC_ENTRY(221, 11, 63, 16, 54, 24, 42, 39, 22), ++ CABAC_ENTRY(222, 9, 59, 7, 66, 0, 93, 14, 48), ++ CABAC_ENTRY(223, 9, 64, 16, 56, 14, 56, 27, 37), ++ CABAC_ENTRY(224, -1, 94, 11, 73, 15, 57, 21, 60), ++ CABAC_ENTRY(225, -2, 89, 10, 67, 26, 38, 12, 68), ++ CABAC_ENTRY(226, -9, 108, -10, 116, -24, 127, 2, 97), ++ ++ /* Table 9-21 – Values of variables m and n for ctxIdx from 227 to 275 */ ++ CABAC_ENTRY(227, -6, 76, -23, 112, -24, 115, -3, 71), ++ CABAC_ENTRY(228, -2, 44, -15, 71, -22, 82, -6, 42), ++ CABAC_ENTRY(229, 0, 45, -7, 61, -9, 62, -5, 50), ++ CABAC_ENTRY(230, 0, 52, 0, 53, 0, 53, -3, 54), ++ CABAC_ENTRY(231, -3, 64, -5, 66, 0, 59, -2, 62), ++ CABAC_ENTRY(232, -2, 59, -11, 77, -14, 85, 0, 58), ++ CABAC_ENTRY(233, -4, 70, -9, 80, -13, 89, 1, 63), ++ CABAC_ENTRY(234, -4, 75, -9, 84, -13, 94, -2, 72), ++ CABAC_ENTRY(235, -8, 82, -10, 87, -11, 92, -1, 74), ++ CABAC_ENTRY(236, -17, 102, -34, 127, -29, 127, -9, 91), ++ CABAC_ENTRY(237, -9, 77, -21, 101, -21, 100, -5, 67), ++ CABAC_ENTRY(238, 3, 24, -3, 39, -14, 57, -5, 27), ++ CABAC_ENTRY(239, 0, 42, -5, 53, -12, 67, -3, 39), ++ CABAC_ENTRY(240, 0, 48, -7, 61, -11, 71, -2, 44), ++ CABAC_ENTRY(241, 0, 55, -11, 75, -10, 77, 0, 46), ++ CABAC_ENTRY(242, -6, 59, -15, 77, -21, 85, -16, 64), ++ CABAC_ENTRY(243, -7, 71, -17, 91, -16, 88, -8, 68), ++ CABAC_ENTRY(244, -12, 83, -25, 107, -23, 104, -10, 78), ++ CABAC_ENTRY(245, -11, 87, -25, 111, -15, 98, -6, 77), ++ CABAC_ENTRY(246, -30, 119, -28, 122, -37, 127, -10, 86), ++ CABAC_ENTRY(247, 1, 58, -11, 76, -10, 82, -12, 92), ++ CABAC_ENTRY(248, -3, 29, -10, 44, -8, 48, -15, 55), ++ CABAC_ENTRY(249, -1, 36, -10, 52, -8, 61, -10, 60), ++ CABAC_ENTRY(250, 1, 38, -10, 57, -8, 66, -6, 62), ++ CABAC_ENTRY(251, 2, 43, -9, 58, -7, 70, -4, 65), ++ CABAC_ENTRY(252, -6, 55, -16, 72, -14, 75, -12, 73), ++ CABAC_ENTRY(253, 0, 58, -7, 69, -10, 79, -8, 76), ++ CABAC_ENTRY(254, 0, 64, -4, 69, -9, 83, -7, 80), ++ CABAC_ENTRY(255, -3, 74, -5, 74, -12, 92, -9, 88), ++ CABAC_ENTRY(256, -10, 90, -9, 86, -18, 108, -17, 110), ++ CABAC_ENTRY(257, 0, 70, 2, 66, -4, 79, -11, 97), ++ CABAC_ENTRY(258, -4, 29, -9, 34, -22, 69, -20, 84), ++ CABAC_ENTRY(259, 5, 31, 1, 32, -16, 75, -11, 79), ++ CABAC_ENTRY(260, 7, 42, 11, 31, -2, 58, -6, 73), ++ CABAC_ENTRY(261, 1, 59, 5, 52, 1, 58, -4, 74), ++ CABAC_ENTRY(262, -2, 58, -2, 55, -13, 78, -13, 86), ++ CABAC_ENTRY(263, -3, 72, -2, 67, -9, 83, -13, 96), ++ CABAC_ENTRY(264, -3, 81, 0, 73, -4, 81, -11, 97), ++ CABAC_ENTRY(265, -11, 97, -8, 89, -13, 99, -19, 117), ++ CABAC_ENTRY(266, 0, 58, 3, 52, -13, 81, -8, 78), ++ CABAC_ENTRY(267, 8, 5, 7, 4, -6, 38, -5, 33), ++ CABAC_ENTRY(268, 10, 14, 10, 8, -13, 62, -4, 48), ++ CABAC_ENTRY(269, 14, 18, 17, 8, -6, 58, -2, 53), ++ CABAC_ENTRY(270, 13, 27, 16, 19, -2, 59, -3, 62), ++ CABAC_ENTRY(271, 2, 40, 3, 37, -16, 73, -13, 71), ++ CABAC_ENTRY(272, 0, 58, -1, 61, -10, 76, -10, 79), ++ CABAC_ENTRY(273, -3, 70, -5, 73, -13, 86, -12, 86), ++ CABAC_ENTRY(274, -6, 79, -1, 70, -9, 83, -13, 90), ++ CABAC_ENTRY(275, -8, 85, -4, 78, -10, 87, -14, 97), ++ ++ /* Table 9-22 – Values of variables m and n for ctxIdx from 277 to 337 */ ++ CABAC_ENTRY(277, -13, 106, -21, 126, -22, 127, -6, 93), ++ CABAC_ENTRY(278, -16, 106, -23, 124, -25, 127, -6, 84), ++ CABAC_ENTRY(279, -10, 87, -20, 110, -25, 120, -8, 79), ++ CABAC_ENTRY(280, -21, 114, -26, 126, -27, 127, 0, 66), ++ CABAC_ENTRY(281, -18, 110, -25, 124, -19, 114, -1, 71), ++ CABAC_ENTRY(282, -14, 98, -17, 105, -23, 117, 0, 62), ++ CABAC_ENTRY(283, -22, 110, -27, 121, -25, 118, -2, 60), ++ CABAC_ENTRY(284, -21, 106, -27, 117, -26, 117, -2, 59), ++ CABAC_ENTRY(285, -18, 103, -17, 102, -24, 113, -5, 75), ++ CABAC_ENTRY(286, -21, 107, -26, 117, -28, 118, -3, 62), ++ CABAC_ENTRY(287, -23, 108, -27, 116, -31, 120, -4, 58), ++ CABAC_ENTRY(288, -26, 112, -33, 122, -37, 124, -9, 66), ++ CABAC_ENTRY(289, -10, 96, -10, 95, -10, 94, -1, 79), ++ CABAC_ENTRY(290, -12, 95, -14, 100, -15, 102, 0, 71), ++ CABAC_ENTRY(291, -5, 91, -8, 95, -10, 99, 3, 68), ++ CABAC_ENTRY(292, -9, 93, -17, 111, -13, 106, 10, 44), ++ CABAC_ENTRY(293, -22, 94, -28, 114, -50, 127, -7, 62), ++ CABAC_ENTRY(294, -5, 86, -6, 89, -5, 92, 15, 36), ++ CABAC_ENTRY(295, 9, 67, -2, 80, 17, 57, 14, 40), ++ CABAC_ENTRY(296, -4, 80, -4, 82, -5, 86, 16, 27), ++ CABAC_ENTRY(297, -10, 85, -9, 85, -13, 94, 12, 29), ++ CABAC_ENTRY(298, -1, 70, -8, 81, -12, 91, 1, 44), ++ CABAC_ENTRY(299, 7, 60, -1, 72, -2, 77, 20, 36), ++ CABAC_ENTRY(300, 9, 58, 5, 64, 0, 71, 18, 32), ++ CABAC_ENTRY(301, 5, 61, 1, 67, -1, 73, 5, 42), ++ CABAC_ENTRY(302, 12, 50, 9, 56, 4, 64, 1, 48), ++ CABAC_ENTRY(303, 15, 50, 0, 69, -7, 81, 10, 62), ++ CABAC_ENTRY(304, 18, 49, 1, 69, 5, 64, 17, 46), ++ CABAC_ENTRY(305, 17, 54, 7, 69, 15, 57, 9, 64), ++ CABAC_ENTRY(306, 10, 41, -7, 69, 1, 67, -12, 104), ++ CABAC_ENTRY(307, 7, 46, -6, 67, 0, 68, -11, 97), ++ CABAC_ENTRY(308, -1, 51, -16, 77, -10, 67, -16, 96), ++ CABAC_ENTRY(309, 7, 49, -2, 64, 1, 68, -7, 88), ++ CABAC_ENTRY(310, 8, 52, 2, 61, 0, 77, -8, 85), ++ CABAC_ENTRY(311, 9, 41, -6, 67, 2, 64, -7, 85), ++ CABAC_ENTRY(312, 6, 47, -3, 64, 0, 68, -9, 85), ++ CABAC_ENTRY(313, 2, 55, 2, 57, -5, 78, -13, 88), ++ CABAC_ENTRY(314, 13, 41, -3, 65, 7, 55, 4, 66), ++ CABAC_ENTRY(315, 10, 44, -3, 66, 5, 59, -3, 77), ++ CABAC_ENTRY(316, 6, 50, 0, 62, 2, 65, -3, 76), ++ CABAC_ENTRY(317, 5, 53, 9, 51, 14, 54, -6, 76), ++ CABAC_ENTRY(318, 13, 49, -1, 66, 15, 44, 10, 58), ++ CABAC_ENTRY(319, 4, 63, -2, 71, 5, 60, -1, 76), ++ CABAC_ENTRY(320, 6, 64, -2, 75, 2, 70, -1, 83), ++ CABAC_ENTRY(321, -2, 69, -1, 70, -2, 76, -7, 99), ++ CABAC_ENTRY(322, -2, 59, -9, 72, -18, 86, -14, 95), ++ CABAC_ENTRY(323, 6, 70, 14, 60, 12, 70, 2, 95), ++ CABAC_ENTRY(324, 10, 44, 16, 37, 5, 64, 0, 76), ++ CABAC_ENTRY(325, 9, 31, 0, 47, -12, 70, -5, 74), ++ CABAC_ENTRY(326, 12, 43, 18, 35, 11, 55, 0, 70), ++ CABAC_ENTRY(327, 3, 53, 11, 37, 5, 56, -11, 75), ++ CABAC_ENTRY(328, 14, 34, 12, 41, 0, 69, 1, 68), ++ CABAC_ENTRY(329, 10, 38, 10, 41, 2, 65, 0, 65), ++ CABAC_ENTRY(330, -3, 52, 2, 48, -6, 74, -14, 73), ++ CABAC_ENTRY(331, 13, 40, 12, 41, 5, 54, 3, 62), ++ CABAC_ENTRY(332, 17, 32, 13, 41, 7, 54, 4, 62), ++ CABAC_ENTRY(333, 7, 44, 0, 59, -6, 76, -1, 68), ++ CABAC_ENTRY(334, 7, 38, 3, 50, -11, 82, -13, 75), ++ CABAC_ENTRY(335, 13, 50, 19, 40, -2, 77, 11, 55), ++ CABAC_ENTRY(336, 10, 57, 3, 66, -2, 77, 5, 64), ++ CABAC_ENTRY(337, 26, 43, 18, 50, 25, 42, 12, 70), ++ ++ /* Table 9-23 – Values of variables m and n for ctxIdx from 338 to 398 */ ++ CABAC_ENTRY(338, 14, 11, 19, -6, 17, -13, 15, 6), ++ CABAC_ENTRY(339, 11, 14, 18, -6, 16, -9, 6, 19), ++ CABAC_ENTRY(340, 9, 11, 14, 0, 17, -12, 7, 16), ++ CABAC_ENTRY(341, 18, 11, 26, -12, 27, -21, 12, 14), ++ CABAC_ENTRY(342, 21, 9, 31, -16, 37, -30, 18, 13), ++ CABAC_ENTRY(343, 23, -2, 33, -25, 41, -40, 13, 11), ++ CABAC_ENTRY(344, 32, -15, 33, -22, 42, -41, 13, 15), ++ CABAC_ENTRY(345, 32, -15, 37, -28, 48, -47, 15, 16), ++ CABAC_ENTRY(346, 34, -21, 39, -30, 39, -32, 12, 23), ++ CABAC_ENTRY(347, 39, -23, 42, -30, 46, -40, 13, 23), ++ CABAC_ENTRY(348, 42, -33, 47, -42, 52, -51, 15, 20), ++ CABAC_ENTRY(349, 41, -31, 45, -36, 46, -41, 14, 26), ++ CABAC_ENTRY(350, 46, -28, 49, -34, 52, -39, 14, 44), ++ CABAC_ENTRY(351, 38, -12, 41, -17, 43, -19, 17, 40), ++ CABAC_ENTRY(352, 21, 29, 32, 9, 32, 11, 17, 47), ++ CABAC_ENTRY(353, 45, -24, 69, -71, 61, -55, 24, 17), ++ CABAC_ENTRY(354, 53, -45, 63, -63, 56, -46, 21, 21), ++ CABAC_ENTRY(355, 48, -26, 66, -64, 62, -50, 25, 22), ++ CABAC_ENTRY(356, 65, -43, 77, -74, 81, -67, 31, 27), ++ CABAC_ENTRY(357, 43, -19, 54, -39, 45, -20, 22, 29), ++ CABAC_ENTRY(358, 39, -10, 52, -35, 35, -2, 19, 35), ++ CABAC_ENTRY(359, 30, 9, 41, -10, 28, 15, 14, 50), ++ CABAC_ENTRY(360, 18, 26, 36, 0, 34, 1, 10, 57), ++ CABAC_ENTRY(361, 20, 27, 40, -1, 39, 1, 7, 63), ++ CABAC_ENTRY(362, 0, 57, 30, 14, 30, 17, -2, 77), ++ CABAC_ENTRY(363, -14, 82, 28, 26, 20, 38, -4, 82), ++ CABAC_ENTRY(364, -5, 75, 23, 37, 18, 45, -3, 94), ++ CABAC_ENTRY(365, -19, 97, 12, 55, 15, 54, 9, 69), ++ CABAC_ENTRY(366, -35, 125, 11, 65, 0, 79, -12, 109), ++ CABAC_ENTRY(367, 27, 0, 37, -33, 36, -16, 36, -35), ++ CABAC_ENTRY(368, 28, 0, 39, -36, 37, -14, 36, -34), ++ CABAC_ENTRY(369, 31, -4, 40, -37, 37, -17, 32, -26), ++ CABAC_ENTRY(370, 27, 6, 38, -30, 32, 1, 37, -30), ++ CABAC_ENTRY(371, 34, 8, 46, -33, 34, 15, 44, -32), ++ CABAC_ENTRY(372, 30, 10, 42, -30, 29, 15, 34, -18), ++ CABAC_ENTRY(373, 24, 22, 40, -24, 24, 25, 34, -15), ++ CABAC_ENTRY(374, 33, 19, 49, -29, 34, 22, 40, -15), ++ CABAC_ENTRY(375, 22, 32, 38, -12, 31, 16, 33, -7), ++ CABAC_ENTRY(376, 26, 31, 40, -10, 35, 18, 35, -5), ++ CABAC_ENTRY(377, 21, 41, 38, -3, 31, 28, 33, 0), ++ CABAC_ENTRY(378, 26, 44, 46, -5, 33, 41, 38, 2), ++ CABAC_ENTRY(379, 23, 47, 31, 20, 36, 28, 33, 13), ++ CABAC_ENTRY(380, 16, 65, 29, 30, 27, 47, 23, 35), ++ CABAC_ENTRY(381, 14, 71, 25, 44, 21, 62, 13, 58), ++ CABAC_ENTRY(382, 8, 60, 12, 48, 18, 31, 29, -3), ++ CABAC_ENTRY(383, 6, 63, 11, 49, 19, 26, 26, 0), ++ CABAC_ENTRY(384, 17, 65, 26, 45, 36, 24, 22, 30), ++ CABAC_ENTRY(385, 21, 24, 22, 22, 24, 23, 31, -7), ++ CABAC_ENTRY(386, 23, 20, 23, 22, 27, 16, 35, -15), ++ CABAC_ENTRY(387, 26, 23, 27, 21, 24, 30, 34, -3), ++ CABAC_ENTRY(388, 27, 32, 33, 20, 31, 29, 34, 3), ++ CABAC_ENTRY(389, 28, 23, 26, 28, 22, 41, 36, -1), ++ CABAC_ENTRY(390, 28, 24, 30, 24, 22, 42, 34, 5), ++ CABAC_ENTRY(391, 23, 40, 27, 34, 16, 60, 32, 11), ++ CABAC_ENTRY(392, 24, 32, 18, 42, 15, 52, 35, 5), ++ CABAC_ENTRY(393, 28, 29, 25, 39, 14, 60, 34, 12), ++ CABAC_ENTRY(394, 23, 42, 18, 50, 3, 78, 39, 11), ++ CABAC_ENTRY(395, 19, 57, 12, 70, -16, 123, 30, 29), ++ CABAC_ENTRY(396, 22, 53, 21, 54, 21, 53, 34, 26), ++ CABAC_ENTRY(397, 22, 61, 14, 71, 22, 56, 29, 39), ++ CABAC_ENTRY(398, 11, 86, 11, 83, 25, 61, 19, 66), ++ ++ /* Values of variables m and n for ctxIdx from 399 to 463 (not documented) */ ++ CABAC_ENTRY(399, 12, 40, 25, 32, 21, 33, 31, 21), ++ CABAC_ENTRY(400, 11, 51, 21, 49, 19, 50, 31, 31), ++ CABAC_ENTRY(401, 14, 59, 21, 54, 17, 61, 25, 50), ++ CABAC_ENTRY(402, -4, 79, -5, 85, -3, 78, -17, 120), ++ CABAC_ENTRY(403, -7, 71, -6, 81, -8, 74, -20, 112), ++ CABAC_ENTRY(404, -5, 69, -10, 77, -9, 72, -18, 114), ++ CABAC_ENTRY(405, -9, 70, -7, 81, -10, 72, -11, 85), ++ CABAC_ENTRY(406, -8, 66, -17, 80, -18, 75, -15, 92), ++ CABAC_ENTRY(407, -10, 68, -18, 73, -12, 71, -14, 89), ++ CABAC_ENTRY(408, -19, 73, -4, 74, -11, 63, -26, 71), ++ CABAC_ENTRY(409, -12, 69, -10, 83, -5, 70, -15, 81), ++ CABAC_ENTRY(410, -16, 70, -9, 71, -17, 75, -14, 80), ++ CABAC_ENTRY(411, -15, 67, -9, 67, -14, 72, 0, 68), ++ CABAC_ENTRY(412, -20, 62, -1, 61, -16, 67, -14, 70), ++ CABAC_ENTRY(413, -19, 70, -8, 66, -8, 53, -24, 56), ++ CABAC_ENTRY(414, -16, 66, -14, 66, -14, 59, -23, 68), ++ CABAC_ENTRY(415, -22, 65, 0, 59, -9, 52, -24, 50), ++ CABAC_ENTRY(416, -20, 63, 2, 59, -11, 68, -11, 74), ++ CABAC_ENTRY(417, 9, -2, 17, -10, 9, -2, 23, -13), ++ CABAC_ENTRY(418, 26, -9, 32, -13, 30, -10, 26, -13), ++ CABAC_ENTRY(419, 33, -9, 42, -9, 31, -4, 40, -15), ++ CABAC_ENTRY(420, 39, -7, 49, -5, 33, -1, 49, -14), ++ CABAC_ENTRY(421, 41, -2, 53, 0, 33, 7, 44, 3), ++ CABAC_ENTRY(422, 45, 3, 64, 3, 31, 12, 45, 6), ++ CABAC_ENTRY(423, 49, 9, 68, 10, 37, 23, 44, 34), ++ CABAC_ENTRY(424, 45, 27, 66, 27, 31, 38, 33, 54), ++ CABAC_ENTRY(425, 36, 59, 47, 57, 20, 64, 19, 82), ++ CABAC_ENTRY(426, -6, 66, -5, 71, -9, 71, -3, 75), ++ CABAC_ENTRY(427, -7, 35, 0, 24, -7, 37, -1, 23), ++ CABAC_ENTRY(428, -7, 42, -1, 36, -8, 44, 1, 34), ++ CABAC_ENTRY(429, -8, 45, -2, 42, -11, 49, 1, 43), ++ CABAC_ENTRY(430, -5, 48, -2, 52, -10, 56, 0, 54), ++ CABAC_ENTRY(431, -12, 56, -9, 57, -12, 59, -2, 55), ++ CABAC_ENTRY(432, -6, 60, -6, 63, -8, 63, 0, 61), ++ CABAC_ENTRY(433, -5, 62, -4, 65, -9, 67, 1, 64), ++ CABAC_ENTRY(434, -8, 66, -4, 67, -6, 68, 0, 68), ++ CABAC_ENTRY(435, -8, 76, -7, 82, -10, 79, -9, 92), ++ CABAC_ENTRY(436, -5, 85, -3, 81, -3, 78, -14, 106), ++ CABAC_ENTRY(437, -6, 81, -3, 76, -8, 74, -13, 97), ++ CABAC_ENTRY(438, -10, 77, -7, 72, -9, 72, -15, 90), ++ CABAC_ENTRY(439, -7, 81, -6, 78, -10, 72, -12, 90), ++ CABAC_ENTRY(440, -17, 80, -12, 72, -18, 75, -18, 88), ++ CABAC_ENTRY(441, -18, 73, -14, 68, -12, 71, -10, 73), ++ CABAC_ENTRY(442, -4, 74, -3, 70, -11, 63, -9, 79), ++ CABAC_ENTRY(443, -10, 83, -6, 76, -5, 70, -14, 86), ++ CABAC_ENTRY(444, -9, 71, -5, 66, -17, 75, -10, 73), ++ CABAC_ENTRY(445, -9, 67, -5, 62, -14, 72, -10, 70), ++ CABAC_ENTRY(446, -1, 61, 0, 57, -16, 67, -10, 69), ++ CABAC_ENTRY(447, -8, 66, -4, 61, -8, 53, -5, 66), ++ CABAC_ENTRY(448, -14, 66, -9, 60, -14, 59, -9, 64), ++ CABAC_ENTRY(449, 0, 59, 1, 54, -9, 52, -5, 58), ++ CABAC_ENTRY(450, 2, 59, 2, 58, -11, 68, 2, 59), ++ CABAC_ENTRY(451, 21, -13, 17, -10, 9, -2, 21, -10), ++ CABAC_ENTRY(452, 33, -14, 32, -13, 30, -10, 24, -11), ++ CABAC_ENTRY(453, 39, -7, 42, -9, 31, -4, 28, -8), ++ CABAC_ENTRY(454, 46, -2, 49, -5, 33, -1, 28, -1), ++ CABAC_ENTRY(455, 51, 2, 53, 0, 33, 7, 29, 3), ++ CABAC_ENTRY(456, 60, 6, 64, 3, 31, 12, 29, 9), ++ CABAC_ENTRY(457, 61, 17, 68, 10, 37, 23, 35, 20), ++ CABAC_ENTRY(458, 55, 34, 66, 27, 31, 38, 29, 36), ++ CABAC_ENTRY(459, 42, 62, 47, 57, 20, 64, 14, 67), ++}; ++ ++#endif /* RKVDEC_H264_CABAC_H_ */ +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Fri, 14 Jun 2024 19:52:12 -0400 +Subject: media: rockchip: Introduce the rkvdec2 driver + +This driver supports the second generation of the Rockchip Video +decoder, also known as vdpu34x. +It is currently only used on the RK3588(s) SoC. + +There are 2 decoders on the RK3588 SoC that can work in pair to decode +8K video at 30 FPS but currently, only using one core at a time is +supported. + +Scheduling requests between the two cores will be implemented later. + +The core supports H264, HEVC, VP9 and AVS2 decoding but this driver +currently only supports H264. + +The driver is based on rkvdec and they may share some code in the +future. +The decision to make a different driver is mainly because rkvdec2 has +more features and can work with multiple cores. + +The registers are mapped in a struct in RAM using bitfields. It is IO +copied to the HW when all values are configured. +The decision to use such a struct instead of writing buffers one by one +is based on the following reasons: + - Rockchip cores are known to misbehave when registers are not written + in address order, + - Those cores also need the software to write all registers, even if + they are written their default values or are not related to the task + (this core will not start decoding some H264 frames if some VP9 + registers are not written to 0) + - In the future, to support multiple cores, the scheduler could be + optimized by storing the precomputed registers values and copy them + to the HW as soos as a core becomes available. + +This makes the code more readable and may bring performance improvements +in future features. + +Signed-off-by: Detlev Casanova +--- + drivers/media/platform/rockchip/Kconfig | 1 + + drivers/media/platform/rockchip/Makefile | 1 + + drivers/media/platform/rockchip/rkvdec2/Kconfig | 15 + + drivers/media/platform/rockchip/rkvdec2/Makefile | 3 + + drivers/media/platform/rockchip/rkvdec2/rkvdec2-h264.c | 744 ++++++ + drivers/media/platform/rockchip/rkvdec2/rkvdec2-regs.h | 346 +++ + drivers/media/platform/rockchip/rkvdec2/rkvdec2.c | 1263 ++++++++++ + drivers/media/platform/rockchip/rkvdec2/rkvdec2.h | 130 + + 8 files changed, 2503 insertions(+) + +diff --git a/drivers/media/platform/rockchip/Kconfig b/drivers/media/platform/rockchip/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/rockchip/Kconfig ++++ b/drivers/media/platform/rockchip/Kconfig +@@ -4,3 +4,4 @@ comment "Rockchip media platform drivers" + + source "drivers/media/platform/rockchip/rga/Kconfig" + source "drivers/media/platform/rockchip/rkisp1/Kconfig" ++source "drivers/media/platform/rockchip/rkvdec2/Kconfig" +diff --git a/drivers/media/platform/rockchip/Makefile b/drivers/media/platform/rockchip/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/rockchip/Makefile ++++ b/drivers/media/platform/rockchip/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0-only + obj-y += rga/ + obj-y += rkisp1/ ++obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC2) += rkvdec2/ +diff --git a/drivers/media/platform/rockchip/rkvdec2/Kconfig b/drivers/media/platform/rockchip/rkvdec2/Kconfig +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/rockchip/rkvdec2/Kconfig +@@ -0,0 +1,15 @@ ++# SPDX-License-Identifier: GPL-2.0 ++config VIDEO_ROCKCHIP_VDEC2 ++ tristate "Rockchip Video Decoder driver 2" ++ depends on ARCH_ROCKCHIP || COMPILE_TEST ++ depends on VIDEO_DEV ++ select MEDIA_CONTROLLER ++ select VIDEOBUF2_DMA_CONTIG ++ select VIDEOBUF2_VMALLOC ++ select V4L2_MEM2MEM_DEV ++ select V4L2_H264 ++ help ++ Support for the Rockchip Video Decoder 2 IP present on Rockchip SoCs, ++ which accelerates video decoding. ++ To compile this driver as a module, choose M here: the module ++ will be called rockchip-vdec2. +diff --git a/drivers/media/platform/rockchip/rkvdec2/Makefile b/drivers/media/platform/rockchip/rkvdec2/Makefile +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/rockchip/rkvdec2/Makefile +@@ -0,0 +1,3 @@ ++obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC2) += rockchip-vdec2.o ++ ++rockchip-vdec2-y += rkvdec2.o rkvdec2-h264.o +diff --git a/drivers/media/platform/rockchip/rkvdec2/rkvdec2-h264.c b/drivers/media/platform/rockchip/rkvdec2/rkvdec2-h264.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/rockchip/rkvdec2/rkvdec2-h264.c +@@ -0,0 +1,744 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Rockchip Video Decoder 2 H264 backend ++ * ++ * Copyright (C) 2024 Collabora, Ltd. ++ * Detlev Casanova ++ * ++ * Based on rkvdec driver by Boris Brezillon ++ */ ++ ++#include ++#include ++#include ++ ++#include "rkvdec2.h" ++#include "rkvdec2-regs.h" ++ ++#define RKVDEC_NUM_REFLIST 3 ++ ++struct rkvdec2_h264_scaling_list { ++ u8 scaling_list_4x4[6][16]; ++ u8 scaling_list_8x8[6][64]; ++ u8 padding[128]; ++}; ++ ++struct rkvdec2_sps { ++ u16 seq_parameter_set_id: 4; ++ u16 profile_idc: 8; ++ u16 constraint_set3_flag: 1; ++ u16 chroma_format_idc: 2; ++ u16 bit_depth_luma: 3; ++ u16 bit_depth_chroma: 3; ++ u16 qpprime_y_zero_transform_bypass_flag: 1; ++ u16 log2_max_frame_num_minus4: 4; ++ u16 max_num_ref_frames: 5; ++ u16 pic_order_cnt_type: 2; ++ u16 log2_max_pic_order_cnt_lsb_minus4: 4; ++ u16 delta_pic_order_always_zero_flag: 1; ++ u16 pic_width_in_mbs: 12; ++ u16 pic_height_in_mbs: 12; ++ u16 frame_mbs_only_flag: 1; ++ u16 mb_adaptive_frame_field_flag: 1; ++ u16 direct_8x8_inference_flag: 1; ++ u16 mvc_extension_enable: 1; ++ u16 num_views: 2; ++ ++ u16 reserved_bits: 12; ++ u16 reserved[11]; ++} __packed; ++ ++struct rkvdec2_pps { ++ u16 pic_parameter_set_id: 8; ++ u16 pps_seq_parameter_set_id: 5; ++ u16 entropy_coding_mode_flag: 1; ++ u16 bottom_field_pic_order_in_frame_present_flag: 1; ++ u16 num_ref_idx_l0_default_active_minus1: 5; ++ u16 num_ref_idx_l1_default_active_minus1: 5; ++ u16 weighted_pred_flag: 1; ++ u16 weighted_bipred_idc: 2; ++ u16 pic_init_qp_minus26: 7; ++ u16 pic_init_qs_minus26: 6; ++ u16 chroma_qp_index_offset: 5; ++ u16 deblocking_filter_control_present_flag: 1; ++ u16 constrained_intra_pred_flag: 1; ++ u16 redundant_pic_cnt_present: 1; ++ u16 transform_8x8_mode_flag: 1; ++ u16 second_chroma_qp_index_offset: 5; ++ u16 scaling_list_enable_flag: 1; ++ u32 scaling_list_address; ++ u16 is_longterm; ++ ++ u8 reserved[3]; ++} __packed; ++ ++struct rkvdec2_rps_entry { ++ u32 dpb_info0: 5; ++ u32 bottom_flag0: 1; ++ u32 view_index_off0: 1; ++ u32 dpb_info1: 5; ++ u32 bottom_flag1: 1; ++ u32 view_index_off1: 1; ++ u32 dpb_info2: 5; ++ u32 bottom_flag2: 1; ++ u32 view_index_off2: 1; ++ u32 dpb_info3: 5; ++ u32 bottom_flag3: 1; ++ u32 view_index_off3: 1; ++ u32 dpb_info4: 5; ++ u32 bottom_flag4: 1; ++ u32 view_index_off4: 1; ++ u32 dpb_info5: 5; ++ u32 bottom_flag5: 1; ++ u32 view_index_off5: 1; ++ u32 dpb_info6: 5; ++ u32 bottom_flag6: 1; ++ u32 view_index_off6: 1; ++ u32 dpb_info7: 5; ++ u32 bottom_flag7: 1; ++ u32 view_index_off7: 1; ++} __packed; ++ ++struct rkvdec2_rps { ++ u16 frame_num[16]; ++ u32 reserved0; ++ struct rkvdec2_rps_entry entries[12]; ++ u32 reserved1[66]; ++} __packed; ++ ++struct rkvdec2_sps_pps { ++ struct rkvdec2_sps sps; ++ struct rkvdec2_pps pps; ++} __packed; ++ ++/* Data structure describing auxiliary buffer format. */ ++struct rkvdec2_h264_priv_tbl { ++ u32 cabac_table[4][464][2]; ++ struct rkvdec2_h264_scaling_list scaling_list; ++ struct rkvdec2_sps_pps param_set[256]; ++ struct rkvdec2_rps rps; ++}; ++ ++struct rkvdec2_h264_reflists { ++ struct v4l2_h264_reference p[V4L2_H264_REF_LIST_LEN]; ++ struct v4l2_h264_reference b0[V4L2_H264_REF_LIST_LEN]; ++ struct v4l2_h264_reference b1[V4L2_H264_REF_LIST_LEN]; ++}; ++ ++struct rkvdec2_h264_run { ++ struct rkvdec2_run base; ++ const struct v4l2_ctrl_h264_decode_params *decode_params; ++ const struct v4l2_ctrl_h264_sps *sps; ++ const struct v4l2_ctrl_h264_pps *pps; ++ const struct v4l2_ctrl_h264_scaling_matrix *scaling_matrix; ++ struct vb2_buffer *ref_buf[V4L2_H264_NUM_DPB_ENTRIES]; ++}; ++ ++struct rkvdec2_h264_ctx { ++ struct rkvdec2_aux_buf priv_tbl; ++ struct rkvdec2_h264_reflists reflists; ++ struct rkvdec2_regs_h264 regs; ++}; ++ ++static void assemble_hw_pps(struct rkvdec2_ctx *ctx, ++ struct rkvdec2_h264_run *run) ++{ ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ const struct v4l2_ctrl_h264_sps *sps = run->sps; ++ const struct v4l2_ctrl_h264_pps *pps = run->pps; ++ const struct v4l2_ctrl_h264_decode_params *dec_params = run->decode_params; ++ const struct v4l2_h264_dpb_entry *dpb = dec_params->dpb; ++ struct rkvdec2_h264_priv_tbl *priv_tbl = h264_ctx->priv_tbl.cpu; ++ struct rkvdec2_sps_pps *hw_ps; ++ dma_addr_t scaling_list_address; ++ u32 scaling_distance; ++ u32 i; ++ ++ /* ++ * HW read the SPS/PPS information from PPS packet index by PPS id. ++ * offset from the base can be calculated by PPS_id * 32 (size per PPS ++ * packet unit). so the driver copy SPS/PPS information to the exact PPS ++ * packet unit for HW accessing. ++ */ ++ hw_ps = &priv_tbl->param_set[pps->pic_parameter_set_id]; ++ memset(hw_ps, 0, sizeof(*hw_ps)); ++ ++ /* write sps */ ++ hw_ps->sps.seq_parameter_set_id = sps->seq_parameter_set_id; ++ hw_ps->sps.profile_idc = sps->profile_idc; ++ hw_ps->sps.constraint_set3_flag = !!(sps->constraint_set_flags & (1 << 3)); ++ hw_ps->sps.chroma_format_idc = sps->chroma_format_idc; ++ hw_ps->sps.bit_depth_luma = sps->bit_depth_luma_minus8; ++ hw_ps->sps.bit_depth_chroma = sps->bit_depth_chroma_minus8; ++ hw_ps->sps.qpprime_y_zero_transform_bypass_flag = !!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS); ++ hw_ps->sps.log2_max_frame_num_minus4 = sps->log2_max_frame_num_minus4; ++ hw_ps->sps.max_num_ref_frames = sps->max_num_ref_frames; ++ hw_ps->sps.pic_order_cnt_type = sps->pic_order_cnt_type; ++ hw_ps->sps.log2_max_pic_order_cnt_lsb_minus4 = ++ sps->log2_max_pic_order_cnt_lsb_minus4; ++ hw_ps->sps.delta_pic_order_always_zero_flag = ++ !!(sps->flags & V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO); ++ hw_ps->sps.mvc_extension_enable = 1; ++ hw_ps->sps.num_views = 1; ++ ++ /* ++ * Use the SPS values since they are already in macroblocks ++ * dimensions, height can be field height (halved) if ++ * V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY is not set and also it allows ++ * decoding smaller images into larger allocation which can be used ++ * to implementing SVC spatial layer support. ++ */ ++ hw_ps->sps.pic_width_in_mbs = sps->pic_width_in_mbs_minus1 + 1; ++ hw_ps->sps.pic_height_in_mbs = sps->pic_height_in_map_units_minus1 + 1; ++ hw_ps->sps.frame_mbs_only_flag = ++ !!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY); ++ hw_ps->sps.mb_adaptive_frame_field_flag = ++ !!(sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD); ++ hw_ps->sps.direct_8x8_inference_flag = ++ !!(sps->flags & V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE); ++ ++ /* write pps */ ++ hw_ps->pps.pic_parameter_set_id = pps->pic_parameter_set_id; ++ hw_ps->pps.pps_seq_parameter_set_id = pps->seq_parameter_set_id; ++ hw_ps->pps.entropy_coding_mode_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE); ++ hw_ps->pps.bottom_field_pic_order_in_frame_present_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT); ++ hw_ps->pps.num_ref_idx_l0_default_active_minus1 = ++ pps->num_ref_idx_l0_default_active_minus1; ++ hw_ps->pps.num_ref_idx_l1_default_active_minus1 = ++ pps->num_ref_idx_l1_default_active_minus1; ++ hw_ps->pps.weighted_pred_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED); ++ hw_ps->pps.weighted_bipred_idc = pps->weighted_bipred_idc; ++ hw_ps->pps.pic_init_qp_minus26 = pps->pic_init_qp_minus26; ++ hw_ps->pps.pic_init_qs_minus26 = pps->pic_init_qs_minus26; ++ hw_ps->pps.chroma_qp_index_offset = pps->chroma_qp_index_offset; ++ hw_ps->pps.deblocking_filter_control_present_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT); ++ hw_ps->pps.constrained_intra_pred_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED); ++ hw_ps->pps.redundant_pic_cnt_present = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT); ++ hw_ps->pps.transform_8x8_mode_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE); ++ hw_ps->pps.second_chroma_qp_index_offset = pps->second_chroma_qp_index_offset; ++ hw_ps->pps.scaling_list_enable_flag = ++ !!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT); ++ ++ /* ++ * To be on the safe side, program the scaling matrix address ++ * ++ * With this set here, ++ * RKVDEC_SWREG12_SENCODARY_EN:sw_scanlist_addr_valid_en ++ * can stay at 0 ++ */ ++ scaling_distance = offsetof(struct rkvdec2_h264_priv_tbl, scaling_list); ++ scaling_list_address = h264_ctx->priv_tbl.dma + scaling_distance; ++ hw_ps->pps.scaling_list_address = scaling_list_address; ++ ++ for (i = 0; i < ARRAY_SIZE(dec_params->dpb); i++) { ++ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM) ++ hw_ps->pps.is_longterm |= (1 << i); ++ } ++} ++ ++static void lookup_ref_buf_idx(struct rkvdec2_ctx *ctx, ++ struct rkvdec2_h264_run *run) ++{ ++ const struct v4l2_ctrl_h264_decode_params *dec_params = run->decode_params; ++ u32 i; ++ ++ for (i = 0; i < ARRAY_SIZE(dec_params->dpb); i++) { ++ struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; ++ const struct v4l2_h264_dpb_entry *dpb = run->decode_params->dpb; ++ struct vb2_queue *cap_q = &m2m_ctx->cap_q_ctx.q; ++ struct vb2_buffer *buf = NULL; ++ ++ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE) { ++ buf = vb2_find_buffer(cap_q, dpb[i].reference_ts); ++ if (!buf) { ++ dev_dbg(ctx->dev->dev, "No buffer for reference_ts %llu", ++ dpb[i].reference_ts); ++ } ++ } ++ ++ run->ref_buf[i] = buf; ++ } ++} ++ ++static void set_dpb_info(struct rkvdec2_rps_entry *entries, ++ u8 reflist, ++ u8 refnum, ++ u8 info, ++ bool bottom) ++{ ++ struct rkvdec2_rps_entry *entry = &entries[(reflist * 4) + refnum / 8]; ++ u8 idx = refnum % 8; ++ ++ switch (idx) { ++ case 0: ++ entry->dpb_info0 = info; ++ entry->bottom_flag0 = bottom; ++ break; ++ case 1: ++ entry->dpb_info1 = info; ++ entry->bottom_flag1 = bottom; ++ break; ++ case 2: ++ entry->dpb_info2 = info; ++ entry->bottom_flag2 = bottom; ++ break; ++ case 3: ++ entry->dpb_info3 = info; ++ entry->bottom_flag3 = bottom; ++ break; ++ case 4: ++ entry->dpb_info4 = info; ++ entry->bottom_flag4 = bottom; ++ break; ++ case 5: ++ entry->dpb_info5 = info; ++ entry->bottom_flag5 = bottom; ++ break; ++ case 6: ++ entry->dpb_info6 = info; ++ entry->bottom_flag6 = bottom; ++ break; ++ case 7: ++ entry->dpb_info7 = info; ++ entry->bottom_flag7 = bottom; ++ break; ++ } ++} ++ ++static void assemble_hw_rps(struct rkvdec2_ctx *ctx, ++ struct v4l2_h264_reflist_builder *builder, ++ struct rkvdec2_h264_run *run) ++{ ++ const struct v4l2_ctrl_h264_decode_params *dec_params = run->decode_params; ++ const struct v4l2_h264_dpb_entry *dpb = dec_params->dpb; ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ struct rkvdec2_h264_priv_tbl *priv_tbl = h264_ctx->priv_tbl.cpu; ++ ++ struct rkvdec2_rps *hw_rps = &priv_tbl->rps; ++ u32 i, j; ++ ++ memset(hw_rps, 0, sizeof(priv_tbl->rps)); ++ ++ /* ++ * Assign an invalid pic_num if DPB entry at that position is inactive. ++ * If we assign 0 in that position hardware will treat that as a real ++ * reference picture with pic_num 0, triggering output picture ++ * corruption. ++ */ ++ for (i = 0; i < ARRAY_SIZE(dec_params->dpb); i++) { ++ if (!(dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE)) ++ continue; ++ ++ hw_rps->frame_num[i] = builder->refs[i].frame_num; ++ } ++ ++ for (j = 0; j < RKVDEC_NUM_REFLIST; j++) { ++ for (i = 0; i < builder->num_valid; i++) { ++ struct v4l2_h264_reference *ref; ++ bool dpb_valid; ++ bool bottom; ++ ++ switch (j) { ++ case 0: ++ ref = &h264_ctx->reflists.p[i]; ++ break; ++ case 1: ++ ref = &h264_ctx->reflists.b0[i]; ++ break; ++ case 2: ++ ref = &h264_ctx->reflists.b1[i]; ++ break; ++ } ++ ++ if (WARN_ON(ref->index >= ARRAY_SIZE(dec_params->dpb))) ++ continue; ++ ++ dpb_valid = !!(run->ref_buf[ref->index]); ++ bottom = ref->fields == V4L2_H264_BOTTOM_FIELD_REF; ++ ++ set_dpb_info(hw_rps->entries, j, i, ref->index | (dpb_valid << 4), bottom); ++ } ++ } ++} ++ ++static void assemble_hw_scaling_list(struct rkvdec2_ctx *ctx, ++ struct rkvdec2_h264_run *run) ++{ ++ const struct v4l2_ctrl_h264_scaling_matrix *scaling = run->scaling_matrix; ++ const struct v4l2_ctrl_h264_pps *pps = run->pps; ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ struct rkvdec2_h264_priv_tbl *tbl = h264_ctx->priv_tbl.cpu; ++ ++ if (!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT)) ++ return; ++ ++ BUILD_BUG_ON(sizeof(tbl->scaling_list.scaling_list_4x4) != ++ sizeof(scaling->scaling_list_4x4)); ++ BUILD_BUG_ON(sizeof(tbl->scaling_list.scaling_list_8x8) != ++ sizeof(scaling->scaling_list_8x8)); ++ ++ memcpy(tbl->scaling_list.scaling_list_4x4, ++ scaling->scaling_list_4x4, ++ sizeof(scaling->scaling_list_4x4)); ++ ++ memcpy(tbl->scaling_list.scaling_list_8x8, ++ scaling->scaling_list_8x8, ++ sizeof(scaling->scaling_list_8x8)); ++} ++ ++static inline void rkvdec2_memcpy_toio(void __iomem *dst, void *src, size_t len) ++{ ++#ifdef CONFIG_ARM64 ++ __iowrite32_copy(dst, src, len); ++#else ++ memcpy_toio(dst, src, len); ++#endif ++} ++ ++static void rkvdec2_write_regs(struct rkvdec2_ctx *ctx) ++{ ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ ++ rkvdec2_memcpy_toio(rkvdec->regs + OFFSET_COMMON_REGS, ++ &h264_ctx->regs.common, ++ sizeof(h264_ctx->regs.common)); ++ rkvdec2_memcpy_toio(rkvdec->regs + OFFSET_CODEC_PARAMS_REGS, ++ &h264_ctx->regs.h264_param, ++ sizeof(h264_ctx->regs.h264_param)); ++ rkvdec2_memcpy_toio(rkvdec->regs + OFFSET_COMMON_ADDR_REGS, ++ &h264_ctx->regs.common_addr, ++ sizeof(h264_ctx->regs.common_addr)); ++ rkvdec2_memcpy_toio(rkvdec->regs + OFFSET_CODEC_ADDR_REGS, ++ &h264_ctx->regs.h264_addr, ++ sizeof(h264_ctx->regs.h264_addr)); ++ rkvdec2_memcpy_toio(rkvdec->regs + OFFSET_POC_HIGHBIT_REGS, ++ &h264_ctx->regs.h264_highpoc, ++ sizeof(h264_ctx->regs.h264_highpoc)); ++} ++ ++static void config_registers(struct rkvdec2_ctx *ctx, ++ struct rkvdec2_h264_run *run) ++{ ++ const struct v4l2_ctrl_h264_decode_params *dec_params = run->decode_params; ++ const struct v4l2_ctrl_h264_sps *sps = run->sps; ++ const struct v4l2_h264_dpb_entry *dpb = dec_params->dpb; ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ dma_addr_t priv_start_addr = h264_ctx->priv_tbl.dma; ++ const struct v4l2_pix_format_mplane *dst_fmt; ++ struct vb2_v4l2_buffer *src_buf = run->base.bufs.src; ++ struct vb2_v4l2_buffer *dst_buf = run->base.bufs.dst; ++ struct rkvdec2_regs_h264 *regs = &h264_ctx->regs; ++ const struct v4l2_format *f; ++ dma_addr_t rlc_addr; ++ dma_addr_t dst_addr; ++ u32 hor_virstride = 0; ++ u32 ver_virstride = 0; ++ u32 y_virstride = 0; ++ u32 offset; ++ u32 pixels; ++ u32 i; ++ ++ memset(regs, 0, sizeof(*regs)); ++ ++ /* Set H264 mode */ ++ regs->common.reg009.dec_mode = RKVDEC2_MODE_H264; ++ ++ /* Set config */ ++ regs->common.reg011.buf_empty_en = 1; ++ regs->common.reg011.dec_clkgate_e = 1; ++ regs->common.reg011.dec_timeout_e = 1; ++ regs->common.reg011.pix_range_detection_e = 1; ++ ++ /* Set IDR flag */ ++ regs->common.reg013.cur_pic_is_idr = ++ !!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC); ++ ++ /* Set input stream length */ ++ regs->common.stream_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); ++ ++ /* Set max slice number */ ++ regs->common.reg017.slice_num = MAX_SLICE_NUMBER; ++ ++ /* Set strides */ ++ f = &ctx->decoded_fmt; ++ dst_fmt = &f->fmt.pix_mp; ++ hor_virstride = (sps->bit_depth_luma_minus8 + 8) * dst_fmt->width / 8; ++ ver_virstride = round_up(dst_fmt->height, 16); ++ y_virstride = hor_virstride * ver_virstride; ++ pixels = dst_fmt->height * dst_fmt->width; ++ ++ regs->common.reg018.y_hor_virstride = hor_virstride / 16; ++ regs->common.reg019.uv_hor_virstride = hor_virstride / 16; ++ regs->common.reg020.y_virstride = y_virstride / 16; ++ ++ /* Activate block gating */ ++ regs->common.reg026.swreg_block_gating_e = 0xfffef; ++ regs->common.reg026.reg_cfg_gating_en = 1; ++ ++ /* Set timeout threshold */ ++ if (pixels < RKVDEC2_1080P_PIXELS) ++ regs->common.timeout_threshold = RKVDEC2_TIMEOUT_1080p; ++ else if (pixels < RKVDEC2_4K_PIXELS) ++ regs->common.timeout_threshold = RKVDEC2_TIMEOUT_4K; ++ else if (pixels < RKVDEC2_8K_PIXELS) ++ regs->common.timeout_threshold = RKVDEC2_TIMEOUT_8K; ++ else ++ regs->common.timeout_threshold = RKVDEC2_TIMEOUT_MAX; ++ ++ /* Set TOP and BOTTOM POCs */ ++ regs->h264_param.cur_top_poc = dec_params->top_field_order_cnt; ++ regs->h264_param.cur_bot_poc = dec_params->bottom_field_order_cnt; ++ ++ /* Set ref pic address & poc */ ++ for (i = 0; i < ARRAY_SIZE(dec_params->dpb); i++) { ++ struct vb2_buffer *vb_buf = run->ref_buf[i]; ++ dma_addr_t buf_dma; ++ ++ /* ++ * If a DPB entry is unused or invalid, address of current destination ++ * buffer is returned. ++ */ ++ if (!vb_buf) ++ vb_buf = &dst_buf->vb2_buf; ++ ++ buf_dma = vb2_dma_contig_plane_dma_addr(vb_buf, 0); ++ ++ /* Set reference addresses */ ++ regs->h264_addr.ref_base[i] = buf_dma; ++ ++ /* Set COLMV addresses */ ++ regs->h264_addr.colmv_base[i] = buf_dma + ctx->colmv_offset; ++ ++ struct rkvdec2_h264_ref_info *ref_info = ++ ®s->h264_param.ref_info_regs[i / 4].ref_info[i % 4]; ++ ++ ref_info->ref_field = ++ !!(dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_FIELD); ++ ref_info->ref_colmv_use_flag = ++ !!(dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE); ++ ref_info->ref_topfield_used = ++ !!(dpb[i].fields & V4L2_H264_TOP_FIELD_REF); ++ ref_info->ref_botfield_used = ++ !!(dpb[i].fields & V4L2_H264_BOTTOM_FIELD_REF); ++ ++ regs->h264_param.ref_pocs[i * 2] = ++ dpb[i].top_field_order_cnt; ++ regs->h264_param.ref_pocs[i * 2 + 1] = ++ dpb[i].bottom_field_order_cnt; ++ } ++ ++ /* Set rlc base address (input stream) */ ++ rlc_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); ++ regs->common_addr.rlc_base = rlc_addr; ++ regs->common_addr.rlcwrite_base = rlc_addr; ++ ++ /* Set output base address */ ++ dst_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); ++ regs->common_addr.decout_base = dst_addr; ++ ++ /* Set colmv address */ ++ regs->common_addr.colmv_cur_base = dst_addr + ctx->colmv_offset; ++ ++ /* Set RCB addresses */ ++ for (i = 0; i < RKVDEC2_RCB_COUNT; i++) ++ regs->common_addr.rcb_base[i] = ctx->rcb_bufs[i].dma; ++ ++ /* Set hw pps address */ ++ offset = offsetof(struct rkvdec2_h264_priv_tbl, param_set); ++ regs->h264_addr.pps_base = priv_start_addr + offset; ++ ++ /* Set hw rps address */ ++ offset = offsetof(struct rkvdec2_h264_priv_tbl, rps); ++ regs->h264_addr.rps_base = priv_start_addr + offset; ++ ++ /* Set cabac table */ ++ offset = offsetof(struct rkvdec2_h264_priv_tbl, cabac_table); ++ regs->h264_addr.cabactbl_base = priv_start_addr + offset; ++ ++ rkvdec2_write_regs(ctx); ++} ++ ++#define RKVDEC_H264_MAX_DEPTH_IN_BYTES 2 ++ ++static int rkvdec2_h264_adjust_fmt(struct rkvdec2_ctx *ctx, ++ struct v4l2_format *f) ++{ ++ struct v4l2_pix_format_mplane *fmt = &f->fmt.pix_mp; ++ ++ fmt->num_planes = 1; ++ if (!fmt->plane_fmt[0].sizeimage) ++ fmt->plane_fmt[0].sizeimage = fmt->width * fmt->height * ++ RKVDEC_H264_MAX_DEPTH_IN_BYTES; ++ return 0; ++} ++ ++static int rkvdec2_h264_validate_sps(struct rkvdec2_ctx *ctx, ++ const struct v4l2_ctrl_h264_sps *sps) ++{ ++ unsigned int width, height; ++ ++ /* ++ * TODO: The hardware supports 10-bit and 4:2:2 profiles, ++ * but it's currently broken in the driver. ++ * Reject them for now, until it's fixed. ++ */ ++ if (sps->chroma_format_idc > 1) ++ /* Only 4:0:0 and 4:2:0 are supported */ ++ return -EINVAL; ++ if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) ++ /* Luma and chroma bit depth mismatch */ ++ return -EINVAL; ++ if (sps->bit_depth_luma_minus8 != 0) ++ /* Only 8-bit is supported */ ++ return -EINVAL; ++ ++ width = (sps->pic_width_in_mbs_minus1 + 1) * 16; ++ height = (sps->pic_height_in_map_units_minus1 + 1) * 16; ++ ++ /* ++ * When frame_mbs_only_flag is not set, this is field height, ++ * which is half the final height (see (7-8) in the ++ * specification) ++ */ ++ if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)) ++ height *= 2; ++ ++ if (width > ctx->coded_fmt.fmt.pix_mp.width || ++ height > ctx->coded_fmt.fmt.pix_mp.height) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int rkvdec2_h264_start(struct rkvdec2_ctx *ctx) ++{ ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ struct rkvdec2_h264_priv_tbl *priv_tbl; ++ struct rkvdec2_h264_ctx *h264_ctx; ++ struct v4l2_ctrl *ctrl; ++ int ret; ++ ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_H264_SPS); ++ if (!ctrl) ++ return -EINVAL; ++ ++ ret = rkvdec2_h264_validate_sps(ctx, ctrl->p_new.p_h264_sps); ++ if (ret) ++ return ret; ++ ++ h264_ctx = kzalloc(sizeof(*h264_ctx), GFP_KERNEL); ++ if (!h264_ctx) ++ return -ENOMEM; ++ ++ priv_tbl = dma_alloc_coherent(rkvdec->dev, sizeof(*priv_tbl), ++ &h264_ctx->priv_tbl.dma, GFP_KERNEL); ++ if (!priv_tbl) { ++ ret = -ENOMEM; ++ goto err_free_ctx; ++ } ++ ++ h264_ctx->priv_tbl.size = sizeof(*priv_tbl); ++ h264_ctx->priv_tbl.cpu = priv_tbl; ++ memcpy(priv_tbl->cabac_table, rkvdec_h264_cabac_table, ++ sizeof(rkvdec_h264_cabac_table)); ++ ++ ctx->priv = h264_ctx; ++ return 0; ++ ++err_free_ctx: ++ kfree(h264_ctx); ++ return ret; ++} ++ ++static void rkvdec2_h264_stop(struct rkvdec2_ctx *ctx) ++{ ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ ++ dma_free_coherent(rkvdec->dev, h264_ctx->priv_tbl.size, ++ h264_ctx->priv_tbl.cpu, h264_ctx->priv_tbl.dma); ++ kfree(h264_ctx); ++} ++ ++static void rkvdec2_h264_run_preamble(struct rkvdec2_ctx *ctx, ++ struct rkvdec2_h264_run *run) ++{ ++ struct v4l2_ctrl *ctrl; ++ ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_H264_DECODE_PARAMS); ++ run->decode_params = ctrl ? ctrl->p_cur.p : NULL; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_H264_SPS); ++ run->sps = ctrl ? ctrl->p_cur.p : NULL; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_H264_PPS); ++ run->pps = ctrl ? ctrl->p_cur.p : NULL; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_STATELESS_H264_SCALING_MATRIX); ++ run->scaling_matrix = ctrl ? ctrl->p_cur.p : NULL; ++ ++ rkvdec2_run_preamble(ctx, &run->base); ++} ++ ++static int rkvdec2_h264_run(struct rkvdec2_ctx *ctx) ++{ ++ struct v4l2_h264_reflist_builder reflist_builder; ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ struct rkvdec2_h264_ctx *h264_ctx = ctx->priv; ++ struct rkvdec2_h264_run run; ++ uint32_t watchdog_time; ++ ++ rkvdec2_h264_run_preamble(ctx, &run); ++ ++ /* Build the P/B{0,1} ref lists. */ ++ v4l2_h264_init_reflist_builder(&reflist_builder, run.decode_params, ++ run.sps, run.decode_params->dpb); ++ v4l2_h264_build_p_ref_list(&reflist_builder, h264_ctx->reflists.p); ++ v4l2_h264_build_b_ref_lists(&reflist_builder, h264_ctx->reflists.b0, ++ h264_ctx->reflists.b1); ++ ++ assemble_hw_scaling_list(ctx, &run); ++ assemble_hw_pps(ctx, &run); ++ lookup_ref_buf_idx(ctx, &run); ++ assemble_hw_rps(ctx, &reflist_builder, &run); ++ ++ config_registers(ctx, &run); ++ ++ rkvdec2_run_postamble(ctx, &run.base); ++ ++ /* Set watchdog at 2 times the hardware timeout threshold */ ++ u64 timeout_threshold = h264_ctx->regs.common.timeout_threshold; ++ watchdog_time = 2 * (1000 * timeout_threshold) / clk_get_rate(rkvdec->clocks[0].clk); ++ schedule_delayed_work(&rkvdec->watchdog_work, msecs_to_jiffies(watchdog_time)); ++ ++ /* Start decoding! */ ++ writel(RKVDEC2_REG_DEC_E_BIT, rkvdec->regs + RKVDEC2_REG_DEC_E); ++ ++ return 0; ++} ++ ++static int rkvdec2_h264_try_ctrl(struct rkvdec2_ctx *ctx, struct v4l2_ctrl *ctrl) ++{ ++ if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) ++ return rkvdec2_h264_validate_sps(ctx, ctrl->p_new.p_h264_sps); ++ ++ return 0; ++} ++ ++const struct rkvdec2_coded_fmt_ops rkvdec2_h264_fmt_ops = { ++ .adjust_fmt = rkvdec2_h264_adjust_fmt, ++ .start = rkvdec2_h264_start, ++ .stop = rkvdec2_h264_stop, ++ .run = rkvdec2_h264_run, ++ .try_ctrl = rkvdec2_h264_try_ctrl, ++}; +diff --git a/drivers/media/platform/rockchip/rkvdec2/rkvdec2-regs.h b/drivers/media/platform/rockchip/rkvdec2/rkvdec2-regs.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/rockchip/rkvdec2/rkvdec2-regs.h +@@ -0,0 +1,346 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Rockchip Video Decoder 2 driver registers description ++ * ++ * Copyright (C) 2024 Collabora, Ltd. ++ * Detlev Casanova ++ */ ++ ++#ifndef _RKVDEC_REGS_H_ ++#define _RKVDEC_REGS_H_ ++ ++#define OFFSET_COMMON_REGS (8 * sizeof(u32)) ++#define OFFSET_CODEC_PARAMS_REGS (64 * sizeof(u32)) ++#define OFFSET_COMMON_ADDR_REGS (128 * sizeof(u32)) ++#define OFFSET_CODEC_ADDR_REGS (160 * sizeof(u32)) ++#define OFFSET_POC_HIGHBIT_REGS (200 * sizeof(u32)) ++ ++#define RKVDEC2_MODE_HEVC 0 ++#define RKVDEC2_MODE_H264 1 ++#define RKVDEC2_MODE_VP9 2 ++#define RKVDEC2_MODE_AVS2 3 ++ ++#define MAX_SLICE_NUMBER 0x3fff ++ ++#define RKVDEC2_1080P_PIXELS (1920 * 1080) ++#define RKVDEC2_4K_PIXELS (4096 * 2304) ++#define RKVDEC2_8K_PIXELS (7680 * 4320) ++#define RKVDEC2_TIMEOUT_1080p (0xefffff) ++#define RKVDEC2_TIMEOUT_4K (0x2cfffff) ++#define RKVDEC2_TIMEOUT_8K (0x4ffffff) ++#define RKVDEC2_TIMEOUT_MAX (0xffffffff) ++ ++#define RKVDEC2_REG_DEC_E 0x028 ++#define RKVDEC2_REG_DEC_E_BIT 1 ++ ++#define RKVDEC2_REG_IMPORTANT_EN 0x02c ++#define RKVDEC2_REG_DEC_IRQ_DISABLE BIT(4) ++ ++#define RKVDEC2_REG_STA_INT 0x380 ++#define STA_INT_DEC_RDY_STA BIT(2) ++ ++/* base: OFFSET_COMMON_REGS */ ++struct rkvdec2_regs_common { ++ struct rkvdec2_in_out { ++ u32 in_endian : 1; ++ u32 in_swap32_e : 1; ++ u32 in_swap64_e : 1; ++ u32 str_endian : 1; ++ u32 str_swap32_e : 1; ++ u32 str_swap64_e : 1; ++ u32 out_endian : 1; ++ u32 out_swap32_e : 1; ++ u32 out_cbcr_swap : 1; ++ u32 out_swap64_e : 1; ++ u32 reserved : 22; ++ } reg008; ++ ++ struct rkvdec2_dec_mode { ++ u32 dec_mode : 10; ++ u32 reserved : 22; ++ } reg009; ++ ++ struct rkvdec2_dec_e { ++ u32 dec_e : 1; ++ u32 reserved : 31; ++ } reg010; ++ ++ struct rkvdec2_important_en { ++ u32 reserved : 1; ++ u32 dec_clkgate_e : 1; ++ u32 dec_e_strmd_clkgate_dis : 1; ++ u32 reserved0 : 1; ++ ++ u32 dec_irq_dis : 1; ++ u32 dec_timeout_e : 1; ++ u32 buf_empty_en : 1; ++ u32 reserved1 : 3; ++ ++ u32 dec_e_rewrite_valid : 1; ++ u32 reserved2 : 9; ++ u32 softrst_en_p : 1; ++ u32 force_softreset_valid : 1; ++ u32 reserved3 : 2; ++ u32 pix_range_detection_e : 1; ++ u32 reserved4 : 7; ++ } reg011; ++ ++ struct rkvdec2_sencodary_en { ++ u32 wr_ddr_align_en : 1; ++ u32 colmv_compress_en : 1; ++ u32 fbc_e : 1; ++ u32 reserved0 : 1; ++ ++ u32 buspr_slot_disable : 1; ++ u32 error_info_en : 1; ++ u32 info_collect_en : 1; ++ u32 wait_reset_en : 1; ++ ++ u32 scanlist_addr_valid_en : 1; ++ u32 scale_down_en : 1; ++ u32 error_cfg_wr_disable : 1; ++ u32 reserved1 : 21; ++ } reg012; ++ ++ struct rkvdec2_en_mode_set { ++ u32 timeout_mode : 1; ++ u32 req_timeout_rst_sel : 1; ++ u32 reserved0 : 1; ++ u32 dec_commonirq_mode : 1; ++ u32 reserved1 : 2; ++ u32 stmerror_waitdecfifo_empty : 1; ++ u32 reserved2 : 2; ++ u32 h26x_streamd_error_mode : 1; ++ u32 reserved3 : 2; ++ u32 allow_not_wr_unref_bframe : 1; ++ u32 fbc_output_wr_disable : 1; ++ u32 reserved4 : 1; ++ u32 colmv_error_mode : 1; ++ ++ u32 reserved5 : 2; ++ u32 h26x_error_mode : 1; ++ u32 reserved6 : 2; ++ u32 ycacherd_prior : 1; ++ u32 reserved7 : 2; ++ u32 cur_pic_is_idr : 1; ++ u32 reserved8 : 1; ++ u32 right_auto_rst_disable : 1; ++ u32 frame_end_err_rst_flag : 1; ++ u32 rd_prior_mode : 1; ++ u32 rd_ctrl_prior_mode : 1; ++ u32 reserved9 : 1; ++ u32 filter_outbuf_mode : 1; ++ } reg013; ++ ++ struct rkvdec2_fbc_param_set { ++ u32 fbc_force_uncompress : 1; ++ ++ u32 reserved0 : 2; ++ u32 allow_16x8_cp_flag : 1; ++ u32 reserved1 : 2; ++ ++ u32 fbc_h264_exten_4or8_flag : 1; ++ u32 reserved2 : 25; ++ } reg014; ++ ++ struct rkvdec2_stream_param_set { ++ u32 rlc_mode_direct_write : 1; ++ u32 rlc_mode : 1; ++ u32 reserved0 : 3; ++ ++ u32 strm_start_bit : 7; ++ u32 reserved1 : 20; ++ } reg015; ++ ++ u32 stream_len; ++ ++ struct rkvdec2_slice_number { ++ u32 slice_num : 25; ++ u32 reserved : 7; ++ } reg017; ++ ++ struct rkvdec2_y_hor_stride { ++ u32 y_hor_virstride : 16; ++ u32 reserved : 16; ++ } reg018; ++ ++ struct rkvdec2_uv_hor_stride { ++ u32 uv_hor_virstride : 16; ++ u32 reserved : 16; ++ } reg019; ++ ++ struct rkvdec2_y_stride { ++ u32 y_virstride : 28; ++ u32 reserved : 4; ++ } reg020; ++ ++ struct rkvdec2_error_ctrl_set { ++ u32 inter_error_prc_mode : 1; ++ u32 error_intra_mode : 1; ++ u32 error_deb_en : 1; ++ u32 picidx_replace : 5; ++ u32 error_spread_e : 1; ++ u32 reserved0 : 3; ++ u32 error_inter_pred_cross_slice : 1; ++ u32 reserved1 : 11; ++ u32 roi_error_ctu_cal_en : 1; ++ u32 reserved2 : 7; ++ } reg021; ++ ++ struct rkvdec2_err_roi_ctu_offset_start { ++ u32 roi_x_ctu_offset_st : 12; ++ u32 reserved0 : 4; ++ u32 roi_y_ctu_offset_st : 12; ++ u32 reserved1 : 4; ++ } reg022; ++ ++ struct rkvdec2_err_roi_ctu_offset_end { ++ u32 roi_x_ctu_offset_end : 12; ++ u32 reserved0 : 4; ++ u32 roi_y_ctu_offset_end : 12; ++ u32 reserved1 : 4; ++ } reg023; ++ ++ struct rkvdec2_cabac_error_en_lowbits { ++ u32 cabac_err_en_lowbits : 32; ++ } reg024; ++ ++ struct rkvdec2_cabac_error_en_highbits { ++ u32 cabac_err_en_highbits : 30; ++ u32 reserved : 2; ++ } reg025; ++ ++ struct rkvdec2_block_gating_en { ++ u32 swreg_block_gating_e : 20; ++ u32 reserved : 11; ++ u32 reg_cfg_gating_en : 1; ++ } reg026; ++ ++ struct SW027_CORE_SAFE_PIXELS { ++ u32 core_safe_x_pixels : 16; ++ u32 core_safe_y_pixels : 16; ++ } reg027; ++ ++ struct rkvdec2_multiply_core_ctrl { ++ u32 swreg_vp9_wr_prob_idx : 3; ++ u32 reserved0 : 1; ++ u32 swreg_vp9_rd_prob_idx : 3; ++ u32 reserved1 : 1; ++ ++ u32 swreg_ref_req_advance_flag : 1; ++ u32 sw_colmv_req_advance_flag : 1; ++ u32 sw_poc_only_highbit_flag : 1; ++ u32 sw_poc_arb_flag : 1; ++ ++ u32 reserved2 : 4; ++ u32 sw_film_idx : 10; ++ u32 reserved3 : 2; ++ u32 sw_pu_req_mismatch_dis : 1; ++ u32 sw_colmv_req_mismatch_dis : 1; ++ u32 reserved4 : 2; ++ } reg028; ++ ++ struct SW029_SCALE_DOWN_CTRL { ++ u32 scale_down_hor_ratio : 2; ++ u32 reserved0 : 6; ++ u32 scale_down_vrz_ratio : 2; ++ u32 reserved1 : 22; ++ } reg029; ++ ++ struct SW032_Y_SCALE_DOWN_TILE8x8_HOR_STRIDE { ++ u32 y_scale_down_hor_stride : 20; ++ u32 reserved0 : 12; ++ } reg030; ++ ++ struct SW031_UV_SCALE_DOWN_TILE8x8_HOR_STRIDE { ++ u32 uv_scale_down_hor_stride : 20; ++ u32 reserved0 : 12; ++ } reg031; ++ ++ u32 timeout_threshold; ++} __packed; ++ ++/* base: OFFSET_COMMON_ADDR_REGS */ ++struct rkvdec2_regs_common_addr { ++ u32 rlc_base; ++ u32 rlcwrite_base; ++ u32 decout_base; ++ u32 colmv_cur_base; ++ u32 error_ref_base; ++ u32 rcb_base[10]; ++} __packed; ++ ++/* base: OFFSET_CODEC_PARAMS_REGS */ ++struct rkvdec2_regs_h264_params { ++ struct rkvdec2_h26x_set { ++ u32 h26x_frame_orslice : 1; ++ u32 h26x_rps_mode : 1; ++ u32 h26x_stream_mode : 1; ++ u32 h26x_stream_lastpacket : 1; ++ u32 h264_firstslice_flag : 1; ++ u32 reserved : 27; ++ } reg064; ++ ++ u32 cur_top_poc; ++ u32 cur_bot_poc; ++ u32 ref_pocs[32]; ++ ++ struct rkvdec2_h264_info { ++ struct rkvdec2_h264_ref_info { ++ u32 ref_field : 1; ++ u32 ref_topfield_used : 1; ++ u32 ref_botfield_used : 1; ++ u32 ref_colmv_use_flag : 1; ++ u32 ref_reserved : 4; ++ } __packed ref_info[4]; ++ } __packed ref_info_regs[4]; ++ ++ u32 reserved_103_111[9]; ++ ++ struct rkvdec2_error_ref_info { ++ u32 avs2_ref_error_field : 1; ++ u32 avs2_ref_error_topfield : 1; ++ u32 ref_error_topfield_used : 1; ++ u32 ref_error_botfield_used : 1; ++ u32 reserved : 28; ++ } reg112; ++} __packed; ++ ++/* base: OFFSET_CODEC_ADDR_REGS */ ++struct rkvdec2_regs_h264_addr { ++ u32 reserved_160; ++ u32 pps_base; ++ u32 reserved_162; ++ u32 rps_base; ++ u32 ref_base[16]; ++ u32 scanlist_addr; ++ u32 colmv_base[16]; ++ u32 cabactbl_base; ++} __packed; ++ ++struct rkvdec2_regs_h264_highpoc { ++ struct rkvdec2_ref_poc_highbit { ++ u32 ref0_poc_highbit : 4; ++ u32 ref1_poc_highbit : 4; ++ u32 ref2_poc_highbit : 4; ++ u32 ref3_poc_highbit : 4; ++ u32 ref4_poc_highbit : 4; ++ u32 ref5_poc_highbit : 4; ++ u32 ref6_poc_highbit : 4; ++ u32 ref7_poc_highbit : 4; ++ } reg200[4]; ++ struct rkvdec2_cur_poc_highbit { ++ u32 cur_poc_highbit : 4; ++ u32 reserved : 28; ++ } reg204; ++} __packed; ++ ++struct rkvdec2_regs_h264 { ++ struct rkvdec2_regs_common common; ++ struct rkvdec2_regs_h264_params h264_param; ++ struct rkvdec2_regs_common_addr common_addr; ++ struct rkvdec2_regs_h264_addr h264_addr; ++ struct rkvdec2_regs_h264_highpoc h264_highpoc; ++} __packed; ++ ++#endif /* __RKVDEC_REGS_H__ */ +diff --git a/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c b/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/rockchip/rkvdec2/rkvdec2.c +@@ -0,0 +1,1263 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Rockchip Video Decoder 2 driver ++ * ++ * Copyright (C) 2024 Collabora, Ltd. ++ * Detlev Casanova ++ * ++ * Based on rkvdec driver by Boris Brezillon ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "rkvdec2.h" ++ ++static int rkvdec2_try_ctrl(struct v4l2_ctrl *ctrl) ++{ ++ struct rkvdec2_ctx *ctx = container_of(ctrl->handler, struct rkvdec2_ctx, ctrl_hdl); ++ const struct rkvdec2_coded_fmt_desc *desc = ctx->coded_fmt_desc; ++ ++ if (desc->ops->try_ctrl) ++ return desc->ops->try_ctrl(ctx, ctrl); ++ ++ return 0; ++} ++ ++static const struct v4l2_ctrl_ops rkvdec2_ctrl_ops = { ++ .try_ctrl = rkvdec2_try_ctrl, ++}; ++ ++static const struct rkvdec2_ctrl_desc rkvdec2_h264_ctrl_descs[] = { ++ { ++ .cfg.id = V4L2_CID_STATELESS_H264_DECODE_PARAMS, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_H264_SPS, ++ .cfg.ops = &rkvdec2_ctrl_ops, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_H264_PPS, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_H264_SCALING_MATRIX, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_H264_DECODE_MODE, ++ .cfg.min = V4L2_STATELESS_H264_DECODE_MODE_FRAME_BASED, ++ .cfg.max = V4L2_STATELESS_H264_DECODE_MODE_FRAME_BASED, ++ .cfg.def = V4L2_STATELESS_H264_DECODE_MODE_FRAME_BASED, ++ }, ++ { ++ .cfg.id = V4L2_CID_STATELESS_H264_START_CODE, ++ .cfg.min = V4L2_STATELESS_H264_START_CODE_ANNEX_B, ++ .cfg.def = V4L2_STATELESS_H264_START_CODE_ANNEX_B, ++ .cfg.max = V4L2_STATELESS_H264_START_CODE_ANNEX_B, ++ }, ++ { ++ .cfg.id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, ++ .cfg.min = V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE, ++ .cfg.max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, ++ .cfg.menu_skip_mask = ++ BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), ++ .cfg.def = V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, ++ }, ++ { ++ .cfg.id = V4L2_CID_MPEG_VIDEO_H264_LEVEL, ++ .cfg.min = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, ++ .cfg.max = V4L2_MPEG_VIDEO_H264_LEVEL_6_1, ++ }, ++}; ++ ++static const struct rkvdec2_ctrls rkvdec2_h264_ctrls = { ++ .ctrls = rkvdec2_h264_ctrl_descs, ++ .num_ctrls = ARRAY_SIZE(rkvdec2_h264_ctrl_descs), ++}; ++ ++static const u32 rkvdec2_h264_decoded_fmts[] = { ++ V4L2_PIX_FMT_NV12 ++}; ++ ++static const struct rkvdec2_coded_fmt_desc rkvdec2_coded_fmts[] = { ++ { ++ .fourcc = V4L2_PIX_FMT_H264_SLICE, ++ .frmsize = { ++ .min_width = 16, ++ .max_width = 65520, ++ .step_width = 16, ++ .min_height = 16, ++ .max_height = 65520, ++ .step_height = 16, ++ }, ++ .ctrls = &rkvdec2_h264_ctrls, ++ .ops = &rkvdec2_h264_fmt_ops, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec2_h264_decoded_fmts), ++ .decoded_fmts = rkvdec2_h264_decoded_fmts, ++ .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, ++ }, ++}; ++ ++enum rcb_axis { ++ PIC_WIDTH = 0, ++ PIC_HEIGHT = 1 ++}; ++ ++struct rcb_size_info { ++ u8 multiplier; ++ enum rcb_axis axis; ++}; ++ ++static struct rcb_size_info rcb_sizes[] = { ++ {6, PIC_WIDTH}, // intrar ++ {1, PIC_WIDTH}, // transdr (Is actually 0.4*pic_width) ++ {1, PIC_HEIGHT}, // transdc (Is actually 0.1*pic_height) ++ {3, PIC_WIDTH}, // streamdr ++ {6, PIC_WIDTH}, // interr ++ {3, PIC_HEIGHT}, // interc ++ {22, PIC_WIDTH}, // dblkr ++ {6, PIC_WIDTH}, // saor ++ {11, PIC_WIDTH}, // fbcr ++ {67, PIC_HEIGHT}, // filtc col ++}; ++ ++#define RCB_SIZE(n,w,h) (rcb_sizes[(n)].multiplier * (rcb_sizes[(n)].axis ? (h) : (w))) ++ ++static const struct rkvdec2_coded_fmt_desc * ++rkvdec2_find_coded_fmt_desc(u32 fourcc) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ARRAY_SIZE(rkvdec2_coded_fmts); i++) { ++ if (rkvdec2_coded_fmts[i].fourcc == fourcc) ++ return &rkvdec2_coded_fmts[i]; ++ } ++ ++ return NULL; ++} ++ ++static void rkvdec2_reset_fmt(struct rkvdec2_ctx *ctx, struct v4l2_format *f, ++ u32 fourcc) ++{ ++ memset(f, 0, sizeof(*f)); ++ f->fmt.pix_mp.pixelformat = fourcc; ++ f->fmt.pix_mp.field = V4L2_FIELD_NONE; ++ f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_REC709; ++ f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; ++ f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT; ++ f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT; ++} ++ ++static void rkvdec2_reset_coded_fmt(struct rkvdec2_ctx *ctx) ++{ ++ struct v4l2_format *f = &ctx->coded_fmt; ++ ++ ctx->coded_fmt_desc = &rkvdec2_coded_fmts[0]; ++ rkvdec2_reset_fmt(ctx, f, ctx->coded_fmt_desc->fourcc); ++ ++ f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; ++ f->fmt.pix_mp.width = ctx->coded_fmt_desc->frmsize.min_width; ++ f->fmt.pix_mp.height = ctx->coded_fmt_desc->frmsize.min_height; ++ ++ if (ctx->coded_fmt_desc->ops->adjust_fmt) ++ ctx->coded_fmt_desc->ops->adjust_fmt(ctx, f); ++} ++ ++static void rkvdec2_reset_decoded_fmt(struct rkvdec2_ctx *ctx) ++{ ++ struct v4l2_format *f = &ctx->decoded_fmt; ++ ++ rkvdec2_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); ++ f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ v4l2_fill_pixfmt_mp(&f->fmt.pix_mp, ++ ctx->coded_fmt_desc->decoded_fmts[0], ++ ctx->coded_fmt.fmt.pix_mp.width, ++ ctx->coded_fmt.fmt.pix_mp.height); ++ ++ ctx->colmv_offset = f->fmt.pix_mp.plane_fmt[0].sizeimage; ++ ++ f->fmt.pix_mp.plane_fmt[0].sizeimage += 128 * ++ DIV_ROUND_UP(f->fmt.pix_mp.width, 16) * ++ DIV_ROUND_UP(f->fmt.pix_mp.height, 16); ++} ++ ++static int rkvdec2_enum_framesizes(struct file *file, void *priv, ++ struct v4l2_frmsizeenum *fsize) ++{ ++ const struct rkvdec2_coded_fmt_desc *desc; ++ ++ if (fsize->index != 0) ++ return -EINVAL; ++ ++ desc = rkvdec2_find_coded_fmt_desc(fsize->pixel_format); ++ if (!desc) ++ return -EINVAL; ++ ++ fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS; ++ ++ fsize->stepwise.min_height = 1; ++ fsize->stepwise.min_width = 1; ++ fsize->stepwise.step_height = 1; ++ fsize->stepwise.step_width = 1; ++ fsize->stepwise.max_height = desc->frmsize.max_height; ++ fsize->stepwise.max_width = desc->frmsize.max_width; ++ ++ return 0; ++} ++ ++static int rkvdec2_querycap(struct file *file, void *priv, ++ struct v4l2_capability *cap) ++{ ++ struct rkvdec2_dev *rkvdec = video_drvdata(file); ++ struct video_device *vdev = video_devdata(file); ++ ++ strscpy(cap->driver, rkvdec->dev->driver->name, ++ sizeof(cap->driver)); ++ strscpy(cap->card, vdev->name, sizeof(cap->card)); ++ snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", ++ rkvdec->dev->driver->name); ++ return 0; ++} ++ ++static int rkvdec2_try_capture_fmt(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ const struct rkvdec2_coded_fmt_desc *coded_desc; ++ unsigned int i; ++ ++ /* ++ * The codec context should point to a coded format desc, if the format ++ * on the coded end has not been set yet, it should point to the ++ * default value. ++ */ ++ coded_desc = ctx->coded_fmt_desc; ++ if (WARN_ON(!coded_desc)) ++ return -EINVAL; ++ ++ for (i = 0; i < coded_desc->num_decoded_fmts; i++) { ++ if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat) ++ break; ++ } ++ ++ if (i == coded_desc->num_decoded_fmts) ++ pix_mp->pixelformat = coded_desc->decoded_fmts[0]; ++ ++ /* Always apply the frmsize constraint of the coded end. */ ++ pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width); ++ pix_mp->height = max(pix_mp->height, ctx->coded_fmt.fmt.pix_mp.height); ++ v4l2_apply_frmsize_constraints(&pix_mp->width, ++ &pix_mp->height, ++ &coded_desc->frmsize); ++ ++ v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, ++ pix_mp->width, pix_mp->height); ++ ++ pix_mp->plane_fmt[0].sizeimage += ++ 128 * ++ DIV_ROUND_UP(pix_mp->width, 16) * ++ DIV_ROUND_UP(pix_mp->height, 16); ++ ++ pix_mp->field = V4L2_FIELD_NONE; ++ ++ return 0; ++} ++ ++static int rkvdec2_try_output_fmt(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ const struct rkvdec2_coded_fmt_desc *desc; ++ ++ desc = rkvdec2_find_coded_fmt_desc(pix_mp->pixelformat); ++ if (!desc) { ++ pix_mp->pixelformat = rkvdec2_coded_fmts[0].fourcc; ++ desc = &rkvdec2_coded_fmts[0]; ++ } ++ ++ v4l2_apply_frmsize_constraints(&pix_mp->width, ++ &pix_mp->height, ++ &desc->frmsize); ++ ++ pix_mp->field = V4L2_FIELD_NONE; ++ /* All coded formats are considered single planar for now. */ ++ pix_mp->num_planes = 1; ++ ++ if (desc->ops->adjust_fmt) { ++ int ret; ++ ++ ret = desc->ops->adjust_fmt(ctx, f); ++ if (ret) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int rkvdec2_s_capture_fmt(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ struct vb2_queue *vq; ++ int ret; ++ ++ /* Change not allowed if queue is busy */ ++ vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, ++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ if (vb2_is_busy(vq)) ++ return -EBUSY; ++ ++ ret = rkvdec2_try_capture_fmt(file, priv, f); ++ if (ret) ++ return ret; ++ ++ ctx->decoded_fmt = *f; ++ return 0; ++} ++ ++static int rkvdec2_s_output_fmt(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; ++ const struct rkvdec2_coded_fmt_desc *desc; ++ struct v4l2_format *cap_fmt; ++ struct vb2_queue *peer_vq, *vq; ++ int ret; ++ ++ /* ++ * In order to support dynamic resolution change, the decoder admits ++ * a resolution change, as long as the pixelformat remains. Can't be ++ * done if streaming. ++ */ ++ vq = v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ++ if (vb2_is_streaming(vq) || ++ (vb2_is_busy(vq) && ++ f->fmt.pix_mp.pixelformat != ctx->coded_fmt.fmt.pix_mp.pixelformat)) ++ return -EBUSY; ++ ++ /* ++ * Since format change on the OUTPUT queue will reset the CAPTURE ++ * queue, we can't allow doing so when the CAPTURE queue has buffers ++ * allocated. ++ */ ++ peer_vq = v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ if (vb2_is_busy(peer_vq)) ++ return -EBUSY; ++ ++ ret = rkvdec2_try_output_fmt(file, priv, f); ++ if (ret) ++ return ret; ++ ++ desc = rkvdec2_find_coded_fmt_desc(f->fmt.pix_mp.pixelformat); ++ if (!desc) ++ return -EINVAL; ++ ctx->coded_fmt_desc = desc; ++ ctx->coded_fmt = *f; ++ ++ /* ++ * Current decoded format might have become invalid with newly ++ * selected codec, so reset it to default just to be safe and ++ * keep internal driver state sane. User is mandated to set ++ * the decoded format again after we return, so we don't need ++ * anything smarter. ++ * ++ * Note that this will propagate any size changes to the decoded format. ++ */ ++ rkvdec2_reset_decoded_fmt(ctx); ++ ++ /* Propagate colorspace information to capture. */ ++ cap_fmt = &ctx->decoded_fmt; ++ cap_fmt->fmt.pix_mp.colorspace = f->fmt.pix_mp.colorspace; ++ cap_fmt->fmt.pix_mp.xfer_func = f->fmt.pix_mp.xfer_func; ++ cap_fmt->fmt.pix_mp.ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; ++ cap_fmt->fmt.pix_mp.quantization = f->fmt.pix_mp.quantization; ++ ++ /* Enable format specific queue features */ ++ vq->subsystem_flags |= desc->subsystem_flags; ++ ++ return 0; ++} ++ ++static int rkvdec2_g_output_fmt(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ ++ *f = ctx->coded_fmt; ++ return 0; ++} ++ ++static int rkvdec2_g_capture_fmt(struct file *file, void *priv, ++ struct v4l2_format *f) ++{ ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ ++ *f = ctx->decoded_fmt; ++ return 0; ++} ++ ++static int rkvdec2_enum_output_fmt(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ if (f->index >= ARRAY_SIZE(rkvdec2_coded_fmts)) ++ return -EINVAL; ++ ++ f->pixelformat = rkvdec2_coded_fmts[f->index].fourcc; ++ return 0; ++} ++ ++static int rkvdec2_enum_capture_fmt(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(priv); ++ ++ if (WARN_ON(!ctx->coded_fmt_desc)) ++ return -EINVAL; ++ ++ if (f->index >= ctx->coded_fmt_desc->num_decoded_fmts) ++ return -EINVAL; ++ ++ f->pixelformat = ctx->coded_fmt_desc->decoded_fmts[f->index]; ++ return 0; ++} ++ ++static const struct v4l2_ioctl_ops rkvdec2_ioctl_ops = { ++ .vidioc_querycap = rkvdec2_querycap, ++ .vidioc_enum_framesizes = rkvdec2_enum_framesizes, ++ ++ .vidioc_try_fmt_vid_cap_mplane = rkvdec2_try_capture_fmt, ++ .vidioc_try_fmt_vid_out_mplane = rkvdec2_try_output_fmt, ++ .vidioc_s_fmt_vid_out_mplane = rkvdec2_s_output_fmt, ++ .vidioc_s_fmt_vid_cap_mplane = rkvdec2_s_capture_fmt, ++ .vidioc_g_fmt_vid_out_mplane = rkvdec2_g_output_fmt, ++ .vidioc_g_fmt_vid_cap_mplane = rkvdec2_g_capture_fmt, ++ .vidioc_enum_fmt_vid_out = rkvdec2_enum_output_fmt, ++ .vidioc_enum_fmt_vid_cap = rkvdec2_enum_capture_fmt, ++ ++ .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs, ++ .vidioc_querybuf = v4l2_m2m_ioctl_querybuf, ++ .vidioc_qbuf = v4l2_m2m_ioctl_qbuf, ++ .vidioc_dqbuf = v4l2_m2m_ioctl_dqbuf, ++ .vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf, ++ .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, ++ .vidioc_expbuf = v4l2_m2m_ioctl_expbuf, ++ ++ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++ ++ .vidioc_streamon = v4l2_m2m_ioctl_streamon, ++ .vidioc_streamoff = v4l2_m2m_ioctl_streamoff, ++ ++ .vidioc_decoder_cmd = v4l2_m2m_ioctl_stateless_decoder_cmd, ++ .vidioc_try_decoder_cmd = v4l2_m2m_ioctl_stateless_try_decoder_cmd, ++}; ++ ++static int rkvdec2_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, ++ unsigned int *num_planes, unsigned int sizes[], ++ struct device *alloc_devs[]) ++{ ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(vq); ++ struct v4l2_format *f; ++ unsigned int i; ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) ++ f = &ctx->coded_fmt; ++ else ++ f = &ctx->decoded_fmt; ++ ++ if (*num_planes) { ++ if (*num_planes != f->fmt.pix_mp.num_planes) ++ return -EINVAL; ++ ++ for (i = 0; i < f->fmt.pix_mp.num_planes; i++) { ++ if (sizes[i] < f->fmt.pix_mp.plane_fmt[i].sizeimage) ++ return -EINVAL; ++ } ++ } else { ++ *num_planes = f->fmt.pix_mp.num_planes; ++ for (i = 0; i < f->fmt.pix_mp.num_planes; i++) ++ sizes[i] = f->fmt.pix_mp.plane_fmt[i].sizeimage; ++ } ++ ++ return 0; ++} ++ ++static int rkvdec2_buf_prepare(struct vb2_buffer *vb) ++{ ++ struct vb2_queue *vq = vb->vb2_queue; ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(vq); ++ struct v4l2_format *f; ++ unsigned int i; ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) ++ f = &ctx->coded_fmt; ++ else ++ f = &ctx->decoded_fmt; ++ ++ for (i = 0; i < f->fmt.pix_mp.num_planes; ++i) { ++ u32 sizeimage = f->fmt.pix_mp.plane_fmt[i].sizeimage; ++ ++ if (vb2_plane_size(vb, i) < sizeimage) ++ return -EINVAL; ++ } ++ ++ /* ++ * Buffer's bytesused must be written by driver for CAPTURE buffers. ++ * (for OUTPUT buffers, if userspace passes 0 bytesused, v4l2-core sets ++ * it to buffer length). ++ */ ++ if (V4L2_TYPE_IS_CAPTURE(vq->type)) ++ vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage); ++ ++ return 0; ++} ++ ++static void rkvdec2_buf_queue(struct vb2_buffer *vb) ++{ ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); ++ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); ++ ++ v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); ++} ++ ++static int rkvdec2_buf_out_validate(struct vb2_buffer *vb) ++{ ++ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); ++ ++ vbuf->field = V4L2_FIELD_NONE; ++ return 0; ++} ++ ++static void rkvdec2_buf_request_complete(struct vb2_buffer *vb) ++{ ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); ++ ++ v4l2_ctrl_request_complete(vb->req_obj.req, &ctx->ctrl_hdl); ++} ++ ++static void rkvdec2_free_rcb(struct rkvdec2_ctx *ctx) ++{ ++ u32 width, height; ++ int i; ++ ++ width = ctx->decoded_fmt.fmt.pix_mp.width; ++ height = ctx->decoded_fmt.fmt.pix_mp.height; ++ ++ for (i = 0; i < RKVDEC2_RCB_COUNT; i++) { ++ size_t rcb_size = RCB_SIZE(i, width, height); ++ ++ if (!ctx->rcb_bufs[i].cpu) ++ continue; ++ ++ switch (ctx->rcb_bufs[i].type) { ++ case RKVDEC2_ALLOC_SRAM: ++ gen_pool_free(ctx->dev->sram_pool, ++ (unsigned long)ctx->rcb_bufs[i].cpu, ++ rcb_size); ++ break; ++ case RKVDEC2_ALLOC_DMA: ++ dma_free_coherent(ctx->dev->dev, ++ rcb_size, ++ ctx->rcb_bufs[i].cpu, ++ ctx->rcb_bufs[i].dma); ++ break; ++ } ++ } ++} ++ ++static int rkvdec2_allocate_rcb(struct rkvdec2_ctx *ctx) ++{ ++ int ret, i; ++ u32 width, height; ++ ++ memset(ctx->rcb_bufs, 0, sizeof(*ctx->rcb_bufs)); ++ ++ width = ctx->decoded_fmt.fmt.pix_mp.width; ++ height = ctx->decoded_fmt.fmt.pix_mp.height; ++ ++ for (i = 0; i < RKVDEC2_RCB_COUNT; i++) { ++ void *cpu = NULL; ++ dma_addr_t dma; ++ size_t rcb_size = RCB_SIZE(i, width, height); ++ enum rkvdec2_alloc_type alloc_type = RKVDEC2_ALLOC_SRAM; ++ ++ if (ctx->dev->sram_pool) { ++ cpu = gen_pool_dma_zalloc_align(ctx->dev->sram_pool, ++ rcb_size, ++ &dma, ++ 64); ++ } ++ ++ /* Fallback to RAM */ ++ if (!cpu) { ++ cpu = dma_alloc_coherent(ctx->dev->dev, ++ rcb_size, ++ &dma, ++ GFP_KERNEL); ++ alloc_type = RKVDEC2_ALLOC_DMA; ++ } ++ ++ if (!cpu) { ++ ret = -ENOMEM; ++ goto err_alloc; ++ } ++ ++ ctx->rcb_bufs[i].cpu = cpu; ++ ctx->rcb_bufs[i].dma = dma; ++ ctx->rcb_bufs[i].size = rcb_size; ++ ctx->rcb_bufs[i].type = alloc_type; ++ } ++ ++ return 0; ++ ++err_alloc: ++ rkvdec2_free_rcb(ctx); ++ ++ return ret; ++} ++ ++static int rkvdec2_start_streaming(struct vb2_queue *q, unsigned int count) ++{ ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(q); ++ const struct rkvdec2_coded_fmt_desc *desc; ++ int ret; ++ ++ if (V4L2_TYPE_IS_CAPTURE(q->type)) ++ return 0; ++ ++ desc = ctx->coded_fmt_desc; ++ if (WARN_ON(!desc)) ++ return -EINVAL; ++ ++ ret = rkvdec2_allocate_rcb(ctx); ++ if (ret) ++ return ret; ++ ++ if (desc->ops->start) { ++ ret = desc->ops->start(ctx); ++ if (ret) ++ goto err_ops_start; ++ } ++ ++ return 0; ++ ++err_ops_start: ++ rkvdec2_free_rcb(ctx); ++ ++ return ret; ++} ++ ++static void rkvdec2_queue_cleanup(struct vb2_queue *vq, u32 state) ++{ ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(vq); ++ ++ while (true) { ++ struct vb2_v4l2_buffer *vbuf; ++ ++ if (V4L2_TYPE_IS_OUTPUT(vq->type)) ++ vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); ++ else ++ vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); ++ ++ if (!vbuf) ++ break; ++ ++ v4l2_ctrl_request_complete(vbuf->vb2_buf.req_obj.req, ++ &ctx->ctrl_hdl); ++ v4l2_m2m_buf_done(vbuf, state); ++ } ++} ++ ++static void rkvdec2_stop_streaming(struct vb2_queue *q) ++{ ++ struct rkvdec2_ctx *ctx = vb2_get_drv_priv(q); ++ ++ if (V4L2_TYPE_IS_OUTPUT(q->type)) { ++ const struct rkvdec2_coded_fmt_desc *desc = ctx->coded_fmt_desc; ++ ++ if (WARN_ON(!desc)) ++ return; ++ ++ if (desc->ops->stop) ++ desc->ops->stop(ctx); ++ ++ rkvdec2_free_rcb(ctx); ++ } ++ ++ rkvdec2_queue_cleanup(q, VB2_BUF_STATE_ERROR); ++} ++ ++static const struct vb2_ops rkvdec2_queue_ops = { ++ .queue_setup = rkvdec2_queue_setup, ++ .buf_prepare = rkvdec2_buf_prepare, ++ .buf_queue = rkvdec2_buf_queue, ++ .buf_out_validate = rkvdec2_buf_out_validate, ++ .buf_request_complete = rkvdec2_buf_request_complete, ++ .start_streaming = rkvdec2_start_streaming, ++ .stop_streaming = rkvdec2_stop_streaming, ++ .wait_prepare = vb2_ops_wait_prepare, ++ .wait_finish = vb2_ops_wait_finish, ++}; ++ ++static int rkvdec2_request_validate(struct media_request *req) ++{ ++ unsigned int count; ++ ++ count = vb2_request_buffer_cnt(req); ++ if (!count) ++ return -ENOENT; ++ else if (count > 1) ++ return -EINVAL; ++ ++ return vb2_request_validate(req); ++} ++ ++static const struct media_device_ops rkvdec2_media_ops = { ++ .req_validate = rkvdec2_request_validate, ++ .req_queue = v4l2_m2m_request_queue, ++}; ++ ++static void rkvdec2_job_finish_no_pm(struct rkvdec2_ctx *ctx, ++ enum vb2_buffer_state result) ++{ ++ if (ctx->coded_fmt_desc->ops->done) { ++ struct vb2_v4l2_buffer *src_buf, *dst_buf; ++ ++ src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); ++ dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); ++ ctx->coded_fmt_desc->ops->done(ctx, src_buf, dst_buf, result); ++ } ++ ++ v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, ++ result); ++} ++ ++static void rkvdec2_job_finish(struct rkvdec2_ctx *ctx, ++ enum vb2_buffer_state result) ++{ ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ ++ pm_runtime_mark_last_busy(rkvdec->dev); ++ pm_runtime_put_autosuspend(rkvdec->dev); ++ rkvdec2_job_finish_no_pm(ctx, result); ++} ++ ++void rkvdec2_run_preamble(struct rkvdec2_ctx *ctx, struct rkvdec2_run *run) ++{ ++ struct media_request *src_req; ++ ++ memset(run, 0, sizeof(*run)); ++ ++ run->bufs.src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); ++ run->bufs.dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); ++ ++ /* Apply request(s) controls if needed. */ ++ src_req = run->bufs.src->vb2_buf.req_obj.req; ++ if (src_req) ++ v4l2_ctrl_request_setup(src_req, &ctx->ctrl_hdl); ++ ++ v4l2_m2m_buf_copy_metadata(run->bufs.src, run->bufs.dst, true); ++} ++ ++void rkvdec2_run_postamble(struct rkvdec2_ctx *ctx, struct rkvdec2_run *run) ++{ ++ struct media_request *src_req = run->bufs.src->vb2_buf.req_obj.req; ++ ++ if (src_req) ++ v4l2_ctrl_request_complete(src_req, &ctx->ctrl_hdl); ++} ++ ++static void rkvdec2_device_run(void *priv) ++{ ++ struct rkvdec2_ctx *ctx = priv; ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ const struct rkvdec2_coded_fmt_desc *desc = ctx->coded_fmt_desc; ++ int ret; ++ ++ if (WARN_ON(!desc)) ++ return; ++ ++ ret = pm_runtime_resume_and_get(rkvdec->dev); ++ if (ret < 0) { ++ rkvdec2_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR); ++ return; ++ } ++ ++ ret = desc->ops->run(ctx); ++ if (ret) ++ rkvdec2_job_finish(ctx, VB2_BUF_STATE_ERROR); ++} ++ ++static const struct v4l2_m2m_ops rkvdec2_m2m_ops = { ++ .device_run = rkvdec2_device_run, ++}; ++ ++static int rkvdec2_queue_init(void *priv, ++ struct vb2_queue *src_vq, ++ struct vb2_queue *dst_vq) ++{ ++ struct rkvdec2_ctx *ctx = priv; ++ struct rkvdec2_dev *rkvdec = ctx->dev; ++ int ret; ++ ++ src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; ++ src_vq->io_modes = VB2_MMAP | VB2_DMABUF; ++ src_vq->drv_priv = ctx; ++ src_vq->ops = &rkvdec2_queue_ops; ++ src_vq->mem_ops = &vb2_dma_contig_memops; ++ ++ /* ++ * No CPU access on the queues, so no kernel mapping needed. ++ */ ++ src_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING; ++ src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); ++ src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ++ src_vq->lock = &rkvdec->vdev_lock; ++ src_vq->dev = rkvdec->v4l2_dev.dev; ++ src_vq->supports_requests = true; ++ src_vq->requires_requests = true; ++ ++ ret = vb2_queue_init(src_vq); ++ if (ret) ++ return ret; ++ ++ dst_vq->bidirectional = true; ++ dst_vq->mem_ops = &vb2_dma_contig_memops; ++ dst_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING; ++ dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ dst_vq->io_modes = VB2_MMAP | VB2_DMABUF; ++ dst_vq->drv_priv = ctx; ++ dst_vq->ops = &rkvdec2_queue_ops; ++ dst_vq->buf_struct_size = sizeof(struct rkvdec2_decoded_buffer); ++ dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ++ dst_vq->lock = &rkvdec->vdev_lock; ++ dst_vq->dev = rkvdec->v4l2_dev.dev; ++ ++ return vb2_queue_init(dst_vq); ++} ++ ++static int rkvdec2_add_ctrls(struct rkvdec2_ctx *ctx, ++ const struct rkvdec2_ctrls *ctrls) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < ctrls->num_ctrls; i++) { ++ const struct v4l2_ctrl_config *cfg = &ctrls->ctrls[i].cfg; ++ ++ v4l2_ctrl_new_custom(&ctx->ctrl_hdl, cfg, ctx); ++ if (ctx->ctrl_hdl.error) ++ return ctx->ctrl_hdl.error; ++ } ++ ++ return 0; ++} ++ ++static int rkvdec2_init_ctrls(struct rkvdec2_ctx *ctx) ++{ ++ unsigned int i, nctrls = 0; ++ int ret; ++ ++ for (i = 0; i < ARRAY_SIZE(rkvdec2_coded_fmts); i++) ++ nctrls += rkvdec2_coded_fmts[i].ctrls->num_ctrls; ++ ++ v4l2_ctrl_handler_init(&ctx->ctrl_hdl, nctrls); ++ ++ for (i = 0; i < ARRAY_SIZE(rkvdec2_coded_fmts); i++) { ++ ret = rkvdec2_add_ctrls(ctx, rkvdec2_coded_fmts[i].ctrls); ++ if (ret) ++ goto err_free_handler; ++ } ++ ++ ret = v4l2_ctrl_handler_setup(&ctx->ctrl_hdl); ++ if (ret) ++ goto err_free_handler; ++ ++ ctx->fh.ctrl_handler = &ctx->ctrl_hdl; ++ return 0; ++ ++err_free_handler: ++ v4l2_ctrl_handler_free(&ctx->ctrl_hdl); ++ return ret; ++} ++ ++static int rkvdec2_open(struct file *filp) ++{ ++ struct rkvdec2_dev *rkvdec = video_drvdata(filp); ++ struct rkvdec2_ctx *ctx; ++ int ret; ++ ++ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ++ if (!ctx) ++ return -ENOMEM; ++ ++ ctx->dev = rkvdec; ++ rkvdec2_reset_coded_fmt(ctx); ++ rkvdec2_reset_decoded_fmt(ctx); ++ v4l2_fh_init(&ctx->fh, video_devdata(filp)); ++ ++ ret = rkvdec2_init_ctrls(ctx); ++ if (ret) ++ goto err_free_ctx; ++ ++ ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(rkvdec->m2m_dev, ctx, ++ rkvdec2_queue_init); ++ if (IS_ERR(ctx->fh.m2m_ctx)) { ++ ret = PTR_ERR(ctx->fh.m2m_ctx); ++ goto err_cleanup_ctrls; ++ } ++ ++ filp->private_data = &ctx->fh; ++ v4l2_fh_add(&ctx->fh); ++ ++ return 0; ++ ++err_cleanup_ctrls: ++ v4l2_ctrl_handler_free(&ctx->ctrl_hdl); ++ ++err_free_ctx: ++ kfree(ctx); ++ return ret; ++} ++ ++static int rkvdec2_release(struct file *filp) ++{ ++ struct rkvdec2_ctx *ctx = fh_to_rkvdec2_ctx(filp->private_data); ++ ++ v4l2_fh_del(&ctx->fh); ++ v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); ++ v4l2_ctrl_handler_free(&ctx->ctrl_hdl); ++ v4l2_fh_exit(&ctx->fh); ++ kfree(ctx); ++ ++ return 0; ++} ++ ++static const struct v4l2_file_operations rkvdec2_fops = { ++ .owner = THIS_MODULE, ++ .open = rkvdec2_open, ++ .release = rkvdec2_release, ++ .poll = v4l2_m2m_fop_poll, ++ .unlocked_ioctl = video_ioctl2, ++ .mmap = v4l2_m2m_fop_mmap, ++}; ++ ++static int rkvdec2_v4l2_init(struct rkvdec2_dev *rkvdec) ++{ ++ int ret; ++ ++ ret = v4l2_device_register(rkvdec->dev, &rkvdec->v4l2_dev); ++ if (ret) { ++ dev_err(rkvdec->dev, "Failed to register V4L2 device\n"); ++ return ret; ++ } ++ ++ rkvdec->m2m_dev = v4l2_m2m_init(&rkvdec2_m2m_ops); ++ if (IS_ERR(rkvdec->m2m_dev)) { ++ v4l2_err(&rkvdec->v4l2_dev, "Failed to init mem2mem device\n"); ++ ret = PTR_ERR(rkvdec->m2m_dev); ++ goto err_unregister_v4l2; ++ } ++ ++ rkvdec->mdev.dev = rkvdec->dev; ++ strscpy(rkvdec->mdev.model, "rkvdec2", sizeof(rkvdec->mdev.model)); ++ strscpy(rkvdec->mdev.bus_info, "platform:rkvdec2", ++ sizeof(rkvdec->mdev.bus_info)); ++ media_device_init(&rkvdec->mdev); ++ rkvdec->mdev.ops = &rkvdec2_media_ops; ++ rkvdec->v4l2_dev.mdev = &rkvdec->mdev; ++ ++ rkvdec->vdev.lock = &rkvdec->vdev_lock; ++ rkvdec->vdev.v4l2_dev = &rkvdec->v4l2_dev; ++ rkvdec->vdev.fops = &rkvdec2_fops; ++ rkvdec->vdev.release = video_device_release_empty; ++ rkvdec->vdev.vfl_dir = VFL_DIR_M2M; ++ rkvdec->vdev.device_caps = V4L2_CAP_STREAMING | ++ V4L2_CAP_VIDEO_M2M_MPLANE; ++ rkvdec->vdev.ioctl_ops = &rkvdec2_ioctl_ops; ++ video_set_drvdata(&rkvdec->vdev, rkvdec); ++ strscpy(rkvdec->vdev.name, "rkvdec2", sizeof(rkvdec->vdev.name)); ++ ++ ret = video_register_device(&rkvdec->vdev, VFL_TYPE_VIDEO, -1); ++ if (ret) { ++ v4l2_err(&rkvdec->v4l2_dev, "Failed to register video device\n"); ++ goto err_cleanup_mc; ++ } ++ ++ ret = v4l2_m2m_register_media_controller(rkvdec->m2m_dev, &rkvdec->vdev, ++ MEDIA_ENT_F_PROC_VIDEO_DECODER); ++ if (ret) { ++ v4l2_err(&rkvdec->v4l2_dev, ++ "Failed to initialize V4L2 M2M media controller\n"); ++ goto err_unregister_vdev; ++ } ++ ++ ret = media_device_register(&rkvdec->mdev); ++ if (ret) { ++ v4l2_err(&rkvdec->v4l2_dev, "Failed to register media device\n"); ++ goto err_unregister_mc; ++ } ++ ++ return 0; ++ ++err_unregister_mc: ++ v4l2_m2m_unregister_media_controller(rkvdec->m2m_dev); ++ ++err_unregister_vdev: ++ video_unregister_device(&rkvdec->vdev); ++ ++err_cleanup_mc: ++ media_device_cleanup(&rkvdec->mdev); ++ v4l2_m2m_release(rkvdec->m2m_dev); ++ ++err_unregister_v4l2: ++ v4l2_device_unregister(&rkvdec->v4l2_dev); ++ return ret; ++} ++ ++static void rkvdec2_v4l2_cleanup(struct rkvdec2_dev *rkvdec) ++{ ++ media_device_unregister(&rkvdec->mdev); ++ v4l2_m2m_unregister_media_controller(rkvdec->m2m_dev); ++ video_unregister_device(&rkvdec->vdev); ++ media_device_cleanup(&rkvdec->mdev); ++ v4l2_m2m_release(rkvdec->m2m_dev); ++ v4l2_device_unregister(&rkvdec->v4l2_dev); ++} ++ ++static irqreturn_t rkvdec2_irq_handler(int irq, void *priv) ++{ ++ struct rkvdec2_dev *rkvdec = priv; ++ enum vb2_buffer_state state; ++ u32 status; ++ ++ status = readl(rkvdec->regs + RKVDEC2_REG_STA_INT); ++ state = (status & STA_INT_DEC_RDY_STA) ? ++ VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; ++ ++ /* Clear interrupt status */ ++ writel(0, rkvdec->regs + RKVDEC2_REG_STA_INT); ++ if (cancel_delayed_work(&rkvdec->watchdog_work)) { ++ struct rkvdec2_ctx *ctx; ++ ++ ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); ++ rkvdec2_job_finish(ctx, state); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static void rkvdec2_watchdog_func(struct work_struct *work) ++{ ++ struct rkvdec2_dev *rkvdec = container_of(to_delayed_work(work), struct rkvdec2_dev, ++ watchdog_work); ++ struct rkvdec2_ctx *ctx; ++ ++ ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); ++ if (ctx) { ++ dev_err(rkvdec->dev, "Frame processing timed out!\n"); ++ writel(RKVDEC2_REG_DEC_IRQ_DISABLE, rkvdec->regs + RKVDEC2_REG_IMPORTANT_EN); ++ writel(0, rkvdec->regs + RKVDEC2_REG_DEC_E); ++ rkvdec2_job_finish(ctx, VB2_BUF_STATE_ERROR); ++ } ++} ++ ++static const struct of_device_id of_rkvdec2_match[] = { ++ { .compatible = "rockchip,rk3588-vdec" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, of_rkvdec2_match); ++ ++static const char * const rkvdec2_clk_names[] = { ++ "axi", ++ "ahb", ++ "core", ++ "cabac", ++ "hevc_cabac", ++}; ++ ++/* ++ * Some SoCs, like RK3588 have multiple identical vdpu34x cores, but the ++ * kernel is currently missing support for multi-core handling. Exposing ++ * separate devices for each core to userspace is bad, since that does ++ * not allow scheduling tasks properly (and creates ABI). With this workaround ++ * the driver will only probe for the first core and early exit for the other ++ * cores. Once the driver gains multi-core support, the same technique ++ * for detecting the main core can be used to cluster all cores together. ++ */ ++static int rkvdec2_disable_multicore(struct rkvdec2_dev *rkvdec) ++{ ++ const char *compatible; ++ struct device_node *node; ++ int ret; ++ ++ /* Intentionally ignores the fallback strings */ ++ ret = of_property_read_string(rkvdec->dev->of_node, "compatible", &compatible); ++ if (ret) ++ return ret; ++ ++ /* first compatible node found from the root node is considered the main core */ ++ node = of_find_compatible_node(NULL, NULL, compatible); ++ if (!node) ++ return -EINVAL; /* broken DT? */ ++ ++ if (rkvdec->dev->of_node != node) { ++ dev_info(rkvdec->dev, "missing multi-core support, ignoring this instance\n"); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static int rkvdec2_probe(struct platform_device *pdev) ++{ ++ struct rkvdec2_dev *rkvdec; ++ unsigned int i; ++ int ret, irq; ++ ++ rkvdec = devm_kzalloc(&pdev->dev, sizeof(*rkvdec), GFP_KERNEL); ++ if (!rkvdec) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, rkvdec); ++ rkvdec->dev = &pdev->dev; ++ ++ ret = rkvdec2_disable_multicore(rkvdec); ++ if (ret) ++ return ret; ++ ++ mutex_init(&rkvdec->vdev_lock); ++ INIT_DELAYED_WORK(&rkvdec->watchdog_work, rkvdec2_watchdog_func); ++ ++ rkvdec->clocks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(rkvdec2_clk_names), ++ sizeof(*rkvdec->clocks), GFP_KERNEL); ++ if (!rkvdec->clocks) ++ return -ENOMEM; ++ ++ for (i = 0; i < ARRAY_SIZE(rkvdec2_clk_names); i++) ++ rkvdec->clocks[i].id = rkvdec2_clk_names[i]; ++ ++ ret = devm_clk_bulk_get(&pdev->dev, ARRAY_SIZE(rkvdec2_clk_names), ++ rkvdec->clocks); ++ if (ret) ++ return ret; ++ ++ rkvdec->regs = devm_platform_ioremap_resource_byname(pdev, "function"); ++ if (IS_ERR(rkvdec->regs)) ++ return PTR_ERR(rkvdec->regs); ++ ++ /* ++ * Without IOMMU support, keep DMA in the lower 32 bits. ++ */ ++ ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set DMA coherent mask.\n"); ++ return ret; ++ } ++ ++ vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq <= 0) ++ return -ENXIO; ++ ++ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, ++ rkvdec2_irq_handler, IRQF_ONESHOT, ++ dev_name(&pdev->dev), rkvdec); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not request vdec2 IRQ\n"); ++ return ret; ++ } ++ ++ rkvdec->sram_pool = of_gen_pool_get(pdev->dev.of_node, "sram", 0); ++ if (!rkvdec->sram_pool) ++ dev_info(&pdev->dev, "No sram node, RCB will be stored in RAM\n"); ++ ++ pm_runtime_set_autosuspend_delay(&pdev->dev, 100); ++ pm_runtime_use_autosuspend(&pdev->dev); ++ pm_runtime_enable(&pdev->dev); ++ ++ ret = rkvdec2_v4l2_init(rkvdec); ++ if (ret) ++ goto err_disable_runtime_pm; ++ ++ return 0; ++ ++err_disable_runtime_pm: ++ pm_runtime_dont_use_autosuspend(&pdev->dev); ++ pm_runtime_disable(&pdev->dev); ++ ++ if (rkvdec->sram_pool) ++ gen_pool_destroy(rkvdec->sram_pool); ++ ++ return ret; ++} ++ ++static void rkvdec2_remove(struct platform_device *pdev) ++{ ++ struct rkvdec2_dev *rkvdec = platform_get_drvdata(pdev); ++ ++ cancel_delayed_work_sync(&rkvdec->watchdog_work); ++ ++ rkvdec2_v4l2_cleanup(rkvdec); ++ pm_runtime_disable(&pdev->dev); ++ pm_runtime_dont_use_autosuspend(&pdev->dev); ++ ++ if (rkvdec->sram_pool) ++ gen_pool_destroy(rkvdec->sram_pool); ++} ++ ++#ifdef CONFIG_PM ++static int rkvdec2_runtime_resume(struct device *dev) ++{ ++ struct rkvdec2_dev *rkvdec = dev_get_drvdata(dev); ++ ++ return clk_bulk_prepare_enable(ARRAY_SIZE(rkvdec2_clk_names), ++ rkvdec->clocks); ++} ++ ++static int rkvdec2_runtime_suspend(struct device *dev) ++{ ++ struct rkvdec2_dev *rkvdec = dev_get_drvdata(dev); ++ ++ clk_bulk_disable_unprepare(ARRAY_SIZE(rkvdec2_clk_names), ++ rkvdec->clocks); ++ return 0; ++} ++#endif ++ ++static const struct dev_pm_ops rkvdec2_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ++ pm_runtime_force_resume) ++ SET_RUNTIME_PM_OPS(rkvdec2_runtime_suspend, rkvdec2_runtime_resume, NULL) ++}; ++ ++static struct platform_driver rkvdec2_driver = { ++ .probe = rkvdec2_probe, ++ .remove_new = rkvdec2_remove, ++ .driver = { ++ .name = "rkvdec2", ++ .of_match_table = of_rkvdec2_match, ++ .pm = &rkvdec2_pm_ops, ++ }, ++}; ++module_platform_driver(rkvdec2_driver); ++ ++MODULE_AUTHOR("Detlev Casanova "); ++MODULE_DESCRIPTION("Rockchip Video Decoder 2 driver"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/platform/rockchip/rkvdec2/rkvdec2.h b/drivers/media/platform/rockchip/rkvdec2/rkvdec2.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/rockchip/rkvdec2/rkvdec2.h +@@ -0,0 +1,130 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Rockchip Video Decoder 2 driver ++ * ++ * Copyright (C) 2024 Collabora, Ltd. ++ * Detlev Casanova ++ * ++ * Based on rkvdec driver by Boris Brezillon ++ */ ++#ifndef RKVDEC_H_ ++#define RKVDEC_H_ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "rkvdec2-regs.h" ++ ++#define RKVDEC2_RCB_COUNT 10 ++ ++struct rkvdec2_ctx; ++ ++enum rkvdec2_alloc_type { ++ RKVDEC2_ALLOC_SRAM, ++ RKVDEC2_ALLOC_DMA, ++}; ++ ++struct rkvdec2_aux_buf { ++ void *cpu; ++ dma_addr_t dma; ++ size_t size; ++ enum rkvdec2_alloc_type type; ++}; ++ ++struct rkvdec2_ctrl_desc { ++ struct v4l2_ctrl_config cfg; ++}; ++ ++struct rkvdec2_ctrls { ++ const struct rkvdec2_ctrl_desc *ctrls; ++ unsigned int num_ctrls; ++}; ++ ++struct rkvdec2_run { ++ struct { ++ struct vb2_v4l2_buffer *src; ++ struct vb2_v4l2_buffer *dst; ++ } bufs; ++}; ++ ++struct rkvdec2_decoded_buffer { ++ /* Must be the first field in this struct. */ ++ struct v4l2_m2m_buffer base; ++}; ++ ++static inline struct rkvdec2_decoded_buffer * ++vb2_to_rkvdec2_decoded_buf(struct vb2_buffer *buf) ++{ ++ return container_of(buf, struct rkvdec2_decoded_buffer, ++ base.vb.vb2_buf); ++} ++ ++struct rkvdec2_coded_fmt_ops { ++ int (*adjust_fmt)(struct rkvdec2_ctx *ctx, ++ struct v4l2_format *f); ++ int (*start)(struct rkvdec2_ctx *ctx); ++ void (*stop)(struct rkvdec2_ctx *ctx); ++ int (*run)(struct rkvdec2_ctx *ctx); ++ void (*done)(struct rkvdec2_ctx *ctx, struct vb2_v4l2_buffer *src_buf, ++ struct vb2_v4l2_buffer *dst_buf, ++ enum vb2_buffer_state result); ++ int (*try_ctrl)(struct rkvdec2_ctx *ctx, struct v4l2_ctrl *ctrl); ++}; ++ ++struct rkvdec2_coded_fmt_desc { ++ u32 fourcc; ++ struct v4l2_frmsize_stepwise frmsize; ++ const struct rkvdec2_ctrls *ctrls; ++ const struct rkvdec2_coded_fmt_ops *ops; ++ unsigned int num_decoded_fmts; ++ const u32 *decoded_fmts; ++ u32 subsystem_flags; ++}; ++ ++struct rkvdec2_dev { ++ struct v4l2_device v4l2_dev; ++ struct media_device mdev; ++ struct video_device vdev; ++ struct v4l2_m2m_dev *m2m_dev; ++ struct device *dev; ++ struct clk_bulk_data *clocks; ++ void __iomem *regs; ++ struct gen_pool *sram_pool; ++ struct mutex vdev_lock; /* serializes ioctls */ ++ struct delayed_work watchdog_work; ++}; ++ ++struct rkvdec2_ctx { ++ struct v4l2_fh fh; ++ struct v4l2_format coded_fmt; ++ struct v4l2_format decoded_fmt; ++ const struct rkvdec2_coded_fmt_desc *coded_fmt_desc; ++ struct v4l2_ctrl_handler ctrl_hdl; ++ struct rkvdec2_dev *dev; ++ struct rkvdec2_aux_buf rcb_bufs[RKVDEC2_RCB_COUNT]; ++ ++ u32 colmv_offset; ++ ++ void *priv; ++}; ++ ++static inline struct rkvdec2_ctx *fh_to_rkvdec2_ctx(struct v4l2_fh *fh) ++{ ++ return container_of(fh, struct rkvdec2_ctx, fh); ++} ++ ++void rkvdec2_run_preamble(struct rkvdec2_ctx *ctx, struct rkvdec2_run *run); ++void rkvdec2_run_postamble(struct rkvdec2_ctx *ctx, struct rkvdec2_run *run); ++ ++extern const struct rkvdec2_coded_fmt_ops rkvdec2_h264_fmt_ops; ++ ++#endif /* RKVDEC_H_ */ +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Fri, 14 Jun 2024 19:53:40 -0400 +Subject: media: dt-bindings: rockchip: Document RK3588 Video Decoder bindings + +Document the Rockchip RK3588 Video Decoder bindings. + +Signed-off-by: Detlev Casanova +--- + Documentation/devicetree/bindings/media/rockchip,vdec.yaml | 73 +++++++++- + 1 file changed, 72 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml ++++ b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml +@@ -17,6 +17,7 @@ properties: + compatible: + oneOf: + - const: rockchip,rk3399-vdec ++ - const: rockchip,rk3588-vdec + - items: + - enum: + - rockchip,rk3228-vdec +@@ -24,35 +25,72 @@ properties: + - const: rockchip,rk3399-vdec + + reg: +- maxItems: 1 ++ minItems: 1 ++ items: ++ - description: The link table configuration registers base ++ - description: The function configuration registers base ++ - description: The cache configuration registers base ++ ++ reg-names: ++ items: ++ - const: link ++ - const: function ++ - const: cache + + interrupts: + maxItems: 1 + + clocks: ++ minItems: 4 + items: + - description: The Video Decoder AXI interface clock + - description: The Video Decoder AHB interface clock + - description: The Video Decoded CABAC clock + - description: The Video Decoder core clock ++ - description: The Video decoder HEVC CABAC clock + + clock-names: ++ minItems: 4 + items: + - const: axi + - const: ahb + - const: cabac + - const: core ++ - const: hevc_cabac + + assigned-clocks: true + + assigned-clock-rates: true + ++ resets: ++ items: ++ - description: The Video Decoder AXI interface reset ++ - description: The Video Decoder AHB interface reset ++ - description: The Video Decoded CABAC reset ++ - description: The Video Decoder core reset ++ - description: The Video decoder HEVC CABAC reset ++ ++ reset-names: ++ items: ++ - const: axi ++ - const: ahb ++ - const: cabac ++ - const: core ++ - const: hevc_cabac ++ + power-domains: + maxItems: 1 + + iommus: + maxItems: 1 + ++ sram: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: | ++ phandle to a reserved on-chip SRAM regions. ++ Some SoCs, like rk3588 provide on-chip SRAM to store temporary ++ buffers during decoding. ++ + required: + - compatible + - reg +@@ -61,6 +99,39 @@ required: + - clock-names + - power-domains + ++allOf: ++ - if: ++ properties: ++ compatible: ++ contains: ++ const: rockchip,rk3588-vdec ++ then: ++ properties: ++ reg: ++ minItems: 3 ++ reg-names: ++ minItems: 3 ++ clocks: ++ minItems: 5 ++ clock-names: ++ minItems: 5 ++ resets: ++ minItems: 5 ++ reset-names: ++ minItems: 5 ++ else: ++ properties: ++ reg: ++ maxItems: 1 ++ reg-names: false ++ clocks: ++ maxItems: 4 ++ clock-names: ++ maxItems: 4 ++ resets: false ++ reset-names: false ++ sram: false ++ + additionalProperties: false + + examples: +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Fri, 14 Jun 2024 19:56:19 -0400 +Subject: arm64: dts: rockchip: Add rkvdec2 Video Decoder on rk3588(s) + +Add the rkvdec2 Video Decoder to the RK3588s devicetree. + +Signed-off-by: Detlev Casanova +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 48 ++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1224,6 +1224,44 @@ vepu121_3_mmu: iommu@fdbac800 { + #iommu-cells = <0>; + }; + ++ vdec0: video-decoder@fdc38000 { ++ compatible = "rockchip,rk3588-vdec"; ++ reg = <0x0 0xfdc38000 0x0 0x100>, <0x0 0xfdc38100 0x0 0x500>, <0x0 0xfdc38600 0x0 0x100>; ++ reg-names = "link", "function", "cache"; ++ interrupts = ; ++ clocks = <&cru ACLK_RKVDEC0>, <&cru HCLK_RKVDEC0>, <&cru CLK_RKVDEC0_CA>, ++ <&cru CLK_RKVDEC0_CORE>, <&cru CLK_RKVDEC0_HEVC_CA>; ++ clock-names = "axi", "ahb", "cabac", "core", "hevc_cabac"; ++ assigned-clocks = <&cru ACLK_RKVDEC0>, <&cru CLK_RKVDEC0_CORE>, ++ <&cru CLK_RKVDEC0_CA>, <&cru CLK_RKVDEC0_HEVC_CA>; ++ assigned-clock-rates = <800000000>, <600000000>, ++ <600000000>, <1000000000>; ++ resets = <&cru SRST_A_RKVDEC0>, <&cru SRST_H_RKVDEC0>, <&cru SRST_RKVDEC0_CA>, ++ <&cru SRST_RKVDEC0_CORE>, <&cru SRST_RKVDEC0_HEVC_CA>; ++ reset-names = "axi", "ahb", "cabac", "core", "hevc_cabac"; ++ power-domains = <&power RK3588_PD_RKVDEC0>; ++ sram = <&vdec0_sram>; ++ }; ++ ++ vdec1: video-decoder@fdc40000 { ++ compatible = "rockchip,rk3588-vdec"; ++ reg = <0x0 0xfdc40000 0x0 0x100>, <0x0 0xfdc40100 0x0 0x500>, <0x0 0xfdc40600 0x0 0x100>; ++ reg-names = "link", "function", "cache"; ++ interrupts = ; ++ clocks = <&cru ACLK_RKVDEC1>, <&cru HCLK_RKVDEC1>, <&cru CLK_RKVDEC1_CA>, ++ <&cru CLK_RKVDEC1_CORE>, <&cru CLK_RKVDEC1_HEVC_CA>; ++ clock-names = "axi", "ahb", "cabac", "core", "hevc_cabac"; ++ assigned-clocks = <&cru ACLK_RKVDEC1>, <&cru CLK_RKVDEC1_CORE>, ++ <&cru CLK_RKVDEC1_CA>, <&cru CLK_RKVDEC1_HEVC_CA>; ++ assigned-clock-rates = <800000000>, <600000000>, ++ <600000000>, <1000000000>; ++ resets = <&cru SRST_A_RKVDEC1>, <&cru SRST_H_RKVDEC1>, <&cru SRST_RKVDEC1_CA>, ++ <&cru SRST_RKVDEC1_CORE>, <&cru SRST_RKVDEC1_HEVC_CA>; ++ reset-names = "axi", "ahb", "cabac", "core", "hevc_cabac"; ++ power-domains = <&power RK3588_PD_RKVDEC1>; ++ sram = <&vdec1_sram>; ++ }; ++ + av1d: video-codec@fdc70000 { + compatible = "rockchip,rk3588-av1-vpu"; + reg = <0x0 0xfdc70000 0x0 0x800>; +@@ -2848,6 +2886,16 @@ system_sram2: sram@ff001000 { + ranges = <0x0 0x0 0xff001000 0xef000>; + #address-cells = <1>; + #size-cells = <1>; ++ ++ vdec0_sram: codec-sram@0 { ++ reg = <0x0 0x78000>; ++ pool; ++ }; ++ ++ vdec1_sram: codec-sram@78000 { ++ reg = <0x78000 0x77000>; ++ pool; ++ }; + }; + + pinctrl: pinctrl { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0028-media-v4l2-core-Initialize-h264-frame_mbs_only_flag-.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0028-media-v4l2-core-Initialize-h264-frame_mbs_only_flag-.patch new file mode 100644 index 000000000000..13b5aecefc5b --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0028-media-v4l2-core-Initialize-h264-frame_mbs_only_flag-.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Fri, 21 Jun 2024 16:32:55 +0800 +Subject: media: v4l2-core: Initialize h264 frame_mbs_only_flag as 1 + +--- + drivers/media/v4l2-core/v4l2-ctrls-core.c | 13 ++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c +index 111111111111..222222222222 100644 +--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c ++++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c +@@ -111,6 +111,7 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx, + struct v4l2_ctrl_vp9_frame *p_vp9_frame; + struct v4l2_ctrl_fwht_params *p_fwht_params; + struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix; ++ struct v4l2_ctrl_h264_sps *p_h264_sps; + struct v4l2_ctrl_av1_sequence *p_av1_sequence; + void *p = ptr.p + idx * ctrl->elem_size; + +@@ -179,6 +180,18 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx, + */ + memset(p_h264_scaling_matrix, 16, sizeof(*p_h264_scaling_matrix)); + break; ++ case V4L2_CTRL_TYPE_H264_SPS: ++ p_h264_sps = p; ++ /* ++ * Without V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY, ++ * frame_mbs_only_flag set to 0 will translate to a miniumum ++ * height of 32 (see H.264 specification 7-8). Some driver may ++ * have a minimum size lower then 32, which would fail ++ * validation with the SPS value. Set this flag, so that there ++ * is now doubling in the height, allowing a valid default. ++ */ ++ p_h264_sps->flags = V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY; ++ break; + } + } + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0029-arm64-dts-rockchip-rk3588-add-RGA2-node.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0029-arm64-dts-rockchip-rk3588-add-RGA2-node.patch new file mode 100644 index 000000000000..abb8d1683714 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0029-arm64-dts-rockchip-rk3588-add-RGA2-node.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Mon, 13 May 2024 20:29:49 +0300 +Subject: arm64: dts: rockchip: rk3588: add VDPU and RGA2 nodes + +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -566,6 +566,17 @@ mmu600_php: iommu@fcb00000 { + status = "disabled"; + }; + ++ rga: rga@fdb80000 { ++ compatible = "rockchip,rk3568-rga", "rockchip,rk3288-rga"; ++ reg = <0x0 0xfdb80000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru ACLK_RGA2>, <&cru HCLK_RGA2>, <&cru CLK_RGA2_CORE>; ++ clock-names = "aclk", "hclk", "sclk"; ++ resets = <&cru SRST_RGA2_CORE>, <&cru SRST_A_RGA2>, <&cru SRST_H_RGA2>; ++ reset-names = "core", "axi", "ahb"; ++ power-domains = <&power RK3588_PD_VDPU>; ++ }; ++ + pmu1grf: syscon@fd58a000 { + compatible = "rockchip,rk3588-pmugrf", "syscon", "simple-mfd"; + reg = <0x0 0xfd58a000 0x0 0x10000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0113-add-synopsys-designware-hdmi-rx-controller.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0113-add-synopsys-designware-hdmi-rx-controller.patch new file mode 100644 index 000000000000..7c37c6b79ceb --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0113-add-synopsys-designware-hdmi-rx-controller.patch @@ -0,0 +1,3967 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shreeya Patel +Date: Fri, 19 Jul 2024 18:10:30 +0530 +Subject: dt-bindings: media: Document bindings for HDMI RX Controller + +Document bindings for the Synopsys DesignWare HDMI RX Controller. + +Reviewed-by: Rob Herring +Reviewed-by: Dmitry Osipenko +Signed-off-by: Shreeya Patel +Reviewed-by: Sebastian Reichel +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20240719124032.26852-3-shreeya.patel@collabora.com +Signed-off-by: Sebastian Reichel +--- + Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml | 132 ++++++++++ + 1 file changed, 132 insertions(+) + +diff --git a/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml b/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml +@@ -0,0 +1,132 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++# Device Tree bindings for Synopsys DesignWare HDMI RX Controller ++ ++--- ++$id: http://devicetree.org/schemas/media/snps,dw-hdmi-rx.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Synopsys DesignWare HDMI RX Controller ++ ++maintainers: ++ - Shreeya Patel ++ ++description: ++ Synopsys DesignWare HDMI Input Controller preset on RK3588 SoCs ++ allowing devices to receive and decode high-resolution video streams ++ from external sources like media players, cameras, laptops, etc. ++ ++properties: ++ compatible: ++ items: ++ - const: rockchip,rk3588-hdmirx-ctrler ++ - const: snps,dw-hdmi-rx ++ ++ reg: ++ maxItems: 1 ++ ++ interrupts: ++ maxItems: 3 ++ ++ interrupt-names: ++ items: ++ - const: cec ++ - const: hdmi ++ - const: dma ++ ++ clocks: ++ maxItems: 7 ++ ++ clock-names: ++ items: ++ - const: aclk ++ - const: audio ++ - const: cr_para ++ - const: pclk ++ - const: ref ++ - const: hclk_s_hdmirx ++ - const: hclk_vo1 ++ ++ power-domains: ++ maxItems: 1 ++ ++ resets: ++ maxItems: 4 ++ ++ reset-names: ++ items: ++ - const: axi ++ - const: apb ++ - const: ref ++ - const: biu ++ ++ memory-region: ++ maxItems: 1 ++ ++ hpd-gpios: ++ description: GPIO specifier for HPD. ++ maxItems: 1 ++ ++ rockchip,grf: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: ++ The phandle of the syscon node for the general register file ++ containing HDMIRX PHY status bits. ++ ++ rockchip,vo1-grf: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: ++ The phandle of the syscon node for the Video Output GRF register ++ to enable EDID transfer through SDAIN and SCLIN. ++ ++required: ++ - compatible ++ - reg ++ - interrupts ++ - interrupt-names ++ - clocks ++ - clock-names ++ - power-domains ++ - resets ++ - pinctrl-0 ++ - hpd-gpios ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ hdmi_receiver: hdmi-receiver@fdee0000 { ++ compatible = "rockchip,rk3588-hdmirx-ctrler", "snps,dw-hdmi-rx"; ++ reg = <0xfdee0000 0x6000>; ++ interrupts = , ++ , ++ ; ++ interrupt-names = "cec", "hdmi", "dma"; ++ clocks = <&cru ACLK_HDMIRX>, ++ <&cru CLK_HDMIRX_AUD>, ++ <&cru CLK_CR_PARA>, ++ <&cru PCLK_HDMIRX>, ++ <&cru CLK_HDMIRX_REF>, ++ <&cru PCLK_S_HDMIRX>, ++ <&cru HCLK_VO1>; ++ clock-names = "aclk", ++ "audio", ++ "cr_para", ++ "pclk", ++ "ref", ++ "hclk_s_hdmirx", ++ "hclk_vo1"; ++ power-domains = <&power RK3588_PD_VO1>; ++ resets = <&cru SRST_A_HDMIRX>, <&cru SRST_P_HDMIRX>, ++ <&cru SRST_HDMIRX_REF>, <&cru SRST_A_HDMIRX_BIU>; ++ reset-names = "axi", "apb", "ref", "biu"; ++ memory-region = <&hdmi_receiver_cma>; ++ pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_5v_detection>; ++ pinctrl-names = "default"; ++ hpd-gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; ++ }; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shreeya Patel +Date: Fri, 19 Jul 2024 18:10:31 +0530 +Subject: arm64: dts: rockchip: Add device tree support for HDMI RX Controller + +Add device tree support for Synopsys DesignWare HDMI RX +Controller. + +Reviewed-by: Dmitry Osipenko +Tested-by: Dmitry Osipenko +Co-developed-by: Dingxian Wen +Signed-off-by: Dingxian Wen +Signed-off-by: Shreeya Patel +Link: https://lore.kernel.org/r/20240719124032.26852-4-shreeya.patel@collabora.com +Signed-off-by: Sebastian Reichel +--- + arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi | 14 +++ + arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi | 56 ++++++++++ + 2 files changed, 70 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +@@ -594,6 +594,20 @@ hdmim0_tx1_hpd: hdmim0-tx1-hpd { + /* hdmim0_tx1_hpd */ + <1 RK_PA6 5 &pcfg_pull_none>; + }; ++ ++ /omit-if-no-ref/ ++ hdmim1_rx: hdmim1-rx { ++ rockchip,pins = ++ /* hdmim1_rx_cec */ ++ <3 RK_PD1 5 &pcfg_pull_none>, ++ /* hdmim1_rx_scl */ ++ <3 RK_PD2 5 &pcfg_pull_none_smt>, ++ /* hdmim1_rx_sda */ ++ <3 RK_PD3 5 &pcfg_pull_none_smt>, ++ /* hdmim1_rx_hpdin */ ++ <3 RK_PD4 5 &pcfg_pull_none>; ++ }; ++ + /omit-if-no-ref/ + hdmim1_rx_cec: hdmim1-rx-cec { + rockchip,pins = +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi +@@ -7,6 +7,29 @@ + #include "rk3588-extra-pinctrl.dtsi" + + / { ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ /* ++ * The 4k HDMI capture controller works only with 32bit ++ * phys addresses and doesn't support IOMMU. HDMI RX CMA ++ * must be reserved below 4GB. ++ * The size of 160MB was determined as follows: ++ * (3840 * 2160 pixels) * (4 bytes/pixel) * (2 frames/buffer) / 10^6 = 66MB ++ * To ensure sufficient support for practical use-cases, ++ * we doubled the 66MB value. ++ */ ++ hdmi_receiver_cma: hdmi-receiver-cma { ++ compatible = "shared-dma-pool"; ++ alloc-ranges = <0x0 0x0 0x0 0xffffffff>; ++ size = <0x0 (160 * 0x100000)>; /* 160MiB */ ++ no-map; ++ status = "disabled"; ++ }; ++ }; ++ + usb_host1_xhci: usb@fc400000 { + compatible = "rockchip,rk3588-dwc3", "snps,dwc3"; + reg = <0x0 0xfc400000 0x0 0x400000>; +@@ -135,6 +158,39 @@ i2s10_8ch: i2s@fde00000 { + status = "disabled"; + }; + ++ hdmi_receiver: hdmi_receiver@fdee0000 { ++ compatible = "rockchip,rk3588-hdmirx-ctrler", "snps,dw-hdmi-rx"; ++ reg = <0x0 0xfdee0000 0x0 0x6000>; ++ power-domains = <&power RK3588_PD_VO1>; ++ rockchip,grf = <&sys_grf>; ++ rockchip,vo1-grf = <&vo1_grf>; ++ interrupts = , ++ , ++ ; ++ interrupt-names = "cec", "hdmi", "dma"; ++ clocks = <&cru ACLK_HDMIRX>, ++ <&cru CLK_HDMIRX_AUD>, ++ <&cru CLK_CR_PARA>, ++ <&cru PCLK_HDMIRX>, ++ <&cru CLK_HDMIRX_REF>, ++ <&cru PCLK_S_HDMIRX>, ++ <&cru HCLK_VO1>; ++ clock-names = "aclk", ++ "audio", ++ "cr_para", ++ "pclk", ++ "ref", ++ "hclk_s_hdmirx", ++ "hclk_vo1"; ++ resets = <&cru SRST_A_HDMIRX>, <&cru SRST_P_HDMIRX>, ++ <&cru SRST_HDMIRX_REF>, <&cru SRST_A_HDMIRX_BIU>; ++ reset-names = "axi", "apb", "ref", "biu"; ++ memory-region = <&hdmi_receiver_cma>; ++ pinctrl-0 = <&hdmim1_rx>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++ }; ++ + pcie3x4: pcie@fe150000 { + compatible = "rockchip,rk3588-pcie", "rockchip,rk3568-pcie"; + #address-cells = <3>; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shreeya Patel +Date: Fri, 19 Jul 2024 18:10:32 +0530 +Subject: media: platform: synopsys: Add support for hdmi input driver + +Add initial support for the Synopsys DesignWare HDMI RX +Controller Driver used by Rockchip RK3588. The driver +supports: + - HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz) + - RGB888, YUV422, YUV444 and YCC420 pixel formats + - CEC + - EDID configuration + +The hardware also has Audio and HDCP capabilities, but these are +not yet supported by the driver. + +Reviewed-by: Dmitry Osipenko +Tested-by: Dmitry Osipenko +Co-developed-by: Dingxian Wen +Signed-off-by: Dingxian Wen +Signed-off-by: Shreeya Patel +Link: https://lore.kernel.org/r/20240719124032.26852-5-shreeya.patel@collabora.com +Signed-off-by: Sebastian Reichel +--- + drivers/media/platform/Kconfig | 1 + + drivers/media/platform/Makefile | 1 + + drivers/media/platform/synopsys/Kconfig | 3 + + drivers/media/platform/synopsys/Makefile | 2 + + drivers/media/platform/synopsys/hdmirx/Kconfig | 27 + + drivers/media/platform/synopsys/hdmirx/Makefile | 4 + + drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2763 ++++++++++ + drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h | 394 ++ + drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c | 285 + + drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h | 44 + + 10 files changed, 3524 insertions(+) + +diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/Kconfig ++++ b/drivers/media/platform/Kconfig +@@ -85,6 +85,7 @@ source "drivers/media/platform/rockchip/Kconfig" + source "drivers/media/platform/samsung/Kconfig" + source "drivers/media/platform/st/Kconfig" + source "drivers/media/platform/sunxi/Kconfig" ++source "drivers/media/platform/synopsys/Kconfig" + source "drivers/media/platform/ti/Kconfig" + source "drivers/media/platform/verisilicon/Kconfig" + source "drivers/media/platform/via/Kconfig" +diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/Makefile ++++ b/drivers/media/platform/Makefile +@@ -28,6 +28,7 @@ obj-y += rockchip/ + obj-y += samsung/ + obj-y += st/ + obj-y += sunxi/ ++obj-y += synopsys/ + obj-y += ti/ + obj-y += verisilicon/ + obj-y += via/ +diff --git a/drivers/media/platform/synopsys/Kconfig b/drivers/media/platform/synopsys/Kconfig +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/Kconfig +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++ ++source "drivers/media/platform/synopsys/hdmirx/Kconfig" +diff --git a/drivers/media/platform/synopsys/Makefile b/drivers/media/platform/synopsys/Makefile +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/Makefile +@@ -0,0 +1,2 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++obj-y += hdmirx/ +diff --git a/drivers/media/platform/synopsys/hdmirx/Kconfig b/drivers/media/platform/synopsys/hdmirx/Kconfig +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/Kconfig +@@ -0,0 +1,27 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++config VIDEO_SYNOPSYS_HDMIRX ++ tristate "Synopsys DesignWare HDMI Receiver driver" ++ depends on VIDEO_DEV ++ depends on ARCH_ROCKCHIP ++ select MEDIA_CONTROLLER ++ select VIDEO_V4L2_SUBDEV_API ++ select VIDEOBUF2_DMA_CONTIG ++ select CEC_CORE ++ select CEC_NOTIFIER ++ select HDMI ++ help ++ Support for Synopsys HDMI HDMI RX Controller. ++ This driver supports HDMI 2.0 version. ++ ++ To compile this driver as a module, choose M here. The module ++ will be called synopsys_hdmirx. ++ ++config HDMIRX_LOAD_DEFAULT_EDID ++ bool "Load default EDID" ++ depends on VIDEO_SYNOPSYS_HDMIRX ++ default "y" ++ help ++ Preload the default EDID (Extended Display Identification Data). ++ EDID contains information about the capabilities of the display, ++ such as supported resolutions, refresh rates, and audio formats. +diff --git a/drivers/media/platform/synopsys/hdmirx/Makefile b/drivers/media/platform/synopsys/hdmirx/Makefile +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/Makefile +@@ -0,0 +1,4 @@ ++# SPDX-License-Identifier: GPL-2.0 ++synopsys-hdmirx-objs := snps_hdmirx.o snps_hdmirx_cec.o ++ ++obj-$(CONFIG_VIDEO_SYNOPSYS_HDMIRX) += synopsys-hdmirx.o +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +@@ -0,0 +1,2763 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2024 Collabora, Ltd. ++ * Author: Shreeya Patel ++ * ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * Author: Dingxian Wen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "snps_hdmirx.h" ++#include "snps_hdmirx_cec.h" ++ ++static int debug; ++module_param(debug, int, 0644); ++MODULE_PARM_DESC(debug, "debug level (0-3)"); ++ ++#define EDID_NUM_BLOCKS_MAX 2 ++#define EDID_BLOCK_SIZE 128 ++#define HDMIRX_STORED_BIT_WIDTH 8 ++#define IREF_CLK_FREQ_HZ 428571429 ++#define MEMORY_ALIGN_ROUND_UP_BYTES 64 ++#define HDMIRX_PLANE_Y 0 ++#define HDMIRX_PLANE_CBCR 1 ++#define RK_IRQ_HDMIRX_HDMI 210 ++#define FILTER_FRAME_CNT 6 ++#define RK_SIP_FIQ_CTRL 0x82000024 ++#define SIP_WDT_CFG 0x82000026 ++#define DETECTION_THRESHOLD 7 ++ ++/* fiq control sub func */ ++enum { ++ RK_SIP_FIQ_CTRL_FIQ_EN = 1, ++ RK_SIP_FIQ_CTRL_FIQ_DIS, ++ RK_SIP_FIQ_CTRL_SET_AFF ++}; ++ ++/* SIP_WDT_CONFIG call types */ ++enum { ++ WDT_START = 0, ++ WDT_STOP = 1, ++ WDT_PING = 2, ++}; ++ ++enum hdmirx_pix_fmt { ++ HDMIRX_RGB888 = 0, ++ HDMIRX_YUV422 = 1, ++ HDMIRX_YUV444 = 2, ++ HDMIRX_YUV420 = 3, ++}; ++ ++enum ddr_store_fmt { ++ STORE_RGB888 = 0, ++ STORE_RGBA_ARGB, ++ STORE_YUV420_8BIT, ++ STORE_YUV420_10BIT, ++ STORE_YUV422_8BIT, ++ STORE_YUV422_10BIT, ++ STORE_YUV444_8BIT, ++ STORE_YUV420_16BIT = 8, ++ STORE_YUV422_16BIT = 9, ++}; ++ ++enum hdmirx_reg_attr { ++ HDMIRX_ATTR_RW = 0, ++ HDMIRX_ATTR_RO = 1, ++ HDMIRX_ATTR_WO = 2, ++ HDMIRX_ATTR_RE = 3, ++}; ++ ++enum { ++ HDMIRX_RST_A, ++ HDMIRX_RST_P, ++ HDMIRX_RST_REF, ++ HDMIRX_RST_BIU, ++ HDMIRX_NUM_RST, ++}; ++ ++static const char * const pix_fmt_str[] = { ++ "RGB888", ++ "YUV422", ++ "YUV444", ++ "YUV420", ++}; ++ ++struct hdmirx_buffer { ++ struct vb2_v4l2_buffer vb; ++ struct list_head queue; ++ u32 buff_addr[VIDEO_MAX_PLANES]; ++}; ++ ++struct hdmirx_stream { ++ struct snps_hdmirx_dev *hdmirx_dev; ++ struct video_device vdev; ++ struct vb2_queue buf_queue; ++ struct list_head buf_head; ++ struct hdmirx_buffer *curr_buf; ++ struct hdmirx_buffer *next_buf; ++ struct v4l2_pix_format_mplane pixm; ++ const struct v4l2_format_info *out_finfo; ++ struct mutex vlock; /* to lock resources associated with video buffer and video device */ ++ spinlock_t vbq_lock; /* to lock video buffer queue */ ++ bool stopping; ++ wait_queue_head_t wq_stopped; ++ u32 frame_idx; ++ u32 line_flag_int_cnt; ++ u32 irq_stat; ++}; ++ ++struct snps_hdmirx_dev { ++ struct device *dev; ++ struct device *codec_dev; ++ struct hdmirx_stream stream; ++ struct v4l2_device v4l2_dev; ++ struct v4l2_ctrl_handler hdl; ++ struct v4l2_ctrl *detect_tx_5v_ctrl; ++ struct v4l2_ctrl *rgb_range; ++ struct v4l2_dv_timings timings; ++ struct gpio_desc *detect_5v_gpio; ++ struct work_struct work_wdt_config; ++ struct delayed_work delayed_work_hotplug; ++ struct delayed_work delayed_work_res_change; ++ struct delayed_work delayed_work_heartbeat; ++ struct cec_notifier *cec_notifier; ++ struct hdmirx_cec *cec; ++ struct mutex stream_lock; /* to lock video stream capture */ ++ struct mutex work_lock; /* to lock the critical section of hotplug event */ ++ struct reset_control_bulk_data resets[HDMIRX_NUM_RST]; ++ struct clk_bulk_data *clks; ++ struct regmap *grf; ++ struct regmap *vo1_grf; ++ struct completion cr_write_done; ++ struct completion timer_base_lock; ++ struct completion avi_pkt_rcv; ++ enum hdmirx_pix_fmt pix_fmt; ++ void __iomem *regs; ++ int hdmi_irq; ++ int dma_irq; ++ int det_irq; ++ bool hpd_trigger_level; ++ bool tmds_clk_ratio; ++ bool is_dvi_mode; ++ bool got_timing; ++ u32 num_clks; ++ u32 edid_blocks_written; ++ u32 cur_vic; ++ u32 cur_fmt_fourcc; ++ u32 color_depth; ++ u8 edid[EDID_BLOCK_SIZE * 2]; ++ hdmi_codec_plugged_cb plugged_cb; ++ spinlock_t rst_lock; /* to lock register access */ ++}; ++ ++static u8 edid_init_data_340M[] = { ++ 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, ++ 0x49, 0x70, 0x88, 0x35, 0x01, 0x00, 0x00, 0x00, ++ 0x2D, 0x1F, 0x01, 0x03, 0x80, 0x78, 0x44, 0x78, ++ 0x0A, 0xCF, 0x74, 0xA3, 0x57, 0x4C, 0xB0, 0x23, ++ 0x09, 0x48, 0x4C, 0x21, 0x08, 0x00, 0x61, 0x40, ++ 0x01, 0x01, 0x81, 0x00, 0x95, 0x00, 0xA9, 0xC0, ++ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, ++ 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, ++ 0x45, 0x00, 0x20, 0xC2, 0x31, 0x00, 0x00, 0x1E, ++ 0x01, 0x1D, 0x00, 0x72, 0x51, 0xD0, 0x1E, 0x20, ++ 0x6E, 0x28, 0x55, 0x00, 0x20, 0xC2, 0x31, 0x00, ++ 0x00, 0x1E, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x52, ++ 0x4B, 0x2D, 0x55, 0x48, 0x44, 0x0A, 0x20, 0x20, ++ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xFD, ++ 0x00, 0x3B, 0x46, 0x1F, 0x8C, 0x3C, 0x00, 0x0A, ++ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0xA7, ++ ++ 0x02, 0x03, 0x2F, 0xD1, 0x51, 0x07, 0x16, 0x14, ++ 0x05, 0x01, 0x03, 0x12, 0x13, 0x84, 0x22, 0x1F, ++ 0x90, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x23, 0x09, ++ 0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x67, 0x03, ++ 0x0C, 0x00, 0x30, 0x00, 0x10, 0x44, 0xE3, 0x05, ++ 0x03, 0x01, 0xE4, 0x0F, 0x00, 0x80, 0x01, 0x02, ++ 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, ++ 0x2C, 0x45, 0x00, 0x20, 0xC2, 0x31, 0x00, 0x00, ++ 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, ++}; ++ ++static const struct v4l2_dv_timings cea640x480 = V4L2_DV_BT_CEA_640X480P59_94; ++ ++static const struct v4l2_dv_timings_cap hdmirx_timings_cap = { ++ .type = V4L2_DV_BT_656_1120, ++ .reserved = { 0 }, ++ V4L2_INIT_BT_TIMINGS(640, 4096, /* min/max width */ ++ 480, 2160, /* min/max height */ ++ 20000000, 600000000, /* min/max pixelclock */ ++ /* standards */ ++ V4L2_DV_BT_STD_CEA861, ++ /* capabilities */ ++ V4L2_DV_BT_CAP_PROGRESSIVE | ++ V4L2_DV_BT_CAP_INTERLACED) ++}; ++ ++static void hdmirx_writel(struct snps_hdmirx_dev *hdmirx_dev, int reg, u32 val) ++{ ++ unsigned long lock_flags = 0; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ writel(val, hdmirx_dev->regs + reg); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++} ++ ++static u32 hdmirx_readl(struct snps_hdmirx_dev *hdmirx_dev, int reg) ++{ ++ unsigned long lock_flags = 0; ++ u32 val; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ val = readl(hdmirx_dev->regs + reg); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++ return val; ++} ++ ++static void hdmirx_reset_dma(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ unsigned long lock_flags = 0; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ reset_control_reset(hdmirx_dev->resets[0].rstc); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++} ++ ++static void hdmirx_update_bits(struct snps_hdmirx_dev *hdmirx_dev, int reg, ++ u32 mask, u32 data) ++{ ++ unsigned long lock_flags = 0; ++ u32 val; ++ ++ spin_lock_irqsave(&hdmirx_dev->rst_lock, lock_flags); ++ val = readl(hdmirx_dev->regs + reg) & ~mask; ++ val |= (data & mask); ++ writel(val, hdmirx_dev->regs + reg); ++ spin_unlock_irqrestore(&hdmirx_dev->rst_lock, lock_flags); ++} ++ ++static int hdmirx_subscribe_event(struct v4l2_fh *fh, ++ const struct v4l2_event_subscription *sub) ++{ ++ switch (sub->type) { ++ case V4L2_EVENT_SOURCE_CHANGE: ++ if (fh->vdev->vfl_dir == VFL_DIR_RX) ++ return v4l2_src_change_event_subscribe(fh, sub); ++ break; ++ case V4L2_EVENT_CTRL: ++ return v4l2_ctrl_subscribe_event(fh, sub); ++ default: ++ break; ++ } ++ ++ return -EINVAL; ++} ++ ++static bool tx_5v_power_present(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ bool ret; ++ int val, i, cnt; ++ ++ cnt = 0; ++ for (i = 0; i < 10; i++) { ++ usleep_range(1000, 1100); ++ val = gpiod_get_value(hdmirx_dev->detect_5v_gpio); ++ if (val > 0) ++ cnt++; ++ if (cnt >= DETECTION_THRESHOLD) ++ break; ++ } ++ ++ ret = (cnt >= DETECTION_THRESHOLD) ? true : false; ++ v4l2_dbg(3, debug, &hdmirx_dev->v4l2_dev, "%s: %d\n", __func__, ret); ++ ++ return ret; ++} ++ ++static bool signal_not_lock(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ u32 mu_status, dma_st10, cmu_st; ++ ++ mu_status = hdmirx_readl(hdmirx_dev, MAINUNIT_STATUS); ++ dma_st10 = hdmirx_readl(hdmirx_dev, DMA_STATUS10); ++ cmu_st = hdmirx_readl(hdmirx_dev, CMU_STATUS); ++ ++ if ((mu_status & TMDSVALID_STABLE_ST) && ++ (dma_st10 & HDMIRX_LOCK) && ++ (cmu_st & TMDSQPCLK_LOCKED_ST)) ++ return false; ++ ++ return true; ++} ++ ++static void hdmirx_get_colordepth(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 val, color_depth_reg; ++ ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS11); ++ color_depth_reg = (val & HDMIRX_COLOR_DEPTH_MASK) >> 3; ++ ++ switch (color_depth_reg) { ++ case 0x4: ++ hdmirx_dev->color_depth = 24; ++ break; ++ case 0x5: ++ hdmirx_dev->color_depth = 30; ++ break; ++ case 0x6: ++ hdmirx_dev->color_depth = 36; ++ break; ++ case 0x7: ++ hdmirx_dev->color_depth = 48; ++ break; ++ default: ++ hdmirx_dev->color_depth = 24; ++ break; ++ } ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: color_depth: %d, reg_val:%d\n", ++ __func__, hdmirx_dev->color_depth, color_depth_reg); ++} ++ ++static void hdmirx_get_pix_fmt(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 val; ++ ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS11); ++ hdmirx_dev->pix_fmt = val & HDMIRX_FORMAT_MASK; ++ ++ switch (hdmirx_dev->pix_fmt) { ++ case HDMIRX_RGB888: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_BGR24; ++ break; ++ case HDMIRX_YUV422: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_NV16; ++ break; ++ case HDMIRX_YUV444: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_NV24; ++ break; ++ case HDMIRX_YUV420: ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_NV12; ++ break; ++ default: ++ v4l2_err(v4l2_dev, ++ "%s: err pix_fmt: %d, set RGB888 as default\n", ++ __func__, hdmirx_dev->pix_fmt); ++ hdmirx_dev->pix_fmt = HDMIRX_RGB888; ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_BGR24; ++ break; ++ } ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: pix_fmt: %s\n", __func__, ++ pix_fmt_str[hdmirx_dev->pix_fmt]); ++} ++ ++static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_bt_timings *bt, bool from_dma) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 hact, vact, htotal, vtotal, fps; ++ u32 hfp, hs, hbp, vfp, vs, vbp; ++ u32 val; ++ ++ if (from_dma) { ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS2); ++ hact = (val >> 16) & 0xffff; ++ vact = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS3); ++ htotal = (val >> 16) & 0xffff; ++ vtotal = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS4); ++ hs = (val >> 16) & 0xffff; ++ vs = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS5); ++ hbp = (val >> 16) & 0xffff; ++ vbp = val & 0xffff; ++ hfp = htotal - hact - hs - hbp; ++ vfp = vtotal - vact - vs - vbp; ++ } else { ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS1); ++ hs = (val >> 16) & 0xffff; ++ hfp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS2); ++ hbp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS3); ++ htotal = (val >> 16) & 0xffff; ++ hact = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS4); ++ vs = (val >> 16) & 0xffff; ++ vfp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS5); ++ vbp = val & 0xffff; ++ val = hdmirx_readl(hdmirx_dev, VMON_STATUS6); ++ vtotal = (val >> 16) & 0xffff; ++ vact = val & 0xffff; ++ if (hdmirx_dev->pix_fmt == HDMIRX_YUV420) ++ hact *= 2; ++ } ++ if (hdmirx_dev->pix_fmt == HDMIRX_YUV420) ++ htotal *= 2; ++ fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal); ++ if (hdmirx_dev->pix_fmt == HDMIRX_YUV420) ++ fps *= 2; ++ bt->width = hact; ++ bt->height = vact; ++ bt->hfrontporch = hfp; ++ bt->hsync = hs; ++ bt->hbackporch = hbp; ++ bt->vfrontporch = vfp; ++ bt->vsync = vs; ++ bt->vbackporch = vbp; ++ ++ v4l2_dbg(1, debug, v4l2_dev, "get timings from %s\n", from_dma ? "dma" : "ctrl"); ++ v4l2_dbg(1, debug, v4l2_dev, "act:%ux%u, total:%ux%u, fps:%u, pixclk:%llu\n", ++ bt->width, bt->height, htotal, vtotal, fps, bt->pixelclock); ++ ++ v4l2_dbg(2, debug, v4l2_dev, "hfp:%u, hs:%u, hbp:%u, vfp:%u, vs:%u, vbp:%u\n", ++ bt->hfrontporch, bt->hsync, bt->hbackporch, ++ bt->vfrontporch, bt->vsync, bt->vbackporch); ++} ++ ++static bool hdmirx_check_timing_valid(struct v4l2_bt_timings *bt) ++{ ++ if (bt->width < 100 || bt->width > 5000 || ++ bt->height < 100 || bt->height > 5000) ++ return false; ++ ++ if (!bt->hsync || bt->hsync > 200 || ++ !bt->vsync || bt->vsync > 100) ++ return false; ++ ++ if (!bt->hbackporch || bt->hbackporch > 2000 || ++ !bt->vbackporch || bt->vbackporch > 2000) ++ return false; ++ ++ if (!bt->hfrontporch || bt->hfrontporch > 2000 || ++ !bt->vfrontporch || bt->vfrontporch > 2000) ++ return false; ++ ++ return true; ++} ++ ++static void hdmirx_get_avi_infoframe(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ union hdmi_infoframe frame = {}; ++ int err, i, b, itr = 0; ++ u8 aviif[3 + 7 * 4]; ++ u32 val; ++ ++ aviif[itr++] = HDMI_INFOFRAME_TYPE_AVI; ++ val = hdmirx_readl(hdmirx_dev, PKTDEC_AVIIF_PH2_1); ++ aviif[itr++] = val & 0xff; ++ aviif[itr++] = (val >> 8) & 0xff; ++ ++ for (i = 0; i < 7; i++) { ++ val = hdmirx_readl(hdmirx_dev, PKTDEC_AVIIF_PB3_0 + 4 * i); ++ ++ for (b = 0; b < 4; b++) ++ aviif[itr++] = (val >> (8 * b)) & 0xff; ++ } ++ ++ err = hdmi_infoframe_unpack(&frame, aviif, sizeof(aviif)); ++ if (err) { ++ v4l2_err(v4l2_dev, "failed to unpack AVI infoframe\n"); ++ return; ++ } ++ ++ v4l2_ctrl_s_ctrl(hdmirx_dev->rgb_range, frame.avi.quantization_range); ++} ++ ++/* ++ * When querying DV timings during preview, if the DMA's timing is stable, ++ * we retrieve the timings directly from the DMA. However, if the current ++ * resolution is negative, obtaining the timing from CTRL may require a ++ * change in the sync polarity, potentially leading to DMA errors. ++ */ ++static int hdmirx_get_detected_timings(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_dv_timings *timings, ++ bool from_dma) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_bt_timings *bt = &timings->bt; ++ u32 field_type, color_depth, deframer_st; ++ u32 val, tmdsqpclk_freq, pix_clk; ++ u64 tmp_data, tmds_clk; ++ ++ memset(timings, 0, sizeof(struct v4l2_dv_timings)); ++ timings->type = V4L2_DV_BT_656_1120; ++ ++ val = hdmirx_readl(hdmirx_dev, DMA_STATUS11); ++ field_type = (val & HDMIRX_TYPE_MASK) >> 7; ++ hdmirx_get_pix_fmt(hdmirx_dev); ++ bt->interlaced = field_type & BIT(0) ? V4L2_DV_INTERLACED : V4L2_DV_PROGRESSIVE; ++ val = hdmirx_readl(hdmirx_dev, PKTDEC_AVIIF_PB7_4); ++ hdmirx_dev->cur_vic = val | VIC_VAL_MASK; ++ hdmirx_get_colordepth(hdmirx_dev); ++ color_depth = hdmirx_dev->color_depth; ++ deframer_st = hdmirx_readl(hdmirx_dev, DEFRAMER_STATUS); ++ hdmirx_dev->is_dvi_mode = deframer_st & OPMODE_STS_MASK ? false : true; ++ tmdsqpclk_freq = hdmirx_readl(hdmirx_dev, CMU_TMDSQPCLK_FREQ); ++ tmds_clk = tmdsqpclk_freq * 4 * 1000; ++ tmp_data = tmds_clk * 24; ++ do_div(tmp_data, color_depth); ++ pix_clk = tmp_data; ++ bt->pixelclock = pix_clk; ++ ++ hdmirx_get_avi_infoframe(hdmirx_dev); ++ ++ hdmirx_get_timings(hdmirx_dev, bt, from_dma); ++ if (bt->interlaced == V4L2_DV_INTERLACED) { ++ bt->height *= 2; ++ bt->il_vsync = bt->vsync + 1; ++ } ++ ++ v4l2_dbg(2, debug, v4l2_dev, "tmds_clk:%llu\n", tmds_clk); ++ v4l2_dbg(1, debug, v4l2_dev, "interlace:%d, fmt:%d, vic:%d, color:%d, mode:%s\n", ++ bt->interlaced, hdmirx_dev->pix_fmt, ++ hdmirx_dev->cur_vic, hdmirx_dev->color_depth, ++ hdmirx_dev->is_dvi_mode ? "dvi" : "hdmi"); ++ v4l2_dbg(2, debug, v4l2_dev, "deframer_st:%#x\n", deframer_st); ++ ++ if (!hdmirx_check_timing_valid(bt)) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static bool port_no_link(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ return !tx_5v_power_present(hdmirx_dev); ++} ++ ++static int hdmirx_query_dv_timings(struct file *file, void *_fh, ++ struct v4l2_dv_timings *timings) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int ret; ++ ++ if (port_no_link(hdmirx_dev)) { ++ v4l2_err(v4l2_dev, "%s: port has no link\n", __func__); ++ return -ENOLINK; ++ } ++ ++ if (signal_not_lock(hdmirx_dev)) { ++ v4l2_err(v4l2_dev, "%s: signal is not locked\n", __func__); ++ return -ENOLCK; ++ } ++ ++ ret = hdmirx_get_detected_timings(hdmirx_dev, timings, true); ++ if (ret) ++ return ret; ++ ++ if (debug) ++ v4l2_print_dv_timings(hdmirx_dev->v4l2_dev.name, ++ "query_dv_timings: ", timings, false); ++ ++ if (!v4l2_valid_dv_timings(timings, &hdmirx_timings_cap, NULL, NULL)) { ++ v4l2_dbg(1, debug, v4l2_dev, "%s: timings out of range\n", __func__); ++ return -ERANGE; ++ } ++ ++ return 0; ++} ++ ++static void hdmirx_hpd_ctrl(struct snps_hdmirx_dev *hdmirx_dev, bool en) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: %sable, hpd_trigger_level:%d\n", ++ __func__, en ? "en" : "dis", ++ hdmirx_dev->hpd_trigger_level); ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, HPDLOW, en ? 0 : HPDLOW); ++ en = hdmirx_dev->hpd_trigger_level ? en : !en; ++ hdmirx_writel(hdmirx_dev, CORE_CONFIG, en); ++} ++ ++static int hdmirx_write_edid(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_edid *edid, bool hpd_up) ++{ ++ u32 edid_len = edid->blocks * EDID_BLOCK_SIZE; ++ char data[300]; ++ u32 i; ++ ++ memset(edid->reserved, 0, sizeof(edid->reserved)); ++ if (edid->pad) ++ return -EINVAL; ++ ++ if (edid->start_block) ++ return -EINVAL; ++ ++ if (edid->blocks > EDID_NUM_BLOCKS_MAX) { ++ edid->blocks = EDID_NUM_BLOCKS_MAX; ++ return -E2BIG; ++ } ++ ++ if (!edid->blocks) { ++ hdmirx_dev->edid_blocks_written = 0; ++ return 0; ++ } ++ ++ cec_s_phys_addr_from_edid(hdmirx_dev->cec->adap, ++ (const struct edid *)edid->edid); ++ ++ memset(&hdmirx_dev->edid, 0, sizeof(hdmirx_dev->edid)); ++ hdmirx_hpd_ctrl(hdmirx_dev, false); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG11, ++ EDID_READ_EN_MASK | ++ EDID_WRITE_EN_MASK | ++ EDID_SLAVE_ADDR_MASK, ++ EDID_READ_EN(0) | ++ EDID_WRITE_EN(1) | ++ EDID_SLAVE_ADDR(0x50)); ++ for (i = 0; i < edid_len; i++) ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG10, edid->edid[i]); ++ ++ /* read out for debug */ ++ if (debug >= 2) { ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG11, ++ EDID_READ_EN_MASK | ++ EDID_WRITE_EN_MASK, ++ EDID_READ_EN(1) | ++ EDID_WRITE_EN(0)); ++ edid_len = edid_len > sizeof(data) ? sizeof(data) : edid_len; ++ memset(data, 0, sizeof(data)); ++ for (i = 0; i < edid_len; i++) ++ data[i] = hdmirx_readl(hdmirx_dev, DMA_STATUS14); ++ ++ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, data, ++ edid_len, false); ++ } ++ ++ /* ++ * You must set EDID_READ_EN & EDID_WRITE_EN bit to 0, ++ * when the read/write edid operation is completed.Otherwise, it ++ * will affect the reading and writing of other registers ++ */ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG11, ++ EDID_READ_EN_MASK | EDID_WRITE_EN_MASK, ++ EDID_READ_EN(0) | EDID_WRITE_EN(0)); ++ ++ hdmirx_dev->edid_blocks_written = edid->blocks; ++ memcpy(&hdmirx_dev->edid, edid->edid, edid->blocks * EDID_BLOCK_SIZE); ++ if (hpd_up) { ++ if (tx_5v_power_present(hdmirx_dev)) { ++ /* Add 100ms delay after updating the EDID as per HDMI specs */ ++ msleep(100); ++ hdmirx_hpd_ctrl(hdmirx_dev, true); ++ } ++ } ++ ++ return 0; ++} ++ ++/* ++ * Before clearing interrupt, we need to read the interrupt status. ++ */ ++static inline void hdmirx_clear_interrupt(struct snps_hdmirx_dev *hdmirx_dev, ++ u32 reg, u32 val) ++{ ++ /* (interrupt status register) = (interrupt clear register) - 0x8 */ ++ hdmirx_readl(hdmirx_dev, reg - 0x8); ++ hdmirx_writel(hdmirx_dev, reg, val); ++} ++ ++static void hdmirx_interrupts_setup(struct snps_hdmirx_dev *hdmirx_dev, bool en) ++{ ++ v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: %sable\n", ++ __func__, en ? "en" : "dis"); ++ ++ /* Note: In DVI mode, it needs to be written twice to take effect. */ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_0_INT_CLEAR, 0xffffffff); ++ ++ if (en) { ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_0_INT_MASK_N, ++ TMDSQPCLK_OFF_CHG | TMDSQPCLK_LOCKED_CHG, ++ TMDSQPCLK_OFF_CHG | TMDSQPCLK_LOCKED_CHG); ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_2_INT_MASK_N, ++ TMDSVALID_STABLE_CHG, TMDSVALID_STABLE_CHG); ++ hdmirx_update_bits(hdmirx_dev, AVPUNIT_0_INT_MASK_N, ++ CED_DYN_CNT_CH2_IRQ | ++ CED_DYN_CNT_CH1_IRQ | ++ CED_DYN_CNT_CH0_IRQ, ++ CED_DYN_CNT_CH2_IRQ | ++ CED_DYN_CNT_CH1_IRQ | ++ CED_DYN_CNT_CH0_IRQ); ++ } else { ++ hdmirx_writel(hdmirx_dev, MAINUNIT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_2_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_0_INT_MASK_N, 0); ++ } ++} ++ ++static void hdmirx_plugout(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct arm_smccc_res res; ++ ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, 0); ++ hdmirx_interrupts_setup(hdmirx_dev, false); ++ hdmirx_hpd_ctrl(hdmirx_dev, false); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, 0); ++ hdmirx_reset_dma(hdmirx_dev); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, HDMI_DISABLE | PHY_RESET | ++ PHY_PDDQ, HDMI_DISABLE); ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG0, 0x0); ++ cancel_delayed_work(&hdmirx_dev->delayed_work_res_change); ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_heartbeat); ++ flush_work(&hdmirx_dev->work_wdt_config); ++ arm_smccc_smc(SIP_WDT_CFG, WDT_STOP, 0, 0, 0, 0, 0, 0, &res); ++} ++ ++static int hdmirx_set_edid(struct file *file, void *fh, struct v4l2_edid *edid) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct arm_smccc_res res; ++ int ret; ++ ++ disable_irq(hdmirx_dev->hdmi_irq); ++ disable_irq(hdmirx_dev->dma_irq); ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_DIS, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ if (tx_5v_power_present(hdmirx_dev)) ++ hdmirx_plugout(hdmirx_dev); ++ ret = hdmirx_write_edid(hdmirx_dev, edid, false); ++ if (ret) ++ return ret; ++ ++ enable_irq(hdmirx_dev->hdmi_irq); ++ enable_irq(hdmirx_dev->dma_irq); ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_EN, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(500)); ++ return 0; ++} ++ ++static int hdmirx_get_edid(struct file *file, void *fh, struct v4l2_edid *edid) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ memset(edid->reserved, 0, sizeof(edid->reserved)); ++ ++ if (edid->pad) ++ return -EINVAL; ++ ++ if (!edid->start_block && !edid->blocks) { ++ edid->blocks = hdmirx_dev->edid_blocks_written; ++ return 0; ++ } ++ ++ if (!hdmirx_dev->edid_blocks_written) ++ return -ENODATA; ++ ++ if (edid->start_block >= hdmirx_dev->edid_blocks_written || !edid->blocks) ++ return -EINVAL; ++ ++ if (edid->start_block + edid->blocks > hdmirx_dev->edid_blocks_written) ++ edid->blocks = hdmirx_dev->edid_blocks_written - edid->start_block; ++ ++ memcpy(edid->edid, &hdmirx_dev->edid, edid->blocks * EDID_BLOCK_SIZE); ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: read EDID:\n", __func__); ++ if (debug > 0) ++ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, ++ edid->edid, edid->blocks * EDID_BLOCK_SIZE, false); ++ ++ return 0; ++} ++ ++static int hdmirx_g_parm(struct file *file, void *priv, ++ struct v4l2_streamparm *parm) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_fract fps; ++ ++ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) ++ return -EINVAL; ++ ++ fps = v4l2_calc_timeperframe(&hdmirx_dev->timings); ++ parm->parm.capture.timeperframe.numerator = fps.numerator; ++ parm->parm.capture.timeperframe.denominator = fps.denominator; ++ ++ return 0; ++} ++ ++static int hdmirx_dv_timings_cap(struct file *file, void *fh, ++ struct v4l2_dv_timings_cap *cap) ++{ ++ *cap = hdmirx_timings_cap; ++ return 0; ++} ++ ++static int hdmirx_enum_dv_timings(struct file *file, void *_fh, ++ struct v4l2_enum_dv_timings *timings) ++{ ++ return v4l2_enum_dv_timings_cap(timings, &hdmirx_timings_cap, NULL, NULL); ++} ++ ++static void hdmirx_scdc_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_update_bits(hdmirx_dev, I2C_SLAVE_CONFIG1, ++ I2C_SDA_OUT_HOLD_VALUE_QST_MASK | ++ I2C_SDA_IN_HOLD_VALUE_QST_MASK, ++ I2C_SDA_OUT_HOLD_VALUE_QST(0x80) | ++ I2C_SDA_IN_HOLD_VALUE_QST(0x15)); ++ hdmirx_update_bits(hdmirx_dev, SCDC_REGBANK_CONFIG0, ++ SCDC_SINKVERSION_QST_MASK, ++ SCDC_SINKVERSION_QST(1)); ++} ++ ++static int wait_reg_bit_status(struct snps_hdmirx_dev *hdmirx_dev, u32 reg, ++ u32 bit_mask, u32 expect_val, bool is_grf, ++ u32 ms) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 i, val; ++ ++ for (i = 0; i < ms; i++) { ++ if (is_grf) ++ regmap_read(hdmirx_dev->grf, reg, &val); ++ else ++ val = hdmirx_readl(hdmirx_dev, reg); ++ ++ if ((val & bit_mask) == expect_val) { ++ v4l2_dbg(2, debug, v4l2_dev, ++ "%s: i:%d, time: %dms\n", __func__, i, ms); ++ break; ++ } ++ usleep_range(1000, 1010); ++ } ++ ++ if (i == ms) ++ return -1; ++ ++ return 0; ++} ++ ++static int hdmirx_phy_register_write(struct snps_hdmirx_dev *hdmirx_dev, ++ u32 phy_reg, u32 val) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ ++ reinit_completion(&hdmirx_dev->cr_write_done); ++ /* clear irq status */ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ /* en irq */ ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_2_INT_MASK_N, ++ PHYCREG_CR_WRITE_DONE, PHYCREG_CR_WRITE_DONE); ++ /* write phy reg addr */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG1, phy_reg); ++ /* write phy reg val */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG2, val); ++ /* config write enable */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONTROL, PHYCREG_CR_PARA_WRITE_P); ++ ++ if (!wait_for_completion_timeout(&hdmirx_dev->cr_write_done, ++ msecs_to_jiffies(20))) { ++ dev_err(dev, "%s wait cr write done failed\n", __func__); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++static void hdmirx_tmds_clk_ratio_config(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 val; ++ ++ val = hdmirx_readl(hdmirx_dev, SCDC_REGBANK_STATUS1); ++ v4l2_dbg(3, debug, v4l2_dev, "%s: scdc_regbank_st:%#x\n", __func__, val); ++ hdmirx_dev->tmds_clk_ratio = (val & SCDC_TMDSBITCLKRATIO) > 0; ++ ++ if (hdmirx_dev->tmds_clk_ratio) { ++ v4l2_dbg(3, debug, v4l2_dev, "%s: HDMITX greater than 3.4Gbps\n", __func__); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, ++ TMDS_CLOCK_RATIO, TMDS_CLOCK_RATIO); ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, "%s: HDMITX less than 3.4Gbps\n", __func__); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, ++ TMDS_CLOCK_RATIO, 0); ++ } ++} ++ ++static void hdmirx_phy_config(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ ++ hdmirx_clear_interrupt(hdmirx_dev, SCDC_INT_CLEAR, 0xffffffff); ++ hdmirx_update_bits(hdmirx_dev, SCDC_INT_MASK_N, SCDCTMDSCCFG_CHG, ++ SCDCTMDSCCFG_CHG); ++ /* cr_para_clk 24M */ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, REFFREQ_SEL_MASK, REFFREQ_SEL(0)); ++ /* rx data width 40bit valid */ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, RXDATA_WIDTH, RXDATA_WIDTH); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_RESET, PHY_RESET); ++ usleep_range(100, 110); ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_RESET, 0); ++ usleep_range(100, 110); ++ /* select cr para interface */ ++ hdmirx_writel(hdmirx_dev, PHYCREG_CONFIG0, 0x3); ++ ++ if (wait_reg_bit_status(hdmirx_dev, SYS_GRF_SOC_STATUS1, ++ HDMIRXPHY_SRAM_INIT_DONE, ++ HDMIRXPHY_SRAM_INIT_DONE, true, 10)) ++ dev_err(dev, "%s: phy SRAM init failed\n", __func__); ++ ++ regmap_write(hdmirx_dev->grf, SYS_GRF_SOC_CON1, ++ (HDMIRXPHY_SRAM_EXT_LD_DONE << 16) | ++ HDMIRXPHY_SRAM_EXT_LD_DONE); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 3); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 3); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 2); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 0); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 1); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 0); ++ hdmirx_phy_register_write(hdmirx_dev, SUP_DIG_ANA_CREGS_SUP_ANA_NC, 0); ++ ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_3_REG, ++ CDR_SETTING_BOUNDARY_3_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_4_REG, ++ CDR_SETTING_BOUNDARY_4_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_5_REG, ++ CDR_SETTING_BOUNDARY_5_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_6_REG, ++ CDR_SETTING_BOUNDARY_6_DEFAULT); ++ hdmirx_phy_register_write(hdmirx_dev, ++ HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_7_REG, ++ CDR_SETTING_BOUNDARY_7_DEFAULT); ++ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_PDDQ, 0); ++ if (wait_reg_bit_status(hdmirx_dev, PHY_STATUS, PDDQ_ACK, 0, false, 10)) ++ dev_err(dev, "%s: wait pddq ack failed\n", __func__); ++ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, HDMI_DISABLE, 0); ++ if (wait_reg_bit_status(hdmirx_dev, PHY_STATUS, HDMI_DISABLE_ACK, 0, ++ false, 50)) ++ dev_err(dev, "%s: wait hdmi disable ack failed\n", __func__); ++ ++ hdmirx_tmds_clk_ratio_config(hdmirx_dev); ++} ++ ++static void hdmirx_controller_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ ++ reinit_completion(&hdmirx_dev->timer_base_lock); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ /* en irq */ ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_0_INT_MASK_N, ++ TIMER_BASE_LOCKED_IRQ, TIMER_BASE_LOCKED_IRQ); ++ /* write irefclk freq */ ++ hdmirx_writel(hdmirx_dev, GLOBAL_TIMER_REF_BASE, IREF_CLK_FREQ_HZ); ++ ++ if (!wait_for_completion_timeout(&hdmirx_dev->timer_base_lock, ++ msecs_to_jiffies(20))) ++ dev_err(dev, "%s wait timer base lock failed\n", __func__); ++ ++ hdmirx_update_bits(hdmirx_dev, CMU_CONFIG0, ++ TMDSQPCLK_STABLE_FREQ_MARGIN_MASK | ++ AUDCLK_STABLE_FREQ_MARGIN_MASK, ++ TMDSQPCLK_STABLE_FREQ_MARGIN(2) | ++ AUDCLK_STABLE_FREQ_MARGIN(1)); ++ hdmirx_update_bits(hdmirx_dev, DESCRAND_EN_CONTROL, ++ SCRAMB_EN_SEL_QST_MASK, SCRAMB_EN_SEL_QST(1)); ++ hdmirx_update_bits(hdmirx_dev, CED_CONFIG, ++ CED_VIDDATACHECKEN_QST | ++ CED_DATAISCHECKEN_QST | ++ CED_GBCHECKEN_QST | ++ CED_CTRLCHECKEN_QST | ++ CED_CHLOCKMAXER_QST_MASK, ++ CED_VIDDATACHECKEN_QST | ++ CED_GBCHECKEN_QST | ++ CED_CTRLCHECKEN_QST | ++ CED_CHLOCKMAXER_QST(0x10)); ++ hdmirx_update_bits(hdmirx_dev, DEFRAMER_CONFIG0, ++ VS_REMAPFILTER_EN_QST | VS_FILTER_ORDER_QST_MASK, ++ VS_REMAPFILTER_EN_QST | VS_FILTER_ORDER_QST(0x3)); ++} ++ ++static void hdmirx_set_negative_pol(struct snps_hdmirx_dev *hdmirx_dev, bool en) ++{ ++ if (en) { ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, ++ VSYNC_TOGGLE_EN | HSYNC_TOGGLE_EN, ++ VSYNC_TOGGLE_EN | HSYNC_TOGGLE_EN); ++ hdmirx_update_bits(hdmirx_dev, VIDEO_CONFIG2, ++ VPROC_VSYNC_POL_OVR_VALUE | ++ VPROC_VSYNC_POL_OVR_EN | ++ VPROC_HSYNC_POL_OVR_VALUE | ++ VPROC_HSYNC_POL_OVR_EN, ++ VPROC_VSYNC_POL_OVR_EN | ++ VPROC_HSYNC_POL_OVR_EN); ++ return; ++ } ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, ++ VSYNC_TOGGLE_EN | HSYNC_TOGGLE_EN, 0); ++ ++ hdmirx_update_bits(hdmirx_dev, VIDEO_CONFIG2, ++ VPROC_VSYNC_POL_OVR_VALUE | ++ VPROC_VSYNC_POL_OVR_EN | ++ VPROC_HSYNC_POL_OVR_VALUE | ++ VPROC_HSYNC_POL_OVR_EN, 0); ++} ++ ++static int hdmirx_try_to_get_timings(struct snps_hdmirx_dev *hdmirx_dev, ++ struct v4l2_dv_timings *timings, ++ int try_cnt) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int i, cnt = 0, fail_cnt = 0, ret = 0; ++ bool from_dma = false; ++ ++ hdmirx_set_negative_pol(hdmirx_dev, false); ++ for (i = 0; i < try_cnt; i++) { ++ ret = hdmirx_get_detected_timings(hdmirx_dev, timings, from_dma); ++ if (ret) { ++ cnt = 0; ++ fail_cnt++; ++ if (fail_cnt > 3) { ++ hdmirx_set_negative_pol(hdmirx_dev, true); ++ from_dma = true; ++ } ++ } else { ++ cnt++; ++ } ++ if (cnt >= 5) ++ break; ++ ++ usleep_range(10 * 1000, 10 * 1100); ++ } ++ ++ if (try_cnt > 8 && cnt < 5) ++ v4l2_dbg(1, debug, v4l2_dev, "%s: res not stable\n", __func__); ++ ++ return ret; ++} ++ ++static void hdmirx_format_change(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_dv_timings timings; ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ const struct v4l2_event ev_src_chg = { ++ .type = V4L2_EVENT_SOURCE_CHANGE, ++ .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, ++ }; ++ ++ if (hdmirx_try_to_get_timings(hdmirx_dev, &timings, 20)) { ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(20)); ++ return; ++ } ++ ++ hdmirx_dev->got_timing = true; ++ v4l2_dbg(1, debug, v4l2_dev, "%s: queue res_chg_event\n", __func__); ++ v4l2_event_queue(&stream->vdev, &ev_src_chg); ++} ++ ++static void hdmirx_set_ddr_store_fmt(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ enum ddr_store_fmt store_fmt; ++ u32 dma_cfg1; ++ ++ switch (hdmirx_dev->pix_fmt) { ++ case HDMIRX_RGB888: ++ store_fmt = STORE_RGB888; ++ break; ++ case HDMIRX_YUV444: ++ store_fmt = STORE_YUV444_8BIT; ++ break; ++ case HDMIRX_YUV422: ++ store_fmt = STORE_YUV422_8BIT; ++ break; ++ case HDMIRX_YUV420: ++ store_fmt = STORE_YUV420_8BIT; ++ break; ++ default: ++ store_fmt = STORE_RGB888; ++ break; ++ } ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG1, ++ DDR_STORE_FORMAT_MASK, DDR_STORE_FORMAT(store_fmt)); ++ dma_cfg1 = hdmirx_readl(hdmirx_dev, DMA_CONFIG1); ++ v4l2_dbg(1, debug, v4l2_dev, "%s: pix_fmt: %s, DMA_CONFIG1:%#x\n", ++ __func__, pix_fmt_str[hdmirx_dev->pix_fmt], dma_cfg1); ++} ++ ++static int hdmirx_wait_lock_and_get_timing(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 mu_status, scdc_status, dma_st10, cmu_st; ++ u32 i; ++ ++ for (i = 0; i < 300; i++) { ++ mu_status = hdmirx_readl(hdmirx_dev, MAINUNIT_STATUS); ++ scdc_status = hdmirx_readl(hdmirx_dev, SCDC_REGBANK_STATUS3); ++ dma_st10 = hdmirx_readl(hdmirx_dev, DMA_STATUS10); ++ cmu_st = hdmirx_readl(hdmirx_dev, CMU_STATUS); ++ ++ if ((mu_status & TMDSVALID_STABLE_ST) && ++ (dma_st10 & HDMIRX_LOCK) && ++ (cmu_st & TMDSQPCLK_LOCKED_ST)) ++ break; ++ ++ if (!tx_5v_power_present(hdmirx_dev)) { ++ v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__); ++ return -1; ++ } ++ ++ hdmirx_tmds_clk_ratio_config(hdmirx_dev); ++ } ++ ++ if (i == 300) { ++ v4l2_err(v4l2_dev, "%s: signal not lock, tmds_clk_ratio:%d\n", ++ __func__, hdmirx_dev->tmds_clk_ratio); ++ v4l2_err(v4l2_dev, "%s: mu_st:%#x, scdc_st:%#x, dma_st10:%#x\n", ++ __func__, mu_status, scdc_status, dma_st10); ++ return -1; ++ } ++ ++ v4l2_info(v4l2_dev, "%s: signal lock ok, i:%d\n", __func__, i); ++ hdmirx_writel(hdmirx_dev, GLOBAL_SWRESET_REQUEST, DATAPATH_SWRESETREQ); ++ ++ reinit_completion(&hdmirx_dev->avi_pkt_rcv); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_update_bits(hdmirx_dev, PKT_2_INT_MASK_N, ++ PKTDEC_AVIIF_RCV_IRQ, PKTDEC_AVIIF_RCV_IRQ); ++ ++ if (!wait_for_completion_timeout(&hdmirx_dev->avi_pkt_rcv, ++ msecs_to_jiffies(300))) { ++ v4l2_err(v4l2_dev, "%s wait avi_pkt_rcv failed\n", __func__); ++ hdmirx_update_bits(hdmirx_dev, PKT_2_INT_MASK_N, ++ PKTDEC_AVIIF_RCV_IRQ, 0); ++ } ++ ++ usleep_range(50 * 1000, 50 * 1010); ++ hdmirx_format_change(hdmirx_dev); ++ ++ return 0; ++} ++ ++static void hdmirx_dma_config(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_set_ddr_store_fmt(hdmirx_dev); ++ ++ /* Note: uv_swap, rb can not swap, doc err*/ ++ if (hdmirx_dev->cur_fmt_fourcc != V4L2_PIX_FMT_NV16) ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, RB_SWAP_EN, RB_SWAP_EN); ++ else ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, RB_SWAP_EN, 0); ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG7, ++ LOCK_FRAME_NUM_MASK, ++ LOCK_FRAME_NUM(2)); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG1, ++ UV_WID_MASK | Y_WID_MASK | ABANDON_EN, ++ UV_WID(1) | Y_WID(2) | ABANDON_EN); ++} ++ ++static void hdmirx_submodule_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ /* Note: if not config HDCP2_CONFIG, there will be some errors; */ ++ hdmirx_update_bits(hdmirx_dev, HDCP2_CONFIG, ++ HDCP2_SWITCH_OVR_VALUE | ++ HDCP2_SWITCH_OVR_EN, ++ HDCP2_SWITCH_OVR_EN); ++ hdmirx_scdc_init(hdmirx_dev); ++ hdmirx_controller_init(hdmirx_dev); ++} ++ ++static int hdmirx_enum_input(struct file *file, void *priv, ++ struct v4l2_input *input) ++{ ++ if (input->index > 0) ++ return -EINVAL; ++ ++ input->type = V4L2_INPUT_TYPE_CAMERA; ++ input->std = 0; ++ strscpy(input->name, "HDMI IN", sizeof(input->name)); ++ input->capabilities = V4L2_IN_CAP_DV_TIMINGS; ++ ++ return 0; ++} ++ ++static int hdmirx_get_input(struct file *file, void *priv, unsigned int *i) ++{ ++ *i = 0; ++ return 0; ++} ++ ++static int hdmirx_set_input(struct file *file, void *priv, unsigned int i) ++{ ++ if (i) ++ return -EINVAL; ++ return 0; ++} ++ ++static void hdmirx_set_fmt(struct hdmirx_stream *stream, ++ struct v4l2_pix_format_mplane *pixm, bool try) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_bt_timings *bt = &hdmirx_dev->timings.bt; ++ const struct v4l2_format_info *finfo; ++ unsigned int imagesize = 0; ++ int i; ++ ++ memset(&pixm->plane_fmt[0], 0, sizeof(struct v4l2_plane_pix_format)); ++ finfo = v4l2_format_info(pixm->pixelformat); ++ if (!finfo) { ++ finfo = v4l2_format_info(V4L2_PIX_FMT_BGR24); ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: set_fmt:%#x not supported, use def_fmt:%x\n", ++ __func__, pixm->pixelformat, finfo->format); ++ } ++ ++ if (!bt->width || !bt->height) ++ v4l2_dbg(1, debug, v4l2_dev, "%s: invalid resolution:%#xx%#x\n", ++ __func__, bt->width, bt->height); ++ ++ pixm->pixelformat = finfo->format; ++ pixm->width = bt->width; ++ pixm->height = bt->height; ++ pixm->num_planes = finfo->mem_planes; ++ pixm->quantization = V4L2_QUANTIZATION_DEFAULT; ++ pixm->colorspace = V4L2_COLORSPACE_SRGB; ++ pixm->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; ++ ++ if (bt->interlaced == V4L2_DV_INTERLACED) ++ pixm->field = V4L2_FIELD_INTERLACED_TB; ++ else ++ pixm->field = V4L2_FIELD_NONE; ++ ++ memset(pixm->reserved, 0, sizeof(pixm->reserved)); ++ ++ v4l2_fill_pixfmt_mp(pixm, finfo->format, pixm->width, pixm->height); ++ ++ for (i = 0; i < pixm->num_planes; i++) { ++ struct v4l2_plane_pix_format *plane_fmt; ++ int width, height, bpl, size, bpp = 0; ++ ++ if (!i) { ++ width = pixm->width; ++ height = pixm->height; ++ } else { ++ width = pixm->width / finfo->hdiv; ++ height = pixm->height / finfo->vdiv; ++ } ++ ++ switch (finfo->format) { ++ case V4L2_PIX_FMT_NV24: ++ case V4L2_PIX_FMT_NV16: ++ case V4L2_PIX_FMT_NV12: ++ case V4L2_PIX_FMT_BGR24: ++ bpp = finfo->bpp[i]; ++ break; ++ default: ++ v4l2_dbg(1, debug, v4l2_dev, ++ "fourcc: %#x is not supported\n", ++ finfo->format); ++ break; ++ } ++ ++ bpl = ALIGN(width * bpp, MEMORY_ALIGN_ROUND_UP_BYTES); ++ size = bpl * height; ++ imagesize += size; ++ ++ if (finfo->mem_planes > i) { ++ /* Set bpl and size for each mplane */ ++ plane_fmt = pixm->plane_fmt + i; ++ plane_fmt->bytesperline = bpl; ++ plane_fmt->sizeimage = size; ++ } ++ ++ v4l2_dbg(1, debug, v4l2_dev, ++ "C-Plane %i size: %d, Total imagesize: %d\n", ++ i, size, imagesize); ++ } ++ ++ /* Convert to non-MPLANE format as we want to unify non-MPLANE and MPLANE */ ++ if (finfo->mem_planes == 1) ++ pixm->plane_fmt[0].sizeimage = imagesize; ++ ++ if (!try) { ++ stream->out_finfo = finfo; ++ stream->pixm = *pixm; ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: req(%d, %d), out(%d, %d), fmt:%#x\n", __func__, ++ pixm->width, pixm->height, stream->pixm.width, ++ stream->pixm.height, finfo->format); ++ } ++} ++ ++static int hdmirx_enum_fmt_vid_cap_mplane(struct file *file, void *priv, ++ struct v4l2_fmtdesc *f) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ ++ if (f->index >= 1) ++ return -EINVAL; ++ ++ f->pixelformat = hdmirx_dev->cur_fmt_fourcc; ++ ++ return 0; ++} ++ ++static int hdmirx_s_fmt_vid_cap_mplane(struct file *file, ++ void *priv, struct v4l2_format *f) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (vb2_is_busy(&stream->buf_queue)) { ++ v4l2_err(v4l2_dev, "%s: queue busy\n", __func__); ++ return -EBUSY; ++ } ++ ++ hdmirx_set_fmt(stream, &f->fmt.pix_mp, false); ++ ++ return 0; ++} ++ ++static int hdmirx_g_fmt_vid_cap_mplane(struct file *file, void *fh, ++ struct v4l2_format *f) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_pix_format_mplane pixm = {}; ++ ++ pixm.pixelformat = hdmirx_dev->cur_fmt_fourcc; ++ hdmirx_set_fmt(stream, &pixm, true); ++ f->fmt.pix_mp = pixm; ++ ++ return 0; ++} ++ ++static int hdmirx_g_dv_timings(struct file *file, void *_fh, ++ struct v4l2_dv_timings *timings) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 dma_cfg1; ++ ++ *timings = hdmirx_dev->timings; ++ dma_cfg1 = hdmirx_readl(hdmirx_dev, DMA_CONFIG1); ++ v4l2_dbg(1, debug, v4l2_dev, "%s: pix_fmt: %s, DMA_CONFIG1:%#x\n", ++ __func__, pix_fmt_str[hdmirx_dev->pix_fmt], dma_cfg1); ++ ++ return 0; ++} ++ ++static int hdmirx_s_dv_timings(struct file *file, void *_fh, ++ struct v4l2_dv_timings *timings) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (!timings) ++ return -EINVAL; ++ ++ if (debug) ++ v4l2_print_dv_timings(hdmirx_dev->v4l2_dev.name, ++ "s_dv_timings: ", timings, false); ++ ++ if (!v4l2_valid_dv_timings(timings, &hdmirx_timings_cap, NULL, NULL)) { ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: timings out of range\n", __func__); ++ return -ERANGE; ++ } ++ ++ /* Check if the timings are part of the CEA-861 timings. */ ++ v4l2_find_dv_timings_cap(timings, &hdmirx_timings_cap, 0, NULL, NULL); ++ ++ if (v4l2_match_dv_timings(&hdmirx_dev->timings, timings, 0, false)) { ++ v4l2_dbg(1, debug, v4l2_dev, "%s: no change\n", __func__); ++ return 0; ++ } ++ ++ /* ++ * Changing the timings implies a format change, which is not allowed ++ * while buffers for use with streaming have already been allocated. ++ */ ++ if (vb2_is_busy(&stream->buf_queue)) ++ return -EBUSY; ++ ++ hdmirx_dev->timings = *timings; ++ /* Update the internal format */ ++ hdmirx_set_fmt(stream, &stream->pixm, false); ++ ++ return 0; ++} ++ ++static int hdmirx_querycap(struct file *file, void *priv, ++ struct v4l2_capability *cap) ++{ ++ struct hdmirx_stream *stream = video_drvdata(file); ++ struct device *dev = stream->hdmirx_dev->dev; ++ ++ strscpy(cap->driver, dev->driver->name, sizeof(cap->driver)); ++ strscpy(cap->card, dev->driver->name, sizeof(cap->card)); ++ ++ return 0; ++} ++ ++static int hdmirx_queue_setup(struct vb2_queue *queue, ++ unsigned int *num_buffers, ++ unsigned int *num_planes, ++ unsigned int sizes[], ++ struct device *alloc_ctxs[]) ++{ ++ struct hdmirx_stream *stream = vb2_get_drv_priv(queue); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ const struct v4l2_pix_format_mplane *pixm = NULL; ++ const struct v4l2_format_info *out_finfo; ++ u32 i, height; ++ ++ pixm = &stream->pixm; ++ out_finfo = stream->out_finfo; ++ ++ if (!num_planes || !out_finfo) { ++ v4l2_err(v4l2_dev, "%s: out_fmt not set\n", __func__); ++ return -EINVAL; ++ } ++ ++ if (*num_planes) { ++ if (*num_planes != pixm->num_planes) ++ return -EINVAL; ++ ++ for (i = 0; i < *num_planes; i++) ++ if (sizes[i] < pixm->plane_fmt[i].sizeimage) ++ return -EINVAL; ++ return 0; ++ } ++ ++ *num_planes = out_finfo->mem_planes; ++ height = pixm->height; ++ ++ for (i = 0; i < out_finfo->mem_planes; i++) ++ sizes[i] = pixm->plane_fmt[i].sizeimage; ++ ++ v4l2_dbg(1, debug, v4l2_dev, "%s: count %d, size %d\n", ++ v4l2_type_names[queue->type], *num_buffers, sizes[0]); ++ ++ return 0; ++} ++ ++/* ++ * The vb2_buffer are stored in hdmirx_buffer, in order to unify ++ * mplane buffer and none-mplane buffer. ++ */ ++static void hdmirx_buf_queue(struct vb2_buffer *vb) ++{ ++ const struct v4l2_format_info *out_finfo; ++ struct vb2_v4l2_buffer *vbuf; ++ struct hdmirx_buffer *hdmirx_buf; ++ struct vb2_queue *queue; ++ struct hdmirx_stream *stream; ++ const struct v4l2_pix_format_mplane *pixm; ++ unsigned long lock_flags = 0; ++ int i; ++ ++ vbuf = to_vb2_v4l2_buffer(vb); ++ hdmirx_buf = container_of(vbuf, struct hdmirx_buffer, vb); ++ queue = vb->vb2_queue; ++ stream = vb2_get_drv_priv(queue); ++ pixm = &stream->pixm; ++ out_finfo = stream->out_finfo; ++ ++ memset(hdmirx_buf->buff_addr, 0, sizeof(hdmirx_buf->buff_addr)); ++ ++ /* ++ * If mplanes > 1, every c-plane has its own m-plane, ++ * otherwise, multiple c-planes are in the same m-plane ++ */ ++ for (i = 0; i < out_finfo->mem_planes; i++) ++ hdmirx_buf->buff_addr[i] = vb2_dma_contig_plane_dma_addr(vb, i); ++ ++ if (out_finfo->mem_planes == 1) { ++ if (out_finfo->comp_planes == 1) { ++ hdmirx_buf->buff_addr[HDMIRX_PLANE_CBCR] = ++ hdmirx_buf->buff_addr[HDMIRX_PLANE_Y]; ++ } else { ++ for (i = 0; i < out_finfo->comp_planes - 1; i++) ++ hdmirx_buf->buff_addr[i + 1] = ++ hdmirx_buf->buff_addr[i] + ++ pixm->plane_fmt[i].bytesperline * ++ pixm->height; ++ } ++ } ++ ++ spin_lock_irqsave(&stream->vbq_lock, lock_flags); ++ list_add_tail(&hdmirx_buf->queue, &stream->buf_head); ++ spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); ++} ++ ++static void return_all_buffers(struct hdmirx_stream *stream, ++ enum vb2_buffer_state state) ++{ ++ struct hdmirx_buffer *buf; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&stream->vbq_lock, flags); ++ if (stream->curr_buf) ++ list_add_tail(&stream->curr_buf->queue, &stream->buf_head); ++ if (stream->next_buf && stream->next_buf != stream->curr_buf) ++ list_add_tail(&stream->next_buf->queue, &stream->buf_head); ++ stream->curr_buf = NULL; ++ stream->next_buf = NULL; ++ ++ while (!list_empty(&stream->buf_head)) { ++ buf = list_first_entry(&stream->buf_head, ++ struct hdmirx_buffer, queue); ++ list_del(&buf->queue); ++ spin_unlock_irqrestore(&stream->vbq_lock, flags); ++ vb2_buffer_done(&buf->vb.vb2_buf, state); ++ spin_lock_irqsave(&stream->vbq_lock, flags); ++ } ++ spin_unlock_irqrestore(&stream->vbq_lock, flags); ++} ++ ++static void hdmirx_stop_streaming(struct vb2_queue *queue) ++{ ++ struct hdmirx_stream *stream = vb2_get_drv_priv(queue); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int ret; ++ ++ v4l2_info(v4l2_dev, "stream start stopping\n"); ++ mutex_lock(&hdmirx_dev->stream_lock); ++ WRITE_ONCE(stream->stopping, true); ++ ++ /* wait last irq to return the buffer */ ++ ret = wait_event_timeout(stream->wq_stopped, !stream->stopping, ++ msecs_to_jiffies(500)); ++ if (!ret) { ++ v4l2_err(v4l2_dev, "%s: timeout waiting last irq\n", ++ __func__); ++ WRITE_ONCE(stream->stopping, false); ++ } ++ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0); ++ return_all_buffers(stream, VB2_BUF_STATE_ERROR); ++ mutex_unlock(&hdmirx_dev->stream_lock); ++ v4l2_info(v4l2_dev, "stream stopping finished\n"); ++} ++ ++static int hdmirx_start_streaming(struct vb2_queue *queue, unsigned int count) ++{ ++ struct hdmirx_stream *stream = vb2_get_drv_priv(queue); ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_dv_timings timings = hdmirx_dev->timings; ++ struct v4l2_bt_timings *bt = &timings.bt; ++ unsigned long lock_flags = 0; ++ int line_flag; ++ ++ if (!hdmirx_dev->got_timing) { ++ v4l2_dbg(1, debug, v4l2_dev, "timing is invalid\n"); ++ return 0; ++ } ++ ++ mutex_lock(&hdmirx_dev->stream_lock); ++ stream->frame_idx = 0; ++ stream->line_flag_int_cnt = 0; ++ stream->curr_buf = NULL; ++ stream->next_buf = NULL; ++ stream->irq_stat = 0; ++ queue->min_queued_buffers = 1; ++ ++ WRITE_ONCE(stream->stopping, false); ++ ++ spin_lock_irqsave(&stream->vbq_lock, lock_flags); ++ if (!stream->curr_buf) { ++ if (!list_empty(&stream->buf_head)) { ++ stream->curr_buf = list_first_entry(&stream->buf_head, ++ struct hdmirx_buffer, ++ queue); ++ list_del(&stream->curr_buf->queue); ++ } else { ++ stream->curr_buf = NULL; ++ } ++ } ++ spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); ++ ++ v4l2_dbg(2, debug, v4l2_dev, ++ "%s: start_stream cur_buf y_addr:%#x, uv_addr:%#x\n", ++ __func__, stream->curr_buf->buff_addr[HDMIRX_PLANE_Y], ++ stream->curr_buf->buff_addr[HDMIRX_PLANE_CBCR]); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG2, ++ stream->curr_buf->buff_addr[HDMIRX_PLANE_Y]); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG3, ++ stream->curr_buf->buff_addr[HDMIRX_PLANE_CBCR]); ++ ++ if (bt->height) { ++ if (bt->interlaced == V4L2_DV_INTERLACED) ++ line_flag = bt->height / 4; ++ else ++ line_flag = bt->height / 2; ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG7, ++ LINE_FLAG_NUM_MASK, ++ LINE_FLAG_NUM(line_flag)); ++ } else { ++ v4l2_err(v4l2_dev, "height err: %d\n", bt->height); ++ } ++ ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG5, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, CED_DYN_CONTROL, 0x1); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, HDMIRX_DMA_EN); ++ v4l2_dbg(1, debug, v4l2_dev, "%s: enable dma", __func__); ++ mutex_unlock(&hdmirx_dev->stream_lock); ++ ++ return 0; ++} ++ ++/* vb2 queue */ ++static const struct vb2_ops hdmirx_vb2_ops = { ++ .queue_setup = hdmirx_queue_setup, ++ .buf_queue = hdmirx_buf_queue, ++ .wait_prepare = vb2_ops_wait_prepare, ++ .wait_finish = vb2_ops_wait_finish, ++ .stop_streaming = hdmirx_stop_streaming, ++ .start_streaming = hdmirx_start_streaming, ++}; ++ ++static int hdmirx_init_vb2_queue(struct vb2_queue *q, ++ struct hdmirx_stream *stream, ++ enum v4l2_buf_type buf_type) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ ++ q->type = buf_type; ++ q->io_modes = VB2_MMAP | VB2_DMABUF; ++ q->drv_priv = stream; ++ q->ops = &hdmirx_vb2_ops; ++ q->mem_ops = &vb2_dma_contig_memops; ++ q->buf_struct_size = sizeof(struct hdmirx_buffer); ++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; ++ q->lock = &stream->vlock; ++ q->dev = hdmirx_dev->dev; ++ /* ++ * rk3588 doesn't use iommu and works only with dma buffers ++ * that are physically contiguous in memory. ++ */ ++ q->dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS; ++ return vb2_queue_init(q); ++} ++ ++/* video device */ ++static const struct v4l2_ioctl_ops hdmirx_v4l2_ioctl_ops = { ++ .vidioc_querycap = hdmirx_querycap, ++ .vidioc_try_fmt_vid_cap_mplane = hdmirx_g_fmt_vid_cap_mplane, ++ .vidioc_s_fmt_vid_cap_mplane = hdmirx_s_fmt_vid_cap_mplane, ++ .vidioc_g_fmt_vid_cap_mplane = hdmirx_g_fmt_vid_cap_mplane, ++ .vidioc_enum_fmt_vid_cap = hdmirx_enum_fmt_vid_cap_mplane, ++ ++ .vidioc_s_dv_timings = hdmirx_s_dv_timings, ++ .vidioc_g_dv_timings = hdmirx_g_dv_timings, ++ .vidioc_enum_dv_timings = hdmirx_enum_dv_timings, ++ .vidioc_query_dv_timings = hdmirx_query_dv_timings, ++ .vidioc_dv_timings_cap = hdmirx_dv_timings_cap, ++ .vidioc_enum_input = hdmirx_enum_input, ++ .vidioc_g_input = hdmirx_get_input, ++ .vidioc_s_input = hdmirx_set_input, ++ .vidioc_g_edid = hdmirx_get_edid, ++ .vidioc_s_edid = hdmirx_set_edid, ++ .vidioc_g_parm = hdmirx_g_parm, ++ ++ .vidioc_reqbufs = vb2_ioctl_reqbufs, ++ .vidioc_querybuf = vb2_ioctl_querybuf, ++ .vidioc_create_bufs = vb2_ioctl_create_bufs, ++ .vidioc_qbuf = vb2_ioctl_qbuf, ++ .vidioc_expbuf = vb2_ioctl_expbuf, ++ .vidioc_dqbuf = vb2_ioctl_dqbuf, ++ .vidioc_prepare_buf = vb2_ioctl_prepare_buf, ++ .vidioc_streamon = vb2_ioctl_streamon, ++ .vidioc_streamoff = vb2_ioctl_streamoff, ++ ++ .vidioc_log_status = v4l2_ctrl_log_status, ++ .vidioc_subscribe_event = hdmirx_subscribe_event, ++ .vidioc_unsubscribe_event = v4l2_event_unsubscribe, ++}; ++ ++static const struct v4l2_file_operations hdmirx_fops = { ++ .owner = THIS_MODULE, ++ .open = v4l2_fh_open, ++ .release = vb2_fop_release, ++ .unlocked_ioctl = video_ioctl2, ++ .poll = vb2_fop_poll, ++ .mmap = vb2_fop_mmap, ++}; ++ ++static int hdmirx_register_stream_vdev(struct hdmirx_stream *stream) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = stream->hdmirx_dev; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct video_device *vdev = &stream->vdev; ++ int ret = 0; ++ ++ strscpy(vdev->name, "stream_hdmirx", sizeof(vdev->name)); ++ INIT_LIST_HEAD(&stream->buf_head); ++ spin_lock_init(&stream->vbq_lock); ++ mutex_init(&stream->vlock); ++ init_waitqueue_head(&stream->wq_stopped); ++ stream->curr_buf = NULL; ++ stream->next_buf = NULL; ++ ++ vdev->ioctl_ops = &hdmirx_v4l2_ioctl_ops; ++ vdev->release = video_device_release_empty; ++ vdev->fops = &hdmirx_fops; ++ vdev->minor = -1; ++ vdev->v4l2_dev = v4l2_dev; ++ vdev->lock = &stream->vlock; ++ vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | ++ V4L2_CAP_STREAMING; ++ video_set_drvdata(vdev, stream); ++ vdev->vfl_dir = VFL_DIR_RX; ++ ++ hdmirx_init_vb2_queue(&stream->buf_queue, stream, ++ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); ++ vdev->queue = &stream->buf_queue; ++ ++ ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); ++ if (ret < 0) { ++ v4l2_err(v4l2_dev, "video_register_device failed: %d\n", ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static void process_signal_change(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, 0); ++ hdmirx_reset_dma(hdmirx_dev); ++ hdmirx_dev->got_timing = false; ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_res_change, ++ msecs_to_jiffies(50)); ++} ++ ++static void avpunit_0_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (status & (CED_DYN_CNT_CH2_IRQ | ++ CED_DYN_CNT_CH1_IRQ | ++ CED_DYN_CNT_CH0_IRQ)) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: avp0_st:%#x\n", ++ __func__, status); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_0_INT_FORCE, 0x0); ++} ++ ++static void avpunit_1_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ if (status & DEFRAMER_VSYNC_THR_REACHED_IRQ) { ++ v4l2_info(v4l2_dev, "Vertical Sync threshold reached interrupt %#x", status); ++ hdmirx_update_bits(hdmirx_dev, AVPUNIT_1_INT_MASK_N, ++ DEFRAMER_VSYNC_THR_REACHED_MASK_N, 0); ++ *handled = true; ++ } ++} ++ ++static void mainunit_0_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "mu0_st:%#x\n", status); ++ if (status & TIMER_BASE_LOCKED_IRQ) { ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_0_INT_MASK_N, ++ TIMER_BASE_LOCKED_IRQ, 0); ++ complete(&hdmirx_dev->timer_base_lock); ++ *handled = true; ++ } ++ ++ if (status & TMDSQPCLK_OFF_CHG) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: TMDSQPCLK_OFF_CHG\n", __func__); ++ *handled = true; ++ } ++ ++ if (status & TMDSQPCLK_LOCKED_CHG) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: TMDSQPCLK_LOCKED_CHG\n", __func__); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_0_INT_FORCE, 0x0); ++} ++ ++static void mainunit_2_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "mu2_st:%#x\n", status); ++ if (status & PHYCREG_CR_WRITE_DONE) { ++ hdmirx_update_bits(hdmirx_dev, MAINUNIT_2_INT_MASK_N, ++ PHYCREG_CR_WRITE_DONE, 0); ++ complete(&hdmirx_dev->cr_write_done); ++ *handled = true; ++ } ++ ++ if (status & TMDSVALID_STABLE_CHG) { ++ process_signal_change(hdmirx_dev); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: TMDSVALID_STABLE_CHG\n", __func__); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_2_INT_FORCE, 0x0); ++} ++ ++static void pkt_2_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: pk2_st:%#x\n", __func__, status); ++ if (status & PKTDEC_AVIIF_RCV_IRQ) { ++ hdmirx_update_bits(hdmirx_dev, PKT_2_INT_MASK_N, ++ PKTDEC_AVIIF_RCV_IRQ, 0); ++ complete(&hdmirx_dev->avi_pkt_rcv); ++ v4l2_dbg(2, debug, v4l2_dev, "%s: AVIIF_RCV_IRQ\n", __func__); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_2_INT_CLEAR, 0xffffffff); ++} ++ ++static void scdc_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ int status, bool *handled) ++{ ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: scdc_st:%#x\n", __func__, status); ++ if (status & SCDCTMDSCCFG_CHG) { ++ hdmirx_tmds_clk_ratio_config(hdmirx_dev); ++ *handled = true; ++ } ++ ++ hdmirx_clear_interrupt(hdmirx_dev, SCDC_INT_CLEAR, 0xffffffff); ++} ++ ++static irqreturn_t hdmirx_hdmi_irq_handler(int irq, void *dev_id) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_id; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct arm_smccc_res res; ++ u32 mu0_st, mu2_st, pk2_st, scdc_st, avp1_st, avp0_st; ++ u32 mu0_mask, mu2_mask, pk2_mask, scdc_mask, avp1_msk, avp0_msk; ++ bool handled = false; ++ ++ mu0_mask = hdmirx_readl(hdmirx_dev, MAINUNIT_0_INT_MASK_N); ++ mu2_mask = hdmirx_readl(hdmirx_dev, MAINUNIT_2_INT_MASK_N); ++ pk2_mask = hdmirx_readl(hdmirx_dev, PKT_2_INT_MASK_N); ++ scdc_mask = hdmirx_readl(hdmirx_dev, SCDC_INT_MASK_N); ++ mu0_st = hdmirx_readl(hdmirx_dev, MAINUNIT_0_INT_STATUS); ++ mu2_st = hdmirx_readl(hdmirx_dev, MAINUNIT_2_INT_STATUS); ++ pk2_st = hdmirx_readl(hdmirx_dev, PKT_2_INT_STATUS); ++ scdc_st = hdmirx_readl(hdmirx_dev, SCDC_INT_STATUS); ++ avp0_st = hdmirx_readl(hdmirx_dev, AVPUNIT_0_INT_STATUS); ++ avp1_st = hdmirx_readl(hdmirx_dev, AVPUNIT_1_INT_STATUS); ++ avp0_msk = hdmirx_readl(hdmirx_dev, AVPUNIT_0_INT_MASK_N); ++ avp1_msk = hdmirx_readl(hdmirx_dev, AVPUNIT_1_INT_MASK_N); ++ mu0_st &= mu0_mask; ++ mu2_st &= mu2_mask; ++ pk2_st &= pk2_mask; ++ avp1_st &= avp1_msk; ++ avp0_st &= avp0_msk; ++ scdc_st &= scdc_mask; ++ ++ if (avp0_st) ++ avpunit_0_int_handler(hdmirx_dev, avp0_st, &handled); ++ if (avp1_st) ++ avpunit_1_int_handler(hdmirx_dev, avp1_st, &handled); ++ if (mu0_st) ++ mainunit_0_int_handler(hdmirx_dev, mu0_st, &handled); ++ if (mu2_st) ++ mainunit_2_int_handler(hdmirx_dev, mu2_st, &handled); ++ if (pk2_st) ++ pkt_2_int_handler(hdmirx_dev, pk2_st, &handled); ++ if (scdc_st) ++ scdc_int_handler(hdmirx_dev, scdc_st, &handled); ++ ++ if (!handled) { ++ v4l2_dbg(2, debug, v4l2_dev, "%s: hdmi irq not handled", __func__); ++ v4l2_dbg(2, debug, v4l2_dev, ++ "avp0:%#x, avp1:%#x, mu0:%#x, mu2:%#x, pk2:%#x, scdc:%#x\n", ++ avp0_st, avp1_st, mu0_st, mu2_st, pk2_st, scdc_st); ++ } ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: en_fiq", __func__); ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_EN, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ return handled ? IRQ_HANDLED : IRQ_NONE; ++} ++ ++static void hdmirx_vb_done(struct hdmirx_stream *stream, ++ struct vb2_v4l2_buffer *vb_done) ++{ ++ const struct v4l2_format_info *finfo = stream->out_finfo; ++ u32 i; ++ ++ /* Dequeue a filled buffer */ ++ for (i = 0; i < finfo->mem_planes; i++) { ++ vb2_set_plane_payload(&vb_done->vb2_buf, i, ++ stream->pixm.plane_fmt[i].sizeimage); ++ } ++ ++ vb_done->vb2_buf.timestamp = ktime_get_ns(); ++ vb2_buffer_done(&vb_done->vb2_buf, VB2_BUF_STATE_DONE); ++} ++ ++static void dma_idle_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ bool *handled) ++{ ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_dv_timings timings = hdmirx_dev->timings; ++ struct v4l2_bt_timings *bt = &timings.bt; ++ struct vb2_v4l2_buffer *vb_done = NULL; ++ ++ if (!(stream->irq_stat) && !(stream->irq_stat & LINE_FLAG_INT_EN)) ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: last time have no line_flag_irq\n", __func__); ++ ++ if (stream->line_flag_int_cnt <= FILTER_FRAME_CNT) ++ goto DMA_IDLE_OUT; ++ ++ if (bt->interlaced != V4L2_DV_INTERLACED || ++ !(stream->line_flag_int_cnt % 2)) { ++ if (stream->next_buf) { ++ if (stream->curr_buf) ++ vb_done = &stream->curr_buf->vb; ++ ++ if (vb_done) { ++ vb_done->vb2_buf.timestamp = ktime_get_ns(); ++ vb_done->sequence = stream->frame_idx; ++ hdmirx_vb_done(stream, vb_done); ++ stream->frame_idx++; ++ if (stream->frame_idx == 30) ++ v4l2_info(v4l2_dev, "rcv frames\n"); ++ } ++ ++ stream->curr_buf = NULL; ++ if (stream->next_buf) { ++ stream->curr_buf = stream->next_buf; ++ stream->next_buf = NULL; ++ } ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, ++ "%s: next_buf NULL, skip vb_done\n", __func__); ++ } ++ } ++ ++DMA_IDLE_OUT: ++ *handled = true; ++} ++ ++static void line_flag_int_handler(struct snps_hdmirx_dev *hdmirx_dev, ++ bool *handled) ++{ ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ struct v4l2_dv_timings timings = hdmirx_dev->timings; ++ struct v4l2_bt_timings *bt = &timings.bt; ++ u32 dma_cfg6; ++ ++ stream->line_flag_int_cnt++; ++ if (!(stream->irq_stat) && !(stream->irq_stat & HDMIRX_DMA_IDLE_INT)) ++ v4l2_dbg(1, debug, v4l2_dev, ++ "%s: last have no dma_idle_irq\n", __func__); ++ dma_cfg6 = hdmirx_readl(hdmirx_dev, DMA_CONFIG6); ++ if (!(dma_cfg6 & HDMIRX_DMA_EN)) { ++ v4l2_dbg(2, debug, v4l2_dev, "%s: dma not on\n", __func__); ++ goto LINE_FLAG_OUT; ++ } ++ ++ if (stream->line_flag_int_cnt <= FILTER_FRAME_CNT) ++ goto LINE_FLAG_OUT; ++ ++ if (bt->interlaced != V4L2_DV_INTERLACED || ++ !(stream->line_flag_int_cnt % 2)) { ++ if (!stream->next_buf) { ++ spin_lock(&stream->vbq_lock); ++ if (!list_empty(&stream->buf_head)) { ++ stream->next_buf = list_first_entry(&stream->buf_head, ++ struct hdmirx_buffer, ++ queue); ++ list_del(&stream->next_buf->queue); ++ } else { ++ stream->next_buf = NULL; ++ } ++ spin_unlock(&stream->vbq_lock); ++ ++ if (stream->next_buf) { ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG2, ++ stream->next_buf->buff_addr[HDMIRX_PLANE_Y]); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG3, ++ stream->next_buf->buff_addr[HDMIRX_PLANE_CBCR]); ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, ++ "%s: no buffer is available\n", __func__); ++ } ++ } ++ } else { ++ v4l2_dbg(3, debug, v4l2_dev, "%s: interlace:%d, line_flag_int_cnt:%d\n", ++ __func__, bt->interlaced, stream->line_flag_int_cnt); ++ } ++ ++LINE_FLAG_OUT: ++ *handled = true; ++} ++ ++static irqreturn_t hdmirx_dma_irq_handler(int irq, void *dev_id) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_id; ++ struct hdmirx_stream *stream = &hdmirx_dev->stream; ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ u32 dma_stat1, dma_stat13; ++ bool handled = false; ++ ++ dma_stat1 = hdmirx_readl(hdmirx_dev, DMA_STATUS1); ++ dma_stat13 = hdmirx_readl(hdmirx_dev, DMA_STATUS13); ++ v4l2_dbg(3, debug, v4l2_dev, "dma_irq st1:%#x, st13:%d\n", ++ dma_stat1, dma_stat13); ++ ++ if (READ_ONCE(stream->stopping)) { ++ v4l2_dbg(1, debug, v4l2_dev, "%s: stop stream\n", __func__); ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG5, 0xffffffff); ++ hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4, ++ LINE_FLAG_INT_EN | ++ HDMIRX_DMA_IDLE_INT | ++ HDMIRX_LOCK_DISABLE_INT | ++ LAST_FRAME_AXI_UNFINISH_INT_EN | ++ FIFO_OVERFLOW_INT_EN | ++ FIFO_UNDERFLOW_INT_EN | ++ HDMIRX_AXI_ERROR_INT_EN, 0); ++ WRITE_ONCE(stream->stopping, false); ++ wake_up(&stream->wq_stopped); ++ return IRQ_HANDLED; ++ } ++ ++ if (dma_stat1 & HDMIRX_DMA_IDLE_INT) ++ dma_idle_int_handler(hdmirx_dev, &handled); ++ ++ if (dma_stat1 & LINE_FLAG_INT_EN) ++ line_flag_int_handler(hdmirx_dev, &handled); ++ ++ if (!handled) ++ v4l2_dbg(3, debug, v4l2_dev, ++ "%s: dma irq not handled, dma_stat1:%#x\n", ++ __func__, dma_stat1); ++ ++ stream->irq_stat = dma_stat1; ++ hdmirx_writel(hdmirx_dev, DMA_CONFIG5, 0xffffffff); ++ ++ return IRQ_HANDLED; ++} ++ ++static void hdmirx_plugin(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct arm_smccc_res res; ++ int ret; ++ ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_heartbeat, ++ msecs_to_jiffies(10)); ++ arm_smccc_smc(SIP_WDT_CFG, WDT_START, 0, 0, 0, 0, 0, 0, &res); ++ hdmirx_submodule_init(hdmirx_dev); ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, ++ POWERPROVIDED); ++ hdmirx_hpd_ctrl(hdmirx_dev, true); ++ hdmirx_phy_config(hdmirx_dev); ++ ret = hdmirx_wait_lock_and_get_timing(hdmirx_dev); ++ if (ret) { ++ hdmirx_plugout(hdmirx_dev); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(200)); ++ return; ++ } ++ hdmirx_dma_config(hdmirx_dev); ++ hdmirx_interrupts_setup(hdmirx_dev, true); ++} ++ ++static void hdmirx_delayed_work_hotplug(struct work_struct *work) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev; ++ bool plugin; ++ ++ hdmirx_dev = container_of(work, struct snps_hdmirx_dev, ++ delayed_work_hotplug.work); ++ ++ mutex_lock(&hdmirx_dev->work_lock); ++ hdmirx_dev->got_timing = false; ++ plugin = tx_5v_power_present(hdmirx_dev); ++ v4l2_ctrl_s_ctrl(hdmirx_dev->detect_tx_5v_ctrl, plugin); ++ v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: plugin:%d\n", ++ __func__, plugin); ++ ++ if (plugin) ++ hdmirx_plugin(hdmirx_dev); ++ else ++ hdmirx_plugout(hdmirx_dev); ++ ++ mutex_unlock(&hdmirx_dev->work_lock); ++} ++ ++static void hdmirx_delayed_work_res_change(struct work_struct *work) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev; ++ bool plugin; ++ ++ hdmirx_dev = container_of(work, struct snps_hdmirx_dev, ++ delayed_work_res_change.work); ++ ++ mutex_lock(&hdmirx_dev->work_lock); ++ plugin = tx_5v_power_present(hdmirx_dev); ++ v4l2_dbg(1, debug, &hdmirx_dev->v4l2_dev, "%s: plugin:%d\n", ++ __func__, plugin); ++ if (plugin) { ++ hdmirx_interrupts_setup(hdmirx_dev, false); ++ hdmirx_submodule_init(hdmirx_dev); ++ hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, ++ POWERPROVIDED); ++ hdmirx_hpd_ctrl(hdmirx_dev, true); ++ hdmirx_phy_config(hdmirx_dev); ++ ++ if (hdmirx_wait_lock_and_get_timing(hdmirx_dev)) { ++ hdmirx_plugout(hdmirx_dev); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(200)); ++ } else { ++ hdmirx_dma_config(hdmirx_dev); ++ hdmirx_interrupts_setup(hdmirx_dev, true); ++ } ++ } ++ mutex_unlock(&hdmirx_dev->work_lock); ++} ++ ++static void hdmirx_delayed_work_heartbeat(struct work_struct *work) ++{ ++ struct delayed_work *dwork = to_delayed_work(work); ++ struct snps_hdmirx_dev *hdmirx_dev = container_of(dwork, ++ struct snps_hdmirx_dev, ++ delayed_work_heartbeat); ++ ++ queue_work(system_highpri_wq, &hdmirx_dev->work_wdt_config); ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_heartbeat, HZ); ++} ++ ++static void hdmirx_work_wdt_config(struct work_struct *work) ++{ ++ struct arm_smccc_res res; ++ struct snps_hdmirx_dev *hdmirx_dev = container_of(work, ++ struct snps_hdmirx_dev, ++ work_wdt_config); ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ arm_smccc_smc(SIP_WDT_CFG, WDT_PING, 0, 0, 0, 0, 0, 0, &res); ++ v4l2_dbg(3, debug, v4l2_dev, "hb\n"); ++} ++ ++static irqreturn_t hdmirx_5v_det_irq_handler(int irq, void *dev_id) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_id; ++ u32 val; ++ ++ val = gpiod_get_value(hdmirx_dev->detect_5v_gpio); ++ v4l2_dbg(3, debug, &hdmirx_dev->v4l2_dev, "%s: 5v:%d\n", __func__, val); ++ ++ queue_delayed_work(system_unbound_wq, ++ &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(10)); ++ ++ return IRQ_HANDLED; ++} ++ ++static const struct hdmirx_cec_ops hdmirx_cec_ops = { ++ .write = hdmirx_writel, ++ .read = hdmirx_readl, ++}; ++ ++static int hdmirx_parse_dt(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ int ret; ++ ++ hdmirx_dev->num_clks = devm_clk_bulk_get_all(dev, &hdmirx_dev->clks); ++ if (hdmirx_dev->num_clks < 1) ++ return -ENODEV; ++ ++ hdmirx_dev->resets[HDMIRX_RST_A].id = "axi"; ++ hdmirx_dev->resets[HDMIRX_RST_P].id = "apb"; ++ hdmirx_dev->resets[HDMIRX_RST_REF].id = "ref"; ++ hdmirx_dev->resets[HDMIRX_RST_BIU].id = "biu"; ++ ++ ret = devm_reset_control_bulk_get_exclusive(dev, HDMIRX_NUM_RST, ++ hdmirx_dev->resets); ++ if (ret < 0) { ++ dev_err(dev, "failed to get reset controls\n"); ++ return ret; ++ } ++ ++ hdmirx_dev->detect_5v_gpio = ++ devm_gpiod_get_optional(dev, "hpd", GPIOD_IN); ++ ++ if (IS_ERR(hdmirx_dev->detect_5v_gpio)) { ++ dev_err(dev, "failed to get hdmirx hot plug detection gpio\n"); ++ return PTR_ERR(hdmirx_dev->detect_5v_gpio); ++ } ++ ++ hdmirx_dev->grf = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "rockchip,grf"); ++ if (IS_ERR(hdmirx_dev->grf)) { ++ dev_err(dev, "failed to get rockchip,grf\n"); ++ return PTR_ERR(hdmirx_dev->grf); ++ } ++ ++ hdmirx_dev->vo1_grf = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "rockchip,vo1-grf"); ++ if (IS_ERR(hdmirx_dev->vo1_grf)) { ++ dev_err(dev, "failed to get rockchip,vo1-grf\n"); ++ return PTR_ERR(hdmirx_dev->vo1_grf); ++ } ++ ++ hdmirx_dev->hpd_trigger_level = !device_property_read_bool(dev, "hpd-is-active-low"); ++ ++ ret = of_reserved_mem_device_init(dev); ++ if (ret) ++ dev_warn(dev, "No reserved memory for HDMIRX, use default CMA\n"); ++ ++ return 0; ++} ++ ++static void hdmirx_disable_all_interrupts(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_writel(hdmirx_dev, MAINUNIT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_1_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, MAINUNIT_2_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, AVPUNIT_1_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, PKT_0_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, PKT_1_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, PKT_2_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, SCDC_INT_MASK_N, 0); ++ hdmirx_writel(hdmirx_dev, CEC_INT_MASK_N, 0); ++ ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, MAINUNIT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, AVPUNIT_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_0_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, PKT_2_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, SCDC_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, HDCP_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, HDCP_1_INT_CLEAR, 0xffffffff); ++ hdmirx_clear_interrupt(hdmirx_dev, CEC_INT_CLEAR, 0xffffffff); ++} ++ ++static int hdmirx_init(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ hdmirx_update_bits(hdmirx_dev, PHY_CONFIG, PHY_RESET | PHY_PDDQ, 0); ++ ++ regmap_write(hdmirx_dev->vo1_grf, VO1_GRF_VO1_CON2, ++ (HDMIRX_SDAIN_MSK | HDMIRX_SCLIN_MSK) | ++ ((HDMIRX_SDAIN_MSK | HDMIRX_SCLIN_MSK) << 16)); ++ /* ++ * Some interrupts are enabled by default, so we disable ++ * all interrupts and clear interrupts status first. ++ */ ++ hdmirx_disable_all_interrupts(hdmirx_dev); ++ ++ return 0; ++} ++ ++static void hdmirx_load_default_edid(struct snps_hdmirx_dev *hdmirx_dev) ++{ ++ int ret; ++ struct v4l2_edid def_edid; ++ ++ hdmirx_hpd_ctrl(hdmirx_dev, false); ++ ++ /* disable hpd and write edid */ ++ def_edid.pad = 0; ++ def_edid.start_block = 0; ++ def_edid.blocks = EDID_NUM_BLOCKS_MAX; ++ ++ if (IS_ENABLED(CONFIG_HDMIRX_LOAD_DEFAULT_EDID)) ++ def_edid.edid = edid_init_data_340M; ++ else ++ def_edid.edid = hdmirx_dev->edid; ++ ++ ret = hdmirx_write_edid(hdmirx_dev, &def_edid, true); ++ if (ret) ++ dev_err(hdmirx_dev->dev, "%s: write edid failed\n", __func__); ++} ++ ++static void hdmirx_disable_irq(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct arm_smccc_res res; ++ ++ disable_irq(hdmirx_dev->hdmi_irq); ++ disable_irq(hdmirx_dev->dma_irq); ++ disable_irq(hdmirx_dev->det_irq); ++ ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_DIS, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_hotplug); ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_res_change); ++ cancel_delayed_work_sync(&hdmirx_dev->delayed_work_heartbeat); ++ flush_work(&hdmirx_dev->work_wdt_config); ++ ++ arm_smccc_smc(SIP_WDT_CFG, WDT_STOP, 0, 0, 0, 0, 0, 0, &res); ++} ++ ++static int hdmirx_disable(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ ++ clk_bulk_disable_unprepare(hdmirx_dev->num_clks, hdmirx_dev->clks); ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: suspend\n", __func__); ++ ++ return pinctrl_pm_select_sleep_state(dev); ++} ++ ++static void hdmirx_enable_irq(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct arm_smccc_res res; ++ ++ enable_irq(hdmirx_dev->hdmi_irq); ++ enable_irq(hdmirx_dev->dma_irq); ++ enable_irq(hdmirx_dev->det_irq); ++ ++ arm_smccc_smc(RK_SIP_FIQ_CTRL, RK_SIP_FIQ_CTRL_FIQ_EN, ++ RK_IRQ_HDMIRX_HDMI, 0, 0, 0, 0, 0, &res); ++ ++ queue_delayed_work(system_unbound_wq, &hdmirx_dev->delayed_work_hotplug, ++ msecs_to_jiffies(20)); ++} ++ ++static int hdmirx_enable(struct device *dev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev; ++ int ret; ++ ++ v4l2_dbg(2, debug, v4l2_dev, "%s: resume\n", __func__); ++ ret = pinctrl_pm_select_default_state(dev); ++ if (ret < 0) ++ return ret; ++ ++ ret = clk_bulk_prepare_enable(hdmirx_dev->num_clks, hdmirx_dev->clks); ++ if (ret) { ++ dev_err(dev, "failed to enable hdmirx bulk clks: %d\n", ret); ++ return ret; ++ } ++ ++ reset_control_bulk_assert(HDMIRX_NUM_RST, hdmirx_dev->resets); ++ usleep_range(150, 160); ++ reset_control_bulk_deassert(HDMIRX_NUM_RST, hdmirx_dev->resets); ++ usleep_range(150, 160); ++ ++ return 0; ++} ++ ++static int hdmirx_suspend(struct device *dev) ++{ ++ hdmirx_disable_irq(dev); ++ ++ return hdmirx_disable(dev); ++} ++ ++static int hdmirx_resume(struct device *dev) ++{ ++ int ret = hdmirx_enable(dev); ++ ++ if (ret) ++ return ret; ++ ++ hdmirx_enable_irq(dev); ++ ++ return 0; ++} ++ ++static const struct dev_pm_ops snps_hdmirx_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(hdmirx_suspend, hdmirx_resume) ++}; ++ ++static int hdmirx_setup_irq(struct snps_hdmirx_dev *hdmirx_dev, ++ struct platform_device *pdev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ int ret, irq; ++ ++ irq = platform_get_irq_byname(pdev, "hdmi"); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get hdmi irq\n"); ++ return irq; ++ } ++ ++ irq_set_status_flags(irq, IRQ_NOAUTOEN); ++ ++ hdmirx_dev->hdmi_irq = irq; ++ ret = devm_request_irq(dev, irq, hdmirx_hdmi_irq_handler, 0, ++ "rk_hdmirx-hdmi", hdmirx_dev); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to request hdmi irq\n"); ++ return ret; ++ } ++ ++ irq = platform_get_irq_byname(pdev, "dma"); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get dma irq\n"); ++ return irq; ++ } ++ ++ irq_set_status_flags(irq, IRQ_NOAUTOEN); ++ ++ hdmirx_dev->dma_irq = irq; ++ ret = devm_request_threaded_irq(dev, irq, NULL, hdmirx_dma_irq_handler, ++ IRQF_ONESHOT, "rk_hdmirx-dma", ++ hdmirx_dev); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to request dma irq\n"); ++ return ret; ++ } ++ ++ irq = gpiod_to_irq(hdmirx_dev->detect_5v_gpio); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get hdmirx-5v irq\n"); ++ return irq; ++ } ++ ++ irq_set_status_flags(irq, IRQ_NOAUTOEN); ++ ++ hdmirx_dev->det_irq = irq; ++ ret = devm_request_irq(dev, irq, hdmirx_5v_det_irq_handler, ++ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, ++ "rk_hdmirx-5v", hdmirx_dev); ++ if (ret) { ++ dev_err_probe(dev, ret, "failed to request hdmirx-5v irq\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int hdmirx_register_cec(struct snps_hdmirx_dev *hdmirx_dev, ++ struct platform_device *pdev) ++{ ++ struct device *dev = hdmirx_dev->dev; ++ struct hdmirx_cec_data cec_data; ++ int irq; ++ ++ irq = platform_get_irq_byname(pdev, "cec"); ++ if (irq < 0) { ++ dev_err_probe(dev, irq, "failed to get cec irq\n"); ++ return irq; ++ } ++ ++ hdmirx_dev->cec_notifier = cec_notifier_conn_register(dev, NULL, NULL); ++ if (!hdmirx_dev->cec_notifier) ++ return -EINVAL; ++ ++ cec_data.hdmirx = hdmirx_dev; ++ cec_data.dev = hdmirx_dev->dev; ++ cec_data.ops = &hdmirx_cec_ops; ++ cec_data.irq = irq; ++ ++ hdmirx_dev->cec = snps_hdmirx_cec_register(&cec_data); ++ if (!hdmirx_dev->cec) { ++ cec_notifier_conn_unregister(hdmirx_dev->cec_notifier); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int hdmirx_probe(struct platform_device *pdev) ++{ ++ struct snps_hdmirx_dev *hdmirx_dev; ++ struct device *dev = &pdev->dev; ++ struct v4l2_ctrl_handler *hdl; ++ struct hdmirx_stream *stream; ++ struct v4l2_device *v4l2_dev; ++ int ret; ++ ++ hdmirx_dev = devm_kzalloc(dev, sizeof(*hdmirx_dev), GFP_KERNEL); ++ if (!hdmirx_dev) ++ return -ENOMEM; ++ ++ ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); ++ if (ret) ++ return ret; ++ ++ hdmirx_dev->dev = dev; ++ dev_set_drvdata(dev, hdmirx_dev); ++ ++ ret = hdmirx_parse_dt(hdmirx_dev); ++ if (ret) ++ return ret; ++ ++ ret = hdmirx_setup_irq(hdmirx_dev, pdev); ++ if (ret) ++ return ret; ++ ++ hdmirx_dev->regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(hdmirx_dev->regs)) ++ return dev_err_probe(dev, PTR_ERR(hdmirx_dev->regs), ++ "failed to remap regs resource\n"); ++ ++ mutex_init(&hdmirx_dev->stream_lock); ++ mutex_init(&hdmirx_dev->work_lock); ++ spin_lock_init(&hdmirx_dev->rst_lock); ++ ++ init_completion(&hdmirx_dev->cr_write_done); ++ init_completion(&hdmirx_dev->timer_base_lock); ++ init_completion(&hdmirx_dev->avi_pkt_rcv); ++ ++ INIT_WORK(&hdmirx_dev->work_wdt_config, hdmirx_work_wdt_config); ++ INIT_DELAYED_WORK(&hdmirx_dev->delayed_work_hotplug, ++ hdmirx_delayed_work_hotplug); ++ INIT_DELAYED_WORK(&hdmirx_dev->delayed_work_res_change, ++ hdmirx_delayed_work_res_change); ++ INIT_DELAYED_WORK(&hdmirx_dev->delayed_work_heartbeat, ++ hdmirx_delayed_work_heartbeat); ++ ++ hdmirx_dev->cur_fmt_fourcc = V4L2_PIX_FMT_BGR24; ++ hdmirx_dev->timings = cea640x480; ++ ++ hdmirx_enable(dev); ++ hdmirx_init(hdmirx_dev); ++ ++ v4l2_dev = &hdmirx_dev->v4l2_dev; ++ strscpy(v4l2_dev->name, dev_name(dev), sizeof(v4l2_dev->name)); ++ ++ hdl = &hdmirx_dev->hdl; ++ v4l2_ctrl_handler_init(hdl, 1); ++ ++ hdmirx_dev->detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL, ++ V4L2_CID_DV_RX_POWER_PRESENT, ++ 0, 1, 0, 0); ++ ++ hdmirx_dev->rgb_range = v4l2_ctrl_new_std_menu(hdl, 0, ++ V4L2_CID_DV_RX_RGB_RANGE, ++ V4L2_DV_RGB_RANGE_FULL, 0, ++ V4L2_DV_RGB_RANGE_AUTO); ++ ++ hdmirx_dev->rgb_range->flags |= V4L2_CTRL_FLAG_READ_ONLY; ++ ++ if (hdl->error) { ++ dev_err(dev, "v4l2 ctrl handler init failed\n"); ++ ret = hdl->error; ++ goto err_pm; ++ } ++ hdmirx_dev->v4l2_dev.ctrl_handler = hdl; ++ ++ ret = v4l2_device_register(dev, &hdmirx_dev->v4l2_dev); ++ if (ret < 0) { ++ dev_err(dev, "register v4l2 device failed\n"); ++ goto err_hdl; ++ } ++ ++ stream = &hdmirx_dev->stream; ++ stream->hdmirx_dev = hdmirx_dev; ++ ret = hdmirx_register_stream_vdev(stream); ++ if (ret < 0) { ++ dev_err(dev, "register video device failed\n"); ++ goto err_unreg_v4l2_dev; ++ } ++ ++ ret = hdmirx_register_cec(hdmirx_dev, pdev); ++ if (ret) ++ goto err_unreg_video_dev; ++ ++ hdmirx_load_default_edid(hdmirx_dev); ++ ++ hdmirx_enable_irq(dev); ++ ++ return 0; ++ ++err_unreg_video_dev: ++ video_unregister_device(&hdmirx_dev->stream.vdev); ++err_unreg_v4l2_dev: ++ v4l2_device_unregister(&hdmirx_dev->v4l2_dev); ++err_hdl: ++ v4l2_ctrl_handler_free(&hdmirx_dev->hdl); ++err_pm: ++ hdmirx_disable(dev); ++ ++ return ret; ++} ++ ++static void hdmirx_remove(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev); ++ ++ snps_hdmirx_cec_unregister(hdmirx_dev->cec); ++ cec_notifier_conn_unregister(hdmirx_dev->cec_notifier); ++ ++ hdmirx_disable_irq(dev); ++ ++ video_unregister_device(&hdmirx_dev->stream.vdev); ++ v4l2_ctrl_handler_free(&hdmirx_dev->hdl); ++ v4l2_device_unregister(&hdmirx_dev->v4l2_dev); ++ ++ hdmirx_disable(dev); ++ ++ reset_control_bulk_assert(HDMIRX_NUM_RST, hdmirx_dev->resets); ++ ++ of_reserved_mem_device_release(dev); ++} ++ ++static const struct of_device_id hdmirx_id[] = { ++ { .compatible = "rockchip,rk3588-hdmirx-ctrler" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, hdmirx_id); ++ ++static struct platform_driver hdmirx_driver = { ++ .probe = hdmirx_probe, ++ .remove = hdmirx_remove, ++ .driver = { ++ .name = "snps_hdmirx", ++ .of_match_table = hdmirx_id, ++ .pm = &snps_hdmirx_pm_ops, ++ } ++}; ++module_platform_driver(hdmirx_driver); ++ ++MODULE_DESCRIPTION("Rockchip HDMI Receiver Driver"); ++MODULE_AUTHOR("Dingxian Wen "); ++MODULE_AUTHOR("Shreeya Patel "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h +@@ -0,0 +1,394 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * ++ * Author: Dingxian Wen ++ */ ++ ++#ifndef DW_HDMIRX_H ++#define DW_HDMIRX_H ++ ++#include ++ ++#define UPDATE(x, h, l) (((x) << (l)) & GENMASK((h), (l))) ++#define HIWORD_UPDATE(v, h, l) (((v) << (l)) | (GENMASK((h), (l)) << 16)) ++ ++/* SYS_GRF */ ++#define SYS_GRF_SOC_CON1 0x0304 ++#define HDMIRXPHY_SRAM_EXT_LD_DONE BIT(1) ++#define HDMIRXPHY_SRAM_BYPASS BIT(0) ++#define SYS_GRF_SOC_STATUS1 0x0384 ++#define HDMIRXPHY_SRAM_INIT_DONE BIT(10) ++#define SYS_GRF_CHIP_ID 0x0600 ++ ++/* VO1_GRF */ ++#define VO1_GRF_VO1_CON2 0x0008 ++#define HDMIRX_SDAIN_MSK BIT(2) ++#define HDMIRX_SCLIN_MSK BIT(1) ++ ++/* HDMIRX PHY */ ++#define SUP_DIG_ANA_CREGS_SUP_ANA_NC 0x004f ++ ++#define LANE0_DIG_ASIC_RX_OVRD_OUT_0 0x100f ++#define LANE1_DIG_ASIC_RX_OVRD_OUT_0 0x110f ++#define LANE2_DIG_ASIC_RX_OVRD_OUT_0 0x120f ++#define LANE3_DIG_ASIC_RX_OVRD_OUT_0 0x130f ++#define ASIC_ACK_OVRD_EN BIT(1) ++#define ASIC_ACK BIT(0) ++ ++#define LANE0_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x104a ++#define LANE1_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x114a ++#define LANE2_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x124a ++#define LANE3_DIG_RX_VCOCAL_RX_VCO_CAL_CTRL_2 0x134a ++#define FREQ_TUNE_START_VAL_MASK GENMASK(9, 0) ++#define FREQ_TUNE_START_VAL(x) UPDATE(x, 9, 0) ++ ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_FSM_CONFIG 0x20c4 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_ADAPT_REF_FOM 0x20c7 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_3_REG 0x20e9 ++#define CDR_SETTING_BOUNDARY_3_DEFAULT 0x52da ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_4_REG 0x20ea ++#define CDR_SETTING_BOUNDARY_4_DEFAULT 0x43cd ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_5_REG 0x20eb ++#define CDR_SETTING_BOUNDARY_5_DEFAULT 0x35b3 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_6_REG 0x20fb ++#define CDR_SETTING_BOUNDARY_6_DEFAULT 0x2799 ++#define HDMIPCS_DIG_CTRL_PATH_MAIN_FSM_RATE_CALC_HDMI14_CDR_SETTING_7_REG 0x20fc ++#define CDR_SETTING_BOUNDARY_7_DEFAULT 0x1b65 ++ ++#define RAWLANE0_DIG_PCS_XF_RX_OVRD_OUT 0x300e ++#define RAWLANE1_DIG_PCS_XF_RX_OVRD_OUT 0x310e ++#define RAWLANE2_DIG_PCS_XF_RX_OVRD_OUT 0x320e ++#define RAWLANE3_DIG_PCS_XF_RX_OVRD_OUT 0x330e ++#define PCS_ACK_WRITE_SELECT BIT(14) ++#define PCS_EN_CTL BIT(1) ++#define PCS_ACK BIT(0) ++ ++#define RAWLANE0_DIG_AON_FAST_FLAGS 0x305c ++#define RAWLANE1_DIG_AON_FAST_FLAGS 0x315c ++#define RAWLANE2_DIG_AON_FAST_FLAGS 0x325c ++#define RAWLANE3_DIG_AON_FAST_FLAGS 0x335c ++ ++/* HDMIRX Ctrler */ ++#define GLOBAL_SWRESET_REQUEST 0x0020 ++#define DATAPATH_SWRESETREQ BIT(12) ++#define GLOBAL_SWENABLE 0x0024 ++#define PHYCTRL_ENABLE BIT(21) ++#define CEC_ENABLE BIT(16) ++#define TMDS_ENABLE BIT(13) ++#define DATAPATH_ENABLE BIT(12) ++#define PKTFIFO_ENABLE BIT(11) ++#define AVPUNIT_ENABLE BIT(8) ++#define MAIN_ENABLE BIT(0) ++#define GLOBAL_TIMER_REF_BASE 0x0028 ++#define CORE_CONFIG 0x0050 ++#define CMU_CONFIG0 0x0060 ++#define TMDSQPCLK_STABLE_FREQ_MARGIN_MASK GENMASK(30, 16) ++#define TMDSQPCLK_STABLE_FREQ_MARGIN(x) UPDATE(x, 30, 16) ++#define AUDCLK_STABLE_FREQ_MARGIN_MASK GENMASK(11, 9) ++#define AUDCLK_STABLE_FREQ_MARGIN(x) UPDATE(x, 11, 9) ++#define CMU_STATUS 0x007c ++#define TMDSQPCLK_LOCKED_ST BIT(4) ++#define CMU_TMDSQPCLK_FREQ 0x0084 ++#define PHY_CONFIG 0x00c0 ++#define LDO_AFE_PROG_MASK GENMASK(24, 23) ++#define LDO_AFE_PROG(x) UPDATE(x, 24, 23) ++#define LDO_PWRDN BIT(21) ++#define TMDS_CLOCK_RATIO BIT(16) ++#define RXDATA_WIDTH BIT(15) ++#define REFFREQ_SEL_MASK GENMASK(11, 9) ++#define REFFREQ_SEL(x) UPDATE(x, 11, 9) ++#define HDMI_DISABLE BIT(8) ++#define PHY_PDDQ BIT(1) ++#define PHY_RESET BIT(0) ++#define PHY_STATUS 0x00c8 ++#define HDMI_DISABLE_ACK BIT(1) ++#define PDDQ_ACK BIT(0) ++#define PHYCREG_CONFIG0 0x00e0 ++#define PHYCREG_CR_PARA_SELECTION_MODE_MASK GENMASK(1, 0) ++#define PHYCREG_CR_PARA_SELECTION_MODE(x) UPDATE(x, 1, 0) ++#define PHYCREG_CONFIG1 0x00e4 ++#define PHYCREG_CONFIG2 0x00e8 ++#define PHYCREG_CONFIG3 0x00ec ++#define PHYCREG_CONTROL 0x00f0 ++#define PHYCREG_CR_PARA_WRITE_P BIT(1) ++#define PHYCREG_CR_PARA_READ_P BIT(0) ++#define PHYCREG_STATUS 0x00f4 ++ ++#define MAINUNIT_STATUS 0x0150 ++#define TMDSVALID_STABLE_ST BIT(1) ++#define DESCRAND_EN_CONTROL 0x0210 ++#define SCRAMB_EN_SEL_QST_MASK GENMASK(1, 0) ++#define SCRAMB_EN_SEL_QST(x) UPDATE(x, 1, 0) ++#define DESCRAND_SYNC_CONTROL 0x0214 ++#define RECOVER_UNSYNC_STREAM_QST BIT(0) ++#define DESCRAND_SYNC_SEQ_CONFIG 0x022c ++#define DESCRAND_SYNC_SEQ_ERR_CNT_EN BIT(0) ++#define DESCRAND_SYNC_SEQ_STATUS 0x0234 ++#define DEFRAMER_CONFIG0 0x0270 ++#define VS_CNT_THR_QST_MASK GENMASK(27, 20) ++#define VS_CNT_THR_QST(x) UPDATE(x, 27, 20) ++#define HS_POL_QST_MASK GENMASK(19, 18) ++#define HS_POL_QST(x) UPDATE(x, 19, 18) ++#define VS_POL_QST_MASK GENMASK(17, 16) ++#define VS_POL_QST(x) UPDATE(x, 17, 16) ++#define VS_REMAPFILTER_EN_QST BIT(8) ++#define VS_FILTER_ORDER_QST_MASK GENMASK(1, 0) ++#define VS_FILTER_ORDER_QST(x) UPDATE(x, 1, 0) ++#define DEFRAMER_VSYNC_CNT_CLEAR 0x0278 ++#define VSYNC_CNT_CLR_P BIT(0) ++#define DEFRAMER_STATUS 0x027c ++#define OPMODE_STS_MASK GENMASK(6, 4) ++#define I2C_SLAVE_CONFIG1 0x0164 ++#define I2C_SDA_OUT_HOLD_VALUE_QST_MASK GENMASK(15, 8) ++#define I2C_SDA_OUT_HOLD_VALUE_QST(x) UPDATE(x, 15, 8) ++#define I2C_SDA_IN_HOLD_VALUE_QST_MASK GENMASK(7, 0) ++#define I2C_SDA_IN_HOLD_VALUE_QST(x) UPDATE(x, 7, 0) ++#define OPMODE_STS_MASK GENMASK(6, 4) ++#define REPEATER_QST BIT(28) ++#define FASTREAUTH_QST BIT(27) ++#define FEATURES_1DOT1_QST BIT(26) ++#define FASTI2C_QST BIT(25) ++#define EESS_CTL_THR_QST_MASK GENMASK(19, 16) ++#define EESS_CTL_THR_QST(x) UPDATE(x, 19, 16) ++#define OESS_CTL3_THR_QST_MASK GENMASK(11, 8) ++#define OESS_CTL3_THR_QST(x) UPDATE(x, 11, 8) ++#define EESS_OESS_SEL_QST_MASK GENMASK(5, 4) ++#define EESS_OESS_SEL_QST(x) UPDATE(x, 5, 4) ++#define KEY_DECRYPT_EN_QST BIT(0) ++#define KEY_DECRYPT_SEED_QST_MASK GENMASK(15, 0) ++#define KEY_DECRYPT_SEED_QST(x) UPDATE(x, 15, 0) ++#define HDCP_INT_CLEAR 0x50d8 ++#define HDCP_1_INT_CLEAR 0x50e8 ++#define HDCP2_CONFIG 0x02f0 ++#define HDCP2_SWITCH_OVR_VALUE BIT(2) ++#define HDCP2_SWITCH_OVR_EN BIT(1) ++ ++#define VIDEO_CONFIG2 0x042c ++#define VPROC_VSYNC_POL_OVR_VALUE BIT(19) ++#define VPROC_VSYNC_POL_OVR_EN BIT(18) ++#define VPROC_HSYNC_POL_OVR_VALUE BIT(17) ++#define VPROC_HSYNC_POL_OVR_EN BIT(16) ++#define VPROC_FMT_OVR_VALUE_MASK GENMASK(6, 4) ++#define VPROC_FMT_OVR_VALUE(x) UPDATE(x, 6, 4) ++#define VPROC_FMT_OVR_EN BIT(0) ++ ++#define AFIFO_FILL_RESTART BIT(0) ++#define AFIFO_INIT_P BIT(0) ++#define AFIFO_THR_LOW_QST_MASK GENMASK(25, 16) ++#define AFIFO_THR_LOW_QST(x) UPDATE(x, 25, 16) ++#define AFIFO_THR_HIGH_QST_MASK GENMASK(9, 0) ++#define AFIFO_THR_HIGH_QST(x) UPDATE(x, 9, 0) ++#define AFIFO_THR_MUTE_LOW_QST_MASK GENMASK(25, 16) ++#define AFIFO_THR_MUTE_LOW_QST(x) UPDATE(x, 25, 16) ++#define AFIFO_THR_MUTE_HIGH_QST_MASK GENMASK(9, 0) ++#define AFIFO_THR_MUTE_HIGH_QST(x) UPDATE(x, 9, 0) ++ ++#define AFIFO_UNDERFLOW_ST BIT(25) ++#define AFIFO_OVERFLOW_ST BIT(24) ++ ++#define SPEAKER_ALLOC_OVR_EN BIT(16) ++#define I2S_BPCUV_EN BIT(4) ++#define SPDIF_EN BIT(2) ++#define I2S_EN BIT(1) ++#define AFIFO_THR_PASS_DEMUTEMASK_N BIT(24) ++#define AVMUTE_DEMUTEMASK_N BIT(16) ++#define AFIFO_THR_MUTE_LOW_MUTEMASK_N BIT(9) ++#define AFIFO_THR_MUTE_HIGH_MUTEMASK_N BIT(8) ++#define AVMUTE_MUTEMASK_N BIT(0) ++#define SCDC_CONFIG 0x0580 ++#define HPDLOW BIT(1) ++#define POWERPROVIDED BIT(0) ++#define SCDC_REGBANK_STATUS1 0x058c ++#define SCDC_TMDSBITCLKRATIO BIT(1) ++#define SCDC_REGBANK_STATUS3 0x0594 ++#define SCDC_REGBANK_CONFIG0 0x05c0 ++#define SCDC_SINKVERSION_QST_MASK GENMASK(7, 0) ++#define SCDC_SINKVERSION_QST(x) UPDATE(x, 7, 0) ++#define AGEN_LAYOUT BIT(4) ++#define AGEN_SPEAKER_ALLOC GENMASK(15, 8) ++ ++#define CED_CONFIG 0x0760 ++#define CED_VIDDATACHECKEN_QST BIT(27) ++#define CED_DATAISCHECKEN_QST BIT(26) ++#define CED_GBCHECKEN_QST BIT(25) ++#define CED_CTRLCHECKEN_QST BIT(24) ++#define CED_CHLOCKMAXER_QST_MASK GENMASK(14, 0) ++#define CED_CHLOCKMAXER_QST(x) UPDATE(x, 14, 0) ++#define CED_DYN_CONFIG 0x0768 ++#define CED_DYN_CONTROL 0x076c ++#define PKTEX_BCH_ERRFILT_CONFIG 0x07c4 ++#define PKTEX_CHKSUM_ERRFILT_CONFIG 0x07c8 ++ ++#define PKTDEC_ACR_PH2_1 0x1100 ++#define PKTDEC_ACR_PB3_0 0x1104 ++#define PKTDEC_ACR_PB7_4 0x1108 ++#define PKTDEC_AVIIF_PH2_1 0x1200 ++#define PKTDEC_AVIIF_PB3_0 0x1204 ++#define PKTDEC_AVIIF_PB7_4 0x1208 ++#define VIC_VAL_MASK GENMASK(6, 0) ++#define PKTDEC_AVIIF_PB11_8 0x120c ++#define PKTDEC_AVIIF_PB15_12 0x1210 ++#define PKTDEC_AVIIF_PB19_16 0x1214 ++#define PKTDEC_AVIIF_PB23_20 0x1218 ++#define PKTDEC_AVIIF_PB27_24 0x121c ++ ++#define PKTFIFO_CONFIG 0x1500 ++#define PKTFIFO_STORE_FILT_CONFIG 0x1504 ++#define PKTFIFO_THR_CONFIG0 0x1508 ++#define PKTFIFO_THR_CONFIG1 0x150c ++#define PKTFIFO_CONTROL 0x1510 ++ ++#define VMON_STATUS1 0x1580 ++#define VMON_STATUS2 0x1584 ++#define VMON_STATUS3 0x1588 ++#define VMON_STATUS4 0x158c ++#define VMON_STATUS5 0x1590 ++#define VMON_STATUS6 0x1594 ++#define VMON_STATUS7 0x1598 ++#define VMON_ILACE_DETECT BIT(4) ++ ++#define CEC_TX_CONTROL 0x2000 ++#define CEC_STATUS 0x2004 ++#define CEC_CONFIG 0x2008 ++#define RX_AUTO_DRIVE_ACKNOWLEDGE BIT(9) ++#define CEC_ADDR 0x200c ++#define CEC_TX_COUNT 0x2020 ++#define CEC_TX_DATA3_0 0x2024 ++#define CEC_RX_COUNT_STATUS 0x2040 ++#define CEC_RX_DATA3_0 0x2044 ++#define CEC_LOCK_CONTROL 0x2054 ++#define CEC_RXQUAL_BITTIME_CONFIG 0x2060 ++#define CEC_RX_BITTIME_CONFIG 0x2064 ++#define CEC_TX_BITTIME_CONFIG 0x2068 ++ ++#define DMA_CONFIG1 0x4400 ++#define UV_WID_MASK GENMASK(31, 28) ++#define UV_WID(x) UPDATE(x, 31, 28) ++#define Y_WID_MASK GENMASK(27, 24) ++#define Y_WID(x) UPDATE(x, 27, 24) ++#define DDR_STORE_FORMAT_MASK GENMASK(15, 12) ++#define DDR_STORE_FORMAT(x) UPDATE(x, 15, 12) ++#define ABANDON_EN BIT(0) ++#define DMA_CONFIG2 0x4404 ++#define DMA_CONFIG3 0x4408 ++#define DMA_CONFIG4 0x440c // dma irq en ++#define DMA_CONFIG5 0x4410 // dma irq clear status ++#define LINE_FLAG_INT_EN BIT(8) ++#define HDMIRX_DMA_IDLE_INT BIT(7) ++#define HDMIRX_LOCK_DISABLE_INT BIT(6) ++#define LAST_FRAME_AXI_UNFINISH_INT_EN BIT(5) ++#define FIFO_OVERFLOW_INT_EN BIT(2) ++#define FIFO_UNDERFLOW_INT_EN BIT(1) ++#define HDMIRX_AXI_ERROR_INT_EN BIT(0) ++#define DMA_CONFIG6 0x4414 ++#define RB_SWAP_EN BIT(9) ++#define HSYNC_TOGGLE_EN BIT(5) ++#define VSYNC_TOGGLE_EN BIT(4) ++#define HDMIRX_DMA_EN BIT(1) ++#define DMA_CONFIG7 0x4418 ++#define LINE_FLAG_NUM_MASK GENMASK(31, 16) ++#define LINE_FLAG_NUM(x) UPDATE(x, 31, 16) ++#define LOCK_FRAME_NUM_MASK GENMASK(11, 0) ++#define LOCK_FRAME_NUM(x) UPDATE(x, 11, 0) ++#define DMA_CONFIG8 0x441c ++#define REG_MIRROR_EN BIT(0) ++#define DMA_CONFIG9 0x4420 ++#define DMA_CONFIG10 0x4424 ++#define DMA_CONFIG11 0x4428 ++#define EDID_READ_EN_MASK BIT(8) ++#define EDID_READ_EN(x) UPDATE(x, 8, 8) ++#define EDID_WRITE_EN_MASK BIT(7) ++#define EDID_WRITE_EN(x) UPDATE(x, 7, 7) ++#define EDID_SLAVE_ADDR_MASK GENMASK(6, 0) ++#define EDID_SLAVE_ADDR(x) UPDATE(x, 6, 0) ++#define DMA_STATUS1 0x4430 // dma irq status ++#define DMA_STATUS2 0x4434 ++#define DMA_STATUS3 0x4438 ++#define DMA_STATUS4 0x443c ++#define DMA_STATUS5 0x4440 ++#define DMA_STATUS6 0x4444 ++#define DMA_STATUS7 0x4448 ++#define DMA_STATUS8 0x444c ++#define DMA_STATUS9 0x4450 ++#define DMA_STATUS10 0x4454 ++#define HDMIRX_LOCK BIT(3) ++#define DMA_STATUS11 0x4458 ++#define HDMIRX_TYPE_MASK GENMASK(8, 7) ++#define HDMIRX_COLOR_DEPTH_MASK GENMASK(6, 3) ++#define HDMIRX_FORMAT_MASK GENMASK(2, 0) ++#define DMA_STATUS12 0x445c ++#define DMA_STATUS13 0x4460 ++#define DMA_STATUS14 0x4464 ++ ++#define MAINUNIT_INTVEC_INDEX 0x5000 ++#define MAINUNIT_0_INT_STATUS 0x5010 ++#define CECRX_NOTIFY_ERR BIT(12) ++#define CECRX_EOM BIT(11) ++#define CECTX_DRIVE_ERR BIT(10) ++#define CECRX_BUSY BIT(9) ++#define CECTX_BUSY BIT(8) ++#define CECTX_FRAME_DISCARDED BIT(5) ++#define CECTX_NRETRANSMIT_FAIL BIT(4) ++#define CECTX_LINE_ERR BIT(3) ++#define CECTX_ARBLOST BIT(2) ++#define CECTX_NACK BIT(1) ++#define CECTX_DONE BIT(0) ++#define MAINUNIT_0_INT_MASK_N 0x5014 ++#define MAINUNIT_0_INT_CLEAR 0x5018 ++#define MAINUNIT_0_INT_FORCE 0x501c ++#define TIMER_BASE_LOCKED_IRQ BIT(26) ++#define TMDSQPCLK_OFF_CHG BIT(5) ++#define TMDSQPCLK_LOCKED_CHG BIT(4) ++#define MAINUNIT_1_INT_STATUS 0x5020 ++#define MAINUNIT_1_INT_MASK_N 0x5024 ++#define MAINUNIT_1_INT_CLEAR 0x5028 ++#define MAINUNIT_1_INT_FORCE 0x502c ++#define MAINUNIT_2_INT_STATUS 0x5030 ++#define MAINUNIT_2_INT_MASK_N 0x5034 ++#define MAINUNIT_2_INT_CLEAR 0x5038 ++#define MAINUNIT_2_INT_FORCE 0x503c ++#define PHYCREG_CR_READ_DONE BIT(11) ++#define PHYCREG_CR_WRITE_DONE BIT(10) ++#define TMDSVALID_STABLE_CHG BIT(1) ++ ++#define AVPUNIT_0_INT_STATUS 0x5040 ++#define AVPUNIT_0_INT_MASK_N 0x5044 ++#define AVPUNIT_0_INT_CLEAR 0x5048 ++#define AVPUNIT_0_INT_FORCE 0x504c ++#define CED_DYN_CNT_CH2_IRQ BIT(22) ++#define CED_DYN_CNT_CH1_IRQ BIT(21) ++#define CED_DYN_CNT_CH0_IRQ BIT(20) ++#define AVPUNIT_1_INT_STATUS 0x5050 ++#define DEFRAMER_VSYNC_THR_REACHED_IRQ BIT(1) ++#define AVPUNIT_1_INT_MASK_N 0x5054 ++#define DEFRAMER_VSYNC_THR_REACHED_MASK_N BIT(1) ++#define DEFRAMER_VSYNC_MASK_N BIT(0) ++#define AVPUNIT_1_INT_CLEAR 0x5058 ++#define DEFRAMER_VSYNC_THR_REACHED_CLEAR BIT(1) ++#define PKT_0_INT_STATUS 0x5080 ++#define PKTDEC_ACR_CHG_IRQ BIT(3) ++#define PKT_0_INT_MASK_N 0x5084 ++#define PKTDEC_ACR_CHG_MASK_N BIT(3) ++#define PKT_0_INT_CLEAR 0x5088 ++#define PKT_1_INT_STATUS 0x5090 ++#define PKT_1_INT_MASK_N 0x5094 ++#define PKT_1_INT_CLEAR 0x5098 ++#define PKT_2_INT_STATUS 0x50a0 ++#define PKTDEC_ACR_RCV_IRQ BIT(3) ++#define PKT_2_INT_MASK_N 0x50a4 ++#define PKTDEC_AVIIF_RCV_IRQ BIT(11) ++#define PKTDEC_ACR_RCV_MASK_N BIT(3) ++#define PKT_2_INT_CLEAR 0x50a8 ++#define PKTDEC_AVIIF_RCV_CLEAR BIT(11) ++#define PKTDEC_ACR_RCV_CLEAR BIT(3) ++#define SCDC_INT_STATUS 0x50c0 ++#define SCDC_INT_MASK_N 0x50c4 ++#define SCDC_INT_CLEAR 0x50c8 ++#define SCDCTMDSCCFG_CHG BIT(2) ++ ++#define CEC_INT_STATUS 0x5100 ++#define CEC_INT_MASK_N 0x5104 ++#define CEC_INT_CLEAR 0x5108 ++ ++#endif +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c +@@ -0,0 +1,285 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * ++ * Author: Shunqing Chen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "snps_hdmirx.h" ++#include "snps_hdmirx_cec.h" ++ ++static void hdmirx_cec_write(struct hdmirx_cec *cec, int reg, u32 val) ++{ ++ cec->ops->write(cec->hdmirx, reg, val); ++} ++ ++static u32 hdmirx_cec_read(struct hdmirx_cec *cec, int reg) ++{ ++ return cec->ops->read(cec->hdmirx, reg); ++} ++ ++static void hdmirx_cec_update_bits(struct hdmirx_cec *cec, int reg, u32 mask, ++ u32 data) ++{ ++ u32 val = hdmirx_cec_read(cec, reg) & ~mask; ++ ++ val |= (data & mask); ++ hdmirx_cec_write(cec, reg, val); ++} ++ ++static int hdmirx_cec_log_addr(struct cec_adapter *adap, u8 logical_addr) ++{ ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ ++ if (logical_addr == CEC_LOG_ADDR_INVALID) ++ cec->addresses = 0; ++ else ++ cec->addresses |= BIT(logical_addr) | BIT(15); ++ ++ hdmirx_cec_write(cec, CEC_ADDR, cec->addresses); ++ ++ return 0; ++} ++ ++/* signal_free_time is handled by the Synopsys Designware ++ * HDMIRX Controller hardware. ++ */ ++static int hdmirx_cec_transmit(struct cec_adapter *adap, u8 attempts, ++ u32 signal_free_time, struct cec_msg *msg) ++{ ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ u32 data[4] = {0}; ++ int i, data_len, msg_len; ++ ++ msg_len = msg->len; ++ ++ hdmirx_cec_write(cec, CEC_TX_COUNT, msg_len - 1); ++ for (i = 0; i < msg_len; i++) ++ data[i / 4] |= msg->msg[i] << (i % 4) * 8; ++ ++ data_len = DIV_ROUND_UP(msg_len, 4); ++ ++ for (i = 0; i < data_len; i++) ++ hdmirx_cec_write(cec, CEC_TX_DATA3_0 + i * 4, data[i]); ++ ++ hdmirx_cec_write(cec, CEC_TX_CONTROL, 0x1); ++ ++ return 0; ++} ++ ++static irqreturn_t hdmirx_cec_hardirq(int irq, void *data) ++{ ++ struct cec_adapter *adap = data; ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ u32 stat = hdmirx_cec_read(cec, CEC_INT_STATUS); ++ irqreturn_t ret = IRQ_HANDLED; ++ u32 val; ++ ++ if (!stat) ++ return IRQ_NONE; ++ ++ hdmirx_cec_write(cec, CEC_INT_CLEAR, stat); ++ ++ if (stat & CECTX_LINE_ERR) { ++ cec->tx_status = CEC_TX_STATUS_ERROR; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } else if (stat & CECTX_DONE) { ++ cec->tx_status = CEC_TX_STATUS_OK; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } else if (stat & CECTX_NACK) { ++ cec->tx_status = CEC_TX_STATUS_NACK; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } else if (stat & CECTX_ARBLOST) { ++ cec->tx_status = CEC_TX_STATUS_ARB_LOST; ++ cec->tx_done = true; ++ ret = IRQ_WAKE_THREAD; ++ } ++ ++ if (stat & CECRX_EOM) { ++ unsigned int len, i; ++ ++ val = hdmirx_cec_read(cec, CEC_RX_COUNT_STATUS); ++ /* rxbuffer locked status */ ++ if ((val & 0x80)) ++ return ret; ++ ++ len = (val & 0xf) + 1; ++ if (len > sizeof(cec->rx_msg.msg)) ++ len = sizeof(cec->rx_msg.msg); ++ ++ for (i = 0; i < len; i++) { ++ if (!(i % 4)) ++ val = hdmirx_cec_read(cec, CEC_RX_DATA3_0 + i / 4 * 4); ++ cec->rx_msg.msg[i] = (val >> ((i % 4) * 8)) & 0xff; ++ } ++ ++ cec->rx_msg.len = len; ++ smp_wmb(); /* receive RX msg */ ++ cec->rx_done = true; ++ hdmirx_cec_write(cec, CEC_LOCK_CONTROL, 0x1); ++ ++ ret = IRQ_WAKE_THREAD; ++ } ++ ++ return ret; ++} ++ ++static irqreturn_t hdmirx_cec_thread(int irq, void *data) ++{ ++ struct cec_adapter *adap = data; ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ ++ if (cec->tx_done) { ++ cec->tx_done = false; ++ cec_transmit_attempt_done(adap, cec->tx_status); ++ } ++ if (cec->rx_done) { ++ cec->rx_done = false; ++ smp_rmb(); /* RX msg has been received */ ++ cec_received_msg(adap, &cec->rx_msg); ++ } ++ ++ return IRQ_HANDLED; ++} ++ ++static int hdmirx_cec_enable(struct cec_adapter *adap, bool enable) ++{ ++ struct hdmirx_cec *cec = cec_get_drvdata(adap); ++ ++ if (!enable) { ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, 0); ++ hdmirx_cec_write(cec, CEC_INT_CLEAR, 0); ++ if (cec->ops->disable) ++ cec->ops->disable(cec->hdmirx); ++ } else { ++ unsigned int irqs; ++ ++ hdmirx_cec_log_addr(cec->adap, CEC_LOG_ADDR_INVALID); ++ if (cec->ops->enable) ++ cec->ops->enable(cec->hdmirx); ++ hdmirx_cec_update_bits(cec, GLOBAL_SWENABLE, CEC_ENABLE, CEC_ENABLE); ++ ++ irqs = CECTX_LINE_ERR | CECTX_NACK | CECRX_EOM | CECTX_DONE; ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, irqs); ++ } ++ ++ return 0; ++} ++ ++static const struct cec_adap_ops hdmirx_cec_ops = { ++ .adap_enable = hdmirx_cec_enable, ++ .adap_log_addr = hdmirx_cec_log_addr, ++ .adap_transmit = hdmirx_cec_transmit, ++}; ++ ++static void hdmirx_cec_del(void *data) ++{ ++ struct hdmirx_cec *cec = data; ++ ++ cec_delete_adapter(cec->adap); ++} ++ ++struct hdmirx_cec *snps_hdmirx_cec_register(struct hdmirx_cec_data *data) ++{ ++ struct hdmirx_cec *cec; ++ unsigned int irqs; ++ int ret; ++ ++ /* ++ * Our device is just a convenience - we want to link to the real ++ * hardware device here, so that userspace can see the association ++ * between the HDMI hardware and its associated CEC chardev. ++ */ ++ cec = devm_kzalloc(data->dev, sizeof(*cec), GFP_KERNEL); ++ if (!cec) ++ return NULL; ++ ++ cec->dev = data->dev; ++ cec->irq = data->irq; ++ cec->ops = data->ops; ++ cec->hdmirx = data->hdmirx; ++ ++ hdmirx_cec_update_bits(cec, GLOBAL_SWENABLE, CEC_ENABLE, CEC_ENABLE); ++ hdmirx_cec_update_bits(cec, CEC_CONFIG, RX_AUTO_DRIVE_ACKNOWLEDGE, ++ RX_AUTO_DRIVE_ACKNOWLEDGE); ++ ++ hdmirx_cec_write(cec, CEC_TX_COUNT, 0); ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, 0); ++ hdmirx_cec_write(cec, CEC_INT_CLEAR, ~0); ++ ++ cec->adap = cec_allocate_adapter(&hdmirx_cec_ops, cec, "snps-hdmirx", ++ CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | ++ CEC_CAP_RC | CEC_CAP_PASSTHROUGH | ++ CEC_CAP_MONITOR_ALL, ++ CEC_MAX_LOG_ADDRS); ++ if (IS_ERR(cec->adap)) { ++ dev_err(cec->dev, "cec adap allocate failed\n"); ++ return NULL; ++ } ++ ++ /* override the module pointer */ ++ cec->adap->owner = THIS_MODULE; ++ ++ ret = devm_add_action(cec->dev, hdmirx_cec_del, cec); ++ if (ret) { ++ cec_delete_adapter(cec->adap); ++ return NULL; ++ } ++ ++ irq_set_status_flags(cec->irq, IRQ_NOAUTOEN); ++ ++ ret = devm_request_threaded_irq(cec->dev, cec->irq, ++ hdmirx_cec_hardirq, ++ hdmirx_cec_thread, IRQF_ONESHOT, ++ "rk_hdmirx_cec", cec->adap); ++ if (ret) { ++ dev_err(cec->dev, "cec irq request failed\n"); ++ return NULL; ++ } ++ ++ cec->notify = cec_notifier_cec_adap_register(cec->dev, ++ NULL, cec->adap); ++ if (!cec->notify) { ++ dev_err(cec->dev, "cec notify register failed\n"); ++ return NULL; ++ } ++ ++ ret = cec_register_adapter(cec->adap, cec->dev); ++ if (ret < 0) { ++ dev_err(cec->dev, "cec register adapter failed\n"); ++ cec_unregister_adapter(cec->adap); ++ return NULL; ++ } ++ ++ irqs = CECTX_LINE_ERR | CECTX_NACK | CECRX_EOM | CECTX_DONE; ++ hdmirx_cec_write(cec, CEC_INT_MASK_N, irqs); ++ ++ /* ++ * CEC documentation says we must not call cec_delete_adapter ++ * after a successful call to cec_register_adapter(). ++ */ ++ devm_remove_action(cec->dev, hdmirx_cec_del, cec); ++ ++ enable_irq(cec->irq); ++ ++ return cec; ++} ++ ++void snps_hdmirx_cec_unregister(struct hdmirx_cec *cec) ++{ ++ disable_irq(cec->irq); ++ ++ cec_unregister_adapter(cec->adap); ++} +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h +@@ -0,0 +1,44 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (c) 2021 Rockchip Electronics Co. Ltd. ++ * ++ * Author: Shunqing Chen ++ */ ++ ++#ifndef DW_HDMI_RX_CEC_H ++#define DW_HDMI_RX_CEC_H ++ ++struct snps_hdmirx_dev; ++ ++struct hdmirx_cec_ops { ++ void (*write)(struct snps_hdmirx_dev *hdmirx_dev, int reg, u32 val); ++ u32 (*read)(struct snps_hdmirx_dev *hdmirx_dev, int reg); ++ void (*enable)(struct snps_hdmirx_dev *hdmirx); ++ void (*disable)(struct snps_hdmirx_dev *hdmirx); ++}; ++ ++struct hdmirx_cec_data { ++ struct snps_hdmirx_dev *hdmirx; ++ const struct hdmirx_cec_ops *ops; ++ struct device *dev; ++ int irq; ++}; ++ ++struct hdmirx_cec { ++ struct snps_hdmirx_dev *hdmirx; ++ struct device *dev; ++ const struct hdmirx_cec_ops *ops; ++ u32 addresses; ++ struct cec_adapter *adap; ++ struct cec_msg rx_msg; ++ unsigned int tx_status; ++ bool tx_done; ++ bool rx_done; ++ struct cec_notifier *notify; ++ int irq; ++}; ++ ++struct hdmirx_cec *snps_hdmirx_cec_register(struct hdmirx_cec_data *data); ++void snps_hdmirx_cec_unregister(struct hdmirx_cec *cec); ++ ++#endif /* DW_HDMI_RX_CEC_H */ +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Mon, 29 Jul 2024 17:29:46 +0200 +Subject: arm64: defconfig: Enable Synopsys HDMI receiver + +The Rockchip RK3588 has a built-in HDMI receiver block from +Synopsys. Let's enable the driver for it. + +Signed-off-by: Sebastian Reichel +--- + arch/arm64/configs/defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig +index 111111111111..222222222222 100644 +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -840,6 +840,7 @@ CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m + CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m + CONFIG_VIDEO_SAMSUNG_S5P_MFC=m + CONFIG_VIDEO_SUN6I_CSI=m ++CONFIG_VIDEO_SYNOPSYS_HDMIRX=m + CONFIG_VIDEO_TI_J721E_CSI2RX=m + CONFIG_VIDEO_HANTRO=m + CONFIG_VIDEO_IMX219=m +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Thu, 1 Aug 2024 16:47:35 +0300 +Subject: comment v4l2 error on hdmirx + +--- + drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +index 111111111111..222222222222 100644 +--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c ++++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c +@@ -1180,7 +1180,7 @@ static int hdmirx_wait_lock_and_get_timing(struct snps_hdmirx_dev *hdmirx_dev) + break; + + if (!tx_5v_power_present(hdmirx_dev)) { +- v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__); ++ //v4l2_err(v4l2_dev, "%s: HDMI pull out, return\n", __func__); + return -1; + } + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0130-phy-phy-rockchip-samsung-hdptx-Enable-runtime-PM.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0130-phy-phy-rockchip-samsung-hdptx-Enable-runtime-PM.patch new file mode 100644 index 000000000000..7efdc0b75ec1 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0130-phy-phy-rockchip-samsung-hdptx-Enable-runtime-PM.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Tue, 11 Jun 2024 02:06:10 +0300 +Subject: phy: phy-rockchip-samsung-hdptx: Explicitly include pm_runtime.h + +Driver makes use of helpers from pm_runtime.h, but relies on the header +file being implicitly included. + +Explicitly pull the header in to avoid potential build failures in some +configurations. + +Fixes: 553be2830c5f ("phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver") +Signed-off-by: Cristian Ciocaltea +--- + drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +index 111111111111..222222222222 100644 +--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c ++++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Tue, 11 Jun 2024 02:28:26 +0300 +Subject: phy: phy-rockchip-samsung-hdptx: Enable runtime PM at PHY core level + +When a new PHY is created via [devm_]phy_create(), the runtime PM for it +is not enabled unless the parent device (which creates the PHY) has its +own runtime PM already enabled. + +Move the call to devm_pm_runtime_enable() before devm_phy_create() to +enable runtime PM at PHY core level. + +With this change the ->power_on() and ->power_off() callbacks do not +require explicit runtime PM management anymore, since the PHY core +handles that via phy_pm_runtime_{get,put}_sync() when phy_power_on() and +phy_power_off() are invoked. + +Hence drop the now unnecessary calls to pm_runtime_resume_and_get() and +pm_runtime_put() helpers. + +Signed-off-by: Cristian Ciocaltea +--- + drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 24 +++------- + 1 file changed, 6 insertions(+), 18 deletions(-) + +diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +index 111111111111..222222222222 100644 +--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c ++++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +@@ -860,7 +860,7 @@ static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx, + static int rk_hdptx_phy_power_on(struct phy *phy) + { + struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy); +- int ret, bus_width = phy_get_bus_width(hdptx->phy); ++ int bus_width = phy_get_bus_width(hdptx->phy); + /* + * FIXME: Temporary workaround to pass pixel_clk_rate + * from the HDMI bridge driver until phy_configure_opts_hdmi +@@ -871,17 +871,7 @@ static int rk_hdptx_phy_power_on(struct phy *phy) + dev_dbg(hdptx->dev, "%s bus_width=%x rate=%u\n", + __func__, bus_width, rate); + +- ret = pm_runtime_resume_and_get(hdptx->dev); +- if (ret) { +- dev_err(hdptx->dev, "Failed to resume phy: %d\n", ret); +- return ret; +- } +- +- ret = rk_hdptx_ropll_tmds_mode_config(hdptx, rate); +- if (ret) +- pm_runtime_put(hdptx->dev); +- +- return ret; ++ return rk_hdptx_ropll_tmds_mode_config(hdptx, rate); + } + + static int rk_hdptx_phy_power_off(struct phy *phy) +@@ -894,8 +884,6 @@ static int rk_hdptx_phy_power_off(struct phy *phy) + if (ret == 0 && (val & HDPTX_O_PLL_LOCK_DONE)) + rk_hdptx_phy_disable(hdptx); + +- pm_runtime_put(hdptx->dev); +- + return ret; + } + +@@ -977,6 +965,10 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev) + return dev_err_probe(dev, PTR_ERR(hdptx->grf), + "Could not get GRF syscon\n"); + ++ ret = devm_pm_runtime_enable(dev); ++ if (ret) ++ return dev_err_probe(dev, ret, "Failed to enable runtime PM\n"); ++ + hdptx->phy = devm_phy_create(dev, NULL, &rk_hdptx_phy_ops); + if (IS_ERR(hdptx->phy)) + return dev_err_probe(dev, PTR_ERR(hdptx->phy), +@@ -986,10 +978,6 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev) + phy_set_drvdata(hdptx->phy, hdptx); + phy_set_bus_width(hdptx->phy, 8); + +- ret = devm_pm_runtime_enable(dev); +- if (ret) +- return dev_err_probe(dev, ret, "Failed to enable runtime PM\n"); +- + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return dev_err_probe(dev, PTR_ERR(phy_provider), +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0131-phy-phy-rockchip-samsung-hdptx-Add-clock-provider.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0131-phy-phy-rockchip-samsung-hdptx-Add-clock-provider.patch new file mode 100644 index 000000000000..721cf796ee3d --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0131-phy-phy-rockchip-samsung-hdptx-Add-clock-provider.patch @@ -0,0 +1,323 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Mon, 19 Feb 2024 21:53:24 +0200 +Subject: dt-bindings: phy: rockchip,rk3588-hdptx-phy: Add #clock-cells + +The HDMI PHY can be used as a clock provider on RK3588 SoC, hence add +the necessary '#clock-cells' property. + +Signed-off-by: Cristian Ciocaltea +--- + Documentation/devicetree/bindings/phy/rockchip,rk3588-hdptx-phy.yaml | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Documentation/devicetree/bindings/phy/rockchip,rk3588-hdptx-phy.yaml b/Documentation/devicetree/bindings/phy/rockchip,rk3588-hdptx-phy.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/phy/rockchip,rk3588-hdptx-phy.yaml ++++ b/Documentation/devicetree/bindings/phy/rockchip,rk3588-hdptx-phy.yaml +@@ -27,6 +27,9 @@ properties: + - const: ref + - const: apb + ++ "#clock-cells": ++ const: 0 ++ + "#phy-cells": + const: 0 + +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Tue, 16 Jan 2024 19:27:40 +0200 +Subject: phy: phy-rockchip-samsung-hdptx: Add clock provider support + +The HDMI PHY PLL can be used as an alternative dclk source to RK3588 SoC +CRU. It provides more accurate clock rates required by VOP2 to improve +existing support for display modes handling, which is known to be +problematic when dealing with non-integer refresh rates, among others. + +It is worth noting this only works for HDMI 2.0 or below, e.g. cannot be +used to support HDMI 2.1 4K@120Hz mode. + +Signed-off-by: Cristian Ciocaltea +--- + drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 195 ++++++++-- + 1 file changed, 173 insertions(+), 22 deletions(-) + +diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +index 111111111111..222222222222 100644 +--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c ++++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +@@ -8,6 +8,7 @@ + */ + #include + #include ++#include + #include + #include + #include +@@ -191,6 +192,8 @@ + #define LN3_TX_SER_RATE_SEL_HBR2 BIT(3) + #define LN3_TX_SER_RATE_SEL_HBR3 BIT(2) + ++#define HDMI20_MAX_RATE 600000000 ++ + struct lcpll_config { + u32 bit_rate; + u8 lcvco_mode_en; +@@ -273,6 +276,12 @@ struct rk_hdptx_phy { + struct clk_bulk_data *clks; + int nr_clks; + struct reset_control_bulk_data rsts[RST_MAX]; ++ ++ /* clk provider */ ++ struct clk_hw hw; ++ unsigned long rate; ++ ++ atomic_t usage_count; + }; + + static const struct ropll_config ropll_tmds_cfg[] = { +@@ -760,6 +769,8 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx, + struct ropll_config rc = {0}; + int i; + ++ hdptx->rate = rate * 100; ++ + for (i = 0; i < ARRAY_SIZE(ropll_tmds_cfg); i++) + if (rate == ropll_tmds_cfg[i].bit_rate) { + cfg = &ropll_tmds_cfg[i]; +@@ -823,19 +834,6 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx, + static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx, + unsigned int rate) + { +- u32 val; +- int ret; +- +- ret = regmap_read(hdptx->grf, GRF_HDPTX_STATUS, &val); +- if (ret) +- return ret; +- +- if (!(val & HDPTX_O_PLL_LOCK_DONE)) { +- ret = rk_hdptx_ropll_tmds_cmn_config(hdptx, rate); +- if (ret) +- return ret; +- } +- + rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_sb_init_seq); + + regmap_write(hdptx->regmap, LNTOP_REG(0200), 0x06); +@@ -857,10 +855,68 @@ static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx, + return rk_hdptx_post_enable_lane(hdptx); + } + ++static int rk_hdptx_phy_consumer_get(struct rk_hdptx_phy *hdptx, ++ unsigned int rate) ++{ ++ u32 status; ++ int ret; ++ ++ if (atomic_inc_return(&hdptx->usage_count) > 1) ++ return 0; ++ ++ ret = regmap_read(hdptx->grf, GRF_HDPTX_STATUS, &status); ++ if (ret) ++ goto dec_usage; ++ ++ if (status & HDPTX_O_PLL_LOCK_DONE) ++ dev_warn(hdptx->dev, "PLL locked by unknown consumer!\n"); ++ ++ if (rate) { ++ ret = rk_hdptx_ropll_tmds_cmn_config(hdptx, rate); ++ if (ret) ++ goto dec_usage; ++ } ++ ++ return 0; ++ ++dec_usage: ++ atomic_dec(&hdptx->usage_count); ++ return ret; ++} ++ ++static int rk_hdptx_phy_consumer_put(struct rk_hdptx_phy *hdptx, bool force) ++{ ++ u32 status; ++ int ret; ++ ++ ret = atomic_dec_return(&hdptx->usage_count); ++ if (ret > 0) ++ return 0; ++ ++ if (ret < 0) { ++ dev_warn(hdptx->dev, "Usage count underflow!\n"); ++ ret = -EINVAL; ++ } else { ++ ret = regmap_read(hdptx->grf, GRF_HDPTX_STATUS, &status); ++ if (!ret) { ++ if (status & HDPTX_O_PLL_LOCK_DONE) ++ rk_hdptx_phy_disable(hdptx); ++ return 0; ++ } else if (force) { ++ return 0; ++ } ++ } ++ ++ atomic_inc(&hdptx->usage_count); ++ return ret; ++} ++ + static int rk_hdptx_phy_power_on(struct phy *phy) + { + struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy); + int bus_width = phy_get_bus_width(hdptx->phy); ++ int ret; ++ + /* + * FIXME: Temporary workaround to pass pixel_clk_rate + * from the HDMI bridge driver until phy_configure_opts_hdmi +@@ -871,20 +927,22 @@ static int rk_hdptx_phy_power_on(struct phy *phy) + dev_dbg(hdptx->dev, "%s bus_width=%x rate=%u\n", + __func__, bus_width, rate); + +- return rk_hdptx_ropll_tmds_mode_config(hdptx, rate); ++ ret = rk_hdptx_phy_consumer_get(hdptx, rate); ++ if (ret) ++ return ret; ++ ++ ret = rk_hdptx_ropll_tmds_mode_config(hdptx, rate); ++ if (ret) ++ rk_hdptx_phy_consumer_put(hdptx, true); ++ ++ return ret; + } + + static int rk_hdptx_phy_power_off(struct phy *phy) + { + struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy); +- u32 val; +- int ret; + +- ret = regmap_read(hdptx->grf, GRF_HDPTX_STATUS, &val); +- if (ret == 0 && (val & HDPTX_O_PLL_LOCK_DONE)) +- rk_hdptx_phy_disable(hdptx); +- +- return ret; ++ return rk_hdptx_phy_consumer_put(hdptx, false); + } + + static const struct phy_ops rk_hdptx_phy_ops = { +@@ -893,6 +951,99 @@ static const struct phy_ops rk_hdptx_phy_ops = { + .owner = THIS_MODULE, + }; + ++static struct rk_hdptx_phy *to_rk_hdptx_phy(struct clk_hw *hw) ++{ ++ return container_of(hw, struct rk_hdptx_phy, hw); ++} ++ ++static int rk_hdptx_phy_clk_prepare(struct clk_hw *hw) ++{ ++ struct rk_hdptx_phy *hdptx = to_rk_hdptx_phy(hw); ++ ++ return rk_hdptx_phy_consumer_get(hdptx, hdptx->rate / 100); ++} ++ ++static void rk_hdptx_phy_clk_unprepare(struct clk_hw *hw) ++{ ++ struct rk_hdptx_phy *hdptx = to_rk_hdptx_phy(hw); ++ ++ rk_hdptx_phy_consumer_put(hdptx, true); ++} ++ ++static unsigned long rk_hdptx_phy_clk_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ struct rk_hdptx_phy *hdptx = to_rk_hdptx_phy(hw); ++ ++ return hdptx->rate; ++} ++ ++static long rk_hdptx_phy_clk_round_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long *parent_rate) ++{ ++ u32 bit_rate = rate / 100; ++ int i; ++ ++ if (rate > HDMI20_MAX_RATE) ++ return rate; ++ ++ for (i = 0; i < ARRAY_SIZE(ropll_tmds_cfg); i++) ++ if (bit_rate == ropll_tmds_cfg[i].bit_rate) ++ break; ++ ++ if (i == ARRAY_SIZE(ropll_tmds_cfg) && ++ !rk_hdptx_phy_clk_pll_calc(bit_rate, NULL)) ++ return -EINVAL; ++ ++ return rate; ++} ++ ++static int rk_hdptx_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long parent_rate) ++{ ++ struct rk_hdptx_phy *hdptx = to_rk_hdptx_phy(hw); ++ ++ return rk_hdptx_ropll_tmds_cmn_config(hdptx, rate / 100); ++} ++ ++static const struct clk_ops hdptx_phy_clk_ops = { ++ .prepare = rk_hdptx_phy_clk_prepare, ++ .unprepare = rk_hdptx_phy_clk_unprepare, ++ .recalc_rate = rk_hdptx_phy_clk_recalc_rate, ++ .round_rate = rk_hdptx_phy_clk_round_rate, ++ .set_rate = rk_hdptx_phy_clk_set_rate, ++}; ++ ++static int rk_hdptx_phy_clk_register(struct rk_hdptx_phy *hdptx) ++{ ++ struct device *dev = hdptx->dev; ++ const char *name, *pname; ++ struct clk *refclk; ++ int ret, id; ++ ++ refclk = devm_clk_get(dev, "ref"); ++ if (IS_ERR(refclk)) ++ return dev_err_probe(dev, PTR_ERR(refclk), ++ "Failed to get ref clock\n"); ++ ++ id = of_alias_get_id(dev->of_node, "hdptxphy"); ++ name = id > 0 ? "clk_hdmiphy_pixel1" : "clk_hdmiphy_pixel0"; ++ pname = __clk_get_name(refclk); ++ ++ hdptx->hw.init = CLK_HW_INIT(name, pname, &hdptx_phy_clk_ops, ++ CLK_GET_RATE_NOCACHE); ++ ++ ret = devm_clk_hw_register(dev, &hdptx->hw); ++ if (ret) ++ return dev_err_probe(dev, ret, "Failed to register clock\n"); ++ ++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &hdptx->hw); ++ if (ret) ++ return dev_err_probe(dev, ret, ++ "Failed to register clk provider\n"); ++ return 0; ++} ++ + static int rk_hdptx_phy_runtime_suspend(struct device *dev) + { + struct rk_hdptx_phy *hdptx = dev_get_drvdata(dev); +@@ -987,7 +1138,7 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev) + reset_control_deassert(hdptx->rsts[RST_CMN].rstc); + reset_control_deassert(hdptx->rsts[RST_INIT].rstc); + +- return 0; ++ return rk_hdptx_phy_clk_register(hdptx); + } + + static const struct dev_pm_ops rk_hdptx_phy_pm_ops = { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0132-phy-phy-rockchip-samsung-hdptx-Add-FRL-EARC-support.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0132-phy-phy-rockchip-samsung-hdptx-Add-FRL-EARC-support.patch new file mode 100644 index 000000000000..2f76a087e845 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0132-phy-phy-rockchip-samsung-hdptx-Add-FRL-EARC-support.patch @@ -0,0 +1,547 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Mon, 5 Feb 2024 01:38:48 +0200 +Subject: [WIP] phy: phy-rockchip-samsung-hdptx: Add FRL & EARC support + +For upstreaming, this requires extending the standard PHY API to support +HDMI configuration options [1]. + +Currently, the bus_width PHY attribute is used to pass clock rate and +flags for 10-bit color depth, FRL and EARC. This is done by the HDMI +bridge driver via phy_set_bus_width(). + +[1]: https://lore.kernel.org/all/20240306101625.795732-3-alexander.stein@ew.tq-group.com/ + +Signed-off-by: Cristian Ciocaltea +--- + drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 428 +++++++++- + 1 file changed, 426 insertions(+), 2 deletions(-) + +diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +index 111111111111..222222222222 100644 +--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c ++++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +@@ -193,6 +193,10 @@ + #define LN3_TX_SER_RATE_SEL_HBR3 BIT(2) + + #define HDMI20_MAX_RATE 600000000 ++#define DATA_RATE_MASK 0xFFFFFFF ++#define COLOR_DEPTH_MASK BIT(31) ++#define HDMI_MODE_MASK BIT(30) ++#define HDMI_EARC_MASK BIT(29) + + struct lcpll_config { + u32 bit_rate; +@@ -276,6 +280,7 @@ struct rk_hdptx_phy { + struct clk_bulk_data *clks; + int nr_clks; + struct reset_control_bulk_data rsts[RST_MAX]; ++ bool earc_en; + + /* clk provider */ + struct clk_hw hw; +@@ -284,6 +289,24 @@ struct rk_hdptx_phy { + atomic_t usage_count; + }; + ++static const struct lcpll_config lcpll_cfg[] = { ++ { 48000000, 1, 0, 0, 0x7d, 0x7d, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, ++ 0, 0x13, 0x18, 1, 0, 0x20, 0x0c, 1, 0, }, ++ { 40000000, 1, 1, 0, 0x68, 0x68, 1, 1, 0, 0, 0, 1, 1, 1, 1, 9, 0, 1, 1, ++ 0, 2, 3, 1, 0, 0x20, 0x0c, 1, 0, }, ++ { 32000000, 1, 1, 1, 0x6b, 0x6b, 1, 1, 0, 1, 2, 1, 1, 1, 1, 9, 1, 2, 1, ++ 0, 0x0d, 0x18, 1, 0, 0x20, 0x0c, 1, 1, }, ++}; ++ ++static const struct ropll_config ropll_frl_cfg[] = { ++ { 24000000, 0x19, 0x19, 1, 1, 0, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, ++ 0, 0, 0x20, 0x0c, 1, 0x0e, 0, 0, }, ++ { 18000000, 0x7d, 0x7d, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, ++ 0, 0, 0x20, 0x0c, 1, 0x0e, 0, 0, }, ++ { 9000000, 0x7d, 0x7d, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, ++ 0, 0, 0x20, 0x0c, 1, 0x0e, 0, 0, }, ++}; ++ + static const struct ropll_config ropll_tmds_cfg[] = { + { 5940000, 124, 124, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 62, 1, 16, 5, 0, + 1, 1, 0, 0x20, 0x0c, 1, 0x0e, 0, 0, }, +@@ -459,6 +482,73 @@ static const struct reg_sequence rk_hdtpx_tmds_cmn_init_seq[] = { + REG_SEQ0(CMN_REG(009b), 0x00), + }; + ++static const struct reg_sequence rk_hdtpx_frl_cmn_init_seq[] = { ++ REG_SEQ0(CMN_REG(0011), 0x00), ++ REG_SEQ0(CMN_REG(0017), 0x00), ++ REG_SEQ0(CMN_REG(0026), 0x53), ++ REG_SEQ0(CMN_REG(0030), 0x00), ++ REG_SEQ0(CMN_REG(0031), 0x20), ++ REG_SEQ0(CMN_REG(0032), 0x30), ++ REG_SEQ0(CMN_REG(0033), 0x0b), ++ REG_SEQ0(CMN_REG(0034), 0x23), ++ REG_SEQ0(CMN_REG(0042), 0xb8), ++ REG_SEQ0(CMN_REG(004e), 0x14), ++ REG_SEQ0(CMN_REG(0074), 0x00), ++ REG_SEQ0(CMN_REG(0081), 0x09), ++ REG_SEQ0(CMN_REG(0086), 0x01), ++ REG_SEQ0(CMN_REG(0087), 0x0c), ++ REG_SEQ0(CMN_REG(009b), 0x10), ++}; ++ ++static const struct reg_sequence rk_hdtpx_frl_ropll_cmn_init_seq[] = { ++ REG_SEQ0(CMN_REG(0008), 0x00), ++ REG_SEQ0(CMN_REG(001e), 0x14), ++ REG_SEQ0(CMN_REG(0020), 0x00), ++ REG_SEQ0(CMN_REG(0021), 0x00), ++ REG_SEQ0(CMN_REG(0022), 0x11), ++ REG_SEQ0(CMN_REG(0023), 0x00), ++ REG_SEQ0(CMN_REG(0025), 0x00), ++ REG_SEQ0(CMN_REG(0027), 0x00), ++ REG_SEQ0(CMN_REG(0028), 0x00), ++ REG_SEQ0(CMN_REG(002a), 0x01), ++ REG_SEQ0(CMN_REG(002b), 0x00), ++ REG_SEQ0(CMN_REG(002c), 0x00), ++ REG_SEQ0(CMN_REG(002d), 0x00), ++ REG_SEQ0(CMN_REG(002e), 0x00), ++ REG_SEQ0(CMN_REG(002f), 0x04), ++ REG_SEQ0(CMN_REG(003d), 0x40), ++ REG_SEQ0(CMN_REG(005c), 0x25), ++ REG_SEQ0(CMN_REG(0089), 0x00), ++ REG_SEQ0(CMN_REG(0094), 0x00), ++ REG_SEQ0(CMN_REG(0097), 0x02), ++ REG_SEQ0(CMN_REG(0099), 0x04), ++}; ++ ++static const struct reg_sequence rk_hdtpx_frl_lcpll_cmn_init_seq[] = { ++ REG_SEQ0(CMN_REG(0025), 0x10), ++ REG_SEQ0(CMN_REG(0027), 0x01), ++ REG_SEQ0(CMN_REG(0028), 0x0d), ++ REG_SEQ0(CMN_REG(002e), 0x02), ++ REG_SEQ0(CMN_REG(002f), 0x0d), ++ REG_SEQ0(CMN_REG(003d), 0x00), ++ REG_SEQ0(CMN_REG(0051), 0x00), ++ REG_SEQ0(CMN_REG(0055), 0x00), ++ REG_SEQ0(CMN_REG(0059), 0x11), ++ REG_SEQ0(CMN_REG(005a), 0x03), ++ REG_SEQ0(CMN_REG(005c), 0x05), ++ REG_SEQ0(CMN_REG(005e), 0x07), ++ REG_SEQ0(CMN_REG(0060), 0x01), ++ REG_SEQ0(CMN_REG(0064), 0x07), ++ REG_SEQ0(CMN_REG(0065), 0x00), ++ REG_SEQ0(CMN_REG(0069), 0x00), ++ REG_SEQ0(CMN_REG(006c), 0x00), ++ REG_SEQ0(CMN_REG(0070), 0x01), ++ REG_SEQ0(CMN_REG(0089), 0x02), ++ REG_SEQ0(CMN_REG(0095), 0x00), ++ REG_SEQ0(CMN_REG(0097), 0x00), ++ REG_SEQ0(CMN_REG(0099), 0x00), ++}; ++ + static const struct reg_sequence rk_hdtpx_common_sb_init_seq[] = { + REG_SEQ0(SB_REG(0114), 0x00), + REG_SEQ0(SB_REG(0115), 0x00), +@@ -482,6 +572,17 @@ static const struct reg_sequence rk_hdtpx_tmds_lntop_lowbr_seq[] = { + REG_SEQ0(LNTOP_REG(0205), 0x1f), + }; + ++static const struct reg_sequence rk_hdtpx_frl_lntop_init_seq[] = { ++ REG_SEQ0(LNTOP_REG(0200), 0x04), ++ REG_SEQ0(LNTOP_REG(0201), 0x00), ++ REG_SEQ0(LNTOP_REG(0202), 0x00), ++ REG_SEQ0(LNTOP_REG(0203), 0xf0), ++ REG_SEQ0(LNTOP_REG(0204), 0xff), ++ REG_SEQ0(LNTOP_REG(0205), 0xff), ++ REG_SEQ0(LNTOP_REG(0206), 0x05), ++ REG_SEQ0(LNTOP_REG(0207), 0x0f), ++}; ++ + static const struct reg_sequence rk_hdtpx_common_lane_init_seq[] = { + REG_SEQ0(LANE_REG(0303), 0x0c), + REG_SEQ0(LANE_REG(0307), 0x20), +@@ -560,6 +661,40 @@ static const struct reg_sequence rk_hdtpx_tmds_lane_init_seq[] = { + REG_SEQ0(LANE_REG(0606), 0x1c), + }; + ++static const struct reg_sequence rk_hdtpx_frl_ropll_lane_init_seq[] = { ++ REG_SEQ0(LANE_REG(0312), 0x3c), ++ REG_SEQ0(LANE_REG(0412), 0x3c), ++ REG_SEQ0(LANE_REG(0512), 0x3c), ++ REG_SEQ0(LANE_REG(0612), 0x3c), ++}; ++ ++static const struct reg_sequence rk_hdtpx_frl_lcpll_lane_init_seq[] = { ++ REG_SEQ0(LANE_REG(0312), 0x3c), ++ REG_SEQ0(LANE_REG(0412), 0x3c), ++ REG_SEQ0(LANE_REG(0512), 0x3c), ++ REG_SEQ0(LANE_REG(0612), 0x3c), ++ REG_SEQ0(LANE_REG(0303), 0x2f), ++ REG_SEQ0(LANE_REG(0403), 0x2f), ++ REG_SEQ0(LANE_REG(0503), 0x2f), ++ REG_SEQ0(LANE_REG(0603), 0x2f), ++ REG_SEQ0(LANE_REG(0305), 0x03), ++ REG_SEQ0(LANE_REG(0405), 0x03), ++ REG_SEQ0(LANE_REG(0505), 0x03), ++ REG_SEQ0(LANE_REG(0605), 0x03), ++ REG_SEQ0(LANE_REG(0306), 0xfc), ++ REG_SEQ0(LANE_REG(0406), 0xfc), ++ REG_SEQ0(LANE_REG(0506), 0xfc), ++ REG_SEQ0(LANE_REG(0606), 0xfc), ++ REG_SEQ0(LANE_REG(0305), 0x4f), ++ REG_SEQ0(LANE_REG(0405), 0x4f), ++ REG_SEQ0(LANE_REG(0505), 0x4f), ++ REG_SEQ0(LANE_REG(0605), 0x4f), ++ REG_SEQ0(LANE_REG(0304), 0x14), ++ REG_SEQ0(LANE_REG(0404), 0x14), ++ REG_SEQ0(LANE_REG(0504), 0x14), ++ REG_SEQ0(LANE_REG(0604), 0x14), ++}; ++ + static bool rk_hdptx_phy_is_rw_reg(struct device *dev, unsigned int reg) + { + switch (reg) { +@@ -661,6 +796,47 @@ static int rk_hdptx_post_enable_pll(struct rk_hdptx_phy *hdptx) + return 0; + } + ++static int rk_hdptx_post_power_up(struct rk_hdptx_phy *hdptx) ++{ ++ u32 val; ++ int ret; ++ ++ val = (HDPTX_I_BIAS_EN | HDPTX_I_BGR_EN) << 16 | ++ HDPTX_I_BIAS_EN | HDPTX_I_BGR_EN; ++ regmap_write(hdptx->grf, GRF_HDPTX_CON0, val); ++ ++ usleep_range(10, 15); ++ reset_control_deassert(hdptx->rsts[RST_INIT].rstc); ++ ++ usleep_range(10, 15); ++ val = HDPTX_I_PLL_EN << 16 | HDPTX_I_PLL_EN; ++ regmap_write(hdptx->grf, GRF_HDPTX_CON0, val); ++ ++ usleep_range(10, 15); ++ reset_control_deassert(hdptx->rsts[RST_CMN].rstc); ++ ++ ret = regmap_read_poll_timeout(hdptx->grf, GRF_HDPTX_STATUS, val, ++ val & HDPTX_O_PLL_LOCK_DONE, 20, 400); ++ if (ret) { ++ dev_err(hdptx->dev, "Failed to get PHY PLL lock: %d\n", ret); ++ return ret; ++ } ++ ++ usleep_range(20, 30); ++ reset_control_deassert(hdptx->rsts[RST_LANE].rstc); ++ ++ ret = regmap_read_poll_timeout(hdptx->grf, GRF_HDPTX_STATUS, val, ++ val & HDPTX_O_PHY_RDY, 100, 5000); ++ if (ret) { ++ dev_err(hdptx->dev, "Failed to get PHY ready: %d\n", ret); ++ return ret; ++ } ++ ++ dev_dbg(hdptx->dev, "PHY ready\n"); ++ ++ return 0; ++} ++ + static void rk_hdptx_phy_disable(struct rk_hdptx_phy *hdptx) + { + u32 val; +@@ -690,6 +866,99 @@ static void rk_hdptx_phy_disable(struct rk_hdptx_phy *hdptx) + regmap_write(hdptx->grf, GRF_HDPTX_CON0, val); + } + ++static void rk_hdptx_earc_config(struct rk_hdptx_phy *hdptx) ++{ ++ regmap_update_bits(hdptx->regmap, SB_REG(0113), SB_RX_RCAL_OPT_CODE_MASK, ++ FIELD_PREP(SB_RX_RCAL_OPT_CODE_MASK, 1)); ++ regmap_write(hdptx->regmap, SB_REG(011c), 0x04); ++ regmap_update_bits(hdptx->regmap, SB_REG(011b), SB_AFC_TOL_MASK, ++ FIELD_PREP(SB_AFC_TOL_MASK, 3)); ++ regmap_write(hdptx->regmap, SB_REG(0109), 0x05); ++ ++ regmap_update_bits(hdptx->regmap, SB_REG(0120), ++ SB_EARC_EN_MASK | SB_EARC_AFC_EN_MASK, ++ FIELD_PREP(SB_EARC_EN_MASK, 1) | ++ FIELD_PREP(SB_EARC_AFC_EN_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(011b), SB_EARC_SIG_DET_BYPASS_MASK, ++ FIELD_PREP(SB_EARC_SIG_DET_BYPASS_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(011f), ++ SB_PWM_AFC_CTRL_MASK | SB_RCAL_RSTN_MASK, ++ FIELD_PREP(SB_PWM_AFC_CTRL_MASK, 0xc) | ++ FIELD_PREP(SB_RCAL_RSTN_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0115), SB_READY_DELAY_TIME_MASK, ++ FIELD_PREP(SB_READY_DELAY_TIME_MASK, 2)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0113), SB_RX_RTERM_CTRL_MASK, ++ FIELD_PREP(SB_RX_RTERM_CTRL_MASK, 3)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0102), ANA_SB_RXTERM_OFFSP_MASK, ++ FIELD_PREP(ANA_SB_RXTERM_OFFSP_MASK, 3)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0103), ANA_SB_RXTERM_OFFSN_MASK, ++ FIELD_PREP(ANA_SB_RXTERM_OFFSN_MASK, 3)); ++ ++ regmap_write(hdptx->regmap, SB_REG(011a), 0x03); ++ regmap_write(hdptx->regmap, SB_REG(0118), 0x0a); ++ regmap_write(hdptx->regmap, SB_REG(011e), 0x6a); ++ regmap_write(hdptx->regmap, SB_REG(011d), 0x67); ++ ++ regmap_update_bits(hdptx->regmap, SB_REG(0117), FAST_PULSE_TIME_MASK, ++ FIELD_PREP(FAST_PULSE_TIME_MASK, 4)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0114), ++ SB_TG_SB_EN_DELAY_TIME_MASK | SB_TG_RXTERM_EN_DELAY_TIME_MASK, ++ FIELD_PREP(SB_TG_SB_EN_DELAY_TIME_MASK, 2) | ++ FIELD_PREP(SB_TG_RXTERM_EN_DELAY_TIME_MASK, 2)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0105), ANA_SB_TX_HLVL_PROG_MASK, ++ FIELD_PREP(ANA_SB_TX_HLVL_PROG_MASK, 7)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0106), ANA_SB_TX_LLVL_PROG_MASK, ++ FIELD_PREP(ANA_SB_TX_LLVL_PROG_MASK, 7)); ++ regmap_update_bits(hdptx->regmap, SB_REG(010f), ANA_SB_VREG_GAIN_CTRL_MASK, ++ FIELD_PREP(ANA_SB_VREG_GAIN_CTRL_MASK, 0)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0110), ANA_SB_VREG_REF_SEL_MASK, ++ FIELD_PREP(ANA_SB_VREG_REF_SEL_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0115), SB_TG_OSC_EN_DELAY_TIME_MASK, ++ FIELD_PREP(SB_TG_OSC_EN_DELAY_TIME_MASK, 2)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0116), AFC_RSTN_DELAY_TIME_MASK, ++ FIELD_PREP(AFC_RSTN_DELAY_TIME_MASK, 2)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0109), ANA_SB_DMRX_AFC_DIV_RATIO_MASK, ++ FIELD_PREP(ANA_SB_DMRX_AFC_DIV_RATIO_MASK, 5)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0103), OVRD_SB_RX_RESCAL_DONE_MASK, ++ FIELD_PREP(OVRD_SB_RX_RESCAL_DONE_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0104), OVRD_SB_EN_MASK, ++ FIELD_PREP(OVRD_SB_EN_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0102), OVRD_SB_RXTERM_EN_MASK, ++ FIELD_PREP(OVRD_SB_RXTERM_EN_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0105), OVRD_SB_EARC_CMDC_EN_MASK, ++ FIELD_PREP(OVRD_SB_EARC_CMDC_EN_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(010f), ++ OVRD_SB_VREG_EN_MASK | OVRD_SB_VREG_LPF_BYPASS_MASK, ++ FIELD_PREP(OVRD_SB_VREG_EN_MASK, 1) | ++ FIELD_PREP(OVRD_SB_VREG_LPF_BYPASS_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(0123), OVRD_SB_READY_MASK, ++ FIELD_PREP(OVRD_SB_READY_MASK, 1)); ++ ++ usleep_range(1000, 1100); ++ regmap_update_bits(hdptx->regmap, SB_REG(0103), SB_RX_RESCAL_DONE_MASK, ++ FIELD_PREP(SB_RX_RESCAL_DONE_MASK, 1)); ++ usleep_range(50, 60); ++ regmap_update_bits(hdptx->regmap, SB_REG(0104), SB_EN_MASK, ++ FIELD_PREP(SB_EN_MASK, 1)); ++ usleep_range(50, 60); ++ regmap_update_bits(hdptx->regmap, SB_REG(0102), SB_RXTERM_EN_MASK, ++ FIELD_PREP(SB_RXTERM_EN_MASK, 1)); ++ usleep_range(50, 60); ++ regmap_update_bits(hdptx->regmap, SB_REG(0105), SB_EARC_CMDC_EN_MASK, ++ FIELD_PREP(SB_EARC_CMDC_EN_MASK, 1)); ++ regmap_update_bits(hdptx->regmap, SB_REG(010f), SB_VREG_EN_MASK, ++ FIELD_PREP(SB_VREG_EN_MASK, 1)); ++ usleep_range(50, 60); ++ regmap_update_bits(hdptx->regmap, SB_REG(010f), OVRD_SB_VREG_LPF_BYPASS_MASK, ++ FIELD_PREP(OVRD_SB_VREG_LPF_BYPASS_MASK, 1)); ++ usleep_range(250, 300); ++ regmap_update_bits(hdptx->regmap, SB_REG(010f), OVRD_SB_VREG_LPF_BYPASS_MASK, ++ FIELD_PREP(OVRD_SB_VREG_LPF_BYPASS_MASK, 0)); ++ usleep_range(100, 120); ++ regmap_update_bits(hdptx->regmap, SB_REG(0123), SB_READY_MASK, ++ FIELD_PREP(SB_READY_MASK, 1)); ++} ++ + static bool rk_hdptx_phy_clk_pll_calc(unsigned int data_rate, + struct ropll_config *cfg) + { +@@ -765,9 +1034,13 @@ static bool rk_hdptx_phy_clk_pll_calc(unsigned int data_rate, + static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx, + unsigned int rate) + { ++ int i, bus_width = phy_get_bus_width(hdptx->phy); ++ u8 color_depth = (bus_width & COLOR_DEPTH_MASK) ? 1 : 0; + const struct ropll_config *cfg = NULL; + struct ropll_config rc = {0}; +- int i; ++ ++ if (color_depth) ++ rate = rate * 10 / 8; + + hdptx->rate = rate * 100; + +@@ -825,6 +1098,9 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx, + regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_POSTDIV_SEL_MASK, + FIELD_PREP(PLL_PCG_POSTDIV_SEL_MASK, cfg->pms_sdiv)); + ++ regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_CLK_SEL_MASK, ++ FIELD_PREP(PLL_PCG_CLK_SEL_MASK, color_depth)); ++ + regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_CLK_EN, + PLL_PCG_CLK_EN); + +@@ -852,9 +1128,146 @@ static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx, + rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_lane_init_seq); + rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_tmds_lane_init_seq); + ++ if (hdptx->earc_en) ++ rk_hdptx_earc_config(hdptx); ++ + return rk_hdptx_post_enable_lane(hdptx); + } + ++static int rk_hdptx_ropll_frl_mode_config(struct rk_hdptx_phy *hdptx, ++ u32 bus_width) ++{ ++ u32 bit_rate = bus_width & DATA_RATE_MASK; ++ u8 color_depth = (bus_width & COLOR_DEPTH_MASK) ? 1 : 0; ++ const struct ropll_config *cfg = NULL; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(ropll_frl_cfg); i++) ++ if (bit_rate == ropll_frl_cfg[i].bit_rate) { ++ cfg = &ropll_frl_cfg[i]; ++ break; ++ } ++ ++ if (!cfg) { ++ dev_err(hdptx->dev, "%s cannot find pll cfg\n", __func__); ++ return -EINVAL; ++ } ++ ++ rk_hdptx_pre_power_up(hdptx); ++ ++ reset_control_assert(hdptx->rsts[RST_ROPLL].rstc); ++ usleep_range(10, 20); ++ reset_control_deassert(hdptx->rsts[RST_ROPLL].rstc); ++ ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_cmn_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_cmn_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_ropll_cmn_init_seq); ++ ++ regmap_write(hdptx->regmap, CMN_REG(0051), cfg->pms_mdiv); ++ regmap_write(hdptx->regmap, CMN_REG(0055), cfg->pms_mdiv_afc); ++ regmap_write(hdptx->regmap, CMN_REG(0059), ++ (cfg->pms_pdiv << 4) | cfg->pms_refdiv); ++ regmap_write(hdptx->regmap, CMN_REG(005a), cfg->pms_sdiv << 4); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(005e), ROPLL_SDM_EN_MASK, ++ FIELD_PREP(ROPLL_SDM_EN_MASK, cfg->sdm_en)); ++ if (!cfg->sdm_en) ++ regmap_update_bits(hdptx->regmap, CMN_REG(005e), 0xf, 0); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(0064), ROPLL_SDM_NUM_SIGN_RBR_MASK, ++ FIELD_PREP(ROPLL_SDM_NUM_SIGN_RBR_MASK, cfg->sdm_num_sign)); ++ ++ regmap_write(hdptx->regmap, CMN_REG(0060), cfg->sdm_deno); ++ regmap_write(hdptx->regmap, CMN_REG(0065), cfg->sdm_num); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(0069), ROPLL_SDC_N_RBR_MASK, ++ FIELD_PREP(ROPLL_SDC_N_RBR_MASK, cfg->sdc_n)); ++ ++ regmap_write(hdptx->regmap, CMN_REG(006c), cfg->sdc_num); ++ regmap_write(hdptx->regmap, CMN_REG(0070), cfg->sdc_deno); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_POSTDIV_SEL_MASK, ++ FIELD_PREP(PLL_PCG_POSTDIV_SEL_MASK, cfg->pms_sdiv)); ++ regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_CLK_SEL_MASK, ++ FIELD_PREP(PLL_PCG_CLK_SEL_MASK, color_depth)); ++ ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_sb_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_lntop_init_seq); ++ ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_lane_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_ropll_lane_init_seq); ++ ++ if (hdptx->earc_en) ++ rk_hdptx_earc_config(hdptx); ++ ++ return rk_hdptx_post_power_up(hdptx); ++} ++ ++static int rk_hdptx_lcpll_frl_mode_config(struct rk_hdptx_phy *hdptx, ++ u32 bus_width) ++{ ++ u32 bit_rate = bus_width & DATA_RATE_MASK; ++ u8 color_depth = (bus_width & COLOR_DEPTH_MASK) ? 1 : 0; ++ const struct lcpll_config *cfg = NULL; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(lcpll_cfg); i++) ++ if (bit_rate == lcpll_cfg[i].bit_rate) { ++ cfg = &lcpll_cfg[i]; ++ break; ++ } ++ ++ if (!cfg) { ++ dev_err(hdptx->dev, "%s cannot find pll cfg\n", __func__); ++ return -EINVAL; ++ } ++ ++ rk_hdptx_pre_power_up(hdptx); ++ ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_cmn_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_cmn_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_lcpll_cmn_init_seq); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(0008), ++ LCPLL_EN_MASK | LCPLL_LCVCO_MODE_EN_MASK, ++ FIELD_PREP(LCPLL_EN_MASK, 1) | ++ FIELD_PREP(LCPLL_LCVCO_MODE_EN_MASK, cfg->lcvco_mode_en)); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(001e), ++ LCPLL_PI_EN_MASK | LCPLL_100M_CLK_EN_MASK, ++ FIELD_PREP(LCPLL_PI_EN_MASK, cfg->pi_en) | ++ FIELD_PREP(LCPLL_100M_CLK_EN_MASK, cfg->clk_en_100m)); ++ ++ regmap_write(hdptx->regmap, CMN_REG(0020), cfg->pms_mdiv); ++ regmap_write(hdptx->regmap, CMN_REG(0021), cfg->pms_mdiv_afc); ++ regmap_write(hdptx->regmap, CMN_REG(0022), ++ (cfg->pms_pdiv << 4) | cfg->pms_refdiv); ++ regmap_write(hdptx->regmap, CMN_REG(0023), ++ (cfg->pms_sdiv << 4) | cfg->pms_sdiv); ++ regmap_write(hdptx->regmap, CMN_REG(002a), cfg->sdm_deno); ++ regmap_write(hdptx->regmap, CMN_REG(002b), cfg->sdm_num_sign); ++ regmap_write(hdptx->regmap, CMN_REG(002c), cfg->sdm_num); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(002d), LCPLL_SDC_N_MASK, ++ FIELD_PREP(LCPLL_SDC_N_MASK, cfg->sdc_n)); ++ ++ regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_POSTDIV_SEL_MASK, ++ FIELD_PREP(PLL_PCG_POSTDIV_SEL_MASK, cfg->pms_sdiv)); ++ regmap_update_bits(hdptx->regmap, CMN_REG(0086), PLL_PCG_CLK_SEL_MASK, ++ FIELD_PREP(PLL_PCG_CLK_SEL_MASK, color_depth)); ++ ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_sb_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_lntop_init_seq); ++ ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_common_lane_init_seq); ++ rk_hdptx_multi_reg_write(hdptx, rk_hdtpx_frl_lcpll_lane_init_seq); ++ ++ if (hdptx->earc_en) ++ rk_hdptx_earc_config(hdptx); ++ ++ return rk_hdptx_post_power_up(hdptx); ++} ++ + static int rk_hdptx_phy_consumer_get(struct rk_hdptx_phy *hdptx, + unsigned int rate) + { +@@ -922,11 +1335,22 @@ static int rk_hdptx_phy_power_on(struct phy *phy) + * from the HDMI bridge driver until phy_configure_opts_hdmi + * becomes available in the PHY API. + */ +- unsigned int rate = bus_width & 0xfffffff; ++ unsigned int rate = bus_width & DATA_RATE_MASK; + + dev_dbg(hdptx->dev, "%s bus_width=%x rate=%u\n", + __func__, bus_width, rate); + ++ if (bus_width & HDMI_EARC_MASK) ++ hdptx->earc_en = true; ++ else ++ hdptx->earc_en = false; ++ ++ if (bus_width & HDMI_MODE_MASK) { ++ if (rate > 24000000) ++ return rk_hdptx_lcpll_frl_mode_config(hdptx, bus_width); ++ return rk_hdptx_ropll_frl_mode_config(hdptx, bus_width); ++ } ++ + ret = rk_hdptx_phy_consumer_get(hdptx, rate); + if (ret) + return ret; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0133-drm-rockchip-vop2-Improve-display-modes-handling.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0133-drm-rockchip-vop2-Improve-display-modes-handling.patch new file mode 100644 index 000000000000..4caa301abf58 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0133-drm-rockchip-vop2-Improve-display-modes-handling.patch @@ -0,0 +1,715 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Wed, 27 Mar 2024 20:36:15 +0200 +Subject: [WIP] dt-bindings: display: rockchip-drm: Add optional clocks + property + +Allow using the clock provided by HDMI0 PHY PLL to improve HDMI output +support on RK3588 SoC. + +Signed-off-by: Cristian Ciocaltea +--- + Documentation/devicetree/bindings/display/rockchip/rockchip-drm.yaml | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip-drm.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip-drm.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/display/rockchip/rockchip-drm.yaml ++++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-drm.yaml +@@ -28,6 +28,14 @@ properties: + of vop devices. vop definitions as defined in + Documentation/devicetree/bindings/display/rockchip/rockchip-vop.yaml + ++ clocks: ++ maxItems: 1 ++ description: Optional clock provided by HDMI0 PLL ++ ++ clock-names: ++ items: ++ - const: hdmi0_phy_pll ++ + required: + - compatible + - ports +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Fri, 3 Nov 2023 19:58:02 +0200 +Subject: [WIP] drm/rockchip: vop2: Improve display modes handling on rk3588 + +The initial vop2 support for rk3588 in mainline is not able to handle +all display modes supported by connected displays, e.g. +2560x1440-75.00Hz, 2048x1152-60.00Hz, 1024x768-60.00Hz. + +Additionally, it doesn't cope with non-integer refresh rates like 59.94, +29.97, 23.98, etc. + +Improve HDMI0 clocking in order to support the additional display modes. + +Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588") +Signed-off-by: Cristian Ciocaltea +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 553 +++++++++- + 1 file changed, 552 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -5,6 +5,8 @@ + */ + #include + #include ++#include ++#include + #include + #include + #include +@@ -212,6 +214,10 @@ struct vop2 { + struct clk *hclk; + struct clk *aclk; + struct clk *pclk; ++ // [CC:] hack to support additional display modes ++ struct clk *hdmi0_phy_pll; ++ /* list_head of internal clk */ ++ struct list_head clk_list_head; + + /* optional internal rgb encoder */ + struct rockchip_rgb *rgb; +@@ -220,6 +226,19 @@ struct vop2 { + struct vop2_win win[]; + }; + ++struct vop2_clk { ++ struct vop2 *vop2; ++ struct list_head list; ++ unsigned long rate; ++ struct clk_hw hw; ++ struct clk_divider div; ++ int div_val; ++ u8 parent_index; ++}; ++ ++#define to_vop2_clk(_hw) container_of(_hw, struct vop2_clk, hw) ++#define VOP2_MAX_DCLK_RATE 600000 /* kHz */ ++ + #define vop2_output_if_is_hdmi(x) ((x) == ROCKCHIP_VOP2_EP_HDMI0 || \ + (x) == ROCKCHIP_VOP2_EP_HDMI1) + +@@ -1476,9 +1495,30 @@ static bool vop2_crtc_mode_fixup(struct drm_crtc *crtc, + const struct drm_display_mode *mode, + struct drm_display_mode *adj_mode) + { ++ struct vop2_video_port *vp = to_vop2_video_port(crtc); ++ struct drm_connector *connector; ++ struct drm_connector_list_iter conn_iter; ++ struct drm_crtc_state *new_crtc_state = container_of(mode, struct drm_crtc_state, mode); + drm_mode_set_crtcinfo(adj_mode, CRTC_INTERLACE_HALVE_V | + CRTC_STEREO_DOUBLE); + ++ if (mode->flags & DRM_MODE_FLAG_DBLCLK) ++ adj_mode->crtc_clock *= 2; ++ ++ drm_connector_list_iter_begin(crtc->dev, &conn_iter); ++ drm_for_each_connector_iter(connector, &conn_iter) { ++ if ((new_crtc_state->connector_mask & drm_connector_mask(connector)) && ++ ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) || ++ (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA))) { ++ drm_connector_list_iter_end(&conn_iter); ++ return true; ++ } ++ } ++ drm_connector_list_iter_end(&conn_iter); ++ ++ if (adj_mode->crtc_clock <= VOP2_MAX_DCLK_RATE) ++ adj_mode->crtc_clock = DIV_ROUND_UP(clk_round_rate(vp->dclk, ++ adj_mode->crtc_clock * 1000), 1000); + return true; + } + +@@ -1663,6 +1703,31 @@ static unsigned long rk3588_calc_dclk(unsigned long child_clk, unsigned long max + return 0; + } + ++static struct vop2_clk *vop2_clk_get(struct vop2 *vop2, const char *name); ++ ++static int vop2_cru_set_rate(struct vop2_clk *if_pixclk, struct vop2_clk *if_dclk) ++{ ++ int ret = 0; ++ ++ if (if_pixclk) { ++ ret = clk_set_rate(if_pixclk->hw.clk, if_pixclk->rate); ++ if (ret < 0) { ++ DRM_DEV_ERROR(if_pixclk->vop2->dev, "set %s to %ld failed: %d\n", ++ clk_hw_get_name(&if_pixclk->hw), if_pixclk->rate, ret); ++ return ret; ++ } ++ } ++ ++ if (if_dclk) { ++ ret = clk_set_rate(if_dclk->hw.clk, if_dclk->rate); ++ if (ret < 0) ++ DRM_DEV_ERROR(if_dclk->vop2->dev, "set %s to %ld failed %d\n", ++ clk_hw_get_name(&if_dclk->hw), if_dclk->rate, ret); ++ } ++ ++ return ret; ++} ++ + /* + * 4 pixclk/cycle on rk3588 + * RGB/eDP/HDMI: if_pixclk >= dclk_core +@@ -1686,6 +1751,72 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id, + int K = 1; + + if (vop2_output_if_is_hdmi(id)) { ++ if (vop2->data->soc_id == 3588 && id == ROCKCHIP_VOP2_EP_HDMI0 && ++ vop2->hdmi0_phy_pll) { ++ const char *clk_src_name = "hdmi_edp0_clk_src"; ++ const char *clk_parent_name = "dclk"; ++ const char *pixclk_name = "hdmi_edp0_pixclk"; ++ const char *dclk_name = "hdmi_edp0_dclk"; ++ struct vop2_clk *if_clk_src, *if_clk_parent, *if_pixclk, *if_dclk, *dclk, *dclk_core, *dclk_out; ++ char clk_name[32]; ++ int ret; ++ ++ if_clk_src = vop2_clk_get(vop2, clk_src_name); ++ snprintf(clk_name, sizeof(clk_name), "%s%d", clk_parent_name, vp->id); ++ if_clk_parent = vop2_clk_get(vop2, clk_name); ++ if_pixclk = vop2_clk_get(vop2, pixclk_name); ++ if_dclk = vop2_clk_get(vop2, dclk_name); ++ if (!if_pixclk || !if_clk_parent) { ++ DRM_DEV_ERROR(vop2->dev, "failed to get connector interface clk\n"); ++ return -ENODEV; ++ } ++ ++ ret = clk_set_parent(if_clk_src->hw.clk, if_clk_parent->hw.clk); ++ if (ret < 0) { ++ DRM_DEV_ERROR(vop2->dev, "failed to set parent(%s) for %s: %d\n", ++ __clk_get_name(if_clk_parent->hw.clk), ++ __clk_get_name(if_clk_src->hw.clk), ret); ++ return ret; ++ } ++ ++ if (output_mode == ROCKCHIP_OUT_MODE_YUV420) ++ K = 2; ++ ++ if_pixclk->rate = (dclk_core_rate << 1) / K; ++ if_dclk->rate = dclk_core_rate / K; ++ ++ snprintf(clk_name, sizeof(clk_name), "dclk_core%d", vp->id); ++ dclk_core = vop2_clk_get(vop2, clk_name); ++ ++ snprintf(clk_name, sizeof(clk_name), "dclk_out%d", vp->id); ++ dclk_out = vop2_clk_get(vop2, clk_name); ++ ++ snprintf(clk_name, sizeof(clk_name), "dclk%d", vp->id); ++ dclk = vop2_clk_get(vop2, clk_name); ++ if (v_pixclk <= (VOP2_MAX_DCLK_RATE * 1000)) { ++ if (output_mode == ROCKCHIP_OUT_MODE_YUV420) ++ v_pixclk = v_pixclk >> 1; ++ } else { ++ v_pixclk = v_pixclk >> 2; ++ } ++ clk_set_rate(dclk->hw.clk, v_pixclk); ++ ++ if (dclk_core_rate > if_pixclk->rate) { ++ clk_set_rate(dclk_core->hw.clk, dclk_core_rate); ++ ret = vop2_cru_set_rate(if_pixclk, if_dclk); ++ } else { ++ ret = vop2_cru_set_rate(if_pixclk, if_dclk); ++ clk_set_rate(dclk_core->hw.clk, dclk_core_rate); ++ } ++ ++ *dclk_core_div = dclk_core->div_val; ++ *dclk_out_div = dclk_out->div_val; ++ *if_pixclk_div = if_pixclk->div_val; ++ *if_dclk_div = if_dclk->div_val; ++ ++ return dclk->rate; ++ } ++ + /* + * K = 2: dclk_core = if_pixclk_rate > if_dclk_rate + * K = 1: dclk_core = hdmie_edp_dclk > if_pixclk_rate +@@ -1917,6 +2048,22 @@ static int us_to_vertical_line(struct drm_display_mode *mode, int us) + return us * mode->clock / mode->htotal / 1000; + } + ++// [CC:] rework virtual clock ++static struct vop2_clk *vop2_clk_get(struct vop2 *vop2, const char *name) ++{ ++ struct vop2_clk *clk, *n; ++ ++ if (!name) ++ return NULL; ++ ++ list_for_each_entry_safe(clk, n, &vop2->clk_list_head, list) { ++ if (!strcmp(clk_hw_get_name(&clk->hw), name)) ++ return clk; ++ } ++ ++ return NULL; ++} ++ + static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + struct drm_atomic_state *state) + { +@@ -1944,6 +2091,8 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + u32 val, polflags; + int ret; + struct drm_encoder *encoder; ++ char clk_name[32]; ++ struct vop2_clk *dclk; + + drm_dbg(vop2->drm, "Update mode to %dx%d%s%d, type: %d for vp%d\n", + hdisplay, vdisplay, mode->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "p", +@@ -2044,11 +2193,38 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + + if (mode->flags & DRM_MODE_FLAG_DBLCLK) { + dsp_ctrl |= RK3568_VP_DSP_CTRL__CORE_DCLK_DIV; +- clock *= 2; ++ // [CC:] done via mode_fixup ++ // clock *= 2; + } + + vop2_vp_write(vp, RK3568_VP_MIPI_CTRL, 0); + ++ snprintf(clk_name, sizeof(clk_name), "dclk%d", vp->id); ++ dclk = vop2_clk_get(vop2, clk_name); ++ if (dclk) { ++ /* ++ * use HDMI_PHY_PLL as dclk source under 4K@60 if it is available, ++ * otherwise use system cru as dclk source. ++ */ ++ drm_for_each_encoder_mask(encoder, crtc->dev, crtc_state->encoder_mask) { ++ struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder); ++ ++ // [CC:] Using PHY PLL to handle all display modes ++ if (rkencoder->crtc_endpoint_id == ROCKCHIP_VOP2_EP_HDMI0) { ++ clk_get_rate(vop2->hdmi0_phy_pll); ++ ++ if (mode->crtc_clock <= VOP2_MAX_DCLK_RATE) { ++ ret = clk_set_parent(vp->dclk, vop2->hdmi0_phy_pll); ++ if (ret < 0) ++ DRM_WARN("failed to set clock parent for %s\n", ++ __clk_get_name(vp->dclk)); ++ } ++ ++ clock = dclk->rate; ++ } ++ } ++ } ++ + clk_set_rate(vp->dclk, clock); + + vop2_post_config(crtc); +@@ -2504,7 +2680,43 @@ static void vop2_crtc_atomic_flush(struct drm_crtc *crtc, + spin_unlock_irq(&crtc->dev->event_lock); + } + ++static enum drm_mode_status ++vop2_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode) ++{ ++ struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(crtc->state); ++ struct vop2_video_port *vp = to_vop2_video_port(crtc); ++ struct vop2 *vop2 = vp->vop2; ++ const struct vop2_data *vop2_data = vop2->data; ++ const struct vop2_video_port_data *vp_data = &vop2_data->vp[vp->id]; ++ int request_clock = mode->clock; ++ int clock; ++ ++ if (mode->hdisplay > vp_data->max_output.width) ++ return MODE_BAD_HVALUE; ++ ++ if (mode->flags & DRM_MODE_FLAG_DBLCLK) ++ request_clock *= 2; ++ ++ if (request_clock <= VOP2_MAX_DCLK_RATE) { ++ clock = request_clock; ++ } else { ++ request_clock = request_clock >> 2; ++ clock = clk_round_rate(vp->dclk, request_clock * 1000) / 1000; ++ } ++ ++ /* ++ * Hdmi or DisplayPort request a Accurate clock. ++ */ ++ if (vcstate->output_type == DRM_MODE_CONNECTOR_HDMIA || ++ vcstate->output_type == DRM_MODE_CONNECTOR_DisplayPort) ++ if (clock != request_clock) ++ return MODE_CLOCK_RANGE; ++ ++ return MODE_OK; ++} ++ + static const struct drm_crtc_helper_funcs vop2_crtc_helper_funcs = { ++ .mode_valid = vop2_crtc_mode_valid, + .mode_fixup = vop2_crtc_mode_fixup, + .atomic_check = vop2_crtc_atomic_check, + .atomic_begin = vop2_crtc_atomic_begin, +@@ -3074,6 +3286,336 @@ static const struct regmap_config vop2_regmap_config = { + .cache_type = REGCACHE_MAPLE, + }; + ++/* ++ * BEGIN virtual clock ++ */ ++#define PLL_RATE_MIN 30000000 ++ ++#define cru_dbg(format, ...) do { \ ++ if (cru_debug) \ ++ pr_info("%s: " format, __func__, ## __VA_ARGS__); \ ++ } while (0) ++ ++#define PNAME(x) static const char *const x[] ++ ++enum vop_clk_branch_type { ++ branch_mux, ++ branch_divider, ++ branch_factor, ++ branch_virtual, ++}; ++ ++#define VIR(cname) \ ++ { \ ++ .branch_type = branch_virtual, \ ++ .name = cname, \ ++ } ++ ++ ++#define MUX(cname, pnames, f) \ ++ { \ ++ .branch_type = branch_mux, \ ++ .name = cname, \ ++ .parent_names = pnames, \ ++ .num_parents = ARRAY_SIZE(pnames), \ ++ .flags = f, \ ++ } ++ ++#define FACTOR(cname, pname, f) \ ++ { \ ++ .branch_type = branch_factor, \ ++ .name = cname, \ ++ .parent_names = (const char *[]){ pname }, \ ++ .num_parents = 1, \ ++ .flags = f, \ ++ } ++ ++#define DIV(cname, pname, f, w) \ ++ { \ ++ .branch_type = branch_divider, \ ++ .name = cname, \ ++ .parent_names = (const char *[]){ pname }, \ ++ .num_parents = 1, \ ++ .flags = f, \ ++ .div_width = w, \ ++ } ++ ++struct vop2_clk_branch { ++ enum vop_clk_branch_type branch_type; ++ const char *name; ++ const char *const *parent_names; ++ u8 num_parents; ++ unsigned long flags; ++ u8 div_shift; ++ u8 div_width; ++ u8 div_flags; ++}; ++ ++PNAME(mux_port0_dclk_src_p) = { "dclk0", "dclk1" }; ++PNAME(mux_port2_dclk_src_p) = { "dclk2", "dclk1" }; ++PNAME(mux_dp_pixclk_p) = { "dclk_out0", "dclk_out1", "dclk_out2" }; ++PNAME(mux_hdmi_edp_clk_src_p) = { "dclk0", "dclk1", "dclk2" }; ++PNAME(mux_mipi_clk_src_p) = { "dclk_out1", "dclk_out2", "dclk_out3" }; ++PNAME(mux_dsc_8k_clk_src_p) = { "dclk0", "dclk1", "dclk2", "dclk3" }; ++PNAME(mux_dsc_4k_clk_src_p) = { "dclk0", "dclk1", "dclk2", "dclk3" }; ++ ++/* ++ * We only use this clk driver calculate the div ++ * of dclk_core/dclk_out/if_pixclk/if_dclk and ++ * the rate of the dclk from the soc. ++ * ++ * We don't touch the cru in the vop here, as ++ * these registers has special read andy write ++ * limits. ++ */ ++static struct vop2_clk_branch rk3588_vop_clk_branches[] = { ++ VIR("dclk0"), ++ VIR("dclk1"), ++ VIR("dclk2"), ++ VIR("dclk3"), ++ ++ MUX("port0_dclk_src", mux_port0_dclk_src_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("dclk_core0", "port0_dclk_src", CLK_SET_RATE_PARENT, 2), ++ DIV("dclk_out0", "port0_dclk_src", CLK_SET_RATE_PARENT, 2), ++ ++ FACTOR("port1_dclk_src", "dclk1", CLK_SET_RATE_PARENT), ++ DIV("dclk_core1", "port1_dclk_src", CLK_SET_RATE_PARENT, 2), ++ DIV("dclk_out1", "port1_dclk_src", CLK_SET_RATE_PARENT, 2), ++ ++ MUX("port2_dclk_src", mux_port2_dclk_src_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("dclk_core2", "port2_dclk_src", CLK_SET_RATE_PARENT, 2), ++ DIV("dclk_out2", "port2_dclk_src", CLK_SET_RATE_PARENT, 2), ++ ++ FACTOR("port3_dclk_src", "dclk3", CLK_SET_RATE_PARENT), ++ DIV("dclk_core3", "port3_dclk_src", CLK_SET_RATE_PARENT, 2), ++ DIV("dclk_out3", "port3_dclk_src", CLK_SET_RATE_PARENT, 2), ++ ++ MUX("dp0_pixclk", mux_dp_pixclk_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ MUX("dp1_pixclk", mux_dp_pixclk_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ ++ MUX("hdmi_edp0_clk_src", mux_hdmi_edp_clk_src_p, ++ CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("hdmi_edp0_dclk", "hdmi_edp0_clk_src", 0, 2), ++ DIV("hdmi_edp0_pixclk", "hdmi_edp0_clk_src", CLK_SET_RATE_PARENT, 1), ++ ++ MUX("hdmi_edp1_clk_src", mux_hdmi_edp_clk_src_p, ++ CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("hdmi_edp1_dclk", "hdmi_edp1_clk_src", 0, 2), ++ DIV("hdmi_edp1_pixclk", "hdmi_edp1_clk_src", CLK_SET_RATE_PARENT, 1), ++ ++ MUX("mipi0_clk_src", mux_mipi_clk_src_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("mipi0_pixclk", "mipi0_clk_src", CLK_SET_RATE_PARENT, 2), ++ ++ MUX("mipi1_clk_src", mux_mipi_clk_src_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("mipi1_pixclk", "mipi1_clk_src", CLK_SET_RATE_PARENT, 2), ++ ++ FACTOR("rgb_pixclk", "port3_dclk_src", CLK_SET_RATE_PARENT), ++ ++ MUX("dsc_8k_txp_clk_src", mux_dsc_8k_clk_src_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("dsc_8k_txp_clk", "dsc_8k_txp_clk_src", 0, 2), ++ DIV("dsc_8k_pxl_clk", "dsc_8k_txp_clk_src", 0, 2), ++ DIV("dsc_8k_cds_clk", "dsc_8k_txp_clk_src", 0, 2), ++ ++ MUX("dsc_4k_txp_clk_src", mux_dsc_4k_clk_src_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT), ++ DIV("dsc_4k_txp_clk", "dsc_4k_txp_clk_src", 0, 2), ++ DIV("dsc_4k_pxl_clk", "dsc_4k_txp_clk_src", 0, 2), ++ DIV("dsc_4k_cds_clk", "dsc_4k_txp_clk_src", 0, 2), ++}; ++ ++static unsigned long clk_virtual_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ ++ return (unsigned long)vop2_clk->rate; ++} ++ ++static long clk_virtual_round_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long *prate) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ ++ vop2_clk->rate = rate; ++ ++ return rate; ++} ++ ++static int clk_virtual_set_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long parent_rate) ++{ ++ return 0; ++} ++ ++const struct clk_ops clk_virtual_ops = { ++ .round_rate = clk_virtual_round_rate, ++ .set_rate = clk_virtual_set_rate, ++ .recalc_rate = clk_virtual_recalc_rate, ++}; ++ ++static u8 vop2_mux_get_parent(struct clk_hw *hw) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ ++ // cru_dbg("%s index: %d\n", clk_hw_get_name(hw), vop2_clk->parent_index); ++ return vop2_clk->parent_index; ++} ++ ++static int vop2_mux_set_parent(struct clk_hw *hw, u8 index) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ ++ vop2_clk->parent_index = index; ++ ++ // cru_dbg("%s index: %d\n", clk_hw_get_name(hw), index); ++ return 0; ++} ++ ++static int vop2_clk_mux_determine_rate(struct clk_hw *hw, ++ struct clk_rate_request *req) ++{ ++ // cru_dbg("%s %ld(min: %ld max: %ld)\n", ++ // clk_hw_get_name(hw), req->rate, req->min_rate, req->max_rate); ++ return __clk_mux_determine_rate(hw, req); ++} ++ ++static const struct clk_ops vop2_mux_clk_ops = { ++ .get_parent = vop2_mux_get_parent, ++ .set_parent = vop2_mux_set_parent, ++ .determine_rate = vop2_clk_mux_determine_rate, ++}; ++ ++#define div_mask(width) ((1 << (width)) - 1) ++ ++static int vop2_div_get_val(unsigned long rate, unsigned long parent_rate) ++{ ++ unsigned int div, value; ++ ++ div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); ++ ++ value = ilog2(div); ++ ++ return value; ++} ++ ++static unsigned long vop2_clk_div_recalc_rate(struct clk_hw *hw, ++ unsigned long parent_rate) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ unsigned long rate; ++ unsigned int div; ++ ++ div = 1 << vop2_clk->div_val; ++ rate = parent_rate / div; ++ ++ // cru_dbg("%s rate: %ld(prate: %ld)\n", clk_hw_get_name(hw), rate, parent_rate); ++ return rate; ++} ++ ++static long vop2_clk_div_round_rate(struct clk_hw *hw, unsigned long rate, ++ unsigned long *prate) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ ++ if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { ++ if (*prate < rate) ++ *prate = rate; ++ if ((*prate >> vop2_clk->div.width) > rate) ++ *prate = rate; ++ ++ if ((*prate % rate)) ++ *prate = rate; ++ ++ /* SOC PLL can't output a too low pll freq */ ++ if (*prate < PLL_RATE_MIN) ++ *prate = rate << vop2_clk->div.width; ++ } ++ ++ // cru_dbg("%s rate: %ld(prate: %ld)\n", clk_hw_get_name(hw), rate, *prate); ++ return rate; ++} ++ ++static int vop2_clk_div_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) ++{ ++ struct vop2_clk *vop2_clk = to_vop2_clk(hw); ++ int div_val; ++ ++ div_val = vop2_div_get_val(rate, parent_rate); ++ vop2_clk->div_val = div_val; ++ ++ // cru_dbg("%s prate: %ld rate: %ld div_val: %d\n", ++ // clk_hw_get_name(hw), parent_rate, rate, div_val); ++ return 0; ++} ++ ++static const struct clk_ops vop2_div_clk_ops = { ++ .recalc_rate = vop2_clk_div_recalc_rate, ++ .round_rate = vop2_clk_div_round_rate, ++ .set_rate = vop2_clk_div_set_rate, ++}; ++ ++static struct clk *vop2_clk_register(struct vop2 *vop2, struct vop2_clk_branch *branch) ++{ ++ struct clk_init_data init = {}; ++ struct vop2_clk *vop2_clk; ++ struct clk *clk; ++ ++ vop2_clk = devm_kzalloc(vop2->dev, sizeof(*vop2_clk), GFP_KERNEL); ++ if (!vop2_clk) ++ return ERR_PTR(-ENOMEM); ++ ++ vop2_clk->vop2 = vop2; ++ vop2_clk->hw.init = &init; ++ vop2_clk->div.shift = branch->div_shift; ++ vop2_clk->div.width = branch->div_width; ++ ++ init.name = branch->name; ++ init.flags = branch->flags; ++ init.num_parents = branch->num_parents; ++ init.parent_names = branch->parent_names; ++ if (branch->branch_type == branch_divider) { ++ init.ops = &vop2_div_clk_ops; ++ } else if (branch->branch_type == branch_virtual) { ++ init.ops = &clk_virtual_ops; ++ init.num_parents = 0; ++ init.parent_names = NULL; ++ } else { ++ init.ops = &vop2_mux_clk_ops; ++ } ++ ++ clk = devm_clk_register(vop2->dev, &vop2_clk->hw); ++ if (!IS_ERR(clk)) ++ list_add_tail(&vop2_clk->list, &vop2->clk_list_head); ++ else ++ DRM_DEV_ERROR(vop2->dev, "Register %s failed\n", branch->name); ++ ++ return clk; ++} ++ ++static int vop2_clk_init(struct vop2 *vop2) ++{ ++ struct vop2_clk_branch *branch = rk3588_vop_clk_branches; ++ unsigned int nr_clk = ARRAY_SIZE(rk3588_vop_clk_branches); ++ unsigned int idx; ++ struct vop2_clk *clk, *n; ++ ++ INIT_LIST_HEAD(&vop2->clk_list_head); ++ ++ if (vop2->data->soc_id < 3588 || vop2->hdmi0_phy_pll == NULL) ++ return 0; ++ ++ list_for_each_entry_safe(clk, n, &vop2->clk_list_head, list) { ++ list_del(&clk->list); ++ } ++ ++ for (idx = 0; idx < nr_clk; idx++, branch++) ++ vop2_clk_register(vop2, branch); ++ ++ return 0; ++} ++/* ++ * END virtual clock ++ */ ++ + static int vop2_bind(struct device *dev, struct device *master, void *data) + { + struct platform_device *pdev = to_platform_device(dev); +@@ -3167,6 +3709,12 @@ static int vop2_bind(struct device *dev, struct device *master, void *data) + return PTR_ERR(vop2->pclk); + } + ++ vop2->hdmi0_phy_pll = devm_clk_get_optional(vop2->drm->dev, "hdmi0_phy_pll"); ++ if (IS_ERR(vop2->hdmi0_phy_pll)) { ++ DRM_DEV_ERROR(vop2->dev, "failed to get hdmi0_phy_pll source\n"); ++ return PTR_ERR(vop2->hdmi0_phy_pll); ++ } ++ + vop2->irq = platform_get_irq(pdev, 0); + if (vop2->irq < 0) { + drm_err(vop2->drm, "cannot find irq for vop2\n"); +@@ -3183,6 +3731,9 @@ static int vop2_bind(struct device *dev, struct device *master, void *data) + if (ret) + return ret; + ++ // [CC:] rework virtual clock ++ vop2_clk_init(vop2); ++ + ret = vop2_find_rgb_encoder(vop2); + if (ret >= 0) { + vop2->rgb = rockchip_rgb_init(dev, &vop2->vps[ret].crtc, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0134-drm-bridge-synopsys-Add-initial-support-for-DW-HDMI-Controller.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0134-drm-bridge-synopsys-Add-initial-support-for-DW-HDMI-Controller.patch new file mode 100644 index 000000000000..2c8539458c64 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0134-drm-bridge-synopsys-Add-initial-support-for-DW-HDMI-Controller.patch @@ -0,0 +1,2603 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Fri, 26 Jul 2024 02:54:52 +0300 +Subject: dt-bindings: display: bridge: Add schema for Synopsys DW HDMI QP TX + IP + +Add dt-binding schema containing the common properties for the Synopsys +DesignWare HDMI QP TX controller. + +Note this is not a full dt-binding specification, but is meant to be +referenced by platform-specific bindings for this IP core. + +Signed-off-by: Cristian Ciocaltea +--- + Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi-qp.yaml | 66 ++++++++++ + 1 file changed, 66 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi-qp.yaml b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi-qp.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi-qp.yaml +@@ -0,0 +1,66 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/display/bridge/synopsys,dw-hdmi-qp.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Common Properties for Synopsys DesignWare HDMI QP TX Controller IP ++ ++maintainers: ++ - Cristian Ciocaltea ++ ++description: | ++ This document defines device tree properties for the Synopsys DesignWare ++ HDMI 2.1 Quad-Pixel (QP) TX controller IP core. ++ It doesn't constitute a device tree binding specification by itself, but ++ is meant to be referenced by platform-specific device tree bindings. ++ ++ When referenced from platform device tree bindings, the properties defined ++ in this document are defined as follows. The platform device tree bindings ++ are responsible for defining whether each property is required or optional. ++ ++properties: ++ reg: ++ maxItems: 1 ++ ++ clocks: ++ minItems: 4 ++ maxItems: 6 ++ items: ++ - description: Peripheral/APB bus clock ++ - description: EARC RX biphase clock ++ - description: Reference clock ++ - description: Audio interface clock ++ additionalItems: true ++ ++ clock-names: ++ minItems: 4 ++ maxItems: 6 ++ items: ++ - const: pclk ++ - const: earc ++ - const: ref ++ - const: aud ++ additionalItems: true ++ ++ interrupts: ++ minItems: 4 ++ maxItems: 5 ++ items: ++ - description: AVP Unit interrupt ++ - description: CEC interrupt ++ - description: eARC RX interrupt ++ - description: Main Unit interrupt ++ additionalItems: true ++ ++ interrupt-names: ++ minItems: 4 ++ maxItems: 5 ++ items: ++ - const: avp ++ - const: cec ++ - const: earc ++ - const: main ++ additionalItems: true ++ ++additionalProperties: true +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Mon, 20 May 2024 14:49:50 +0300 +Subject: drm/bridge: synopsys: Add DW HDMI QP TX Controller driver + +The Synopsys DesignWare HDMI 2.1 Quad-Pixel (QP) TX Controller supports +the following features, among others: + +* Fixed Rate Link (FRL) +* Display Stream Compression (DSC) +* 4K@120Hz and 8K@60Hz video modes +* Variable Refresh Rate (VRR) including Quick Media Switching (QMS), aka + Cinema VRR +* Fast Vactive (FVA), aka Quick Frame Transport (QFT) +* SCDC I2C DDC access +* TMDS Scrambler enabling 2160p@60Hz with RGB/YCbCr4:4:4 +* YCbCr4:2:0 enabling 2160p@60Hz at lower HDMI link speeds +* Multi-stream audio +* Enhanced Audio Return Channel (EARC) + +Add driver to enable basic support, i.e. RGB output up to 4K@60Hz, +without audio, CEC or any HDMI 2.1 specific features. + +Co-developed-by: Algea Cao +Signed-off-by: Algea Cao +Signed-off-by: Cristian Ciocaltea +--- + drivers/gpu/drm/bridge/synopsys/Kconfig | 8 + + drivers/gpu/drm/bridge/synopsys/Makefile | 2 + + drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 748 +++++++++ + drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.h | 834 ++++++++++ + include/drm/bridge/dw_hdmi_qp.h | 37 + + 5 files changed, 1629 insertions(+) + +diff --git a/drivers/gpu/drm/bridge/synopsys/Kconfig b/drivers/gpu/drm/bridge/synopsys/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/bridge/synopsys/Kconfig ++++ b/drivers/gpu/drm/bridge/synopsys/Kconfig +@@ -46,6 +46,14 @@ config DRM_DW_HDMI_CEC + Support the CE interface which is part of the Synopsys + Designware HDMI block. + ++config DRM_DW_HDMI_QP ++ tristate ++ select DRM_DISPLAY_HDMI_HELPER ++ select DRM_DISPLAY_HDMI_STATE_HELPER ++ select DRM_DISPLAY_HELPER ++ select DRM_KMS_HELPER ++ select REGMAP_MMIO ++ + config DRM_DW_MIPI_DSI + tristate + select DRM_KMS_HELPER +diff --git a/drivers/gpu/drm/bridge/synopsys/Makefile b/drivers/gpu/drm/bridge/synopsys/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/bridge/synopsys/Makefile ++++ b/drivers/gpu/drm/bridge/synopsys/Makefile +@@ -5,4 +5,6 @@ obj-$(CONFIG_DRM_DW_HDMI_GP_AUDIO) += dw-hdmi-gp-audio.o + obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o + obj-$(CONFIG_DRM_DW_HDMI_CEC) += dw-hdmi-cec.o + ++obj-$(CONFIG_DRM_DW_HDMI_QP) += dw-hdmi-qp.o ++ + obj-$(CONFIG_DRM_DW_MIPI_DSI) += dw-mipi-dsi.o +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +@@ -0,0 +1,748 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Copyright (c) 2021-2022 Rockchip Electronics Co., Ltd. ++ * Copyright (c) 2024 Collabora Ltd. ++ * ++ * Author: Algea Cao ++ * Author: Cristian Ciocaltea ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "dw-hdmi-qp.h" ++ ++#define DDC_CI_ADDR 0x37 ++#define DDC_SEGMENT_ADDR 0x30 ++ ++#define SCDC_MIN_SOURCE_VERSION 0x1 ++ ++#define HDMI14_MAX_TMDSCLK 340000000 ++ ++struct dw_hdmi_qp_i2c { ++ struct i2c_adapter adap; ++ ++ struct mutex lock; /* used to serialize data transfers */ ++ struct completion cmp; ++ u8 stat; ++ ++ u8 slave_reg; ++ bool is_regaddr; ++ bool is_segment; ++}; ++ ++struct dw_hdmi_qp { ++ struct drm_bridge bridge; ++ ++ struct device *dev; ++ struct dw_hdmi_qp_i2c *i2c; ++ ++ struct { ++ const struct dw_hdmi_qp_phy_ops *ops; ++ void *data; ++ } phy; ++ ++ struct clk *ref_clk; ++ ++ struct drm_connector *curr_conn; ++ unsigned long long pix_clock; ++ ++ struct regmap *regm; ++}; ++ ++/* Filter out invalid setups to avoid configuring SCDC and scrambling */ ++static bool dw_hdmi_qp_support_scdc(struct dw_hdmi_qp *hdmi, ++ const struct drm_display_info *display) ++{ ++ /* Disable if no DDC bus */ ++ if (!hdmi->bridge.ddc) ++ return false; ++ ++ /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */ ++ if (!display->hdmi.scdc.supported || ++ !display->hdmi.scdc.scrambling.supported) ++ return false; ++ ++ /* ++ * Disable if display only support low TMDS rates and scrambling ++ * for low rates is not supported either ++ */ ++ if (!display->hdmi.scdc.scrambling.low_rates && ++ display->max_tmds_clock <= 340000) ++ return false; ++ ++ return true; ++} ++ ++int dw_hdmi_qp_set_refclk_rate(struct dw_hdmi_qp *hdmi, unsigned long rate) ++{ ++ return clk_set_rate(hdmi->ref_clk, rate); ++} ++EXPORT_SYMBOL_GPL(dw_hdmi_qp_set_refclk_rate); ++ ++/* ++ * HDMI2.0 Specifies the following procedure for High TMDS Bit Rates: ++ * - The Source shall suspend transmission of the TMDS clock and data ++ * ++ * - The Source shall write to the TMDS_Bit_Clock_Ratio bit to change it ++ * from a 0 to a 1 or from a 1 to a 0 ++ * ++ * - The Source shall allow a minimum of 1 ms and a maximum of 100 ms from ++ * the time the TMDS_Bit_Clock_Ratio bit is written until resuming ++ * transmission of TMDS clock and data ++ * ++ * To respect the 100ms max delay, the dw_hdmi_qp_set_high_tmds_clock_ratio() ++ * helper should be called right before enabling the TMDS Clock and Data in ++ * the PHY configuration callback. ++ */ ++void dw_hdmi_qp_set_high_tmds_clock_ratio(struct dw_hdmi_qp *hdmi, ++ const struct drm_display_info *display) ++{ ++ bool set; ++ ++ if (hdmi->curr_conn && dw_hdmi_qp_support_scdc(hdmi, display)) { ++ set = (hdmi->pix_clock > HDMI14_MAX_TMDSCLK); ++ drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, set); ++ } ++} ++EXPORT_SYMBOL_GPL(dw_hdmi_qp_set_high_tmds_clock_ratio); ++ ++static void dw_hdmi_qp_write(struct dw_hdmi_qp *hdmi, unsigned int val, ++ int offset) ++{ ++ regmap_write(hdmi->regm, offset, val); ++} ++ ++static unsigned int dw_hdmi_qp_read(struct dw_hdmi_qp *hdmi, int offset) ++{ ++ unsigned int val = 0; ++ ++ regmap_read(hdmi->regm, offset, &val); ++ ++ return val; ++} ++ ++static void dw_hdmi_qp_mod(struct dw_hdmi_qp *hdmi, unsigned int data, ++ unsigned int mask, unsigned int reg) ++{ ++ regmap_update_bits(hdmi->regm, reg, mask, data); ++} ++ ++static int dw_hdmi_qp_i2c_read(struct dw_hdmi_qp *hdmi, ++ unsigned char *buf, unsigned int length) ++{ ++ struct dw_hdmi_qp_i2c *i2c = hdmi->i2c; ++ int stat; ++ ++ if (!i2c->is_regaddr) { ++ dev_dbg(hdmi->dev, "set read register address to 0\n"); ++ i2c->slave_reg = 0x00; ++ i2c->is_regaddr = true; ++ } ++ ++ while (length--) { ++ reinit_completion(&i2c->cmp); ++ ++ dw_hdmi_qp_mod(hdmi, i2c->slave_reg++ << 12, I2CM_ADDR, ++ I2CM_INTERFACE_CONTROL0); ++ ++ if (i2c->is_segment) ++ dw_hdmi_qp_mod(hdmi, I2CM_EXT_READ, I2CM_WR_MASK, ++ I2CM_INTERFACE_CONTROL0); ++ else ++ dw_hdmi_qp_mod(hdmi, I2CM_FM_READ, I2CM_WR_MASK, ++ I2CM_INTERFACE_CONTROL0); ++ ++ stat = wait_for_completion_timeout(&i2c->cmp, HZ / 10); ++ if (!stat) { ++ dev_err(hdmi->dev, "i2c read timed out\n"); ++ dw_hdmi_qp_write(hdmi, 0x01, I2CM_CONTROL0); ++ return -EAGAIN; ++ } ++ ++ /* Check for error condition on the bus */ ++ if (i2c->stat & I2CM_NACK_RCVD_IRQ) { ++ dev_err(hdmi->dev, "i2c read error\n"); ++ dw_hdmi_qp_write(hdmi, 0x01, I2CM_CONTROL0); ++ return -EIO; ++ } ++ ++ *buf++ = dw_hdmi_qp_read(hdmi, I2CM_INTERFACE_RDDATA_0_3) & 0xff; ++ dw_hdmi_qp_mod(hdmi, 0, I2CM_WR_MASK, I2CM_INTERFACE_CONTROL0); ++ } ++ ++ i2c->is_segment = false; ++ ++ return 0; ++} ++ ++static int dw_hdmi_qp_i2c_write(struct dw_hdmi_qp *hdmi, ++ unsigned char *buf, unsigned int length) ++{ ++ struct dw_hdmi_qp_i2c *i2c = hdmi->i2c; ++ int stat; ++ ++ if (!i2c->is_regaddr) { ++ /* Use the first write byte as register address */ ++ i2c->slave_reg = buf[0]; ++ length--; ++ buf++; ++ i2c->is_regaddr = true; ++ } ++ ++ while (length--) { ++ reinit_completion(&i2c->cmp); ++ ++ dw_hdmi_qp_write(hdmi, *buf++, I2CM_INTERFACE_WRDATA_0_3); ++ dw_hdmi_qp_mod(hdmi, i2c->slave_reg++ << 12, I2CM_ADDR, ++ I2CM_INTERFACE_CONTROL0); ++ dw_hdmi_qp_mod(hdmi, I2CM_FM_WRITE, I2CM_WR_MASK, ++ I2CM_INTERFACE_CONTROL0); ++ ++ stat = wait_for_completion_timeout(&i2c->cmp, HZ / 10); ++ if (!stat) { ++ dev_err(hdmi->dev, "i2c write time out!\n"); ++ dw_hdmi_qp_write(hdmi, 0x01, I2CM_CONTROL0); ++ return -EAGAIN; ++ } ++ ++ /* Check for error condition on the bus */ ++ if (i2c->stat & I2CM_NACK_RCVD_IRQ) { ++ dev_err(hdmi->dev, "i2c write nack!\n"); ++ dw_hdmi_qp_write(hdmi, 0x01, I2CM_CONTROL0); ++ return -EIO; ++ } ++ ++ dw_hdmi_qp_mod(hdmi, 0, I2CM_WR_MASK, I2CM_INTERFACE_CONTROL0); ++ } ++ ++ return 0; ++} ++ ++static int dw_hdmi_qp_i2c_xfer(struct i2c_adapter *adap, ++ struct i2c_msg *msgs, int num) ++{ ++ struct dw_hdmi_qp *hdmi = i2c_get_adapdata(adap); ++ struct dw_hdmi_qp_i2c *i2c = hdmi->i2c; ++ u8 addr = msgs[0].addr; ++ int i, ret = 0; ++ ++ if (addr == DDC_CI_ADDR) ++ /* ++ * The internal I2C controller does not support the multi-byte ++ * read and write operations needed for DDC/CI. ++ * FIXME: Blacklist the DDC/CI address until we filter out ++ * unsupported I2C operations. ++ */ ++ return -EOPNOTSUPP; ++ ++ for (i = 0; i < num; i++) { ++ if (msgs[i].len == 0) { ++ dev_err(hdmi->dev, ++ "unsupported transfer %d/%d, no data\n", ++ i + 1, num); ++ return -EOPNOTSUPP; ++ } ++ } ++ ++ mutex_lock(&i2c->lock); ++ ++ /* Unmute DONE and ERROR interrupts */ ++ dw_hdmi_qp_mod(hdmi, I2CM_NACK_RCVD_MASK_N | I2CM_OP_DONE_MASK_N, ++ I2CM_NACK_RCVD_MASK_N | I2CM_OP_DONE_MASK_N, ++ MAINUNIT_1_INT_MASK_N); ++ ++ /* Set slave device address taken from the first I2C message */ ++ if (addr == DDC_SEGMENT_ADDR && msgs[0].len == 1) ++ addr = DDC_ADDR; ++ ++ dw_hdmi_qp_mod(hdmi, addr << 5, I2CM_SLVADDR, I2CM_INTERFACE_CONTROL0); ++ ++ /* Set slave device register address on transfer */ ++ i2c->is_regaddr = false; ++ ++ /* Set segment pointer for I2C extended read mode operation */ ++ i2c->is_segment = false; ++ ++ for (i = 0; i < num; i++) { ++ if (msgs[i].addr == DDC_SEGMENT_ADDR && msgs[i].len == 1) { ++ i2c->is_segment = true; ++ dw_hdmi_qp_mod(hdmi, DDC_SEGMENT_ADDR, I2CM_SEG_ADDR, ++ I2CM_INTERFACE_CONTROL1); ++ dw_hdmi_qp_mod(hdmi, *msgs[i].buf << 7, I2CM_SEG_PTR, ++ I2CM_INTERFACE_CONTROL1); ++ } else { ++ if (msgs[i].flags & I2C_M_RD) ++ ret = dw_hdmi_qp_i2c_read(hdmi, msgs[i].buf, ++ msgs[i].len); ++ else ++ ret = dw_hdmi_qp_i2c_write(hdmi, msgs[i].buf, ++ msgs[i].len); ++ } ++ if (ret < 0) ++ break; ++ } ++ ++ if (!ret) ++ ret = num; ++ ++ /* Mute DONE and ERROR interrupts */ ++ dw_hdmi_qp_mod(hdmi, 0, I2CM_OP_DONE_MASK_N | I2CM_NACK_RCVD_MASK_N, ++ MAINUNIT_1_INT_MASK_N); ++ ++ mutex_unlock(&i2c->lock); ++ ++ return ret; ++} ++ ++static u32 dw_hdmi_qp_i2c_func(struct i2c_adapter *adapter) ++{ ++ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; ++} ++ ++static const struct i2c_algorithm dw_hdmi_qp_algorithm = { ++ .master_xfer = dw_hdmi_qp_i2c_xfer, ++ .functionality = dw_hdmi_qp_i2c_func, ++}; ++ ++static struct i2c_adapter *dw_hdmi_qp_i2c_adapter(struct dw_hdmi_qp *hdmi) ++{ ++ struct dw_hdmi_qp_i2c *i2c; ++ struct i2c_adapter *adap; ++ int ret; ++ ++ i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL); ++ if (!i2c) ++ return ERR_PTR(-ENOMEM); ++ ++ mutex_init(&i2c->lock); ++ init_completion(&i2c->cmp); ++ ++ adap = &i2c->adap; ++ adap->owner = THIS_MODULE; ++ adap->dev.parent = hdmi->dev; ++ adap->algo = &dw_hdmi_qp_algorithm; ++ strscpy(adap->name, "DesignWare HDMI QP", sizeof(adap->name)); ++ ++ i2c_set_adapdata(adap, hdmi); ++ ++ ret = devm_i2c_add_adapter(hdmi->dev, adap); ++ if (ret) { ++ dev_warn(hdmi->dev, "cannot add %s I2C adapter\n", adap->name); ++ devm_kfree(hdmi->dev, i2c); ++ return ERR_PTR(ret); ++ } ++ ++ hdmi->i2c = i2c; ++ dev_info(hdmi->dev, "registered %s I2C bus driver\n", adap->name); ++ ++ return adap; ++} ++ ++static int dw_hdmi_qp_config_avi_infoframe(struct dw_hdmi_qp *hdmi, ++ const u8 *buffer, size_t len) ++{ ++ u32 val, i, j; ++ ++ if (len != HDMI_INFOFRAME_SIZE(AVI)) { ++ dev_err(hdmi->dev, "failed to configure avi infoframe\n"); ++ return -EINVAL; ++ } ++ ++ /* ++ * DW HDMI QP IP uses a different byte format from standard AVI info ++ * frames, though generally the bits are in the correct bytes. ++ */ ++ val = buffer[1] << 8 | buffer[2] << 16; ++ dw_hdmi_qp_write(hdmi, val, PKT_AVI_CONTENTS0); ++ ++ for (i = 0; i < 4; i++) { ++ for (j = 0; j < 4; j++) { ++ if (i * 4 + j >= 14) ++ break; ++ if (!j) ++ val = buffer[i * 4 + j + 3]; ++ val |= buffer[i * 4 + j + 3] << (8 * j); ++ } ++ ++ dw_hdmi_qp_write(hdmi, val, PKT_AVI_CONTENTS1 + i * 4); ++ } ++ ++ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_AVI_FIELDRATE, PKTSCHED_PKT_CONFIG1); ++ ++ dw_hdmi_qp_mod(hdmi, PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN, ++ PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN, PKTSCHED_PKT_EN); ++ ++ return 0; ++} ++ ++static int dw_hdmi_qp_config_drm_infoframe(struct dw_hdmi_qp *hdmi, ++ const u8 *buffer, size_t len) ++{ ++ u32 val, i; ++ ++ if (len != HDMI_INFOFRAME_SIZE(DRM)) { ++ dev_err(hdmi->dev, "failed to configure drm infoframe\n"); ++ return -EINVAL; ++ } ++ ++ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_TX_EN, PKTSCHED_PKT_EN); ++ ++ val = buffer[1] << 8 | buffer[2] << 16; ++ dw_hdmi_qp_write(hdmi, val, PKT_DRMI_CONTENTS0); ++ ++ for (i = 0; i <= buffer[2]; i++) { ++ if (i % 4 == 0) ++ val = buffer[3 + i]; ++ val |= buffer[3 + i] << ((i % 4) * 8); ++ ++ if ((i % 4 == 3) || i == buffer[2]) ++ dw_hdmi_qp_write(hdmi, val, ++ PKT_DRMI_CONTENTS1 + ((i / 4) * 4)); ++ } ++ ++ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_FIELDRATE, PKTSCHED_PKT_CONFIG1); ++ dw_hdmi_qp_mod(hdmi, PKTSCHED_DRMI_TX_EN, PKTSCHED_DRMI_TX_EN, ++ PKTSCHED_PKT_EN); ++ ++ return 0; ++} ++ ++static void dw_hdmi_qp_setup(struct dw_hdmi_qp *hdmi, ++ struct drm_connector *connector) ++{ ++ bool scramb; ++ u8 ver; ++ ++ if (!connector->display_info.is_hdmi) { ++ dev_dbg(hdmi->dev, "%s DVI mode\n", __func__); ++ ++ dw_hdmi_qp_mod(hdmi, HDCP2_BYPASS, HDCP2_BYPASS, ++ HDCP2LOGIC_CONFIG0); ++ dw_hdmi_qp_mod(hdmi, OPMODE_DVI, OPMODE_DVI, LINK_CONFIG0); ++ ++ return; ++ } ++ ++ dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); ++ ++ dw_hdmi_qp_mod(hdmi, 0, OPMODE_DVI, LINK_CONFIG0); ++ dw_hdmi_qp_mod(hdmi, HDCP2_BYPASS, HDCP2_BYPASS, HDCP2LOGIC_CONFIG0); ++ ++ scramb = (hdmi->pix_clock > HDMI14_MAX_TMDSCLK); ++ ++ if (dw_hdmi_qp_support_scdc(hdmi, &connector->display_info)) { ++ if (scramb) { ++ drm_scdc_readb(hdmi->bridge.ddc, SCDC_SINK_VERSION, &ver); ++ drm_scdc_writeb(hdmi->bridge.ddc, SCDC_SOURCE_VERSION, ++ min_t(u8, ver, SCDC_MIN_SOURCE_VERSION)); ++ } ++ ++ drm_scdc_set_high_tmds_clock_ratio(connector, scramb); ++ drm_scdc_set_scrambling(connector, scramb); ++ } ++ ++ dw_hdmi_qp_write(hdmi, scramb, SCRAMB_CONFIG0); ++} ++ ++static int dw_hdmi_qp_bridge_atomic_check(struct drm_bridge *bridge, ++ struct drm_bridge_state *bridge_state, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ int ret; ++ ++ ret = drm_atomic_helper_connector_hdmi_check(conn_state->connector, ++ conn_state->state); ++ if (ret) ++ dev_dbg(hdmi->dev, "%s failed: %d\n", __func__, ret); ++ ++ return ret; ++} ++ ++static void dw_hdmi_qp_bridge_atomic_enable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_state) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ struct drm_atomic_state *state = old_state->base.state; ++ struct drm_connector *connector; ++ struct drm_connector_state *conn_state; ++ ++ connector = drm_atomic_get_new_connector_for_encoder(state, ++ bridge->encoder); ++ conn_state = drm_atomic_get_new_connector_state(state, connector); ++ ++ hdmi->pix_clock = conn_state->hdmi.tmds_char_rate; ++ hdmi->curr_conn = connector; ++ ++ hdmi->phy.ops->init(hdmi, hdmi->phy.data, &connector->display_info); ++ ++ dw_hdmi_qp_setup(hdmi, connector); ++ ++ drm_atomic_helper_connector_hdmi_update_infoframes(connector, state); ++} ++ ++static void dw_hdmi_qp_bridge_atomic_disable(struct drm_bridge *bridge, ++ struct drm_bridge_state *old_state) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ ++ hdmi->curr_conn = NULL; ++ hdmi->phy.ops->disable(hdmi, hdmi->phy.data); ++} ++ ++static enum drm_connector_status ++dw_hdmi_qp_bridge_detect(struct drm_bridge *bridge) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ ++ return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); ++} ++ ++static const struct drm_edid * ++dw_hdmi_qp_bridge_edid_read(struct drm_bridge *bridge, ++ struct drm_connector *connector) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ const struct drm_edid *drm_edid; ++ ++ if (!bridge->ddc) ++ return NULL; ++ ++ drm_edid = drm_edid_read_ddc(connector, bridge->ddc); ++ if (!drm_edid) ++ dev_dbg(hdmi->dev, "failed to get edid\n"); ++ ++ return drm_edid; ++} ++ ++static int dw_hdmi_qp_bridge_clear_infoframe(struct drm_bridge *bridge, ++ enum hdmi_infoframe_type type) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ ++ switch (type) { ++ case HDMI_INFOFRAME_TYPE_AVI: ++ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN, ++ PKTSCHED_PKT_EN); ++ break; ++ ++ case HDMI_INFOFRAME_TYPE_DRM: ++ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_TX_EN, PKTSCHED_PKT_EN); ++ break; ++ ++ default: ++ dev_dbg(hdmi->dev, "Unsupported infoframe type %x\n", type); ++ } ++ ++ return 0; ++} ++ ++static int dw_hdmi_qp_bridge_write_infoframe(struct drm_bridge *bridge, ++ enum hdmi_infoframe_type type, ++ const u8 *buffer, size_t len) ++{ ++ struct dw_hdmi_qp *hdmi = bridge->driver_private; ++ ++ dw_hdmi_qp_bridge_clear_infoframe(bridge, type); ++ ++ switch (type) { ++ case HDMI_INFOFRAME_TYPE_AVI: ++ return dw_hdmi_qp_config_avi_infoframe(hdmi, buffer, len); ++ ++ case HDMI_INFOFRAME_TYPE_DRM: ++ return dw_hdmi_qp_config_drm_infoframe(hdmi, buffer, len); ++ ++ default: ++ dev_dbg(hdmi->dev, "Unsupported infoframe type %x\n", type); ++ return 0; ++ } ++} ++ ++static const struct drm_bridge_funcs dw_hdmi_qp_bridge_funcs = { ++ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, ++ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, ++ .atomic_reset = drm_atomic_helper_bridge_reset, ++ .atomic_check = dw_hdmi_qp_bridge_atomic_check, ++ .atomic_enable = dw_hdmi_qp_bridge_atomic_enable, ++ .atomic_disable = dw_hdmi_qp_bridge_atomic_disable, ++ .detect = dw_hdmi_qp_bridge_detect, ++ .edid_read = dw_hdmi_qp_bridge_edid_read, ++ .hdmi_clear_infoframe = dw_hdmi_qp_bridge_clear_infoframe, ++ .hdmi_write_infoframe = dw_hdmi_qp_bridge_write_infoframe, ++}; ++ ++static irqreturn_t dw_hdmi_qp_main_hardirq(int irq, void *dev_id) ++{ ++ struct dw_hdmi_qp *hdmi = dev_id; ++ struct dw_hdmi_qp_i2c *i2c = hdmi->i2c; ++ u32 stat; ++ ++ stat = dw_hdmi_qp_read(hdmi, MAINUNIT_1_INT_STATUS); ++ ++ i2c->stat = stat & (I2CM_OP_DONE_IRQ | I2CM_READ_REQUEST_IRQ | ++ I2CM_NACK_RCVD_IRQ); ++ ++ if (i2c->stat) { ++ dw_hdmi_qp_write(hdmi, i2c->stat, MAINUNIT_1_INT_CLEAR); ++ complete(&i2c->cmp); ++ } ++ ++ if (stat) ++ return IRQ_HANDLED; ++ ++ return IRQ_NONE; ++} ++ ++static const struct regmap_config dw_hdmi_qp_regmap_config = { ++ .reg_bits = 32, ++ .val_bits = 32, ++ .reg_stride = 4, ++ .max_register = EARCRX_1_INT_FORCE, ++}; ++ ++static void dw_hdmi_qp_init_hw(struct dw_hdmi_qp *hdmi) ++{ ++ dw_hdmi_qp_write(hdmi, 0, MAINUNIT_0_INT_MASK_N); ++ dw_hdmi_qp_write(hdmi, 0, MAINUNIT_1_INT_MASK_N); ++ dw_hdmi_qp_write(hdmi, 428571429, TIMER_BASE_CONFIG0); ++ ++ /* Software reset */ ++ dw_hdmi_qp_write(hdmi, 0x01, I2CM_CONTROL0); ++ ++ dw_hdmi_qp_write(hdmi, 0x085c085c, I2CM_FM_SCL_CONFIG0); ++ ++ dw_hdmi_qp_mod(hdmi, 0, I2CM_FM_EN, I2CM_INTERFACE_CONTROL0); ++ ++ /* Clear DONE and ERROR interrupts */ ++ dw_hdmi_qp_write(hdmi, I2CM_OP_DONE_CLEAR | I2CM_NACK_RCVD_CLEAR, ++ MAINUNIT_1_INT_CLEAR); ++ ++ if (hdmi->phy.ops->setup_hpd) ++ hdmi->phy.ops->setup_hpd(hdmi, hdmi->phy.data); ++} ++ ++struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev, ++ struct drm_encoder *encoder, ++ const struct dw_hdmi_qp_plat_data *plat_data) ++{ ++ static const char * const clk_names[] = { ++ "pclk", "earc", "aud", "ref" /* keep "ref" last */ ++ }; ++ struct device *dev = &pdev->dev; ++ struct dw_hdmi_qp *hdmi; ++ void __iomem *regs; ++ struct clk *clk; ++ int irq, ret, i; ++ ++ if (!plat_data->phy_ops || !plat_data->phy_ops->init || ++ !plat_data->phy_ops->disable || !plat_data->phy_ops->read_hpd) { ++ dev_err(dev, "Missing platform PHY ops\n"); ++ return ERR_PTR(-ENODEV); ++ } ++ ++ hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); ++ if (!hdmi) ++ return ERR_PTR(-ENOMEM); ++ ++ hdmi->dev = dev; ++ ++ regs = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(regs)) ++ return regs; ++ ++ hdmi->regm = devm_regmap_init_mmio(dev, regs, &dw_hdmi_qp_regmap_config); ++ if (IS_ERR(hdmi->regm)) { ++ dev_err(dev, "Failed to configure regmap\n"); ++ return ERR_CAST(hdmi->regm); ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(clk_names); i++) { ++ clk = devm_clk_get_enabled(hdmi->dev, clk_names[i]); ++ ++ if (IS_ERR(clk)) { ++ if (PTR_ERR(clk) != -EPROBE_DEFER) ++ dev_err(dev, "Failed to get %s clock\n", ++ clk_names[i]); ++ return ERR_CAST(clk); ++ } ++ } ++ hdmi->ref_clk = clk; ++ ++ hdmi->phy.ops = plat_data->phy_ops; ++ hdmi->phy.data = plat_data->phy_data; ++ ++ dw_hdmi_qp_init_hw(hdmi); ++ ++ irq = platform_get_irq_byname(pdev, "main"); ++ if (irq < 0) ++ return ERR_PTR(irq); ++ ++ ret = devm_request_threaded_irq(dev, irq, ++ dw_hdmi_qp_main_hardirq, NULL, ++ IRQF_SHARED, dev_name(dev), hdmi); ++ if (ret) ++ return ERR_PTR(ret); ++ ++ hdmi->bridge.driver_private = hdmi; ++ hdmi->bridge.funcs = &dw_hdmi_qp_bridge_funcs; ++ hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | ++ DRM_BRIDGE_OP_EDID | ++ DRM_BRIDGE_OP_HDMI | ++ DRM_BRIDGE_OP_HPD; ++ hdmi->bridge.of_node = pdev->dev.of_node; ++ hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA; ++ hdmi->bridge.vendor = "Synopsys"; ++ hdmi->bridge.product = "DW HDMI QP TX"; ++ ++ hdmi->bridge.ddc = dw_hdmi_qp_i2c_adapter(hdmi); ++ if (IS_ERR(hdmi->bridge.ddc)) ++ hdmi->bridge.ddc = NULL; ++ ++ ret = devm_drm_bridge_add(dev, &hdmi->bridge); ++ if (ret) ++ return ERR_PTR(ret); ++ ++ ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, ++ DRM_BRIDGE_ATTACH_NO_CONNECTOR); ++ if (ret) ++ return ERR_PTR(ret); ++ ++ return hdmi; ++} ++EXPORT_SYMBOL_GPL(dw_hdmi_qp_bind); ++ ++void dw_hdmi_qp_unbind(struct dw_hdmi_qp *hdmi) ++{ ++} ++EXPORT_SYMBOL_GPL(dw_hdmi_qp_unbind); ++ ++void dw_hdmi_qp_resume(struct device *dev, struct dw_hdmi_qp *hdmi) ++{ ++ dw_hdmi_qp_init_hw(hdmi); ++} ++EXPORT_SYMBOL_GPL(dw_hdmi_qp_resume); ++ ++MODULE_AUTHOR("Algea Cao "); ++MODULE_AUTHOR("Cristian Ciocaltea "); ++MODULE_DESCRIPTION("DW HDMI QP transmitter driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:dw-hdmi-qp"); +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.h +@@ -0,0 +1,834 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) Rockchip Electronics Co.Ltd ++ * Author: ++ * Algea Cao ++ */ ++#ifndef __DW_HDMI_QP_H__ ++#define __DW_HDMI_QP_H__ ++ ++#include ++ ++/* Main Unit Registers */ ++#define CORE_ID 0x0 ++#define VER_NUMBER 0x4 ++#define VER_TYPE 0x8 ++#define CONFIG_REG 0xc ++#define CONFIG_CEC BIT(28) ++#define CONFIG_AUD_UD BIT(23) ++#define CORE_TIMESTAMP_HHMM 0x14 ++#define CORE_TIMESTAMP_MMDD 0x18 ++#define CORE_TIMESTAMP_YYYY 0x1c ++/* Reset Manager Registers */ ++#define GLOBAL_SWRESET_REQUEST 0x40 ++#define EARCRX_CMDC_SWINIT_P BIT(27) ++#define AVP_DATAPATH_PACKET_AUDIO_SWINIT_P BIT(10) ++#define GLOBAL_SWDISABLE 0x44 ++#define CEC_SWDISABLE BIT(17) ++#define AVP_DATAPATH_PACKET_AUDIO_SWDISABLE BIT(10) ++#define AVP_DATAPATH_VIDEO_SWDISABLE BIT(6) ++#define RESET_MANAGER_CONFIG0 0x48 ++#define RESET_MANAGER_STATUS0 0x50 ++#define RESET_MANAGER_STATUS1 0x54 ++#define RESET_MANAGER_STATUS2 0x58 ++/* Timer Base Registers */ ++#define TIMER_BASE_CONFIG0 0x80 ++#define TIMER_BASE_STATUS0 0x84 ++/* CMU Registers */ ++#define CMU_CONFIG0 0xa0 ++#define CMU_CONFIG1 0xa4 ++#define CMU_CONFIG2 0xa8 ++#define CMU_CONFIG3 0xac ++#define CMU_STATUS 0xb0 ++#define DISPLAY_CLK_MONITOR 0x3f ++#define DISPLAY_CLK_LOCKED 0X15 ++#define EARC_BPCLK_OFF BIT(9) ++#define AUDCLK_OFF BIT(7) ++#define LINKQPCLK_OFF BIT(5) ++#define VIDQPCLK_OFF BIT(3) ++#define IPI_CLK_OFF BIT(1) ++#define CMU_IPI_CLK_FREQ 0xb4 ++#define CMU_VIDQPCLK_FREQ 0xb8 ++#define CMU_LINKQPCLK_FREQ 0xbc ++#define CMU_AUDQPCLK_FREQ 0xc0 ++#define CMU_EARC_BPCLK_FREQ 0xc4 ++/* I2CM Registers */ ++#define I2CM_SM_SCL_CONFIG0 0xe0 ++#define I2CM_FM_SCL_CONFIG0 0xe4 ++#define I2CM_CONFIG0 0xe8 ++#define I2CM_CONTROL0 0xec ++#define I2CM_STATUS0 0xf0 ++#define I2CM_INTERFACE_CONTROL0 0xf4 ++#define I2CM_ADDR 0xff000 ++#define I2CM_SLVADDR 0xfe0 ++#define I2CM_WR_MASK 0x1e ++#define I2CM_EXT_READ BIT(4) ++#define I2CM_SHORT_READ BIT(3) ++#define I2CM_FM_READ BIT(2) ++#define I2CM_FM_WRITE BIT(1) ++#define I2CM_FM_EN BIT(0) ++#define I2CM_INTERFACE_CONTROL1 0xf8 ++#define I2CM_SEG_PTR 0x7f80 ++#define I2CM_SEG_ADDR 0x7f ++#define I2CM_INTERFACE_WRDATA_0_3 0xfc ++#define I2CM_INTERFACE_WRDATA_4_7 0x100 ++#define I2CM_INTERFACE_WRDATA_8_11 0x104 ++#define I2CM_INTERFACE_WRDATA_12_15 0x108 ++#define I2CM_INTERFACE_RDDATA_0_3 0x10c ++#define I2CM_INTERFACE_RDDATA_4_7 0x110 ++#define I2CM_INTERFACE_RDDATA_8_11 0x114 ++#define I2CM_INTERFACE_RDDATA_12_15 0x118 ++/* SCDC Registers */ ++#define SCDC_CONFIG0 0x140 ++#define SCDC_I2C_FM_EN BIT(12) ++#define SCDC_UPD_FLAGS_AUTO_CLR BIT(6) ++#define SCDC_UPD_FLAGS_POLL_EN BIT(4) ++#define SCDC_CONTROL0 0x148 ++#define SCDC_STATUS0 0x150 ++#define STATUS_UPDATE BIT(0) ++#define FRL_START BIT(4) ++#define FLT_UPDATE BIT(5) ++/* FLT Registers */ ++#define FLT_CONFIG0 0x160 ++#define FLT_CONFIG1 0x164 ++#define FLT_CONFIG2 0x168 ++#define FLT_CONTROL0 0x170 ++/* Main Unit 2 Registers */ ++#define MAINUNIT_STATUS0 0x180 ++/* Video Interface Registers */ ++#define VIDEO_INTERFACE_CONFIG0 0x800 ++#define VIDEO_INTERFACE_CONFIG1 0x804 ++#define VIDEO_INTERFACE_CONFIG2 0x808 ++#define VIDEO_INTERFACE_CONTROL0 0x80c ++#define VIDEO_INTERFACE_STATUS0 0x814 ++/* Video Packing Registers */ ++#define VIDEO_PACKING_CONFIG0 0x81c ++/* Audio Interface Registers */ ++#define AUDIO_INTERFACE_CONFIG0 0x820 ++#define AUD_IF_SEL_MSK 0x3 ++#define AUD_IF_SPDIF 0x2 ++#define AUD_IF_I2S 0x1 ++#define AUD_IF_PAI 0x0 ++#define AUD_FIFO_INIT_ON_OVF_MSK BIT(2) ++#define AUD_FIFO_INIT_ON_OVF_EN BIT(2) ++#define I2S_LINES_EN_MSK GENMASK(7, 4) ++#define I2S_LINES_EN(x) BIT((x) + 4) ++#define I2S_BPCUV_RCV_MSK BIT(12) ++#define I2S_BPCUV_RCV_EN BIT(12) ++#define I2S_BPCUV_RCV_DIS 0 ++#define SPDIF_LINES_EN GENMASK(19, 16) ++#define AUD_FORMAT_MSK GENMASK(26, 24) ++#define AUD_3DOBA (0x7 << 24) ++#define AUD_3DASP (0x6 << 24) ++#define AUD_MSOBA (0x5 << 24) ++#define AUD_MSASP (0x4 << 24) ++#define AUD_HBR (0x3 << 24) ++#define AUD_DST (0x2 << 24) ++#define AUD_OBA (0x1 << 24) ++#define AUD_ASP (0x0 << 24) ++#define AUDIO_INTERFACE_CONFIG1 0x824 ++#define AUDIO_INTERFACE_CONTROL0 0x82c ++#define AUDIO_FIFO_CLR_P BIT(0) ++#define AUDIO_INTERFACE_STATUS0 0x834 ++/* Frame Composer Registers */ ++#define FRAME_COMPOSER_CONFIG0 0x840 ++#define FRAME_COMPOSER_CONFIG1 0x844 ++#define FRAME_COMPOSER_CONFIG2 0x848 ++#define FRAME_COMPOSER_CONFIG3 0x84c ++#define FRAME_COMPOSER_CONFIG4 0x850 ++#define FRAME_COMPOSER_CONFIG5 0x854 ++#define FRAME_COMPOSER_CONFIG6 0x858 ++#define FRAME_COMPOSER_CONFIG7 0x85c ++#define FRAME_COMPOSER_CONFIG8 0x860 ++#define FRAME_COMPOSER_CONFIG9 0x864 ++#define FRAME_COMPOSER_CONTROL0 0x86c ++/* Video Monitor Registers */ ++#define VIDEO_MONITOR_CONFIG0 0x880 ++#define VIDEO_MONITOR_STATUS0 0x884 ++#define VIDEO_MONITOR_STATUS1 0x888 ++#define VIDEO_MONITOR_STATUS2 0x88c ++#define VIDEO_MONITOR_STATUS3 0x890 ++#define VIDEO_MONITOR_STATUS4 0x894 ++#define VIDEO_MONITOR_STATUS5 0x898 ++#define VIDEO_MONITOR_STATUS6 0x89c ++/* HDCP2 Logic Registers */ ++#define HDCP2LOGIC_CONFIG0 0x8e0 ++#define HDCP2_BYPASS BIT(0) ++#define HDCP2LOGIC_ESM_GPIO_IN 0x8e4 ++#define HDCP2LOGIC_ESM_GPIO_OUT 0x8e8 ++/* HDCP14 Registers */ ++#define HDCP14_CONFIG0 0x900 ++#define HDCP14_CONFIG1 0x904 ++#define HDCP14_CONFIG2 0x908 ++#define HDCP14_CONFIG3 0x90c ++#define HDCP14_KEY_SEED 0x914 ++#define HDCP14_KEY_H 0x918 ++#define HDCP14_KEY_L 0x91c ++#define HDCP14_KEY_STATUS 0x920 ++#define HDCP14_AKSV_H 0x924 ++#define HDCP14_AKSV_L 0x928 ++#define HDCP14_AN_H 0x92c ++#define HDCP14_AN_L 0x930 ++#define HDCP14_STATUS0 0x934 ++#define HDCP14_STATUS1 0x938 ++/* Scrambler Registers */ ++#define SCRAMB_CONFIG0 0x960 ++/* Video Configuration Registers */ ++#define LINK_CONFIG0 0x968 ++#define OPMODE_FRL_4LANES BIT(8) ++#define OPMODE_DVI BIT(4) ++#define OPMODE_FRL BIT(0) ++/* TMDS FIFO Registers */ ++#define TMDS_FIFO_CONFIG0 0x970 ++#define TMDS_FIFO_CONTROL0 0x974 ++/* FRL RSFEC Registers */ ++#define FRL_RSFEC_CONFIG0 0xa20 ++#define FRL_RSFEC_STATUS0 0xa30 ++/* FRL Packetizer Registers */ ++#define FRL_PKTZ_CONFIG0 0xa40 ++#define FRL_PKTZ_CONTROL0 0xa44 ++#define FRL_PKTZ_CONTROL1 0xa50 ++#define FRL_PKTZ_STATUS1 0xa54 ++/* Packet Scheduler Registers */ ++#define PKTSCHED_CONFIG0 0xa80 ++#define PKTSCHED_PRQUEUE0_CONFIG0 0xa84 ++#define PKTSCHED_PRQUEUE1_CONFIG0 0xa88 ++#define PKTSCHED_PRQUEUE2_CONFIG0 0xa8c ++#define PKTSCHED_PRQUEUE2_CONFIG1 0xa90 ++#define PKTSCHED_PRQUEUE2_CONFIG2 0xa94 ++#define PKTSCHED_PKT_CONFIG0 0xa98 ++#define PKTSCHED_PKT_CONFIG1 0xa9c ++#define PKTSCHED_DRMI_FIELDRATE BIT(13) ++#define PKTSCHED_AVI_FIELDRATE BIT(12) ++#define PKTSCHED_PKT_CONFIG2 0xaa0 ++#define PKTSCHED_PKT_CONFIG3 0xaa4 ++#define PKTSCHED_PKT_EN 0xaa8 ++#define PKTSCHED_DRMI_TX_EN BIT(17) ++#define PKTSCHED_AUDI_TX_EN BIT(15) ++#define PKTSCHED_AVI_TX_EN BIT(13) ++#define PKTSCHED_EMP_CVTEM_TX_EN BIT(10) ++#define PKTSCHED_AMD_TX_EN BIT(8) ++#define PKTSCHED_GCP_TX_EN BIT(3) ++#define PKTSCHED_AUDS_TX_EN BIT(2) ++#define PKTSCHED_ACR_TX_EN BIT(1) ++#define PKTSCHED_NULL_TX_EN BIT(0) ++#define PKTSCHED_PKT_CONTROL0 0xaac ++#define PKTSCHED_PKT_SEND 0xab0 ++#define PKTSCHED_PKT_STATUS0 0xab4 ++#define PKTSCHED_PKT_STATUS1 0xab8 ++#define PKT_NULL_CONTENTS0 0xb00 ++#define PKT_NULL_CONTENTS1 0xb04 ++#define PKT_NULL_CONTENTS2 0xb08 ++#define PKT_NULL_CONTENTS3 0xb0c ++#define PKT_NULL_CONTENTS4 0xb10 ++#define PKT_NULL_CONTENTS5 0xb14 ++#define PKT_NULL_CONTENTS6 0xb18 ++#define PKT_NULL_CONTENTS7 0xb1c ++#define PKT_ACP_CONTENTS0 0xb20 ++#define PKT_ACP_CONTENTS1 0xb24 ++#define PKT_ACP_CONTENTS2 0xb28 ++#define PKT_ACP_CONTENTS3 0xb2c ++#define PKT_ACP_CONTENTS4 0xb30 ++#define PKT_ACP_CONTENTS5 0xb34 ++#define PKT_ACP_CONTENTS6 0xb38 ++#define PKT_ACP_CONTENTS7 0xb3c ++#define PKT_ISRC1_CONTENTS0 0xb40 ++#define PKT_ISRC1_CONTENTS1 0xb44 ++#define PKT_ISRC1_CONTENTS2 0xb48 ++#define PKT_ISRC1_CONTENTS3 0xb4c ++#define PKT_ISRC1_CONTENTS4 0xb50 ++#define PKT_ISRC1_CONTENTS5 0xb54 ++#define PKT_ISRC1_CONTENTS6 0xb58 ++#define PKT_ISRC1_CONTENTS7 0xb5c ++#define PKT_ISRC2_CONTENTS0 0xb60 ++#define PKT_ISRC2_CONTENTS1 0xb64 ++#define PKT_ISRC2_CONTENTS2 0xb68 ++#define PKT_ISRC2_CONTENTS3 0xb6c ++#define PKT_ISRC2_CONTENTS4 0xb70 ++#define PKT_ISRC2_CONTENTS5 0xb74 ++#define PKT_ISRC2_CONTENTS6 0xb78 ++#define PKT_ISRC2_CONTENTS7 0xb7c ++#define PKT_GMD_CONTENTS0 0xb80 ++#define PKT_GMD_CONTENTS1 0xb84 ++#define PKT_GMD_CONTENTS2 0xb88 ++#define PKT_GMD_CONTENTS3 0xb8c ++#define PKT_GMD_CONTENTS4 0xb90 ++#define PKT_GMD_CONTENTS5 0xb94 ++#define PKT_GMD_CONTENTS6 0xb98 ++#define PKT_GMD_CONTENTS7 0xb9c ++#define PKT_AMD_CONTENTS0 0xba0 ++#define PKT_AMD_CONTENTS1 0xba4 ++#define PKT_AMD_CONTENTS2 0xba8 ++#define PKT_AMD_CONTENTS3 0xbac ++#define PKT_AMD_CONTENTS4 0xbb0 ++#define PKT_AMD_CONTENTS5 0xbb4 ++#define PKT_AMD_CONTENTS6 0xbb8 ++#define PKT_AMD_CONTENTS7 0xbbc ++#define PKT_VSI_CONTENTS0 0xbc0 ++#define PKT_VSI_CONTENTS1 0xbc4 ++#define PKT_VSI_CONTENTS2 0xbc8 ++#define PKT_VSI_CONTENTS3 0xbcc ++#define PKT_VSI_CONTENTS4 0xbd0 ++#define PKT_VSI_CONTENTS5 0xbd4 ++#define PKT_VSI_CONTENTS6 0xbd8 ++#define PKT_VSI_CONTENTS7 0xbdc ++#define PKT_AVI_CONTENTS0 0xbe0 ++#define HDMI_FC_AVICONF0_ACTIVE_FMT_INFO_PRESENT BIT(4) ++#define HDMI_FC_AVICONF0_BAR_DATA_VERT_BAR 0x04 ++#define HDMI_FC_AVICONF0_BAR_DATA_HORIZ_BAR 0x08 ++#define HDMI_FC_AVICONF2_IT_CONTENT_VALID 0x80 ++#define PKT_AVI_CONTENTS1 0xbe4 ++#define PKT_AVI_CONTENTS2 0xbe8 ++#define PKT_AVI_CONTENTS3 0xbec ++#define PKT_AVI_CONTENTS4 0xbf0 ++#define PKT_AVI_CONTENTS5 0xbf4 ++#define PKT_AVI_CONTENTS6 0xbf8 ++#define PKT_AVI_CONTENTS7 0xbfc ++#define PKT_SPDI_CONTENTS0 0xc00 ++#define PKT_SPDI_CONTENTS1 0xc04 ++#define PKT_SPDI_CONTENTS2 0xc08 ++#define PKT_SPDI_CONTENTS3 0xc0c ++#define PKT_SPDI_CONTENTS4 0xc10 ++#define PKT_SPDI_CONTENTS5 0xc14 ++#define PKT_SPDI_CONTENTS6 0xc18 ++#define PKT_SPDI_CONTENTS7 0xc1c ++#define PKT_AUDI_CONTENTS0 0xc20 ++#define PKT_AUDI_CONTENTS1 0xc24 ++#define PKT_AUDI_CONTENTS2 0xc28 ++#define PKT_AUDI_CONTENTS3 0xc2c ++#define PKT_AUDI_CONTENTS4 0xc30 ++#define PKT_AUDI_CONTENTS5 0xc34 ++#define PKT_AUDI_CONTENTS6 0xc38 ++#define PKT_AUDI_CONTENTS7 0xc3c ++#define PKT_NVI_CONTENTS0 0xc40 ++#define PKT_NVI_CONTENTS1 0xc44 ++#define PKT_NVI_CONTENTS2 0xc48 ++#define PKT_NVI_CONTENTS3 0xc4c ++#define PKT_NVI_CONTENTS4 0xc50 ++#define PKT_NVI_CONTENTS5 0xc54 ++#define PKT_NVI_CONTENTS6 0xc58 ++#define PKT_NVI_CONTENTS7 0xc5c ++#define PKT_DRMI_CONTENTS0 0xc60 ++#define PKT_DRMI_CONTENTS1 0xc64 ++#define PKT_DRMI_CONTENTS2 0xc68 ++#define PKT_DRMI_CONTENTS3 0xc6c ++#define PKT_DRMI_CONTENTS4 0xc70 ++#define PKT_DRMI_CONTENTS5 0xc74 ++#define PKT_DRMI_CONTENTS6 0xc78 ++#define PKT_DRMI_CONTENTS7 0xc7c ++#define PKT_GHDMI1_CONTENTS0 0xc80 ++#define PKT_GHDMI1_CONTENTS1 0xc84 ++#define PKT_GHDMI1_CONTENTS2 0xc88 ++#define PKT_GHDMI1_CONTENTS3 0xc8c ++#define PKT_GHDMI1_CONTENTS4 0xc90 ++#define PKT_GHDMI1_CONTENTS5 0xc94 ++#define PKT_GHDMI1_CONTENTS6 0xc98 ++#define PKT_GHDMI1_CONTENTS7 0xc9c ++#define PKT_GHDMI2_CONTENTS0 0xca0 ++#define PKT_GHDMI2_CONTENTS1 0xca4 ++#define PKT_GHDMI2_CONTENTS2 0xca8 ++#define PKT_GHDMI2_CONTENTS3 0xcac ++#define PKT_GHDMI2_CONTENTS4 0xcb0 ++#define PKT_GHDMI2_CONTENTS5 0xcb4 ++#define PKT_GHDMI2_CONTENTS6 0xcb8 ++#define PKT_GHDMI2_CONTENTS7 0xcbc ++/* EMP Packetizer Registers */ ++#define PKT_EMP_CONFIG0 0xce0 ++#define PKT_EMP_CONTROL0 0xcec ++#define PKT_EMP_CONTROL1 0xcf0 ++#define PKT_EMP_CONTROL2 0xcf4 ++#define PKT_EMP_VTEM_CONTENTS0 0xd00 ++#define PKT_EMP_VTEM_CONTENTS1 0xd04 ++#define PKT_EMP_VTEM_CONTENTS2 0xd08 ++#define PKT_EMP_VTEM_CONTENTS3 0xd0c ++#define PKT_EMP_VTEM_CONTENTS4 0xd10 ++#define PKT_EMP_VTEM_CONTENTS5 0xd14 ++#define PKT_EMP_VTEM_CONTENTS6 0xd18 ++#define PKT_EMP_VTEM_CONTENTS7 0xd1c ++#define PKT0_EMP_CVTEM_CONTENTS0 0xd20 ++#define PKT0_EMP_CVTEM_CONTENTS1 0xd24 ++#define PKT0_EMP_CVTEM_CONTENTS2 0xd28 ++#define PKT0_EMP_CVTEM_CONTENTS3 0xd2c ++#define PKT0_EMP_CVTEM_CONTENTS4 0xd30 ++#define PKT0_EMP_CVTEM_CONTENTS5 0xd34 ++#define PKT0_EMP_CVTEM_CONTENTS6 0xd38 ++#define PKT0_EMP_CVTEM_CONTENTS7 0xd3c ++#define PKT1_EMP_CVTEM_CONTENTS0 0xd40 ++#define PKT1_EMP_CVTEM_CONTENTS1 0xd44 ++#define PKT1_EMP_CVTEM_CONTENTS2 0xd48 ++#define PKT1_EMP_CVTEM_CONTENTS3 0xd4c ++#define PKT1_EMP_CVTEM_CONTENTS4 0xd50 ++#define PKT1_EMP_CVTEM_CONTENTS5 0xd54 ++#define PKT1_EMP_CVTEM_CONTENTS6 0xd58 ++#define PKT1_EMP_CVTEM_CONTENTS7 0xd5c ++#define PKT2_EMP_CVTEM_CONTENTS0 0xd60 ++#define PKT2_EMP_CVTEM_CONTENTS1 0xd64 ++#define PKT2_EMP_CVTEM_CONTENTS2 0xd68 ++#define PKT2_EMP_CVTEM_CONTENTS3 0xd6c ++#define PKT2_EMP_CVTEM_CONTENTS4 0xd70 ++#define PKT2_EMP_CVTEM_CONTENTS5 0xd74 ++#define PKT2_EMP_CVTEM_CONTENTS6 0xd78 ++#define PKT2_EMP_CVTEM_CONTENTS7 0xd7c ++#define PKT3_EMP_CVTEM_CONTENTS0 0xd80 ++#define PKT3_EMP_CVTEM_CONTENTS1 0xd84 ++#define PKT3_EMP_CVTEM_CONTENTS2 0xd88 ++#define PKT3_EMP_CVTEM_CONTENTS3 0xd8c ++#define PKT3_EMP_CVTEM_CONTENTS4 0xd90 ++#define PKT3_EMP_CVTEM_CONTENTS5 0xd94 ++#define PKT3_EMP_CVTEM_CONTENTS6 0xd98 ++#define PKT3_EMP_CVTEM_CONTENTS7 0xd9c ++#define PKT4_EMP_CVTEM_CONTENTS0 0xda0 ++#define PKT4_EMP_CVTEM_CONTENTS1 0xda4 ++#define PKT4_EMP_CVTEM_CONTENTS2 0xda8 ++#define PKT4_EMP_CVTEM_CONTENTS3 0xdac ++#define PKT4_EMP_CVTEM_CONTENTS4 0xdb0 ++#define PKT4_EMP_CVTEM_CONTENTS5 0xdb4 ++#define PKT4_EMP_CVTEM_CONTENTS6 0xdb8 ++#define PKT4_EMP_CVTEM_CONTENTS7 0xdbc ++#define PKT5_EMP_CVTEM_CONTENTS0 0xdc0 ++#define PKT5_EMP_CVTEM_CONTENTS1 0xdc4 ++#define PKT5_EMP_CVTEM_CONTENTS2 0xdc8 ++#define PKT5_EMP_CVTEM_CONTENTS3 0xdcc ++#define PKT5_EMP_CVTEM_CONTENTS4 0xdd0 ++#define PKT5_EMP_CVTEM_CONTENTS5 0xdd4 ++#define PKT5_EMP_CVTEM_CONTENTS6 0xdd8 ++#define PKT5_EMP_CVTEM_CONTENTS7 0xddc ++/* Audio Packetizer Registers */ ++#define AUDPKT_CONTROL0 0xe20 ++#define AUDPKT_PBIT_FORCE_EN_MASK BIT(12) ++#define AUDPKT_PBIT_FORCE_EN BIT(12) ++#define AUDPKT_CHSTATUS_OVR_EN_MASK BIT(0) ++#define AUDPKT_CHSTATUS_OVR_EN BIT(0) ++#define AUDPKT_CONTROL1 0xe24 ++#define AUDPKT_ACR_CONTROL0 0xe40 ++#define AUDPKT_ACR_N_VALUE 0xfffff ++#define AUDPKT_ACR_CONTROL1 0xe44 ++#define AUDPKT_ACR_CTS_OVR_VAL_MSK GENMASK(23, 4) ++#define AUDPKT_ACR_CTS_OVR_VAL(x) ((x) << 4) ++#define AUDPKT_ACR_CTS_OVR_EN_MSK BIT(1) ++#define AUDPKT_ACR_CTS_OVR_EN BIT(1) ++#define AUDPKT_ACR_STATUS0 0xe4c ++#define AUDPKT_CHSTATUS_OVR0 0xe60 ++#define AUDPKT_CHSTATUS_OVR1 0xe64 ++/* IEC60958 Byte 3: Sampleing frenuency Bits 24 to 27 */ ++#define AUDPKT_CHSTATUS_SR_MASK GENMASK(3, 0) ++#define AUDPKT_CHSTATUS_SR_22050 0x4 ++#define AUDPKT_CHSTATUS_SR_24000 0x6 ++#define AUDPKT_CHSTATUS_SR_32000 0x3 ++#define AUDPKT_CHSTATUS_SR_44100 0x0 ++#define AUDPKT_CHSTATUS_SR_48000 0x2 ++#define AUDPKT_CHSTATUS_SR_88200 0x8 ++#define AUDPKT_CHSTATUS_SR_96000 0xa ++#define AUDPKT_CHSTATUS_SR_176400 0xc ++#define AUDPKT_CHSTATUS_SR_192000 0xe ++#define AUDPKT_CHSTATUS_SR_768000 0x9 ++#define AUDPKT_CHSTATUS_SR_NOT_INDICATED 0x1 ++/* IEC60958 Byte 4: Original Sampleing frenuency Bits 36 to 39 */ ++#define AUDPKT_CHSTATUS_0SR_MASK GENMASK(15, 12) ++#define AUDPKT_CHSTATUS_OSR_8000 0x6 ++#define AUDPKT_CHSTATUS_OSR_11025 0xa ++#define AUDPKT_CHSTATUS_OSR_12000 0x2 ++#define AUDPKT_CHSTATUS_OSR_16000 0x8 ++#define AUDPKT_CHSTATUS_OSR_22050 0xb ++#define AUDPKT_CHSTATUS_OSR_24000 0x9 ++#define AUDPKT_CHSTATUS_OSR_32000 0xc ++#define AUDPKT_CHSTATUS_OSR_44100 0xf ++#define AUDPKT_CHSTATUS_OSR_48000 0xd ++#define AUDPKT_CHSTATUS_OSR_88200 0x7 ++#define AUDPKT_CHSTATUS_OSR_96000 0x5 ++#define AUDPKT_CHSTATUS_OSR_176400 0x3 ++#define AUDPKT_CHSTATUS_OSR_192000 0x1 ++#define AUDPKT_CHSTATUS_OSR_NOT_INDICATED 0x0 ++#define AUDPKT_CHSTATUS_OVR2 0xe68 ++#define AUDPKT_CHSTATUS_OVR3 0xe6c ++#define AUDPKT_CHSTATUS_OVR4 0xe70 ++#define AUDPKT_CHSTATUS_OVR5 0xe74 ++#define AUDPKT_CHSTATUS_OVR6 0xe78 ++#define AUDPKT_CHSTATUS_OVR7 0xe7c ++#define AUDPKT_CHSTATUS_OVR8 0xe80 ++#define AUDPKT_CHSTATUS_OVR9 0xe84 ++#define AUDPKT_CHSTATUS_OVR10 0xe88 ++#define AUDPKT_CHSTATUS_OVR11 0xe8c ++#define AUDPKT_CHSTATUS_OVR12 0xe90 ++#define AUDPKT_CHSTATUS_OVR13 0xe94 ++#define AUDPKT_CHSTATUS_OVR14 0xe98 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC0 0xea0 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC1 0xea4 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC2 0xea8 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC3 0xeac ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC4 0xeb0 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC5 0xeb4 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC6 0xeb8 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC7 0xebc ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC8 0xec0 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC9 0xec4 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC10 0xec8 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC11 0xecc ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC12 0xed0 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC13 0xed4 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC14 0xed8 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC15 0xedc ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC16 0xee0 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC17 0xee4 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC18 0xee8 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC19 0xeec ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC20 0xef0 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC21 0xef4 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC22 0xef8 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC23 0xefc ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC24 0xf00 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC25 0xf04 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC26 0xf08 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC27 0xf0c ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC28 0xf10 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC29 0xf14 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC30 0xf18 ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC31 0xf1c ++#define AUDPKT_USRDATA_OVR_MSG_GENERIC32 0xf20 ++#define AUDPKT_VBIT_OVR0 0xf24 ++/* CEC Registers */ ++#define CEC_TX_CONTROL 0x1000 ++#define CEC_STATUS 0x1004 ++#define CEC_CONFIG 0x1008 ++#define CEC_ADDR 0x100c ++#define CEC_TX_COUNT 0x1020 ++#define CEC_TX_DATA3_0 0x1024 ++#define CEC_TX_DATA7_4 0x1028 ++#define CEC_TX_DATA11_8 0x102c ++#define CEC_TX_DATA15_12 0x1030 ++#define CEC_RX_COUNT_STATUS 0x1040 ++#define CEC_RX_DATA3_0 0x1044 ++#define CEC_RX_DATA7_4 0x1048 ++#define CEC_RX_DATA11_8 0x104c ++#define CEC_RX_DATA15_12 0x1050 ++#define CEC_LOCK_CONTROL 0x1054 ++#define CEC_RXQUAL_BITTIME_CONFIG 0x1060 ++#define CEC_RX_BITTIME_CONFIG 0x1064 ++#define CEC_TX_BITTIME_CONFIG 0x1068 ++/* eARC RX CMDC Registers */ ++#define EARCRX_CMDC_CONFIG0 0x1800 ++#define EARCRX_XACTREAD_STOP_CFG BIT(26) ++#define EARCRX_XACTREAD_RETRY_CFG BIT(25) ++#define EARCRX_CMDC_DSCVR_EARCVALID0_TO_DISC1 BIT(24) ++#define EARCRX_CMDC_XACT_RESTART_EN BIT(18) ++#define EARCRX_CMDC_CONFIG1 0x1804 ++#define EARCRX_CMDC_CONTROL 0x1808 ++#define EARCRX_CMDC_HEARTBEAT_LOSS_EN BIT(4) ++#define EARCRX_CMDC_DISCOVERY_EN BIT(3) ++#define EARCRX_CONNECTOR_HPD BIT(1) ++#define EARCRX_CMDC_WHITELIST0_CONFIG 0x180c ++#define EARCRX_CMDC_WHITELIST1_CONFIG 0x1810 ++#define EARCRX_CMDC_WHITELIST2_CONFIG 0x1814 ++#define EARCRX_CMDC_WHITELIST3_CONFIG 0x1818 ++#define EARCRX_CMDC_STATUS 0x181c ++#define EARCRX_CMDC_XACT_INFO 0x1820 ++#define EARCRX_CMDC_XACT_ACTION 0x1824 ++#define EARCRX_CMDC_HEARTBEAT_RXSTAT_SE 0x1828 ++#define EARCRX_CMDC_HEARTBEAT_STATUS 0x182c ++#define EARCRX_CMDC_XACT_WR0 0x1840 ++#define EARCRX_CMDC_XACT_WR1 0x1844 ++#define EARCRX_CMDC_XACT_WR2 0x1848 ++#define EARCRX_CMDC_XACT_WR3 0x184c ++#define EARCRX_CMDC_XACT_WR4 0x1850 ++#define EARCRX_CMDC_XACT_WR5 0x1854 ++#define EARCRX_CMDC_XACT_WR6 0x1858 ++#define EARCRX_CMDC_XACT_WR7 0x185c ++#define EARCRX_CMDC_XACT_WR8 0x1860 ++#define EARCRX_CMDC_XACT_WR9 0x1864 ++#define EARCRX_CMDC_XACT_WR10 0x1868 ++#define EARCRX_CMDC_XACT_WR11 0x186c ++#define EARCRX_CMDC_XACT_WR12 0x1870 ++#define EARCRX_CMDC_XACT_WR13 0x1874 ++#define EARCRX_CMDC_XACT_WR14 0x1878 ++#define EARCRX_CMDC_XACT_WR15 0x187c ++#define EARCRX_CMDC_XACT_WR16 0x1880 ++#define EARCRX_CMDC_XACT_WR17 0x1884 ++#define EARCRX_CMDC_XACT_WR18 0x1888 ++#define EARCRX_CMDC_XACT_WR19 0x188c ++#define EARCRX_CMDC_XACT_WR20 0x1890 ++#define EARCRX_CMDC_XACT_WR21 0x1894 ++#define EARCRX_CMDC_XACT_WR22 0x1898 ++#define EARCRX_CMDC_XACT_WR23 0x189c ++#define EARCRX_CMDC_XACT_WR24 0x18a0 ++#define EARCRX_CMDC_XACT_WR25 0x18a4 ++#define EARCRX_CMDC_XACT_WR26 0x18a8 ++#define EARCRX_CMDC_XACT_WR27 0x18ac ++#define EARCRX_CMDC_XACT_WR28 0x18b0 ++#define EARCRX_CMDC_XACT_WR29 0x18b4 ++#define EARCRX_CMDC_XACT_WR30 0x18b8 ++#define EARCRX_CMDC_XACT_WR31 0x18bc ++#define EARCRX_CMDC_XACT_WR32 0x18c0 ++#define EARCRX_CMDC_XACT_WR33 0x18c4 ++#define EARCRX_CMDC_XACT_WR34 0x18c8 ++#define EARCRX_CMDC_XACT_WR35 0x18cc ++#define EARCRX_CMDC_XACT_WR36 0x18d0 ++#define EARCRX_CMDC_XACT_WR37 0x18d4 ++#define EARCRX_CMDC_XACT_WR38 0x18d8 ++#define EARCRX_CMDC_XACT_WR39 0x18dc ++#define EARCRX_CMDC_XACT_WR40 0x18e0 ++#define EARCRX_CMDC_XACT_WR41 0x18e4 ++#define EARCRX_CMDC_XACT_WR42 0x18e8 ++#define EARCRX_CMDC_XACT_WR43 0x18ec ++#define EARCRX_CMDC_XACT_WR44 0x18f0 ++#define EARCRX_CMDC_XACT_WR45 0x18f4 ++#define EARCRX_CMDC_XACT_WR46 0x18f8 ++#define EARCRX_CMDC_XACT_WR47 0x18fc ++#define EARCRX_CMDC_XACT_WR48 0x1900 ++#define EARCRX_CMDC_XACT_WR49 0x1904 ++#define EARCRX_CMDC_XACT_WR50 0x1908 ++#define EARCRX_CMDC_XACT_WR51 0x190c ++#define EARCRX_CMDC_XACT_WR52 0x1910 ++#define EARCRX_CMDC_XACT_WR53 0x1914 ++#define EARCRX_CMDC_XACT_WR54 0x1918 ++#define EARCRX_CMDC_XACT_WR55 0x191c ++#define EARCRX_CMDC_XACT_WR56 0x1920 ++#define EARCRX_CMDC_XACT_WR57 0x1924 ++#define EARCRX_CMDC_XACT_WR58 0x1928 ++#define EARCRX_CMDC_XACT_WR59 0x192c ++#define EARCRX_CMDC_XACT_WR60 0x1930 ++#define EARCRX_CMDC_XACT_WR61 0x1934 ++#define EARCRX_CMDC_XACT_WR62 0x1938 ++#define EARCRX_CMDC_XACT_WR63 0x193c ++#define EARCRX_CMDC_XACT_WR64 0x1940 ++#define EARCRX_CMDC_XACT_RD0 0x1960 ++#define EARCRX_CMDC_XACT_RD1 0x1964 ++#define EARCRX_CMDC_XACT_RD2 0x1968 ++#define EARCRX_CMDC_XACT_RD3 0x196c ++#define EARCRX_CMDC_XACT_RD4 0x1970 ++#define EARCRX_CMDC_XACT_RD5 0x1974 ++#define EARCRX_CMDC_XACT_RD6 0x1978 ++#define EARCRX_CMDC_XACT_RD7 0x197c ++#define EARCRX_CMDC_XACT_RD8 0x1980 ++#define EARCRX_CMDC_XACT_RD9 0x1984 ++#define EARCRX_CMDC_XACT_RD10 0x1988 ++#define EARCRX_CMDC_XACT_RD11 0x198c ++#define EARCRX_CMDC_XACT_RD12 0x1990 ++#define EARCRX_CMDC_XACT_RD13 0x1994 ++#define EARCRX_CMDC_XACT_RD14 0x1998 ++#define EARCRX_CMDC_XACT_RD15 0x199c ++#define EARCRX_CMDC_XACT_RD16 0x19a0 ++#define EARCRX_CMDC_XACT_RD17 0x19a4 ++#define EARCRX_CMDC_XACT_RD18 0x19a8 ++#define EARCRX_CMDC_XACT_RD19 0x19ac ++#define EARCRX_CMDC_XACT_RD20 0x19b0 ++#define EARCRX_CMDC_XACT_RD21 0x19b4 ++#define EARCRX_CMDC_XACT_RD22 0x19b8 ++#define EARCRX_CMDC_XACT_RD23 0x19bc ++#define EARCRX_CMDC_XACT_RD24 0x19c0 ++#define EARCRX_CMDC_XACT_RD25 0x19c4 ++#define EARCRX_CMDC_XACT_RD26 0x19c8 ++#define EARCRX_CMDC_XACT_RD27 0x19cc ++#define EARCRX_CMDC_XACT_RD28 0x19d0 ++#define EARCRX_CMDC_XACT_RD29 0x19d4 ++#define EARCRX_CMDC_XACT_RD30 0x19d8 ++#define EARCRX_CMDC_XACT_RD31 0x19dc ++#define EARCRX_CMDC_XACT_RD32 0x19e0 ++#define EARCRX_CMDC_XACT_RD33 0x19e4 ++#define EARCRX_CMDC_XACT_RD34 0x19e8 ++#define EARCRX_CMDC_XACT_RD35 0x19ec ++#define EARCRX_CMDC_XACT_RD36 0x19f0 ++#define EARCRX_CMDC_XACT_RD37 0x19f4 ++#define EARCRX_CMDC_XACT_RD38 0x19f8 ++#define EARCRX_CMDC_XACT_RD39 0x19fc ++#define EARCRX_CMDC_XACT_RD40 0x1a00 ++#define EARCRX_CMDC_XACT_RD41 0x1a04 ++#define EARCRX_CMDC_XACT_RD42 0x1a08 ++#define EARCRX_CMDC_XACT_RD43 0x1a0c ++#define EARCRX_CMDC_XACT_RD44 0x1a10 ++#define EARCRX_CMDC_XACT_RD45 0x1a14 ++#define EARCRX_CMDC_XACT_RD46 0x1a18 ++#define EARCRX_CMDC_XACT_RD47 0x1a1c ++#define EARCRX_CMDC_XACT_RD48 0x1a20 ++#define EARCRX_CMDC_XACT_RD49 0x1a24 ++#define EARCRX_CMDC_XACT_RD50 0x1a28 ++#define EARCRX_CMDC_XACT_RD51 0x1a2c ++#define EARCRX_CMDC_XACT_RD52 0x1a30 ++#define EARCRX_CMDC_XACT_RD53 0x1a34 ++#define EARCRX_CMDC_XACT_RD54 0x1a38 ++#define EARCRX_CMDC_XACT_RD55 0x1a3c ++#define EARCRX_CMDC_XACT_RD56 0x1a40 ++#define EARCRX_CMDC_XACT_RD57 0x1a44 ++#define EARCRX_CMDC_XACT_RD58 0x1a48 ++#define EARCRX_CMDC_XACT_RD59 0x1a4c ++#define EARCRX_CMDC_XACT_RD60 0x1a50 ++#define EARCRX_CMDC_XACT_RD61 0x1a54 ++#define EARCRX_CMDC_XACT_RD62 0x1a58 ++#define EARCRX_CMDC_XACT_RD63 0x1a5c ++#define EARCRX_CMDC_XACT_RD64 0x1a60 ++#define EARCRX_CMDC_SYNC_CONFIG 0x1b00 ++/* eARC RX DMAC Registers */ ++#define EARCRX_DMAC_PHY_CONTROL 0x1c00 ++#define EARCRX_DMAC_CONFIG 0x1c08 ++#define EARCRX_DMAC_CONTROL0 0x1c0c ++#define EARCRX_DMAC_AUDIO_EN BIT(1) ++#define EARCRX_DMAC_EN BIT(0) ++#define EARCRX_DMAC_CONTROL1 0x1c10 ++#define EARCRX_DMAC_STATUS 0x1c14 ++#define EARCRX_DMAC_CHSTATUS0 0x1c18 ++#define EARCRX_DMAC_CHSTATUS1 0x1c1c ++#define EARCRX_DMAC_CHSTATUS2 0x1c20 ++#define EARCRX_DMAC_CHSTATUS3 0x1c24 ++#define EARCRX_DMAC_CHSTATUS4 0x1c28 ++#define EARCRX_DMAC_CHSTATUS5 0x1c2c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC0 0x1c30 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC1 0x1c34 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC2 0x1c38 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC3 0x1c3c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC4 0x1c40 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC5 0x1c44 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC6 0x1c48 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC7 0x1c4c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC8 0x1c50 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC9 0x1c54 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC10 0x1c58 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_AC11 0x1c5c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT0 0x1c60 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT1 0x1c64 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT2 0x1c68 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT3 0x1c6c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT4 0x1c70 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT5 0x1c74 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT6 0x1c78 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT7 0x1c7c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT8 0x1c80 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT9 0x1c84 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT10 0x1c88 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC1_PKT11 0x1c8c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT0 0x1c90 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT1 0x1c94 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT2 0x1c98 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT3 0x1c9c ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT4 0x1ca0 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT5 0x1ca4 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT6 0x1ca8 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT7 0x1cac ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT8 0x1cb0 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT9 0x1cb4 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT10 0x1cb8 ++#define EARCRX_DMAC_USRDATA_MSG_HDMI_ISRC2_PKT11 0x1cbc ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC0 0x1cc0 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC1 0x1cc4 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC2 0x1cc8 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC3 0x1ccc ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC4 0x1cd0 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC5 0x1cd4 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC6 0x1cd8 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC7 0x1cdc ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC8 0x1ce0 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC9 0x1ce4 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC10 0x1ce8 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC11 0x1cec ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC12 0x1cf0 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC13 0x1cf4 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC14 0x1cf8 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC15 0x1cfc ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC16 0x1d00 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC17 0x1d04 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC18 0x1d08 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC19 0x1d0c ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC20 0x1d10 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC21 0x1d14 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC22 0x1d18 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC23 0x1d1c ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC24 0x1d20 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC25 0x1d24 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC26 0x1d28 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC27 0x1d2c ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC28 0x1d30 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC29 0x1d34 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC30 0x1d38 ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC31 0x1d3c ++#define EARCRX_DMAC_USRDATA_MSG_GENERIC32 0x1d40 ++#define EARCRX_DMAC_CHSTATUS_STREAMER0 0x1d44 ++#define EARCRX_DMAC_CHSTATUS_STREAMER1 0x1d48 ++#define EARCRX_DMAC_CHSTATUS_STREAMER2 0x1d4c ++#define EARCRX_DMAC_CHSTATUS_STREAMER3 0x1d50 ++#define EARCRX_DMAC_CHSTATUS_STREAMER4 0x1d54 ++#define EARCRX_DMAC_CHSTATUS_STREAMER5 0x1d58 ++#define EARCRX_DMAC_CHSTATUS_STREAMER6 0x1d5c ++#define EARCRX_DMAC_CHSTATUS_STREAMER7 0x1d60 ++#define EARCRX_DMAC_CHSTATUS_STREAMER8 0x1d64 ++#define EARCRX_DMAC_CHSTATUS_STREAMER9 0x1d68 ++#define EARCRX_DMAC_CHSTATUS_STREAMER10 0x1d6c ++#define EARCRX_DMAC_CHSTATUS_STREAMER11 0x1d70 ++#define EARCRX_DMAC_CHSTATUS_STREAMER12 0x1d74 ++#define EARCRX_DMAC_CHSTATUS_STREAMER13 0x1d78 ++#define EARCRX_DMAC_CHSTATUS_STREAMER14 0x1d7c ++#define EARCRX_DMAC_USRDATA_STREAMER0 0x1d80 ++/* Main Unit Interrupt Registers */ ++#define MAIN_INTVEC_INDEX 0x3000 ++#define MAINUNIT_0_INT_STATUS 0x3010 ++#define MAINUNIT_0_INT_MASK_N 0x3014 ++#define MAINUNIT_0_INT_CLEAR 0x3018 ++#define MAINUNIT_0_INT_FORCE 0x301c ++#define MAINUNIT_1_INT_STATUS 0x3020 ++#define FLT_EXIT_TO_LTSL_IRQ BIT(22) ++#define FLT_EXIT_TO_LTS4_IRQ BIT(21) ++#define FLT_EXIT_TO_LTSP_IRQ BIT(20) ++#define SCDC_NACK_RCVD_IRQ BIT(12) ++#define SCDC_RR_REPLY_STOP_IRQ BIT(11) ++#define SCDC_UPD_FLAGS_CLR_IRQ BIT(10) ++#define SCDC_UPD_FLAGS_CHG_IRQ BIT(9) ++#define SCDC_UPD_FLAGS_RD_IRQ BIT(8) ++#define I2CM_NACK_RCVD_IRQ BIT(2) ++#define I2CM_READ_REQUEST_IRQ BIT(1) ++#define I2CM_OP_DONE_IRQ BIT(0) ++#define MAINUNIT_1_INT_MASK_N 0x3024 ++#define I2CM_NACK_RCVD_MASK_N BIT(2) ++#define I2CM_READ_REQUEST_MASK_N BIT(1) ++#define I2CM_OP_DONE_MASK_N BIT(0) ++#define MAINUNIT_1_INT_CLEAR 0x3028 ++#define I2CM_NACK_RCVD_CLEAR BIT(2) ++#define I2CM_READ_REQUEST_CLEAR BIT(1) ++#define I2CM_OP_DONE_CLEAR BIT(0) ++#define MAINUNIT_1_INT_FORCE 0x302c ++/* AVPUNIT Interrupt Registers */ ++#define AVP_INTVEC_INDEX 0x3800 ++#define AVP_0_INT_STATUS 0x3810 ++#define AVP_0_INT_MASK_N 0x3814 ++#define AVP_0_INT_CLEAR 0x3818 ++#define AVP_0_INT_FORCE 0x381c ++#define AVP_1_INT_STATUS 0x3820 ++#define AVP_1_INT_MASK_N 0x3824 ++#define HDCP14_AUTH_CHG_MASK_N BIT(6) ++#define AVP_1_INT_CLEAR 0x3828 ++#define AVP_1_INT_FORCE 0x382c ++#define AVP_2_INT_STATUS 0x3830 ++#define AVP_2_INT_MASK_N 0x3834 ++#define AVP_2_INT_CLEAR 0x3838 ++#define AVP_2_INT_FORCE 0x383c ++#define AVP_3_INT_STATUS 0x3840 ++#define AVP_3_INT_MASK_N 0x3844 ++#define AVP_3_INT_CLEAR 0x3848 ++#define AVP_3_INT_FORCE 0x384c ++#define AVP_4_INT_STATUS 0x3850 ++#define AVP_4_INT_MASK_N 0x3854 ++#define AVP_4_INT_CLEAR 0x3858 ++#define AVP_4_INT_FORCE 0x385c ++#define AVP_5_INT_STATUS 0x3860 ++#define AVP_5_INT_MASK_N 0x3864 ++#define AVP_5_INT_CLEAR 0x3868 ++#define AVP_5_INT_FORCE 0x386c ++#define AVP_6_INT_STATUS 0x3870 ++#define AVP_6_INT_MASK_N 0x3874 ++#define AVP_6_INT_CLEAR 0x3878 ++#define AVP_6_INT_FORCE 0x387c ++/* CEC Interrupt Registers */ ++#define CEC_INT_STATUS 0x4000 ++#define CEC_INT_MASK_N 0x4004 ++#define CEC_INT_CLEAR 0x4008 ++#define CEC_INT_FORCE 0x400c ++/* eARC RX Interrupt Registers */ ++#define EARCRX_INTVEC_INDEX 0x4800 ++#define EARCRX_0_INT_STATUS 0x4810 ++#define EARCRX_CMDC_DISCOVERY_TIMEOUT_IRQ BIT(9) ++#define EARCRX_CMDC_DISCOVERY_DONE_IRQ BIT(8) ++#define EARCRX_0_INT_MASK_N 0x4814 ++#define EARCRX_0_INT_CLEAR 0x4818 ++#define EARCRX_0_INT_FORCE 0x481c ++#define EARCRX_1_INT_STATUS 0x4820 ++#define EARCRX_1_INT_MASK_N 0x4824 ++#define EARCRX_1_INT_CLEAR 0x4828 ++#define EARCRX_1_INT_FORCE 0x482c ++ ++#endif /* __DW_HDMI_QP_H__ */ +diff --git a/include/drm/bridge/dw_hdmi_qp.h b/include/drm/bridge/dw_hdmi_qp.h +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/include/drm/bridge/dw_hdmi_qp.h +@@ -0,0 +1,37 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * Copyright (c) 2021-2022 Rockchip Electronics Co., Ltd. ++ * Copyright (c) 2024 Collabora Ltd. ++ */ ++ ++#ifndef __DW_HDMI_QP__ ++#define __DW_HDMI_QP__ ++ ++struct device; ++struct drm_display_info; ++struct drm_encoder; ++struct dw_hdmi_qp; ++struct platform_device; ++ ++struct dw_hdmi_qp_phy_ops { ++ int (*init)(struct dw_hdmi_qp *hdmi, void *data, ++ const struct drm_display_info *display); ++ void (*disable)(struct dw_hdmi_qp *hdmi, void *data); ++ enum drm_connector_status (*read_hpd)(struct dw_hdmi_qp *hdmi, void *data); ++ void (*setup_hpd)(struct dw_hdmi_qp *hdmi, void *data); ++}; ++ ++struct dw_hdmi_qp_plat_data { ++ const struct dw_hdmi_qp_phy_ops *phy_ops; ++ void *phy_data; ++}; ++ ++int dw_hdmi_qp_set_refclk_rate(struct dw_hdmi_qp *hdmi, unsigned long rate); ++void dw_hdmi_qp_set_high_tmds_clock_ratio(struct dw_hdmi_qp *hdmi, ++ const struct drm_display_info *display); ++void dw_hdmi_qp_unbind(struct dw_hdmi_qp *hdmi); ++struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev, ++ struct drm_encoder *encoder, ++ const struct dw_hdmi_qp_plat_data *plat_data); ++void dw_hdmi_qp_resume(struct device *dev, struct dw_hdmi_qp *hdmi); ++#endif /* __DW_HDMI_QP__ */ +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Fri, 26 Jul 2024 03:07:04 +0300 +Subject: dt-bindings: display: rockchip: Add schema for RK3588 HDMI TX + Controller + +Rockchip RK3588 SoC integrates the Synopsys DesignWare HDMI 2.1 +Quad-Pixel (QP) TX controller IP. + +Since this is a new IP block, quite different from those used in the +previous generations of Rockchip SoCs, add a dedicated binding file. + +Signed-off-by: Cristian Ciocaltea +--- + Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi-qp.yaml | 188 ++++++++++ + 1 file changed, 188 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi-qp.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi-qp.yaml +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi-qp.yaml +@@ -0,0 +1,188 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/display/rockchip/rockchip,dw-hdmi-qp.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Rockchip DW HDMI QP TX Encoder ++ ++maintainers: ++ - Cristian Ciocaltea ++ ++description: ++ Rockchip RK3588 SoC integrates the Synopsys DesignWare HDMI QP TX controller ++ IP and a HDMI/eDP TX Combo PHY based on a Samsung IP block. ++ ++allOf: ++ - $ref: ../bridge/synopsys,dw-hdmi-qp.yaml# ++ - $ref: /schemas/sound/dai-common.yaml# ++ ++properties: ++ compatible: ++ enum: ++ - rockchip,rk3588-dw-hdmi-qp ++ ++ clocks: ++ minItems: 4 ++ items: ++ - {} ++ - {} ++ - {} ++ - {} ++ # The next clocks are optional, but shall be specified in this ++ # order when present. ++ - description: TMDS/FRL link clock ++ - description: Video datapath clock ++ ++ clock-names: ++ minItems: 4 ++ items: ++ - {} ++ - {} ++ - {} ++ - {} ++ - enum: [hdp, hclk_vo1] ++ - const: hclk_vo1 ++ ++ interrupts: ++ items: ++ - {} ++ - {} ++ - {} ++ - {} ++ - description: HPD interrupt ++ ++ interrupt-names: ++ items: ++ - {} ++ - {} ++ - {} ++ - {} ++ - const: hpd ++ ++ phys: ++ maxItems: 1 ++ description: The HDMI/eDP PHY. ++ ++ phy-names: ++ const: hdmi ++ ++ ports: ++ $ref: /schemas/graph.yaml#/properties/ports ++ ++ properties: ++ port@0: ++ $ref: /schemas/graph.yaml#/properties/port ++ description: ++ Port node with one endpoint connected to a vop node. ++ ++ port@1: ++ $ref: /schemas/graph.yaml#/properties/port ++ description: ++ Port node with one endpoint connected to a hdmi-connector node. ++ ++ required: ++ - port@0 ++ - port@1 ++ ++ power-domains: ++ maxItems: 1 ++ ++ resets: ++ minItems: 2 ++ maxItems: 2 ++ ++ reset-names: ++ items: ++ - const: ref ++ - const: hdp ++ ++ "#sound-dai-cells": ++ const: 0 ++ ++ rockchip,grf: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: ++ Most HDMI QP related data is accessed through SYS GRF regs. ++ ++ rockchip,vo1_grf: ++ $ref: /schemas/types.yaml#/definitions/phandle ++ description: ++ Additional HDMI QP related data is accessed through VO1 GRF regs. ++ ++required: ++ - compatible ++ - reg ++ - clocks ++ - clock-names ++ - interrupts ++ - interrupt-names ++ - phys ++ - phy-names ++ - ports ++ - resets ++ - reset-names ++ - rockchip,grf ++ - rockchip,vo1_grf ++ ++unevaluatedProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ #include ++ #include ++ #include ++ ++ soc { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ++ hdmi@fde80000 { ++ compatible = "rockchip,rk3588-dw-hdmi-qp"; ++ reg = <0x0 0xfde80000 0x0 0x20000>; ++ clocks = <&cru PCLK_HDMITX0>, ++ <&cru CLK_HDMITX0_EARC>, ++ <&cru CLK_HDMITX0_REF>, ++ <&cru MCLK_I2S5_8CH_TX>, ++ <&cru CLK_HDMIHDP0>, ++ <&cru HCLK_VO1>; ++ clock-names = "pclk", "earc", "ref", "aud", "hdp", "hclk_vo1"; ++ interrupts = , ++ , ++ , ++ , ++ ; ++ interrupt-names = "avp", "cec", "earc", "main", "hpd"; ++ phys = <&hdptxphy_hdmi0>; ++ phy-names = "hdmi"; ++ power-domains = <&power RK3588_PD_VO1>; ++ resets = <&cru SRST_HDMITX0_REF>, <&cru SRST_HDMIHDP0>; ++ reset-names = "ref", "hdp"; ++ rockchip,grf = <&sys_grf>; ++ rockchip,vo1_grf = <&vo1_grf>; ++ #sound-dai-cells = <0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ ++ hdmi0_in_vp0: endpoint { ++ remote-endpoint = <&vp0_out_hdmi0>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ ++ hdmi0_out_con0: endpoint { ++ remote-endpoint = <&hdmi_con0_in>; ++ }; ++ }; ++ }; ++ }; ++ }; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Wed, 17 Jul 2024 03:34:36 +0300 +Subject: drm/rockchip: Explicitly include bits header + +Driver makes use of the BIT() macro, but relies on the bits header being +implicitly included. + +Explicitly pull the header in to avoid potential build failures in some +configurations. + +While at it, reorder include directives alphabetically. + +Fixes: 8c8546546f25 ("drm/rockchip: move output interface related definition to rockchip_drm_drv.h") +Signed-off-by: Cristian Ciocaltea +--- + drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +@@ -12,9 +12,10 @@ + #include + #include + ++#include ++#include + #include + #include +-#include + + #define ROCKCHIP_MAX_FB_BUFFER 3 + #define ROCKCHIP_MAX_CONNECTOR 2 +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Sat, 6 Jul 2024 03:22:35 +0300 +Subject: drm/rockchip: Add basic RK3588 HDMI output support + +The RK3588 SoC family integrates the newer Synopsys DesignWare HDMI 2.1 +Quad-Pixel (QP) TX controller IP and a HDMI/eDP TX Combo PHY based on a +Samsung IP block. + +Add just the basic support for now, i.e. RGB output up to 4K@60Hz, +without audio, CEC or any of the HDMI 2.1 specific features. + +Co-developed-by: Algea Cao +Signed-off-by: Algea Cao +Signed-off-by: Cristian Ciocaltea +--- + drivers/gpu/drm/rockchip/Kconfig | 8 + + drivers/gpu/drm/rockchip/Makefile | 1 + + drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 430 ++++++++++ + drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 + + drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + + 5 files changed, 442 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/Kconfig ++++ b/drivers/gpu/drm/rockchip/Kconfig +@@ -8,6 +8,7 @@ config DRM_ROCKCHIP + select VIDEOMODE_HELPERS + select DRM_ANALOGIX_DP if ROCKCHIP_ANALOGIX_DP + select DRM_DW_HDMI if ROCKCHIP_DW_HDMI ++ select DRM_DW_HDMI_QP if ROCKCHIP_DW_HDMI_QP + select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI + select GENERIC_PHY if ROCKCHIP_DW_MIPI_DSI + select GENERIC_PHY_MIPI_DPHY if ROCKCHIP_DW_MIPI_DSI +@@ -63,6 +64,13 @@ config ROCKCHIP_DW_HDMI + enable HDMI on RK3288 or RK3399 based SoC, you should select + this option. + ++config ROCKCHIP_DW_HDMI_QP ++ bool "Rockchip specific extensions for Synopsys DW HDMI QP" ++ help ++ This selects support for Rockchip SoC specific extensions ++ for the Synopsys DesignWare HDMI QP driver. If you want to ++ enable HDMI on RK3588 based SoC, you should select this option. ++ + config ROCKCHIP_DW_MIPI_DSI + bool "Rockchip specific extensions for Synopsys DW MIPI DSI" + select GENERIC_PHY_MIPI_DPHY +diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/Makefile ++++ b/drivers/gpu/drm/rockchip/Makefile +@@ -11,6 +11,7 @@ rockchipdrm-$(CONFIG_ROCKCHIP_VOP) += rockchip_drm_vop.o rockchip_vop_reg.o + rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o + rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o + rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o ++rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI_QP) += dw_hdmi_qp-rockchip.o + rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi-rockchip.o + rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o + rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +new file mode 100644 +index 000000000000..111111111111 +--- /dev/null ++++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +@@ -0,0 +1,430 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++/* ++ * Copyright (c) 2021-2022 Rockchip Electronics Co., Ltd. ++ * Copyright (c) 2024 Collabora Ltd. ++ * ++ * Author: Algea Cao ++ * Author: Cristian Ciocaltea ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "rockchip_drm_drv.h" ++ ++#define RK3588_GRF_SOC_CON2 0x0308 ++#define RK3588_HDMI0_HPD_INT_MSK BIT(13) ++#define RK3588_HDMI0_HPD_INT_CLR BIT(12) ++#define RK3588_GRF_SOC_CON7 0x031c ++#define RK3588_SET_HPD_PATH_MASK GENMASK(13, 12) ++#define RK3588_GRF_SOC_STATUS1 0x0384 ++#define RK3588_HDMI0_LEVEL_INT BIT(16) ++#define RK3588_GRF_VO1_CON3 0x000c ++#define RK3588_SCLIN_MASK BIT(9) ++#define RK3588_SDAIN_MASK BIT(10) ++#define RK3588_MODE_MASK BIT(11) ++#define RK3588_I2S_SEL_MASK BIT(13) ++#define RK3588_GRF_VO1_CON9 0x0024 ++#define RK3588_HDMI0_GRANT_SEL BIT(10) ++ ++#define HIWORD_UPDATE(val, mask) ((val) | (mask) << 16) ++ ++struct rockchip_hdmi_qp { ++ struct device *dev; ++ struct regmap *regmap; ++ struct regmap *vo1_regmap; ++ struct rockchip_encoder encoder; ++ struct dw_hdmi_qp *hdmi; ++ struct phy *phy; ++ struct gpio_desc *enable_gpio; ++ struct delayed_work hpd_work; ++}; ++ ++static struct rockchip_hdmi_qp *to_rockchip_hdmi_qp(struct drm_encoder *encoder) ++{ ++ struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder); ++ ++ return container_of(rkencoder, struct rockchip_hdmi_qp, encoder); ++} ++ ++static void ++dw_hdmi_qp_rockchip_encoder_mode_set(struct drm_encoder *encoder, ++ struct drm_display_mode *mode, ++ struct drm_display_mode *adj_mode) ++{ ++ struct rockchip_hdmi_qp *hdmi = to_rockchip_hdmi_qp(encoder); ++ ++ dw_hdmi_qp_set_refclk_rate(hdmi->hdmi, adj_mode->clock * 1000); ++} ++ ++static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder) ++{ ++ struct rockchip_hdmi_qp *hdmi = to_rockchip_hdmi_qp(encoder); ++ struct drm_crtc *crtc = encoder->crtc; ++ int rate; ++ ++ /* Unconditionally switch to TMDS as FRL is not yet supported */ ++ gpiod_set_value(hdmi->enable_gpio, 1); ++ ++ if (crtc && crtc->state) { ++ dw_hdmi_qp_set_refclk_rate(hdmi->hdmi, ++ crtc->state->adjusted_mode.crtc_clock * 1000); ++ /* ++ * FIXME: Temporary workaround to pass pixel clock rate ++ * to the PHY driver until phy_configure_opts_hdmi ++ * becomes available in the PHY API. See also the related ++ * comment in rk_hdptx_phy_power_on() from ++ * drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c ++ */ ++ rate = crtc->state->mode.clock * 10; ++ phy_set_bus_width(hdmi->phy, rate); ++ drm_dbg(hdmi, "%s set bus_width=%u\n", __func__, rate); ++ } ++} ++ ++static int ++dw_hdmi_qp_rockchip_encoder_atomic_check(struct drm_encoder *encoder, ++ struct drm_crtc_state *crtc_state, ++ struct drm_connector_state *conn_state) ++{ ++ struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); ++ ++ s->output_mode = ROCKCHIP_OUT_MODE_AAAA; ++ s->output_type = DRM_MODE_CONNECTOR_HDMIA; ++ ++ return 0; ++} ++ ++static const struct ++drm_encoder_helper_funcs dw_hdmi_qp_rockchip_encoder_helper_funcs = { ++ .mode_set = dw_hdmi_qp_rockchip_encoder_mode_set, ++ .enable = dw_hdmi_qp_rockchip_encoder_enable, ++ .atomic_check = dw_hdmi_qp_rockchip_encoder_atomic_check, ++}; ++ ++static int dw_hdmi_qp_rk3588_phy_init(struct dw_hdmi_qp *dw_hdmi, void *data, ++ const struct drm_display_info *display) ++{ ++ struct rockchip_hdmi_qp *hdmi = (struct rockchip_hdmi_qp *)data; ++ ++ dw_hdmi_qp_set_high_tmds_clock_ratio(dw_hdmi, display); ++ ++ return phy_power_on(hdmi->phy); ++} ++ ++static void dw_hdmi_qp_rk3588_phy_disable(struct dw_hdmi_qp *dw_hdmi, ++ void *data) ++{ ++ struct rockchip_hdmi_qp *hdmi = (struct rockchip_hdmi_qp *)data; ++ ++ phy_power_off(hdmi->phy); ++} ++ ++static enum drm_connector_status ++dw_hdmi_qp_rk3588_read_hpd(struct dw_hdmi_qp *dw_hdmi, void *data) ++{ ++ struct rockchip_hdmi_qp *hdmi = (struct rockchip_hdmi_qp *)data; ++ u32 val; ++ ++ regmap_read(hdmi->regmap, RK3588_GRF_SOC_STATUS1, &val); ++ ++ return val & RK3588_HDMI0_LEVEL_INT ? ++ connector_status_connected : connector_status_disconnected; ++} ++ ++static void dw_hdmi_qp_rk3588_setup_hpd(struct dw_hdmi_qp *dw_hdmi, void *data) ++{ ++ struct rockchip_hdmi_qp *hdmi = (struct rockchip_hdmi_qp *)data; ++ ++ regmap_write(hdmi->regmap, ++ RK3588_GRF_SOC_CON2, ++ HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_CLR, ++ RK3588_HDMI0_HPD_INT_CLR | ++ RK3588_HDMI0_HPD_INT_MSK)); ++} ++ ++static const struct dw_hdmi_qp_phy_ops rk3588_hdmi_phy_ops = { ++ .init = dw_hdmi_qp_rk3588_phy_init, ++ .disable = dw_hdmi_qp_rk3588_phy_disable, ++ .read_hpd = dw_hdmi_qp_rk3588_read_hpd, ++ .setup_hpd = dw_hdmi_qp_rk3588_setup_hpd, ++}; ++ ++static void dw_hdmi_qp_rk3588_hpd_work(struct work_struct *work) ++{ ++ struct rockchip_hdmi_qp *hdmi = container_of(work, ++ struct rockchip_hdmi_qp, ++ hpd_work.work); ++ struct drm_device *drm = hdmi->encoder.encoder.dev; ++ bool changed; ++ ++ if (drm) { ++ changed = drm_helper_hpd_irq_event(drm); ++ if (changed) ++ drm_dbg(hdmi, "connector status changed\n"); ++ } ++} ++ ++static irqreturn_t dw_hdmi_qp_rk3588_hardirq(int irq, void *dev_id) ++{ ++ struct rockchip_hdmi_qp *hdmi = dev_id; ++ u32 intr_stat, val; ++ ++ regmap_read(hdmi->regmap, RK3588_GRF_SOC_STATUS1, &intr_stat); ++ ++ if (intr_stat) { ++ val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_MSK, ++ RK3588_HDMI0_HPD_INT_MSK); ++ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val); ++ return IRQ_WAKE_THREAD; ++ } ++ ++ return IRQ_NONE; ++} ++ ++static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id) ++{ ++ struct rockchip_hdmi_qp *hdmi = dev_id; ++ u32 intr_stat, val; ++ int debounce_ms; ++ ++ regmap_read(hdmi->regmap, RK3588_GRF_SOC_STATUS1, &intr_stat); ++ if (!intr_stat) ++ return IRQ_NONE; ++ ++ val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_CLR, ++ RK3588_HDMI0_HPD_INT_CLR); ++ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val); ++ ++ debounce_ms = intr_stat & RK3588_HDMI0_LEVEL_INT ? 150 : 20; ++ mod_delayed_work(system_wq, &hdmi->hpd_work, ++ msecs_to_jiffies(debounce_ms)); ++ ++ val |= HIWORD_UPDATE(0, RK3588_HDMI0_HPD_INT_MSK); ++ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val); ++ ++ return IRQ_HANDLED; ++} ++ ++static const struct of_device_id dw_hdmi_qp_rockchip_dt_ids[] = { ++ { .compatible = "rockchip,rk3588-dw-hdmi-qp", ++ .data = &rk3588_hdmi_phy_ops }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, dw_hdmi_qp_rockchip_dt_ids); ++ ++static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master, ++ void *data) ++{ ++ static const char * const clk_names[] = { "hdp", "hclk_vo1" }; ++ struct platform_device *pdev = to_platform_device(dev); ++ struct dw_hdmi_qp_plat_data plat_data; ++ struct drm_device *drm = data; ++ struct drm_connector *connector; ++ struct drm_encoder *encoder; ++ struct rockchip_hdmi_qp *hdmi; ++ struct clk *clk; ++ int ret, irq, i; ++ u32 val; ++ ++ if (!pdev->dev.of_node) ++ return -ENODEV; ++ ++ hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); ++ if (!hdmi) ++ return -ENOMEM; ++ ++ plat_data.phy_ops = of_device_get_match_data(dev); ++ if (!plat_data.phy_ops) ++ return -ENODEV; ++ ++ plat_data.phy_data = hdmi; ++ hdmi->dev = &pdev->dev; ++ ++ encoder = &hdmi->encoder.encoder; ++ encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node); ++ ++ rockchip_drm_encoder_set_crtc_endpoint_id(&hdmi->encoder, ++ dev->of_node, 0, 0); ++ /* ++ * If we failed to find the CRTC(s) which this encoder is ++ * supposed to be connected to, it's because the CRTC has ++ * not been registered yet. Defer probing, and hope that ++ * the required CRTC is added later. ++ */ ++ if (encoder->possible_crtcs == 0) ++ return -EPROBE_DEFER; ++ ++ hdmi->regmap = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "rockchip,grf"); ++ if (IS_ERR(hdmi->regmap)) { ++ drm_err(hdmi, "Unable to get rockchip,grf\n"); ++ return PTR_ERR(hdmi->regmap); ++ } ++ ++ hdmi->vo1_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, ++ "rockchip,vo1_grf"); ++ if (IS_ERR(hdmi->vo1_regmap)) { ++ drm_err(hdmi, "Unable to get rockchip,vo1_grf\n"); ++ return PTR_ERR(hdmi->vo1_regmap); ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(clk_names); i++) { ++ clk = devm_clk_get_optional_enabled(hdmi->dev, clk_names[i]); ++ ++ if (IS_ERR(clk)) { ++ ret = PTR_ERR(clk); ++ if (ret != -EPROBE_DEFER) ++ drm_err(hdmi, "Failed to get %s clock: %d\n", ++ clk_names[i], ret); ++ return ret; ++ } ++ } ++ ++ hdmi->enable_gpio = devm_gpiod_get_optional(hdmi->dev, "enable", ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(hdmi->enable_gpio)) { ++ ret = PTR_ERR(hdmi->enable_gpio); ++ drm_err(hdmi, "Failed to request enable GPIO: %d\n", ret); ++ return ret; ++ } ++ ++ hdmi->phy = devm_phy_get(dev, "hdmi"); ++ if (IS_ERR(hdmi->phy)) { ++ ret = PTR_ERR(hdmi->phy); ++ if (ret != -EPROBE_DEFER) ++ drm_err(hdmi, "failed to get phy: %d\n", ret); ++ return ret; ++ } ++ ++ val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) | ++ HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) | ++ HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) | ++ HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK); ++ regmap_write(hdmi->vo1_regmap, RK3588_GRF_VO1_CON3, val); ++ ++ val = HIWORD_UPDATE(RK3588_SET_HPD_PATH_MASK, ++ RK3588_SET_HPD_PATH_MASK); ++ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON7, val); ++ ++ val = HIWORD_UPDATE(RK3588_HDMI0_GRANT_SEL, ++ RK3588_HDMI0_GRANT_SEL); ++ regmap_write(hdmi->vo1_regmap, RK3588_GRF_VO1_CON9, val); ++ ++ val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_MSK, RK3588_HDMI0_HPD_INT_MSK); ++ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val); ++ ++ INIT_DELAYED_WORK(&hdmi->hpd_work, dw_hdmi_qp_rk3588_hpd_work); ++ ++ irq = platform_get_irq_byname(pdev, "hpd"); ++ if (irq < 0) ++ return irq; ++ ++ ret = devm_request_threaded_irq(hdmi->dev, irq, ++ dw_hdmi_qp_rk3588_hardirq, ++ dw_hdmi_qp_rk3588_irq, ++ IRQF_SHARED, "dw-hdmi-qp-hpd", ++ hdmi); ++ if (ret) ++ return ret; ++ ++ drm_encoder_helper_add(encoder, &dw_hdmi_qp_rockchip_encoder_helper_funcs); ++ drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); ++ ++ platform_set_drvdata(pdev, hdmi); ++ ++ hdmi->hdmi = dw_hdmi_qp_bind(pdev, encoder, &plat_data); ++ if (IS_ERR(hdmi->hdmi)) { ++ ret = PTR_ERR(hdmi->hdmi); ++ drm_encoder_cleanup(encoder); ++ return ret; ++ } ++ ++ connector = drm_bridge_connector_init(drm, encoder); ++ if (IS_ERR(connector)) { ++ ret = PTR_ERR(connector); ++ drm_err(hdmi, "failed to init bridge connector: %d\n", ret); ++ return ret; ++ } ++ ++ return drm_connector_attach_encoder(connector, encoder); ++} ++ ++static void dw_hdmi_qp_rockchip_unbind(struct device *dev, ++ struct device *master, ++ void *data) ++{ ++ struct rockchip_hdmi_qp *hdmi = dev_get_drvdata(dev); ++ ++ cancel_delayed_work_sync(&hdmi->hpd_work); ++ dw_hdmi_qp_unbind(hdmi->hdmi); ++ ++ drm_encoder_cleanup(&hdmi->encoder.encoder); ++} ++ ++static const struct component_ops dw_hdmi_qp_rockchip_ops = { ++ .bind = dw_hdmi_qp_rockchip_bind, ++ .unbind = dw_hdmi_qp_rockchip_unbind, ++}; ++ ++static int dw_hdmi_qp_rockchip_probe(struct platform_device *pdev) ++{ ++ return component_add(&pdev->dev, &dw_hdmi_qp_rockchip_ops); ++} ++ ++static void dw_hdmi_qp_rockchip_remove(struct platform_device *pdev) ++{ ++ component_del(&pdev->dev, &dw_hdmi_qp_rockchip_ops); ++} ++ ++static int __maybe_unused dw_hdmi_qp_rockchip_resume(struct device *dev) ++{ ++ struct rockchip_hdmi_qp *hdmi = dev_get_drvdata(dev); ++ u32 val; ++ ++ val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) | ++ HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) | ++ HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) | ++ HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK); ++ regmap_write(hdmi->vo1_regmap, RK3588_GRF_VO1_CON3, val); ++ ++ val = HIWORD_UPDATE(RK3588_SET_HPD_PATH_MASK, ++ RK3588_SET_HPD_PATH_MASK); ++ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON7, val); ++ ++ val = HIWORD_UPDATE(RK3588_HDMI0_GRANT_SEL, ++ RK3588_HDMI0_GRANT_SEL); ++ regmap_write(hdmi->vo1_regmap, RK3588_GRF_VO1_CON9, val); ++ ++ dw_hdmi_qp_resume(dev, hdmi->hdmi); ++ ++ if (hdmi->encoder.encoder.dev) ++ drm_helper_hpd_irq_event(hdmi->encoder.encoder.dev); ++ ++ return 0; ++} ++ ++static const struct dev_pm_ops dw_hdmi_qp_rockchip_pm = { ++ SET_SYSTEM_SLEEP_PM_OPS(NULL, dw_hdmi_qp_rockchip_resume) ++}; ++ ++struct platform_driver dw_hdmi_qp_rockchip_pltfm_driver = { ++ .probe = dw_hdmi_qp_rockchip_probe, ++ .remove_new = dw_hdmi_qp_rockchip_remove, ++ .driver = { ++ .name = "dwhdmiqp-rockchip", ++ .pm = &dw_hdmi_qp_rockchip_pm, ++ .of_match_table = dw_hdmi_qp_rockchip_dt_ids, ++ }, ++}; +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +@@ -503,6 +503,8 @@ static int __init rockchip_drm_init(void) + ADD_ROCKCHIP_SUB_DRIVER(cdn_dp_driver, CONFIG_ROCKCHIP_CDN_DP); + ADD_ROCKCHIP_SUB_DRIVER(dw_hdmi_rockchip_pltfm_driver, + CONFIG_ROCKCHIP_DW_HDMI); ++ ADD_ROCKCHIP_SUB_DRIVER(dw_hdmi_qp_rockchip_pltfm_driver, ++ CONFIG_ROCKCHIP_DW_HDMI_QP); + ADD_ROCKCHIP_SUB_DRIVER(dw_mipi_dsi_rockchip_driver, + CONFIG_ROCKCHIP_DW_MIPI_DSI); + ADD_ROCKCHIP_SUB_DRIVER(inno_hdmi_driver, CONFIG_ROCKCHIP_INNO_HDMI); +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +@@ -88,6 +88,7 @@ int rockchip_drm_encoder_set_crtc_endpoint_id(struct rockchip_encoder *rencoder, + int rockchip_drm_endpoint_is_subdriver(struct device_node *ep); + extern struct platform_driver cdn_dp_driver; + extern struct platform_driver dw_hdmi_rockchip_pltfm_driver; ++extern struct platform_driver dw_hdmi_qp_rockchip_pltfm_driver; + extern struct platform_driver dw_mipi_dsi_rockchip_driver; + extern struct platform_driver inno_hdmi_driver; + extern struct platform_driver rockchip_dp_driver; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Thu, 11 Jul 2024 14:48:43 +0300 +Subject: arm64: defconfig: Enable Rockchip extensions for Synopsys DW HDMI QP + +Enable Rockchip specific extensions for the Synopsys DesignWare HDMI QP +driver. + +This is needed for the HDMI output support on RK3588 SoC based boards. + +Signed-off-by: Cristian Ciocaltea +--- + arch/arm64/configs/defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig +index 111111111111..222222222222 100644 +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -865,6 +865,7 @@ CONFIG_ROCKCHIP_VOP2=y + CONFIG_ROCKCHIP_ANALOGIX_DP=y + CONFIG_ROCKCHIP_CDN_DP=y + CONFIG_ROCKCHIP_DW_HDMI=y ++CONFIG_ROCKCHIP_DW_HDMI_QP=y + CONFIG_ROCKCHIP_DW_MIPI_DSI=y + CONFIG_ROCKCHIP_INNO_HDMI=y + CONFIG_ROCKCHIP_LVDS=y +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0135-arm64-dts-rockchip-Add-HDMI0-bridge-CLK-to-rk3588.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0135-arm64-dts-rockchip-Add-HDMI0-bridge-CLK-to-rk3588.patch new file mode 100644 index 000000000000..4707239f4ad3 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0135-arm64-dts-rockchip-Add-HDMI0-bridge-CLK-to-rk3588.patch @@ -0,0 +1,94 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Mon, 15 Jan 2024 22:47:41 +0200 +Subject: arm64: dts: rockchip: Add HDMI0 bridge to rk3588 + +Add DT node for the HDMI0 bridge found on RK3588 SoC. + +Signed-off-by: Cristian Ciocaltea +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 42 ++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1405,6 +1405,48 @@ i2s9_8ch: i2s@fddfc000 { + status = "disabled"; + }; + ++ hdmi0: hdmi@fde80000 { ++ compatible = "rockchip,rk3588-dw-hdmi-qp"; ++ reg = <0x0 0xfde80000 0x0 0x20000>; ++ clocks = <&cru PCLK_HDMITX0>, ++ <&cru CLK_HDMITX0_EARC>, ++ <&cru CLK_HDMITX0_REF>, ++ <&cru MCLK_I2S5_8CH_TX>, ++ <&cru CLK_HDMIHDP0>, ++ <&cru HCLK_VO1>; ++ clock-names = "pclk", "earc", "ref", "aud", "hdp", "hclk_vo1"; ++ interrupts = , ++ , ++ , ++ , ++ ; ++ interrupt-names = "avp", "cec", "earc", "main", "hpd"; ++ phys = <&hdptxphy_hdmi0>; ++ phy-names = "hdmi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmim0_tx0_cec &hdmim0_tx0_hpd ++ &hdmim0_tx0_scl &hdmim0_tx0_sda>; ++ power-domains = <&power RK3588_PD_VO1>; ++ resets = <&cru SRST_HDMITX0_REF>, <&cru SRST_HDMIHDP0>; ++ reset-names = "ref", "hdp"; ++ rockchip,grf = <&sys_grf>; ++ rockchip,vo1_grf = <&vo1_grf>; ++ status = "disabled"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hdmi0_in: port@0 { ++ reg = <0>; ++ }; ++ ++ hdmi0_out: port@1 { ++ reg = <1>; ++ }; ++ }; ++ }; ++ + qos_gpu_m0: qos@fdf35000 { + compatible = "rockchip,rk3588-qos", "syscon"; + reg = <0x0 0xfdf35000 0x0 0x20>; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Tue, 16 Jan 2024 03:13:38 +0200 +Subject: [WIP] arm64: dts: rockchip: Enable HDMI0 PHY clk provider on rk3588 + +The HDMI0 PHY can be used as a clock provider on RK3588, hence add the +missing #clock-cells property. +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -2868,6 +2868,7 @@ hdptxphy_hdmi0: phy@fed60000 { + reg = <0x0 0xfed60000 0x0 0x2000>; + clocks = <&cru CLK_USB2PHY_HDPTXRXPHY_REF>, <&cru PCLK_HDPTX0>; + clock-names = "ref", "apb"; ++ #clock-cells = <0>; + #phy-cells = <0>; + resets = <&cru SRST_HDPTX0>, <&cru SRST_P_HDPTX0>, + <&cru SRST_HDPTX0_INIT>, <&cru SRST_HDPTX0_CMN>, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0170-drm-rockchip-vop2-add-clocks-reset-support.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0170-drm-rockchip-vop2-add-clocks-reset-support.patch new file mode 100644 index 000000000000..78e0ae900c10 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0170-drm-rockchip-vop2-add-clocks-reset-support.patch @@ -0,0 +1,187 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Fri, 3 May 2024 14:27:39 -0400 +Subject: vop2: Add clock resets support + +At the end of initialization, each VP clock needs to be reset before +they can be used. + +Failing to do so can put the VOP in an undefined state where the +generated HDMI signal is either lost or not matching the selected mode. + +Signed-off-by: Detlev Casanova +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 30 ++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 111111111111..222222222222 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -159,6 +160,7 @@ struct vop2_win { + struct vop2_video_port { + struct drm_crtc crtc; + struct vop2 *vop2; ++ struct reset_control *dclk_rst; + struct clk *dclk; + unsigned int id; + const struct vop2_video_port_data *data; +@@ -2064,6 +2066,26 @@ static struct vop2_clk *vop2_clk_get(struct vop2 *vop2, const char *name) + return NULL; + } + ++static int vop2_clk_reset(struct vop2_video_port *vp) ++{ ++ struct reset_control *rstc = vp->dclk_rst; ++ struct vop2 *vop2 = vp->vop2; ++ int ret; ++ ++ if (!rstc) ++ return 0; ++ ++ ret = reset_control_assert(rstc); ++ if (ret < 0) ++ drm_warn(vop2->drm, "failed to assert reset\n"); ++ udelay(10); ++ ret = reset_control_deassert(rstc); ++ if (ret < 0) ++ drm_warn(vop2->drm, "failed to deassert reset\n"); ++ ++ return ret; ++} ++ + static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + struct drm_atomic_state *state) + { +@@ -2233,6 +2255,8 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + + vop2_vp_write(vp, RK3568_VP_DSP_CTRL, dsp_ctrl); + ++ vop2_clk_reset(vp); ++ + drm_crtc_vblank_on(crtc); + + vop2_unlock(vop2); +@@ -2920,6 +2944,12 @@ static int vop2_create_crtcs(struct vop2 *vop2) + vp->data = vp_data; + + snprintf(dclk_name, sizeof(dclk_name), "dclk_vp%d", vp->id); ++ vp->dclk_rst = devm_reset_control_get_optional(vop2->dev, dclk_name); ++ if (IS_ERR(vp->dclk_rst)) { ++ drm_err(vop2->drm, "failed to get %s reset\n", dclk_name); ++ return PTR_ERR(vp->dclk_rst); ++ } ++ + vp->dclk = devm_clk_get(vop2->dev, dclk_name); + if (IS_ERR(vp->dclk)) { + drm_err(vop2->drm, "failed to get %s\n", dclk_name); +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Detlev Casanova +Date: Mon, 6 May 2024 13:54:01 -0400 +Subject: dt-bindings: display: vop2: Add VP clock resets + +Add the documentation for VOP2 video ports reset clocks. +One reset can be set per video port. + +Signed-off-by: Detlev Casanova +--- + Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml | 27 ++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml ++++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml +@@ -65,6 +65,22 @@ properties: + - const: dclk_vp3 + - const: pclk_vop + ++ resets: ++ minItems: 3 ++ items: ++ - description: Pixel clock reset for video port 0. ++ - description: Pixel clock reset for video port 1. ++ - description: Pixel clock reset for video port 2. ++ - description: Pixel clock reset for video port 3. ++ ++ reset-names: ++ minItems: 3 ++ items: ++ - const: dclk_vp0 ++ - const: dclk_vp1 ++ - const: dclk_vp2 ++ - const: dclk_vp3 ++ + rockchip,grf: + $ref: /schemas/types.yaml#/definitions/phandle + description: +@@ -128,6 +144,11 @@ allOf: + clock-names: + minItems: 7 + ++ resets: ++ minItems: 4 ++ reset-names: ++ minItems: 4 ++ + ports: + required: + - port@0 +@@ -183,6 +204,12 @@ examples: + "dclk_vp0", + "dclk_vp1", + "dclk_vp2"; ++ resets = <&cru SRST_VOP0>, ++ <&cru SRST_VOP1>, ++ <&cru SRST_VOP2>; ++ reset-names = "dclk_vp0", ++ "dclk_vp1", ++ "dclk_vp2"; + power-domains = <&power RK3568_PD_VO>; + iommus = <&vop_mmu>; + vop_out: ports { +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Fri, 2 Aug 2024 00:13:32 +0300 +Subject: arm64: dts: rockchip: rk3588: add VOP2 clock resets + +--- + arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +@@ -1307,6 +1307,14 @@ vop: vop@fdd90000 { + "pclk_vop"; + iommus = <&vop_mmu>; + power-domains = <&power RK3588_PD_VOP>; ++ resets = <&cru SRST_D_VOP0>, ++ <&cru SRST_D_VOP1>, ++ <&cru SRST_D_VOP2>, ++ <&cru SRST_D_VOP3>; ++ reset-names = "dclk_vp0", ++ "dclk_vp1", ++ "dclk_vp2", ++ "dclk_vp3"; + rockchip,grf = <&sys_grf>; + rockchip,vop-grf = <&vop_grf>; + rockchip,vo1-grf = <&vo1_grf>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0801-wireless-add-bcm43752.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0801-wireless-add-bcm43752.patch new file mode 100644 index 000000000000..bdcd77c10ebd --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0801-wireless-add-bcm43752.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Wed, 28 Feb 2024 20:59:15 +0100 +Subject: net: wireless: brcmfmac: Add support for AP6275P + +This module features BCM43752A2 chipset. The firmware requires +randomness seeding, so enabled it. + +Signed-off-by: Ondrej Jirman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 ++++- + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +index 111111111111..222222222222 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -70,6 +70,7 @@ BRCMF_FW_CLM_DEF(4377B3, "brcmfmac4377b3-pcie"); + BRCMF_FW_CLM_DEF(4378B1, "brcmfmac4378b1-pcie"); + BRCMF_FW_CLM_DEF(4378B3, "brcmfmac4378b3-pcie"); + BRCMF_FW_CLM_DEF(4387C2, "brcmfmac4387c2-pcie"); ++BRCMF_FW_CLM_DEF(43752, "brcmfmac43752-pcie"); + + /* firmware config files */ + MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.txt"); +@@ -104,6 +105,7 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43664_CHIP_ID, 0xFFFFFFF0, 4366C), + BRCMF_FW_ENTRY(BRCM_CC_43666_CHIP_ID, 0xFFFFFFF0, 4366C), + BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), ++ BRCMF_FW_ENTRY(BRCM_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752), + BRCMF_FW_ENTRY(BRCM_CC_4377_CHIP_ID, 0xFFFFFFFF, 4377B3), /* revision ID 4 */ + BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0x0000000F, 4378B1), /* revision ID 3 */ + BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0xFFFFFFE0, 4378B3), /* revision ID 5 */ +@@ -1715,7 +1717,7 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, + memcpy_toio(devinfo->tcm + address, nvram, nvram_len); + brcmf_fw_nvram_free(nvram); + +- if (devinfo->otp.valid) { ++ if (devinfo->otp.valid || devinfo->ci->chip == BRCM_CC_43752_CHIP_ID) { + size_t rand_len = BRCMF_RANDOM_SEED_LENGTH; + struct brcmf_random_seed_footer footer = { + .length = cpu_to_le32(rand_len), +@@ -2695,6 +2697,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = { + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43596_DEVICE_ID, CYW), ++ BRCMF_PCIE_DEVICE(BRCM_PCIE_43752_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4377_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4378_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4387_DEVICE_ID, WCC), +diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +index 111111111111..222222222222 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -52,6 +52,7 @@ + #define BRCM_CC_43664_CHIP_ID 43664 + #define BRCM_CC_43666_CHIP_ID 43666 + #define BRCM_CC_4371_CHIP_ID 0x4371 ++#define BRCM_CC_43752_CHIP_ID 43752 + #define BRCM_CC_4377_CHIP_ID 0x4377 + #define BRCM_CC_4378_CHIP_ID 0x4378 + #define BRCM_CC_4387_CHIP_ID 0x4387 +@@ -94,6 +95,7 @@ + #define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5 + #define BRCM_PCIE_4371_DEVICE_ID 0x440d + #define BRCM_PCIE_43596_DEVICE_ID 0x4415 ++#define BRCM_PCIE_43752_DEVICE_ID 0x449d + #define BRCM_PCIE_4377_DEVICE_ID 0x4488 + #define BRCM_PCIE_4378_DEVICE_ID 0x4425 + #define BRCM_PCIE_4387_DEVICE_ID 0x4433 +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/0802-wireless-add-clk-property.patch b/patch/kernel/archive/rockchip-rk3588-6.11/0802-wireless-add-clk-property.patch new file mode 100644 index 000000000000..dcf8c70b0b68 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/0802-wireless-add-clk-property.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Wed, 28 Feb 2024 21:09:51 +0100 +Subject: net: wireless: brcmfmac: Add optional 32k clock enable support + +WiFi modules often require 32kHz clock to function. Add support to +enable the clock to pcie driver. + +Signed-off-by: Ondrej Jirman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +index 111111111111..222222222222 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -3,6 +3,7 @@ + * Copyright (c) 2014 Broadcom Corporation + */ + ++#include + #include + #include + #include +@@ -2408,6 +2409,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) + struct brcmf_pciedev *pcie_bus_dev; + struct brcmf_core *core; + struct brcmf_bus *bus; ++ struct clk *clk; + + if (!id) { + id = pci_match_id(brcmf_pcie_devid_table, pdev); +@@ -2419,6 +2421,14 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) + + brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device); + ++ clk = devm_clk_get_optional_enabled(&pdev->dev, "32k"); ++ if (IS_ERR(clk)) ++ return PTR_ERR(clk); ++ if (clk) { ++ dev_info(&pdev->dev, "enabling 32kHz clock\n"); ++ clk_set_rate(clk, 32768); ++ } ++ + ret = -ENOMEM; + devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL); + if (devinfo == NULL) +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1010-arm64-dts-rock-5b-Slow-down-emmc-to-hs200-and-add-ts.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1010-arm64-dts-rock-5b-Slow-down-emmc-to-hs200-and-add-ts.patch new file mode 100644 index 000000000000..cad0ed1438f8 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1010-arm64-dts-rock-5b-Slow-down-emmc-to-hs200-and-add-ts.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Wed, 27 Dec 2023 15:03:57 +0800 +Subject: arm64: dts: rock-5b: Slow down emmc to hs200 and add tsadc node + +--- + arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +@@ -408,8 +408,7 @@ &sdhci { + no-sdio; + no-sd; + non-removable; +- mmc-hs400-1_8v; +- mmc-hs400-enhanced-strobe; ++ mmc-hs200-1_8v; + status = "okay"; + }; + +@@ -463,6 +462,10 @@ flash@0 { + }; + }; + ++&tsadc { ++ status = "okay"; ++}; ++ + &uart6 { + pinctrl-names = "default"; + pinctrl-0 = <&uart6m1_xfer &uart6m1_ctsn &uart6m1_rtsn>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1012-arm64-dts-rockchip-Enable-HDMI0-on-rock-5b.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1012-arm64-dts-rockchip-Enable-HDMI0-on-rock-5b.patch new file mode 100644 index 000000000000..1867a9b42d8b --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1012-arm64-dts-rockchip-Enable-HDMI0-on-rock-5b.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Mon, 15 Jan 2024 22:51:17 +0200 +Subject: arm64: dts: rockchip: Enable HDMI0 on rock-5b + +Add the necessary DT changes to enable HDMI0 on Rock 5B. + +Signed-off-by: Cristian Ciocaltea +--- + arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 30 ++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +@@ -4,6 +4,7 @@ + + #include + #include ++#include + #include "rk3588.dtsi" + + / { +@@ -192,6 +193,20 @@ &gpu { + status = "okay"; + }; + ++&hdmi0 { ++ status = "okay"; ++}; ++ ++&hdmi0_in { ++ hdmi0_in_vp0: endpoint { ++ remote-endpoint = <&vp0_out_hdmi0>; ++ }; ++}; ++ ++&hdptxphy_hdmi0 { ++ status = "okay"; ++}; ++ + &i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; +@@ -861,3 +876,18 @@ &usb_host1_xhci { + &usb_host2_xhci { + status = "okay"; + }; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vp0 { ++ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { ++ reg = ; ++ remote-endpoint = <&hdmi0_in_vp0>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1014-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-rock5b.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1014-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-rock5b.patch new file mode 100644 index 000000000000..4a17782ae85a --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1014-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-rock5b.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cristian Ciocaltea +Date: Fri, 3 Nov 2023 20:05:05 +0200 +Subject: arm64: dts: rockchip: Make use of HDMI0 PHY PLL on rock-5b + +The initial vop2 support for rk3588 in mainline is not able to handle +all display modes supported by connected displays, e.g. +2560x1440-75.00Hz, 2048x1152-60.00Hz, 1024x768-60.00Hz. + +Additionally, it doesn't cope with non-integer refresh rates like 59.94, +29.97, 23.98, etc. + +Make use of the HDMI0 PHY PLL to support the additional display modes. + +Note this requires commit "drm/rockchip: vop2: Improve display modes +handling on rk3588", which needs a rework to be upstreamable. + +Signed-off-by: Cristian Ciocaltea +--- + arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +@@ -193,6 +193,11 @@ &gpu { + status = "okay"; + }; + ++&display_subsystem { ++ clocks = <&hdptxphy_hdmi0>; ++ clock-names = "hdmi0_phy_pll"; ++}; ++ + &hdmi0 { + status = "okay"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1020-Add-HDMI-and-VOP2-to-Rock-5A.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1020-Add-HDMI-and-VOP2-to-Rock-5A.patch new file mode 100644 index 000000000000..6ac64dd819cc --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1020-Add-HDMI-and-VOP2-to-Rock-5A.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Tue, 27 Feb 2024 16:04:42 +0300 +Subject: Add HDMI and VOP2 to Rock 5A + +--- + arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 30 ++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include "rk3588s.dtsi" + + / { +@@ -778,3 +779,32 @@ &usb_host1_ohci { + &usb_host2_xhci { + status = "okay"; + }; ++ ++&hdmi0 { ++ status = "okay"; ++}; ++ ++&hdptxphy_hdmi0 { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&hdmi0_in { ++ hdmi0_in_vp0: endpoint { ++ remote-endpoint = <&vp0_out_hdmi0>; ++ }; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vp0 { ++ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { ++ reg = ; ++ remote-endpoint = <&hdmi0_in_vp0>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1021-arch-arm64-dts-enable-gpu-node-for-rock-5a.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1021-arch-arm64-dts-enable-gpu-node-for-rock-5a.patch new file mode 100644 index 000000000000..ceafeea6decb --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1021-arch-arm64-dts-enable-gpu-node-for-rock-5a.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Thu, 28 Mar 2024 00:41:34 +0800 +Subject: arch: arm64: dts: enable gpu node for rock-5a + +--- + arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +@@ -281,6 +281,11 @@ &gmac1_rgmii_clk + status = "okay"; + }; + ++&gpu { ++ mali-supply = <&vdd_gpu_s0>; ++ status = "okay"; ++}; ++ + &mdio1 { + rgmii_phy1: ethernet-phy@1 { + /* RTL8211F */ +@@ -447,6 +452,7 @@ rk806_dvs3_null: dvs3-null-pins { + regulators { + vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { + regulator-name = "vdd_gpu_s0"; ++ regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1021-arm64-dts-Add-missing-nodes-to-Orange-Pi-5-Plus.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1021-arm64-dts-Add-missing-nodes-to-Orange-Pi-5-Plus.patch new file mode 100644 index 000000000000..7814d306607b --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1021-arm64-dts-Add-missing-nodes-to-Orange-Pi-5-Plus.patch @@ -0,0 +1,322 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Thu, 16 Nov 2023 18:15:09 +0300 +Subject: arm64: dts: Add missing nodes to Orange Pi 5 Plus + +--- + arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts | 221 +++++++++- + 1 file changed, 218 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts b/arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include "rk3588.dtsi" + + / { +@@ -72,6 +73,17 @@ ir-receiver { + pinctrl-0 = <&ir_receiver_pin>; + }; + ++ hdmi0-con { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi0_con_in: endpoint { ++ remote-endpoint = <&hdmi0_out_con>; ++ }; ++ }; ++ }; ++ + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; +@@ -98,10 +110,10 @@ pwm-leds { + + led { + color = ; +- function = LED_FUNCTION_INDICATOR; +- function-enumerator = <2>; ++ function = LED_FUNCTION_HEARTBEAT; + max-brightness = <255>; + pwms = <&pwm2 0 25000 0>; ++ linux,default-trigger = "heartbeat"; + }; + }; + +@@ -158,6 +170,20 @@ daicodec: simple-audio-card,codec { + }; + }; + ++ wlan-rfkill { ++ compatible = "rfkill-gpio"; ++ label = "rfkill-wlan"; ++ radio-type = "wlan"; ++ shutdown-gpios = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ bluetooth-rfkill { ++ compatible = "rfkill-gpio"; ++ label = "rfkill-bluetooth"; ++ radio-type = "bluetooth"; ++ shutdown-gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; ++ }; ++ + vcc3v3_pcie30: vcc3v3-pcie30-regulator { + compatible = "regulator-fixed"; + enable-active-high; +@@ -199,6 +225,18 @@ vcc5v0_sys: vcc5v0-sys-regulator { + regulator-max-microvolt = <5000000>; + }; + ++ vbus5v0_typec: vbus5v0-typec-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vbus5v0_typec"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&typec5v_pwren>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ + vcc5v0_usb20: vcc5v0-usb20-regulator { + compatible = "regulator-fixed"; + enable-active-high; +@@ -311,6 +349,53 @@ hym8563: rtc@51 { + pinctrl-0 = <&hym8563_int>; + wakeup-source; + }; ++ ++ usbc0: usb-typec@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usbc0_int>; ++ vbus-supply = <&vbus5v0_typec>; ++ ++ usb_con: connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ data-role = "dual"; ++ power-role = "dual"; ++ try-power-role = "source"; ++ op-sink-microwatt = <1000000>; ++ sink-pdos = ; ++ source-pdos = ; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ usbc0_hs: endpoint { ++ remote-endpoint = <&usb_host0_xhci_drd_sw>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ usbc0_ss: endpoint { ++ remote-endpoint = <&usbdp_phy0_typec_ss>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ usbc0_sbu: endpoint { ++ remote-endpoint = <&usbdp_phy0_typec_sbu>; ++ }; ++ }; ++ }; ++ }; ++ }; + }; + + &i2c7 { +@@ -383,9 +468,15 @@ &pcie3x4 { + }; + + &pinctrl { ++ hdmirx { ++ hdmirx_hpd: hdmirx-hpd { ++ rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ + hym8563 { + hym8563_int: hym8563-int { +- rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + +@@ -408,6 +499,14 @@ hp_detect: hp-detect { + }; + + usb { ++ typec5v_pwren: typec5v-pwren { ++ rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ usbc0_int: usbc0-int { ++ rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ + vcc5v0_usb20_en: vcc5v0-usb20-en { + rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; +@@ -803,6 +902,22 @@ &tsadc { + status = "okay"; + }; + ++&u2phy0 { ++ status = "okay"; ++}; ++ ++&u2phy0_otg { ++ status = "okay"; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ + &u2phy2 { + status = "okay"; + }; +@@ -831,6 +946,35 @@ &uart9 { + status = "okay"; + }; + ++&usbdp_phy0 { ++ orientation-switch; ++ mode-switch; ++ sbu1-dc-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; ++ sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ svid = <0xff01>; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ usbdp_phy0_typec_ss: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&usbc0_ss>; ++ }; ++ ++ usbdp_phy0_typec_sbu: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&usbc0_sbu>; ++ }; ++ }; ++}; ++ ++&usbdp_phy1 { ++ rockchip,dp-lane-mux = <2 3>; ++ status = "okay"; ++}; ++ + &usb_host0_ehci { + status = "okay"; + }; +@@ -839,6 +983,20 @@ &usb_host0_ohci { + status = "okay"; + }; + ++&usb_host0_xhci { ++ dr_mode = "otg"; ++ usb-role-switch; ++ status = "okay"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ usb_host0_xhci_drd_sw: endpoint { ++ remote-endpoint = <&usbc0_hs>; ++ }; ++ }; ++}; ++ + &usb_host1_ehci { + status = "okay"; + }; +@@ -846,3 +1004,60 @@ &usb_host1_ehci { + &usb_host1_ohci { + status = "okay"; + }; ++ ++&usb_host1_xhci { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_gpu_s0>; ++ status = "okay"; ++}; ++ ++&hdptxphy_hdmi0 { ++ status = "okay"; ++}; ++ ++&hdmi0 { ++ enable-gpios = <&gpio4 RK_PB1 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++}; ++ ++&hdmi0_in { ++ hdmi0_in_vp0: endpoint { ++ remote-endpoint = <&vp0_out_hdmi0>; ++ }; ++}; ++ ++&hdmi0_out { ++ hdmi0_out_con: endpoint { ++ remote-endpoint = <&hdmi0_con_in>; ++ }; ++}; ++ ++&hdmi_receiver_cma { ++ status = "disabled"; ++}; ++ ++&hdmi_receiver { ++ hpd-gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_hpd>; ++ pinctrl-names = "default"; ++ status = "disabled"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vp0 { ++ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { ++ reg = ; ++ remote-endpoint = <&hdmi0_in_vp0>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1023-arm64-dts-rockchip-add-PCIe-for-M.2-E-Key-to-rock-5a.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1023-arm64-dts-rockchip-add-PCIe-for-M.2-E-Key-to-rock-5a.patch new file mode 100644 index 000000000000..bd33b5976c41 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1023-arm64-dts-rockchip-add-PCIe-for-M.2-E-Key-to-rock-5a.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Thu, 28 Mar 2024 16:07:18 +0800 +Subject: arm64: dts: rockchip: add PCIe for M.2 E-Key to rock-5a + +--- + arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +@@ -115,6 +115,10 @@ vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + }; + }; + ++&combphy0_ps { ++ status = "okay"; ++}; ++ + &combphy2_psu { + status = "okay"; + }; +@@ -299,6 +303,11 @@ rgmii_phy1: ethernet-phy@1 { + }; + }; + ++&pcie2x1l2 { ++ status = "okay"; ++ reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; ++}; ++ + &pinctrl { + leds { + io_led: io-led { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1031-arm64-dts-rockchip-Add-HDMI-support-to-ArmSoM-Sige7.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1031-arm64-dts-rockchip-Add-HDMI-support-to-ArmSoM-Sige7.patch new file mode 100644 index 000000000000..8ee172545f55 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1031-arm64-dts-rockchip-Add-HDMI-support-to-ArmSoM-Sige7.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Thu, 6 Jun 2024 23:28:01 +0800 +Subject: arm64: dts: rockchip: Add HDMI support to ArmSoM Sige7 + +--- + arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts | 30 ++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts b/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts +@@ -4,6 +4,7 @@ + + #include + #include ++#include + #include "rk3588.dtsi" + + / { +@@ -164,6 +165,20 @@ &gpu { + status = "okay"; + }; + ++&hdmi0 { ++ status = "okay"; ++}; ++ ++&hdmi0_in { ++ hdmi0_in_vp0: endpoint { ++ remote-endpoint = <&vp0_out_hdmi0>; ++ }; ++}; ++ ++&hdptxphy_hdmi0 { ++ status = "okay"; ++}; ++ + &i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; +@@ -723,3 +738,18 @@ &usb_host1_xhci { + dr_mode = "host"; + status = "okay"; + }; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vp0 { ++ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { ++ reg = ; ++ remote-endpoint = <&hdmi0_in_vp0>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1032-arm64-dts-rockchip-Add-ap6275p-wireless-support-to-A.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1032-arm64-dts-rockchip-Add-ap6275p-wireless-support-to-A.patch new file mode 100644 index 000000000000..a57707485c0e --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1032-arm64-dts-rockchip-Add-ap6275p-wireless-support-to-A.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Thu, 6 Jun 2024 23:29:39 +0800 +Subject: arm64: dts: rockchip: Add ap6275p wireless support to ArmSoM Sige7 + +--- + arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts | 16 ++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts b/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-armsom-sige7.dts +@@ -283,6 +283,22 @@ &pcie2x1l0 { + &pcie2x1l1 { + reset-gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; + status = "okay"; ++ ++ pcie@0,0 { ++ reg = <0x300000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ device_type = "pci"; ++ bus-range = <0x30 0x3f>; ++ ++ wifi: wifi@0,0 { ++ compatible = "pci14e4,449d"; ++ reg = <0x310000 0 0 0 0>; ++ clocks = <&hym8563>; ++ clock-names = "32k"; ++ }; ++ }; + }; + + /* phy0 - left ethernet port */ +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1040-board-khadas-edge2-add-nodes.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1040-board-khadas-edge2-add-nodes.patch new file mode 100644 index 000000000000..17e8fbd06bcd --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1040-board-khadas-edge2-add-nodes.patch @@ -0,0 +1,359 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Mon, 12 Feb 2024 17:35:13 +0300 +Subject: arm64: dts: rockchip: Add USB-C to Khadas Edge 2 + +Khadas Edge 2 has 2x Type-C port. One just supports PD and +controlled by MCU. The other one supports PD, DP Alt mode and DRD. This +commit adds support for DRD. + +Signed-off-by: Muhammed Efe Cetin +--- + arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 120 ++++++++++ + 1 file changed, 120 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include "rk3588s.dtsi" + + / { +@@ -76,6 +77,18 @@ blue_led: led-2 { + }; + }; + ++ vbus5v0_typec: vbus5v0-typec-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vbus5v0_typec"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ gpio = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>; ++ vin-supply = <&vcc5v0_sys>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&typec5v_pwren>; ++ }; ++ + vcc3v3_pcie_wl: vcc3v3-pcie-wl-regulator { + compatible = "regulator-fixed"; + enable-active-high; +@@ -224,6 +237,56 @@ regulator-state-mem { + &i2c2 { + status = "okay"; + ++ usbc0: usb-typec@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usbc0_int>; ++ vbus-supply = <&vbus5v0_typec>; ++ status = "okay"; ++ ++ usb_con: connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ data-role = "dual"; ++ power-role = "dual"; ++ try-power-role = "source"; ++ op-sink-microwatt = <1000000>; ++ sink-pdos = ; ++ source-pdos = ; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ usbc0_orien_sw: endpoint { ++ remote-endpoint = <&usbdp_phy0_orientation_switch>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ usbc0_role_sw: endpoint { ++ remote-endpoint = <&dwc3_0_role_switch>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ dp_altmode_mux: endpoint { ++ remote-endpoint = <&usbdp_phy0_dp_altmode_mux>; ++ }; ++ }; ++ }; ++ }; ++ }; ++ + hym8563: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; +@@ -256,6 +319,16 @@ vcc5v0_host_en: vcc5v0-host-en { + }; + }; + ++ usb-typec { ++ usbc0_int: usbc0-int { ++ rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ typec5v_pwren: typec5v-pwren { ++ rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ + ir-receiver { + ir_receiver_pin: ir-receiver-pin { + rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; +@@ -681,6 +754,15 @@ &uart9 { + status = "okay"; + }; + ++&u2phy0 { ++ status = "okay"; ++}; ++ ++&u2phy0_otg { ++ status = "okay"; ++}; ++ ++ + &u2phy2 { + status = "okay"; + }; +@@ -707,6 +789,44 @@ &usb_host0_ohci { + status = "okay"; + }; + ++&usbdp_phy0 { ++ orientation-switch; ++ mode-switch; ++ svid = <0xff01>; ++ sbu1-dc-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>; ++ sbu2-dc-gpios = <&gpio4 RK_PA1 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ usbdp_phy0_orientation_switch: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&usbc0_orien_sw>; ++ }; ++ ++ usbdp_phy0_dp_altmode_mux: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&dp_altmode_mux>; ++ }; ++ }; ++}; ++ ++&usb_host0_xhci { ++ usb-role-switch; ++ status = "okay"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ dwc3_0_role_switch: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&usbc0_role_sw>; ++ }; ++ }; ++}; ++ + &usb_host1_ehci { + status = "okay"; + }; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Mon, 12 Feb 2024 17:35:13 +0300 +Subject: arm64: dts: rockchip: Add bluetooth support to Khadas Edge 2 + +--- + arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 18 +++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +@@ -750,8 +750,24 @@ &uart2 { + + &uart9 { + pinctrl-names = "default"; +- pinctrl-0 = <&uart9m2_xfer &uart9m2_ctsn>; ++ pinctrl-0 = <&uart9m2_xfer &uart9m2_ctsn &uart9m2_rtsn>; + status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm43438-bt"; ++ clocks = <&hym8563>; ++ clock-names = "lpo"; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wakeup"; ++ device-wakeup-gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; ++ shutdown-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; ++ max-speed = <1500000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_wake_host_irq &bt_wake_pin &bt_reset_pin>; ++ vbat-supply = <&vcc_3v3_s3>; ++ vddio-supply = <&vcc_1v8_s3>; ++ }; + }; + + &u2phy0 { +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Mon, 19 Feb 2024 23:32:11 +0300 +Subject: arm64: dts: rockchip: Add HDMI & VOP2 to Khadas Edge 2 + +--- + arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 53 ++++++++++ + 1 file changed, 53 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + #include "rk3588s.dtsi" + + / { +@@ -43,6 +44,17 @@ ir-receiver { + pinctrl-0 = <&ir_receiver_pin>; + }; + ++ hdmi0-con { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi0_con_in: endpoint { ++ remote-endpoint = <&hdmi0_out_con>; ++ }; ++ }; ++ }; ++ + leds { + compatible = "pwm-leds"; + +@@ -830,6 +842,7 @@ usbdp_phy0_dp_altmode_mux: endpoint@1 { + }; + + &usb_host0_xhci { ++ dr-mode = "otg"; + usb-role-switch; + status = "okay"; + +@@ -854,3 +867,43 @@ &usb_host1_ohci { + &usb_host2_xhci { + status = "okay"; + }; ++ ++&hdmi0 { ++ status = "okay"; ++}; ++ ++&hdmi0_in { ++ hdmi0_in_vp0: endpoint { ++ remote-endpoint = <&vp0_out_hdmi0>; ++ }; ++}; ++ ++&hdmi0_out { ++ hdmi0_out_con: endpoint { ++ remote-endpoint = <&hdmi0_con_in>; ++ }; ++}; ++ ++&hdptxphy_hdmi0 { ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ clocks = <&hdptxphy_hdmi0>; ++ clock-names = "hdmi0_phy_pll"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vp0 { ++ vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { ++ reg = ; ++ remote-endpoint = <&hdmi0_in_vp0>; ++ }; ++}; +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Sat, 2 Mar 2024 19:13:59 +0300 +Subject: arm64: dts: rockchip: Add AP6275P wireless support to Khadas Edge 2 + +--- + arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 17 ++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +@@ -368,6 +368,23 @@ &pcie2x1l2 { + reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie_wl>; + status = "okay"; ++ ++ pcie@0,0 { ++ reg = <0x400000 0 0 0 0>; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ ranges; ++ device_type = "pci"; ++ bus-range = <0x40 0x4f>; ++ ++ wifi: wifi@0,0 { ++ compatible = "pci14e4,449d"; ++ reg = <0x410000 0 0 0 0>; ++ clocks = <&hym8563>; ++ clock-names = "32k"; ++ }; ++ }; ++ + }; + + &pwm11 { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1041-board-khadas-edge2-mcu.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1041-board-khadas-edge2-mcu.patch new file mode 100644 index 000000000000..856b524ef432 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1041-board-khadas-edge2-mcu.patch @@ -0,0 +1,441 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Wed, 6 Mar 2024 00:09:25 +0300 +Subject: mfd: khadas-mcu: add Edge2 registers + +--- + drivers/mfd/khadas-mcu.c | 8 +++- + include/linux/mfd/khadas-mcu.h | 24 ++++++++++ + 2 files changed, 30 insertions(+), 2 deletions(-) + +diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c +index 111111111111..222222222222 100644 +--- a/drivers/mfd/khadas-mcu.c ++++ b/drivers/mfd/khadas-mcu.c +@@ -26,6 +26,10 @@ static bool khadas_mcu_reg_volatile(struct device *dev, unsigned int reg) + case KHADAS_MCU_CHECK_USER_PASSWD_REG: + case KHADAS_MCU_WOL_INIT_START_REG: + case KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG: ++ case KHADAS_MCU_LED_ON_RAM_REG: ++ case KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG_V2: ++ case KHADAS_MCU_WDT_EN_REG: ++ case KHADAS_MCU_SYS_RST_REG: + return true; + default: + return false; +@@ -69,14 +73,14 @@ static const struct regmap_config khadas_mcu_regmap_config = { + .reg_bits = 8, + .reg_stride = 1, + .val_bits = 8, +- .max_register = KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, ++ .max_register = KHADAS_MCU_SYS_RST_REG, + .volatile_reg = khadas_mcu_reg_volatile, + .writeable_reg = khadas_mcu_reg_writeable, + .cache_type = REGCACHE_MAPLE, + }; + + static struct mfd_cell khadas_mcu_fan_cells[] = { +- /* VIM1/2 Rev13+ and VIM3 only */ ++ /* VIM1/2 Rev13+, VIM3 and Edge2 only */ + { .name = "khadas-mcu-fan-ctrl", }, + }; + +diff --git a/include/linux/mfd/khadas-mcu.h b/include/linux/mfd/khadas-mcu.h +index 111111111111..222222222222 100644 +--- a/include/linux/mfd/khadas-mcu.h ++++ b/include/linux/mfd/khadas-mcu.h +@@ -35,26 +35,45 @@ + #define KHADAS_MCU_FACTORY_TEST_REG 0x16 /* R */ + #define KHADAS_MCU_BOOT_MODE_REG 0x20 /* RW */ + #define KHADAS_MCU_BOOT_EN_WOL_REG 0x21 /* RW */ ++#define KHADAS_MCU_BOOT_EN_DCIN_REG_V2 0x21 /* RW */ + #define KHADAS_MCU_BOOT_EN_RTC_REG 0x22 /* RW */ + #define KHADAS_MCU_BOOT_EN_EXP_REG 0x23 /* RW */ ++#define KHADAS_MCU_LED_MODE_ON_REG_V2 0x23 /* RW */ ++#define KHADAS_MCU_LED_MODE_OFF_REG_V2 0x24 /* RW */ + #define KHADAS_MCU_BOOT_EN_IR_REG 0x24 /* RW */ + #define KHADAS_MCU_BOOT_EN_DCIN_REG 0x25 /* RW */ ++#define KHADAS_MCU_RGB_ON_R_REG 0x25 /* RW */ ++#define KHADAS_MCU_RGB_ON_G_REG 0x26 /* RW */ + #define KHADAS_MCU_BOOT_EN_KEY_REG 0x26 /* RW */ ++#define KHADAS_MCU_RGB_ON_B_REG 0x27 /* RW */ + #define KHADAS_MCU_KEY_MODE_REG 0x27 /* RW */ ++#define KHADAS_MCU_RGB_OFF_R_REG 0x28 /* RW */ + #define KHADAS_MCU_LED_MODE_ON_REG 0x28 /* RW */ ++#define KHADAS_MCU_RGB_OFF_G_REG 0x29 /* RW */ + #define KHADAS_MCU_LED_MODE_OFF_REG 0x29 /* RW */ ++#define KHADAS_MCU_RGB_OFF_B_REG 0x2a /* RW */ + #define KHADAS_MCU_SHUTDOWN_NORMAL_REG 0x2c /* RW */ + #define KHADAS_MCU_MAC_SWITCH_REG 0x2d /* RW */ ++#define KHADAS_MCU_REST_CONF_REG 0x2e /* RW */ + #define KHADAS_MCU_MCU_SLEEP_MODE_REG 0x2e /* RW */ ++#define KHADAS_MCU_BOOT_EN_IR_REG_V2 0x2f /* RW */ + #define KHADAS_MCU_IR_CODE1_0_REG 0x2f /* RW */ + #define KHADAS_MCU_IR_CODE1_1_REG 0x30 /* RW */ ++#define KHADAS_MCU_IR1_CUST1_REG 0x30 /* RW */ + #define KHADAS_MCU_IR_CODE1_2_REG 0x31 /* RW */ ++#define KHADAS_MCU_IR1_CUST2_REG 0x31 /* RW */ + #define KHADAS_MCU_IR_CODE1_3_REG 0x32 /* RW */ ++#define KHADAS_MCU_IR1_ORDER1_REG 0x32 /* RW */ + #define KHADAS_MCU_USB_PCIE_SWITCH_REG 0x33 /* RW */ ++#define KHADAS_MCU_IR1_ORDER2_REG 0x33 /* RW */ ++#define KHADAS_MCU_IR2_CUST1_REG 0x34 /* RW */ + #define KHADAS_MCU_IR_CODE2_0_REG 0x34 /* RW */ + #define KHADAS_MCU_IR_CODE2_1_REG 0x35 /* RW */ ++#define KHADAS_MCU_IR2_CUST2_REG 0x35 /* RW */ + #define KHADAS_MCU_IR_CODE2_2_REG 0x36 /* RW */ ++#define KHADAS_MCU_IR2_ORDER1_REG 0x36 /* RW */ + #define KHADAS_MCU_IR_CODE2_3_REG 0x37 /* RW */ ++#define KHADAS_MCU_IR2_ORDER2_REG 0x36 /* RW */ + #define KHADAS_MCU_PASSWD_USER_0_REG 0x40 /* RW */ + #define KHADAS_MCU_PASSWD_USER_1_REG 0x41 /* RW */ + #define KHADAS_MCU_PASSWD_USER_2_REG 0x42 /* RW */ +@@ -69,6 +88,10 @@ + #define KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG 0x86 /* RO */ + #define KHADAS_MCU_WOL_INIT_START_REG 0x87 /* WO */ + #define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG 0x88 /* WO */ ++#define KHADAS_MCU_LED_ON_RAM_REG 0x89 /* WO */ ++#define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG_V2 0x8A /* WO */ ++#define KHADAS_MCU_WDT_EN_REG 0x8B /* WO */ ++#define KHADAS_MCU_SYS_RST_REG 0x91 /* WO */ + + enum { + KHADAS_BOARD_VIM1 = 0x1, +@@ -76,6 +99,7 @@ enum { + KHADAS_BOARD_VIM3, + KHADAS_BOARD_EDGE = 0x11, + KHADAS_BOARD_EDGE_V, ++ KHADAS_BOARD_EDGE2, + }; + + /** +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Wed, 6 Mar 2024 00:09:58 +0300 +Subject: mfd: khadas-mcu: drop unused code + +--- + drivers/mfd/khadas-mcu.c | 11 ---------- + 1 file changed, 11 deletions(-) + +diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c +index 111111111111..222222222222 100644 +--- a/drivers/mfd/khadas-mcu.c ++++ b/drivers/mfd/khadas-mcu.c +@@ -84,10 +84,6 @@ static struct mfd_cell khadas_mcu_fan_cells[] = { + { .name = "khadas-mcu-fan-ctrl", }, + }; + +-static struct mfd_cell khadas_mcu_cells[] = { +- { .name = "khadas-mcu-user-mem", }, +-}; +- + static int khadas_mcu_probe(struct i2c_client *client) + { + struct device *dev = &client->dev; +@@ -109,13 +105,6 @@ static int khadas_mcu_probe(struct i2c_client *client) + return ret; + } + +- ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, +- khadas_mcu_cells, +- ARRAY_SIZE(khadas_mcu_cells), +- NULL, 0, NULL); +- if (ret) +- return ret; +- + if (of_property_present(dev->of_node, "#cooling-cells")) + return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, + khadas_mcu_fan_cells, +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Wed, 6 Mar 2024 00:13:10 +0300 +Subject: thermal: khadas_mcu_fan: add support for Khadas Edge 2 + +--- + drivers/thermal/khadas_mcu_fan.c | 77 +++++++++- + 1 file changed, 73 insertions(+), 4 deletions(-) + +diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_fan.c +index 111111111111..222222222222 100644 +--- a/drivers/thermal/khadas_mcu_fan.c ++++ b/drivers/thermal/khadas_mcu_fan.c +@@ -15,10 +15,16 @@ + #include + + #define MAX_LEVEL 3 ++#define MAX_SPEED 0x64 + + struct khadas_mcu_fan_ctx { + struct khadas_mcu *mcu; + unsigned int level; ++ ++ unsigned int fan_max_level; ++ unsigned int fan_register; ++ unsigned int *fan_cooling_levels; ++ + struct thermal_cooling_device *cdev; + }; + +@@ -26,9 +32,21 @@ static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx, + unsigned int level) + { + int ret; ++ unsigned int write_level = level; ++ ++ if (level > ctx->fan_max_level) ++ return -EINVAL; ++ ++ if (ctx->fan_cooling_levels != NULL) { ++ write_level = ctx->fan_cooling_levels[level]; ++ ++ if (write_level > MAX_SPEED) ++ return -EINVAL; ++ } ++ ++ ret = regmap_write(ctx->mcu->regmap, ctx->fan_register, ++ write_level); + +- ret = regmap_write(ctx->mcu->regmap, KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, +- level); + if (ret) + return ret; + +@@ -40,7 +58,9 @@ static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx, + static int khadas_mcu_fan_get_max_state(struct thermal_cooling_device *cdev, + unsigned long *state) + { +- *state = MAX_LEVEL; ++ struct khadas_mcu_fan_ctx *ctx = cdev->devdata; ++ ++ *state = ctx->fan_max_level; + + return 0; + } +@@ -61,7 +81,7 @@ khadas_mcu_fan_set_cur_state(struct thermal_cooling_device *cdev, + { + struct khadas_mcu_fan_ctx *ctx = cdev->devdata; + +- if (state > MAX_LEVEL) ++ if (state > ctx->fan_max_level) + return -EINVAL; + + if (state == ctx->level) +@@ -76,6 +96,48 @@ static const struct thermal_cooling_device_ops khadas_mcu_fan_cooling_ops = { + .set_cur_state = khadas_mcu_fan_set_cur_state, + }; + ++// Khadas Edge 2 sets fan level by passing fan speed(0-100). So we need different logic here like pwm-fan cooling-levels. ++// This is optional and just necessary for Edge 2. ++static int khadas_mcu_fan_get_cooling_data_edge2(struct khadas_mcu_fan_ctx *ctx, struct device *dev) { ++ struct device_node *np = ctx->mcu->dev->of_node; ++ int num, i, ret; ++ ++ if (!of_property_present(np, "cooling-levels")) ++ return 0; ++ ++ ret = of_property_count_u32_elems(np, "cooling-levels"); ++ if (ret <= 0) { ++ dev_err(dev, "Wrong data!\n"); ++ return ret ? : -EINVAL; ++ } ++ ++ num = ret; ++ ctx->fan_cooling_levels = devm_kcalloc(dev, num, sizeof(u32), ++ GFP_KERNEL); ++ if (!ctx->fan_cooling_levels) ++ return -ENOMEM; ++ ++ ret = of_property_read_u32_array(np, "cooling-levels", ++ ctx->fan_cooling_levels, num); ++ if (ret) { ++ dev_err(dev, "Property 'cooling-levels' cannot be read!\n"); ++ return ret; ++ } ++ ++ for (i = 0; i < num; i++) { ++ if (ctx->fan_cooling_levels[i] > MAX_SPEED) { ++ dev_err(dev, "PWM fan state[%d]:%d > %d\n", i, ++ ctx->fan_cooling_levels[i], MAX_SPEED); ++ return -EINVAL; ++ } ++ } ++ ++ ctx->fan_max_level = num - 1; ++ ctx->fan_register = KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG_V2; ++ ++ return 0; ++} ++ + static int khadas_mcu_fan_probe(struct platform_device *pdev) + { + struct khadas_mcu *mcu = dev_get_drvdata(pdev->dev.parent); +@@ -90,6 +152,13 @@ static int khadas_mcu_fan_probe(struct platform_device *pdev) + ctx->mcu = mcu; + platform_set_drvdata(pdev, ctx); + ++ ctx->fan_max_level = MAX_LEVEL; ++ ctx->fan_register = KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG; ++ ++ ret = khadas_mcu_fan_get_cooling_data_edge2(ctx, dev); ++ if (ret) ++ return ret; ++ + cdev = devm_thermal_of_cooling_device_register(dev->parent, + dev->parent->of_node, "khadas-mcu-fan", ctx, + &khadas_mcu_fan_cooling_ops); +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Wed, 6 Mar 2024 00:14:58 +0300 +Subject: dt-bindings: mfd: khadas-mcu: add cooling-levels property + +--- + Documentation/devicetree/bindings/mfd/khadas,mcu.yaml | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml +index 111111111111..222222222222 100644 +--- a/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml ++++ b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml +@@ -11,7 +11,7 @@ maintainers: + + description: | + Khadas embeds a microcontroller on their VIM and Edge boards adding some +- system feature as PWM Fan control (for VIM2 rev14 or VIM3), User memory ++ system feature as PWM Fan control (for VIM2 rev14, VIM3, Edge2), User memory + storage, IR/Key resume control, system power LED control and more. + + properties: +@@ -22,6 +22,11 @@ properties: + "#cooling-cells": # Only needed for boards having FAN control feature + const: 2 + ++ cooling-levels: ++ description: Max speed of PWM fan. This property is necessary for Khadas Edge 2. ++ items: ++ maximum: 100 ++ + reg: + maxItems: 1 + +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Wed, 6 Mar 2024 00:17:58 +0300 +Subject: arm64: dts: rockchip: Add MCU to Khadas Edge 2 + +--- + arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +@@ -306,6 +306,13 @@ hym8563: rtc@51 { + clock-output-names = "hym8563"; + wakeup-source; + }; ++ ++ khadas_mcu: system-controller@18 { ++ compatible = "khadas,mcu"; ++ reg = <0x18>; ++ cooling-levels = <0 50 72 100>; ++ #cooling-cells = <2>; ++ }; + }; + + &pinctrl { +-- +Armbian + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Muhammed Efe Cetin +Date: Mon, 25 Mar 2024 22:41:26 +0300 +Subject: arm64: dts: rockchip: Add automatic fan control to Khadas Edge 2 + +--- + arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts | 56 ++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +@@ -315,6 +315,62 @@ khadas_mcu: system-controller@18 { + }; + }; + ++&package_thermal { ++ polling-delay = <1000>; ++ ++ trips { ++ package_fan0: package-fan0 { ++ temperature = <45000>; ++ hysteresis = <5000>; ++ type = "active"; ++ }; ++ ++ package_fan1: package-fan1 { ++ temperature = <55000>; ++ hysteresis = <5000>; ++ type = "active"; ++ }; ++ ++ package_fan2: package-fan2 { ++ temperature = <60000>; ++ hysteresis = <5000>; ++ type = "active"; ++ }; ++ ++ package_fan3: package-fan3 { ++ temperature = <70000>; ++ hysteresis = <5000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map0 { ++ trip = <&package_fan0>; ++ cooling-device = <&khadas_mcu 0 1>; ++ contribution = <1024>; ++ }; ++ ++ map1 { ++ trip = <&package_fan1>; ++ cooling-device = <&khadas_mcu 1 2>; ++ contribution = <1024>; ++ }; ++ ++ map2 { ++ trip = <&package_fan2>; ++ cooling-device = <&khadas_mcu 2 3>; ++ contribution = <1024>; ++ }; ++ ++ map3 { ++ trip = <&package_fan3>; ++ cooling-device = <&khadas_mcu 3 THERMAL_NO_LIMIT>; ++ contribution = <1024>; ++ }; ++ }; ++}; ++ + &pinctrl { + vdd_sd { + vdd_sd_en: vdd-sd-en { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/1051-arm64-dts-rockchip-Add-NanoPC-T6-SPI-Flash.patch b/patch/kernel/archive/rockchip-rk3588-6.11/1051-arm64-dts-rockchip-Add-NanoPC-T6-SPI-Flash.patch new file mode 100644 index 000000000000..6b842c006ea3 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/1051-arm64-dts-rockchip-Add-NanoPC-T6-SPI-Flash.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ricardo Pardini +Date: Thu, 6 Jun 2024 23:00:05 +0200 +Subject: arm64: dts: rockchip: Add NanoPC T6 SPI Flash + +Signed-off-by: Ricardo Pardini +--- + arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts | 14 ++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts +index 111111111111..222222222222 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts +@@ -576,6 +576,20 @@ &sdmmc { + status = "okay"; + }; + ++&sfc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fspim1_pins>; ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0x0>; ++ spi-max-frequency = <50000000>; ++ spi-rx-bus-width = <4>; ++ spi-tx-bus-width = <1>; ++ }; ++}; ++ + &spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-bananapi-m7.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-bananapi-m7.dts new file mode 100644 index 000000000000..8489240ab8bd --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-bananapi-m7.dts @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3588-armsom-sige7.dts" + +/ { + model = "Banana Pi M7"; + compatible = "bananapi,m7", "rockchip,rk3588"; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-hinlink-h88k.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-hinlink-h88k.dts new file mode 100644 index 000000000000..ed962d5a9ee1 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-hinlink-h88k.dts @@ -0,0 +1,858 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include +#include "rk3588.dtsi" + +/ { + model = "HINLINK H88K"; + compatible = "hinlink,h88k", "rockchip,rk3588"; + + aliases { + ethernet0 = &gmac0; + mmc0 = &sdhci; + mmc1 = &sdmmc; + mmc2 = &sdio; + }; + + analog-sound { + compatible = "simple-audio-card"; + label = "rockchip,es8388-codec"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_detect>; + simple-audio-card,name = "Analog"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>; + simple-audio-card,bitclock-master = <&daicpu>; + simple-audio-card,frame-master = <&daicpu>; + + simple-audio-card,widgets = + "Microphone", "Onboard Microphone", + "Microphone", "Microphone Jack", + "Speaker", "Speaker", + "Headphone", "Headphones"; + + simple-audio-card,routing = + "Headphones", "LOUT1", + "Headphones", "ROUT1", + "Speaker", "LOUT2", + "Speaker", "ROUT2", + + /* single ended signal to LINPUT1 */ + "LINPUT1", "Microphone Jack", + "RINPUT1", "Microphone Jack", + /* differential signal */ + "LINPUT2", "Onboard Microphone", + "RINPUT2", "Onboard Microphone"; + + daicpu: simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + system-clock-frequency = <12288000>; + }; + + daicodec: simple-audio-card,codec { + sound-dai = <&es8388>; + system-clock-frequency = <12288000>; + }; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_net_en>, <&led_sata_en>, + <&led_user_en>, <&led_work_en>; + + net { + label = "blue:net"; + gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_HIGH>; + }; + + sata { + label = "amber:sata"; + gpios = <&gpio2 RK_PC5 GPIO_ACTIVE_HIGH>; + }; + + user { + label = "green:user"; + gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_HIGH>; + }; + + work { + label = "red:work"; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + + vcc12v_dcin: vcc12v-dcin { + compatible = "regulator-fixed"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-name = "vcc12v_dcin"; + }; + + vcc3v3_pcie30: vcc3v3-pcie30-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; + regulator-name = "vcc3v3_pcie30"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + startup-delay-us = <5000>; + vin-supply = <&vcc12v_dcin>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_hub: vcc5v0-usb-hub { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_hub_en>; + regulator-name = "vcc5v0_usb_hub"; + regulator-always-on; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v1_nldo_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&combphy0_ps { + status = "okay"; +}; + +&combphy1_ps { + status = "okay"; +}; + +&combphy2_psu { + status = "okay"; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&gmac0 { + clock_in_out = "output"; + phy-handle = <&rgmii_phy>; + phy-mode = "rgmii-rxid"; + pinctrl-0 = <&gmac0_miim + &gmac0_tx_bus2 + &gmac0_rx_bus2 + &gmac0_rgmii_clk + &gmac0_rgmii_bus>; + pinctrl-names = "default"; + rx_delay = <0x00>; + tx_delay = <0x43>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu_s0>; + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + + +&hdptxphy_hdmi0 { + status = "okay"; +}; + +&hdmi0_in { + hdmi0_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi0>; + }; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; + status = "okay"; + + vdd_cpu_big0_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c2 { + status = "okay"; + + hym8563: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-output-names = "hym8563"; + pinctrl-names = "default"; + pinctrl-0 = <&hym8563_int>; + interrupt-parent = <&gpio0>; + interrupts = ; + wakeup-source; + }; +}; + +&i2c7 { + pinctrl-0 = <&i2c7m0_xfer>; + status = "okay"; + + es8388: audio-codec@11 { + compatible = "everest,es8388"; + reg = <0x11>; + assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; + assigned-clock-rates = <12288000>; + AVDD-supply = <&vcc_3v3_s3>; + clocks = <&cru I2S0_8CH_MCLKOUT>; + clock-names = "mclk"; + DVDD-supply = <&vcc_1v8_s3>; + HPVDD-supply = <&vcc_3v3_s3>; + PVDD-supply = <&vcc_1v8_s3>; + #sound-dai-cells = <0>; + + port { + es8388_p0_0: endpoint { + remote-endpoint = <&i2s0_8ch_p0_0>; + }; + }; + }; +}; + +&i2s0_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s0_lrck + &i2s0_mclk + &i2s0_sclk + &i2s0_sdi0 + &i2s0_sdo0>; + status = "okay"; + + i2s0_8ch_p0: port { + i2s0_8ch_p0_0: endpoint { + dai-format = "i2s"; + mclk-fs = <256>; + remote-endpoint = <&es8388_p0_0>; + }; + }; +}; + +&mdio0 { + rgmii_phy: ethernet-phy@1 { + /* RTL8211F */ + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1>; + pinctrl-names = "default"; + pinctrl-0 = <&rtl8211f_rst>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>; + }; +}; + +&pcie2x1l0 { + reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&pcie2x1l1 { + reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&pcie2x1l2 { + reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&pcie30phy { + status = "okay"; +}; + +&pcie3x4 { + pinctrl-names = "default"; + reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie30>; + status = "okay"; +}; + +&pinctrl { + hym8563 { + hym8563_int: hym8563-int { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_net_en: led_net_en { + rockchip,pins = <2 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_sata_en: led_sata_en { + rockchip,pins = <2 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_user_en: led_user_en { + rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_work_en: led_work_en { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rtl8211f { + rtl8211f_rst: rtl8211f-rst { + rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sound { + hp_detect: hp-detect { + rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_usb_hub_en: vcc5v0_usb_hub_en { + rockchip,pins = <4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&saradc { + vref-supply = <&avcc_1v8_s0>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + no-sdio; + no-sd; + non-removable; + mmc-hs200-1_8v; + status = "okay"; +}; + +&sdmmc { + max-frequency = <200000000>; + no-sdio; + no-mmc; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s3>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +&spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + pinctrl-names = "default"; + pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; + num-cs = <1>; + + pmic@0 { + compatible = "rockchip,rk806"; + spi-max-frequency = <1000000>; + reg = <0x0>; + + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + + system-power-controller; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc5v0_sys>; + vcc6-supply = <&vcc5v0_sys>; + vcc7-supply = <&vcc5v0_sys>; + vcc8-supply = <&vcc5v0_sys>; + vcc9-supply = <&vcc5v0_sys>; + vcc10-supply = <&vcc5v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc5v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc5v0_sys>; + + gpio-controller; + #gpio-cells = <2>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_gpu_s0"; + regulator-enable-ramp-delay = <400>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_cpu_lit_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log_s0: dcdc-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <750000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_log_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_vdenc_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vdd2_ddr_s3: dcdc-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vdd2_ddr_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_2v0_pldo_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_3v3_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vddq_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "avcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "avdd_1v2_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vcc_3v3_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vccio_sd_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + pldo6_s3: pldo-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "pldo6_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_ddr_pll_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "avdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_0v85_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&tsadc { + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&u2phy2 { + status = "okay"; +}; + +&u2phy2_host { + /* connected to USB hub, which is powered by vcc5v0_sys */ + phy-supply = <&vcc5v0_sys>; + status = "okay"; +}; + +&u2phy3 { + status = "okay"; +}; + +&u2phy3_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usbdp_phy1 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb_host2_xhci { + status = "okay"; +}; + +&vop { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi0_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-mixtile-blade3.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-mixtile-blade3.dts new file mode 100644 index 000000000000..ef0adae48ebf --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-mixtile-blade3.dts @@ -0,0 +1,712 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include "rk3588.dtsi" + +/ { + model = "Mixtile Blade 3"; + compatible = "mixtile,blade3", "rockchip,rk3588"; + + aliases { + mmc0 = &sdhci; + mmc1 = &sdmmc; + serial2 = &uart2; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + vcc12v_dcin: vcc12v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc12v_dcin>; + }; + + vcc5v0_usbdcin: vcc5v0-usbdcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usbdcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc12v_dcin>; + }; + + vcc5v0_usb: vcc5v0-usb-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_usbdcin>; + }; + + pcie20_avdd0v85: pcie20-avdd0v85-regulator { + compatible = "regulator-fixed"; + regulator-name = "pcie20_avdd0v85"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + vin-supply = <&vdd_0v85_s0>; + }; + + pcie20_avdd1v8: pcie20-avdd1v8-regulator { + compatible = "regulator-fixed"; + regulator-name = "pcie20_avdd1v8"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&avcc_1v8_s0>; + }; + + pcie30_avdd0v75: pcie30-avdd0v75-regulator { + compatible = "regulator-fixed"; + regulator-name = "pcie30_avdd0v75"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + vin-supply = <&avdd_0v75_s0>; + }; + + pcie30_avdd1v8: pcie30-avdd1v8-regulator { + compatible = "regulator-fixed"; + regulator-name = "pcie30_avdd1v8"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&avcc_1v8_s0>; + }; + + vcc3v3_pcie30: vcc3v3-pcie30-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie30"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + enable-active-high; + regulator-boot-on; + regulator-always-on; + gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; + startup-delay-us = <5000>; + vin-supply = <&vcc12v_dcin>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie3_vcc3v3_en>; + }; + + vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3_sd_s0"; + gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_pwr>; + enable-active-high; + }; + + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v1_nldo_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&combphy0_ps { + status = "okay"; +}; + +&combphy1_ps { + status = "okay"; +}; + +&combphy2_psu { + status = "okay"; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; + mem-supply = <&vdd_cpu_big0_mem_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; + mem-supply = <&vdd_cpu_big0_mem_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; + mem-supply = <&vdd_cpu_big1_mem_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; + mem-supply = <&vdd_cpu_big1_mem_s0>; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; + status = "okay"; + + vdd_cpu_big0_s0: vdd_cpu_big0_mem_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: vdd_cpu_big1_mem_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1m2_xfer>; + status = "okay"; + + vdd_npu_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_npu_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c4 { + pinctrl-0 = <&i2c4m0_xfer>; + status = "okay"; +}; + +/* exposed on the 30-pin connector; shows up as i2c-3 */ +&i2c5 { + pinctrl-0 = <&i2c5m3_xfer>; + status = "okay"; +}; + +&i2s2_2ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s2m1_mclk + &i2s2m1_lrck + &i2s2m1_sclk + &i2s2m1_sdi + &i2s2m1_sdo>; + status = "okay"; +}; + +&pcie2x1l0 { + reset-gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_0_rst>; + status = "okay"; +}; + +&pcie2x1l1 { + reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_1_rst>; + status = "okay"; +}; + +&pcie30phy { + status = "okay"; +}; + +&pcie3x4 { + reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie30>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie3_rst>; + status = "okay"; +}; + +&pinctrl { + sdmmc { + sdmmc_pwr: sdmmc-pwr { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + pcie2 { + pcie2_0_rst: pcie2-0-rst { + rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie2_1_rst: pcie2-1-rst { + rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie3 { + pcie3_rst: pcie3-rst { + rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie3_vcc3v3_en: pcie3-vcc3v3-en { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm8 { + pinctrl-names = "active"; + pinctrl-0 = <&pwm8m2_pins>; + status = "okay"; +}; + +&pwm14 { + pinctrl-0 = <&pwm14m2_pins>; + status = "okay"; +}; + +&pwm15 { + pinctrl-0 = <&pwm15m3_pins>; + status = "disabled"; +}; + +&spi4 { + pinctrl-names = "default"; + pinctrl-0 = <&spi4m2_cs0 &spi4m2_pins>; + num-cs = <1>; + status = "okay"; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8_s0>; +}; + +&sdhci { + bus-width = <8>; + no-sdio; + no-sd; + non-removable; + max-frequency = <200000000>; + // hs400 causes immediate trouble, hs200 works at around 150mb/s + // mmc-hs400-1_8v; + // mmc-hs400-enhanced-strobe; + mmc-hs200-1_8v; + status = "okay"; +}; + +&sdmmc { + max-frequency = <150000000>; + no-sdio; + no-mmc; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s3>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +&spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + pinctrl-names = "default"; + pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; + num-cs = <1>; + + pmic@0 { + compatible = "rockchip,rk806"; + spi-max-frequency = <1000000>; + reg = <0x0>; + + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc5v0_sys>; + vcc6-supply = <&vcc5v0_sys>; + vcc7-supply = <&vcc5v0_sys>; + vcc8-supply = <&vcc5v0_sys>; + vcc9-supply = <&vcc5v0_sys>; + vcc10-supply = <&vcc5v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc5v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc5v0_sys>; + + gpio-controller; + #gpio-cells = <2>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_gpu_s0"; + regulator-enable-ramp-delay = <400>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_cpu_lit_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log_s0: dcdc-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <750000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_log_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_vdenc_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vdd2_ddr_s3: dcdc-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vdd2_ddr_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_2v0_pldo_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_3v3_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vddq_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "avcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "avdd_1v2_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vcc_3v3_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vccio_sd_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + pldo6_s3: pldo-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "pldo6_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_ddr_pll_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "avdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_0v85_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&tsadc { + status = "okay"; +}; + +&uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-nanopc-cm3588-nas.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-nanopc-cm3588-nas.dts new file mode 100644 index 000000000000..f95c8a708aba --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588-nanopc-cm3588-nas.dts @@ -0,0 +1,1436 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2021 Rockchip Electronics Co., Ltd. + * Copyright (c) 2023 FriendlyElec Computer Tech. Co., Ltd. + * Copyright (c) 2023 Thomas McKahan + * Author: ColorfulRhino + * + */ + +/dts-v1/; + +#include +#include +#include +#include +#include +#include "rk3588.dtsi" + +/ { + model = "FriendlyElec CM3588 NAS"; + compatible = "friendlyarm,cm3588", "rockchip,rk3588"; + + aliases { + mmc0 = &sdhci; + mmc1 = &sdmmc; + // nvme0 = &nvme0; + // nvme1 = &nvme1; + // nvme2 = &nvme2; + // nvme3 = &nvme3; + // ethernet0 = &r8125_u10; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + adc_keys: adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + button-vol-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <17000>; + }; + }; + + analog-sound { + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&headphone_detect>; + + simple-audio-card,name = "realtek,rt5616-codec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,hp-det-gpio = <&gpio1 RK_PC4 GPIO_ACTIVE_LOW>; + + simple-audio-card,routing = + "Headphones", "HPOL", + "Headphones", "HPOR", + "MIC1", "Microphone Jack", + "Microphone Jack", "micbias1"; + simple-audio-card,widgets = + "Headphone", "Headphones", + "Microphone", "Microphone Jack"; + + simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rt5616>; + }; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + cooling-levels = <0 50 100 150 200 255>; + pwms = <&pwm1 0 50000 0>; + status = "disabled"; + }; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&key1_pin>; + + button-user { + debounce-interval = <50>; + gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_LOW>; + label = "User Button"; + linux,code = ; + wakeup-source; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_sys: led-0 { + gpios = <&gpio2 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "system-led"; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_sys_pin>; + }; + + led_usr: led-1 { + gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>; + label = "user-led"; + pinctrl-names = "default"; + pinctrl-0 = <&led_usr_pin>; + }; + }; + + vcc_12v_dcin: vcc-12v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + /* vcc_5v0_sys powers peripherals */ + vcc_5v0_sys: vcc-5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_12v_dcin>; + }; + + vcc_5v0_host_20: vcc-5v0-host-20 { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_5v0_host20_en>; + regulator-name = "vcc_5v0_host_20"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v0_sys>; + }; + + vcc_5v0_host_30: vcc-5v0-host-30 { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_5v0_host30_en>; + regulator-name = "vcc_5v0_host_30"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v0_sys>; + }; + + vcc_3v3_host_32: vcc-3v3-host-32-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_3v3_host32_en>; + regulator-name = "vcc_3v3_host_32"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_5v0_sys>; + }; + + vbus_5v0_typec: vbus-5v0-typec-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec_5v_pwr_en>; + regulator-name = "vbus_5v0_typec"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_5v0_sys>; + }; + + /* vcc_4v0_sys powers the RK806, RK860's */ + vcc_4v0_sys: vcc-4v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_4v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <4000000>; + vin-supply = <&vcc_12v_dcin>; + }; + + vcc_3v3_pcie20: vcc-3v3-pcie20-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3_pcie20"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc_3v3_pcie30: vcc-3v3-pcie30-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3_pcie30"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_5v0_sys>; + }; + + vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sd_s0_pwr>; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_3v3_sd_s0"; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc-1v1-nldo-s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + vin-supply = <&vcc_4v0_sys>; + }; +}; + +&combphy0_ps { + status = "okay"; +}; + +&combphy1_ps { + status = "okay"; +}; + +&combphy2_psu { + status = "okay"; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +/* Properties "clock" and "clock-names" introduced by Collabora https://gitlab.collabora.com/hardware-enablement/rockchip-3588/linux/-/commit/8fff68cb7cfe1e698445896252e34f79fad41720 */ +&display_subsystem { + clocks = <&hdptxphy_hdmi0>; + clock-names = "hdmi0_phy_pll"; +}; + +/* Signal labels [SIGNAL_LABEL] are from the official CM3588 NAS schematic revision 2309 */ +/* Some GPIOs like USB, sdmmc or SPI-NOR are not listed here */ +&gpio0 { + gpio-line-names = + /* GPIO0 A0-A7 */ + "", "", "", "", + "", "", "", "", + /* GPIO0 B0-B7 */ + "", "", "", "", + "", "", "", "", + /* GPIO0 C0-C7 */ + "", "", "", "", + "Pin 10 [UART0_RX_M0]", "Pin 08 [UART0_TX_M0/PWM4_M0]", "Pin 32 [PWM5_M1]", "", + /* GPIO0 D0-D7 */ + "", "", "", "", + "IR sensor [PWM3_IR_M0]", "User Button", "", ""; +}; + +&gpio1 { + gpio-line-names = + /* GPIO1 A0-A7 */ + "Pin 27 [UART6_RX_M1]", "Pin 28 [UART6_TX_M1]", "", "", + "", "", "", "Pin 15", + /* GPIO1 B0-B7 */ + "Pin 26", "Pin 21 [SPI0_MISO_M2]", "Pin 19 [SPI0_MOSI_M2/UART4_RX_M2]", "Pin 23 [SPI0_CLK_M2/UART4_TX_M2]", + "Pin 24 [SPI0_CS0_M2/UART7_RX_M2]", "Pin 22 [SPI0_CS1_M0/UART7_TX_M2]", "", "CSI-Pin 14 [MIPI_CAM2_CLKOUT]", + /* GPIO1 C0-C7 */ + "", "", "", "", + "Headphone detect [HP_DET_L]", "", "", "", + /* GPIO1 D0-D7 */ + "", "", "", "Fan [PWM1_M1]", + "", "", "Pin 05 [I2C8_SCL_M2]", "Pin 03 [I2C8_SDA_M2]"; +}; + +&gpio2 { + gpio-line-names = + /* GPIO2 A0-A7 */ + "", "", "", "", + "", "", "", "", + /* GPIO2 B0-B7 */ + "", "", "", "", + "", "", "", "", + /* GPIO2 C0-C7 */ + "", "CSI-Pin 11 [MIPI_CAM2_RESET_L]", "CSI-Pin 12 [MIPI_CAM2_PDN_L]", "", + "", "", "", "", + /* GPIO2 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&gpio3 { + gpio-line-names = + /* GPIO3 A0-A7 */ + "Pin 35 [SPI4_MISO_M1/PW M10_M0]", "Pin 38 [SPI4_MOSI_M1]", "Pin 40 [SPI4_CLK_M1/UART8_TX_M1]", "Pin 36 [SPI4_CS0_M1/UART8_RX_M1]", + "Pin 37 [SPI4_CS1_M1]", "", "DSI-Pin 12 [LCD_RST]", "Buzzer [PW M8_M0]", + /* GPIO3 B0-B7 */ + "Pin 33 [PW M9_M0]", "DSI-Pin 10 [PW M2_M1/LCD_BL]", "Pin 07", "Pin 16", + "Pin 18", "Pin 29 [UART3_TX_M1/PW M12_M0]", "Pin 31 [UART3_RX_M1/PW M13_M0]", "Pin 12", + /* GPIO3 C0-C7 */ + "DSI-Pin 08 [TP_INT_L]", "DSI-Pin 14 [TP_RST_L]", "Pin 11 [PWM14_M0]", "Pin 13 [PWM15_IR_M0]", + "", "", "", "DSI-Pin 06 [I2C5_SCL_M0_TP]", + /* GPIO3 D0-D7 */ + "DSI-Pin 05 [I2C5_SDA_M0_TP]", "", "", "", + "", "", "", ""; +}; + +&gpio4 { + gpio-line-names = + /* GPIO4 A0-A7 */ + "", "", "", "", + "", "", "", "", + /* GPIO4 B0-B7 */ + "", "", "", "", + "", "", "", "", + /* GPIO4 C0-C7 */ + "", "", "", "", + "", "", "", "", + /* GPIO4 D0-D7 */ + "", "", "", "", + "", "", "", ""; +}; + +&gpu { + mali-supply = <&vdd_gpu_s0>; + sram-supply = <&vdd_gpu_mem_s0>; + status = "okay"; +}; + +&hdmi0 { + // avdd-0v9-supply = + // avdd-1v8-supply = + /* Dmesg error/warning: + * [ +0.000055] dwhdmi-rockchip fde80000.hdmi: Looking up avdd-0v9-supply from device tree + * [ +0.000011] dwhdmi-rockchip fde80000.hdmi: Looking up avdd-0v9-supply property in node /hdmi@fde80000 failed + * [ +0.000014] dwhdmi-rockchip fde80000.hdmi: supply avdd-0v9 not found, using dummy regulator + * [ +0.000080] dwhdmi-rockchip fde80000.hdmi: Looking up avdd-1v8-supply from device tree + * [ +0.000010] dwhdmi-rockchip fde80000.hdmi: Looking up avdd-1v8-supply property in node /hdmi@fde80000 failed + * [ +0.000010] dwhdmi-rockchip fde80000.hdmi: supply avdd-1v8 not found, using dummy regulator + * [ +0.001009] dwhdmi-rockchip fde80000.hdmi: registered ddc I2C bus driver + */ + status = "okay"; +}; + +&hdmi0_in { + hdmi0_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi0>; + }; +}; + +&hdptxphy_hdmi0 { + status = "okay"; +}; + +// /* 4k HDMI capture controller (see rk3588.dtsi) */ +// &hdmirx_cma { +// status = "okay"; +// }; + +// &hdmirx_ctrler { +// status = "okay"; +// hdmirx-5v-detection-gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>; +// pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_5v_detection>; +// pinctrl-names = "default"; +// memory-region = <&hdmirx_cma>; +// }; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; + status = "okay"; + + vdd_cpu_big0_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc_4v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc_4v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c2 { + status = "okay"; + + vdd_npu_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_npu_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc_4v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c4 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c4m3_xfer>; + status = "disabled"; +}; + +/* Connected to MIPI-DSI0 */ +&i2c5 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c5m0_xfer>; + status = "disabled"; +}; + +&i2c6 { + clock-frequency = <200000>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c6m0_xfer>; + status = "okay"; + + fusb302: typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&usbc0_int>; + pinctrl-names = "default"; + vbus-supply = <&vbus_5v0_typec>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_role_sw: endpoint@0 { + remote-endpoint = <&dwc3_0_role_switch>; + }; + }; + }; + + usb_con: connector { + compatible = "usb-c-connector"; + data-role = "dual"; + label = "USB-C"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + source-pdos = ; + sink-pdos = ; + try-power-role = "sink"; + + altmodes { + #address-cells = <1>; + #size-cells = <0>; + + altmode@0 { + reg = <0>; + svid = <0xff01>; + vdo = <0xffffffff>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_orien_sw: endpoint { + remote-endpoint = <&usbdp_phy0_orientation_switch>; + }; + }; + + port@1 { + reg = <1>; + dp_altmode_mux: endpoint { + remote-endpoint = <&usbdp_phy0_dp_altmode_mux>; + }; + }; + }; + }; + }; + + hym8563: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-output-names = "hym8563"; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&hym8563_int>; + wakeup-source; + }; +}; + +/* Connected to MIPI-CSI1 */ +&i2c7 { + clock-frequency = <200000>; + status = "okay"; + + rt5616: audio-codec@1b { + compatible = "realtek,rt5616"; + reg = <0x1b>; + assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; + assigned-clock-rates = <12288000>; + clocks = <&cru I2S0_8CH_MCLKOUT>; + clock-names = "mclk"; + #sound-dai-cells = <0>; + + port { + rt5616_p0_0: endpoint { + remote-endpoint = <&i2s0_8ch_p0_0>; + }; + }; + }; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&i2c8 { + pinctrl-0 = <&i2c8m2_xfer>; +}; + +&i2s0_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s0_lrck + &i2s0_mclk + &i2s0_sclk + &i2s0_sdi0 + &i2s0_sdo0>; + status = "okay"; + + i2s0_8ch_p0: port { + i2s0_8ch_p0_0: endpoint { + dai-format = "i2s"; + mclk-fs = <256>; + remote-endpoint = <&rt5616_p0_0>; + }; + }; +}; + +&i2s5_8ch { + status = "okay"; +}; + +&i2s6_8ch { + status = "okay"; +}; + +&i2s7_8ch { + status = "okay"; +}; + +/* Temperature sensor near the center of the SoC */ +&package_thermal { + polling-delay = <1000>; + + trips { + package_hot: package_hot { + hysteresis = <2000>; + temperature = <65000>; + type = "active"; + }; + }; + + cooling-maps { + map0 { + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + trip = <&package_hot>; + }; + }; +}; + +&pcie2x1l0 { // @fe170000 + /* 2. M.2 slot, CON14: pcie30phy port0 lane1 */ + max-link-speed = <3>; + num-lanes = <1>; + phys = <&pcie30phy>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_0_rst>; + reset-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie30>; + status = "okay"; + + // pcie@0,0 { + // reg = <0x00200000 0 0 0 0>; + // #address-cells = <3>; + // #size-cells = <2>; + + // nvme1: pcie@20,0 { + // reg = <0x000000 0 0 0 0>; + // }; + // }; +}; + +&pcie2x1l1 { // @fe180000 + /* 4. M.2 slot, CON16: pcie30phy port1 lane1 */ + max-link-speed = <3>; + num-lanes = <1>; + phys = <&pcie30phy>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_1_rst>; + reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie30>; + status = "okay"; + + // pcie@0,0 { + // reg = <0x00300000 0 0 0 0>; + // #address-cells = <3>; + // #size-cells = <2>; + + // nvme3: pcie@30,0 { + // reg = <0x000000 0 0 0 0>; + // }; + // }; +}; + +&pcie2x1l2 { // @fe190000 + /* r8125 ethernet */ + pinctrl-names = "default"; + pinctrl-0 = <&pcie2_2_rst>; + reset-gpios = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie20>; + status = "okay"; + + // pcie@0,0 { + // reg = <0x00400000 0 0 0 0>; + // #address-cells = <3>; + // #size-cells = <2>; + + // r8125_u10: pcie@40,0 { + // reg = <0x000000 0 0 0 0>; + // local-mac-address = [ 00 00 00 00 00 00 ]; + // }; + // }; +}; + +&pcie30phy { + /* + * Michal Tomek describes: + * The PHY offers the following mapping options: + * + * port 0 lane 0 - always mapped to controller 0 (4L) + * port 0 lane 1 - to controller 0 or 2 (1L0) + * port 1 lane 0 - to controller 0 or 1 (2L) + * port 1 lane 1 - to controller 0, 1 or 3 (1L1) + * + * The data-lanes DT property maps these as follows: + * + * 0 = no controller (unsupported by the HW) + * 1 = 4L + * 2 = 2L + * 3 = 1L0 + * 4 = 1L1 + * + * <1 3 2 4> = NABIBI = [3 3] = x1x1 x1x1 (bif. of both ports; + */ + data-lanes = <1 3 2 4>; + status = "okay"; +}; + +&pcie3x4 { // @fe150000 + /* 1. M.2 slot, CON13: pcie30phy port0 lane0 */ + max-link-speed = <3>; + num-lanes = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie3x4_rst>; + reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie30>; + status = "okay"; + + // pcie@0,0 { + // reg = <0x00000000 0 0 0 0>; + // #address-cells = <3>; + // #size-cells = <2>; + + // nvme0: pcie@0,0 { + // reg = <0x000000 0 0 0 0>; + // }; + // }; +}; + +&pcie3x2 { // @fe160000 + /* 3. M.2 slot, CON15: pcie30phy port1 lane0 */ + max-link-speed = <3>; + num-lanes = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie3x2_rst>; + reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie30>; + status = "okay"; + + // pcie@0,0 { + // reg = <0x00100000 0 0 0 0>; + // #address-cells = <3>; + // #size-cells = <2>; + + // nvme2: pcie@10,0 { + // reg = <0x000000 0 0 0 0>; + // }; + // }; +}; + +&pinctrl { + audio { + headphone_detect: headphone-detect { + rockchip,pins = <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gpio-key { + key1_pin: key1-pin { + rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + led_sys_pin: led-sys-pin { + rockchip,pins = <2 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_usr_pin: led-usr-pin { + rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hym8563 { + hym8563_int: hym8563-int { + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + pcie { + pcie2_0_rst: pcie2-0-rst { + rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie2_1_rst: pcie2-1-rst { + rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie2_2_rst: pcie2-2-rst { + rockchip,pins = <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie3x2_rst: pcie3x2-rst { + rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie3x4_rst: pcie3x4-rst { + rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdmmc { + sd_s0_pwr: sd-s0-pwr { + rockchip,pins = <4 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc_5v0_host20_en: vcc-5v0-host20-en { + rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc_5v0_host30_en: vcc-5v0-host30-en { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc_3v3_host32_en: vcc-3v3-host32-en { + rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec_5v_pwr_en: typec-5v-pwr-en { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +/* Connected to 5V Fan */ +&pwm1 { + pinctrl-0 = <&pwm1m1_pins>; + status = "okay"; +}; + +/* Connected to MIPI-DSI0 */ +&pwm2 { + pinctrl-0 = <&pwm2m1_pins>; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&pwm5 { + pinctrl-0 = <&pwm5m1_pins>; + status = "okay"; +}; + +/* GPIO Connector */ +&pwm8 { + pinctrl-0 = <&pwm8m0_pins>; + status = "okay"; +}; + +/* GPIO Connector */ +&pwm9 { + pinctrl-0 = <&pwm9m0_pins>; + status = "okay"; +}; + +&saradc { + vref-supply = <&avcc_1v8_s0>; + status = "okay"; +}; + +/* eMMC */ +&sdhci { + bus-width = <8>; + full-pwr-cycle-in-suspend; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + no-sd; + no-sdio; + non-removable; + status = "okay"; +}; + +/* microSD card */ +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + no-mmc; + no-sdio; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_sd_s0>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +/* GPIO Connector */ +&spi0 { + num-cs = <1>; + pinctrl-0 = <&spi0m2_cs0 &spi0m2_pins>; + status = "disabled"; +}; + +&spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + pinctrl-names = "default"; + pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; + num-cs = <1>; + + rk806_single: pmic@0 { + compatible = "rockchip,rk806"; + reg = <0x0>; + + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + + spi-max-frequency = <1000000>; + + system-power-controller; + + vcc1-supply = <&vcc_4v0_sys>; + vcc2-supply = <&vcc_4v0_sys>; + vcc3-supply = <&vcc_4v0_sys>; + vcc4-supply = <&vcc_4v0_sys>; + vcc5-supply = <&vcc_4v0_sys>; + vcc6-supply = <&vcc_4v0_sys>; + vcc7-supply = <&vcc_4v0_sys>; + vcc8-supply = <&vcc_4v0_sys>; + vcc9-supply = <&vcc_4v0_sys>; + vcc10-supply = <&vcc_4v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc_4v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc_4v0_sys>; + + gpio-controller; + #gpio-cells = <2>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_gpu_s0"; + regulator-enable-ramp-delay = <400>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_cpu_lit_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log_s0: dcdc-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <750000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_log_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_vdenc_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vdd2_ddr_s3: dcdc-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vdd2_ddr_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_2v0_pldo_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_3v3_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vddq_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "avcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "avdd_1v2_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vcc_3v3_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vccio_sd_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + pldo6_s3: pldo-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "pldo6_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_ddr_pll_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "avdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_0v85_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&spi4 { + num-cs = <1>; + pinctrl-0 = <&spi4m1_cs0 &spi4m1_pins>; + status = "disabled"; +}; + +&tsadc { + status = "okay"; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&uart0 { + pinctrl-0 = <&uart0m0_xfer>; + status = "disabled"; +}; + +/* Debug UART */ +&uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&uart3 { + pinctrl-0 = <&uart3m1_xfer>; + status = "disabled"; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&uart4 { + pinctrl-0 = <&uart4m2_xfer>; + status = "disabled"; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&uart6 { + pinctrl-0 = <&uart6m1_xfer>; + status = "okay"; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&uart7 { + pinctrl-0 = <&uart7m2_xfer>; + status = "disabled"; +}; + +/* GPIO Connector, connected to 40-pin GPIO header */ +&uart8 { + pinctrl-0 = <&uart8m1_xfer>; + status = "disabled"; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + rockchip,typec-vbus-det; /* @TODO Note: This flag is not (yet?) present in Linux 6.9 "Documentation/devicetree/bindings/phy/rockchip,inno-usb2phy.yaml" */ + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg { + phy-supply = <&vcc_5v0_host_30>; + status = "okay"; +}; + +&u2phy2 { + status = "okay"; +}; + +&u2phy2_host { + phy-supply = <&vcc_5v0_host_20>; + status = "okay"; +}; + +&u2phy3 { + status = "okay"; +}; + +&u2phy3_host { + phy-supply = <&vcc_3v3_host_32>; + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "otg"; + usb-role-switch; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + dwc3_0_role_switch: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_role_sw>; + }; + }; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +/* Upper USB 3.0 port */ +&usb_host1_xhci { + dr_mode = "host"; + snps,xhci-trb-ent-quirk; + status = "okay"; +}; + +/* Lower USB 3.0 port */ +&usb_host2_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usbdp_phy0 { + orientation-switch; + svid = <0xff01>; + sbu1-dc-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + usbdp_phy0_orientation_switch: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_orien_sw>; + }; + + usbdp_phy0_dp_altmode_mux: endpoint@1 { + reg = <1>; + remote-endpoint = <&dp_altmode_mux>; + }; + }; +}; + +&usbdp_phy1 { + status = "okay"; +}; + +&vop { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi0_in_vp0>; + }; +}; + +&wdt { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6c.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6c.dts new file mode 100644 index 000000000000..5c8b850efe75 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6c.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3588s-nanopi-r6s.dts" + +/ { + model = "FriendlyElec NanoPi R6C"; + compatible = "friendlyelec,nanopi-r6c", "rockchip,rk3588s"; +}; + +&lan2_led { + /delete-property/ linux,default-trigger; + label = "user_led"; +}; + +&pcie2x1l2 { + /delete-node/ pcie@0,0; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6s.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6s.dts new file mode 100644 index 000000000000..b39a3fc976b5 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-nanopi-r6s.dts @@ -0,0 +1,865 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include +#include +#include "rk3588s.dtsi" + +/ { + model = "FriendlyElec NanoPi R6S"; + compatible = "friendlyelec,nanopi-r6s", "rockchip,rk3588s"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdhci; + serial2 = &uart2; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + leds { + compatible = "gpio-leds"; + + sys_led: led-0 { + label = "sys_led"; + gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&sys_led_pin>; + }; + + wan_led: led-1 { + label = "wan_led"; + gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "r8169-3-3100:00:link"; + pinctrl-names = "default"; + pinctrl-0 = <&wan_led_pin>; + }; + + lan1_led: led-2 { + label = "lan1_led"; + gpios = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "r8169-4-4100:00:link"; + pinctrl-names = "default"; + pinctrl-0 = <&lan1_led_pin>; + }; + + lan2_led: led-3 { + label = "lan2_led"; + gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "stmmac-0:01:link"; + pinctrl-names = "default"; + pinctrl-0 = <&lan2_led_pin>; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + button-maskrom { + label = "Maskrom"; + linux,code = ; + press-threshold-microvolt = <1800>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&key1_pin>; + + button-user { + label = "User"; + linux,code = ; + gpios = <&gpio1 RK_PC0 GPIO_ACTIVE_LOW>; + debounce-interval = <50>; + wakeup-source; + }; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v1_nldo_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3_sd_s0"; + enable-active-high; + regulator-boot-on; + gpio = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sd_s0_pwr>; + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <3000000>; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc_3v3_pcie20: vcc3v3-pcie20-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3_pcie20"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc5v0_usb: vcc5v0-usb-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_otg0: vcc5v0-usb-otg0-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_otg0"; + enable-active-high; + gpio = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec5v_pwren>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_usb>; + }; + + vcc5v0_host_20: vcc5v0-host-20-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host_20"; + enable-active-high; + gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host20_en>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_usb>; + }; +}; + +&combphy0_ps { + status = "okay"; +}; + +&combphy2_psu { + status = "okay"; +}; + +&gmac1 { + clock_in_out = "output"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii-rxid"; + pinctrl-0 = <&gmac1_miim + &gmac1_tx_bus2 + &gmac1_rx_bus2 + &gmac1_rgmii_clk + &gmac1_rgmii_bus>; + pinctrl-names = "default"; + tx_delay = <0x42>; + status = "okay"; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; + mem-supply = <&vdd_cpu_big0_mem_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; + mem-supply = <&vdd_cpu_big0_mem_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; + mem-supply = <&vdd_cpu_big1_mem_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; + mem-supply = <&vdd_cpu_big1_mem_s0>; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; + mem-supply = <&vdd_cpu_lit_mem_s0>; +}; + +&gpu { + mali-supply = <&vdd_gpu_s0>; + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; + status = "okay"; + + vdd_cpu_big0_s0: vdd_cpu_big0_mem_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: vdd_cpu_big1_mem_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c2 { + status = "okay"; + + vdd_npu_s0: vdd_npu_mem_s0: rk8602@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-compatible = "rk860x-reg"; + regulator-name = "vdd_npu_s0"; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <2300>; + regulator-boot-on; + regulator-always-on; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c6 { + clock-frequency = <200000>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c6m0_xfer>; + status = "okay"; + + hym8563: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-output-names = "hym8563"; + pinctrl-names = "default"; + pinctrl-0 = <&rtc_int>; + interrupt-parent = <&gpio0>; + interrupts = ; + wakeup-source; + }; + + eeprom@53 { + compatible = "microchip,24c02", "atmel,24c02"; + reg = <0x53>; + #address-cells = <2>; + #size-cells = <0>; + pagesize = <16>; + size = <256>; + + eui_48: eui-48@fa { + reg = <0xfa 0x06>; + }; + }; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-id001c.c916"; + reg = <0x1>; + pinctrl-names = "default"; + pinctrl-0 = <&rtl8211f_rst>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + }; +}; + +&pcie2x1l1 { + reset-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie20>; + status = "okay"; + + pcie@0,0 { + reg = <0x00300000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + + r8125_u25: pcie@30,0 { + reg = <0x000000 0 0 0 0>; + local-mac-address = [ 00 00 00 00 00 00 ]; + }; + }; +}; + +&pcie2x1l2 { + reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc_3v3_pcie20>; + status = "okay"; + + pcie@0,0 { + reg = <0x00400000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + + r8125_u40: pcie@40,0 { + reg = <0x000000 0 0 0 0>; + local-mac-address = [ 00 00 00 00 00 00 ]; + }; + }; +}; + +&pinctrl { + gpio-key { + key1_pin: key1-pin { + rockchip,pins = <1 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + sys_led_pin: sys-led-pin { + rockchip,pins = + <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wan_led_pin: wan-led-pin { + rockchip,pins = + <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + lan1_led_pin: lan1-led-pin { + rockchip,pins = + <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + lan2_led_pin: lan2-led-pin { + rockchip,pins = + <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hym8563 { + rtc_int: rtc-int { + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdmmc { + sd_s0_pwr: sd-s0-pwr { + rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + typec5v_pwren: typec5v-pwren { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + /omit-if-no-ref/ + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vcc5v0_host20_en: vcc5v0-host20-en { + rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rtl8211f { + rtl8211f_rst: rtl8211f-rst { + rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&saradc { + vref-supply = <&avcc_1v8_s0>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + no-sdio; + no-sd; + non-removable; + /* HS400 doesn't work properly -> https://github.com/torvalds/linux/commit/cee572756aa2cb46e959e9797ad4b730b78a050b */ + mmc-hs200-1_8v; + max-frequency = <200000000>; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + max-frequency = <150000000>; + no-mmc; + no-sdio; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_sd_s0>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +&spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + pinctrl-names = "default"; + pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; + num-cs = <1>; + + pmic@0 { + compatible = "rockchip,rk806"; + spi-max-frequency = <1000000>; + reg = <0x0>; + + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + + system-power-controller; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc5v0_sys>; + vcc6-supply = <&vcc5v0_sys>; + vcc7-supply = <&vcc5v0_sys>; + vcc8-supply = <&vcc5v0_sys>; + vcc9-supply = <&vcc5v0_sys>; + vcc10-supply = <&vcc5v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc5v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc5v0_sys>; + + gpio-controller; + #gpio-cells = <2>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fudr_moden0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_gpu_s0"; + regulator-enable-ramp-delay = <400>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_cpu_lit_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log_s0: dcdc-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <750000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_log_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-init-microvolt = <750000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_vdenc_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vdd2_ddr_s3: dcdc-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vdd2_ddr_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_2v0_pldo_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_3v3_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vddq_ddr_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "avcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "avdd_1v2_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vcc_3v3_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + regulator-name = "vccio_sd_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + pldo6_s3: pldo-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "pldo6_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s3"; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_ddr_pll_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "avdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_0v85_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s0"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + phy-supply = <&vcc5v0_usb_otg0>; + status = "okay"; +}; + +&u2phy2 { + status = "okay"; +}; + +&u2phy2_host { + phy-supply = <&vcc5v0_host_20>; + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + extcon = <&u2phy0>; + status = "okay"; +}; + +&usbdp_phy0 { + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + + +&hdptxphy_hdmi0 { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&hdmi0_in { + hdmi0_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi0>; + }; +}; + +&vop { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi0_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5.dts new file mode 100644 index 000000000000..ea8c082a58c9 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5.dts @@ -0,0 +1,814 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include +#include +#include +#include +#include "rk3588s.dtsi" + +/ { + model = "Xunlong Orange Pi 5"; + compatible = "xunlong,orangepi-5", "rockchip,rk3588s"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + button-recovery { + label = "Recovery"; + linux,code = ; + press-threshold-microvolt = <1800>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&leds_gpio>; + + led-1 { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + }; + }; + + hdmi0-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi0_con_in: endpoint { + remote-endpoint = <&hdmi0_out_con>; + }; + }; + }; + + vbus_typec: vbus-typec-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&typec5v_pwren>; + regulator-name = "vbus_typec"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator { + compatible = "regulator-fixed"; + enable-active-low; + gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_LOW>; + regulator-name = "vcc_3v3_sd_s0"; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc3v3_pcie20: vcc3v3-pcie20-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + regulator-name = "vcc3v3_pcie20"; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + startup-delay-us = <50000>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&combphy0_ps { + status = "okay"; +}; + +&combphy2_psu { + status = "okay"; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&gmac1 { + clock_in_out = "output"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii-rxid"; + pinctrl-0 = <&gmac1_miim + &gmac1_tx_bus2 + &gmac1_rx_bus2 + &gmac1_rgmii_clk + &gmac1_rgmii_bus>; + pinctrl-names = "default"; + tx_delay = <0x42>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu_s0>; + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; + status = "okay"; + + vdd_cpu_big0_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c2 { + status = "okay"; + + vdd_npu_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_npu_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c6 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c6m3_xfer>; + status = "okay"; + + usbc0: usb-typec@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus_typec>; + status = "okay"; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + ; + source-pdos = + ; + try-power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_hs: endpoint { + remote-endpoint = <&usb_host0_xhci_drd_sw>; + }; + }; + + port@1 { + reg = <1>; + usbc0_ss: endpoint { + remote-endpoint = <&usbdp_phy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + usbc0_sbu: endpoint { + remote-endpoint = <&usbdp_phy0_typec_sbu>; + }; + }; + }; + }; + }; + + hym8563: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-output-names = "hym8563"; + pinctrl-names = "default"; + pinctrl-0 = <&hym8563_int>; + interrupt-parent = <&gpio0>; + interrupts = ; + wakeup-source; + }; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>; + }; +}; + +&pcie2x1l2 { + reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie20>; + status = "okay"; +}; + +&pinctrl { + gpio-func { + leds_gpio: leds-gpio { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hym8563 { + hym8563_int: hym8563-int { + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec5v_pwren: typec5v-pwren { + rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&saradc { + vref-supply = <&avcc_1v8_s0>; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + max-frequency = <150000000>; + no-mmc; + no-sdio; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_sd_s0>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +&sfc { + pinctrl-names = "default"; + pinctrl-0 = <&fspim0_pins>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x0>; + spi-max-frequency = <100000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + num-cs = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; + + pmic@0 { + compatible = "rockchip,rk806"; + reg = <0x0>; + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + spi-max-frequency = <1000000>; + system-power-controller; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc5v0_sys>; + vcc6-supply = <&vcc5v0_sys>; + vcc7-supply = <&vcc5v0_sys>; + vcc8-supply = <&vcc5v0_sys>; + vcc9-supply = <&vcc5v0_sys>; + vcc10-supply = <&vcc5v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc5v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc5v0_sys>; + + gpio-controller; + #gpio-cells = <2>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: dcdc-reg1 { + regulator-name = "vdd_gpu_s0"; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-enable-ramp-delay = <400>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: dcdc-reg2 { + regulator-name = "vdd_cpu_lit_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log_s0: dcdc-reg3 { + regulator-name = "vdd_log_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <750000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: dcdc-reg4 { + regulator-name = "vdd_vdenc_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-name = "vdd_ddr_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vcc_1v1_nldo_s3: vdd2_ddr_s3: dcdc-reg6 { + regulator-name = "vdd2_ddr_s3"; + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1100000>; + regulator-min-microvolt = <1100000>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-name = "vdd_2v0_pldo_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-name = "vcc_3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-name = "vddq_ddr_s0"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-name = "vcc_1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-name = "avcc_1v8_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-name = "vcc_1v8_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-name = "avdd_1v2_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-name = "vcc_3v3_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-name = "vccio_sd_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + pldo6_s3: pldo-reg6 { + regulator-name = "pldo6_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-name = "vdd_0v75_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-name = "vdd_ddr_pll_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-name = "avdd_0v75_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-name = "vdd_0v85_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-name = "vdd_0v75_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; +}; + +&u2phy2 { + status = "okay"; +}; + +&u2phy2_host { + status = "okay"; +}; + +&u2phy3 { + status = "okay"; +}; + +&u2phy3_host { + status = "okay"; +}; + +&uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&usbdp_phy0 { + mode-switch; + orientation-switch; + sbu1-dc-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usbdp_phy0_typec_ss: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_ss>; + }; + + usbdp_phy0_typec_sbu: endpoint@1 { + reg = <1>; + remote-endpoint = <&usbc0_sbu>; + }; + }; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + usb-role-switch; + status = "okay"; + + port { + usb_host0_xhci_drd_sw: endpoint { + remote-endpoint = <&usbc0_hs>; + }; + }; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host2_xhci { + status = "okay"; +}; + +&hdptxphy_hdmi0 { + status = "okay"; +}; + +&hdmi0 { + enable-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&hdmi0_in { + hdmi0_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi0>; + }; +}; + +&hdmi0_out { + hdmi0_out_con: endpoint { + remote-endpoint = <&hdmi0_con_in>; + }; +}; + +&vop { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi0_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5b.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5b.dts new file mode 100644 index 000000000000..3194df7a5fc8 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-orangepi-5b.dts @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3588s-orangepi-5.dts" + +/ { + model = "Xunlong Orange Pi 5B"; + compatible = "xunlong,orangepi-5b", "rockchip,rk3588s"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdhci; + }; +}; + +&sdhci { + bus-width = <8>; + no-sdio; + no-sd; + non-removable; + /* HS400 doesn't work properly -> https://github.com/torvalds/linux/commit/cee572756aa2cb46e959e9797ad4b730b78a050b */ + mmc-hs200-1_8v; + max-frequency = <200000000>; + status = "okay"; +}; + +&sfc { + status = "disabled"; +}; + +&pcie2x1l2 { + pcie@0,0 { + reg = <0x400000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + device_type = "pci"; + bus-range = <0x40 0x4f>; + + wifi: wifi@0,0 { + compatible = "pci14e4,449d"; + reg = <0x410000 0 0 0 0>; + clocks = <&hym8563>; + clock-names = "32k"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-rock-5c.dts b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-rock-5c.dts new file mode 100644 index 000000000000..0666da126cf0 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/dt/rk3588s-rock-5c.dts @@ -0,0 +1,825 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include +#include +#include "rk3588s.dtsi" + +/ { + model = "Radxa ROCK 5 Model C"; + compatible = "radxa,rock-5c", "rockchip,rk3588s"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc; + }; + + analog-sound { + compatible = "audio-graph-card"; + label = "rk3588-es8316"; + + widgets = "Microphone", "Mic Jack", + "Headphone", "Headphones"; + + routing = "MIC2", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR"; + + dais = <&i2s0_8ch_p0>; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + + user-led { + gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>; + }; + + io-led { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 95 145 195 255>; + fan-supply = <&vcc_5v0>; + pwms = <&pwm3 0 50000 0>; + #cooling-cells = <2>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v1_nldo_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc3v3_pcie: vcc3v3-pcie { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + startup-delay-us = <5000>; + enable-active-high; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_5v0: vcc-5v0 { + compatible = "regulator-fixed"; + regulator-name = "vcc_5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + enable-active-high; + gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_5v0_en>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_otg: vcc5v0-otg-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_otg_en>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&combphy0_ps { + status = "okay"; +}; + +&combphy2_psu { + status = "okay"; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0m2_xfer>; + status = "okay"; + + vdd_cpu_big0_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <1050000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c2 { + status = "okay"; + + vdd_npu_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_npu_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + eeprom: eeprom@50 { + compatible = "belling,bl24c16a", "atmel,24c16"; + reg = <0x50>; + pagesize = <16>; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c5 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c5m2_xfer>; +}; + +&i2c7 { + status = "okay"; + + es8316: audio-codec@11 { + compatible = "everest,es8316"; + reg = <0x11>; + clocks = <&cru I2S0_8CH_MCLKOUT>; + clock-names = "mclk"; + assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; + assigned-clock-rates = <12288000>; + #sound-dai-cells = <0>; + + port { + es8316_p0_0: endpoint { + remote-endpoint = <&i2s0_8ch_p0_0>; + }; + }; + }; +}; + +&i2s0_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s0_lrck + &i2s0_mclk + &i2s0_sclk + &i2s0_sdi0 + &i2s0_sdo0>; + status = "okay"; + + i2s0_8ch_p0: port { + i2s0_8ch_p0_0: endpoint { + dai-format = "i2s"; + mclk-fs = <256>; + remote-endpoint = <&es8316_p0_0>; + }; + }; +}; + +&gmac1 { + clock_in_out = "output"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii"; + pinctrl-0 = <&gmac1_miim + &gmac1_tx_bus2 + &gmac1_rx_bus2 + &gmac1_rgmii_clk + &gmac1_rgmii_bus>; + pinctrl-names = "default"; + tx_delay = <0x3a>; + rx_delay = <0x3e>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu_s0>; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + /* RTL8211F */ + compatible = "ethernet-phy-id001c.c916"; + reg = <0x1>; + pinctrl-names = "default"; + pinctrl-0 = <&rtl8211f_rst>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + }; +}; + +&pcie2x1l2 { + status = "okay"; + reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; +}; + +&pinctrl { + power { + vcc_5v0_en: vcc-5v0-en { + rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rtl8211f { + rtl8211f_rst: rtl8211f-rst { + rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_otg_en: vcc5v0-otg-en { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifibt { + wifibt_en: wifibit-en { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + host_wake_wl: host-wake-wl { + rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_output_high>; + }; + + wl_wake_host: wl-wake-host { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + host_wake_bt: host-wake-bt { + rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_output_high>; + }; + + bt_wake_host: bt-wake-host { + rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm3 { + pinctrl-names = "default"; + pinctrl-0 = <&pwm3m1_pins>; + status = "okay"; +}; + +&saradc { + vref-supply = <&avcc_1v8_s0>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + no-sdio; + no-sd; + non-removable; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + no-sdio; + no-mmc; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_s0>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +&spi2 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + num-cs = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; + + pmic@0 { + compatible = "rockchip,rk806"; + reg = <0x0>; + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + spi-max-frequency = <1000000>; + + system-power-controller; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc5v0_sys>; + vcc6-supply = <&vcc5v0_sys>; + vcc7-supply = <&vcc5v0_sys>; + vcc8-supply = <&vcc5v0_sys>; + vcc9-supply = <&vcc5v0_sys>; + vcc10-supply = <&vcc5v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc5v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc5v0_sys>; + + gpio-controller; + #gpio-cells = <2>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { + regulator-name = "vdd_gpu_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + regulator-enable-ramp-delay = <400>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { + regulator-name = "vdd_cpu_lit_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log_s0: dcdc-reg3 { + regulator-name = "vdd_log_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <750000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { + regulator-name = "vdd_vdenc_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <550000>; + regulator-max-microvolt = <950000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-name = "vdd_ddr_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vdd2_ddr_s3: dcdc-reg6 { + regulator-name = "vdd2_ddr_s3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-name = "vdd_2v0_pldo_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-name = "vcc_3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-name = "vddq_ddr_s0"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-name = "vcc_1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-name = "avcc_1v8_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-name = "vcc_1v8_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-name = "avdd_1v2_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-name = "vcc_3v3_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-name = "vccio_sd_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + pldo6_s3: pldo-reg6 { + regulator-name = "pldo6_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-name = "vdd_0v75_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-name = "vdd_ddr_pll_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-name = "avdd_0v75_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-name = "vdd_0v85_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-name = "vdd_0v75_s0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; + vbus-supply = <&vcc5v0_otg>; +}; + +&u2phy2 { + status = "okay"; +}; + +&u2phy2_host { + status = "okay"; + phy-supply = <&vcc5v0_host>; +}; + +&u2phy3 { + status = "okay"; +}; + +&u2phy3_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&usbdp_phy0 { + status = "okay"; + rockchip,dp-lane-mux = <2 3>; +}; + +&usb_host0_ehci { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&wifibt_en &host_wake_wl &wl_wake_host &host_wake_bt &bt_wake_host>; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host2_xhci { + status = "okay"; +}; + +&hdmi0 { + status = "okay"; +}; + +&hdptxphy_hdmi0 { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&hdmi0_in { + hdmi0_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi0>; + }; +}; + +&vop { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi0_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/Makefile b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/Makefile new file mode 100644 index 000000000000..51ee0419354c --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/Makefile @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ + rockchip-rk3588-sata1.dtbo \ + rockchip-rk3588-sata2.dtbo \ + rockchip-rk3588-hdmirx.dtbo \ + rockchip-rk3588-i2c8-m2.dtbo \ + rockchip-rk3588-pwm0-m0.dtbo \ + rockchip-rk3588-pwm0-m1.dtbo \ + rockchip-rk3588-pwm0-m2.dtbo \ + rockchip-rk3588-pwm1-m0.dtbo \ + rockchip-rk3588-pwm1-m1.dtbo \ + rockchip-rk3588-pwm1-m2.dtbo \ + rockchip-rk3588-pwm2-m1.dtbo \ + rockchip-rk3588-pwm3-m0.dtbo \ + rockchip-rk3588-pwm3-m1.dtbo \ + rockchip-rk3588-pwm3-m2.dtbo \ + rockchip-rk3588-pwm3-m3.dtbo \ + rockchip-rk3588-pwm5-m2.dtbo \ + rockchip-rk3588-pwm6-m0.dtbo \ + rockchip-rk3588-pwm6-m2.dtbo \ + rockchip-rk3588-pwm7-m0.dtbo \ + rockchip-rk3588-pwm7-m3.dtbo \ + rockchip-rk3588-pwm8-m0.dtbo \ + rockchip-rk3588-pwm10-m0.dtbo \ + rockchip-rk3588-pwm11-m0.dtbo \ + rockchip-rk3588-pwm11-m1.dtbo \ + rockchip-rk3588-pwm12-m0.dtbo \ + rockchip-rk3588-pwm13-m0.dtbo \ + rockchip-rk3588-pwm13-m2.dtbo \ + rockchip-rk3588-pwm14-m0.dtbo \ + rockchip-rk3588-pwm14-m1.dtbo \ + rockchip-rk3588-pwm14-m2.dtbo \ + rockchip-rk3588-pwm15-m0.dtbo \ + rockchip-rk3588-pwm15-m1.dtbo \ + rockchip-rk3588-pwm15-m2.dtbo \ + rockchip-rk3588-pwm15-m3.dtbo \ + rockchip-rk3588-uart1-m1.dtbo \ + rockchip-rk3588-uart3-m1.dtbo \ + rockchip-rk3588-uart4-m2.dtbo \ + rockchip-rk3588-uart6-m1.dtbo \ + rockchip-rk3588-uart7-m2.dtbo \ + rockchip-rk3588-uart8-m1.dtbo + +dtb-y += $(dtbo-y) + +clean-files := *.dtbo diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-hdmirx.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-hdmirx.dtso new file mode 100644 index 000000000000..b61eff3047be --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-hdmirx.dtso @@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&hdmi_receiver_cma>; + + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&hdmi_receiver>; + + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-i2c8-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-i2c8-m2.dtso new file mode 100644 index 000000000000..24993c880984 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-i2c8-m2.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&i2c8>; + + __overlay__ { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c8m2_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m0.dtso new file mode 100644 index 000000000000..211ddc646f45 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m0.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm0>; + + __overlay__ { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm0m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m1.dtso new file mode 100644 index 000000000000..353162ec79ee --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm0>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm0m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m2.dtso new file mode 100644 index 000000000000..f7c03e93e3b8 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm0-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm0>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm0m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m0.dtso new file mode 100644 index 000000000000..bb19090ad249 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m0.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm1>; + + __overlay__ { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm1m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m1.dtso new file mode 100644 index 000000000000..e935135023ee --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm1>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm1m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m2.dtso new file mode 100644 index 000000000000..155d0bd4138b --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm1-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm1>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm1m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm10-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm10-m0.dtso new file mode 100644 index 000000000000..281071bbbc0f --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm10-m0.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm10>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm10m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m0.dtso new file mode 100644 index 000000000000..1bebcd619d95 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m0.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm11>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm11m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m1.dtso new file mode 100644 index 000000000000..b85076feabad --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm11-m1.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM11-M1"; + compatible = "radxa,rock-5a"; + category = "misc"; + exclusive = "GPIO4_B4"; + description = "Enable PWM11-M1.\nOn Radxa ROCK 5A this is pin 15."; + }; + + fragment@0 { + target = <&pwm11>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm11m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm12-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm12-m0.dtso new file mode 100644 index 000000000000..6dc0c7ed0b58 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm12-m0.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm12>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm12m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m0.dtso new file mode 100644 index 000000000000..38ec499ce586 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m0.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm13>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm13m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m2.dtso new file mode 100644 index 000000000000..0d9b225fff0d --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm13-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm13>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm13m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m0.dtso new file mode 100644 index 000000000000..330406d939ad --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m0.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm14>; + + __overlay__ { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm14m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m1.dtso new file mode 100644 index 000000000000..82fec22ebbd1 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m1.dtso @@ -0,0 +1,14 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm14>; + + __overlay__ { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm14m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m2.dtso new file mode 100644 index 000000000000..7a26f2dc891a --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm14-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm14>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm14m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m0.dtso new file mode 100644 index 000000000000..076bef9f64d9 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m0.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM15-M0"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO3_C3"; + description = "Enable PWM15-M0.\nOn Radxa ROCK 5B this is pin 7."; + }; + + fragment@0 { + target = <&pwm15>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm15m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m1.dtso new file mode 100644 index 000000000000..7d3de70b05cf --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm15>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm15m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m2.dtso new file mode 100644 index 000000000000..c1b2aea10acb --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm15>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm15m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m3.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m3.dtso new file mode 100644 index 000000000000..79e421a4958f --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm15-m3.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM15-M3"; + compatible = "radxa,rock-5a", "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO1_D7"; + description = "Enable PWM15-M3.\nOn Radxa ROCK 5A this is pin 3.\nOn Radxa ROCK 5B this is pin 29."; + }; + + fragment@0 { + target = <&pwm15>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm15m3_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm2-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm2-m1.dtso new file mode 100644 index 000000000000..653583fdb7e4 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm2-m1.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM2-M1"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO3_B1"; + description = "Enable PWM2-M1.\nOn Radxa ROCK 5B this is pin 36."; + }; + + fragment@0 { + target = <&pwm2>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm2m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m0.dtso new file mode 100644 index 000000000000..a6a9181ab596 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m0.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm3>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm3m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m1.dtso new file mode 100644 index 000000000000..23ff1ad68993 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m1.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM3-M1"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO3_B2"; + description = "Enable PWM3-M1.\nOn Radxa ROCK 5B this is pin 38."; + }; + + fragment@0 { + target = <&pwm3>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm3m1_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m2.dtso new file mode 100644 index 000000000000..b70d2097ea32 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm3>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm3m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m3.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m3.dtso new file mode 100644 index 000000000000..db544f2502fd --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm3-m3.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pwm3>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm3m3_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm5-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm5-m2.dtso new file mode 100644 index 000000000000..ce26d29f33cf --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm5-m2.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM5-M2"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO4_C4"; + description = "Enable PWM5-M2.\nOn Radxa ROCK 5B this is pin 18."; + }; + + fragment@0 { + target = <&pwm5>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm5m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m0.dtso new file mode 100644 index 000000000000..e4d0ce3f5864 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m0.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM6-M0"; + compatible = "radxa,rock-5a"; + category = "misc"; + exclusive = "GPIO0_C7"; + description = "Enable PWM6-M0.\nOn Radxa ROCK 5A this is pin 27."; + }; + + fragment@0 { + target = <&pwm6>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm6m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m2.dtso new file mode 100644 index 000000000000..5e66d1d33ef4 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm6-m2.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM6-M2"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO4_C5"; + description = "Enable PWM6-M2.\nOn Radxa ROCK 5B this is pin 28."; + }; + + fragment@0 { + target = <&pwm6>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm6m2_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m0.dtso new file mode 100644 index 000000000000..6516762486dd --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m0.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM7-M0"; + compatible = "radxa,rock-5a"; + category = "misc"; + exclusive = "GPIO0_D0"; + description = "Enable PWM7-M0.\nOn Radxa ROCK 5A this is pin 28."; + }; + + fragment@0 { + target = <&pwm7>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm7m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m3.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m3.dtso new file mode 100644 index 000000000000..9a7d919f6cd6 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm7-m3.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM7-M3"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO4_C6"; + description = "Enable PWM7-M3.\nOn Radxa ROCK 5B this is pin 27."; + }; + + fragment@0 { + target = <&pwm7>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm7m3_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm8-m0.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm8-m0.dtso new file mode 100644 index 000000000000..e461cffb597a --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-pwm8-m0.dtso @@ -0,0 +1,21 @@ +/dts-v1/; +/plugin/; + +/ { + metadata { + title = "Enable PWM8-M0"; + compatible = "radxa,rock-5b"; + category = "misc"; + exclusive = "GPIO3_A7"; + description = "Enable PWM8-M0.\nOn Radxa ROCK 5B this is pin 33."; + }; + + fragment@0 { + target = <&pwm8>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&pwm8m0_pins>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata1.dtso new file mode 100644 index 000000000000..2759ab9cf7af --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata1.dtso @@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pcie2x1l0>; + + __overlay__ { + status = "disabled"; + }; + }; + + fragment@1 { + target = <&sata1>; + + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata2.dtso new file mode 100644 index 000000000000..c68e11dc1604 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-sata2.dtso @@ -0,0 +1,20 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&pcie2x1l1>; + + __overlay__ { + status = "disabled"; + }; + }; + + fragment@1 { + target = <&sata2>; + + __overlay__ { + status = "okay"; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart1-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart1-m1.dtso new file mode 100644 index 000000000000..909f6058fd69 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart1-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&uart1>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart1m1_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart3-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart3-m1.dtso new file mode 100644 index 000000000000..cc5522c9cd3a --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart3-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&uart3>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart3m1_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart4-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart4-m2.dtso new file mode 100644 index 000000000000..a371018ef585 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart4-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&uart4>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart4m2_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart6-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart6-m1.dtso new file mode 100644 index 000000000000..46cea59e9fee --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart6-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&uart6>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart6m1_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart7-m2.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart7-m2.dtso new file mode 100644 index 000000000000..6a56f61d13de --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart7-m2.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&uart7>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart7m2_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart8-m1.dtso b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart8-m1.dtso new file mode 100644 index 000000000000..e1b3b3a38b27 --- /dev/null +++ b/patch/kernel/archive/rockchip-rk3588-6.11/overlay/rockchip-rk3588-uart8-m1.dtso @@ -0,0 +1,13 @@ +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target = <&uart8>; + + __overlay__ { + status = "okay"; + pinctrl-0 = <&uart8m1_xfer>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml b/patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml new file mode 100644 index 000000000000..61a898c1035a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/0000.patching_config.yaml @@ -0,0 +1,37 @@ +config: # This is file 'patch/kernel/archive/rockchip64-6.8/0000.patching_config.yaml' + + # Just some info stuff; not used by the patching scripts + name: rockchip64-6.10 + kind: kernel + type: mainline # or: vendor + branch: linux-6.10.y + last-known-good-tag: v6.10 + maintainers: + - { github: rpardini, name: Ricardo Pardini, email: ricardo@pardini.net, armbian-forum: rpardini } + - { github: paolosabatino, name: Paolo Sabatino, email: paolo.sabatino@gmail.com, armbian-forum: jock } + + # .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones. + # This is meant to provide a way to "add a board DTS" without having to null-patch them in. + dts-directories: + - { source: "dt", target: "arch/arm64/boot/dts/rockchip" } + + # every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones + # This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in. + # @TODO need a solution to auto-Makefile the overlays as well + overlay-directories: + - { source: "overlay", target: "arch/arm64/boot/dts/rockchip/overlay" } + + # the Makefile in each of these directories will be magically patched to include the dts files copied + # or patched-in; overlay subdir will be included "-y" if it exists. + # No more Makefile patching needed, yay! + auto-patch-dt-makefile: + - { directory: "arch/arm64/boot/dts/rockchip", config-var: "CONFIG_ARCH_ROCKCHIP" } + + # configuration for when applying patches to git / auto-rewriting patches (development cycle helpers) + patches-to-git: + do-not-commit-files: + - "MAINTAINERS" # constant churn, drop them. sorry. + - "Documentation/devicetree/bindings/arm/rockchip.yaml" # constant churn, conflicts on every bump, drop it. sorry. + do-not-commit-regexes: # Python-style regexes + - "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now + diff --git a/patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch b/patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch new file mode 100644 index 000000000000..e4f6ac366906 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/add-board-fine3399-dts.patch @@ -0,0 +1,876 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-fine3399.dts b/arch/arm64/boot/dts/rockchip/rk3399-fine3399.dts +new file mode 100644 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-fine3399.dts +@@ -0,0 +1,871 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/dts-v1/; ++#include ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++ ++ ++/ { ++ model = "Rockchip Fine3399"; ++ compatible = "rockchip,fine3399", "rockchip,rk3399"; ++ ++ aliases { ++ mmc0 = &sdio0; ++ mmc1 = &sdmmc; ++ mmc2 = &sdhci; ++ }; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ dc_12v: dc-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "dc_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ 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>; // bsp ++ }; ++ ++ /* switched by pmic_sleep */ ++ vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_1v8>; ++ }; ++ ++ vcc3v3_sys: vcc3v3_pcie: vcc3v3_bl: vcc3v3-sys { // sch ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&dc_12v>; ++ }; ++ ++ vcc_sys: vcc-sys { // sch ++ 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>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_phy_h>; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ 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>; ++ }; ++ ++ leds: gpio-leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&user_led2>; ++ ++ user_led2 { ++ label = "blue:work_led"; ++ gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; // sch ++ linux,default-trigger = "heartbeat"; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ autorepeat; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&power_key>; ++ ++ power { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp ++ label = "GPIO Key Power"; ++ linux,code = ; ++ wakeup-source; ++ }; ++ }; ++ ++ fan0: pwm-fan { ++ compatible = "pwm-fan"; ++ cooling-levels = <0 30 60 90 120 160>; ++ #cooling-cells = <2>; ++ fan-supply = <&vcc_sys>; ++ pwms = <&pwm1 0 40000 0>; ++ }; ++ ++ // pwm3 ++ ir-receiver { ++ compatible = "gpio-ir-receiver"; ++ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ir_int>; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1750000>; ++ poll-interval = <100>; ++ ++ recovery { ++ label = "Recovery"; ++ linux,code = ; // ?? ++ press-threshold-microvolt = <0>; ++ }; ++ }; ++ ++ backlight: backlight { ++ compatible = "pwm-backlight"; ++ brightness-levels = <0 4 8 16 32 64 128 255>; ++ default-brightness-level = <5>; ++ pwms = <&pwm0 0 1000000 0>; ++ status = "okay"; ++ }; ++ ++}; ++ ++&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>; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ ++&cpu_thermal { ++ trips { ++ cpu_warm: cpu_warm { ++ temperature = <50000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ ++ cpu_hot: cpu_hot { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map2 { ++ trip = <&cpu_warm>; ++ cooling-device = <&fan0 THERMAL_NO_LIMIT 1>; ++ }; ++ ++ map3 { ++ trip = <&cpu_hot>; ++ cooling-device = <&fan0 4 THERMAL_NO_LIMIT>; ++ }; ++ }; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp ++ 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"; ++}; ++ ++&gpu_thermal { ++ trips { ++ gpu_warm: gpu_warm { ++ temperature = <50000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ ++ gpu_hot: gpu_hot { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map1 { ++ trip = <&gpu_warm>; ++ cooling-device = <&fan0 THERMAL_NO_LIMIT 1>; ++ }; ++ ++ map2 { ++ trip = <&gpu_hot>; ++ cooling-device = <&fan0 4 THERMAL_NO_LIMIT>; ++ }; ++ }; ++}; ++ ++&hdmi { ++ ddc-i2c-bus = <&i2c3>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmi_cec>; ++ 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 = ; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l &pmic_dvs2>; ++ 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 = <&vcc1v8_pmu>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v0_tp: LDO_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc3v0_tp"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-name = "vcc1v8_pmu"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-name = "vcca3v0_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-name = "vcca1v8_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: 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>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&cpu_b_sleep>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: regulator@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gpu_sleep>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++// Used for HDMI ++&i2c3 { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++// HDMI sound ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc_3v0>; ++ audio-supply = <&vcca1v8_codec>; ++ sdmmc-supply = <&vcc_sd>; ++ gpio1830-supply = <&vcc_3v0>; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_1v8>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; // sch ++ max-link-speed = <2>; ++ num-lanes = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ pmic { ++ cpu_b_sleep: cpu-b-sleep { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ gpu_sleep: gpu-sleep { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ pmic_dvs2: pmic-dvs2 { ++ rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; // bsp ++ }; ++ }; ++ ++ 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>; ++ }; ++ }; ++ ++ spi2 { ++ spi2_cs0: spi2-cs0 { ++ rockchip,pins = ++ <2 RK_PB4 2 &pcfg_pull_up>; ++ }; ++ }; ++ ++ display_pin:display-pin { ++ DC_pin: dc-pin { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ reset_pin: reset-pin { ++ rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ bt { ++ bt_enable_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_down>; ++ }; ++ ++ bt_wake_l: bt-wake-l { ++ rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ gmac { ++ vcc_phy_h: vcc-phy-h { ++ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ leds { ++ user_led2: user_led2 { ++ rockchip,pins = ++ <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ ir { ++ ir_int: ir-int { ++ rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ buttons { ++ power_key: power_key { ++ rockchip,pins = ++ <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++// TFT ++&pwm0 { ++ status = "okay"; ++}; ++ ++// FAN ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vcca1v8_s3>; ++ 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; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ brcmf: wifi@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ brcm,drive-strength = <5>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake_l>; ++ }; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-sd-highspeed; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // bsp ++ clock-frequency = <150000000>; ++ disable-wp; ++ sd-uhs-sdr104; ++ max-frequency = <150000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ vqmmc-supply = <&vcc_sd>; ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ keep-power-in-suspend; ++ non-removable; ++ status = "okay"; ++}; ++/* ++&spi1 { ++ status = "okay"; ++ ++ norflash: flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <50000000>; ++ }; ++}; ++*/ ++ ++&spi2 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_clk &spi2_tx &spi2_cs0>; ++ ++ st7735r@0 { ++ status = "okay"; ++ compatible = "sitronix,st7735r"; ++ reg = <0>; ++ rgb; ++ rotate = <270>; ++ width = <80>; ++ height = <160>; ++ fps = <30>; ++ buswidth = <8>; ++ backlight = <&backlight>; ++ dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; ++ reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; ++ led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ }; ++}; ++ ++&tcphy0 { ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ 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>; ++ max-speed = <4000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; ++ vbat-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ }; ++}; ++ ++// Debug TTL ++&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 = "host"; ++}; ++ ++&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"; ++}; ++ ++&iep_mmu { ++ status = "okay"; ++}; diff --git a/patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch b/patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch new file mode 100644 index 000000000000..be107a49e16a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/add-board-helios64.patch @@ -0,0 +1,1038 @@ +From 98834ee2745daea7ee9c2f620acc1d09a4da2cdc Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Tue, 15 Sep 2020 20:04:22 +0700 +Subject: [PATCH] Add board Helios64 + +note: rpardini: this patch was rebased on top of 6.3.1, finally admitting +that it used to blindly overwrite the mainline dts (it was added when helios64 +was not in the tree, and thus a "file addition"). the resulting patch +is the complete set of changes actually done. + +Signed-off-by: Aditya Prayoga +--- + .../dts/rockchip/rk3399-kobol-helios64.dts | 735 ++++++++++++++++-- + 1 file changed, 654 insertions(+), 81 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +index 9586bb12a5d8..09e2cfe40696 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +@@ -11,6 +11,10 @@ + */ + + /dts-v1/; ++#include ++#include ++#include ++#include + #include "rk3399.dtsi" + #include "rk3399-opp.dtsi" + +@@ -48,6 +52,25 @@ chosen { + stdout-path = "serial2:1500000n8"; + }; + ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1800000>; ++ poll-interval = <100>; ++ ++ user2-button { ++ label = "User Button 2"; ++ linux,code = ; ++ press-threshold-microvolt = <100000>; ++ }; ++ }; ++ ++ beeper: beeper { ++ compatible = "gpio-beeper"; ++ gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; ++ }; ++ + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; +@@ -55,35 +78,119 @@ clkin_gmac: external-gmac-clock { + #clock-cells = <0>; + }; + +- fan1 { ++ fan1: p7-fan { + /* fan connected to P7 */ + compatible = "pwm-fan"; + pwms = <&pwm0 0 40000 0>; ++ cooling-min-state = <0>; ++ cooling-max-state = <3>; ++ #cooling-cells = <2>; + cooling-levels = <0 80 170 255>; + }; + +- fan2 { ++ fan2: p6-fan { + /* fan connected to P6 */ + compatible = "pwm-fan"; + pwms = <&pwm1 0 40000 0>; ++ cooling-min-state = <0>; ++ cooling-max-state = <3>; ++ #cooling-cells = <2>; + cooling-levels = <0 80 170 255>; + }; + +- leds { ++ io_leds: io-gpio-leds { ++ status = "okay"; + compatible = "gpio-leds"; + pinctrl-names = "default"; +- pinctrl-0 = <&sys_grn_led_on &sys_red_led_on>; ++ pinctrl-0 = <&network_act>, <&usb3_act>, ++ <&sata_act>, <&sata_err_led>; ++ ++ network { ++ label = "helios64:blue:net"; ++ gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "netdev"; ++ default-state = "off"; ++ }; ++ ++ sata { ++ label = "helios64:blue:hdd-status"; ++ gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "disk-activity"; ++ default-state = "off"; ++ }; ++ ++ sata_err1 { ++ label = "helios64:red:ata1-err"; ++ gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ sata_err2 { ++ label = "helios64:red:ata2-err"; ++ gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ sata_err3 { ++ label = "helios64:red:ata3-err"; ++ gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ sata_err4 { ++ label = "helios64:red:ata4-err"; ++ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; + +- led-0 { ++ sata_err5 { ++ label = "helios64:red:ata5-err"; ++ gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>; ++ default-state = "keep"; ++ }; ++ ++ usb3 { ++ label = "helios64:blue:usb3"; ++ gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; ++ trigger-sources = <&int_hub_port1>, ++ <&int_hub_port2>, ++ <&int_hub_port3>; ++ linux,default-trigger = "usbport"; ++ default-state = "off"; ++ }; ++ }; ++ ++ pwmleds { ++ compatible = "pwm-leds"; ++ status = "okay"; ++ ++ power-led { ++ label = "helios64:blue:power-status"; ++ pwms = <&pwm3 0 2000000000 0>; ++ max-brightness = <255>; ++ }; ++ }; ++ ++ system_leds: system-gpio-leds { ++ status = "okay"; ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&system_led>; ++ ++ status-led { + label = "helios64:green:status"; + gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "none"; + default-state = "on"; ++ mode = <0x23>; + }; + +- led-1 { ++ fault-led { + label = "helios64:red:fault"; + gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "panic"; + default-state = "keep"; ++ mode = <0x23>; + }; + }; + +@@ -115,7 +222,7 @@ pcie_power: pcie-power { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; +- pinctrl-0 = <&pcie_pwr>; ++ pinctrl-0 = <&pcie_pwr_en>; + pinctrl-names = "default"; + regulator-boot-on; + regulator-name = "pcie_power"; +@@ -135,6 +242,7 @@ usblan_power: usblan-power { + vin-supply = <&vcc5v0_usb>; + }; + ++ /* switched by pmic_sleep */ + vcc1v8_sys_s0: vcc1v8-sys-s0 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_sys_s0"; +@@ -145,6 +253,36 @@ vcc1v8_sys_s0: vcc1v8-sys-s0 { + vin-supply = <&vcc1v8_sys_s3>; + }; + ++ vcc0v9_s3: vcc0v9-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc0v9_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <&vcc3v3_sys_s3>; ++ }; ++ ++ avdd_0v9_s0: avdd-0v9-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "avdd_0v9_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <&vcc1v8_sys_s3>; ++ }; ++ ++ avdd_1v8_s0: avdd-1v8-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "avdd_1v8_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc3v3_sys_s3>; ++ }; ++ + vcc3v0_sd: vcc3v0-sd { + compatible = "regulator-fixed"; + enable-active-high; +@@ -210,6 +346,36 @@ vcc5v0_usb: vcc5v0-usb { + vin-supply = <&vcc5v0_perdev>; + }; + ++ vcc5v0_typec: vcc5v0-typec-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_vbus_en>; ++ regulator-name = "vcc5v0_typec"; ++ vin-supply = <&vcc5v0_usb>; ++ }; ++ ++ vcc5v0_hdd: vcc5v0-hdd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_hdd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc12v_dcin_bkup>; ++ }; ++ ++ vcc12v_hdd: vcc12v-hdd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc12v_hdd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ vin-supply = <&vcc12v_dcin_bkup>; ++ }; ++ + vcc12v_dcin: vcc12v-dcin { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; +@@ -228,36 +394,60 @@ vcc12v_dcin_bkup: vcc12v-dcin-bkup { + regulator-max-microvolt = <12000000>; + vin-supply = <&vcc12v_dcin>; + }; +-}; + +-/* +- * The system doesn't run stable with cpu freq enabled, so disallow the lower +- * frequencies until this problem is properly understood and resolved. +- */ +-&cluster0_opp { +- /delete-node/ opp00; +- /delete-node/ opp01; +- /delete-node/ opp02; +- /delete-node/ opp03; +- /delete-node/ opp04; +-}; ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ pwm-supply = <&vcc5v0_sys>; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <830000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; + +-&cluster1_opp { +- /delete-node/ opp00; +- /delete-node/ opp01; +- /delete-node/ opp02; +- /delete-node/ opp03; +- /delete-node/ opp04; +- /delete-node/ opp05; +- /delete-node/ opp06; +-}; ++ gpio-charger { ++ compatible = "gpio-charger"; ++ charger-type = "mains"; ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ charge-status-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ac_present_ap>, <&charger_status>; ++ }; + +-&cpu_b0 { +- cpu-supply = <&vdd_cpu_b>; +-}; ++ gpio-keys { ++ compatible = "gpio-keys"; ++ autorepeat; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwrbtn>, <&user1btn>, <&wake_on_lan>; ++ ++ power { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "Power"; ++ linux,code = ; ++ wakeup-source; ++ }; + +-&cpu_b1 { +- cpu-supply = <&vdd_cpu_b>; ++ user1-button { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; ++ label = "User Button 1"; ++ linux,code = ; ++ wakeup-source; ++ }; ++ }; ++ ++ hdmi_dp_sound: hdmi-dp-sound { ++ status = "okay"; ++ compatible = "rockchip,rk3399-hdmi-dp"; ++ rockchip,cpu = <&i2s2>; ++ rockchip,codec = <&cdn_dp>; ++ }; + }; + + &cpu_l0 { +@@ -276,6 +467,20 @@ &cpu_l3 { + cpu-supply = <&vdd_cpu_l>; + }; + ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0>; ++ phys = <&tcphy0_dp>; ++}; ++ + &emmc_phy { + status = "okay"; + }; +@@ -296,6 +500,11 @@ &gmac { + status = "okay"; + }; + ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ + &i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <168>; +@@ -311,6 +520,7 @@ rk808: pmic@1b { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; ++ + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; +@@ -327,6 +537,19 @@ rk808: pmic@1b { + #clock-cells = <1>; + + regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1000000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; +@@ -334,19 +557,48 @@ vdd_cpu_l: DCDC_REG2 { + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; +- + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + ++ vcc_ddr_s3: DCDC_REG3 { ++ regulator-name = "vcc_ddr_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ + vcc1v8_sys_s3: DCDC_REG4 { + regulator-name = "vcc1v8_sys_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ /* not used */ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ }; + ++ /* not used */ ++ vcc3v0_touch: LDO_REG2 { ++ regulator-name = "vcc3v0_touch"; ++ }; ++ ++ vcc1v8_s3: LDO_REG3 { ++ regulator-name = "vcc1v8_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -359,25 +611,61 @@ vcc_sdio_s0: LDO_REG4 { + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; +- + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + ++ /* not used */ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-name = "vcca3v0_codec"; ++ }; ++ ++ vcc1v5_s3: LDO_REG6 { ++ regulator-name = "vcc1v5_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ /* not used */ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-name = "vcca1v8_codec"; ++ }; ++ + vcc3v0_s3: LDO_REG8 { + regulator-name = "vcc3v0_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; +- + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; ++ ++ vcc3v3_sys_s0: SWITCH_REG1 { ++ regulator-name = "vcc3v3_sys_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ /* not used */ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ }; + }; + }; + +@@ -385,12 +673,33 @@ vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; + regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <40000>; + regulator-always-on; + regulator-boot-on; ++ vin-supply = <&vcc5v0_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: regulator@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { +@@ -405,17 +714,101 @@ &i2c2 { + i2c-scl-falling-time-ns = <30>; + status = "okay"; + ++ gpio-expander@20 { ++ compatible = "nxp,pca9555"; ++ reg = <0x20>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pca0_pins>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <9 IRQ_TYPE_EDGE_FALLING>; ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ vcc-supply = <&vcc3v3_sys_s3>; ++ }; ++ + temp@4c { + compatible = "national,lm75"; + reg = <0x4c>; + }; + }; + ++&i2c4 { ++ clock-frequency = <400000>; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ status = "okay"; ++ ++ fusb0: typec-portc@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ vbus-supply = <&vcc5v0_typec>; ++ ++ connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ power-role = "dual"; ++ data-role = "dual"; ++ try-power-role = "sink"; ++ source-pdos = ; ++ sink-pdos = ; ++ op-sink-microwatt = <5000000>; ++ ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ usb_con_hs: endpoint { ++ remote-endpoint = <&u2phy0_typec_hs>; ++ }; ++ }; ++ port@1 { ++ reg = <1>; ++ usb_con_ss: endpoint { ++ remote-endpoint = <&tcphy0_typec_ss>; ++ }; ++ }; ++ port@2 { ++ reg = <2>; ++ usb_con_sbu: endpoint { ++ remote-endpoint = <&tcphy0_typec_dp>; ++ }; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++/* I2C on UEXT */ ++&i2c7 { ++ status = "okay"; ++}; ++ ++/* External I2C */ ++&i2c8 { ++ status = "okay"; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ + &io_domains { +- audio-supply = <&vcc1v8_sys_s0>; + bt656-supply = <&vcc1v8_sys_s0>; +- gpio1830-supply = <&vcc3v0_s3>; ++ audio-supply = <&vcc1v8_sys_s0>; + sdmmc-supply = <&vcc_sdio_s0>; ++ gpio1830-supply = <&vcc3v0_s3>; + status = "okay"; + }; + +@@ -428,6 +821,7 @@ &pcie0 { + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_prst &pcie_clkreqn_cpm>; + status = "okay"; + + vpcie12v-supply = <&vcc12v_dcin>; +@@ -437,36 +831,116 @@ &pcie0 { + }; + + &pinctrl { ++ buttons { ++ pwrbtn: pwrbtn { ++ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ user1btn: usr1btn { ++ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ charger { ++ ac_present_ap: ac-present-ap { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ charger_status: charger-status { ++ rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fan { ++ fan1_sense: fan1-sense { ++ rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ fan2_sense: fan2-sense { ++ rockchip,pins = <4 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ fusb0_vbus_en: fusb0-vbus-en { ++ rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ + gmac { + gphy_reset: gphy-reset { +- rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; ++ rockchip,pins = ++ <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + leds { +- sys_grn_led_on: sys-grn-led-on { +- rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>; ++ network_act: network-act { ++ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ usb3_act: usb3-act { ++ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ sata_act: sata-act { ++ rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ system_led: sys-led { ++ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>, ++ <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ sata_err_led: sata-err-led { ++ rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>, ++ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ misc { ++ pca0_pins: pca0-pins { ++ rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + +- sys_red_led_on: sys-red-led-on { +- rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>; ++ wake_on_lan: wake-on-lan { ++ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { +- pcie_pwr: pcie-pwr { ++ pcie_pwr_en: pcie-pwr-en { + rockchip,pins = + <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ ++ pcie_prst: pcie-prst { ++ rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + pmic { + pmic_int_l: pmic-int-l { +- rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + +- power { ++ power { + hdd_a_power_en: hdd-a-power-en { + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; +@@ -486,7 +960,7 @@ usb_lan_en: usb-lan-en { + + vcc3v0-sd { + sdmmc0_pwr_h: sdmmc0-pwr-h { +- rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; ++ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; + }; +@@ -506,10 +980,29 @@ &pwm1 { + status = "okay"; + }; + ++&pwm2 { ++ status = "okay"; ++}; ++ ++&pwm3 { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vcc1v8_s3>; ++ status = "okay"; ++}; ++ + &sdhci { ++ assigned-clock-rates = <150000000>; + bus-width = <8>; + mmc-hs200-1_8v; ++ // hs400 is broken on Helios64 since 5.10.60 ++ // mmc-hs400-1_8v; ++ // mmc-hs400-enhanced-strobe; ++ supports-emmc; + non-removable; ++ disable-wp; + vqmmc-supply = <&vcc1v8_sys_s0>; + status = "okay"; + }; +@@ -517,8 +1010,9 @@ &sdhci { + &sdmmc { + bus-width = <4>; + cap-sd-highspeed; +- cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // TODO: verify what needs to be done to use implicit CD definition + disable-wp; ++ sd-uhs-sdr104; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + vmmc-supply = <&vcc3v0_sd>; +@@ -547,6 +1041,27 @@ &spi5 { + status = "okay"; + }; + ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy0_dp { ++ port { ++ tcphy0_typec_dp: endpoint { ++ remote-endpoint = <&usb_con_sbu>; ++ }; ++ }; ++}; ++ ++&tcphy0_usb3 { ++ port { ++ tcphy0_typec_ss: endpoint { ++ remote-endpoint = <&usb_con_ss>; ++ }; ++ }; ++}; ++ + &tcphy1 { + /* phy for &usbdrd_dwc3_1 */ + status = "okay"; +@@ -560,61 +1075,118 @@ &tsadc { + status = "okay"; + }; + +-&u2phy1 { ++&u2phy0 { + status = "okay"; + +- otg-port { +- /* phy for &usbdrd_dwc3_1 */ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { + phy-supply = <&vcc5v0_usb>; + status = "okay"; + }; ++ ++ port { ++ u2phy0_typec_hs: endpoint { ++ remote-endpoint = <&usb_con_hs>; ++ }; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer>; ++ status = "okay"; + }; + + &uart2 { + status = "okay"; + }; + ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++ dr_mode = "otg"; ++}; ++ + &usbdrd3_1 { + status = "okay"; ++}; + +- usb@fe900000 { +- dr_mode = "host"; +- status = "okay"; ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ int_hub: hub@1 { ++ compatible = "usb2109,0815"; ++ reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + +- hub@1 { +- compatible = "usb2109,0815"; ++ int_hub_port1: port@1 { + reg = <1>; +- #address-cells = <1>; +- #size-cells = <0>; +- +- port@1 { +- reg = <1>; +- #trigger-source-cells = <0>; +- }; ++ #trigger-source-cells = <0>; ++ }; + +- port@2 { +- reg = <2>; +- #trigger-source-cells = <0>; +- }; ++ int_hub_port2: port@2 { ++ reg = <2>; ++ #trigger-source-cells = <0>; ++ }; + +- port@3 { +- reg = <3>; +- #trigger-source-cells = <0>; +- }; ++ int_hub_port3: port@3 { ++ reg = <3>; ++ #trigger-source-cells = <0>; ++ }; + +- device@4 { +- compatible = "usbbda,8156"; +- reg = <4>; +- #address-cells = <2>; +- #size-cells = <0>; ++ usb_lan: device@4 { ++ compatible = "usbbda,8156"; ++ reg = <4>; ++ #address-cells = <2>; ++ #size-cells = <0>; + +- interface@0 { /* interface 0 of configuration 1 */ +- compatible = "usbifbda,8156.config1.0"; +- reg = <0 1>; +- }; ++ interface@0 { /* interface 0 of configuration 1 */ ++ compatible = "usbifbda,8156.config1.0"; ++ reg = <0 1>; + }; + }; + }; + }; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; +-- +2.43.0 + diff --git a/patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch b/patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch new file mode 100644 index 000000000000..a82ffbdd2b5c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/add-board-xiaobao-nas-dts.patch @@ -0,0 +1,779 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-xiaobao-nas.dts b/arch/arm64/boot/dts/rockchip/rk3399-xiaobao-nas.dts +new file mode 100644 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-xiaobao-nas.dts +@@ -0,0 +1,774 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++ ++/dts-v1/; ++#include ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++ ++/ { ++ model = "Codinge Xiaobao NAS"; ++ compatible = "codinge,xiaobao-nas", "rockchip,rk3399"; ++ ++ aliases { ++ mmc0 = &sdmmc; ++ mmc1 = &sdhci; ++ mmc2 = &sdio0; ++ }; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ reset-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>; ++ }; ++ ++ vcc_dc: vcc-dc { ++ compatible = "regulator-fixed"; ++ regulator-name = "dc_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc_12v: vcc-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_12v"; ++ regulator-always-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc1v8_s3: vcc1v8-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s3"; ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_1v8>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_host_en>; ++ regulator-name = "vcc5v0_host"; ++ }; ++ ++ vcc_sd: vcc-sd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sd"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_sd_h>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_typec: vcc5v0-typec { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_typec_en>; ++ regulator-name = "vcc5v0_typec"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc_12v>; ++ }; ++ ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_pcie"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_pwr_en>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc_lan: vcc3v3-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_lan"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ keyup-threshold-microvolt = <1800000>; ++ poll-interval = <100>; ++ ++ recovery { ++ label = "Recovery"; ++ linux,code = <0x168>; ++ press-threshold-microvolt = <18000>; ++ }; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&leds_pins>; ++ ++ led1: system-led1 { ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ label = "system_led1"; ++ retain-state-suspended; ++ default-state = "on"; ++ }; ++ ++ led2: system-led2 { ++ gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; ++ label = "system_led2"; ++ retain-state-suspended; ++ default-state = "off"; ++ }; ++ }; ++ ++ pwm-fan { ++ compatible = "pwm-fan"; ++ pwms = <&pwm1 0 50000 0>; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_lan>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ ++&hdmi { ++ ddc-i2c-bus = <&i2c3>; ++ ddc-i2c-scl-high-time-ns = <9625>; ++ ddc-i2c-scl-low-time-ns = <10000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmi_cec>; ++ 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 = "xin32k", "rk808-clkout2"; ++ 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 = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcca_1v8: LDO_REG2 { ++ regulator-name = "vcca_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_pmupll: LDO_REG3 { ++ regulator-name = "vcc1v8_pmupll"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sdio: LDO_REG4 { ++ regulator-name = "vcc_sdio"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ ++ 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 = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-name = "vcca1v8_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: 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>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_pin>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: regulator@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_pin>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ hym8563@51 { ++ compatible = "haoyu,hym8563"; ++ reg = <0x51>; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ }; ++}; ++ ++&i2c3 { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++&i2c4 { ++ clock-frequency = <400000>; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ status = "okay"; ++ ++ typec-portc@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ vbus-supply = <&vcc5v0_typec>; ++ }; ++}; ++ ++&i2s0 { ++ rockchip,capture-channels = <8>; ++ rockchip,playback-channels = <8>; ++ status = "okay"; ++}; ++ ++&i2s1 { ++ rockchip,capture-channels = <2>; ++ rockchip,playback-channels = <2>; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc_3v0>; ++ audio-supply = <&vcca1v8_codec>; ++ sdmmc-supply = <&vcc_sdio>; ++ gpio1830-supply = <&vcc_3v0>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++ drive-impedance-ohm = <50>; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqnb_cpm &fn8274_en_h>; ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++&pinctrl { ++ pcie { ++ fn8274_en_h: fn8274-en-h { ++ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_output_high>, ++ <4 RK_PD5 RK_FUNC_GPIO &pcfg_output_high>, ++ <1 RK_PC7 RK_FUNC_GPIO &pcfg_output_high>; ++ }; ++ ++ pcie_pwr_en: pcie-pwr-en { ++ rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ vsel1_pin: vsel1-pin { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_pin: vsel2-pin { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ usb2 { ++ vcc5v0_host_en: vcc5v0-host-en { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ vcc5v0_typec_en: vcc5v0-typec-en { ++ rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_output_high>; ++ }; ++ }; ++ ++ vcc_sd { ++ vcc_sd_h: vcc-sd-h { ++ rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ leds { ++ leds_pins: leds-pins { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, ++ <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdio0 { ++ bus-width = <4>; ++ clock-frequency = <50000000>; ++ cap-sdio-irq; ++ cap-sd-highspeed; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ disable-wp; ++ max-frequency = <150000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>; ++ vmmc-supply = <&vcc_sd>; ++ vqmmc-supply = <&vcc_sdio>; ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ non-removable; ++ status = "okay"; ++}; ++ ++&spi1 { ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0x00>; ++ spi-max-frequency = <10000000>; ++ }; ++}; ++ ++&tcphy0 { ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++}; ++ ++&tsadc { ++ status = "okay"; ++ ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++}; ++ ++&u2phy0_otg { ++ status = "okay"; ++}; ++ ++&u2phy0_host { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ ++&u2phy1_host { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++&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"; ++}; diff --git a/patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch b/patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch new file mode 100644 index 000000000000..f212d69355a7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-firefly-rk3399-dts.patch @@ -0,0 +1,282 @@ +index c654b6b02f3..f73f792eb44 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts +@@ -217,7 +216,7 @@ + enable-active-high; + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; +- pinctrl-0 = <&vcc5v0_host_en>; ++ pinctrl-0 = <&vcc5v0_host_en &hub_rst>; + regulator-name = "vcc5v0_host"; + regulator-always-on; + vin-supply = <&vcc_sys>; +@@ -236,8 +235,11 @@ + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 RK_PA6 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_sys_en>; + regulator-name = "vcc_sys"; +- regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; +@@ -254,6 +256,27 @@ + regulator-min-microvolt = <430000>; + regulator-max-microvolt = <1400000>; + }; ++ ++ vcca_0v9: vcca-0v9 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcca_0v9"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc3v3_3g: vcc3v3-3g-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_3g_drv>; ++ regulator-name = "vcc3v3_3g"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; + }; + + &cpu_l0 { +@@ -306,6 +329,8 @@ + }; + + &hdmi { ++ avdd-0v9-supply = <&vcca0v9_hdmi>; ++ avdd-1v8-supply = <&vcca1v8_hdmi>; + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; +@@ -330,18 +355,18 @@ + rockchip,system-power-controller; + wakeup-source; + +- vcc1-supply = <&vcc_sys>; +- vcc2-supply = <&vcc_sys>; +- vcc3-supply = <&vcc_sys>; +- vcc4-supply = <&vcc_sys>; +- vcc6-supply = <&vcc_sys>; +- vcc7-supply = <&vcc_sys>; ++ 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 = <&vcc_sys>; +- vcc10-supply = <&vcc_sys>; +- vcc11-supply = <&vcc_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; +- vddio-supply = <&vcc1v8_pmu>; ++ vddio-supply = <&vcc_3v0>; + + regulators { + vdd_center: DCDC_REG1 { +@@ -389,8 +414,8 @@ + }; + }; + +- vcc1v8_dvp: LDO_REG1 { +- regulator-name = "vcc1v8_dvp"; ++ vcca1v8_codec: LDO_REG1 { ++ regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; +@@ -400,12 +425,12 @@ + }; + }; + +- vcc2v8_dvp: LDO_REG2 { +- regulator-name = "vcc2v8_dvp"; ++ vcca1v8_hdmi: LDO_REG2 { ++ regulator-name = "vcca1v8_hdmi"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <2800000>; +- regulator-max-microvolt = <2800000>; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; +@@ -458,12 +483,12 @@ + }; + }; + +- vcca1v8_codec: LDO_REG7 { +- regulator-name = "vcca1v8_codec"; ++ vcca0v9_hdmi: LDO_REG7 { ++ regulator-name = "vcca0v9_hdmi"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; + regulator-state-mem { + regulator-off-in-suspend; + }; +@@ -504,14 +529,16 @@ + vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; +- fcs,suspend-voltage-selector = <0>; ++ fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_pin>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; +- vin-supply = <&vcc_sys>; ++ vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; +@@ -522,13 +549,15 @@ + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_pin>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; +- vin-supply = <&vcc_sys>; ++ vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; +@@ -565,7 +594,7 @@ + status = "okay"; + + fusb0: typec-portc@22 { +- compatible = "fcs,fusb302"; ++ compatible = "fairchild,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio1>; + interrupts = ; +@@ -638,7 +667,7 @@ + &io_domains { + status = "okay"; + +- bt656-supply = <&vcc1v8_dvp>; ++ bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sdio>; + gpio1830-supply = <&vcc_3v0>; +@@ -652,7 +681,10 @@ + ep-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + pinctrl-names = "default"; +- pinctrl-0 = <&pcie_clkreqn_cpm>; ++ pinctrl-0 = <&pcie_perst>; ++ vpcie3v3-supply = <&vcc3v3_pcie>; ++ vpcie1v8-supply = <&vcc1v8_pmu>; ++ vpcie0v9-supply = <&vcca_0v9>; + status = "okay"; + }; + +@@ -704,6 +736,10 @@ + pcie_3g_drv: pcie-3g-drv { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; ++ ++ pcie_perst: pcie-perst { ++ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + pmic { +@@ -742,6 +778,14 @@ + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ ++ vcc_sys_en: vcc-sys-en { ++ rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ hub_rst: hub-rst { ++ rockchip,pins = <2 RK_PA4 RK_FUNC_GPIO &pcfg_output_high>; ++ }; + }; + + wifi { +@@ -749,6 +793,20 @@ + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; ++ ++ bt { ++ bt_host_wake_l: bt-host-wake-l { ++ rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ bt_reg_on_h: bt-reg-on-h { ++ rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ bt_wake_l: bt-wake-l { ++ rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; + }; + + &pwm0 { +@@ -788,7 +846,7 @@ + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio0>; +- interrupts = ; ++ interrupts = ; + interrupt-names = "host-wake"; + brcm,drive-strength = <5>; + pinctrl-names = "default"; +@@ -885,8 +943,22 @@ + + &uart0 { + pinctrl-names = "default"; +- pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ pinctrl-0 = <&uart0_xfer &uart0_rts &uart0_cts>; + 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>; ++ max-speed = <4000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_reg_on_h &bt_host_wake_l &bt_wake_l>; ++ vbat-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ }; + }; + + &uart2 { diff --git a/patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch b/patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch new file mode 100644 index 000000000000..1b427c141177 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-helios64-dts-fix-stability-issues.patch @@ -0,0 +1,72 @@ +From 4244bd791ab2fe68abebc1b6bf71ffbc02535828 Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Thu, 4 Mar 2021 10:39:40 +0700 +Subject: [PATCH] Attempt to improve stability on Helios64 (#2680) + +> X-Git-Archeology: > recovered message: > * Adjust the RK808 buck step to improve stability +> X-Git-Archeology: > recovered message: > * Adjust vdd_log and enable vdd_center init voltage +> X-Git-Archeology: > recovered message: > For some reason, regulator-init-microvolt property under PMIC does not applied. Set the voltage on board file. +> X-Git-Archeology: - Revision eefad69215557708b151a5d9244617a4ffd1281c: https://github.com/armbian/build/commit/eefad69215557708b151a5d9244617a4ffd1281c +> X-Git-Archeology: Date: Thu, 04 Mar 2021 10:39:40 +0700 +> X-Git-Archeology: From: Aditya Prayoga +> X-Git-Archeology: Subject: Attempt to improve stability on Helios64 (#2680) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +index 09e2cfe40696..4cb72981809a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +@@ -522,6 +522,7 @@ rk808: pmic@1b { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; ++ max-buck-steps-per-change = <4>; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; +-- +2.43.0 + diff --git a/patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch b/patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch new file mode 100644 index 000000000000..ff7ca38b5346 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-helios64-remove-pcie-ep-gpios.patch @@ -0,0 +1,25 @@ +From 9fd42a26755ee7303a033c9c1fba3a492e0044f5 Mon Sep 17 00:00:00 2001 +From: Aditya Prayoga +Date: Tue, 15 Sep 2020 13:42:02 +0700 +Subject: [PATCH] Remove PCIE ep-gpios from Helios64 + +Signed-off-by: Aditya Prayoga +--- + arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +index 4cb72981809a..824e7a4d8e40 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +@@ -820,7 +820,6 @@ &pcie_phy { + }; + + &pcie0 { +- ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; +-- +2.43.0 + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch new file mode 100644 index 000000000000..b6a2dc3d616b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopc-t4-add-typec-dp.patch @@ -0,0 +1,147 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Wed, 17 Feb 2021 00:54:00 -0500 +Subject: Patching something + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts | 96 ++++++++++ + 1 file changed, 96 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +index 3bf8f959e42c..2b1220beabd5 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +@@ -9,6 +9,7 @@ + */ + + /dts-v1/; ++#include + #include "rk3399-nanopi4.dtsi" + + / { +@@ -66,6 +67,12 @@ fan: pwm-fan { + }; + }; + ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0>; ++ phys = <&tcphy0_dp>; ++}; ++ + &cpu_thermal { + trips { + cpu_warm: cpu_warm { +@@ -94,6 +101,50 @@ map3 { + }; + }; + ++&fusb0 { ++ ++ connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ power-role = "dual"; ++ data-role = "dual"; ++ try-power-role = "sink"; ++ source-pdos = ; ++ sink-pdos = ; ++ op-sink-microwatt = <5000000>; ++ ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ port@0 { ++ reg = <0>; ++ usb_con_hs: endpoint { ++ remote-endpoint = ++ <&u2phy0_typec_hs>; ++ }; ++ }; ++ port@1 { ++ reg = <1>; ++ ++ usb_con_ss: endpoint { ++ remote-endpoint = ++ <&tcphy0_typec_ss>; ++ }; ++ }; ++ port@2 { ++ reg = <2>; ++ usb_con_dp: endpoint { ++ remote-endpoint = ++ <&tcphy0_typec_dp>; ++ }; ++ }; ++ }; ++ }; ++}; ++ + &pcie0 { + ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; +@@ -114,12 +165,57 @@ &sdhci { + mmc-hs400-enhanced-strobe; + }; + ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy0_dp { ++ port { ++ tcphy0_typec_dp: endpoint { ++ remote-endpoint = <&usb_con_dp>; ++ }; ++ }; ++}; ++ ++&tcphy0_usb3 { ++ port { ++ tcphy0_typec_ss: endpoint { ++ remote-endpoint = <&usb_con_ss>; ++ }; ++ }; ++}; ++ ++&u2phy0 { ++ extcon = <&fusb0>; ++}; ++ + &u2phy0_host { + phy-supply = <&vcc5v0_host0>; ++ status = "okay"; ++}; ++ ++&u2phy0_otg { ++ status = "okay"; ++ ++ port { ++ u2phy0_typec_hs: endpoint { ++ remote-endpoint = <&usb_con_hs>; ++ }; ++ }; + }; + + &u2phy1_host { + phy-supply = <&vcc5v0_host0>; ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ extcon = <&fusb0>; + }; + + &vcc5v0_sys { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch new file mode 100644 index 000000000000..8c03adf2bfa8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-m4v2-dts-add-sound-card.patch @@ -0,0 +1,190 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Thu, 28 Nov 2019 22:29:54 +0000 +Subject: [ARCHEOLOGY] Initial addition of NanoPi M4V2 + +> X-Git-Archeology: - Revision c4eecbcef0d4dc499baf0155449e71dc774bc7c4: https://github.com/armbian/build/commit/c4eecbcef0d4dc499baf0155449e71dc774bc7c4 +> X-Git-Archeology: Date: Thu, 28 Nov 2019 22:29:54 +0000 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Initial addition of NanoPi M4V2 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 40a3d4ecb9a75c17183e2129491b7bc03060a315: https://github.com/armbian/build/commit/40a3d4ecb9a75c17183e2129491b7bc03060a315 +> X-Git-Archeology: Date: Sun, 17 May 2020 18:42:24 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Fixed rt5651 codec probing after its driver was changed to module (#1969) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 401fb1fde426c93121c4639b34a450d8ff551c85: https://github.com/armbian/build/commit/401fb1fde426c93121c4639b34a450d8ff551c85 +> X-Git-Archeology: Date: Sat, 20 Nov 2021 19:49:22 +0100 +> X-Git-Archeology: From: simple <991605149@qq.com> +> X-Git-Archeology: Subject: Fixed rt5651 codec build module (#3270) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 51 ++++++++++ + sound/soc/rockchip/Kconfig | 9 ++ + 2 files changed, 60 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +index 7c5f441a2219..3e899f584871 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +@@ -132,6 +132,27 @@ status_led: led-0 { + }; + }; + ++ rt5651-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "realtek,rt5651-codec"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,widgets = ++ "Microphone", "Mic Jack", ++ "Headphone", "Headphone Jack"; ++ simple-audio-card,routing = ++ "Mic Jack", "micbias1", ++ "IN1P", "Mic Jack", ++ "Headphone Jack", "HPOL", ++ "Headphone Jack", "HPOR"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&rt5651>; ++ }; ++ }; ++ + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; +@@ -216,6 +237,10 @@ &hdmi_sound { + status = "okay"; + }; + ++&hdmi_sound { ++ status = "okay"; ++}; ++ + &i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; +@@ -463,6 +488,16 @@ &i2c1 { + i2c-scl-rising-time-ns = <150>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; ++ ++ rt5651: rt5651@1a { ++ compatible = "realtek,rt5651"; ++ reg = <0x1a>; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ clock-names = "mclk"; ++ hp-det-gpio = <&gpio4 RK_PC4 GPIO_ACTIVE_LOW>; ++ // spk-con-gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; ++ #sound-dai-cells = <0>; ++ }; + }; + + &i2c2 { +@@ -494,6 +529,16 @@ &i2s2 { + status = "okay"; + }; + ++&i2s1 { ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ status = "okay"; ++}; ++ + &io_domains { + bt656-supply = <&vcc_1v8>; + audio-supply = <&vcca1v8_codec>; +@@ -759,3 +804,9 @@ &vopl { + &vopl_mmu { + status = "okay"; + }; ++ ++&spdif { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; +diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig +index f98a2fa85edd..be36e36c8783 100644 +--- a/sound/soc/rockchip/Kconfig ++++ b/sound/soc/rockchip/Kconfig +@@ -65,6 +65,15 @@ config SND_SOC_ROCKCHIP_RT5645 + Say Y or M here if you want to add support for SoC audio on Rockchip + boards using the RT5645/RT5650 codec, such as Veyron. + ++config SND_SOC_ROCKCHIP_RT5651 ++ tristate "ASoC support for Rockchip boards using a RT5651 codec" ++ depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && HAVE_CLK ++ select SND_SOC_ROCKCHIP_I2S ++ select SND_SOC_RT5651 ++ help ++ Say Y or M here if you want to add support for SoC audio on Rockchip ++ boards using the RT5651 codec, such as FriendlyARM's Nano{Pi,PC} family. ++ + config SND_SOC_RK3288_HDMI_ANALOG + tristate "ASoC support multiple codecs for Rockchip RK3288 boards" + depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && HAVE_CLK +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch new file mode 100644 index 000000000000..72fe01212211 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2c-plus.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Thu, 31 Aug 2023 11:41:37 +0200 +Subject: [ARCHEOLOGY] rockchip64: bump rockchip64-edge kernel to 6.5 + +> X-Git-Archeology: - Revision 8254411054a99f9750770bb6055facfbdedacbba: https://github.com/armbian/build/commit/8254411054a99f9750770bb6055facfbdedacbba +> X-Git-Archeology: Date: Thu, 31 Aug 2023 11:41:37 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: rockchip64: bump rockchip64-edge kernel to 6.5 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts +index 16a1958e4572..45954295d51d 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2c-plus.dts +@@ -27,7 +27,7 @@ &emmc { + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; +- vmmc-supply = <&vcc_io_33>; ++ vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc18_emmc>; + status = "okay"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch new file mode 100644 index 000000000000..c707061370f8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r2s.patch @@ -0,0 +1,735 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 7 Jan 2023 11:59:47 +0000 +Subject: rockchip64: consolidate nanopi r2s device trees + +--- + arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 493 ++++++---- + 1 file changed, 328 insertions(+), 165 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +index 1445b879ac7a..7ebf21d7faac 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +@@ -1,119 +1,167 @@ + // SPDX-License-Identifier: (GPL-2.0+ OR MIT) + /* +- * Copyright (c) 2020 David Bauer ++ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd. ++ * (http://www.friendlyarm.com) ++ * ++ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd + */ + + /dts-v1/; +- +-#include +-#include ++#include "rk3328-dram-default-timing.dtsi" + #include "rk3328.dtsi" + + / { +- model = "FriendlyElec NanoPi R2S"; +- compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328"; ++ model = "FriendlyElec boards based on Rockchip RK3328"; ++ compatible = "friendlyelec,nanopi-r2", ++ "rockchip,rk3328"; + + aliases { +- ethernet0 = &gmac2io; +- ethernet1 = &rtl8153; +- mmc0 = &sdmmc; ++ ethernet0 = &gmac2io; ++ ethernet1 = &r8153; + }; + + chosen { ++ bootargs = "swiotlb=1 coherent_pool=1m consoleblank=0"; + stdout-path = "serial2:1500000n8"; + }; + +- gmac_clk: gmac-clock { ++ gmac_clkin: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac_clkin"; + #clock-cells = <0>; + }; + +- keys { +- compatible = "gpio-keys"; +- pinctrl-0 = <&reset_button_pin>; +- pinctrl-names = "default"; +- +- key-reset { +- label = "reset"; +- gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; +- linux,code = ; +- debounce-interval = <50>; +- }; ++ mach: board { ++ compatible = "friendlyelec,board"; ++ machine = "NANOPI-R2"; ++ hwrev = <255>; ++ model = "NanoPi R2 Series"; ++ nvmem-cells = <&efuse_id>, <&efuse_cpu_version>; ++ nvmem-cell-names = "id", "cpu-version"; + }; + +- leds { ++ leds: gpio-leds { + compatible = "gpio-leds"; +- pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; + pinctrl-names = "default"; ++ pinctrl-0 =<&leds_gpio>; ++ status = "disabled"; + +- lan_led: led-0 { +- gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:green:lan"; +- }; +- +- sys_led: led-1 { ++ led@1 { + gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:red:sys"; +- default-state = "on"; +- }; +- +- wan_led: led-2 { +- gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; +- label = "nanopi-r2s:green:wan"; ++ label = "status_led"; ++ linux,default-trigger = "heartbeat"; ++ linux,default-trigger-delay-ms = <0>; + }; + }; + +- vcc_io_sdio: sdmmcio-regulator { +- compatible = "regulator-gpio"; +- enable-active-high; +- gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; +- pinctrl-0 = <&sdio_vcc_pin>; ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk805 1>; ++ clock-names = "ext_clock"; + pinctrl-names = "default"; +- regulator-name = "vcc_io_sdio"; +- regulator-always-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <3300000>; +- regulator-settling-time-us = <5000>; +- regulator-type = "voltage"; +- startup-delay-us = <2000>; +- states = <1800000 0x1>, +- <3300000 0x0>; +- vin-supply = <&vcc_io_33>; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sdmmc_ext: dwmmc@ff5f0000 { ++ compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; ++ reg = <0x0 0xff5f0000 0x0 0x4000>; ++ clock-freq-min-max = <400000 150000000>; ++ clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>, ++ <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>; ++ clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; ++ fifo-depth = <0x100>; ++ interrupts = ; ++ status = "disabled"; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; +- gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; +- pinctrl-0 = <&sdmmc0m1_pin>; ++ gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; +- regulator-name = "vcc_sd"; ++ pinctrl-0 = <&sdmmc0m1_pin>; + regulator-boot-on; ++ regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- vin-supply = <&vcc_io_33>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vccio_sd: sdmmcio-regulator { ++ compatible = "regulator-gpio"; ++ gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; ++ states = <1800000 0x1 ++ 3300000 0x0>; ++ regulator-name = "vccio_sd"; ++ regulator-type = "voltage"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ vin-supply = <&vcc_io>; ++ startup-delay-us = <2000>; ++ regulator-settling-time-us = <5000>; ++ enable-active-high; ++ status = "disabled"; + }; + +- vdd_5v: vdd-5v { ++ vcc_sys: vcc-sys { + compatible = "regulator-fixed"; +- regulator-name = "vdd_5v"; ++ regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + +- vdd_5v_lan: vdd-5v-lan { ++ vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; +- pinctrl-0 = <&lan_vdd_pin>; +- pinctrl-names = "default"; +- regulator-name = "vdd_5v_lan"; ++ regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; +- vin-supply = <&vdd_5v>; ++ }; ++ ++ vcc_host_vbus: host-vbus-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_host_vbus"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ /delete-node/ dmc-opp-table; ++ ++ dmc_opp_table: dmc_opp_table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-924000000 { ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 1200000>; ++ }; ++ opp-1056000000 { ++ opp-hz = /bits/ 64 <1056000000>; ++ opp-microvolt = <1175000 1175000 1200000>; ++ }; + }; + }; + +@@ -120,34 +168,57 @@ &cpu0 { + cpu-supply = <&vdd_arm>; + }; + +-&cpu1 { +- cpu-supply = <&vdd_arm>; ++&dfi { ++ status = "okay"; + }; + +-&cpu2 { +- cpu-supply = <&vdd_arm>; ++&dmc { ++ center-supply = <&vdd_logic>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; + }; + +-&cpu3 { +- cpu-supply = <&vdd_arm>; ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ max-frequency = <150000000>; ++ mmc-hs200-1_8v; ++ no-sd; ++ non-removable; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ vmmc-supply = <&vcc_io>; ++ vqmmc-supply = <&vcc18_emmc>; ++ status = "okay"; + }; + +-&display_subsystem { ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ clock_in_out = "output"; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; + status = "disabled"; + }; + + &gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; +- assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; ++ assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; + clock_in_out = "input"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmiim1_pins>; + phy-handle = <&rtl8211e>; + phy-mode = "rgmii"; +- phy-supply = <&vcc_io_33>; +- pinctrl-0 = <&rgmiim1_pins>; +- pinctrl-names = "default"; +- rx_delay = <0x18>; ++ phy-supply = <&vcc_phy>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 30000>; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + snps,aal; ++ snps,rxpbl = <0x4>; ++ snps,txpbl = <0x4>; + tx_delay = <0x24>; ++ rx_delay = <0x18>; + status = "okay"; + + mdio { +@@ -155,13 +226,11 @@ mdio { + #address-cells = <1>; + #size-cells = <0>; + +- rtl8211e: ethernet-phy@1 { +- reg = <1>; +- pinctrl-0 = <ð_phy_reset_pin>; +- pinctrl-names = "default"; ++ rtl8211e: phy@0 { ++ reg = <0>; + reset-assert-us = <10000>; +- reset-deassert-us = <50000>; +- reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ reset-deassert-us = <30000>; ++ /* reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; */ + }; + }; + }; +@@ -169,36 +238,35 @@ rtl8211e: ethernet-phy@1 { + &i2c1 { + status = "okay"; + +- rk805: pmic@18 { ++ rk805: rk805@18 { + compatible = "rockchip,rk805"; + reg = <0x18>; +- interrupt-parent = <&gpio1>; +- interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <6 IRQ_TYPE_LEVEL_LOW>; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk805-clkout2"; + gpio-controller; + #gpio-cells = <2>; +- pinctrl-0 = <&pmic_int_l>; + pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + +- vcc1-supply = <&vdd_5v>; +- vcc2-supply = <&vdd_5v>; +- vcc3-supply = <&vdd_5v>; +- vcc4-supply = <&vdd_5v>; +- vcc5-supply = <&vcc_io_33>; +- vcc6-supply = <&vdd_5v>; ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_io>; + + regulators { +- vdd_log: DCDC_REG1 { +- regulator-name = "vdd_log"; +- regulator-always-on; +- regulator-boot-on; ++ vdd_logic: DCDC_REG1 { ++ regulator-name = "vdd_logic"; ++ regulator-init-microvolt = <1075000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; +- regulator-ramp-delay = <12500>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; +@@ -207,12 +275,11 @@ regulator-state-mem { + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; +- regulator-always-on; +- regulator-boot-on; ++ regulator-init-microvolt = <1225000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; +- regulator-ramp-delay = <12500>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; +@@ -223,19 +290,17 @@ vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; +- + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + +- vcc_io_33: DCDC_REG4 { +- regulator-name = "vcc_io_33"; +- regulator-always-on; +- regulator-boot-on; ++ vcc_io: DCDC_REG4 { ++ regulator-name = "vcc_io"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; +@@ -244,11 +309,10 @@ regulator-state-mem { + + vcc_18: LDO_REG1 { + regulator-name = "vcc_18"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -257,11 +321,10 @@ regulator-state-mem { + + vcc18_emmc: LDO_REG2 { + regulator-name = "vcc18_emmc"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; +@@ -270,11 +333,10 @@ regulator-state-mem { + + vdd_10: LDO_REG3 { + regulator-name = "vdd_10"; +- regulator-always-on; +- regulator-boot-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; +- ++ regulator-always-on; ++ regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; +@@ -285,20 +347,21 @@ regulator-state-mem { + }; + + &io_domains { +- pmuio-supply = <&vcc_io_33>; +- vccio1-supply = <&vcc_io_33>; +- vccio2-supply = <&vcc18_emmc>; +- vccio3-supply = <&vcc_io_sdio>; +- vccio4-supply = <&vcc_18>; +- vccio5-supply = <&vcc_io_33>; +- vccio6-supply = <&vcc_io_33>; + status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc18_emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_18>; ++ pmuio-supply = <&vcc_io>; + }; + + &pinctrl { +- button { +- reset_button_pin: reset-button-pin { +- rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + +@@ -308,61 +371,165 @@ eth_phy_reset_pin: eth-phy-reset-pin { + }; + }; + +- leds { +- lan_led_pin: lan-led-pin { +- rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + +- sys_led_pin: sys-led-pin { +- rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdmmc0 { ++ sdmmc0_clk: sdmmc0-clk { ++ rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_4ma>; ++ }; ++ ++ sdmmc0_cmd: sdmmc0-cmd { ++ rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_4ma>; + }; + +- wan_led_pin: wan-led-pin { +- rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdmmc0_dectn: sdmmc0-dectn { ++ rockchip,pins = <1 RK_PA5 1 &pcfg_pull_up_4ma>; ++ }; ++ ++ sdmmc0_bus4: sdmmc0-bus4 { ++ rockchip,pins = ++ <1 RK_PA0 1 &pcfg_pull_up_4ma>, ++ <1 RK_PA1 1 &pcfg_pull_up_4ma>, ++ <1 RK_PA2 1 &pcfg_pull_up_4ma>, ++ <1 RK_PA3 1 &pcfg_pull_up_4ma>; + }; + }; + +- lan { +- lan_vdd_pin: lan-vdd-pin { +- rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; ++ sdmmc0ext { ++ sdmmc0ext_clk: sdmmc0ext-clk { ++ rockchip,pins = <3 RK_PA2 3 &pcfg_pull_none_2ma>; ++ }; ++ ++ sdmmc0ext_cmd: sdmmc0ext-cmd { ++ rockchip,pins = <3 RK_PA0 3 &pcfg_pull_up_2ma>; ++ }; ++ ++ sdmmc0ext_bus4: sdmmc0ext-bus4 { ++ rockchip,pins = ++ <3 RK_PA4 3 &pcfg_pull_up_2ma>, ++ <3 RK_PA5 3 &pcfg_pull_up_2ma>, ++ <3 RK_PA6 3 &pcfg_pull_up_2ma>, ++ <3 RK_PA7 3 &pcfg_pull_up_2ma>; + }; + }; + +- pmic { +- pmic_int_l: pmic-int-l { +- rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; ++ gmac-1 { ++ rgmiim1_pins: rgmiim1-pins { ++ rockchip,pins = ++ /* mac_txclk */ ++ <1 RK_PB4 2 &pcfg_pull_none_4ma>, ++ /* mac_rxclk */ ++ <1 RK_PB5 2 &pcfg_pull_none>, ++ /* mac_mdio */ ++ <1 RK_PC3 2 &pcfg_pull_none_2ma>, ++ /* mac_txen */ ++ <1 RK_PD1 2 &pcfg_pull_none_4ma>, ++ /* mac_clk */ ++ <1 RK_PC5 2 &pcfg_pull_none_2ma>, ++ /* mac_rxdv */ ++ <1 RK_PC6 2 &pcfg_pull_none>, ++ /* mac_mdc */ ++ <1 RK_PC7 2 &pcfg_pull_none_2ma>, ++ /* mac_rxd1 */ ++ <1 RK_PB2 2 &pcfg_pull_none>, ++ /* mac_rxd0 */ ++ <1 RK_PB3 2 &pcfg_pull_none>, ++ /* mac_txd1 */ ++ <1 RK_PB0 2 &pcfg_pull_none_4ma>, ++ /* mac_txd0 */ ++ <1 RK_PB1 2 &pcfg_pull_none_4ma>, ++ /* mac_rxd3 */ ++ <1 RK_PB6 2 &pcfg_pull_none>, ++ /* mac_rxd2 */ ++ <1 RK_PB7 2 &pcfg_pull_none>, ++ /* mac_txd3 */ ++ <1 RK_PC0 2 &pcfg_pull_none_4ma>, ++ /* mac_txd2 */ ++ <1 RK_PC1 2 &pcfg_pull_none_4ma>, ++ ++ /* mac_txclk */ ++ <0 RK_PB0 1 &pcfg_pull_none>, ++ /* mac_txen */ ++ <0 RK_PB4 1 &pcfg_pull_none>, ++ /* mac_clk */ ++ <0 RK_PD0 1 &pcfg_pull_none>, ++ /* mac_txd1 */ ++ <0 RK_PC0 1 &pcfg_pull_none>, ++ /* mac_txd0 */ ++ <0 RK_PC1 1 &pcfg_pull_none>, ++ /* mac_txd3 */ ++ <0 RK_PC7 1 &pcfg_pull_none>, ++ /* mac_txd2 */ ++ <0 RK_PC6 1 &pcfg_pull_none>; + }; + }; + +- sd { +- sdio_vcc_pin: sdio-vcc-pin { +- rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; ++ usb { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; ++ ++ gpio-leds { ++ leds_gpio: leds-gpio { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; + }; + +-&pwm2 { ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ max-frequency = <150000000>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ vmmc-supply = <&vcc_sd>; + status = "okay"; + }; + +-&sdmmc { ++&sdmmc_ext { + bus-width = <4>; + cap-sd-highspeed; ++ cap-sdio-irq; + disable-wp; +- pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; ++ keep-power-in-suspend; ++ max-frequency = <100000000>; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; + pinctrl-names = "default"; +- sd-uhs-sdr12; +- sd-uhs-sdr25; +- sd-uhs-sdr50; ++ pinctrl-0 = <&sdmmc0ext_clk &sdmmc0ext_cmd &sdmmc0ext_bus4>; ++ rockchip,default-sample-phase = <120>; ++ supports-sdio; + sd-uhs-sdr104; +- vmmc-supply = <&vcc_sd>; +- vqmmc-supply = <&vcc_io_sdio>; ++ #address-cells = <1>; ++ #size-cells = <0>; + status = "okay"; ++ ++ brcmf: bcrmf@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ }; + }; + + &tsadc { +- rockchip,hw-tshut-mode = <0>; +- rockchip,hw-tshut-polarity = <0>; ++ status = "okay"; ++}; ++ ++&uart2 { + status = "okay"; + }; + +@@ -378,13 +545,16 @@ &u2phy_otg { + status = "okay"; + }; + +-&uart2 { ++&usb20_otg { + status = "okay"; + }; + +-&usb20_otg { ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { + status = "okay"; +- dr_mode = "host"; + }; + + &usbdrd3 { +@@ -393,17 +563,10 @@ &usbdrd3 { + #address-cells = <1>; + #size-cells = <0>; + +- /* Second port is for USB 3.0 */ +- rtl8153: device@2 { ++ r8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; ++ realtek,led-data = <0x87>; ++ local-mac-address = [00 00 00 00 00 00]; + }; + }; +- +-&usb_host0_ehci { +- status = "okay"; +-}; +- +-&usb_host0_ohci { +- status = "okay"; +-}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch new file mode 100644 index 000000000000..2fb280e546cd --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-nanopi-r4s-pwmfan.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Bochun Bai +Date: Sun, 18 Jun 2023 11:56:34 +0200 +Subject: Add pwm-fan support to nanopi r4s + +--- + arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 35 ++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +index fe5b52610010..10cc254fd1dc 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -62,6 +62,41 @@ vdd_5v: vdd-5v { + regulator-always-on; + regulator-boot-on; + }; ++ ++ fan: pwm-fan { ++ compatible = "pwm-fan"; ++ cooling-levels = <0 18 102 170 255>; ++ fan-supply = <&vdd_5v>; ++ 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>; ++ }; ++ }; + }; + + &emmc_phy { +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch b/patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch new file mode 100644 index 000000000000..7cb0c747bf7b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-orangepi-r1-plus.patch @@ -0,0 +1,216 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Sat, 20 Jun 2020 22:39:57 +0200 +Subject: [ARCHEOLOGY] Initial ROCK Pi E support (as WIP) (#2042) + +> X-Git-Archeology: > recovered message: > * WIP: Adding RockpiE config +> X-Git-Archeology: > recovered message: > Signed-off-by: Igor Pecovnik +> X-Git-Archeology: > recovered message: > * Mainline u-boot for ROCK Pi E +> X-Git-Archeology: > recovered message: > * Initial ROCK Pi E device tree in kernel +> X-Git-Archeology: > recovered message: > * Fixed supplies for ROCK Pi E device tree +> X-Git-Archeology: > recovered message: > * Adjusted u-boot load address for rockchip64 boards with 256MB eg. ROCK Pi E +> X-Git-Archeology: > recovered message: > * Blacklisted lima on ROCK Pi E +> X-Git-Archeology: > recovered message: > * Fixed ROCK Pi E patch after merge from master +> X-Git-Archeology: > recovered message: > * Removed mode settings from rk805 regulators +> X-Git-Archeology: > recovered message: > * Fixed issues with offloading for gigabit interface of RockPi E +> X-Git-Archeology: > recovered message: > * Adjusted ROCK Pi E board config +> X-Git-Archeology: > recovered message: > * Added dev branch for ROCK Pi E +> X-Git-Archeology: > recovered message: > * Add build targets +> X-Git-Archeology: > recovered message: > Signed-off-by: Igor Pecovnik +> X-Git-Archeology: > recovered message: > * Exchange legacy to current in ROCK Pi E build targets +> X-Git-Archeology: > recovered message: > Co-authored-by: Piotr Szczepanik +> X-Git-Archeology: - Revision e1ecb098330dc372740371dc2386f911833a0529: https://github.com/armbian/build/commit/e1ecb098330dc372740371dc2386f911833a0529 +> X-Git-Archeology: Date: Sat, 20 Jun 2020 22:39:57 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Initial ROCK Pi E support (as WIP) (#2042) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 72257bd0648c28fca32962126bb885a4a2c188cc: https://github.com/armbian/build/commit/72257bd0648c28fca32962126bb885a4a2c188cc +> X-Git-Archeology: Date: Tue, 23 Jun 2020 16:37:54 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Make USB3 support of ROCK Pi E on par with other rk3328 boards (#2050) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e36ce875b025e112127cf8cc2d34825ebfe36569: https://github.com/armbian/build/commit/e36ce875b025e112127cf8cc2d34825ebfe36569 +> X-Git-Archeology: Date: Tue, 10 Nov 2020 21:43:13 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-current to linux 5.9.y (#2309) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ccbc888b3f5731790128684959b55b6552e26190: https://github.com/armbian/build/commit/ccbc888b3f5731790128684959b55b6552e26190 +> X-Git-Archeology: Date: Sat, 28 Nov 2020 16:52:34 +0100 +> X-Git-Archeology: From: Oleg +> X-Git-Archeology: Subject: add dts rk3328-roc-pc, fix WIFI and USB 3.0 rk3328 (#2390) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 25bd76527e1276c4c00829f68c0ca0742ecc94c1: https://github.com/armbian/build/commit/25bd76527e1276c4c00829f68c0ca0742ecc94c1 +> X-Git-Archeology: Date: Sat, 28 Nov 2020 18:10:53 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Fix roc-rk3328-pc device tree reference to missing RK_FUNC_1 +> X-Git-Archeology: +> X-Git-Archeology: - Revision dfd5cf9692e97774f7f0bfd72227144e36f58070: https://github.com/armbian/build/commit/dfd5cf9692e97774f7f0bfd72227144e36f58070 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 22:13:03 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Clean up patchset +> X-Git-Archeology: +> X-Git-Archeology: - Revision 25e0f1633467c020f6ae68d09964a522fbfbe613: https://github.com/armbian/build/commit/25e0f1633467c020f6ae68d09964a522fbfbe613 +> X-Git-Archeology: Date: Mon, 18 Jan 2021 23:21:40 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Adjusted power and pmic configuration for Station M1 in current/dev +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision d8dbefd61838e5b0cfc2b93d2d168f3fb2666dfb: https://github.com/armbian/build/commit/d8dbefd61838e5b0cfc2b93d2d168f3fb2666dfb +> X-Git-Archeology: Date: Tue, 27 Jul 2021 00:05:09 -0400 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] rk3328 change to mainline USB3 +> X-Git-Archeology: +> X-Git-Archeology: - Revision a16699260fb786a4d89a1c335722e9fed49d19d2: https://github.com/armbian/build/commit/a16699260fb786a4d89a1c335722e9fed49d19d2 +> X-Git-Archeology: Date: Fri, 08 Jul 2022 22:35:59 +1200 +> X-Git-Archeology: From: schwar3kat <61094841+schwar3kat@users.noreply.github.com> +> X-Git-Archeology: Subject: Refactored orangepi-r1plus-lts dts in kernel add board patch +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8648dde23ff090b5fb704adab036ed14cd944ba3: https://github.com/armbian/build/commit/8648dde23ff090b5fb704adab036ed14cd944ba3 +> X-Git-Archeology: Date: Thu, 22 Sep 2022 10:25:28 +0200 +> X-Git-Archeology: From: aiamadeus <42570690+aiamadeus@users.noreply.github.com> +> X-Git-Archeology: Subject: rockchip: fixes support for orangepi-r1plus (#4215) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 85bab47bba73e0ef0e4ea5fde60e0aab56f82906: https://github.com/armbian/build/commit/85bab47bba73e0ef0e4ea5fde60e0aab56f82906 +> X-Git-Archeology: Date: Sat, 06 May 2023 12:55:10 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 906ca66430329ab774f5b9d0f62eef1ce5e398fe: https://github.com/armbian/build/commit/906ca66430329ab774f5b9d0f62eef1ce5e398fe +> X-Git-Archeology: Date: Tue, 16 May 2023 08:55:33 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `rockchip64`/`edge`/`6.3`: rebase/rewrite patches against `v6.3.1`; do archeology for mbox-less patches; materialize overwrites +> X-Git-Archeology: +> X-Git-Archeology: - Revision 19d532b13cabc1a749f61b9c400d933ba5aeb7e3: https://github.com/armbian/build/commit/19d532b13cabc1a749f61b9c400d933ba5aeb7e3 +> X-Git-Archeology: Date: Tue, 13 Jun 2023 12:33:59 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `rockchip64` `edge` 6.3: rename most remaining "add-board" patches to "board" (all "add-board"s are now bare .dts in `dt/` folder) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 41ade999f04c26a277cfa1c3c721cbe869d3ad12: https://github.com/armbian/build/commit/41ade999f04c26a277cfa1c3c721cbe869d3ad12 +> X-Git-Archeology: Date: Tue, 03 Oct 2023 13:54:03 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: `rockchip64`/`edge`: bump to `6.6-rc4`; initial copy patches from 6.5 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 1f4df4c41fe33f9822ca2f42d14a2a445e27aed7: https://github.com/armbian/build/commit/1f4df4c41fe33f9822ca2f42d14a2a445e27aed7 +> X-Git-Archeology: Date: Sun, 14 Jan 2024 14:14:50 +0100 +> X-Git-Archeology: From: Paolo Sabatino +> X-Git-Archeology: Subject: rockchip64: bump edge to 6.7, current to 6.6 +> X-Git-Archeology: +> X-Git-Archeology: - Revision e4d413b9166e3633b40fb23382fb1045b9d0e315: https://github.com/armbian/build/commit/e4d413b9166e3633b40fb23382fb1045b9d0e315 +> X-Git-Archeology: Date: Tue, 26 Mar 2024 13:46:35 +0100 +> X-Git-Archeology: From: Paolo Sabatino +> X-Git-Archeology: Subject: rockchip64: bump edge kernel to 6.8 +> X-Git-Archeology: +> X-Git-Archeology: - Revision fae4549764c548cb65d3cbfe319f1e11bc777505: https://github.com/armbian/build/commit/fae4549764c548cb65d3cbfe319f1e11bc777505 +> X-Git-Archeology: Date: Thu, 04 Apr 2024 13:38:18 +0800 +> X-Git-Archeology: From: aiamadeus <2789289348@qq.com> +> X-Git-Archeology: Subject: rockchip: update dts patches for orangepi r1-plus +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts | 45 ++++++++++ + 1 file changed, 45 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +index f20662929c77..c55d79e12f16 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-orangepi-r1-plus.dts +@@ -8,6 +8,7 @@ + + #include + #include ++#include "rk3328-dram-default-timing.dtsi" + #include "rk3328.dtsi" + + / { +@@ -86,6 +87,33 @@ vdd_5v_lan: vdd-5v-lan-regulator { + regulator-boot-on; + vin-supply = <&vcc_sys>; + }; ++ ++ /delete-node/ dmc-opp-table; ++ ++ dmc_opp_table: dmc_opp_table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-924000000 { ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 1200000>; ++ }; ++ opp-1056000000 { ++ opp-hz = /bits/ 64 <1056000000>; ++ opp-microvolt = <1175000 1175000 1200000>; ++ }; ++ }; + }; + + &cpu0 { +@@ -108,6 +136,16 @@ &display_subsystem { + status = "disabled"; + }; + ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_log>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; ++}; ++ + &gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; +@@ -138,6 +176,10 @@ rtl8211e: ethernet-phy@1 { + }; + }; + ++&i2c0 { ++ status = "okay"; ++}; ++ + &i2c1 { + status = "okay"; + +@@ -167,6 +209,7 @@ vdd_log: DCDC_REG1 { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; ++ regulator-init-microvolt = <1075000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; +@@ -181,6 +224,7 @@ vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-always-on; + regulator-boot-on; ++ regulator-init-microvolt = <1225000>; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; +@@ -362,6 +406,7 @@ &usbdrd3 { + rtl8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; ++ realtek,led-data = <0x87>; + }; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch b/patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch new file mode 100644 index 000000000000..dfbf219abd24 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-orangepi-rk3399-pcie.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: amazingfate +Date: Thu, 18 Apr 2024 00:42:13 +0800 +Subject: arm64: dts: rockchip: add pcie support to orangepi rk3399 board + +--- + arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts | 31 ++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +index e7551449e718..fc23d4733509 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +@@ -124,6 +124,17 @@ vcc3v0_sd: vcc3v0-sd { + vin-supply = <&vcc3v3_sys>; + }; + ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 2 0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_drv>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_pcie"; ++ }; ++ + vcc3v3_sys: vcc3v3-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; +@@ -588,6 +599,20 @@ &io_domains { + gpio1830-supply = <&vcc_3v0>; + }; + ++&pcie_phy { ++ status = "okay"; ++ assigned-clocks = <&cru 138>; ++ assigned-clock-parents = <&cru 167>; ++ assigned-clock-rates = <100000000>; ++}; ++ ++&pcie0 { ++ status = "okay"; ++ ep-gpios = <&gpio2 4 0>; ++ num-lanes = <4>; ++ max-link-speed = <1>; ++}; ++ + &pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +@@ -610,6 +635,12 @@ phy_rstb: phy-rstb { + }; + }; + ++ pcie { ++ pcie_drv: pcie-drv { ++ rockchip,pins = <0 2 0 &pcfg_pull_none>; ++ }; ++ }; ++ + pmic { + cpu_b_sleep: cpu-b-sleep { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch b/patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch new file mode 100644 index 000000000000..6e29666c547e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-pbp-add-dp-alt-mode.patch @@ -0,0 +1,421 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dan Johansen +Date: Tue, 2 Jun 2020 20:20:29 +0200 +Subject: add-dp-alt-mode-to-PBP + +--- + arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 5 + + drivers/phy/rockchip/phy-rockchip-typec.c | 17 ++ + drivers/usb/typec/altmodes/displayport.c | 52 +++- + drivers/usb/typec/tcpm/tcpm.c | 139 +++++++++- + 4 files changed, 210 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +index 054c6a4d1a45..48b865d30b14 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +@@ -422,6 +422,7 @@ edp_out_panel: endpoint@0 { + + &emmc_phy { + status = "okay"; ++ extcon = <&fusb0>; + }; + + &gpu { +@@ -706,6 +707,9 @@ connector { + ; + try-power-role = "sink"; + ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ + ports { + #address-cells = <1>; + #size-cells = <0>; +@@ -972,6 +976,7 @@ spiflash: flash@0 { + }; + + &tcphy0 { ++ extcon = <&fusb0>; + status = "okay"; + }; + +diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c +index 4efcb78b0ab1..6a641d9f752c 100644 +--- a/drivers/phy/rockchip/phy-rockchip-typec.c ++++ b/drivers/phy/rockchip/phy-rockchip-typec.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1156,6 +1157,22 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) + dev_err(dev, "Invalid or missing extcon\n"); + return PTR_ERR(tcphy->extcon); + } ++ } else { ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_sync(tcphy->extcon, EXTCON_USB); ++ extcon_sync(tcphy->extcon, EXTCON_USB_HOST); ++ extcon_sync(tcphy->extcon, EXTCON_DISP_DP); + } + + pm_runtime_enable(dev); +diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c +index 59e0218a8bc5..5b046eb1fad7 100644 +--- a/drivers/usb/typec/altmodes/displayport.c ++++ b/drivers/usb/typec/altmodes/displayport.c +@@ -9,6 +9,8 @@ + */ + + #include ++#include ++#include + #include + #include + #include +@@ -69,6 +71,8 @@ struct dp_altmode { + struct fwnode_handle *connector_fwnode; + }; + ++void dp_altmode_update_extcon(struct dp_altmode *dp, bool disconnect); ++ + static int dp_altmode_notify(struct dp_altmode *dp) + { + unsigned long conf; +@@ -77,7 +81,9 @@ static int dp_altmode_notify(struct dp_altmode *dp) + if (dp->data.conf) { + state = get_count_order(DP_CONF_GET_PIN_ASSIGN(dp->data.conf)); + conf = TYPEC_MODAL_STATE(state); ++ dp_altmode_update_extcon(dp, false); + } else { ++ dp_altmode_update_extcon(dp, true); + conf = TYPEC_STATE_USB; + } + +@@ -163,6 +169,40 @@ static int dp_altmode_status_update(struct dp_altmode *dp) + return ret; + } + ++void dp_altmode_update_extcon(struct dp_altmode *dp, bool disconnect) { ++ const struct device *dev = &dp->port->dev; ++ struct extcon_dev* edev = NULL; ++ ++ while (dev) { ++ edev = extcon_find_edev_by_node(dev->of_node); ++ if(!IS_ERR(edev)) { ++ break; ++ } ++ dev = dev->parent; ++ } ++ ++ if (IS_ERR_OR_NULL(edev)) { ++ return; ++ } ++ ++ if (disconnect || !dp->data.conf) { ++ extcon_set_state_sync(edev, EXTCON_DISP_DP, false); ++ } else { ++ union extcon_property_value extcon_true = { .intval = true }; ++ extcon_set_state(edev, EXTCON_DISP_DP, true); ++ if (DP_CONF_GET_PIN_ASSIGN(dp->data.conf) & DP_PIN_ASSIGN_MULTI_FUNC_MASK) { ++ extcon_set_state_sync(edev, EXTCON_USB_HOST, true); ++ extcon_set_property(edev, EXTCON_DISP_DP, EXTCON_PROP_USB_SS, ++ extcon_true); ++ } else { ++ extcon_set_state_sync(edev, EXTCON_USB_HOST, false); ++ } ++ extcon_sync(edev, EXTCON_DISP_DP); ++ extcon_set_state_sync(edev, EXTCON_USB, false); ++ } ++ ++} ++ + static int dp_altmode_configured(struct dp_altmode *dp) + { + sysfs_notify(&dp->alt->dev.kobj, "displayport", "configuration"); +@@ -242,6 +282,8 @@ static void dp_altmode_work(struct work_struct *work) + case DP_STATE_EXIT: + if (typec_altmode_exit(dp->alt)) + dev_err(&dp->alt->dev, "Exit Mode Failed!\n"); ++ else ++ dp_altmode_update_extcon(dp, true); + break; + default: + break; +@@ -579,8 +621,14 @@ int dp_altmode_probe(struct typec_altmode *alt) + if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) & + DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) && + !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) & +- DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) +- return -ENODEV; ++ DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) { ++ dev_err(&alt->dev, "No compatible pin configuration found:"\ ++ "%04lx -> %04lx, %04lx <- %04lx", ++ DP_CAP_PIN_ASSIGN_DFP_D(port->vdo), DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo), ++ DP_CAP_PIN_ASSIGN_UFP_D(port->vdo), DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)); ++ return -ENODEV; ++ } ++ + + ret = sysfs_create_group(&alt->dev.kobj, &dp_altmode_group); + if (ret) +diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c +index d962f67c95ae..5ac809870867 100644 +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -552,6 +552,12 @@ struct tcpm_port { + */ + unsigned int message_id_prime; + unsigned int rx_msgid_prime; ++ ++#ifdef CONFIG_EXTCON ++ struct extcon_dev *extcon; ++ unsigned int *extcon_cables; ++#endif ++ + #ifdef CONFIG_DEBUG_FS + struct dentry *dentry; + struct mutex logbuffer_lock; /* log buffer access lock */ +@@ -879,6 +886,35 @@ static void tcpm_ams_finish(struct tcpm_port *port) + port->ams = NONE_AMS; + } + ++static void tcpm_update_extcon_data(struct tcpm_port *port, bool attached) { ++#ifdef CONFIG_EXTCON ++ unsigned int *capability = port->extcon_cables; ++ if (port->data_role == TYPEC_HOST) { ++ extcon_set_state(port->extcon, EXTCON_USB, false); ++ extcon_set_state(port->extcon, EXTCON_USB_HOST, attached); ++ } else { ++ extcon_set_state(port->extcon, EXTCON_USB, true); ++ extcon_set_state(port->extcon, EXTCON_USB_HOST, attached); ++ } ++ while (*capability != EXTCON_NONE) { ++ if (attached) { ++ union extcon_property_value val; ++ val.intval = (port->polarity == TYPEC_POLARITY_CC2); ++ extcon_set_property(port->extcon, *capability, ++ EXTCON_PROP_USB_TYPEC_POLARITY, val); ++ } else { ++ extcon_set_state(port->extcon, *capability, false); ++ } ++ extcon_sync(port->extcon, *capability); ++ capability++; ++ } ++ tcpm_log(port, "Extcon update (%s): %s, %s", ++ attached ? "attached" : "detached", ++ port->data_role == TYPEC_HOST ? "host" : "device", ++ port->polarity == TYPEC_POLARITY_CC1 ? "normal" : "flipped"); ++#endif ++} ++ + static int tcpm_pd_transmit(struct tcpm_port *port, + enum tcpm_transmit_type type, + const struct pd_message *msg) +@@ -1091,6 +1127,8 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached, + typec_set_data_role(port->typec_port, data); + typec_set_pwr_role(port->typec_port, role); + ++ tcpm_update_extcon_data(port, attached); ++ + return 0; + } + +@@ -1562,7 +1600,7 @@ static void svdm_consume_modes(struct tcpm_port *port, const u32 *p, int cnt) + paltmode->mode = i; + paltmode->vdo = p[i]; + +- tcpm_log(port, " Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x", ++ tcpm_log(port, "Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x", + pmdata->altmodes, paltmode->svid, + paltmode->mode, paltmode->vdo); + +@@ -1583,6 +1621,8 @@ static void tcpm_register_partner_altmodes(struct tcpm_port *port) + tcpm_log(port, "Failed to register partner SVID 0x%04x", + modep->altmode_desc[i].svid); + altmode = NULL; ++ } else { ++ tcpm_log(port, "Registered altmode 0x%04x", modep->altmode_desc[i].svid); + } + port->partner_altmode[i] = altmode; + } +@@ -2167,11 +2173,13 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, + modep->svid_index++; + if (modep->svid_index < modep->nsvids) { + u16 svid = modep->svids[modep->svid_index]; ++ tcpm_log(port, "More modes available, sending discover"); + *response_tx_sop_type = TCPC_TX_SOP; + response[0] = VDO(svid, 1, svdm_version, + CMD_DISCOVER_MODES); + rlen = 1; + } else if (tcpm_cable_vdm_supported(port)) { ++ tcpm_log(port, "Got all patner modes, registering"); + *response_tx_sop_type = TCPC_TX_SOP_PRIME; + response[0] = VDO(USB_SID_PD, 1, + typec_get_cable_svdm_version(typec), +@@ -3650,8 +3692,9 @@ static int tcpm_src_attach(struct tcpm_port *port) + static void tcpm_typec_disconnect(struct tcpm_port *port) + { + if (port->connected) { + if (port->partner) { ++ tcpm_update_extcon_data(port, false); + typec_partner_set_usb_power_delivery(port->partner, NULL); + typec_unregister_partner(port->partner); + port->partner = NULL; + } +@@ -3739,6 +3782,8 @@ static void tcpm_detach(struct tcpm_port *port) + } + + tcpm_reset_port(port); ++ ++ tcpm_update_extcon_data(port, false); + } + + static void tcpm_src_detach(struct tcpm_port *port) +@@ -6258,6 +6303,64 @@ static int tcpm_port_register_pd(struct tcpm_port *port) + return ret; + } + ++unsigned int default_supported_cables[] = { ++ EXTCON_NONE ++}; ++ ++static int tcpm_fw_get_caps_late(struct tcpm_port *port, ++ struct fwnode_handle *fwnode) ++{ ++ int ret, i; ++ ret = fwnode_property_count_u32(fwnode, "typec-altmodes"); ++ if (ret > 0) { ++ u32 *props; ++ if (ret % 4) { ++ dev_err(port->dev, "Length of typec altmode array must be divisible by 4"); ++ return -EINVAL; ++ } ++ ++ props = devm_kzalloc(port->dev, sizeof(u32) * ret, GFP_KERNEL); ++ if (!props) { ++ dev_err(port->dev, "Failed to allocate memory for altmode properties"); ++ return -ENOMEM; ++ } ++ ++ if(fwnode_property_read_u32_array(fwnode, "typec-altmodes", props, ret) < 0) { ++ dev_err(port->dev, "Failed to read altmodes from port"); ++ return -EINVAL; ++ } ++ ++ i = 0; ++ while (ret > 0 && i < ARRAY_SIZE(port->port_altmode)) { ++ struct typec_altmode *alt; ++ struct typec_altmode_desc alt_desc = { ++ .svid = props[i * 4], ++ .mode = props[i * 4 + 1], ++ .vdo = props[i * 4 + 2], ++ .roles = props[i * 4 + 3], ++ }; ++ ++ ++ tcpm_log(port, "Adding altmode SVID: 0x%04x, mode: %d, vdo: %u, role: %d", ++ alt_desc.svid, alt_desc.mode, alt_desc.vdo, alt_desc.roles); ++ alt = typec_port_register_altmode(port->typec_port, ++ &alt_desc); ++ if (IS_ERR(alt)) { ++ tcpm_log(port, ++ "%s: failed to register port alternate mode 0x%x", ++ dev_name(port->dev), alt_desc.svid); ++ break; ++ } ++ typec_altmode_set_drvdata(alt, port); ++ alt->ops = &tcpm_altmode_ops; ++ port->port_altmode[i] = alt; ++ i++; ++ ret -= 4; ++ } ++ } ++ return 0; ++} ++ + static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode) + { + struct fwnode_handle *capabilities, *child, *caps = NULL; +@@ -6119,6 +6222,23 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, + if (!fwnode) + return -EINVAL; + ++#ifdef CONFIG_EXTCON ++ ret = fwnode_property_count_u32(fwnode, "extcon-cables"); ++ if (ret > 0) { ++ port->extcon_cables = devm_kzalloc(port->dev, sizeof(u32) * ret, GFP_KERNEL); ++ if (!port->extcon_cables) { ++ dev_err(port->dev, "Failed to allocate memory for extcon cable types. "\ ++ "Using default tyes"); ++ goto extcon_default; ++ } ++ fwnode_property_read_u32_array(fwnode, "extcon-cables", port->extcon_cables, ret); ++ } else { ++extcon_default: ++ dev_info(port->dev, "No cable types defined, using default cables"); ++ port->extcon_cables = default_supported_cables; ++ } ++#endif ++ + /* + * This fwnode has a "compatible" property, but is never populated as a + * struct device. Instead we simply parse it to read the properties. +@@ -6571,6 +6691,17 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) + goto out_destroy_wq; + + port->try_role = port->typec_caps.prefer_role; ++#ifdef CONFIG_EXTCON ++ port->extcon = devm_extcon_dev_allocate(dev, port->extcon_cables); ++ if (IS_ERR(port->extcon)) { ++ dev_err(dev, "Failed to allocate extcon device: %ld", PTR_ERR(port->extcon)); ++ goto out_destroy_wq; ++ } ++ if((err = devm_extcon_dev_register(dev, port->extcon))) { ++ dev_err(dev, "Failed to register extcon device: %d", err); ++ goto out_destroy_wq; ++ } ++#endif + + port->typec_caps.fwnode = tcpc->fwnode; + port->typec_caps.revision = 0x0120; /* Type-C spec release 1.2 */ +@@ -6613,6 +6744,12 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) + port->port_altmode, ALTMODE_DISCOVERY_MAX); + port->registered = true; + ++ err = tcpm_fw_get_caps_late(port, tcpc->fwnode); ++ if (err < 0) { ++ dev_err(dev, "Failed to get altmodes from fwnode"); ++ goto out_destroy_wq; ++ } ++ + mutex_lock(&port->lock); + tcpm_init(port); + mutex_unlock(&port->lock); +-- +Armbian + + diff --git a/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch new file mode 100644 index 000000000000..41758a620fbd --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-sdmmc0-fix.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: krachlatte +Date: Wed, 17 May 2023 00:55:30 +0200 +Subject: [ARCHEOLOGY] Improve SD card compatibility on Radxa E25 (#5165) + +> X-Git-Archeology: - Revision 45c85878613108c238e491aa69650fcad1fba4bb: https://github.com/armbian/build/commit/45c85878613108c238e491aa69650fcad1fba4bb +> X-Git-Archeology: Date: Wed, 17 May 2023 00:55:30 +0200 +> X-Git-Archeology: From: krachlatte +> X-Git-Archeology: Subject: Improve SD card compatibility on Radxa E25 (#5165) +> X-Git-Archeology: +> X-Git-Archeology: - Revision f6a0c53d08f53aadd0588a571662dc199232825b: https://github.com/armbian/build/commit/f6a0c53d08f53aadd0588a571662dc199232825b +> X-Git-Archeology: Date: Wed, 24 May 2023 10:39:21 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: manual e25 patch fix +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +index 72ad74c38a2b..5751dc7e2ebc 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +@@ -194,7 +194,7 @@ &sdmmc0 { + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>; +- sd-uhs-sdr104; ++ sd-uhs-sdr50; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch new file mode 100644 index 000000000000..afd5918a0b7e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-radxa-e25-usb3-and-emmc-fix.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: krachlatte +Date: Wed, 17 May 2023 00:55:30 +0200 +Subject: [ARCHEOLOGY] Improve SD card compatibility on Radxa E25 (#5165) + +> X-Git-Archeology: - Revision 45c85878613108c238e491aa69650fcad1fba4bb: https://github.com/armbian/build/commit/45c85878613108c238e491aa69650fcad1fba4bb +> X-Git-Archeology: Date: Wed, 17 May 2023 00:55:30 +0200 +> X-Git-Archeology: From: krachlatte +> X-Git-Archeology: Subject: Improve SD card compatibility on Radxa E25 (#5165) +> X-Git-Archeology: +> X-Git-Archeology: - Revision f6a0c53d08f53aadd0588a571662dc199232825b: https://github.com/armbian/build/commit/f6a0c53d08f53aadd0588a571662dc199232825b +> X-Git-Archeology: Date: Wed, 24 May 2023 10:39:21 +0200 +> X-Git-Archeology: From: Ricardo Pardini +> X-Git-Archeology: Subject: manual e25 patch fix +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi | 12 ++++++++++ + arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts | 2 ++ + 2 files changed, 14 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi b/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi +index 45b03dcbbad4..ffae714d56dc 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3568-radxa-cm3i.dtsi +@@ -389,6 +389,17 @@ &sdhci { + status = "okay"; + }; + ++&sfc { ++ status = "okay"; ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <108000000>; ++ spi-rx-bus-width = <2>; ++ spi-tx-bus-width = <2>; ++ }; ++}; ++ + &tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; +@@ -409,4 +420,5 @@ &usb2phy1 { + + &usb_host0_xhci { + extcon = <&usb2phy0>; ++ dr_mode = "host"; + }; +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +index 5751dc7e2ebc..7d7d00adf10a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +@@ -209,6 +209,8 @@ &usb_host0_ohci { + }; + + &usb_host0_xhci { ++ extcon = <&usb2phy0>; ++ dr_mode = "host"; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch new file mode 100644 index 000000000000..658c3e15ce3e --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-enable-dmc.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 12 Oct 2021 18:31:28 +0000 +Subject: enable roc-cc dmc + +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 38 ++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +index 5d5d9574088c..be5d064d6a93 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +@@ -4,6 +4,7 @@ + */ + + /dts-v1/; ++#include "rk3328-dram-renegade-timing.dtsi" + #include "rk3328.dtsi" + + / { +@@ -19,6 +20,32 @@ chosen { + stdout-path = "serial2:1500000n8"; + }; + ++ /delete-node/ dmc-opp-table; ++ dmc_opp_table: dmc-opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 12000000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 12000000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 12000000>; ++ }; ++ opp-924000000 { ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 12000000>; ++ }; ++ opp-1068000000 { ++ opp-hz = /bits/ 64 <1068000000>; ++ opp-microvolt = <1175000 1175000 12000000>; ++ }; ++ }; ++ + gmac_clkin: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; +@@ -115,6 +142,17 @@ &codec { + status = "okay"; + }; + ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; ++}; ++ ++ + &cpu0 { + cpu-supply = <&vdd_arm>; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch new file mode 100644 index 000000000000..71b23c423c80 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-cc-dts-ram-profile.patch @@ -0,0 +1,330 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Wed, 7 Oct 2020 23:39:54 -0400 +Subject: board-rk3328-roc-cc-adjust-DMC-opps + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi | 311 ++++++++++ + 1 file changed, 311 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi +new file mode 100644 +index 000000000000..303428153094 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-dram-renegade-timing.dtsi +@@ -0,0 +1,311 @@ ++/* ++ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Or, alternatively, ++ * ++ * b) Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation ++ * files (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, ++ * copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following ++ * conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++#include ++#include ++ ++/ { ++ ddr_timing: ddr_timing { ++ compatible = "rockchip,ddr-timing"; ++ ddr3_speed_bin = ; ++ ddr4_speed_bin = ; ++ pd_idle = <0>; ++ sr_idle = <0>; ++ sr_mc_gate_idle = <0>; ++ srpd_lite_idle = <0>; ++ standby_idle = <0>; ++ ++ auto_pd_dis_freq = <1066>; ++ auto_sr_dis_freq = <800>; ++ ddr3_dll_dis_freq = <300>; ++ ddr4_dll_dis_freq = <625>; ++ phy_dll_dis_freq = <400>; ++ ++ ddr3_odt_dis_freq = <100>; ++ phy_ddr3_odt_dis_freq = <100>; ++ ddr3_drv = ; ++ ddr3_odt = ; ++ phy_ddr3_ca_drv = ; ++ phy_ddr3_ck_drv = ; ++ phy_ddr3_dq_drv = ; ++ phy_ddr3_odt = ; ++ ++ lpddr3_odt_dis_freq = <666>; ++ phy_lpddr3_odt_dis_freq = <666>; ++ lpddr3_drv = ; ++ lpddr3_odt = ; ++ phy_lpddr3_ca_drv = ; ++ phy_lpddr3_ck_drv = ; ++ phy_lpddr3_dq_drv = ; ++ phy_lpddr3_odt = ; ++ ++ lpddr4_odt_dis_freq = <800>; ++ phy_lpddr4_odt_dis_freq = <800>; ++ lpddr4_drv = ; ++ lpddr4_dq_odt = ; ++ lpddr4_ca_odt = ; ++ phy_lpddr4_ca_drv = ; ++ phy_lpddr4_ck_cs_drv = ; ++ phy_lpddr4_dq_drv = ; ++ phy_lpddr4_odt = ; ++ ++ ddr4_odt_dis_freq = <666>; ++ phy_ddr4_odt_dis_freq = <666>; ++ ddr4_drv = ; ++ ddr4_odt = ; ++ phy_ddr4_ca_drv = ; ++ phy_ddr4_ck_drv = ; ++ phy_ddr4_dq_drv = ; ++ phy_ddr4_odt = ; ++ ++ /* CA de-skew, one step is 47.8ps, range 0-15 */ ++ ddr3a1_ddr4a9_de-skew = <0>; ++ ddr3a0_ddr4a10_de-skew = <0>; ++ ddr3a3_ddr4a6_de-skew = <1>; ++ ddr3a2_ddr4a4_de-skew = <1>; ++ ddr3a5_ddr4a8_de-skew = <0>; ++ ddr3a4_ddr4a5_de-skew = <2>; ++ ddr3a7_ddr4a11_de-skew = <0>; ++ ddr3a6_ddr4a7_de-skew = <2>; ++ ddr3a9_ddr4a0_de-skew = <1>; ++ ddr3a8_ddr4a13_de-skew = <0>; ++ ddr3a11_ddr4a3_de-skew = <2>; ++ ddr3a10_ddr4cs0_de-skew = <0>; ++ ddr3a13_ddr4a2_de-skew = <1>; ++ ddr3a12_ddr4ba1_de-skew = <0>; ++ ddr3a15_ddr4odt0_de-skew = <0>; ++ ddr3a14_ddr4a1_de-skew = <1>; ++ ddr3ba1_ddr4a15_de-skew = <0>; ++ ddr3ba0_ddr4bg0_de-skew = <0>; ++ ddr3ras_ddr4cke_de-skew = <0>; ++ ddr3ba2_ddr4ba0_de-skew = <1>; ++ ddr3we_ddr4bg1_de-skew = <1>; ++ ddr3cas_ddr4a12_de-skew = <0>; ++ ddr3ckn_ddr4ckn_de-skew = <5>; ++ ddr3ckp_ddr4ckp_de-skew = <5>; ++ ddr3cke_ddr4a16_de-skew = <1>; ++ ddr3odt0_ddr4a14_de-skew = <0>; ++ ddr3cs0_ddr4act_de-skew = <1>; ++ ddr3reset_ddr4reset_de-skew = <0>; ++ ddr3cs1_ddr4cs1_de-skew = <0>; ++ ddr3odt1_ddr4odt1_de-skew = <0>; ++ ++ /* DATA de-skew ++ * RX one step is 25.1ps, range 0-15 ++ * TX one step is 47.8ps, range 0-15 ++ */ ++ cs0_dm0_rx_de-skew = <7>; ++ cs0_dm0_tx_de-skew = <8>; ++ cs0_dq0_rx_de-skew = <7>; ++ cs0_dq0_tx_de-skew = <8>; ++ cs0_dq1_rx_de-skew = <7>; ++ cs0_dq1_tx_de-skew = <8>; ++ cs0_dq2_rx_de-skew = <7>; ++ cs0_dq2_tx_de-skew = <8>; ++ cs0_dq3_rx_de-skew = <7>; ++ cs0_dq3_tx_de-skew = <8>; ++ cs0_dq4_rx_de-skew = <7>; ++ cs0_dq4_tx_de-skew = <8>; ++ cs0_dq5_rx_de-skew = <7>; ++ cs0_dq5_tx_de-skew = <8>; ++ cs0_dq6_rx_de-skew = <7>; ++ cs0_dq6_tx_de-skew = <8>; ++ cs0_dq7_rx_de-skew = <7>; ++ cs0_dq7_tx_de-skew = <8>; ++ cs0_dqs0_rx_de-skew = <6>; ++ cs0_dqs0p_tx_de-skew = <9>; ++ cs0_dqs0n_tx_de-skew = <9>; ++ ++ cs0_dm1_rx_de-skew = <7>; ++ cs0_dm1_tx_de-skew = <7>; ++ cs0_dq8_rx_de-skew = <7>; ++ cs0_dq8_tx_de-skew = <8>; ++ cs0_dq9_rx_de-skew = <7>; ++ cs0_dq9_tx_de-skew = <7>; ++ cs0_dq10_rx_de-skew = <7>; ++ cs0_dq10_tx_de-skew = <8>; ++ cs0_dq11_rx_de-skew = <7>; ++ cs0_dq11_tx_de-skew = <7>; ++ cs0_dq12_rx_de-skew = <7>; ++ cs0_dq12_tx_de-skew = <8>; ++ cs0_dq13_rx_de-skew = <7>; ++ cs0_dq13_tx_de-skew = <7>; ++ cs0_dq14_rx_de-skew = <7>; ++ cs0_dq14_tx_de-skew = <8>; ++ cs0_dq15_rx_de-skew = <7>; ++ cs0_dq15_tx_de-skew = <7>; ++ cs0_dqs1_rx_de-skew = <7>; ++ cs0_dqs1p_tx_de-skew = <9>; ++ cs0_dqs1n_tx_de-skew = <9>; ++ ++ cs0_dm2_rx_de-skew = <7>; ++ cs0_dm2_tx_de-skew = <8>; ++ cs0_dq16_rx_de-skew = <7>; ++ cs0_dq16_tx_de-skew = <8>; ++ cs0_dq17_rx_de-skew = <7>; ++ cs0_dq17_tx_de-skew = <8>; ++ cs0_dq18_rx_de-skew = <7>; ++ cs0_dq18_tx_de-skew = <8>; ++ cs0_dq19_rx_de-skew = <7>; ++ cs0_dq19_tx_de-skew = <8>; ++ cs0_dq20_rx_de-skew = <7>; ++ cs0_dq20_tx_de-skew = <8>; ++ cs0_dq21_rx_de-skew = <7>; ++ cs0_dq21_tx_de-skew = <8>; ++ cs0_dq22_rx_de-skew = <7>; ++ cs0_dq22_tx_de-skew = <8>; ++ cs0_dq23_rx_de-skew = <7>; ++ cs0_dq23_tx_de-skew = <8>; ++ cs0_dqs2_rx_de-skew = <6>; ++ cs0_dqs2p_tx_de-skew = <9>; ++ cs0_dqs2n_tx_de-skew = <9>; ++ ++ cs0_dm3_rx_de-skew = <7>; ++ cs0_dm3_tx_de-skew = <7>; ++ cs0_dq24_rx_de-skew = <7>; ++ cs0_dq24_tx_de-skew = <8>; ++ cs0_dq25_rx_de-skew = <7>; ++ cs0_dq25_tx_de-skew = <7>; ++ cs0_dq26_rx_de-skew = <7>; ++ cs0_dq26_tx_de-skew = <7>; ++ cs0_dq27_rx_de-skew = <7>; ++ cs0_dq27_tx_de-skew = <7>; ++ cs0_dq28_rx_de-skew = <7>; ++ cs0_dq28_tx_de-skew = <7>; ++ cs0_dq29_rx_de-skew = <7>; ++ cs0_dq29_tx_de-skew = <7>; ++ cs0_dq30_rx_de-skew = <7>; ++ cs0_dq30_tx_de-skew = <7>; ++ cs0_dq31_rx_de-skew = <7>; ++ cs0_dq31_tx_de-skew = <7>; ++ cs0_dqs3_rx_de-skew = <7>; ++ cs0_dqs3p_tx_de-skew = <9>; ++ cs0_dqs3n_tx_de-skew = <9>; ++ ++ cs1_dm0_rx_de-skew = <7>; ++ cs1_dm0_tx_de-skew = <8>; ++ cs1_dq0_rx_de-skew = <7>; ++ cs1_dq0_tx_de-skew = <8>; ++ cs1_dq1_rx_de-skew = <7>; ++ cs1_dq1_tx_de-skew = <8>; ++ cs1_dq2_rx_de-skew = <7>; ++ cs1_dq2_tx_de-skew = <8>; ++ cs1_dq3_rx_de-skew = <7>; ++ cs1_dq3_tx_de-skew = <8>; ++ cs1_dq4_rx_de-skew = <7>; ++ cs1_dq4_tx_de-skew = <8>; ++ cs1_dq5_rx_de-skew = <7>; ++ cs1_dq5_tx_de-skew = <8>; ++ cs1_dq6_rx_de-skew = <7>; ++ cs1_dq6_tx_de-skew = <8>; ++ cs1_dq7_rx_de-skew = <7>; ++ cs1_dq7_tx_de-skew = <8>; ++ cs1_dqs0_rx_de-skew = <6>; ++ cs1_dqs0p_tx_de-skew = <9>; ++ cs1_dqs0n_tx_de-skew = <9>; ++ ++ cs1_dm1_rx_de-skew = <7>; ++ cs1_dm1_tx_de-skew = <7>; ++ cs1_dq8_rx_de-skew = <7>; ++ cs1_dq8_tx_de-skew = <8>; ++ cs1_dq9_rx_de-skew = <7>; ++ cs1_dq9_tx_de-skew = <7>; ++ cs1_dq10_rx_de-skew = <7>; ++ cs1_dq10_tx_de-skew = <8>; ++ cs1_dq11_rx_de-skew = <7>; ++ cs1_dq11_tx_de-skew = <7>; ++ cs1_dq12_rx_de-skew = <7>; ++ cs1_dq12_tx_de-skew = <8>; ++ cs1_dq13_rx_de-skew = <7>; ++ cs1_dq13_tx_de-skew = <7>; ++ cs1_dq14_rx_de-skew = <7>; ++ cs1_dq14_tx_de-skew = <8>; ++ cs1_dq15_rx_de-skew = <7>; ++ cs1_dq15_tx_de-skew = <7>; ++ cs1_dqs1_rx_de-skew = <7>; ++ cs1_dqs1p_tx_de-skew = <9>; ++ cs1_dqs1n_tx_de-skew = <9>; ++ ++ cs1_dm2_rx_de-skew = <7>; ++ cs1_dm2_tx_de-skew = <8>; ++ cs1_dq16_rx_de-skew = <7>; ++ cs1_dq16_tx_de-skew = <8>; ++ cs1_dq17_rx_de-skew = <7>; ++ cs1_dq17_tx_de-skew = <8>; ++ cs1_dq18_rx_de-skew = <7>; ++ cs1_dq18_tx_de-skew = <8>; ++ cs1_dq19_rx_de-skew = <7>; ++ cs1_dq19_tx_de-skew = <8>; ++ cs1_dq20_rx_de-skew = <7>; ++ cs1_dq20_tx_de-skew = <8>; ++ cs1_dq21_rx_de-skew = <7>; ++ cs1_dq21_tx_de-skew = <8>; ++ cs1_dq22_rx_de-skew = <7>; ++ cs1_dq22_tx_de-skew = <8>; ++ cs1_dq23_rx_de-skew = <7>; ++ cs1_dq23_tx_de-skew = <8>; ++ cs1_dqs2_rx_de-skew = <6>; ++ cs1_dqs2p_tx_de-skew = <9>; ++ cs1_dqs2n_tx_de-skew = <9>; ++ ++ cs1_dm3_rx_de-skew = <7>; ++ cs1_dm3_tx_de-skew = <7>; ++ cs1_dq24_rx_de-skew = <7>; ++ cs1_dq24_tx_de-skew = <8>; ++ cs1_dq25_rx_de-skew = <7>; ++ cs1_dq25_tx_de-skew = <7>; ++ cs1_dq26_rx_de-skew = <7>; ++ cs1_dq26_tx_de-skew = <7>; ++ cs1_dq27_rx_de-skew = <7>; ++ cs1_dq27_tx_de-skew = <7>; ++ cs1_dq28_rx_de-skew = <7>; ++ cs1_dq28_tx_de-skew = <7>; ++ cs1_dq29_rx_de-skew = <7>; ++ cs1_dq29_tx_de-skew = <7>; ++ cs1_dq30_rx_de-skew = <7>; ++ cs1_dq30_tx_de-skew = <7>; ++ cs1_dq31_rx_de-skew = <7>; ++ cs1_dq31_tx_de-skew = <7>; ++ cs1_dqs3_rx_de-skew = <7>; ++ cs1_dqs3p_tx_de-skew = <9>; ++ cs1_dqs3n_tx_de-skew = <9>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch new file mode 100644 index 000000000000..872a1574beec --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc-dts-ram-profile.patch @@ -0,0 +1,301 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony +Date: Thu, 8 Oct 2020 01:56:28 -0400 +Subject: [ARCHEOLOGY] Add files via upload + +> X-Git-Archeology: - Revision 8fc20a15b12561e76e92d5bd29b5afd1c62f08ac: https://github.com/armbian/build/commit/8fc20a15b12561e76e92d5bd29b5afd1c62f08ac +> X-Git-Archeology: Date: Thu, 08 Oct 2020 01:56:28 -0400 +> X-Git-Archeology: From: Tony +> X-Git-Archeology: Subject: Add files via upload +> X-Git-Archeology: +> X-Git-Archeology: - Revision 2788adccedc25f12fc9e71e01a92863d97683979: https://github.com/armbian/build/commit/2788adccedc25f12fc9e71e01a92863d97683979 +> X-Git-Archeology: Date: Tue, 26 Jan 2021 21:22:04 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Enable DMC for Station M1 in current and dev (#2575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi | 223 ++++++++++ + 1 file changed, 223 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi +new file mode 100644 +index 000000000000..8b2077d086f5 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc-dram-timing.dtsi +@@ -0,0 +1,223 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ */ ++#include ++#include ++ ++/ { ++ ddr_timing: ddr_timing { ++ /* CA de-skew, one step is 47.8ps, range 0-15 */ ++ ddr3a1_ddr4a9_de-skew = <0>; ++ ddr3a0_ddr4a10_de-skew = <0>; ++ ddr3a3_ddr4a6_de-skew = <1>; ++ ddr3a2_ddr4a4_de-skew = <1>; ++ ddr3a5_ddr4a8_de-skew = <0>; ++ ddr3a4_ddr4a5_de-skew = <2>; ++ ddr3a7_ddr4a11_de-skew = <0>; ++ ddr3a6_ddr4a7_de-skew = <2>; ++ ddr3a9_ddr4a0_de-skew = <1>; ++ ddr3a8_ddr4a13_de-skew = <0>; ++ ddr3a11_ddr4a3_de-skew = <2>; ++ ddr3a10_ddr4cs0_de-skew = <0>; ++ ddr3a13_ddr4a2_de-skew = <1>; ++ ddr3a12_ddr4ba1_de-skew = <0>; ++ ddr3a15_ddr4odt0_de-skew = <0>; ++ ddr3a14_ddr4a1_de-skew = <1>; ++ ddr3ba1_ddr4a15_de-skew = <0>; ++ ddr3ba0_ddr4bg0_de-skew = <0>; ++ ddr3ras_ddr4cke_de-skew = <0>; ++ ddr3ba2_ddr4ba0_de-skew = <1>; ++ ddr3we_ddr4bg1_de-skew = <1>; ++ ddr3cas_ddr4a12_de-skew = <0>; ++ ddr3ckn_ddr4ckn_de-skew = <5>; ++ ddr3ckp_ddr4ckp_de-skew = <5>; ++ ddr3cke_ddr4a16_de-skew = <1>; ++ ddr3odt0_ddr4a14_de-skew = <0>; ++ ddr3cs0_ddr4act_de-skew = <1>; ++ ddr3reset_ddr4reset_de-skew = <0>; ++ ddr3cs1_ddr4cs1_de-skew = <0>; ++ ddr3odt1_ddr4odt1_de-skew = <0>; ++ ++ /* DATA de-skew ++ * RX one step is 25.1ps, range 0-15 ++ * TX one step is 47.8ps, range 0-15 ++ */ ++ cs0_dm0_rx_de-skew = <7>; ++ cs0_dm0_tx_de-skew = <8>; ++ cs0_dq0_rx_de-skew = <7>; ++ cs0_dq0_tx_de-skew = <8>; ++ cs0_dq1_rx_de-skew = <7>; ++ cs0_dq1_tx_de-skew = <8>; ++ cs0_dq2_rx_de-skew = <7>; ++ cs0_dq2_tx_de-skew = <8>; ++ cs0_dq3_rx_de-skew = <7>; ++ cs0_dq3_tx_de-skew = <8>; ++ cs0_dq4_rx_de-skew = <7>; ++ cs0_dq4_tx_de-skew = <8>; ++ cs0_dq5_rx_de-skew = <7>; ++ cs0_dq5_tx_de-skew = <8>; ++ cs0_dq6_rx_de-skew = <7>; ++ cs0_dq6_tx_de-skew = <8>; ++ cs0_dq7_rx_de-skew = <7>; ++ cs0_dq7_tx_de-skew = <8>; ++ cs0_dqs0_rx_de-skew = <6>; ++ cs0_dqs0p_tx_de-skew = <9>; ++ cs0_dqs0n_tx_de-skew = <9>; ++ ++ cs0_dm1_rx_de-skew = <7>; ++ cs0_dm1_tx_de-skew = <7>; ++ cs0_dq8_rx_de-skew = <7>; ++ cs0_dq8_tx_de-skew = <8>; ++ cs0_dq9_rx_de-skew = <7>; ++ cs0_dq9_tx_de-skew = <7>; ++ cs0_dq10_rx_de-skew = <7>; ++ cs0_dq10_tx_de-skew = <8>; ++ cs0_dq11_rx_de-skew = <7>; ++ cs0_dq11_tx_de-skew = <7>; ++ cs0_dq12_rx_de-skew = <7>; ++ cs0_dq12_tx_de-skew = <8>; ++ cs0_dq13_rx_de-skew = <7>; ++ cs0_dq13_tx_de-skew = <7>; ++ cs0_dq14_rx_de-skew = <7>; ++ cs0_dq14_tx_de-skew = <8>; ++ cs0_dq15_rx_de-skew = <7>; ++ cs0_dq15_tx_de-skew = <7>; ++ cs0_dqs1_rx_de-skew = <7>; ++ cs0_dqs1p_tx_de-skew = <9>; ++ cs0_dqs1n_tx_de-skew = <9>; ++ ++ cs0_dm2_rx_de-skew = <7>; ++ cs0_dm2_tx_de-skew = <8>; ++ cs0_dq16_rx_de-skew = <7>; ++ cs0_dq16_tx_de-skew = <8>; ++ cs0_dq17_rx_de-skew = <7>; ++ cs0_dq17_tx_de-skew = <8>; ++ cs0_dq18_rx_de-skew = <7>; ++ cs0_dq18_tx_de-skew = <8>; ++ cs0_dq19_rx_de-skew = <7>; ++ cs0_dq19_tx_de-skew = <8>; ++ cs0_dq20_rx_de-skew = <7>; ++ cs0_dq20_tx_de-skew = <8>; ++ cs0_dq21_rx_de-skew = <7>; ++ cs0_dq21_tx_de-skew = <8>; ++ cs0_dq22_rx_de-skew = <7>; ++ cs0_dq22_tx_de-skew = <8>; ++ cs0_dq23_rx_de-skew = <7>; ++ cs0_dq23_tx_de-skew = <8>; ++ cs0_dqs2_rx_de-skew = <6>; ++ cs0_dqs2p_tx_de-skew = <9>; ++ cs0_dqs2n_tx_de-skew = <9>; ++ ++ cs0_dm3_rx_de-skew = <7>; ++ cs0_dm3_tx_de-skew = <7>; ++ cs0_dq24_rx_de-skew = <7>; ++ cs0_dq24_tx_de-skew = <8>; ++ cs0_dq25_rx_de-skew = <7>; ++ cs0_dq25_tx_de-skew = <7>; ++ cs0_dq26_rx_de-skew = <7>; ++ cs0_dq26_tx_de-skew = <7>; ++ cs0_dq27_rx_de-skew = <7>; ++ cs0_dq27_tx_de-skew = <7>; ++ cs0_dq28_rx_de-skew = <7>; ++ cs0_dq28_tx_de-skew = <7>; ++ cs0_dq29_rx_de-skew = <7>; ++ cs0_dq29_tx_de-skew = <7>; ++ cs0_dq30_rx_de-skew = <7>; ++ cs0_dq30_tx_de-skew = <7>; ++ cs0_dq31_rx_de-skew = <7>; ++ cs0_dq31_tx_de-skew = <7>; ++ cs0_dqs3_rx_de-skew = <7>; ++ cs0_dqs3p_tx_de-skew = <9>; ++ cs0_dqs3n_tx_de-skew = <9>; ++ ++ cs1_dm0_rx_de-skew = <7>; ++ cs1_dm0_tx_de-skew = <8>; ++ cs1_dq0_rx_de-skew = <7>; ++ cs1_dq0_tx_de-skew = <8>; ++ cs1_dq1_rx_de-skew = <7>; ++ cs1_dq1_tx_de-skew = <8>; ++ cs1_dq2_rx_de-skew = <7>; ++ cs1_dq2_tx_de-skew = <8>; ++ cs1_dq3_rx_de-skew = <7>; ++ cs1_dq3_tx_de-skew = <8>; ++ cs1_dq4_rx_de-skew = <7>; ++ cs1_dq4_tx_de-skew = <8>; ++ cs1_dq5_rx_de-skew = <7>; ++ cs1_dq5_tx_de-skew = <8>; ++ cs1_dq6_rx_de-skew = <7>; ++ cs1_dq6_tx_de-skew = <8>; ++ cs1_dq7_rx_de-skew = <7>; ++ cs1_dq7_tx_de-skew = <8>; ++ cs1_dqs0_rx_de-skew = <6>; ++ cs1_dqs0p_tx_de-skew = <9>; ++ cs1_dqs0n_tx_de-skew = <9>; ++ ++ cs1_dm1_rx_de-skew = <7>; ++ cs1_dm1_tx_de-skew = <7>; ++ cs1_dq8_rx_de-skew = <7>; ++ cs1_dq8_tx_de-skew = <8>; ++ cs1_dq9_rx_de-skew = <7>; ++ cs1_dq9_tx_de-skew = <7>; ++ cs1_dq10_rx_de-skew = <7>; ++ cs1_dq10_tx_de-skew = <8>; ++ cs1_dq11_rx_de-skew = <7>; ++ cs1_dq11_tx_de-skew = <7>; ++ cs1_dq12_rx_de-skew = <7>; ++ cs1_dq12_tx_de-skew = <8>; ++ cs1_dq13_rx_de-skew = <7>; ++ cs1_dq13_tx_de-skew = <7>; ++ cs1_dq14_rx_de-skew = <7>; ++ cs1_dq14_tx_de-skew = <8>; ++ cs1_dq15_rx_de-skew = <7>; ++ cs1_dq15_tx_de-skew = <7>; ++ cs1_dqs1_rx_de-skew = <7>; ++ cs1_dqs1p_tx_de-skew = <9>; ++ cs1_dqs1n_tx_de-skew = <9>; ++ ++ cs1_dm2_rx_de-skew = <7>; ++ cs1_dm2_tx_de-skew = <8>; ++ cs1_dq16_rx_de-skew = <7>; ++ cs1_dq16_tx_de-skew = <8>; ++ cs1_dq17_rx_de-skew = <7>; ++ cs1_dq17_tx_de-skew = <8>; ++ cs1_dq18_rx_de-skew = <7>; ++ cs1_dq18_tx_de-skew = <8>; ++ cs1_dq19_rx_de-skew = <7>; ++ cs1_dq19_tx_de-skew = <8>; ++ cs1_dq20_rx_de-skew = <7>; ++ cs1_dq20_tx_de-skew = <8>; ++ cs1_dq21_rx_de-skew = <7>; ++ cs1_dq21_tx_de-skew = <8>; ++ cs1_dq22_rx_de-skew = <7>; ++ cs1_dq22_tx_de-skew = <8>; ++ cs1_dq23_rx_de-skew = <7>; ++ cs1_dq23_tx_de-skew = <8>; ++ cs1_dqs2_rx_de-skew = <6>; ++ cs1_dqs2p_tx_de-skew = <9>; ++ cs1_dqs2n_tx_de-skew = <9>; ++ ++ cs1_dm3_rx_de-skew = <7>; ++ cs1_dm3_tx_de-skew = <7>; ++ cs1_dq24_rx_de-skew = <7>; ++ cs1_dq24_tx_de-skew = <8>; ++ cs1_dq25_rx_de-skew = <7>; ++ cs1_dq25_tx_de-skew = <7>; ++ cs1_dq26_rx_de-skew = <7>; ++ cs1_dq26_tx_de-skew = <7>; ++ cs1_dq27_rx_de-skew = <7>; ++ cs1_dq27_tx_de-skew = <7>; ++ cs1_dq28_rx_de-skew = <7>; ++ cs1_dq28_tx_de-skew = <7>; ++ cs1_dq29_rx_de-skew = <7>; ++ cs1_dq29_tx_de-skew = <7>; ++ cs1_dq30_rx_de-skew = <7>; ++ cs1_dq30_tx_de-skew = <7>; ++ cs1_dq31_rx_de-skew = <7>; ++ cs1_dq31_tx_de-skew = <7>; ++ cs1_dqs3_rx_de-skew = <7>; ++ cs1_dqs3p_tx_de-skew = <9>; ++ cs1_dqs3n_tx_de-skew = <9>; ++ }; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch new file mode 100644 index 000000000000..43892ae48fb7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rk3328-roc-pc.patch @@ -0,0 +1,593 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Tue, 12 Oct 2021 19:34:29 +0000 +Subject: enable dmc for rk3328-roc-pc + +--- + arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts | 525 ++++++++-- + 1 file changed, 466 insertions(+), 59 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts +index e3e3984d01d4..02047f049822 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-pc.dts +@@ -1,110 +1,517 @@ +-// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +-// Copyright (c) 2021 T-Chip Intelligent Technology Co., Ltd ++/* ++ * SPDX-License-Identifier: (GPL-2.0+ or MIT) ++ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd ++ */ + + /dts-v1/; +- ++#include "rk3328-roc-pc-dram-timing.dtsi" ++#include "rk3328.dtsi" + #include + +-#include "rk3328-roc-cc.dts" +- + / { +- model = "Firefly ROC-RK3328-PC"; ++ model = "Firefly roc-rk3328-pc"; + compatible = "firefly,roc-rk3328-pc", "rockchip,rk3328"; + +- adc-keys { +- compatible = "adc-keys"; +- io-channels = <&saradc 0>; +- io-channel-names = "buttons"; +- keyup-threshold-microvolt = <1750000>; ++ aliases { ++ mmc0 = &sdmmc; ++ mmc1 = &emmc; /* MMC boot device */ ++ }; ++ ++ gmac_clkin: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "gmac_clkin"; ++ #clock-cells = <0>; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "rockchip,rk3328"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; + +- /* This button is unpopulated out of the factory. */ +- button-recovery { +- label = "Recovery"; +- linux,code = ; +- press-threshold-microvolt = <10000>; ++ hdmi-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <128>; ++ simple-audio-card,name = "rockchip,hdmi"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s0>; + }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ vcc_host_5v: vcc-host-5v-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb30_host_drv>; ++ regulator-name = "vcc_host_5v"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; + }; + +- ir-receiver { +- compatible = "gpio-ir-receiver"; +- gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; +- linux,rc-map-name = "rc-khadas"; ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; +- pinctrl-0 = <&ir_int>; ++ pinctrl-0 = <&usb20_host_drv>; ++ regulator-name = "vcc_host1_5v"; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; + }; + +- sdio_pwrseq: sdio-pwrseq { +- compatible = "mmc-pwrseq-simple"; ++ vcc_sd: sdmmc-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; +- pinctrl-0 = <&wifi_en>, <&wifi_host_wake>; +- reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; ++ pinctrl-0 = <&sdmmc0m1_pin>; ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ 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>; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ power_led: led-0 { ++ label = "firefly:blue:power"; ++ linux,default-trigger = "heartbeat"; ++ gpios = <&rk805 1 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ mode = <0x23>; ++ }; ++ ++ user_led: led-1 { ++ label = "firefly:yellow:user"; ++ linux,default-trigger = "mmc1"; ++ gpios = <&rk805 0 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ mode = <0x05>; ++ }; ++ }; ++ ++ /delete-node/ dmc-opp-table; ++ dmc_opp_table: dmc-opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-786000000 { ++ opp-hz = /bits/ 64 <786000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-798000000 { ++ opp-hz = /bits/ 64 <798000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-840000000 { ++ opp-hz = /bits/ 64 <840000000>; ++ opp-microvolt = <1075000 1075000 1200000>; ++ }; ++ opp-924000000 { ++ status = "disabled"; // unstable ++ opp-hz = /bits/ 64 <924000000>; ++ opp-microvolt = <1100000 1100000 1200000>; ++ }; + }; + }; + +-&codec { +- mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; ++&dfi { ++ status = "okay"; ++}; ++ ++&dmc { ++ center-supply = <&vdd_logic>; ++ ddr_timing = <&ddr_timing>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ vccio1-supply = <&vcc_io>; ++ vccio2-supply = <&vcc_18emmc>; ++ vccio3-supply = <&vcc_io>; ++ vccio4-supply = <&vcc_io>; ++ vccio5-supply = <&vcc_io>; ++ vccio6-supply = <&vcc_io>; ++ pmuio-supply = <&vcc_io>; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_arm>; + }; + + &gpu { ++ status = "okay"; + mali-supply = <&vdd_logic>; + }; + +-&pinctrl { +- ir { +- ir_int: ir-int { +- rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++&gmac2phy { ++ phy-supply = <&vcc_phy>; ++ clock_in_out = "output"; ++ assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; ++ assigned-clock-rate = <50000000>; ++ assigned-clocks = <&cru SCLK_MAC2PHY>; ++ assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; ++ status = "disabled"; ++}; ++ ++&gmac2io { ++ phy-supply = <&vcc_io>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; ++ assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmiim1_pins>; ++ snps,aal; ++ snps,rxpbl = <0x4>; ++ snps,txpbl = <0x4>; ++ tx_delay = <0x24>; ++ rx_delay = <0x18>; ++ status = "okay"; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&hdmi { ++ #sound-dai-cells = <0>; ++ ddc-i2c-scl-high-time-ns = <9625>; ++ ddc-i2c-scl-low-time-ns = <10000>; ++ status = "okay"; ++}; ++ ++&hdmiphy { ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++/*&h265e { ++ status = "okay"; ++}; ++ ++&vdec { ++ status = "okay"; ++}; ++ ++&vepu { ++ status = "okay"; ++};*/ ++ ++&vop { ++ status = "okay"; ++}; ++ ++&vop_mmu { ++ status = "okay"; ++}; ++ ++/*&vpu_service { ++ status = "okay"; ++};*/ ++ ++&i2s0 { ++ #sound-dai-cells = <0>; ++ rockchip,bclk-fs = <128>; ++ status = "okay"; ++}; ++ ++&i2s1 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&codec { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&emmc { ++ bus-width = <8>; ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ supports-emmc; ++ disable-wp; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ max-frequency = <150000000>; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; ++ supports-sd; ++ status = "okay"; ++ vmmc-supply = <&vcc_sd>; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ ++ rk805: rk805@18 { ++ compatible = "rockchip,rk805"; ++ status = "okay"; ++ reg = <0x18>; ++ interrupt-parent = <&gpio2>; ++ interrupts = <24 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk805-clkout2"; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc5-supply = <&vcc_io>; ++ vcc6-supply = <&vcc_io>; ++ ++ rtc { ++ status = "okay"; + }; +- }; + +- sdmmcio { +- sdio_per_pin: sdio-per-pin { +- rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_down>; ++ pwrkey { ++ status = "okay"; ++ }; ++ ++ gpio { ++ status = "okay"; ++ }; ++ ++ regulators { ++ compatible = "rk805-regulator"; ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ vdd_logic: DCDC_REG1 { ++ regulator-name = "vdd_logic"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1000000>; ++ }; ++ }; ++ ++ vdd_arm: DCDC_REG2 { ++ regulator-name = "vdd_arm"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1450000>; ++ regulator-ramp-delay = <12500>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <950000>; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_io: DCDC_REG4 { ++ regulator-name = "vcc_io"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vdd_18: LDO_REG1 { ++ regulator-name = "vdd_18"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_18emmc: LDO_REG2 { ++ regulator-name = "vcc_18emmc"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vdd_11: LDO_REG3 { ++ regulator-name = "vdd_11"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1100000>; ++ }; ++ }; + }; + }; ++}; ++ ++&pinctrl { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&clk_32k_out>; + +- wifi { +- wifi_en: wifi-en { +- rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ clk_32k { ++ clk_32k_out: clk-32k-out { ++ rockchip,pins = ++ <1 RK_PD4 1 &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; /* gpio2_a6 */ + }; ++ }; + +- wifi_host_wake: wifi-host-wake { +- rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none_4ma>; ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>, ++ <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none_4ma>, ++ <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>, ++ <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + +- bt_rst: bt-rst { +- rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; ++ usb2 { ++ usb20_host_drv: usb20-host-drv { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + +- bt_en: bt-en { +- rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; ++ usb3 { ++ usb30_host_drv: usb30-host-drv { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + }; + +-&pmic_int_l { +- rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++&u2phy { ++ status = "okay"; + }; + +-&rk805 { +- interrupt-parent = <&gpio0>; +- interrupts = ; ++&u2phy_host { ++ status = "okay"; + }; + +-&saradc { +- vref-supply = <&vcc_18>; ++&u2phy_otg { ++ status = "okay"; ++}; ++ ++&uart2 { + status = "okay"; + }; + +-&usb20_host_drv { +- rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; ++&usb20_otg { ++ dr_mode = "host"; ++ status = "okay"; + }; + +-&vcc_host1_5v { +- gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; ++&usb_host0_ehci { ++ status = "okay"; + }; + +-&vcc_sdio { +- gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sdio_per_pin>; ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&wdt { ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vdd_18>; ++}; ++ ++&tsadc { ++ status = "okay"; ++ rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */ + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch b/patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch new file mode 100644 index 000000000000..84e0169a4d63 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rock3a-emmc-sfc.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Wed, 3 Aug 2022 22:22:55 +0200 +Subject: [ARCHEOLOGY] update rockchip64 edge to 5.19 (#4039) + +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 11 ++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +index e05ab11981f5..37de541cd4a1 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +@@ -753,6 +753,17 @@ &sdmmc2 { + status = "okay"; + }; + ++&sfc { ++ status = "okay"; ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <108000000>; ++ spi-rx-bus-width = <2>; ++ spi-tx-bus-width = <2>; ++ }; ++}; ++ + &tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch b/patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch new file mode 100644 index 000000000000..b5dfe00f774a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rock3a-usb3.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jianfeng Liu +Date: Wed, 3 Aug 2022 22:22:55 +0200 +Subject: [ARCHEOLOGY] update rockchip64 edge to 5.19 (#4039) + +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +index 37de541cd4a1..effcb2ee471f 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts +@@ -805,6 +805,7 @@ &usb_host0_ohci { + + &usb_host0_xhci { + extcon = <&usb2phy0>; ++ dr_mode = "host"; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch b/patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch new file mode 100644 index 000000000000..a108ddef5e55 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rock64-mail-supply.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Sun, 8 Aug 2021 11:49:27 -0400 +Subject: board_rock64_mali-usb-supply + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +index 0a27fa5271f5..1596ce3368f7 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +@@ -135,6 +135,11 @@ &emmc { + status = "okay"; + }; + ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_logic>; ++}; ++ + &gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch new file mode 100644 index 000000000000..6164405eedc8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpi3-enable-dmc.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Wed, 8 Mar 2023 11:12:22 +0100 +Subject: [ARCHEOLOGY] rockchip64: enable dmc on Rock PI E board + +> X-Git-Archeology: - Revision 4ea9330e5185e1c6e248af035cc615d23408316d: https://github.com/armbian/build/commit/4ea9330e5185e1c6e248af035cc615d23408316d +> X-Git-Archeology: Date: Wed, 08 Mar 2023 11:12:22 +0100 +> X-Git-Archeology: From: Paolo Sabatino +> X-Git-Archeology: Subject: rockchip64: enable dmc on Rock PI E board +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +index 018a3a5075c7..9b3453cece85 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts +@@ -15,6 +15,7 @@ + #include + + #include "rk3328.dtsi" ++#include "rk3328-dram-default-timing.dtsi" + + / { + model = "Radxa ROCK Pi E"; +@@ -388,3 +389,9 @@ &usbdrd3 { + &usb_host0_ehci { + status = "okay"; + }; ++ ++&dmc { ++ status = "okay"; ++ center-supply = <&vdd_log>; ++ ddr_timing = <&ddr_timing>; ++}; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch new file mode 100644 index 000000000000..3552a282ba37 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpi4-0003-arm64-dts-pcie.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Mon, 18 Nov 2019 18:23:10 +0100 +Subject: [ARCHEOLOGY] Rock Pi 4 enable PCIe in device tree for "dev" target + (#1624) + +> X-Git-Archeology: > recovered message: > * Rock Pi 4 enabled support for PCIe in device tree +> X-Git-Archeology: > recovered message: > * Rockchip64-dev added possibility to enable PCIe Gen2 speed via overlay +> X-Git-Archeology: - Revision b3bb9345439250d8247f0e24a8e1ef6290b2c279: https://github.com/armbian/build/commit/b3bb9345439250d8247f0e24a8e1ef6290b2c279 +> X-Git-Archeology: Date: Mon, 18 Nov 2019 18:23:10 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Rock Pi 4 enable PCIe in device tree for "dev" target (#1624) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 150ac0c2afa147d9e3b036c8ecd8238fe5648cf3: https://github.com/armbian/build/commit/150ac0c2afa147d9e3b036c8ecd8238fe5648cf3 +> X-Git-Archeology: Date: Tue, 19 Nov 2019 23:25:39 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Remove K<4, change branches, new features (#1586) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 812245def37a695bce9e7ece148b2920d82c8b37: https://github.com/armbian/build/commit/812245def37a695bce9e7ece148b2920d82c8b37 +> X-Git-Archeology: Date: Sat, 18 Jul 2020 23:07:01 +0200 +> X-Git-Archeology: From: Werner +> X-Git-Archeology: Subject: Move rockchip/64 current to 5.7.y (#2099) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dfd5cf9692e97774f7f0bfd72227144e36f58070: https://github.com/armbian/build/commit/dfd5cf9692e97774f7f0bfd72227144e36f58070 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 22:13:03 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Clean up patchset +> X-Git-Archeology: +> X-Git-Archeology: - Revision 091d91468e383c3d12a03a465be36b76112ce798: https://github.com/armbian/build/commit/091d91468e383c3d12a03a465be36b76112ce798 +> X-Git-Archeology: Date: Sun, 17 Jan 2021 19:07:59 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-current to 5.10.y (and synced -dev config/patches) (#2546) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 44c4cdf8653104bc395c504d7611d819906ff69b: https://github.com/armbian/build/commit/44c4cdf8653104bc395c504d7611d819906ff69b +> X-Git-Archeology: Date: Fri, 30 Dec 2022 21:17:33 +0100 +> X-Git-Archeology: From: Konstantin Litvinov +> X-Git-Archeology: Subject: Fixed issue with NVMe identification in rk3399-rock-pi-4.dts (#4627) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 44c95b7b0a64486a85f23c5630842ea1b877a695: https://github.com/armbian/build/commit/44c95b7b0a64486a85f23c5630842ea1b877a695 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:01 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: fix unidiff warning from patches of rockchip64-6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +index f2279aa6ca9e..9d1b2129431c 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +@@ -112,6 +112,8 @@ vcc3v3_pcie: vcc3v3-pcie-regulator { + regulator-name = "vcc3v3_pcie"; + regulator-always-on; + regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + +@@ -528,9 +530,11 @@ &pcie0 { + num-lanes = <4>; + pinctrl-0 = <&pcie_clkreqnb_cpm>; + pinctrl-names = "default"; ++ vpcie12v-supply = <&vcc12v_dcin>; + vpcie0v9-supply = <&vcc_0v9>; + vpcie1v8-supply = <&vcc_1v8>; + vpcie3v3-supply = <&vcc3v3_pcie>; ++ bus-scan-delay-ms = <1500>; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch.disabled b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch.disabled new file mode 100644 index 000000000000..fe2d91d22ffe --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0001-arm64-dts.patch.disabled @@ -0,0 +1,408 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: brentr +Date: Fri, 23 Dec 2022 21:57:53 +0100 +Subject: [ARCHEOLOGY] Rockpis devtree mainlined (#4603) + +> X-Git-Archeology: > recovered message: > * moved rockpro64 patch out of rockpis patch sequence +> X-Git-Archeology: > recovered message: > It had been misnamed +> X-Git-Archeology: > recovered message: > * patch new mainline devtree for Rock Pi-S instead of overwritting it. +> X-Git-Archeology: > recovered message: > Also restores lost bluetooth compatibility items on UART4 +> X-Git-Archeology: - Revision 588c2ec17e709dec19304fa50522459702ebfadd: https://github.com/armbian/build/commit/588c2ec17e709dec19304fa50522459702ebfadd +> X-Git-Archeology: Date: Fri, 23 Dec 2022 21:57:53 +0100 +> X-Git-Archeology: From: brentr +> X-Git-Archeology: Subject: Rockpis devtree mainlined (#4603) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts | 240 +++++++--- + 1 file changed, 164 insertions(+), 76 deletions(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +index e9810d2f0407..0d917658d24a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts +@@ -2,6 +2,7 @@ + /* + * Copyright (c) 2019 Akash Gajjar + * Copyright (c) 2019 Jagan Teki ++ * Revised: 2022 Brent Roman + */ + + /dts-v1/; +@@ -11,12 +12,6 @@ / { + model = "Radxa ROCK Pi S"; + compatible = "radxa,rockpis", "rockchip,rk3308"; + +- aliases { +- ethernet0 = &gmac; +- mmc0 = &emmc; +- mmc1 = &sdmmc; +- }; +- + chosen { + stdout-path = "serial0:1500000n8"; + }; +@@ -27,48 +22,106 @@ leds { + pinctrl-0 = <&green_led>, <&heartbeat_led>; + + green-led { + color = ; +- default-state = "on"; + function = LED_FUNCTION_POWER; +- gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + label = "rockpis:green:power"; ++ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; ++ default-state = "on"; + }; + + blue-led { + color = ; +- default-state = "on"; + function = LED_FUNCTION_HEARTBEAT; +- gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + label = "rockpis:blue:user"; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; ++ default-state = "on"; + }; + }; + ++ acodec-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,rk3308-acodec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,codec-hp-det; ++ simple-audio-card,widgets = ++ "Headphone", "Headphones"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s_8ch_2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "i2s_8ch_0"; ++ ++ simple-audio-card,dai-link@1 { ++ format = "i2s"; ++ cpu { ++ sound-dai = <&i2s_8ch_0>; ++ }; ++ ++ codec { ++ sound-dai = <&pcm5102a>; ++ }; ++ }; ++ }; ++ ++ pcm5102a: pcm5102a { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ pcm510x,format = "i2s"; ++ }; ++ + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + +- vcc_1v8: vcc-1v8 { ++ vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; +- regulator-name = "vcc_1v8"; ++ regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; +- vin-supply = <&vcc_io>; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; + }; + +- vcc_io: vcc-io { ++ vdd_core: vdd-core { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm0 0 5000 1>; ++ regulator-name = "vdd_core"; ++ regulator-min-microvolt = <827000>; ++ regulator-max-microvolt = <1340000>; ++ regulator-init-microvolt = <1015000>; ++ regulator-settling-time-up-us = <250>; ++ regulator-always-on; ++ regulator-boot-on; ++ pwm-supply = <&vcc5v0_sys>; ++ }; ++ ++ vdd_log: vdd-log { + compatible = "regulator-fixed"; +- regulator-name = "vcc_io"; ++ regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; ++ regulator-min-microvolt = <1050000>; ++ regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + +@@ -78,49 +131,50 @@ vcc_ddr: vcc-ddr { + vin-supply = <&vcc5v0_sys>; + }; + +- vcc5v0_otg: vcc5v0-otg { ++ vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&otg_vbus_drv>; +- regulator-name = "vcc5v0_otg"; ++ regulator-name = "vcc_1v8"; + regulator-always-on; +- vin-supply = <&vcc5v0_sys>; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_io>; + }; + +- vcc5v0_sys: vcc5v0-sys { ++ vcc_io: vcc-io { + compatible = "regulator-fixed"; +- regulator-name = "vcc5v0_sys"; ++ regulator-name = "vcc_io"; + regulator-always-on; + regulator-boot-on; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc5v0_sys>; + }; + +- vdd_core: vdd-core { +- compatible = "pwm-regulator"; +- pwms = <&pwm0 0 5000 1>; +- pwm-supply = <&vcc5v0_sys>; +- regulator-name = "vdd_core"; +- regulator-min-microvolt = <827000>; +- regulator-max-microvolt = <1340000>; +- regulator-settling-time-up-us = <250>; ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + +- vdd_log: vdd-log { ++ vcc5v0_otg: vcc5v0-otg { + compatible = "regulator-fixed"; +- regulator-name = "vdd_log"; ++ regulator-name = "vcc5v0_otg"; + regulator-always-on; +- regulator-boot-on; +- regulator-min-microvolt = <1050000>; +- regulator-max-microvolt = <1050000>; ++ gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&otg_vbus_drv>; + vin-supply = <&vcc5v0_sys>; + }; + }; + ++&codec { ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ + &cpu0 { + cpu-supply = <&vdd_core>; + }; +@@ -132,13 +132,43 @@ + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>; +- vmmc-supply = <&vcc_io>; + status = "okay"; + }; + ++&sdmmc { ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det &sdmmc_bus4>; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ no-mmc; ++ status = "okay"; ++ ++ rtl8723ds: wifi@1 { ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake>; ++ }; ++}; ++ + &gmac { ++ phy-supply = <&vcc_phy>; + clock_in_out = "output"; +- phy-supply = <&vcc_io>; ++ assigned-clocks = <&cru SCLK_MAC>; ++ assigned-clock-parents = <&cru SCLK_MAC_SRC>; + snps,reset-gpio = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 50000>; +@@ -207,8 +237,16 @@ + "", "", "", "", "", "", "", ""; + }; + +-&i2c1 { +- status = "okay"; ++&i2s_8ch_0 { ++ assigned-clocks = <&cru SCLK_I2S0_8CH_RX>; ++ assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>; ++ rockchip,clk-trcm = <1>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s_8ch_2 { ++ status = "okay"; ++ #sound-dai-cells = <0>; + }; + + &pinctrl { +@@ -171,7 +262,9 @@ sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ }; + ++ wifi { + wifi_host_wake: wifi-host-wake { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; + }; +@@ -188,42 +281,29 @@ &saradc { + status = "okay"; + }; + +-&sdio { +- #address-cells = <1>; +- #size-cells = <0>; +- cap-sd-highspeed; +- cap-sdio-irq; +- keep-power-in-suspend; +- max-frequency = <1000000>; +- mmc-pwrseq = <&sdio_pwrseq>; +- non-removable; +- sd-uhs-sdr104; ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; /* 0:CRU */ ++ rockchip,hw-tshut-polarity = <1>; /* 1:HIGH */ + status = "okay"; + }; + +-&sdmmc { +- cap-sd-highspeed; ++&i2c1 { + status = "okay"; + }; + +-&u2phy { +- status = "okay"; +- +- u2phy_host: host-port { +- phy-supply = <&vcc5v0_otg>; +- status = "okay"; +- }; +- +- u2phy_otg: otg-port { +- phy-supply = <&vcc5v0_otg>; +- status = "okay"; +- }; ++&spi2 { ++// status = "okay"; //conflicts with UART2 ++ max-freq = <10000000>; + }; + + &uart0 { + status = "okay"; + }; + ++&uart2 { ++ status = "okay"; ++}; ++ + &uart4 { + status = "okay"; + +@@ -234,19 +314,27 @@ bluetooth { + }; + }; + +-&usb_host_ehci { ++&u2phy { + status = "okay"; ++ ++ u2phy_host: host-port { ++ phy-supply = <&vcc5v0_otg>; ++ status = "okay"; ++ }; ++ ++ u2phy_otg: otg-port { ++ status = "okay"; ++ }; + }; + +-&usb_host_ohci { ++&usb20_otg { + status = "okay"; + }; + +-&usb20_otg { +- dr_mode = "peripheral"; ++&usb_host_ehci { + status = "okay"; + }; + +-&wdt { ++&usb_host_ohci{ + status = "okay"; + }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch new file mode 100644 index 000000000000..3db2657a852c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0005-arm64-dts-rk3308-Add-gmac-node-at-dtsi-level.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Thu, 16 Jan 2020 21:13:09 +0100 +Subject: arm64: dts: rk3308: Add mac node at dtsi level + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 2ae4bb7d5e62..2a6f41e2281f 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -24,6 +24,7 @@ aliases { + i2c1 = &i2c1; + i2c2 = &i2c2; + i2c3 = &i2c3; ++ ethernet0 = &gmac; + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch new file mode 100644 index 000000000000..2d86ad6c3580 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0007-arm64-dts-rockchip-add-cpu-s-thermal-config-for-rk33.patch @@ -0,0 +1,87 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Fri, 17 Jan 2020 15:57:53 +0100 +Subject: arm64: dts: rockchip: add cpu's thermal config for rk3308 + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 64 ++++++++++ + 1 file changed, 64 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 2a6f41e2281f..fde32008902a 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -552,6 +552,70 @@ saradc: saradc@ff1e0000 { + status = "disabled"; + }; + ++ thermal_zones: thermal-zones { ++ ++ soc_thermal: soc-thermal { ++ polling-delay-passive = <20>; ++ polling-delay = <1000>; ++ sustainable-power = <300>; ++ ++ thermal-sensors = <&tsadc 1>; ++ ++ trips { ++ threshold: trip-point-0 { ++ temperature = <70000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ target: trip-point-1 { ++ temperature = <85000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ soc_crit: soc-crit { ++ temperature = <115000>; ++ hysteresis = <2000>; ++ type = "critical"; ++ }; ++ }; ++ ++ cooling-maps { ++ map0 { ++ trip = <&target>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ contribution = <4096>; ++ }; ++ }; ++ ++ }; ++ ++ logic_thermal: logic-thermal { ++ polling-delay-passive = <100>; /* milliseconds */ ++ polling-delay = <1000>; /* milliseconds */ ++ ++ thermal-sensors = <&tsadc 0>; ++ }; ++ }; ++ ++ tsadc: tsadc@ff1f0000 { ++ compatible = "rockchip,rk3308-tsadc"; ++ reg = <0x0 0xff1f0000 0x0 0x100>; ++ interrupts = ; ++ rockchip,grf = <&grf>; ++ clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; ++ clock-names = "tsadc", "apb_pclk"; ++ assigned-clocks = <&cru SCLK_TSADC>; ++ assigned-clock-rates = <50000>; ++ resets = <&cru SRST_TSADC>; ++ reset-names = "tsadc-apb"; ++ pinctrl-names = "gpio", "otpout"; ++ pinctrl-0 = <&tsadc_otp_pin>; ++ pinctrl-1 = <&tsadc_otp_out>; ++ #thermal-sensor-cells = <1>; ++ rockchip,hw-tshut-temp = <120000>; ++ status = "disabled"; ++ }; ++ + dmac0: dma-controller@ff2c0000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0x0 0xff2c0000 0x0 0x4000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch new file mode 100644 index 000000000000..3902d61c8fba --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Rocky Hao +Date: Fri, 9 Mar 2018 17:36:39 +0800 +Subject: thermal: rockchip: add tsadc support for rk3308 + +Change-Id: Ibf1782ca471c8ad4b14d6fd64eeb123181903adc +Signed-off-by: Rocky Hao +--- + Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml | 1 + + drivers/thermal/rockchip_thermal.c | 26 ++++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml +index 55f8ec0bec01..c822baf04aed 100644 +--- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml ++++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml +@@ -15,6 +15,7 @@ properties: + - rockchip,px30-tsadc + - rockchip,rk3228-tsadc + - rockchip,rk3288-tsadc ++ - rockchip,rk3308-tsadc + - rockchip,rk3328-tsadc + - rockchip,rk3368-tsadc + - rockchip,rk3399-tsadc +diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c +index 77231a9d28ff..13182e2a3142 100644 +--- a/drivers/thermal/rockchip_thermal.c ++++ b/drivers/thermal/rockchip_thermal.c +@@ -1060,6 +1060,28 @@ static void rk_tsadcv3_tshut_mode(int chn, void __iomem *regs, + writel_relaxed(val_cru, regs + TSADCV3_HSHUT_CRU_INT_EN); + } + ++static const struct rockchip_tsadc_chip rk3308_tsadc_data = { ++ .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 px30_tsadc_data = { + /* cpu, gpu */ + .chn_offset = 0, +@@ -1321,6 +1343,10 @@ static const struct of_device_id of_rockchip_thermal_match[] = { + .compatible = "rockchip,rk3288-tsadc", + .data = (void *)&rk3288_tsadc_data, + }, ++ { ++ .compatible = "rockchip,rk3308-tsadc", ++ .data = (void *)&rk3308_tsadc_data, ++ }, + { + .compatible = "rockchip,rk3328-tsadc", + .data = (void *)&rk3328_tsadc_data, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch.disabled b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch.disabled new file mode 100644 index 000000000000..e4c527331216 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0010-arm64-dts-rockchip-add-i2s_8ch-for-rk3308.patch.disabled @@ -0,0 +1,126 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Fri, 17 Jan 2020 16:22:13 +0100 +Subject: arm64: dts: rockchip: add i2s_8ch for rk3308 + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 103 ++++++++++ + 1 file changed, 103 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index fde32008902a..1567758ca90e 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -638,6 +638,109 @@ dmac1: dma-controller@ff2d0000 { + #dma-cells = <1>; + }; + ++ i2s_8ch_0: i2s@ff300000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff300000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S0_8CH_TX>, <&cru SCLK_I2S0_8CH_RX>, <&cru HCLK_I2S0_8CH>, ++ <&cru SCLK_I2S0_8CH_TX_SRC>, ++ <&cru SCLK_I2S0_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 0>, <&dmac1 1>; ++ dma-names = "tx", "rx"; ++ resets = <&cru SRST_I2S0_8CH_TX_M>, <&cru SRST_I2S0_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_0_sclktx ++ &i2s_8ch_0_sclkrx ++ &i2s_8ch_0_lrcktx ++ &i2s_8ch_0_lrckrx ++ &i2s_8ch_0_sdi0 ++ &i2s_8ch_0_sdi1 ++ &i2s_8ch_0_sdi2 ++ &i2s_8ch_0_sdi3 ++ &i2s_8ch_0_sdo0 ++ &i2s_8ch_0_sdo1 ++ &i2s_8ch_0_sdo2 ++ &i2s_8ch_0_sdo3 ++ &i2s_8ch_0_mclk>; ++ status = "disabled"; ++ }; ++ ++ i2s_8ch_1: i2s@ff310000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff310000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S1_8CH_TX>, <&cru SCLK_I2S1_8CH_RX>, <&cru HCLK_I2S1_8CH>, ++ <&cru SCLK_I2S1_8CH_TX_SRC>, ++ <&cru SCLK_I2S1_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 2>, <&dmac1 3>; ++ dma-names = "tx", "rx"; ++ resets = <&cru SRST_I2S1_8CH_TX_M>, <&cru SRST_I2S1_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ rockchip,io-multiplex; ++ status = "disabled"; ++ }; ++ ++ i2s_8ch_2: i2s@ff320000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff320000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S2_8CH_TX>, <&cru SCLK_I2S2_8CH_RX>, <&cru HCLK_I2S2_8CH>, ++ <&cru SCLK_I2S2_8CH_TX_SRC>, ++ <&cru SCLK_I2S2_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 4>, <&dmac1 5>; ++ dma-names = "tx", "rx"; ++ resets = <&cru SRST_I2S2_8CH_TX_M>, <&cru SRST_I2S2_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ status = "disabled"; ++ }; ++ ++ i2s_8ch_3: i2s@ff330000 { ++ compatible = "rockchip,rk3308-i2s-tdm"; ++ reg = <0x0 0xff330000 0x0 0x1000>; ++ interrupts = ; ++ clocks = <&cru SCLK_I2S3_8CH_TX>, <&cru SCLK_I2S3_8CH_RX>, <&cru HCLK_I2S3_8CH>, ++ <&cru SCLK_I2S3_8CH_TX_SRC>, ++ <&cru SCLK_I2S3_8CH_RX_SRC>, ++ <&cru PLL_VPLL0>, ++ <&cru PLL_VPLL1>; ++ clock-names = "mclk_tx", "mclk_rx", "hclk", ++ "mclk_tx_src", "mclk_rx_src", ++ "mclk_root0", "mclk_root1"; ++ dmas = <&dmac1 7>; ++ dma-names = "rx"; ++ resets = <&cru SRST_I2S3_8CH_TX_M>, <&cru SRST_I2S3_8CH_RX_M>; ++ reset-names = "tx-m", "rx-m"; ++ rockchip,cru = <&cru>; ++ rockchip,grf = <&grf>; ++ rockchip,mclk-calibrate; ++ status = "disabled"; ++ }; ++ + i2s_2ch_0: i2s@ff350000 { + compatible = "rockchip,rk3308-i2s", "rockchip,rk3066-i2s"; + reg = <0x0 0xff350000 0x0 0x1000>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch new file mode 100644 index 000000000000..e8ecc0a02a2f --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0012-arm64-dts-rk3308-Add-rk-timer-rtc.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Fri, 17 Jan 2020 17:12:51 +0100 +Subject: arm64: dts: rk3308: Add rk-timer-rtc + +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 11 +++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 1567758ca90e..291f011800b2 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -540,6 +540,15 @@ rktimer: rktimer@ff1a0000 { + clock-names = "pclk", "timer"; + }; + ++ rk_timer_rtc: rk-timer-rtc@ff1a0020 { ++ compatible = "rockchip,rk3308-timer-rtc"; ++ reg = <0x0 0xff1a0020 0x0 0x20>; ++ interrupts = ; ++ clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER1>; ++ clock-names = "pclk", "timer"; ++ status = "disabled"; ++ }; ++ + saradc: saradc@ff1e0000 { + compatible = "rockchip,rk3308-saradc", "rockchip,rk3399-saradc"; + reg = <0x0 0xff1e0000 0x0 0x100>; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch.disabled b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch.disabled new file mode 100644 index 000000000000..30bfaeaf504a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch.disabled @@ -0,0 +1,2638 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Xing Zheng +Date: Sun, 11 Mar 2018 11:37:28 +0800 +Subject: ASoC: codecs: Add RK3308 internal codec driver + +This adds support for the RK3308 audio codec. + +Change-Id: Ieccdebaa27f4a46f6de9406046a6e02e20398013 +Signed-off-by: Xing Zheng +--- + sound/soc/codecs/Kconfig | 5 + + sound/soc/codecs/Makefile | 2 + + sound/soc/codecs/rk3308_codec.c | 1604 ++++++++++ + sound/soc/codecs/rk3308_codec.h | 960 ++++++ + 4 files changed, 2571 insertions(+) + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index f1e1dbc509f6..8ce353dad530 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -177,6 +177,7 @@ config SND_SOC_ALL_CODECS + imply SND_SOC_PCM512x_I2C + imply SND_SOC_PCM512x_SPI + imply SND_SOC_PEB2466 ++ imply SND_SOC_RK3308 + imply SND_SOC_RK3328 + imply SND_SOC_RK817 + imply SND_SOC_RT274 +@@ -1370,6 +1371,10 @@ config SND_SOC_PEB2466 + To compile this driver as a module, choose M here: the module + will be called snd-soc-peb2466. + ++config SND_SOC_RK3308 ++ select REGMAP_MMIO ++ tristate "Rockchip RK3308 CODEC" ++ + config SND_SOC_RK3328 + tristate "Rockchip RK3328 audio CODEC" + select REGMAP_MMIO +diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile +index a87e56938ce5..8f539b13864d 100644 +--- a/sound/soc/codecs/Makefile ++++ b/sound/soc/codecs/Makefile +@@ -199,6 +199,7 @@ snd-soc-pcm512x-objs := pcm512x.o + snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o + snd-soc-pcm512x-spi-objs := pcm512x-spi.o + snd-soc-peb2466-objs := peb2466.o ++snd-soc-rk3308-objs := rk3308_codec.o + snd-soc-rk3328-objs := rk3328_codec.o + snd-soc-rk817-objs := rk817_codec.o + snd-soc-rl6231-objs := rl6231.o +@@ -580,6 +581,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o + obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o + obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o + obj-$(CONFIG_SND_SOC_PEB2466) += snd-soc-peb2466.o ++obj-$(CONFIG_SND_SOC_RK3308) += snd-soc-rk3308.o + obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o + obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o + obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o +diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c +new file mode 100644 +index 000000000000..106f09738dd0 +--- /dev/null ++++ b/sound/soc/codecs/rk3308_codec.c +@@ -0,0 +1,1604 @@ ++/* ++ * rk3308_codec.c -- RK3308 ALSA Soc Audio Driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "rk3308_codec.h" ++ ++struct rk3308_codec_priv { ++ const struct device *plat_dev; ++ struct device dev; ++ struct reset_control *reset; ++ struct regmap *regmap; ++ struct clk *pclk; ++ struct gpio_desc *spk_ctl_gpio; ++ int adc_ch; /* To select ADCs for channel */ ++ int adc_ch0_using_linein; ++}; ++ ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_gain_tlv, ++ -1800, 150, 2850); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_max_gain_tlv, ++ -1350, 600, 2850); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_min_gain_tlv, ++ -1800, 600, 2400); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_mic_gain_tlv, ++ 0, 600, 3000); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_alc_gain_tlv, ++ -1800, 150, 2850); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_gain_tlv, ++ 0, 150, 600); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpout_gain_tlv, ++ -3900, 150, 600); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpmix_gain_tlv, ++ -600, 600, 0); ++ ++static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = { ++ /* ALC AGC Channel*/ ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Volume", ++ RK3308_ALC_L_DIG_CON03(0), ++ RK3308_ALC_R_DIG_CON03(0), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Volume", ++ RK3308_ALC_L_DIG_CON03(1), ++ RK3308_ALC_R_DIG_CON03(1), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Volume", ++ RK3308_ALC_L_DIG_CON03(2), ++ RK3308_ALC_R_DIG_CON03(2), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Volume", ++ RK3308_ALC_L_DIG_CON03(3), ++ RK3308_ALC_R_DIG_CON03(3), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_NDB_18, ++ RK3308_AGC_PGA_GAIN_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ ++ /* ALC AGC MAX */ ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Max Volume", ++ RK3308_ALC_L_DIG_CON09(0), ++ RK3308_ALC_R_DIG_CON09(0), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Max Volume", ++ RK3308_ALC_L_DIG_CON09(1), ++ RK3308_ALC_R_DIG_CON09(1), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Max Volume", ++ RK3308_ALC_L_DIG_CON09(2), ++ RK3308_ALC_R_DIG_CON09(2), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Max Volume", ++ RK3308_ALC_L_DIG_CON09(3), ++ RK3308_ALC_R_DIG_CON09(3), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, ++ RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, ++ 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ ++ /* ALC AGC MIN */ ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Min Volume", ++ RK3308_ALC_L_DIG_CON09(0), ++ RK3308_ALC_R_DIG_CON09(0), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Min Volume", ++ RK3308_ALC_L_DIG_CON09(1), ++ RK3308_ALC_R_DIG_CON09(1), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Min Volume", ++ RK3308_ALC_L_DIG_CON09(2), ++ RK3308_ALC_R_DIG_CON09(2), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Min Volume", ++ RK3308_ALC_L_DIG_CON09(3), ++ RK3308_ALC_R_DIG_CON09(3), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_NDB_18, ++ RK3308_AGC_MIN_GAIN_PGA_PDB_24, ++ 0, rk3308_codec_alc_agc_ch_min_gain_tlv), ++ ++ /* ADC MIC */ ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Left Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Right Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Left Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Right Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Left Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Right Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Left Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_0DB, ++ RK3308_ADC_CH1_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Right Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_0DB, ++ RK3308_ADC_CH2_MIC_GAIN_30DB, ++ 0, rk3308_codec_adc_mic_gain_tlv), ++ ++ /* ADC ALC */ ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Left Volume", ++ RK3308_ADC_ANA_CON03(0), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Right Volume", ++ RK3308_ADC_ANA_CON04(0), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Left Volume", ++ RK3308_ADC_ANA_CON03(1), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Right Volume", ++ RK3308_ADC_ANA_CON04(1), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Left Volume", ++ RK3308_ADC_ANA_CON03(2), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Right Volume", ++ RK3308_ADC_ANA_CON04(2), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Left Volume", ++ RK3308_ADC_ANA_CON03(3), ++ RK3308_ADC_CH1_ALC_GAIN_SFT, ++ RK3308_ADC_CH1_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Right Volume", ++ RK3308_ADC_ANA_CON04(3), ++ RK3308_ADC_CH2_ALC_GAIN_SFT, ++ RK3308_ADC_CH2_ALC_GAIN_NDB_18, ++ RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ 0, rk3308_codec_adc_alc_gain_tlv), ++ ++ /* DAC */ ++ SOC_SINGLE_RANGE_TLV("DAC Left Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_GAIN_SFT, ++ RK3308_DAC_L_GAIN_0DB, ++ RK3308_DAC_L_GAIN_PDB_6, ++ 0, rk3308_codec_dac_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("DAC Right Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_R_GAIN_SFT, ++ RK3308_DAC_R_GAIN_0DB, ++ RK3308_DAC_R_GAIN_PDB_6, ++ 0, rk3308_codec_dac_gain_tlv), ++ ++ /* DAC HPOUT */ ++ SOC_SINGLE_RANGE_TLV("DAC HPOUT Left Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_SFT, ++ RK3308_DAC_L_HPOUT_GAIN_NDB_39, ++ RK3308_DAC_L_HPOUT_GAIN_PDB_6, ++ 0, rk3308_codec_dac_hpout_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("DAC HPOUT Right Volume", ++ RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_SFT, ++ RK3308_DAC_R_HPOUT_GAIN_NDB_39, ++ RK3308_DAC_R_HPOUT_GAIN_PDB_6, ++ 0, rk3308_codec_dac_hpout_gain_tlv), ++ ++ /* DAC HPMIX */ ++ SOC_SINGLE_RANGE_TLV("DAC HPMIX Left Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPMIX_GAIN_SFT, ++ RK3308_DAC_L_HPMIX_GAIN_NDB_6, ++ RK3308_DAC_L_HPMIX_GAIN_0DB, ++ 0, rk3308_codec_dac_hpmix_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("DAC HPMIX Right Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_R_HPMIX_GAIN_SFT, ++ RK3308_DAC_R_HPMIX_GAIN_NDB_6, ++ RK3308_DAC_R_HPMIX_GAIN_0DB, ++ 0, rk3308_codec_dac_hpmix_gain_tlv), ++}; ++ ++static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) ++{ ++ gpiod_direction_output(rk3308->spk_ctl_gpio, on); ++} ++ ++static int rk3308_codec_reset(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ reset_control_assert(rk3308->reset); ++ usleep_range(200, 300); /* estimated value */ ++ reset_control_deassert(rk3308->reset); ++ ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, 0x00); ++ usleep_range(200, 300); /* estimated value */ ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_SYS_WORK | ++ RK3308_DAC_DIG_WORK | ++ RK3308_ADC_DIG_WORK); ++ ++ return 0; ++} ++ ++static int rk3308_set_bias_level(struct snd_soc_codec *codec, ++ enum snd_soc_bias_level level) ++{ ++ switch (level) { ++ case SND_SOC_BIAS_ON: ++ break; ++ ++ case SND_SOC_BIAS_PREPARE: ++ break; ++ ++ case SND_SOC_BIAS_STANDBY: ++ case SND_SOC_BIAS_OFF: ++ break; ++ } ++ ++ snd_soc_codec_force_bias_level(codec, level); ++ ++ return 0; ++} ++ ++static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, ++ unsigned int fmt) ++{ ++ struct snd_soc_codec *codec = codec_dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; ++ int ch = rk3308->adc_ch; ++ ++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ adc_aif2 |= RK3308_ADC_IO_MODE_SLAVE; ++ adc_aif2 |= RK3308_ADC_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_IO_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_MODE_SLAVE; ++ break; ++ case SND_SOC_DAIFMT_CBM_CFM: ++ adc_aif2 |= RK3308_ADC_IO_MODE_MASTER; ++ adc_aif2 |= RK3308_ADC_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_IO_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_MODE_MASTER; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_DSP_A: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_PCM; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_PCM; ++ break; ++ case SND_SOC_DAIFMT_I2S: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_I2S; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_I2S; ++ break; ++ case SND_SOC_DAIFMT_RIGHT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_RJ; ++ break; ++ case SND_SOC_DAIFMT_LEFT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_LJ; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { ++ case SND_SOC_DAIFMT_NB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ case SND_SOC_DAIFMT_IB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_IB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_NB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), ++ RK3308_ADC_I2S_LRC_POL_MSK | ++ RK3308_ADC_I2S_MODE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), ++ RK3308_ADC_IO_MODE_MSK | ++ RK3308_ADC_MODE_MSK | ++ RK3308_ADC_I2S_BIT_CLK_POL_MSK, ++ adc_aif2); ++ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_LRC_POL_MSK | ++ RK3308_DAC_I2S_MODE_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_IO_MODE_MSK | ++ RK3308_DAC_MODE_MSK | ++ RK3308_DAC_I2S_BIT_CLK_POL_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; ++ int ch = rk3308->adc_ch; ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_16BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_20BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_24BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_32BITS; ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (params_channels(params)) { ++ case 1: ++ adc_aif1 |= RK3308_ADC_I2S_MONO; ++ break; ++ case 2: ++ adc_aif1 |= RK3308_ADC_I2S_STEREO; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ adc_aif1 |= RK3308_ADC_I2S_LR_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_WORK; ++ dac_aif1 |= RK3308_DAC_I2S_LR_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_WORK; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), ++ RK3308_ADC_I2S_VALID_LEN_MSK | ++ RK3308_ADC_I2S_LR_MSK | ++ RK3308_ADC_I2S_TYPE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), ++ RK3308_ADC_I2S_MSK, ++ adc_aif2); ++ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_VALID_LEN_MSK | ++ RK3308_DAC_I2S_LR_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_I2S_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_digital_mute(struct snd_soc_dai *dai, int mute) ++{ ++ return 0; ++} ++ ++static int rk3308_codec_dac_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 01 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_MSK, ++ RK3308_DAC_CURRENT_EN); ++ ++ /* Step 02 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_MSK | ++ RK3308_DAC_BUF_REF_R_MSK, ++ RK3308_DAC_BUF_REF_L_EN | ++ RK3308_DAC_BUF_REF_R_EN); ++ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_L_MSK | ++ RK3308_DAC_POP_SOUND_R_MSK, ++ RK3308_DAC_POP_SOUND_L_WORK | ++ RK3308_DAC_POP_SOUND_R_WORK); ++ ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN); ++ ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK); ++ ++ /* Step 06 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN); ++ ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN); ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_I2S | ++ RK3308_DAC_R_HPMIX_I2S); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE); ++ ++ /* Step 15 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_GAIN_MSK | ++ RK3308_DAC_R_HPMIX_GAIN_MSK, ++ RK3308_DAC_L_HPMIX_GAIN_0DB | ++ RK3308_DAC_R_HPMIX_GAIN_0DB); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE); ++ ++ /* Step 17 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ RK3308_DAC_L_HPOUT_GAIN_0DB); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ RK3308_DAC_R_HPOUT_GAIN_0DB); ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, ++ RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 01 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, ++ RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); ++ ++ /* ++ * Step 02 ++ * ++ * Note1. In the step2, adjusting the register step by step to the ++ * appropriate value and taking 20ms as time step ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ RK3308_DAC_L_HPOUT_GAIN_NDB_39); ++ ++ /* Step 02 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ RK3308_DAC_R_HPOUT_GAIN_NDB_39); ++ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_MUTE | ++ RK3308_DAC_R_HPMIX_MUTE); ++ ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_NONE | ++ RK3308_DAC_R_HPMIX_NONE); ++ ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_MUTE | ++ RK3308_DAC_R_HPOUT_MUTE); ++ ++ /* Step 06 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_INIT | RK3308_DAC_R_DAC_INIT); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_DIS | RK3308_DAC_R_HPOUT_DIS); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_MUTE | ++ RK3308_DAC_R_LINEOUT_MUTE); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_DIS | RK3308_DAC_R_LINEOUT_DIS); ++ ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_DIS | RK3308_DAC_R_HPMIX_DIS); ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_DIS | RK3308_DAC_R_DAC_DIS); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_DIS | RK3308_DAC_R_CLK_DIS); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_DIS | RK3308_DAC_R_REF_DIS); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_L_MSK | ++ RK3308_DAC_POP_SOUND_R_MSK, ++ RK3308_DAC_POP_SOUND_L_INIT | ++ RK3308_DAC_POP_SOUND_R_INIT); ++ ++ /* Step 15 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_EN | RK3308_DAC_BUF_REF_R_EN, ++ RK3308_DAC_BUF_REF_L_DIS | RK3308_DAC_BUF_REF_R_DIS); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_EN, ++ RK3308_DAC_CURRENT_DIS); ++ ++ /* Step 17 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_INIT | RK3308_DAC_R_HPOUT_INIT); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_INIT | RK3308_DAC_R_HPMIX_INIT); ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_GAIN_MSK | ++ RK3308_DAC_R_HPMIX_GAIN_MSK, ++ RK3308_DAC_L_HPMIX_GAIN_NDB_6 | ++ RK3308_DAC_R_HPMIX_GAIN_NDB_6); ++ ++ /* ++ * Note2. If the ACODEC_DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] ++ * is set to 0x1, add the steps from the section Disable DAC ++ * Configuration Standard Usage Flow after complete the step 19 ++ */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_on(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ /* 1. Supply the power of digital part and reset the Audio Codec */ ++ /* Do nothing */ ++ ++ /* ++ * 2. Configure ACODEC_DAC_ANA_CON1[1:0] and ACODEC_DAC_ANA_CON1[5:4] ++ * to 0x1, to setup dc voltage of the DAC channel output ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_L_MSK, RK3308_DAC_POP_SOUND_L_INIT); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_POP_SOUND_R_MSK, RK3308_DAC_POP_SOUND_R_INIT); ++ ++ /* ++ * 3. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 ++ * ++ * Note: Only the reg (ADC_ANA_CON10+0x0)[6:0] represent the control ++ * signal to select current to pre-charge/dis_charge ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ ++ /* 4. Supply the power of the analog part(AVDD,AVDDRV) */ ++ ++ /* ++ * 5. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x1 to setup ++ * reference voltage ++ * ++ * Note: Only the reg (ADC_ANA_CON10+0x0)[7] represent the enable ++ * signal of reference voltage module ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, RK3308_ADC_REF_EN); ++ ++ /* ++ * 6. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to ++ * 0x7f step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to ++ * 0x7f directly. The suggestion slot time of the step is 20ms. ++ */ ++ mdelay(20); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_DONT_SEL_ALL); ++ ++ /* 7. Wait until the voltage of VCM keeps stable at the AVDD/2 */ ++ usleep_range(200, 300); /* estimated value */ ++ ++ /* ++ * 8. Configure the register ACODEC_ADC_ANA_CON10[6:0] to the ++ * appropriate value(expect 0x0) for reducing power. ++ */ ++ ++ /* TODO: choose an appropriate charge value */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_off(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ /* ++ * 1. Keep the power on and disable the DAC and ADC path according to ++ * the section power on configuration standard usage flow. ++ */ ++ ++ /* 2. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ ++ /* 3. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, RK3308_ADC_REF_DIS); ++ ++ /* ++ * 4.Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to 0x7f ++ * step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to 0x7f ++ * directly. The suggestion slot time of the step is 20ms ++ */ ++ mdelay(20); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_DONT_SEL_ALL); ++ ++ /* 5. Wait until the voltage of VCM keeps stable at the AGND */ ++ usleep_range(200, 300); /* estimated value */ ++ ++ /* 6. Power off the analog power supply */ ++ /* 7. Power off the digital power supply */ ++ ++ /* Do something via hardware */ ++ ++ return 0; ++} ++ ++static int check_micbias(int micbias) ++{ ++ switch (micbias) { ++ case RK3308_ADC_MICBIAS_VOLT_0_85: ++ case RK3308_ADC_MICBIAS_VOLT_0_8: ++ case RK3308_ADC_MICBIAS_VOLT_0_75: ++ case RK3308_ADC_MICBIAS_VOLT_0_7: ++ case RK3308_ADC_MICBIAS_VOLT_0_65: ++ case RK3308_ADC_MICBIAS_VOLT_0_6: ++ case RK3308_ADC_MICBIAS_VOLT_0_55: ++ case RK3308_ADC_MICBIAS_VOLT_0_5: ++ return 0; ++ } ++ ++ return -EINVAL; ++} ++ ++static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, ++ int micbias) ++{ ++ int ch = rk3308->adc_ch; ++ int ret; ++ ++ if (ch != 1 && ch != 2) { ++ dev_err(rk3308->plat_dev, ++ "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", ++ __func__, ch); ++ return -EINVAL; ++ } ++ ++ /* 1. Power up the ACODEC and keep the AVDDH stable */ ++ ++ /* 2. Configure ACODEC_ADC_ANA_CON7[2:0] to the certain value */ ++ ret = check_micbias(micbias); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, "This is an invalid micbias: %d\n", ++ micbias); ++ return ret; ++ } ++ ++ /* ++ * Note: Only the reg (ADC_ANA_CON7+0x0)[2:0] represent the level range ++ * control signal of MICBIAS voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, ++ micbias); ++ ++ /* 3. Wait until the VCMH keep stable */ ++ usleep_range(200, 300); /* estimated value */ ++ ++ /* 4. Configure ACODEC_ADC_ANA_CON8[4] to 0x1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_EN); ++ ++ /* ++ * 5. Configure the (ADC_ANA_CON7+0x40)[3] or (ADC_ANA_CON7+0x80)[3] ++ * to 0x1. ++ * (ADC_ANA_CON7+0x40)[3] used to control the MICBIAS1, and ++ * (ADC_ANA_CON7+0x80)[3] used to control the MICBIAS2 ++ */ ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_EN); ++ ++ return 0; ++} ++ ++static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ if (ch != 1 && ch != 2) { ++ dev_err(rk3308->plat_dev, ++ "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", ++ __func__, ch); ++ return -EINVAL; ++ } ++ ++ /* 1. Enable the MICBIAS and keep the Audio Codec stable */ ++ /* Do nothing */ ++ ++ /* ++ * 2. Configure the (ADC_ANA_CON7+0x40)[3] or ++ * (ADC_ANA_CON7+0x80)[3] to 0x0 ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_DIS); ++ ++ /* 3. Configure ACODEC_ADC_ANA_CON8[4] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_alc_enable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set he max level and min level of the ALC need to control. ++ * ++ * These values are estimated ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), ++ RK3308_AGC_LO_8BITS_AGC_MIN_MSK, ++ 0x16); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), ++ RK3308_AGC_HI_8BITS_AGC_MIN_MSK, ++ 0x40); ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), ++ RK3308_AGC_LO_8BITS_AGC_MAX_MSK, ++ 0x26); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), ++ RK3308_AGC_HI_8BITS_AGC_MAX_MSK, ++ 0x40); ++ ++ /* ++ * 2. Set ACODEC_ALC_DIG_CON4[2:0] according to the sample rate ++ * ++ * By default is 44.1KHz for sample. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON04(ch), ++ RK3308_AGC_APPROX_RATE_MSK, ++ RK3308_AGC_APPROX_RATE_44_1K); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON04(ch), ++ RK3308_AGC_APPROX_RATE_MSK, ++ RK3308_AGC_APPROX_RATE_44_1K); ++ ++ /* 3. Set ACODEC_ALC_DIG_CON9[6] to 0x1, to enable the ALC module */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ ++ /* ++ * 4. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], ++ * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] ++ * to 0x3, to enable the ALC module to control the gain of PGA. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_EN | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_EN); ++ ++ /* ++ * 5.Observe the current ALC output gain by reading ++ * ACODEC_ALC_DIG_CON12[4:0] ++ * ++ * The default GAIN is 0x0c ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON12(ch), ++ RK3308_AGC_GAIN_MSK, ++ 0x0c); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON12(ch), ++ RK3308_AGC_GAIN_MSK, ++ 0x0c); ++ ++ return 0; ++} ++ ++static int rk3308_codec_alc_disable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set ACODEC_ALC_DIG_CON9[6] to 0x0, to disable the ALC module, ++ * then the ALC output gain will keep to the last value ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], ++ * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] ++ * to 0x0, to disable the ALC module to control the gain of PGA. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS | ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_enable(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int adc_aif1 = 0, adc_aif2 = 0; ++ unsigned int agc_func_en; ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set the ACODEC_ADC_ANA_CON7[7:6] and ACODEC_ADC_ANA_CON7[5:4], ++ * to select the line-in or microphone as input of ADC ++ * ++ * Note1. Please ignore the step1 for enabling ADC3, ADC4, ADC5, ++ * ADC6, ADC7, and ADC8 ++ */ ++ if (ch == 0) { ++ if (rk3308->adc_ch0_using_linein) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH1_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_LINEIN); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH2_IN_LINEIN); ++ } else { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH1_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_MIC); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH2_IN_MIC); ++ } ++ } ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON0[7:0] to 0xff, to end the mute station ++ * of ADC, to enable the MIC module, to enable the reference voltage ++ * buffer, and to end the initialization of MIC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), ++ RK3308_ADC_CH1_CH2_MIC_ALL_MSK, ++ RK3308_ADC_CH1_CH2_MIC_ALL); ++ ++ /* ++ * 3. Set ACODEC_ADC_ANA_CON6[0] to 0x1, to enable the current source ++ * of audio ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_EN); ++ ++ /* ++ * 4. Set ACODEC_ADC_ANA_CON2[7:0] to 0x77, to enable the ALC module, ++ * to enable the zero-crossing detection function, and to end the ++ * initialization of ALC ++ * ++ * Note2. Please set ACODEC_ADC_ANA_CON2[7:0] to 0x33 in step4 ++ * if the AGC function is closed ++ */ ++ ++ adc_aif1 = RK3308_ADC_CH1_ALC_EN | RK3308_ADC_CH1_ALC_WORK; ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); ++ if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) ++ adc_aif1 |= RK3308_ADC_CH1_ZEROCROSS_DET_EN; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH1_ALC_ZC_MSK, ++ adc_aif1); ++ ++ adc_aif2 = RK3308_ADC_CH2_ALC_EN | RK3308_ADC_CH2_ALC_WORK; ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); ++ if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) ++ adc_aif2 |= RK3308_ADC_CH2_ZEROCROSS_DET_EN; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH2_ALC_ZC_MSK, ++ adc_aif2); ++ ++ /* ++ * 5. Set ACODEC_ADC_ANA_CON5[7:0] to 0x77, to enable the clock and ++ * ADC module, and to end the initialization of ADC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH1_ADC_CLK_MSK, ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH1_ADC_WORK); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH2_ADC_CLK_MSK, ++ RK3308_ADC_CH2_CLK_EN | ++ RK3308_ADC_CH2_ADC_EN | ++ RK3308_ADC_CH2_ADC_WORK); ++ ++ /* ++ * 6. Set ACODEC_ADC_ANA_CON1[5:4] and ACODEC_ADC_ANA_CON1[1:0], ++ * to select the gain of the MIC ++ * ++ * By default is 0db. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH1_MIC_GAIN_MSK, ++ RK3308_ADC_CH1_MIC_GAIN_0DB); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH2_MIC_GAIN_MSK, ++ RK3308_ADC_CH2_MIC_GAIN_0DB); ++ ++ /* ++ * 7.Set ACODEC_ADC_ANA_CON3[4:0] and ACODEC_ADC_ANA_CON4[3:0] to ++ * select the gain of ALC ++ * ++ * By default is 0db. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON03(ch), ++ RK3308_ADC_CH1_ALC_GAIN_MSK, ++ RK3308_ADC_CH1_ALC_GAIN_0DB); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON04(ch), ++ RK3308_ADC_CH2_ALC_GAIN_MSK, ++ RK3308_ADC_CH2_ALC_GAIN_0DB); ++ ++ /* 8.Begin recording */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_disable(struct rk3308_codec_priv *rk3308) ++{ ++ int ch = rk3308->adc_ch; ++ ++ /* ++ * 1. Set ACODEC_ADC_ANA_CON2[7:0] to 0x0, to disable the ALC module, ++ * to disable the zero-crossing detection function, and to begin the ++ * initialization of ALC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH1_ALC_ZC_MSK, ++ 0); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), ++ RK3308_ADC_CH2_ALC_ZC_MSK, ++ 0); ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON5[7:0] to 0x0, to disable the clock and ++ * ADC module, and to begin the initialization of ADC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH1_ADC_CLK_MSK, ++ 0); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), ++ RK3308_ADC_CH2_ADC_CLK_MSK, ++ 0); ++ ++ /* ++ * 3. Set ACODEC_ADC_ANA_CON0[7:0] to 0x88, to disable the MIC module, ++ * to disable the reference voltage buffer, and to begin the ++ * initialization of MIC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), ++ RK3308_ADC_CH1_CH2_MIC_ALL_MSK, ++ RK3308_ADC_CH1_MIC_UNMUTE | ++ RK3308_ADC_CH2_MIC_UNMUTE); ++ ++ /* ++ * 4. Set ACODEC_ADC_ANA_CON6[0] to 0x0, to disable the current ++ * source of audio ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_capture(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_alc_enable(rk3308); ++ rk3308_codec_adc_ana_enable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_capture(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_alc_disable(rk3308); ++ rk3308_codec_adc_ana_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_playback(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_dac_enable(rk3308); ++ rk3308_speaker_ctl(rk3308, 1); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_playback(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_speaker_ctl(rk3308, 0); ++ rk3308_codec_dac_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_pcm_startup(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ int ret = 0; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ ret = rk3308_codec_open_playback(codec); ++ else ++ ret = rk3308_codec_open_capture(codec); ++ ++ return ret; ++} ++ ++static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ rk3308_codec_close_playback(codec); ++ else ++ rk3308_codec_close_capture(codec); ++} ++ ++static struct snd_soc_dai_ops rk3308_dai_ops = { ++ .hw_params = rk3308_hw_params, ++ .set_fmt = rk3308_set_dai_fmt, ++ .digital_mute = rk3308_digital_mute, ++ .startup = rk3308_pcm_startup, ++ .shutdown = rk3308_pcm_shutdown, ++}; ++ ++static struct snd_soc_dai_driver rk3308_dai[] = { ++ { ++ .name = "rk3308-hifi", ++ .id = RK3308_HIFI, ++ .playback = { ++ .stream_name = "HiFi Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .capture = { ++ .stream_name = "HiFi Capture", ++ .channels_min = 1, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_8000_96000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .ops = &rk3308_dai_ops, ++ }, ++}; ++ ++static int rk3308_suspend(struct snd_soc_codec *codec) ++{ ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ ++ return 0; ++} ++ ++static int rk3308_resume(struct snd_soc_codec *codec) ++{ ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ ++ return 0; ++} ++ ++static int rk3308_probe(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_codec_reset(codec); ++ rk3308_codec_power_on(codec); ++ ++ rk3308_codec_micbias_enable(rk3308, RK3308_ADC_MICBIAS_VOLT_0_7); ++ ++ return 0; ++} ++ ++static int rk3308_remove(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_speaker_ctl(rk3308, 0); ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308_codec_power_off(codec); ++ ++ return 0; ++} ++ ++static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { ++ .probe = rk3308_probe, ++ .remove = rk3308_remove, ++ .suspend = rk3308_suspend, ++ .resume = rk3308_resume, ++ .set_bias_level = rk3308_set_bias_level, ++ .controls = rk3308_codec_dapm_controls, ++ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++}; ++ ++static const struct reg_default rk3308_codec_reg_defaults[] = { ++ { RK3308_GLB_CON, 0x07 }, ++}; ++ ++static bool rk3308_codec_write_read_reg(struct device *dev, unsigned int reg) ++{ ++ /* All registers can be read / write */ ++ return true; ++} ++ ++static bool rk3308_codec_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ switch (reg) { ++ case RK3308_GLB_CON: ++ return true; ++ default: ++ return false; ++ } ++} ++ ++static const struct regmap_config rk3308_codec_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = RK3308_DAC_ANA_CON13, ++ .writeable_reg = rk3308_codec_write_read_reg, ++ .readable_reg = rk3308_codec_write_read_reg, ++ .volatile_reg = rk3308_codec_volatile_reg, ++ .reg_defaults = rk3308_codec_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(rk3308_codec_reg_defaults), ++ .cache_type = REGCACHE_FLAT, ++}; ++ ++static ssize_t adc_ch_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ ++ return sprintf(buf, "adc_ch: %d\n", rk3308->adc_ch); ++} ++ ++static ssize_t adc_ch_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long ch; ++ int ret = kstrtoul(buf, 10, &ch); ++ ++ if (ret < 0 || ch > 4) { ++ dev_err(dev, "Invalid ch: %ld, ret: %d\n", ch, ret); ++ return -EINVAL; ++ } ++ ++ rk3308->adc_ch = ch; ++ ++ dev_info(dev, "Store ch: %d\n", rk3308->adc_ch); ++ ++ return count; ++} ++ ++static const struct device_attribute adc_ch_attrs[] = { ++ __ATTR(adc_ch, 0644, adc_ch_show, adc_ch_store), ++}; ++ ++static void rk3308_codec_device_release(struct device *dev) ++{ ++ /* Do nothing */ ++} ++ ++static int rk3308_codec_sysfs_init(struct platform_device *pdev, ++ struct rk3308_codec_priv *rk3308) ++{ ++ struct device *dev = &rk3308->dev; ++ int i; ++ ++ dev->release = rk3308_codec_device_release; ++ dev->parent = &pdev->dev; ++ set_dev_node(dev, dev_to_node(&pdev->dev)); ++ dev_set_name(dev, "rk3308-acodec-dev"); ++ ++ if (device_register(dev)) { ++ dev_err(&pdev->dev, ++ "Register 'rk3308-acodec-dev' failed\n"); ++ dev->parent = NULL; ++ return -ENOMEM; ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(adc_ch_attrs); i++) { ++ if (device_create_file(dev, &adc_ch_attrs[i])) { ++ dev_err(&pdev->dev, ++ "Create 'rk3308-acodec-dev' attr failed\n"); ++ device_unregister(dev); ++ return -ENOMEM; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_platform_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node; ++ struct rk3308_codec_priv *rk3308; ++ struct resource *res; ++ void __iomem *base; ++ int ret = 0; ++ struct regmap *grf; ++ ++ grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); ++ if (IS_ERR(grf)) { ++ dev_err(&pdev->dev, ++ "Missing 'rockchip,grf' property\n"); ++ return PTR_ERR(grf); ++ } ++ ++ rk3308 = devm_kzalloc(&pdev->dev, sizeof(*rk3308), GFP_KERNEL); ++ if (!rk3308) ++ return -ENOMEM; ++ ++ ret = rk3308_codec_sysfs_init(pdev, rk3308); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Sysfs init failed\n"); ++ return ret; ++ } ++ ++ rk3308->plat_dev = &pdev->dev; ++ ++ rk3308->reset = devm_reset_control_get(&pdev->dev, "acodec-reset"); ++ if (IS_ERR(rk3308->reset)) { ++ ret = PTR_ERR(rk3308->reset); ++ if (ret != -ENOENT) ++ return ret; ++ ++ dev_dbg(&pdev->dev, "No reset control found\n"); ++ rk3308->reset = NULL; ++ } ++ ++ /* GPIO0_A5 control speaker on RK3308 EVB */ ++ rk3308->spk_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "spk_ctl", ++ GPIOD_OUT_HIGH); ++ if (IS_ERR(rk3308->spk_ctl_gpio)) { ++ ret = PTR_ERR(rk3308->spk_ctl_gpio); ++ dev_err(&pdev->dev, "Unable to claim gpio spk_ctl\n"); ++ return ret; ++ } ++ ++ rk3308->pclk = devm_clk_get(&pdev->dev, "acodec"); ++ if (IS_ERR(rk3308->pclk)) { ++ dev_err(&pdev->dev, "Can't get acodec pclk\n"); ++ return PTR_ERR(rk3308->pclk); ++ } ++ ++ ret = clk_prepare_enable(rk3308->pclk); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to enable acodec pclk: %d\n", ret); ++ return ret; ++ } ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ base = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(base)) { ++ ret = PTR_ERR(base); ++ dev_err(&pdev->dev, "Failed to ioremap resource\n"); ++ goto failed; ++ } ++ ++ rk3308->regmap = devm_regmap_init_mmio(&pdev->dev, base, ++ &rk3308_codec_regmap_config); ++ if (IS_ERR(rk3308->regmap)) { ++ ret = PTR_ERR(rk3308->regmap); ++ dev_err(&pdev->dev, "Failed to regmap mmio\n"); ++ goto failed; ++ } ++ ++ platform_set_drvdata(pdev, rk3308); ++ ++ ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308, ++ rk3308_dai, ARRAY_SIZE(rk3308_dai)); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); ++ goto failed; ++ } ++ ++ return ret; ++ ++failed: ++ clk_disable_unprepare(rk3308->pclk); ++ ++ return ret; ++} ++ ++static int rk3308_platform_remove(struct platform_device *pdev) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ (struct rk3308_codec_priv *)platform_get_drvdata(pdev); ++ ++ clk_disable_unprepare(rk3308->pclk); ++ snd_soc_unregister_codec(&pdev->dev); ++ ++ return 0; ++} ++ ++static const struct of_device_id rk3308codec_of_match[] = { ++ { .compatible = "rockchip,rk3308-codec", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, rk3308codec_of_match); ++ ++static struct platform_driver rk3308_codec_driver = { ++ .driver = { ++ .name = "rk3308-acodec", ++ .of_match_table = of_match_ptr(rk3308codec_of_match), ++ }, ++ .probe = rk3308_platform_probe, ++ .remove = rk3308_platform_remove, ++}; ++module_platform_driver(rk3308_codec_driver); ++ ++MODULE_AUTHOR("Xing Zheng "); ++MODULE_DESCRIPTION("ASoC RK3308 Codec Driver"); ++MODULE_LICENSE("GPL v2"); +diff --git a/sound/soc/codecs/rk3308_codec.h b/sound/soc/codecs/rk3308_codec.h +new file mode 100644 +index 000000000000..6cfa69157785 +--- /dev/null ++++ b/sound/soc/codecs/rk3308_codec.h +@@ -0,0 +1,960 @@ ++/* ++ * rk3308_codec.h -- RK3308 ALSA Soc Audio Driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef __RK3308_CODEC_H__ ++#define __RK3308_CODEC_H__ ++ ++#define ACODEC_RESET_CTL 0x00 /* REG 0x00 */ ++ ++/* ADC DIGITAL REGISTERS */ ++#define ACODEC_ADC_I2S_CTL0 0x04 /* REG 0x01 */ ++#define ACODEC_ADC_I2S_CTL1 0x08 /* REG 0x02 */ ++#define ACODEC_ADC_BIST_MODE_SEL 0x0c /* REG 0x03 */ ++/* Resevred REG 0x04 ~ 0x06 */ ++#define ACODEC_ADC_DATA_PATH 0x1c /* REG 0x07 */ ++/* Resevred REG 0x08 ~ 0x0f */ ++ ++/* REG 0x10 ~ 0x1c are used to configure AGC of Left channel (ALC1) */ ++#define ACODEC_ADC_PGA_AGC_L_CTL0 0x40 /* REG 0x10 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL1 0x44 /* REG 0x11 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL2 0x48 /* REG 0x12 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL3 0x4c /* REG 0x13 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL4 0x50 /* REG 0x14 */ ++#define ACODEC_ADC_PGA_AGC_L_LO_MAX 0x54 /* REG 0x15 */ ++#define ACODEC_ADC_PGA_AGC_L_HI_MAX 0x58 /* REG 0x16 */ ++#define ACODEC_ADC_PGA_AGC_L_LO_MIN 0x5c /* REG 0x17 */ ++#define ACODEC_ADC_PGA_AGC_L_HI_MIN 0x60 /* REG 0x18 */ ++#define ACODEC_ADC_PGA_AGC_L_CTL5 0x64 /* REG 0x19 */ ++/* Resevred REG 0x1a ~ 0x1b */ ++#define ACODEC_ADC_AGC_L_RO_GAIN 0x70 /* REG 0x1c */ ++ ++/* REG 0x20 ~ 0x2c are used to configure AGC of Right channel (ALC2) */ ++#define ACODEC_ADC_PGA_AGC_R_CTL0 0x80 /* REG 0x20 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL1 0x84 /* REG 0x21 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL2 0x88 /* REG 0x22 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL3 0x8c /* REG 0x23 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL4 0x90 /* REG 0x24 */ ++#define ACODEC_ADC_PGA_AGC_R_LO_MAX 0x94 /* REG 0x25 */ ++#define ACODEC_ADC_PGA_AGC_R_HI_MAX 0x98 /* REG 0x26 */ ++#define ACODEC_ADC_PGA_AGC_R_LO_MIN 0x9c /* REG 0x27 */ ++#define ACODEC_ADC_PGA_AGC_R_HI_MIN 0xa0 /* REG 0x28 */ ++#define ACODEC_ADC_PGA_AGC_R_CTL5 0xa4 /* REG 0x29 */ ++/* Resevred REG 0x2a ~ 0x2b */ ++#define ACODEC_ADC_AGC_R_RO_GAIN 0xb0 /* REG 0x2c */ ++ ++/* DAC DIGITAL REGISTERS */ ++#define ACODEC_DAC_I2S_CTL0 0x04 /* REG 0x01 */ ++#define ACODEC_DAC_I2S_CTL1 0x08 /* REG 0x02 */ ++#define ACODEC_DAC_BIST_MODE_SEL 0x0c /* REG 0x03 */ ++/* Resevred REG 0x04 */ ++#define ACODEC_DAC_DATA_SEL 0x14 /* REG 0x05 */ ++/* Resevred REG 0x06 ~ 0x09 */ ++#define ACODEC_DAC_DATA_HI 0x28 /* REG 0x0a */ ++#define ACODEC_DAC_DATA_LO 0x2c /* REG 0x0b */ ++/* Resevred REG 0x0c ~ 0x0f */ ++ ++/* ADC ANALOG REGISTERS */ ++#define ACODEC_ADC_ANA_MIC_CTL 0x00 /* REG 0x00 */ ++#define ACODEC_ADC_ANA_MIC_GAIN 0x04 /* REG 0x01 */ ++#define ACODEC_ADC_ANA_ALC_CTL 0x08 /* REG 0x02 */ ++#define ACODEC_ADC_ANA_ALC_GAIN1 0x0c /* REG 0x03 */ ++#define ACODEC_ADC_ANA_ALC_GAIN2 0x10 /* REG 0x04 */ ++#define ACODEC_ADC_ANA_CTL0 0x14 /* REG 0x05 */ ++#define ACODEC_ADC_ANA_CTL1 0x18 /* REG 0x06 */ ++#define ACODEC_ADC_ANA_CTL2 0x1c /* REG 0x07 */ ++#define ACODEC_ADC_ANA_CTL3 0x20 /* REG 0x08 */ ++/* Resevred REG 0x09 */ ++#define ACODEC_ADC_ANA_CTL4 0x28 /* REG 0x0a */ ++#define ACODEC_ADC_ANA_ALC_PGA 0x2c /* REG 0x0b */ ++/* Resevred REG 0x0c ~ 0x0f */ ++ ++/* DAC ANALOG REGISTERS */ ++#define ACODEC_DAC_ANA_CTL0 0x00 /* REG 0x00 */ ++#define ACODEC_DAC_ANA_POP_VOLT 0x04 /* REG 0x01 */ ++#define ACODEC_DAC_ANA_CTL1 0x08 /* REG 0x02 */ ++#define ACODEC_DAC_ANA_HPOUT 0x0c /* REG 0x03 */ ++#define ACODEC_DAC_ANA_LINEOUT 0x10 /* REG 0x04 */ ++#define ACODEC_DAC_ANA_L_HPOUT_GAIN 0x14 /* REG 0x05 */ ++#define ACODEC_DAC_ANA_R_HPOUT_GAIN 0x18 /* REG 0x06 */ ++/* Resevred REG 0x07 ~ 0x0b */ ++#define ACODEC_DAC_ANA_HPMIX_CTL0 0x30 /* REG 0x0c */ ++#define ACODEC_DAC_ANA_HPMIX_CTL1 0x34 /* REG 0x0d */ ++/* Resevred REG 0x0e ~ 0x0f */ ++ ++/* ++ * These registers are referenced by codec driver ++ */ ++ ++#define RK3308_GLB_CON ACODEC_RESET_CTL ++ ++/* ADC DIGITAL REGISTERS */ ++ ++/* ++ * The ADC chanel are 0 ~ 3, that control: ++ * ++ * CH0: left_0(ADC1) and right_0(ADC2) ++ * CH1: left_1(ADC3) and right_1(ADC4) ++ * CH2: left_2(ADC5) and right_2(ADC6) ++ * CH3: left_3(ADC7) and right_3(ADC8) ++ */ ++#define RK3308_ADC_DIG_OFFSET(ch) ((ch & 0x3) * 0xc0 + 0x0) ++ ++#define RK3308_ADC_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL0) ++#define RK3308_ADC_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL1) ++#define RK3308_ADC_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_BIST_MODE_SEL) ++#define RK3308_ADC_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_DATA_PATH) ++ ++#define RK3308_ALC_L_DIG_CON00(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL0) ++#define RK3308_ALC_L_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL1) ++#define RK3308_ALC_L_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL2) ++#define RK3308_ALC_L_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL3) ++#define RK3308_ALC_L_DIG_CON04(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL4) ++#define RK3308_ALC_L_DIG_CON05(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_LO_MAX) ++#define RK3308_ALC_L_DIG_CON06(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_HI_MAX) ++#define RK3308_ALC_L_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_LO_MIN) ++#define RK3308_ALC_L_DIG_CON08(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_HI_MIN) ++#define RK3308_ALC_L_DIG_CON09(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL5) ++#define RK3308_ALC_L_DIG_CON12(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_AGC_L_RO_GAIN) ++ ++#define RK3308_ALC_R_DIG_CON00(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL0) ++#define RK3308_ALC_R_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL1) ++#define RK3308_ALC_R_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL2) ++#define RK3308_ALC_R_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL3) ++#define RK3308_ALC_R_DIG_CON04(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL4) ++#define RK3308_ALC_R_DIG_CON05(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_LO_MAX) ++#define RK3308_ALC_R_DIG_CON06(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_HI_MAX) ++#define RK3308_ALC_R_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_LO_MIN) ++#define RK3308_ALC_R_DIG_CON08(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_HI_MIN) ++#define RK3308_ALC_R_DIG_CON09(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_R_CTL5) ++#define RK3308_ALC_R_DIG_CON12(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_AGC_R_RO_GAIN) ++ ++/* DAC DIGITAL REGISTERS */ ++#define RK3308_DAC_DIG_OFFSET 0x300 ++ ++#define RK3308_DAC_DIG_CON01 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL0) ++#define RK3308_DAC_DIG_CON02 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL1) ++#define RK3308_DAC_DIG_CON03 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_BIST_MODE_SEL) ++#define RK3308_DAC_DIG_CON05 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_SEL) ++#define RK3308_DAC_DIG_CON10 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_HI) ++#define RK3308_DAC_DIG_CON11 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_LO) ++ ++/* ADC ANALOG REGISTERS */ ++/* ++ * The ADC chanel are 0 ~ 3, that control: ++ * ++ * CH0: left_0(ADC1) and right_0(ADC2) ++ * CH1: left_1(ADC3) and right_1(ADC4) ++ * CH2: left_2(ADC5) and right_2(ADC6) ++ * CH3: left_3(ADC7) and right_3(ADC8) ++ */ ++#define RK3308_ADC_ANA_OFFSET(ch) ((ch & 0x3) * 0x40 + 0x340) ++ ++#define RK3308_ADC_ANA_CON00(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_MIC_CTL) ++#define RK3308_ADC_ANA_CON01(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_MIC_GAIN) ++#define RK3308_ADC_ANA_CON02(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_CTL) ++#define RK3308_ADC_ANA_CON03(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_GAIN1) ++#define RK3308_ADC_ANA_CON04(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_GAIN2) ++#define RK3308_ADC_ANA_CON05(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL0) ++#define RK3308_ADC_ANA_CON06(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL1) ++#define RK3308_ADC_ANA_CON07(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL2) ++#define RK3308_ADC_ANA_CON08(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL3) ++#define RK3308_ADC_ANA_CON10(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_CTL4) ++#define RK3308_ADC_ANA_CON11(ch) (RK3308_ADC_ANA_OFFSET(ch) + ACODEC_ADC_ANA_ALC_PGA) ++ ++/* DAC ANALOG REGISTERS */ ++#define RK3308_DAC_ANA_OFFSET 0x440 ++ ++#define RK3308_DAC_ANA_CON00 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL0) ++#define RK3308_DAC_ANA_CON01 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_POP_VOLT) ++#define RK3308_DAC_ANA_CON02 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL1) ++#define RK3308_DAC_ANA_CON03 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPOUT) ++#define RK3308_DAC_ANA_CON04 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT) ++#define RK3308_DAC_ANA_CON05 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_L_HPOUT_GAIN) ++#define RK3308_DAC_ANA_CON06 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_R_HPOUT_GAIN) ++#define RK3308_DAC_ANA_CON12 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL0) ++#define RK3308_DAC_ANA_CON13 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL1) ++ ++/* ++ * These are the bits for registers ++ */ ++ ++/* RK3308_GLB_CON - REG: 0x0000 */ ++#define RK3308_ADC_BIST_WORK (1 << 7) ++#define RK3308_ADC_BIST_RESET (0 << 7) ++#define RK3308_DAC_BIST_WORK (1 << 6) ++#define RK3308_DAC_BIST_RESET (0 << 6) ++#define RK3308_CODEC_RST_MSK (0x7 << 0) ++#define RK3308_ADC_DIG_WORK (1 << 2) ++#define RK3308_ADC_DIG_RESET (0 << 2) ++#define RK3308_DAC_DIG_WORK (1 << 1) ++#define RK3308_DAC_DIG_RESET (0 << 1) ++#define RK3308_SYS_WORK (1 << 0) ++#define RK3308_SYS_RESET (0 << 0) ++ ++/* RK3308_ADC_DIG_CON01 - REG: 0x0004 */ ++#define RK3308_ADC_I2S_LRC_POL_MSK (1 << 0) ++#define RK3308_ADC_I2S_LRC_POL_REVERSAL (1 << 0) ++#define RK3308_ADC_I2S_LRC_POL_NORMAL (0 << 0) ++#define RK3308_ADC_I2S_VALID_LEN_SFT 5 ++#define RK3308_ADC_I2S_VALID_LEN_MSK (0x3 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_32BITS (0x3 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_24BITS (0x2 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_20BITS (0x1 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_VALID_LEN_16BITS (0x0 << RK3308_ADC_I2S_VALID_LEN_SFT) ++#define RK3308_ADC_I2S_MODE_SFT 3 ++#define RK3308_ADC_I2S_MODE_MSK (0x3 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_PCM (0x3 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_I2S (0x2 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_LJ (0x1 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_MODE_RJ (0x0 << RK3308_ADC_I2S_MODE_SFT) ++#define RK3308_ADC_I2S_LR_MSK (1 << 1) ++#define RK3308_ADC_I2S_LR_SWAP (1 << 1) ++#define RK3308_ADC_I2S_LR_NORMAL (0 << 1) ++#define RK3308_ADC_I2S_TYPE_MSK (1 << 0) ++#define RK3308_ADC_I2S_MONO (1 << 0) ++#define RK3308_ADC_I2S_STEREO (0 << 0) ++ ++/* RK3308_ADC_DIG_CON02 - REG: 0x0008 */ ++#define RK3308_ADC_IO_MODE_MSK (1 << 5) ++#define RK3308_ADC_IO_MODE_MASTER (1 << 5) ++#define RK3308_ADC_IO_MODE_SLAVE (0 << 5) ++#define RK3308_ADC_MODE_MSK (1 << 4) ++#define RK3308_ADC_MODE_MASTER (1 << 4) ++#define RK3308_ADC_MODE_SLAVE (0 << 4) ++#define RK3308_ADC_I2S_FRAME_LEN_SFT 2 ++#define RK3308_ADC_I2S_FRAME_LEN_MSK (0x3 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_32BITS (0x3 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_24BITS (0x2 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_20BITS (0x1 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_FRAME_16BITS (0x0 << RK3308_ADC_I2S_FRAME_LEN_SFT) ++#define RK3308_ADC_I2S_MSK (0x1 << 1) ++#define RK3308_ADC_I2S_WORK (0x1 << 1) ++#define RK3308_ADC_I2S_RESET (0x0 << 1) ++#define RK3308_ADC_I2S_BIT_CLK_POL_MSK (0x1 << 0) ++#define RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL (0x1 << 0) ++#define RK3308_ADC_I2S_BIT_CLK_POL_NORMAL (0x0 << 0) ++ ++/* RK3308_ADC_DIG_CON03 - REG: 0x000c */ ++#define RK3308_ADC_L_CH_BIST_SFT 2 ++#define RK3308_ADC_L_CH_BIST_MSK (0x3 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_LEFT (0x3 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_L_CH_BIST_SINE (0x2 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_CUBE (0x1 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_RIGHT (0x0 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_BIST_SFT 0 ++#define RK3308_ADC_R_CH_BIST_MSK (0x3 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_LEFT (0x3 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_BIST_SINE (0x2 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_CUBE (0x1 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_RIGHT (0x0 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++ ++/* RK3308_ADC_DIG_CON07 - REG: 0x001c */ ++#define RK3308_ADCL_DATA_SFT 4 ++#define RK3308_ADCL_DATA(x) (x << RK3308_ADCL_DATA_SFT) ++#define RK3308_ADCR_DATA_SFT 2 ++#define RK3308_ADCR_DATA(x) (x << RK3308_ADCR_DATA_SFT) ++#define RK3308_ADCL_DATA_SEL_ADCL (0x1 << 1) ++#define RK3308_ADCL_DATA_SEL_NORMAL (0x0 << 1) ++#define RK3308_ADCR_DATA_SEL_ADCR (0x1 << 0) ++#define RK3308_ADCR_DATA_SEL_NORMAL (0x0 << 0) ++ ++/* ++ * RK3308_ALC_L_DIG_CON00 - REG: 0x0040 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON00 - REG: 0x0080 + ch * 0xc0 ++ */ ++#define RK3308_GAIN_ATTACK_JACK (0x1 << 6) ++#define RK3308_GAIN_ATTACK_NORMAL (0x0 << 6) ++#define RK3308_CTRL_GEN_SFT 4 ++#define RK3308_CTRL_GEN_MSK (0x3 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_JACK3 (0x3 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_JACK2 (0x2 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_JACK1 (0x1 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_CTRL_GEN_NORMAL (0x0 << RK3308_ALC_CTRL_GEN_SFT) ++#define RK3308_AGC_HOLD_TIME_SFT 0 ++#define RK3308_AGC_HOLD_TIME_MSK (0xf << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_1S (0xa << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_512MS (0x9 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_256MS (0x8 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_128MS (0x7 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_64MS (0x6 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_32MS (0x5 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_16MS (0x4 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_8MS (0x3 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_4MS (0x2 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_2MS (0x1 << RK3308_AGC_HOLD_TIME_SFT) ++#define RK3308_AGC_HOLD_TIME_0MS (0x0 << RK3308_AGC_HOLD_TIME_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON01 - REG: 0x0044 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON01 - REG: 0x0084 + ch * 0xc0 ++ */ ++#define RK3308_AGC_DECAY_TIME_SFT 4 ++/* Normal mode (reg_agc_mode = 0) */ ++#define RK3308_AGC_DECAY_NORMAL_MSK (0xf << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_512MS (0xa << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_256MS (0x9 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_128MS (0x8 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_64MS (0x7 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_32MS (0x6 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_16MS (0x5 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_8MS (0x4 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_4MS (0x3 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_2MS (0x2 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_1MS (0x1 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_NORMAL_0MS (0x0 << RK3308_AGC_DECAY_TIME_SFT) ++/* Limiter mode (reg_agc_mode = 1) */ ++#define RK3308_AGC_DECAY_LIMITER_MSK (0xf << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_128MS (0xa << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_64MS (0x9 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_32MS (0x8 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_16MS (0x7 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_8MS (0x6 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_4MS (0x5 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_2MS (0x4 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_1MS (0x3 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_500US (0x2 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_250US (0x1 << RK3308_AGC_DECAY_TIME_SFT) ++#define RK3308_AGC_DECAY_LIMITER_125US (0x0 << RK3308_AGC_DECAY_TIME_SFT) ++ ++#define RK3308_AGC_ATTACK_TIME_SFT 0 ++/* Normal mode (reg_agc_mode = 0) */ ++#define RK3308_AGC_ATTACK_NORMAL_MSK (0xf << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_128MS (0xa << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_64MS (0x9 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_32MS (0x8 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_16MS (0x7 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_8MS (0x6 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_4MS (0x5 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_2MS (0x4 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_1MS (0x3 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_500US (0x2 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_250US (0x1 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_NORMAL_125US (0x0 << RK3308_AGC_ATTACK_TIME_SFT) ++/* Limiter mode (reg_agc_mode = 1) */ ++#define RK3308_AGC_ATTACK_LIMITER_MSK (0xf << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_32MS (0xa << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_16MS (0x9 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_8MS (0x8 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_4MS (0x7 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_2MS (0x6 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_1MS (0x5 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_500US (0x4 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_250US (0x3 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_125US (0x2 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_64US (0x1 << RK3308_AGC_ATTACK_TIME_SFT) ++#define RK3308_AGC_ATTACK_LIMITER_32US (0x0 << RK3308_AGC_ATTACK_TIME_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON02 - REG: 0x0048 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON02 - REG: 0x0088 + ch * 0xc0 ++ */ ++#define RK3308_AGC_MODE_LIMITER (0x1 << 7) ++#define RK3308_AGC_MODE_NORMAL (0x0 << 7) ++#define RK3308_AGC_ZERO_CRO_EN (0x1 << 6) ++#define RK3308_AGC_ZERO_CRO_DIS (0x0 << 6) ++#define RK3308_AGC_AMP_RECOVER_GAIN (0x1 << 5) ++#define RK3308_AGC_AMP_RECOVER_LVOL (0x0 << 5) ++#define RK3308_AGC_FAST_DEC_EN (0x1 << 4) ++#define RK3308_AGC_FAST_DEC_DIS (0x0 << 4) ++#define RK3308_AGC_NOISE_GATE_EN (0x1 << 3) ++#define RK3308_AGC_NOISE_GATE_DIS (0x0 << 3) ++#define RK3308_AGC_NOISE_GATE_THRESH_SFT 0 ++#define RK3308_AGC_NOISE_GATE_THRESH_MSK (0x7 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N81DB (0x7 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N75DB (0x6 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N69DB (0x5 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N63DB (0x4 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N57DB (0x3 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N51DB (0x2 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N45DB (0x1 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++#define RK3308_AGC_NOISE_GATE_THRESH_N39DB (0x0 << RK3308_AGC_NOISE_GATE_THRESH_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON03 - REG: 0x004c + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON03 - REG: 0x008c + ch * 0xc0 ++ */ ++#define RK3308_AGC_PGA_ZERO_CRO_EN (0x1 << 5) ++#define RK3308_AGC_PGA_ZERO_CRO_DIS (0x0 << 5) ++#define RK3308_AGC_PGA_GAIN_SFT 0 ++#define RK3308_AGC_PGA_GAIN_MSK (0x1f << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_28_5 (0x1f << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_27 (0x1e << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_25_5 (0x1d << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_24 (0x1c << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_22_5 (0x1b << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_21 (0x1a << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_19_5 (0x19 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_18 (0x18 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_16_5 (0x17 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_15 (0x16 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_13_5 (0x15 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_12 (0x14 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_10_5 (0x13 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_9 (0x12 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_7_5 (0x11 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_6 (0x10 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_4_5 (0x0f << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_3 (0x0e << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_PDB_1_5 (0x0d << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_0DB (0x0c << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_1_5 (0x0b << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_3 (0x0a << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_4_5 (0x09 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_6 (0x08 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_7_5 (0x07 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_9 (0x06 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_10_5 (0x05 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_12 (0x04 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_13_5 (0x03 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_15 (0x02 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_16_5 (0x01 << RK3308_AGC_PGA_GAIN_SFT) ++#define RK3308_AGC_PGA_GAIN_NDB_18 (0x00 << RK3308_AGC_PGA_GAIN_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON04 - REG: 0x0050 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON04 - REG: 0x0090 + ch * 0xc0 ++ */ ++#define RK3308_AGC_SLOW_CLK_EN (0x1 << 3) ++#define RK3308_AGC_SLOW_CLK_DIS (0x0 << 3) ++#define RK3308_AGC_APPROX_RATE_SFT 0 ++#define RK3308_AGC_APPROX_RATE_MSK (0x7 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_8K (0x7 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_12K (0x6 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_16K (0x5 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_24K (0x4 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_32K (0x3 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_44_1K (0x2 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_48K (0x1 << RK3308_AGC_APPROX_RATE_SFT) ++#define RK3308_AGC_APPROX_RATE_96K (0x0 << RK3308_AGC_APPROX_RATE_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON05 - REG: 0x0054 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON05 - REG: 0x0094 + ch * 0xc0 ++ */ ++#define RK3308_AGC_LO_8BITS_AGC_MAX_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON06 - REG: 0x0058 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON06 - REG: 0x0098 + ch * 0xc0 ++ */ ++#define RK3308_AGC_HI_8BITS_AGC_MAX_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON07 - REG: 0x005c + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON07 - REG: 0x009c + ch * 0xc0 ++ */ ++#define RK3308_AGC_LO_8BITS_AGC_MIN_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON08 - REG: 0x0060 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON08 - REG: 0x00a0 + ch * 0xc0 ++ */ ++#define RK3308_AGC_HI_8BITS_AGC_MIN_MSK 0xff ++ ++/* ++ * RK3308_ALC_L_DIG_CON09 - REG: 0x0064 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON09 - REG: 0x00a4 + ch * 0xc0 ++ */ ++#define RK3308_AGC_FUNC_SEL_MSK (0x1 << 6) ++#define RK3308_AGC_FUNC_SEL_EN (0x1 << 6) ++#define RK3308_AGC_FUNC_SEL_DIS (0x0 << 6) ++#define RK3308_AGC_MAX_GAIN_PGA_SFT 3 ++#define RK3308_AGC_MAX_GAIN_PGA_MSK (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_28_5 (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_22_5 (0x6 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_16_5 (0x5 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_10_5 (0x4 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_PDB_4_5 (0x3 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_NDB_1_5 (0x2 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_NDB_7_5 (0x1 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MAX_GAIN_PGA_NDB_13_5 (0x0 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_SFT 0 ++#define RK3308_AGC_MIN_GAIN_PGA_MSK (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_24 (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_18 (0x6 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_12 (0x5 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_PDB_6 (0x4 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_0DB (0x3 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_NDB_6 (0x2 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_NDB_12 (0x1 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_NDB_18 (0x0 << RK3308_AGC_MIN_GAIN_PGA_SFT) ++ ++/* ++ * RK3308_ALC_L_DIG_CON12 - REG: 0x0068 + ch * 0xc0 ++ * RK3308_ALC_R_DIG_CON12 - REG: 0x00a8 + ch * 0xc0 ++ */ ++#define RK3308_AGC_GAIN_MSK 0x1f ++ ++/* RK3308_DAC_DIG_CON01 - REG: 0x0304 */ ++#define RK3308_DAC_I2S_LRC_POL_MSK (0x1 << 7) ++#define RK3308_DAC_I2S_LRC_POL_REVERSAL (0x1 << 7) ++#define RK3308_DAC_I2S_LRC_POL_NORMAL (0x0 << 7) ++#define RK3308_DAC_I2S_VALID_LEN_SFT 5 ++#define RK3308_DAC_I2S_VALID_LEN_MSK (0x3 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_32BITS (0x3 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_24BITS (0x2 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_20BITS (0x1 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_VALID_LEN_16BITS (0x0 << RK3308_DAC_I2S_VALID_LEN_SFT) ++#define RK3308_DAC_I2S_MODE_SFT 3 ++#define RK3308_DAC_I2S_MODE_MSK (0x3 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_PCM (0x3 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_I2S (0x2 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_LJ (0x1 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_MODE_RJ (0x0 << RK3308_DAC_I2S_MODE_SFT) ++#define RK3308_DAC_I2S_LR_MSK (0x1 << 2) ++#define RK3308_DAC_I2S_LR_SWAP (0x1 << 2) ++#define RK3308_DAC_I2S_LR_NORMAL (0x0 << 2) ++ ++/* RK3308_DAC_DIG_CON02 - REG: 0x0308 */ ++#define RK3308_DAC_IO_MODE_MSK (0x1 << 5) ++#define RK3308_DAC_IO_MODE_MASTER (0x1 << 5) ++#define RK3308_DAC_IO_MODE_SLAVE (0x0 << 5) ++#define RK3308_DAC_MODE_MSK (0x1 << 4) ++#define RK3308_DAC_MODE_MASTER (0x1 << 4) ++#define RK3308_DAC_MODE_SLAVE (0x0 << 4) ++#define RK3308_DAC_I2S_FRAME_LEN_SFT 2 ++#define RK3308_DAC_I2S_FRAME_LEN_MSK (0x3 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_32BITS (0x3 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_24BITS (0x2 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_20BITS (0x1 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_FRAME_16BITS (0x0 << RK3308_DAC_I2S_FRAME_LEN_SFT) ++#define RK3308_DAC_I2S_MSK (0x1 << 1) ++#define RK3308_DAC_I2S_WORK (0x1 << 1) ++#define RK3308_DAC_I2S_RESET (0x0 << 1) ++#define RK3308_DAC_I2S_BIT_CLK_POL_MSK (0x1 << 0) ++#define RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL (0x1 << 0) ++#define RK3308_DAC_I2S_BIT_CLK_POL_NORMAL (0x0 << 0) ++ ++/* RK3308_DAC_DIG_CON03 - REG: 0x030C */ ++#define RK3308_DAC_L_CH_BIST_SFT 2 ++#define RK3308_DAC_L_CH_BIST_MSK (0x3 << RK3308_DAC_L_CH_BIST_SFT) ++#define RK3308_DAC_L_CH_BIST_LEFT (0x3 << RK3308_DAC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_DAC_L_CH_BIST_CUBE (0x2 << RK3308_DAC_L_CH_BIST_SFT) ++#define RK3308_DAC_L_CH_BIST_SINE (0x1 << RK3308_DAC_L_CH_BIST_SFT) ++#define RK3308_DAC_L_CH_BIST_RIGHT (0x0 << RK3308_DAC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_DAC_R_CH_BIST_SFT 0 ++#define RK3308_DAC_R_CH_BIST_MSK (0x3 << RK3308_DAC_R_CH_BIST_SFT) ++#define RK3308_DAC_R_CH_BIST_LEFT (0x3 << RK3308_DAC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_DAC_R_CH_BIST_CUBE (0x2 << RK3308_DAC_R_CH_BIST_SFT) ++#define RK3308_DAC_R_CH_BIST_SINE (0x1 << RK3308_DAC_R_CH_BIST_SFT) ++#define RK3308_DAC_R_CH_BIST_RIGHT (0x0 << RK3308_DAC_R_CH_BIST_SFT) /* normal mode */ ++ ++/* RK3308_DAC_DIG_CON05 - REG: 0x0314 */ ++#define RK3308_DAC_L_REG_CTL_INDATA (0x1 << 2) ++#define RK3308_DAC_L_NORMAL_DATA (0x0 << 2) ++#define RK3308_DAC_R_REG_CTL_INDATA (0x1 << 1) ++#define RK3308_DAC_R_NORMAL_DATA (0x0 << 1) ++ ++/* RK3308_DAC_DIG_CON10 - REG: 0x0328 */ ++#define RK3308_DAC_DATA_HI4(x) (x & 0xf) /* Need to RK3308_DAC_x_REG_CTL_INDATA */ ++ ++/* RK3308_DAC_DIG_CON11 - REG: 0x032c */ ++#define RK3308_DAC_DATA_LO8(x) (x & 0xff) /* Need to RK3308_DAC_x_REG_CTL_INDATA */ ++ ++/* RK3308_ADC_ANA_CON00 - REG: 0x0340 */ ++#define RK3308_ADC_CH1_CH2_MIC_ALL_MSK (0xff << 0) ++#define RK3308_ADC_CH1_CH2_MIC_ALL 0xff ++#define RK3308_ADC_CH2_MIC_UNMUTE (0x1 << 7) ++#define RK3308_ADC_CH2_MIC_MUTE (0x0 << 7) ++#define RK3308_ADC_CH2_MIC_WORK (0x1 << 6) ++#define RK3308_ADC_CH2_MIC_INIT (0x0 << 6) ++#define RK3308_ADC_CH2_MIC_EN (0x1 << 5) ++#define RK3308_ADC_CH2_MIC_DIS (0x0 << 5) ++#define RK3308_ADC_CH2_BUF_REF_EN (0x1 << 4) ++#define RK3308_ADC_CH2_BUF_REF_DIS (0x0 << 4) ++#define RK3308_ADC_CH1_MIC_UNMUTE (0x1 << 3) ++#define RK3308_ADC_CH1_MIC_MUTE (0x0 << 3) ++#define RK3308_ADC_CH1_MIC_WORK (0x1 << 2) ++#define RK3308_ADC_CH1_MIC_INIT (0x0 << 2) ++#define RK3308_ADC_CH1_MIC_EN (0x1 << 1) ++#define RK3308_ADC_CH1_MIC_DIS (0x0 << 1) ++#define RK3308_ADC_CH1_BUF_REF_EN (0x1 << 0) ++#define RK3308_ADC_CH1_BUF_REF_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON01 - REG: 0x0344 */ ++#define RK3308_ADC_CH2_MIC_GAIN_SFT 4 ++#define RK3308_ADC_CH2_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_SFT 0 ++#define RK3308_ADC_CH1_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++ ++/* RK3308_ADC_ANA_CON02 - REG: 0x0348 */ ++#define RK3308_ADC_CH2_ALC_ZC_MSK (0x7 << 4) ++#define RK3308_ADC_CH2_ZEROCROSS_DET_EN (0x1 << 6) ++#define RK3308_ADC_CH2_ZEROCROSS_DET_DIS (0x0 << 6) ++#define RK3308_ADC_CH2_ALC_WORK (0x1 << 5) ++#define RK3308_ADC_CH2_ALC_INIT (0x0 << 5) ++#define RK3308_ADC_CH2_ALC_EN (0x1 << 4) ++#define RK3308_ADC_CH2_ALC_DIS (0x0 << 4) ++ ++#define RK3308_ADC_CH1_ALC_ZC_MSK (0x7 << 0) ++#define RK3308_ADC_CH1_ZEROCROSS_DET_EN (0x1 << 2) ++#define RK3308_ADC_CH1_ZEROCROSS_DET_DIS (0x0 << 2) ++#define RK3308_ADC_CH1_ALC_WORK (0x1 << 1) ++#define RK3308_ADC_CH1_ALC_INIT (0x0 << 1) ++#define RK3308_ADC_CH1_ALC_EN (0x1 << 0) ++#define RK3308_ADC_CH1_ALC_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON03 - REG: 0x034c */ ++#define RK3308_ADC_CH1_ALC_GAIN_SFT 0 ++#define RK3308_ADC_CH1_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_27 (0x1e << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_25_5 (0x1d << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_24 (0x1c << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_22_5 (0x1b << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_21 (0x1a << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_19_5 (0x19 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_18 (0x18 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_16_5 (0x17 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_15 (0x16 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_13_5 (0x15 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_12 (0x14 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_10_5 (0x13 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_9 (0x12 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_7_5 (0x11 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_6 (0x10 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_4_5 (0x0f << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_3 (0x0e << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_PDB_1_5 (0x0d << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_0DB (0x0c << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_1_5 (0x0b << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_3 (0x0a << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_4_5 (0x09 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_6 (0x08 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_7_5 (0x07 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_9 (0x06 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_10_5 (0x05 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_12 (0x04 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_13_5 (0x03 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_15 (0x02 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_16_5 (0x01 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++#define RK3308_ADC_CH1_ALC_GAIN_NDB_18 (0x00 << RK3308_ADC_CH1_ALC_GAIN_SFT) ++ ++/* RK3308_ADC_ANA_CON04 - REG: 0x0350 */ ++#define RK3308_ADC_CH2_ALC_GAIN_SFT 0 ++#define RK3308_ADC_CH2_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_27 (0x1e << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_25_5 (0x1d << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_24 (0x1c << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_22_5 (0x1b << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_21 (0x1a << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_19_5 (0x19 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_18 (0x18 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_16_5 (0x17 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_15 (0x16 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_13_5 (0x15 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_12 (0x14 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_10_5 (0x13 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_9 (0x12 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_7_5 (0x11 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_6 (0x10 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_4_5 (0x0f << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_3 (0x0e << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_PDB_1_5 (0x0d << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_0DB (0x0c << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_1_5 (0x0b << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_3 (0x0a << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_4_5 (0x09 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_6 (0x08 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_7_5 (0x07 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_9 (0x06 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_10_5 (0x05 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_12 (0x04 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_13_5 (0x03 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_15 (0x02 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_16_5 (0x01 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++#define RK3308_ADC_CH2_ALC_GAIN_NDB_18 (0x00 << RK3308_ADC_CH2_ALC_GAIN_SFT) ++ ++/* RK3308_ADC_ANA_CON05 - REG: 0x0354 */ ++#define RK3308_ADC_CH2_ADC_CLK_MSK (0x7 << 4) ++#define RK3308_ADC_CH2_ADC_WORK (0x1 << 6) ++#define RK3308_ADC_CH2_ADC_INIT (0x0 << 6) ++#define RK3308_ADC_CH2_ADC_EN (0x1 << 5) ++#define RK3308_ADC_CH2_ADC_DIS (0x0 << 5) ++#define RK3308_ADC_CH2_CLK_EN (0x1 << 4) ++#define RK3308_ADC_CH2_CLK_DIS (0x0 << 4) ++ ++#define RK3308_ADC_CH1_ADC_CLK_MSK (0x7 << 0) ++#define RK3308_ADC_CH1_ADC_WORK (0x1 << 2) ++#define RK3308_ADC_CH1_ADC_INIT (0x0 << 2) ++#define RK3308_ADC_CH1_ADC_EN (0x1 << 1) ++#define RK3308_ADC_CH1_ADC_DIS (0x0 << 1) ++#define RK3308_ADC_CH1_CLK_EN (0x1 << 0) ++#define RK3308_ADC_CH1_CLK_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON06 - REG: 0x0358 */ ++#define RK3308_ADC_CURRENT_MSK (0x1 << 0) ++#define RK3308_ADC_CURRENT_EN (0x1 << 0) ++#define RK3308_ADC_CURRENT_DIS (0x0 << 0) ++ ++/* RK3308_ADC_ANA_CON07 - REG: 0x035c */ ++/* Note: The register configuration is only valid for ADC2 */ ++#define RK3308_ADC_CH2_IN_SEL_SFT 6 ++#define RK3308_ADC_CH2_IN_SEL_MSK (0x3 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_LINEIN_MIC (0x3 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_LINEIN (0x2 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_MIC (0x1 << RK3308_ADC_CH2_IN_SEL_SFT) ++#define RK3308_ADC_CH2_IN_NONE (0x0 << RK3308_ADC_CH2_IN_SEL_SFT) ++/* Note: The register configuration is only valid for ADC1 */ ++#define RK3308_ADC_CH1_IN_SEL_SFT 4 ++#define RK3308_ADC_CH1_IN_SEL_MSK (0x3 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_LINEIN_MIC (0x3 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_LINEIN (0x2 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_MIC (0x1 << RK3308_ADC_CH1_IN_SEL_SFT) ++#define RK3308_ADC_CH1_IN_NONE (0x0 << RK3308_ADC_CH1_IN_SEL_SFT) ++ ++#define RK3308_ADC_MIC_BIAS_BUF_EN (0x1 << 3) ++#define RK3308_ADC_MIC_BIAS_BUF_DIS (0x0 << 3) ++#define RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT 0 ++#define RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_85 (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_8 (0x6 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_75 (0x5 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_7 (0x4 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_65 (0x3 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_6 (0x2 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_55 (0x1 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++#define RK3308_ADC_MICBIAS_VOLT_0_5 (0x0 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++ ++/* RK3308_ADC_ANA_CON08 - REG: 0x0360 */ ++#define RK3308_ADC_MICBIAS_CURRENT_MSK (0x1 << 4) ++#define RK3308_ADC_MICBIAS_CURRENT_EN (0x1 << 4) ++#define RK3308_ADC_MICBIAS_CURRENT_DIS (0x0 << 4) ++ ++/* RK3308_ADC_ANA_CON10 - REG: 0x0368 */ ++#define RK3308_ADC_REF_EN (0x1 << 7) ++#define RK3308_ADC_REF_DIS (0x0 << 7) ++#define RK3308_ADC_CURRENT_CHARGE_SFT 0 ++#define RK3308_ADC_CURRENT_CHARGE_MSK (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) ++#define RK3308_ADC_DONT_SEL_ALL (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) ++/* ++ * 0: Choose the current I ++ * 1: Don't choose the current I ++ */ ++#define RK3308_ADC_SEL_I_1(x) ((x & 0x1) << 6) ++#define RK3308_ADC_SEL_I_2(x) ((x & 0x1) << 5) ++#define RK3308_ADC_SEL_I_4(x) ((x & 0x1) << 4) ++#define RK3308_ADC_SEL_I_8(x) ((x & 0x1) << 3) ++#define RK3308_ADC_SEL_I_16(x) ((x & 0x1) << 2) ++#define RK3308_ADC_SEL_I_32(x) ((x & 0x1) << 1) ++#define RK3308_ADC_SEL_I_64(x) ((x & 0x1) << 0) ++ ++/* RK3308_ADC_ANA_CON11 - REG: 0x036c */ ++#define RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK (0x1 << 1) ++#define RK3308_ADC_ALCR_CON_GAIN_PGAR_EN (0x1 << 1) ++#define RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS (0x0 << 1) ++#define RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK (0x1 << 0) ++#define RK3308_ADC_ALCL_CON_GAIN_PGAL_EN (0x1 << 0) ++#define RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON00 - REG: 0x0440 */ ++#define RK3308_DAC_HEADPHONE_DET_EN (0x1 << 1) ++#define RK3308_DAC_HEADPHONE_DET_DIS (0x0 << 1) ++#define RK3308_DAC_CURRENT_MSK (0x1 << 0) ++#define RK3308_DAC_CURRENT_EN (0x1 << 0) ++#define RK3308_DAC_CURRENT_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON01 - REG: 0x0444 */ ++#define RK3308_DAC_BUF_REF_R_MSK (0x1 << 6) ++#define RK3308_DAC_BUF_REF_R_EN (0x1 << 6) ++#define RK3308_DAC_BUF_REF_R_DIS (0x0 << 6) ++#define RK3308_DAC_POP_SOUND_R_SFT 4 ++#define RK3308_DAC_POP_SOUND_R_MSK (0x3 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_POP_SOUND_R_WORK (0x2 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_POP_SOUND_R_INIT (0x1 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_BUF_REF_L_MSK (0x1 << 2) ++#define RK3308_DAC_BUF_REF_L_EN (0x1 << 2) ++#define RK3308_DAC_BUF_REF_L_DIS (0x0 << 2) ++#define RK3308_DAC_POP_SOUND_L_SFT 0 ++#define RK3308_DAC_POP_SOUND_L_MSK (0x3 << RK3308_DAC_POP_SOUND_L_SFT) ++#define RK3308_DAC_POP_SOUND_L_WORK (0x2 << RK3308_DAC_POP_SOUND_L_SFT) ++#define RK3308_DAC_POP_SOUND_L_INIT (0x1 << RK3308_DAC_POP_SOUND_L_SFT) ++ ++/* RK3308_DAC_ANA_CON02 - REG: 0x0448 */ ++#define RK3308_DAC_R_DAC_WORK (0x1 << 7) ++#define RK3308_DAC_R_DAC_INIT (0x0 << 7) ++#define RK3308_DAC_R_DAC_EN (0x1 << 6) ++#define RK3308_DAC_R_DAC_DIS (0x0 << 6) ++#define RK3308_DAC_R_CLK_EN (0x1 << 5) ++#define RK3308_DAC_R_CLK_DIS (0x0 << 5) ++#define RK3308_DAC_R_REF_EN (0x1 << 4) ++#define RK3308_DAC_R_REF_DIS (0x0 << 4) ++#define RK3308_DAC_L_DAC_WORK (0x1 << 3) ++#define RK3308_DAC_L_DAC_INIT (0x0 << 3) ++#define RK3308_DAC_L_DAC_EN (0x1 << 2) ++#define RK3308_DAC_L_DAC_DIS (0x0 << 2) ++#define RK3308_DAC_L_CLK_EN (0x1 << 1) ++#define RK3308_DAC_L_CLK_DIS (0x0 << 1) ++#define RK3308_DAC_L_REF_EN (0x1 << 0) ++#define RK3308_DAC_L_REF_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON03 - REG: 0x044c */ ++#define RK3308_DAC_R_HPOUT_WORK (0x1 << 6) ++#define RK3308_DAC_R_HPOUT_INIT (0x0 << 6) ++#define RK3308_DAC_R_HPOUT_EN (0x1 << 5) ++#define RK3308_DAC_R_HPOUT_DIS (0x0 << 5) ++#define RK3308_DAC_R_HPOUT_UNMUTE (0x1 << 4) ++#define RK3308_DAC_R_HPOUT_MUTE (0x0 << 4) ++#define RK3308_DAC_L_HPOUT_WORK (0x1 << 2) ++#define RK3308_DAC_L_HPOUT_INIT (0x0 << 2) ++#define RK3308_DAC_L_HPOUT_EN (0x1 << 1) ++#define RK3308_DAC_L_HPOUT_DIS (0x0 << 1) ++#define RK3308_DAC_L_HPOUT_UNMUTE (0x1 << 0) ++#define RK3308_DAC_L_HPOUT_MUTE (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON04 - REG: 0x0450 */ ++#define RK3308_DAC_R_GAIN_SFT 6 ++#define RK3308_DAC_R_GAIN_MSK (0x3 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_0DB (0x3 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_PDB_1_5 (0x2 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_PDB_3 (0x1 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_GAIN_PDB_6 (0x0 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_UNMUTE (0x1 << 5) ++#define RK3308_DAC_R_LINEOUT_MUTE (0x0 << 5) ++#define RK3308_DAC_R_LINEOUT_EN (0x1 << 4) ++#define RK3308_DAC_R_LINEOUT_DIS (0x0 << 4) ++#define RK3308_DAC_L_GAIN_SFT 2 ++#define RK3308_DAC_L_GAIN_MSK (0x3 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_0DB (0x3 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_PDB_1_5 (0x2 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_PDB_3 (0x1 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_GAIN_PDB_6 (0x0 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_UNMUTE (0x1 << 1) ++#define RK3308_DAC_L_LINEOUT_MUTE (0x0 << 1) ++#define RK3308_DAC_L_LINEOUT_EN (0x1 << 0) ++#define RK3308_DAC_L_LINEOUT_DIS (0x0 << 0) ++ ++/* RK3308_DAC_ANA_CON05 - REG: 0x0454, step is 1.5db */ ++#define RK3308_DAC_L_HPOUT_GAIN_SFT 0 ++#define RK3308_DAC_L_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_4_5 (0x1d << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_3 (0x1c << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_PDB_1_5 (0x1b << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_0DB (0x1a << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_1_5 (0x19 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_3 (0x18 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_4_5 (0x17 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_6 (0x16 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_7_5 (0x15 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_9 (0x14 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_10_5 (0x13 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_12 (0x12 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_13_5 (0x11 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_15 (0x10 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_16_5 (0x0f << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_18 (0x0e << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_19_5 (0x0d << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_21 (0x0c << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_22_5 (0x0b << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_24 (0x0a << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_25_5 (0x09 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_27 (0x08 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_28_5 (0x07 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_30 (0x06 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_31_5 (0x05 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_33 (0x04 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_34_5 (0x03 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_36 (0x02 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_37_5 (0x01 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++#define RK3308_DAC_L_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_L_HPOUT_GAIN_SFT) ++ ++/* RK3308_DAC_ANA_CON06 - REG: 0x0458, step is 1.5db */ ++#define RK3308_DAC_R_HPOUT_GAIN_SFT 0 ++#define RK3308_DAC_R_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_4_5 (0x1d << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_3 (0x1c << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_PDB_1_5 (0x1b << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_0DB (0x1a << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_1_5 (0x19 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_3 (0x18 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_4_5 (0x17 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_6 (0x16 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_7_5 (0x15 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_9 (0x14 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_10_5 (0x13 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_12 (0x12 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_13_5 (0x11 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_15 (0x10 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_16_5 (0x0f << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_18 (0x0e << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_19_5 (0x0d << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_21 (0x0c << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_22_5 (0x0b << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_24 (0x0a << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_25_5 (0x09 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_27 (0x08 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_28_5 (0x07 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_30 (0x06 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_31_5 (0x05 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_33 (0x04 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_34_5 (0x03 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_36 (0x02 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_37_5 (0x01 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++#define RK3308_DAC_R_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_R_HPOUT_GAIN_SFT) ++ ++/* RK3308_DAC_ANA_CON12 - REG: 0x0470 */ ++#define RK3308_DAC_R_HPMIX_SEL_SFT 6 ++#define RK3308_DAC_R_HPMIX_SEL_MSK (0x3 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_LINEIN_I2S (0x3 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_LINEIN (0x2 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_I2S (0x1 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_NONE (0x0 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_SFT 4 ++#define RK3308_DAC_R_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_R_HPMIX_GAIN_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_R_HPMIX_GAIN_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_NDB_6 (0x1 << RK3308_DAC_R_HPMIX_GAIN_SFT) ++#define RK3308_DAC_L_HPMIX_SEL_SFT 2 ++#define RK3308_DAC_L_HPMIX_SEL_MSK (0x3 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_LINEIN_I2S (0x3 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_LINEIN (0x2 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_I2S (0x1 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_NONE (0x0 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_SFT 0 ++#define RK3308_DAC_L_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_L_HPMIX_GAIN_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_L_HPMIX_GAIN_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_NDB_6 (0x1 << RK3308_DAC_L_HPMIX_GAIN_SFT) ++ ++/* RK3308_DAC_ANA_CON13 - REG: 0x0474 */ ++#define RK3308_DAC_R_HPMIX_UNMUTE (0x1 << 6) ++#define RK3308_DAC_R_HPMIX_MUTE (0x0 << 6) ++#define RK3308_DAC_R_HPMIX_WORK (0x1 << 5) ++#define RK3308_DAC_R_HPMIX_INIT (0x0 << 5) ++#define RK3308_DAC_R_HPMIX_EN (0x1 << 4) ++#define RK3308_DAC_R_HPMIX_DIS (0x0 << 4) ++#define RK3308_DAC_L_HPMIX_UNMUTE (0x1 << 2) ++#define RK3308_DAC_L_HPMIX_MUTE (0x0 << 2) ++#define RK3308_DAC_L_HPMIX_WORK (0x1 << 1) ++#define RK3308_DAC_L_HPMIX_INIT (0x0 << 1) ++#define RK3308_DAC_L_HPMIX_EN (0x1 << 0) ++#define RK3308_DAC_L_HPMIX_DIS (0x0 << 0) ++ ++#define RK3308_HIFI 0x0 ++ ++#endif /* __RK3308_CODEC_H__ */ +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch.disabled b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch.disabled new file mode 100644 index 000000000000..8c83b14e0c8c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch.disabled @@ -0,0 +1,6738 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Mon, 3 Feb 2020 17:13:59 +0100 +Subject: Sync `rk3308_codec` to BSP tree + +--- + Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt | 78 + + sound/soc/codecs/rk3308_codec.c | 5687 ++++++++-- + sound/soc/codecs/rk3308_codec.h | 217 +- + sound/soc/codecs/rk3308_codec_provider.h | 28 + + 4 files changed, 4894 insertions(+), 1116 deletions(-) + +diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt b/Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt +new file mode 100644 +index 000000000000..e20bbd73e37e +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.txt +@@ -0,0 +1,78 @@ ++* Rockchip RK3308 Internal Codec ++ ++Required properties: ++ ++- compatible: "rockchip,rk3308-codec" ++- reg: The physical base address of the controller and length of memory ++ mapped region. ++- rockchip,grf: The phandle of the syscon node for GRF register. ++- clocks: A list of phandle + clock-specifer pairs, one for each entry in ++ clock-names. ++- clock-names: It should be "acodec". ++- resets : Must contain an entry for each entry in reset-names. ++- reset-names : Must include the following entries: "acodec-reset". ++ ++Optional properties: ++- rockchip,enable-all-adcs: This is a boolean type property, that shows whether ++ force enable all of ADCs. The following shows the relationship between grps ++ and ADC: ++ * grp 0 -- select ADC1 / ADC2 ++ * grp 1 -- select ADC3 / ADC4 ++ * grp 2 -- select ADC5 / ADC6 ++ * grp 3 -- select ADC7 / ADC8 ++ If the property is not used, the enabled ADC groups refer to needed channels ++ via configure hw_params. ++ ++- rockchip,adc-grps-route: This is a variable length array, that shows the ++ mapping route of ACODEC sdo to I2S sdi. By default, they are one-to-one ++ mapping: ++ * sdi_0 <-- sdo_0 ++ * sdi_1 <-- sdo_1 ++ * sdi_2 <-- sdo_2 ++ * sdi_3 <-- sdo_3 ++ If you would like to change the route mapping like this: ++ * sdi_0 <-- sdo_3 ++ * sdi_1 <-- sdo_0 ++ * sdi_2 <-- sdo_2 ++ * sdi_3 <-- sdo_1 ++ You need to add the property on dts: ++ - rockchip,adc-grps-route = <3 0 2 1>; ++ ++- rockchip,delay-loopback-handle-ms: This property points out that the delay for ++ handling ADC after enable PAs during loopback. ++- rockchip,delay-start-play-ms: This property points out the delay ms of start ++ playback according to different amplifier performance. ++- rockchip,en-always-grps: This property will keep the needed ADCs enabled ++ always after enabling once. ++- rockchip,loopback-grp: It points out the ADC group which is the loopback used. ++- rockchip,no-deep-low-power: The codec will not enter deep low power mode ++ during suspend. ++- rockchip,no-hp-det: If there is no headphone on boards, we don't need to ++ enable headphone detection. ++- rockchip,micbias1: Using internal micbias1 supply which are from codec. ++- rockchip,micbias2: Using internal micbias2 supply which are from codec. ++- rockchip,hp-jack-reversed;: To detect headphone via the reversed jack. ++- hp-ctl-gpios: The gpio of head phone controller. ++- pa-drv-gpios: The gpio of poweramplifier controller ++- rockchip,delay-pa-drv-ms: This property points out that the delay for ++ power on amplifier ++- spk-ctl-gpios: The gpio of speak controller. ++- micbias-en-gpios: The GPIO to enable external micbias. ++- vmicbias-supply: The phandle to the regulator to handle external micbias. ++ ++Example for rk3308 internal codec: ++ ++acodec: acodec@ff560000 { ++ compatible = "rockchip,rk3308-codec"; ++ reg = <0x0 0xff560000 0x0 0x10000>; ++ rockchip,grf = <&grf>; ++ clocks = <&cru PCLK_ACODEC>; ++ clock-names = "acodec"; ++ resets = <&cru SRST_ACODEC_P>; ++ reset-names = "acodec-reset"; ++ rockchip,loopback-grp = <0>; ++ hp-ctl-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; ++ pa-drv-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>; ++ spk-ctl-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++}; +diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c +index 106f09738dd0..815e22fc346c 100644 +--- a/sound/soc/codecs/rk3308_codec.c ++++ b/sound/soc/codecs/rk3308_codec.c +@@ -29,1420 +29,4699 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + + #include "rk3308_codec.h" ++#include "rk3308_codec_provider.h" ++ ++#if defined(CONFIG_DEBUG_FS) ++#include ++#include ++#include ++#endif ++ ++#define CODEC_DRV_NAME "rk3308-acodec" ++ ++#define ADC_GRP_SKIP_MAGIC 0x1001 ++#define ADC_LR_GROUP_MAX 4 ++#define ADC_STABLE_MS 200 ++#define DEBUG_POP_ALWAYS 0 ++#define HPDET_POLL_MS 2000 ++#define NOT_USED 255 ++#define LOOPBACK_HANDLE_MS 100 ++#define PA_DRV_MS 5 ++ ++#define GRF_SOC_CON1 0x304 ++#define GRF_CHIP_ID 0x800 ++#define GRF_I2S2_8CH_SDI_SFT 0 ++#define GRF_I2S3_4CH_SDI_SFT 8 ++#define GRF_I2S1_2CH_SDI_SFT 12 ++ ++#define GRF_I2S2_8CH_SDI_R_MSK(i, v) ((v >> (i * 2 + GRF_I2S2_8CH_SDI_SFT)) & 0x3) ++#define GRF_I2S2_8CH_SDI_W_MSK(i) (0x3 << (i * 2 + GRF_I2S2_8CH_SDI_SFT + 16)) ++#define GRF_I2S2_8CH_SDI(i, v) (((v & 0x3) << (i * 2 + GRF_I2S2_8CH_SDI_SFT)) |\ ++ GRF_I2S2_8CH_SDI_W_MSK(i)) ++ ++#define GRF_I2S3_4CH_SDI_W_MSK(i) (0x3 << (i * 2 + GRF_I2S3_4CH_SDI_SFT + 16)) ++#define GRF_I2S3_4CH_SDI(i, v) (((v & 0x3) << (i * 2 + GRF_I2S3_4CH_SDI_SFT)) |\ ++ GRF_I2S3_4CH_SDI_W_MSK(i)) ++ ++#define GRF_I2S1_2CH_SDI_W_MSK (0x3 << (GRF_I2S1_2CH_SDI_SFT + 16)) ++#define GRF_I2S1_2CH_SDI(v) (((v & 0x3) << GRF_I2S1_2CH_SDI_SFT) |\ ++ GRF_I2S1_2CH_SDI_W_MSK) ++ ++#define DETECT_GRF_ACODEC_HPDET_COUNTER 0x0030 ++#define DETECT_GRF_ACODEC_HPDET_CON 0x0034 ++#define DETECT_GRF_ACODEC_HPDET_STATUS 0x0038 ++#define DETECT_GRF_ACODEC_HPDET_STATUS_CLR 0x003c ++ ++/* 200ms based on pclk is 100MHz */ ++#define DEFAULT_HPDET_COUNT 20000000 ++#define HPDET_NEG_IRQ_SFT 1 ++#define HPDET_POS_IRQ_SFT 0 ++#define HPDET_BOTH_NEG_POS ((1 << HPDET_NEG_IRQ_SFT) |\ ++ (1 << HPDET_POS_IRQ_SFT)) ++ ++#define ACODEC_VERSION_A 0xa ++#define ACODEC_VERSION_B 0xb ++ ++enum { ++ ACODEC_TO_I2S2_8CH = 0, ++ ACODEC_TO_I2S3_4CH, ++ ACODEC_TO_I2S1_2CH, ++}; ++ ++enum { ++ ADC_GRP0_MICIN = 0, ++ ADC_GRP0_LINEIN ++}; ++ ++enum { ++ ADC_TYPE_NORMAL = 0, ++ ADC_TYPE_LOOPBACK, ++ ADC_TYPE_DBG, ++ ADC_TYPE_ALL, ++}; ++ ++enum { ++ DAC_LINEOUT = 0, ++ DAC_HPOUT = 1, ++ DAC_LINEOUT_HPOUT = 11, ++}; ++ ++enum { ++ EXT_MICBIAS_NONE = 0, ++ EXT_MICBIAS_FUNC1, /* enable external micbias via GPIO */ ++ EXT_MICBIAS_FUNC2, /* enable external micbias via regulator */ ++}; ++ ++enum { ++ PATH_IDLE = 0, ++ PATH_BUSY, ++}; ++ ++enum { ++ PM_NORMAL = 0, ++ PM_LLP_DOWN, /* light low power down */ ++ PM_LLP_UP, ++ PM_DLP_DOWN, /* deep low power down */ ++ PM_DLP_UP, ++ PM_DLP_DOWN2, ++ PM_DLP_UP2, ++}; + + struct rk3308_codec_priv { + const struct device *plat_dev; + struct device dev; + struct reset_control *reset; + struct regmap *regmap; ++ struct regmap *grf; ++ struct regmap *detect_grf; + struct clk *pclk; ++ struct clk *mclk_rx; ++ struct clk *mclk_tx; ++ struct gpio_desc *micbias_en_gpio; ++ struct gpio_desc *hp_ctl_gpio; + struct gpio_desc *spk_ctl_gpio; +- int adc_ch; /* To select ADCs for channel */ +- int adc_ch0_using_linein; ++ struct gpio_desc *pa_drv_gpio; ++ struct snd_soc_codec *codec; ++ struct snd_soc_jack *hpdet_jack; ++ struct regulator *vcc_micbias; ++ u32 codec_ver; ++ ++ /* ++ * To select ADCs for groups: ++ * ++ * grp 0 -- select ADC1 / ADC2 ++ * grp 1 -- select ADC3 / ADC4 ++ * grp 2 -- select ADC5 / ADC6 ++ * grp 3 -- select ADC7 / ADC8 ++ */ ++ u32 used_adc_grps; ++ /* The ADC group which is used for loop back */ ++ u32 loopback_grp; ++ u32 cur_dbg_grp; ++ u32 en_always_grps[ADC_LR_GROUP_MAX]; ++ u32 en_always_grps_num; ++ u32 skip_grps[ADC_LR_GROUP_MAX]; ++ u32 i2s_sdis[ADC_LR_GROUP_MAX]; ++ u32 to_i2s_grps; ++ u32 delay_loopback_handle_ms; ++ u32 delay_start_play_ms; ++ u32 delay_pa_drv_ms; ++ u32 micbias_num; ++ u32 micbias_volt; ++ int which_i2s; ++ int irq; ++ int adc_grp0_using_linein; ++ int adc_zerocross; ++ /* 0: line out, 1: hp out, 11: lineout and hpout */ ++ int dac_output; ++ int dac_path_state; ++ ++ int ext_micbias; ++ int pm_state; ++ ++ /* AGC L/R Off/on */ ++ unsigned int agc_l[ADC_LR_GROUP_MAX]; ++ unsigned int agc_r[ADC_LR_GROUP_MAX]; ++ ++ /* AGC L/R Approximate Sample Rate */ ++ unsigned int agc_asr_l[ADC_LR_GROUP_MAX]; ++ unsigned int agc_asr_r[ADC_LR_GROUP_MAX]; ++ ++ /* ADC MIC Mute/Work */ ++ unsigned int mic_mute_l[ADC_LR_GROUP_MAX]; ++ unsigned int mic_mute_r[ADC_LR_GROUP_MAX]; ++ ++ /* For the high pass filter */ ++ unsigned int hpf_cutoff[ADC_LR_GROUP_MAX]; ++ ++ /* Only hpout do fade-in and fade-out */ ++ unsigned int hpout_l_dgain; ++ unsigned int hpout_r_dgain; ++ ++ bool adc_grps_endisable[ADC_LR_GROUP_MAX]; ++ bool dac_endisable; ++ bool enable_all_adcs; ++ bool enable_micbias; ++ bool micbias1; ++ bool micbias2; ++ bool hp_jack_reversed; ++ bool hp_plugged; ++ bool loopback_dacs_enabled; ++ bool no_deep_low_power; ++ bool no_hp_det; ++ struct delayed_work hpdet_work; ++ struct delayed_work loopback_work; ++ ++#if defined(CONFIG_DEBUG_FS) ++ struct dentry *dbg_codec; ++#endif + }; + +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_gain_tlv, ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_grp_gain_tlv, + -1800, 150, 2850); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_max_gain_tlv, ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_grp_max_gain_tlv, + -1350, 600, 2850); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_ch_min_gain_tlv, ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_alc_agc_grp_min_gain_tlv, + -1800, 600, 2400); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_mic_gain_tlv, +- 0, 600, 3000); + static const DECLARE_TLV_DB_SCALE(rk3308_codec_adc_alc_gain_tlv, + -1800, 150, 2850); +-static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_gain_tlv, +- 0, 150, 600); ++static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_lineout_gain_tlv, ++ -600, 150, 0); + static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpout_gain_tlv, + -3900, 150, 600); + static const DECLARE_TLV_DB_SCALE(rk3308_codec_dac_hpmix_gain_tlv, + -600, 600, 0); + ++static const DECLARE_TLV_DB_RANGE(rk3308_codec_adc_mic_gain_tlv_a, ++ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), ++ 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0), ++); ++ ++static const DECLARE_TLV_DB_RANGE(rk3308_codec_adc_mic_gain_tlv_b, ++ 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), ++ 1, 1, TLV_DB_SCALE_ITEM(660, 0, 0), ++ 2, 2, TLV_DB_SCALE_ITEM(1300, 0, 0), ++ 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0), ++); ++ ++static bool handle_loopback(struct rk3308_codec_priv *rk3308); ++ ++static int check_micbias(int micbias); ++ ++static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, ++ int micbias); ++static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308); ++ ++static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++ ++static const char *offon_text[2] = { ++ [0] = "Off", ++ [1] = "On", ++}; ++ ++static const char *mute_text[2] = { ++ [0] = "Work", ++ [1] = "Mute", ++}; ++ ++/* ADC MICBIAS Volt */ ++#define MICBIAS_VOLT_NUM 8 ++ ++#define MICBIAS_VREFx0_5 0 ++#define MICBIAS_VREFx0_55 1 ++#define MICBIAS_VREFx0_6 2 ++#define MICBIAS_VREFx0_65 3 ++#define MICBIAS_VREFx0_7 4 ++#define MICBIAS_VREFx0_75 5 ++#define MICBIAS_VREFx0_8 6 ++#define MICBIAS_VREFx0_85 7 ++ ++static const char *micbias_volts_enum_array[MICBIAS_VOLT_NUM] = { ++ [MICBIAS_VREFx0_5] = "VREFx0_5", ++ [MICBIAS_VREFx0_55] = "VREFx0_55", ++ [MICBIAS_VREFx0_6] = "VREFx0_6", ++ [MICBIAS_VREFx0_65] = "VREFx0_65", ++ [MICBIAS_VREFx0_7] = "VREFx0_7", ++ [MICBIAS_VREFx0_75] = "VREFx0_75", ++ [MICBIAS_VREFx0_8] = "VREFx0_8", ++ [MICBIAS_VREFx0_85] = "VREFx0_85", ++}; ++ ++static const struct soc_enum rk3308_micbias_volts_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(micbias_volts_enum_array), micbias_volts_enum_array), ++}; ++ ++/* ADC MICBIAS1 and MICBIAS2 Main Switch */ ++static const struct soc_enum rk3308_main_micbias_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text), ++}; ++ ++static const struct soc_enum rk3308_hpf_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(offon_text), offon_text), ++}; ++ ++/* ALC AGC Switch */ ++static const struct soc_enum rk3308_agc_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(1, 1, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(2, 1, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(offon_text), offon_text), ++ SOC_ENUM_SINGLE(3, 1, ARRAY_SIZE(offon_text), offon_text), ++}; ++ ++/* ADC MIC Mute/Work Switch */ ++static const struct soc_enum rk3308_mic_mute_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(1, 1, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(2, 1, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(mute_text), mute_text), ++ SOC_ENUM_SINGLE(3, 1, ARRAY_SIZE(mute_text), mute_text), ++}; ++ ++/* ALC AGC Approximate Sample Rate */ ++#define AGC_ASR_NUM 8 ++ ++#define AGC_ASR_96KHZ 0 ++#define AGC_ASR_48KHZ 1 ++#define AGC_ASR_44_1KHZ 2 ++#define AGC_ASR_32KHZ 3 ++#define AGC_ASR_24KHZ 4 ++#define AGC_ASR_16KHZ 5 ++#define AGC_ASR_12KHZ 6 ++#define AGC_ASR_8KHZ 7 ++ ++static const char *agc_asr_text[AGC_ASR_NUM] = { ++ [AGC_ASR_96KHZ] = "96KHz", ++ [AGC_ASR_48KHZ] = "48KHz", ++ [AGC_ASR_44_1KHZ] = "44.1KHz", ++ [AGC_ASR_32KHZ] = "32KHz", ++ [AGC_ASR_24KHZ] = "24KHz", ++ [AGC_ASR_16KHZ] = "16KHz", ++ [AGC_ASR_12KHZ] = "12KHz", ++ [AGC_ASR_8KHZ] = "8KHz", ++}; ++ ++static const struct soc_enum rk3308_agc_asr_enum_array[] = { ++ SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(1, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(2, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(2, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(3, 0, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++ SOC_ENUM_SINGLE(3, 1, ARRAY_SIZE(agc_asr_text), agc_asr_text), ++}; ++ ++static const struct snd_kcontrol_new mic_gains_a[] = { ++ /* ADC MIC */ ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Left Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Right Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Left Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Right Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Left Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Right Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Left Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Right Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_a), ++}; ++ ++static const struct snd_kcontrol_new mic_gains_b[] = { ++ /* ADC MIC */ ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Left Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 0 Right Volume", ++ RK3308_ADC_ANA_CON01(0), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Left Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 1 Right Volume", ++ RK3308_ADC_ANA_CON01(1), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Left Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 2 Right Volume", ++ RK3308_ADC_ANA_CON01(2), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Left Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH1_MIC_GAIN_SFT, ++ RK3308_ADC_CH1_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++ SOC_SINGLE_EXT_TLV("ADC MIC Group 3 Right Volume", ++ RK3308_ADC_ANA_CON01(3), ++ RK3308_ADC_CH2_MIC_GAIN_SFT, ++ RK3308_ADC_CH2_MIC_GAIN_MAX, ++ 0, ++ rk3308_codec_mic_gain_get, ++ rk3308_codec_mic_gain_put, ++ rk3308_codec_adc_mic_gain_tlv_b), ++}; ++ + static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = { +- /* ALC AGC Channel*/ +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Volume", ++ /* ALC AGC Group */ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Left Volume", + RK3308_ALC_L_DIG_CON03(0), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Right Volume", + RK3308_ALC_R_DIG_CON03(0), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Volume", ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Left Volume", + RK3308_ALC_L_DIG_CON03(1), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Right Volume", + RK3308_ALC_R_DIG_CON03(1), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Volume", ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Left Volume", + RK3308_ALC_L_DIG_CON03(2), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Right Volume", + RK3308_ALC_R_DIG_CON03(2), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Volume", ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Left Volume", + RK3308_ALC_L_DIG_CON03(3), ++ RK3308_AGC_PGA_GAIN_SFT, ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Right Volume", + RK3308_ALC_R_DIG_CON03(3), + RK3308_AGC_PGA_GAIN_SFT, +- RK3308_AGC_PGA_GAIN_NDB_18, +- RK3308_AGC_PGA_GAIN_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_gain_tlv), ++ RK3308_AGC_PGA_GAIN_MIN, ++ RK3308_AGC_PGA_GAIN_MAX, ++ 0, rk3308_codec_alc_agc_grp_gain_tlv), + + /* ALC AGC MAX */ +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Max Volume", ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Left Max Volume", + RK3308_ALC_L_DIG_CON09(0), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Right Max Volume", + RK3308_ALC_R_DIG_CON09(0), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Max Volume", ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Left Max Volume", + RK3308_ALC_L_DIG_CON09(1), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Right Max Volume", + RK3308_ALC_R_DIG_CON09(1), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Max Volume", ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Left Max Volume", + RK3308_ALC_L_DIG_CON09(2), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Right Max Volume", + RK3308_ALC_R_DIG_CON09(2), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Max Volume", ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Left Max Volume", + RK3308_ALC_L_DIG_CON09(3), ++ RK3308_AGC_MAX_GAIN_PGA_SFT, ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Right Max Volume", + RK3308_ALC_R_DIG_CON09(3), + RK3308_AGC_MAX_GAIN_PGA_SFT, +- RK3308_AGC_MAX_GAIN_PGA_NDB_13_5, +- RK3308_AGC_MAX_GAIN_PGA_PDB_28_5, +- 0, rk3308_codec_alc_agc_ch_max_gain_tlv), ++ RK3308_AGC_MAX_GAIN_PGA_MIN, ++ RK3308_AGC_MAX_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_max_gain_tlv), + + /* ALC AGC MIN */ +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 0 Min Volume", ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Left Min Volume", + RK3308_ALC_L_DIG_CON09(0), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 0 Right Min Volume", + RK3308_ALC_R_DIG_CON09(0), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 1 Min Volume", ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Left Min Volume", + RK3308_ALC_L_DIG_CON09(1), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 1 Right Min Volume", + RK3308_ALC_R_DIG_CON09(1), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 2 Min Volume", ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Left Min Volume", + RK3308_ALC_L_DIG_CON09(2), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 2 Right Min Volume", + RK3308_ALC_R_DIG_CON09(2), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- SOC_DOUBLE_R_RANGE_TLV("ALC AGC Channel 3 Min Volume", ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Left Min Volume", + RK3308_ALC_L_DIG_CON09(3), ++ RK3308_AGC_MIN_GAIN_PGA_SFT, ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ SOC_SINGLE_RANGE_TLV("ALC AGC Group 3 Right Min Volume", + RK3308_ALC_R_DIG_CON09(3), + RK3308_AGC_MIN_GAIN_PGA_SFT, +- RK3308_AGC_MIN_GAIN_PGA_NDB_18, +- RK3308_AGC_MIN_GAIN_PGA_PDB_24, +- 0, rk3308_codec_alc_agc_ch_min_gain_tlv), +- +- /* ADC MIC */ +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Left Volume", +- RK3308_ADC_ANA_CON01(0), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 0 Right Volume", +- RK3308_ADC_ANA_CON01(0), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Left Volume", +- RK3308_ADC_ANA_CON01(1), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 1 Right Volume", +- RK3308_ADC_ANA_CON01(1), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Left Volume", +- RK3308_ADC_ANA_CON01(2), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 2 Right Volume", +- RK3308_ADC_ANA_CON01(2), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Left Volume", +- RK3308_ADC_ANA_CON01(3), +- RK3308_ADC_CH1_MIC_GAIN_SFT, +- RK3308_ADC_CH1_MIC_GAIN_0DB, +- RK3308_ADC_CH1_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC MIC Channel 3 Right Volume", +- RK3308_ADC_ANA_CON01(3), +- RK3308_ADC_CH2_MIC_GAIN_SFT, +- RK3308_ADC_CH2_MIC_GAIN_0DB, +- RK3308_ADC_CH2_MIC_GAIN_30DB, +- 0, rk3308_codec_adc_mic_gain_tlv), ++ RK3308_AGC_MIN_GAIN_PGA_MIN, ++ RK3308_AGC_MIN_GAIN_PGA_MAX, ++ 0, rk3308_codec_alc_agc_grp_min_gain_tlv), ++ ++ /* ALC AGC Switch */ ++ SOC_ENUM_EXT("ALC AGC Group 0 Left Switch", rk3308_agc_enum_array[0], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 0 Right Switch", rk3308_agc_enum_array[1], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 1 Left Switch", rk3308_agc_enum_array[2], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 1 Right Switch", rk3308_agc_enum_array[3], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 2 Left Switch", rk3308_agc_enum_array[4], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 2 Right Switch", rk3308_agc_enum_array[5], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 3 Left Switch", rk3308_agc_enum_array[6], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ SOC_ENUM_EXT("ALC AGC Group 3 Right Switch", rk3308_agc_enum_array[7], ++ rk3308_codec_agc_get, rk3308_codec_agc_put), ++ ++ /* ALC AGC Approximate Sample Rate */ ++ SOC_ENUM_EXT("AGC Group 0 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[0], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 0 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[1], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 1 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[2], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 1 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[3], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 2 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[4], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 2 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[5], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 3 Left Approximate Sample Rate", rk3308_agc_asr_enum_array[6], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ SOC_ENUM_EXT("AGC Group 3 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[7], ++ rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put), ++ ++ /* ADC MICBIAS Voltage */ ++ SOC_ENUM_EXT("ADC MICBIAS Voltage", rk3308_micbias_volts_enum_array[0], ++ rk3308_codec_micbias_volts_get, rk3308_codec_micbias_volts_put), ++ ++ /* ADC Main MICBIAS Switch */ ++ SOC_ENUM_EXT("ADC Main MICBIAS", rk3308_main_micbias_enum_array[0], ++ rk3308_codec_main_micbias_get, rk3308_codec_main_micbias_put), ++ ++ /* ADC MICBIAS1 and MICBIAS2 Switch */ ++ SOC_SINGLE("ADC MICBIAS1", RK3308_ADC_ANA_CON07(1), ++ RK3308_ADC_MIC_BIAS_BUF_SFT, 1, 0), ++ SOC_SINGLE("ADC MICBIAS2", RK3308_ADC_ANA_CON07(2), ++ RK3308_ADC_MIC_BIAS_BUF_SFT, 1, 0), ++ ++ /* ADC MIC Mute/Work Switch */ ++ SOC_ENUM_EXT("ADC MIC Group 0 Left Switch", rk3308_mic_mute_enum_array[0], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 0 Right Switch", rk3308_mic_mute_enum_array[1], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 1 Left Switch", rk3308_mic_mute_enum_array[2], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 1 Right Switch", rk3308_mic_mute_enum_array[3], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 2 Left Switch", rk3308_mic_mute_enum_array[4], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 2 Right Switch", rk3308_mic_mute_enum_array[5], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 3 Left Switch", rk3308_mic_mute_enum_array[6], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), ++ SOC_ENUM_EXT("ADC MIC Group 3 Right Switch", rk3308_mic_mute_enum_array[7], ++ rk3308_codec_mic_mute_get, rk3308_codec_mic_mute_put), + + /* ADC ALC */ +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 0 Left Volume", + RK3308_ADC_ANA_CON03(0), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 0 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 0 Right Volume", + RK3308_ADC_ANA_CON04(0), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 1 Left Volume", + RK3308_ADC_ANA_CON03(1), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 1 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 1 Right Volume", + RK3308_ADC_ANA_CON04(1), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 2 Left Volume", + RK3308_ADC_ANA_CON03(2), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 2 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 2 Right Volume", + RK3308_ADC_ANA_CON04(2), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Left Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 3 Left Volume", + RK3308_ADC_ANA_CON03(3), + RK3308_ADC_CH1_ALC_GAIN_SFT, +- RK3308_ADC_CH1_ALC_GAIN_NDB_18, +- RK3308_ADC_CH1_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH1_ALC_GAIN_MIN, ++ RK3308_ADC_CH1_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), +- SOC_SINGLE_RANGE_TLV("ADC ALC Channel 3 Right Volume", ++ SOC_SINGLE_RANGE_TLV("ADC ALC Group 3 Right Volume", + RK3308_ADC_ANA_CON04(3), + RK3308_ADC_CH2_ALC_GAIN_SFT, +- RK3308_ADC_CH2_ALC_GAIN_NDB_18, +- RK3308_ADC_CH2_ALC_GAIN_PDB_28_5, ++ RK3308_ADC_CH2_ALC_GAIN_MIN, ++ RK3308_ADC_CH2_ALC_GAIN_MAX, + 0, rk3308_codec_adc_alc_gain_tlv), + +- /* DAC */ +- SOC_SINGLE_RANGE_TLV("DAC Left Volume", +- RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_GAIN_SFT, +- RK3308_DAC_L_GAIN_0DB, +- RK3308_DAC_L_GAIN_PDB_6, +- 0, rk3308_codec_dac_gain_tlv), +- SOC_SINGLE_RANGE_TLV("DAC Right Volume", +- RK3308_DAC_ANA_CON04, +- RK3308_DAC_R_GAIN_SFT, +- RK3308_DAC_R_GAIN_0DB, +- RK3308_DAC_R_GAIN_PDB_6, +- 0, rk3308_codec_dac_gain_tlv), ++ /* ADC High Pass Filter */ ++ SOC_ENUM_EXT("ADC Group 0 HPF Cut-off", rk3308_hpf_enum_array[0], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ SOC_ENUM_EXT("ADC Group 1 HPF Cut-off", rk3308_hpf_enum_array[1], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ SOC_ENUM_EXT("ADC Group 2 HPF Cut-off", rk3308_hpf_enum_array[2], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ SOC_ENUM_EXT("ADC Group 3 HPF Cut-off", rk3308_hpf_enum_array[3], ++ rk3308_codec_hpf_get, rk3308_codec_hpf_put), ++ ++ /* DAC LINEOUT */ ++ SOC_SINGLE_TLV("DAC LINEOUT Left Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_GAIN_SFT, ++ RK3308_DAC_L_LINEOUT_GAIN_MAX, ++ 0, rk3308_codec_dac_lineout_gain_tlv), ++ SOC_SINGLE_TLV("DAC LINEOUT Right Volume", ++ RK3308_DAC_ANA_CON04, ++ RK3308_DAC_R_LINEOUT_GAIN_SFT, ++ RK3308_DAC_R_LINEOUT_GAIN_MAX, ++ 0, rk3308_codec_dac_lineout_gain_tlv), + + /* DAC HPOUT */ +- SOC_SINGLE_RANGE_TLV("DAC HPOUT Left Volume", +- RK3308_DAC_ANA_CON05, +- RK3308_DAC_L_HPOUT_GAIN_SFT, +- RK3308_DAC_L_HPOUT_GAIN_NDB_39, +- RK3308_DAC_L_HPOUT_GAIN_PDB_6, +- 0, rk3308_codec_dac_hpout_gain_tlv), +- SOC_SINGLE_RANGE_TLV("DAC HPOUT Right Volume", +- RK3308_DAC_ANA_CON06, +- RK3308_DAC_R_HPOUT_GAIN_SFT, +- RK3308_DAC_R_HPOUT_GAIN_NDB_39, +- RK3308_DAC_R_HPOUT_GAIN_PDB_6, +- 0, rk3308_codec_dac_hpout_gain_tlv), ++ SOC_SINGLE_EXT_TLV("DAC HPOUT Left Volume", ++ RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_SFT, ++ RK3308_DAC_L_HPOUT_GAIN_MAX, ++ 0, ++ rk3308_codec_hpout_l_get_tlv, ++ rk3308_codec_hpout_l_put_tlv, ++ rk3308_codec_dac_hpout_gain_tlv), ++ SOC_SINGLE_EXT_TLV("DAC HPOUT Right Volume", ++ RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_SFT, ++ RK3308_DAC_R_HPOUT_GAIN_MAX, ++ 0, ++ rk3308_codec_hpout_r_get_tlv, ++ rk3308_codec_hpout_r_put_tlv, ++ rk3308_codec_dac_hpout_gain_tlv), + + /* DAC HPMIX */ + SOC_SINGLE_RANGE_TLV("DAC HPMIX Left Volume", +- RK3308_DAC_ANA_CON05, ++ RK3308_DAC_ANA_CON12, + RK3308_DAC_L_HPMIX_GAIN_SFT, +- RK3308_DAC_L_HPMIX_GAIN_NDB_6, +- RK3308_DAC_L_HPMIX_GAIN_0DB, ++ RK3308_DAC_L_HPMIX_GAIN_MIN, ++ RK3308_DAC_L_HPMIX_GAIN_MAX, + 0, rk3308_codec_dac_hpmix_gain_tlv), + SOC_SINGLE_RANGE_TLV("DAC HPMIX Right Volume", +- RK3308_DAC_ANA_CON05, ++ RK3308_DAC_ANA_CON12, + RK3308_DAC_R_HPMIX_GAIN_SFT, +- RK3308_DAC_R_HPMIX_GAIN_NDB_6, +- RK3308_DAC_R_HPMIX_GAIN_0DB, ++ RK3308_DAC_R_HPMIX_GAIN_MIN, ++ RK3308_DAC_R_HPMIX_GAIN_MAX, + 0, rk3308_codec_dac_hpmix_gain_tlv), + }; + +-static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) ++static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- gpiod_direction_output(rk3308->spk_ctl_gpio, on); ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } ++ ++ if (e->shift_l) ++ ucontrol->value.integer.value[0] = rk3308->agc_r[e->reg]; ++ else ++ ucontrol->value.integer.value[0] = rk3308->agc_l[e->reg]; ++ ++ return 0; + } + +-static int rk3308_codec_reset(struct snd_soc_codec *codec) ++static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value = ucontrol->value.integer.value[0]; ++ int grp = e->reg; + +- reset_control_assert(rk3308->reset); +- usleep_range(200, 300); /* estimated value */ +- reset_control_deassert(rk3308->reset); ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } + +- regmap_write(rk3308->regmap, RK3308_GLB_CON, 0x00); +- usleep_range(200, 300); /* estimated value */ +- regmap_write(rk3308->regmap, RK3308_GLB_CON, +- RK3308_SYS_WORK | +- RK3308_DAC_DIG_WORK | +- RK3308_ADC_DIG_WORK); ++ if (value) { ++ /* ALC AGC On */ ++ if (e->shift_l) { ++ /* ALC AGC Right On */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_EN); ++ ++ rk3308->agc_r[e->reg] = 1; ++ } else { ++ /* ALC AGC Left On */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_EN); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_EN); ++ ++ rk3308->agc_l[e->reg] = 1; ++ } ++ } else { ++ /* ALC AGC Off */ ++ if (e->shift_l) { ++ /* ALC AGC Right Off */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, ++ RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS); ++ ++ rk3308->agc_r[e->reg] = 0; ++ } else { ++ /* ALC AGC Left Off */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(grp), ++ RK3308_AGC_FUNC_SEL_MSK, ++ RK3308_AGC_FUNC_SEL_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(grp), ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK, ++ RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS); ++ ++ rk3308->agc_l[e->reg] = 0; ++ } ++ } + + return 0; + } + +-static int rk3308_set_bias_level(struct snd_soc_codec *codec, +- enum snd_soc_bias_level level) ++static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- switch (level) { +- case SND_SOC_BIAS_ON: +- break; +- +- case SND_SOC_BIAS_PREPARE: +- break; ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; + +- case SND_SOC_BIAS_STANDBY: +- case SND_SOC_BIAS_OFF: +- break; ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; + } + +- snd_soc_codec_force_bias_level(codec, level); ++ if (e->shift_l) { ++ regmap_read(rk3308->regmap, RK3308_ALC_R_DIG_CON04(grp), &value); ++ rk3308->agc_asr_r[e->reg] = value >> RK3308_AGC_APPROX_RATE_SFT; ++ ucontrol->value.integer.value[0] = rk3308->agc_asr_r[e->reg]; ++ } else { ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON04(grp), &value); ++ rk3308->agc_asr_l[e->reg] = value >> RK3308_AGC_APPROX_RATE_SFT; ++ ucontrol->value.integer.value[0] = rk3308->agc_asr_l[e->reg]; ++ } + + return 0; + } + +-static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, +- unsigned int fmt) ++static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = codec_dai->codec; ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; +- int ch = rk3308->adc_ch; ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; + +- switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { +- case SND_SOC_DAIFMT_CBS_CFS: +- adc_aif2 |= RK3308_ADC_IO_MODE_SLAVE; +- adc_aif2 |= RK3308_ADC_MODE_SLAVE; +- dac_aif2 |= RK3308_DAC_IO_MODE_SLAVE; +- dac_aif2 |= RK3308_DAC_MODE_SLAVE; +- break; +- case SND_SOC_DAIFMT_CBM_CFM: +- adc_aif2 |= RK3308_ADC_IO_MODE_MASTER; +- adc_aif2 |= RK3308_ADC_MODE_MASTER; +- dac_aif2 |= RK3308_DAC_IO_MODE_MASTER; +- dac_aif2 |= RK3308_DAC_MODE_MASTER; +- break; +- default: ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); + return -EINVAL; + } + +- switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { +- case SND_SOC_DAIFMT_DSP_A: +- adc_aif1 |= RK3308_ADC_I2S_MODE_PCM; +- dac_aif1 |= RK3308_DAC_I2S_MODE_PCM; +- break; +- case SND_SOC_DAIFMT_I2S: +- adc_aif1 |= RK3308_ADC_I2S_MODE_I2S; +- dac_aif1 |= RK3308_DAC_I2S_MODE_I2S; +- break; +- case SND_SOC_DAIFMT_RIGHT_J: +- adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; +- dac_aif1 |= RK3308_DAC_I2S_MODE_RJ; +- break; +- case SND_SOC_DAIFMT_LEFT_J: +- adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; +- dac_aif1 |= RK3308_DAC_I2S_MODE_LJ; +- break; +- default: +- return -EINVAL; ++ value = ucontrol->value.integer.value[0] << RK3308_AGC_APPROX_RATE_SFT; ++ ++ if (e->shift_l) { ++ /* ALC AGC Right Approximate Sample Rate */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON04(grp), ++ RK3308_AGC_APPROX_RATE_MSK, ++ value); ++ rk3308->agc_asr_r[e->reg] = ucontrol->value.integer.value[0]; ++ } else { ++ /* ALC AGC Left Approximate Sample Rate */ ++ regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON04(grp), ++ RK3308_AGC_APPROX_RATE_MSK, ++ value); ++ rk3308->agc_asr_l[e->reg] = ucontrol->value.integer.value[0]; + } + +- switch (fmt & SND_SOC_DAIFMT_INV_MASK) { +- case SND_SOC_DAIFMT_NB_NF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; +- break; +- case SND_SOC_DAIFMT_IB_IF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; +- break; +- case SND_SOC_DAIFMT_IB_NF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; +- break; +- case SND_SOC_DAIFMT_NB_IF: +- adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; +- adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; +- dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; +- dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; +- break; +- default: ++ return 0; ++} ++ ++static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; ++ ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); + return -EINVAL; + } + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), +- RK3308_ADC_I2S_LRC_POL_MSK | +- RK3308_ADC_I2S_MODE_MSK, +- adc_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), +- RK3308_ADC_IO_MODE_MSK | +- RK3308_ADC_MODE_MSK | +- RK3308_ADC_I2S_BIT_CLK_POL_MSK, +- adc_aif2); +- +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, +- RK3308_DAC_I2S_LRC_POL_MSK | +- RK3308_DAC_I2S_MODE_MSK, +- dac_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, +- RK3308_DAC_IO_MODE_MSK | +- RK3308_DAC_MODE_MSK | +- RK3308_DAC_I2S_BIT_CLK_POL_MSK, +- dac_aif2); ++ if (e->shift_l) { ++ /* ADC MIC Right Mute/Work Infos */ ++ regmap_read(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), &value); ++ rk3308->mic_mute_r[e->reg] = (value & RK3308_ADC_R_CH_BIST_SINE) >> ++ RK3308_ADC_R_CH_BIST_SFT; ++ ucontrol->value.integer.value[0] = rk3308->mic_mute_r[e->reg]; ++ } else { ++ /* ADC MIC Left Mute/Work Infos */ ++ regmap_read(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), &value); ++ rk3308->mic_mute_l[e->reg] = (value & RK3308_ADC_L_CH_BIST_SINE) >> ++ RK3308_ADC_L_CH_BIST_SFT; ++ ucontrol->value.integer.value[0] = rk3308->mic_mute_l[e->reg]; ++ } + + return 0; + } + +-static int rk3308_hw_params(struct snd_pcm_substream *substream, +- struct snd_pcm_hw_params *params, +- struct snd_soc_dai *dai) ++static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = dai->codec; ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; +- int ch = rk3308->adc_ch; ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; ++ int grp = e->reg; + +- switch (params_format(params)) { +- case SNDRV_PCM_FORMAT_S16_LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_16BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_16BITS; +- break; +- case SNDRV_PCM_FORMAT_S20_3LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_20BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_20BITS; +- break; +- case SNDRV_PCM_FORMAT_S24_LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_24BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_24BITS; +- break; +- case SNDRV_PCM_FORMAT_S32_LE: +- adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_32BITS; +- dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_32BITS; +- break; +- default: ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); + return -EINVAL; + } + +- switch (params_channels(params)) { +- case 1: +- adc_aif1 |= RK3308_ADC_I2S_MONO; +- break; +- case 2: +- adc_aif1 |= RK3308_ADC_I2S_STEREO; +- break; +- default: +- return -EINVAL; ++ if (e->shift_l) { ++ /* ADC MIC Right Mute/Work Configuration */ ++ value = ucontrol->value.integer.value[0] << RK3308_ADC_R_CH_BIST_SFT; ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_SINE, ++ value); ++ rk3308->mic_mute_r[e->reg] = ucontrol->value.integer.value[0]; ++ } else { ++ /* ADC MIC Left Mute/Work Configuration */ ++ value = ucontrol->value.integer.value[0] << RK3308_ADC_L_CH_BIST_SFT; ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_SINE, ++ value); ++ rk3308->mic_mute_l[e->reg] = ucontrol->value.integer.value[0]; + } + +- adc_aif1 |= RK3308_ADC_I2S_LR_NORMAL; +- adc_aif2 |= RK3308_ADC_I2S_WORK; +- dac_aif1 |= RK3308_DAC_I2S_LR_NORMAL; +- dac_aif2 |= RK3308_DAC_I2S_WORK; ++ return 0; ++} + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(ch), +- RK3308_ADC_I2S_VALID_LEN_MSK | +- RK3308_ADC_I2S_LR_MSK | +- RK3308_ADC_I2S_TYPE_MSK, +- adc_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(ch), +- RK3308_ADC_I2S_MSK, +- adc_aif2); ++static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, +- RK3308_DAC_I2S_VALID_LEN_MSK | +- RK3308_DAC_I2S_LR_MSK, +- dac_aif1); +- regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, +- RK3308_DAC_I2S_MSK, +- dac_aif2); ++ ucontrol->value.integer.value[0] = rk3308->micbias_volt; + + return 0; + } + +-static int rk3308_digital_mute(struct snd_soc_dai *dai, int mute) ++static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int volt = ucontrol->value.integer.value[0]; ++ int ret; ++ ++ ret = check_micbias(volt); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, "The invalid micbias volt: %d\n", ++ volt); ++ return ret; ++ } ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, ++ volt); ++ ++ rk3308->micbias_volt = volt; ++ + return 0; + } + +-static int rk3308_codec_dac_enable(struct rk3308_codec_priv *rk3308) ++static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- /* Step 01 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, +- RK3308_DAC_CURRENT_MSK, +- RK3308_DAC_CURRENT_EN); +- +- /* Step 02 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_BUF_REF_L_MSK | +- RK3308_DAC_BUF_REF_R_MSK, +- RK3308_DAC_BUF_REF_L_EN | +- RK3308_DAC_BUF_REF_R_EN); ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- /* Step 03 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_L_MSK | +- RK3308_DAC_POP_SOUND_R_MSK, +- RK3308_DAC_POP_SOUND_L_WORK | +- RK3308_DAC_POP_SOUND_R_WORK); ++ ucontrol->value.integer.value[0] = rk3308->enable_micbias; + +- /* Step 04 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, +- RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN); ++ return 0; ++} + +- /* Step 05 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, +- RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK); ++static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int on = ucontrol->value.integer.value[0]; ++ ++ if (on) { ++ if (!rk3308->enable_micbias) ++ rk3308_codec_micbias_enable(rk3308, rk3308->micbias_volt); ++ } else { ++ if (rk3308->enable_micbias) ++ rk3308_codec_micbias_disable(rk3308); ++ } + +- /* Step 06 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, +- RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN); ++ return 0; ++} + +- /* Step 07 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, +- RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN); ++static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ return snd_soc_get_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 08 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, +- RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK); ++static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int gain = ucontrol->value.integer.value[0]; + +- /* Step 09 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, +- RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN); ++ if (gain > RK3308_ADC_CH1_MIC_GAIN_MAX) { ++ dev_err(rk3308->plat_dev, "%s: invalid mic gain: %d\n", ++ __func__, gain); ++ return -EINVAL; ++ } + +- /* Step 10 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, +- RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN); ++ if (rk3308->codec_ver == ACODEC_VERSION_A) { ++ /* ++ * From the TRM, there are only suupport 0dB(gain==0) and ++ * 20dB(gain==3) on the codec version A. ++ */ ++ if (!(gain == 0 || gain == RK3308_ADC_CH1_MIC_GAIN_MAX)) { ++ dev_err(rk3308->plat_dev, ++ "version A doesn't supported: %d, expect: 0,%d\n", ++ gain, RK3308_ADC_CH1_MIC_GAIN_MAX); ++ return 0; ++ } ++ } + +- /* Step 11 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, +- RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN); ++ return snd_soc_put_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 12 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, +- RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK); ++static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value; + +- /* Step 13 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_SEL_MSK | +- RK3308_DAC_R_HPMIX_SEL_MSK, +- RK3308_DAC_L_HPMIX_I2S | +- RK3308_DAC_R_HPMIX_I2S); ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } + +- /* Step 14 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_UNMUTE | +- RK3308_DAC_R_HPMIX_UNMUTE, +- RK3308_DAC_L_HPMIX_UNMUTE | +- RK3308_DAC_R_HPMIX_UNMUTE); ++ regmap_read(rk3308->regmap, RK3308_ADC_DIG_CON04(e->reg), &value); ++ if (value & RK3308_ADC_HPF_PATH_MSK) ++ rk3308->hpf_cutoff[e->reg] = 0; ++ else ++ rk3308->hpf_cutoff[e->reg] = 1; + +- /* Step 15 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_GAIN_MSK | +- RK3308_DAC_R_HPMIX_GAIN_MSK, +- RK3308_DAC_L_HPMIX_GAIN_0DB | +- RK3308_DAC_R_HPMIX_GAIN_0DB); ++ ucontrol->value.integer.value[0] = rk3308->hpf_cutoff[e->reg]; + +- /* Step 16 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_UNMUTE | +- RK3308_DAC_R_HPOUT_UNMUTE, +- RK3308_DAC_L_HPOUT_UNMUTE | +- RK3308_DAC_R_HPOUT_UNMUTE); ++ return 0; ++} + +- /* Step 17 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_UNMUTE | +- RK3308_DAC_R_LINEOUT_UNMUTE, +- RK3308_DAC_L_LINEOUT_UNMUTE | +- RK3308_DAC_R_LINEOUT_UNMUTE); ++static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; ++ unsigned int value = ucontrol->value.integer.value[0]; + +- /* Step 18 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, +- RK3308_DAC_L_HPOUT_GAIN_MSK, +- RK3308_DAC_L_HPOUT_GAIN_0DB); ++ if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "%s: Invalid ADC grp: %d\n", __func__, e->reg); ++ return -EINVAL; ++ } + +- /* Step 18 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, +- RK3308_DAC_R_HPOUT_GAIN_MSK, +- RK3308_DAC_R_HPOUT_GAIN_0DB); ++ if (value) { ++ /* Enable high pass filter for ADCs */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON04(e->reg), ++ RK3308_ADC_HPF_PATH_MSK, ++ RK3308_ADC_HPF_PATH_EN); ++ } else { ++ /* Disable high pass filter for ADCs. */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON04(e->reg), ++ RK3308_ADC_HPF_PATH_MSK, ++ RK3308_ADC_HPF_PATH_DIS); ++ } + +- /* Step 19 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, +- RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); ++ rk3308->hpf_cutoff[e->reg] = value; + + return 0; + } + +-static int rk3308_codec_dac_disable(struct rk3308_codec_priv *rk3308) ++static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) + { +- /* Step 01 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_GAIN_MSK | RK3308_DAC_R_GAIN_MSK, +- RK3308_DAC_L_GAIN_0DB | RK3308_DAC_R_GAIN_0DB); +- +- /* +- * Step 02 +- * +- * Note1. In the step2, adjusting the register step by step to the +- * appropriate value and taking 20ms as time step +- */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, +- RK3308_DAC_L_HPOUT_GAIN_MSK, +- RK3308_DAC_L_HPOUT_GAIN_NDB_39); +- +- /* Step 02 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, +- RK3308_DAC_R_HPOUT_GAIN_MSK, +- RK3308_DAC_R_HPOUT_GAIN_NDB_39); ++ return snd_soc_get_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 03 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_UNMUTE | +- RK3308_DAC_R_HPMIX_UNMUTE, +- RK3308_DAC_L_HPMIX_MUTE | +- RK3308_DAC_R_HPMIX_MUTE); ++static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int dgain = ucontrol->value.integer.value[0]; + +- /* Step 04 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_SEL_MSK | +- RK3308_DAC_R_HPMIX_SEL_MSK, +- RK3308_DAC_L_HPMIX_NONE | +- RK3308_DAC_R_HPMIX_NONE); ++ if (dgain > RK3308_DAC_L_HPOUT_GAIN_MAX) { ++ dev_err(rk3308->plat_dev, "%s: invalid l_dgain: %d\n", ++ __func__, dgain); ++ return -EINVAL; ++ } + +- /* Step 05 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_UNMUTE | +- RK3308_DAC_R_HPOUT_UNMUTE, +- RK3308_DAC_L_HPOUT_MUTE | +- RK3308_DAC_R_HPOUT_MUTE); ++ rk3308->hpout_l_dgain = dgain; + +- /* Step 06 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_WORK | RK3308_DAC_R_DAC_WORK, +- RK3308_DAC_L_DAC_INIT | RK3308_DAC_R_DAC_INIT); ++ return snd_soc_put_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 07 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_EN | RK3308_DAC_R_HPOUT_EN, +- RK3308_DAC_L_HPOUT_DIS | RK3308_DAC_R_HPOUT_DIS); ++static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ return snd_soc_get_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 08 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_UNMUTE | +- RK3308_DAC_R_LINEOUT_UNMUTE, +- RK3308_DAC_L_LINEOUT_MUTE | +- RK3308_DAC_R_LINEOUT_MUTE); ++static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int dgain = ucontrol->value.integer.value[0]; + +- /* Step 09 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, +- RK3308_DAC_L_LINEOUT_EN | RK3308_DAC_R_LINEOUT_EN, +- RK3308_DAC_L_LINEOUT_DIS | RK3308_DAC_R_LINEOUT_DIS); ++ if (dgain > RK3308_DAC_R_HPOUT_GAIN_MAX) { ++ dev_err(rk3308->plat_dev, "%s: invalid r_dgain: %d\n", ++ __func__, dgain); ++ return -EINVAL; ++ } + +- /* Step 10 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_EN | RK3308_DAC_R_HPMIX_EN, +- RK3308_DAC_L_HPMIX_DIS | RK3308_DAC_R_HPMIX_DIS); ++ rk3308->hpout_r_dgain = dgain; + +- /* Step 11 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_DAC_EN | RK3308_DAC_R_DAC_EN, +- RK3308_DAC_L_DAC_DIS | RK3308_DAC_R_DAC_DIS); ++ return snd_soc_put_volsw_range(kcontrol, ucontrol); ++} + +- /* Step 12 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_CLK_EN | RK3308_DAC_R_CLK_EN, +- RK3308_DAC_L_CLK_DIS | RK3308_DAC_R_CLK_DIS); ++static u32 to_mapped_grp(struct rk3308_codec_priv *rk3308, int idx) ++{ ++ return rk3308->i2s_sdis[idx]; ++} + +- /* Step 13 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, +- RK3308_DAC_L_REF_EN | RK3308_DAC_R_REF_EN, +- RK3308_DAC_L_REF_DIS | RK3308_DAC_R_REF_DIS); ++static bool adc_for_each_grp(struct rk3308_codec_priv *rk3308, ++ int type, int idx, u32 *grp) ++{ ++ if (type == ADC_TYPE_NORMAL) { ++ u32 mapped_grp = to_mapped_grp(rk3308, idx); ++ int max_grps; ++ ++ if (rk3308->enable_all_adcs) ++ max_grps = ADC_LR_GROUP_MAX; ++ else ++ max_grps = rk3308->used_adc_grps; ++ ++ if (idx >= max_grps) ++ return false; ++ ++ if ((!rk3308->loopback_dacs_enabled) && ++ handle_loopback(rk3308) && ++ rk3308->loopback_grp == mapped_grp) { ++ /* ++ * Ths loopback DACs are closed, and specify the ++ * loopback ADCs. ++ */ ++ *grp = ADC_GRP_SKIP_MAGIC; ++ } else if (rk3308->en_always_grps_num && ++ rk3308->skip_grps[mapped_grp]) { ++ /* To set the skip flag if the ADC GRP is enabled. */ ++ *grp = ADC_GRP_SKIP_MAGIC; ++ } else { ++ *grp = mapped_grp; ++ } + +- /* Step 14 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_L_MSK | +- RK3308_DAC_POP_SOUND_R_MSK, +- RK3308_DAC_POP_SOUND_L_INIT | +- RK3308_DAC_POP_SOUND_R_INIT); ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_NORMAL, idx: %d, mapped_grp: %d, get grp: %d,\n", ++ idx, mapped_grp, *grp); ++ } else if (type == ADC_TYPE_ALL) { ++ if (idx >= ADC_LR_GROUP_MAX) ++ return false; ++ ++ *grp = idx; ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_ALL, idx: %d, get grp: %d\n", ++ idx, *grp); ++ } else if (type == ADC_TYPE_DBG) { ++ if (idx >= ADC_LR_GROUP_MAX) ++ return false; ++ ++ if (idx == (int)rk3308->cur_dbg_grp) ++ *grp = idx; ++ else ++ *grp = ADC_GRP_SKIP_MAGIC; ++ ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_DBG, idx: %d, get grp: %d\n", ++ idx, *grp); ++ } else { ++ if (idx >= 1) ++ return false; ++ ++ *grp = rk3308->loopback_grp; ++ dev_dbg(rk3308->plat_dev, ++ "ADC_TYPE_LOOPBACK, idx: %d, get grp: %d\n", ++ idx, *grp); ++ } + +- /* Step 15 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_BUF_REF_L_EN | RK3308_DAC_BUF_REF_R_EN, +- RK3308_DAC_BUF_REF_L_DIS | RK3308_DAC_BUF_REF_R_DIS); ++ return true; ++} + +- /* Step 16 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, +- RK3308_DAC_CURRENT_EN, +- RK3308_DAC_CURRENT_DIS); ++static int rk3308_codec_get_dac_path_state(struct rk3308_codec_priv *rk3308) ++{ ++ return rk3308->dac_path_state; ++} + +- /* Step 17 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, +- RK3308_DAC_L_HPOUT_WORK | RK3308_DAC_R_HPOUT_WORK, +- RK3308_DAC_L_HPOUT_INIT | RK3308_DAC_R_HPOUT_INIT); ++static void rk3308_codec_set_dac_path_state(struct rk3308_codec_priv *rk3308, ++ int state) ++{ ++ rk3308->dac_path_state = state; ++} + +- /* Step 18 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, +- RK3308_DAC_L_HPMIX_WORK | RK3308_DAC_R_HPMIX_WORK, +- RK3308_DAC_L_HPMIX_INIT | RK3308_DAC_R_HPMIX_INIT); ++static void rk3308_headphone_ctl(struct rk3308_codec_priv *rk3308, int on) ++{ ++ if (rk3308->hp_ctl_gpio) ++ gpiod_direction_output(rk3308->hp_ctl_gpio, on); ++} + +- /* Step 19 */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, +- RK3308_DAC_L_HPMIX_GAIN_MSK | +- RK3308_DAC_R_HPMIX_GAIN_MSK, +- RK3308_DAC_L_HPMIX_GAIN_NDB_6 | +- RK3308_DAC_R_HPMIX_GAIN_NDB_6); ++static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) ++{ ++ if (on) { ++ if (rk3308->pa_drv_gpio) { ++ gpiod_direction_output(rk3308->pa_drv_gpio, on); ++ msleep(rk3308->delay_pa_drv_ms); ++ } + +- /* +- * Note2. If the ACODEC_DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] +- * is set to 0x1, add the steps from the section Disable DAC +- * Configuration Standard Usage Flow after complete the step 19 +- */ ++ if (rk3308->spk_ctl_gpio) ++ gpiod_direction_output(rk3308->spk_ctl_gpio, on); ++ } else { ++ if (rk3308->spk_ctl_gpio) ++ gpiod_direction_output(rk3308->spk_ctl_gpio, on); + +- return 0; ++ if (rk3308->pa_drv_gpio) { ++ msleep(rk3308->delay_pa_drv_ms); ++ gpiod_direction_output(rk3308->pa_drv_gpio, on); ++ } ++ } + } + +-static int rk3308_codec_power_on(struct snd_soc_codec *codec) ++static int rk3308_codec_reset(struct snd_soc_codec *codec) + { + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- /* 1. Supply the power of digital part and reset the Audio Codec */ +- /* Do nothing */ ++ reset_control_assert(rk3308->reset); ++ usleep_range(2000, 2500); /* estimated value */ ++ reset_control_deassert(rk3308->reset); + +- /* +- * 2. Configure ACODEC_DAC_ANA_CON1[1:0] and ACODEC_DAC_ANA_CON1[5:4] +- * to 0x1, to setup dc voltage of the DAC channel output +- */ +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_L_MSK, RK3308_DAC_POP_SOUND_L_INIT); +- regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, +- RK3308_DAC_POP_SOUND_R_MSK, RK3308_DAC_POP_SOUND_R_INIT); ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, 0x00); ++ usleep_range(200, 300); /* estimated value */ ++ regmap_write(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_SYS_WORK | ++ RK3308_DAC_DIG_WORK | ++ RK3308_ADC_DIG_WORK); + +- /* +- * 3. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 +- * +- * Note: Only the reg (ADC_ANA_CON10+0x0)[6:0] represent the control +- * signal to select current to pre-charge/dis_charge +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ return 0; ++} + +- /* 4. Supply the power of the analog part(AVDD,AVDDRV) */ ++static int rk3308_codec_adc_dig_reset(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_RESET); ++ udelay(50); ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_WORK); + +- /* +- * 5. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x1 to setup +- * reference voltage +- * +- * Note: Only the reg (ADC_ANA_CON10+0x0)[7] represent the enable +- * signal of reference voltage module +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_REF_EN, RK3308_ADC_REF_EN); ++ return 0; ++} + +- /* +- * 6. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to +- * 0x7f step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to +- * 0x7f directly. The suggestion slot time of the step is 20ms. +- */ +- mdelay(20); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, +- RK3308_ADC_DONT_SEL_ALL); ++static int rk3308_codec_dac_dig_reset(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_DIG_WORK, ++ RK3308_DAC_DIG_RESET); ++ udelay(50); ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_DIG_WORK, ++ RK3308_DAC_DIG_WORK); + +- /* 7. Wait until the voltage of VCM keeps stable at the AVDD/2 */ +- usleep_range(200, 300); /* estimated value */ ++ return 0; ++} + +- /* +- * 8. Configure the register ACODEC_ADC_ANA_CON10[6:0] to the +- * appropriate value(expect 0x0) for reducing power. +- */ ++static int rk3308_set_bias_level(struct snd_soc_codec *codec, ++ enum snd_soc_bias_level level) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- /* TODO: choose an appropriate charge value */ ++ switch (level) { ++ case SND_SOC_BIAS_ON: ++ break; ++ case SND_SOC_BIAS_PREPARE: ++ break; ++ case SND_SOC_BIAS_STANDBY: ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ break; ++ case SND_SOC_BIAS_OFF: ++ break; ++ } + + return 0; + } + +-static int rk3308_codec_power_off(struct snd_soc_codec *codec) ++static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, ++ unsigned int fmt) + { ++ struct snd_soc_codec *codec = codec_dai->codec; + struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; ++ int idx, grp, is_master; ++ int type = ADC_TYPE_ALL; ++ ++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { ++ case SND_SOC_DAIFMT_CBS_CFS: ++ adc_aif2 |= RK3308_ADC_IO_MODE_SLAVE; ++ adc_aif2 |= RK3308_ADC_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_IO_MODE_SLAVE; ++ dac_aif2 |= RK3308_DAC_MODE_SLAVE; ++ is_master = 0; ++ break; ++ case SND_SOC_DAIFMT_CBM_CFM: ++ adc_aif2 |= RK3308_ADC_IO_MODE_MASTER; ++ adc_aif2 |= RK3308_ADC_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_IO_MODE_MASTER; ++ dac_aif2 |= RK3308_DAC_MODE_MASTER; ++ is_master = 1; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ++ case SND_SOC_DAIFMT_DSP_A: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_PCM; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_PCM; ++ break; ++ case SND_SOC_DAIFMT_I2S: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_I2S; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_I2S; ++ break; ++ case SND_SOC_DAIFMT_RIGHT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_RJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_RJ; ++ break; ++ case SND_SOC_DAIFMT_LEFT_J: ++ adc_aif1 |= RK3308_ADC_I2S_MODE_LJ; ++ dac_aif1 |= RK3308_DAC_I2S_MODE_LJ; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { ++ case SND_SOC_DAIFMT_NB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ case SND_SOC_DAIFMT_IB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_IB_NF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_REVERSAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_REVERSAL; ++ break; ++ case SND_SOC_DAIFMT_NB_IF: ++ adc_aif1 |= RK3308_ADC_I2S_LRC_POL_REVERSAL; ++ adc_aif2 |= RK3308_ADC_I2S_BIT_CLK_POL_NORMAL; ++ dac_aif1 |= RK3308_DAC_I2S_LRC_POL_REVERSAL; ++ dac_aif2 |= RK3308_DAC_I2S_BIT_CLK_POL_NORMAL; ++ break; ++ default: ++ return -EINVAL; ++ } + + /* +- * 1. Keep the power on and disable the DAC and ADC path according to +- * the section power on configuration standard usage flow. ++ * Hold ADC Digital registers start at master mode ++ * ++ * There are 8 ADCs and use the same SCLK and LRCK internal for master ++ * mode, We need to make sure that they are in effect at the same time, ++ * otherwise they will cause the abnormal clocks. + */ ++ if (is_master) ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_RESET); ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(grp), ++ RK3308_ADC_I2S_LRC_POL_MSK | ++ RK3308_ADC_I2S_MODE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(grp), ++ RK3308_ADC_IO_MODE_MSK | ++ RK3308_ADC_MODE_MSK | ++ RK3308_ADC_I2S_BIT_CLK_POL_MSK, ++ adc_aif2); ++ } + +- /* 2. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 0x1 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, RK3308_ADC_SEL_I_64(1)); ++ /* Hold ADC Digital registers end at master mode */ ++ if (is_master) ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_DIG_WORK, ++ RK3308_ADC_DIG_WORK); + +- /* 3. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x0 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_REF_EN, RK3308_ADC_REF_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_LRC_POL_MSK | ++ RK3308_DAC_I2S_MODE_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_IO_MODE_MSK | ++ RK3308_DAC_MODE_MSK | ++ RK3308_DAC_I2S_BIT_CLK_POL_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_dig_config(struct rk3308_codec_priv *rk3308, ++ struct snd_pcm_hw_params *params) ++{ ++ unsigned int dac_aif1 = 0, dac_aif2 = 0; ++ ++ /* Clear the status of DAC DIG Digital reigisters */ ++ rk3308_codec_dac_dig_reset(rk3308); ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ dac_aif1 |= RK3308_DAC_I2S_VALID_LEN_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ dac_aif1 |= RK3308_DAC_I2S_LR_NORMAL; ++ dac_aif2 |= RK3308_DAC_I2S_WORK; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON01, ++ RK3308_DAC_I2S_VALID_LEN_MSK | ++ RK3308_DAC_I2S_LR_MSK, ++ dac_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_DIG_CON02, ++ RK3308_DAC_I2S_MSK, ++ dac_aif2); ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_dig_config(struct rk3308_codec_priv *rk3308, ++ struct snd_pcm_hw_params *params) ++{ ++ unsigned int adc_aif1 = 0, adc_aif2 = 0; ++ int type = ADC_TYPE_NORMAL; ++ int idx, grp; ++ ++ /* Clear the status of ADC DIG Digital reigisters */ ++ rk3308_codec_adc_dig_reset(rk3308); ++ ++ switch (params_format(params)) { ++ case SNDRV_PCM_FORMAT_S16_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_16BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S20_3LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_20BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S24_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_24BITS; ++ break; ++ case SNDRV_PCM_FORMAT_S32_LE: ++ adc_aif1 |= RK3308_ADC_I2S_VALID_LEN_32BITS; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ switch (params_channels(params)) { ++ case 1: ++ adc_aif1 |= RK3308_ADC_I2S_MONO; ++ break; ++ case 2: ++ case 4: ++ case 6: ++ case 8: ++ adc_aif1 |= RK3308_ADC_I2S_STEREO; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ adc_aif1 |= RK3308_ADC_I2S_LR_NORMAL; ++ adc_aif2 |= RK3308_ADC_I2S_WORK; ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON01(grp), ++ RK3308_ADC_I2S_VALID_LEN_MSK | ++ RK3308_ADC_I2S_LR_MSK | ++ RK3308_ADC_I2S_TYPE_MSK, ++ adc_aif1); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON02(grp), ++ RK3308_ADC_I2S_MSK, ++ adc_aif2); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_update_adc_grps(struct rk3308_codec_priv *rk3308, ++ struct snd_pcm_hw_params *params) ++{ ++ switch (params_channels(params)) { ++ case 1: ++ rk3308->used_adc_grps = 1; ++ break; ++ case 2: ++ case 4: ++ case 6: ++ case 8: ++ rk3308->used_adc_grps = params_channels(params) / 2; ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Invalid channels: %d\n", ++ params_channels(params)); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ if (stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ int dgain; ++ ++ if (mute) { ++ for (dgain = 0x2; dgain <= 0x7; dgain++) { ++ /* ++ * Keep the max -> min digital CIC interpolation ++ * filter gain step by step. ++ * ++ * loud: 0x2; whisper: 0x7 ++ */ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_DAC_DIG_CON04, ++ RK3308_DAC_CIC_IF_GAIN_MSK, ++ dgain); ++ usleep_range(200, 300); /* estimated value */ ++ } ++ ++#if !DEBUG_POP_ALWAYS ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 0); ++#endif ++ } else { ++#if !DEBUG_POP_ALWAYS ++ if (rk3308->dac_output == DAC_LINEOUT) ++ rk3308_speaker_ctl(rk3308, 1); ++ else if (rk3308->dac_output == DAC_HPOUT) ++ rk3308_headphone_ctl(rk3308, 1); ++ ++ if (rk3308->delay_start_play_ms) ++ msleep(rk3308->delay_start_play_ms); ++#endif ++ for (dgain = 0x7; dgain >= 0x2; dgain--) { ++ /* ++ * Keep the min -> max digital CIC interpolation ++ * filter gain step by step ++ * ++ * loud: 0x2; whisper: 0x7 ++ */ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_DAC_DIG_CON04, ++ RK3308_DAC_CIC_IF_GAIN_MSK, ++ dgain); ++ usleep_range(200, 300); /* estimated value */ ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_digital_fadein(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int dgain, dgain_ref; ++ ++ if (rk3308->hpout_l_dgain != rk3308->hpout_r_dgain) { ++ pr_warn("HPOUT l_dgain: 0x%x != r_dgain: 0x%x\n", ++ rk3308->hpout_l_dgain, rk3308->hpout_r_dgain); ++ dgain_ref = min(rk3308->hpout_l_dgain, rk3308->hpout_r_dgain); ++ } else { ++ dgain_ref = rk3308->hpout_l_dgain; ++ } + + /* +- * 4.Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to 0x7f +- * step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to 0x7f +- * directly. The suggestion slot time of the step is 20ms ++ * We'd better change the gain of the left and right channels ++ * at the same time to avoid different listening + */ +- mdelay(20); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), +- RK3308_ADC_CURRENT_CHARGE_MSK, +- RK3308_ADC_DONT_SEL_ALL); ++ for (dgain = RK3308_DAC_L_HPOUT_GAIN_NDB_39; ++ dgain <= dgain_ref; dgain++) { ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ dgain); ++ ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ dgain); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_digital_fadeout(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int l_dgain, r_dgain; ++ ++ /* ++ * Note. In the step2, adjusting the register step by step to ++ * the appropriate value and taking 20ms as time step ++ */ ++ regmap_read(rk3308->regmap, RK3308_DAC_ANA_CON05, &l_dgain); ++ l_dgain &= RK3308_DAC_L_HPOUT_GAIN_MSK; ++ ++ regmap_read(rk3308->regmap, RK3308_DAC_ANA_CON06, &r_dgain); ++ r_dgain &= RK3308_DAC_R_HPOUT_GAIN_MSK; ++ ++ if (l_dgain != r_dgain) { ++ pr_warn("HPOUT l_dgain: 0x%x != r_dgain: 0x%x\n", ++ l_dgain, r_dgain); ++ l_dgain = min(l_dgain, r_dgain); ++ } ++ ++ /* ++ * We'd better change the gain of the left and right channels ++ * at the same time to avoid different listening ++ */ ++ while (l_dgain >= RK3308_DAC_L_HPOUT_GAIN_NDB_39) { ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ l_dgain); ++ ++ /* Step 02 decrease dgains for de-pop */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ l_dgain); ++ ++ usleep_range(200, 300); /* estimated value */ ++ ++ if (l_dgain == RK3308_DAC_L_HPOUT_GAIN_NDB_39) ++ break; ++ ++ l_dgain--; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_lineout_enable(struct rk3308_codec_priv *rk3308) ++{ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_DC_FROM_INTERNAL); ++ } ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN); ++ ++ udelay(20); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_LINEOUT_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_LINEOUT_FROM_INTERNAL); ++ ++ udelay(20); ++ } ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE); ++ udelay(20); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_lineout_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_MUTE | ++ RK3308_DAC_R_LINEOUT_MUTE); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_DIS | ++ RK3308_DAC_R_LINEOUT_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_hpout_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_WORK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_WORK); ++ ++ udelay(20); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN); ++ ++ udelay(20); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK); ++ ++ udelay(20); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE); ++ ++ udelay(20); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_hpout_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_INIT | ++ RK3308_DAC_HPOUT_POP_SOUND_R_INIT); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_DIS | ++ RK3308_DAC_R_HPOUT_DIS); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_INIT | ++ RK3308_DAC_R_HPOUT_INIT); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_MUTE | ++ RK3308_DAC_R_HPOUT_MUTE); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_switch(struct rk3308_codec_priv *rk3308, ++ int dac_output) ++{ int ret = 0; ++ ++ if (rk3308->dac_output == dac_output) { ++ dev_info(rk3308->plat_dev, ++ "Don't need to change dac_output: %d\n", dac_output); ++ goto out; ++ } ++ ++ switch (dac_output) { ++ case DAC_LINEOUT: ++ case DAC_HPOUT: ++ case DAC_LINEOUT_HPOUT: ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Unknown value: %d\n", dac_output); ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (rk3308_codec_get_dac_path_state(rk3308) == PATH_BUSY) { ++ /* ++ * We can only switch the audio path to LINEOUT or HPOUT on ++ * codec during playbacking, otherwise, just update the ++ * dac_output flag. ++ */ ++ switch (dac_output) { ++ case DAC_LINEOUT: ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 1); ++ rk3308_codec_dac_hpout_disable(rk3308); ++ rk3308_codec_dac_lineout_enable(rk3308); ++ break; ++ case DAC_HPOUT: ++ rk3308_speaker_ctl(rk3308, 0); ++ rk3308_headphone_ctl(rk3308, 1); ++ rk3308_codec_dac_lineout_disable(rk3308); ++ rk3308_codec_dac_hpout_enable(rk3308); ++ break; ++ case DAC_LINEOUT_HPOUT: ++ rk3308_speaker_ctl(rk3308, 1); ++ rk3308_headphone_ctl(rk3308, 1); ++ rk3308_codec_dac_lineout_enable(rk3308); ++ rk3308_codec_dac_hpout_enable(rk3308); ++ break; ++ default: ++ break; ++ } ++ } ++ ++ rk3308->dac_output = dac_output; ++out: ++ dev_dbg(rk3308->plat_dev, "switch dac_output to: %d\n", ++ rk3308->dac_output); ++ ++ return ret; ++} ++ ++static int rk3308_codec_dac_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Note1. If the ACODEC_DAC_ANA_CON12[6] or ACODEC_DAC_ANA_CON12[2] ++ * is set to 0x1, ignoring the step9~12. ++ */ ++ ++ /* ++ * Note2. If the ACODEC_ DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] ++ * is set to 0x1, the ADC0 or ADC1 should be enabled firstly, and ++ * please refer to Enable ADC Configuration Standard Usage Flow(expect ++ * step7~step9,step14). ++ */ ++ ++ /* ++ * Note3. If no opening the line out, ignoring the step6, step17 and ++ * step19. ++ */ ++ ++ /* ++ * Note4. If no opening the headphone out, ignoring the step3,step7~8, ++ * step16 and step18. ++ */ ++ ++ /* ++ * Note5. In the step18, adjust the register step by step to the ++ * appropriate value and taking 10ms as one time step ++ */ ++ ++ /* ++ * 1. Set the ACODEC_DAC_ANA_CON0[0] to 0x1, to enable the current ++ * source of DAC ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_MSK, ++ RK3308_DAC_CURRENT_EN); ++ ++ udelay(20); ++ ++ /* ++ * 2. Set the ACODEC_DAC_ANA_CON1[6] and ACODEC_DAC_ANA_CON1[2] to 0x1, ++ * to enable the reference voltage buffer ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_MSK | ++ RK3308_DAC_BUF_REF_R_MSK, ++ RK3308_DAC_BUF_REF_L_EN | ++ RK3308_DAC_BUF_REF_R_EN); ++ ++ /* Waiting the stable reference voltage */ ++ mdelay(1); ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_WORK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_WORK); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B && ++ (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT)) { ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_DC_FROM_INTERNAL); ++ ++ udelay(20); ++ } ++ ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | ++ RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_EN | ++ RK3308_DAC_R_HPMIX_EN); ++ ++ /* Waiting the stable HPMIX */ ++ mdelay(1); ++ ++ /* Step 06. Reset HPMIX and recover HPMIX gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_INIT | ++ RK3308_DAC_R_HPMIX_INIT); ++ udelay(50); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK); ++ ++ udelay(20); ++ ++ if (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN); ++ ++ udelay(20); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_LINEOUT_FROM_INTERNAL | ++ RK3308_DAC_R_SEL_LINEOUT_FROM_INTERNAL); ++ ++ udelay(20); ++ } ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | ++ RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_EN | ++ RK3308_DAC_R_REF_EN); ++ ++ udelay(20); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | ++ RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_EN | ++ RK3308_DAC_R_CLK_EN); ++ ++ udelay(20); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | ++ RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_EN | ++ RK3308_DAC_R_DAC_EN); ++ ++ udelay(20); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | ++ RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_WORK | ++ RK3308_DAC_R_DAC_WORK); ++ ++ udelay(20); ++ ++ /* Step 15 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_I2S | ++ RK3308_DAC_R_HPMIX_I2S); ++ ++ udelay(20); ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE); ++ ++ udelay(20); ++ ++ /* Step 17: Put configuration HPMIX Gain to DAPM */ ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE); ++ ++ udelay(20); ++ } ++ ++ if (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE); ++ udelay(20); ++ } ++ ++ /* Step 20, put configuration HPOUT gain to DAPM control */ ++ /* Step 21, put configuration LINEOUT gain to DAPM control */ ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Just for HPOUT */ ++ rk3308_codec_digital_fadein(rk3308); ++ } ++ ++ rk3308->dac_endisable = true; ++ ++ /* TODO: TRY TO TEST DRIVE STRENGTH */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_dac_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Step 00 skipped. Keep the DAC channel work and input the mute signal. ++ */ ++ ++ /* Step 01 skipped. May set the min gain for LINEOUT. */ ++ ++ /* Step 02 skipped. May set the min gain for HPOUT. */ ++ ++ if (rk3308->dac_output == DAC_HPOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT) { ++ /* Just for HPOUT */ ++ rk3308_codec_digital_fadeout(rk3308); ++ } ++ ++ /* Step 03 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE, ++ RK3308_DAC_L_HPMIX_UNMUTE | ++ RK3308_DAC_R_HPMIX_UNMUTE); ++ ++ /* Step 04 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_SEL_MSK | ++ RK3308_DAC_R_HPMIX_SEL_MSK, ++ RK3308_DAC_L_HPMIX_NONE | ++ RK3308_DAC_R_HPMIX_NONE); ++ /* Step 05 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_UNMUTE | ++ RK3308_DAC_R_HPOUT_UNMUTE, ++ RK3308_DAC_L_HPOUT_MUTE | ++ RK3308_DAC_R_HPOUT_MUTE); ++ ++ /* Step 06 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_WORK | ++ RK3308_DAC_R_DAC_WORK, ++ RK3308_DAC_L_DAC_INIT | ++ RK3308_DAC_R_DAC_INIT); ++ ++ /* Step 07 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_EN | ++ RK3308_DAC_R_HPOUT_EN, ++ RK3308_DAC_L_HPOUT_DIS | ++ RK3308_DAC_R_HPOUT_DIS); ++ ++ /* Step 08 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_UNMUTE | ++ RK3308_DAC_R_LINEOUT_UNMUTE, ++ RK3308_DAC_L_LINEOUT_MUTE | ++ RK3308_DAC_R_LINEOUT_MUTE); ++ ++ /* Step 09 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_EN | ++ RK3308_DAC_R_LINEOUT_EN, ++ RK3308_DAC_L_LINEOUT_DIS | ++ RK3308_DAC_R_LINEOUT_DIS); ++ ++ /* Step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_EN | ++ RK3308_DAC_R_HPMIX_EN, ++ RK3308_DAC_L_HPMIX_DIS | ++ RK3308_DAC_R_HPMIX_DIS); ++ ++ /* Step 11 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_DAC_EN | ++ RK3308_DAC_R_DAC_EN, ++ RK3308_DAC_L_DAC_DIS | ++ RK3308_DAC_R_DAC_DIS); ++ ++ /* Step 12 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_CLK_EN | ++ RK3308_DAC_R_CLK_EN, ++ RK3308_DAC_L_CLK_DIS | ++ RK3308_DAC_R_CLK_DIS); ++ ++ /* Step 13 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON02, ++ RK3308_DAC_L_REF_EN | ++ RK3308_DAC_R_REF_EN, ++ RK3308_DAC_L_REF_DIS | ++ RK3308_DAC_R_REF_DIS); ++ ++ /* Step 14 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_INIT | ++ RK3308_DAC_HPOUT_POP_SOUND_R_INIT); ++ ++ /* Step 15 */ ++ if (rk3308->codec_ver == ACODEC_VERSION_B && ++ (rk3308->dac_output == DAC_LINEOUT || ++ rk3308->dac_output == DAC_LINEOUT_HPOUT)) { ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK | ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_VCM | ++ RK3308_DAC_R_SEL_DC_FROM_VCM); ++ } ++ ++ /* Step 16 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_BUF_REF_L_EN | ++ RK3308_DAC_BUF_REF_R_EN, ++ RK3308_DAC_BUF_REF_L_DIS | ++ RK3308_DAC_BUF_REF_R_DIS); ++ ++ /* Step 17 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_CURRENT_EN, ++ RK3308_DAC_CURRENT_DIS); ++ ++ /* Step 18 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON03, ++ RK3308_DAC_L_HPOUT_WORK | ++ RK3308_DAC_R_HPOUT_WORK, ++ RK3308_DAC_L_HPOUT_INIT | ++ RK3308_DAC_R_HPOUT_INIT); ++ ++ /* Step 19 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON13, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK, ++ RK3308_DAC_L_HPMIX_WORK | ++ RK3308_DAC_R_HPMIX_WORK); ++ ++ /* Step 20 skipped, may set the min gain for HPOUT. */ ++ ++ /* ++ * Note2. If the ACODEC_DAC_ANA_CON12[7] or ACODEC_DAC_ANA_CON12[3] ++ * is set to 0x1, add the steps from the section Disable ADC ++ * Configuration Standard Usage Flow after complete the step 19 ++ * ++ * IF USING LINE-IN ++ * rk3308_codec_adc_ana_disable(rk3308, type); ++ */ ++ ++ rk3308->dac_endisable = false; ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_on(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int v; ++ ++ /* 0. Supply the power of digital part and reset the Audio Codec */ ++ /* Do nothing */ ++ ++ /* ++ * 1. Configure ACODEC_DAC_ANA_CON1[1:0] and ACODEC_DAC_ANA_CON1[5:4] ++ * to 0x1, to setup dc voltage of the DAC channel output. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_L_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_L_INIT); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON01, ++ RK3308_DAC_HPOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_HPOUT_POP_SOUND_R_INIT); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 2. Configure ACODEC_DAC_ANA_CON15[1:0] and ++ * ACODEC_DAC_ANA_CON15[5:4] to 0x1, to setup dc voltage of ++ * the DAC channel output. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_L_MSK, ++ RK3308_DAC_L_SEL_DC_FROM_VCM); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON15, ++ RK3308_DAC_LINEOUT_POP_SOUND_R_MSK, ++ RK3308_DAC_R_SEL_DC_FROM_VCM); ++ } ++ ++ /* ++ * 3. Configure the register ACODEC_ADC_ANA_CON10[3:0] to 7’b000_0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_SEL_I(0x1)); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 4. Configure the register ACODEC_ADC_ANA_CON14[3:0] to ++ * 4’b0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, ++ RK3308_DAC_SEL_I(0x1)); ++ } ++ ++ /* 5. Supply the power of the analog part(AVDD,AVDDRV) */ ++ ++ /* ++ * 6. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x1 to setup ++ * reference voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, RK3308_ADC_REF_EN); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 7. Configure the register ACODEC_ADC_ANA_CON14[4] to 0x1 to ++ * setup reference voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_VCM_LINEOUT_EN, ++ RK3308_DAC_VCM_LINEOUT_EN); ++ } ++ ++ /* ++ * 8. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to ++ * 0x7f step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to ++ * 0x7f directly. Here the slot time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0x7f; v++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 9. Change the register ACODEC_ADC_ANA_CON14[3:0] from the 0x1 ++ * to 0xf step by step or configure the ++ * ACODEC_ADC_ANA_CON14[3:0] to 0xf directly. Here the slot ++ * time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0xf; v++) { ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ } ++ ++ /* 10. Wait until the voltage of VCM keeps stable at the AVDD/2 */ ++ msleep(20); /* estimated value */ ++ ++ /* ++ * 11. Configure the register ACODEC_ADC_ANA_CON10[6:0] to the ++ * appropriate value(expect 0x0) for reducing power. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, 0x7c); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 12. Configure the register ACODEC_DAC_ANA_CON14[6:0] to the ++ * appropriate value(expect 0x0) for reducing power. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, 0xf); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_power_off(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int v; ++ ++ /* ++ * 0. Keep the power on and disable the DAC and ADC path according to ++ * the section power on configuration standard usage flow. ++ */ ++ ++ /* ++ * 1. Configure the register ACODEC_ADC_ANA_CON10[6:0] to 7’b000_0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ RK3308_ADC_SEL_I(0x1)); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 2. Configure the register ACODEC_DAC_ANA_CON14[3:0] to ++ * 4’b0001. ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_CURRENT_CHARGE_MSK, ++ RK3308_DAC_SEL_I(0x1)); ++ } ++ ++ /* 3. Configure the register ACODEC_ADC_ANA_CON10[7] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_REF_EN, ++ RK3308_ADC_REF_DIS); ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* 4. Configure the register ACODEC_DAC_ANA_CON14[7] to 0x0 */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON14, ++ RK3308_DAC_VCM_LINEOUT_EN, ++ RK3308_DAC_VCM_LINEOUT_DIS); ++ } ++ ++ /* ++ * 5. Change the register ACODEC_ADC_ANA_CON10[6:0] from the 0x1 to 0x7f ++ * step by step or configure the ACODEC_ADC_ANA_CON10[6:0] to 0x7f ++ * directly. Here the slot time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0x7f; v++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* ++ * 6. Change the register ACODEC_DAC_ANA_CON14[3:0] from the 0x1 ++ * to 0xf step by step or configure the ++ * ACODEC_DAC_ANA_CON14[3:0] to 0xf directly. Here the slot ++ * time of the step is 200us. ++ */ ++ for (v = 0x1; v <= 0x7f; v++) { ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON10(0), ++ RK3308_ADC_CURRENT_CHARGE_MSK, ++ v); ++ udelay(200); ++ } ++ } ++ ++ /* 7. Wait until the voltage of VCM keeps stable at the AGND */ ++ msleep(20); /* estimated value */ ++ ++ /* 8. Power off the analog power supply */ ++ /* 9. Power off the digital power supply */ ++ ++ /* Do something via hardware */ ++ ++ return 0; ++} ++ ++static int rk3308_codec_headset_detect_enable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Set ACODEC_DAC_ANA_CON0[1] to 0x1, to enable the headset insert ++ * detection ++ * ++ * Note. When the voltage of PAD HPDET> 8*AVDD/9, the output value of ++ * the pin_hpdet will be set to 0x1 and assert a interrupt ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_HEADPHONE_DET_MSK, ++ RK3308_DAC_HEADPHONE_DET_EN); ++ ++ return 0; ++} ++ ++static int rk3308_codec_headset_detect_disable(struct rk3308_codec_priv *rk3308) ++{ ++ /* ++ * Set ACODEC_DAC_ANA_CON0[1] to 0x0, to disable the headset insert ++ * detection ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON00, ++ RK3308_DAC_HEADPHONE_DET_MSK, ++ RK3308_DAC_HEADPHONE_DET_DIS); ++ ++ return 0; ++} ++ ++static int rk3308_codec_check_i2s_sdis(struct rk3308_codec_priv *rk3308, ++ int num) ++{ ++ int i, j, ret = 0; ++ ++ switch (num) { ++ case 1: ++ rk3308->which_i2s = ACODEC_TO_I2S1_2CH; ++ break; ++ case 2: ++ rk3308->which_i2s = ACODEC_TO_I2S3_4CH; ++ break; ++ case 4: ++ rk3308->which_i2s = ACODEC_TO_I2S2_8CH; ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Invalid i2s sdis num: %d\n", num); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ for (i = 0; i < num; i++) { ++ if (rk3308->i2s_sdis[i] > ADC_LR_GROUP_MAX - 1) { ++ dev_err(rk3308->plat_dev, ++ "i2s_sdis[%d]: %d is overflow\n", ++ i, rk3308->i2s_sdis[i]); ++ ret = -EINVAL; ++ goto err; ++ } ++ ++ for (j = 0; j < num; j++) { ++ if (i == j) ++ continue; ++ ++ if (rk3308->i2s_sdis[i] == rk3308->i2s_sdis[j]) { ++ dev_err(rk3308->plat_dev, ++ "Invalid i2s_sdis: [%d]%d == [%d]%d\n", ++ i, rk3308->i2s_sdis[i], ++ j, rk3308->i2s_sdis[j]); ++ ret = -EINVAL; ++ goto err; ++ } ++ } ++ } ++ ++err: ++ return ret; ++} ++ ++static int rk3308_codec_adc_grps_route_config(struct rk3308_codec_priv *rk3308) ++{ ++ int idx = 0; ++ ++ if (rk3308->which_i2s == ACODEC_TO_I2S2_8CH) { ++ for (idx = 0; idx < rk3308->to_i2s_grps; idx++) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S2_8CH_SDI(idx, rk3308->i2s_sdis[idx])); ++ } ++ } else if (rk3308->which_i2s == ACODEC_TO_I2S3_4CH) { ++ for (idx = 0; idx < rk3308->to_i2s_grps; idx++) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S3_4CH_SDI(idx, rk3308->i2s_sdis[idx])); ++ } ++ } else if (rk3308->which_i2s == ACODEC_TO_I2S1_2CH) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S1_2CH_SDI(rk3308->i2s_sdis[idx])); ++ } ++ ++ return 0; ++} ++ ++/* Put default one-to-one mapping */ ++static int rk3308_codec_adc_grps_route_default(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int idx; ++ ++ /* ++ * The GRF values may be kept the previous status after hot reboot, ++ * if the property 'rockchip,adc-grps-route' is not set, we need to ++ * recover default the order of sdi/sdo for i2s2_8ch/i2s3_8ch/i2s1_2ch. ++ */ ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S1_2CH_SDI(0)); ++ ++ for (idx = 0; idx < 2; idx++) { ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S3_4CH_SDI(idx, idx)); ++ } ++ ++ /* Using i2s2_8ch by default. */ ++ rk3308->which_i2s = ACODEC_TO_I2S2_8CH; ++ rk3308->to_i2s_grps = ADC_LR_GROUP_MAX; ++ ++ for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) { ++ rk3308->i2s_sdis[idx] = idx; ++ regmap_write(rk3308->grf, GRF_SOC_CON1, ++ GRF_I2S2_8CH_SDI(idx, idx)); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_grps_route(struct rk3308_codec_priv *rk3308, ++ struct device_node *np) ++{ ++ int num, ret; ++ ++ num = of_count_phandle_with_args(np, "rockchip,adc-grps-route", NULL); ++ if (num < 0) { ++ if (num == -ENOENT) { ++ /* Not use 'rockchip,adc-grps-route' property here */ ++ rk3308_codec_adc_grps_route_default(rk3308); ++ ret = 0; ++ } else { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,adc-grps-route' num: %d\n", ++ num); ++ ret = num; ++ } ++ return ret; ++ } ++ ++ ret = of_property_read_u32_array(np, "rockchip,adc-grps-route", ++ rk3308->i2s_sdis, num); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,adc-grps-route': %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_check_i2s_sdis(rk3308, num); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to check i2s_sdis: %d\n", ret); ++ return ret; ++ } ++ ++ rk3308->to_i2s_grps = num; ++ ++ rk3308_codec_adc_grps_route_config(rk3308); ++ ++ return 0; ++} ++ ++static int check_micbias(int micbias) ++{ ++ switch (micbias) { ++ case RK3308_ADC_MICBIAS_VOLT_0_85: ++ case RK3308_ADC_MICBIAS_VOLT_0_8: ++ case RK3308_ADC_MICBIAS_VOLT_0_75: ++ case RK3308_ADC_MICBIAS_VOLT_0_7: ++ case RK3308_ADC_MICBIAS_VOLT_0_65: ++ case RK3308_ADC_MICBIAS_VOLT_0_6: ++ case RK3308_ADC_MICBIAS_VOLT_0_55: ++ case RK3308_ADC_MICBIAS_VOLT_0_5: ++ return 0; ++ } ++ ++ return -EINVAL; ++} ++ ++static bool handle_loopback(struct rk3308_codec_priv *rk3308) ++{ ++ /* The version B doesn't need to handle loopback. */ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) ++ return false; ++ ++ switch (rk3308->loopback_grp) { ++ case 0: ++ case 1: ++ case 2: ++ case 3: ++ return true; ++ } ++ ++ return false; ++} ++ ++static bool has_en_always_grps(struct rk3308_codec_priv *rk3308) ++{ ++ int idx; ++ ++ if (rk3308->en_always_grps_num) { ++ for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) { ++ if (rk3308->en_always_grps[idx] >= 0 && ++ rk3308->en_always_grps[idx] <= ADC_LR_GROUP_MAX - 1) ++ return true; ++ } ++ } ++ ++ return false; ++} ++ ++static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, ++ int micbias) ++{ ++ int ret; ++ ++ if (rk3308->ext_micbias != EXT_MICBIAS_NONE) ++ return 0; ++ ++ /* 0. Power up the ACODEC and keep the AVDDH stable */ ++ ++ /* Step 1. Configure ACODEC_ADC_ANA_CON7[2:0] to the certain value */ ++ ret = check_micbias(micbias); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, "This is an invalid micbias: %d\n", ++ micbias); ++ return ret; ++ } ++ ++ /* ++ * Note: Only the reg (ADC_ANA_CON7+0x0)[2:0] represent the level range ++ * control signal of MICBIAS voltage ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, ++ micbias); ++ ++ /* Step 2. Wait until the VCMH keep stable */ ++ msleep(20); /* estimated value */ ++ ++ /* ++ * Step 3. Configure ACODEC_ADC_ANA_CON8[4] to 0x1 ++ * ++ * Note: Only the reg (ADC_ANA_CON8+0x0)[4] represent the enable ++ * signal of current source for MICBIAS ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(0), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_EN); ++ ++ /* ++ * Step 4. Configure the (ADC_ANA_CON7+0x40)[3] or ++ * (ADC_ANA_CON7+0x80)[3] to 0x1. ++ * ++ * (ADC_ANA_CON7+0x40)[3] used to control the MICBIAS1, and ++ * (ADC_ANA_CON7+0x80)[3] used to control the MICBIAS2 ++ */ ++ if (rk3308->micbias1) ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(1), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_EN); ++ ++ if (rk3308->micbias2) ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(2), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_EN); ++ ++ /* waiting micbias stabled*/ ++ mdelay(50); ++ ++ rk3308->enable_micbias = true; ++ ++ return 0; ++} ++ ++static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308) ++{ ++ if (rk3308->ext_micbias != EXT_MICBIAS_NONE) ++ return 0; ++ ++ /* Step 0. Enable the MICBIAS and keep the Audio Codec stable */ ++ /* Do nothing */ ++ ++ /* ++ * Step 1. Configure the (ADC_ANA_CON7+0x40)[3] or ++ * (ADC_ANA_CON7+0x80)[3] to 0x0 ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(1), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_DIS); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(2), ++ RK3308_ADC_MIC_BIAS_BUF_EN, ++ RK3308_ADC_MIC_BIAS_BUF_DIS); ++ ++ /* ++ * Step 2. Configure ACODEC_ADC_ANA_CON8[4] to 0x0 ++ * ++ * Note: Only the reg (ADC_ANA_CON8+0x0)[4] represent the enable ++ * signal of current source for MICBIAS ++ */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(0), ++ RK3308_ADC_MICBIAS_CURRENT_MSK, ++ RK3308_ADC_MICBIAS_CURRENT_DIS); ++ ++ rk3308->enable_micbias = false; ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_reinit_mics(struct rk3308_codec_priv *rk3308, ++ int type) ++{ ++ int idx, grp; ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_INIT | ++ RK3308_ADC_CH2_ADC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 2 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_INIT | ++ RK3308_ADC_CH2_ALC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 3 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_INIT | ++ RK3308_ADC_CH2_MIC_INIT); ++ } ++ ++ usleep_range(200, 250); /* estimated value */ ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 2 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 3 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_enable(struct rk3308_codec_priv *rk3308, ++ int type) ++{ ++ unsigned int agc_func_en; ++ int idx, grp; ++ ++ /* ++ * 1. Set the ACODEC_ADC_ANA_CON7[7:6] and ACODEC_ADC_ANA_CON7[5:4], ++ * to select the line-in or microphone as input of ADC ++ * ++ * Note1. Please ignore the step1 for enabling ADC3, ADC4, ADC5, ++ * ADC6, ADC7, and ADC8 ++ */ ++ if (rk3308->adc_grp0_using_linein) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), ++ RK3308_ADC_CH1_IN_SEL_MSK | ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_LINEIN | ++ RK3308_ADC_CH2_IN_LINEIN); ++ ++ /* Keep other ADCs as MIC-IN */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ /* The groups without line-in are >= 1 */ ++ if (grp < 1 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON07(grp), ++ RK3308_ADC_CH1_IN_SEL_MSK | ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_MIC | ++ RK3308_ADC_CH2_IN_MIC); ++ } ++ } else { ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON07(grp), ++ RK3308_ADC_CH1_IN_SEL_MSK | ++ RK3308_ADC_CH2_IN_SEL_MSK, ++ RK3308_ADC_CH1_IN_MIC | ++ RK3308_ADC_CH2_IN_MIC); ++ } ++ } ++ ++ /* ++ * 2. Set ACODEC_ADC_ANA_CON0[7] and [3] to 0x1, to end the mute station ++ * of ADC, to enable the MIC module, to enable the reference voltage ++ * buffer, and to end the initialization of MIC ++ */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_UNMUTE | ++ RK3308_ADC_CH2_MIC_UNMUTE, ++ RK3308_ADC_CH1_MIC_UNMUTE | ++ RK3308_ADC_CH2_MIC_UNMUTE); ++ } ++ ++ /* ++ * 3. Set ACODEC_ADC_ANA_CON6[0] to 0x1, to enable the current source ++ * of audio ++ */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(grp), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_EN); ++ } ++ ++ /* ++ * This is mainly used for BIST mode that wait ADCs are stable. ++ * ++ * By tested results, the type delay is >40us, but we need to leave ++ * enough delay margin. ++ */ ++ usleep_range(400, 500); ++ ++ /* vendor step 4*/ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_BUF_REF_EN | ++ RK3308_ADC_CH2_BUF_REF_EN, ++ RK3308_ADC_CH1_BUF_REF_EN | ++ RK3308_ADC_CH2_BUF_REF_EN); ++ } ++ ++ /* vendor step 5 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_EN | ++ RK3308_ADC_CH2_MIC_EN, ++ RK3308_ADC_CH1_MIC_EN | ++ RK3308_ADC_CH2_MIC_EN); ++ } ++ ++ /* vendor step 6 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_EN | ++ RK3308_ADC_CH2_ALC_EN, ++ RK3308_ADC_CH1_ALC_EN | ++ RK3308_ADC_CH2_ALC_EN); ++ } ++ ++ /* vendor step 7 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH2_CLK_EN, ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH2_CLK_EN); ++ } ++ ++ /* vendor step 8 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH2_ADC_EN, ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH2_ADC_EN); ++ } ++ ++ /* vendor step 9 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK); ++ } ++ ++ /* vendor step 10 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK); ++ } ++ ++ /* vendor step 11 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK); ++ } ++ ++ /* vendor step 12 */ ++ ++ /* vendor step 13 */ ++ ++ /* vendor step 14 */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(grp), ++ &agc_func_en); ++ if (rk3308->adc_zerocross || ++ agc_func_en & RK3308_AGC_FUNC_SEL_EN) { ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ZEROCROSS_DET_EN, ++ RK3308_ADC_CH1_ZEROCROSS_DET_EN); ++ } ++ regmap_read(rk3308->regmap, RK3308_ALC_R_DIG_CON09(grp), ++ &agc_func_en); ++ if (rk3308->adc_zerocross || ++ agc_func_en & RK3308_AGC_FUNC_SEL_EN) { ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH2_ZEROCROSS_DET_EN, ++ RK3308_ADC_CH2_ZEROCROSS_DET_EN); ++ } ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ rk3308->adc_grps_endisable[grp] = true; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_adc_ana_disable(struct rk3308_codec_priv *rk3308, ++ int type) ++{ ++ int idx, grp; ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 1 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ZEROCROSS_DET_EN | ++ RK3308_ADC_CH2_ZEROCROSS_DET_EN, ++ RK3308_ADC_CH1_ZEROCROSS_DET_DIS | ++ RK3308_ADC_CH2_ZEROCROSS_DET_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 2 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_EN | ++ RK3308_ADC_CH2_ADC_EN, ++ RK3308_ADC_CH1_ADC_DIS | ++ RK3308_ADC_CH2_ADC_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 3 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_CLK_EN | ++ RK3308_ADC_CH2_CLK_EN, ++ RK3308_ADC_CH1_CLK_DIS | ++ RK3308_ADC_CH2_CLK_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 4 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_EN | ++ RK3308_ADC_CH2_ALC_EN, ++ RK3308_ADC_CH1_ALC_DIS | ++ RK3308_ADC_CH2_ALC_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 5 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_EN | ++ RK3308_ADC_CH2_MIC_EN, ++ RK3308_ADC_CH1_MIC_DIS | ++ RK3308_ADC_CH2_MIC_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 6 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_BUF_REF_EN | ++ RK3308_ADC_CH2_BUF_REF_EN, ++ RK3308_ADC_CH1_BUF_REF_DIS | ++ RK3308_ADC_CH2_BUF_REF_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 7 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(grp), ++ RK3308_ADC_CURRENT_MSK, ++ RK3308_ADC_CURRENT_DIS); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 8 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(grp), ++ RK3308_ADC_CH1_ADC_WORK | ++ RK3308_ADC_CH2_ADC_WORK, ++ RK3308_ADC_CH1_ADC_INIT | ++ RK3308_ADC_CH2_ADC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 9 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(grp), ++ RK3308_ADC_CH1_ALC_WORK | ++ RK3308_ADC_CH2_ALC_WORK, ++ RK3308_ADC_CH1_ALC_INIT | ++ RK3308_ADC_CH2_ALC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ /* vendor step 10 */ ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(grp), ++ RK3308_ADC_CH1_MIC_WORK | ++ RK3308_ADC_CH2_MIC_WORK, ++ RK3308_ADC_CH1_MIC_INIT | ++ RK3308_ADC_CH2_MIC_INIT); ++ } ++ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ rk3308->adc_grps_endisable[grp] = false; ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_capture(struct rk3308_codec_priv *rk3308) ++{ ++ int idx, grp = 0; ++ int type = ADC_TYPE_NORMAL; ++ ++ rk3308_codec_adc_ana_enable(rk3308, type); ++ rk3308_codec_adc_reinit_mics(rk3308, type); ++ ++ if (rk3308->adc_grp0_using_linein) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(0), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_RIGHT); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_DIG_CON03(0), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_LEFT); ++ } else { ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (handle_loopback(rk3308) && ++ idx == rk3308->loopback_grp && ++ grp == ADC_GRP_SKIP_MAGIC) { ++ /* ++ * Switch to dummy BIST mode (BIST keep reset ++ * now) to keep the zero input data in I2S bus. ++ * ++ * It may cause the glitch if we hold the ADC ++ * digtital i2s module in codec. ++ * ++ * Then, the grp which is set from loopback_grp. ++ */ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(rk3308->loopback_grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_BIST_SINE); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(rk3308->loopback_grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_BIST_SINE); ++ } else { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_LEFT); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_RIGHT); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++static void rk3308_codec_adc_mclk_disable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_MCLK_MSK, ++ RK3308_ADC_MCLK_DIS); ++} ++ ++static void rk3308_codec_adc_mclk_enable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_ADC_MCLK_MSK, ++ RK3308_ADC_MCLK_EN); ++ udelay(20); ++} ++ ++static void rk3308_codec_dac_mclk_disable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_MCLK_MSK, ++ RK3308_DAC_MCLK_DIS); ++} ++ ++static void rk3308_codec_dac_mclk_enable(struct rk3308_codec_priv *rk3308) ++{ ++ regmap_update_bits(rk3308->regmap, RK3308_GLB_CON, ++ RK3308_DAC_MCLK_MSK, ++ RK3308_DAC_MCLK_EN); ++ udelay(20); ++} ++ ++static int rk3308_codec_open_dbg_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_enable(rk3308, ADC_TYPE_DBG); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_dbg_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_DBG); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_all_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_ALL); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_capture(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_NORMAL); ++ ++ return 0; ++} ++ ++static int rk3308_codec_open_playback(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_dac_enable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_close_playback(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_dac_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_llp_down(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_mclk_disable(rk3308); ++ rk3308_codec_dac_mclk_disable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_llp_up(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_adc_mclk_enable(rk3308); ++ rk3308_codec_dac_mclk_enable(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dlp_down(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308_codec_power_off(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dlp_up(struct rk3308_codec_priv *rk3308) ++{ ++ rk3308_codec_power_on(rk3308); ++ rk3308_codec_micbias_enable(rk3308, rk3308->micbias_volt); ++ ++ return 0; ++} ++ ++/* Just used for debug and trace power state */ ++static void rk3308_codec_set_pm_state(struct rk3308_codec_priv *rk3308, ++ int pm_state) ++{ ++ int ret; ++ ++ switch (pm_state) { ++ case PM_LLP_DOWN: ++ rk3308_codec_llp_down(rk3308); ++ break; ++ case PM_LLP_UP: ++ rk3308_codec_llp_up(rk3308); ++ break; ++ case PM_DLP_DOWN: ++ rk3308_codec_dlp_down(rk3308); ++ break; ++ case PM_DLP_UP: ++ rk3308_codec_dlp_up(rk3308); ++ break; ++ case PM_DLP_DOWN2: ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); ++ clk_disable_unprepare(rk3308->pclk); ++ break; ++ case PM_DLP_UP2: ++ ret = clk_prepare_enable(rk3308->pclk); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable acodec pclk: %d\n", ret); ++ goto err; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_rx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_rx: %d\n", ret); ++ goto err; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_tx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_tx: %d\n", ret); ++ goto err; ++ } ++ break; ++ default: ++ dev_err(rk3308->plat_dev, "Invalid pm_state: %d\n", pm_state); ++ goto err; ++ } ++ ++ rk3308->pm_state = pm_state; ++ ++err: ++ return; ++} ++ ++static void rk3308_codec_update_adcs_status(struct rk3308_codec_priv *rk3308, ++ int state) ++{ ++ int idx, grp; ++ ++ /* Update skip_grps flags if the ADCs need to be enabled always. */ ++ if (state == PATH_BUSY) { ++ for (idx = 0; idx < rk3308->used_adc_grps; idx++) { ++ u32 mapped_grp = to_mapped_grp(rk3308, idx); ++ ++ for (grp = 0; grp < rk3308->en_always_grps_num; grp++) { ++ u32 en_always_grp = rk3308->en_always_grps[grp]; ++ ++ if (mapped_grp == en_always_grp) ++ rk3308->skip_grps[en_always_grp] = 1; ++ } ++ } ++ } ++} ++ ++static int rk3308_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_pcm_str *playback_str = ++ &substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; ++ int type = ADC_TYPE_LOOPBACK; ++ int idx, grp; ++ int ret; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* DAC only supports 2 channels */ ++ rk3308_codec_dac_mclk_enable(rk3308); ++ rk3308_codec_open_playback(rk3308); ++ rk3308_codec_dac_dig_config(rk3308, params); ++ rk3308_codec_set_dac_path_state(rk3308, PATH_BUSY); ++ } else { ++ if (rk3308->micbias_num && ++ !rk3308->enable_micbias) ++ rk3308_codec_micbias_enable(rk3308, rk3308->micbias_volt); ++ ++ rk3308_codec_adc_mclk_enable(rk3308); ++ ret = rk3308_codec_update_adc_grps(rk3308, params); ++ if (ret < 0) ++ return ret; ++ ++ if (handle_loopback(rk3308)) { ++ if (rk3308->micbias_num && ++ (params_channels(params) == 2) && ++ to_mapped_grp(rk3308, 0) == rk3308->loopback_grp) ++ rk3308_codec_micbias_disable(rk3308); ++ ++ /* Check the DACs are opened */ ++ if (playback_str->substream_opened) { ++ rk3308->loopback_dacs_enabled = true; ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_LEFT); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_RIGHT); ++ } ++ } else { ++ rk3308->loopback_dacs_enabled = false; ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_BIST_SINE); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_BIST_SINE); ++ } ++ } ++ } ++ ++ rk3308_codec_open_capture(rk3308); ++ rk3308_codec_adc_dig_config(rk3308, params); ++ rk3308_codec_update_adcs_status(rk3308, PATH_BUSY); ++ } ++ ++ return 0; ++} ++ ++static int rk3308_pcm_trigger(struct snd_pcm_substream *substream, ++ int cmd, struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ int type = ADC_TYPE_LOOPBACK; ++ int idx, grp; ++ ++ if (handle_loopback(rk3308) && ++ rk3308->dac_output == DAC_LINEOUT && ++ substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ if (cmd == SNDRV_PCM_TRIGGER_START) { ++ struct snd_pcm_str *capture_str = ++ &substream->pcm->streams[SNDRV_PCM_STREAM_CAPTURE]; ++ ++ if (capture_str->substream_opened) ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->loopback_work, ++ msecs_to_jiffies(rk3308->delay_loopback_handle_ms)); ++ } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { ++ /* ++ * Switch to dummy bist mode to kick the glitch during disable ++ * ADCs and keep zero input data ++ */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_BIST_SINE); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_BIST_SINE); ++ } ++ rk3308_codec_adc_ana_disable(rk3308, ADC_TYPE_LOOPBACK); ++ } ++ } ++ ++ return 0; ++} ++ ++static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, ++ struct snd_soc_dai *dai) ++{ ++ struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ rk3308_codec_close_playback(rk3308); ++ rk3308_codec_dac_mclk_disable(rk3308); ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); ++ } else { ++ rk3308_codec_close_capture(rk3308); ++ if (!has_en_always_grps(rk3308)) { ++ rk3308_codec_adc_mclk_disable(rk3308); ++ rk3308_codec_update_adcs_status(rk3308, PATH_IDLE); ++ if (rk3308->micbias_num && ++ rk3308->enable_micbias) ++ rk3308_codec_micbias_disable(rk3308); ++ } ++ ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ } ++} ++ ++static struct snd_soc_dai_ops rk3308_dai_ops = { ++ .hw_params = rk3308_hw_params, ++ .set_fmt = rk3308_set_dai_fmt, ++ .mute_stream = rk3308_mute_stream, ++ .trigger = rk3308_pcm_trigger, ++ .shutdown = rk3308_pcm_shutdown, ++}; ++ ++static struct snd_soc_dai_driver rk3308_dai[] = { ++ { ++ .name = "rk3308-hifi", ++ .id = RK3308_HIFI, ++ .playback = { ++ .stream_name = "HiFi Playback", ++ .channels_min = 2, ++ .channels_max = 2, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .capture = { ++ .stream_name = "HiFi Capture", ++ .channels_min = 1, ++ .channels_max = 8, ++ .rates = SNDRV_PCM_RATE_8000_192000, ++ .formats = (SNDRV_PCM_FMTBIT_S16_LE | ++ SNDRV_PCM_FMTBIT_S20_3LE | ++ SNDRV_PCM_FMTBIT_S24_LE | ++ SNDRV_PCM_FMTBIT_S32_LE), ++ }, ++ .ops = &rk3308_dai_ops, ++ }, ++}; ++ ++static int rk3308_suspend(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ if (rk3308->no_deep_low_power) ++ goto out; ++ ++ rk3308_codec_dlp_down(rk3308); ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); ++ clk_disable_unprepare(rk3308->pclk); ++ ++out: ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ return 0; ++} ++ ++static int rk3308_resume(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ int ret = 0; ++ ++ if (rk3308->no_deep_low_power) ++ goto out; ++ ++ ret = clk_prepare_enable(rk3308->pclk); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable acodec pclk: %d\n", ret); ++ goto out; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_rx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_rx: %d\n", ret); ++ goto out; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_tx); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to enable i2s mclk_tx: %d\n", ret); ++ goto out; ++ } ++ ++ rk3308_codec_dlp_up(rk3308); ++out: ++ rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ return ret; ++} ++ ++static int rk3308_codec_default_gains(struct rk3308_codec_priv *rk3308) ++{ ++ int grp; ++ ++ /* Prepare ADC gains */ ++ /* vendor step 12, set MIC PGA default gains */ ++ for (grp = 0; grp < ADC_LR_GROUP_MAX; grp++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON01(grp), ++ RK3308_ADC_CH1_MIC_GAIN_MSK | ++ RK3308_ADC_CH2_MIC_GAIN_MSK, ++ RK3308_ADC_CH1_MIC_GAIN_0DB | ++ RK3308_ADC_CH2_MIC_GAIN_0DB); ++ } ++ ++ /* vendor step 13, set ALC default gains */ ++ for (grp = 0; grp < ADC_LR_GROUP_MAX; grp++) { ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON03(grp), ++ RK3308_ADC_CH1_ALC_GAIN_MSK, ++ RK3308_ADC_CH1_ALC_GAIN_0DB); ++ regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON04(grp), ++ RK3308_ADC_CH2_ALC_GAIN_MSK, ++ RK3308_ADC_CH2_ALC_GAIN_0DB); ++ } ++ ++ /* Prepare DAC gains */ ++ /* Step 15, set HPMIX default gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON12, ++ RK3308_DAC_L_HPMIX_GAIN_MSK | ++ RK3308_DAC_R_HPMIX_GAIN_MSK, ++ RK3308_DAC_L_HPMIX_GAIN_NDB_6 | ++ RK3308_DAC_R_HPMIX_GAIN_NDB_6); ++ ++ /* Step 18, set HPOUT default gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON05, ++ RK3308_DAC_L_HPOUT_GAIN_MSK, ++ RK3308_DAC_L_HPOUT_GAIN_NDB_39); ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON06, ++ RK3308_DAC_R_HPOUT_GAIN_MSK, ++ RK3308_DAC_R_HPOUT_GAIN_NDB_39); ++ ++ /* Using the same gain to HPOUT LR channels */ ++ rk3308->hpout_l_dgain = RK3308_DAC_L_HPOUT_GAIN_NDB_39; ++ ++ /* Step 19, set LINEOUT default gains */ ++ regmap_update_bits(rk3308->regmap, RK3308_DAC_ANA_CON04, ++ RK3308_DAC_L_LINEOUT_GAIN_MSK | ++ RK3308_DAC_R_LINEOUT_GAIN_MSK, ++ RK3308_DAC_L_LINEOUT_GAIN_NDB_6 | ++ RK3308_DAC_R_LINEOUT_GAIN_NDB_6); ++ ++ return 0; ++} ++ ++static int rk3308_codec_setup_en_always_adcs(struct rk3308_codec_priv *rk3308, ++ struct device_node *np) ++{ ++ int num, ret; ++ ++ num = of_count_phandle_with_args(np, "rockchip,en-always-grps", NULL); ++ if (num < 0) { ++ if (num == -ENOENT) { ++ /* ++ * If there is note use 'rockchip,en-always-grps' ++ * property, return 0 is also right. ++ */ ++ ret = 0; ++ } else { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,adc-grps-route' num: %d\n", ++ num); ++ ret = num; ++ } ++ ++ rk3308->en_always_grps_num = 0; ++ return ret; ++ } ++ ++ rk3308->en_always_grps_num = num; ++ ++ ret = of_property_read_u32_array(np, "rockchip,en-always-grps", ++ rk3308->en_always_grps, num); ++ if (ret < 0) { ++ dev_err(rk3308->plat_dev, ++ "Failed to read 'rockchip,en-always-grps': %d\n", ++ ret); ++ return ret; ++ } ++ ++ /* Clear all of skip_grps flags. */ ++ for (num = 0; num < ADC_LR_GROUP_MAX; num++) ++ rk3308->skip_grps[num] = 0; ++ ++ /* The loopback grp should not be enabled always. */ ++ for (num = 0; num < rk3308->en_always_grps_num; num++) { ++ if (rk3308->en_always_grps[num] == rk3308->loopback_grp) { ++ dev_err(rk3308->plat_dev, ++ "loopback_grp: %d should not be enabled always!\n", ++ rk3308->loopback_grp); ++ ret = -EINVAL; ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308) ++{ ++ int ret; ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ ret = snd_soc_add_codec_controls(rk3308->codec, ++ mic_gains_b, ++ ARRAY_SIZE(mic_gains_b)); ++ if (ret) { ++ dev_err(rk3308->plat_dev, ++ "%s: add mic_gains_b failed: %d\n", ++ __func__, ret); ++ return ret; ++ } ++ } else { ++ ret = snd_soc_add_codec_controls(rk3308->codec, ++ mic_gains_a, ++ ARRAY_SIZE(mic_gains_a)); ++ if (ret) { ++ dev_err(rk3308->plat_dev, ++ "%s: add mic_gains_a failed: %d\n", ++ __func__, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int rk3308_codec_check_micbias(struct rk3308_codec_priv *rk3308, ++ struct device_node *np) ++{ ++ struct device *dev = (struct device *)rk3308->plat_dev; ++ int num = 0, ret; ++ ++ /* Check internal micbias */ ++ rk3308->micbias1 = ++ of_property_read_bool(np, "rockchip,micbias1"); ++ if (rk3308->micbias1) ++ num++; ++ ++ rk3308->micbias2 = ++ of_property_read_bool(np, "rockchip,micbias2"); ++ if (rk3308->micbias2) ++ num++; ++ ++ rk3308->micbias_volt = RK3308_ADC_MICBIAS_VOLT_0_85; /* by default */ ++ rk3308->micbias_num = num; ++ ++ /* Check external micbias */ ++ rk3308->ext_micbias = EXT_MICBIAS_NONE; ++ ++ rk3308->micbias_en_gpio = devm_gpiod_get_optional(dev, ++ "micbias-en", ++ GPIOD_IN); ++ if (!rk3308->micbias_en_gpio) { ++ dev_info(dev, "Don't need micbias-en gpio\n"); ++ } else if (IS_ERR(rk3308->micbias_en_gpio)) { ++ ret = PTR_ERR(rk3308->micbias_en_gpio); ++ dev_err(dev, "Unable to claim gpio micbias-en\n"); ++ return ret; ++ } else if (gpiod_get_value(rk3308->micbias_en_gpio)) { ++ rk3308->ext_micbias = EXT_MICBIAS_FUNC1; ++ } ++ ++ rk3308->vcc_micbias = devm_regulator_get_optional(dev, ++ "vmicbias"); ++ if (IS_ERR(rk3308->vcc_micbias)) { ++ if (PTR_ERR(rk3308->vcc_micbias) == -EPROBE_DEFER) ++ return -EPROBE_DEFER; ++ dev_info(dev, "no vmicbias regulator found\n"); ++ } else { ++ ret = regulator_enable(rk3308->vcc_micbias); ++ if (ret) { ++ dev_err(dev, "Can't enable vmicbias: %d\n", ret); ++ return ret; ++ } ++ rk3308->ext_micbias = EXT_MICBIAS_FUNC2; ++ } ++ ++ dev_info(dev, "Check ext_micbias: %d\n", rk3308->ext_micbias); ++ ++ return 0; ++} ++ ++static int rk3308_codec_dapm_controls_prepare(struct rk3308_codec_priv *rk3308) ++{ ++ int grp; ++ ++ for (grp = 0; grp < ADC_LR_GROUP_MAX; grp++) { ++ rk3308->hpf_cutoff[grp] = 0; ++ rk3308->agc_l[grp] = 0; ++ rk3308->agc_r[grp] = 0; ++ rk3308->agc_asr_l[grp] = AGC_ASR_96KHZ; ++ rk3308->agc_asr_r[grp] = AGC_ASR_96KHZ; ++ } ++ ++ rk3308_codec_dapm_mic_gains(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_codec_prepare(struct rk3308_codec_priv *rk3308) ++{ ++ /* Clear registers for ADC and DAC */ ++ rk3308_codec_close_playback(rk3308); ++ rk3308_codec_close_all_capture(rk3308); ++ rk3308_codec_default_gains(rk3308); ++ rk3308_codec_llp_down(rk3308); ++ rk3308_codec_dapm_controls_prepare(rk3308); ++ ++ return 0; ++} ++ ++static int rk3308_probe(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ int ext_micbias; ++ ++ rk3308->codec = codec; ++ rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); ++ ++ rk3308_codec_reset(codec); ++ rk3308_codec_power_on(rk3308); ++ ++ /* From vendor recommend, disable micbias at first. */ ++ ext_micbias = rk3308->ext_micbias; ++ rk3308->ext_micbias = EXT_MICBIAS_NONE; ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308->ext_micbias = ext_micbias; ++ ++ rk3308_codec_prepare(rk3308); ++ if (!rk3308->no_hp_det) ++ rk3308_codec_headset_detect_enable(rk3308); ++ ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ ++ return 0; ++} + +- /* 5. Wait until the voltage of VCM keeps stable at the AGND */ +- usleep_range(200, 300); /* estimated value */ ++static int rk3308_remove(struct snd_soc_codec *codec) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 0); ++ if (!rk3308->no_hp_det) ++ rk3308_codec_headset_detect_disable(rk3308); ++ rk3308_codec_micbias_disable(rk3308); ++ rk3308_codec_power_off(rk3308); + +- /* 6. Power off the analog power supply */ +- /* 7. Power off the digital power supply */ ++ rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); + +- /* Do something via hardware */ ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); + + return 0; + } + +-static int check_micbias(int micbias) ++static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { ++ .probe = rk3308_probe, ++ .remove = rk3308_remove, ++ .suspend = rk3308_suspend, ++ .resume = rk3308_resume, ++ .set_bias_level = rk3308_set_bias_level, ++ .controls = rk3308_codec_dapm_controls, ++ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++}; ++ ++static const struct reg_default rk3308_codec_reg_defaults[] = { ++ { RK3308_GLB_CON, 0x07 }, ++}; ++ ++static bool rk3308_codec_write_read_reg(struct device *dev, unsigned int reg) + { +- switch (micbias) { +- case RK3308_ADC_MICBIAS_VOLT_0_85: +- case RK3308_ADC_MICBIAS_VOLT_0_8: +- case RK3308_ADC_MICBIAS_VOLT_0_75: +- case RK3308_ADC_MICBIAS_VOLT_0_7: +- case RK3308_ADC_MICBIAS_VOLT_0_65: +- case RK3308_ADC_MICBIAS_VOLT_0_6: +- case RK3308_ADC_MICBIAS_VOLT_0_55: +- case RK3308_ADC_MICBIAS_VOLT_0_5: +- return 0; +- } ++ /* All registers can be read / write */ ++ return true; ++} + +- return -EINVAL; ++static bool rk3308_codec_volatile_reg(struct device *dev, unsigned int reg) ++{ ++ return true; + } + +-static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308, +- int micbias) ++static void rk3308_codec_hpdetect_work(struct work_struct *work) + { +- int ch = rk3308->adc_ch; +- int ret; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(work, struct rk3308_codec_priv, hpdet_work.work); ++ unsigned int val; ++ int need_poll = 0, need_irq = 0; ++ int need_report = 0, report_type = 0; ++ int dac_output = DAC_LINEOUT; ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ /* Check headphone plugged/unplugged directly. */ ++ regmap_read(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_STATUS, &val); ++ regmap_write(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_STATUS_CLR, val); ++ ++ if (rk3308->hp_jack_reversed) { ++ switch (val) { ++ case 0x0: ++ case 0x2: ++ dac_output = DAC_HPOUT; ++ report_type = SND_JACK_HEADPHONE; ++ break; ++ default: ++ break; ++ } ++ } else { ++ switch (val) { ++ case 0x1: ++ dac_output = DAC_HPOUT; ++ report_type = SND_JACK_HEADPHONE; ++ break; ++ default: ++ /* Includes val == 2 or others. */ ++ break; ++ } ++ } + +- if (ch != 1 && ch != 2) { +- dev_err(rk3308->plat_dev, +- "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", +- __func__, ch); +- return -EINVAL; +- } ++ rk3308_codec_dac_switch(rk3308, dac_output); ++ if (rk3308->hpdet_jack) ++ snd_soc_jack_report(rk3308->hpdet_jack, ++ report_type, ++ SND_JACK_HEADPHONE); + +- /* 1. Power up the ACODEC and keep the AVDDH stable */ ++ enable_irq(rk3308->irq); + +- /* 2. Configure ACODEC_ADC_ANA_CON7[2:0] to the certain value */ +- ret = check_micbias(micbias); +- if (ret < 0) { +- dev_err(rk3308->plat_dev, "This is an invalid micbias: %d\n", +- micbias); +- return ret; ++ return; + } + +- /* +- * Note: Only the reg (ADC_ANA_CON7+0x0)[2:0] represent the level range +- * control signal of MICBIAS voltage +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(0), +- RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK, +- micbias); ++ /* Check headphone unplugged via poll. */ ++ regmap_read(rk3308->regmap, RK3308_DAC_DIG_CON14, &val); + +- /* 3. Wait until the VCMH keep stable */ +- usleep_range(200, 300); /* estimated value */ ++ if (rk3308->hp_jack_reversed) { ++ if (!val) { ++ rk3308->hp_plugged = true; ++ report_type = SND_JACK_HEADPHONE; + +- /* 4. Configure ACODEC_ADC_ANA_CON8[4] to 0x1 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), +- RK3308_ADC_MICBIAS_CURRENT_MSK, +- RK3308_ADC_MICBIAS_CURRENT_EN); ++ need_report = 1; ++ need_irq = 1; ++ } else { ++ if (rk3308->hp_plugged) { ++ rk3308->hp_plugged = false; ++ need_report = 1; ++ } ++ need_poll = 1; ++ } ++ } else { ++ if (!val) { ++ rk3308->hp_plugged = false; + +- /* +- * 5. Configure the (ADC_ANA_CON7+0x40)[3] or (ADC_ANA_CON7+0x80)[3] +- * to 0x1. +- * (ADC_ANA_CON7+0x40)[3] used to control the MICBIAS1, and +- * (ADC_ANA_CON7+0x80)[3] used to control the MICBIAS2 +- */ ++ need_report = 1; ++ need_irq = 1; ++ } else { ++ if (!rk3308->hp_plugged) { ++ rk3308->hp_plugged = true; ++ report_type = SND_JACK_HEADPHONE; ++ need_report = 1; ++ } ++ need_poll = 1; ++ } ++ } + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_MIC_BIAS_BUF_EN, +- RK3308_ADC_MIC_BIAS_BUF_EN); ++ if (need_poll) ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->hpdet_work, ++ msecs_to_jiffies(HPDET_POLL_MS)); + +- return 0; +-} ++ if (need_report) { ++ if (report_type) ++ dac_output = DAC_HPOUT; + +-static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308) +-{ +- int ch = rk3308->adc_ch; ++ rk3308_codec_dac_switch(rk3308, dac_output); + +- if (ch != 1 && ch != 2) { +- dev_err(rk3308->plat_dev, +- "%s: currnet ch: %d, only ch1/2 control MICBIAS1/2\n", +- __func__, ch); +- return -EINVAL; ++ if (rk3308->hpdet_jack) ++ snd_soc_jack_report(rk3308->hpdet_jack, ++ report_type, ++ SND_JACK_HEADPHONE); + } + +- /* 1. Enable the MICBIAS and keep the Audio Codec stable */ +- /* Do nothing */ +- +- /* +- * 2. Configure the (ADC_ANA_CON7+0x40)[3] or +- * (ADC_ANA_CON7+0x80)[3] to 0x0 +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_MIC_BIAS_BUF_EN, +- RK3308_ADC_MIC_BIAS_BUF_DIS); +- +- /* 3. Configure ACODEC_ADC_ANA_CON8[4] to 0x0 */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON08(ch), +- RK3308_ADC_MICBIAS_CURRENT_MSK, +- RK3308_ADC_MICBIAS_CURRENT_DIS); ++ if (need_irq) ++ enable_irq(rk3308->irq); ++} + +- return 0; ++static void rk3308_codec_loopback_work(struct work_struct *work) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(work, struct rk3308_codec_priv, loopback_work.work); ++ int type = ADC_TYPE_LOOPBACK; ++ int idx, grp; ++ ++ /* Prepare loopback ADCs */ ++ rk3308_codec_adc_ana_enable(rk3308, type); ++ ++ /* Waiting ADCs are stable */ ++ msleep(ADC_STABLE_MS); ++ ++ /* Recover normal mode after enable ADCs */ ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) { ++ if (grp < 0 || grp > ADC_LR_GROUP_MAX - 1) ++ continue; ++ ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_L_CH_BIST_MSK, ++ RK3308_ADC_L_CH_NORMAL_LEFT); ++ regmap_update_bits(rk3308->regmap, ++ RK3308_ADC_DIG_CON03(grp), ++ RK3308_ADC_R_CH_BIST_MSK, ++ RK3308_ADC_R_CH_NORMAL_RIGHT); ++ } + } + +-static int rk3308_codec_alc_enable(struct rk3308_codec_priv *rk3308) ++static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data) + { +- int ch = rk3308->adc_ch; ++ struct rk3308_codec_priv *rk3308 = data; + + /* +- * 1. Set he max level and min level of the ALC need to control. +- * +- * These values are estimated ++ * For the high level irq trigger, disable irq and avoid a lot of ++ * repeated irq handlers entry. + */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), +- RK3308_AGC_LO_8BITS_AGC_MIN_MSK, +- 0x16); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON05(ch), +- RK3308_AGC_HI_8BITS_AGC_MIN_MSK, +- 0x40); +- +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), +- RK3308_AGC_LO_8BITS_AGC_MAX_MSK, +- 0x26); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON05(ch), +- RK3308_AGC_HI_8BITS_AGC_MAX_MSK, +- 0x40); ++ disable_irq_nosync(rk3308->irq); ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->hpdet_work, msecs_to_jiffies(10)); + +- /* +- * 2. Set ACODEC_ALC_DIG_CON4[2:0] according to the sample rate +- * +- * By default is 44.1KHz for sample. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON04(ch), +- RK3308_AGC_APPROX_RATE_MSK, +- RK3308_AGC_APPROX_RATE_44_1K); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON04(ch), +- RK3308_AGC_APPROX_RATE_MSK, +- RK3308_AGC_APPROX_RATE_44_1K); +- +- /* 3. Set ACODEC_ALC_DIG_CON9[6] to 0x1, to enable the ALC module */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_EN); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_EN); ++ return IRQ_HANDLED; ++} + +- /* +- * 4. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], +- * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] +- * to 0x3, to enable the ALC module to control the gain of PGA. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), +- RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, +- RK3308_ADC_ALCL_CON_GAIN_PGAL_EN | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_EN); ++void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++ struct snd_soc_jack *hpdet_jack); ++EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb); + +- /* +- * 5.Observe the current ALC output gain by reading +- * ACODEC_ALC_DIG_CON12[4:0] +- * +- * The default GAIN is 0x0c +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON12(ch), +- RK3308_AGC_GAIN_MSK, +- 0x0c); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON12(ch), +- RK3308_AGC_GAIN_MSK, +- 0x0c); ++static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec, ++ struct snd_soc_jack *hpdet_jack) ++{ ++ struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); + +- return 0; +-} ++ rk3308->hpdet_jack = hpdet_jack; + +-static int rk3308_codec_alc_disable(struct rk3308_codec_priv *rk3308) +-{ +- int ch = rk3308->adc_ch; ++ /* To detect jack once during startup */ ++ disable_irq_nosync(rk3308->irq); ++ queue_delayed_work(system_power_efficient_wq, ++ &rk3308->hpdet_work, msecs_to_jiffies(10)); + +- /* +- * 1. Set ACODEC_ALC_DIG_CON9[6] to 0x0, to disable the ALC module, +- * then the ALC output gain will keep to the last value +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_DIS); +- regmap_update_bits(rk3308->regmap, RK3308_ALC_R_DIG_CON09(ch), +- RK3308_AGC_FUNC_SEL_MSK, +- RK3308_AGC_FUNC_SEL_DIS); ++ dev_info(rk3308->plat_dev, "%s: Request detect hp jack once\n", ++ __func__); ++} + +- /* +- * 2. Set ACODEC_ADC_ANA_CON11[1:0], (ACODEC_ADC_ANA_CON11+0x40)[1:0], +- * (ACODEC_ADC_ANA_CON11+0x80)[1:0] and (ACODEC_ADC_ANA_CON11+0xc0)[1:0] +- * to 0x0, to disable the ALC module to control the gain of PGA. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON11(ch), +- RK3308_ADC_ALCL_CON_GAIN_PGAL_MSK | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK, +- RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS | +- RK3308_ADC_ALCR_CON_GAIN_PGAR_DIS); ++static const struct regmap_config rk3308_codec_regmap_config = { ++ .reg_bits = 32, ++ .reg_stride = 4, ++ .val_bits = 32, ++ .max_register = RK3308_DAC_ANA_CON15, ++ .writeable_reg = rk3308_codec_write_read_reg, ++ .readable_reg = rk3308_codec_write_read_reg, ++ .volatile_reg = rk3308_codec_volatile_reg, ++ .reg_defaults = rk3308_codec_reg_defaults, ++ .num_reg_defaults = ARRAY_SIZE(rk3308_codec_reg_defaults), ++ .cache_type = REGCACHE_FLAT, ++}; + +- return 0; ++static ssize_t pm_state_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ ++ return sprintf(buf, "pm_state: %d\n", rk3308->pm_state); + } + +-static int rk3308_codec_adc_ana_enable(struct rk3308_codec_priv *rk3308) ++static ssize_t pm_state_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- unsigned int adc_aif1 = 0, adc_aif2 = 0; +- unsigned int agc_func_en; +- int ch = rk3308->adc_ch; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long pm_state; ++ int ret = kstrtoul(buf, 10, &pm_state); + +- /* +- * 1. Set the ACODEC_ADC_ANA_CON7[7:6] and ACODEC_ADC_ANA_CON7[5:4], +- * to select the line-in or microphone as input of ADC +- * +- * Note1. Please ignore the step1 for enabling ADC3, ADC4, ADC5, +- * ADC6, ADC7, and ADC8 +- */ +- if (ch == 0) { +- if (rk3308->adc_ch0_using_linein) { +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH1_IN_SEL_MSK, +- RK3308_ADC_CH1_IN_LINEIN); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH2_IN_SEL_MSK, +- RK3308_ADC_CH2_IN_LINEIN); +- } else { +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH1_IN_SEL_MSK, +- RK3308_ADC_CH1_IN_MIC); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON07(ch), +- RK3308_ADC_CH2_IN_SEL_MSK, +- RK3308_ADC_CH2_IN_MIC); +- } ++ if (ret < 0) { ++ dev_err(dev, "Invalid pm_state: %ld, ret: %d\n", ++ pm_state, ret); ++ return -EINVAL; + } + +- /* +- * 2. Set ACODEC_ADC_ANA_CON0[7:0] to 0xff, to end the mute station +- * of ADC, to enable the MIC module, to enable the reference voltage +- * buffer, and to end the initialization of MIC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), +- RK3308_ADC_CH1_CH2_MIC_ALL_MSK, +- RK3308_ADC_CH1_CH2_MIC_ALL); ++ rk3308_codec_set_pm_state(rk3308, pm_state); + +- /* +- * 3. Set ACODEC_ADC_ANA_CON6[0] to 0x1, to enable the current source +- * of audio +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), +- RK3308_ADC_CURRENT_MSK, +- RK3308_ADC_CURRENT_EN); ++ dev_info(dev, "Store pm_state: %d\n", rk3308->pm_state); + +- /* +- * 4. Set ACODEC_ADC_ANA_CON2[7:0] to 0x77, to enable the ALC module, +- * to enable the zero-crossing detection function, and to end the +- * initialization of ALC +- * +- * Note2. Please set ACODEC_ADC_ANA_CON2[7:0] to 0x33 in step4 +- * if the AGC function is closed +- */ ++ return count; ++} + +- adc_aif1 = RK3308_ADC_CH1_ALC_EN | RK3308_ADC_CH1_ALC_WORK; +- regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); +- if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) +- adc_aif1 |= RK3308_ADC_CH1_ZEROCROSS_DET_EN; ++static ssize_t adc_grps_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ u32 grp; ++ int type = ADC_TYPE_NORMAL, count = 0; ++ int idx; ++ ++ count += sprintf(buf + count, "current used adc_grps:\n"); ++ count += sprintf(buf + count, "- normal:"); ++ for (idx = 0; adc_for_each_grp(rk3308, type, idx, &grp); idx++) ++ count += sprintf(buf + count, " %d", grp); ++ count += sprintf(buf + count, "\n"); ++ count += sprintf(buf + count, "- loopback: %d\n", ++ rk3308->loopback_grp); + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH1_ALC_ZC_MSK, +- adc_aif1); ++ return count; ++} + +- adc_aif2 = RK3308_ADC_CH2_ALC_EN | RK3308_ADC_CH2_ALC_WORK; +- regmap_read(rk3308->regmap, RK3308_ALC_L_DIG_CON09(ch), &agc_func_en); +- if (agc_func_en & RK3308_AGC_FUNC_SEL_EN) +- adc_aif2 |= RK3308_ADC_CH2_ZEROCROSS_DET_EN; ++static ssize_t adc_grps_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ char adc_type; ++ int grps, ret; ++ ++ ret = sscanf(buf, "%c,%d", &adc_type, &grps); ++ if (ret != 2) { ++ dev_err(rk3308->plat_dev, "%s sscanf failed: %d\n", ++ __func__, ret); ++ return -EFAULT; ++ } + +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH2_ALC_ZC_MSK, +- adc_aif2); ++ if (adc_type == 'n') ++ rk3308->used_adc_grps = grps; ++ else if (adc_type == 'l') ++ rk3308->loopback_grp = grps; + +- /* +- * 5. Set ACODEC_ADC_ANA_CON5[7:0] to 0x77, to enable the clock and +- * ADC module, and to end the initialization of ADC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH1_ADC_CLK_MSK, +- RK3308_ADC_CH1_CLK_EN | +- RK3308_ADC_CH1_ADC_EN | +- RK3308_ADC_CH1_ADC_WORK); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH2_ADC_CLK_MSK, +- RK3308_ADC_CH2_CLK_EN | +- RK3308_ADC_CH2_ADC_EN | +- RK3308_ADC_CH2_ADC_WORK); ++ return count; ++} + +- /* +- * 6. Set ACODEC_ADC_ANA_CON1[5:4] and ACODEC_ADC_ANA_CON1[1:0], +- * to select the gain of the MIC +- * +- * By default is 0db. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH1_MIC_GAIN_MSK, +- RK3308_ADC_CH1_MIC_GAIN_0DB); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH2_MIC_GAIN_MSK, +- RK3308_ADC_CH2_MIC_GAIN_0DB); ++static ssize_t adc_grps_route_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ char which_i2s[32] = {0}; ++ int count = 0; ++ u32 grp; + +- /* +- * 7.Set ACODEC_ADC_ANA_CON3[4:0] and ACODEC_ADC_ANA_CON4[3:0] to +- * select the gain of ALC +- * +- * By default is 0db. +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON03(ch), +- RK3308_ADC_CH1_ALC_GAIN_MSK, +- RK3308_ADC_CH1_ALC_GAIN_0DB); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON04(ch), +- RK3308_ADC_CH2_ALC_GAIN_MSK, +- RK3308_ADC_CH2_ALC_GAIN_0DB); ++ switch (rk3308->which_i2s) { ++ case ACODEC_TO_I2S1_2CH: ++ strcpy(which_i2s, "i2s1_2ch"); ++ break; ++ case ACODEC_TO_I2S3_4CH: ++ strcpy(which_i2s, "i2s3_4ch"); ++ break; ++ default: ++ strcpy(which_i2s, "i2s2_8ch"); ++ break; ++ } + +- /* 8.Begin recording */ ++ count += sprintf(buf + count, "%s from acodec route mapping:\n", ++ which_i2s); ++ for (grp = 0; grp < rk3308->to_i2s_grps; grp++) { ++ count += sprintf(buf + count, "* sdi_%d <-- sdo_%d\n", ++ grp, rk3308->i2s_sdis[grp]); ++ } + +- return 0; ++ return count; + } + +-static int rk3308_codec_adc_ana_disable(struct rk3308_codec_priv *rk3308) ++static ssize_t adc_grps_route_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- int ch = rk3308->adc_ch; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ int which_i2s, idx, i2s_sdis[ADC_LR_GROUP_MAX]; ++ int ret; + +- /* +- * 1. Set ACODEC_ADC_ANA_CON2[7:0] to 0x0, to disable the ALC module, +- * to disable the zero-crossing detection function, and to begin the +- * initialization of ALC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH1_ALC_ZC_MSK, +- 0); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON02(ch), +- RK3308_ADC_CH2_ALC_ZC_MSK, +- 0); ++ ret = sscanf(buf, "%d,%d,%d,%d,%d", &which_i2s, ++ &i2s_sdis[0], &i2s_sdis[1], &i2s_sdis[2], &i2s_sdis[3]); ++ if (ret != 5) { ++ dev_err(rk3308->plat_dev, "%s sscanf failed: %d\n", ++ __func__, ret); ++ goto err; ++ } + +- /* +- * 2. Set ACODEC_ADC_ANA_CON5[7:0] to 0x0, to disable the clock and +- * ADC module, and to begin the initialization of ADC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH1_ADC_CLK_MSK, +- 0); +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON05(ch), +- RK3308_ADC_CH2_ADC_CLK_MSK, +- 0); ++ if (which_i2s < ACODEC_TO_I2S2_8CH || ++ which_i2s > ACODEC_TO_I2S1_2CH) { ++ dev_err(rk3308->plat_dev, "Invalid i2s type: %d\n", which_i2s); ++ goto err; ++ } + +- /* +- * 3. Set ACODEC_ADC_ANA_CON0[7:0] to 0x88, to disable the MIC module, +- * to disable the reference voltage buffer, and to begin the +- * initialization of MIC +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON00(ch), +- RK3308_ADC_CH1_CH2_MIC_ALL_MSK, +- RK3308_ADC_CH1_MIC_UNMUTE | +- RK3308_ADC_CH2_MIC_UNMUTE); ++ rk3308->which_i2s = which_i2s; + +- /* +- * 4. Set ACODEC_ADC_ANA_CON6[0] to 0x0, to disable the current +- * source of audio +- */ +- regmap_update_bits(rk3308->regmap, RK3308_ADC_ANA_CON06(ch), +- RK3308_ADC_CURRENT_MSK, +- RK3308_ADC_CURRENT_DIS); ++ switch (rk3308->which_i2s) { ++ case ACODEC_TO_I2S1_2CH: ++ rk3308->to_i2s_grps = 1; ++ break; ++ case ACODEC_TO_I2S3_4CH: ++ rk3308->to_i2s_grps = 2; ++ break; ++ default: ++ rk3308->to_i2s_grps = 4; ++ break; ++ } + +- return 0; ++ for (idx = 0; idx < rk3308->to_i2s_grps; idx++) ++ rk3308->i2s_sdis[idx] = i2s_sdis[idx]; ++ ++ rk3308_codec_adc_grps_route_config(rk3308); ++ ++err: ++ return count; + } + +-static int rk3308_codec_open_capture(struct snd_soc_codec *codec) ++static ssize_t adc_grp0_in_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- +- rk3308_codec_alc_enable(rk3308); +- rk3308_codec_adc_ana_enable(rk3308); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); + +- return 0; ++ return sprintf(buf, "adc ch0 using: %s\n", ++ rk3308->adc_grp0_using_linein ? "line in" : "mic in"); + } + +-static int rk3308_codec_close_capture(struct snd_soc_codec *codec) ++static ssize_t adc_grp0_in_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long using_linein; ++ int ret = kstrtoul(buf, 10, &using_linein); ++ ++ if (ret < 0 || using_linein > 1) { ++ dev_err(dev, "Invalid input status: %ld, ret: %d\n", ++ using_linein, ret); ++ return -EINVAL; ++ } + +- rk3308_codec_alc_disable(rk3308); +- rk3308_codec_adc_ana_disable(rk3308); ++ rk3308->adc_grp0_using_linein = using_linein; + +- return 0; ++ dev_info(dev, "store using_linein: %d\n", ++ rk3308->adc_grp0_using_linein); ++ ++ return count; + } + +-static int rk3308_codec_open_playback(struct snd_soc_codec *codec) ++static ssize_t adc_zerocross_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); +- +- rk3308_codec_dac_enable(rk3308); +- rk3308_speaker_ctl(rk3308, 1); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); + +- return 0; ++ return sprintf(buf, "adc zerocross: %s\n", ++ rk3308->adc_zerocross ? "enabled" : "disabled"); + } + +-static int rk3308_codec_close_playback(struct snd_soc_codec *codec) ++static ssize_t adc_zerocross_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long zerocross; ++ int ret = kstrtoul(buf, 10, &zerocross); + +- rk3308_speaker_ctl(rk3308, 0); +- rk3308_codec_dac_disable(rk3308); ++ if (ret < 0 || zerocross > 1) { ++ dev_err(dev, "Invalid zerocross: %ld, ret: %d\n", ++ zerocross, ret); ++ return -EINVAL; ++ } + +- return 0; ++ rk3308->adc_zerocross = zerocross; ++ ++ dev_info(dev, "store adc zerocross: %d\n", rk3308->adc_zerocross); ++ ++ return count; + } + +-static int rk3308_pcm_startup(struct snd_pcm_substream *substream, +- struct snd_soc_dai *dai) ++static ssize_t adc_grps_endisable_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct snd_soc_codec *codec = dai->codec; +- int ret = 0; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ int count = 0, i; + +- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) +- ret = rk3308_codec_open_playback(codec); +- else +- ret = rk3308_codec_open_capture(codec); ++ count += sprintf(buf + count, "enabled adc grps:"); ++ for (i = 0; i < ADC_LR_GROUP_MAX; i++) ++ count += sprintf(buf + count, "%d ", ++ rk3308->adc_grps_endisable[i]); + +- return ret; ++ count += sprintf(buf + count, "\n"); ++ return count; + } + +-static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, +- struct snd_soc_dai *dai) ++static ssize_t adc_grps_endisable_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct snd_soc_codec *codec = dai->codec; ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ int grp, endisable, ret; + +- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) +- rk3308_codec_close_playback(codec); +- else +- rk3308_codec_close_capture(codec); +-} ++ ret = sscanf(buf, "%d,%d", &grp, &endisable); ++ if (ret != 2) { ++ dev_err(rk3308->plat_dev, "%s sscanf failed: %d\n", ++ __func__, ret); ++ return -EFAULT; ++ } + +-static struct snd_soc_dai_ops rk3308_dai_ops = { +- .hw_params = rk3308_hw_params, +- .set_fmt = rk3308_set_dai_fmt, +- .digital_mute = rk3308_digital_mute, +- .startup = rk3308_pcm_startup, +- .shutdown = rk3308_pcm_shutdown, +-}; ++ rk3308->cur_dbg_grp = grp; + +-static struct snd_soc_dai_driver rk3308_dai[] = { +- { +- .name = "rk3308-hifi", +- .id = RK3308_HIFI, +- .playback = { +- .stream_name = "HiFi Playback", +- .channels_min = 2, +- .channels_max = 2, +- .rates = SNDRV_PCM_RATE_8000_96000, +- .formats = (SNDRV_PCM_FMTBIT_S16_LE | +- SNDRV_PCM_FMTBIT_S20_3LE | +- SNDRV_PCM_FMTBIT_S24_LE | +- SNDRV_PCM_FMTBIT_S32_LE), +- }, +- .capture = { +- .stream_name = "HiFi Capture", +- .channels_min = 1, +- .channels_max = 8, +- .rates = SNDRV_PCM_RATE_8000_96000, +- .formats = (SNDRV_PCM_FMTBIT_S16_LE | +- SNDRV_PCM_FMTBIT_S20_3LE | +- SNDRV_PCM_FMTBIT_S24_LE | +- SNDRV_PCM_FMTBIT_S32_LE), +- }, +- .ops = &rk3308_dai_ops, +- }, +-}; ++ if (endisable) ++ rk3308_codec_open_dbg_capture(rk3308); ++ else ++ rk3308_codec_close_dbg_capture(rk3308); + +-static int rk3308_suspend(struct snd_soc_codec *codec) +-{ +- rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ dev_info(dev, "ADC grp %d endisable: %d\n", grp, endisable); + +- return 0; ++ return count; + } + +-static int rk3308_resume(struct snd_soc_codec *codec) ++static ssize_t dac_endisable_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); + +- return 0; ++ return sprintf(buf, "%d\n", rk3308->dac_endisable); + } + +-static int rk3308_probe(struct snd_soc_codec *codec) ++static ssize_t dac_endisable_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long endisable; ++ int ret = kstrtoul(buf, 10, &endisable); + +- rk3308_codec_reset(codec); +- rk3308_codec_power_on(codec); ++ if (ret < 0) { ++ dev_err(dev, "Invalid endisable: %ld, ret: %d\n", ++ endisable, ret); ++ return -EINVAL; ++ } ++ ++ if (endisable) ++ rk3308_codec_open_playback(rk3308); ++ else ++ rk3308_codec_close_playback(rk3308); + +- rk3308_codec_micbias_enable(rk3308, RK3308_ADC_MICBIAS_VOLT_0_7); ++ dev_info(dev, "DAC endisable: %ld\n", endisable); + +- return 0; ++ return count; + } + +-static int rk3308_remove(struct snd_soc_codec *codec) ++static ssize_t dac_output_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ ssize_t ret = 0; + +- rk3308_speaker_ctl(rk3308, 0); +- rk3308_codec_micbias_disable(rk3308); +- rk3308_codec_power_off(codec); ++ switch (rk3308->dac_output) { ++ case DAC_LINEOUT: ++ ret = sprintf(buf, "dac path: %s\n", "line out"); ++ break; ++ case DAC_HPOUT: ++ ret = sprintf(buf, "dac path: %s\n", "hp out"); ++ break; ++ case DAC_LINEOUT_HPOUT: ++ ret = sprintf(buf, "dac path: %s\n", ++ "both line out and hp out"); ++ break; ++ default: ++ pr_err("Invalid dac path: %d ?\n", rk3308->dac_output); ++ break; ++ } + +- return 0; ++ return ret; + } + +-static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { +- .probe = rk3308_probe, +- .remove = rk3308_remove, +- .suspend = rk3308_suspend, +- .resume = rk3308_resume, +- .set_bias_level = rk3308_set_bias_level, +- .controls = rk3308_codec_dapm_controls, +- .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), +-}; +- +-static const struct reg_default rk3308_codec_reg_defaults[] = { +- { RK3308_GLB_CON, 0x07 }, +-}; +- +-static bool rk3308_codec_write_read_reg(struct device *dev, unsigned int reg) ++static ssize_t dac_output_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { +- /* All registers can be read / write */ +- return true; +-} ++ struct rk3308_codec_priv *rk3308 = ++ container_of(dev, struct rk3308_codec_priv, dev); ++ unsigned long dac_output; ++ int ret = kstrtoul(buf, 10, &dac_output); + +-static bool rk3308_codec_volatile_reg(struct device *dev, unsigned int reg) +-{ +- switch (reg) { +- case RK3308_GLB_CON: +- return true; +- default: +- return false; ++ if (ret < 0) { ++ dev_err(dev, "Invalid input status: %ld, ret: %d\n", ++ dac_output, ret); ++ return -EINVAL; + } +-} + +-static const struct regmap_config rk3308_codec_regmap_config = { +- .reg_bits = 32, +- .reg_stride = 4, +- .val_bits = 32, +- .max_register = RK3308_DAC_ANA_CON13, +- .writeable_reg = rk3308_codec_write_read_reg, +- .readable_reg = rk3308_codec_write_read_reg, +- .volatile_reg = rk3308_codec_volatile_reg, +- .reg_defaults = rk3308_codec_reg_defaults, +- .num_reg_defaults = ARRAY_SIZE(rk3308_codec_reg_defaults), +- .cache_type = REGCACHE_FLAT, +-}; ++ rk3308_codec_dac_switch(rk3308, dac_output); + +-static ssize_t adc_ch_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++ dev_info(dev, "Store dac_output: %d\n", rk3308->dac_output); ++ ++ return count; ++} ++ ++static ssize_t enable_all_adcs_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) + { + struct rk3308_codec_priv *rk3308 = + container_of(dev, struct rk3308_codec_priv, dev); + +- return sprintf(buf, "adc_ch: %d\n", rk3308->adc_ch); ++ return sprintf(buf, "%d\n", rk3308->enable_all_adcs); + } + +-static ssize_t adc_ch_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t enable_all_adcs_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct rk3308_codec_priv *rk3308 = + container_of(dev, struct rk3308_codec_priv, dev); +- unsigned long ch; +- int ret = kstrtoul(buf, 10, &ch); ++ unsigned long enable; ++ int ret = kstrtoul(buf, 10, &enable); + +- if (ret < 0 || ch > 4) { +- dev_err(dev, "Invalid ch: %ld, ret: %d\n", ch, ret); ++ if (ret < 0) { ++ dev_err(dev, "Invalid enable value: %ld, ret: %d\n", ++ enable, ret); + return -EINVAL; + } + +- rk3308->adc_ch = ch; +- +- dev_info(dev, "Store ch: %d\n", rk3308->adc_ch); ++ rk3308->enable_all_adcs = enable; + + return count; + } + +-static const struct device_attribute adc_ch_attrs[] = { +- __ATTR(adc_ch, 0644, adc_ch_show, adc_ch_store), ++static const struct device_attribute acodec_attrs[] = { ++ __ATTR_RW(adc_grps), ++ __ATTR_RW(adc_grps_endisable), ++ __ATTR_RW(adc_grps_route), ++ __ATTR_RW(adc_grp0_in), ++ __ATTR_RW(adc_zerocross), ++ __ATTR_RW(dac_endisable), ++ __ATTR_RW(dac_output), ++ __ATTR_RW(enable_all_adcs), ++ __ATTR_RW(pm_state), + }; + + static void rk3308_codec_device_release(struct device *dev) +@@ -1468,8 +4747,8 @@ static int rk3308_codec_sysfs_init(struct platform_device *pdev, + return -ENOMEM; + } + +- for (i = 0; i < ARRAY_SIZE(adc_ch_attrs); i++) { +- if (device_create_file(dev, &adc_ch_attrs[i])) { ++ for (i = 0; i < ARRAY_SIZE(acodec_attrs); i++) { ++ if (device_create_file(dev, &acodec_attrs[i])) { + dev_err(&pdev->dev, + "Create 'rk3308-acodec-dev' attr failed\n"); + device_unregister(dev); +@@ -1480,32 +4759,136 @@ static int rk3308_codec_sysfs_init(struct platform_device *pdev, + return 0; + } + ++#if defined(CONFIG_DEBUG_FS) ++static int rk3308_codec_debugfs_reg_show(struct seq_file *s, void *v) ++{ ++ struct rk3308_codec_priv *rk3308 = s->private; ++ unsigned int i; ++ unsigned int val; ++ ++ for (i = RK3308_GLB_CON; i <= RK3308_DAC_ANA_CON13; i += 4) { ++ regmap_read(rk3308->regmap, i, &val); ++ if (!(i % 16)) ++ seq_printf(s, "\nR:%04x: ", i); ++ seq_printf(s, "%08x ", val); ++ } ++ ++ seq_puts(s, "\n"); ++ ++ return 0; ++} ++ ++static ssize_t rk3308_codec_debugfs_reg_operate(struct file *file, ++ const char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ struct rk3308_codec_priv *rk3308 = ++ ((struct seq_file *)file->private_data)->private; ++ unsigned int reg, val; ++ char op; ++ char kbuf[32]; ++ int ret; ++ ++ if (count >= sizeof(kbuf)) ++ return -EINVAL; ++ ++ if (copy_from_user(kbuf, buf, count)) ++ return -EFAULT; ++ kbuf[count] = '\0'; ++ ++ ret = sscanf(kbuf, "%c,%x,%x", &op, ®, &val); ++ if (ret != 3) { ++ pr_err("sscanf failed: %d\n", ret); ++ return -EFAULT; ++ } ++ ++ if (op == 'w') { ++ pr_info("Write reg: 0x%04x with val: 0x%08x\n", reg, val); ++ regmap_write(rk3308->regmap, reg, val); ++ regcache_cache_only(rk3308->regmap, false); ++ regcache_sync(rk3308->regmap); ++ pr_info("Read back reg: 0x%04x with val: 0x%08x\n", reg, val); ++ } else if (op == 'r') { ++ regmap_read(rk3308->regmap, reg, &val); ++ pr_info("Read reg: 0x%04x with val: 0x%08x\n", reg, val); ++ } else { ++ pr_err("This is an invalid operation: %c\n", op); ++ } ++ ++ return count; ++} ++ ++static int rk3308_codec_debugfs_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, ++ rk3308_codec_debugfs_reg_show, inode->i_private); ++} ++ ++static const struct file_operations rk3308_codec_reg_debugfs_fops = { ++ .owner = THIS_MODULE, ++ .open = rk3308_codec_debugfs_open, ++ .read = seq_read, ++ .write = rk3308_codec_debugfs_reg_operate, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++#endif /* CONFIG_DEBUG_FS */ ++ ++static int rk3308_codec_get_version(struct rk3308_codec_priv *rk3308) ++{ ++ unsigned int chip_id; ++ ++ regmap_read(rk3308->grf, GRF_CHIP_ID, &chip_id); ++ switch (chip_id) { ++ case 3306: ++ rk3308->codec_ver = ACODEC_VERSION_A; ++ break; ++ case 0x3308: ++ rk3308->codec_ver = ACODEC_VERSION_B; ++ break; ++ default: ++ pr_err("Unknown chip_id: %d / 0x%x\n", chip_id, chip_id); ++ return -EFAULT; ++ } ++ ++ pr_info("The acodec version is: %x\n", rk3308->codec_ver); ++ return 0; ++} ++ + static int rk3308_platform_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; + struct rk3308_codec_priv *rk3308; + struct resource *res; + void __iomem *base; +- int ret = 0; +- struct regmap *grf; +- +- grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); +- if (IS_ERR(grf)) { +- dev_err(&pdev->dev, +- "Missing 'rockchip,grf' property\n"); +- return PTR_ERR(grf); +- } ++ int ret; + + rk3308 = devm_kzalloc(&pdev->dev, sizeof(*rk3308), GFP_KERNEL); + if (!rk3308) + return -ENOMEM; + ++ rk3308->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); ++ if (IS_ERR(rk3308->grf)) { ++ dev_err(&pdev->dev, ++ "Missing 'rockchip,grf' property\n"); ++ return PTR_ERR(rk3308->grf); ++ } ++ + ret = rk3308_codec_sysfs_init(pdev, rk3308); + if (ret < 0) { + dev_err(&pdev->dev, "Sysfs init failed\n"); + return ret; + } + ++#if defined(CONFIG_DEBUG_FS) ++ rk3308->dbg_codec = debugfs_create_dir(CODEC_DRV_NAME, NULL); ++ if (IS_ERR(rk3308->dbg_codec)) ++ dev_err(&pdev->dev, ++ "Failed to create debugfs dir for rk3308!\n"); ++ else ++ debugfs_create_file("reg", 0644, rk3308->dbg_codec, ++ rk3308, &rk3308_codec_reg_debugfs_fops); ++#endif + rk3308->plat_dev = &pdev->dev; + + rk3308->reset = devm_reset_control_get(&pdev->dev, "acodec-reset"); +@@ -1518,27 +4901,146 @@ static int rk3308_platform_probe(struct platform_device *pdev) + rk3308->reset = NULL; + } + +- /* GPIO0_A5 control speaker on RK3308 EVB */ +- rk3308->spk_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "spk_ctl", +- GPIOD_OUT_HIGH); +- if (IS_ERR(rk3308->spk_ctl_gpio)) { ++ rk3308->hp_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "hp-ctl", ++ GPIOD_OUT_LOW); ++ if (!rk3308->hp_ctl_gpio) { ++ dev_info(&pdev->dev, "Don't need hp-ctl gpio\n"); ++ } else if (IS_ERR(rk3308->hp_ctl_gpio)) { ++ ret = PTR_ERR(rk3308->hp_ctl_gpio); ++ dev_err(&pdev->dev, "Unable to claim gpio hp-ctl\n"); ++ return ret; ++ } ++ ++ rk3308->spk_ctl_gpio = devm_gpiod_get_optional(&pdev->dev, "spk-ctl", ++ GPIOD_OUT_LOW); ++ ++ if (!rk3308->spk_ctl_gpio) { ++ dev_info(&pdev->dev, "Don't need spk-ctl gpio\n"); ++ } else if (IS_ERR(rk3308->spk_ctl_gpio)) { + ret = PTR_ERR(rk3308->spk_ctl_gpio); +- dev_err(&pdev->dev, "Unable to claim gpio spk_ctl\n"); ++ dev_err(&pdev->dev, "Unable to claim gpio spk-ctl\n"); ++ return ret; ++ } ++ ++ rk3308->pa_drv_gpio = devm_gpiod_get_optional(&pdev->dev, "pa-drv", ++ GPIOD_OUT_LOW); ++ ++ if (!rk3308->pa_drv_gpio) { ++ dev_info(&pdev->dev, "Don't need pa-drv gpio\n"); ++ } else if (IS_ERR(rk3308->pa_drv_gpio)) { ++ ret = PTR_ERR(rk3308->pa_drv_gpio); ++ dev_err(&pdev->dev, "Unable to claim gpio pa-drv\n"); + return ret; + } + ++ if (rk3308->pa_drv_gpio) { ++ rk3308->delay_pa_drv_ms = PA_DRV_MS; ++ ret = of_property_read_u32(np, "rockchip,delay-pa-drv-ms", ++ &rk3308->delay_pa_drv_ms); ++ } ++ ++#if DEBUG_POP_ALWAYS ++ dev_info(&pdev->dev, "Enable all ctl gpios always for debugging pop\n"); ++ rk3308_headphone_ctl(rk3308, 1); ++ rk3308_speaker_ctl(rk3308, 1); ++#else ++ dev_info(&pdev->dev, "De-pop as much as possible\n"); ++ rk3308_headphone_ctl(rk3308, 0); ++ rk3308_speaker_ctl(rk3308, 0); ++#endif ++ + rk3308->pclk = devm_clk_get(&pdev->dev, "acodec"); + if (IS_ERR(rk3308->pclk)) { + dev_err(&pdev->dev, "Can't get acodec pclk\n"); + return PTR_ERR(rk3308->pclk); + } + ++ rk3308->mclk_rx = devm_clk_get(&pdev->dev, "mclk_rx"); ++ if (IS_ERR(rk3308->mclk_rx)) { ++ dev_err(&pdev->dev, "Can't get acodec mclk_rx\n"); ++ return PTR_ERR(rk3308->mclk_rx); ++ } ++ ++ rk3308->mclk_tx = devm_clk_get(&pdev->dev, "mclk_tx"); ++ if (IS_ERR(rk3308->mclk_tx)) { ++ dev_err(&pdev->dev, "Can't get acodec mclk_tx\n"); ++ return PTR_ERR(rk3308->mclk_tx); ++ } ++ + ret = clk_prepare_enable(rk3308->pclk); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to enable acodec pclk: %d\n", ret); + return ret; + } + ++ ret = clk_prepare_enable(rk3308->mclk_rx); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to enable i2s mclk_rx: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(rk3308->mclk_tx); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to enable i2s mclk_tx: %d\n", ret); ++ return ret; ++ } ++ ++ rk3308_codec_check_micbias(rk3308, np); ++ ++ rk3308->enable_all_adcs = ++ of_property_read_bool(np, "rockchip,enable-all-adcs"); ++ ++ rk3308->hp_jack_reversed = ++ of_property_read_bool(np, "rockchip,hp-jack-reversed"); ++ ++ rk3308->no_deep_low_power = ++ of_property_read_bool(np, "rockchip,no-deep-low-power"); ++ ++ rk3308->no_hp_det = ++ of_property_read_bool(np, "rockchip,no-hp-det"); ++ ++ rk3308->delay_loopback_handle_ms = LOOPBACK_HANDLE_MS; ++ ret = of_property_read_u32(np, "rockchip,delay-loopback-handle-ms", ++ &rk3308->delay_loopback_handle_ms); ++ ++ rk3308->delay_start_play_ms = 0; ++ ret = of_property_read_u32(np, "rockchip,delay-start-play-ms", ++ &rk3308->delay_start_play_ms); ++ ++ rk3308->loopback_grp = NOT_USED; ++ ret = of_property_read_u32(np, "rockchip,loopback-grp", ++ &rk3308->loopback_grp); ++ /* ++ * If there is no loopback on some board, the -EINVAL indicates that ++ * we don't need add the node, and it is not an error. ++ */ ++ if (ret < 0 && ret != -EINVAL) { ++ dev_err(&pdev->dev, "Failed to read loopback property: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_adc_grps_route(rk3308, np); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to route ADC groups: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_setup_en_always_adcs(rk3308, np); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to setup enabled always ADCs: %d\n", ++ ret); ++ return ret; ++ } ++ ++ ret = rk3308_codec_get_version(rk3308); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to get acodec version: %d\n", ++ ret); ++ return ret; ++ } ++ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) { +@@ -1555,10 +5057,65 @@ static int rk3308_platform_probe(struct platform_device *pdev) + goto failed; + } + ++ if (!rk3308->no_hp_det) { ++ int index = 0; ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) ++ index = 1; ++ ++ rk3308->irq = platform_get_irq(pdev, index); ++ if (rk3308->irq < 0) { ++ dev_err(&pdev->dev, "Can not get codec irq\n"); ++ goto failed; ++ } ++ ++ INIT_DELAYED_WORK(&rk3308->hpdet_work, rk3308_codec_hpdetect_work); ++ ++ ret = devm_request_irq(&pdev->dev, rk3308->irq, ++ rk3308_codec_hpdet_isr, ++ 0, ++ "acodec-hpdet", ++ rk3308); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Failed to request IRQ: %d\n", ret); ++ goto failed; ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_B) { ++ rk3308->detect_grf = ++ syscon_regmap_lookup_by_phandle(np, "rockchip,detect-grf"); ++ if (IS_ERR(rk3308->detect_grf)) { ++ dev_err(&pdev->dev, ++ "Missing 'rockchip,detect-grf' property\n"); ++ return PTR_ERR(rk3308->detect_grf); ++ } ++ ++ /* Configure filter count and enable hpdet irq. */ ++ regmap_write(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_COUNTER, ++ DEFAULT_HPDET_COUNT); ++ regmap_write(rk3308->detect_grf, ++ DETECT_GRF_ACODEC_HPDET_CON, ++ (HPDET_BOTH_NEG_POS << 16) | ++ HPDET_BOTH_NEG_POS); ++ } ++ ++ rk3308_codec_set_jack_detect_cb = rk3308_codec_set_jack_detect; ++ } ++ ++ if (rk3308->codec_ver == ACODEC_VERSION_A) ++ INIT_DELAYED_WORK(&rk3308->loopback_work, ++ rk3308_codec_loopback_work); ++ ++ rk3308->adc_grp0_using_linein = ADC_GRP0_MICIN; ++ rk3308->dac_output = DAC_LINEOUT; ++ rk3308->adc_zerocross = 1; ++ rk3308->pm_state = PM_NORMAL; ++ + platform_set_drvdata(pdev, rk3308); + + ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308, +- rk3308_dai, ARRAY_SIZE(rk3308_dai)); ++ rk3308_dai, ARRAY_SIZE(rk3308_dai)); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); + goto failed; +@@ -1567,7 +5124,10 @@ static int rk3308_platform_probe(struct platform_device *pdev) + return ret; + + failed: ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); + clk_disable_unprepare(rk3308->pclk); ++ device_unregister(&rk3308->dev); + + return ret; + } +@@ -1577,8 +5137,11 @@ static int rk3308_platform_remove(struct platform_device *pdev) + struct rk3308_codec_priv *rk3308 = + (struct rk3308_codec_priv *)platform_get_drvdata(pdev); + ++ clk_disable_unprepare(rk3308->mclk_rx); ++ clk_disable_unprepare(rk3308->mclk_tx); + clk_disable_unprepare(rk3308->pclk); + snd_soc_unregister_codec(&pdev->dev); ++ device_unregister(&rk3308->dev); + + return 0; + } +@@ -1591,7 +5154,7 @@ MODULE_DEVICE_TABLE(of, rk3308codec_of_match); + + static struct platform_driver rk3308_codec_driver = { + .driver = { +- .name = "rk3308-acodec", ++ .name = CODEC_DRV_NAME, + .of_match_table = of_match_ptr(rk3308codec_of_match), + }, + .probe = rk3308_platform_probe, +diff --git a/sound/soc/codecs/rk3308_codec.h b/sound/soc/codecs/rk3308_codec.h +index 6cfa69157785..93e089dae081 100644 +--- a/sound/soc/codecs/rk3308_codec.h ++++ b/sound/soc/codecs/rk3308_codec.h +@@ -26,7 +26,8 @@ + #define ACODEC_ADC_I2S_CTL0 0x04 /* REG 0x01 */ + #define ACODEC_ADC_I2S_CTL1 0x08 /* REG 0x02 */ + #define ACODEC_ADC_BIST_MODE_SEL 0x0c /* REG 0x03 */ +-/* Resevred REG 0x04 ~ 0x06 */ ++#define ACODEC_ADC_HPF_PATH 0x10 /* REG 0x04 */ ++/* Resevred REG 0x05 ~ 0x06 */ + #define ACODEC_ADC_DATA_PATH 0x1c /* REG 0x07 */ + /* Resevred REG 0x08 ~ 0x0f */ + +@@ -62,12 +63,15 @@ + #define ACODEC_DAC_I2S_CTL0 0x04 /* REG 0x01 */ + #define ACODEC_DAC_I2S_CTL1 0x08 /* REG 0x02 */ + #define ACODEC_DAC_BIST_MODE_SEL 0x0c /* REG 0x03 */ +-/* Resevred REG 0x04 */ ++#define ACODEC_DAC_DIGITAL_GAIN 0x10 /* REG 0x04 */ + #define ACODEC_DAC_DATA_SEL 0x14 /* REG 0x05 */ + /* Resevred REG 0x06 ~ 0x09 */ + #define ACODEC_DAC_DATA_HI 0x28 /* REG 0x0a */ + #define ACODEC_DAC_DATA_LO 0x2c /* REG 0x0b */ +-/* Resevred REG 0x0c ~ 0x0f */ ++/* Resevred REG 0x0c */ ++#define ACODEC_DAC_HPDET_DELAYTIME 0x34 /* REG 0x0d */ ++#define ACODEC_DAC_HPDET_STATUS 0x38 /* REG 0x0e, Read-only */ ++/* Resevred REG 0x0f */ + + /* ADC ANALOG REGISTERS */ + #define ACODEC_ADC_ANA_MIC_CTL 0x00 /* REG 0x00 */ +@@ -92,10 +96,13 @@ + #define ACODEC_DAC_ANA_LINEOUT 0x10 /* REG 0x04 */ + #define ACODEC_DAC_ANA_L_HPOUT_GAIN 0x14 /* REG 0x05 */ + #define ACODEC_DAC_ANA_R_HPOUT_GAIN 0x18 /* REG 0x06 */ ++#define ACODEC_DAC_ANA_DRV_HPOUT 0x1c /* REG 0x07 */ ++#define ACODEC_DAC_ANA_DRV_LINEOUT 0x20 /* REG 0x08 */ + /* Resevred REG 0x07 ~ 0x0b */ + #define ACODEC_DAC_ANA_HPMIX_CTL0 0x30 /* REG 0x0c */ + #define ACODEC_DAC_ANA_HPMIX_CTL1 0x34 /* REG 0x0d */ +-/* Resevred REG 0x0e ~ 0x0f */ ++#define ACODEC_DAC_ANA_LINEOUT_CTL0 0x38 /* REG 0x0e */ ++#define ACODEC_DAC_ANA_LINEOUT_CTL1 0x3c /* REG 0x0f */ + + /* + * These registers are referenced by codec driver +@@ -106,7 +113,7 @@ + /* ADC DIGITAL REGISTERS */ + + /* +- * The ADC chanel are 0 ~ 3, that control: ++ * The ADC group are 0 ~ 3, that control: + * + * CH0: left_0(ADC1) and right_0(ADC2) + * CH1: left_1(ADC3) and right_1(ADC4) +@@ -118,6 +125,7 @@ + #define RK3308_ADC_DIG_CON01(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL0) + #define RK3308_ADC_DIG_CON02(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_I2S_CTL1) + #define RK3308_ADC_DIG_CON03(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_BIST_MODE_SEL) ++#define RK3308_ADC_DIG_CON04(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_HPF_PATH) + #define RK3308_ADC_DIG_CON07(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_DATA_PATH) + + #define RK3308_ALC_L_DIG_CON00(ch) (RK3308_ADC_DIG_OFFSET(ch) + ACODEC_ADC_PGA_AGC_L_CTL0) +@@ -150,13 +158,16 @@ + #define RK3308_DAC_DIG_CON01 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL0) + #define RK3308_DAC_DIG_CON02 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_I2S_CTL1) + #define RK3308_DAC_DIG_CON03 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_BIST_MODE_SEL) ++#define RK3308_DAC_DIG_CON04 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DIGITAL_GAIN) + #define RK3308_DAC_DIG_CON05 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_SEL) + #define RK3308_DAC_DIG_CON10 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_HI) + #define RK3308_DAC_DIG_CON11 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_DATA_LO) ++#define RK3308_DAC_DIG_CON13 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_HPDET_DELAYTIME) ++#define RK3308_DAC_DIG_CON14 (RK3308_DAC_DIG_OFFSET + ACODEC_DAC_HPDET_STATUS) + + /* ADC ANALOG REGISTERS */ + /* +- * The ADC chanel are 0 ~ 3, that control: ++ * The ADC group are 0 ~ 3, that control: + * + * CH0: left_0(ADC1) and right_0(ADC2) + * CH1: left_1(ADC3) and right_1(ADC4) +@@ -179,7 +190,6 @@ + + /* DAC ANALOG REGISTERS */ + #define RK3308_DAC_ANA_OFFSET 0x440 +- + #define RK3308_DAC_ANA_CON00 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL0) + #define RK3308_DAC_ANA_CON01 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_POP_VOLT) + #define RK3308_DAC_ANA_CON02 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_CTL1) +@@ -187,8 +197,12 @@ + #define RK3308_DAC_ANA_CON04 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT) + #define RK3308_DAC_ANA_CON05 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_L_HPOUT_GAIN) + #define RK3308_DAC_ANA_CON06 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_R_HPOUT_GAIN) ++#define RK3308_DAC_ANA_CON07 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_DRV_HPOUT) ++#define RK3308_DAC_ANA_CON08 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_DRV_LINEOUT) + #define RK3308_DAC_ANA_CON12 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL0) + #define RK3308_DAC_ANA_CON13 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_HPMIX_CTL1) ++#define RK3308_DAC_ANA_CON14 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT_CTL0) ++#define RK3308_DAC_ANA_CON15 (RK3308_DAC_ANA_OFFSET + ACODEC_DAC_ANA_LINEOUT_CTL1) + + /* + * These are the bits for registers +@@ -199,6 +213,12 @@ + #define RK3308_ADC_BIST_RESET (0 << 7) + #define RK3308_DAC_BIST_WORK (1 << 6) + #define RK3308_DAC_BIST_RESET (0 << 6) ++#define RK3308_ADC_MCLK_MSK (1 << 5) ++#define RK3308_ADC_MCLK_DIS (1 << 5) ++#define RK3308_ADC_MCLK_EN (0 << 5) ++#define RK3308_DAC_MCLK_MSK (1 << 4) ++#define RK3308_DAC_MCLK_DIS (1 << 4) ++#define RK3308_DAC_MCLK_EN (0 << 4) + #define RK3308_CODEC_RST_MSK (0x7 << 0) + #define RK3308_ADC_DIG_WORK (1 << 2) + #define RK3308_ADC_DIG_RESET (0 << 2) +@@ -253,16 +273,27 @@ + /* RK3308_ADC_DIG_CON03 - REG: 0x000c */ + #define RK3308_ADC_L_CH_BIST_SFT 2 + #define RK3308_ADC_L_CH_BIST_MSK (0x3 << RK3308_ADC_L_CH_BIST_SFT) +-#define RK3308_ADC_L_CH_BIST_LEFT (0x3 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ +-#define RK3308_ADC_L_CH_BIST_SINE (0x2 << RK3308_ADC_L_CH_BIST_SFT) +-#define RK3308_ADC_L_CH_BIST_CUBE (0x1 << RK3308_ADC_L_CH_BIST_SFT) +-#define RK3308_ADC_L_CH_BIST_RIGHT (0x0 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_L_CH_NORMAL_RIGHT (0x3 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_L_CH_BIST_CUBE (0x2 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_BIST_SINE (0x1 << RK3308_ADC_L_CH_BIST_SFT) ++#define RK3308_ADC_L_CH_NORMAL_LEFT (0x0 << RK3308_ADC_L_CH_BIST_SFT) /* normal mode */ + #define RK3308_ADC_R_CH_BIST_SFT 0 + #define RK3308_ADC_R_CH_BIST_MSK (0x3 << RK3308_ADC_R_CH_BIST_SFT) +-#define RK3308_ADC_R_CH_BIST_LEFT (0x3 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ +-#define RK3308_ADC_R_CH_BIST_SINE (0x2 << RK3308_ADC_R_CH_BIST_SFT) +-#define RK3308_ADC_R_CH_BIST_CUBE (0x1 << RK3308_ADC_R_CH_BIST_SFT) +-#define RK3308_ADC_R_CH_BIST_RIGHT (0x0 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_NORMAL_LEFT (0x3 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++#define RK3308_ADC_R_CH_BIST_CUBE (0x2 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_BIST_SINE (0x1 << RK3308_ADC_R_CH_BIST_SFT) ++#define RK3308_ADC_R_CH_NORMAL_RIGHT (0x0 << RK3308_ADC_R_CH_BIST_SFT) /* normal mode */ ++ ++/* RK3308_ADC_DIG_CON04 - REG: 0x0010 */ ++#define RK3308_ADC_HPF_PATH_SFT 2 ++#define RK3308_ADC_HPF_PATH_MSK (1 << RK3308_ADC_HPF_PATH_SFT) ++#define RK3308_ADC_HPF_PATH_DIS (1 << RK3308_ADC_HPF_PATH_SFT) ++#define RK3308_ADC_HPF_PATH_EN (0 << RK3308_ADC_HPF_PATH_SFT) ++#define RK3308_ADC_HPF_CUTOFF_SFT 0 ++#define RK3308_ADC_HPF_CUTOFF_MSK (0x3 << RK3308_ADC_HPF_CUTOFF_SFT) ++#define RK3308_ADC_HPF_CUTOFF_612HZ (0x2 << RK3308_ADC_HPF_CUTOFF_SFT) ++#define RK3308_ADC_HPF_CUTOFF_245HZ (0x1 << RK3308_ADC_HPF_CUTOFF_SFT) ++#define RK3308_ADC_HPF_CUTOFF_20HZ (0x0 << RK3308_ADC_HPF_CUTOFF_SFT) + + /* RK3308_ADC_DIG_CON07 - REG: 0x001c */ + #define RK3308_ADCL_DATA_SFT 4 +@@ -391,6 +422,8 @@ + */ + #define RK3308_AGC_PGA_ZERO_CRO_EN (0x1 << 5) + #define RK3308_AGC_PGA_ZERO_CRO_DIS (0x0 << 5) ++#define RK3308_AGC_PGA_GAIN_MAX 0x1f ++#define RK3308_AGC_PGA_GAIN_MIN 0 + #define RK3308_AGC_PGA_GAIN_SFT 0 + #define RK3308_AGC_PGA_GAIN_MSK (0x1f << RK3308_AGC_PGA_GAIN_SFT) + #define RK3308_AGC_PGA_GAIN_PDB_28_5 (0x1f << RK3308_AGC_PGA_GAIN_SFT) +@@ -474,6 +507,8 @@ + #define RK3308_AGC_FUNC_SEL_MSK (0x1 << 6) + #define RK3308_AGC_FUNC_SEL_EN (0x1 << 6) + #define RK3308_AGC_FUNC_SEL_DIS (0x0 << 6) ++#define RK3308_AGC_MAX_GAIN_PGA_MAX 0x7 ++#define RK3308_AGC_MAX_GAIN_PGA_MIN 0 + #define RK3308_AGC_MAX_GAIN_PGA_SFT 3 + #define RK3308_AGC_MAX_GAIN_PGA_MSK (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) + #define RK3308_AGC_MAX_GAIN_PGA_PDB_28_5 (0x7 << RK3308_AGC_MAX_GAIN_PGA_SFT) +@@ -484,6 +519,8 @@ + #define RK3308_AGC_MAX_GAIN_PGA_NDB_1_5 (0x2 << RK3308_AGC_MAX_GAIN_PGA_SFT) + #define RK3308_AGC_MAX_GAIN_PGA_NDB_7_5 (0x1 << RK3308_AGC_MAX_GAIN_PGA_SFT) + #define RK3308_AGC_MAX_GAIN_PGA_NDB_13_5 (0x0 << RK3308_AGC_MAX_GAIN_PGA_SFT) ++#define RK3308_AGC_MIN_GAIN_PGA_MAX 0x7 ++#define RK3308_AGC_MIN_GAIN_PGA_MIN 0 + #define RK3308_AGC_MIN_GAIN_PGA_SFT 0 + #define RK3308_AGC_MIN_GAIN_PGA_MSK (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) + #define RK3308_AGC_MIN_GAIN_PGA_PDB_24 (0x7 << RK3308_AGC_MIN_GAIN_PGA_SFT) +@@ -555,6 +592,18 @@ + #define RK3308_DAC_R_CH_BIST_SINE (0x1 << RK3308_DAC_R_CH_BIST_SFT) + #define RK3308_DAC_R_CH_BIST_RIGHT (0x0 << RK3308_DAC_R_CH_BIST_SFT) /* normal mode */ + ++/* RK3308_DAC_DIG_CON04 - REG: 0x0310 */ ++#define RK3308_DAC_MODULATOR_GAIN_SFT 4 ++#define RK3308_DAC_MODULATOR_GAIN_MSK (0x7 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_4_8DB (0x5 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_4_2DB (0x4 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_3_5DB (0x3 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_2_8DB (0x2 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_2DB (0x1 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_MODULATOR_GAIN_0DB (0x0 << RK3308_DAC_MODULATOR_GAIN_SFT) ++#define RK3308_DAC_CIC_IF_GAIN_SFT 0 ++#define RK3308_DAC_CIC_IF_GAIN_MSK (0x7 << RK3308_DAC_CIC_IF_GAIN_SFT) ++ + /* RK3308_DAC_DIG_CON05 - REG: 0x0314 */ + #define RK3308_DAC_L_REG_CTL_INDATA (0x1 << 2) + #define RK3308_DAC_L_NORMAL_DATA (0x0 << 2) +@@ -587,18 +636,30 @@ + #define RK3308_ADC_CH1_BUF_REF_EN (0x1 << 0) + #define RK3308_ADC_CH1_BUF_REF_DIS (0x0 << 0) + +-/* RK3308_ADC_ANA_CON01 - REG: 0x0344 */ ++/* RK3308_ADC_ANA_CON01 - REG: 0x0344 ++ * ++ * The PGA of MIC-INs: ++ * 0x0 - MIC1~MIC8 0dB ++ * 0x1 - MIC1~MIC8 6.6dB ++ * 0x2 - MIC1~MIC8 13dB ++ * 0x3 - MIC1~MIC8 20dB ++ */ ++#define RK3308_ADC_CH2_MIC_GAIN_MAX 0x3 ++#define RK3308_ADC_CH2_MIC_GAIN_MIN 0 + #define RK3308_ADC_CH2_MIC_GAIN_SFT 4 + #define RK3308_ADC_CH2_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) +-#define RK3308_ADC_CH2_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) +-#define RK3308_ADC_CH2_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH2_MIC_GAIN_SFT) +-#define RK3308_ADC_CH2_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_20DB (0x3 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++#define RK3308_ADC_CH2_MIC_GAIN_13DB (0x2 << RK3308_ADC_CH2_MIC_GAIN_SFT) /* TRM: only used for version B */ ++#define RK3308_ADC_CH2_MIC_GAIN_6_6DB (0x1 << RK3308_ADC_CH2_MIC_GAIN_SFT) /* TRM: only used for version B */ + #define RK3308_ADC_CH2_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH2_MIC_GAIN_SFT) ++ ++#define RK3308_ADC_CH1_MIC_GAIN_MAX 0x3 ++#define RK3308_ADC_CH1_MIC_GAIN_MIN 0 + #define RK3308_ADC_CH1_MIC_GAIN_SFT 0 + #define RK3308_ADC_CH1_MIC_GAIN_MSK (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) +-#define RK3308_ADC_CH1_MIC_GAIN_30DB (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) +-#define RK3308_ADC_CH1_MIC_GAIN_20DB (0x2 << RK3308_ADC_CH1_MIC_GAIN_SFT) +-#define RK3308_ADC_CH1_MIC_GAIN_6DB (0x1 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_20DB (0x3 << RK3308_ADC_CH1_MIC_GAIN_SFT) ++#define RK3308_ADC_CH1_MIC_GAIN_13DB (0x2 << RK3308_ADC_CH1_MIC_GAIN_SFT) /* TRM: only used for version B */ ++#define RK3308_ADC_CH1_MIC_GAIN_6_6DB (0x1 << RK3308_ADC_CH1_MIC_GAIN_SFT) /* TRM: only used for version B */ + #define RK3308_ADC_CH1_MIC_GAIN_0DB (0x0 << RK3308_ADC_CH1_MIC_GAIN_SFT) + + /* RK3308_ADC_ANA_CON02 - REG: 0x0348 */ +@@ -619,6 +680,8 @@ + #define RK3308_ADC_CH1_ALC_DIS (0x0 << 0) + + /* RK3308_ADC_ANA_CON03 - REG: 0x034c */ ++#define RK3308_ADC_CH1_ALC_GAIN_MAX 0x1f ++#define RK3308_ADC_CH1_ALC_GAIN_MIN 0 + #define RK3308_ADC_CH1_ALC_GAIN_SFT 0 + #define RK3308_ADC_CH1_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) + #define RK3308_ADC_CH1_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH1_ALC_GAIN_SFT) +@@ -655,6 +718,8 @@ + #define RK3308_ADC_CH1_ALC_GAIN_NDB_18 (0x00 << RK3308_ADC_CH1_ALC_GAIN_SFT) + + /* RK3308_ADC_ANA_CON04 - REG: 0x0350 */ ++#define RK3308_ADC_CH2_ALC_GAIN_MAX 0x1f ++#define RK3308_ADC_CH2_ALC_GAIN_MIN 0 + #define RK3308_ADC_CH2_ALC_GAIN_SFT 0 + #define RK3308_ADC_CH2_ALC_GAIN_MSK (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) + #define RK3308_ADC_CH2_ALC_GAIN_PDB_28_5 (0x1f << RK3308_ADC_CH2_ALC_GAIN_SFT) +@@ -728,10 +793,16 @@ + #define RK3308_ADC_CH1_IN_MIC (0x1 << RK3308_ADC_CH1_IN_SEL_SFT) + #define RK3308_ADC_CH1_IN_NONE (0x0 << RK3308_ADC_CH1_IN_SEL_SFT) + +-#define RK3308_ADC_MIC_BIAS_BUF_EN (0x1 << 3) +-#define RK3308_ADC_MIC_BIAS_BUF_DIS (0x0 << 3) ++#define RK3308_ADC_MIC_BIAS_BUF_SFT 3 ++#define RK3308_ADC_MIC_BIAS_BUF_EN (0x1 << RK3308_ADC_MIC_BIAS_BUF_SFT) ++#define RK3308_ADC_MIC_BIAS_BUF_DIS (0x0 << RK3308_ADC_MIC_BIAS_BUF_SFT) + #define RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT 0 + #define RK3308_ADC_LEVEL_RANGE_MICBIAS_MSK (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) ++/* ++ * The follow MICBIAS_VOLTs are based on the external reference voltage(Vref). ++ * For example, the Vref == 3.3V, the MICBIAS_VOLT_0_85 is equal: ++ * 3.3V * 0.85 = 2.805V. ++ */ + #define RK3308_ADC_MICBIAS_VOLT_0_85 (0x7 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) + #define RK3308_ADC_MICBIAS_VOLT_0_8 (0x6 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) + #define RK3308_ADC_MICBIAS_VOLT_0_75 (0x5 << RK3308_ADC_LEVEL_RANGE_MICBIAS_SFT) +@@ -751,18 +822,11 @@ + #define RK3308_ADC_REF_DIS (0x0 << 7) + #define RK3308_ADC_CURRENT_CHARGE_SFT 0 + #define RK3308_ADC_CURRENT_CHARGE_MSK (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) +-#define RK3308_ADC_DONT_SEL_ALL (0x7f << RK3308_ADC_CURRENT_CHARGE_SFT) + /* +- * 0: Choose the current I +- * 1: Don't choose the current I ++ * 1: Choose the current I ++ * 0: Don't choose the current I + */ +-#define RK3308_ADC_SEL_I_1(x) ((x & 0x1) << 6) +-#define RK3308_ADC_SEL_I_2(x) ((x & 0x1) << 5) +-#define RK3308_ADC_SEL_I_4(x) ((x & 0x1) << 4) +-#define RK3308_ADC_SEL_I_8(x) ((x & 0x1) << 3) +-#define RK3308_ADC_SEL_I_16(x) ((x & 0x1) << 2) +-#define RK3308_ADC_SEL_I_32(x) ((x & 0x1) << 1) +-#define RK3308_ADC_SEL_I_64(x) ((x & 0x1) << 0) ++#define RK3308_ADC_SEL_I(x) (x & 0x7f) + + /* RK3308_ADC_ANA_CON11 - REG: 0x036c */ + #define RK3308_ADC_ALCR_CON_GAIN_PGAR_MSK (0x1 << 1) +@@ -773,6 +837,7 @@ + #define RK3308_ADC_ALCL_CON_GAIN_PGAL_DIS (0x0 << 0) + + /* RK3308_DAC_ANA_CON00 - REG: 0x0440 */ ++#define RK3308_DAC_HEADPHONE_DET_MSK (0x1 << 1) + #define RK3308_DAC_HEADPHONE_DET_EN (0x1 << 1) + #define RK3308_DAC_HEADPHONE_DET_DIS (0x0 << 1) + #define RK3308_DAC_CURRENT_MSK (0x1 << 0) +@@ -783,17 +848,17 @@ + #define RK3308_DAC_BUF_REF_R_MSK (0x1 << 6) + #define RK3308_DAC_BUF_REF_R_EN (0x1 << 6) + #define RK3308_DAC_BUF_REF_R_DIS (0x0 << 6) +-#define RK3308_DAC_POP_SOUND_R_SFT 4 +-#define RK3308_DAC_POP_SOUND_R_MSK (0x3 << RK3308_DAC_POP_SOUND_R_SFT) +-#define RK3308_DAC_POP_SOUND_R_WORK (0x2 << RK3308_DAC_POP_SOUND_R_SFT) +-#define RK3308_DAC_POP_SOUND_R_INIT (0x1 << RK3308_DAC_POP_SOUND_R_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_R_SFT 4 ++#define RK3308_DAC_HPOUT_POP_SOUND_R_MSK (0x3 << RK3308_DAC_HPOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_R_WORK (0x2 << RK3308_DAC_HPOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_R_INIT (0x1 << RK3308_DAC_HPOUT_POP_SOUND_R_SFT) + #define RK3308_DAC_BUF_REF_L_MSK (0x1 << 2) + #define RK3308_DAC_BUF_REF_L_EN (0x1 << 2) + #define RK3308_DAC_BUF_REF_L_DIS (0x0 << 2) +-#define RK3308_DAC_POP_SOUND_L_SFT 0 +-#define RK3308_DAC_POP_SOUND_L_MSK (0x3 << RK3308_DAC_POP_SOUND_L_SFT) +-#define RK3308_DAC_POP_SOUND_L_WORK (0x2 << RK3308_DAC_POP_SOUND_L_SFT) +-#define RK3308_DAC_POP_SOUND_L_INIT (0x1 << RK3308_DAC_POP_SOUND_L_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_L_SFT 0 ++#define RK3308_DAC_HPOUT_POP_SOUND_L_MSK (0x3 << RK3308_DAC_HPOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_L_WORK (0x2 << RK3308_DAC_HPOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_HPOUT_POP_SOUND_L_INIT (0x1 << RK3308_DAC_HPOUT_POP_SOUND_L_SFT) + + /* RK3308_DAC_ANA_CON02 - REG: 0x0448 */ + #define RK3308_DAC_R_DAC_WORK (0x1 << 7) +@@ -828,28 +893,31 @@ + #define RK3308_DAC_L_HPOUT_MUTE (0x0 << 0) + + /* RK3308_DAC_ANA_CON04 - REG: 0x0450 */ +-#define RK3308_DAC_R_GAIN_SFT 6 +-#define RK3308_DAC_R_GAIN_MSK (0x3 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_0DB (0x3 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_PDB_1_5 (0x2 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_PDB_3 (0x1 << RK3308_DAC_R_GAIN_SFT) +-#define RK3308_DAC_R_GAIN_PDB_6 (0x0 << RK3308_DAC_R_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_MAX 0x3 ++#define RK3308_DAC_R_LINEOUT_GAIN_SFT 6 ++#define RK3308_DAC_R_LINEOUT_GAIN_MSK (0x3 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_0DB (0x3 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_NDB_1_5 (0x2 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_NDB_3 (0x1 << RK3308_DAC_R_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_R_LINEOUT_GAIN_NDB_6 (0x0 << RK3308_DAC_R_LINEOUT_GAIN_SFT) + #define RK3308_DAC_R_LINEOUT_UNMUTE (0x1 << 5) + #define RK3308_DAC_R_LINEOUT_MUTE (0x0 << 5) + #define RK3308_DAC_R_LINEOUT_EN (0x1 << 4) + #define RK3308_DAC_R_LINEOUT_DIS (0x0 << 4) +-#define RK3308_DAC_L_GAIN_SFT 2 +-#define RK3308_DAC_L_GAIN_MSK (0x3 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_0DB (0x3 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_PDB_1_5 (0x2 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_PDB_3 (0x1 << RK3308_DAC_L_GAIN_SFT) +-#define RK3308_DAC_L_GAIN_PDB_6 (0x0 << RK3308_DAC_L_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_MAX 0x3 ++#define RK3308_DAC_L_LINEOUT_GAIN_SFT 2 ++#define RK3308_DAC_L_LINEOUT_GAIN_MSK (0x3 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_0DB (0x3 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_NDB_1_5 (0x2 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_NDB_3 (0x1 << RK3308_DAC_L_LINEOUT_GAIN_SFT) ++#define RK3308_DAC_L_LINEOUT_GAIN_NDB_6 (0x0 << RK3308_DAC_L_LINEOUT_GAIN_SFT) + #define RK3308_DAC_L_LINEOUT_UNMUTE (0x1 << 1) + #define RK3308_DAC_L_LINEOUT_MUTE (0x0 << 1) + #define RK3308_DAC_L_LINEOUT_EN (0x1 << 0) + #define RK3308_DAC_L_LINEOUT_DIS (0x0 << 0) + + /* RK3308_DAC_ANA_CON05 - REG: 0x0454, step is 1.5db */ ++#define RK3308_DAC_L_HPOUT_GAIN_MAX 0x1e + #define RK3308_DAC_L_HPOUT_GAIN_SFT 0 + #define RK3308_DAC_L_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_L_HPOUT_GAIN_SFT) + #define RK3308_DAC_L_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_L_HPOUT_GAIN_SFT) +@@ -885,6 +953,7 @@ + #define RK3308_DAC_L_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_L_HPOUT_GAIN_SFT) + + /* RK3308_DAC_ANA_CON06 - REG: 0x0458, step is 1.5db */ ++#define RK3308_DAC_R_HPOUT_GAIN_MAX 0x1e + #define RK3308_DAC_R_HPOUT_GAIN_SFT 0 + #define RK3308_DAC_R_HPOUT_GAIN_MSK (0x1f << RK3308_DAC_R_HPOUT_GAIN_SFT) + #define RK3308_DAC_R_HPOUT_GAIN_PDB_6 (0x1e << RK3308_DAC_R_HPOUT_GAIN_SFT) +@@ -919,6 +988,18 @@ + #define RK3308_DAC_R_HPOUT_GAIN_NDB_37_5 (0x01 << RK3308_DAC_R_HPOUT_GAIN_SFT) + #define RK3308_DAC_R_HPOUT_GAIN_NDB_39 (0x00 << RK3308_DAC_R_HPOUT_GAIN_SFT) + ++/* RK3308_DAC_ANA_CON07 - REG: 0x045c */ ++#define RK3308_DAC_R_HPOUT_DRV_SFT 4 ++#define RK3308_DAC_R_HPOUT_DRV_MSK (0xf << RK3308_DAC_R_HPOUT_DRV_SFT) ++#define RK3308_DAC_L_HPOUT_DRV_SFT 0 ++#define RK3308_DAC_L_HPOUT_DRV_MSK (0xf << RK3308_DAC_L_HPOUT_DRV_SFT) ++ ++/* RK3308_DAC_ANA_CON08 - REG: 0x0460 */ ++#define RK3308_DAC_R_LINEOUT_DRV_SFT 4 ++#define RK3308_DAC_R_LINEOUT_DRV_MSK (0xf << RK3308_DAC_R_LINEOUT_DRV_SFT) ++#define RK3308_DAC_L_LINEOUT_DRV_SFT 0 ++#define RK3308_DAC_L_LINEOUT_DRV_MSK (0xf << RK3308_DAC_L_LINEOUT_DRV_SFT) ++ + /* RK3308_DAC_ANA_CON12 - REG: 0x0470 */ + #define RK3308_DAC_R_HPMIX_SEL_SFT 6 + #define RK3308_DAC_R_HPMIX_SEL_MSK (0x3 << RK3308_DAC_R_HPMIX_SEL_SFT) +@@ -926,6 +1007,8 @@ + #define RK3308_DAC_R_HPMIX_LINEIN (0x2 << RK3308_DAC_R_HPMIX_SEL_SFT) + #define RK3308_DAC_R_HPMIX_I2S (0x1 << RK3308_DAC_R_HPMIX_SEL_SFT) + #define RK3308_DAC_R_HPMIX_NONE (0x0 << RK3308_DAC_R_HPMIX_SEL_SFT) ++#define RK3308_DAC_R_HPMIX_GAIN_MIN 0x1 ++#define RK3308_DAC_R_HPMIX_GAIN_MAX 0x2 + #define RK3308_DAC_R_HPMIX_GAIN_SFT 4 + #define RK3308_DAC_R_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_R_HPMIX_GAIN_SFT) + #define RK3308_DAC_R_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_R_HPMIX_GAIN_SFT) +@@ -936,6 +1019,8 @@ + #define RK3308_DAC_L_HPMIX_LINEIN (0x2 << RK3308_DAC_L_HPMIX_SEL_SFT) + #define RK3308_DAC_L_HPMIX_I2S (0x1 << RK3308_DAC_L_HPMIX_SEL_SFT) + #define RK3308_DAC_L_HPMIX_NONE (0x0 << RK3308_DAC_L_HPMIX_SEL_SFT) ++#define RK3308_DAC_L_HPMIX_GAIN_MIN 0x1 ++#define RK3308_DAC_L_HPMIX_GAIN_MAX 0x2 + #define RK3308_DAC_L_HPMIX_GAIN_SFT 0 + #define RK3308_DAC_L_HPMIX_GAIN_MSK (0x3 << RK3308_DAC_L_HPMIX_GAIN_SFT) + #define RK3308_DAC_L_HPMIX_GAIN_0DB (0x2 << RK3308_DAC_L_HPMIX_GAIN_SFT) +@@ -955,6 +1040,30 @@ + #define RK3308_DAC_L_HPMIX_EN (0x1 << 0) + #define RK3308_DAC_L_HPMIX_DIS (0x0 << 0) + ++/* RK3308_DAC_ANA_CON14 - REG: 0x0478 */ ++#define RK3308_DAC_VCM_LINEOUT_EN (0x1 << 4) ++#define RK3308_DAC_VCM_LINEOUT_DIS (0x0 << 4) ++#define RK3308_DAC_CURRENT_CHARGE_SFT 0 ++#define RK3308_DAC_CURRENT_CHARGE_MSK (0xf << RK3308_DAC_CURRENT_CHARGE_SFT) ++ ++/* ++ * 1: Choose the current I ++ * 0: Don't choose the current I ++ */ ++#define RK3308_DAC_SEL_I(x) (x & 0xf) ++ ++/* RK3308_DAC_ANA_CON15 - REG: 0x047C */ ++#define RK3308_DAC_LINEOUT_POP_SOUND_R_SFT 4 ++#define RK3308_DAC_LINEOUT_POP_SOUND_R_MSK (0x3 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_R_SEL_DC_FROM_INTERNAL (0x2 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_R_SEL_DC_FROM_VCM (0x1 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_R_SEL_LINEOUT_FROM_INTERNAL (0x0 << RK3308_DAC_LINEOUT_POP_SOUND_R_SFT) ++#define RK3308_DAC_LINEOUT_POP_SOUND_L_SFT 0 ++#define RK3308_DAC_LINEOUT_POP_SOUND_L_MSK (0x3 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_L_SEL_DC_FROM_INTERNAL (0x2 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_L_SEL_DC_FROM_VCM (0x1 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++#define RK3308_DAC_L_SEL_LINEOUT_FROM_INTERNAL (0x0 << RK3308_DAC_LINEOUT_POP_SOUND_L_SFT) ++ + #define RK3308_HIFI 0x0 + + #endif /* __RK3308_CODEC_H__ */ +diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h +new file mode 100644 +index 000000000000..68042b1328dc +--- /dev/null ++++ b/sound/soc/codecs/rk3308_codec_provider.h +@@ -0,0 +1,28 @@ ++/* ++ * rk3308_codec_provider.h -- RK3308 ALSA Soc Audio Driver ++ * ++ * Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef __RK3308_CODEC_PROVIDER_H__ ++#define __RK3308_CODEC_PROVIDER_H__ ++ ++#ifdef CONFIG_SND_SOC_RK3308 ++extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++ struct snd_soc_jack *hpdet_jack); ++#endif ++ ++#endif /* __RK3308_CODEC_PROVIDER_H__ */ +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch.disabled b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch.disabled new file mode 100644 index 000000000000..821e69964ccd --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0020-arm64-dts-rockchip-Add-acodec-node-for-rk3308.patch.disabled @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Mon, 3 Feb 2020 17:19:33 +0100 +Subject: arm64: dts: rockchip: Add acodec node for rk3308 + +Change-Id: I76f4a877711d33620bdef295e9047bdba26d4da4 +Signed-off-by: Xing Zheng +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 18 +++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 291f011800b2..dd221ee88722 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -548,7 +548,7 @@ rk_timer_rtc: rk-timer-rtc@ff1a0020 { + clock-names = "pclk", "timer"; + status = "disabled"; + }; +- ++ + saradc: saradc@ff1e0000 { + compatible = "rockchip,rk3308-saradc", "rockchip,rk3399-saradc"; + reg = <0x0 0xff1e0000 0x0 0x100>; +@@ -933,6 +933,22 @@ cru: clock-controller@ff500000 { + assigned-clock-rates = <32768>; + }; + ++ acodec: acodec@ff560000 { ++ compatible = "rockchip,rk3308-codec"; ++ reg = <0x0 0xff560000 0x0 0x10000>; ++ rockchip,grf = <&grf>; ++ rockchip,detect-grf = <&detect_grf>; ++ interrupts = , ++ ; ++ clocks = <&cru PCLK_ACODEC>, ++ <&cru SCLK_I2S2_8CH_TX_OUT>, ++ <&cru SCLK_I2S2_8CH_RX_OUT>; ++ clock-names = "acodec", "mclk_tx", "mclk_rx"; ++ resets = <&cru SRST_ACODEC_P>; ++ reset-names = "acodec-reset"; ++ status = "disabled"; ++}; ++ + gic: interrupt-controller@ff580000 { + compatible = "arm,gic-400"; + reg = <0x0 0xff581000 0x0 0x1000>, +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch.disabled b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch.disabled new file mode 100644 index 000000000000..5855cf80a551 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch.disabled @@ -0,0 +1,459 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ashthespy +Date: Mon, 3 Feb 2020 19:35:42 +0100 +Subject: ASoC: rk3308_codec: replace codec to component + +--- + sound/soc/codecs/rk3308_codec.c | 159 +++++----- + sound/soc/codecs/rk3308_codec_provider.h | 2 +- + 2 files changed, 84 insertions(+), 77 deletions(-) + +diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c +index 815e22fc346c..b6862fc5a3da 100644 +--- a/sound/soc/codecs/rk3308_codec.c ++++ b/sound/soc/codecs/rk3308_codec.c +@@ -31,7 +31,7 @@ + #include + #include + #include +-#include ++// #include + #include + #include + #include +@@ -156,7 +156,7 @@ struct rk3308_codec_priv { + struct gpio_desc *hp_ctl_gpio; + struct gpio_desc *spk_ctl_gpio; + struct gpio_desc *pa_drv_gpio; +- struct snd_soc_codec *codec; ++ struct snd_soc_component *component; + struct snd_soc_jack *hpdet_jack; + struct regulator *vcc_micbias; + u32 codec_ver; +@@ -883,8 +883,8 @@ static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = { + static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + + if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) { +@@ -904,8 +904,8 @@ static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.integer.value[0]; + int grp = e->reg; +@@ -970,8 +970,8 @@ static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -998,8 +998,8 @@ static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -1032,8 +1032,8 @@ static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -1064,8 +1064,8 @@ static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + int grp = e->reg; +@@ -1098,8 +1098,8 @@ static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + ucontrol->value.integer.value[0] = rk3308->micbias_volt; + +@@ -1109,8 +1109,8 @@ static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int volt = ucontrol->value.integer.value[0]; + int ret; + +@@ -1133,8 +1133,8 @@ static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + ucontrol->value.integer.value[0] = rk3308->enable_micbias; + +@@ -1144,8 +1144,8 @@ static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int on = ucontrol->value.integer.value[0]; + + if (on) { +@@ -1168,8 +1168,8 @@ static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int gain = ucontrol->value.integer.value[0]; + + if (gain > RK3308_ADC_CH1_MIC_GAIN_MAX) { +@@ -1197,8 +1197,8 @@ static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value; + +@@ -1222,8 +1222,8 @@ static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int value = ucontrol->value.integer.value[0]; + +@@ -1259,8 +1259,8 @@ static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int dgain = ucontrol->value.integer.value[0]; + + if (dgain > RK3308_DAC_L_HPOUT_GAIN_MAX) { +@@ -1283,8 +1283,8 @@ static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol, + static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int dgain = ucontrol->value.integer.value[0]; + + if (dgain > RK3308_DAC_R_HPOUT_GAIN_MAX) { +@@ -1408,9 +1408,9 @@ static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on) + } + } + +-static int rk3308_codec_reset(struct snd_soc_codec *codec) ++static int rk3308_codec_reset(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + reset_control_assert(rk3308->reset); + usleep_range(2000, 2500); /* estimated value */ +@@ -1452,10 +1452,10 @@ static int rk3308_codec_dac_dig_reset(struct rk3308_codec_priv *rk3308) + return 0; + } + +-static int rk3308_set_bias_level(struct snd_soc_codec *codec, ++static int rk3308_set_bias_level(struct snd_soc_component *component, + enum snd_soc_bias_level level) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + switch (level) { + case SND_SOC_BIAS_ON: +@@ -1473,11 +1473,11 @@ static int rk3308_set_bias_level(struct snd_soc_codec *codec, + return 0; + } + +-static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai, ++static int rk3308_set_dai_fmt(struct snd_soc_dai *dai, + unsigned int fmt) + { +- struct snd_soc_codec *codec = codec_dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0; + int idx, grp, is_master; + int type = ADC_TYPE_ALL; +@@ -1721,8 +1721,8 @@ static int rk3308_codec_update_adc_grps(struct rk3308_codec_priv *rk3308, + + static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + int dgain; +@@ -3630,8 +3630,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + struct snd_pcm_str *playback_str = + &substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; + int type = ADC_TYPE_LOOPBACK; +@@ -3705,8 +3705,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream, + static int rk3308_pcm_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + int type = ADC_TYPE_LOOPBACK; + int idx, grp; + +@@ -3749,8 +3749,8 @@ static int rk3308_pcm_trigger(struct snd_pcm_substream *substream, + static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { +- struct snd_soc_codec *codec = dai->codec; +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct snd_soc_component *component = dai->component; ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + rk3308_codec_close_playback(rk3308); +@@ -3809,9 +3809,9 @@ static struct snd_soc_dai_driver rk3308_dai[] = { + }, + }; + +-static int rk3308_suspend(struct snd_soc_codec *codec) ++static int rk3308_suspend(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + if (rk3308->no_deep_low_power) + goto out; +@@ -3822,13 +3822,13 @@ static int rk3308_suspend(struct snd_soc_codec *codec) + clk_disable_unprepare(rk3308->pclk); + + out: +- rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF); ++ rk3308_set_bias_level(component, SND_SOC_BIAS_OFF); + return 0; + } + +-static int rk3308_resume(struct snd_soc_codec *codec) ++static int rk3308_resume(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + int ret = 0; + + if (rk3308->no_deep_low_power) +@@ -3857,7 +3857,7 @@ static int rk3308_resume(struct snd_soc_codec *codec) + + rk3308_codec_dlp_up(rk3308); + out: +- rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ++ rk3308_set_bias_level(component, SND_SOC_BIAS_STANDBY); + return ret; + } + +@@ -3972,7 +3972,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308) + int ret; + + if (rk3308->codec_ver == ACODEC_VERSION_B) { +- ret = snd_soc_add_codec_controls(rk3308->codec, ++ ret = snd_soc_add_component_controls(rk3308->component, + mic_gains_b, + ARRAY_SIZE(mic_gains_b)); + if (ret) { +@@ -3982,7 +3982,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308) + return ret; + } + } else { +- ret = snd_soc_add_codec_controls(rk3308->codec, ++ ret = snd_soc_add_component_controls(rk3308->component, + mic_gains_a, + ARRAY_SIZE(mic_gains_a)); + if (ret) { +@@ -4081,15 +4081,15 @@ static int rk3308_codec_prepare(struct rk3308_codec_priv *rk3308) + return 0; + } + +-static int rk3308_probe(struct snd_soc_codec *codec) ++static int rk3308_probe(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + int ext_micbias; + +- rk3308->codec = codec; ++ rk3308->component = component; + rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE); + +- rk3308_codec_reset(codec); ++ rk3308_codec_reset(component); + rk3308_codec_power_on(rk3308); + + /* From vendor recommend, disable micbias at first. */ +@@ -4108,9 +4108,9 @@ static int rk3308_probe(struct snd_soc_codec *codec) + return 0; + } + +-static int rk3308_remove(struct snd_soc_codec *codec) ++static void rk3308_remove(struct snd_soc_component *component) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + rk3308_headphone_ctl(rk3308, 0); + rk3308_speaker_ctl(rk3308, 0); +@@ -4124,17 +4124,25 @@ static int rk3308_remove(struct snd_soc_codec *codec) + regcache_cache_only(rk3308->regmap, false); + regcache_sync(rk3308->regmap); + +- return 0; + } + +-static struct snd_soc_codec_driver soc_codec_dev_rk3308 = { +- .probe = rk3308_probe, +- .remove = rk3308_remove, +- .suspend = rk3308_suspend, +- .resume = rk3308_resume, +- .set_bias_level = rk3308_set_bias_level, +- .controls = rk3308_codec_dapm_controls, +- .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++static const struct snd_soc_component_driver soc_codec_dev_rk3308_component = { ++ .probe = rk3308_probe, ++ .remove = rk3308_remove, ++ .resume = rk3308_resume, ++ .suspend = rk3308_suspend, ++ .set_bias_level = rk3308_set_bias_level, ++ .controls = rk3308_codec_dapm_controls, ++ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls), ++ // .dapm_widgets = rk3308_dapm_widgets, ++ // .num_dapm_widgets = ARRAY_SIZE(rk3308_dapm_widgets), ++ // .dapm_routes = rk3308_dapm_routes, ++ // .num_dapm_routes = ARRAY_SIZE(rk3308_dapm_routes), ++ // .suspend_bias_off = 1, ++ // .idle_bias_on = 1, ++ // .use_pmdown_time = 1, ++ .endianness = 1, ++ .legacy_dai_naming = 1, + }; + + static const struct reg_default rk3308_codec_reg_defaults[] = { +@@ -4299,14 +4307,14 @@ static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data) + return IRQ_HANDLED; + } + +-void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component, + struct snd_soc_jack *hpdet_jack); + EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb); + +-static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec, ++static void rk3308_codec_set_jack_detect(struct snd_soc_component *component, + struct snd_soc_jack *hpdet_jack) + { +- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec); ++ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); + + rk3308->hpdet_jack = hpdet_jack; + +@@ -5114,10 +5122,10 @@ static int rk3308_platform_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, rk3308); + +- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308, ++ ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk3308_component, + rk3308_dai, ARRAY_SIZE(rk3308_dai)); + if (ret < 0) { +- dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); ++ dev_err(&pdev->dev, "Failed to register component: %d\n", ret); + goto failed; + } + +@@ -5140,7 +5148,6 @@ static int rk3308_platform_remove(struct platform_device *pdev) + clk_disable_unprepare(rk3308->mclk_rx); + clk_disable_unprepare(rk3308->mclk_tx); + clk_disable_unprepare(rk3308->pclk); +- snd_soc_unregister_codec(&pdev->dev); + device_unregister(&rk3308->dev); + + return 0; +diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h +index 68042b1328dc..34c1ef86a507 100644 +--- a/sound/soc/codecs/rk3308_codec_provider.h ++++ b/sound/soc/codecs/rk3308_codec_provider.h +@@ -21,7 +21,7 @@ + #define __RK3308_CODEC_PROVIDER_H__ + + #ifdef CONFIG_SND_SOC_RK3308 +-extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec, ++extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component, + struct snd_soc_jack *hpdet_jack); + #endif + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch new file mode 100644 index 000000000000..f11c766eb4e2 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0027-arm64-dts-rk3308-add-otp-cpuinfo.patch @@ -0,0 +1,115 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Wed, 8 Sep 2021 17:51:34 +0200 +Subject: [ARCHEOLOGY] Bumping EDGE kernel to 5.14.y (#3125) + +> X-Git-Archeology: > recovered message: > * Bumping EDGE kernel to 5.14.y +> X-Git-Archeology: > recovered message: > Meson64: +> X-Git-Archeology: > recovered message: > - removing Odroid reboot shutdown patch since its probably not needed anymore +> X-Git-Archeology: > recovered message: > Rockchip64: +> X-Git-Archeology: > recovered message: > - removing Rockpi S. No interest to maintain this any further +> X-Git-Archeology: > recovered message: > - removing PBP suspend. Doesn't align. Need inspection if some other way was mainstreamed +> X-Git-Archeology: > recovered message: > - temporally removing Orangepi R1 +> X-Git-Archeology: > recovered message: > * Re-adding rockpis, pbp suspend, HFLPS170 wifi and cleanup +> X-Git-Archeology: > recovered message: > * Removing deprecated patch, fixing ap6256 wifi +> X-Git-Archeology: > recovered message: > * Re-enable Opi R1 plus, untest +> X-Git-Archeology: > recovered message: > * Add and fix Radxa Zero +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 29 ++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index dd221ee88722..5f48dcee7548 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -138,6 +138,12 @@ arm-pmu { + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + ++ cpuinfo { ++ compatible = "rockchip,cpuinfo"; ++ nvmem-cells = <&cpu_id>; ++ nvmem-cell-names = "id"; ++ }; ++ + mac_clkin: external-mac-clock { + compatible = "fixed-clock"; + clock-frequency = <50000000>; +@@ -145,6 +151,29 @@ mac_clkin: external-mac-clock { + #clock-cells = <0>; + }; + ++ otp: otp@ff210000 { ++ compatible = "rockchip,rk3308-otp"; ++ reg = <0x0 0xff210000 0x0 0x4000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ clocks = <&cru SCLK_OTP_USR>, <&cru PCLK_OTP_NS>, ++ <&cru PCLK_OTP_PHY>; ++ clock-names = "otp", "apb_pclk", "phy"; ++ resets = <&cru SRST_OTP_PHY>; ++ reset-names = "phy"; ++ ++ /* Data cells */ ++ cpu_id: id@7 { ++ reg = <0x07 0x10>; ++ }; ++ cpu_leakage: cpu-leakage@17 { ++ reg = <0x17 0x1>; ++ }; ++ logic_leakage: logic-leakage@18 { ++ reg = <0x18 0x1>; ++ }; ++ }; ++ + psci { + compatible = "arm,psci-1.0"; + method = "smc"; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch new file mode 100644 index 000000000000..e64c536bc09a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpis-0029-arm64-dts-rk3308-add-reserved-memory-ramoops.patch @@ -0,0 +1,99 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Igor Pecovnik +Date: Wed, 8 Sep 2021 17:51:34 +0200 +Subject: [ARCHEOLOGY] Bumping EDGE kernel to 5.14.y (#3125) + +> X-Git-Archeology: > recovered message: > * Bumping EDGE kernel to 5.14.y +> X-Git-Archeology: > recovered message: > Meson64: +> X-Git-Archeology: > recovered message: > - removing Odroid reboot shutdown patch since its probably not needed anymore +> X-Git-Archeology: > recovered message: > Rockchip64: +> X-Git-Archeology: > recovered message: > - removing Rockpi S. No interest to maintain this any further +> X-Git-Archeology: > recovered message: > - removing PBP suspend. Doesn't align. Need inspection if some other way was mainstreamed +> X-Git-Archeology: > recovered message: > - temporally removing Orangepi R1 +> X-Git-Archeology: > recovered message: > * Re-adding rockpis, pbp suspend, HFLPS170 wifi and cleanup +> X-Git-Archeology: > recovered message: > * Removing deprecated patch, fixing ap6256 wifi +> X-Git-Archeology: > recovered message: > * Re-enable Opi R1 plus, untest +> X-Git-Archeology: > recovered message: > * Add and fix Radxa Zero +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3308.dtsi | 20 ++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +index 5f48dcee7548..c5fe355c6deb 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi +@@ -179,6 +179,26 @@ psci { + method = "smc"; + }; + ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ drm_logo: drm-logo@00000000 { ++ compatible = "rockchip,drm-logo"; ++ reg = <0x0 0x0 0x0 0x0>; ++ }; ++ ++ ramoops: ramoops@110000 { ++ compatible = "ramoops"; ++ reg = <0x0 0x110000 0x0 0xf0000>; ++ record-size = <0x30000>; ++ console-size = <0xc0000>; ++ ftrace-size = <0x00000>; ++ pmsg-size = <0x00000>; ++ }; ++ }; ++ + timer { + compatible = "arm,armv8-timer"; + interrupts = , +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch new file mode 100644 index 000000000000..42c9ba693774 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-0001-Add-pcie-bus-scan-delay.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Mon, 24 Aug 2020 22:47:03 +0200 +Subject: Rockpro64 add pcie bus scan delay + +> X-Git-Archeology: - Revision 42e76b9277ad492e935cc76c2b37c9f6d882a675: https://github.com/armbian/build/commit/42e76b9277ad492e935cc76c2b37c9f6d882a675 +> X-Git-Archeology: Date: Mon, 24 Aug 2020 22:47:03 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch RockPro64 work led to heartbeat trigger +> X-Git-Archeology: +> X-Git-Archeology: - Revision 4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5: https://github.com/armbian/build/commit/4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5 +> X-Git-Archeology: Date: Wed, 02 Sep 2020 23:22:09 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64 curent to kernel 5.8.y (#2175) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 7be9e8b99590e32c0594365d00a2a2cfc3c4bd5a: https://github.com/armbian/build/commit/7be9e8b99590e32c0594365d00a2a2cfc3c4bd5a +> X-Git-Archeology: Date: Thu, 16 Dec 2021 05:17:33 -0500 +> X-Git-Archeology: From: Dan Pasanen +> X-Git-Archeology: Subject: rockchip-[current,edge]: add pcie hack and lsi scsi/sas support (#3351) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 588c2ec17e709dec19304fa50522459702ebfadd: https://github.com/armbian/build/commit/588c2ec17e709dec19304fa50522459702ebfadd +> X-Git-Archeology: Date: Fri, 23 Dec 2022 21:57:53 +0100 +> X-Git-Archeology: From: brentr +> X-Git-Archeology: Subject: Rockpis devtree mainlined (#4603) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index bca2b50e0a93..1e7295215b58 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -663,6 +663,7 @@ &pcie0 { + pinctrl-0 = <&pcie_perst>; + vpcie12v-supply = <&vcc12v_dcin>; + vpcie3v3-supply = <&vcc3v3_pcie>; ++ bus-scan-delay-ms = <1000>; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch new file mode 100644 index 000000000000..4e7ed60cfbef --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-change-rx_delay-for-gmac.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ayufan +Date: Sun, 30 Dec 2018 13:32:47 +0100 +Subject: ayufan: dts: rockpro64: change rx_delay for gmac + +Change-Id: Ib3899f684188aa1ed1545717af004bba53fe0e07 +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index 1e7295215b58..25ee84e06874 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -307,7 +307,7 @@ &gmac { + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; +- rx_delay = <0x11>; ++ rx_delay = <0x20>; + status = "okay"; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch new file mode 100644 index 000000000000..7aeb8dc4fac6 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-emmc.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Wed, 5 Dec 2018 14:09:24 -0500 +Subject: [ARCHEOLOGY] fix PMIC_INT_L gpio conflicting with I2C8_SCL in + RockPro64 + +> X-Git-Archeology: - Revision 9324bde9b94db6c2f43ff1e75bedb74fbe6e29a1: https://github.com/armbian/build/commit/9324bde9b94db6c2f43ff1e75bedb74fbe6e29a1 +> X-Git-Archeology: Date: Wed, 05 Dec 2018 14:09:24 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: fix PMIC_INT_L gpio conflicting with I2C8_SCL in RockPro64 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8f82cb60b958ad235ee91899ab2ca8e4a8a2a33b: https://github.com/armbian/build/commit/8f82cb60b958ad235ee91899ab2ca8e4a8a2a33b +> X-Git-Archeology: Date: Mon, 31 Dec 2018 12:29:56 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: set lower speed for RockPro64 eMMC +> X-Git-Archeology: +> X-Git-Archeology: - Revision cbbbf0631969bf0e4578f4b1eef62c1aab115d79: https://github.com/armbian/build/commit/cbbbf0631969bf0e4578f4b1eef62c1aab115d79 +> X-Git-Archeology: Date: Tue, 01 Jan 2019 19:37:27 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: fix RockPi-4B naming + fix vcc5v0_host gpio pin +> X-Git-Archeology: +> X-Git-Archeology: - Revision a186fd498404fdae7d3a25dec64f014c590027d6: https://github.com/armbian/build/commit/a186fd498404fdae7d3a25dec64f014c590027d6 +> X-Git-Archeology: Date: Wed, 05 Feb 2020 00:19:00 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-dev to mainline kernel 5.5.y (#1781) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 5e251dc4148f7a7e3fa61d440c5a268626624de3: https://github.com/armbian/build/commit/5e251dc4148f7a7e3fa61d440c5a268626624de3 +> X-Git-Archeology: Date: Mon, 06 Apr 2020 19:06:28 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Merged rockpi-s dev info rockchip64-dev and moved to 5.6.y (#1874) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 812245def37a695bce9e7ece148b2920d82c8b37: https://github.com/armbian/build/commit/812245def37a695bce9e7ece148b2920d82c8b37 +> X-Git-Archeology: Date: Sat, 18 Jul 2020 23:07:01 +0200 +> X-Git-Archeology: From: Werner +> X-Git-Archeology: Subject: Move rockchip/64 current to 5.7.y (#2099) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dfd5cf9692e97774f7f0bfd72227144e36f58070: https://github.com/armbian/build/commit/dfd5cf9692e97774f7f0bfd72227144e36f58070 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 22:13:03 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Clean up patchset +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index 25ee84e06874..f5f521986d43 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -17,6 +17,7 @@ aliases { + }; + + chosen { ++ bootargs = "mmc_cmdqueue=0 earlycon=uart8250,mmio32,0xff1a0000"; + stdout-path = "serial2:1500000n8"; + }; + +@@ -815,6 +816,7 @@ &sdmmc { + + &sdhci { + bus-width = <8>; ++ keep-power-in-suspend; + mmc-hs200-1_8v; + non-removable; + status = "okay"; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch new file mode 100644 index 000000000000..3fb67e1c646b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-fix-spi1-flash-speed.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martin Ayotte +Date: Sat, 5 Jan 2019 09:50:02 -0500 +Subject: [ARCHEOLOGY] slow SPIFlash to avoid errors + +> X-Git-Archeology: - Revision ea20f750bfead37ced7b604a44f8f014e317abad: https://github.com/armbian/build/commit/ea20f750bfead37ced7b604a44f8f014e317abad +> X-Git-Archeology: Date: Sat, 05 Jan 2019 09:50:02 -0500 +> X-Git-Archeology: From: Martin Ayotte +> X-Git-Archeology: Subject: slow SPIFlash to avoid errors +> X-Git-Archeology: +> X-Git-Archeology: - Revision a186fd498404fdae7d3a25dec64f014c590027d6: https://github.com/armbian/build/commit/a186fd498404fdae7d3a25dec64f014c590027d6 +> X-Git-Archeology: Date: Wed, 05 Feb 2020 00:19:00 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64-dev to mainline kernel 5.5.y (#1781) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 5e251dc4148f7a7e3fa61d440c5a268626624de3: https://github.com/armbian/build/commit/5e251dc4148f7a7e3fa61d440c5a268626624de3 +> X-Git-Archeology: Date: Mon, 06 Apr 2020 19:06:28 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Merged rockpi-s dev info rockchip64-dev and moved to 5.6.y (#1874) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 812245def37a695bce9e7ece148b2920d82c8b37: https://github.com/armbian/build/commit/812245def37a695bce9e7ece148b2920d82c8b37 +> X-Git-Archeology: Date: Sat, 18 Jul 2020 23:07:01 +0200 +> X-Git-Archeology: From: Werner +> X-Git-Archeology: Subject: Move rockchip/64 current to 5.7.y (#2099) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 40665cde86285060e6bdd5ef7dc33be6c301ec66: https://github.com/armbian/build/commit/40665cde86285060e6bdd5ef7dc33be6c301ec66 +> X-Git-Archeology: Date: Sun, 13 Dec 2020 23:22:08 -0500 +> X-Git-Archeology: From: tonymac32 +> X-Git-Archeology: Subject: [ rockchip64 ] Patch reorg round 2 +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index f5f521986d43..6eddc07a958f 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -838,7 +838,7 @@ &spi1 { + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; +- spi-max-frequency = <10000000>; ++ spi-max-frequency = <3000000>; + }; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch new file mode 100644 index 000000000000..9e17aa826118 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rockpro64-work-led-heartbeat.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Piotr Szczepanik +Date: Mon, 24 Aug 2020 22:47:03 +0200 +Subject: [ARCHEOLOGY] Switch RockPro64 work led to heartbeat trigger + +> X-Git-Archeology: - Revision 42e76b9277ad492e935cc76c2b37c9f6d882a675: https://github.com/armbian/build/commit/42e76b9277ad492e935cc76c2b37c9f6d882a675 +> X-Git-Archeology: Date: Mon, 24 Aug 2020 22:47:03 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch RockPro64 work led to heartbeat trigger +> X-Git-Archeology: +> X-Git-Archeology: - Revision d1eb0003854909824d17b529cd513feb542bf228: https://github.com/armbian/build/commit/d1eb0003854909824d17b529cd513feb542bf228 +> X-Git-Archeology: Date: Mon, 24 Aug 2020 23:11:20 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch RockPro64 work led to heartbeat trigger (in legacy too) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5: https://github.com/armbian/build/commit/4d4c3f58ffc1cbfbb060cbabc9eb414036a2fda5 +> X-Git-Archeology: Date: Wed, 02 Sep 2020 23:22:09 +0200 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switched rockchip64 curent to kernel 5.8.y (#2175) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision e7377248b3cae186e24e2be781cd3365b43246f0: https://github.com/armbian/build/commit/e7377248b3cae186e24e2be781cd3365b43246f0 +> X-Git-Archeology: Date: Thu, 22 Jul 2021 00:15:54 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Second part of EDGE bumping to 5.13.y (#3045) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 744ea89a589d62cb6f409baab60fc6664520bc39: https://github.com/armbian/build/commit/744ea89a589d62cb6f409baab60fc6664520bc39 +> X-Git-Archeology: Date: Wed, 08 Sep 2021 17:51:34 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bumping EDGE kernel to 5.14.y (#3125) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +index 6eddc07a958f..eb1eebadb637 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +@@ -66,7 +66,7 @@ leds { + + work_led: led-0 { + label = "work"; +- default-state = "on"; ++ linux,default-trigger = "heartbeat"; + gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; + }; + +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch b/patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch new file mode 100644 index 000000000000..fa0f46a0c85a --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-rocks0-0001-deviceTree.patch @@ -0,0 +1,366 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brent Roman +Date: Wed, 7 Feb 2024 18:02:07 -0800 +Subject: Added Linux device tree for Rock S0 + +Signed-off-by: Brent Roman +--- + arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts | 347 ++++++++++ + 1 files changed, 347 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts b/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts +new file mode 100644 +index 000000000..aded16959 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-s0.dts +@@ -0,0 +1,347 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2019 Akash Gajjar ++ * Copyright (c) 2019 Jagan Teki ++ * Revised: 2024 Brent Roman ++ */ ++ ++/dts-v1/; ++#include "rk3308.dtsi" ++ ++/ { ++ model = "Radxa ROCK S0"; ++ compatible = "radxa,rock-s0", "rockchip,rk3308"; ++ ++ chosen { ++ stdout-path = "serial0:1500000n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&green_led_gio>; ++ ++ green-led { ++ label = "rock-s0:green:power"; ++ gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "heartbeat"; ++ default-state = "on"; ++ }; ++ }; ++ ++ acodec-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,rk3308-acodec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,codec-hp-det; ++ simple-audio-card,widgets = ++ "Headphone", "Headphones"; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s_8ch_2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&codec>; ++ }; ++ }; ++ ++ sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "i2s_8ch_0"; ++ ++ simple-audio-card,dai-link@1 { ++ format = "i2s"; ++ cpu { ++ sound-dai = <&i2s_8ch_0>; ++ }; ++ ++ codec { ++ sound-dai = <&pcm5102a>; ++ }; ++ }; ++ }; ++ ++ pcm5102a: pcm5102a { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ pcm510x,format = "i2s"; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ pinctrl-0 = <&wifi_enable_h>; ++ pinctrl-names = "default"; ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ vcc_1v8: vcc-1v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_io>; ++ }; ++ ++ vcc_io: vcc-io { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_io"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc_ddr: vcc-ddr { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc5v0_otg: vcc5v0-otg { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&otg_vbus_drv>; ++ regulator-name = "vcc5v0_otg"; ++ regulator-always-on; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vdd_core: vdd-core { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm0 0 5000 1>; ++ pwm-supply = <&vcc5v0_sys>; ++ regulator-name = "vdd_core"; ++ regulator-min-microvolt = <827000>; ++ regulator-max-microvolt = <1340000>; ++ regulator-init-microvolt = <1015000>; ++ regulator-settling-time-up-us = <250>; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1050000>; ++ regulator-max-microvolt = <1050000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ board_antenna: board-antenna { ++ status = "okay"; ++ compatible = "regulator-fixed"; ++ enable-active-low; ++ gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; ++ regulator-always-on; ++ regulator-boot-on; ++ pinctrl-0 = <&ant_1>; ++ pinctrl-names = "default"; ++ regulator-name = "board_antenna"; ++ }; ++}; ++ ++&codec { ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ ++&cpu0 { ++ cpu-supply = <&vdd_core>; ++}; ++ ++&emmc { ++ cap-mmc-highspeed; ++ mmc-hs200-1_8v; ++ non-removable; ++ vmmc-supply = <&vcc_io>; //was vin-supply ++ status = "okay"; ++}; ++ ++&sdmmc { ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ no-mmc; ++ status = "okay"; ++ ++ AP6212: wifi@1 { ++ compatible = "brcm,bcm4329-fmac"; ++ reg = <1>; ++ interrupt-parent = <&gpio0>; ++ interrupts = ; ++ interrupt-names = "host-wake"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake>; ++ }; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_io>; ++ clock_in_out = "output"; ++ assigned-clocks = <&cru SCLK_MAC>; ++ assigned-clock-parents = <&cru SCLK_MAC_SRC>; ++ snps,reset-gpio = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 50000 50000>; ++ status = "okay"; ++}; ++ ++&i2s_8ch_0 { ++ assigned-clocks = <&cru SCLK_I2S0_8CH_RX>; ++ assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>; ++ rockchip,clk-trcm = <1>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s_8ch_2 { ++ status = "okay"; ++ #sound-dai-cells = <0>; ++}; ++ ++&pinctrl { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtc_32k>; ++ ++ leds { ++ green_led_gio: green-led-gpio { ++ rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb { ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wifi { ++ wifi_host_wake: wifi-host-wake { ++ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ }; ++ antenna { ++ ant_1: ant-1 { ++ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++ pinctrl-0 = <&pwm0_pin_pull_down>; ++}; ++ ++&saradc { ++ vref-supply = <&vcc_1v8>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ rockchip,hw-tshut-mode = <0>; /* 0:CRU */ ++ rockchip,hw-tshut-polarity = <1>; /* 1:HIGH */ ++ status = "okay"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++}; ++ ++&spi2 { ++// status = "okay"; //conflicts with UART2 ++ max-freq = <10000000>; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&uart4 { ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "realtek,rtl8723bs-bt"; ++ device-wake-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; ++ host-wake-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&u2phy { ++ status = "okay"; ++ ++ u2phy_host: host-port { ++ phy-supply = <&vcc5v0_otg>; ++ status = "okay"; ++ }; ++ ++ u2phy_otg: otg-port { ++ status = "okay"; ++ }; ++}; ++ ++&usb20_otg { ++ status = "okay"; ++}; ++ ++&usb_host_ehci { ++ status = "okay"; ++}; ++ ++&usb_host_ohci{ ++ status = "okay"; ++}; ++ ++&wdt { ++ status = "okay"; ++}; ++ +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/archive/rockchip64-6.10/board-station-p2.patch b/patch/kernel/archive/rockchip64-6.10/board-station-p2.patch new file mode 100644 index 000000000000..670c56d8fea3 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/board-station-p2.patch @@ -0,0 +1,580 @@ +--- a/arch/arm64/boot/dts/rockchip/rk3568-roc-pc.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3568-roc-pc.dts +@@ -48,17 +48,15 @@ + #clock-cells = <0>; + }; + +- leds { ++ firefly_leds: leds { + compatible = "gpio-leds"; +- +- led-user { +- label = "user-led"; ++ power_led: power { ++ label = "firefly:blue:power"; ++ linux,default-trigger = "ir-power-click"; + default-state = "on"; + gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; +- linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; +- pinctrl-0 = <&user_led_enable_h>; +- retain-state-suspended; ++ pinctrl-0 = <&led_power>; + }; + }; + +@@ -126,41 +124,134 @@ + vin-supply = <&dc_12v>; + }; + +- vcc5v0_usb: vcc5v0-usb-regulator { +- compatible = "regulator-fixed"; +- regulator-name = "vcc5v0_usb"; +- regulator-always-on; +- regulator-boot-on; +- regulator-min-microvolt = <5000000>; +- regulator-max-microvolt = <5000000>; +- vin-supply = <&vcc5v0_sys>; +- }; +- + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + enable-active-high; +- gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; ++ gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-always-on; +- vin-supply = <&vcc5v0_usb>; + }; + + vcc5v0_otg: vcc5v0-otg-regulator { + compatible = "regulator-fixed"; +- regulator-name = "vcc5v0_otg"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_otg_en>; +- vin-supply = <&vcc5v0_usb>; ++ regulator-name = "vcc5v0_otg"; + }; +-}; + +-&combphy0 { +- /* used for USB3 */ +- status = "okay"; ++ vcc2v5_sys: vcc2v5-ddr-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc2v5-sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <2500000>; ++ regulator-max-microvolt = <2500000>; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc_hub_power: vcc-hub-power-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_hub_power_en>; ++ regulator-name = "vcc_hub_power_en"; ++ regulator-always-on; ++ }; ++ ++ vcc_hub_reset: vcc-hub-reset-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_hub_reset_en>; ++ regulator-name = "vcc_hub_reset_en"; ++ regulator-always-on; ++ }; ++ ++ pcie_pi6c_oe: pcie-pi6c-oe-regulator { ++ compatible = "regulator-fixed"; ++ //enable-active-high; ++ gpio = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_pi6c_oe_en>; ++ regulator-name = "pcie_pi6c_oe_en"; ++ regulator-always-on; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ status = "okay"; ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk809 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ reset-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>; ++ post-power-on-delay-ms = <100>; ++ }; ++ ++ wireless_wlan: wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6275s"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_host_wake_irq>; ++ WIFI,host_wake_irq = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ wireless_bluetooth: wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ clocks = <&rk809 1>; ++ clock-names = "ext_clock"; ++ //wifi-bt-power-toggle; ++ uart_rts_gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart8m0_rtsn>; ++ pinctrl-1 = <&uart8_gpios>; ++ BT,reset_gpio = <&gpio3 RK_PA0 GPIO_ACTIVE_HIGH>; ++ BT,wake_gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>; ++ BT,wake_host_irq = <&gpio3 RK_PA2 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ flash_led: flash-led { ++ compatible = "led,rgb13h"; ++ label = "pwm-flash-led"; ++ led-max-microamp = <20000>; ++ flash-max-microamp = <20000>; ++ flash-max-timeout-us = <1000000>; ++ pwms = <&pwm11 0 25000 0>; ++ rockchip,camera-module-index = <1>; ++ rockchip,camera-module-facing = "front"; ++ status = "disabled"; ++ }; ++ ++ rk809-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "Analog RK809"; ++ simple-audio-card,mclk-fs = <256>; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1_8ch>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&rk809>; ++ }; ++ }; ++ ++ rk_headset: rk-headset { ++ compatible = "rockchip_headset"; ++ headset_gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hp_det>; ++ io-channels = <&saradc 2>; //HP_HOOK pin ++ }; + }; + + &combphy1 { +@@ -247,15 +338,59 @@ + &i2c0 { + status = "okay"; + ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ int-n-gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>; ++ fusb340-switch-gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_HIGH>; ++ vbus-5v-gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ vdd_cpu: regulator@1c { ++ compatible = "tcs,tcs4525"; ++ reg = <0x1c>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-reg"; ++ regulator-name = "vdd_cpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1390000>; ++ regulator-ramp-delay = <2300>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-boot-on; ++ regulator-always-on; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; ++ assigned-clocks = <&cru I2S1_MCLKOUT_TX>; ++ assigned-clock-rates = <12288000>; ++ assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pmic_int>; ++ clock-names = "mclk"; ++ clocks = <&cru I2S1_MCLKOUT_TX>; ++ pinctrl-names = "default", "pmic-sleep", ++ "pmic-power-off", "pmic-reset"; ++ pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; ++ + rockchip,system-power-controller; ++ #sound-dai-cells = <0>; ++ clock-output-names = "rk808-clkout1", "rk808-clkout2"; ++ //fb-inner-reg-idxs = <2>; ++ /* 1: rst regs (default in codes), 0: rst the pmic */ ++ pmic-reset-func = <0>; ++ /* not save the PMIC_POWER_EN register in uboot */ ++ not-save-power-en = <1>; ++ + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; +@@ -284,6 +419,8 @@ + }; + + vdd_gpu: DCDC_REG2 { ++ regulator-always-on; ++ regulator-boot-on; + regulator-name = "vdd_gpu"; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; +@@ -320,19 +457,9 @@ + }; + }; + +- vcc_1v8: DCDC_REG5 { +- regulator-name = "vcc_1v8"; +- regulator-always-on; +- regulator-boot-on; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1800000>; +- +- regulator-state-mem { +- regulator-off-in-suspend; +- }; +- }; +- + vdda0v9_image: LDO_REG1 { ++ regulator-boot-on; ++ regulator-always-on; + regulator-name = "vdda0v9_image"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; +@@ -368,6 +495,8 @@ + }; + + vccio_acodec: LDO_REG4 { ++ regulator-always-on; ++ regulator-boot-on; + regulator-name = "vccio_acodec"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +@@ -379,6 +508,8 @@ + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; ++ regulator-always-on; ++ regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + +@@ -426,6 +557,8 @@ + }; + + vcca1v8_image: LDO_REG9 { ++ regulator-always-on; ++ regulator-boot-on; + regulator-name = "vcca1v8_image"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +@@ -435,6 +568,17 @@ + }; + }; + ++ vcc_1v8: DCDC_REG5 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc_1v8"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; +@@ -455,6 +599,10 @@ + }; + }; + }; ++ ++ codec { ++ mic-in-differential; ++ }; + }; + }; + +@@ -477,7 +625,7 @@ + }; + + &pcie30phy { +- status = "okay"; ++ tatus = "okay"; + }; + + &pcie3x2 { +@@ -490,19 +638,27 @@ + + &pinctrl { + leds { +- user_led_enable_h: user-led-enable-h { +- rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ led_power: led-power { ++ rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { +- rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_otg_en: vcc5v0-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ ++ vcc_hub_power_en: vcc-hub-power-en { ++ rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ vcc_hub_reset_en: vcc-hub-reset-en { ++ rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + pcie { +@@ -512,21 +668,53 @@ + vcc3v3_pcie_en_pin: vcc3v3-pcie-en-pin { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; ++ pcie_pi6c_oe_en: pcie-pi6c-oe-en { ++ rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; + }; + + pmic { +- pmic_int: pmic-int { ++ pmic_int: pmic_int { + rockchip,pins = + <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-wlan { ++ wifi_host_wake_irq: wifi-host-wake-irq { ++ rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart8_gpios: uart8-gpios { ++ rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ headphone { ++ hp_det: hp-det { ++ rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; + }; + + &pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; +- vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; +@@ -548,25 +736,44 @@ + bus-width = <8>; + max-frequency = <200000000>; + non-removable; +- pinctrl-names = "default"; +- pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; ++ supports-emmc; + status = "okay"; + }; + + &sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; +- cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; +- pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; ++ max-frequency = <150000000>; ++ supports-sd; ++ cap-mmc-highspeed; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&sdmmc2 { ++ max-frequency = <150000000>; ++ supports-sdio; ++ bus-width = <4>; ++ disable-wp; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>; ++ sd-uhs-sdr104; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; + status = "okay"; + }; + + &tsadc { ++ rockchip,hw-tshut-mode = <1>; ++ rockchip,hw-tshut-polarity = <0>; + status = "okay"; + }; + +@@ -588,6 +795,7 @@ + }; + + &usb2phy0_otg { ++ vbus-supply = <&vcc5v0_otg>; + status = "okay"; + }; + +@@ -609,6 +817,10 @@ + status = "okay"; + }; + ++&usb_host0_xhci { ++ status = "okay"; ++}; ++ + &usb_host1_ehci { + status = "okay"; + }; +@@ -617,11 +829,13 @@ + status = "okay"; + }; + +-&usb_host0_xhci { ++&usb_host1_xhci { + status = "okay"; + }; + +-&usb_host1_xhci { ++&vop { ++ assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; ++ assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; + }; + +@@ -632,12 +846,68 @@ + }; + }; + +-&vop { +- assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; +- assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; ++&vop_mmu { + status = "okay"; + }; + +-&vop_mmu { ++&i2s1_8ch { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s1m0_sclktx ++ &i2s1m0_lrcktx ++ &i2s1m0_sdi0 ++ &i2s1m0_sdo0>; ++ rockchip,trcm-sync-tx-only; ++ status = "okay"; ++}; ++ ++&i2c1 { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ status = "okay"; ++}; ++ ++&i2c5 { ++ status = "okay"; ++}; ++ ++&gic { ++ status = "okay"; ++}; ++ ++&uart3 { ++// status = "disabled"; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&uart4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart4m1_xfer>; ++ status = "okay"; ++}; ++ ++&uart8 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart8m0_xfer &uart8m0_ctsn>; ++}; ++ ++&rk809 { ++ rtc { ++ status = "disabled"; ++ }; ++}; ++ ++&pwm4 { ++ status = "okay"; ++}; ++ ++&pwm5 { ++ status = "okay"; ++}; ++ ++&pwm7 { + status = "okay"; + }; diff --git a/patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch b/patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch new file mode 100644 index 000000000000..80987aa16384 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/drv-spi-spidev-remove-warnings.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Doe +Date: Wed, 14 Aug 2024 16:33:07 +0000 +Subject: rockchip64: edge: 6.10.5 drv:spi:spidev remove warnings + +Signed-off-by: John Doe +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 5304728c6..64c4280de 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -698,10 +698,11 @@ static const struct file_operations spidev_fops = { + static const struct class spidev_class = { + .name = "spidev", + }; + + static const struct spi_device_id spidev_spi_ids[] = { ++ { .name = "spi-dev" }, + { .name = "bh2228fv" }, + { .name = "dh2228fv" }, + { .name = "ltc2488" }, + { .name = "sx1301" }, + { .name = "bk4" }, +@@ -727,10 +728,11 @@ static int spidev_of_check(struct device *dev) + dev_err(dev, "spidev listed directly in DT is not supported\n"); + return -EINVAL; + } + + static const struct of_device_id spidev_dt_ids[] = { ++ { .compatible = "armbian,spi-dev", .data = &spidev_of_check }, + { .compatible = "cisco,spi-petra", .data = &spidev_of_check }, + { .compatible = "dh,dhcom-board", .data = &spidev_of_check }, + { .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check }, + { .compatible = "lwn,bk4", .data = &spidev_of_check }, + { .compatible = "menlo,m53cpld", .data = &spidev_of_check }, +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts new file mode 100644 index 000000000000..7d942a8f5e54 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3308-sakurapi-rk3308b.dts @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Akash Gajjar + * Copyright (c) 2019 Jagan Teki + * Copyright (C) 2024 Chiyuki Akatsuki + */ + +/dts-v1/; +#include "rk3308.dtsi" + +/ { + model = "Sakura Pi RK3308B"; + compatible = "rockchip,rk3308"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vdd_core: vdd-core { + compatible = "pwm-regulator"; + pwms = <&pwm0 0 5000 1>; + regulator-name = "vdd_core"; + regulator-min-microvolt = <827000>; + regulator-max-microvolt = <1340000>; + regulator-init-microvolt = <1015000>; + regulator-settling-time-up-us = <250>; + regulator-always-on; + regulator-boot-on; + pwm-supply = <&vcc5v0_sys>; + }; + + vdd_log: vdd-log { + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_ddr: vcc-ddr { + compatible = "regulator-fixed"; + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_io>; + }; + + vcc_io: vcc-io { + compatible = "regulator-fixed"; + regulator-name = "vcc_io"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_otg: vcc5v0-otg { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_otg"; + regulator-always-on; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-names = "default"; + pinctrl-0 = <&otg_vbus_drv>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_core>; +}; + +&emmc { + bus-width = <8>; + cap-mmc-highspeed; + non-removable; + status = "okay"; +}; + +&i2c1 { + status = "okay"; +}; + +&sdmmc { + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det &sdmmc_bus4>; + card-detect-delay = <800>; + status = "okay"; +}; + +&sdio { + #address-cells = <1>; + #size-cells = <0>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + no-mmc; + status = "okay"; + + brcmf: wifi@1 { + compatible = "brcm,bcm43455-fmac"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake>; + }; +}; + +&spi2 { + status = "okay"; + max-freq = <10000000>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&rtc_32k>; + + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake: wifi-host-wake { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_pin_pull_down>; +}; + +&saradc { + vref-supply = <&vcc_1v8>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&usb20_otg { + status = "okay"; +}; + +&u2phy { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&u2phy_host { + state = "okay"; +}; + +&usb_host_ehci { + status = "okay"; +}; + +&usb_host_ohci{ + status = "okay"; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts new file mode 100644 index 000000000000..8024338b41f5 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3318-box.dts @@ -0,0 +1,1007 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2020 Paolo Sabatino + */ + +/dts-v1/; +#include "dt-bindings/pwm/pwm.h" +#include "dt-bindings/input/input.h" +#include +#include +#include "rk3328.dtsi" + +/ { + model = "Rockchip RK3318 BOX"; + compatible = "rockchip,rk3318-box", "rockchip,rk3328-box", "rockchip,rk3328"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdio; + mmc2 = &emmc; + mmc3 = &sdmmc_ext; + mmc4 = &sdio_ext; + }; + + /delete-node/ opp-table-0; + /delete-node/ gpu-opp-table; + + cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <950000>; + clock-latency-ns = <40000>; + opp-suspend; + }; + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1000000>; + clock-latency-ns = <40000>; + }; + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1100000>; + clock-latency-ns = <40000>; + }; + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <1200000>; + clock-latency-ns = <40000>; + status = "disabled"; + }; + opp-1296000000 { + opp-hz = /bits/ 64 <1296000000>; + opp-microvolt = <1275000>; + clock-latency-ns = <40000>; + status = "disabled"; + }; + }; + + gpu_opp_table: gpu-opp-table { + compatible = "operating-points-v2"; + + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + opp-microvolt = <1000000 950000 1200000>; + }; + + opp-300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <1050000 950000 1200000>; + }; + + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + opp-microvolt = <1050000 950000 1200000>; + }; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <1100000 950000 1200000>; + }; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + adc_keys: adc-keys { + + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + recovery { + label = "recovery"; + linux,code = ; + press-threshold-microvolt = <17000>; + }; + + }; + + xin32k: xin32k { + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + #clock-cells = <0>; + }; + + gmac_clkin: gmac-clkin { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac_clkin"; + #clock-cells = <0x00>; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <0x01>; + #size-cells = <0x00>; + + vcc_18: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vccio_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + vcc_io: regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "vccio_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + 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>; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0m1_pin>; + regulator-name = "vcc_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io>; + }; + + /* + * USB3 vbus + */ + vcc_host_vbus: vcc-host-vbus { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_host_drv>; + regulator-name = "vcc_host_vbus"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + }; + + /* + * USB2 OTG vbus + */ + vcc_otg_vbus: vcc-otg-vbus { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb20_host_drv>; + regulator-name = "vcc_otg_vbus"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + }; + + vdd_arm: vdd-arm { + compatible = "pwm-regulator"; + pwms = <&pwm0 0 5000 PWM_POLARITY_INVERTED>; + pwm-supply = <&vcc_sys>; + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1400000>; + regulator-ramp-delay = <12500>; + regulator-settling-time-up-us = <250>; + regulator-always-on; + regulator-boot-on; + }; + + vdd_logic: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm1 0 5000 PWM_POLARITY_INVERTED>; + pwm-supply = <&vcc_sys>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1300000>; + regulator-ramp-delay = <12500>; + regulator-settling-time-up-us = <250>; + regulator-always-on; + regulator-boot-on; + }; + + gpio_led: gpio-leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + pinctrl-0 = <&working_led>; + + working { + gpios = <&gpio2 RK_PC7 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "timer"; + default-state = "on"; + }; + + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&ir_int>; + pinctrl-names = "default"; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + + /* + wireless-bluetooth { + compatible = "bluetooth-platdata"; + uart_rts_gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default", "rts_gpio"; + pinctrl-0 = <&uart0_rts>; + pinctrl-1 = <&uart0_rts_gpio>; + BT,power_gpio = <&gpio1 RK_PC5 GPIO_ACTIVE_HIGH>; + BT,wake_host_irq = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; + }; + + wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "ap6330"; + sdio_vref = <1800>; + WIFI,host_wake_irq = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>; + }; + */ + + fd628_dev { + compatible = "fd628_dev"; + fd628_gpio_clk = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + fd628_gpio_dat = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + analog-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "ANALOG"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + + simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; + + hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <128>; + simple-audio-card,name = "HDMI"; + + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + }; + + /* + * This node is a duplicate of sdmmc_ext: most common board do not use sdmmc_ext + * controller, so it is left unused. Some other boards use it as sdio controller + * for wifi and some others use it as sdcard controller. + * To handle the most critical situation, the controller will be configured as + * sdcard controller by default. An overlay can be set to disable the sdmmc_ext + * node and enable this sdio_ext in case wifi chips are attached to this. + */ + sdio_ext: mmc@ff5f0000 { + compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff5f0000 0x0 0x4000>; + interrupts = ; + clocks = <&cru HCLK_SDMMC_EXT>, <&cru SCLK_SDMMC_EXT>, + <&cru SCLK_SDMMC_EXT_DRV>, <&cru SCLK_SDMMC_EXT_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; + fifo-depth = <0x100>; + max-frequency = <150000000>; + resets = <&cru SRST_SDMMCEXT>; + reset-names = "reset"; + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <>; + non-removable; + num-slots = <1>; + pinctrl-0 = <&sdmmc0ext_cmd &sdmmc0ext_clk &sdmmc0ext_bus4>; + pinctrl-names = "default"; + supports-sdio; + status = "disabled"; + }; + + ddr_timing: ddr_timing { + compatible = "rockchip,ddr-timing"; + ddr3_speed_bin = ; + ddr4_speed_bin = ; + pd_idle = <0>; + sr_idle = <0>; + sr_mc_gate_idle = <0>; + srpd_lite_idle = <0>; + standby_idle = <0>; + + auto_pd_dis_freq = <1066>; + auto_sr_dis_freq = <800>; + ddr3_dll_dis_freq = <300>; + ddr4_dll_dis_freq = <625>; + phy_dll_dis_freq = <400>; + + ddr3_odt_dis_freq = <100>; + phy_ddr3_odt_dis_freq = <100>; + ddr3_drv = ; + ddr3_odt = ; + phy_ddr3_ca_drv = ; + phy_ddr3_ck_drv = ; + phy_ddr3_dq_drv = ; + phy_ddr3_odt = ; + + lpddr3_odt_dis_freq = <666>; + phy_lpddr3_odt_dis_freq = <666>; + lpddr3_drv = ; + lpddr3_odt = ; + phy_lpddr3_ca_drv = ; + phy_lpddr3_ck_drv = ; + phy_lpddr3_dq_drv = ; + phy_lpddr3_odt = ; + + lpddr4_odt_dis_freq = <800>; + phy_lpddr4_odt_dis_freq = <800>; + lpddr4_drv = ; + lpddr4_dq_odt = ; + lpddr4_ca_odt = ; + phy_lpddr4_ca_drv = ; + phy_lpddr4_ck_cs_drv = ; + phy_lpddr4_dq_drv = ; + phy_lpddr4_odt = ; + + ddr4_odt_dis_freq = <666>; + phy_ddr4_odt_dis_freq = <666>; + ddr4_drv = ; + ddr4_odt = ; + phy_ddr4_ca_drv = ; + phy_ddr4_ck_drv = ; + phy_ddr4_dq_drv = ; + phy_ddr4_odt = ; + + /* CA de-skew, one step is 47.8ps, range 0-15 */ + ddr3a1_ddr4a9_de-skew = <2>; + ddr3a0_ddr4a10_de-skew = <3>; + ddr3a3_ddr4a6_de-skew = <3>; + ddr3a2_ddr4a4_de-skew = <2>; + ddr3a5_ddr4a8_de-skew = <3>; + ddr3a4_ddr4a5_de-skew = <2>; + ddr3a7_ddr4a11_de-skew = <3>; + ddr3a6_ddr4a7_de-skew = <2>; + ddr3a9_ddr4a0_de-skew = <2>; + ddr3a8_ddr4a13_de-skew = <1>; + ddr3a11_ddr4a3_de-skew = <2>; + ddr3a10_ddr4cs0_de-skew = <2>; + ddr3a13_ddr4a2_de-skew = <1>; + ddr3a12_ddr4ba1_de-skew = <2>; + ddr3a15_ddr4odt0_de-skew = <3>; + ddr3a14_ddr4a1_de-skew = <2>; + ddr3ba1_ddr4a15_de-skew = <2>; + ddr3ba0_ddr4bg0_de-skew = <4>; + ddr3ras_ddr4cke_de-skew = <4>; + ddr3ba2_ddr4ba0_de-skew = <3>; + ddr3we_ddr4bg1_de-skew = <2>; + ddr3cas_ddr4a12_de-skew = <2>; + ddr3ckn_ddr4ckn_de-skew = <11>; + ddr3ckp_ddr4ckp_de-skew = <11>; + ddr3cke_ddr4a16_de-skew = <2>; + ddr3odt0_ddr4a14_de-skew = <4>; + ddr3cs0_ddr4act_de-skew = <4>; + ddr3reset_ddr4reset_de-skew = <7>; + ddr3cs1_ddr4cs1_de-skew = <7>; + ddr3odt1_ddr4odt1_de-skew = <7>; + + /* DATA de-skew + * RX one step is 25.1ps, range 0-15 + * TX one step is 47.8ps, range 0-15 + */ + cs0_dm0_rx_de-skew = <12>; + cs0_dm0_tx_de-skew = <10>; + cs0_dq0_rx_de-skew = <12>; + cs0_dq0_tx_de-skew = <10>; + cs0_dq1_rx_de-skew = <12>; + cs0_dq1_tx_de-skew = <10>; + cs0_dq2_rx_de-skew = <12>; + cs0_dq2_tx_de-skew = <10>; + cs0_dq3_rx_de-skew = <12>; + cs0_dq3_tx_de-skew = <10>; + cs0_dq4_rx_de-skew = <12>; + cs0_dq4_tx_de-skew = <10>; + cs0_dq5_rx_de-skew = <12>; + cs0_dq5_tx_de-skew = <10>; + cs0_dq6_rx_de-skew = <12>; + cs0_dq6_tx_de-skew = <10>; + cs0_dq7_rx_de-skew = <12>; + cs0_dq7_tx_de-skew = <10>; + cs0_dqs0_rx_de-skew = <10>; + cs0_dqs0p_tx_de-skew = <12>; + cs0_dqs0n_tx_de-skew = <12>; + + cs0_dm1_rx_de-skew = <10>; + cs0_dm1_tx_de-skew = <8>; + cs0_dq8_rx_de-skew = <10>; + cs0_dq8_tx_de-skew = <8>; + cs0_dq9_rx_de-skew = <10>; + cs0_dq9_tx_de-skew = <8>; + cs0_dq10_rx_de-skew = <10>; + cs0_dq10_tx_de-skew = <8>; + cs0_dq11_rx_de-skew = <10>; + cs0_dq11_tx_de-skew = <8>; + cs0_dq12_rx_de-skew = <10>; + cs0_dq12_tx_de-skew = <8>; + cs0_dq13_rx_de-skew = <10>; + cs0_dq13_tx_de-skew = <8>; + cs0_dq14_rx_de-skew = <10>; + cs0_dq14_tx_de-skew = <8>; + cs0_dq15_rx_de-skew = <10>; + cs0_dq15_tx_de-skew = <8>; + cs0_dqs1_rx_de-skew = <9>; + cs0_dqs1p_tx_de-skew = <10>; + cs0_dqs1n_tx_de-skew = <10>; + + cs0_dm2_rx_de-skew = <10>; + cs0_dm2_tx_de-skew = <9>; + cs0_dq16_rx_de-skew = <10>; + cs0_dq16_tx_de-skew = <9>; + cs0_dq17_rx_de-skew = <10>; + cs0_dq17_tx_de-skew = <9>; + cs0_dq18_rx_de-skew = <10>; + cs0_dq18_tx_de-skew = <9>; + cs0_dq19_rx_de-skew = <10>; + cs0_dq19_tx_de-skew = <9>; + cs0_dq20_rx_de-skew = <10>; + cs0_dq20_tx_de-skew = <9>; + cs0_dq21_rx_de-skew = <10>; + cs0_dq21_tx_de-skew = <9>; + cs0_dq22_rx_de-skew = <10>; + cs0_dq22_tx_de-skew = <9>; + cs0_dq23_rx_de-skew = <10>; + cs0_dq23_tx_de-skew = <9>; + cs0_dqs2_rx_de-skew = <9>; + cs0_dqs2p_tx_de-skew = <11>; + cs0_dqs2n_tx_de-skew = <11>; + + cs0_dm3_rx_de-skew = <7>; + cs0_dm3_tx_de-skew = <7>; + cs0_dq24_rx_de-skew = <7>; + cs0_dq24_tx_de-skew = <7>; + cs0_dq25_rx_de-skew = <7>; + cs0_dq25_tx_de-skew = <7>; + cs0_dq26_rx_de-skew = <7>; + cs0_dq26_tx_de-skew = <7>; + cs0_dq27_rx_de-skew = <7>; + cs0_dq27_tx_de-skew = <7>; + cs0_dq28_rx_de-skew = <7>; + cs0_dq28_tx_de-skew = <7>; + cs0_dq29_rx_de-skew = <7>; + cs0_dq29_tx_de-skew = <7>; + cs0_dq30_rx_de-skew = <7>; + cs0_dq30_tx_de-skew = <7>; + cs0_dq31_rx_de-skew = <7>; + cs0_dq31_tx_de-skew = <7>; + cs0_dqs3_rx_de-skew = <7>; + cs0_dqs3p_tx_de-skew = <10>; + cs0_dqs3n_tx_de-skew = <10>; + + cs1_dm0_rx_de-skew = <7>; + cs1_dm0_tx_de-skew = <8>; + cs1_dq0_rx_de-skew = <7>; + cs1_dq0_tx_de-skew = <8>; + cs1_dq1_rx_de-skew = <7>; + cs1_dq1_tx_de-skew = <8>; + cs1_dq2_rx_de-skew = <7>; + cs1_dq2_tx_de-skew = <8>; + cs1_dq3_rx_de-skew = <7>; + cs1_dq3_tx_de-skew = <8>; + cs1_dq4_rx_de-skew = <7>; + cs1_dq4_tx_de-skew = <8>; + cs1_dq5_rx_de-skew = <7>; + cs1_dq5_tx_de-skew = <8>; + cs1_dq6_rx_de-skew = <7>; + cs1_dq6_tx_de-skew = <8>; + cs1_dq7_rx_de-skew = <7>; + cs1_dq7_tx_de-skew = <8>; + cs1_dqs0_rx_de-skew = <6>; + cs1_dqs0p_tx_de-skew = <9>; + cs1_dqs0n_tx_de-skew = <9>; + + cs1_dm1_rx_de-skew = <7>; + cs1_dm1_tx_de-skew = <7>; + cs1_dq8_rx_de-skew = <7>; + cs1_dq8_tx_de-skew = <8>; + cs1_dq9_rx_de-skew = <7>; + cs1_dq9_tx_de-skew = <7>; + cs1_dq10_rx_de-skew = <7>; + cs1_dq10_tx_de-skew = <8>; + cs1_dq11_rx_de-skew = <7>; + cs1_dq11_tx_de-skew = <7>; + cs1_dq12_rx_de-skew = <7>; + cs1_dq12_tx_de-skew = <8>; + cs1_dq13_rx_de-skew = <7>; + cs1_dq13_tx_de-skew = <7>; + cs1_dq14_rx_de-skew = <7>; + cs1_dq14_tx_de-skew = <8>; + cs1_dq15_rx_de-skew = <7>; + cs1_dq15_tx_de-skew = <7>; + cs1_dqs1_rx_de-skew = <7>; + cs1_dqs1p_tx_de-skew = <9>; + cs1_dqs1n_tx_de-skew = <9>; + + cs1_dm2_rx_de-skew = <7>; + cs1_dm2_tx_de-skew = <8>; + cs1_dq16_rx_de-skew = <7>; + cs1_dq16_tx_de-skew = <8>; + cs1_dq17_rx_de-skew = <7>; + cs1_dq17_tx_de-skew = <8>; + cs1_dq18_rx_de-skew = <7>; + cs1_dq18_tx_de-skew = <8>; + cs1_dq19_rx_de-skew = <7>; + cs1_dq19_tx_de-skew = <8>; + cs1_dq20_rx_de-skew = <7>; + cs1_dq20_tx_de-skew = <8>; + cs1_dq21_rx_de-skew = <7>; + cs1_dq21_tx_de-skew = <8>; + cs1_dq22_rx_de-skew = <7>; + cs1_dq22_tx_de-skew = <8>; + cs1_dq23_rx_de-skew = <7>; + cs1_dq23_tx_de-skew = <8>; + cs1_dqs2_rx_de-skew = <6>; + cs1_dqs2p_tx_de-skew = <9>; + cs1_dqs2n_tx_de-skew = <9>; + + cs1_dm3_rx_de-skew = <7>; + cs1_dm3_tx_de-skew = <7>; + cs1_dq24_rx_de-skew = <7>; + cs1_dq24_tx_de-skew = <8>; + cs1_dq25_rx_de-skew = <7>; + cs1_dq25_tx_de-skew = <7>; + cs1_dq26_rx_de-skew = <7>; + cs1_dq26_tx_de-skew = <7>; + cs1_dq27_rx_de-skew = <7>; + cs1_dq27_tx_de-skew = <7>; + cs1_dq28_rx_de-skew = <7>; + cs1_dq28_tx_de-skew = <7>; + cs1_dq29_rx_de-skew = <7>; + cs1_dq29_tx_de-skew = <7>; + cs1_dq30_rx_de-skew = <7>; + cs1_dq30_tx_de-skew = <7>; + cs1_dq31_rx_de-skew = <7>; + cs1_dq31_tx_de-skew = <7>; + cs1_dqs3_rx_de-skew = <7>; + cs1_dqs3p_tx_de-skew = <9>; + cs1_dqs3n_tx_de-skew = <9>; + }; + +}; + +&dfi { + status = "okay"; +}; + +&dmc { + center-supply = <&vdd_logic>; + ddr_timing = <&ddr_timing>; + status = "disabled"; +}; + +&codec { + status = "okay"; + mute-gpios = <&grf_gpio 0 GPIO_ACTIVE_LOW>; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&display_subsystem { + status = "okay"; +}; + +&emmc { + + supports-emmc; + no-sdio; + no-sd; + cap-mmc-highspeed; + disable-wp; + non-removable; + bus-width = <8>; + num-slots = <0x01>; + + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; + + vmmc-supply = <&vcc_io>; + vqmmc-supply = <&vcc_18>; + + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + card-detect-delay = <500>; + cd-gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + disable-wp; + no-sdio; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; + supports-sd; + status = "okay"; + vmmc-supply = <&vcc_sd>; +}; + +&sdio { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + supports-sdio; + status = "okay"; +}; + +/* + * sdmmc_ext is configured as sdcard controller and enabled by default. + * In this way boards which have the sdcard attached to sdmmc_ext will work + * by default. In case the controller is not attached to anything, the + * kernel will just autodetect and give up. + */ +&sdmmc_ext { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + card-detect-delay = <500>; + cd-gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; + disable-wp; + no-sdio; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0ext_clk &sdmmc0ext_cmd &sdmmc0ext_dectn &sdmmc0ext_bus4>; + supports-sd; + status = "okay"; + vmmc-supply = <&vcc_sd>; +}; + +&gmac2phy { + phy-supply = <&vcc_phy>; + + phy-mode = "rmii"; + + clock_in_out = "output"; + assigned-clocks = <&cru SCLK_MAC2PHY>; + assigned-clock-rate = <50000000>; + assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; + tx_delay = <0x30>; + rx_delay = <0x10>; + + status = "okay"; + +}; + +&gpu { + status = "okay"; + mali-supply = <&vdd_logic>; +}; + +/* +&h265e { + status = "okay"; +}; +*/ + +&h265e_mmu { + status = "okay"; +}; + +&hdmi { + status = "okay"; +}; + +&spdif { + pinctrl-0 = <&spdifm0_tx>; + status = "okay"; +}; + +&spdif_out { + status = "okay"; +}; + +&spdif_sound { + status = "okay"; +}; + +&hdmiphy { + status = "okay"; +}; + +&i2s0 { + status = "okay"; +}; + +&i2s1 { + status = "okay"; +}; + +&io_domains { + status = "okay"; + + vccio1-supply = <&vcc_io>; + vccio2-supply = <&vcc_18>; + vccio3-supply = <&vcc_io>; + vccio4-supply = <&vcc_18>; + vccio5-supply = <&vcc_io>; + vccio6-supply = <&vcc_io>; + pmuio-supply = <&vcc_io>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&clk_32k_out>; + + clk_32k { + clk_32k_out: clk-32k-out { + rockchip,pins = <1 RK_PD4 1 &pcfg_pull_none>; + }; + }; + + leds { + working_led: working-led { + rockchip,pins = <2 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none_2ma>; + }; + }; + + 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>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none_4ma>;/*, + <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none_4ma>;*/ + }; + }; + + usb2 { + usb20_host_drv: usb20-host-drv { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb3 { + usb30_host_drv: usb30-host-drv { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + + /* + * SDIO host wake interrupt on YX_RK3328 board (sdio is attached to + * regular mmc controller mmc@ff510000) + */ + sdio_host_wake: sdio-host-wake { + rockchip,pins = <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + /* + * SDIO host wake interrupt on X88_PRO_B board (sdio is attached to + * alternative mmc controller mmc@ff5f0000) + */ + sdio_host_wake_ext: sdio-host-wake-ext { + rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + }; + +}; + +/* +&vdec { + status = "okay"; + vcodec-supply = <&vdd_logic>; +}; +*/ + +&vdec_mmu { + status = "okay"; +}; + +&threshold { + temperature = <80000>; /* millicelsius */ +}; + +&target { + temperature = <95000>; /* millicelsius */ +}; + +&soc_crit { + temperature = <100000>; /* millicelsius */ +}; + +&tsadc { + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart0 { + + status = "okay"; + +}; + +&uart2 { + /delete-property/ dmas; + /delete-property/ dma-names; + + status = "okay"; +}; + +&u2phy { + status = "okay"; + + u2phy_host: host-port { + status = "okay"; + }; + + u2phy_otg: otg-port { + status = "okay"; + }; +}; + +&usb20_otg { + dr_mode = "host"; + resets = <&cru SRST_USB2OTG>; + reset-names = "dwc2"; + status = "okay"; +}; + +&usb_host0_ehci { + resets = <&cru SRST_USB2HOST_EHCIPHY>; + reset-names = "ehci"; + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usbdrd3 { + #address-cells = <1>; + #size-cells = <0>; + dr_mode = "host"; + status = "okay"; +}; + +&vop { + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vpu { + status = "okay"; + vcodec-supply = <&vdd_logic>; +}; + +&vpu_mmu { + status = "okay"; +}; + +/* +&vepu { + status = "okay"; +}; +*/ + +&vepu_mmu { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_18>; + status = "okay"; +}; + +/* +&rga { + status = "okay"; +}; +*/ + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&analog_sound { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-heltec.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-heltec.dts new file mode 100755 index 000000000000..1cb919d9adba --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-heltec.dts @@ -0,0 +1,288 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd + */ + +/dts-v1/; +#include "rk3328.dtsi" + +/ { + model = "Rockchip RK3328 Heltec"; + compatible = "rockchip,rk3328-evb", "rockchip,rk3328"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdio; + mmc2 = &emmc; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + 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>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio1 18 GPIO_ACTIVE_LOW>; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0m1_pin>; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io>; + }; + + 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>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; +}; + +&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; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; + status = "okay"; +}; + +&gmac2phy { + phy-supply = <&vcc_phy>; + clock_in_out = "output"; + assigned-clock-rate = <50000000>; + assigned-clocks = <&cru SCLK_MAC2PHY>; + assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; + status = "okay"; +}; + +&i2c1 { + status = "okay"; + + rk805: pmic@18 { + compatible = "rockchip,rk805"; + reg = <0x18>; + interrupt-parent = <&gpio2>; + 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; + wakeup-source; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; + vcc3-supply = <&vcc_sys>; + vcc4-supply = <&vcc_sys>; + vcc5-supply = <&vcc_io>; + vcc6-supply = <&vcc_io>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_io: DCDC_REG4 { + regulator-name = "vcc_io"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_18: LDO_REG1 { + regulator-name = "vcc_18"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc18_emmc: LDO_REG2 { + regulator-name = "vcc18_emmc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_10: LDO_REG3 { + regulator-name = "vdd_10"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + }; + }; +}; + +&pinctrl { + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = + <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&sdio { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + max-frequency = <150000000>; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; + vmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&u2phy { + status = "okay"; +}; + +&u2phy_host { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&usb20_otg { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts new file mode 100644 index 000000000000..496e334d3030 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-neo3-rev02.dts @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; +#include +#include "rk3328-nanopi-r2s.dts" + +/ { + model = "FriendlyElec NanoPi NEO3"; + compatible = "friendlyelec,nanopi-neo3", "rockchip,rk3328"; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&gpio_key1>; + + button@0 { + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + i2s-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "I2S Out"; + status = "okay"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + + simple-audio-card,codec { + sound-dai = <&pcm5102>; + }; + }; + + pcm5102: pcm510x { + #sound-dai-cells = <0>; + compatible = "ti,pcm5102a"; + pcm510x,format = "i2s"; + }; + + sound-spdif { + compatible = "simple-audio-card"; + simple-audio-card,name = "SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + vcc_rtl8153: vcc-rtl8153-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_en_drv>; + regulator-always-on; + regulator-name = "vcc_rtl8153"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + off-on-delay-us = <5000>; + enable-active-high; + }; +}; + +&mach { + hwrev = <2>; + model = "NanoPi NEO3"; +}; + +&i2s1 { + rockchip,playback-channels = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1_mclk + &i2s1_sclk + &i2s1_lrcktx + &i2s1_lrckrx + &i2s1_sdo + &i2s1_sdi>; + status = "okay"; +}; + +&spdif { + status = "okay"; + pinctrl-0 = <&spdifm0_tx>; +}; + +&emmc { + status = "disabled"; +}; + +&i2c0 { + status = "okay"; +}; + +&leds { + status = "okay"; + +}; + +&leds_gpio { + rockchip,pins = + <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; +}; + +&pwm2 { + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&pwm2_sleep_pin>; + status = "okay"; +}; + +&rk805 { + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&vccio_sd { + status = "okay"; +}; + +&io_domains { + vccio3-supply = <&vccio_sd>; +}; + +&sdmmc { + vqmmc-supply = <&vccio_sd>; + max-frequency = <150000000>; + sd-uhs-sdr50; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc_ext { + status = "disabled"; +}; + +&sdio_pwrseq { + status = "disabled"; +}; + +&pinctrl { + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + pwm { + pwm2_sleep_pin: pwm2-sleep-pin { + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + rockchip-key { + gpio_key1: gpio-key1 { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usb30_en_drv: usb30-en-drv { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&uart1{ + status = "okay"; + pinctl-0 = <&uart1_xfer>; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts new file mode 100644 index 000000000000..8ba95189c031 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev00.dts @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; +#include +#include "rk3328-nanopi-r2s.dts" + +/ { + model = "FriendlyElec NanoPi R2S"; + compatible = "friendlyelec,nanopi-r2", "rockchip,rk3328"; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&gpio_key1>; + + button@0 { + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + vcc_rtl8153: vcc-rtl8153-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb30_en_drv>; + regulator-always-on; + regulator-name = "vcc_rtl8153"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + off-on-delay-us = <5000>; + enable-active-high; + }; +}; + +&mach { + hwrev = <0>; + model = "NanoPi R2S"; +}; + +&emmc { + status = "disabled"; +}; + +&i2c0 { + status = "okay"; +}; + +&leds { + status = "okay"; + + led@2 { + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + label = "lan_led"; + }; + + led@3 { + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; + label = "wan_led"; + }; +}; + +&rk805 { + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&vccio_sd { + status = "okay"; +}; + +&io_domains { + vccio3-supply = <&vccio_sd>; +}; + +&sdmmc { + vqmmc-supply = <&vccio_sd>; + max-frequency = <150000000>; + sd-uhs-sdr50; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc_ext { + status = "disabled"; +}; + +&sdio_pwrseq { + status = "disabled"; +}; + +&pinctrl { + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + rockchip-key { + gpio_key1: gpio-key1 { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + otg_vbus_drv: otg-vbus-drv { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + usb30_en_drv: usb30-en-drv { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts new file mode 100644 index 000000000000..5de8b51db0bf --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev06.dts @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2021 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; + +#include "rk3328-nanopi-r2-rev00.dts" + +/ { + model = "FriendlyElec NanoPi R2C"; + compatible = "friendlyelec,nanopi-r2", "rockchip,rk3328"; +}; + +&mach { + hwrev = <6>; + model = "NanoPi R2C"; +}; + +&rgmiim1_pins { + rockchip,pins = + /* mac_txclk */ + <1 RK_PB4 2 &pcfg_pull_none_8ma>, + /* mac_rxclk */ + <1 RK_PB5 2 &pcfg_pull_none>, + /* mac_mdio */ + <1 RK_PC3 2 &pcfg_pull_none_2ma>, + /* mac_txen */ + <1 RK_PD1 2 &pcfg_pull_none_8ma>, + /* mac_clk */ + <1 RK_PC5 2 &pcfg_pull_none_2ma>, + /* mac_rxdv */ + <1 RK_PC6 2 &pcfg_pull_none>, + /* mac_mdc */ + <1 RK_PC7 2 &pcfg_pull_none_2ma>, + /* mac_rxd1 */ + <1 RK_PB2 2 &pcfg_pull_none>, + /* mac_rxd0 */ + <1 RK_PB3 2 &pcfg_pull_none>, + /* mac_txd1 */ + <1 RK_PB0 2 &pcfg_pull_none_8ma>, + /* mac_txd0 */ + <1 RK_PB1 2 &pcfg_pull_none_8ma>, + /* mac_rxd3 */ + <1 RK_PB6 2 &pcfg_pull_none>, + /* mac_rxd2 */ + <1 RK_PB7 2 &pcfg_pull_none>, + /* mac_txd3 */ + <1 RK_PC0 2 &pcfg_pull_none_8ma>, + /* mac_txd2 */ + <1 RK_PC1 2 &pcfg_pull_none_8ma>, + + /* mac_txclk */ + <0 RK_PB0 1 &pcfg_pull_none>, + /* mac_txen */ + <0 RK_PB4 1 &pcfg_pull_none>, + /* mac_clk */ + <0 RK_PD0 1 &pcfg_pull_none>, + /* mac_txd1 */ + <0 RK_PC0 1 &pcfg_pull_none>, + /* mac_txd0 */ + <0 RK_PC1 1 &pcfg_pull_none>, + /* mac_txd3 */ + <0 RK_PC7 1 &pcfg_pull_none>, + /* mac_txd2 */ + <0 RK_PC6 1 &pcfg_pull_none>; +}; + +/delete-node/ &rtl8211e; + +&gmac2io { + phy-handle = <ðphy3>; + snps,reset-delays-us = <0 15000 50000>; + tx_delay = <0x22>; + rx_delay = <0x12>; + mdio { + + ethphy3: ethernet-phy@3 { + compatible = "ethernet-phy-id0000.011a", + "ethernet-phy-ieee802.3-c22"; + reg = <3>; + interrupt-parent = <&gpio2>; + interrupts = ; + //reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + motorcomm,clk-out-frequency-hz = <125000000>; // enable gmac clock + motorcomm,keep-pll-enabled; // keep pll run without link + motorcomm,auto-sleep-disabled; // disable sleep without link + keep-clkout-on; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts new file mode 100644 index 000000000000..ad327ca56858 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-nanopi-r2-rev20.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + */ + +/dts-v1/; +#include "rk3328-nanopi-r2s.dts" + +/ { + model = "FriendlyElec NanoPi R2"; + compatible = "friendlyelec,nanopi-r2", "rockchip,rk3328"; +}; + +&mach { + hwrev = <0x20>; + model = "NanoPi R2"; +}; + +&gmac2io { + pinctrl-0 = <&rgmiim1_pins>, <&phy_intb>, <&phy_rstb>; +}; + +&rtl8211e { + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&pinctrl { + phy { + phy_intb: phy-intb { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + phy_rstb: phy-rstb { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts new file mode 100644 index 000000000000..4e944e0c1908 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-orangepi-r1-plus-lts.dts @@ -0,0 +1,449 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* Copyright (c) 2020 David Bauer + * Copyright (c) 2020 Shenzhen Xunlong Software CO.,Limited + * Copyright (c) 2021 AmadeusGhost + * Revised for Orange Pi R1 Plus LTS (c) 2022 schwar3kat + * Based on Orange Pi R1 plus + */ + +/dts-v1/; + +#include +#include +#include "rk3328.dtsi" + +/ { + model = "Xunlong Orange Pi R1 Plus LTS"; + compatible = "xunlong,orangepi-r1-plus-lts", "rockchip,rk3328"; + + aliases { + ethernet1 = &rtl8153; + mmc0 = &sdmmc; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + gmac_clk: gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac_clkin"; + #clock-cells = <0>; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&reset_button_pin>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <50>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>; + pinctrl-names = "default"; + + lan_led: led-0 { + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + label = "orangepi-r1-plus-lts:green:lan"; + }; + + sys_led: led-1 { + gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>; + label = "orangepi-r1-plus-lts:red:status"; + linux,default-trigger = "heartbeat"; + }; + + wan_led: led-2 { + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>; + label = "orangepi-r1-plus-lts:green:wan"; + }; + }; + + vcc_io_sdio: sdmmcio-regulator { + compatible = "regulator-gpio"; + enable-active-high; + gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&sdio_vcc_pin>; + pinctrl-names = "default"; + regulator-name = "vcc_io_sdio"; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-settling-time-us = <5000>; + regulator-type = "voltage"; + startup-delay-us = <2000>; + states = <1800000 0x1>, + <3300000 0x0>; + vin-supply = <&vcc_io_33>; + }; + + vcc_sd: sdmmc-regulator { + compatible = "regulator-fixed"; + gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&sdmmc0m1_pin>; + pinctrl-names = "default"; + regulator-name = "vcc_sd"; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io_33>; + }; + + vdd_5v: vdd-5v { + compatible = "regulator-fixed"; + regulator-name = "vdd_5v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vdd_5v_lan: vdd-5v-lan { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&lan_vdd_pin>; + pinctrl-names = "default"; + regulator-name = "vdd_5v_lan"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vdd_5v>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_arm>; +}; + +&cpu1 { + cpu-supply = <&vdd_arm>; +}; + +&cpu2 { + cpu-supply = <&vdd_arm>; +}; + +&cpu3 { + cpu-supply = <&vdd_arm>; +}; + +&display_subsystem { + status = "disabled"; +}; + +&gmac2io { + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>; + assigned-clock-parents = <&gmac_clk>, <&gmac_clk>; + clock_in_out = "input"; + phy-mode = "rgmii"; + phy-supply = <&vcc_io_33>; + pinctrl-0 = <&rgmiim1_pins>; + pinctrl-names = "default"; + snps,aal; + status = "okay"; + phy-handle = <&yt8531c>; + tx_delay = <0x19>; + rx_delay = <0x05>; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + yt8531c: ethernet-phy@0 { + compatible = "ethernet-phy-id4f51.e91b", + "ethernet-phy-ieee802.3-c22"; + reg = <0>; + motorcomm,clk-out-frequency-hz = <125000000>; + motorcomm,keep-pll-enabled; + motorcomm,auto-sleep-disabled; + pinctrl-0 = <ð_phy_reset_pin>; + pinctrl-names = "default"; + reset-assert-us = <15000>; + reset-deassert-us = <50000>; + reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&i2c1 { + status = "okay"; + + rk805: pmic@18 { + compatible = "rockchip,rk805"; + reg = <0x18>; + interrupt-parent = <&gpio1>; + interrupts = <24 IRQ_TYPE_LEVEL_LOW>; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk805-clkout2"; + gpio-controller; + #gpio-cells = <2>; + pinctrl-0 = <&pmic_int_l>; + pinctrl-names = "default"; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vdd_5v>; + vcc2-supply = <&vdd_5v>; + vcc3-supply = <&vdd_5v>; + vcc4-supply = <&vdd_5v>; + vcc5-supply = <&vcc_io_33>; + vcc6-supply = <&vdd_5v>; + + regulators { + vdd_log: DCDC_REG1 { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1450000>; + regulator-ramp-delay = <12500>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_io_33: DCDC_REG4 { + regulator-name = "vcc_io_33"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_18: LDO_REG1 { + regulator-name = "vcc_18"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc18_emmc: LDO_REG2 { + regulator-name = "vcc18_emmc"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_10: LDO_REG3 { + regulator-name = "vdd_10"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + }; + }; +}; + +&io_domains { + pmuio-supply = <&vcc_io_33>; + vccio1-supply = <&vcc_io_33>; + vccio2-supply = <&vcc18_emmc>; + vccio3-supply = <&vcc_io_sdio>; + vccio4-supply = <&vcc_18>; + vccio5-supply = <&vcc_io_33>; + vccio6-supply = <&vcc_io_33>; + status = "okay"; +}; + +&pinctrl { + button { + reset_button_pin: reset-button-pin { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac2io { + eth_phy_reset_pin: eth-phy-reset-pin { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + leds { + lan_led_pin: lan-led-pin { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + sys_led_pin: sys-led-pin { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wan_led_pin: wan-led-pin { + rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + lan { + lan_vdd_pin: lan-vdd-pin { + rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sd { + sdio_vcc_pin: sdio-vcc-pin { + rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm2 { + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; + pinctrl-names = "default"; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vcc_io_sdio>; + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <0>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&u2phy { + status = "okay"; +}; + +&u2phy_host { + status = "okay"; +}; + +&u2phy_otg { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb20_otg { + status = "okay"; + dr_mode = "host"; +}; + +&usbdrd3 { + dr_mode = "host"; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + snps,xhci-trb-ent-quirk; + + /* Second port is for USB 3.0 */ + rtl8153: device@2 { + compatible = "usbbda,8153"; + reg = <2>; + realtek,led-data = <0x87>; + }; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&spi0 { + max-freq = <48000000>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + }; +}; + +&uart1 { + status = "okay"; +}; + +&dmc_opp_table { + opp-798000000 { + status = "disabled"; + }; + opp-840000000 { + status = "disabled"; + }; + opp-924000000 { + status = "disabled"; + }; + opp-1056000000 { + status = "disabled"; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts new file mode 100644 index 000000000000..0b2e21a13990 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3328-z28pro.dts @@ -0,0 +1 @@ +#include "rk3328-rock64.dts" diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts new file mode 100644 index 000000000000..9022e0195531 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-fine3399.dts @@ -0,0 +1,797 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + + +/ { + model = "Rockchip Fine3399"; + compatible = "rockchip,fine3399", "rockchip,rk3399"; + + aliases { + mmc0 = &sdio0; + mmc1 = &sdmmc; + mmc2 = &sdhci; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + dc_12v: dc-12v { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + 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>; // bsp + }; + + /* switched by pmic_sleep */ + vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8>; + }; + + vcc3v3_sys: vcc3v3_pcie: vcc3v3_bl: vcc3v3-sys { // sch + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&dc_12v>; + }; + + vcc_sys: vcc-sys { // sch + 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>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_phy_h>; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + 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>; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + + user_led2 { + label = "blue:work_led"; + gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; // sch + linux,default-trigger = "heartbeat"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + power { + debounce-interval = <100>; + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp + label = "GPIO Key Power"; + linux,code = ; + wakeup-source; + }; + }; + + fan0: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 150 200 255>; + #cooling-cells = <2>; + fan-supply = <&vcc_sys>; + pwms = <&pwm1 0 40000 0>; + }; + + // pwm3 + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_int>; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1750000>; + poll-interval = <100>; + + recovery { + label = "Recovery"; + linux,code = ; // ?? + press-threshold-microvolt = <0>; + }; + }; + +}; + +&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>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&cpu_thermal { + trips { + cpu_hot: cpu_hot { + hysteresis = <10000>; + temperature = <55000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + cooling-device = + <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + trip = <&cpu_hot>; + }; + }; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + 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 = ; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l &pmic_dvs2>; + 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 = <&vcc1v8_pmu>; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG4 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_dvp: LDO_REG1 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v0_tp: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc3v0_tp"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_sd: LDO_REG4 { + regulator-name = "vcc_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca3v0_codec: LDO_REG5 { + regulator-name = "vcca3v0_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca1v8_codec: LDO_REG7 { + regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: 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>; + pinctrl-names = "default"; + pinctrl-0 = <&cpu_b_sleep>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&gpu_sleep>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +// Used for HDMI +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +// HDMI sound +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sd>; + gpio1830-supply = <&vcc_3v0>; +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_1v8>; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; // sch + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqn_cpm>; + status = "okay"; +}; + +&pinctrl { + pmic { + cpu_b_sleep: cpu-b-sleep { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + gpu_sleep: gpu-sleep { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + pmic_dvs2: pmic-dvs2 { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; // bsp + }; + }; + + 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>; + }; + }; + + bt { + bt_enable_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_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac { + vcc_phy_h: vcc-phy-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + user_led2: user_led2 { + rockchip,pins = + <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + buttons { + power_key: power_key { + rockchip,pins = + <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; +/* +// TFT +&pwm0 { + status = "okay"; +}; +*/ +// FAN +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca1v8_s3>; + 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; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + brcm,drive-strength = <5>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_l>; + }; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; // bsp + clock-frequency = <150000000>; + disable-wp; + sd-uhs-sdr104; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + vqmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + keep-power-in-suspend; + non-removable; + status = "okay"; +}; +/* +&spi1 { + status = "okay"; + + norflash: flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + }; +}; +*/ +/* +&spi2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi2_clk &spi2_tx &spi2_cs0>; + + panel@0 { + compatible = "sitronix,st7789v"; + reg = <0>; + // backlight = <&pwm0>; + dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; + led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; + spi-max-frequency = <15000000>; + spi-cs-high; + status = "okay"; + }; +}; +*/ +&tcphy0 { + status = "okay"; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + status = "okay"; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + 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>; + max-speed = <4000000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; + }; +}; + +// Debug TTL +&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 = "host"; +}; + +&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"; +}; + +&iep_mmu { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts new file mode 100644 index 000000000000..094440ce38ad --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-m4v2.dts @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * FriendlyElec NanoPi M4V2 board device tree source + * + * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd. + * (http://www.friendlyarm.com) + * + * Copyright (c) 2018 Collabora Ltd. + * Copyright (c) 2019 Arm Ltd. + */ + +/dts-v1/; +#include "rk3399-nanopi4.dtsi" + +/ { + model = "FriendlyElec NanoPi M4 Ver2.0"; + compatible = "friendlyarm,nanopi-m4", "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>; + }; + + vcc5v0_usb2: vcc5v0-usb2 { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb2"; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + }; + + 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>; + regulator-init-microvolt = <900000>; + vin-supply = <&vcc5v0_core>; + }; +}; + +&gmac { + rx_delay = <0x16>; +}; + +&rk808 { + max-buck-steps-per-change = <4>; +}; + +&vcc3v3_sys { + vin-supply = <&vcc5v0_core>; +}; + +&u2phy0_host { + phy-supply = <&vcc5v0_usb1>; +}; + +&u2phy1_host { + phy-supply = <&vcc5v0_usb2>; +}; + +&vbus_typec { + regulator-always-on; + vin-supply = <&vdd_5v>; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts new file mode 100644 index 000000000000..1c9d0c34f151 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-nanopi-r4se.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include "rk3399-nanopi-r4s-enterprise.dts" + +/ { + model = "FriendlyElec NanoPi R4SE"; + compatible = "friendlyarm,nanopi-r4se", "rockchip,rk3399"; +}; + +&emmc_phy { + status = "okay"; +}; + +&sdhci { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts new file mode 100644 index 000000000000..2f0baf9fd43b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4-lts.dts @@ -0,0 +1,1334 @@ +/* + * SPDX-License-Identifier: (GPL-2.0+ or MIT) + * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. + * Copyright (c) 2018 Akash Gajjar + * Copyright (c) 2020-2022 Armbian (chwe17, piter75, jock) + * + */ + +/dts-v1/; +#include +#include +#include +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "OrangePi 4 LTS"; + compatible = "xunlong,orangepi-4-lts", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + aliases { + spi1 = &spi1; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + usb_vbus: usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + usb3_vbus: usb3-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb3_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vbus_typec: vbus-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec_en>; + regulator-name = "vbus-5v"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + /* 0.9 V supply, over PMIC + vcc_0v9: vcc-0v9 { + compatible = "regulator-fixed"; + regulator-name = "vcc_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vcc3v3_sys>; + } + */ + + vcc3v0_sd: vcc3v0-sd { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_pwr>; + regulator-name = "vcc3v0_sd"; + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_drv>; + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc3v3_pcie"; + }; + + 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>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + }; + + es8316c_card: es8316c-card { + compatible = "simple-audio-card"; + + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip-es8316c"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; + + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones"; + + simple-audio-card,routing = + "MIC1", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR"; + + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + + simple-audio-card,codec { + sound-dai = <&es8316c_codec>; + }; + + }; + + hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "hdmi-sound"; + status = "okay"; + + simple-audio-card,cpu { + sound-dai = <&i2s2>; + }; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + }; + + spdif-sound { + status = "disable"; + compatible = "simple-audio-card"; + simple-audio-card,name = "ROCKCHIP,SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + status = "disable"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + pwm_bl: backlight { + status = "disable"; + compatible = "pwm-backlight"; + pwms = <&pwm0 0 25000 0>; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <200>; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + button@0 { + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "GPIO Key Power"; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <1800000>; + + button-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <100000>; + }; + + button-down { + label = "Volume Down"; + linux,code = ; + press-threshold-microvolt = <300000>; + }; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + linux,default-trigger-delay-ms = <0>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ + }; + + unisoc_uwe_bsp: uwe-bsp { + compatible = "unisoc,uwe_bsp"; + //wl-reg-on = <&gpio0 10 GPIO_ACTIVE_HIGH>; // handled by sdio-pwrseq + bt-reg-on = <&gpio0 9 GPIO_ACTIVE_HIGH>; + wl-wake-host-gpio = <&gpio0 3 GPIO_ACTIVE_HIGH>; + bt-wake-host-gpio = <&gpio0 4 GPIO_ACTIVE_HIGH>; + sdio-ext-int-gpio = <&gpio3 30 GPIO_ACTIVE_HIGH>; + unisoc,btwf-file-name = "/lib/firmware/uwe5622/wcnmodem-38222.bin"; + data-irq; + blksz-512; + keep-power-on; + status = "okay"; + }; + + sprd-wlan { + compatible = "sprd,uwe5622-wifi"; + status = "okay"; + }; + + sprd-mtty { + compatible = "sprd,mtty"; + sprd,name = "ttyBT"; + status = "okay"; + }; + + dmc_opp_table: dmc_opp_table { + compatible = "operating-points-v2"; + + opp00 { + opp-hz = /bits/ 64 <328000000>; + opp-microvolt = <900000>; + }; + + opp01 { + opp-hz = /bits/ 64 <416000000>; + opp-microvolt = <900000>; + }; + + opp02 { + opp-hz = /bits/ 64 <666000000>; + opp-microvolt = <900000>; + }; + + }; + +}; + +&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>; +}; + +&gpu { + status = "okay"; + mali-supply = <&vdd_gpu>; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>, <&phy_rstb>; + phy-mode = "rgmii"; + phy-supply = <&vcc3v3_s3>; + phy-handle = <&yt8531c>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + 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>; + yt8531c: ethernet-phy@0 { + compatible = "ethernet-phy-id4f51.e91b", + "ethernet-phy-ieee802.3-c22"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&phy_intb>; + motorcomm,clk-out-frequency-hz = <125000000>; + motorcomm,keep-pll-enabled; + motorcomm,auto-sleep-disabled; + interrupt-parent = <&gpio3>; + interrupts = ; + }; + }; + +}; + +&spi1 { + status = "disable"; + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&spi1_gpio>; + + spidev0: spidev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <10000000>; + status = "okay"; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vpu { + status = "okay"; +}; + +&rga { + status = "okay"; +}; + +&cdn_dp { + status = "okay"; + extcon = <&fusb0>; + phys = <&tcphy0_dp>; +}; + +&hdmi { + /* remove the hdmi_i2c_xfer */ + pinctrl-0 = <&hdmi_cec>; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <0>; + status = "okay"; + ddc-i2c-bus = <&i2c7>; +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio2>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&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>; + vcc13-supply = <&vcc3v3_sys>; + vcc14-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 = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc1v8: vcc1v8_s3: vcca1v8_s3: DCDC_REG4 { + regulator-name = "vcc1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_dvp: LDO_REG1 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v0_touch: LDO_REG2 { + regulator-name = "vcc3v0_touch"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_sdio: LDO_REG4 { + regulator-name = "vcc_sdio"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-init-microvolt = <3000000>; + 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 = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca1v8_codec: LDO_REG7 { + regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: vcc_lan: SWITCH_REG1 { + regulator-name = "vcc3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_s0: SWITCH_REG2 { + regulator-name = "vcc3v3_s0"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; + + vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel1_gpio>; + vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + 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>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + 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 { + clock-frequency = <200000>; + i2c-scl-rising-time-ns = <300>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + es8316c_codec: es8316c@11 { + #sound-dai-cells = <0>; + compatible = "everest,es8316"; + reg = <17>; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + //pinctrl-names = "default"; + //pinctrl-0 = <&i2s_8ch_mclk>; + status = "okay"; + }; + +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + fusb0: fusb30x@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + interrupt-parent = <&gpio1>; + interrupts = ; + vbus-supply = <&vbus_typec>; + status = "okay"; + + connector { + compatible = "usb-c-connector"; + data-role = "dual"; + label = "USB-C"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + ; + source-pdos = + ; + try-power-role = "sink"; + + extcon-cables = <1 2 5 6 9 10 12 44>; + typec-altmodes = <0xff01 1 0x001c0000 1>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbc_hs: endpoint { + remote-endpoint = + <&u2phy0_typec_hs>; + }; + }; + + port@1 { + reg = <1>; + + usbc_ss: endpoint { + remote-endpoint = + <&tcphy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + + usbc_dp: endpoint { + remote-endpoint = + <&tcphy0_typec_dp>; + }; + }; + }; + }; + + }; + + ft5x06_ts@38 { + compatible = "edt,edt-ft5x06", "ft5x06"; + reg = <0x38>; + interrupt-parent = <&gpio1>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + status = "okay"; + }; + +}; + +&i2c7 { + status = "okay"; +}; + +&spdif { + status = "disable"; + pinctrl-0 = <&spdif_bus>; + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + #sound-dai-cells = <0>; +}; + +&i2s0 { + rockchip,i2s-broken-burst-len; + assigned-clocks = <&cru SCLK_I2SOUT_SRC>; + assigned-clock-parents = <&cru SCLK_I2S0_8CH>; + resets = <&cru SRST_I2S0_8CH>, <&cru SRST_H_I2S0_8CH>; + reset-names = "reset-m", "reset-h"; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + status = "okay"; + #sound-dai-cells = <0>; +}; + +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc1v8_dvp>; /* bt656_gpio2ab_ms */ + audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ + sdmmc-supply = <&vcc_sdio>; /* sdmmc_gpio4b_ms */ + gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +}; + +&pcie_phy { + status = "okay"; + assigned-clocks = <&cru SCLK_PCIEPHY_REF>; + assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; + assigned-clock-rates = <100000000>; +}; + +&pcie0 { + status = "okay"; + ep-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + max-link-speed = <1>; +}; + +&pwm_bl { + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin_pull_down>; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcca1v8_s3>; /* TBD */ +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + supports-emmc; + non-removable; + keep-power-in-suspend; + mmc-hs400-enhanced-strobe; + status = "okay"; +}; + +&emmc_phy { + status = "okay"; +}; + +&sdio0 { + clock-frequency = <150000000>; + max-frequency = <150000000>; + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + cd-debounce-delay-ms = <500>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc_cd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v0_sd>; + vqmmc-supply = <&vcc_sdio>; + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy0_dp { + port { + tcphy0_typec_dp: endpoint { + remote-endpoint = <&usbc_dp>; + }; + }; +}; + +&tcphy0_usb3 { + port { + tcphy0_typec_ss: endpoint { + remote-endpoint = <&usbc_ss>; + }; + }; +}; + +&tcphy1 { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&usb3_vbus>; + status = "okay"; + }; + + port { + u2phy0_typec_hs: endpoint { + remote-endpoint = <&usbc_hs>; + }; + }; + +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + phy-supply = <&usb_vbus>; + status = "okay"; + }; +}; + +&usbdrd3_0 { + status = "okay"; + extcon = <&fusb0>; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&sdmmc_bus4 { + rockchip,pins = + <4 RK_PB0 1 &pcfg_pull_up_12ma>, + <4 RK_PB1 1 &pcfg_pull_up_12ma>, + <4 RK_PB2 1 &pcfg_pull_up_12ma>, + <4 RK_PB3 1 &pcfg_pull_up_12ma>; +}; + +&sdmmc_cmd { + rockchip,pins = + <4 RK_PB5 1 &pcfg_pull_up_12ma>; +}; + +&pinctrl { + + pcfg_pull_up_12ma: pcfg-pull-up-12ma { + bias-pull-up; + drive-strength = <12>; + }; + + pcie { + pcie_drv: pcie-drv { + rockchip,pins = + <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hdmi { + /delete-node/ hdmi-i2c-xfer; + }; + + i2s0 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vsel1_gpio: vsel1-gpio { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + vsel2_gpio: vsel2-gpio { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + usb-typec { + vcc5v0_typec_en: vcc5v0_typec_en { + rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-bluetooth { + uart0_gpios: uart0-gpios { + rockchip,pins = <2 19 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rockchip-key { + power_key: power-key { + rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + leds_gpio: leds-gpio { + rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + cam_pins { + cif_clkout_a: cif-clkout-a { + rockchip,pins = <2 11 3 &pcfg_pull_none>; + }; + + cif_clkout_a_sleep: cif-clkout-a-sleep { + rockchip,pins = <2 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + cam0_default_pins: cam0-default-pins { + rockchip,pins = + <4 27 0 &pcfg_pull_down>, + <2 11 3 &pcfg_pull_none>; + }; + + cam0_sleep_pins: cam0-sleep-pins { + rockchip,pins = + <4 27 3 &pcfg_pull_none>, + <2 11 0 &pcfg_pull_none>; + }; + + cam1_default_pins: cam1-default-pins { + rockchip,pins = + <0 12 RK_FUNC_GPIO &pcfg_pull_down>, + <0 8 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + spi1 { + spi1_gpio: spi1-gpio { + rockchip,pins = + <1 7 RK_FUNC_GPIO &pcfg_output_low>, + <1 8 RK_FUNC_GPIO &pcfg_output_low>, + <1 9 RK_FUNC_GPIO &pcfg_output_low>, + <1 10 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + bt { + bt_host_wake: bt-host-wake { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_reset: bt-reset { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake: bt-wake { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac { + phy_intb: phy-intb { + rockchip,pins = <3 RK_PB2 1 &pcfg_pull_up>; + }; + + phy_rstb: phy-rstb { + rockchip,pins = <3 RK_PB7 1 &pcfg_pull_none>; + }; + }; + +}; + +&hdmi_in_vopb { + status = "okay"; +}; + +&hdmi_in_vopl { + status = "disable"; +}; + +&dp_in_vopb { + status = "disable"; +}; +&dp_in_vopl { + status = "okay"; +}; + +&dmc { + #cooling-cells = <2>; /* min followed by max */ + + status = "okay"; + center-supply = <&vdd_log>; + operating-points-v2 = <&dmc_opp_table>; + + rockchip,pd-idle-ns = <160>; + rockchip,sr-idle-ns = <10240>; + rockchip,sr-mc-gate-idle-ns = <40960>; + rockchip,srpd-lite-idle-ns = <61440>; + rockchip,standby-idle-ns = <81920>; + + rockchip,ddr3_odt_dis_freq = <666000000>; + rockchip,lpddr3_odt_dis_freq = <666000000>; + rockchip,lpddr4_odt_dis_freq = <666000000>; + + rockchip,sr-mc-gate-idle-dis-freq-hz = <1000000000>; + rockchip,srpd-lite-idle-dis-freq-hz = <0>; + rockchip,standby-idle-dis-freq-hz = <928000000>; + +}; + +&dfi { + status = "okay"; +}; + +/* + * Redefine some parameters for the thermal trip points for Opi4 LTS. + * First of all, the Soc does not like getting over 90°C. My sample + * froze at 94.4°C, so we lower the critical temprature to 90°C, hopefully + * giving enough room for safe reboot of the device. + * Big cores are getting throttled a bit when reaching 82°C, then at 85°C + * we aggressively throttle all the cores and even the memory controller. + * The GPU is handled by existing trip points in the base device tree, here + * we just set the same critical temperature as CPU. + */ +&cpu_alert0 { + temperature = <82000>; +}; + +&cpu_alert1 { + temperature = <85000>; +}; + +&cpu_crit { + temperatue = <90000>; +}; + +&gpu_crit { + temperatue = <90000>; +}; + +&cpu_thermal { + + cooling-maps { + + map0 { + trip = <&cpu_alert0>; + cooling-device = + <&cpu_b0 THERMAL_NO_LIMIT 3>, + <&cpu_b1 THERMAL_NO_LIMIT 3>; + }; + + map1 { + trip = <&cpu_alert1>; + cooling-device = + <&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_l3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu_b1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map2 { + trip = <&cpu_alert1>; + cooling-device = + <&dmc THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + }; + +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts new file mode 100644 index 000000000000..976d3f9964f3 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-orangepi-4.dts @@ -0,0 +1,1194 @@ +/* + * SPDX-License-Identifier: (GPL-2.0+ or MIT) + * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. + * Copyright (c) 2018 Akash Gajjar + * Copyright (c) 2020 Armbian (chwe17, piter75) + * + */ + +/dts-v1/; +#include +#include +#include +//#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "OrangePi 4"; + compatible = "xunlong,orangepi-4", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + aliases { + spi1 = &spi1; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + usb_vbus: usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + usb3_vbus: usb3-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb3_vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vbus_typec: vbus-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec_en>; + regulator-name = "vbus_typec"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + /* 0.9 V supply, over PMIC + vcc_0v9: vcc-0v9 { + compatible = "regulator-fixed"; + regulator-name = "vcc_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vcc3v3_sys>; + } + */ + + 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-name = "vcc3v0_sd"; + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_drv>; + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc3v3_pcie"; + }; + + 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>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc3v3_sys>; + }; + + rt5651_card: rt5651-sound { + status = "okay"; + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + + simple-audio-card,name = "realtek,rt5651-codec"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>; + + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Mic Jack", "micbias1", + "IN2P", "Mic Jack", + "IN3P", "Mic Jack", + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR"; + + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + simple-audio-card,codec { + sound-dai = <&rt5651>; + }; + }; + + dw_hdmi_audio: dw-hdmi-audio { + status = "disable"; + compatible = "rockchip,dw-hdmi-audio"; + #sound-dai-cells = <0>; + }; + + hdmi_sound: hdmi-sound { + status = "okay"; + }; + + hdmi_dp_sound: hdmi-dp-sound { + status = "okay"; + compatible = "rockchip,rk3399-hdmi-dp"; + rockchip,cpu = <&i2s2>; + rockchip,codec = <&hdmi>, <&cdn_dp>; + }; + + spdif-sound { + status = "disable"; + compatible = "simple-audio-card"; + simple-audio-card,name = "ROCKCHIP,SPDIF"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + status = "disable"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + pwm_bl: backlight { + status = "disable"; + compatible = "pwm-backlight"; + pwms = <&pwm0 0 25000 0>; + brightness-levels = < + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31 + 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255>; + default-brightness-level = <200>; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + button@0 { + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + linux,code = ; + label = "GPIO Key Power"; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <1800000>; + + button-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <100000>; + }; + + button-down { + label = "Volume Down"; + linux,code = ; + press-threshold-microvolt = <300000>; + }; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + linux,default-trigger-delay-ms = <0>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ + }; +}; + +&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>; +}; + +&gpu { + status = "okay"; + mali-supply = <&vdd_gpu>; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + phy-mode = "rgmii"; + phy-supply = <&vcc3v3_s3>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&spi1 { + status = "disable"; + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&spi1_gpio>; + + spidev0: spidev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <10000000>; + status = "okay"; + }; +}; +/* +&spi1 { + status = "okay"; + max-freq = <48000000>; + spidev@00 { + compatible = "linux,spidev"; + reg = <0x00>; + spi-max-frequency = <48000000>; + }; +}; +*/ + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + 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>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake &bt_wake &bt_reset>; + }; + +}; + +&uart2 { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vpu { + status = "okay"; + /* 0 means ion, 1 means drm */ + //allocator = <0>; +}; + +&rga { + status = "disabled"; +}; + +&cdn_dp { + status = "okay"; + extcon = <&fusb0>; + phys = <&tcphy0_dp>; +}; + +&hdmi { + /* remove the hdmi_i2c_xfer */ + pinctrl-0 = <&hdmi_cec>; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <0>; + status = "okay"; + ddc-i2c-bus = <&i2c7>; + rockchip,defaultmode = <16>; /* CEA 1920x1080@60Hz */ +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio1>; + interrupts = <21 IRQ_TYPE_LEVEL_LOW>; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&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>; + vcc13-supply = <&vcc3v3_sys>; + vcc14-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 = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc1v8: vcc1v8_s3: vcca1v8_s3: DCDC_REG4 { + regulator-name = "vcc1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_dvp: LDO_REG1 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v0_touch: LDO_REG2 { + regulator-name = "vcc3v0_touch"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_sdio: LDO_REG4 { + regulator-name = "vcc_sdio"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + regulator-init-microvolt = <3000000>; + 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 = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca1v8_codec: LDO_REG7 { + regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: vcc_lan: SWITCH_REG1 { + regulator-name = "vcc3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_s0: SWITCH_REG2 { + regulator-name = "vcc3v3_s0"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; + + vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel1_gpio>; + vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + 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>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; + regulator-compatible = "fan53555-reg"; + 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 { + status = "okay"; + i2c-scl-rising-time-ns = <300>; + i2c-scl-falling-time-ns = <15>; + clock-frequency = <200000>; + + rt5651: rt5651@1a { + #sound-dai-cells = <0>; + compatible = "realtek,rt5651"; + reg = <0x1a>; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + status = "okay"; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + fusb0: fusb30x@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + interrupt-parent = <&gpio1>; + interrupts = ; + vbus-supply = <&vbus_typec>; + status = "okay"; + + connector { + compatible = "usb-c-connector"; + data-role = "dual"; + label = "USB-C"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + ; + source-pdos = + ; + try-power-role = "sink"; + + extcon-cables = <1 2 5 6 9 10 12 44>; + typec-altmodes = <0xff01 1 0x001c0000 1>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbc_hs: endpoint { + remote-endpoint = + <&u2phy0_typec_hs>; + }; + }; + + port@1 { + reg = <1>; + + usbc_ss: endpoint { + remote-endpoint = + <&tcphy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + + usbc_dp: endpoint { + remote-endpoint = + <&tcphy0_typec_dp>; + }; + }; + }; + }; + + }; + + ft5x06_ts@38 { + compatible = "edt,edt-ft5x06", "ft5x06"; + reg = <0x38>; + interrupt-parent = <&gpio1>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + status = "okay"; + }; + + /* + onewire_ts@2f { + compatible = "onewire"; + reg = <0x2f>; + interrupt-parent = <&gpio1>; + interrupts = <20 IRQ_TYPE_EDGE_FALLING>; + }; */ +}; + +&i2c7 { + status = "okay"; +}; + +&spdif { + status = "disable"; + pinctrl-0 = <&spdif_bus>; + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + #sound-dai-cells = <0>; +}; + +&i2s1 { + assigned-clocks = <&cru SCLK_I2SOUT_SRC>; + assigned-clock-parents = <&cru SCLK_I2S1_8CH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_8ch_mclk>,<&i2s1_2ch_bus>; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + #sound-dai-cells = <0>; + status = "okay"; +}; +/* +&i2s0 { + assigned-clocks = <&cru SCLK_I2S1_DIV>; + assigned-clock-parents = <&cru PLL_GPLL>; +};*/ + +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc1v8_dvp>; /* bt656_gpio2ab_ms */ + audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ + sdmmc-supply = <&vcc_sdio>; /* sdmmc_gpio4b_ms */ + gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_3v0>; +}; + +&pcie_phy { + status = "okay"; + assigned-clocks = <&cru SCLK_PCIEPHY_REF>; + assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>; + assigned-clock-rates = <100000000>; +}; + +&pcie0 { + status = "okay"; + ep-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + max-link-speed = <1>; +}; + +&pwm_bl { + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin_pull_down>; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcca1v8_s3>; /* TBD */ +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + supports-emmc; + non-removable; + keep-power-in-suspend; + mmc-hs400-enhanced-strobe; + status = "okay"; +}; + +&emmc_phy { + status = "okay"; +}; + +&sdio0 { + clock-frequency = <50000000>; + clock-freq-min-max = <200000 50000000>; + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc0_det_l>; +// sd-uhs-sdr104; + vmmc-supply = <&vcc3v0_sd>; + vqmmc-supply = <&vcc_sdio>; + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy0_dp { + port { + tcphy0_typec_dp: endpoint { + remote-endpoint = <&usbc_dp>; + }; + }; +}; + +&tcphy0_usb3 { + port { + tcphy0_typec_ss: endpoint { + remote-endpoint = <&usbc_ss>; + }; + }; +}; + +&tcphy1 { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&usb3_vbus>; + status = "okay"; + }; + + port { + u2phy0_typec_hs: endpoint { + remote-endpoint = <&usbc_hs>; + }; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + phy-supply = <&usb_vbus>; + status = "okay"; + }; +}; + +&usbdrd3_0 { + status = "okay"; + extcon = <&fusb0>; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&pinctrl { + pcie { + pcie_drv: pcie-drv { + rockchip,pins = + <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + hdmi { + /delete-node/ hdmi-i2c-xfer; + }; + + i2s1 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vsel1_gpio: vsel1-gpio { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + vsel2_gpio: vsel2-gpio { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + sdmmc { + sdmmc0_det_l: sdmmc0-det-l { + rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + sdmmc0_pwr_h: sdmmc0-pwr-h { + rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb-typec { + vcc5v0_typec_en: vcc5v0_typec_en { + rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-bluetooth { + uart0_gpios: uart0-gpios { + rockchip,pins = <2 19 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + rockchip-key { + power_key: power-key { + rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + leds_gpio: leds-gpio { + rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + cam_pins { + cif_clkout_a: cif-clkout-a { + rockchip,pins = <2 11 3 &pcfg_pull_none>; + }; + + cif_clkout_a_sleep: cif-clkout-a-sleep { + rockchip,pins = <2 11 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + cam0_default_pins: cam0-default-pins { + rockchip,pins = + <4 27 0 &pcfg_pull_down>, + <2 11 3 &pcfg_pull_none>; + }; + cam0_sleep_pins: cam0-sleep-pins { + rockchip,pins = + <4 27 3 &pcfg_pull_none>, + <2 11 0 &pcfg_pull_none>; + }; + + cam1_default_pins: cam1-default-pins { + rockchip,pins = + <0 12 RK_FUNC_GPIO &pcfg_pull_down>, + <0 8 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + spi1 { + spi1_gpio: spi1-gpio { + rockchip,pins = + <1 7 RK_FUNC_GPIO &pcfg_output_low>, + <1 8 RK_FUNC_GPIO &pcfg_output_low>, + <1 9 RK_FUNC_GPIO &pcfg_output_low>, + <1 10 RK_FUNC_GPIO &pcfg_output_low>; + }; + }; + + bt { + bt_host_wake: bt-host-wake { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_reset: bt-reset { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake: bt-wake { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + +}; + +&hdmi_in_vopb { + status = "okay"; +}; + +&hdmi_in_vopl { + status = "disable"; +}; + +&dp_in_vopb { + status = "disable"; +}; +&dp_in_vopl { + status = "okay"; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts new file mode 100644 index 000000000000..8d0aa5346293 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4.dts @@ -0,0 +1 @@ +#include "rk3399-rock-pi-4b.dts" diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts new file mode 100644 index 000000000000..4053ba72618c --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-rock-pi-4c.dts @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (c) 2019 Radxa Limited + * Copyright (c) 2019 Amarula Solutions(India) + */ + +/dts-v1/; +#include "rk3399-rock-pi-4.dtsi" + +/ { + model = "Radxa ROCK Pi 4C"; + compatible = "radxa,rockpi4c", "radxa,rockpi4", "rockchip,rk3399"; + + aliases { + mmc2 = &sdio0; + }; +}; + +&es8316 { + pinctrl-0 = <&hp_detect &hp_int>; + pinctrl-names = "default"; + interrupt-parent = <&gpio1>; + interrupts = ; +}; + +&sdio0 { + status = "okay"; + + brcmf: wifi@1 { + compatible = "brcm,bcm4329-fmac"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_l>; + }; +}; + +&sound { + hp-det-gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; +}; + +&uart0 { + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rk808 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; + }; +}; + +&vcc5v0_host { + gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>; +}; + +&vcc5v0_host_en { + rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts new file mode 100644 index 000000000000..0f4b28ae0118 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-tinker-2.dts @@ -0,0 +1,751 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (c) 2021 Thomas McKahan + */ + +/dts-v1/; +#include +#include +#include "rk3399.dtsi" +#include "rk3399-op1-opp.dtsi" + +/ { + model = "Asus Tinker Board 2/2S"; + compatible = "rockchip,rk3399-evb", "rockchip,rk3399"; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + board_info: board-info { + compatible = "board-info"; + + hw-id0 = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + hw-id1 = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; + hw-id2 = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; + + pid-id0 = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; + pid-id1 = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>; + pid-id2 = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; + + ddr-id1 = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>; + ddr-id2 = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>; + + pmic-reset = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + pwr-led { + gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + retain-state-suspended = <1>; + }; + + act-led { + gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; + linux,default-trigger="mmc0"; + }; + + rsv-led { + gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>; + linux,default-trigger="heartbeat"; + }; + }; + + vcc_lcd: vcc-lcd { + compatible = "regulator-fixed"; + regulator-name = "vcc_lcd"; + gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>; + startup-delay-us = <20000>; + enable-active-high; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + vin-supply = <&vcc5v0_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>; + }; + + 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"; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vbus_typec: vbus-5vout { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec0_en_pin>; + regulator-name = "vbus_5vout"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + regulator-boot-on; + + /* for rockchip boot on */ + rockchip,pwm_id= <2>; + rockchip,pwm_voltage = <900000>; + }; + + xin32k: xin32k { + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + #clock-cells = <0>; + }; +}; + +&cdn_dp { + status = "okay"; + extcon = <&fusb0>; +}; + +&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 = <&cru SCLK_MAC>; + clock_in_out = "input"; + assigned-clock-rates = <125000000>; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 16000 72000>; + tx_delay = <0x25>; + rx_delay = <0x20>; + wakeup-enable = "0"; + status = "okay"; +}; +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio1>; + interrupts = <18 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + + 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 = <&vcc1v8_pmu>; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + 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-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc3v3_dsi: LDO_REG1 { + regulator-name = "vcc3v3_dsi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_hdmi: LDO_REG2 { + regulator-name = "vcca1v8_hdmi"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vccio_sd: LDO_REG4 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_csi: LDO_REG5 { + regulator-name = "vcc3v3_csi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca0v9_hdmi: LDO_REG7 { + regulator-name = "vcca0v9_hdmi"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + 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-on-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: vdd_cpu_b@60 { + compatible = "fcs,fan53200"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-regulator"; + pinctrl-names = "default"; + pinctrl-0 = <&vsel1_gpio>; + vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1250000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + status = "okay"; + + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + + status = "okay"; + i2c-scl-rising-time-ns = <475>; + i2c-scl-falling-time-ns = <26>; + fusb0: fusb30x@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + interrupt-parent = <&gpio1>; + interrupts = ; + vbus-supply = <&vbus_typec>; + status = "okay"; + + connector { + compatible = "usb-c-connector"; + data-role = "dual"; + label = "USB-C"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + sink-pdos = + ; + source-pdos = + ; + try-power-role = "sink"; + + extcon-cables = <1 2 5 6 9 10 12 44>; + typec-altmodes = <0xff01 1 0x001c0000 1>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbc_hs: endpoint { + remote-endpoint = + <&u2phy0_typec_hs>; + }; + }; + + port@1 { + reg = <1>; + + usbc_ss: endpoint { + remote-endpoint = + <&tcphy0_typec_ss>; + }; + }; + + port@2 { + reg = <2>; + + usbc_dp: endpoint { + remote-endpoint = + <&tcphy0_typec_dp>; + }; + }; + }; + }; + + + + + }; + + vdd_gpu: vdd_gpu@60 { + compatible = "fcs,fan53200"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-regulator"; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1200000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + status = "okay"; + + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c8 { + + m24c08: m24c08@50 { + compatible = "atmel,24c08"; + reg = <0x50>; + }; +}; + +&i2s0 { + rockchip,playback-channels = <8>; + rockchip,capture-channels = <8>; + status = "okay"; +}; + +&i2s2 { + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + ep-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqn_cpm>; + status = "okay"; +}; + +&pwm0 { + status = "disabled"; +}; + +&pwm2 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin_pull_down>; +}; + +&pwm3 { + status = "disabled"; +}; + +&saradc { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + supports-emmc; + //mmc-hs400-enhanced-strobe; + non-removable; + keep-power-in-suspend; + status = "okay"; +}; + +&sdmmc { + clock-frequency = <150000000>; + clock-freq-min-max = <100000 150000000>; + supports-sd; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + num-slots = <1>; + //sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_s3>; + vqmmc-supply = <&vccio_sd>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + status = "okay"; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy0_dp { + port { + tcphy0_typec_dp: endpoint { + remote-endpoint = <&usbc_dp>; + }; + }; +}; + +&tcphy0_usb3 { + port { + tcphy0_typec_ss: endpoint { + remote-endpoint = <&usbc_ss>; + }; + }; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&vcc5v0_host>; + status = "okay"; + }; + + port { + u2phy0_typec_hs: endpoint { + remote-endpoint = <&usbc_hs>; + }; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + phy-supply = <&vcc5v0_host>; + status = "okay"; + }; +}; + +&usbdrd3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; + dr_mode = "host"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&pinctrl { + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = + <1 18 RK_FUNC_GPIO &pcfg_pull_up>, + <0 9 RK_FUNC_GPIO &pcfg_pull_none>; /* GPIO0_B1 */ + }; + vsel1_gpio: vsel1-gpio { + rockchip,pins = + <1 17 RK_FUNC_GPIO &pcfg_pull_down>; + }; + vsel2_gpio: vsel2-gpio { + rockchip,pins = + <1 14 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + usb2 { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = + <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb-typec { + vcc5v0_typec0_en_pin: vcc5v0-typec0-en-pin { + rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts new file mode 100644 index 000000000000..16f12e573472 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399-xiaobao-nas.dts @@ -0,0 +1,774 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "Codinge Xiaobao NAS"; + compatible = "codinge,xiaobao-nas", "rockchip,rk3399"; + + aliases { + mmc0 = &sdmmc; + mmc1 = &sdhci; + mmc2 = &sdio0; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>; + }; + + vcc_dc: vcc-dc { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + }; + + vcc_12v: vcc-12v { + compatible = "regulator-fixed"; + regulator-name = "vcc_12v"; + regulator-always-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_s3"; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8>; + }; + + vcc3v3_sys: vcc3v3-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-name = "vcc5v0_host"; + }; + + vcc_sd: vcc-sd { + compatible = "regulator-fixed"; + regulator-name = "vcc_sd"; + enable-active-high; + gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_sd_h>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vcc5v0_typec: vcc5v0-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec_en>; + regulator-name = "vcc5v0_typec"; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_12v>; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + enable-active-high; + gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pwr_en>; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc_lan: vcc3v3-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_lan"; + regulator-always-on; + regulator-boot-on; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <100>; + + recovery { + label = "Recovery"; + linux,code = <0x168>; + press-threshold-microvolt = <18000>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&leds_pins>; + + led1: system-led1 { + gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; + label = "system_led1"; + retain-state-suspended; + default-state = "on"; + }; + + led2: system-led2 { + gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; + label = "system_led2"; + retain-state-suspended; + default-state = "off"; + }; + }; + + pwm-fan { + compatible = "pwm-fan"; + pwms = <&pwm1 0 50000 0>; + }; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_b>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_b>; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_lan>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + ddc-i2c-scl-high-time-ns = <9625>; + ddc-i2c-scl-low-time-ns = <10000>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + 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 = "xin32k", "rk808-clkout2"; + 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 = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG4 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_dvp: LDO_REG1 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca_1v8: LDO_REG2 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_pmupll: LDO_REG3 { + regulator-name = "vcc1v8_pmupll"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_sdio: LDO_REG4 { + regulator-name = "vcc_sdio"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3000000>; + + 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 = <3000000>; + regulator-max-microvolt = <3000000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca1v8_codec: LDO_REG7 { + regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: 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>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel1_pin>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&vsel2_pin>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + hym8563@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + }; +}; + +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +&i2c4 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <160>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; + + typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + vbus-supply = <&vcc5v0_typec>; + }; +}; + +&i2s0 { + rockchip,capture-channels = <8>; + rockchip,playback-channels = <8>; + status = "okay"; +}; + +&i2s1 { + rockchip,capture-channels = <2>; + rockchip,playback-channels = <2>; + status = "okay"; +}; + +&i2s2 { + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sdio>; + gpio1830-supply = <&vcc_3v0>; +}; + +&pcie_phy { + status = "okay"; + drive-impedance-ohm = <50>; +}; + +&pcie0 { + ep-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; + num-lanes = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqnb_cpm &fn8274_en_h>; + status = "okay"; +}; + +&pmu_io_domains { + status = "okay"; + + pmu1830-supply = <&vcc_3v0>; +}; + +&pinctrl { + pcie { + fn8274_en_h: fn8274-en-h { + rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_output_high>, + <4 RK_PD5 RK_FUNC_GPIO &pcfg_output_high>, + <1 RK_PC7 RK_FUNC_GPIO &pcfg_output_high>; + }; + + pcie_pwr_en: pcie-pwr-en { + rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vsel1_pin: vsel1-pin { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + vsel2_pin: vsel2-pin { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + usb2 { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_typec_en: vcc5v0-typec-en { + rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; + + vcc_sd { + vcc_sd_h: vcc-sd-h { + rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + leds_pins: leds-pins { + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm1 { + status = "okay"; +}; + +&saradc { + status = "okay"; +}; + +&sdio0 { + bus-width = <4>; + clock-frequency = <50000000>; + cap-sdio-irq; + cap-sd-highspeed; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + num-slots = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + disable-wp; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vcc_sdio>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + non-removable; + status = "okay"; +}; + +&spi1 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x00>; + spi-max-frequency = <10000000>; + }; +}; + +&tcphy0 { + status = "okay"; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + status = "okay"; + + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; +}; + +&u2phy0_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&u2phy1 { + status = "okay"; +}; + +&u2phy1_otg { + status = "okay"; +}; + +&u2phy1_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usbdrd3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; + dr_mode = "host"; +}; + +&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"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts new file mode 100644 index 000000000000..3785bb5d7f3b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3399pro-tinker-edge-r.dts @@ -0,0 +1,1080 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (c) 2019 Radxa Limited + * Copyright (c) 2019 Amarula Solutions(India) + * Copyright (c) 2024 ARCW rk3399pro-tinker_edge_r + */ + +/dts-v1/; +#include +#include +#include "rk3399pro.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "ASUS Tinker Edge R"; + compatible = "ASUS,rk3399-tinker_edge_r", "rockchip,rk3399pro"; + + chosen { + stdout-path = "serial0:115200n8"; + // bootargs = "earlycon=uart8250,mmio32,0xff180000 swiotlb=1 coherent_pool=1m"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + pwr-led { + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; + retain-state-suspended = <1>; + }; + + act-led { + gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; + linux,default-trigger="mmc0"; + }; + + rsv-led { + gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + linux,default-trigger="none"; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; + }; + + rk_headset { + compatible = "rockchip_headset"; + headset_gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + io-channels = <&saradc 3>; + }; + + sdhci_pwrseq: sdhci-pwrseq { + compatible = "mmc-pwrseq-emmc"; + pinctrl-0 = <&sdhci_reset>; + pinctrl-names = "default"; + reset-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>; + }; + + display-subsystem{ + status = "okay"; + }; + + vdd_3v3_reg: fixedregulator_3v3 { + compatible = "regulator-fixed"; + regulator-name = "3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_sys: vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vbus_typec: vbus-typec { + compatible = "regulator-fixed"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-name = "vbus_typec"; + }; + + backlight: backlight { + status = "disabled"; + compatible = "pwm-backlight"; + pwms = <&pwm0 0 400000 0>;//f=2500 t=400,000ns + brightness-levels = < + 0 1 2 3 4 5 6 7 + 9 10 11 12 13 14 15 16 + 17 18 19 20 21 22 23 24 + 25 26 27 28 29 30 31 32 + 33 34 35 37 37 38 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63 + 64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95 + 96 97 98 99 100 101 102 103 + 104 105 106 107 108 109 110 111 + 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 + 128 129 130 131 132 133 134 135 + 136 137 138 139 140 141 142 143 + 144 145 146 147 148 149 150 151 + 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 + 168 169 170 171 172 173 174 175 + 176 177 178 179 180 181 182 183 + 184 185 186 187 188 189 190 191 + 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 + 208 209 210 211 212 213 214 215 + 216 217 218 219 220 221 222 223 + 224 225 226 227 228 229 230 231 + 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 + 248 249 250 251 252 253 254 255 + >; + default-brightness-level = <200>; + minimal-brightness-level = <26>; + soc_enablekl-gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; + enable_delay = <15>; + disable_delay = <5>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lvds_bl_en>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk809"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Mic Jack", "MICBIAS1", + "IN1P", "Mic Jack", + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR"; + simple-audio-card,cpu { + sound-dai = <&i2s1>; + }; + simple-audio-card,codec { + sound-dai = <&rk809_codec>; + }; + }; + + spdif-sound { + status = "okay"; + compatible = "simple-audio-card"; + simple-audio-card,name = "rockchip,spdif"; + simple-audio-card,cpu { + sound-dai = <&spdif>; + }; + simple-audio-card,codec { + sound-dai = <&spdif_out>; + }; + }; + + spdif_out: spdif-out { + status = "okay"; + compatible = "linux,spdif-dit"; + #sound-dai-cells = <0>; + }; + + hdmi_dp_sound: hdmi-dp-sound { + status = "okay"; + compatible = "rockchip,rk3399-hdmi-dp"; + rockchip,cpu = <&i2s2>; + rockchip,codec = <&hdmi>, <&cdn_dp>; + }; + + route_hdmi: route-hdmi { + status = "okay"; + logo,mode = "center"; + charge_logo,mode = "center"; + connect = <&vopb_out_hdmi>; + }; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_b>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_b>; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 16000 72000>; + wolirq-gpio = <&gpio3 16 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + tx_delay = <0x23>; + rx_delay = <0x22>; + wakeup-enable = "0"; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + status = "okay"; + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + #sound-dai-cells = <0>; // must exist + rockchip,phy-table = + <74250000 0x8009 0x0004 0x0272>, + <165000000 0x802b 0x0004 0x0209>, + <297000000 0x8039 0x0005 0x028d>, + <594000000 0x8039 0x0000 0x019d>, + <000000000 0x0000 0x0000 0x0000>; +}; + +&hdmi_in_vopl { + status = "disabled"; +}; + +&vopb { + status = "okay"; + // assigned-clocks = <&cru DCLK_VOP0_DIV>; + // assigned-clock-parents = <&cru PLL_VPLL>; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; + // assigned-clocks = <&cru DCLK_VOP1_DIV>; + // assigned-clock-parents = <&cru PLL_CPLL>; +}; + +&vopl_mmu { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + i2c-scl-rising-time-ns = <180>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <400000>; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default", "pmic-sleep", + "pmic-power-off", "pmic-reset"; + pinctrl-0 = <&pmic_int_l>; + pinctrl-1 = <&soc_slppin_slp>, <&rk809_slppin_slp>; + pinctrl-2 = <&soc_slppin_gpio>, <&rk809_slppin_pwrdn>; + pinctrl-3 = <&soc_slppin_gpio>, <&rk809_slppin_null>; + rockchip,system-power-controller; + pmic-reset-func = <0>; + wakeup-source; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc_buck5>; + vcc6-supply = <&vcc_buck5>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc5v0_sys>; + + pwrkey { + status = "okay"; + }; + + rtc { + status = "okay"; + }; + + pinctrl_rk8xx: pinctrl_rk8xx { + gpio-controller; + #gpio-cells = <2>; + + rk809_slppin_null: rk809_slppin_null { + pins = "gpio_slp"; + function = "pin_fun0"; + }; + + rk809_slppin_slp: rk809_slppin_slp { + pins = "gpio_slp"; + function = "pin_fun1"; + }; + + rk809_slppin_pwrdn: rk809_slppin_pwrdn { + pins = "gpio_slp"; + function = "pin_fun2"; + }; + + rk809_slppin_rst: rk809_slppin_rst { + pins = "gpio_slp"; + function = "pin_fun3"; + }; + }; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1025000>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <925000>; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1225000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc3v3_sys: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-initial-mode = <0x2>; + regulator-name = "vcc3v3_sys"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_buck5: DCDC_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc_buck5"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_0v9: LDO_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <925000>; + regulator-name = "vcca_0v9"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <925000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <1850000>; + + regulator-name = "vcc_1v8"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1850000>; + }; + }; + + vcc0v9_soc: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <950000>; + + regulator-name = "vcc0v9_soc"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcca_1v8: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <1850000>; + + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1850000>; + }; + }; + + vdd1v5_dvp: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <1850000>; + + regulator-name = "vdd1v5_dvp"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1550000>; + regulator-max-microvolt = <1550000>; + + regulator-name = "vcc_1v5"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG7 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3075000>; + regulator-max-microvolt = <3075000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1850000>; + regulator-max-microvolt = <3375000>; + + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_sd: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3375000>; + regulator-max-microvolt = <3375000>; + + regulator-name = "vcc_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc5v0_usb: SWITCH_REG1 { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + regulator-name = "vcc5v0_usb"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <5000000>; + }; + }; + + vccio_3v3: SWITCH_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-name = "vccio_3v3"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + }; + + rk809_codec: codec { + #sound-dai-cells = <0>; + compatible = "rockchip,rk809-codec", "rockchip,rk817-codec"; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_8ch_mclk>; + hp-volume = <20>; + spk-volume = <3>; + status = "okay"; + }; + }; + + vdd_cpu_b: fan53555@60 { + compatible = "fcs,fan53555"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-reg"; + pinctrl-0 = <&vsel1_gpio>; + vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1275000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + bq25700: bq25700@6b { + compatible = "ti,bq25703"; + reg = <0x6b>; + extcon = <&fusb0>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&charger_ok_int>; + ti,charge-current = <1500000>; + ti,max-charge-voltage = <8704000>; + ti,max-input-voltage = <20000000>; + ti,max-input-current = <6000000>; + ti,input-current-sdp = <500000>; + ti,input-current-dcp = <2000000>; + ti,input-current-cdp = <2000000>; + ti,input-current-dc = <2000000>; + ti,minimum-sys-voltage = <6700000>; + ti,otg-voltage = <5000000>; + ti,otg-current = <500000>; + ti,input-current = <500000>; + pd-charge-only = <0>; + status = "disabled"; + }; +}; + +&spdif { + status = "disabled"; + pinctrl-0 = <&spdif_bus>; + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; +}; + +&i2c1 { + status = "okay"; + i2c-scl-rising-time-ns = <140>; + i2c-scl-falling-time-ns = <30>; + status = "okay"; +}; + +&i2c2 { + status = "okay"; + i2c-scl-rising-time-ns = <140>; + i2c-scl-falling-time-ns = <30>; +}; + +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +&i2c4 { + i2c-scl-rising-time-ns = <345>; + i2c-scl-falling-time-ns = <11>; + status = "okay"; +}; + +&i2c8 { + status = "okay"; + i2c-scl-rising-time-ns = <345>; + i2c-scl-falling-time-ns = <11>; + clock-frequency = <100000>; + + fusb0: typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + pinctrl-names = "default"; + pinctrl-0 = <&fusb0_int>; + int-n-gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>; + vbus-5v-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; + vbus2-5v-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + + vdd_gpu: fan53555@60 { + compatible = "fcs,fan53555"; + reg = <0x60>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-reg"; + pinctrl-0 = <&vsel2_gpio>; + vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1225000>; + regulator-ramp-delay = <1000>; + fcs,suspend-voltage-selector = <1>; + regulator-always-on; + regulator-boot-on; + regulator-initial-state = <3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + +}; + +&i2s0 { + i2s_8ch_mclk: i2s-8ch-mclk { + rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; + }; +}; + +&i2s1 { + status = "okay"; +}; + +&i2s2 { + status = "okay"; +}; + +&io_domains { + status = "okay"; + bt656-supply = <&vcca_1v8>; + audio-supply = <&vcca_1v8>; + sdmmc-supply = <&vccio_sd>; + gpio1830-supply = <&vcc_3v0>; +}; + +&isp0_mmu { + status = "okay"; +}; + +&isp1_mmu { + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + status = "okay"; +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_1v8>; +}; + +&pwm2 { + status = "okay"; +}; + +// &isp0 { +// status = "okay"; + +// port { +// #address-cells = <1>; +// #size-cells = <0>; + +// isp0_mipi_in: endpoint@0 { +// reg = <0>; +// remote-endpoint = <&dphy_rx0_out>; +// }; +// }; +// }; + +// &isp1 { +// status = "okay"; + +// port { +// #address-cells = <1>; +// #size-cells = <0>; + +// isp1_mipi_in: endpoint@0 { +// reg = <0>; +// remote-endpoint = <&dphy_tx1rx1_out>; +// }; +// }; +// }; + +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&sdio0 { + status = "okay"; +}; + +&sdmmc { + status = "okay"; + supports-emmc; + sd-uhs-sdr12; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; +}; + +&sdhci { + mmc-pwrseq = <&sdhci_pwrseq>; + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + status = "okay"; +}; + +&spi1 { + status = "disable"; + max-freq = <48000000>; /* spi internal clk, don't modify */ + spi_dev@0 { + compatible = "rockchip,spidev"; + reg = <0>; + spi-max-frequency = <48000000>; + }; +}; + +&spi5 { + status = "disable"; + max-freq = <48000000>; //spi internal clk, don't modify + spi_dev@0 { + compatible = "rockchip,spidev"; + reg = <0>; //chip select 0:cs0 1:cs1 + id = <0>; + spi-max-frequency = <48000000>; //spi output clock + }; +}; + +&tcphy0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + extcon = <&fusb0>; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + phy-supply = <&vcc5v0_usb>; + status = "okay"; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + phy-supply = <&vcc5v0_usb>; + status = "okay"; + }; +}; + +&uart0 { + status = "okay"; +}; + +// &uart4 { +// status = "disable"; +// }; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usbdrd3_0 { + extcon = <&fusb0>; + status = "okay"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + dr_mode = "otg"; + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&vpu { + status = "okay"; + /* 0 means ion, 1 means drm */ + //allocator = <0>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&npu_ref_clk &gpio_init>; + + mipi_to_lvds { + /*pinctrl_lvds_hdmi_sel: lvds_hdmi_sel { + rockchip,pins = <0 5 0 &pcfg_pull_none>; + };*/ + + pinctrl_sn65dsi84_irq: sn65dsi84_irq{ + rockchip,pins = <1 RK_PB2 0 &pcfg_pull_none>; + }; + + pinctrl_lvds_bl_en: lvds_bl_en { + rockchip,pins = <1 RK_PB0 0 &pcfg_pull_none>; + }; + + pinctrl_sn65dsi84_en: sn65dsi84_en { + rockchip,pins = <1 RK_PA7 0 &pcfg_pull_none>; + }; + + pinctrl_lvds_vdd_en: lvds_vdd_en { + rockchip,pins = <1 RK_PB1 0 &pcfg_pull_none>; + }; + + pinctrl_pwr_source: pwr_source { + rockchip,pins = <0 RK_PA6 0 &pcfg_pull_none>; + }; + }; + + bq2570 { + charger_ok_int: charger-ok-int { + rockchip,pins = <1 RK_PA1 0 &pcfg_pull_up>; + }; + }; + + fusb30x { + fusb0_int: fusb0-int { + rockchip,pins = <1 RK_PA2 0 &pcfg_pull_up>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <0 RK_PB5 0 &pcfg_pull_up>; + }; + }; + + lcd_rst { + lcd_rst_gpio: lcd-rst-gpio { + rockchip,pins = <3 RK_PA4 0 &pcfg_pull_none>; + }; + }; + + gpio_init_config { + gpio_init: gpio_init { + rockchip,pins = + <1 9 0 &pcfg_pull_none>, + <1 10 0 &pcfg_pull_none>, + <1 7 0 &pcfg_pull_none>, + <1 8 0 &pcfg_pull_none>; + }; + }; + + npu_clk { + npu_ref_clk: npu-ref-clk { + rockchip,pins = + <0 RK_PA2 1 &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = + <1 RK_PC2 0 &pcfg_pull_up>; + }; + vsel1_gpio: vsel1-gpio { + rockchip,pins = + <1 RK_PC1 0 &pcfg_pull_down>; + }; + vsel2_gpio: vsel2-gpio { + rockchip,pins = + <1 RK_PB6 0 &pcfg_pull_down>; + }; + + soc_slppin_gpio: soc-slppin-gpio { + rockchip,pins = + <1 RK_PA5 0 &pcfg_output_low>; + }; + + soc_slppin_slp: soc-slppin-slp { + rockchip,pins = + <1 RK_PA5 1 &pcfg_pull_down>; + }; + + soc_slppin_rst: soc-slppin-rst { + rockchip,pins = + <1 RK_PA5 2 &pcfg_pull_none>; + }; + }; + + sdhci-pwrseq { + sdhci_reset: sdhci-reset { + rockchip,pins = <2 4 0 &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = + <2 RK_PD3 0 &pcfg_pull_none>; + }; + }; + + sdmmc { + sdmmc_bus1: sdmmc-bus1 { + rockchip,pins = + <4 RK_PB0 1 &pcfg_pull_up>; + }; + + sdmmc_bus4: sdmmc-bus4 { + rockchip,pins = + <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 1 &pcfg_pull_none>; + }; + + sdmmc_cmd: sdmmc-cmd { + rockchip,pins = + <4 RK_PB5 1 &pcfg_pull_up>; + }; + }; + + tp_irq { + tp_irq_gpio: tp-irq-gpio { + rockchip,pins = + <3 RK_PB0 0 &pcfg_pull_up>; + }; + }; + + // wireless-bluetooth { + // bt_irq_gpio: bt-irq-gpio { + // rockchip,pins = + // <0 RK_PA5 0 &pcfg_pull_down>; + // }; + + //uart0_gpios: uart0-gpios { + // rockchip,pins = + // <2 RK_PC3 0 &pcfg_pull_none>; + //}; + // }; + + // isp { + // test_clkout2: cif-test_clkout2 { + // rockchip,pins = + // /* test_clkout2 */ + // <0 8 3 &pcfg_pull_none>; + // }; + // }; +}; + diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts new file mode 100644 index 000000000000..f999fb2b46b4 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-firefly-roc-pc.dts @@ -0,0 +1,760 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (c) 2021 Rockchip Electronics Co., Ltd. + * + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Firefly rk3566-roc-pc"; + compatible = "firefly,rk3566-roc-pc", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc0; + mmc1 = &sdhci; + mmc2 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + vcc5v0_in: vcc5v0_in { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_in"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + 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 = <&vcc5v0_sys>; + }; + + vcc5v0_sys: vcc5v0_sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_in>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_otg: vcc5v0-otg-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_otg"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_otg_en>; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc3v3_pcie_p: vcc3v3-pcie-p-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_enable_h>; + regulator-name = "vcc3v3_pcie_p"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_3v3>; + }; + + firefly_leds: leds { + compatible = "gpio-leds"; + power_led: power { + label = "firefly:blue:power"; + linux,default-trigger = "ir-power-click"; + default-state = "on"; + gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_power>; + }; + + user_led: user { + label = "firefly:yellow:user"; + linux,default-trigger = "ir-user-click"; + default-state = "off"; + gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_user>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + status = "okay"; + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + rk_headset: rk-headset { + compatible = "rockchip_headset"; + headset_gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det>; + io-channels = <&saradc 2>; //HP_HOOK pin + }; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu_thermal { + trips { + cpu_hot: cpu_hot { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + }; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-supply = <&vcc_3v3>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + snps,reset-gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x4e>; + rx_delay = <0x2c>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint@0 { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + vin-supply = <&vcc5v0_sys>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + regulator-boot-on; + regulator-always-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; + rockchip,system-power-controller; + wakeup-source; + #clock-cells = <1>; + #sound-dai-cells = <0>; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + codec { + mic-in-differential; + }; + + regulators { + vdd_log: DCDC_REG1 { + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <1350000>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-boot-on; + regulator-name = "vcc3v3"; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + regulator-always-on; + regulator-boot-on; + }; + }; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_sclktx + &i2s1m0_lrcktx + &i2s1m0_sdi0 + &i2s1m0_sdo0>; + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + }; +}; + +&pcie2x1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_h>; + reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie_p>; + status = "okay"; +}; + +&pinctrl { + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic_int { + rockchip,pins = + <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_otg_en: vcc5v0-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + pcie_enable_h: pcie-enable-h { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie_reset_h: pcie-reset-h { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_power: led-power { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_user: led-user { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_1v8>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdmmc1 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + vmmc-supply = <&vcc3v3_sys>; + vqmmc-supply = <&vcca1v8_pmu>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk &uart9m1_xfer &uart8m1_xfer>; + status = "okay"; +}; + +&sdmmc2 { + cap-sd-highspeed; + cap-sdio-irq; + bus-width = <4>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcca1v8_pmu>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&tsadc { + status = "okay"; +}; + +&uart0 { +// pinctrl-names = "default"; +// pinctrl-0 = <&uart0_xfer>; + status = "disabled"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + status = "okay"; + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wake-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usb2phy0_otg { + vbus-supply = <&vcc5v0_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&vop { + compatible = "rockchip,rk3568-vop"; + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; \ No newline at end of file diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts new file mode 100644 index 000000000000..6a53d23a55a4 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-jp-tvbox.dts @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 tdleiyao + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "JP TVbox 3566"; + compatible = "JP-TVbox,rk3566", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-status { + label = "led-status"; + gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_status_enable_h>; + }; + }; + + vbus: vbus-regulator { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vbus>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + sdio_pwrseq: sdio-pwrseq { + status = "okay"; + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + post-power-on-delay-ms = <100>; + }; + + wireless_wlan: wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "ap6398s"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_irq>; + WIFI,host_wake_irq = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-supply = <&vcc_3v3>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + snps,reset-gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f, also works well here */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x41>; + rx_delay = <0x2e>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + status = "okay"; + }; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + 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>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-name = "vcc_ddr"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_npu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda_0v9"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_acodec"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + }; + }; +}; + +&pinctrl { + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + wifi_host_wake_irq: wifi-host-wake-irq { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_status_enable_h: led-status-enable-h { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_1v8>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sata2 { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc1 { + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + non-removable; + mmc-pwrseq = <&sdio_pwrseq>; + status = "okay"; + +}; + +&tsadc { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + status = "okay"; +}; + +&usb2phy1_otg { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts new file mode 100644 index 000000000000..7957970244d7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b-sata.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3566-orangepi-3b.dts" + +/ { + model = "Rockchip RK3566 OPi 3B with SATA instead of PCIe"; +}; + +&pcie2x1 { + status = "disabled"; +}; + +&sata2 { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts new file mode 100644 index 000000000000..0d385cfa23c0 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-orangepi-3b.dts @@ -0,0 +1,869 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2020 Rockchip Electronics Co., Ltd. + * + */ +/dts-v1/; + +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Rockchip RK3566 OPi 3B"; + compatible = "rockchip,rk3566-orangepi-3b", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + pwms = <&pwm7 0 50000 0>; + cooling-levels = <0 50 100 150 200 255>; + rockchip,temp-trips = < + 50000 1 + 55000 2 + 60000 3 + 65000 4 + 70000 5 + >; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>; + label = "status_led"; + linux,default-trigger = "heartbeat"; + }; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + + /* + * On the module itself this is one of these (depending + * on the actual card populated): + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ + post-power-on-delay-ms = <200>; + reset-gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_LOW>; + }; + + sprd-mtty { + compatible = "sprd,mtty"; + sprd,name = "ttyBT"; + }; + + unisoc_uwe_bsp: uwe-bsp { + compatible = "unisoc,uwe_bsp"; + wl-reg-on = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; + bt-reg-on = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + wl-wake-host-gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; + bt-wake-host; + bt-wake-host-gpio = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + sdio-ext-int-gpio = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + unisoc,btwf-file-name = "/lib/firmware/wcnmodem.bin"; + blksz-512; + keep-power-on; + }; + + /* labeled +12v in schematic */ + vcc12v_dcin: vcc12v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + /* labeled +5v in schematic */ + vcc_5v: vcc-5v-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_5v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc12v_dcin>; + }; + + vbus: vbus { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + /* labeled +3.3v For PCIe only in schematic */ + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_drv>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc12v_dcin>; + }; + + 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 = <&vbus>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vbus>; + }; + + vcc5v0_usb: vcc5v0-usb { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vbus>; + }; + + vcc_sd: vcc-sd { + compatible = "regulator-fixed"; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_sd"; + vin-supply = <&vcc3v3_sys>; + }; + + vcc5v0_host: vcc5v0-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + regulator-name = "vcc5v0_host"; + regulator-always-on; + }; + + vcc5v0_otg: vcc5v0-otg-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_otg_en>; + regulator-name = "vcc5v0_otg"; + regulator-always-on; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + + snps,reset-gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + //snps,reset-delays-us = <0 20000 100000>; + snps,reset-delays-us = <0 50000 200000>; + tx_delay = <0x30>; + rx_delay = <0x10>; + phy-handle = <&rgmii_phy0>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: syr837@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + vin-supply = <&vcc5v0_sys>; + regulator-compatible = "fan53555-reg"; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1390000>; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <1>; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + regulator-boot-on; + regulator-always-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default", "pmic-sleep", + "pmic-power-off", "pmic-reset"; + pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; + pinctrl-1 = <&soc_slppin_slp>, <&rk817_slppin_slp>; + pinctrl-2 = <&soc_slppin_gpio>, <&rk817_slppin_pwrdn>; + pinctrl-3 = <&soc_slppin_gpio>, <&rk817_slppin_rst>; + #sound-dai-cells = <0>; + + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + pinctrl_rk8xx: pinctrl_rk8xx { + gpio-controller; + #gpio-cells = <2>; + + rk817_slppin_null: rk817_slppin_null { + pins = "gpio_slp"; + function = "pin_fun0"; + }; + + rk817_slppin_slp: rk817_slppin_slp { + pins = "gpio_slp"; + function = "pin_fun1"; + }; + + rk817_slppin_pwrdn: rk817_slppin_pwrdn { + pins = "gpio_slp"; + function = "pin_fun2"; + }; + + rk817_slppin_rst: rk817_slppin_rst { + pins = "gpio_slp"; + function = "pin_fun3"; + }; + }; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_logic"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_gpu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-name = "vcc_ddr"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_npu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-boot-on; + regulator-always-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda_0v9"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vccio_acodec"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcc_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc_3v3"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vcc3v3_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + codec { + mic-in-differential; + }; + }; +}; + +/* + * i2c3_m0 is exposed on the 40-pin (green connectors) + * pin 27 - i2c3_sda_m0 + * pin 28 - i2c3_scl_m0 + */ +&i2c3 { + status = "okay"; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_sclktx + &i2s1m0_lrcktx + &i2s1m0_sdi0 + &i2s1m0_sdo0>; + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio1 { + rgmii_phy0: phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + }; +}; + +&pcie2x1 { + reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; + status = "okay"; +}; + +&pinctrl { + wireless-bluetooth { + uart1_gpios: uart1-gpios { + rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sd { + sdmmc0_pwr_h: sdmmc0-pwr-h { + rockchip,pins = + <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + mxc6655xa { + mxc6655xa_irq_gpio: mxc6655xa_irq_gpio { + rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic_int { + rockchip,pins = + <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + soc_slppin_gpio: soc_slppin_gpio { + rockchip,pins = + <0 RK_PA2 RK_FUNC_GPIO &pcfg_output_low>; + }; + + soc_slppin_slp: soc_slppin_slp { + rockchip,pins = + <0 RK_PA2 1 &pcfg_pull_none>; + }; + + soc_slppin_rst: soc_slppin_rst { + rockchip,pins = + <0 RK_PA2 2 &pcfg_pull_none>; + }; + }; + + touch { + touch_gpio: touch-gpio { + rockchip,pins = + <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_otg_en: vcc5v0-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + work-led { + leds_gpio: leds-gpio { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + headphone { + hp_det: hp-det { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + pcie { + pcie_drv: pcie-drv { + rockchip,pins = + <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + edp { + edp_hpd: edp-hpd { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bl_en: bl-en { + rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_output_high>; + }; + }; +}; + + /* + * There are 10 independent IO domains in RK3566/RK3568, including PMUIO[0:2] and VCCIO[1:7]. + * 1/ PMUIO0 and PMUIO1 are fixed-level power domains which cannot be configured; + * 2/ PMUIO2 and VCCIO1,VCCIO[3:7] domains require that their hardware power supply voltages + * must be consistent with the software configuration correspondingly + * a/ When the hardware IO level is connected to 1.8V, the software voltage configuration + * should also be configured to 1.8V accordingly; + * b/ When the hardware IO level is connected to 3.3V, the software voltage configuration + * should also be configured to 3.3V accordingly; + * 3/ VCCIO2 voltage control selection (0xFDC20140) + * BIT[0]: 0x0: from GPIO_0A7 (default) + * BIT[0]: 0x1: from GRF + * Default is determined by Pin FLASH_VOL_SEL/GPIO0_A7: + * L:VCCIO2 must supply 3.3V + * H:VCCIO2 must supply 1.8V + */ + +&pmu_io_domains { + status = "okay"; + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vcc_3v3>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; +}; + +&pwm7 { + status = "okay"; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcca_1v8>; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>; + status = "okay"; +}; + +&sdmmc0 { + max-frequency = <150000000>; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vccio_sd>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + status = "okay"; +}; + +&sdmmc1 { + max-frequency = <150000000>; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + sd-uhs-sdr104; + status = "okay"; +}; + +&sfc { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <100000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + status = "okay"; +}; + +&uart1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + uart-has-rtscts; +}; + +/* (debug) uart2 has connectors near the usb-c power, but also on the 40-pin pins 6 (tx) and 8 (rx) - don't wire both */ +&uart2 { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vbus>; + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + status = "okay"; +}; + +&usb2phy1_otg { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + extcon = <&usb2phy0>; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts new file mode 100644 index 000000000000..2d077f3bb36f --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-panther-x2.dts @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 tdleiyao + */ + +/dts-v1/; + +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Panther X2"; + compatible = "panther,x2", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc0; + mmc1 = &sdhci; + mmc2 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + //Corresponds to the actual order + led_pwr: led-pwr { + label = "led-pwr"; + default-state = "on"; + gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_pwr_enable_h>; + retain-state-suspended; + status = "okay"; + }; + + led_wifi: led-wifi { + label = "led-wifi"; + default-state = "off"; + gpios = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_wifi_enable_h>; + retain-state-suspended; + status = "okay"; + }; + + led_eth: led-eth { + label = "led-eth"; + default-state = "off"; + gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&led_eth_enable_h>; + retain-state-suspended; + status = "okay"; + }; + + led_status: led-status { + label = "led-status"; + default-state = "on"; + gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_status_enable_h>; + retain-state-suspended; + status = "okay"; + }; + }; + + vbus: vbus-regulator { + compatible = "regulator-fixed"; + regulator-name = "vbus"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vbus>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + sdio_pwrseq: sdio-pwrseq { + status = "okay"; + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_enable_h>; + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + post-power-on-delay-ms = <100>; + }; + + wireless_wlan: wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; + wifi_chip_type = "ap6236"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_irq>; + WIFI,host_wake_irq = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru SCLK_GMAC1>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-supply = <&vcc_3v3>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_clkinout + &gmac1m0_rgmii_bus>; + snps,reset-gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f, also works well here */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x30>; + rx_delay = <0x10>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + status = "okay"; + }; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + 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>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-ramp-delay = <6001>; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-name = "vcc_ddr"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-name = "vdd_npu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_image"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda_0v9"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-name = "vdda0v9_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_acodec"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vccio_sd"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pmu"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca_1v8"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_pmu"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "vcca1v8_image"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + status = "disabled"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + }; + }; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m1_sclktx &i2s1m1_sclkrx + &i2s1m1_lrcktx &i2s1m1_lrckrx + &i2s1m1_sdi0 &i2s1m1_sdi1 + &i2s1m1_sdi2 &i2s1m1_sdi3 + &i2s1m1_sdo0 &i2s1m1_sdo1 + &i2s1m1_sdo2 &i2s1m1_sdo3>; + status = "disabled"; +}; + +&pinctrl { + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wireless-wlan { + wifi_host_wake_irq: wifi-host-wake-irq { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_pwr_enable_h: led-pwr-enable-h { + rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_wifi_enable_h: led-wifi-enable-h { + rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_eth_enable_h: led-eth-enable-h { + rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_status_enable_h: led-status-enable-h { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vcc_3v3>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs200-1_8v; + non-removable; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + broken-cd; + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdmmc1 { + supports-sdio; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>; + non-removable; + mmc-pwrseq = <&sdio_pwrseq>; + status = "okay"; + +}; + +&tsadc { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi new file mode 100644 index 000000000000..9cc7aa3298d0 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3.dtsi @@ -0,0 +1,531 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +#include +#include +#include +#include "rk3566.dtsi" + +/ { + chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "d"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + + led-green { + color = ; + default-state = "on"; + function = LED_FUNCTION_HEARTBEAT; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + + vcc_1v8: regulator-1v8-vcc { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcca_1v8: regulator-1v8-vcca { + compatible = "regulator-fixed"; + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcca1v8_image: regulator-1v8-vcca-image { + compatible = "regulator-fixed"; + regulator-name = "vcca1v8_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcc_3v3: regulator-3v3-vcc { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc_sys: regulator-5v0-vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpio0 { + gpio-line-names = + /* GPIO0_A0 - A7 */ + "", "", "", "", "", "", "", "", + /* GPIO0_B0 - B7 */ + "", "", "", "", "", "", "", "", + /* GPIO0_C0 - C7 */ + "", "", "", "", "", "", "", "", + /* GPIO0_D0 - D7 */ + "pin-10 [GPIO0_D0]", "pin-08 [GPIO0_D1]", "", + "", "", "", "", ""; +}; + +&gpio1 { + gpio-line-names = + /* GPIO1_A0 - A7 */ + "pin-03 [GPIO1_A0]", "pin-05 [GPIO1_A1]", "", + "", "pin-37 [GPIO1_A4]", "", + "", "", + /* GPIO1_B0 - B7 */ + "", "", "", "", "", "", "", "", + /* GPIO1_C0 - C7 */ + "", "", "", "", "", "", "", "", + /* GPIO1_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpio2 { + gpio-line-names = + /* GPIO2_A0 - A7 */ + "", "", "", "", "", "", "", "", + /* GPIO2_B0 - B7 */ + "", "", "", "", "", "", "", "", + /* GPIO2_C0 - C7 */ + "", "", "", "", "", "", "", "", + /* GPIO2_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpio3 { + gpio-line-names = + /* GPIO3_A0 - A7 */ + "", "pin-11 [GPIO3_A1]", "pin-13 [GPIO3_A2]", + "pin-12 [GPIO3_A3]", "pin-35 [GPIO3_A4]", "pin-40 [GPIO3_A5]", + "pin-38 [GPIO3_A6]", "pin-36 [GPIO3_A7]", + /* GPIO3_B0 - B7 */ + "pin-15 [GPIO3_B0]", "pin-16 [GPIO3_B1]", "pin-18 [GPIO3_B2]", + "pin-29 [GPIO3_B3]", "pin-31 [GPIO3_B4]", "", + "", "", + /* GPIO3_C0 - C7 */ + "", "pin-22 [GPIO3_C1]", "pin-32 [GPIO3_C2]", + "pin-33 [GPIO3_C3]", "pin-07 [GPIO3_C4]", "", + "", "", + /* GPIO3_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpio4 { + gpio-line-names = + /* GPIO4_A0 - A7 */ + "", "", "", "", "", "", "", "", + /* GPIO4_B0 - B7 */ + "", "", "pin-27 [GPIO4_B2]", + "pin-28 [GPIO4_B3]", "", "", "", "", + /* GPIO4_C0 - C7 */ + "", "", "pin-23 [GPIO4_C2]", + "pin-19 [GPIO4_C3]", "", "pin-21 [GPIO4_C5]", + "pin-24 [GPIO4_C6]", "", + /* GPIO4_D0 - D7 */ + "", "", "", "", "", "", "", ""; +}; + +&gpu { + mali-supply = <&vdd_gpu_npu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda_0v9>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + #clock-cells = <1>; + clock-output-names = "rk817-clkout1", "rk817-clkout2"; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; + vcc3-supply = <&vcc_sys>; + vcc4-supply = <&vcc_sys>; + vcc5-supply = <&vcc_sys>; + vcc6-supply = <&vcc_sys>; + vcc7-supply = <&vcc_sys>; + vcc8-supply = <&vcc_sys>; + vcc9-supply = <&vcc5v_midu>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu_npu: DCDC_REG2 { + regulator-name = "vdd_gpu_npu"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc3v3_sys: DCDC_REG4 { + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca1v8_pmu: LDO_REG1 { + regulator-name = "vcca1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8_p: LDO_REG7 { + regulator-name = "vcc_1v8_p"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_dvp: LDO_REG8 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc2v8_dvp: LDO_REG9 { + regulator-name = "vcc2v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc5v_midu: BOOST { + regulator-name = "vcc5v_midu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vbus: OTG_SWITCH { + regulator-name = "vbus"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; + + vdd_cpu: regulator@40 { + compatible = "rockchip,rk8600"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1390000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&pinctrl { + leds { + user_led2: user-led2 { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcca1v8_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + vmmc-supply = <&vcc3v3_sys>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "peripheral"; + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + status = "okay"; +}; + +&usb2phy0_otg { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts new file mode 100644 index 000000000000..4a830eb09f0b --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3e.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3566-radxa-zero-3.dtsi" + +/ { + model = "Radxa ZERO 3E"; + compatible = "radxa,zero-3e", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdmmc0; + }; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; + clock_in_out = "input"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii-id"; + phy-supply = <&vcc_3v3>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m1_miim + &gmac1m1_tx_bus2 + &gmac1m1_rx_bus2 + &gmac1m1_rgmii_clk + &gmac1m1_rgmii_bus + &gmac1m1_clkinout>; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1_rstn>; + reset-assert-us = <20000>; + reset-deassert-us = <50000>; + reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + gmac1 { + gmac1_rstn: gmac1-rstn { + rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts new file mode 100644 index 000000000000..f92475c59deb --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-radxa-zero-3w.dts @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "rk3566-radxa-zero-3.dtsi" + +/ { + model = "Radxa ZERO 3W"; + compatible = "radxa,zero-3w", "rockchip,rk3566"; + + aliases { + mmc0 = &sdhci; + mmc1 = &sdmmc0; + mmc2 = &sdmmc1; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk817 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + post-power-on-delay-ms = <100>; + power-off-delay-us = <5000000>; + reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>; + }; +}; + +&pinctrl { + bluetooth { + bt_reg_on_h: bt-reg-on-h { + rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_host_h: bt-wake-host-h { + rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + host_wake_bt_h: host-wake-bt-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wifi_wake_host_h: wifi-wake-host-h { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&sdhci { + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <200000000>; + mmc-hs200-1_8v; + no-sd; + no-sdio; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc1 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; + uart-has-rtscts; + status = "okay"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts new file mode 100644 index 000000000000..774134de72a7 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3566-rock-3c.dts @@ -0,0 +1,786 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; +#include +#include +#include +#include +#include "rk3566.dtsi" + +/ { + model = "Radxa ROCK3 Model C"; + compatible = "radxa,rock3c", "rockchip,rk3566"; + + aliases { + ethernet0 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + mmc2 = &sdmmc1; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + leds { + compatible = "gpio-leds"; + + led_user: led-0 { + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_user_en>; + }; + }; + + pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + cooling-levels = <0 64 128 192 255>; + pwms = <&pwm15 0 40000 0>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk809 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + post-power-on-delay-ms = <100>; + power-off-delay-us = <5000000>; + reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>; + }; + + vcc5v_dcin: vcc5v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_pwr_en>; + regulator-name = "vcc3v3_pcie"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v_dcin>; + }; + + vcc5v0_usb_host: vcc5v0-usb-host-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_host_en>; + regulator-name = "vcc5v0_usb_host"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en>; + regulator-name = "vcc5v0_usb_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_cam: vcc-cam-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_cam_en>; + regulator-name = "vcc_cam"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_mipi: vcc-mipi-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_mipi_en>; + regulator-name = "vcc_mipi"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>; + clock_in_out = "input"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii"; + phy-supply = <&vcc_3v3>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m1_miim + &gmac1m1_tx_bus2 + &gmac1m1_rx_bus2 + &gmac1m1_rgmii_clk + &gmac1m1_clkinout + &gmac1m1_rgmii_bus>; + snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x47>; + rx_delay = <0x27>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>; + rockchip,system-power-controller; + #sound-dai-cells = <0>; + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + wakeup-source; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + codec { + mic-in-differential; + }; + }; + + eeprom: eeprom@50 { + compatible = "belling,bl24c16a", "atmel,24c16"; + reg = <0x50>; + pagesize = <16>; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_lrcktx &i2s1m0_sdi0 &i2s1m0_sdo0>; + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x1>; + }; +}; + +&pcie2x1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_h>; + reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; + status = "okay"; +}; + +&pinctrl { + bluetooth { + bt_reg_on_h: bt-reg-on-h { + rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_host_h: bt-wake-host-h { + rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_h: bt-host-wake-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + cam { + vcc_cam_en: vcc_cam_en { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + display { + vcc_mipi_en: vcc_mipi_en { + rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_user_en: led_user_en { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + pcie_pwr_en: pcie-pwr-en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + pcie_reset_h: pcie-reset-h { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc5v0_usb_host_en: vcc5v0-usb-host-en { + rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc5v0_usb_otg_en: vcc5v0-usb-otg-en { + rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake_h: wifi-host-wake-h { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcca1v8_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcca1v8_pmu>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pwm15 { + pinctrl-names = "active"; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr50; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sdmmc1 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc3v3_sys>; + vqmmc-supply = <&vcca1v8_pmu>; + status = "okay"; + + wifi@1 { + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_h>; + }; +}; + +&sfc { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x0>; + spi-max-frequency = <50000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_ctsn &uart1m0_rtsn &uart1m0_xfer>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rk809 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_h &bt_reg_on_h &bt_wake_host_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcca1v8_pmu>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts new file mode 100644 index 000000000000..f51e626f28a2 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h66k.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (c) 2022 AmadeusGhost +// Copyright (c) 2022 Flippy +// Copyright (c) 2023 amazingfate + +/dts-v1/; + +#include "rk3568-hinlink-h68k.dts" + +/ { + model = "HINLINK H66K"; + compatible = "hinlink,h66k", "rockchip,rk3568"; +}; + +&gmac0 { + status = "disabled"; +}; + +&gmac1 { + status = "disabled"; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts new file mode 100644 index 000000000000..7eed082c4edf --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-hinlink-h68k.dts @@ -0,0 +1,889 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +// Copyright (c) 2022 AmadeusGhost +// Copyright (c) 2023 amazingfate + +/dts-v1/; + +#include +#include +#include +#include +#include +#include "rk3568.dtsi" + +/ { + model = "HINLINK H68K"; + compatible = "hinlink,h68k", "rockchip,rk3568"; + + aliases { + ethernet0 = &gmac0; + ethernet1 = &gmac1; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + + led-boot = &led_work; + led-failsafe = &led_work; + led-running = &led_work; + led-upgrade = &led_work; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&reset_button_pin>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <50>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_net_en>, <&led_sata_en>, <&led_work_en>; + + led_net: net { + label = "blue:net"; + gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>; + }; + + led_sata: sata { + label = "amber:sata"; + gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>; + }; + + led_work: work { + label = "green:work"; + gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>; + }; + }; + + dc_12v: dc-12v-regulator { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + enable-active-high; + gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_sys_en>; + + vin-supply = <&vcc5v0_sys>; + }; + + /* wifi power + for H68K-MAX & H69K-MAX + */ + vcc3v3_pcie2: vcc3v3-pcie2-regulator { + compatible = "regulator-fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pcie2"; + regulator-boot-on; + + gpio = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_pcie2_en>; + vin-supply = <&vcc3v3_sys>; + }; + + /* eth 2.5g power + for H66K H69K + */ + vcc3v3_pcie3: vcc3v3-pcie3-regulator { + compatible = "regulator-fixed"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc3v3_pcie3"; + regulator-boot-on; + + enable-active-high; + gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; + + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_pcie3_en>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { + compatible = "regulator-fixed"; + + regulator-name = "vcc5v0_usb_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en>; + + vin-supply = <&vcc5v0_sys>; + + }; + + vcc3v3_sd_pwren: vcc3v3-sd-pwren-regulator { + compatible = "regulator-fixed"; + + regulator-name = "vcc3v3_sd_pwren"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; /* SD_PWREN */ + vin-supply = <&vcc3v3_sys>; + + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_sd_en>; + }; + + rk809-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "Analog RK809"; + simple-audio-card,mclk-fs = <256>; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 127 163 255>; + #cooling-cells = <2>; + fan-supply = <&vcc5v0_sys>; + pwms = <&pwm0 0 50000 0>; + }; +}; + +&combphy0 { + status = "okay"; +}; + +&combphy1 { + status = "okay"; +}; + +&combphy2 { + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu_thermal { + trips { + cpu_cool: cpu_cool { + temperature = <45000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_warm: cpu_warm { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + + cpu_hot: cpu_hot { + temperature = <65000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&cpu_cool>; + cooling-device = <&fan THERMAL_NO_LIMIT 1>; + }; + + map2 { + trip = <&cpu_warm>; + cooling-device = <&fan 2 THERMAL_NO_LIMIT>; + }; + + map3 { + trip = <&cpu_hot>; + cooling-device = <&fan 3 THERMAL_NO_LIMIT>; + }; + }; +}; + +&gmac0 { + assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; + assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_miim + &gmac0_tx_bus2 + &gmac0_rx_bus2 + &gmac0_rgmii_clk + &gmac0_rgmii_bus>; + snps,reset-gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 200000>; + tx_delay = <0x3c>; + rx_delay = <0x2f>; + phy-handle = <&rgmii_phy0>; + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m1_miim + &gmac1m1_tx_bus2 + &gmac1m1_rx_bus2 + &gmac1m1_rgmii_clk + &gmac1m1_rgmii_bus>; + snps,reset-gpio = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 50000 200000>; + tx_delay = <0x3c>; + rx_delay = <0x2f>; + phy-handle = <&rgmii_phy1>; + status = "okay"; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + + interrupt-parent = <&gpio0>; + interrupts = ; + + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #sound-dai-cells = <0>; + + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>; + + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + + pwrkey { + status = "okay"; + }; + + pinctrl_rk8xx: pinctrl_rk8xx { + gpio-controller; + #gpio-cells = <2>; + + rk817_slppin_null: rk817_slppin_null { + pins = "gpio_slp"; + function = "pin_fun0"; + }; + + rk817_slppin_slp: rk817_slppin_slp { + pins = "gpio_slp"; + function = "pin_fun1"; + }; + + rk817_slppin_pwrdn: rk817_slppin_pwrdn { + pins = "gpio_slp"; + function = "pin_fun2"; + }; + + rk817_slppin_rst: rk817_slppin_rst { + pins = "gpio_slp"; + function = "pin_fun3"; + }; + }; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-init-microvolt = <900000>; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + + rk809_codec: codec { + #sound-dai-cells = <0>; + compatible = "rockchip,rk809-codec", "rockchip,rk817-codec"; + clocks = <&cru I2S1_MCLKOUT_TX>; + clock-names = "mclk"; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1m0_mclk>; + hp-volume = <20>; + spk-volume = <3>; + mic-in-differential; + status = "okay"; + }; + }; +}; + +&i2c5 { + status = "okay"; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio0 { + rgmii_phy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + phy-supply = <&vcc3v3_sys>; + reg = <0x0>; + }; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + phy-supply = <&vcc3v3_sys>; + reg = <0x0>; + }; +}; + +&pcie2x1 { + reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie2>; + status = "okay"; +}; + +&pcie30phy { + data-lanes = <1 2>; + status = "okay"; +}; + +&pcie3x1 { + num-lanes = <1>; + reset-gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie3>; + status = "okay"; + + pcie@0,0 { + reg = <0x00100000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + + rtl8125_1: pcie-eth@10,0 { + compatible = "pci10ec,8125"; + reg = <0x000000 0 0 0 0>; + realtek,led-data = <0x0200>; + }; + }; +}; + +&pcie3x2 { + num-lanes = <1>; + rockchip,init-delay-ms = <100>; + reset-gpios = <&gpio2 RK_PD0 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie3>; + status = "okay"; + + pcie@0,0 { + reg = <0x00200000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + + rtl8125_2: pcie-eth@20,0 { + compatible = "pci10ec,8125"; + reg = <0x000000 0 0 0 0>; + realtek,led-data = <0x0200>; + }; + }; +}; + +&pinctrl { + button { + reset_button_pin: reset-button-pin { + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + led_work_en: led-work-en { + rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_sata_en: led-user-en { + rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + led_net_en: led-net-en { + rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + vcc { + vcc3v3_sys_en: vcc3v3-sys-en { + rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int: pmic-int { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb { + vcc5v0_usb_otg_en: vcc5v0-usb-otg-en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sd { + vcc3v3_sd_en: vcc3v3-sd_en { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + vcc3v3_pcie2_en: vcc3v3_pcie2_en { + rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + vcc3v3_pcie3_en: vcc3v3_pcie3_en { + rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_1v8>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&pwm0 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sata0 { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + + cap-sd-highspeed; + max-frequency = <50000000>; + disable-wp; + + vmmc-supply = <&vcc3v3_sd_pwren>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + status = "disabled"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts new file mode 100644 index 000000000000..2cb03c95a0f4 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/dt/rk3568-odroid-m1.dts @@ -0,0 +1,775 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Hardkernel Co., Ltd. + * + */ + +/dts-v1/; +#include +#include +#include +#include +#include "rk3568.dtsi" + +/ { + model = "Hardkernel ODROID-M1"; + compatible = "rockchip,rk3568-odroid-m1", "rockchip,rk3568"; + + aliases { + ethernet0 = &gmac0; + i2c0 = &i2c3; + i2c3 = &i2c0; + mmc0 = &sdhci; + mmc1 = &sdmmc0; + serial0 = &uart1; + serial1 = &uart0; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + dc_12v: dc-12v-regulator { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_receiver_pin>; + }; + + leds { + compatible = "gpio-leds"; + + led_power: led-0 { + gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_POWER; + color = ; + default-state = "keep"; + linux,default-trigger = "default-on"; + pinctrl-names = "default"; + pinctrl-0 = <&led_power_pin>; + }; + led_work: led-1 { + gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&led_work_pin>; + }; + }; + + rk809-sound { + compatible = "simple-audio-card"; + pinctrl-names = "default"; + pinctrl-0 = <&hp_det_pin>; + simple-audio-card,name = "Analog RK817"; + simple-audio-card,format = "i2s"; + simple-audio-card,hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + + simple-audio-card,cpu { + sound-dai = <&i2s1_8ch>; + }; + + simple-audio-card,codec { + sound-dai = <&rk809>; + }; + }; + + vcc3v3_pcie: vcc3v3-pcie-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_pcie"; + enable-active-high; + gpio = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc3v3_pcie_en_pin>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + startup-delay-us = <5000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcc3v3_sys: vcc3v3-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&dc_12v>; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc5v0_usb_host: vcc5v0-usb-host-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_host"; + enable-active-high; + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_host_en_pin>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb_otg"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en_pin>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&combphy0 { + /* Used for USB3 */ + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&combphy1 { + /* Used for USB3 */ + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&combphy2 { + /* used for SATA */ + status = "okay"; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gmac0 { + assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; + assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "output"; + phy-handle = <&rgmii_phy0>; + phy-mode = "rgmii"; + phy-supply = <&vcc3v3_sys>; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_miim + &gmac0_tx_bus2 + &gmac0_rx_bus2 + &gmac0_rgmii_clk + &gmac0_rgmii_bus>; + status = "okay"; + + tx_delay = <0x4f>; + rx_delay = <0x2d>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc3v3_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = ; + assigned-clocks = <&cru I2S1_MCLKOUT_TX>; + assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; + #clock-cells = <1>; + clock-names = "mclk"; + clocks = <&cru I2S1_MCLKOUT_TX>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>; + rockchip,system-power-controller; + #sound-dai-cells = <0>; + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc5-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + wakeup-source; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: DCDC_REG2 { + regulator-name = "vdd_gpu"; + regulator-always-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vdd_npu: DCDC_REG4 { + regulator-name = "vdd_npu"; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG5 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_image: LDO_REG1 { + regulator-name = "vdda0v9_image"; + regulator-always-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca_1v8: LDO_REG7 { + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcca1v8_pmu: LDO_REG8 { + regulator-name = "vcca1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcca1v8_image: LDO_REG9 { + regulator-name = "vcca1v8_image"; + regulator-always-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3: SWITCH_REG1 { + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_sd: SWITCH_REG2 { + regulator-name = "vcc3v3_sd"; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&i2s0_8ch { + status = "okay"; +}; + +&i2s1_8ch { + rockchip,trcm-sync-tx-only; + status = "okay"; +}; + +&mdio0 { + rgmii_phy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0x0>; + reset-assert-us = <20000>; + reset-deassert-us = <100000>; + reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + }; +}; + +&pcie30phy { + status = "okay"; +}; + +&pcie3x2 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie_reset_pin>; + reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>; + vpcie3v3-supply = <&vcc3v3_pcie>; + status = "okay"; +}; + +&pinctrl { + fspi { + fspi_dual_io_pins: fspi-dual-io-pins { + rockchip,pins = + /* fspi_clk */ + <1 RK_PD0 1 &pcfg_pull_none>, + /* fspi_cs0n */ + <1 RK_PD3 1 &pcfg_pull_none>, + /* fspi_d0 */ + <1 RK_PD1 1 &pcfg_pull_none>, + /* fspi_d1 */ + <1 RK_PD2 1 &pcfg_pull_none>; + }; + }; + + ir-receiver { + ir_receiver_pin: ir-receiver-pin { + /* external pullup to VCC3V3_SYS */ + rockchip,pins = <0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + leds { + led_power_pin: led-power-pin { + rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + led_work_pin: led-work-pin { + rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pcie { + pcie_reset_pin: pcie-reset-pin { + rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + vcc3v3_pcie_en_pin: vcc3v3-pcie-en-pin { + rockchip,pins = <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + rk809 { + hp_det_pin: hp-det-pin { + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_usb_host_en_pin: vcc5v0-usb-host-en-pin { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + vcc5v0_usb_otg_en_pin: vcc5v0-usb-dr-en-pin { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc3v3_pmu>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sata2 { + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe &emmc_rstnout>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&sdmmc0 { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; + disable-wp; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; + sd-uhs-sdr50; + vmmc-supply = <&vcc3v3_sd>; + vqmmc-supply = <&vccio_sd>; + status = "okay"; +}; + +&sfc { + /* Dual I/O mode as the D2 pin conflicts with the eMMC */ + pinctrl-0 = <&fspi_dual_io_pins>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <100000000>; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SPL"; + reg = <0x0 0xe0000>; + }; + partition@e0000 { + label = "U-Boot Env"; + reg = <0xe0000 0x20000>; + }; + partition@100000 { + label = "U-Boot"; + reg = <0x100000 0x200000>; + }; + partition@300000 { + label = "splash"; + reg = <0x300000 0x100000>; + }; + partition@400000 { + label = "Filesystem"; + reg = <0x400000 0xc00000>; + }; + }; + }; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host0_xhci { + dr_mode = "host"; + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&usb2phy1_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy1_otg { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = ; + remote-endpoint = <&hdmi_in_vp0>; + }; +}; + +&i2c3 { + status = "disabled"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c3m1_xfer>; +}; + +&pwm1 { + status = "disabled"; + pinctrl-0 = <&pwm1m1_pins>; +}; + +&pwm2 { + status = "disabled"; + pinctrl-0 = <&pwm2m1_pins>; +}; + +&spi0 { + status = "disabled"; + + pinctrl-0 = <&spi0m1_pins>; + pinctrl-1 = <&spi0m1_pins_hs>; + num_chipselect = <1>; + + cs-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>; +}; + +&uart1 { + status = "disabled"; + dma-names = "tx", "rx"; + /* uart1 uart1-with-ctsrts */ + pinctrl-0 = <&uart1m1_xfer>; + pinctrl-1 = <&uart1m1_xfer &uart1m1_ctsn &uart1m1_rtsn>; +}; diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch new file mode 100644 index 000000000000..c74bfad3e38f --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-dt-doc.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony +Date: Wed, 3 Mar 2021 07:59:25 +0100 +Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676) + +> X-Git-Archeology: > recovered message: > * RK3399 NanoPC-T4 Add Type-C alt mode DP +> X-Git-Archeology: > recovered message: > * rk3399 rockpi 4C add mini-DP (WIP) +> X-Git-Archeology: > recovered message: > * [ rockchip64 ] revert rockPi 4C DP patch +> X-Git-Archeology: > recovered message: > Add an extension to disable it, but leave for future work. +> X-Git-Archeology: - Revision 4971535c774a1f49a811baebc083ea028ced0300: https://github.com/armbian/build/commit/4971535c774a1f49a811baebc083ea028ced0300 +> X-Git-Archeology: Date: Wed, 03 Mar 2021 07:59:25 +0100 +> X-Git-Archeology: From: Tony +> X-Git-Archeology: Subject: RK3399 Typec DP (#2676) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml | 66 ++++++++++ + 1 file changed, 66 insertions(+) + +diff --git a/Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml b/Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml +new file mode 100644 +index 000000000000..8110fbe2ddc2 +--- /dev/null ++++ b/Documentation/devicetree/bindings/extcon/extcon-usbc-virtual-pd.yaml +@@ -0,0 +1,66 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/extcon/extcon-usbc-virtual-pd.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Type-C Virtual PD extcon ++ ++maintainers: ++ - Jagan Teki ++ ++description: | ++ USB Type-C protocol supports various modes of operations includes PD, ++ USB3, and Altmode. If the platform design supports a Type-C connector ++ then configuring these modes can be done via enumeration. ++ ++ However, there are some platforms that design these modes as separate ++ protocol connectors like design Display Port from on-chip USB3 controller. ++ So we can access Type-C Altmode Display Port via onboard Display Port ++ connector instead of a Type-C connector. These kinds of platforms require ++ an explicit extcon driver in order to handle Power Delivery and ++ Port Detection. ++ ++properties: ++ compatible: ++ const: linux,extcon-usbc-virtual-pd ++ ++ det-gpios: ++ description: Detect GPIO pin. Pin can be Display Port Detect or USB ID. ++ maxItems: 1 ++ ++ vpd-polarity: ++ description: USB Type-C Polarity. false for Normal and true for Flip. ++ type: boolean ++ ++ vpd-super-speed: ++ description: USB Super Speed. false for USB2 and true for USB3. ++ type: boolean ++ ++ vpd-data-role: ++ description: USB Data roles for Virtual Type-C. ++ $ref: /schemas/types.yaml#definitions/string ++ ++ enum: ++ - host ++ - device ++ - display-port ++ ++required: ++ - compatible ++ - det-gpios ++ - vpd-data-role ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ #include ++ ++ virtual_pd: virtual-pd { ++ compatible = "linux,extcon-usbc-virtual-pd"; ++ det-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; ++ vpd-data-role = "display-port"; ++ vpd-super-speed; ++ }; +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch new file mode 100644 index 000000000000..00551e8b3159 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-miniDP-virtual-extcon.patch @@ -0,0 +1,382 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony +Date: Wed, 3 Mar 2021 07:59:25 +0100 +Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676) + +> X-Git-Archeology: > recovered message: > * RK3399 NanoPC-T4 Add Type-C alt mode DP +> X-Git-Archeology: > recovered message: > * rk3399 rockpi 4C add mini-DP (WIP) +> X-Git-Archeology: > recovered message: > * [ rockchip64 ] revert rockPi 4C DP patch +> X-Git-Archeology: > recovered message: > Add an extension to disable it, but leave for future work. +> X-Git-Archeology: - Revision 4971535c774a1f49a811baebc083ea028ced0300: https://github.com/armbian/build/commit/4971535c774a1f49a811baebc083ea028ced0300 +> X-Git-Archeology: Date: Wed, 03 Mar 2021 07:59:25 +0100 +> X-Git-Archeology: From: Tony +> X-Git-Archeology: Subject: RK3399 Typec DP (#2676) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 0cdffb29b07305209efb12cf3b5ac6032d3a1153: https://github.com/armbian/build/commit/0cdffb29b07305209efb12cf3b5ac6032d3a1153 +> X-Git-Archeology: Date: Wed, 24 Mar 2021 19:01:53 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Renaming DEV branch to EDGE (#2704) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6765f734cc4a22aeaa9f99a3ad28c8c322de26f6: https://github.com/armbian/build/commit/6765f734cc4a22aeaa9f99a3ad28c8c322de26f6 +> X-Git-Archeology: Date: Tue, 25 Oct 2022 11:26:51 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump rockchip64 edge to 6.0.y (#4337) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + drivers/extcon/Kconfig | 10 + + drivers/extcon/Makefile | 1 + + drivers/extcon/extcon-usbc-virtual-pd.c | 285 ++++++++++ + 3 files changed, 296 insertions(+) + +diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig +index 8de9023c2a38..21f0f856cacb 100644 +--- a/drivers/extcon/Kconfig ++++ b/drivers/extcon/Kconfig +@@ -191,4 +191,14 @@ config EXTCON_USBC_TUSB320 + Say Y here to enable support for USB Type C cable detection extcon + support using a TUSB320. + ++config EXTCON_USBC_VIRTUAL_PD ++ tristate "Virtual Type-C PD EXTCON support" ++ depends on GPIOLIB || COMPILE_TEST ++ help ++ Say Y here to enable Virtual Type-C PD extcon driver support, if ++ hardware platform designed Type-C modes separately. ++ ++ Example, of designing Display Port separately from Type-C Altmode ++ instead of accessing Altmode Display Port in Type-C connector. ++ + endif +diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile +index 1b390d934ca9..57c1e65bfcfd 100644 +--- a/drivers/extcon/Makefile ++++ b/drivers/extcon/Makefile +@@ -25,3 +25,4 @@ obj-$(CONFIG_EXTCON_RTK_TYPE_C) += extcon-rtk-type-c.o + obj-$(CONFIG_EXTCON_USBC_CROS_EC) += extcon-usbc-cros-ec.o + obj-$(CONFIG_EXTCON_USBC_TUSB320) += extcon-usbc-tusb320.o + obj-$(CONFIG_EXTCON_RTK_TYPE_C) += extcon-rtk-type-c.o ++obj-$(CONFIG_EXTCON_USBC_VIRTUAL_PD) += extcon-usbc-virtual-pd.o +diff --git a/drivers/extcon/extcon-usbc-virtual-pd.c b/drivers/extcon/extcon-usbc-virtual-pd.c +new file mode 100644 +index 000000000000..e0713670e33d +--- /dev/null ++++ b/drivers/extcon/extcon-usbc-virtual-pd.c +@@ -0,0 +1,285 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Type-C Virtual PD Extcon driver ++ * ++ * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd ++ * Copyright (c) 2019 Radxa Limited ++ * Copyright (c) 2019 Amarula Solutions(India) ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static const unsigned int vpd_cable[] = { ++ EXTCON_USB, ++ EXTCON_USB_HOST, ++ EXTCON_DISP_DP, ++ EXTCON_NONE, ++}; ++ ++enum vpd_data_role { ++ DR_NONE, ++ DR_HOST, ++ DR_DEVICE, ++ DR_DISPLAY_PORT, ++}; ++ ++enum vpd_polarity { ++ POLARITY_NORMAL, ++ POLARITY_FLIP, ++}; ++ ++enum vpd_usb_ss { ++ USB_SS_USB2, ++ USB_SS_USB3, ++}; ++ ++struct vpd_extcon { ++ struct device *dev; ++ struct extcon_dev *extcon; ++ struct gpio_desc *det_gpio; ++ ++ u8 polarity; ++ u8 usb_ss; ++ enum vpd_data_role data_role; ++ ++ int irq; ++ bool enable_irq; ++ struct work_struct work; ++ struct delayed_work irq_work; ++}; ++ ++static void vpd_extcon_irq_work(struct work_struct *work) ++{ ++ struct vpd_extcon *vpd = container_of(work, struct vpd_extcon, irq_work.work); ++ bool host_connected = false, device_connected = false, dp_connected = false; ++ union extcon_property_value property; ++ int det; ++ ++ det = vpd->det_gpio ? gpiod_get_raw_value(vpd->det_gpio) : 0; ++ if (det) { ++ device_connected = (vpd->data_role == DR_DEVICE) ? true : false; ++ host_connected = (vpd->data_role == DR_HOST) ? true : false; ++ dp_connected = (vpd->data_role == DR_DISPLAY_PORT) ? true : false; ++ } ++ ++ extcon_set_state(vpd->extcon, EXTCON_USB, host_connected); ++ extcon_set_state(vpd->extcon, EXTCON_USB_HOST, device_connected); ++ extcon_set_state(vpd->extcon, EXTCON_DISP_DP, dp_connected); ++ ++ property.intval = vpd->polarity; ++ extcon_set_property(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_TYPEC_POLARITY, property); ++ extcon_set_property(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_TYPEC_POLARITY, property); ++ extcon_set_property(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_TYPEC_POLARITY, property); ++ ++ property.intval = vpd->usb_ss; ++ extcon_set_property(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_SS, property); ++ extcon_set_property(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_SS, property); ++ extcon_set_property(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_SS, property); ++ ++ extcon_sync(vpd->extcon, EXTCON_USB); ++ extcon_sync(vpd->extcon, EXTCON_USB_HOST); ++ extcon_sync(vpd->extcon, EXTCON_DISP_DP); ++} ++ ++static irqreturn_t vpd_extcon_irq_handler(int irq, void *dev_id) ++{ ++ struct vpd_extcon *vpd = dev_id; ++ ++ schedule_delayed_work(&vpd->irq_work, msecs_to_jiffies(10)); ++ ++ return IRQ_HANDLED; ++} ++ ++static enum vpd_data_role vpd_extcon_data_role(struct vpd_extcon *vpd) ++{ ++ const char *const data_roles[] = { ++ [DR_NONE] = "NONE", ++ [DR_HOST] = "host", ++ [DR_DEVICE] = "device", ++ [DR_DISPLAY_PORT] = "display-port", ++ }; ++ struct device *dev = vpd->dev; ++ int ret; ++ const char *dr; ++ ++ ret = device_property_read_string(dev, "vpd-data-role", &dr); ++ if (ret < 0) ++ return DR_NONE; ++ ++ ret = match_string(data_roles, ARRAY_SIZE(data_roles), dr); ++ ++ return (ret < 0) ? DR_NONE : ret; ++} ++ ++static int vpd_extcon_parse_dts(struct vpd_extcon *vpd) ++{ ++ struct device *dev = vpd->dev; ++ bool val = false; ++ int ret; ++ ++ val = device_property_read_bool(dev, "vpd-polarity"); ++ if (val) ++ vpd->polarity = POLARITY_FLIP; ++ else ++ vpd->polarity = POLARITY_NORMAL; ++ ++ val = device_property_read_bool(dev, "vpd-super-speed"); ++ if (val) ++ vpd->usb_ss = USB_SS_USB3; ++ else ++ vpd->usb_ss = USB_SS_USB2; ++ ++ vpd->data_role = vpd_extcon_data_role(vpd); ++ ++ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_OUT_LOW); ++ if (IS_ERR(vpd->det_gpio)) { ++ ret = PTR_ERR(vpd->det_gpio); ++ dev_warn(dev, "failed to get det gpio: %d\n", ret); ++ return ret; ++ } ++ ++ vpd->irq = gpiod_to_irq(vpd->det_gpio); ++ if (vpd->irq < 0) { ++ dev_err(dev, "failed to get irq for gpio: %d\n", vpd->irq); ++ return vpd->irq; ++ } ++ ++ ret = devm_request_threaded_irq(dev, vpd->irq, NULL, ++ vpd_extcon_irq_handler, ++ IRQF_TRIGGER_FALLING | ++ IRQF_TRIGGER_RISING | IRQF_ONESHOT, ++ NULL, vpd); ++ if (ret) ++ dev_err(dev, "failed to request gpio irq\n"); ++ ++ return ret; ++} ++ ++static int vpd_extcon_probe(struct platform_device *pdev) ++{ ++ struct vpd_extcon *vpd; ++ struct device *dev = &pdev->dev; ++ int ret; ++ ++ vpd = devm_kzalloc(dev, sizeof(*vpd), GFP_KERNEL); ++ if (!vpd) ++ return -ENOMEM; ++ ++ vpd->dev = dev; ++ ret = vpd_extcon_parse_dts(vpd); ++ if (ret) ++ return ret; ++ ++ INIT_DELAYED_WORK(&vpd->irq_work, vpd_extcon_irq_work); ++ ++ vpd->extcon = devm_extcon_dev_allocate(dev, vpd_cable); ++ if (IS_ERR(vpd->extcon)) { ++ dev_err(dev, "allocat extcon failed\n"); ++ return PTR_ERR(vpd->extcon); ++ } ++ ++ ret = devm_extcon_dev_register(dev, vpd->extcon); ++ if (ret) { ++ dev_err(dev, "register extcon failed: %d\n", ret); ++ return ret; ++ } ++ ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_VBUS); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_VBUS); ++ ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(vpd->extcon, EXTCON_USB_HOST, ++ EXTCON_PROP_USB_SS); ++ ++ extcon_set_property_capability(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_SS); ++ extcon_set_property_capability(vpd->extcon, EXTCON_DISP_DP, ++ EXTCON_PROP_USB_TYPEC_POLARITY); ++ ++ platform_set_drvdata(pdev, vpd); ++ ++ vpd_extcon_irq_work(&vpd->irq_work.work); ++ ++ return 0; ++} ++ ++static int vpd_extcon_remove(struct platform_device *pdev) ++{ ++ struct vpd_extcon *vpd = platform_get_drvdata(pdev); ++ ++ cancel_delayed_work_sync(&vpd->irq_work); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_PM_SLEEP ++static int vpd_extcon_suspend(struct device *dev) ++{ ++ struct vpd_extcon *vpd = dev_get_drvdata(dev); ++ ++ if (!vpd->enable_irq) { ++ disable_irq_nosync(vpd->irq); ++ vpd->enable_irq = true; ++ } ++ ++ return 0; ++} ++ ++static int vpd_extcon_resume(struct device *dev) ++{ ++ struct vpd_extcon *vpd = dev_get_drvdata(dev); ++ ++ if (vpd->enable_irq) { ++ enable_irq(vpd->irq); ++ vpd->enable_irq = false; ++ } ++ ++ return 0; ++} ++#endif ++ ++static SIMPLE_DEV_PM_OPS(vpd_extcon_pm_ops, ++ vpd_extcon_suspend, vpd_extcon_resume); ++ ++static const struct of_device_id vpd_extcon_dt_match[] = { ++ { .compatible = "linux,extcon-usbc-virtual-pd", }, ++ { /* sentinel */ } ++}; ++ ++static struct platform_driver vpd_extcon_driver = { ++ .probe = vpd_extcon_probe, ++ .remove = vpd_extcon_remove, ++ .driver = { ++ .name = "extcon-usbc-virtual-pd", ++ .pm = &vpd_extcon_pm_ops, ++ .of_match_table = vpd_extcon_dt_match, ++ }, ++}; ++ ++module_platform_driver(vpd_extcon_driver); ++ ++MODULE_AUTHOR("Jagan Teki "); ++MODULE_DESCRIPTION("Type-C Virtual PD extcon driver"); ++MODULE_LICENSE("GPL v2"); +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch new file mode 100644 index 000000000000..3a0c05e60cab --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-compilation-support.patch @@ -0,0 +1,64 @@ +From a8f9689004d59f0a454ce8cb06bf1556971c1bad Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Sat, 20 Jul 2024 13:58:49 +0200 +Subject: [PATCH] compile .scr and install overlays in right path + +--- + scripts/Makefile.dtbinst | 13 ++++++++++++- + scripts/Makefile.lib | 8 +++++++- + 2 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index 9d920419a62c..9144a1b7c909 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -33,7 +33,18 @@ endef + + $(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) + +-dtbs := $(notdir $(dtbs)) ++# Very convoluted way to flatten all the device tree ++# directories, but keep the "/overlay/" directory ++ ++# topmost directory (ie: from rockchip/overlay/rk322x-emmc.dtbo extracts rockchip) ++topmost_dir = $(firstword $(subst /, ,$(dtbs))) ++# collect dtbs entries which starts with "$topmost_dir/overlay/", then remove "$topmost_dir" ++dtbs_overlays = $(subst $(topmost_dir)/,,$(filter $(topmost_dir)/overlay/%, $(dtbs))) ++# collect the non-overlay dtbs ++dtbs_regular = $(filter-out $(topmost_dir)/overlay/%, $(dtbs)) ++# compose the dtbs variable flattening all the non-overlays entries ++# and appending the overlays entries ++dtbs := $(notdir $(dtbs_regular)) $(dtbs_overlays) + + endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL + +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 9f06f6aaf7fc..67a7b73b6688 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -394,15 +394,21 @@ quiet_cmd_wrap_S_dtb = WRAP $@ + echo '.balign STRUCT_ALIGNMENT'; \ + } > $@ + ++quiet_cmd_scr = MKIMAGE $@ ++cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ ++ + $(obj)/%.dtb.S: $(obj)/%.dtb FORCE + $(call if_changed,wrap_S_dtb) + + $(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE + $(call if_changed,wrap_S_dtb) + ++$(obj)/%.scr: $(src)/%.scr-cmd FORCE ++ $(call if_changed,scr) ++ + quiet_cmd_dtc = DTC $@ + cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ +- $(DTC) -o $@ -b 0 \ ++ $(DTC) -@ -o $@ -b 0 \ + $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) +-- +2.34.1 + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch new file mode 100644 index 000000000000..895edaddbfbf --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-overlay-configfs.patch @@ -0,0 +1,419 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Pantelis Antoniou +Date: Wed, 3 Dec 2014 13:23:28 +0200 +Subject: OF: DT-Overlay configfs interface + +This is a port of Pantelis Antoniou's v3 port that makes use of the +new upstreamed configfs support for binary attributes. + +Original commit message: + +Add a runtime interface to using configfs for generic device tree overlay +usage. With it its possible to use device tree overlays without having +to use a per-platform overlay manager. + +Please see Documentation/devicetree/configfs-overlays.txt for more info. + +Changes since v2: +- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) +- Created a documentation entry +- Slight rewording in Kconfig + +Changes since v1: +- of_resolve() -> of_resolve_phandles(). + +Originally-signed-off-by: Pantelis Antoniou +Signed-off-by: Phil Elwell + +DT configfs: Fix build errors on other platforms + +Signed-off-by: Phil Elwell + +DT configfs: fix build error + +There is an error when compiling rpi-4.6.y branch: + CC drivers/of/configfs.o +drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] + .default_groups = of_cfs_def_groups, + ^ +drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next') + +The .default_groups is linked list since commit +1ae1602de028acaa42a0f6ff18d19756f8e825c6. +This commit uses configfs_add_default_group to fix this problem. + +Signed-off-by: Slawomir Stepien + +configfs: New of_overlay API + +of: configfs: Use of_overlay_fdt_apply API call + +The published API to the dynamic overlay application mechanism now +takes a Flattened Device Tree blob as input so that it can manage the +lifetime of the unflattened tree. Conveniently, the new API call - +of_overlay_fdt_apply - is virtually a drop-in replacement for +create_overlay, which can now be deleted. + +Signed-off-by: Phil Elwell +--- + Documentation/devicetree/configfs-overlays.txt | 31 ++ + drivers/of/Kconfig | 11 + + drivers/of/Makefile | 1 + + drivers/of/configfs.c | 277 ++++++++++ + 4 files changed, 320 insertions(+) + +diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt +new file mode 100644 +index 000000000000..5fa43e064307 +--- /dev/null ++++ b/Documentation/devicetree/configfs-overlays.txt +@@ -0,0 +1,31 @@ ++Howto use the configfs overlay interface. ++ ++A device-tree configfs entry is created in /config/device-tree/overlays ++and and it is manipulated using standard file system I/O. ++Note that this is a debug level interface, for use by developers and ++not necessarily something accessed by normal users due to the ++security implications of having direct access to the kernel's device tree. ++ ++* To create an overlay you mkdir the directory: ++ ++ # mkdir /config/device-tree/overlays/foo ++ ++* Either you echo the overlay firmware file to the path property file. ++ ++ # echo foo.dtbo >/config/device-tree/overlays/foo/path ++ ++* Or you cat the contents of the overlay to the dtbo file ++ ++ # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo ++ ++The overlay file will be applied, and devices will be created/destroyed ++as required. ++ ++To remove it simply rmdir the directory. ++ ++ # rmdir /config/device-tree/overlays/foo ++ ++The rationalle of the dual interface (firmware & direct copy) is that each is ++better suited to different use patterns. The firmware interface is what's ++intended to be used by hardware managers in the kernel, while the copy interface ++make sense for developers (since it avoids problems with namespaces). +diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig +index da9826accb1b..69e7c420b8f4 100644 +--- a/drivers/of/Kconfig ++++ b/drivers/of/Kconfig +@@ -102,4 +102,15 @@ config OF_OVERLAY + config OF_NUMA + bool + ++config OF_DMA_DEFAULT_COHERENT ++ # arches should select this if DMA is coherent by default for OF devices ++ bool ++ ++config OF_CONFIGFS ++ bool "Device Tree Overlay ConfigFS interface" ++ select CONFIGFS_FS ++ select OF_OVERLAY ++ help ++ Enable a simple user-space driven DT overlay interface. ++ + endif # OF +diff --git a/drivers/of/Makefile b/drivers/of/Makefile +index eff624854575..61bd05f08ca1 100644 +--- a/drivers/of/Makefile ++++ b/drivers/of/Makefile +@@ -1,6 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + obj-y = base.o cpu.o device.o module.o platform.o property.o + obj-$(CONFIG_OF_KOBJ) += kobj.o ++obj-$(CONFIG_OF_CONFIGFS) += configfs.o + obj-$(CONFIG_OF_DYNAMIC) += dynamic.o + obj-$(CONFIG_OF_FLATTREE) += fdt.o + obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o +diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c +new file mode 100644 +index 000000000000..1c30f35c3ca1 +--- /dev/null ++++ b/drivers/of/configfs.c +@@ -0,0 +1,277 @@ ++/* ++ * Configfs entries for device-tree ++ * ++ * Copyright (C) 2013 - Pantelis Antoniou ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "of_private.h" ++ ++struct cfs_overlay_item { ++ struct config_item item; ++ ++ char path[PATH_MAX]; ++ ++ const struct firmware *fw; ++ struct device_node *overlay; ++ int ov_id; ++ ++ void *dtbo; ++ int dtbo_size; ++}; ++ ++static inline struct cfs_overlay_item *to_cfs_overlay_item( ++ struct config_item *item) ++{ ++ return item ? container_of(item, struct cfs_overlay_item, item) : NULL; ++} ++ ++static ssize_t cfs_overlay_item_path_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ return sprintf(page, "%s\n", overlay->path); ++} ++ ++static ssize_t cfs_overlay_item_path_store(struct config_item *item, ++ const char *page, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ const char *p = page; ++ char *s; ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy to path buffer (and make sure it's always zero terminated */ ++ count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p); ++ overlay->path[sizeof(overlay->path) - 1] = '\0'; ++ ++ /* strip trailing newlines */ ++ s = overlay->path + strlen(overlay->path); ++ while (s > overlay->path && *--s == '\n') ++ *s = '\0'; ++ ++ pr_debug("%s: path is '%s'\n", __func__, overlay->path); ++ ++ err = request_firmware(&overlay->fw, overlay->path, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ err = of_overlay_fdt_apply((void *)overlay->fw->data, ++ (u32)overlay->fw->size, &overlay->ov_id, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ ++ release_firmware(overlay->fw); ++ overlay->fw = NULL; ++ ++ overlay->path[0] = '\0'; ++ return err; ++} ++ ++static ssize_t cfs_overlay_item_status_show(struct config_item *item, ++ char *page) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ return sprintf(page, "%s\n", ++ overlay->ov_id > 0 ? "applied" : "unapplied"); ++} ++ ++CONFIGFS_ATTR(cfs_overlay_item_, path); ++CONFIGFS_ATTR_RO(cfs_overlay_item_, status); ++ ++static struct configfs_attribute *cfs_overlay_attrs[] = { ++ &cfs_overlay_item_attr_path, ++ &cfs_overlay_item_attr_status, ++ NULL, ++}; ++ ++ssize_t cfs_overlay_item_dtbo_read(struct config_item *item, ++ void *buf, size_t max_count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ pr_debug("%s: buf=%p max_count=%zu\n", __func__, ++ buf, max_count); ++ ++ if (overlay->dtbo == NULL) ++ return 0; ++ ++ /* copy if buffer provided */ ++ if (buf != NULL) { ++ /* the buffer must be large enough */ ++ if (overlay->dtbo_size > max_count) ++ return -ENOSPC; ++ ++ memcpy(buf, overlay->dtbo, overlay->dtbo_size); ++ } ++ ++ return overlay->dtbo_size; ++} ++ ++ssize_t cfs_overlay_item_dtbo_write(struct config_item *item, ++ const void *buf, size_t count) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ int err; ++ ++ /* if it's set do not allow changes */ ++ if (overlay->path[0] != '\0' || overlay->dtbo_size > 0) ++ return -EPERM; ++ ++ /* copy the contents */ ++ overlay->dtbo = kmemdup(buf, count, GFP_KERNEL); ++ if (overlay->dtbo == NULL) ++ return -ENOMEM; ++ ++ overlay->dtbo_size = count; ++ ++ err = of_overlay_fdt_apply(overlay->dtbo, overlay->dtbo_size, ++ &overlay->ov_id, NULL); ++ if (err != 0) ++ goto out_err; ++ ++ return count; ++ ++out_err: ++ kfree(overlay->dtbo); ++ overlay->dtbo = NULL; ++ overlay->dtbo_size = 0; ++ overlay->ov_id = 0; ++ ++ return err; ++} ++ ++CONFIGFS_BIN_ATTR(cfs_overlay_item_, dtbo, NULL, SZ_1M); ++ ++static struct configfs_bin_attribute *cfs_overlay_bin_attrs[] = { ++ &cfs_overlay_item_attr_dtbo, ++ NULL, ++}; ++ ++static void cfs_overlay_release(struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ if (overlay->ov_id > 0) ++ of_overlay_remove(&overlay->ov_id); ++ if (overlay->fw) ++ release_firmware(overlay->fw); ++ /* kfree with NULL is safe */ ++ kfree(overlay->dtbo); ++ kfree(overlay); ++} ++ ++static struct configfs_item_operations cfs_overlay_item_ops = { ++ .release = cfs_overlay_release, ++}; ++ ++static struct config_item_type cfs_overlay_type = { ++ .ct_item_ops = &cfs_overlay_item_ops, ++ .ct_attrs = cfs_overlay_attrs, ++ .ct_bin_attrs = cfs_overlay_bin_attrs, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct config_item *cfs_overlay_group_make_item( ++ struct config_group *group, const char *name) ++{ ++ struct cfs_overlay_item *overlay; ++ ++ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); ++ if (!overlay) ++ return ERR_PTR(-ENOMEM); ++ ++ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type); ++ return &overlay->item; ++} ++ ++static void cfs_overlay_group_drop_item(struct config_group *group, ++ struct config_item *item) ++{ ++ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item); ++ ++ config_item_put(&overlay->item); ++} ++ ++static struct configfs_group_operations overlays_ops = { ++ .make_item = cfs_overlay_group_make_item, ++ .drop_item = cfs_overlay_group_drop_item, ++}; ++ ++static struct config_item_type overlays_type = { ++ .ct_group_ops = &overlays_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++static struct configfs_group_operations of_cfs_ops = { ++ /* empty - we don't allow anything to be created */ ++}; ++ ++static struct config_item_type of_cfs_type = { ++ .ct_group_ops = &of_cfs_ops, ++ .ct_owner = THIS_MODULE, ++}; ++ ++struct config_group of_cfs_overlay_group; ++ ++static struct configfs_subsystem of_cfs_subsys = { ++ .su_group = { ++ .cg_item = { ++ .ci_namebuf = "device-tree", ++ .ci_type = &of_cfs_type, ++ }, ++ }, ++ .su_mutex = __MUTEX_INITIALIZER(of_cfs_subsys.su_mutex), ++}; ++ ++static int __init of_cfs_init(void) ++{ ++ int ret; ++ ++ pr_info("%s\n", __func__); ++ ++ config_group_init(&of_cfs_subsys.su_group); ++ config_group_init_type_name(&of_cfs_overlay_group, "overlays", ++ &overlays_type); ++ configfs_add_default_group(&of_cfs_overlay_group, ++ &of_cfs_subsys.su_group); ++ ++ ret = configfs_register_subsystem(&of_cfs_subsys); ++ if (ret != 0) { ++ pr_err("%s: failed to register subsys\n", __func__); ++ goto out; ++ } ++ pr_info("%s: OK\n", __func__); ++out: ++ return ret; ++} ++late_initcall(of_cfs_init); +-- +Armbian + diff --git a/patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch b/patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch new file mode 100644 index 000000000000..536acee59be8 --- /dev/null +++ b/patch/kernel/archive/rockchip64-6.10/general-add-panel-simple-dsi.patch @@ -0,0 +1,856 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: simple <991605149@qq.com> +Date: Sun, 12 Sep 2021 20:06:02 +0200 +Subject: [ARCHEOLOGY] general add panel simple dsi (#3140) + +> X-Git-Archeology: > recovered message: > * Backporting patch to 5.10 kernel makes sense. Lets do it. +> X-Git-Archeology: > recovered message: > Co-authored-by: iamdrq +> X-Git-Archeology: > recovered message: > Co-authored-by: Igor Pecovnik +> X-Git-Archeology: - Revision 15819f00e21238e36ca70f6d8445efd6157fbe66: https://github.com/armbian/build/commit/15819f00e21238e36ca70f6d8445efd6157fbe66 +> X-Git-Archeology: Date: Sun, 12 Sep 2021 20:06:02 +0200 +> X-Git-Archeology: From: simple <991605149@qq.com> +> X-Git-Archeology: Subject: general add panel simple dsi (#3140) +> X-Git-Archeology: +> X-Git-Archeology: - Revision dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e: https://github.com/armbian/build/commit/dd51f9f2afcbc83a3e10b32eb6a5061d91d1558e +> X-Git-Archeology: Date: Tue, 09 Nov 2021 18:06:34 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump imx6, xu4, rockchip64 and jetson-nano to 5.15 (#3238) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 6b490e16944b30ff69bf9c13678905187df0d9d4: https://github.com/armbian/build/commit/6b490e16944b30ff69bf9c13678905187df0d9d4 +> X-Git-Archeology: Date: Tue, 11 Jan 2022 15:26:11 +0100 +> X-Git-Archeology: From: Oleg +> X-Git-Archeology: Subject: move kernel edge to 5.16 (#3387) +> X-Git-Archeology: +> X-Git-Archeology: - Revision ac8fc4385594d59257ee9dffd9efa85e3497fa7d: https://github.com/armbian/build/commit/ac8fc4385594d59257ee9dffd9efa85e3497fa7d +> X-Git-Archeology: Date: Sat, 26 Feb 2022 07:46:44 +0100 +> X-Git-Archeology: From: Piotr Szczepanik +> X-Git-Archeology: Subject: Switch rockchip64 current to linux 5.15.y (#3489) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 897674aa74bce0326ed7fe06f5336bf4709a8a1f: https://github.com/armbian/build/commit/897674aa74bce0326ed7fe06f5336bf4709a8a1f +> X-Git-Archeology: Date: Tue, 03 May 2022 08:27:32 +0200 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Bump and freeze kernel at last known working versions (#3736) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 597d2dac11f00d9070a4e49d6bad1b2244e36cb3: https://github.com/armbian/build/commit/597d2dac11f00d9070a4e49d6bad1b2244e36cb3 +> X-Git-Archeology: Date: Sat, 28 May 2022 07:56:22 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64-edge to 5.18 (#3814) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 8c6641e7b79f0d50acdc306d140e586a4e923cf0: https://github.com/armbian/build/commit/8c6641e7b79f0d50acdc306d140e586a4e923cf0 +> X-Git-Archeology: Date: Wed, 03 Aug 2022 22:22:55 +0200 +> X-Git-Archeology: From: Jianfeng Liu +> X-Git-Archeology: Subject: update rockchip64 edge to 5.19 (#4039) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 92f1a22d76b987afa7ba555d5b509adc51d689e7: https://github.com/armbian/build/commit/92f1a22d76b987afa7ba555d5b509adc51d689e7 +> X-Git-Archeology: Date: Fri, 16 Dec 2022 13:38:13 +0100 +> X-Git-Archeology: From: Igor Pecovnik +> X-Git-Archeology: Subject: Re-add rockchip64 6.0 patches (#4575) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 3b78b57fe367e60ad874d9e16ff1cd67957f8382: https://github.com/armbian/build/commit/3b78b57fe367e60ad874d9e16ff1cd67957f8382 +> X-Git-Archeology: Date: Sat, 24 Dec 2022 09:43:51 +0100 +> X-Git-Archeology: From: simple <991605149@qq.com> +> X-Git-Archeology: Subject: Fix general-add-panel-simple-dsi.patch on linux6.1 (#4607) +> X-Git-Archeology: +> X-Git-Archeology: - Revision 34ae84fac5d0b66a1ab2d1e51534b7beb13ef245: https://github.com/armbian/build/commit/34ae84fac5d0b66a1ab2d1e51534b7beb13ef245 +> X-Git-Archeology: Date: Fri, 05 May 2023 14:22:00 +0200 +> X-Git-Archeology: From: amazingfate +> X-Git-Archeology: Subject: bump rockchip64 edge to v6.3 +> X-Git-Archeology: +--- + drivers/gpu/drm/panel/Makefile | 1 + + drivers/gpu/drm/panel/panel-simple-dsi.c | 772 ++++++++++ + 2 files changed, 773 insertions(+) + +diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile +index 433e93d57949..02076386ed5f 100644 +--- a/drivers/gpu/drm/panel/Makefile ++++ b/drivers/gpu/drm/panel/Makefile +@@ -9,6 +9,7 @@ obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o + obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o + obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o + obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o ++obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple-dsi.o + obj-$(CONFIG_DRM_PANEL_EDP) += panel-edp.o + obj-$(CONFIG_DRM_PANEL_EBBG_FT8719) += panel-ebbg-ft8719.o + obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o +diff --git a/drivers/gpu/drm/panel/panel-simple-dsi.c b/drivers/gpu/drm/panel/panel-simple-dsi.c +new file mode 100644 +index 000000000000..e3c8dcf8cb5e +--- /dev/null ++++ b/drivers/gpu/drm/panel/panel-simple-dsi.c +@@ -0,0 +1,772 @@ ++/* ++ * Copyright (C) 2021 ++ * This simple dsi driver porting from rock-chip panel-simple.c on linux-4.4 ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include